tycono 0.1.86 → 0.1.87
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/src/routes/save.ts +2 -2
- package/src/api/src/services/company-config.ts +18 -19
- package/src/web/dist/assets/{index-BNXzWgl4.js → index-LekO2AHi.js} +3 -3
- package/src/web/dist/assets/{preview-app-BfUkkjCs.js → preview-app-COzv8nuC.js} +1 -1
- package/src/web/dist/index.html +1 -1
|
@@ -47,7 +47,7 @@ var fw=Object.defineProperty;var hw=(e,n,a)=>n in e?fw(e,n,{enumerable:!0,config
|
|
|
47
47
|
Error generating stack: `+c.message+`
|
|
48
48
|
`+c.stack}}var Wt=Object.prototype.hasOwnProperty,Tt=e.unstable_scheduleCallback,Ct=e.unstable_cancelCallback,Bn=e.unstable_shouldYield,pe=e.unstable_requestPaint,Se=e.unstable_now,Ne=e.unstable_getCurrentPriorityLevel,G=e.unstable_ImmediatePriority,ce=e.unstable_UserBlockingPriority,re=e.unstable_NormalPriority,ve=e.unstable_LowPriority,we=e.unstable_IdlePriority,Me=e.log,ze=e.unstable_setDisableYieldValue,Oe=null,qe=null;function lt(t){if(typeof Me=="function"&&ze(t),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(Oe,t)}catch{}}var Qe=Math.clz32?Math.clz32:Ue,bt=Math.log,Re=Math.LN2;function Ue(t){return t>>>=0,t===0?32:31-(bt(t)/Re|0)|0}var _t=256,Bt=262144,Ot=4194304;function un(t){var r=t&42;if(r!==0)return r;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function kn(t,r,s){var c=t.pendingLanes;if(c===0)return 0;var p=0,y=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var z=c&134217727;return z!==0?(c=z&~y,c!==0?p=un(c):(S&=z,S!==0?p=un(S):s||(s=z&~t,s!==0&&(p=un(s))))):(z=c&~y,z!==0?p=un(z):S!==0?p=un(S):s||(s=c&~t,s!==0&&(p=un(s)))),p===0?0:r!==0&&r!==p&&(r&y)===0&&(y=p&-p,s=r&-r,y>=s||y===32&&(s&4194048)!==0)?r:p}function Z(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function $e(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 at(){var t=Ot;return Ot<<=1,(Ot&62914560)===0&&(Ot=4194304),t}function Kt(t){for(var r=[],s=0;31>s;s++)r.push(t);return r}function ke(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function kt(t,r,s,c,p,y){var S=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var z=t.entanglements,W=t.expirationTimes,ie=t.hiddenUpdates;for(s=S&~s;0<s;){var xe=31-Qe(s),Ce=1<<xe;z[xe]=0,W[xe]=-1;var oe=ie[xe];if(oe!==null)for(ie[xe]=null,xe=0;xe<oe.length;xe++){var fe=oe[xe];fe!==null&&(fe.lane&=-536870913)}s&=~Ce}c!==0&&jn(t,c,0),y!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=y&~(S&~r))}function jn(t,r,s){t.pendingLanes|=r,t.suspendedLanes&=~r;var c=31-Qe(r);t.entangledLanes|=r,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function hn(t,r){var s=t.entangledLanes|=r;for(t=t.entanglements;s;){var c=31-Qe(s),p=1<<c;p&r|t[c]&r&&(t[c]|=r),s&=~p}}function te(t,r){var s=r&-r;return s=(s&42)!==0?1:_e(s),(s&(t.suspendedLanes|r))!==0?0:s}function _e(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function We(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ze(){var t=se.p;return t!==0?t:(t=window.event,t===void 0?32:x0(t.type))}function Sn(t,r){var s=se.p;try{return se.p=t,r()}finally{se.p=s}}var Wn=Math.random().toString(36).slice(2),yn="__reactFiber$"+Wn,mn="__reactProps$"+Wn,$r="__reactContainer$"+Wn,Ql="__reactEvents$"+Wn,Ds="__reactListeners$"+Wn,Fi="__reactHandles$"+Wn,Go="__reactResources$"+Wn,Fa="__reactMarker$"+Wn;function Ts(t){delete t[yn],delete t[mn],delete t[Ql],delete t[Ds],delete t[Fi]}function ca(t){var r=t[yn];if(r)return r;for(var s=t.parentNode;s;){if(r=s[$r]||s[yn]){if(s=r.alternate,r.child!==null||s!==null&&s.child!==null)for(t=e0(t);t!==null;){if(s=t[yn])return s;t=e0(t)}return r}t=s,s=t.parentNode}return null}function Ra(t){if(t=t[yn]||t[$r]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function Ma(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function Vn(t){var r=t[Go];return r||(r=t[Go]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Dn(t){t[Fa]=!0}var za=new Set,Ri={};function fr(t,r){jr(t,r),jr(t+"Capture",r)}function jr(t,r){for(Ri[t]=r,t=0;t<r.length;t++)za.add(r[t])}var ol=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]*$"),Fs={},_a={};function Ko(t){return Wt.call(_a,t)?!0:Wt.call(Fs,t)?!1:ol.test(t)?_a[t]=!0:(Fs[t]=!0,!1)}function Zl(t,r,s){if(Ko(r))if(s===null)t.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+s)}}function cl(t,r,s){if(s===null)t.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+s)}}function Lr(t,r,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(r,s,""+c)}}function lr(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Po(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Ba(t,r,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,y=c.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return p.call(this)},set:function(S){s=""+S,y.call(this,S)}}),Object.defineProperty(t,r,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Sr(t){if(!t._valueTracker){var r=Po(t)?"checked":"value";t._valueTracker=Ba(t,r,""+t[r])}}function Ir(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var s=r.getValue(),c="";return t&&(c=Po(t)?t.checked?"true":"false":t.value),t=c,t!==s?(r.setValue(t),!0):!1}function Cr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var ea=/[\n"\\]/g;function Pt(t){return t.replace(ea,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Mi(t,r,s,c,p,y,S,z){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),r!=null?S==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+lr(r)):t.value!==""+lr(r)&&(t.value=""+lr(r)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),r!=null?Jl(t,S,lr(r)):s!=null?Jl(t,S,lr(s)):c!=null&&t.removeAttribute("value"),p==null&&y!=null&&(t.defaultChecked=!!y),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?t.name=""+lr(z):t.removeAttribute("name")}function Qo(t,r,s,c,p,y,S,z){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||s!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Sr(t);return}s=s!=null?""+lr(s):"",r=r!=null?""+lr(r):s,z||r===t.value||(t.value=r),t.defaultValue=r}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=z?t.checked:!!c,t.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),Sr(t)}function Jl(t,r,s){r==="number"&&Cr(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Gn(t,r,s,c){if(t=t.options,r){r={};for(var p=0;p<s.length;p++)r["$"+s[p]]=!0;for(s=0;s<t.length;s++)p=r.hasOwnProperty("$"+t[s].value),t[s].selected!==p&&(t[s].selected=p),p&&c&&(t[s].defaultSelected=!0)}else{for(s=""+lr(s),r=null,p=0;p<t.length;p++){if(t[p].value===s){t[p].selected=!0,c&&(t[p].defaultSelected=!0);return}r!==null||t[p].disabled||(r=t[p])}r!==null&&(r.selected=!0)}}function Oa(t,r,s){if(r!=null&&(r=""+lr(r),r!==t.value&&(t.value=r),s==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=s!=null?""+lr(s):""}function ua(t,r,s,c){if(r==null){if(c!=null){if(s!=null)throw Error(i(92));if(K(c)){if(1<c.length)throw Error(i(93));c=c[0]}s=c}s==null&&(s=""),r=s}s=lr(r),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),Sr(t)}function ul(t,r){if(r){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=r;return}}t.textContent=r}var Un=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 an(t,r,s){var c=r.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":c?t.setProperty(r,s):typeof s!="number"||s===0||Un.has(r)?r==="float"?t.cssFloat=s:t[r]=(""+s).trim():t[r]=s+"px"}function ta(t,r,s){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var p in r)c=r[p],r.hasOwnProperty(p)&&s[p]!==c&&an(t,p,c)}else for(var y in r)r.hasOwnProperty(y)&&an(t,y,r[y])}function qn(t){if(t.indexOf("-")===-1)return!1;switch(t){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 da=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"]]),$a=/^[\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 zi(t){return $a.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function hr(){}var _i=null;function fa(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var mr=null,La=null;function Rs(t){var r=Ra(t);if(r&&(t=r.stateNode)){var s=t[mn]||null;e:switch(t=r.stateNode,r.type){case"input":if(Mi(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),r=s.name,s.type==="radio"&&r!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Pt(""+r)+'"][type="radio"]'),r=0;r<s.length;r++){var c=s[r];if(c!==t&&c.form===t.form){var p=c[mn]||null;if(!p)throw Error(i(90));Mi(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<s.length;r++)c=s[r],c.form===t.form&&Ir(c)}break e;case"textarea":Oa(t,s.value,s.defaultValue);break e;case"select":r=s.value,r!=null&&Gn(t,!!s.multiple,r,!1)}}}var Kn=!1;function dl(t,r,s){if(Kn)return t(r,s);Kn=!0;try{var c=t(r);return c}finally{if(Kn=!1,(mr!==null||La!==null)&&(Vc(),mr&&(r=mr,t=La,La=mr=null,Rs(r),t)))for(r=0;r<t.length;r++)Rs(t[r])}}function ha(t,r){var s=t.stateNode;if(s===null)return null;var c=s[mn]||null;if(c===null)return null;s=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(i(231,r,typeof s));return s}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ms=!1;if(na)try{var Et={};Object.defineProperty(Et,"passive",{get:function(){Ms=!0}}),window.addEventListener("test",Et,Et),window.removeEventListener("test",Et,Et)}catch{Ms=!1}var ma=null,ln=null,fl=null;function hl(){if(fl)return fl;var t,r=ln,s=r.length,c,p="value"in ma?ma.value:ma.textContent,y=p.length;for(t=0;t<s&&r[t]===p[t];t++);var S=s-t;for(c=1;c<=S&&r[s-c]===p[y-c];c++);return fl=p.slice(t,1<c?1-c:void 0)}function Bi(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function pa(){return!0}function Zo(){return!1}function Yn(t){function r(s,c,p,y,S){this._reactName=s,this._targetInst=p,this.type=c,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var z in t)t.hasOwnProperty(z)&&(s=t[z],this[z]=s?s(y):y[z]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?pa:Zo,this.isPropagationStopped=Zo,this}return g(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=pa)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),r}var ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ml=Yn(ir),ei=g({},ir,{view:0,detail:0}),rd=Yn(ei),ti,zs,pl,ni=g({},ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$i,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==pl&&(pl&&t.type==="mousemove"?(ti=t.screenX-pl.screenX,zs=t.screenY-pl.screenY):zs=ti=0,pl=t),ti)},movementY:function(t){return"movementY"in t?t.movementY:zs}}),Jo=Yn(ni),ec=g({},ni,{dataTransfer:0}),tc=Yn(ec),nc=g({},ei,{relatedTarget:0}),Hr=Yn(nc),Ia=g({},ir,{animationName:0,elapsedTime:0,pseudoElement:0}),_s=Yn(Ia),ad=g({},ir,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),rc=Yn(ad),ac=g({},ir,{data:0}),lc=Yn(ac),ic={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jt={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"},Oi={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sc(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=Oi[t])?!!r[t]:!1}function $i(){return sc}var oc=g({},ei,{key:function(t){if(t.key){var r=ic[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Bi(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Jt[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$i,charCode:function(t){return t.type==="keypress"?Bi(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Bi(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),cc=Yn(oc),uc=g({},ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bs=Yn(uc),dc=g({},ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$i}),F=Yn(dc),P=g({},ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),ae=Yn(P),me=g({},ni,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),je=Yn(me),Le=g({},ir,{newState:0,oldState:0}),It=Yn(Le),ft=[9,13,27,32],tt=na&&"CompositionEvent"in window,Pe=null;na&&"documentMode"in document&&(Pe=document.documentMode);var mt=na&&"TextEvent"in window&&!Pe,Ft=na&&(!tt||Pe&&8<Pe&&11>=Pe),xl=" ",sr=!1;function ct(t,r){switch(t){case"keyup":return ft.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $t(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var pn=!1;function dn(t,r){switch(t){case"compositionend":return $t(r);case"keypress":return r.which!==32?null:(sr=!0,xl);case"textInput":return t=r.data,t===xl&&sr?null:t;default:return null}}function Ov(t,r){if(pn)return t==="compositionend"||!tt&&ct(t,r)?(t=hl(),fl=ln=ma=null,pn=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Ft&&r.locale!=="ko"?null:r.data;default:return null}}var $v={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 rp(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!$v[t.type]:r==="textarea"}function ap(t,r,s,c){mr?La?La.push(c):La=[c]:mr=c,r=eu(r,"onChange"),0<r.length&&(s=new ml("onChange","change",null,s,c),t.push({event:s,listeners:r}))}var Os=null,$s=null;function Lv(t){I1(t,0)}function fc(t){var r=Ma(t);if(Ir(r))return t}function lp(t,r){if(t==="change")return r}var ip=!1;if(na){var ld;if(na){var id="oninput"in document;if(!id){var sp=document.createElement("div");sp.setAttribute("oninput","return;"),id=typeof sp.oninput=="function"}ld=id}else ld=!1;ip=ld&&(!document.documentMode||9<document.documentMode)}function op(){Os&&(Os.detachEvent("onpropertychange",cp),$s=Os=null)}function cp(t){if(t.propertyName==="value"&&fc($s)){var r=[];ap(r,$s,t,fa(t)),dl(Lv,r)}}function Iv(t,r,s){t==="focusin"?(op(),Os=r,$s=s,Os.attachEvent("onpropertychange",cp)):t==="focusout"&&op()}function Hv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return fc($s)}function Uv(t,r){if(t==="click")return fc(r)}function qv(t,r){if(t==="input"||t==="change")return fc(r)}function Yv(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var Er=typeof Object.is=="function"?Object.is:Yv;function Ls(t,r){if(Er(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var s=Object.keys(t),c=Object.keys(r);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var p=s[c];if(!Wt.call(r,p)||!Er(t[p],r[p]))return!1}return!0}function up(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dp(t,r){var s=up(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=r&&c>=r)return{node:s,offset:r-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=up(s)}}function fp(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?fp(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function hp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Cr(t.document);r instanceof t.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)t=r.contentWindow;else break;r=Cr(t.document)}return r}function sd(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var Xv=na&&"documentMode"in document&&11>=document.documentMode,Li=null,od=null,Is=null,cd=!1;function mp(t,r,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;cd||Li==null||Li!==Cr(c)||(c=Li,"selectionStart"in c&&sd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Is&&Ls(Is,c)||(Is=c,c=eu(od,"onSelect"),0<c.length&&(r=new ml("onSelect","select",null,r,s),t.push({event:r,listeners:c}),r.target=Li)))}function ri(t,r){var s={};return s[t.toLowerCase()]=r.toLowerCase(),s["Webkit"+t]="webkit"+r,s["Moz"+t]="moz"+r,s}var Ii={animationend:ri("Animation","AnimationEnd"),animationiteration:ri("Animation","AnimationIteration"),animationstart:ri("Animation","AnimationStart"),transitionrun:ri("Transition","TransitionRun"),transitionstart:ri("Transition","TransitionStart"),transitioncancel:ri("Transition","TransitionCancel"),transitionend:ri("Transition","TransitionEnd")},ud={},pp={};na&&(pp=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function ai(t){if(ud[t])return ud[t];if(!Ii[t])return t;var r=Ii[t],s;for(s in r)if(r.hasOwnProperty(s)&&s in pp)return ud[t]=r[s];return t}var xp=ai("animationend"),gp=ai("animationiteration"),yp=ai("animationstart"),Wv=ai("transitionrun"),Vv=ai("transitionstart"),Gv=ai("transitioncancel"),bp=ai("transitionend"),vp=new Map,dd="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(" ");dd.push("scrollEnd");function ra(t,r){vp.set(t,r),fr(r,[t])}var hc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Ur=[],Hi=0,fd=0;function mc(){for(var t=Hi,r=fd=Hi=0;r<t;){var s=Ur[r];Ur[r++]=null;var c=Ur[r];Ur[r++]=null;var p=Ur[r];Ur[r++]=null;var y=Ur[r];if(Ur[r++]=null,c!==null&&p!==null){var S=c.pending;S===null?p.next=p:(p.next=S.next,S.next=p),c.pending=p}y!==0&&wp(s,p,y)}}function pc(t,r,s,c){Ur[Hi++]=t,Ur[Hi++]=r,Ur[Hi++]=s,Ur[Hi++]=c,fd|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function hd(t,r,s,c){return pc(t,r,s,c),xc(t)}function li(t,r){return pc(t,null,null,r),xc(t)}function wp(t,r,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var p=!1,y=t.return;y!==null;)y.childLanes|=s,c=y.alternate,c!==null&&(c.childLanes|=s),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(p=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,p&&r!==null&&(p=31-Qe(s),t=y.hiddenUpdates,c=t[p],c===null?t[p]=[r]:c.push(r),r.lane=s|536870912),y):null}function xc(t){if(50<oo)throw oo=0,jf=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var Ui={};function Kv(t,r,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(t,r,s,c){return new Kv(t,r,s,c)}function md(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ha(t,r){var s=t.alternate;return s===null?(s=Nr(t.tag,r,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=r,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,r=t.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function kp(t,r){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,r=s.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function gc(t,r,s,c,p,y){var S=0;if(c=t,typeof t=="function")md(t)&&(S=1);else if(typeof t=="string")S=ew(t,s,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case J:return t=Nr(31,s,r,p),t.elementType=J,t.lanes=y,t;case k:return ii(s.children,p,y,r);case N:S=8,p|=24;break;case E:return t=Nr(12,s,r,p|2),t.elementType=E,t.lanes=y,t;case L:return t=Nr(13,s,r,p),t.elementType=L,t.lanes=y,t;case R:return t=Nr(19,s,r,p),t.elementType=R,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:S=10;break e;case C:S=9;break e;case M:S=11;break e;case I:S=14;break e;case X:S=16,c=null;break e}S=29,s=Error(i(130,t===null?"null":typeof t,"")),c=null}return r=Nr(S,s,r,p),r.elementType=t,r.type=c,r.lanes=y,r}function ii(t,r,s,c){return t=Nr(7,t,c,r),t.lanes=s,t}function pd(t,r,s){return t=Nr(6,t,null,r),t.lanes=s,t}function jp(t){var r=Nr(18,null,null,0);return r.stateNode=t,r}function xd(t,r,s){return r=Nr(4,t.children!==null?t.children:[],t.key,r),r.lanes=s,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var Sp=new WeakMap;function qr(t,r){if(typeof t=="object"&&t!==null){var s=Sp.get(t);return s!==void 0?s:(r={value:t,source:r,stack:jt(r)},Sp.set(t,r),r)}return{value:t,source:r,stack:jt(r)}}var qi=[],Yi=0,yc=null,Hs=0,Yr=[],Xr=0,gl=null,xa=1,ga="";function Ua(t,r){qi[Yi++]=Hs,qi[Yi++]=yc,yc=t,Hs=r}function Cp(t,r,s){Yr[Xr++]=xa,Yr[Xr++]=ga,Yr[Xr++]=gl,gl=t;var c=xa;t=ga;var p=32-Qe(c)-1;c&=~(1<<p),s+=1;var y=32-Qe(r)+p;if(30<y){var S=p-p%5;y=(c&(1<<S)-1).toString(32),c>>=S,p-=S,xa=1<<32-Qe(r)+p|s<<p|c,ga=y+t}else xa=1<<y|s<<p|c,ga=t}function gd(t){t.return!==null&&(Ua(t,1),Cp(t,1,0))}function yd(t){for(;t===yc;)yc=qi[--Yi],qi[Yi]=null,Hs=qi[--Yi],qi[Yi]=null;for(;t===gl;)gl=Yr[--Xr],Yr[Xr]=null,ga=Yr[--Xr],Yr[Xr]=null,xa=Yr[--Xr],Yr[Xr]=null}function Ep(t,r){Yr[Xr++]=xa,Yr[Xr++]=ga,Yr[Xr++]=gl,xa=r.id,ga=r.overflow,gl=t}var Pn=null,xn=null,Lt=!1,yl=null,Wr=!1,bd=Error(i(519));function bl(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Us(qr(r,t)),bd}function Np(t){var r=t.stateNode,s=t.type,c=t.memoizedProps;switch(r[yn]=t,r[mn]=c,s){case"dialog":At("cancel",r),At("close",r);break;case"iframe":case"object":case"embed":At("load",r);break;case"video":case"audio":for(s=0;s<uo.length;s++)At(uo[s],r);break;case"source":At("error",r);break;case"img":case"image":case"link":At("error",r),At("load",r);break;case"details":At("toggle",r);break;case"input":At("invalid",r),Qo(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":At("invalid",r);break;case"textarea":At("invalid",r),ua(r,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||r.textContent===""+s||c.suppressHydrationWarning===!0||Y1(r.textContent,s)?(c.popover!=null&&(At("beforetoggle",r),At("toggle",r)),c.onScroll!=null&&At("scroll",r),c.onScrollEnd!=null&&At("scrollend",r),c.onClick!=null&&(r.onclick=hr),r=!0):r=!1,r||bl(t,!0)}function Ap(t){for(Pn=t.return;Pn;)switch(Pn.tag){case 5:case 31:case 13:Wr=!1;return;case 27:case 3:Wr=!0;return;default:Pn=Pn.return}}function Xi(t){if(t!==Pn)return!1;if(!Lt)return Ap(t),Lt=!0,!1;var r=t.tag,s;if((s=r!==3&&r!==27)&&((s=r===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||$f(t.type,t.memoizedProps)),s=!s),s&&xn&&bl(t),Ap(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));xn=J1(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));xn=J1(t)}else r===27?(r=xn,Ml(t.type)?(t=qf,qf=null,xn=t):xn=r):xn=Pn?Gr(t.stateNode.nextSibling):null;return!0}function si(){xn=Pn=null,Lt=!1}function vd(){var t=yl;return t!==null&&(yr===null?yr=t:yr.push.apply(yr,t),yl=null),t}function Us(t){yl===null?yl=[t]:yl.push(t)}var wd=B(null),oi=null,qa=null;function vl(t,r,s){T(wd,r._currentValue),r._currentValue=s}function Ya(t){t._currentValue=wd.current,H(wd)}function kd(t,r,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),t===s)break;t=t.return}}function jd(t,r,s,c){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var y=p.dependencies;if(y!==null){var S=p.child;y=y.firstContext;e:for(;y!==null;){var z=y;y=p;for(var W=0;W<r.length;W++)if(z.context===r[W]){y.lanes|=s,z=y.alternate,z!==null&&(z.lanes|=s),kd(y.return,s,t),c||(S=null);break e}y=z.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(i(341));S.lanes|=s,y=S.alternate,y!==null&&(y.lanes|=s),kd(S,s,t),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===t){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function Wi(t,r,s,c){t=null;for(var p=r,y=!1;p!==null;){if(!y){if((p.flags&524288)!==0)y=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var z=p.type;Er(p.pendingProps.value,S.value)||(t!==null?t.push(z):t=[z])}}else if(p===Be.current){if(S=p.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(xo):t=[xo])}p=p.return}t!==null&&jd(r,t,s,c),r.flags|=262144}function bc(t){for(t=t.firstContext;t!==null;){if(!Er(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ci(t){oi=t,qa=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qn(t){return Dp(oi,t)}function vc(t,r){return oi===null&&ci(t),Dp(t,r)}function Dp(t,r){var s=r._currentValue;if(r={context:r,memoizedValue:s,next:null},qa===null){if(t===null)throw Error(i(308));qa=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else qa=qa.next=r;return s}var Pv=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){r.aborted=!0,t.forEach(function(s){return s()})}},Qv=e.unstable_scheduleCallback,Zv=e.unstable_NormalPriority,Tn={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sd(){return{controller:new Pv,data:new Map,refCount:0}}function qs(t){t.refCount--,t.refCount===0&&Qv(Zv,function(){t.controller.abort()})}var Ys=null,Cd=0,Vi=0,Gi=null;function Jv(t,r){if(Ys===null){var s=Ys=[];Cd=0,Vi=Df(),Gi={status:"pending",value:void 0,then:function(c){s.push(c)}}}return Cd++,r.then(Tp,Tp),r}function Tp(){if(--Cd===0&&Ys!==null){Gi!==null&&(Gi.status="fulfilled");var t=Ys;Ys=null,Vi=0,Gi=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function e2(t,r){var s=[],c={status:"pending",value:null,reason:null,then:function(p){s.push(p)}};return t.then(function(){c.status="fulfilled",c.value=r;for(var p=0;p<s.length;p++)(0,s[p])(r)},function(p){for(c.status="rejected",c.reason=p,p=0;p<s.length;p++)(0,s[p])(void 0)}),c}var Fp=q.S;q.S=function(t,r){m1=Se(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&Jv(t,r),Fp!==null&&Fp(t,r)};var ui=B(null);function Ed(){var t=ui.current;return t!==null?t:sn.pooledCache}function wc(t,r){r===null?T(ui,ui.current):T(ui,r.pool)}function Rp(){var t=Ed();return t===null?null:{parent:Tn._currentValue,pool:t}}var Ki=Error(i(460)),Nd=Error(i(474)),kc=Error(i(542)),jc={then:function(){}};function Mp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function zp(t,r,s){switch(s=t[s],s===void 0?t.push(r):s!==r&&(r.then(hr,hr),r=s),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,Bp(t),t;default:if(typeof r.status=="string")r.then(hr,hr);else{if(t=sn,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(c){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=c}},function(c){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,Bp(t),t}throw fi=r,Ki}}function di(t){try{var r=t._init;return r(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(fi=s,Ki):s}}var fi=null;function _p(){if(fi===null)throw Error(i(459));var t=fi;return fi=null,t}function Bp(t){if(t===Ki||t===kc)throw Error(i(483))}var Pi=null,Xs=0;function Sc(t){var r=Xs;return Xs+=1,Pi===null&&(Pi=[]),zp(Pi,t,r)}function Ws(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function Cc(t,r){throw r.$$typeof===v?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function Op(t){function r(ee,Q){if(t){var le=ee.deletions;le===null?(ee.deletions=[Q],ee.flags|=16):le.push(Q)}}function s(ee,Q){if(!t)return null;for(;Q!==null;)r(ee,Q),Q=Q.sibling;return null}function c(ee){for(var Q=new Map;ee!==null;)ee.key!==null?Q.set(ee.key,ee):Q.set(ee.index,ee),ee=ee.sibling;return Q}function p(ee,Q){return ee=Ha(ee,Q),ee.index=0,ee.sibling=null,ee}function y(ee,Q,le){return ee.index=le,t?(le=ee.alternate,le!==null?(le=le.index,le<Q?(ee.flags|=67108866,Q):le):(ee.flags|=67108866,Q)):(ee.flags|=1048576,Q)}function S(ee){return t&&ee.alternate===null&&(ee.flags|=67108866),ee}function z(ee,Q,le,be){return Q===null||Q.tag!==6?(Q=pd(le,ee.mode,be),Q.return=ee,Q):(Q=p(Q,le),Q.return=ee,Q)}function W(ee,Q,le,be){var rt=le.type;return rt===k?xe(ee,Q,le.props.children,be,le.key):Q!==null&&(Q.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===X&&di(rt)===Q.type)?(Q=p(Q,le.props),Ws(Q,le),Q.return=ee,Q):(Q=gc(le.type,le.key,le.props,null,ee.mode,be),Ws(Q,le),Q.return=ee,Q)}function ie(ee,Q,le,be){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==le.containerInfo||Q.stateNode.implementation!==le.implementation?(Q=xd(le,ee.mode,be),Q.return=ee,Q):(Q=p(Q,le.children||[]),Q.return=ee,Q)}function xe(ee,Q,le,be,rt){return Q===null||Q.tag!==7?(Q=ii(le,ee.mode,be,rt),Q.return=ee,Q):(Q=p(Q,le),Q.return=ee,Q)}function Ce(ee,Q,le){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=pd(""+Q,ee.mode,le),Q.return=ee,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return le=gc(Q.type,Q.key,Q.props,null,ee.mode,le),Ws(le,Q),le.return=ee,le;case j:return Q=xd(Q,ee.mode,le),Q.return=ee,Q;case X:return Q=di(Q),Ce(ee,Q,le)}if(K(Q)||U(Q))return Q=ii(Q,ee.mode,le,null),Q.return=ee,Q;if(typeof Q.then=="function")return Ce(ee,Sc(Q),le);if(Q.$$typeof===_)return Ce(ee,vc(ee,Q),le);Cc(ee,Q)}return null}function oe(ee,Q,le,be){var rt=Q!==null?Q.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return rt!==null?null:z(ee,Q,""+le,be);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case b:return le.key===rt?W(ee,Q,le,be):null;case j:return le.key===rt?ie(ee,Q,le,be):null;case X:return le=di(le),oe(ee,Q,le,be)}if(K(le)||U(le))return rt!==null?null:xe(ee,Q,le,be,null);if(typeof le.then=="function")return oe(ee,Q,Sc(le),be);if(le.$$typeof===_)return oe(ee,Q,vc(ee,le),be);Cc(ee,le)}return null}function fe(ee,Q,le,be,rt){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return ee=ee.get(le)||null,z(Q,ee,""+be,rt);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case b:return ee=ee.get(be.key===null?le:be.key)||null,W(Q,ee,be,rt);case j:return ee=ee.get(be.key===null?le:be.key)||null,ie(Q,ee,be,rt);case X:return be=di(be),fe(ee,Q,le,be,rt)}if(K(be)||U(be))return ee=ee.get(le)||null,xe(Q,ee,be,rt,null);if(typeof be.then=="function")return fe(ee,Q,le,Sc(be),rt);if(be.$$typeof===_)return fe(ee,Q,le,vc(Q,be),rt);Cc(Q,be)}return null}function Ye(ee,Q,le,be){for(var rt=null,qt=null,Ge=Q,vt=Q=0,Mt=null;Ge!==null&&vt<le.length;vt++){Ge.index>vt?(Mt=Ge,Ge=null):Mt=Ge.sibling;var Yt=oe(ee,Ge,le[vt],be);if(Yt===null){Ge===null&&(Ge=Mt);break}t&&Ge&&Yt.alternate===null&&r(ee,Ge),Q=y(Yt,Q,vt),qt===null?rt=Yt:qt.sibling=Yt,qt=Yt,Ge=Mt}if(vt===le.length)return s(ee,Ge),Lt&&Ua(ee,vt),rt;if(Ge===null){for(;vt<le.length;vt++)Ge=Ce(ee,le[vt],be),Ge!==null&&(Q=y(Ge,Q,vt),qt===null?rt=Ge:qt.sibling=Ge,qt=Ge);return Lt&&Ua(ee,vt),rt}for(Ge=c(Ge);vt<le.length;vt++)Mt=fe(Ge,ee,vt,le[vt],be),Mt!==null&&(t&&Mt.alternate!==null&&Ge.delete(Mt.key===null?vt:Mt.key),Q=y(Mt,Q,vt),qt===null?rt=Mt:qt.sibling=Mt,qt=Mt);return t&&Ge.forEach(function($l){return r(ee,$l)}),Lt&&Ua(ee,vt),rt}function st(ee,Q,le,be){if(le==null)throw Error(i(151));for(var rt=null,qt=null,Ge=Q,vt=Q=0,Mt=null,Yt=le.next();Ge!==null&&!Yt.done;vt++,Yt=le.next()){Ge.index>vt?(Mt=Ge,Ge=null):Mt=Ge.sibling;var $l=oe(ee,Ge,Yt.value,be);if($l===null){Ge===null&&(Ge=Mt);break}t&&Ge&&$l.alternate===null&&r(ee,Ge),Q=y($l,Q,vt),qt===null?rt=$l:qt.sibling=$l,qt=$l,Ge=Mt}if(Yt.done)return s(ee,Ge),Lt&&Ua(ee,vt),rt;if(Ge===null){for(;!Yt.done;vt++,Yt=le.next())Yt=Ce(ee,Yt.value,be),Yt!==null&&(Q=y(Yt,Q,vt),qt===null?rt=Yt:qt.sibling=Yt,qt=Yt);return Lt&&Ua(ee,vt),rt}for(Ge=c(Ge);!Yt.done;vt++,Yt=le.next())Yt=fe(Ge,ee,vt,Yt.value,be),Yt!==null&&(t&&Yt.alternate!==null&&Ge.delete(Yt.key===null?vt:Yt.key),Q=y(Yt,Q,vt),qt===null?rt=Yt:qt.sibling=Yt,qt=Yt);return t&&Ge.forEach(function(dw){return r(ee,dw)}),Lt&&Ua(ee,vt),rt}function nn(ee,Q,le,be){if(typeof le=="object"&&le!==null&&le.type===k&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case b:e:{for(var rt=le.key;Q!==null;){if(Q.key===rt){if(rt=le.type,rt===k){if(Q.tag===7){s(ee,Q.sibling),be=p(Q,le.props.children),be.return=ee,ee=be;break e}}else if(Q.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===X&&di(rt)===Q.type){s(ee,Q.sibling),be=p(Q,le.props),Ws(be,le),be.return=ee,ee=be;break e}s(ee,Q);break}else r(ee,Q);Q=Q.sibling}le.type===k?(be=ii(le.props.children,ee.mode,be,le.key),be.return=ee,ee=be):(be=gc(le.type,le.key,le.props,null,ee.mode,be),Ws(be,le),be.return=ee,ee=be)}return S(ee);case j:e:{for(rt=le.key;Q!==null;){if(Q.key===rt)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){s(ee,Q.sibling),be=p(Q,le.children||[]),be.return=ee,ee=be;break e}else{s(ee,Q);break}else r(ee,Q);Q=Q.sibling}be=xd(le,ee.mode,be),be.return=ee,ee=be}return S(ee);case X:return le=di(le),nn(ee,Q,le,be)}if(K(le))return Ye(ee,Q,le,be);if(U(le)){if(rt=U(le),typeof rt!="function")throw Error(i(150));return le=rt.call(le),st(ee,Q,le,be)}if(typeof le.then=="function")return nn(ee,Q,Sc(le),be);if(le.$$typeof===_)return nn(ee,Q,vc(ee,le),be);Cc(ee,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,Q!==null&&Q.tag===6?(s(ee,Q.sibling),be=p(Q,le),be.return=ee,ee=be):(s(ee,Q),be=pd(le,ee.mode,be),be.return=ee,ee=be),S(ee)):s(ee,Q)}return function(ee,Q,le,be){try{Xs=0;var rt=nn(ee,Q,le,be);return Pi=null,rt}catch(Ge){if(Ge===Ki||Ge===kc)throw Ge;var qt=Nr(29,Ge,null,ee.mode);return qt.lanes=be,qt.return=ee,qt}finally{}}}var hi=Op(!0),$p=Op(!1),wl=!1;function Ad(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dd(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function kl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function jl(t,r,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Vt&2)!==0){var p=c.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),c.pending=r,r=xc(t),wp(t,null,s),r}return pc(t,c,r,s),xc(t)}function Vs(t,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194048)!==0)){var c=r.lanes;c&=t.pendingLanes,s|=c,r.lanes=s,hn(t,s)}}function Td(t,r){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var p=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};y===null?p=y=S:y=y.next=S,s=s.next}while(s!==null);y===null?p=y=r:y=y.next=r}else p=y=r;s={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=r:t.next=r,s.lastBaseUpdate=r}var Fd=!1;function Gs(){if(Fd){var t=Gi;if(t!==null)throw t}}function Ks(t,r,s,c){Fd=!1;var p=t.updateQueue;wl=!1;var y=p.firstBaseUpdate,S=p.lastBaseUpdate,z=p.shared.pending;if(z!==null){p.shared.pending=null;var W=z,ie=W.next;W.next=null,S===null?y=ie:S.next=ie,S=W;var xe=t.alternate;xe!==null&&(xe=xe.updateQueue,z=xe.lastBaseUpdate,z!==S&&(z===null?xe.firstBaseUpdate=ie:z.next=ie,xe.lastBaseUpdate=W))}if(y!==null){var Ce=p.baseState;S=0,xe=ie=W=null,z=y;do{var oe=z.lane&-536870913,fe=oe!==z.lane;if(fe?(Rt&oe)===oe:(c&oe)===oe){oe!==0&&oe===Vi&&(Fd=!0),xe!==null&&(xe=xe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ye=t,st=z;oe=r;var nn=s;switch(st.tag){case 1:if(Ye=st.payload,typeof Ye=="function"){Ce=Ye.call(nn,Ce,oe);break e}Ce=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=st.payload,oe=typeof Ye=="function"?Ye.call(nn,Ce,oe):Ye,oe==null)break e;Ce=g({},Ce,oe);break e;case 2:wl=!0}}oe=z.callback,oe!==null&&(t.flags|=64,fe&&(t.flags|=8192),fe=p.callbacks,fe===null?p.callbacks=[oe]:fe.push(oe))}else fe={lane:oe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},xe===null?(ie=xe=fe,W=Ce):xe=xe.next=fe,S|=oe;if(z=z.next,z===null){if(z=p.shared.pending,z===null)break;fe=z,z=fe.next,fe.next=null,p.lastBaseUpdate=fe,p.shared.pending=null}}while(!0);xe===null&&(W=Ce),p.baseState=W,p.firstBaseUpdate=ie,p.lastBaseUpdate=xe,y===null&&(p.shared.lanes=0),Al|=S,t.lanes=S,t.memoizedState=Ce}}function Lp(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function Ip(t,r){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Lp(s[t],r)}var Qi=B(null),Ec=B(0);function Hp(t,r){t=Ja,T(Ec,t),T(Qi,r),Ja=t|r.baseLanes}function Rd(){T(Ec,Ja),T(Qi,Qi.current)}function Md(){Ja=Ec.current,H(Qi),H(Ec)}var Ar=B(null),Vr=null;function Sl(t){var r=t.alternate;T(Nn,Nn.current&1),T(Ar,t),Vr===null&&(r===null||Qi.current!==null||r.memoizedState!==null)&&(Vr=t)}function zd(t){T(Nn,Nn.current),T(Ar,t),Vr===null&&(Vr=t)}function Up(t){t.tag===22?(T(Nn,Nn.current),T(Ar,t),Vr===null&&(Vr=t)):Cl()}function Cl(){T(Nn,Nn.current),T(Ar,Ar.current)}function Dr(t){H(Ar),Vr===t&&(Vr=null),H(Nn)}var Nn=B(0);function Nc(t){for(var r=t;r!==null;){if(r.tag===13){var s=r.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Hf(s)||Uf(s)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Xa=0,gt=null,en=null,Fn=null,Ac=!1,Zi=!1,mi=!1,Dc=0,Ps=0,Ji=null,t2=0;function Cn(){throw Error(i(321))}function _d(t,r){if(r===null)return!1;for(var s=0;s<r.length&&s<t.length;s++)if(!Er(t[s],r[s]))return!1;return!0}function Bd(t,r,s,c,p,y){return Xa=y,gt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,q.H=t===null||t.memoizedState===null?Cx:Qd,mi=!1,y=s(c,p),mi=!1,Zi&&(y=Yp(r,s,c,p)),qp(t),y}function qp(t){q.H=Js;var r=en!==null&&en.next!==null;if(Xa=0,Fn=en=gt=null,Ac=!1,Ps=0,Ji=null,r)throw Error(i(300));t===null||Rn||(t=t.dependencies,t!==null&&bc(t)&&(Rn=!0))}function Yp(t,r,s,c){gt=t;var p=0;do{if(Zi&&(Ji=null),Ps=0,Zi=!1,25<=p)throw Error(i(301));if(p+=1,Fn=en=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}q.H=Ex,y=r(s,c)}while(Zi);return y}function n2(){var t=q.H,r=t.useState()[0];return r=typeof r.then=="function"?Qs(r):r,t=t.useState()[0],(en!==null?en.memoizedState:null)!==t&&(gt.flags|=1024),r}function Od(){var t=Dc!==0;return Dc=0,t}function $d(t,r,s){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~s}function Ld(t){if(Ac){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}Ac=!1}Xa=0,Fn=en=gt=null,Zi=!1,Ps=Dc=0,Ji=null}function or(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fn===null?gt.memoizedState=Fn=t:Fn=Fn.next=t,Fn}function An(){if(en===null){var t=gt.alternate;t=t!==null?t.memoizedState:null}else t=en.next;var r=Fn===null?gt.memoizedState:Fn.next;if(r!==null)Fn=r,en=t;else{if(t===null)throw gt.alternate===null?Error(i(467)):Error(i(310));en=t,t={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},Fn===null?gt.memoizedState=Fn=t:Fn=Fn.next=t}return Fn}function Tc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qs(t){var r=Ps;return Ps+=1,Ji===null&&(Ji=[]),t=zp(Ji,t,r),r=gt,(Fn===null?r.memoizedState:Fn.next)===null&&(r=r.alternate,q.H=r===null||r.memoizedState===null?Cx:Qd),t}function Fc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Qs(t);if(t.$$typeof===_)return Qn(t)}throw Error(i(438,String(t)))}function Id(t){var r=null,s=gt.updateQueue;if(s!==null&&(r=s.memoCache),r==null){var c=gt.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),s===null&&(s=Tc(),gt.updateQueue=s),s.memoCache=r,s=r.data[r.index],s===void 0)for(s=r.data[r.index]=Array(t),c=0;c<t;c++)s[c]=A;return r.index++,s}function Wa(t,r){return typeof r=="function"?r(t):r}function Rc(t){var r=An();return Hd(r,en,t)}function Hd(t,r,s){var c=t.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var p=t.baseQueue,y=c.pending;if(y!==null){if(p!==null){var S=p.next;p.next=y.next,y.next=S}r.baseQueue=p=y,c.pending=null}if(y=t.baseState,p===null)t.memoizedState=y;else{r=p.next;var z=S=null,W=null,ie=r,xe=!1;do{var Ce=ie.lane&-536870913;if(Ce!==ie.lane?(Rt&Ce)===Ce:(Xa&Ce)===Ce){var oe=ie.revertLane;if(oe===0)W!==null&&(W=W.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),Ce===Vi&&(xe=!0);else if((Xa&oe)===oe){ie=ie.next,oe===Vi&&(xe=!0);continue}else Ce={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},W===null?(z=W=Ce,S=y):W=W.next=Ce,gt.lanes|=oe,Al|=oe;Ce=ie.action,mi&&s(y,Ce),y=ie.hasEagerState?ie.eagerState:s(y,Ce)}else oe={lane:Ce,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},W===null?(z=W=oe,S=y):W=W.next=oe,gt.lanes|=Ce,Al|=Ce;ie=ie.next}while(ie!==null&&ie!==r);if(W===null?S=y:W.next=z,!Er(y,t.memoizedState)&&(Rn=!0,xe&&(s=Gi,s!==null)))throw s;t.memoizedState=y,t.baseState=S,t.baseQueue=W,c.lastRenderedState=y}return p===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function Ud(t){var r=An(),s=r.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var c=s.dispatch,p=s.pending,y=r.memoizedState;if(p!==null){s.pending=null;var S=p=p.next;do y=t(y,S.action),S=S.next;while(S!==p);Er(y,r.memoizedState)||(Rn=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),s.lastRenderedState=y}return[y,c]}function Xp(t,r,s){var c=gt,p=An(),y=Lt;if(y){if(s===void 0)throw Error(i(407));s=s()}else s=r();var S=!Er((en||p).memoizedState,s);if(S&&(p.memoizedState=s,Rn=!0),p=p.queue,Xd(Gp.bind(null,c,p,t),[t]),p.getSnapshot!==r||S||Fn!==null&&Fn.memoizedState.tag&1){if(c.flags|=2048,es(9,{destroy:void 0},Vp.bind(null,c,p,s,r),null),sn===null)throw Error(i(349));y||(Xa&127)!==0||Wp(c,r,s)}return s}function Wp(t,r,s){t.flags|=16384,t={getSnapshot:r,value:s},r=gt.updateQueue,r===null?(r=Tc(),gt.updateQueue=r,r.stores=[t]):(s=r.stores,s===null?r.stores=[t]:s.push(t))}function Vp(t,r,s,c){r.value=s,r.getSnapshot=c,Kp(r)&&Pp(t)}function Gp(t,r,s){return s(function(){Kp(r)&&Pp(t)})}function Kp(t){var r=t.getSnapshot;t=t.value;try{var s=r();return!Er(t,s)}catch{return!0}}function Pp(t){var r=li(t,2);r!==null&&br(r,t,2)}function qd(t){var r=or();if(typeof t=="function"){var s=t;if(t=s(),mi){lt(!0);try{s()}finally{lt(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:t},r}function Qp(t,r,s,c){return t.baseState=s,Hd(t,en,typeof c=="function"?c:Wa)}function r2(t,r,s,c,p){if(_c(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};q.T!==null?s(!0):y.isTransition=!1,c(y),s=r.pending,s===null?(y.next=r.pending=y,Zp(r,y)):(y.next=s.next,r.pending=s.next=y)}}function Zp(t,r){var s=r.action,c=r.payload,p=t.state;if(r.isTransition){var y=q.T,S={};q.T=S;try{var z=s(p,c),W=q.S;W!==null&&W(S,z),Jp(t,r,z)}catch(ie){Yd(t,r,ie)}finally{y!==null&&S.types!==null&&(y.types=S.types),q.T=y}}else try{y=s(p,c),Jp(t,r,y)}catch(ie){Yd(t,r,ie)}}function Jp(t,r,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){ex(t,r,c)},function(c){return Yd(t,r,c)}):ex(t,r,s)}function ex(t,r,s){r.status="fulfilled",r.value=s,tx(r),t.state=s,r=t.pending,r!==null&&(s=r.next,s===r?t.pending=null:(s=s.next,r.next=s,Zp(t,s)))}function Yd(t,r,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=s,tx(r),r=r.next;while(r!==c)}t.action=null}function tx(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function nx(t,r){return r}function rx(t,r){if(Lt){var s=sn.formState;if(s!==null){e:{var c=gt;if(Lt){if(xn){t:{for(var p=xn,y=Wr;p.nodeType!==8;){if(!y){p=null;break t}if(p=Gr(p.nextSibling),p===null){p=null;break t}}y=p.data,p=y==="F!"||y==="F"?p:null}if(p){xn=Gr(p.nextSibling),c=p.data==="F!";break e}}bl(c)}c=!1}c&&(r=s[0])}}return s=or(),s.memoizedState=s.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nx,lastRenderedState:r},s.queue=c,s=kx.bind(null,gt,c),c.dispatch=s,c=qd(!1),y=Pd.bind(null,gt,!1,c.queue),c=or(),p={state:r,dispatch:null,action:t,pending:null},c.queue=p,s=r2.bind(null,gt,p,y,s),p.dispatch=s,c.memoizedState=t,[r,s,!1]}function ax(t){var r=An();return lx(r,en,t)}function lx(t,r,s){if(r=Hd(t,r,nx)[0],t=Rc(Wa)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=Qs(r)}catch(S){throw S===Ki?kc:S}else c=r;r=An();var p=r.queue,y=p.dispatch;return s!==r.memoizedState&&(gt.flags|=2048,es(9,{destroy:void 0},a2.bind(null,p,s),null)),[c,y,t]}function a2(t,r){t.action=r}function ix(t){var r=An(),s=en;if(s!==null)return lx(r,s,t);An(),r=r.memoizedState,s=An();var c=s.queue.dispatch;return s.memoizedState=t,[r,c,!1]}function es(t,r,s,c){return t={tag:t,create:s,deps:c,inst:r,next:null},r=gt.updateQueue,r===null&&(r=Tc(),gt.updateQueue=r),s=r.lastEffect,s===null?r.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,r.lastEffect=t),t}function sx(){return An().memoizedState}function Mc(t,r,s,c){var p=or();gt.flags|=t,p.memoizedState=es(1|r,{destroy:void 0},s,c===void 0?null:c)}function zc(t,r,s,c){var p=An();c=c===void 0?null:c;var y=p.memoizedState.inst;en!==null&&c!==null&&_d(c,en.memoizedState.deps)?p.memoizedState=es(r,y,s,c):(gt.flags|=t,p.memoizedState=es(1|r,y,s,c))}function ox(t,r){Mc(8390656,8,t,r)}function Xd(t,r){zc(2048,8,t,r)}function l2(t){gt.flags|=4;var r=gt.updateQueue;if(r===null)r=Tc(),gt.updateQueue=r,r.events=[t];else{var s=r.events;s===null?r.events=[t]:s.push(t)}}function cx(t){var r=An().memoizedState;return l2({ref:r,nextImpl:t}),function(){if((Vt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function ux(t,r){return zc(4,2,t,r)}function dx(t,r){return zc(4,4,t,r)}function fx(t,r){if(typeof r=="function"){t=t();var s=r(t);return function(){typeof s=="function"?s():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function hx(t,r,s){s=s!=null?s.concat([t]):null,zc(4,4,fx.bind(null,r,t),s)}function Wd(){}function mx(t,r){var s=An();r=r===void 0?null:r;var c=s.memoizedState;return r!==null&&_d(r,c[1])?c[0]:(s.memoizedState=[t,r],t)}function px(t,r){var s=An();r=r===void 0?null:r;var c=s.memoizedState;if(r!==null&&_d(r,c[1]))return c[0];if(c=t(),mi){lt(!0);try{t()}finally{lt(!1)}}return s.memoizedState=[c,r],c}function Vd(t,r,s){return s===void 0||(Xa&1073741824)!==0&&(Rt&261930)===0?t.memoizedState=r:(t.memoizedState=s,t=x1(),gt.lanes|=t,Al|=t,s)}function xx(t,r,s,c){return Er(s,r)?s:Qi.current!==null?(t=Vd(t,s,c),Er(t,r)||(Rn=!0),t):(Xa&42)===0||(Xa&1073741824)!==0&&(Rt&261930)===0?(Rn=!0,t.memoizedState=s):(t=x1(),gt.lanes|=t,Al|=t,r)}function gx(t,r,s,c,p){var y=se.p;se.p=y!==0&&8>y?y:8;var S=q.T,z={};q.T=z,Pd(t,!1,r,s);try{var W=p(),ie=q.S;if(ie!==null&&ie(z,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var xe=e2(W,c);Zs(t,r,xe,Rr(t))}else Zs(t,r,c,Rr(t))}catch(Ce){Zs(t,r,{then:function(){},status:"rejected",reason:Ce},Rr())}finally{se.p=y,S!==null&&z.types!==null&&(S.types=z.types),q.T=S}}function i2(){}function Gd(t,r,s,c){if(t.tag!==5)throw Error(i(476));var p=yx(t).queue;gx(t,p,r,ue,s===null?i2:function(){return bx(t),s(c)})}function yx(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:ue},next:null};var s={};return r.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:s},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function bx(t){var r=yx(t);r.next===null&&(r=t.alternate.memoizedState),Zs(t,r.next.queue,{},Rr())}function Kd(){return Qn(xo)}function vx(){return An().memoizedState}function wx(){return An().memoizedState}function s2(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var s=Rr();t=kl(s);var c=jl(r,t,s);c!==null&&(br(c,r,s),Vs(c,r,s)),r={cache:Sd()},t.payload=r;return}r=r.return}}function o2(t,r,s){var c=Rr();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},_c(t)?jx(r,s):(s=hd(t,r,s,c),s!==null&&(br(s,t,c),Sx(s,r,c)))}function kx(t,r,s){var c=Rr();Zs(t,r,s,c)}function Zs(t,r,s,c){var p={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(_c(t))jx(r,p);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var S=r.lastRenderedState,z=y(S,s);if(p.hasEagerState=!0,p.eagerState=z,Er(z,S))return pc(t,r,p,0),sn===null&&mc(),!1}catch{}finally{}if(s=hd(t,r,p,c),s!==null)return br(s,t,c),Sx(s,r,c),!0}return!1}function Pd(t,r,s,c){if(c={lane:2,revertLane:Df(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},_c(t)){if(r)throw Error(i(479))}else r=hd(t,s,c,2),r!==null&&br(r,t,2)}function _c(t){var r=t.alternate;return t===gt||r!==null&&r===gt}function jx(t,r){Zi=Ac=!0;var s=t.pending;s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r}function Sx(t,r,s){if((s&4194048)!==0){var c=r.lanes;c&=t.pendingLanes,s|=c,r.lanes=s,hn(t,s)}}var Js={readContext:Qn,use:Fc,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn,useHostTransitionStatus:Cn,useFormState:Cn,useActionState:Cn,useOptimistic:Cn,useMemoCache:Cn,useCacheRefresh:Cn};Js.useEffectEvent=Cn;var Cx={readContext:Qn,use:Fc,useCallback:function(t,r){return or().memoizedState=[t,r===void 0?null:r],t},useContext:Qn,useEffect:ox,useImperativeHandle:function(t,r,s){s=s!=null?s.concat([t]):null,Mc(4194308,4,fx.bind(null,r,t),s)},useLayoutEffect:function(t,r){return Mc(4194308,4,t,r)},useInsertionEffect:function(t,r){Mc(4,2,t,r)},useMemo:function(t,r){var s=or();r=r===void 0?null:r;var c=t();if(mi){lt(!0);try{t()}finally{lt(!1)}}return s.memoizedState=[c,r],c},useReducer:function(t,r,s){var c=or();if(s!==void 0){var p=s(r);if(mi){lt(!0);try{s(r)}finally{lt(!1)}}}else p=r;return c.memoizedState=c.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},c.queue=t,t=t.dispatch=o2.bind(null,gt,t),[c.memoizedState,t]},useRef:function(t){var r=or();return t={current:t},r.memoizedState=t},useState:function(t){t=qd(t);var r=t.queue,s=kx.bind(null,gt,r);return r.dispatch=s,[t.memoizedState,s]},useDebugValue:Wd,useDeferredValue:function(t,r){var s=or();return Vd(s,t,r)},useTransition:function(){var t=qd(!1);return t=gx.bind(null,gt,t.queue,!0,!1),or().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,s){var c=gt,p=or();if(Lt){if(s===void 0)throw Error(i(407));s=s()}else{if(s=r(),sn===null)throw Error(i(349));(Rt&127)!==0||Wp(c,r,s)}p.memoizedState=s;var y={value:s,getSnapshot:r};return p.queue=y,ox(Gp.bind(null,c,y,t),[t]),c.flags|=2048,es(9,{destroy:void 0},Vp.bind(null,c,y,s,r),null),s},useId:function(){var t=or(),r=sn.identifierPrefix;if(Lt){var s=ga,c=xa;s=(c&~(1<<32-Qe(c)-1)).toString(32)+s,r="_"+r+"R_"+s,s=Dc++,0<s&&(r+="H"+s.toString(32)),r+="_"}else s=t2++,r="_"+r+"r_"+s.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Kd,useFormState:rx,useActionState:rx,useOptimistic:function(t){var r=or();r.memoizedState=r.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=s,r=Pd.bind(null,gt,!0,s),s.dispatch=r,[t,r]},useMemoCache:Id,useCacheRefresh:function(){return or().memoizedState=s2.bind(null,gt)},useEffectEvent:function(t){var r=or(),s={impl:t};return r.memoizedState=s,function(){if((Vt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}},Qd={readContext:Qn,use:Fc,useCallback:mx,useContext:Qn,useEffect:Xd,useImperativeHandle:hx,useInsertionEffect:ux,useLayoutEffect:dx,useMemo:px,useReducer:Rc,useRef:sx,useState:function(){return Rc(Wa)},useDebugValue:Wd,useDeferredValue:function(t,r){var s=An();return xx(s,en.memoizedState,t,r)},useTransition:function(){var t=Rc(Wa)[0],r=An().memoizedState;return[typeof t=="boolean"?t:Qs(t),r]},useSyncExternalStore:Xp,useId:vx,useHostTransitionStatus:Kd,useFormState:ax,useActionState:ax,useOptimistic:function(t,r){var s=An();return Qp(s,en,t,r)},useMemoCache:Id,useCacheRefresh:wx};Qd.useEffectEvent=cx;var Ex={readContext:Qn,use:Fc,useCallback:mx,useContext:Qn,useEffect:Xd,useImperativeHandle:hx,useInsertionEffect:ux,useLayoutEffect:dx,useMemo:px,useReducer:Ud,useRef:sx,useState:function(){return Ud(Wa)},useDebugValue:Wd,useDeferredValue:function(t,r){var s=An();return en===null?Vd(s,t,r):xx(s,en.memoizedState,t,r)},useTransition:function(){var t=Ud(Wa)[0],r=An().memoizedState;return[typeof t=="boolean"?t:Qs(t),r]},useSyncExternalStore:Xp,useId:vx,useHostTransitionStatus:Kd,useFormState:ix,useActionState:ix,useOptimistic:function(t,r){var s=An();return en!==null?Qp(s,en,t,r):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Id,useCacheRefresh:wx};Ex.useEffectEvent=cx;function Zd(t,r,s,c){r=t.memoizedState,s=s(c,r),s=s==null?r:g({},r,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Jd={enqueueSetState:function(t,r,s){t=t._reactInternals;var c=Rr(),p=kl(c);p.payload=r,s!=null&&(p.callback=s),r=jl(t,p,c),r!==null&&(br(r,t,c),Vs(r,t,c))},enqueueReplaceState:function(t,r,s){t=t._reactInternals;var c=Rr(),p=kl(c);p.tag=1,p.payload=r,s!=null&&(p.callback=s),r=jl(t,p,c),r!==null&&(br(r,t,c),Vs(r,t,c))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var s=Rr(),c=kl(s);c.tag=2,r!=null&&(c.callback=r),r=jl(t,c,s),r!==null&&(br(r,t,s),Vs(r,t,s))}};function Nx(t,r,s,c,p,y,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,y,S):r.prototype&&r.prototype.isPureReactComponent?!Ls(s,c)||!Ls(p,y):!0}function Ax(t,r,s,c){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(s,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(s,c),r.state!==t&&Jd.enqueueReplaceState(r,r.state,null)}function pi(t,r){var s=r;if("ref"in r){s={};for(var c in r)c!=="ref"&&(s[c]=r[c])}if(t=t.defaultProps){s===r&&(s=g({},s));for(var p in t)s[p]===void 0&&(s[p]=t[p])}return s}function Dx(t){hc(t)}function Tx(t){console.error(t)}function Fx(t){hc(t)}function Bc(t,r){try{var s=t.onUncaughtError;s(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function Rx(t,r,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function ef(t,r,s){return s=kl(s),s.tag=3,s.payload={element:null},s.callback=function(){Bc(t,r)},s}function Mx(t){return t=kl(t),t.tag=3,t}function zx(t,r,s,c){var p=s.type.getDerivedStateFromError;if(typeof p=="function"){var y=c.value;t.payload=function(){return p(y)},t.callback=function(){Rx(r,s,c)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){Rx(r,s,c),typeof p!="function"&&(Dl===null?Dl=new Set([this]):Dl.add(this));var z=c.stack;this.componentDidCatch(c.value,{componentStack:z!==null?z:""})})}function c2(t,r,s,c,p){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=s.alternate,r!==null&&Wi(r,s,p,!0),s=Ar.current,s!==null){switch(s.tag){case 31:case 13:return Vr===null?Gc():s.alternate===null&&En===0&&(En=3),s.flags&=-257,s.flags|=65536,s.lanes=p,c===jc?s.flags|=16384:(r=s.updateQueue,r===null?s.updateQueue=new Set([c]):r.add(c),Ef(t,c,p)),!1;case 22:return s.flags|=65536,c===jc?s.flags|=16384:(r=s.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=r):(s=r.retryQueue,s===null?r.retryQueue=new Set([c]):s.add(c)),Ef(t,c,p)),!1}throw Error(i(435,s.tag))}return Ef(t,c,p),Gc(),!1}if(Lt)return r=Ar.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,c!==bd&&(t=Error(i(422),{cause:c}),Us(qr(t,s)))):(c!==bd&&(r=Error(i(423),{cause:c}),Us(qr(r,s))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,c=qr(c,s),p=ef(t.stateNode,c,p),Td(t,p),En!==4&&(En=2)),!1;var y=Error(i(520),{cause:c});if(y=qr(y,s),so===null?so=[y]:so.push(y),En!==4&&(En=2),r===null)return!0;c=qr(c,s),s=r;do{switch(s.tag){case 3:return s.flags|=65536,t=p&-p,s.lanes|=t,t=ef(s.stateNode,c,t),Td(s,t),!1;case 1:if(r=s.type,y=s.stateNode,(s.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Dl===null||!Dl.has(y))))return s.flags|=65536,p&=-p,s.lanes|=p,p=Mx(p),zx(p,t,s,c),Td(s,p),!1}s=s.return}while(s!==null);return!1}var tf=Error(i(461)),Rn=!1;function Zn(t,r,s,c){r.child=t===null?$p(r,null,s,c):hi(r,t.child,s,c)}function _x(t,r,s,c,p){s=s.render;var y=r.ref;if("ref"in c){var S={};for(var z in c)z!=="ref"&&(S[z]=c[z])}else S=c;return ci(r),c=Bd(t,r,s,S,y,p),z=Od(),t!==null&&!Rn?($d(t,r,p),Va(t,r,p)):(Lt&&z&&gd(r),r.flags|=1,Zn(t,r,c,p),r.child)}function Bx(t,r,s,c,p){if(t===null){var y=s.type;return typeof y=="function"&&!md(y)&&y.defaultProps===void 0&&s.compare===null?(r.tag=15,r.type=y,Ox(t,r,y,c,p)):(t=gc(s.type,null,c,r,r.mode,p),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!uf(t,p)){var S=y.memoizedProps;if(s=s.compare,s=s!==null?s:Ls,s(S,c)&&t.ref===r.ref)return Va(t,r,p)}return r.flags|=1,t=Ha(y,c),t.ref=r.ref,t.return=r,r.child=t}function Ox(t,r,s,c,p){if(t!==null){var y=t.memoizedProps;if(Ls(y,c)&&t.ref===r.ref)if(Rn=!1,r.pendingProps=c=y,uf(t,p))(t.flags&131072)!==0&&(Rn=!0);else return r.lanes=t.lanes,Va(t,r,p)}return nf(t,r,s,c,p)}function $x(t,r,s,c){var p=c.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|s:s,t!==null){for(c=r.child=t.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~y}else c=0,r.child=null;return Lx(t,r,y,s,c)}if((s&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&wc(r,y!==null?y.cachePool:null),y!==null?Hp(r,y):Rd(),Up(r);else return c=r.lanes=536870912,Lx(t,r,y!==null?y.baseLanes|s:s,s,c)}else y!==null?(wc(r,y.cachePool),Hp(r,y),Cl(),r.memoizedState=null):(t!==null&&wc(r,null),Rd(),Cl());return Zn(t,r,p,s),r.child}function eo(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Lx(t,r,s,c,p){var y=Ed();return y=y===null?null:{parent:Tn._currentValue,pool:y},r.memoizedState={baseLanes:s,cachePool:y},t!==null&&wc(r,null),Rd(),Up(r),t!==null&&Wi(t,r,c,!0),r.childLanes=p,null}function Oc(t,r){return r=Lc({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Ix(t,r,s){return hi(r,t.child,null,s),t=Oc(r,r.pendingProps),t.flags|=2,Dr(r),r.memoizedState=null,t}function u2(t,r,s){var c=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Lt){if(c.mode==="hidden")return t=Oc(r,c),r.lanes=536870912,eo(null,t);if(zd(r),(t=xn)?(t=Z1(t,Wr),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:gl!==null?{id:xa,overflow:ga}:null,retryLane:536870912,hydrationErrors:null},s=jp(t),s.return=r,r.child=s,Pn=r,xn=null)):t=null,t===null)throw bl(r);return r.lanes=536870912,null}return Oc(r,c)}var y=t.memoizedState;if(y!==null){var S=y.dehydrated;if(zd(r),p)if(r.flags&256)r.flags&=-257,r=Ix(t,r,s);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(Rn||Wi(t,r,s,!1),p=(s&t.childLanes)!==0,Rn||p){if(c=sn,c!==null&&(S=te(c,s),S!==0&&S!==y.retryLane))throw y.retryLane=S,li(t,S),br(c,t,S),tf;Gc(),r=Ix(t,r,s)}else t=y.treeContext,xn=Gr(S.nextSibling),Pn=r,Lt=!0,yl=null,Wr=!1,t!==null&&Ep(r,t),r=Oc(r,c),r.flags|=4096;return r}return t=Ha(t.child,{mode:c.mode,children:c.children}),t.ref=r.ref,r.child=t,t.return=r,t}function $c(t,r){var s=r.ref;if(s===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(i(284));(t===null||t.ref!==s)&&(r.flags|=4194816)}}function nf(t,r,s,c,p){return ci(r),s=Bd(t,r,s,c,void 0,p),c=Od(),t!==null&&!Rn?($d(t,r,p),Va(t,r,p)):(Lt&&c&&gd(r),r.flags|=1,Zn(t,r,s,p),r.child)}function Hx(t,r,s,c,p,y){return ci(r),r.updateQueue=null,s=Yp(r,c,s,p),qp(t),c=Od(),t!==null&&!Rn?($d(t,r,y),Va(t,r,y)):(Lt&&c&&gd(r),r.flags|=1,Zn(t,r,s,y),r.child)}function Ux(t,r,s,c,p){if(ci(r),r.stateNode===null){var y=Ui,S=s.contextType;typeof S=="object"&&S!==null&&(y=Qn(S)),y=new s(c,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Jd,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=c,y.state=r.memoizedState,y.refs={},Ad(r),S=s.contextType,y.context=typeof S=="object"&&S!==null?Qn(S):Ui,y.state=r.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(Zd(r,s,S,c),y.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&Jd.enqueueReplaceState(y,y.state,null),Ks(r,c,y,p),Gs(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(t===null){y=r.stateNode;var z=r.memoizedProps,W=pi(s,z);y.props=W;var ie=y.context,xe=s.contextType;S=Ui,typeof xe=="object"&&xe!==null&&(S=Qn(xe));var Ce=s.getDerivedStateFromProps;xe=typeof Ce=="function"||typeof y.getSnapshotBeforeUpdate=="function",z=r.pendingProps!==z,xe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(z||ie!==S)&&Ax(r,y,c,S),wl=!1;var oe=r.memoizedState;y.state=oe,Ks(r,c,y,p),Gs(),ie=r.memoizedState,z||oe!==ie||wl?(typeof Ce=="function"&&(Zd(r,s,Ce,c),ie=r.memoizedState),(W=wl||Nx(r,s,W,c,oe,ie,S))?(xe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=ie),y.props=c,y.state=ie,y.context=S,c=W):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{y=r.stateNode,Dd(t,r),S=r.memoizedProps,xe=pi(s,S),y.props=xe,Ce=r.pendingProps,oe=y.context,ie=s.contextType,W=Ui,typeof ie=="object"&&ie!==null&&(W=Qn(ie)),z=s.getDerivedStateFromProps,(ie=typeof z=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==Ce||oe!==W)&&Ax(r,y,c,W),wl=!1,oe=r.memoizedState,y.state=oe,Ks(r,c,y,p),Gs();var fe=r.memoizedState;S!==Ce||oe!==fe||wl||t!==null&&t.dependencies!==null&&bc(t.dependencies)?(typeof z=="function"&&(Zd(r,s,z,c),fe=r.memoizedState),(xe=wl||Nx(r,s,xe,c,oe,fe,W)||t!==null&&t.dependencies!==null&&bc(t.dependencies))?(ie||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,fe,W),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,fe,W)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=fe),y.props=c,y.state=fe,y.context=W,c=xe):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),c=!1)}return y=c,$c(t,r),c=(r.flags&128)!==0,y||c?(y=r.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&c?(r.child=hi(r,t.child,null,p),r.child=hi(r,null,s,p)):Zn(t,r,s,p),r.memoizedState=y.state,t=r.child):t=Va(t,r,p),t}function qx(t,r,s,c){return si(),r.flags|=256,Zn(t,r,s,c),r.child}var rf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function af(t){return{baseLanes:t,cachePool:Rp()}}function lf(t,r,s){return t=t!==null?t.childLanes&~s:0,r&&(t|=Fr),t}function Yx(t,r,s){var c=r.pendingProps,p=!1,y=(r.flags&128)!==0,S;if((S=y)||(S=t!==null&&t.memoizedState===null?!1:(Nn.current&2)!==0),S&&(p=!0,r.flags&=-129),S=(r.flags&32)!==0,r.flags&=-33,t===null){if(Lt){if(p?Sl(r):Cl(),(t=xn)?(t=Z1(t,Wr),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:gl!==null?{id:xa,overflow:ga}:null,retryLane:536870912,hydrationErrors:null},s=jp(t),s.return=r,r.child=s,Pn=r,xn=null)):t=null,t===null)throw bl(r);return Uf(t)?r.lanes=32:r.lanes=536870912,null}var z=c.children;return c=c.fallback,p?(Cl(),p=r.mode,z=Lc({mode:"hidden",children:z},p),c=ii(c,p,s,null),z.return=r,c.return=r,z.sibling=c,r.child=z,c=r.child,c.memoizedState=af(s),c.childLanes=lf(t,S,s),r.memoizedState=rf,eo(null,c)):(Sl(r),sf(r,z))}var W=t.memoizedState;if(W!==null&&(z=W.dehydrated,z!==null)){if(y)r.flags&256?(Sl(r),r.flags&=-257,r=of(t,r,s)):r.memoizedState!==null?(Cl(),r.child=t.child,r.flags|=128,r=null):(Cl(),z=c.fallback,p=r.mode,c=Lc({mode:"visible",children:c.children},p),z=ii(z,p,s,null),z.flags|=2,c.return=r,z.return=r,c.sibling=z,r.child=c,hi(r,t.child,null,s),c=r.child,c.memoizedState=af(s),c.childLanes=lf(t,S,s),r.memoizedState=rf,r=eo(null,c));else if(Sl(r),Uf(z)){if(S=z.nextSibling&&z.nextSibling.dataset,S)var ie=S.dgst;S=ie,c=Error(i(419)),c.stack="",c.digest=S,Us({value:c,source:null,stack:null}),r=of(t,r,s)}else if(Rn||Wi(t,r,s,!1),S=(s&t.childLanes)!==0,Rn||S){if(S=sn,S!==null&&(c=te(S,s),c!==0&&c!==W.retryLane))throw W.retryLane=c,li(t,c),br(S,t,c),tf;Hf(z)||Gc(),r=of(t,r,s)}else Hf(z)?(r.flags|=192,r.child=t.child,r=null):(t=W.treeContext,xn=Gr(z.nextSibling),Pn=r,Lt=!0,yl=null,Wr=!1,t!==null&&Ep(r,t),r=sf(r,c.children),r.flags|=4096);return r}return p?(Cl(),z=c.fallback,p=r.mode,W=t.child,ie=W.sibling,c=Ha(W,{mode:"hidden",children:c.children}),c.subtreeFlags=W.subtreeFlags&65011712,ie!==null?z=Ha(ie,z):(z=ii(z,p,s,null),z.flags|=2),z.return=r,c.return=r,c.sibling=z,r.child=c,eo(null,c),c=r.child,z=t.child.memoizedState,z===null?z=af(s):(p=z.cachePool,p!==null?(W=Tn._currentValue,p=p.parent!==W?{parent:W,pool:W}:p):p=Rp(),z={baseLanes:z.baseLanes|s,cachePool:p}),c.memoizedState=z,c.childLanes=lf(t,S,s),r.memoizedState=rf,eo(t.child,c)):(Sl(r),s=t.child,t=s.sibling,s=Ha(s,{mode:"visible",children:c.children}),s.return=r,s.sibling=null,t!==null&&(S=r.deletions,S===null?(r.deletions=[t],r.flags|=16):S.push(t)),r.child=s,r.memoizedState=null,s)}function sf(t,r){return r=Lc({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function Lc(t,r){return t=Nr(22,t,null,r),t.lanes=0,t}function of(t,r,s){return hi(r,t.child,null,s),t=sf(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function Xx(t,r,s){t.lanes|=r;var c=t.alternate;c!==null&&(c.lanes|=r),kd(t.return,r,s)}function cf(t,r,s,c,p,y){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:p,treeForkCount:y}:(S.isBackwards=r,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=s,S.tailMode=p,S.treeForkCount=y)}function Wx(t,r,s){var c=r.pendingProps,p=c.revealOrder,y=c.tail;c=c.children;var S=Nn.current,z=(S&2)!==0;if(z?(S=S&1|2,r.flags|=128):S&=1,T(Nn,S),Zn(t,r,c,s),c=Lt?Hs:0,!z&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Xx(t,s,r);else if(t.tag===19)Xx(t,s,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(s=r.child,p=null;s!==null;)t=s.alternate,t!==null&&Nc(t)===null&&(p=s),s=s.sibling;s=p,s===null?(p=r.child,r.child=null):(p=s.sibling,s.sibling=null),cf(r,!1,p,s,y,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,p=r.child,r.child=null;p!==null;){if(t=p.alternate,t!==null&&Nc(t)===null){r.child=p;break}t=p.sibling,p.sibling=s,s=p,p=t}cf(r,!0,s,null,y,c);break;case"together":cf(r,!1,null,null,void 0,c);break;default:r.memoizedState=null}return r.child}function Va(t,r,s){if(t!==null&&(r.dependencies=t.dependencies),Al|=r.lanes,(s&r.childLanes)===0)if(t!==null){if(Wi(t,r,s,!1),(s&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,s=Ha(t,t.pendingProps),r.child=s,s.return=r;t.sibling!==null;)t=t.sibling,s=s.sibling=Ha(t,t.pendingProps),s.return=r;s.sibling=null}return r.child}function uf(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&bc(t)))}function d2(t,r,s){switch(r.tag){case 3:He(r,r.stateNode.containerInfo),vl(r,Tn,t.memoizedState.cache),si();break;case 27:case 5:et(r);break;case 4:He(r,r.stateNode.containerInfo);break;case 10:vl(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,zd(r),null;break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(Sl(r),r.flags|=128,null):(s&r.child.childLanes)!==0?Yx(t,r,s):(Sl(r),t=Va(t,r,s),t!==null?t.sibling:null);Sl(r);break;case 19:var p=(t.flags&128)!==0;if(c=(s&r.childLanes)!==0,c||(Wi(t,r,s,!1),c=(s&r.childLanes)!==0),p){if(c)return Wx(t,r,s);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),T(Nn,Nn.current),c)break;return null;case 22:return r.lanes=0,$x(t,r,s,r.pendingProps);case 24:vl(r,Tn,t.memoizedState.cache)}return Va(t,r,s)}function Vx(t,r,s){if(t!==null)if(t.memoizedProps!==r.pendingProps)Rn=!0;else{if(!uf(t,s)&&(r.flags&128)===0)return Rn=!1,d2(t,r,s);Rn=(t.flags&131072)!==0}else Rn=!1,Lt&&(r.flags&1048576)!==0&&Cp(r,Hs,r.index);switch(r.lanes=0,r.tag){case 16:e:{var c=r.pendingProps;if(t=di(r.elementType),r.type=t,typeof t=="function")md(t)?(c=pi(t,c),r.tag=1,r=Ux(null,r,t,c,s)):(r.tag=0,r=nf(null,r,t,c,s));else{if(t!=null){var p=t.$$typeof;if(p===M){r.tag=11,r=_x(null,r,t,c,s);break e}else if(p===I){r.tag=14,r=Bx(null,r,t,c,s);break e}}throw r=ne(t)||t,Error(i(306,r,""))}}return r;case 0:return nf(t,r,r.type,r.pendingProps,s);case 1:return c=r.type,p=pi(c,r.pendingProps),Ux(t,r,c,p,s);case 3:e:{if(He(r,r.stateNode.containerInfo),t===null)throw Error(i(387));c=r.pendingProps;var y=r.memoizedState;p=y.element,Dd(t,r),Ks(r,c,null,s);var S=r.memoizedState;if(c=S.cache,vl(r,Tn,c),c!==y.cache&&jd(r,[Tn],s,!0),Gs(),c=S.element,y.isDehydrated)if(y={element:c,isDehydrated:!1,cache:S.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=qx(t,r,c,s);break e}else if(c!==p){p=qr(Error(i(424)),r),Us(p),r=qx(t,r,c,s);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(xn=Gr(t.firstChild),Pn=r,Lt=!0,yl=null,Wr=!0,s=$p(r,null,c,s),r.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(si(),c===p){r=Va(t,r,s);break e}Zn(t,r,c,s)}r=r.child}return r;case 26:return $c(t,r),t===null?(s=a0(r.type,null,r.pendingProps,null))?r.memoizedState=s:Lt||(s=r.type,t=r.pendingProps,c=tu(he.current).createElement(s),c[yn]=r,c[mn]=t,Jn(c,s,t),Dn(c),r.stateNode=c):r.memoizedState=a0(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return et(r),t===null&&Lt&&(c=r.stateNode=t0(r.type,r.pendingProps,he.current),Pn=r,Wr=!0,p=xn,Ml(r.type)?(qf=p,xn=Gr(c.firstChild)):xn=p),Zn(t,r,r.pendingProps.children,s),$c(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Lt&&((p=c=xn)&&(c=H2(c,r.type,r.pendingProps,Wr),c!==null?(r.stateNode=c,Pn=r,xn=Gr(c.firstChild),Wr=!1,p=!0):p=!1),p||bl(r)),et(r),p=r.type,y=r.pendingProps,S=t!==null?t.memoizedProps:null,c=y.children,$f(p,y)?c=null:S!==null&&$f(p,S)&&(r.flags|=32),r.memoizedState!==null&&(p=Bd(t,r,n2,null,null,s),xo._currentValue=p),$c(t,r),Zn(t,r,c,s),r.child;case 6:return t===null&&Lt&&((t=s=xn)&&(s=U2(s,r.pendingProps,Wr),s!==null?(r.stateNode=s,Pn=r,xn=null,t=!0):t=!1),t||bl(r)),null;case 13:return Yx(t,r,s);case 4:return He(r,r.stateNode.containerInfo),c=r.pendingProps,t===null?r.child=hi(r,null,c,s):Zn(t,r,c,s),r.child;case 11:return _x(t,r,r.type,r.pendingProps,s);case 7:return Zn(t,r,r.pendingProps,s),r.child;case 8:return Zn(t,r,r.pendingProps.children,s),r.child;case 12:return Zn(t,r,r.pendingProps.children,s),r.child;case 10:return c=r.pendingProps,vl(r,r.type,c.value),Zn(t,r,c.children,s),r.child;case 9:return p=r.type._context,c=r.pendingProps.children,ci(r),p=Qn(p),c=c(p),r.flags|=1,Zn(t,r,c,s),r.child;case 14:return Bx(t,r,r.type,r.pendingProps,s);case 15:return Ox(t,r,r.type,r.pendingProps,s);case 19:return Wx(t,r,s);case 31:return u2(t,r,s);case 22:return $x(t,r,s,r.pendingProps);case 24:return ci(r),c=Qn(Tn),t===null?(p=Ed(),p===null&&(p=sn,y=Sd(),p.pooledCache=y,y.refCount++,y!==null&&(p.pooledCacheLanes|=s),p=y),r.memoizedState={parent:c,cache:p},Ad(r),vl(r,Tn,p)):((t.lanes&s)!==0&&(Dd(t,r),Ks(r,null,null,s),Gs()),p=t.memoizedState,y=r.memoizedState,p.parent!==c?(p={parent:c,cache:c},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),vl(r,Tn,c)):(c=y.cache,vl(r,Tn,c),c!==p.cache&&jd(r,[Tn],s,!0))),Zn(t,r,r.pendingProps.children,s),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Ga(t){t.flags|=4}function df(t,r,s,c,p){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(v1())t.flags|=8192;else throw fi=jc,Nd}else t.flags&=-16777217}function Gx(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!c0(r))if(v1())t.flags|=8192;else throw fi=jc,Nd}function Ic(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?at():536870912,t.lanes|=r,as|=r)}function to(t,r){if(!Lt)switch(t.tailMode){case"hidden":r=t.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function gn(t){var r=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(r)for(var p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=c,t.childLanes=s,r}function f2(t,r,s){var c=r.pendingProps;switch(yd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(r),null;case 1:return gn(r),null;case 3:return s=r.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ya(Tn),Ie(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Xi(r)?Ga(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,vd())),gn(r),null;case 26:var p=r.type,y=r.memoizedState;return t===null?(Ga(r),y!==null?(gn(r),Gx(r,y)):(gn(r),df(r,p,null,c,s))):y?y!==t.memoizedState?(Ga(r),gn(r),Gx(r,y)):(gn(r),r.flags&=-16777217):(t=t.memoizedProps,t!==c&&Ga(r),gn(r),df(r,p,t,c,s)),null;case 27:if(Ve(r),s=he.current,p=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(!c){if(r.stateNode===null)throw Error(i(166));return gn(r),null}t=de.current,Xi(r)?Np(r):(t=t0(p,c,s),r.stateNode=t,Ga(r))}return gn(r),null;case 5:if(Ve(r),p=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(!c){if(r.stateNode===null)throw Error(i(166));return gn(r),null}if(y=de.current,Xi(r))Np(r);else{var S=tu(he.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?y.multiple=!0:c.size&&(y.size=c.size);break;default:y=typeof c.is=="string"?S.createElement(p,{is:c.is}):S.createElement(p)}}y[yn]=r,y[mn]=c;e:for(S=r.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===r)break e;for(;S.sibling===null;){if(S.return===null||S.return===r)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}r.stateNode=y;e:switch(Jn(y,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ga(r)}}return gn(r),df(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,s),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(i(166));if(t=he.current,Xi(r)){if(t=r.stateNode,s=r.memoizedProps,c=null,p=Pn,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}t[yn]=r,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||Y1(t.nodeValue,s)),t||bl(r,!0)}else t=tu(t).createTextNode(c),t[yn]=r,r.stateNode=t}return gn(r),null;case 31:if(s=r.memoizedState,t===null||t.memoizedState!==null){if(c=Xi(r),s!==null){if(t===null){if(!c)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[yn]=r}else si(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;gn(r),t=!1}else s=vd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return r.flags&256?(Dr(r),r):(Dr(r),null);if((r.flags&128)!==0)throw Error(i(558))}return gn(r),null;case 13:if(c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=Xi(r),c!==null&&c.dehydrated!==null){if(t===null){if(!p)throw Error(i(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[yn]=r}else si(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;gn(r),p=!1}else p=vd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Dr(r),r):(Dr(r),null)}return Dr(r),(r.flags&128)!==0?(r.lanes=s,r):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=r.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),y=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(y=c.memoizedState.cachePool.pool),y!==p&&(c.flags|=2048)),s!==t&&s&&(r.child.flags|=8192),Ic(r,r.updateQueue),gn(r),null);case 4:return Ie(),t===null&&Mf(r.stateNode.containerInfo),gn(r),null;case 10:return Ya(r.type),gn(r),null;case 19:if(H(Nn),c=r.memoizedState,c===null)return gn(r),null;if(p=(r.flags&128)!==0,y=c.rendering,y===null)if(p)to(c,!1);else{if(En!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=Nc(t),y!==null){for(r.flags|=128,to(c,!1),t=y.updateQueue,r.updateQueue=t,Ic(r,t),r.subtreeFlags=0,t=s,s=r.child;s!==null;)kp(s,t),s=s.sibling;return T(Nn,Nn.current&1|2),Lt&&Ua(r,c.treeForkCount),r.child}t=t.sibling}c.tail!==null&&Se()>Xc&&(r.flags|=128,p=!0,to(c,!1),r.lanes=4194304)}else{if(!p)if(t=Nc(y),t!==null){if(r.flags|=128,p=!0,t=t.updateQueue,r.updateQueue=t,Ic(r,t),to(c,!0),c.tail===null&&c.tailMode==="hidden"&&!y.alternate&&!Lt)return gn(r),null}else 2*Se()-c.renderingStartTime>Xc&&s!==536870912&&(r.flags|=128,p=!0,to(c,!1),r.lanes=4194304);c.isBackwards?(y.sibling=r.child,r.child=y):(t=c.last,t!==null?t.sibling=y:r.child=y,c.last=y)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Se(),t.sibling=null,s=Nn.current,T(Nn,p?s&1|2:s&1),Lt&&Ua(r,c.treeForkCount),t):(gn(r),null);case 22:case 23:return Dr(r),Md(),c=r.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(s&536870912)!==0&&(r.flags&128)===0&&(gn(r),r.subtreeFlags&6&&(r.flags|=8192)):gn(r),s=r.updateQueue,s!==null&&Ic(r,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==s&&(r.flags|=2048),t!==null&&H(ui),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),r.memoizedState.cache!==s&&(r.flags|=2048),Ya(Tn),gn(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function h2(t,r){switch(yd(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return Ya(Tn),Ie(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return Ve(r),null;case 31:if(r.memoizedState!==null){if(Dr(r),r.alternate===null)throw Error(i(340));si()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(Dr(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));si()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return H(Nn),null;case 4:return Ie(),null;case 10:return Ya(r.type),null;case 22:case 23:return Dr(r),Md(),t!==null&&H(ui),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return Ya(Tn),null;case 25:return null;default:return null}}function Kx(t,r){switch(yd(r),r.tag){case 3:Ya(Tn),Ie();break;case 26:case 27:case 5:Ve(r);break;case 4:Ie();break;case 31:r.memoizedState!==null&&Dr(r);break;case 13:Dr(r);break;case 19:H(Nn);break;case 10:Ya(r.type);break;case 22:case 23:Dr(r),Md(),t!==null&&H(ui);break;case 24:Ya(Tn)}}function no(t,r){try{var s=r.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var p=c.next;s=p;do{if((s.tag&t)===t){c=void 0;var y=s.create,S=s.inst;c=y(),S.destroy=c}s=s.next}while(s!==p)}}catch(z){Zt(r,r.return,z)}}function El(t,r,s){try{var c=r.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var y=p.next;c=y;do{if((c.tag&t)===t){var S=c.inst,z=S.destroy;if(z!==void 0){S.destroy=void 0,p=r;var W=s,ie=z;try{ie()}catch(xe){Zt(p,W,xe)}}}c=c.next}while(c!==y)}}catch(xe){Zt(r,r.return,xe)}}function Px(t){var r=t.updateQueue;if(r!==null){var s=t.stateNode;try{Ip(r,s)}catch(c){Zt(t,t.return,c)}}}function Qx(t,r,s){s.props=pi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){Zt(t,r,c)}}function ro(t,r){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(p){Zt(t,r,p)}}function ya(t,r){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(p){Zt(t,r,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){Zt(t,r,p)}else s.current=null}function Zx(t){var r=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(p){Zt(t,t.return,p)}}function ff(t,r,s){try{var c=t.stateNode;_2(c,t.type,s,r),c[mn]=r}catch(p){Zt(t,t.return,p)}}function Jx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ml(t.type)||t.tag===4}function hf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Jx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ml(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function mf(t,r,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,r):(r=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,r.appendChild(t),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=hr));else if(c!==4&&(c===27&&Ml(t.type)&&(s=t.stateNode,r=null),t=t.child,t!==null))for(mf(t,r,s),t=t.sibling;t!==null;)mf(t,r,s),t=t.sibling}function Hc(t,r,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?s.insertBefore(t,r):s.appendChild(t);else if(c!==4&&(c===27&&Ml(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Hc(t,r,s),t=t.sibling;t!==null;)Hc(t,r,s),t=t.sibling}function e1(t){var r=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);Jn(r,c,s),r[yn]=t,r[mn]=s}catch(y){Zt(t,t.return,y)}}var Ka=!1,Mn=!1,pf=!1,t1=typeof WeakSet=="function"?WeakSet:Set,Xn=null;function m2(t,r){if(t=t.containerInfo,Bf=ou,t=hp(t),sd(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var p=c.anchorOffset,y=c.focusNode;c=c.focusOffset;try{s.nodeType,y.nodeType}catch{s=null;break e}var S=0,z=-1,W=-1,ie=0,xe=0,Ce=t,oe=null;t:for(;;){for(var fe;Ce!==s||p!==0&&Ce.nodeType!==3||(z=S+p),Ce!==y||c!==0&&Ce.nodeType!==3||(W=S+c),Ce.nodeType===3&&(S+=Ce.nodeValue.length),(fe=Ce.firstChild)!==null;)oe=Ce,Ce=fe;for(;;){if(Ce===t)break t;if(oe===s&&++ie===p&&(z=S),oe===y&&++xe===c&&(W=S),(fe=Ce.nextSibling)!==null)break;Ce=oe,oe=Ce.parentNode}Ce=fe}s=z===-1||W===-1?null:{start:z,end:W}}else s=null}s=s||{start:0,end:0}}else s=null;for(Of={focusedElem:t,selectionRange:s},ou=!1,Xn=r;Xn!==null;)if(r=Xn,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Xn=t;else for(;Xn!==null;){switch(r=Xn,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)p=t[s],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,s=r,p=y.memoizedProps,y=y.memoizedState,c=s.stateNode;try{var Ye=pi(s.type,p);t=c.getSnapshotBeforeUpdate(Ye,y),c.__reactInternalSnapshotBeforeUpdate=t}catch(st){Zt(s,s.return,st)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,s=t.nodeType,s===9)If(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":If(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Xn=t;break}Xn=r.return}}function n1(t,r,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Qa(t,s),c&4&&no(5,s);break;case 1:if(Qa(t,s),c&4)if(t=s.stateNode,r===null)try{t.componentDidMount()}catch(S){Zt(s,s.return,S)}else{var p=pi(s.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(p,r,t.__reactInternalSnapshotBeforeUpdate)}catch(S){Zt(s,s.return,S)}}c&64&&Px(s),c&512&&ro(s,s.return);break;case 3:if(Qa(t,s),c&64&&(t=s.updateQueue,t!==null)){if(r=null,s.child!==null)switch(s.child.tag){case 27:case 5:r=s.child.stateNode;break;case 1:r=s.child.stateNode}try{Ip(t,r)}catch(S){Zt(s,s.return,S)}}break;case 27:r===null&&c&4&&e1(s);case 26:case 5:Qa(t,s),r===null&&c&4&&Zx(s),c&512&&ro(s,s.return);break;case 12:Qa(t,s);break;case 31:Qa(t,s),c&4&&l1(t,s);break;case 13:Qa(t,s),c&4&&i1(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=j2.bind(null,s),q2(t,s))));break;case 22:if(c=s.memoizedState!==null||Ka,!c){r=r!==null&&r.memoizedState!==null||Mn,p=Ka;var y=Mn;Ka=c,(Mn=r)&&!y?Za(t,s,(s.subtreeFlags&8772)!==0):Qa(t,s),Ka=p,Mn=y}break;case 30:break;default:Qa(t,s)}}function r1(t){var r=t.alternate;r!==null&&(t.alternate=null,r1(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&Ts(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var bn=null,pr=!1;function Pa(t,r,s){for(s=s.child;s!==null;)a1(t,r,s),s=s.sibling}function a1(t,r,s){if(qe&&typeof qe.onCommitFiberUnmount=="function")try{qe.onCommitFiberUnmount(Oe,s)}catch{}switch(s.tag){case 26:Mn||ya(s,r),Pa(t,r,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Mn||ya(s,r);var c=bn,p=pr;Ml(s.type)&&(bn=s.stateNode,pr=!1),Pa(t,r,s),ho(s.stateNode),bn=c,pr=p;break;case 5:Mn||ya(s,r);case 6:if(c=bn,p=pr,bn=null,Pa(t,r,s),bn=c,pr=p,bn!==null)if(pr)try{(bn.nodeType===9?bn.body:bn.nodeName==="HTML"?bn.ownerDocument.body:bn).removeChild(s.stateNode)}catch(y){Zt(s,r,y)}else try{bn.removeChild(s.stateNode)}catch(y){Zt(s,r,y)}break;case 18:bn!==null&&(pr?(t=bn,P1(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),fs(t)):P1(bn,s.stateNode));break;case 4:c=bn,p=pr,bn=s.stateNode.containerInfo,pr=!0,Pa(t,r,s),bn=c,pr=p;break;case 0:case 11:case 14:case 15:El(2,s,r),Mn||El(4,s,r),Pa(t,r,s);break;case 1:Mn||(ya(s,r),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Qx(s,r,c)),Pa(t,r,s);break;case 21:Pa(t,r,s);break;case 22:Mn=(c=Mn)||s.memoizedState!==null,Pa(t,r,s),Mn=c;break;default:Pa(t,r,s)}}function l1(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{fs(t)}catch(s){Zt(r,r.return,s)}}}function i1(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{fs(t)}catch(s){Zt(r,r.return,s)}}function p2(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new t1),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new t1),r;default:throw Error(i(435,t.tag))}}function Uc(t,r){var s=p2(t);r.forEach(function(c){if(!s.has(c)){s.add(c);var p=S2.bind(null,t,c);c.then(p,p)}})}function xr(t,r){var s=r.deletions;if(s!==null)for(var c=0;c<s.length;c++){var p=s[c],y=t,S=r,z=S;e:for(;z!==null;){switch(z.tag){case 27:if(Ml(z.type)){bn=z.stateNode,pr=!1;break e}break;case 5:bn=z.stateNode,pr=!1;break e;case 3:case 4:bn=z.stateNode.containerInfo,pr=!0;break e}z=z.return}if(bn===null)throw Error(i(160));a1(y,S,p),bn=null,pr=!1,y=p.alternate,y!==null&&(y.return=null),p.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)s1(r,t),r=r.sibling}var aa=null;function s1(t,r){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:xr(r,t),gr(t),c&4&&(El(3,t,t.return),no(3,t),El(5,t,t.return));break;case 1:xr(r,t),gr(t),c&512&&(Mn||s===null||ya(s,s.return)),c&64&&Ka&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var p=aa;if(xr(r,t),gr(t),c&512&&(Mn||s===null||ya(s,s.return)),c&4){var y=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":y=p.getElementsByTagName("title")[0],(!y||y[Fa]||y[yn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=p.createElement(c),p.head.insertBefore(y,p.querySelector("head > title"))),Jn(y,c,s),y[yn]=t,Dn(y),c=y;break e;case"link":var S=s0("link","href",p).get(c+(s.href||""));if(S){for(var z=0;z<S.length;z++)if(y=S[z],y.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&y.getAttribute("rel")===(s.rel==null?null:s.rel)&&y.getAttribute("title")===(s.title==null?null:s.title)&&y.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(z,1);break t}}y=p.createElement(c),Jn(y,c,s),p.head.appendChild(y);break;case"meta":if(S=s0("meta","content",p).get(c+(s.content||""))){for(z=0;z<S.length;z++)if(y=S[z],y.getAttribute("content")===(s.content==null?null:""+s.content)&&y.getAttribute("name")===(s.name==null?null:s.name)&&y.getAttribute("property")===(s.property==null?null:s.property)&&y.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&y.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(z,1);break t}}y=p.createElement(c),Jn(y,c,s),p.head.appendChild(y);break;default:throw Error(i(468,c))}y[yn]=t,Dn(y),c=y}t.stateNode=c}else o0(p,t.type,t.stateNode);else t.stateNode=i0(p,c,t.memoizedProps);else y!==c?(y===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):y.count--,c===null?o0(p,t.type,t.stateNode):i0(p,c,t.memoizedProps)):c===null&&t.stateNode!==null&&ff(t,t.memoizedProps,s.memoizedProps)}break;case 27:xr(r,t),gr(t),c&512&&(Mn||s===null||ya(s,s.return)),s!==null&&c&4&&ff(t,t.memoizedProps,s.memoizedProps);break;case 5:if(xr(r,t),gr(t),c&512&&(Mn||s===null||ya(s,s.return)),t.flags&32){p=t.stateNode;try{ul(p,"")}catch(Ye){Zt(t,t.return,Ye)}}c&4&&t.stateNode!=null&&(p=t.memoizedProps,ff(t,p,s!==null?s.memoizedProps:p)),c&1024&&(pf=!0);break;case 6:if(xr(r,t),gr(t),c&4){if(t.stateNode===null)throw Error(i(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(Ye){Zt(t,t.return,Ye)}}break;case 3:if(au=null,p=aa,aa=nu(r.containerInfo),xr(r,t),aa=p,gr(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{fs(r.containerInfo)}catch(Ye){Zt(t,t.return,Ye)}pf&&(pf=!1,o1(t));break;case 4:c=aa,aa=nu(t.stateNode.containerInfo),xr(r,t),gr(t),aa=c;break;case 12:xr(r,t),gr(t);break;case 31:xr(r,t),gr(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Uc(t,c)));break;case 13:xr(r,t),gr(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Yc=Se()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Uc(t,c)));break;case 22:p=t.memoizedState!==null;var W=s!==null&&s.memoizedState!==null,ie=Ka,xe=Mn;if(Ka=ie||p,Mn=xe||W,xr(r,t),Mn=xe,Ka=ie,gr(t),c&8192)e:for(r=t.stateNode,r._visibility=p?r._visibility&-2:r._visibility|1,p&&(s===null||W||Ka||Mn||xi(t)),s=null,r=t;;){if(r.tag===5||r.tag===26){if(s===null){W=s=r;try{if(y=W.stateNode,p)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{z=W.stateNode;var Ce=W.memoizedProps.style,oe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;z.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Ye){Zt(W,W.return,Ye)}}}else if(r.tag===6){if(s===null){W=r;try{W.stateNode.nodeValue=p?"":W.memoizedProps}catch(Ye){Zt(W,W.return,Ye)}}}else if(r.tag===18){if(s===null){W=r;try{var fe=W.stateNode;p?Q1(fe,!0):Q1(W.stateNode,!1)}catch(Ye){Zt(W,W.return,Ye)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;s===r&&(s=null),r=r.return}s===r&&(s=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,Uc(t,s))));break;case 19:xr(r,t),gr(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Uc(t,c)));break;case 30:break;case 21:break;default:xr(r,t),gr(t)}}function gr(t){var r=t.flags;if(r&2){try{for(var s,c=t.return;c!==null;){if(Jx(c)){s=c;break}c=c.return}if(s==null)throw Error(i(160));switch(s.tag){case 27:var p=s.stateNode,y=hf(t);Hc(t,y,p);break;case 5:var S=s.stateNode;s.flags&32&&(ul(S,""),s.flags&=-33);var z=hf(t);Hc(t,z,S);break;case 3:case 4:var W=s.stateNode.containerInfo,ie=hf(t);mf(t,ie,W);break;default:throw Error(i(161))}}catch(xe){Zt(t,t.return,xe)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function o1(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;o1(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function Qa(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)n1(t,r.alternate,r),r=r.sibling}function xi(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:El(4,r,r.return),xi(r);break;case 1:ya(r,r.return);var s=r.stateNode;typeof s.componentWillUnmount=="function"&&Qx(r,r.return,s),xi(r);break;case 27:ho(r.stateNode);case 26:case 5:ya(r,r.return),xi(r);break;case 22:r.memoizedState===null&&xi(r);break;case 30:xi(r);break;default:xi(r)}t=t.sibling}}function Za(t,r,s){for(s=s&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,p=t,y=r,S=y.flags;switch(y.tag){case 0:case 11:case 15:Za(p,y,s),no(4,y);break;case 1:if(Za(p,y,s),c=y,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ie){Zt(c,c.return,ie)}if(c=y,p=c.updateQueue,p!==null){var z=c.stateNode;try{var W=p.shared.hiddenCallbacks;if(W!==null)for(p.shared.hiddenCallbacks=null,p=0;p<W.length;p++)Lp(W[p],z)}catch(ie){Zt(c,c.return,ie)}}s&&S&64&&Px(y),ro(y,y.return);break;case 27:e1(y);case 26:case 5:Za(p,y,s),s&&c===null&&S&4&&Zx(y),ro(y,y.return);break;case 12:Za(p,y,s);break;case 31:Za(p,y,s),s&&S&4&&l1(p,y);break;case 13:Za(p,y,s),s&&S&4&&i1(p,y);break;case 22:y.memoizedState===null&&Za(p,y,s),ro(y,y.return);break;case 30:break;default:Za(p,y,s)}r=r.sibling}}function xf(t,r){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&qs(s))}function gf(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&qs(t))}function la(t,r,s,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)c1(t,r,s,c),r=r.sibling}function c1(t,r,s,c){var p=r.flags;switch(r.tag){case 0:case 11:case 15:la(t,r,s,c),p&2048&&no(9,r);break;case 1:la(t,r,s,c);break;case 3:la(t,r,s,c),p&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&qs(t)));break;case 12:if(p&2048){la(t,r,s,c),t=r.stateNode;try{var y=r.memoizedProps,S=y.id,z=y.onPostCommit;typeof z=="function"&&z(S,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(W){Zt(r,r.return,W)}}else la(t,r,s,c);break;case 31:la(t,r,s,c);break;case 13:la(t,r,s,c);break;case 23:break;case 22:y=r.stateNode,S=r.alternate,r.memoizedState!==null?y._visibility&2?la(t,r,s,c):ao(t,r):y._visibility&2?la(t,r,s,c):(y._visibility|=2,ts(t,r,s,c,(r.subtreeFlags&10256)!==0||!1)),p&2048&&xf(S,r);break;case 24:la(t,r,s,c),p&2048&&gf(r.alternate,r);break;default:la(t,r,s,c)}}function ts(t,r,s,c,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,S=r,z=s,W=c,ie=S.flags;switch(S.tag){case 0:case 11:case 15:ts(y,S,z,W,p),no(8,S);break;case 23:break;case 22:var xe=S.stateNode;S.memoizedState!==null?xe._visibility&2?ts(y,S,z,W,p):ao(y,S):(xe._visibility|=2,ts(y,S,z,W,p)),p&&ie&2048&&xf(S.alternate,S);break;case 24:ts(y,S,z,W,p),p&&ie&2048&&gf(S.alternate,S);break;default:ts(y,S,z,W,p)}r=r.sibling}}function ao(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var s=t,c=r,p=c.flags;switch(c.tag){case 22:ao(s,c),p&2048&&xf(c.alternate,c);break;case 24:ao(s,c),p&2048&&gf(c.alternate,c);break;default:ao(s,c)}r=r.sibling}}var lo=8192;function ns(t,r,s){if(t.subtreeFlags&lo)for(t=t.child;t!==null;)u1(t,r,s),t=t.sibling}function u1(t,r,s){switch(t.tag){case 26:ns(t,r,s),t.flags&lo&&t.memoizedState!==null&&tw(s,aa,t.memoizedState,t.memoizedProps);break;case 5:ns(t,r,s);break;case 3:case 4:var c=aa;aa=nu(t.stateNode.containerInfo),ns(t,r,s),aa=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=lo,lo=16777216,ns(t,r,s),lo=c):ns(t,r,s));break;default:ns(t,r,s)}}function d1(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function io(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var s=0;s<r.length;s++){var c=r[s];Xn=c,h1(c,t)}d1(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)f1(t),t=t.sibling}function f1(t){switch(t.tag){case 0:case 11:case 15:io(t),t.flags&2048&&El(9,t,t.return);break;case 3:io(t);break;case 12:io(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,qc(t)):io(t);break;default:io(t)}}function qc(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var s=0;s<r.length;s++){var c=r[s];Xn=c,h1(c,t)}d1(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:El(8,r,r.return),qc(r);break;case 22:s=r.stateNode,s._visibility&2&&(s._visibility&=-3,qc(r));break;default:qc(r)}t=t.sibling}}function h1(t,r){for(;Xn!==null;){var s=Xn;switch(s.tag){case 0:case 11:case 15:El(8,s,r);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:qs(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,Xn=c;else e:for(s=t;Xn!==null;){c=Xn;var p=c.sibling,y=c.return;if(r1(c),c===s){Xn=null;break e}if(p!==null){p.return=y,Xn=p;break e}Xn=y}}}var x2={getCacheForType:function(t){var r=Qn(Tn),s=r.data.get(t);return s===void 0&&(s=t(),r.data.set(t,s)),s},cacheSignal:function(){return Qn(Tn).controller.signal}},g2=typeof WeakMap=="function"?WeakMap:Map,Vt=0,sn=null,Nt=null,Rt=0,Qt=0,Tr=null,Nl=!1,rs=!1,yf=!1,Ja=0,En=0,Al=0,gi=0,bf=0,Fr=0,as=0,so=null,yr=null,vf=!1,Yc=0,m1=0,Xc=1/0,Wc=null,Dl=null,On=0,Tl=null,ls=null,el=0,wf=0,kf=null,p1=null,oo=0,jf=null;function Rr(){return(Vt&2)!==0&&Rt!==0?Rt&-Rt:q.T!==null?Df():Ze()}function x1(){if(Fr===0)if((Rt&536870912)===0||Lt){var t=Bt;Bt<<=1,(Bt&3932160)===0&&(Bt=262144),Fr=t}else Fr=536870912;return t=Ar.current,t!==null&&(t.flags|=32),Fr}function br(t,r,s){(t===sn&&(Qt===2||Qt===9)||t.cancelPendingCommit!==null)&&(is(t,0),Fl(t,Rt,Fr,!1)),ke(t,s),((Vt&2)===0||t!==sn)&&(t===sn&&((Vt&2)===0&&(gi|=s),En===4&&Fl(t,Rt,Fr,!1)),ba(t))}function g1(t,r,s){if((Vt&6)!==0)throw Error(i(327));var c=!s&&(r&127)===0&&(r&t.expiredLanes)===0||Z(t,r),p=c?v2(t,r):Cf(t,r,!0),y=c;do{if(p===0){rs&&!c&&Fl(t,r,0,!1);break}else{if(s=t.current.alternate,y&&!y2(s)){p=Cf(t,r,!1),y=!1;continue}if(p===2){if(y=r,t.errorRecoveryDisabledLanes&y)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){r=S;e:{var z=t;p=so;var W=z.current.memoizedState.isDehydrated;if(W&&(is(z,S).flags|=256),S=Cf(z,S,!1),S!==2){if(yf&&!W){z.errorRecoveryDisabledLanes|=y,gi|=y,p=4;break e}y=yr,yr=p,y!==null&&(yr===null?yr=y:yr.push.apply(yr,y))}p=S}if(y=!1,p!==2)continue}}if(p===1){is(t,0),Fl(t,r,0,!0);break}e:{switch(c=t,y=p,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:Fl(c,r,Fr,!Nl);break e;case 2:yr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(p=Yc+300-Se(),10<p)){if(Fl(c,r,Fr,!Nl),kn(c,0,!0)!==0)break e;el=r,c.timeoutHandle=G1(y1.bind(null,c,s,yr,Wc,vf,r,Fr,gi,as,Nl,y,"Throttled",-0,0),p);break e}y1(c,s,yr,Wc,vf,r,Fr,gi,as,Nl,y,null,-0,0)}}break}while(!0);ba(t)}function y1(t,r,s,c,p,y,S,z,W,ie,xe,Ce,oe,fe){if(t.timeoutHandle=-1,Ce=r.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hr},u1(r,y,Ce);var Ye=(y&62914560)===y?Yc-Se():(y&4194048)===y?m1-Se():0;if(Ye=nw(Ce,Ye),Ye!==null){el=y,t.cancelPendingCommit=Ye(E1.bind(null,t,r,y,s,c,p,S,z,W,xe,Ce,null,oe,fe)),Fl(t,y,S,!ie);return}}E1(t,r,y,s,c,p,S,z,W)}function y2(t){for(var r=t;;){var s=r.tag;if((s===0||s===11||s===15)&&r.flags&16384&&(s=r.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var p=s[c],y=p.getSnapshot;p=p.value;try{if(!Er(y(),p))return!1}catch{return!1}}if(s=r.child,r.subtreeFlags&16384&&s!==null)s.return=r,r=s;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Fl(t,r,s,c){r&=~bf,r&=~gi,t.suspendedLanes|=r,t.pingedLanes&=~r,c&&(t.warmLanes|=r),c=t.expirationTimes;for(var p=r;0<p;){var y=31-Qe(p),S=1<<y;c[y]=-1,p&=~S}s!==0&&jn(t,s,r)}function Vc(){return(Vt&6)===0?(co(0),!1):!0}function Sf(){if(Nt!==null){if(Qt===0)var t=Nt.return;else t=Nt,qa=oi=null,Ld(t),Pi=null,Xs=0,t=Nt;for(;t!==null;)Kx(t.alternate,t),t=t.return;Nt=null}}function is(t,r){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,$2(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),el=0,Sf(),sn=t,Nt=s=Ha(t.current,null),Rt=r,Qt=0,Tr=null,Nl=!1,rs=Z(t,r),yf=!1,as=Fr=bf=gi=Al=En=0,yr=so=null,vf=!1,(r&8)!==0&&(r|=r&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=r;0<c;){var p=31-Qe(c),y=1<<p;r|=t[p],c&=~y}return Ja=r,mc(),s}function b1(t,r){gt=null,q.H=Js,r===Ki||r===kc?(r=_p(),Qt=3):r===Nd?(r=_p(),Qt=4):Qt=r===tf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Tr=r,Nt===null&&(En=1,Bc(t,qr(r,t.current)))}function v1(){var t=Ar.current;return t===null?!0:(Rt&4194048)===Rt?Vr===null:(Rt&62914560)===Rt||(Rt&536870912)!==0?t===Vr:!1}function w1(){var t=q.H;return q.H=Js,t===null?Js:t}function k1(){var t=q.A;return q.A=x2,t}function Gc(){En=4,Nl||(Rt&4194048)!==Rt&&Ar.current!==null||(rs=!0),(Al&134217727)===0&&(gi&134217727)===0||sn===null||Fl(sn,Rt,Fr,!1)}function Cf(t,r,s){var c=Vt;Vt|=2;var p=w1(),y=k1();(sn!==t||Rt!==r)&&(Wc=null,is(t,r)),r=!1;var S=En;e:do try{if(Qt!==0&&Nt!==null){var z=Nt,W=Tr;switch(Qt){case 8:Sf(),S=6;break e;case 3:case 2:case 9:case 6:Ar.current===null&&(r=!0);var ie=Qt;if(Qt=0,Tr=null,ss(t,z,W,ie),s&&rs){S=0;break e}break;default:ie=Qt,Qt=0,Tr=null,ss(t,z,W,ie)}}b2(),S=En;break}catch(xe){b1(t,xe)}while(!0);return r&&t.shellSuspendCounter++,qa=oi=null,Vt=c,q.H=p,q.A=y,Nt===null&&(sn=null,Rt=0,mc()),S}function b2(){for(;Nt!==null;)j1(Nt)}function v2(t,r){var s=Vt;Vt|=2;var c=w1(),p=k1();sn!==t||Rt!==r?(Wc=null,Xc=Se()+500,is(t,r)):rs=Z(t,r);e:do try{if(Qt!==0&&Nt!==null){r=Nt;var y=Tr;t:switch(Qt){case 1:Qt=0,Tr=null,ss(t,r,y,1);break;case 2:case 9:if(Mp(y)){Qt=0,Tr=null,S1(r);break}r=function(){Qt!==2&&Qt!==9||sn!==t||(Qt=7),ba(t)},y.then(r,r);break e;case 3:Qt=7;break e;case 4:Qt=5;break e;case 7:Mp(y)?(Qt=0,Tr=null,S1(r)):(Qt=0,Tr=null,ss(t,r,y,7));break;case 5:var S=null;switch(Nt.tag){case 26:S=Nt.memoizedState;case 5:case 27:var z=Nt;if(S?c0(S):z.stateNode.complete){Qt=0,Tr=null;var W=z.sibling;if(W!==null)Nt=W;else{var ie=z.return;ie!==null?(Nt=ie,Kc(ie)):Nt=null}break t}}Qt=0,Tr=null,ss(t,r,y,5);break;case 6:Qt=0,Tr=null,ss(t,r,y,6);break;case 8:Sf(),En=6;break e;default:throw Error(i(462))}}w2();break}catch(xe){b1(t,xe)}while(!0);return qa=oi=null,q.H=c,q.A=p,Vt=s,Nt!==null?0:(sn=null,Rt=0,mc(),En)}function w2(){for(;Nt!==null&&!Bn();)j1(Nt)}function j1(t){var r=Vx(t.alternate,t,Ja);t.memoizedProps=t.pendingProps,r===null?Kc(t):Nt=r}function S1(t){var r=t,s=r.alternate;switch(r.tag){case 15:case 0:r=Hx(s,r,r.pendingProps,r.type,void 0,Rt);break;case 11:r=Hx(s,r,r.pendingProps,r.type.render,r.ref,Rt);break;case 5:Ld(r);default:Kx(s,r),r=Nt=kp(r,Ja),r=Vx(s,r,Ja)}t.memoizedProps=t.pendingProps,r===null?Kc(t):Nt=r}function ss(t,r,s,c){qa=oi=null,Ld(r),Pi=null,Xs=0;var p=r.return;try{if(c2(t,p,r,s,Rt)){En=1,Bc(t,qr(s,t.current)),Nt=null;return}}catch(y){if(p!==null)throw Nt=p,y;En=1,Bc(t,qr(s,t.current)),Nt=null;return}r.flags&32768?(Lt||c===1?t=!0:rs||(Rt&536870912)!==0?t=!1:(Nl=t=!0,(c===2||c===9||c===3||c===6)&&(c=Ar.current,c!==null&&c.tag===13&&(c.flags|=16384))),C1(r,t)):Kc(r)}function Kc(t){var r=t;do{if((r.flags&32768)!==0){C1(r,Nl);return}t=r.return;var s=f2(r.alternate,r,Ja);if(s!==null){Nt=s;return}if(r=r.sibling,r!==null){Nt=r;return}Nt=r=t}while(r!==null);En===0&&(En=5)}function C1(t,r){do{var s=h2(t.alternate,t);if(s!==null){s.flags&=32767,Nt=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!r&&(t=t.sibling,t!==null)){Nt=t;return}Nt=t=s}while(t!==null);En=6,Nt=null}function E1(t,r,s,c,p,y,S,z,W){t.cancelPendingCommit=null;do Pc();while(On!==0);if((Vt&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=fd,kt(t,s,y,S,z,W),t===sn&&(Nt=sn=null,Rt=0),ls=r,Tl=t,el=s,wf=y,kf=p,p1=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,C2(re,function(){return F1(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=q.T,q.T=null,p=se.p,se.p=2,S=Vt,Vt|=4;try{m2(t,r,s)}finally{Vt=S,se.p=p,q.T=c}}On=1,N1(),A1(),D1()}}function N1(){if(On===1){On=0;var t=Tl,r=ls,s=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||s){s=q.T,q.T=null;var c=se.p;se.p=2;var p=Vt;Vt|=4;try{s1(r,t);var y=Of,S=hp(t.containerInfo),z=y.focusedElem,W=y.selectionRange;if(S!==z&&z&&z.ownerDocument&&fp(z.ownerDocument.documentElement,z)){if(W!==null&&sd(z)){var ie=W.start,xe=W.end;if(xe===void 0&&(xe=ie),"selectionStart"in z)z.selectionStart=ie,z.selectionEnd=Math.min(xe,z.value.length);else{var Ce=z.ownerDocument||document,oe=Ce&&Ce.defaultView||window;if(oe.getSelection){var fe=oe.getSelection(),Ye=z.textContent.length,st=Math.min(W.start,Ye),nn=W.end===void 0?st:Math.min(W.end,Ye);!fe.extend&&st>nn&&(S=nn,nn=st,st=S);var ee=dp(z,st),Q=dp(z,nn);if(ee&&Q&&(fe.rangeCount!==1||fe.anchorNode!==ee.node||fe.anchorOffset!==ee.offset||fe.focusNode!==Q.node||fe.focusOffset!==Q.offset)){var le=Ce.createRange();le.setStart(ee.node,ee.offset),fe.removeAllRanges(),st>nn?(fe.addRange(le),fe.extend(Q.node,Q.offset)):(le.setEnd(Q.node,Q.offset),fe.addRange(le))}}}}for(Ce=[],fe=z;fe=fe.parentNode;)fe.nodeType===1&&Ce.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<Ce.length;z++){var be=Ce[z];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}ou=!!Bf,Of=Bf=null}finally{Vt=p,se.p=c,q.T=s}}t.current=r,On=2}}function A1(){if(On===2){On=0;var t=Tl,r=ls,s=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||s){s=q.T,q.T=null;var c=se.p;se.p=2;var p=Vt;Vt|=4;try{n1(t,r.alternate,r)}finally{Vt=p,se.p=c,q.T=s}}On=3}}function D1(){if(On===4||On===3){On=0,pe();var t=Tl,r=ls,s=el,c=p1;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?On=5:(On=0,ls=Tl=null,T1(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Dl=null),We(s),r=r.stateNode,qe&&typeof qe.onCommitFiberRoot=="function")try{qe.onCommitFiberRoot(Oe,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=q.T,p=se.p,se.p=2,q.T=null;try{for(var y=t.onRecoverableError,S=0;S<c.length;S++){var z=c[S];y(z.value,{componentStack:z.stack})}}finally{q.T=r,se.p=p}}(el&3)!==0&&Pc(),ba(t),p=t.pendingLanes,(s&261930)!==0&&(p&42)!==0?t===jf?oo++:(oo=0,jf=t):oo=0,co(0)}}function T1(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,qs(r)))}function Pc(){return N1(),A1(),D1(),F1()}function F1(){if(On!==5)return!1;var t=Tl,r=wf;wf=0;var s=We(el),c=q.T,p=se.p;try{se.p=32>s?32:s,q.T=null,s=kf,kf=null;var y=Tl,S=el;if(On=0,ls=Tl=null,el=0,(Vt&6)!==0)throw Error(i(331));var z=Vt;if(Vt|=4,f1(y.current),c1(y,y.current,S,s),Vt=z,co(0,!1),qe&&typeof qe.onPostCommitFiberRoot=="function")try{qe.onPostCommitFiberRoot(Oe,y)}catch{}return!0}finally{se.p=p,q.T=c,T1(t,r)}}function R1(t,r,s){r=qr(s,r),r=ef(t.stateNode,r,2),t=jl(t,r,2),t!==null&&(ke(t,2),ba(t))}function Zt(t,r,s){if(t.tag===3)R1(t,t,s);else for(;r!==null;){if(r.tag===3){R1(r,t,s);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Dl===null||!Dl.has(c))){t=qr(s,t),s=Mx(2),c=jl(r,s,2),c!==null&&(zx(s,c,r,t),ke(c,2),ba(c));break}}r=r.return}}function Ef(t,r,s){var c=t.pingCache;if(c===null){c=t.pingCache=new g2;var p=new Set;c.set(r,p)}else p=c.get(r),p===void 0&&(p=new Set,c.set(r,p));p.has(s)||(yf=!0,p.add(s),t=k2.bind(null,t,r,s),r.then(t,t))}function k2(t,r,s){var c=t.pingCache;c!==null&&c.delete(r),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,sn===t&&(Rt&s)===s&&(En===4||En===3&&(Rt&62914560)===Rt&&300>Se()-Yc?(Vt&2)===0&&is(t,0):bf|=s,as===Rt&&(as=0)),ba(t)}function M1(t,r){r===0&&(r=at()),t=li(t,r),t!==null&&(ke(t,r),ba(t))}function j2(t){var r=t.memoizedState,s=0;r!==null&&(s=r.retryLane),M1(t,s)}function S2(t,r){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,p=t.memoizedState;p!==null&&(s=p.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(r),M1(t,s)}function C2(t,r){return Tt(t,r)}var Qc=null,os=null,Nf=!1,Zc=!1,Af=!1,Rl=0;function ba(t){t!==os&&t.next===null&&(os===null?Qc=os=t:os=os.next=t),Zc=!0,Nf||(Nf=!0,N2())}function co(t,r){if(!Af&&Zc){Af=!0;do for(var s=!1,c=Qc;c!==null;){if(t!==0){var p=c.pendingLanes;if(p===0)var y=0;else{var S=c.suspendedLanes,z=c.pingedLanes;y=(1<<31-Qe(42|t)+1)-1,y&=p&~(S&~z),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(s=!0,O1(c,y))}else y=Rt,y=kn(c,c===sn?y:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(y&3)===0||Z(c,y)||(s=!0,O1(c,y));c=c.next}while(s);Af=!1}}function E2(){z1()}function z1(){Zc=Nf=!1;var t=0;Rl!==0&&O2()&&(t=Rl);for(var r=Se(),s=null,c=Qc;c!==null;){var p=c.next,y=_1(c,r);y===0?(c.next=null,s===null?Qc=p:s.next=p,p===null&&(os=s)):(s=c,(t!==0||(y&3)!==0)&&(Zc=!0)),c=p}On!==0&&On!==5||co(t),Rl!==0&&(Rl=0)}function _1(t,r){for(var s=t.suspendedLanes,c=t.pingedLanes,p=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var S=31-Qe(y),z=1<<S,W=p[S];W===-1?((z&s)===0||(z&c)!==0)&&(p[S]=$e(z,r)):W<=r&&(t.expiredLanes|=z),y&=~z}if(r=sn,s=Rt,s=kn(t,t===r?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===r&&(Qt===2||Qt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&Ct(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Z(t,s)){if(r=s&-s,r===t.callbackPriority)return r;switch(c!==null&&Ct(c),We(s)){case 2:case 8:s=ce;break;case 32:s=re;break;case 268435456:s=we;break;default:s=re}return c=B1.bind(null,t),s=Tt(s,c),t.callbackPriority=r,t.callbackNode=s,r}return c!==null&&c!==null&&Ct(c),t.callbackPriority=2,t.callbackNode=null,2}function B1(t,r){if(On!==0&&On!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Pc()&&t.callbackNode!==s)return null;var c=Rt;return c=kn(t,t===sn?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(g1(t,c,r),_1(t,Se()),t.callbackNode!=null&&t.callbackNode===s?B1.bind(null,t):null)}function O1(t,r){if(Pc())return null;g1(t,r,!0)}function N2(){L2(function(){(Vt&6)!==0?Tt(G,E2):z1()})}function Df(){if(Rl===0){var t=Vi;t===0&&(t=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Rl=t}return Rl}function $1(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:zi(""+t)}function L1(t,r){var s=r.ownerDocument.createElement("input");return s.name=r.name,s.value=r.value,t.id&&s.setAttribute("form",t.id),r.parentNode.insertBefore(s,r),t=new FormData(t),s.parentNode.removeChild(s),t}function A2(t,r,s,c,p){if(r==="submit"&&s&&s.stateNode===p){var y=$1((p[mn]||null).action),S=c.submitter;S&&(r=(r=S[mn]||null)?$1(r.formAction):S.getAttribute("formAction"),r!==null&&(y=r,S=null));var z=new ml("action","action",null,c,p);t.push({event:z,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Rl!==0){var W=S?L1(p,S):new FormData(p);Gd(s,{pending:!0,data:W,method:p.method,action:y},null,W)}}else typeof y=="function"&&(z.preventDefault(),W=S?L1(p,S):new FormData(p),Gd(s,{pending:!0,data:W,method:p.method,action:y},y,W))},currentTarget:p}]})}}for(var Tf=0;Tf<dd.length;Tf++){var Ff=dd[Tf],D2=Ff.toLowerCase(),T2=Ff[0].toUpperCase()+Ff.slice(1);ra(D2,"on"+T2)}ra(xp,"onAnimationEnd"),ra(gp,"onAnimationIteration"),ra(yp,"onAnimationStart"),ra("dblclick","onDoubleClick"),ra("focusin","onFocus"),ra("focusout","onBlur"),ra(Wv,"onTransitionRun"),ra(Vv,"onTransitionStart"),ra(Gv,"onTransitionCancel"),ra(bp,"onTransitionEnd"),jr("onMouseEnter",["mouseout","mouseover"]),jr("onMouseLeave",["mouseout","mouseover"]),jr("onPointerEnter",["pointerout","pointerover"]),jr("onPointerLeave",["pointerout","pointerover"]),fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var uo="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(" "),F2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(uo));function I1(t,r){r=(r&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],p=c.event;c=c.listeners;e:{var y=void 0;if(r)for(var S=c.length-1;0<=S;S--){var z=c[S],W=z.instance,ie=z.currentTarget;if(z=z.listener,W!==y&&p.isPropagationStopped())break e;y=z,p.currentTarget=ie;try{y(p)}catch(xe){hc(xe)}p.currentTarget=null,y=W}else for(S=0;S<c.length;S++){if(z=c[S],W=z.instance,ie=z.currentTarget,z=z.listener,W!==y&&p.isPropagationStopped())break e;y=z,p.currentTarget=ie;try{y(p)}catch(xe){hc(xe)}p.currentTarget=null,y=W}}}}function At(t,r){var s=r[Ql];s===void 0&&(s=r[Ql]=new Set);var c=t+"__bubble";s.has(c)||(H1(r,t,2,!1),s.add(c))}function Rf(t,r,s){var c=0;r&&(c|=4),H1(s,t,c,r)}var Jc="_reactListening"+Math.random().toString(36).slice(2);function Mf(t){if(!t[Jc]){t[Jc]=!0,za.forEach(function(s){s!=="selectionchange"&&(F2.has(s)||Rf(s,!1,t),Rf(s,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[Jc]||(r[Jc]=!0,Rf("selectionchange",!1,r))}}function H1(t,r,s,c){switch(x0(r)){case 2:var p=lw;break;case 8:p=iw;break;default:p=Gf}s=p.bind(null,r,s,t),p=void 0,!Ms||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),c?p!==void 0?t.addEventListener(r,s,{capture:!0,passive:p}):t.addEventListener(r,s,!0):p!==void 0?t.addEventListener(r,s,{passive:p}):t.addEventListener(r,s,!1)}function zf(t,r,s,c,p){var y=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var z=c.stateNode.containerInfo;if(z===p)break;if(S===4)for(S=c.return;S!==null;){var W=S.tag;if((W===3||W===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;z!==null;){if(S=ca(z),S===null)return;if(W=S.tag,W===5||W===6||W===26||W===27){c=y=S;continue e}z=z.parentNode}}c=c.return}dl(function(){var ie=y,xe=fa(s),Ce=[];e:{var oe=vp.get(t);if(oe!==void 0){var fe=ml,Ye=t;switch(t){case"keypress":if(Bi(s)===0)break e;case"keydown":case"keyup":fe=cc;break;case"focusin":Ye="focus",fe=Hr;break;case"focusout":Ye="blur",fe=Hr;break;case"beforeblur":case"afterblur":fe=Hr;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Jo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=tc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=F;break;case xp:case gp:case yp:fe=_s;break;case bp:fe=ae;break;case"scroll":case"scrollend":fe=rd;break;case"wheel":fe=je;break;case"copy":case"cut":case"paste":fe=rc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=Bs;break;case"toggle":case"beforetoggle":fe=It}var st=(r&4)!==0,nn=!st&&(t==="scroll"||t==="scrollend"),ee=st?oe!==null?oe+"Capture":null:oe;st=[];for(var Q=ie,le;Q!==null;){var be=Q;if(le=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||le===null||ee===null||(be=ha(Q,ee),be!=null&&st.push(fo(Q,be,le))),nn)break;Q=Q.return}0<st.length&&(oe=new fe(oe,Ye,null,s,xe),Ce.push({event:oe,listeners:st}))}}if((r&7)===0){e:{if(oe=t==="mouseover"||t==="pointerover",fe=t==="mouseout"||t==="pointerout",oe&&s!==_i&&(Ye=s.relatedTarget||s.fromElement)&&(ca(Ye)||Ye[$r]))break e;if((fe||oe)&&(oe=xe.window===xe?xe:(oe=xe.ownerDocument)?oe.defaultView||oe.parentWindow:window,fe?(Ye=s.relatedTarget||s.toElement,fe=ie,Ye=Ye?ca(Ye):null,Ye!==null&&(nn=u(Ye),st=Ye.tag,Ye!==nn||st!==5&&st!==27&&st!==6)&&(Ye=null)):(fe=null,Ye=ie),fe!==Ye)){if(st=Jo,be="onMouseLeave",ee="onMouseEnter",Q="mouse",(t==="pointerout"||t==="pointerover")&&(st=Bs,be="onPointerLeave",ee="onPointerEnter",Q="pointer"),nn=fe==null?oe:Ma(fe),le=Ye==null?oe:Ma(Ye),oe=new st(be,Q+"leave",fe,s,xe),oe.target=nn,oe.relatedTarget=le,be=null,ca(xe)===ie&&(st=new st(ee,Q+"enter",Ye,s,xe),st.target=le,st.relatedTarget=nn,be=st),nn=be,fe&&Ye)t:{for(st=R2,ee=fe,Q=Ye,le=0,be=ee;be;be=st(be))le++;be=0;for(var rt=Q;rt;rt=st(rt))be++;for(;0<le-be;)ee=st(ee),le--;for(;0<be-le;)Q=st(Q),be--;for(;le--;){if(ee===Q||Q!==null&&ee===Q.alternate){st=ee;break t}ee=st(ee),Q=st(Q)}st=null}else st=null;fe!==null&&U1(Ce,oe,fe,st,!1),Ye!==null&&nn!==null&&U1(Ce,nn,Ye,st,!0)}}e:{if(oe=ie?Ma(ie):window,fe=oe.nodeName&&oe.nodeName.toLowerCase(),fe==="select"||fe==="input"&&oe.type==="file")var qt=lp;else if(rp(oe))if(ip)qt=qv;else{qt=Hv;var Ge=Iv}else fe=oe.nodeName,!fe||fe.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&qn(ie.elementType)&&(qt=lp):qt=Uv;if(qt&&(qt=qt(t,ie))){ap(Ce,qt,s,xe);break e}Ge&&Ge(t,oe,ie),t==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&Jl(oe,"number",oe.value)}switch(Ge=ie?Ma(ie):window,t){case"focusin":(rp(Ge)||Ge.contentEditable==="true")&&(Li=Ge,od=ie,Is=null);break;case"focusout":Is=od=Li=null;break;case"mousedown":cd=!0;break;case"contextmenu":case"mouseup":case"dragend":cd=!1,mp(Ce,s,xe);break;case"selectionchange":if(Xv)break;case"keydown":case"keyup":mp(Ce,s,xe)}var vt;if(tt)e:{switch(t){case"compositionstart":var Mt="onCompositionStart";break e;case"compositionend":Mt="onCompositionEnd";break e;case"compositionupdate":Mt="onCompositionUpdate";break e}Mt=void 0}else pn?ct(t,s)&&(Mt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Mt="onCompositionStart");Mt&&(Ft&&s.locale!=="ko"&&(pn||Mt!=="onCompositionStart"?Mt==="onCompositionEnd"&&pn&&(vt=hl()):(ma=xe,ln="value"in ma?ma.value:ma.textContent,pn=!0)),Ge=eu(ie,Mt),0<Ge.length&&(Mt=new lc(Mt,t,null,s,xe),Ce.push({event:Mt,listeners:Ge}),vt?Mt.data=vt:(vt=$t(s),vt!==null&&(Mt.data=vt)))),(vt=mt?dn(t,s):Ov(t,s))&&(Mt=eu(ie,"onBeforeInput"),0<Mt.length&&(Ge=new lc("onBeforeInput","beforeinput",null,s,xe),Ce.push({event:Ge,listeners:Mt}),Ge.data=vt)),A2(Ce,t,ie,s,xe)}I1(Ce,r)})}function fo(t,r,s){return{instance:t,listener:r,currentTarget:s}}function eu(t,r){for(var s=r+"Capture",c=[];t!==null;){var p=t,y=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||y===null||(p=ha(t,s),p!=null&&c.unshift(fo(t,p,y)),p=ha(t,r),p!=null&&c.push(fo(t,p,y))),t.tag===3)return c;t=t.return}return[]}function R2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function U1(t,r,s,c,p){for(var y=r._reactName,S=[];s!==null&&s!==c;){var z=s,W=z.alternate,ie=z.stateNode;if(z=z.tag,W!==null&&W===c)break;z!==5&&z!==26&&z!==27||ie===null||(W=ie,p?(ie=ha(s,y),ie!=null&&S.unshift(fo(s,ie,W))):p||(ie=ha(s,y),ie!=null&&S.push(fo(s,ie,W)))),s=s.return}S.length!==0&&t.push({event:r,listeners:S})}var M2=/\r\n?/g,z2=/\u0000|\uFFFD/g;function q1(t){return(typeof t=="string"?t:""+t).replace(M2,`
|
|
49
49
|
`).replace(z2,"")}function Y1(t,r){return r=q1(r),q1(t)===r}function tn(t,r,s,c,p,y){switch(s){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||ul(t,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&ul(t,""+c);break;case"className":cl(t,"class",c);break;case"tabIndex":cl(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":cl(t,s,c);break;case"style":ta(t,c,y);break;case"data":if(r!=="object"){cl(t,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=zi(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 y=="function"&&(s==="formAction"?(r!=="input"&&tn(t,r,"name",p.name,p,null),tn(t,r,"formEncType",p.formEncType,p,null),tn(t,r,"formMethod",p.formMethod,p,null),tn(t,r,"formTarget",p.formTarget,p,null)):(tn(t,r,"encType",p.encType,p,null),tn(t,r,"method",p.method,p,null),tn(t,r,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=zi(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=hr);break;case"onScroll":c!=null&&At("scroll",t);break;case"onScrollEnd":c!=null&&At("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=zi(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":At("beforetoggle",t),At("toggle",t),Zl(t,"popover",c);break;case"xlinkActuate":Lr(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Lr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Lr(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Lr(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Lr(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Lr(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Lr(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Lr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Lr(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Zl(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=da.get(s)||s,Zl(t,s,c))}}function _f(t,r,s,c,p,y){switch(s){case"style":ta(t,c,y);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=s}}break;case"children":typeof c=="string"?ul(t,c):(typeof c=="number"||typeof c=="bigint")&&ul(t,""+c);break;case"onScroll":c!=null&&At("scroll",t);break;case"onScrollEnd":c!=null&&At("scrollend",t);break;case"onClick":c!=null&&(t.onclick=hr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ri.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(p=s.endsWith("Capture"),r=s.slice(2,p?s.length-7:void 0),y=t[mn]||null,y=y!=null?y[s]:null,typeof y=="function"&&t.removeEventListener(r,y,p),typeof c=="function")){typeof y!="function"&&y!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(r,c,p);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):Zl(t,s,c)}}}function Jn(t,r,s){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":At("error",t),At("load",t);var c=!1,p=!1,y;for(y in s)if(s.hasOwnProperty(y)){var S=s[y];if(S!=null)switch(y){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:tn(t,r,y,S,s,null)}}p&&tn(t,r,"srcSet",s.srcSet,s,null),c&&tn(t,r,"src",s.src,s,null);return;case"input":At("invalid",t);var z=y=S=p=null,W=null,ie=null;for(c in s)if(s.hasOwnProperty(c)){var xe=s[c];if(xe!=null)switch(c){case"name":p=xe;break;case"type":S=xe;break;case"checked":W=xe;break;case"defaultChecked":ie=xe;break;case"value":y=xe;break;case"defaultValue":z=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(i(137,r));break;default:tn(t,r,c,xe,s,null)}}Qo(t,y,z,W,ie,S,p,!1);return;case"select":At("invalid",t),c=S=y=null;for(p in s)if(s.hasOwnProperty(p)&&(z=s[p],z!=null))switch(p){case"value":y=z;break;case"defaultValue":S=z;break;case"multiple":c=z;default:tn(t,r,p,z,s,null)}r=y,s=S,t.multiple=!!c,r!=null?Gn(t,!!c,r,!1):s!=null&&Gn(t,!!c,s,!0);return;case"textarea":At("invalid",t),y=p=c=null;for(S in s)if(s.hasOwnProperty(S)&&(z=s[S],z!=null))switch(S){case"value":c=z;break;case"defaultValue":p=z;break;case"children":y=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(i(91));break;default:tn(t,r,S,z,s,null)}ua(t,c,p,y);return;case"option":for(W in s)if(s.hasOwnProperty(W)&&(c=s[W],c!=null))switch(W){case"selected":t.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:tn(t,r,W,c,s,null)}return;case"dialog":At("beforetoggle",t),At("toggle",t),At("cancel",t),At("close",t);break;case"iframe":case"object":At("load",t);break;case"video":case"audio":for(c=0;c<uo.length;c++)At(uo[c],t);break;case"image":At("error",t),At("load",t);break;case"details":At("toggle",t);break;case"embed":case"source":case"link":At("error",t),At("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in s)if(s.hasOwnProperty(ie)&&(c=s[ie],c!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:tn(t,r,ie,c,s,null)}return;default:if(qn(r)){for(xe in s)s.hasOwnProperty(xe)&&(c=s[xe],c!==void 0&&_f(t,r,xe,c,s,void 0));return}}for(z in s)s.hasOwnProperty(z)&&(c=s[z],c!=null&&tn(t,r,z,c,s,null))}function _2(t,r,s,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,y=null,S=null,z=null,W=null,ie=null,xe=null;for(fe in s){var Ce=s[fe];if(s.hasOwnProperty(fe)&&Ce!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":W=Ce;default:c.hasOwnProperty(fe)||tn(t,r,fe,null,c,Ce)}}for(var oe in c){var fe=c[oe];if(Ce=s[oe],c.hasOwnProperty(oe)&&(fe!=null||Ce!=null))switch(oe){case"type":y=fe;break;case"name":p=fe;break;case"checked":ie=fe;break;case"defaultChecked":xe=fe;break;case"value":S=fe;break;case"defaultValue":z=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(i(137,r));break;default:fe!==Ce&&tn(t,r,oe,fe,c,Ce)}}Mi(t,S,z,W,ie,xe,y,p);return;case"select":fe=S=z=oe=null;for(y in s)if(W=s[y],s.hasOwnProperty(y)&&W!=null)switch(y){case"value":break;case"multiple":fe=W;default:c.hasOwnProperty(y)||tn(t,r,y,null,c,W)}for(p in c)if(y=c[p],W=s[p],c.hasOwnProperty(p)&&(y!=null||W!=null))switch(p){case"value":oe=y;break;case"defaultValue":z=y;break;case"multiple":S=y;default:y!==W&&tn(t,r,p,y,c,W)}r=z,s=S,c=fe,oe!=null?Gn(t,!!s,oe,!1):!!c!=!!s&&(r!=null?Gn(t,!!s,r,!0):Gn(t,!!s,s?[]:"",!1));return;case"textarea":fe=oe=null;for(z in s)if(p=s[z],s.hasOwnProperty(z)&&p!=null&&!c.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:tn(t,r,z,null,c,p)}for(S in c)if(p=c[S],y=s[S],c.hasOwnProperty(S)&&(p!=null||y!=null))switch(S){case"value":oe=p;break;case"defaultValue":fe=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==y&&tn(t,r,S,p,c,y)}Oa(t,oe,fe);return;case"option":for(var Ye in s)if(oe=s[Ye],s.hasOwnProperty(Ye)&&oe!=null&&!c.hasOwnProperty(Ye))switch(Ye){case"selected":t.selected=!1;break;default:tn(t,r,Ye,null,c,oe)}for(W in c)if(oe=c[W],fe=s[W],c.hasOwnProperty(W)&&oe!==fe&&(oe!=null||fe!=null))switch(W){case"selected":t.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:tn(t,r,W,oe,c,fe)}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 st in s)oe=s[st],s.hasOwnProperty(st)&&oe!=null&&!c.hasOwnProperty(st)&&tn(t,r,st,null,c,oe);for(ie in c)if(oe=c[ie],fe=s[ie],c.hasOwnProperty(ie)&&oe!==fe&&(oe!=null||fe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,r));break;default:tn(t,r,ie,oe,c,fe)}return;default:if(qn(r)){for(var nn in s)oe=s[nn],s.hasOwnProperty(nn)&&oe!==void 0&&!c.hasOwnProperty(nn)&&_f(t,r,nn,void 0,c,oe);for(xe in c)oe=c[xe],fe=s[xe],!c.hasOwnProperty(xe)||oe===fe||oe===void 0&&fe===void 0||_f(t,r,xe,oe,c,fe);return}}for(var ee in s)oe=s[ee],s.hasOwnProperty(ee)&&oe!=null&&!c.hasOwnProperty(ee)&&tn(t,r,ee,null,c,oe);for(Ce in c)oe=c[Ce],fe=s[Ce],!c.hasOwnProperty(Ce)||oe===fe||oe==null&&fe==null||tn(t,r,Ce,oe,c,fe)}function X1(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function B2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var p=s[c],y=p.transferSize,S=p.initiatorType,z=p.duration;if(y&&z&&X1(S)){for(S=0,z=p.responseEnd,c+=1;c<s.length;c++){var W=s[c],ie=W.startTime;if(ie>z)break;var xe=W.transferSize,Ce=W.initiatorType;xe&&X1(Ce)&&(W=W.responseEnd,S+=xe*(W<z?1:(z-ie)/(W-ie)))}if(--c,r+=8*(y+S)/(p.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Bf=null,Of=null;function tu(t){return t.nodeType===9?t:t.ownerDocument}function W1(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function V1(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function $f(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lf=null;function O2(){var t=window.event;return t&&t.type==="popstate"?t===Lf?!1:(Lf=t,!0):(Lf=null,!1)}var G1=typeof setTimeout=="function"?setTimeout:void 0,$2=typeof clearTimeout=="function"?clearTimeout:void 0,K1=typeof Promise=="function"?Promise:void 0,L2=typeof queueMicrotask=="function"?queueMicrotask:typeof K1<"u"?function(t){return K1.resolve(null).then(t).catch(I2)}:G1;function I2(t){setTimeout(function(){throw t})}function Ml(t){return t==="head"}function P1(t,r){var s=r,c=0;do{var p=s.nextSibling;if(t.removeChild(s),p&&p.nodeType===8)if(s=p.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(p),fs(r);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")ho(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,ho(s);for(var y=s.firstChild;y;){var S=y.nextSibling,z=y.nodeName;y[Fa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&y.rel.toLowerCase()==="stylesheet"||s.removeChild(y),y=S}}else s==="body"&&ho(t.ownerDocument.body);s=p}while(s);fs(r)}function Q1(t,r){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?r?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(r?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function If(t){var r=t.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var s=r;switch(r=r.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":If(s),Ts(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function H2(t,r,s,c){for(;t.nodeType===1;){var p=s;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Fa])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Gr(t.nextSibling),t===null)break}return null}function U2(t,r,s){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Gr(t.nextSibling),t===null))return null;return t}function Z1(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Gr(t.nextSibling),t===null))return null;return t}function Hf(t){return t.data==="$?"||t.data==="$~"}function Uf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function q2(t,r){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||s.readyState!=="loading")r();else{var c=function(){r(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function Gr(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var qf=null;function J1(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(r===0)return Gr(t.nextSibling);r--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||r++}t=t.nextSibling}return null}function e0(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(r===0)return t;r--}else s!=="/$"&&s!=="/&"||r++}t=t.previousSibling}return null}function t0(t,r,s){switch(r=tu(s),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function ho(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ts(t)}var Kr=new Map,n0=new Set;function nu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var tl=se.d;se.d={f:Y2,r:X2,D:W2,C:V2,L:G2,m:K2,X:Q2,S:P2,M:Z2};function Y2(){var t=tl.f(),r=Vc();return t||r}function X2(t){var r=Ra(t);r!==null&&r.tag===5&&r.type==="form"?bx(r):tl.r(t)}var cs=typeof document>"u"?null:document;function r0(t,r,s){var c=cs;if(c&&typeof r=="string"&&r){var p=Pt(r);p='link[rel="'+t+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),n0.has(p)||(n0.add(p),t={rel:t,crossOrigin:s,href:r},c.querySelector(p)===null&&(r=c.createElement("link"),Jn(r,"link",t),Dn(r),c.head.appendChild(r)))}}function W2(t){tl.D(t),r0("dns-prefetch",t,null)}function V2(t,r){tl.C(t,r),r0("preconnect",t,r)}function G2(t,r,s){tl.L(t,r,s);var c=cs;if(c&&t&&r){var p='link[rel="preload"][as="'+Pt(r)+'"]';r==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+Pt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+Pt(s.imageSizes)+'"]')):p+='[href="'+Pt(t)+'"]';var y=p;switch(r){case"style":y=us(t);break;case"script":y=ds(t)}Kr.has(y)||(t=g({rel:"preload",href:r==="image"&&s&&s.imageSrcSet?void 0:t,as:r},s),Kr.set(y,t),c.querySelector(p)!==null||r==="style"&&c.querySelector(mo(y))||r==="script"&&c.querySelector(po(y))||(r=c.createElement("link"),Jn(r,"link",t),Dn(r),c.head.appendChild(r)))}}function K2(t,r){tl.m(t,r);var s=cs;if(s&&t){var c=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+Pt(c)+'"][href="'+Pt(t)+'"]',y=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ds(t)}if(!Kr.has(y)&&(t=g({rel:"modulepreload",href:t},r),Kr.set(y,t),s.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(po(y)))return}c=s.createElement("link"),Jn(c,"link",t),Dn(c),s.head.appendChild(c)}}}function P2(t,r,s){tl.S(t,r,s);var c=cs;if(c&&t){var p=Vn(c).hoistableStyles,y=us(t);r=r||"default";var S=p.get(y);if(!S){var z={loading:0,preload:null};if(S=c.querySelector(mo(y)))z.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":r},s),(s=Kr.get(y))&&Yf(t,s);var W=S=c.createElement("link");Dn(W),Jn(W,"link",t),W._p=new Promise(function(ie,xe){W.onload=ie,W.onerror=xe}),W.addEventListener("load",function(){z.loading|=1}),W.addEventListener("error",function(){z.loading|=2}),z.loading|=4,ru(S,r,c)}S={type:"stylesheet",instance:S,count:1,state:z},p.set(y,S)}}}function Q2(t,r){tl.X(t,r);var s=cs;if(s&&t){var c=Vn(s).hoistableScripts,p=ds(t),y=c.get(p);y||(y=s.querySelector(po(p)),y||(t=g({src:t,async:!0},r),(r=Kr.get(p))&&Xf(t,r),y=s.createElement("script"),Dn(y),Jn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function Z2(t,r){tl.M(t,r);var s=cs;if(s&&t){var c=Vn(s).hoistableScripts,p=ds(t),y=c.get(p);y||(y=s.querySelector(po(p)),y||(t=g({src:t,async:!0,type:"module"},r),(r=Kr.get(p))&&Xf(t,r),y=s.createElement("script"),Dn(y),Jn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function a0(t,r,s,c){var p=(p=he.current)?nu(p):null;if(!p)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(r=us(s.href),s=Vn(p).hoistableStyles,c=s.get(r),c||(c={type:"style",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=us(s.href);var y=Vn(p).hoistableStyles,S=y.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,S),(y=p.querySelector(mo(t)))&&!y._p&&(S.instance=y,S.state.loading=5),Kr.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Kr.set(t,s),y||J2(p,t,s,S.state))),r&&c===null)throw Error(i(528,""));return S}if(r&&c!==null)throw Error(i(529,""));return null;case"script":return r=s.async,s=s.src,typeof s=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=ds(s),s=Vn(p).hoistableScripts,c=s.get(r),c||(c={type:"script",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function us(t){return'href="'+Pt(t)+'"'}function mo(t){return'link[rel="stylesheet"]['+t+"]"}function l0(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function J2(t,r,s,c){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=t.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),Jn(r,"link",s),Dn(r),t.head.appendChild(r))}function ds(t){return'[src="'+Pt(t)+'"]'}function po(t){return"script[async]"+t}function i0(t,r,s){if(r.count++,r.instance===null)switch(r.type){case"style":var c=t.querySelector('style[data-href~="'+Pt(s.href)+'"]');if(c)return r.instance=c,Dn(c),c;var p=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Dn(c),Jn(c,"style",p),ru(c,s.precedence,t),r.instance=c;case"stylesheet":p=us(s.href);var y=t.querySelector(mo(p));if(y)return r.state.loading|=4,r.instance=y,Dn(y),y;c=l0(s),(p=Kr.get(p))&&Yf(c,p),y=(t.ownerDocument||t).createElement("link"),Dn(y);var S=y;return S._p=new Promise(function(z,W){S.onload=z,S.onerror=W}),Jn(y,"link",c),r.state.loading|=4,ru(y,s.precedence,t),r.instance=y;case"script":return y=ds(s.src),(p=t.querySelector(po(y)))?(r.instance=p,Dn(p),p):(c=s,(p=Kr.get(y))&&(c=g({},s),Xf(c,p)),t=t.ownerDocument||t,p=t.createElement("script"),Dn(p),Jn(p,"link",c),t.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,ru(c,s.precedence,t));return r.instance}function ru(t,r,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,y=p,S=0;S<c.length;S++){var z=c[S];if(z.dataset.precedence===r)y=z;else if(y!==p)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=s.nodeType===9?s.head:s,r.insertBefore(t,r.firstChild))}function Yf(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Xf(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var au=null;function s0(t,r,s){if(au===null){var c=new Map,p=au=new Map;p.set(s,c)}else p=au,c=p.get(s),c||(c=new Map,p.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),p=0;p<s.length;p++){var y=s[p];if(!(y[Fa]||y[yn]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(r)||"";S=t+S;var z=c.get(S);z?z.push(y):c.set(S,[y])}}return c}function o0(t,r,s){t=t.ownerDocument||t,t.head.insertBefore(s,r==="title"?t.querySelector("head > title"):null)}function ew(t,r,s){if(s===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function c0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function tw(t,r,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=us(c.href),y=r.querySelector(mo(p));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=lu.bind(t),r.then(t,t)),s.state.loading|=4,s.instance=y,Dn(y);return}y=r.ownerDocument||r,c=l0(c),(p=Kr.get(p))&&Yf(c,p),y=y.createElement("link"),Dn(y);var S=y;S._p=new Promise(function(z,W){S.onload=z,S.onerror=W}),Jn(y,"link",c),s.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,r),(r=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=lu.bind(t),r.addEventListener("load",s),r.addEventListener("error",s))}}var Wf=0;function nw(t,r){return t.stylesheets&&t.count===0&&su(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&su(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&Wf===0&&(Wf=62500*B2());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&su(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Wf?50:800)+r);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function lu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)su(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var iu=null;function su(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,iu=new Map,r.forEach(rw,t),iu=null,lu.call(t))}function rw(t,r){if(!(r.state.loading&4)){var s=iu.get(t);if(s)var c=s.get(null);else{s=new Map,iu.set(t,s);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<p.length;y++){var S=p[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),c=S)}c&&s.set(null,c)}p=r.instance,S=p.getAttribute("data-precedence"),y=s.get(S)||c,y===c&&s.set(null,p),s.set(S,p),this.count++,c=lu.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),y?y.parentNode.insertBefore(p,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),r.state.loading|=4}}var xo={$$typeof:_,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function aw(t,r,s,c,p,y,S,z,W){this.tag=1,this.containerInfo=t,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=Kt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kt(0),this.hiddenUpdates=Kt(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=W,this.incompleteTransitions=new Map}function u0(t,r,s,c,p,y,S,z,W,ie,xe,Ce){return t=new aw(t,r,s,S,W,ie,xe,Ce,z),r=1,y===!0&&(r|=24),y=Nr(3,null,null,r),t.current=y,y.stateNode=t,r=Sd(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:c,isDehydrated:s,cache:r},Ad(y),t}function d0(t){return t?(t=Ui,t):Ui}function f0(t,r,s,c,p,y){p=d0(p),c.context===null?c.context=p:c.pendingContext=p,c=kl(r),c.payload={element:s},y=y===void 0?null:y,y!==null&&(c.callback=y),s=jl(t,c,r),s!==null&&(br(s,t,r),Vs(s,t,r))}function h0(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<r?s:r}}function Vf(t,r){h0(t,r),(t=t.alternate)&&h0(t,r)}function m0(t){if(t.tag===13||t.tag===31){var r=li(t,67108864);r!==null&&br(r,t,67108864),Vf(t,67108864)}}function p0(t){if(t.tag===13||t.tag===31){var r=Rr();r=_e(r);var s=li(t,r);s!==null&&br(s,t,r),Vf(t,r)}}var ou=!0;function lw(t,r,s,c){var p=q.T;q.T=null;var y=se.p;try{se.p=2,Gf(t,r,s,c)}finally{se.p=y,q.T=p}}function iw(t,r,s,c){var p=q.T;q.T=null;var y=se.p;try{se.p=8,Gf(t,r,s,c)}finally{se.p=y,q.T=p}}function Gf(t,r,s,c){if(ou){var p=Kf(c);if(p===null)zf(t,r,c,cu,s),g0(t,c);else if(ow(p,t,r,s,c))c.stopPropagation();else if(g0(t,c),r&4&&-1<sw.indexOf(t)){for(;p!==null;){var y=Ra(p);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=un(y.pendingLanes);if(S!==0){var z=y;for(z.pendingLanes|=2,z.entangledLanes|=2;S;){var W=1<<31-Qe(S);z.entanglements[1]|=W,S&=~W}ba(y),(Vt&6)===0&&(Xc=Se()+500,co(0))}}break;case 31:case 13:z=li(y,2),z!==null&&br(z,y,2),Vc(),Vf(y,2)}if(y=Kf(c),y===null&&zf(t,r,c,cu,s),y===p)break;p=y}p!==null&&c.stopPropagation()}else zf(t,r,c,null,s)}}function Kf(t){return t=fa(t),Pf(t)}var cu=null;function Pf(t){if(cu=null,t=ca(t),t!==null){var r=u(t);if(r===null)t=null;else{var s=r.tag;if(s===13){if(t=d(r),t!==null)return t;t=null}else if(s===31){if(t=f(r),t!==null)return t;t=null}else if(s===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return cu=t,null}function x0(t){switch(t){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(Ne()){case G:return 2;case ce:return 8;case re:case ve:return 32;case we:return 268435456;default:return 32}default:return 32}}var Qf=!1,zl=null,_l=null,Bl=null,go=new Map,yo=new Map,Ol=[],sw="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 g0(t,r){switch(t){case"focusin":case"focusout":zl=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":Bl=null;break;case"pointerover":case"pointerout":go.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":yo.delete(r.pointerId)}}function bo(t,r,s,c,p,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:s,eventSystemFlags:c,nativeEvent:y,targetContainers:[p]},r!==null&&(r=Ra(r),r!==null&&m0(r)),t):(t.eventSystemFlags|=c,r=t.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),t)}function ow(t,r,s,c,p){switch(r){case"focusin":return zl=bo(zl,t,r,s,c,p),!0;case"dragenter":return _l=bo(_l,t,r,s,c,p),!0;case"mouseover":return Bl=bo(Bl,t,r,s,c,p),!0;case"pointerover":var y=p.pointerId;return go.set(y,bo(go.get(y)||null,t,r,s,c,p)),!0;case"gotpointercapture":return y=p.pointerId,yo.set(y,bo(yo.get(y)||null,t,r,s,c,p)),!0}return!1}function y0(t){var r=ca(t.target);if(r!==null){var s=u(r);if(s!==null){if(r=s.tag,r===13){if(r=d(s),r!==null){t.blockedOn=r,Sn(t.priority,function(){p0(s)});return}}else if(r===31){if(r=f(s),r!==null){t.blockedOn=r,Sn(t.priority,function(){p0(s)});return}}else if(r===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function uu(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var s=Kf(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);_i=c,s.target.dispatchEvent(c),_i=null}else return r=Ra(s),r!==null&&m0(r),t.blockedOn=s,!1;r.shift()}return!0}function b0(t,r,s){uu(t)&&s.delete(r)}function cw(){Qf=!1,zl!==null&&uu(zl)&&(zl=null),_l!==null&&uu(_l)&&(_l=null),Bl!==null&&uu(Bl)&&(Bl=null),go.forEach(b0),yo.forEach(b0)}function du(t,r){t.blockedOn===r&&(t.blockedOn=null,Qf||(Qf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cw)))}var fu=null;function v0(t){fu!==t&&(fu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){fu===t&&(fu=null);for(var r=0;r<t.length;r+=3){var s=t[r],c=t[r+1],p=t[r+2];if(typeof c!="function"){if(Pf(c||s)===null)continue;break}var y=Ra(s);y!==null&&(t.splice(r,3),r-=3,Gd(y,{pending:!0,data:p,method:s.method,action:c},c,p))}}))}function fs(t){function r(W){return du(W,t)}zl!==null&&du(zl,t),_l!==null&&du(_l,t),Bl!==null&&du(Bl,t),go.forEach(r),yo.forEach(r);for(var s=0;s<Ol.length;s++){var c=Ol[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Ol.length&&(s=Ol[0],s.blockedOn===null);)y0(s),s.blockedOn===null&&Ol.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var p=s[c],y=s[c+1],S=p[mn]||null;if(typeof y=="function")S||v0(s);else if(S){var z=null;if(y&&y.hasAttribute("formAction")){if(p=y,S=y[mn]||null)z=S.formAction;else if(Pf(p)!==null)continue}else z=S.action;typeof z=="function"?s[c+1]=z:(s.splice(c,3),c-=3),v0(s)}}}function w0(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Zf(t){this._internalRoot=t}hu.prototype.render=Zf.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var s=r.current,c=Rr();f0(s,c,t,r,null,null)},hu.prototype.unmount=Zf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;f0(t.current,2,null,t,null,null),Vc(),r[$r]=null}};function hu(t){this._internalRoot=t}hu.prototype.unstable_scheduleHydration=function(t){if(t){var r=Ze();t={blockedOn:null,target:t,priority:r};for(var s=0;s<Ol.length&&r!==0&&r<Ol[s].priority;s++);Ol.splice(s,0,t),s===0&&y0(t)}};var k0=n.version;if(k0!=="19.2.4")throw Error(i(527,k0,"19.2.4"));se.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=h(r),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var uw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mu.isDisabled&&mu.supportsFiber)try{Oe=mu.inject(uw),qe=mu}catch{}}return wo.createRoot=function(t,r){if(!o(t))throw Error(i(299));var s=!1,c="",p=Dx,y=Tx,S=Fx;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError)),r=u0(t,1,!1,null,null,s,c,null,p,y,S,w0),t[$r]=r.current,Mf(t),new Zf(r)},wo.hydrateRoot=function(t,r,s){if(!o(t))throw Error(i(299));var c=!1,p="",y=Dx,S=Tx,z=Fx,W=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(z=s.onRecoverableError),s.formState!==void 0&&(W=s.formState)),r=u0(t,1,!0,r,s??null,c,p,W,y,S,z,w0),r.context=d0(null),s=r.current,c=Rr(),c=_e(c),p=kl(c),p.callback=null,jl(s,p,c),s=c,r.current.lanes=s,ke(r,s),ba(r),t[$r]=r.current,Mf(t),new hu(r)},wo.version="19.2.4",wo}var M0;function kw(){if(M0)return th.exports;M0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),th.exports=ww(),th.exports}var jw=kw();const Sw="modulepreload",Cw=function(e){return"/"+e},z0={},Ny=function(n,a,i){let o=Promise.resolve();if(a&&a.length>0){let d=function(h){return Promise.all(h.map(x=>Promise.resolve(x).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=d(a.map(h=>{if(h=Cw(h),h in z0)return;z0[h]=!0;const x=h.endsWith(".css"),g=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const v=document.createElement("link");if(v.rel=x?"stylesheet":Sw,x||(v.as="script"),v.crossOrigin="",v.href=h,m&&v.setAttribute("nonce",m),document.head.appendChild(v),x)return new Promise((b,j)=>{v.addEventListener("load",b),v.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})};class Ew extends w.Component{constructor(){super(...arguments);j0(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){var a;return this.state.hasError?l.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:l.jsxs("div",{className:"text-center max-w-md",children:[l.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),l.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),l.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((a=this.state.error)==null?void 0:a.message)??"An unexpected error occurred."}),l.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 Ca="/api";async function Ut(e){const n=await fetch(`${Ca}${e}`);if(!n.ok)throw new Error(`API error: ${n.status}`);return n.json()}async function on(e,n){const a=await fetch(`${Ca}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function pu(e,n){const a=await fetch(`${Ca}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function Nw(e,n){const a=await fetch(`${Ca}${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function nl(e,n){const a={method:"DELETE"};n!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(n));const i=await fetch(`${Ca}${e}`,a);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const ye={getCompany:()=>Ut("/company"),getRoles:()=>Ut("/roles"),getRole:e=>Ut(`/roles/${e}`),getProjects:()=>Ut("/projects"),getProject:e=>Ut(`/projects/${e}`),getStandups:()=>Ut("/operations/standups"),getWaves:()=>Ut("/operations/waves"),getWaveDetail:e=>Ut(`/operations/waves/${e}`),patchWave:(e,n)=>pu(`/operations/waves/${e}`,n),getDecisions:()=>Ut("/operations/decisions"),updateDecision:(e,n)=>Nw(`/operations/decisions/${e}`,{content:n}),deleteDecision:e=>nl(`/operations/decisions/${e}`),getOrgTree:()=>Ut("/engine/org"),getSkills:()=>Ut("/skills"),exportSkills:e=>Ut(`/skills/export/${e}`),getSkillRegistry:()=>Ut("/skills/registry"),installRegistrySkill:(e,n)=>on("/skills/registry/install",{skillId:e,url:n}),createRole:e=>on("/engine/roles",e),updateRole:(e,n)=>pu(`/engine/roles/${e}`,n),deleteRole:e=>nl(`/engine/roles/${e}`),getSessions:()=>Ut("/sessions"),getSession:e=>Ut(`/sessions/${e}`),createSession:(e,n="talk")=>on("/sessions",{roleId:e,mode:n}),deleteSession:e=>nl(`/sessions/${e}`),deleteSessions:e=>nl("/sessions",{ids:e}),deleteEmptySessions:()=>nl("/sessions?empty=true"),updateSession:(e,n)=>pu(`/sessions/${e}`,n),abortSession:e=>on(`/sessions/${e}/abort`,{}),replyToSession:(e,n,a)=>on(`/sessions/${e}/reply`,{message:n,...a&&{attachments:a}}),startJob:e=>on("/jobs",e),saveWave:e=>on("/waves/save",e),getStatus:()=>Ut("/status"),detectEngine:()=>on("/setup/detect-engine",{}),validatePath:e=>on("/setup/validate-path",{path:e}),scaffold:e=>on("/setup/scaffold",e),getTeams:()=>Ut("/setup/teams"),browse:e=>on("/setup/browse",{path:e}),mkdir:(e,n)=>on("/setup/mkdir",{path:e,name:n}),connectAkb:e=>on("/setup/connect-akb",{path:e}),getRequiredTools:e=>on("/setup/required-tools",{team:e}),installTools:(e,n)=>fetch(`${Ca}/setup/install-tools`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({team:e})}).then(a=>{var f;const i=(f=a.body)==null?void 0:f.getReader();if(!i)return;const o=new TextDecoder;let u="";const d=()=>i.read().then(({done:m,value:h})=>{if(m)return;u+=o.decode(h,{stream:!0});const x=u.split(`
|
|
50
|
-
`);u=x.pop()||"";let g="";for(const v of x)if(v.startsWith("event: "))g=v.slice(7);else if(v.startsWith("data: ")&&g){try{n(g,JSON.parse(v.slice(6)))}catch{}g=""}return d()});return d()}),getKnowledge:()=>Ut("/knowledge"),getKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return Ut(`/knowledge/${n}`)},createKnowledgeDoc:e=>on("/knowledge",e),updateKnowledgeDoc:(e,n)=>{const a=e.split("/").map(encodeURIComponent).join("/");return fetch(`${Ca}/knowledge/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return nl(`/knowledge/${n}`)},getPreferences:()=>Ut("/preferences"),updatePreferences:e=>pu("/preferences",e),chatInChannel:e=>on("/speech/chat",e),getSaveStatus:(e="akb")=>Ut(`/save/status?repo=${e}`),save:(e,n="akb")=>on(`/save?repo=${n}`,{message:e}),getSaveHistory:(e=20,n="akb")=>Ut(`/save/history?limit=${e}&repo=${n}`),restoreSave:(e,n,a="akb")=>on(`/save/restore?repo=${a}`,{sha:e,paths:n}),initGit:()=>on(
|
|
50
|
+
`);u=x.pop()||"";let g="";for(const v of x)if(v.startsWith("event: "))g=v.slice(7);else if(v.startsWith("data: ")&&g){try{n(g,JSON.parse(v.slice(6)))}catch{}g=""}return d()});return d()}),getKnowledge:()=>Ut("/knowledge"),getKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return Ut(`/knowledge/${n}`)},createKnowledgeDoc:e=>on("/knowledge",e),updateKnowledgeDoc:(e,n)=>{const a=e.split("/").map(encodeURIComponent).join("/");return fetch(`${Ca}/knowledge/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return nl(`/knowledge/${n}`)},getPreferences:()=>Ut("/preferences"),updatePreferences:e=>pu("/preferences",e),chatInChannel:e=>on("/speech/chat",e),getSaveStatus:(e="akb")=>Ut(`/save/status?repo=${e}`),save:(e,n="akb")=>on(`/save?repo=${n}`,{message:e}),getSaveHistory:(e=20,n="akb")=>Ut(`/save/history?limit=${e}&repo=${n}`),restoreSave:(e,n,a="akb")=>on(`/save/restore?repo=${a}`,{sha:e,paths:n}),initGit:(e="akb")=>on(`/save/init?repo=${e}`,{}),getSyncStatus:(e="akb")=>Ut(`/save/sync-status?repo=${e}`),pull:async(e="akb")=>await(await fetch(`${Ca}/save/pull?repo=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json(),getGithubStatus:(e="akb")=>Ut(`/save/github-status?repo=${e}`),githubCreateRepo:(e,n="private",a="akb")=>on(`/save/github-create-repo?repo=${a}`,{name:e,visibility:n}),addRemote:(e,n="akb")=>on(`/save/remote?repo=${n}`,{url:e}),setCodeRoot:async e=>{const n=await fetch(`${Ca}/setup/code-root`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codeRoot:e})}),a=await n.json();if(!n.ok)throw new Error(a.error||`API error: ${n.status}`);return a},getCodeRoot:()=>Ut("/setup/code-root"),getCostSummary:()=>Ut("/cost/summary"),getSyncRoles:()=>Ut("/sync/roles"),applySyncUpdate:e=>on("/sync/apply",e),getCompanyStats:()=>Ut("/sync/stats"),getCoins:()=>Ut("/coins"),earnCoins:(e,n,a)=>on("/coins/earn",{amount:e,reason:n,ref:a}),spendCoins:(e,n,a)=>on("/coins/spend",{amount:e,reason:n,ref:a}),migrateCoins:e=>on("/coins/migrate",{completedQuests:e}),getQuestProgress:()=>Ut("/quests/progress"),saveQuestProgress:e=>fetch(`${Ca}/quests/progress`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(n=>n.json()),getActiveSessions:()=>Ut("/active-sessions"),getActiveSession:e=>Ut(`/active-sessions/${e}`),registerActiveSession:e=>on("/active-sessions/register",e),deleteActiveSession:e=>nl(`/active-sessions/${e}`),cleanupActiveSessions:()=>on("/active-sessions/cleanup",{}),getGitStatus:()=>Ut("/git/status"),deleteWorktree:e=>nl(`/git/worktrees/${encodeURIComponent(e)}`),deleteBranch:e=>nl(`/git/branches/${encodeURIComponent(e)}`)},Aw=Object.freeze(Object.defineProperty({__proto__:null,api:ye},Symbol.toStringTag,{value:"Module"}));function Ay(e){const[n,a]=w.useState([]),[i,o]=w.useState("idle"),[u,d]=w.useState(""),[f,m]=w.useState([]),h=w.useRef(-1),x=w.useRef(null),g=w.useRef(0),v=w.useCallback(()=>{var E;if(!e)return;(E=x.current)==null||E.abort();const j=new AbortController;x.current=j,o("connecting");const k=h.current+1,N=`/api/sessions/${e}/stream?from=${k}`;fetch(N,{signal:j.signal}).then(async C=>{if(!C.ok||!C.body){o("error");return}o("streaming");const _=C.body.getReader(),M=new TextDecoder;let L="";for(;;){const{done:R,value:I}=await _.read();if(R)break;L+=M.decode(I,{stream:!0});const X=L.split(`
|
|
51
51
|
`);L=X.pop()??"";let J="";for(const A of X)if(A.startsWith("event: "))J=A.slice(7).trim();else if(A.startsWith("data: ")){try{const O=JSON.parse(A.slice(6));if(J==="activity"){const U=O;U.seq>h.current&&(h.current=U.seq),a(Y=>Y.some(ne=>ne.seq===U.seq)?Y:[...Y,U]),U.type==="text"&&d(Y=>Y+(U.data.text??"")),U.type==="dispatch:start"&&U.data.childJobId&&m(Y=>[...Y,U.data.childJobId]),U.type==="job:done"?o("done"):U.type==="job:error"&&o("error")}else if(J==="stream:end"){const U=O.reason;o(U==="done"?"done":U==="error"?"error":"done")}}catch{}J=""}}i==="streaming"&&o("done")}).catch(C=>{C.name!=="AbortError"&&(o("error"),g.current<3&&(g.current++,setTimeout(v,1e3*g.current)))})},[e]),b=w.useCallback(()=>{g.current=0,v()},[v]);return w.useEffect(()=>{if(!e){a([]),o("idle"),d(""),m([]),h.current=-1;return}return a([]),d(""),m([]),h.current=-1,g.current=0,v(),()=>{var j;(j=x.current)==null||j.abort()}},[e,v]),{events:n,status:i,textOutput:u,childJobIds:f,reconnect:b}}function Dw(e,n){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Tw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rw={};function _0(e,n){return(Rw.jsx?Fw:Tw).test(e)}const Mw=/[ \t\n\f\r]/g;function zw(e){return typeof e=="object"?e.type==="text"?B0(e.value):!1:B0(e)}function B0(e){return e.replace(Mw,"")===""}class Yo{constructor(n,a,i){this.normal=a,this.property=n,i&&(this.space=i)}}Yo.prototype.normal={};Yo.prototype.property={};Yo.prototype.space=void 0;function Dy(e,n){const a={},i={};for(const o of e)Object.assign(a,o.property),Object.assign(i,o.normal);return new Yo(a,i,n)}function Wh(e){return e.toLowerCase()}class kr{constructor(n,a){this.attribute=a,this.property=n}}kr.prototype.attribute="";kr.prototype.booleanish=!1;kr.prototype.boolean=!1;kr.prototype.commaOrSpaceSeparated=!1;kr.prototype.commaSeparated=!1;kr.prototype.defined=!1;kr.prototype.mustUseProperty=!1;kr.prototype.number=!1;kr.prototype.overloadedBoolean=!1;kr.prototype.property="";kr.prototype.spaceSeparated=!1;kr.prototype.space=void 0;let _w=0;const wt=Ti(),zn=Ti(),Vh=Ti(),Fe=Ti(),fn=Ti(),gs=Ti(),Mr=Ti();function Ti(){return 2**++_w}const Gh=Object.freeze(Object.defineProperty({__proto__:null,boolean:wt,booleanish:zn,commaOrSpaceSeparated:Mr,commaSeparated:gs,number:Fe,overloadedBoolean:Vh,spaceSeparated:fn},Symbol.toStringTag,{value:"Module"})),lh=Object.keys(Gh);class jm extends kr{constructor(n,a,i,o){let u=-1;if(super(n,a),O0(this,"space",o),typeof i=="number")for(;++u<lh.length;){const d=lh[u];O0(this,lh[u],(i&Gh[d])===Gh[d])}}}jm.prototype.defined=!0;function O0(e,n,a){a&&(e[n]=a)}function Ss(e){const n={},a={};for(const[i,o]of Object.entries(e.properties)){const u=new jm(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),n[i]=u,a[Wh(i)]=i,a[Wh(u.attribute)]=i}return new Yo(n,a,e.space)}const Ty=Ss({properties:{ariaActiveDescendant:null,ariaAtomic:zn,ariaAutoComplete:null,ariaBusy:zn,ariaChecked:zn,ariaColCount:Fe,ariaColIndex:Fe,ariaColSpan:Fe,ariaControls:fn,ariaCurrent:null,ariaDescribedBy:fn,ariaDetails:null,ariaDisabled:zn,ariaDropEffect:fn,ariaErrorMessage:null,ariaExpanded:zn,ariaFlowTo:fn,ariaGrabbed:zn,ariaHasPopup:null,ariaHidden:zn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fn,ariaLevel:Fe,ariaLive:null,ariaModal:zn,ariaMultiLine:zn,ariaMultiSelectable:zn,ariaOrientation:null,ariaOwns:fn,ariaPlaceholder:null,ariaPosInSet:Fe,ariaPressed:zn,ariaReadOnly:zn,ariaRelevant:null,ariaRequired:zn,ariaRoleDescription:fn,ariaRowCount:Fe,ariaRowIndex:Fe,ariaRowSpan:Fe,ariaSelected:zn,ariaSetSize:Fe,ariaSort:null,ariaValueMax:Fe,ariaValueMin:Fe,ariaValueNow:Fe,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Fy(e,n){return n in e?e[n]:n}function Ry(e,n){return Fy(e,n.toLowerCase())}const Bw=Ss({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gs,acceptCharset:fn,accessKey:fn,action:null,allow:null,allowFullScreen:wt,allowPaymentRequest:wt,allowUserMedia:wt,alt:null,as:null,async:wt,autoCapitalize:null,autoComplete:fn,autoFocus:wt,autoPlay:wt,blocking:fn,capture:null,charSet:null,checked:wt,cite:null,className:fn,cols:Fe,colSpan:null,content:null,contentEditable:zn,controls:wt,controlsList:fn,coords:Fe|gs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wt,defer:wt,dir:null,dirName:null,disabled:wt,download:Vh,draggable:zn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wt,formTarget:null,headers:fn,height:Fe,hidden:Vh,high:Fe,href:null,hrefLang:null,htmlFor:fn,httpEquiv:fn,id:null,imageSizes:null,imageSrcSet:null,inert:wt,inputMode:null,integrity:null,is:null,isMap:wt,itemId:null,itemProp:fn,itemRef:fn,itemScope:wt,itemType:fn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wt,low:Fe,manifest:null,max:null,maxLength:Fe,media:null,method:null,min:null,minLength:Fe,multiple:wt,muted:wt,name:null,nonce:null,noModule:wt,noValidate:wt,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:wt,optimum:Fe,pattern:null,ping:fn,placeholder:null,playsInline:wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wt,referrerPolicy:null,rel:fn,required:wt,reversed:wt,rows:Fe,rowSpan:Fe,sandbox:fn,scope:null,scoped:wt,seamless:wt,selected:wt,shadowRootClonable:wt,shadowRootDelegatesFocus:wt,shadowRootMode:null,shape:null,size:Fe,sizes:null,slot:null,span:Fe,spellCheck:zn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Fe,step:null,style:null,tabIndex:Fe,target:null,title:null,translate:null,type:null,typeMustMatch:wt,useMap:null,value:zn,width:Fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fn,axis:null,background:null,bgColor:null,border:Fe,borderColor:null,bottomMargin:Fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wt,declare:wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Fe,leftMargin:Fe,link:null,longDesc:null,lowSrc:null,marginHeight:Fe,marginWidth:Fe,noResize:wt,noHref:wt,noShade:wt,noWrap:wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Fe,rules:null,scheme:null,scrolling:zn,standby:null,summary:null,text:null,topMargin:Fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Fe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wt,disableRemotePlayback:wt,prefix:null,property:null,results:Fe,security:null,unselectable:null},space:"html",transform:Ry}),Ow=Ss({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:Mr,accentHeight:Fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Fe,amplitude:Fe,arabicForm:null,ascent:Fe,attributeName:null,attributeType:null,azimuth:Fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Fe,by:null,calcMode:null,capHeight:Fe,className:fn,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:Fe,diffuseConstant:Fe,direction:null,display:null,dur:null,divisor:Fe,dominantBaseline:null,download:wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Fe,enableBackground:null,end:null,event:null,exponent:Fe,externalResourcesRequired:null,fill:null,fillOpacity:Fe,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:gs,g2:gs,glyphName:gs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Fe,horizOriginX:Fe,horizOriginY:Fe,id:null,ideographic:Fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Fe,k:Fe,k1:Fe,k2:Fe,k3:Fe,k4:Fe,kernelMatrix:Mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Fe,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:Fe,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:Fe,overlineThickness:Fe,paintOrder:null,panose1:null,path:null,pathLength:Fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Fe,pointsAtY:Fe,pointsAtZ:Fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mr,rev:Mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mr,requiredFeatures:Mr,requiredFonts:Mr,requiredFormats:Mr,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:Fe,specularExponent:Fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Fe,strikethroughThickness:Fe,string:null,stroke:null,strokeDashArray:Mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Fe,strokeOpacity:Fe,strokeWidth:null,style:null,surfaceScale:Fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mr,tabIndex:Fe,tableValues:null,target:null,targetX:Fe,targetY:Fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Fe,underlineThickness:Fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Fe,values:null,vAlphabetic:Fe,vMathematical:Fe,vectorEffect:null,vHanging:Fe,vIdeographic:Fe,version:null,vertAdvY:Fe,vertOriginX:Fe,vertOriginY:Fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fy}),My=Ss({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),zy=Ss({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ry}),_y=Ss({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),$w={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"},Lw=/[A-Z]/g,$0=/-[a-z]/g,Iw=/^data[-\w.:]+$/i;function Hw(e,n){const a=Wh(n);let i=n,o=kr;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Iw.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace($0,qw);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!$0.test(u)){let d=u.replace(Lw,Uw);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=jm}return new o(i,n)}function Uw(e){return"-"+e.toLowerCase()}function qw(e){return e.charAt(1).toUpperCase()}const Yw=Dy([Ty,Bw,My,zy,_y],"html"),Sm=Dy([Ty,Ow,My,zy,_y],"svg");function Xw(e){return e.join(" ").trim()}var hs={},ih,L0;function Ww(){if(L0)return ih;L0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,a=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
52
52
|
`,h="/",x="*",g="",v="comment",b="declaration";function j(N,E){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];E=E||{};var C=1,_=1;function M(ne){var K=ne.match(n);K&&(C+=K.length);var q=ne.lastIndexOf(m);_=~q?ne.length-q:_+ne.length}function L(){var ne={line:C,column:_};return function(K){return K.position=new R(ne),J(),K}}function R(ne){this.start=ne,this.end={line:C,column:_},this.source=E.source}R.prototype.content=N;function I(ne){var K=new Error(E.source+":"+C+":"+_+": "+ne);if(K.reason=ne,K.filename=E.source,K.line=C,K.column=_,K.source=N,!E.silent)throw K}function X(ne){var K=ne.exec(N);if(K){var q=K[0];return M(q),N=N.slice(q.length),K}}function J(){X(a)}function A(ne){var K;for(ne=ne||[];K=O();)K!==!1&&ne.push(K);return ne}function O(){var ne=L();if(!(h!=N.charAt(0)||x!=N.charAt(1))){for(var K=2;g!=N.charAt(K)&&(x!=N.charAt(K)||h!=N.charAt(K+1));)++K;if(K+=2,g===N.charAt(K-1))return I("End of comment missing");var q=N.slice(2,K-2);return _+=2,M(q),N=N.slice(K),_+=2,ne({type:v,comment:q})}}function U(){var ne=L(),K=X(i);if(K){if(O(),!X(o))return I("property missing ':'");var q=X(u),se=ne({type:b,property:k(K[0].replace(e,g)),value:q?k(q[0].replace(e,g)):g});return X(d),se}}function Y(){var ne=[];A(ne);for(var K;K=U();)K!==!1&&(ne.push(K),A(ne));return ne}return J(),Y()}function k(N){return N?N.replace(f,g):g}return ih=j,ih}var I0;function Vw(){if(I0)return hs;I0=1;var e=hs&&hs.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(hs,"__esModule",{value:!0}),hs.default=a;const n=e(Ww());function a(i,o){let u=null;if(!i||typeof i!="string")return u;const d=(0,n.default)(i),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:x}=m;f?o(h,x,m):x&&(u=u||{},u[h]=x)}),u}return hs}var ko={},H0;function Gw(){if(H0)return ko;H0=1,Object.defineProperty(ko,"__esModule",{value:!0}),ko.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,a=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||a.test(h)||e.test(h)},d=function(h,x){return x.toUpperCase()},f=function(h,x){return"".concat(x,"-")},m=function(h,x){return x===void 0&&(x={}),u(h)?h:(h=h.toLowerCase(),x.reactCompat?h=h.replace(o,f):h=h.replace(i,f),h.replace(n,d))};return ko.camelCase=m,ko}var jo,U0;function Kw(){if(U0)return jo;U0=1;var e=jo&&jo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(Vw()),a=Gw();function i(o,u){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,a.camelCase)(f,u)]=m)}),d}return i.default=i,jo=i,jo}var Pw=Kw();const Qw=Ey(Pw),By=Oy("end"),Cm=Oy("start");function Oy(e){return n;function n(a){const i=a&&a.position&&a.position[e]||{};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 Zw(e){const n=Cm(e),a=By(e);if(n&&a)return{start:n,end:a}}function _o(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?q0(e.position):"start"in e||"end"in e?q0(e):"line"in e||"column"in e?Kh(e):""}function Kh(e){return Y0(e&&e.line)+":"+Y0(e&&e.column)}function q0(e){return Kh(e&&e.start)+"-"+Kh(e&&e.end)}function Y0(e){return e&&typeof e=="number"?e:1}class ar extends Error{constructor(n,a,i){super(),typeof a=="string"&&(i=a,a=void 0);let o="",u={},d=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof n=="string"?o=n:!u.cause&&n&&(d=!0,o=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?u.ruleId=i:(u.source=i.slice(0,m),u.ruleId=i.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=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=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=_o(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ar.prototype.file="";ar.prototype.name="";ar.prototype.reason="";ar.prototype.message="";ar.prototype.stack="";ar.prototype.column=void 0;ar.prototype.line=void 0;ar.prototype.ancestors=void 0;ar.prototype.cause=void 0;ar.prototype.fatal=void 0;ar.prototype.place=void 0;ar.prototype.ruleId=void 0;ar.prototype.source=void 0;const Em={}.hasOwnProperty,Jw=new Map,e5=/[A-Z]/g,t5=new Set(["table","tbody","thead","tfoot","tr"]),n5=new Set(["td","th"]),$y="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function r5(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=d5(a,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=u5(a,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Sm:Yw,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Ly(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function Ly(e,n,a){if(n.type==="element")return a5(e,n,a);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return l5(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return s5(e,n,a);if(n.type==="mdxjsEsm")return i5(e,n);if(n.type==="root")return o5(e,n,a);if(n.type==="text")return c5(e,n)}function a5(e,n,a){const i=e.schema;let o=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Sm,e.schema=o),e.ancestors.push(n);const u=Hy(e,n.tagName,!1),d=f5(e,n);let f=Am(e,n);return t5.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!zw(m):!0})),Iy(e,d,u,n),Nm(d,f),e.ancestors.pop(),e.schema=i,e.create(n,u,d,a)}function l5(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Lo(e,n.position)}function i5(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Lo(e,n.position)}function s5(e,n,a){const i=e.schema;let o=i;n.name==="svg"&&i.space==="html"&&(o=Sm,e.schema=o),e.ancestors.push(n);const u=n.name===null?e.Fragment:Hy(e,n.name,!0),d=h5(e,n),f=Am(e,n);return Iy(e,d,u,n),Nm(d,f),e.ancestors.pop(),e.schema=i,e.create(n,u,d,a)}function o5(e,n,a){const i={};return Nm(i,Am(e,n)),e.create(n,e.Fragment,i,a)}function c5(e,n){return n.value}function Iy(e,n,a,i){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(n.node=i)}function Nm(e,n){if(n.length>0){const a=n.length>1?n:n[0];a&&(e.children=a)}}function u5(e,n,a){return i;function i(o,u,d,f){const h=Array.isArray(d.children)?a:n;return f?h(u,d,f):h(u,d)}}function d5(e,n){return a;function a(i,o,u,d){const f=Array.isArray(u.children),m=Cm(i);return n(o,u,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function f5(e,n){const a={};let i,o;for(o in n.properties)if(o!=="children"&&Em.call(n.properties,o)){const u=m5(e,o,n.properties[o]);if(u){const[d,f]=u;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&n5.has(n.tagName)?i=f:a[d]=f}}if(i){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function h5(e,n){const a={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const f=d.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else Lo(e,n.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Lo(e,n.position);else u=i.value===null?!0:i.value;a[o]=u}return a}function Am(e,n){const a=[];let i=-1;const o=e.passKeys?new Map:Jw;for(;++i<n.children.length;){const u=n.children[i];let d;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=Ly(e,u,d);f!==void 0&&a.push(f)}return a}function m5(e,n,a){const i=Hw(e.schema,n);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=i.commaSeparated?Dw(a):Xw(a)),i.property==="style"){let o=typeof a=="object"?a:p5(e,String(a));return e.stylePropertyNameCase==="css"&&(o=x5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?$w[i.property]||i.property:i.attribute,a]}}function p5(e,n){try{return Qw(n,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const i=a,o=new ar("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=$y+"#cannot-parse-style-attribute",o}}function Hy(e,n,a){let i;if(!a)i={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let u=-1,d;for(;++u<o.length;){const f=_0(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}i=d}else i=_0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const o=i.value;return Em.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);Lo(e)}function Lo(e,n){const a=new ar("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=$y+"#cannot-handle-mdx-estrees-without-createevaluater",a}function x5(e){const n={};let a;for(a in e)Em.call(e,a)&&(n[g5(a)]=e[a]);return n}function g5(e){let n=e.replace(e5,y5);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function y5(e){return"-"+e.toLowerCase()}const sh={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"]},b5={};function Dm(e,n){const a=b5,i=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Uy(e,i,o)}function Uy(e,n,a){if(v5(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return X0(e.children,n,a)}return Array.isArray(e)?X0(e,n,a):""}function X0(e,n,a){const i=[];let o=-1;for(;++o<e.length;)i[o]=Uy(e[o],n,a);return i.join("")}function v5(e){return!!(e&&typeof e=="object")}const W0=document.createElement("i");function Tm(e){const n="&"+e+";";W0.innerHTML=n;const a=W0.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===n?!1:a}function Or(e,n,a,i){const o=e.length;let u=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,a=a>0?a:0,i.length<1e4)d=Array.from(i),d.unshift(n,a),e.splice(...d);else for(a&&e.splice(n,a);u<i.length;)d=i.slice(u,u+1e4),d.unshift(n,0),e.splice(...d),u+=1e4,n+=1e4}function Qr(e,n){return e.length>0?(Or(e,e.length,0,n),e):n}const V0={}.hasOwnProperty;function qy(e){const n={};let a=-1;for(;++a<e.length;)w5(n,e[a]);return n}function w5(e,n){let a;for(a in n){const o=(V0.call(e,a)?e[a]:void 0)||(e[a]={}),u=n[a];let d;if(u)for(d in u){V0.call(o,d)||(o[d]=[]);const f=u[d];k5(o[d],Array.isArray(f)?f:f?[f]:[])}}}function k5(e,n){let a=-1;const i=[];for(;++a<n.length;)(n[a].add==="after"?e:i).push(n[a]);Or(e,0,0,i)}function Yy(e,n){const a=Number.parseInt(e,n);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function oa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cr=Gl(/[A-Za-z]/),rr=Gl(/[\dA-Za-z]/),j5=Gl(/[#-'*+\--9=?A-Z^-~]/);function $u(e){return e!==null&&(e<32||e===127)}const Ph=Gl(/\d/),S5=Gl(/[\dA-Fa-f]/),C5=Gl(/[!-/:-@[-`{-~]/);function it(e){return e!==null&&e<-2}function cn(e){return e!==null&&(e<0||e===32)}function Dt(e){return e===-2||e===-1||e===32}const Ku=Gl(new RegExp("\\p{P}|\\p{S}","u")),Ai=Gl(/\s/);function Gl(e){return n;function n(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Cs(e){const n=[];let a=-1,i=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&rr(e.charCodeAt(a+1))&&rr(e.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(a+1);u<56320&&f>56319&&f<57344?(d=String.fromCharCode(u,f),o=1):d="�"}else d=String.fromCharCode(u);d&&(n.push(e.slice(i,a),encodeURIComponent(d)),i=a+o+1,d=""),o&&(a+=o,o=0)}return n.join("")+e.slice(i)}function Ht(e,n,a,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(m){return Dt(m)?(e.enter(a),f(m)):n(m)}function f(m){return Dt(m)&&u++<o?(e.consume(m),f):(e.exit(a),n(m))}}const E5={tokenize:N5};function N5(e){const n=e.attempt(this.parser.constructs.contentInitial,i,o);let a;return n;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ht(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=m),a=m,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return it(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),d)}}const A5={tokenize:D5},G0={tokenize:T5};function D5(e){const n=this,a=[];let i=0,o,u,d;return f;function f(_){if(i<a.length){const M=a[i];return n.containerState=M[1],e.attempt(M[0].continuation,m,h)(_)}return h(_)}function m(_){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&C();const M=n.events.length;let L=M,R;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){R=n.events[L][1].end;break}E(i);let I=M;for(;I<n.events.length;)n.events[I][1].end={...R},I++;return Or(n.events,L+1,0,n.events.slice(M)),n.events.length=I,h(_)}return f(_)}function h(_){if(i===a.length){if(!o)return v(_);if(o.currentConstruct&&o.currentConstruct.concrete)return j(_);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(G0,x,g)(_)}function x(_){return o&&C(),E(i),v(_)}function g(_){return n.parser.lazy[n.now().line]=i!==a.length,d=n.now().offset,j(_)}function v(_){return n.containerState={},e.attempt(G0,b,j)(_)}function b(_){return i++,a.push([n.currentConstruct,n.containerState]),v(_)}function j(_){if(_===null){o&&C(),E(0),e.consume(_);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),k(_)}function k(_){if(_===null){N(e.exit("chunkFlow"),!0),E(0),e.consume(_);return}return it(_)?(e.consume(_),N(e.exit("chunkFlow")),i=0,n.interrupt=void 0,f):(e.consume(_),k)}function N(_,M){const L=n.sliceStream(_);if(M&&L.push(null),_.previous=u,u&&(u.next=_),u=_,o.defineSkip(_.start),o.write(L),n.parser.lazy[_.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<d&&(!o.events[R][1].end||o.events[R][1].end.offset>d))return;const I=n.events.length;let X=I,J,A;for(;X--;)if(n.events[X][0]==="exit"&&n.events[X][1].type==="chunkFlow"){if(J){A=n.events[X][1].end;break}J=!0}for(E(i),R=I;R<n.events.length;)n.events[R][1].end={...A},R++;Or(n.events,X+1,0,n.events.slice(I)),n.events.length=R}}function E(_){let M=a.length;for(;M-- >_;){const L=a[M];n.containerState=L[1],L[0].exit.call(n,e)}a.length=_}function C(){o.write([null]),u=void 0,o=void 0,n.containerState._closeFlow=void 0}}function T5(e,n,a){return Ht(e,e.attempt(this.parser.constructs.document,n,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bs(e){if(e===null||cn(e)||Ai(e))return 1;if(Ku(e))return 2}function Pu(e,n,a){const i=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!i.includes(u)&&(n=u(n,a),i.push(u))}return n}const Qh={name:"attention",resolveAll:F5,tokenize:R5};function F5(e,n){let a=-1,i,o,u,d,f,m,h,x;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(i=a;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[i][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const g={...e[i][1].end},v={...e[a][1].start};K0(g,-m),K0(v,m),d={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:v},u={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[a][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[i][1].end={...d.start},e[a][1].start={...f.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=Qr(h,[["enter",e[i][1],n],["exit",e[i][1],n]])),h=Qr(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",u,n]]),h=Qr(h,Pu(n.parser.constructs.insideSpan.null,e.slice(i+1,a),n)),h=Qr(h,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[a][1].end.offset-e[a][1].start.offset?(x=2,h=Qr(h,[["enter",e[a][1],n],["exit",e[a][1],n]])):x=0,Or(e,i-1,a-i+3,h),a=i+h.length-x-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function R5(e,n){const a=this.parser.constructs.attentionMarkers.null,i=this.previous,o=bs(i);let u;return d;function d(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),x=bs(m),g=!x||x===2&&o||a.includes(m),v=!o||o===2&&x||a.includes(i);return h._open=!!(u===42?g:g&&(o||!v)),h._close=!!(u===42?v:v&&(x||!g)),n(m)}}function K0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const M5={name:"autolink",tokenize:z5};function z5(e,n,a){let i=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(b){return cr(b)?(e.consume(b),d):b===64?a(b):h(b)}function d(b){return b===43||b===45||b===46||rr(b)?(i=1,f(b)):h(b)}function f(b){return b===58?(e.consume(b),i=0,m):(b===43||b===45||b===46||rr(b))&&i++<32?(e.consume(b),f):(i=0,h(b))}function m(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),n):b===null||b===32||b===60||$u(b)?a(b):(e.consume(b),m)}function h(b){return b===64?(e.consume(b),x):j5(b)?(e.consume(b),h):a(b)}function x(b){return rr(b)?g(b):a(b)}function g(b){return b===46?(e.consume(b),i=0,x):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),n):v(b)}function v(b){if((b===45||rr(b))&&i++<63){const j=b===45?v:g;return e.consume(b),j}return a(b)}}const Xo={partial:!0,tokenize:_5};function _5(e,n,a){return i;function i(u){return Dt(u)?Ht(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||it(u)?n(u):a(u)}}const Xy={continuation:{tokenize:O5},exit:$5,name:"blockQuote",tokenize:B5};function B5(e,n,a){const i=this;return o;function o(d){if(d===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return Dt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function O5(e,n,a){const i=this;return o;function o(d){return Dt(d)?Ht(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(Xy,n,a)(d)}}function $5(e){e.exit("blockQuote")}const Wy={name:"characterEscape",tokenize:L5};function L5(e,n,a){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return C5(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):a(u)}}const Vy={name:"characterReference",tokenize:I5};function I5(e,n,a){const i=this;let o=0,u,d;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,d=rr,x(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=S5,x):(e.enter("characterReferenceValue"),u=7,d=Ph,x(g))}function x(g){if(g===59&&o){const v=e.exit("characterReferenceValue");return d===rr&&!Tm(i.sliceSerialize(v))?a(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(g)&&o++<u?(e.consume(g),x):a(g)}}const P0={partial:!0,tokenize:U5},Q0={concrete:!0,name:"codeFenced",tokenize:H5};function H5(e,n,a){const i=this,o={partial:!0,tokenize:L};let u=0,d=0,f;return m;function m(R){return h(R)}function h(R){const I=i.events[i.events.length-1];return u=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(R)}function x(R){return R===f?(d++,e.consume(R),x):d<3?a(R):(e.exit("codeFencedFenceSequence"),Dt(R)?Ht(e,g,"whitespace")(R):g(R))}function g(R){return R===null||it(R)?(e.exit("codeFencedFence"),i.interrupt?n(R):e.check(P0,k,M)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||it(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Dt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ht(e,b,"whitespace")(R)):R===96&&R===f?a(R):(e.consume(R),v)}function b(R){return R===null||it(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(R))}function j(R){return R===null||it(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?a(R):(e.consume(R),j)}function k(R){return e.attempt(o,M,N)(R)}function N(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return u>0&&Dt(R)?Ht(e,C,"linePrefix",u+1)(R):C(R)}function C(R){return R===null||it(R)?e.check(P0,k,M)(R):(e.enter("codeFlowValue"),_(R))}function _(R){return R===null||it(R)?(e.exit("codeFlowValue"),C(R)):(e.consume(R),_)}function M(R){return e.exit("codeFenced"),n(R)}function L(R,I,X){let J=0;return A;function A(K){return R.enter("lineEnding"),R.consume(K),R.exit("lineEnding"),O}function O(K){return R.enter("codeFencedFence"),Dt(K)?Ht(R,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):U(K)}function U(K){return K===f?(R.enter("codeFencedFenceSequence"),Y(K)):X(K)}function Y(K){return K===f?(J++,R.consume(K),Y):J>=d?(R.exit("codeFencedFenceSequence"),Dt(K)?Ht(R,ne,"whitespace")(K):ne(K)):X(K)}function ne(K){return K===null||it(K)?(R.exit("codeFencedFence"),I(K)):X(K)}}}function U5(e,n,a){const i=this;return o;function o(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?a(d):n(d)}}const oh={name:"codeIndented",tokenize:Y5},q5={partial:!0,tokenize:X5};function Y5(e,n,a){const i=this;return o;function o(h){return e.enter("codeIndented"),Ht(e,u,"linePrefix",5)(h)}function u(h){const x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?d(h):a(h)}function d(h){return h===null?m(h):it(h)?e.attempt(q5,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||it(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function X5(e,n,a){const i=this;return o;function o(d){return i.parser.lazy[i.now().line]?a(d):it(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ht(e,u,"linePrefix",5)(d)}function u(d){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):it(d)?o(d):a(d)}}const W5={name:"codeText",previous:G5,resolve:V5,tokenize:K5};function V5(e){let n=e.length-4,a=3,i,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=a;++i<n;)if(e[i][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(i=a-1,n++;++i<=n;)o===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(o=i):(i===n||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),n-=i-o-2,i=o+2),o=void 0);return e}function G5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function K5(e,n,a){let i=0,o,u;return d;function d(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),i++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?a(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),o=0,x(g)):it(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||it(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function x(g){return g===96?(e.consume(g),o++,x):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",h(g))}}class P5{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,a){const i=a??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,a,i){const o=a||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&So(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),So(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const a=this.left.splice(n,Number.POSITIVE_INFINITY);So(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);So(this.left,a.reverse())}}}function So(e,n){let a=0;if(n.length<1e4)e.push(...n);else for(;a<n.length;)e.push(...n.slice(a,a+1e4)),a+=1e4}function Gy(e){const n={};let a=-1,i,o,u,d,f,m,h;const x=new P5(e);for(;++a<x.length;){for(;a in n;)a=n[a];if(i=x.get(a),a&&i[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,Q5(x,a)),a=n[a],h=!0);else if(i[1]._container){for(u=a,o=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(x.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(i[1].end={...x.get(o)[1].start},f=x.slice(o,a),f.unshift(i),x.splice(o,a-o+1,f))}}return Or(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!h}function Q5(e,n){const a=e.get(n)[1],i=e.get(n)[2];let o=n-1;const u=[];let d=a._tokenizer;d||(d=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let x,g,v=-1,b=a,j=0,k=0;const N=[k];for(;b;){for(;e.get(++o)[1]!==b;);u.push(o),b._tokenizer||(x=i.sliceStream(b),b.next||x.push(null),g&&d.defineSkip(b.start),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=a;++v<f.length;)f[v][0]==="exit"&&f[v-1][0]==="enter"&&f[v][1].type===f[v-1][1].type&&f[v][1].start.line!==f[v][1].end.line&&(k=v+1,N.push(k),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),v=N.length;v--;){const E=f.slice(N[v],N[v+1]),C=u.pop();m.push([C,C+E.length-1]),e.splice(C,2,E)}for(m.reverse(),v=-1;++v<m.length;)h[j+m[v][0]]=j+m[v][1],j+=m[v][1]-m[v][0]-1;return h}const Z5={resolve:ek,tokenize:tk},J5={partial:!0,tokenize:nk};function ek(e){return Gy(e),e}function tk(e,n){let a;return i;function i(f){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):it(f)?e.check(J5,d,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function d(f){return e.consume(f),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function nk(e,n,a){const i=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ht(e,u,"linePrefix")}function u(d){if(d===null||it(d))return a(d);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(i.parser.constructs.flow,a,n)(d)}}function Ky(e,n,a,i,o,u,d,f,m){const h=m||Number.POSITIVE_INFINITY;let x=0;return g;function g(E){return E===60?(e.enter(i),e.enter(o),e.enter(u),e.consume(E),e.exit(u),v):E===null||E===32||E===41||$u(E)?a(E):(e.enter(i),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(E))}function v(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(o),e.exit(i),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(e.exit("chunkString"),e.exit(f),v(E)):E===null||E===60||it(E)?a(E):(e.consume(E),E===92?j:b)}function j(E){return E===60||E===62||E===92?(e.consume(E),b):b(E)}function k(E){return!x&&(E===null||E===41||cn(E))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(i),n(E)):x<h&&E===40?(e.consume(E),x++,k):E===41?(e.consume(E),x--,k):E===null||E===32||E===40||$u(E)?a(E):(e.consume(E),E===92?N:k)}function N(E){return E===40||E===41||E===92?(e.consume(E),k):k(E)}}function Py(e,n,a,i,o,u){const d=this;let f=0,m;return h;function h(b){return e.enter(i),e.enter(o),e.consume(b),e.exit(o),e.enter(u),x}function x(b){return f>999||b===null||b===91||b===93&&!m||b===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?a(b):b===93?(e.exit(u),e.enter(o),e.consume(b),e.exit(o),e.exit(i),n):it(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||it(b)||f++>999?(e.exit("chunkString"),x(b)):(e.consume(b),m||(m=!Dt(b)),b===92?v:g)}function v(b){return b===91||b===92||b===93?(e.consume(b),f++,g):g(b)}}function Qy(e,n,a,i,o,u){let d;return f;function f(v){return v===34||v===39||v===40?(e.enter(i),e.enter(o),e.consume(v),e.exit(o),d=v===40?41:v,m):a(v)}function m(v){return v===d?(e.enter(o),e.consume(v),e.exit(o),e.exit(i),n):(e.enter(u),h(v))}function h(v){return v===d?(e.exit(u),m(d)):v===null?a(v):it(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ht(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(v))}function x(v){return v===d||v===null||it(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?g:x)}function g(v){return v===d||v===92?(e.consume(v),x):x(v)}}function Bo(e,n){let a;return i;function i(o){return it(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,i):Dt(o)?Ht(e,i,a?"linePrefix":"lineSuffix")(o):n(o)}}const rk={name:"definition",tokenize:lk},ak={partial:!0,tokenize:ik};function lk(e,n,a){const i=this;let o;return u;function u(b){return e.enter("definition"),d(b)}function d(b){return Py.call(i,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return o=oa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):a(b)}function m(b){return cn(b)?Bo(e,h)(b):h(b)}function h(b){return Ky(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function x(b){return e.attempt(ak,g,g)(b)}function g(b){return Dt(b)?Ht(e,v,"whitespace")(b):v(b)}function v(b){return b===null||it(b)?(e.exit("definition"),i.parser.defined.push(o),n(b)):a(b)}}function ik(e,n,a){return i;function i(f){return cn(f)?Bo(e,o)(f):a(f)}function o(f){return Qy(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Dt(f)?Ht(e,d,"whitespace")(f):d(f)}function d(f){return f===null||it(f)?n(f):a(f)}}const sk={name:"hardBreakEscape",tokenize:ok};function ok(e,n,a){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return it(u)?(e.exit("hardBreakEscape"),n(u)):a(u)}}const ck={name:"headingAtx",resolve:uk,tokenize:dk};function uk(e,n){let a=e.length-2,i=3,o,u;return e[i][1].type==="whitespace"&&(i+=2),a-2>i&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(i===a-1||a-4>i&&e[a-2][1].type==="whitespace")&&(a-=i+1===a?2:4),a>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},u={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},Or(e,i,a-i+1,[["enter",o,n],["enter",u,n],["exit",u,n],["exit",o,n]])),e}function dk(e,n,a){let i=0;return o;function o(x){return e.enter("atxHeading"),u(x)}function u(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&i++<6?(e.consume(x),d):x===null||cn(x)?(e.exit("atxHeadingSequence"),f(x)):a(x)}function f(x){return x===35?(e.enter("atxHeadingSequence"),m(x)):x===null||it(x)?(e.exit("atxHeading"),n(x)):Dt(x)?Ht(e,f,"whitespace")(x):(e.enter("atxHeadingText"),h(x))}function m(x){return x===35?(e.consume(x),m):(e.exit("atxHeadingSequence"),f(x))}function h(x){return x===null||x===35||cn(x)?(e.exit("atxHeadingText"),f(x)):(e.consume(x),h)}}const fk=["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"],Z0=["pre","script","style","textarea"],hk={concrete:!0,name:"htmlFlow",resolveTo:xk,tokenize:gk},mk={partial:!0,tokenize:bk},pk={partial:!0,tokenize:yk};function xk(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function gk(e,n,a){const i=this;let o,u,d,f,m;return h;function h(T){return x(T)}function x(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),v):T===47?(e.consume(T),u=!0,k):T===63?(e.consume(T),o=3,i.interrupt?n:D):cr(T)?(e.consume(T),d=String.fromCharCode(T),N):a(T)}function v(T){return T===45?(e.consume(T),o=2,b):T===91?(e.consume(T),o=5,f=0,j):cr(T)?(e.consume(T),o=4,i.interrupt?n:D):a(T)}function b(T){return T===45?(e.consume(T),i.interrupt?n:D):a(T)}function j(T){const de="CDATA[";return T===de.charCodeAt(f++)?(e.consume(T),f===de.length?i.interrupt?n:U:j):a(T)}function k(T){return cr(T)?(e.consume(T),d=String.fromCharCode(T),N):a(T)}function N(T){if(T===null||T===47||T===62||cn(T)){const de=T===47,ge=d.toLowerCase();return!de&&!u&&Z0.includes(ge)?(o=1,i.interrupt?n(T):U(T)):fk.includes(d.toLowerCase())?(o=6,de?(e.consume(T),E):i.interrupt?n(T):U(T)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(T):u?C(T):_(T))}return T===45||rr(T)?(e.consume(T),d+=String.fromCharCode(T),N):a(T)}function E(T){return T===62?(e.consume(T),i.interrupt?n:U):a(T)}function C(T){return Dt(T)?(e.consume(T),C):A(T)}function _(T){return T===47?(e.consume(T),A):T===58||T===95||cr(T)?(e.consume(T),M):Dt(T)?(e.consume(T),_):A(T)}function M(T){return T===45||T===46||T===58||T===95||rr(T)?(e.consume(T),M):L(T)}function L(T){return T===61?(e.consume(T),R):Dt(T)?(e.consume(T),L):_(T)}function R(T){return T===null||T===60||T===61||T===62||T===96?a(T):T===34||T===39?(e.consume(T),m=T,I):Dt(T)?(e.consume(T),R):X(T)}function I(T){return T===m?(e.consume(T),m=null,J):T===null||it(T)?a(T):(e.consume(T),I)}function X(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||cn(T)?L(T):(e.consume(T),X)}function J(T){return T===47||T===62||Dt(T)?_(T):a(T)}function A(T){return T===62?(e.consume(T),O):a(T)}function O(T){return T===null||it(T)?U(T):Dt(T)?(e.consume(T),O):a(T)}function U(T){return T===45&&o===2?(e.consume(T),q):T===60&&o===1?(e.consume(T),se):T===62&&o===4?(e.consume(T),B):T===63&&o===3?(e.consume(T),D):T===93&&o===5?(e.consume(T),V):it(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(mk,H,Y)(T)):T===null||it(T)?(e.exit("htmlFlowData"),Y(T)):(e.consume(T),U)}function Y(T){return e.check(pk,ne,H)(T)}function ne(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),K}function K(T){return T===null||it(T)?Y(T):(e.enter("htmlFlowData"),U(T))}function q(T){return T===45?(e.consume(T),D):U(T)}function se(T){return T===47?(e.consume(T),d="",ue):U(T)}function ue(T){if(T===62){const de=d.toLowerCase();return Z0.includes(de)?(e.consume(T),B):U(T)}return cr(T)&&d.length<8?(e.consume(T),d+=String.fromCharCode(T),ue):U(T)}function V(T){return T===93?(e.consume(T),D):U(T)}function D(T){return T===62?(e.consume(T),B):T===45&&o===2?(e.consume(T),D):U(T)}function B(T){return T===null||it(T)?(e.exit("htmlFlowData"),H(T)):(e.consume(T),B)}function H(T){return e.exit("htmlFlow"),n(T)}}function yk(e,n,a){const i=this;return o;function o(d){return it(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):a(d)}function u(d){return i.parser.lazy[i.now().line]?a(d):n(d)}}function bk(e,n,a){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Xo,n,a)}}const vk={name:"htmlText",tokenize:wk};function wk(e,n,a){const i=this;let o,u,d;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),m}function m(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),L):D===63?(e.consume(D),_):cr(D)?(e.consume(D),X):a(D)}function h(D){return D===45?(e.consume(D),x):D===91?(e.consume(D),u=0,j):cr(D)?(e.consume(D),C):a(D)}function x(D){return D===45?(e.consume(D),b):a(D)}function g(D){return D===null?a(D):D===45?(e.consume(D),v):it(D)?(d=g,se(D)):(e.consume(D),g)}function v(D){return D===45?(e.consume(D),b):g(D)}function b(D){return D===62?q(D):D===45?v(D):g(D)}function j(D){const B="CDATA[";return D===B.charCodeAt(u++)?(e.consume(D),u===B.length?k:j):a(D)}function k(D){return D===null?a(D):D===93?(e.consume(D),N):it(D)?(d=k,se(D)):(e.consume(D),k)}function N(D){return D===93?(e.consume(D),E):k(D)}function E(D){return D===62?q(D):D===93?(e.consume(D),E):k(D)}function C(D){return D===null||D===62?q(D):it(D)?(d=C,se(D)):(e.consume(D),C)}function _(D){return D===null?a(D):D===63?(e.consume(D),M):it(D)?(d=_,se(D)):(e.consume(D),_)}function M(D){return D===62?q(D):_(D)}function L(D){return cr(D)?(e.consume(D),R):a(D)}function R(D){return D===45||rr(D)?(e.consume(D),R):I(D)}function I(D){return it(D)?(d=I,se(D)):Dt(D)?(e.consume(D),I):q(D)}function X(D){return D===45||rr(D)?(e.consume(D),X):D===47||D===62||cn(D)?J(D):a(D)}function J(D){return D===47?(e.consume(D),q):D===58||D===95||cr(D)?(e.consume(D),A):it(D)?(d=J,se(D)):Dt(D)?(e.consume(D),J):q(D)}function A(D){return D===45||D===46||D===58||D===95||rr(D)?(e.consume(D),A):O(D)}function O(D){return D===61?(e.consume(D),U):it(D)?(d=O,se(D)):Dt(D)?(e.consume(D),O):J(D)}function U(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),o=D,Y):it(D)?(d=U,se(D)):Dt(D)?(e.consume(D),U):(e.consume(D),ne)}function Y(D){return D===o?(e.consume(D),o=void 0,K):D===null?a(D):it(D)?(d=Y,se(D)):(e.consume(D),Y)}function ne(D){return D===null||D===34||D===39||D===60||D===61||D===96?a(D):D===47||D===62||cn(D)?J(D):(e.consume(D),ne)}function K(D){return D===47||D===62||cn(D)?J(D):a(D)}function q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),n):a(D)}function se(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ue}function ue(D){return Dt(D)?Ht(e,V,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):V(D)}function V(D){return e.enter("htmlTextData"),d(D)}}const Fm={name:"labelEnd",resolveAll:Ck,resolveTo:Ek,tokenize:Nk},kk={tokenize:Ak},jk={tokenize:Dk},Sk={tokenize:Tk};function Ck(e){let n=-1;const a=[];for(;++n<e.length;){const i=e[n][1];if(a.push(e[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",n+=o}}return e.length!==a.length&&Or(e,0,e.length,a),e}function Ek(e,n){let a=e.length,i=0,o,u,d,f;for(;a--;)if(o=e[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(d=a);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},x={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=Qr(f,e.slice(u+1,u+i+3)),f=Qr(f,[["enter",x,n]]),f=Qr(f,Pu(n.parser.constructs.insideSpan.null,e.slice(u+i+4,d-3),n)),f=Qr(f,[["exit",x,n],e[d-2],e[d-1],["exit",h,n]]),f=Qr(f,e.slice(d+1)),f=Qr(f,[["exit",m,n]]),Or(e,u,e.length,f),e}function Nk(e,n,a){const i=this;let o=i.events.length,u,d;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 f;function f(v){return u?u._inactive?g(v):(d=i.parser.defined.includes(oa(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),m):a(v)}function m(v){return v===40?e.attempt(kk,x,d?x:g)(v):v===91?e.attempt(jk,x,d?h:g)(v):d?x(v):g(v)}function h(v){return e.attempt(Sk,x,g)(v)}function x(v){return n(v)}function g(v){return u._balanced=!0,a(v)}}function Ak(e,n,a){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return cn(g)?Bo(e,u)(g):u(g)}function u(g){return g===41?x(g):Ky(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return cn(g)?Bo(e,m)(g):x(g)}function f(g){return a(g)}function m(g){return g===34||g===39||g===40?Qy(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):x(g)}function h(g){return cn(g)?Bo(e,x)(g):x(g)}function x(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):a(g)}}function Dk(e,n,a){const i=this;return o;function o(f){return Py.call(i,e,u,d,"reference","referenceMarker","referenceString")(f)}function u(f){return i.parser.defined.includes(oa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(f):a(f)}function d(f){return a(f)}}function Tk(e,n,a){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):a(u)}}const Fk={name:"labelStartImage",resolveAll:Fm.resolveAll,tokenize:Rk};function Rk(e,n,a){const i=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):a(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(f):n(f)}}const Mk={name:"labelStartLink",resolveAll:Fm.resolveAll,tokenize:zk};function zk(e,n,a){const i=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(d):n(d)}}const ch={name:"lineEnding",tokenize:_k};function _k(e,n){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ht(e,n,"linePrefix")}}const Mu={name:"thematicBreak",tokenize:Bk};function Bk(e,n,a){let i=0,o;return u;function u(h){return e.enter("thematicBreak"),d(h)}function d(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):i>=3&&(h===null||it(h))?(e.exit("thematicBreak"),n(h)):a(h)}function m(h){return h===o?(e.consume(h),i++,m):(e.exit("thematicBreakSequence"),Dt(h)?Ht(e,f,"whitespace")(h):f(h))}}const vr={continuation:{tokenize:Ik},exit:Uk,name:"list",tokenize:Lk},Ok={partial:!0,tokenize:qk},$k={partial:!0,tokenize:Hk};function Lk(e,n,a){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,d=0;return f;function f(b){const j=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:Ph(b)){if(i.containerState.type||(i.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Mu,a,h)(b):h(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return a(b)}function m(b){return Ph(b)&&++d<10?(e.consume(b),m):(!i.interrupt||d<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):a(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(Xo,i.interrupt?a:x,e.attempt(Ok,v,g))}function x(b){return i.containerState.initialBlankLine=!0,u++,v(b)}function g(b){return Dt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):a(b)}function v(b){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(b)}}function Ik(e,n,a){const i=this;return i.containerState._closeFlow=void 0,e.check(Xo,o,u);function o(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ht(e,n,"listItemIndent",i.containerState.size+1)(f)}function u(f){return i.containerState.furtherBlankLines||!Dt(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt($k,n,d)(f))}function d(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ht(e,e.attempt(vr,n,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Hk(e,n,a){const i=this;return Ht(e,o,"listItemIndent",i.containerState.size+1);function o(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?n(u):a(u)}}function Uk(e){e.exit(this.containerState.type)}function qk(e,n,a){const i=this;return Ht(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=i.events[i.events.length-1];return!Dt(u)&&d&&d[1].type==="listItemPrefixWhitespace"?n(u):a(u)}}const J0={name:"setextUnderline",resolveTo:Yk,tokenize:Xk};function Yk(e,n){let a=e.length,i,o,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){i=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!u&&e[a][1].type==="definition"&&(u=a);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",d,n]),e.splice(u+1,0,["exit",e[i][1],n]),e[i][1].end={...e[u][1].end}):e[i][1]=d,e.push(["exit",d,n]),e}function Xk(e,n,a){const i=this;let o;return u;function u(h){let x=i.events.length,g;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){g=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),o=h,d(h)):a(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Dt(h)?Ht(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||it(h)?(e.exit("setextHeadingLine"),n(h)):a(h)}}const Wk={tokenize:Vk};function Vk(e){const n=this,a=e.attempt(Xo,i,e.attempt(this.parser.constructs.flowInitial,o,Ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Z5,o)),"linePrefix")));return a;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,a}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,a}}const Gk={resolveAll:Jy()},Kk=Zy("string"),Pk=Zy("text");function Zy(e){return{resolveAll:Jy(e==="text"?Qk:void 0),tokenize:n};function n(a){const i=this,o=this.parser.constructs[e],u=a.attempt(o,d,f);return d;function d(x){return h(x)?u(x):f(x)}function f(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),m}function m(x){return h(x)?(a.exit("data"),u(x)):(a.consume(x),m)}function h(x){if(x===null)return!0;const g=o[x];let v=-1;if(g)for(;++v<g.length;){const b=g[v];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function Jy(e){return n;function n(a,i){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(a,i):a}}function Qk(e,n){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){const i=e[a-1][1],o=n.sliceStream(i);let u=o.length,d=-1,f=0,m;for(;u--;){const h=o[u];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(h===-2)m=!0,f++;else if(h!==-1){u++;break}}if(n._contentTypeTextTrailing&&a===e.length&&(f=0),f){const h={type:a===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(a,0,["enter",h,n],["exit",h,n]),a+=2)}a++}return e}const Zk={42:vr,43:vr,45:vr,48:vr,49:vr,50:vr,51:vr,52:vr,53:vr,54:vr,55:vr,56:vr,57:vr,62:Xy},Jk={91:rk},e3={[-2]:oh,[-1]:oh,32:oh},t3={35:ck,42:Mu,45:[J0,Mu],60:hk,61:J0,95:Mu,96:Q0,126:Q0},n3={38:Vy,92:Wy},r3={[-5]:ch,[-4]:ch,[-3]:ch,33:Fk,38:Vy,42:Qh,60:[M5,vk],91:Mk,92:[sk,Wy],93:Fm,95:Qh,96:W5},a3={null:[Qh,Gk]},l3={null:[42,95]},i3={null:[]},s3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:l3,contentInitial:Jk,disable:i3,document:Zk,flow:t3,flowInitial:e3,insideSpan:a3,string:n3,text:r3},Symbol.toStringTag,{value:"Module"}));function o3(e,n,a){let i={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let d=[],f=[];const m={attempt:I(L),check:I(R),consume:C,enter:_,exit:M,interrupt:I(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:j,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:g};let x=n.tokenize.call(h,m);return n.resolveAll&&u.push(n),h;function g(O){return d=Qr(d,O),N(),d[d.length-1]!==null?[]:(X(n,0),h.events=Pu(u,h.events,h),h.events)}function v(O,U){return u3(b(O),U)}function b(O){return c3(d,O)}function j(){const{_bufferIndex:O,_index:U,line:Y,column:ne,offset:K}=i;return{_bufferIndex:O,_index:U,line:Y,column:ne,offset:K}}function k(O){o[O.line]=O.column,A()}function N(){let O;for(;i._index<d.length;){const U=d[i._index];if(typeof U=="string")for(O=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===O&&i._bufferIndex<U.length;)E(U.charCodeAt(i._bufferIndex));else E(U)}}function E(O){x=x(O)}function C(O){it(O)?(i.line++,i.column=1,i.offset+=O===-3?2:1,A()):O!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=O}function _(O,U){const Y=U||{};return Y.type=O,Y.start=j(),h.events.push(["enter",Y,h]),f.push(Y),Y}function M(O){const U=f.pop();return U.end=j(),h.events.push(["exit",U,h]),U}function L(O,U){X(O,U.from)}function R(O,U){U.restore()}function I(O,U){return Y;function Y(ne,K,q){let se,ue,V,D;return Array.isArray(ne)?H(ne):"tokenize"in ne?H([ne]):B(ne);function B(he){return Be;function Be(He){const Ie=He!==null&&he[He],et=He!==null&&he.null,Ve=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(et)?et:et?[et]:[]];return H(Ve)(He)}}function H(he){return se=he,ue=0,he.length===0?q:T(he[ue])}function T(he){return Be;function Be(He){return D=J(),V=he,he.partial||(h.currentConstruct=he),he.name&&h.parser.constructs.disable.null.includes(he.name)?ge():he.tokenize.call(U?Object.assign(Object.create(h),U):h,m,de,ge)(He)}}function de(he){return O(V,D),K}function ge(he){return D.restore(),++ue<se.length?T(se[ue]):q}}}function X(O,U){O.resolveAll&&!u.includes(O)&&u.push(O),O.resolve&&Or(h.events,U,h.events.length-U,O.resolve(h.events.slice(U),h)),O.resolveTo&&(h.events=O.resolveTo(h.events,h))}function J(){const O=j(),U=h.previous,Y=h.currentConstruct,ne=h.events.length,K=Array.from(f);return{from:ne,restore:q};function q(){i=O,h.previous=U,h.currentConstruct=Y,h.events.length=ne,f=K,A()}}function A(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function c3(e,n){const a=n.start._index,i=n.start._bufferIndex,o=n.end._index,u=n.end._bufferIndex;let d;if(a===o)d=[e[a].slice(i,u)];else{if(d=e.slice(a,o),i>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(i):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function u3(e,n){let a=-1;const i=[];let o;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
53
53
|
`;break}case-3:{d=`\r
|
|
@@ -88,7 +88,7 @@ Data Analyst
|
|
|
88
88
|
DevOps Engineer, member, cto
|
|
89
89
|
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"}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/c-level), ReportsTo. Level and ReportsTo are optional."})]}),Me.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",Me.length," role",Me.length!==1?"s":"",")"]}),l.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-white/10",children:[l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),l.jsx("tbody",{children:Me.map((Z,$e)=>l.jsxs("tr",{className:`border-b border-white/5 ${Z.error?"bg-red-900/10":""}`,children:[l.jsx("td",{className:"p-2 text-white/80",children:Z.name}),l.jsx("td",{className:"p-2 text-white/60 font-mono",children:Z.id}),l.jsx("td",{className:"p-2 text-white/60",children:Z.level}),l.jsx("td",{className:"p-2 text-white/60",children:Z.reportsTo}),Z.error&&l.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:Z.error})]},$e))})]})})]})]}),Ct==="review"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",Me.length," roles"]}),l.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:l.jsxs("tr",{className:"border-b border-white/10",children:[l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),l.jsx("tbody",{children:Me.map((Z,$e)=>l.jsxs("tr",{className:"border-b border-white/5",children:[l.jsx("td",{className:"p-2 text-white/30",children:$e+1}),l.jsx("td",{className:"p-2 text-white/80",children:Z.name}),l.jsx("td",{className:"p-2 text-white/60 font-mono",children:Z.id}),l.jsx("td",{className:"p-2 text-white/60",children:Z.level}),l.jsx("td",{className:"p-2 text-white/60",children:Z.reportsTo})]},$e))})]})}),Ve&&pe.total>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[l.jsx("span",{children:"Hiring..."}),l.jsxs("span",{children:[pe.done,"/",pe.total]})]}),l.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${pe.done/pe.total*100}%`,background:"#2E7D32"}})})]}),l.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."}),Ee&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ee})]})]})}),l.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[l.jsxs("div",{children:[u==="single"&&K>1&&l.jsx("button",{onClick:()=>q(K-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"}),u==="bulk"&&Ct==="review"&&l.jsx("button",{onClick:()=>Bn("input"),disabled:Ve,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"}),u==="store"&&L==="review"&&l.jsx("button",{onClick:()=>{R("browse"),N(null),Ae("")},disabled:Ve,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"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),u==="single"?K<To?l.jsx("button",{onClick:()=>q(K+1),disabled:!bt(K),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"}):l.jsx("button",{onClick:Qe,disabled:Ve,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:Ve?"Hiring...":"HIRE"}):u==="bulk"?Ct==="input"?l.jsxs("button",{onClick:()=>Bn("review"),disabled:!ze,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 (",Me.length,")"]}):l.jsx("button",{onClick:Re,disabled:Ve,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:Ve?`Hiring ${pe.done}/${pe.total}...`:`HIRE ALL (${Me.length})`}):L==="review"?l.jsx("button",{onClick:Bt,disabled:Ve||!I.trim()||!J.trim()||e.some(Z=>Z.id===J),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:Ve?"Hiring...":"HIRE"}):null]})]})]})]})}function f6({onLogin:e}){const[n,a]=w.useState(""),[i,o]=w.useState(!1),[u,d]=w.useState(""),f=()=>{const m=n.trim();if(m){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(m)){d("Invalid token format");return}e(m)}};return l.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[l.jsx("div",{className:"text-[11px] text-white/50",children:"Sign in to vote, publish, and manage your characters."}),i?l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{value:n,onChange:m=>{a(m.target.value),d("")},onKeyDown:m=>{m.key==="Enter"&&f()},placeholder:"Paste your token here...",className:"flex-1 px-2 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-white/90 font-mono placeholder-white/20 focus:outline-none focus:border-amber-800/40",autoFocus:!0}),l.jsx("button",{onClick:f,disabled:!n.trim(),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40 disabled:opacity-30 transition-colors",children:"Sign in"})]}),u&&l.jsx("div",{className:"text-[10px] text-red-400",children:u}),l.jsx("button",{onClick:o.bind(null,!1),className:"text-[10px] text-white/30 hover:text-white/50 cursor-pointer",children:"Cancel"})]}):l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:o.bind(null,!0),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-amber-400 bg-amber-900/20 border border-amber-800/30 hover:bg-amber-900/40 transition-colors",children:"Paste Token"}),l.jsx("span",{className:"text-[10px] text-white/20 self-center",children:"from Settings → Token"})]})]})}function h6({char:e,isHired:n,onSelect:a,onVote:i,onDelete:o,fetching:u,token:d}){const[f,m]=w.useState(!1),h=d&&e.publisher_id===d,x=!!d;return l.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors group",children:[l.jsxs("div",{className:"flex flex-col items-center gap-0.5 shrink-0 w-8",children:[l.jsx("button",{onClick:g=>{g.stopPropagation(),i(1)},disabled:!x,className:`text-[14px] leading-none transition-colors ${x?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===1?"text-green-400":"text-white/20 hover:text-green-400/60"}`,title:x?"Upvote":"Sign in to vote",children:"▲"}),l.jsx("span",{className:`text-[11px] font-bold tabular-nums ${(e.vote_score??0)>0?"text-green-400/80":(e.vote_score??0)<0?"text-red-400/80":"text-white/30"}`,children:e.vote_score??0}),l.jsx("button",{onClick:g=>{g.stopPropagation(),i(-1)},disabled:!x,className:`text-[14px] leading-none transition-colors ${x?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===-1?"text-red-400":"text-white/20 hover:text-red-400/60"}`,title:x?"Downvote":"Sign in to vote",children:"▼"})]}),l.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:a,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-white/90 truncate",children:e.name}),l.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-semibold uppercase ${e.level==="c-level"?"bg-amber-900/30 text-amber-400 border border-amber-800/30":"bg-white/5 text-white/40 border border-white/10"}`,children:e.level}),n&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-green-900/20 text-green-400/60 border border-green-800/20",children:"Hired"})]}),e.tagline&&l.jsx("div",{className:"text-[11px] text-white/40 truncate mt-0.5",children:e.tagline}),l.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[l.jsxs("span",{className:"text-[10px] text-white/25",children:[e.installs??0," installs"]}),l.jsxs("span",{className:"text-[10px] text-white/25",children:["v",e.version]}),l.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:e.id})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:a,disabled:u,className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer transition-colors disabled:opacity-40 text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40",children:"Hire"}),h&&(f?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:g=>{g.stopPropagation(),o(),m(!1)},className:"px-2 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-red-400 bg-red-900/30 border border-red-800/40 hover:bg-red-900/50",children:"Confirm"}),l.jsx("button",{onClick:g=>{g.stopPropagation(),m(!1)},className:"px-2 py-1.5 text-[10px] rounded cursor-pointer text-white/40 hover:text-white/60",children:"No"})]}):l.jsx("button",{onClick:g=>{g.stopPropagation(),m(!0)},className:"w-7 h-7 rounded-lg flex items-center justify-center cursor-pointer text-white/15 hover:text-red-400/60 hover:bg-red-900/10 transition-colors opacity-0 group-hover:opacity-100",title:"Delete from store",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"})})}))]})]})}function Fo({label:e,value:n,mono:a}){return l.jsxs("div",{className:"flex justify-between text-sm",children:[l.jsx("span",{className:"text-white/40",children:e}),l.jsx("span",{className:`font-semibold text-white/80 ${a?"font-mono":""}`,children:n})]})}function m6({roleId:e,roleName:n,onClose:a,onConfirm:i}){const[o,u]=w.useState(!1),d=async()=>{u(!0);try{await i(e)}finally{u(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),l.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:[l.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[l.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),l.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",n," (",e,")"]})]}),l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[l.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),l.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",l.jsx("strong",{children:" role.yaml"}),", ",l.jsx("strong",{children:"profile.md"}),", ",l.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),l.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",l.jsx("strong",{children:n}),"?"]})]}),l.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[l.jsx("button",{onClick:a,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:d,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 p6={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function x6({roleId:e,title:n,roleColor:a,active:i,isWave:o,isWaveStreaming:u,onClick:d,onClose:f,"data-session-id":m}){const h=o?"#F59E0B":a;return l.jsxs("button",{onClick:d,"data-session-id":m,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 ${h}`}:void 0,children:[o&&u&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),l.jsx("span",{className:"text-xs",children:p6[e]??"👤"}),l.jsx("span",{className:`truncate ${o?"text-amber-400/90":""}`,children:n}),l.jsx("span",{onClick:f,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function g6({content:e,streaming:n}){let a=e;return n&&(e.match(/```/g)??[]).length%2!==0&&(a+="\n```"),l.jsx("div",{className:"terminal-markdown",children:l.jsx($m,{remarkPlugins:[Um],components:{code:y6,table:({children:i})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"terminal-table",children:i})})},children:a})})}function y6({className:e,children:n,...a}){const i=/language-(\w+)/.exec(e??"");return i||typeof n=="string"&&n.includes(`
|
|
90
90
|
`)?l.jsx(b6,{language:i==null?void 0:i[1],children:n}):l.jsx("code",{className:"terminal-inline-code",...a,children:n})}function b6({children:e,language:n}){const[a,i]=w.useState(!1),o=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return l.jsxs("div",{className:"terminal-code-block group relative my-2",children:[n&&l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:n}),l.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:a?"Copied!":"Copy"}),l.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:l.jsx("code",{children:o})})]})}const v6={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function w6({attachments:e}){const[n,a]=w.useState(null);return e.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map((i,o)=>l.jsxs("button",{onClick:()=>a(o),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[l.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},o))}),n!==null&&l.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>a(null),children:l.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[l.jsx("img",{src:`data:${e[n].mediaType};base64,${e[n].data}`,alt:e[n].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),l.jsx("button",{onClick:()=>a(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),l.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:e[n].name})]})})]})}function Rh(e,n){return n?n.file_path?String(n.file_path).replace(/^.*\/(?=[^/]+\/)/,""):n.path?String(n.path).replace(/^.*\/(?=[^/]+\/)/,""):n.pattern?String(n.pattern):n.command?String(n.command).slice(0,60):n.query?String(n.query).slice(0,60):n.url?String(n.url).slice(0,60):"":""}function k6(e){const n=[];let a="";for(const i of e)if(i.type==="thinking")i.text&&(a=i.text),n.length===0||n[n.length-1].type!=="thinking"?n.push({type:"thinking",text:i.text}):n[n.length-1].text=i.text;else if(i.type==="tool")n.push({type:"tool",toolName:i.toolName,toolSummary:Rh(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")n.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const o=n.length>0?n[n.length-1]:null;(o==null?void 0:o.type)==="dispatch:progress"&&o.roleId===i.roleId?i.progressType==="tool"?(o.toolName=i.toolName,o.toolSummary=Rh(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):n.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Rh(i.toolName,i.toolInput):void 0})}if(a){const i=n.filter(o=>o.type==="thinking");i.length>0&&(i[i.length-1].text=a)}return n}function j6({event:e,isStreaming:n}){var o,u,d;const[a,i]=w.useState(!1);switch(e.type){case"thinking":return l.jsxs("div",{className:"stream-event-thinking",children:[l.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!a),children:[l.jsx("span",{className:"stream-event-thinking-icon"}),l.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",n?"...":""]}),e.text&&!n&&l.jsx("span",{className:"stream-event-thinking-toggle",children:a?"▾":"▸"})]}),(n||a)&&e.text&&l.jsx("div",{className:"stream-event-thinking-content",children:e.text.slice(-500)})]});case"tool":return l.jsxs("div",{className:"stream-event-tool",children:[l.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&l.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary}),e.toolInput&&l.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!a),children:a?"▾":"▸"}),a&&e.toolInput&&l.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(e.toolInput,null,1).slice(0,300)})]});case"dispatch":return l.jsxs("div",{className:"stream-event-dispatch",children:[l.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(o=e.roleId)==null?void 0:o.toUpperCase()]}),l.jsx("span",{className:"stream-event-dispatch-task",children:(u=e.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return l.jsxs("div",{className:"stream-event-dispatch-progress",children:[l.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=e.roleId)==null?void 0:d.toUpperCase()}),e.progressType==="thinking"&&l.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",n?"...":""]}),e.progressType==="tool"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&l.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary})]}),e.progressType==="text"&&e.text&&l.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),e.progressType==="done"&&l.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),e.progressType==="error"&&l.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function S6({events:e,isStreaming:n}){const[a,i]=w.useState(!1);if(e.length===0)return null;const o=k6(e);if(o.length===0)return null;const u=e.filter(v=>v.type==="thinking").length,d=e.filter(v=>v.type==="tool"),f=e.filter(v=>v.type==="dispatch"||v.type==="dispatch:progress"),m=e.filter(v=>v.type==="turn").reduce((v,b)=>Math.max(v,b.turn??0),0),h=[];if(u>0&&h.push("thinking"),d.length>0){const v=[...new Set(d.map(b=>b.toolName))];v.length<=3?h.push(v.join(", ")):h.push(`${d.length} tool calls`)}f.length>0&&h.push(`${f.length} dispatch`),m>1&&h.push(`${m} turns`);const x=h.join(" · "),g=!a;return l.jsxs("div",{className:"stream-activity-log",children:[l.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!a),children:[n&&l.jsx("span",{className:"stream-activity-pulse"}),l.jsxs("span",{className:"stream-activity-summary",children:[a?"▸":"▾"," ",x,n?"...":""]})]}),g&&l.jsx("div",{className:"stream-activity-events",children:o.map((v,b)=>l.jsx(j6,{event:v,isStreaming:n&&b===o.length-1},b))})]})}function C6(e){return e.map(n=>({type:n.type==="tool:start"?"tool":n.type==="dispatch:start"?"dispatch":n.type,timestamp:new Date(n.ts).getTime(),text:n.data.text,toolName:n.data.name,toolInput:n.data.input,roleId:n.data.roleId,task:n.data.task}))}function E6({message:e,roleId:n,roleColor:a}){const i=e.from==="ceo",o=e.type==="system",u=e.status==="streaming";if(o)return l.jsx("div",{className:"flex justify-center my-2",children:l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:e.content})});if(i)return l.jsx("div",{className:"flex justify-end mb-3",children:l.jsxs("div",{className:"max-w-[85%]",children:[l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex justify-end mb-1",children:l.jsx(w6,{attachments:e.attachments})}),l.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:[e.type==="directive"&&l.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),e.content]})]})});const d=e.streamEvents??(e.events?C6(e.events):void 0),f=((d==null?void 0:d.length)??0)>0,m=!!e.thinking,h=m&&!e.content&&u&&!f;return l.jsxs("div",{className:"flex gap-2.5 mb-3",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${a}33`},children:v6[n]??"👤"}),l.jsxs("div",{className:"max-w-[85%] min-w-0",children:[l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:n.toUpperCase()}),f&&l.jsx(S6,{events:d,isStreaming:u}),m&&!f&&l.jsxs("details",{open:h,className:"mb-1",children:[l.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[h&&l.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",h?"...":` (${e.thinking.length} chars)`]}),l.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:e.thinking.slice(-500)})]}),l.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 ${a}`,background:"var(--terminal-surface)"},children:[e.content?l.jsx(g6,{content:e.content,streaming:u}):u&&!m?l.jsxs("span",{className:"typing-dots",children:[l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"})]}):u&&m?l.jsxs("span",{className:"typing-dots",children:[l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"})]}):null,u&&e.content&&l.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),e.status==="error"&&l.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"}),e.status==="done"&&(e.turns||e.tokens)&&l.jsxs("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-1 flex gap-2",children:[e.turns&&l.jsxs("span",{children:[e.turns," turns"]}),e.tokens&&l.jsxs("span",{children:[(e.tokens.input+e.tokens.output).toLocaleString()," tokens"]}),e.readOnly&&l.jsx("span",{className:"text-blue-400/60",children:"read-only"})]}),e.knowledgeDebt&&e.knowledgeDebt.length>0&&l.jsxs("div",{className:"mt-1.5 px-3 py-2 rounded-lg text-[10px]",style:{background:"#FFA72615",border:"1px solid #FFA72630"},children:[l.jsxs("div",{className:"font-bold mb-1",style:{color:"#FFA726"},children:["Knowledge Debt (",e.knowledgeDebt.length,")"]}),e.knowledgeDebt.map((x,g)=>l.jsxs("div",{className:"flex gap-1.5 mb-0.5",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("span",{style:{color:"#FFA726"},children:x.type==="orphan"?"⚠":x.type==="no-hub"?"📁":"🔗"}),l.jsxs("span",{children:[x.message,x.file?` (${x.file})`:""]})]},g))]})]})]})}function yv({messages:e,roleId:n,roleColor:a}){var o;const i=w.useRef(null);return w.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[e,(o=e[e.length-1])==null?void 0:o.content]),e.length===0?l.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",n.toUpperCase()]}):l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[e.map(u=>l.jsx(E6,{message:u,roleId:n,roleColor:a},u.id)),l.jsx("div",{ref:i})]})}const N6=5*1024*1024,A6=["image/png","image/jpeg","image/gif","image/webp"];function Qm({mode:e,onModeChange:n,onSend:a,disabled:i,disabledReason:o,onStop:u}){const[d,f]=w.useState(""),[m,h]=w.useState([]),[x,g]=w.useState(!1),[v,b]=w.useState(null),j=w.useRef(null),k=w.useRef(null),N=w.useRef(!1);w.useEffect(()=>{const O=j.current;O&&(O.style.height="0",O.style.height=Math.min(O.scrollHeight,120)+"px")},[d]),w.useEffect(()=>{if(v){const O=setTimeout(()=>b(null),3e3);return()=>clearTimeout(O)}},[v]);const E=w.useCallback(async O=>A6.includes(O.type)?O.size>N6?(b(`File too large: ${(O.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(U=>{const Y=new FileReader;Y.onload=()=>{const K=Y.result.split(",")[1];U({type:"image",data:K,name:O.name,mediaType:O.type})},Y.onerror=()=>{b("Failed to read file"),U(null)},Y.readAsDataURL(O)}):(b(`Unsupported format: ${O.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),C=w.useCallback(async O=>{const U=Array.from(O),Y=[];for(const ne of U){const K=await E(ne);K&&Y.push(K)}Y.length>0&&h(ne=>[...ne,...Y])},[E]),_=w.useCallback(O=>{O.preventDefault(),O.stopPropagation(),g(!0)},[]),M=w.useCallback(O=>{O.preventDefault(),O.stopPropagation(),g(!1)},[]),L=w.useCallback(O=>{O.preventDefault(),O.stopPropagation(),g(!1);const U=O.dataTransfer.files;U.length>0&&C(U)},[C]),R=w.useCallback(O=>{const U=O.clipboardData.items,Y=[];for(let ne=0;ne<U.length;ne++){const K=U[ne];if(K.type.startsWith("image/")){const q=K.getAsFile();q&&Y.push(q)}}Y.length>0&&(O.preventDefault(),C(Y))},[C]),I=w.useCallback(O=>{const U=O.target.files;U&&U.length>0&&C(U),O.target.value=""},[C]),X=w.useCallback(O=>{h(U=>U.filter((Y,ne)=>ne!==O))},[]),J=()=>{const O=d.trim();!O&&m.length===0||i||(a(O,m.length>0?m:void 0),f(""),h([]))},A=O=>{if(O.key==="Enter"&&!O.shiftKey){if(N.current)return;O.preventDefault(),J()}};return l.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${x?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:_,onDragLeave:M,onDrop:L,children:[v&&l.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:v}),o&&l.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:o}),m.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((O,U)=>l.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[l.jsx("img",{src:`data:${O.mediaType};base64,${O.data}`,alt:O.name,className:"w-full h-full object-cover"}),l.jsx("button",{onClick:()=>X(U),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:O.name})]},U))}),x&&l.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[l.jsx("button",{onClick:()=>n("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),l.jsx("button",{onClick:()=>n("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),l.jsx("button",{onClick:()=>{var O;return(O=k.current)==null?void 0:O.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),l.jsx("input",{ref:k,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:I,className:"hidden"}),l.jsx("textarea",{ref:j,value:d,onChange:O=>f(O.target.value),onKeyDown:A,onCompositionStart:()=>{N.current=!0},onCompositionEnd:()=>{N.current=!1},onPaste:R,placeholder:i?"Waiting...":e==="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"}),i&&u&&l.jsx("button",{onClick:u,className:"w-8 h-8 rounded-lg bg-red-900/40 text-red-400 flex items-center justify-center shrink-0 cursor-pointer hover:bg-red-900/60 hover:text-red-300 transition-colors",title:"Stop",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}),l.jsx("button",{onClick:J,disabled:i||!d.trim()&&m.length===0,className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const D6={ceo:"#FFB300",cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},bv={ceo:"CEO (You)",cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function Pg(e){return new Date(e).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function T6({msg:e}){const n=D6[e.roleId]??"#888",a=bv[e.roleId]??e.roleId;if(e.type==="dispatch"){const i=e.text.includes("WAVE"),o=e.text.includes("completed")||e.text.includes("완료"),u=i?"📡":o?"✓":"→",d=o?"text-green-400/70":"text-[var(--terminal-text-muted)]";return l.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:Pg(e.ts)}),l.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),l.jsx("span",{className:`text-[11px] ${d}`,children:e.text})]})}return l.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:Pg(e.ts)}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:n},children:a}),l.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:e.text})]})]})}function F6({channel:e,allRoles:n,onUpdateMembers:a,onUpdateTopic:i,onSendMessage:o}){const u=w.useRef(null),d=w.useRef(null),[f,m]=w.useState("");w.useEffect(()=>{var _;const E=d.current;if(!E)return;E.scrollHeight-E.scrollTop-E.clientHeight<80&&((_=u.current)==null||_.scrollIntoView({behavior:"smooth"}))},[e.messages.length]);const[h,x]=w.useState(!1),[g,v]=w.useState(!1),[b,j]=w.useState(""),k=o&&e.id!=="general",N=()=>{!f.trim()||!o||(o(e.id,f.trim()),m(""),setTimeout(()=>{var E;return(E=u.current)==null?void 0:E.scrollIntoView({behavior:"smooth"})},50))};return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{ref:d,className:"flex-1 overflow-y-auto terminal-scrollbar py-2 min-h-0",children:[l.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:e.name}),e.members.length>0&&l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.members.map(E=>bv[E]??E).join(", ")}),e.members.length===0&&l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.isDefault?"system logs":"no members"}),!e.isDefault&&n&&a&&l.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:()=>x(!h),children:h?"Done":"Invite"})]}),!e.isDefault&&i&&l.jsx("div",{className:"px-3 pb-2 mb-1",children:g?l.jsx("input",{autoFocus:!0,value:b,onChange:E=>j(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(i(e.id,b.trim()),v(!1)),E.key==="Escape"&&v(!1)},onBlur:()=>{i(e.id,b.trim()),v(!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"}):l.jsx("button",{onClick:()=>{j(e.topic??""),v(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:e.topic||"Click to set channel topic..."})}),h&&!e.isDefault&&n&&a&&l.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:l.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(E=>{const C=e.members.includes(E.id);return l.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${C?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const _=C?e.members.filter(M=>M!==E.id):[...e.members,E.id];a(e.id,_)},children:[C?"✓ ":"",E.name]},E.id)})})}),e.messages.length===0&&l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:l.jsx("span",{children:e.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),e.messages.map(E=>l.jsx(T6,{msg:E},E.id)),l.jsx("div",{ref:u})]}),k&&l.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-[var(--terminal-border)]",children:l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("span",{className:"text-[10px] font-semibold shrink-0",style:{color:"#FFB300"},children:"CEO"}),l.jsx("input",{type:"text",value:f,onChange:E=>m(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),N())},placeholder:"Say something...",className:"flex-1 px-2 py-1 text-xs rounded border bg-transparent text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#FFB300]/50"})]})})]})}const Mh={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},R6=400,M6=800;function Qg({sessions:e,activeSessionId:n,roles:a,streamingSessionId:i,width:o,onWidthChange:u,onSwitchSession:d,onCloseSession:f,onCreateSession:m,onClearEmpty:h,onCloseAll:x,onSendMessage:g,onModeChange:v,onStopSession:b,onCloseTerminal:j,onMaximize:k,chatChannels:N,activeChatChannelId:E,onSwitchChatChannel:C,onCreateChatChannel:_,onDeleteChatChannel:M,onUpdateChatMembers:L,onUpdateChatTopic:R,onSendChatMessage:I,unreadChannels:X}){const[J,A]=w.useState(!1),[O,U]=w.useState(!1),[Y,ne]=w.useState(!1),[K,q]=w.useState(""),se=E!=null,ue=N==null?void 0:N.find(Ee=>Ee.id===E),[V,D]=w.useState(!1),[B,H]=w.useState(!1),[T,de]=w.useState(!1),ge=w.useRef(0),he=w.useRef(0),Be=w.useRef(null),He=e.find(Ee=>Ee.id===n),Ie=i===n,et=e.filter(Ee=>Ee.messages.length===0).length,Ve=w.useCallback(()=>{const Ee=Be.current;Ee&&(H(Ee.scrollLeft>0),de(Ee.scrollLeft+Ee.clientWidth<Ee.scrollWidth-1))},[]);w.useEffect(()=>{if(!n||!Be.current)return;const Ee=Be.current.querySelector(`[data-session-id="${n}"]`);Ee&&Ee.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Ve()},[n,e.length,Ve]),w.useEffect(()=>{const Ee=Be.current;if(!Ee)return;Ve(),Ee.addEventListener("scroll",Ve);const Ae=new ResizeObserver(Ve);return Ae.observe(Ee),()=>{Ee.removeEventListener("scroll",Ve),Ae.disconnect()}},[Ve]);const Ke=w.useCallback(Ee=>{Ee.preventDefault(),ge.current=Ee.clientX,he.current=o,D(!0);const Ae=k,yt=()=>{D(!1),document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",yt)},dt=xt=>{const jt=ge.current-xt.clientX,Wt=he.current+jt;if(Wt>=window.innerWidth*.6&&Ae){yt(),Ae();return}const Tt=Math.min(M6,Math.max(R6,Wt));u==null||u(Tt)};document.addEventListener("mousemove",dt),document.addEventListener("mouseup",yt)},[o,u,k]);return l.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&&l.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${V?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Ke}),l.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[l.jsxs("div",{className:"relative flex-1 min-w-0",children:[B&&l.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"}),l.jsxs("div",{ref:Be,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[N==null?void 0:N.map(Ee=>l.jsxs("button",{onClick:()=>{C==null||C(Ee.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 ${E===Ee.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:E===Ee.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[l.jsx("span",{className:"text-[10px]",children:"💬"}),l.jsx("span",{className:"truncate",children:Ee.name}),(X==null?void 0:X.has(Ee.id))&&E!==Ee.id&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!Ee.isDefault&&l.jsx("span",{onClick:Ae=>{Ae.stopPropagation(),M==null||M(Ee.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:"×"})]},Ee.id)),N&&N.length>0&&e.length>0&&l.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),e.map(Ee=>l.jsx(x6,{roleId:Ee.roleId,title:Ee.title,roleColor:Mh[Ee.roleId]??"#666",active:!se&&Ee.id===n,isWave:Ee.source==="wave",isWaveStreaming:Ee.source==="wave"&&Ee.status==="active",onClick:()=>{C==null||C(null),d(Ee.id)},onClose:Ae=>{Ae.stopPropagation(),f(Ee.id)},"data-session-id":Ee.id},Ee.id))]}),T&&l.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"})]}),l.jsxs("div",{className:"relative shrink-0",children:[l.jsx("button",{onClick:()=>{A(!J),U(!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:"+"}),J&&l.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:[_&&l.jsxs(l.Fragment,{children:[Y?l.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),l.jsx("input",{autoFocus:!0,value:K,onChange:Ee=>q(Ee.target.value),onKeyDown:Ee=>{Ee.key==="Enter"&&K.trim()&&(_(K.trim(),[]),q(""),ne(!1),A(!1)),Ee.key==="Escape"&&(ne(!1),q(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):l.jsxs("button",{onClick:()=>ne(!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:[l.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),l.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),a.map(Ee=>l.jsxs("button",{onClick:()=>{m(Ee.id),C==null||C(null),A(!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:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Mh[Ee.id]??"#666"}}),Ee.id.toUpperCase()," — ",Ee.name]},Ee.id))]})]}),l.jsxs("div",{className:"relative shrink-0",children:[l.jsx("button",{onClick:()=>{U(!O),A(!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:"···"}),O&&l.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:[l.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[e.length," session",e.length!==1?"s":""]}),et>0&&h&&l.jsxs("button",{onClick:()=>{h(),U(!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 (",et,")"]}),e.length>0&&x&&l.jsx("button",{onClick:()=>{x(),U(!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"}),e.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),k&&l.jsx("button",{onClick:k,className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",title:"Maximize (Pro View)",children:"⤢"}),l.jsx("button",{onClick:j,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),se&&ue?l.jsx(F6,{channel:ue,allRoles:a,onUpdateMembers:L,onUpdateTopic:R,onSendMessage:I}):He?l.jsxs(l.Fragment,{children:[l.jsx(yv,{messages:He.messages,roleId:He.roleId,roleColor:Mh[He.roleId]??"#666"}),l.jsx(Qm,{mode:He.mode,onModeChange:Ee=>v(He.id,Ee),onSend:(Ee,Ae)=>g(He.id,Ee,He.mode,Ae),disabled:Ie,disabledReason:Ie?`${He.roleId.toUpperCase()} is responding...`:void 0,onStop:Ie&&b?()=>b(He.id):void 0})]}):l.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 z6(){const e=w.useRef(null),n=w.useCallback(()=>{var i;(i=e.current)==null||i.abort(),e.current=null},[]);return{sendMessage:w.useCallback((i,o,u,d,f)=>{n();const m=new AbortController;return e.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o,mode:u,attachments:f}),signal:m.signal}).then(async h=>{var N,E,C,_,M;if(!h.ok||!h.body){d.onError("Failed to connect");return}const x=h.body.getReader(),g=new TextDecoder;let v="",b=Date.now();const j=6e4,k=setInterval(()=>{Date.now()-b>j&&(clearInterval(k),m.abort(),d.onError("Connection stale — no data received for 60s"))},1e4);try{for(;;){const{done:L,value:R}=await x.read();if(L)break;b=Date.now(),v+=g.decode(R,{stream:!0});const I=v.split(`
|
|
91
|
-
`);v=I.pop()??"";let X="";for(let J=0;J<I.length;J++){const A=I[J];if(A.startsWith("event: ")){X=A.slice(7).trim();continue}if(A.startsWith("data: ")){let O;try{O=JSON.parse(A.slice(6))}catch{X="";continue}switch(X){case"thinking":O.text&&((N=d.onThinking)==null||N.call(d,O.text));break;case"output":O.text&&d.onText(O.text);break;case"tool":(E=d.onToolUse)==null||E.call(d,O.name,O.input);break;case"dispatch":(C=d.onDispatch)==null||C.call(d,O.roleId,O.task);break;case"dispatch:progress":(_=d.onDispatchProgress)==null||_.call(d,O.roleId,O.type,O);break;case"turn":(M=d.onTurn)==null||M.call(d,O.turn);break;case"done":d.onDone(O);break;case"error":d.onError(O.message??"Unknown error");break;default:O.text&&d.onText(O.text);break}X=""}}}}finally{clearInterval(k)}}).catch(h=>{h.name!=="AbortError"&&d.onError(h.message)}),{abort:n}},[n]),abort:n}}const vv="tycono-appearances",gm="tycono-theme";function Zg(){try{const e=localStorage.getItem(vv);return e?JSON.parse(e):{}}catch{return{}}}function zh(e){localStorage.setItem(vv,JSON.stringify(e))}function Jg(){try{const e=localStorage.getItem(gm);if(e&&e in il)return e}catch{}return"default"}const wv=new Set;for(const e of Object.values(il))for(const n of Object.keys(e.vars))wv.add(n);function _6(e){var i;const n=(i=il[e])==null?void 0:i.vars;if(!n)return;const a=document.documentElement;for(const o of wv)o in n||a.style.removeProperty(o);for(const[o,u]of Object.entries(n))a.style.setProperty(o,u)}const _h={mode:"auto",intervalSec:18,dailyBudgetUsd:1},ym="tycono-speech-settings",Bh="tycono-language";function B6(){try{const e=localStorage.getItem(ym);return e?{..._h,...JSON.parse(e)}:_h}catch{return _h}}function O6(){const[e,n]=w.useState(Zg),[a,i]=w.useState(Jg),[o,u]=w.useState(B6),[d,f]=w.useState(()=>{try{return localStorage.getItem(Bh)??"auto"}catch{return"auto"}}),[m,h]=w.useState(new Set),x=w.useRef(!1);w.useEffect(()=>{x.current||(x.current=!0,ye.getPreferences().then(C=>{const _=Object.keys(C.appearances??{}).length>0||C.theme!=="default";if(C.speech&&(u(M=>({...M,...C.speech})),localStorage.setItem(ym,JSON.stringify(C.speech))),C.language&&(f(C.language),localStorage.setItem(Bh,C.language)),C.purchasedItems&&h(new Set(C.purchasedItems)),_){const M=C.appearances;n(M),zh(M),C.theme&&C.theme in il&&(i(C.theme),localStorage.setItem(gm,C.theme))}else{const M=Zg(),L=Jg();(Object.keys(M).length>0||L!=="default")&&ye.updatePreferences({appearances:M,theme:L}).catch(()=>{})}}).catch(()=>{}))},[]),w.useEffect(()=>{_6(a)},[a]);const g=w.useCallback(C=>e[C]??Pm(C),[e]),v=w.useCallback((C,_)=>{n(M=>{const L={...M,[C]:_};return zh(L),ye.updatePreferences({appearances:L}).catch(()=>{}),L})},[]),b=w.useCallback(C=>{n(_=>{const M={..._};return delete M[C],zh(M),ye.updatePreferences({appearances:M}).catch(()=>{}),M})},[]),j=w.useCallback(C=>{i(C),localStorage.setItem(gm,C),ye.updatePreferences({theme:C}).catch(()=>{})},[]),k=w.useCallback(C=>{u(_=>{const M={..._,...C};return localStorage.setItem(ym,JSON.stringify(M)),ye.updatePreferences({speech:M}).catch(()=>{}),M})},[]),N=w.useCallback(C=>{f(C),localStorage.setItem(Bh,C),ye.updatePreferences({language:C}).catch(()=>{})},[]),E=w.useCallback(C=>{h(_=>{const M=new Set(_);return M.add(C),ye.updatePreferences({purchasedItems:Array.from(M)}).catch(()=>{}),M})},[]);return{appearances:e,getAppearance:g,setAppearance:v,resetAppearance:b,theme:a,setTheme:j,speechSettings:o,setSpeechSettings:k,language:d,setLanguage:N,purchasedItems:m,addPurchasedItem:E}}const $6=3e4,L6=3e5;function I6(){var O;const[e,n]=w.useState("akb"),[a,i]=w.useState(null),[o,u]=w.useState("synced"),[d,f]=w.useState([]),[m,h]=w.useState(null),[x,g]=w.useState(!1),v=w.useRef(null),b=w.useRef(null),j=w.useRef(e);j.current=e;const k=w.useCallback(async()=>{try{const U=await ye.getSaveStatus(j.current);i(U),U.noGit?u("no-git"):u(Y=>Y==="saving"?Y:U.dirty?"dirty":"synced")}catch{u("error")}},[]),N=w.useCallback(async()=>{try{const U=await ye.getSyncStatus(j.current);h({ahead:U.ahead,behind:U.behind,branch:U.branch,hasRemote:U.hasRemote})}catch{}},[]),E=w.useCallback(()=>{v.current&&clearInterval(v.current),k(),v.current=setInterval(k,$6),b.current&&clearInterval(b.current),N(),b.current=setInterval(N,L6)},[k,N]);w.useEffect(()=>()=>{v.current&&clearInterval(v.current),b.current&&clearInterval(b.current)},[]);const C=w.useCallback(U=>{n(U),j.current=U,i(null),h(null),f([]),setTimeout(()=>{k(),N()},0)},[k,N]),_=w.useCallback(async U=>{u("saving");try{const Y=await ye.save(U,j.current);return await k(),Y}catch(Y){throw u("error"),Y}},[k]),M=w.useCallback(async()=>{try{const U=await ye.getSaveHistory(20,j.current);f(U)}catch{}},[]),L=w.useCallback(async U=>{u("saving");try{await ye.restoreSave(U,void 0,j.current),await k()}catch(Y){throw u("error"),Y}},[k]),R=w.useCallback(async()=>{g(!0);try{const U=await ye.pull(j.current);return await k(),await N(),U}catch(U){throw U}finally{g(!1)}},[k,N]),I=w.useCallback(async()=>{try{await ye.initGit(),await k()}catch{u("error")}},[k]),X=a?a.modified.length+a.untracked.length:0,J=((O=a==null?void 0:a.lastCommit)==null?void 0:O.date)??null,A=w.useCallback(async()=>{E()},[E]);return{state:o,dirtyCount:X,lastSaved:J,status:a,save:_,history:d,loadHistory:M,restore:L,refresh:A,initGit:I,repo:e,setRepo:C,syncInfo:m,fetchSyncStatus:N,pull:R,pulling:x}}const ey={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."]},ty={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."]},H6=[{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."}]}],U6=18e3,ny=6e3,q6=2500,Y6=30*6e4,kv="tycono:relationships";function X6(){try{const e=localStorage.getItem(kv);return e?JSON.parse(e):[]}catch{return[]}}function W6(e){localStorage.setItem(kv,JSON.stringify(e))}function ku(e,n,a){const[i,o]=n<a?[n,a]:[a,n];let u=e.find(d=>d.roleA===i&&d.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function ju(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function Su(e){return e[Math.floor(Math.random()*e.length)]}function V6(e,n,a){const i=a.find(f=>f.id===e),o=a.find(f=>f.id===n);if(!i||!o)return null;const u=i.level==="c-level",d=o.level==="c-level";return u&&d?"c-level":i.reportsTo===n||o.reportsTo===e?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function G6(e,n){return e.relation==="any"?!0:e.relation===n}function K6({roles:e,roleStatuses:n,activeExecs:a,getStandupSpeech:i}){const[o,u]=w.useState(new Map),[d,f]=w.useState(X6),m=w.useRef({}),h=w.useRef(null),x=w.useRef(e),g=w.useRef(n),v=w.useRef(a),b=w.useRef(i),j=w.useRef(d);x.current=e,g.current=n,v.current=a,b.current=i,j.current=d,w.useEffect(()=>{const M=Date.now();for(const[L,R]of Object.entries(n))R==="working"&&(m.current[L]=M)},[n]),w.useEffect(()=>{W6(d)},[d]);const k=w.useCallback(M=>{const L=g.current[M],R=v.current.find(O=>O.roleId===M);if(L==="working"&&(R!=null&&R.task))return null;const I=b.current(M);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const X=Date.now(),J=m.current[M]??0;if(X-J>Y6&&Math.random()<.5){const O=ty[M]??ty.engineer;return{text:Su(O),type:"guilt",ts:X}}const A=ey[M]??ey.engineer;return{text:Su(A),type:"personality",ts:X}},[]),N=w.useCallback(M=>{if(h.current)return!1;const L=M.filter(se=>g.current[se.id]!=="working");if(L.length<2)return!1;const R=[...L].sort(()=>Math.random()-.5),I=R[0],X=R[1],J=V6(I.id,X.id,M);if(!J)return!1;const A=ku(j.current,I.id,X.id),O=ju(A),U=H6.filter(se=>G6(se,J)&&O>=se.minFamiliarity);if(U.length===0)return!1;const Y=Su(U);let ne=I.id,K=X.id;Y.relation==="superior-subordinate"&&(X.reportsTo===I.id||I.level==="c-level"?(ne=I.id,K=X.id):(ne=X.id,K=I.id)),h.current={templateId:Y.id,roleA:ne,roleB:K,turnIdx:0,timer:null};const q=se=>{if(!h.current||se>=Y.turns.length){h.current=null,f(B=>{const H=[...B],T=ku(H,ne,K);return T.conversations++,T.familiarity=ju(T),T.lastInteraction=new Date().toISOString(),H}),setTimeout(()=>{u(B=>{const H=new Map(B);return H.delete(ne),H.delete(K),H})},ny);return}const ue=Y.turns[se],V=ue.speaker==="A"?ne:K,D=ue.speaker==="A"?K:ne;u(B=>{const H=new Map(B);if(H.set(V,{text:ue.text,type:"social",partnerId:D,ts:Date.now()}),se>0){const T=Y.turns[se-1].speaker==="A"?ne:K;T!==V&&H.delete(T)}return H}),h.current.turnIdx=se,h.current.timer=setTimeout(()=>q(se+1),q6)};return q(0),!0},[]);w.useEffect(()=>{const M=setInterval(()=>{const L=x.current;if(L.length===0||h.current||Math.random()<.35&&N(L))return;const R=L.filter(J=>g.current[J.id]!=="working");if(R.length===0)return;const I=Su(R),X=k(I.id);X&&(u(J=>{const A=new Map(J);return A.set(I.id,X),A}),setTimeout(()=>{u(J=>{const A=new Map(J),O=A.get(I.id);return O&&O.ts===X.ts&&A.delete(I.id),A})},ny))},U6);return()=>{var L;clearInterval(M),(L=h.current)!=null&&L.timer&&clearTimeout(h.current.timer)}},[k,N]);const E=w.useCallback(M=>{const L=o.get(M);return(L==null?void 0:L.text)??""},[o]),C=w.useCallback((M,L)=>{f(R=>{const I=[...R],X=ku(I,M,L);return X.dispatches++,X.familiarity=ju(X),X.lastInteraction=new Date().toISOString(),I})},[]),_=w.useCallback(M=>{M.length<2||f(L=>{const R=[...L];for(let I=0;I<M.length;I++)for(let X=I+1;X<M.length;X++){const J=ku(R,M[I],M[X]);J.wavesTogether++,J.familiarity=ju(J),J.lastInteraction=new Date().toISOString()}return R})},[]);return{speeches:o,getSpeech:E,relationships:d,notifyDispatch:C,notifyWave:_}}const jv="tycono:office-chat";let P6=0;function Q6(){return`chat-${Date.now()}-${++P6}`}function Oh(){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 Z6(){try{const e=localStorage.getItem(jv);if(e){const n=JSON.parse(e);if(n.find(i=>i.id==="office")&&!n.find(i=>i.id==="general")){const i=n.filter(o=>o.id!=="office");return[...Oh(),...i]}const a=Oh();for(const i of a)n.find(o=>o.id===i.id)||n.unshift(i);return n}}catch{}return Oh()}function J6(e){const n=e.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(jv,JSON.stringify(n))}function eA(){const[e,n]=w.useState(Z6),[a,i]=w.useState(null),[o,u]=w.useState(new Set);w.useEffect(()=>{J6(e)},[e]);const d=w.useCallback(b=>{i(b),b&&u(j=>{const k=new Set(j);return k.delete(b),k})},[]),f=w.useCallback(b=>{const j={...b,id:Q6()};n(k=>{const N=k.map(E=>E.id==="general"?b.type==="dispatch"?{...E,messages:[...E.messages,j].slice(-200)}:E:b.channelId?E.id===b.channelId?{...E,messages:[...E.messages,j].slice(-200)}:E:E.members.length>0&&E.members.includes(b.roleId)?{...E,messages:[...E.messages,j].slice(-200)}:E);return u(E=>{const C=new Set(E);for(const _ of N){const M=k.find(L=>L.id===_.id);M&&_.messages.length>M.messages.length&&C.add(_.id)}return C}),N})},[]),m=w.useCallback((b,j,k)=>{const N=`ch-${Date.now()}`,E={id:N,name:b.startsWith("#")?b:`#${b}`,members:j,isDefault:!1,messages:[],topic:k};n(C=>[...C,E]),i(N)},[]),h=w.useCallback(b=>{n(j=>j.filter(k=>k.id!==b||k.isDefault)),i(j=>j===b?"general":j)},[]),x=w.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,members:j}:N))},[]),g=w.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,topic:j||void 0}:N))},[]),v=w.useCallback(b=>{n(j=>j.map(k=>{if(k.id==="watercooler"){const N=b.filter(E=>E.level!=="c-level").map(E=>E.id);if(k.members.length!==N.length||!N.every(E=>k.members.includes(E)))return{...k,members:N}}return k}))},[]);return{channels:e,activeChannelId:a,setActiveChannelId:d,pushMessage:f,createChannel:m,deleteChannel:h,updateMembers:x,updateTopic:g,unreadChannels:o,syncDefaultMembers:v}}const tA=45e3,ry=5e3,nA=4,rA=20;function aA({roles:e,roleStatuses:n,activeExecs:a,channels:i,relationships:o,pushMessage:u,speechSettings:d,engineType:f,hasApiKey:m}){const x=((d==null?void 0:d.mode)==="auto"?f==="claude-cli"||f==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(m!==!1||f==="claude-cli"),g=((d==null?void 0:d.intervalSec)??tA/1e3)*1e3,v=w.useRef(e),b=w.useRef(n),j=w.useRef(a),k=w.useRef(i),N=w.useRef(o),E=w.useRef(u),C=w.useRef(0),_=w.useRef(!1);v.current=e,b.current=n,j.current=a,k.current=i,N.current=o,E.current=u;const M=w.useCallback(async(I,X)=>{if(_.current)return!1;_.current=!0;try{if(!v.current.find(q=>q.id===I))return!1;const A=X.messages.slice(-rA).map(q=>({roleId:q.roleId,text:q.text,ts:q.ts})),O=v.current.filter(q=>X.members.includes(q.id)),U=N.current.filter(q=>q.roleA===I||q.roleB===I).map(q=>({partnerId:q.roleA===I?q.roleB:q.roleA,familiarity:q.familiarity})),Y=j.current.find(q=>q.roleId===I),ne=Y?{currentTask:Y.task,taskProgress:null}:{currentTask:null,taskProgress:null},K=await ye.chatInChannel({channelId:X.name.replace("#",""),channelTopic:X.topic,roleId:I,history:A,members:O.map(q=>({id:q.id,name:q.name,level:q.level})),relationships:U,workContext:ne});return K.message?(E.current({ts:Date.now(),roleId:I,text:K.message,type:"chat",channelId:X.id}),!0):!1}catch{return!1}finally{_.current=!1}},[]),L=w.useCallback(async(I,X)=>{if(C.current>=nA){C.current=0;return}const J=I.members.filter(Y=>Y!==X&&b.current[Y]!=="working");if(J.length===0){C.current=0;return}const A=J[Math.floor(Math.random()*J.length)];if(Math.random()>.7){C.current=0;return}const O=C.current*2e3,U=Math.random()*5e3;setTimeout(async()=>{C.current++;const Y=k.current.find(K=>K.id===I.id);if(!Y)return;if(await M(A,Y)){const K=.6-C.current*.1;Math.random()<K?L(Y,A):C.current=0}else C.current=0},ry+O+U)},[M]);return w.useEffect(()=>{if(!x)return;const I=setInterval(async()=>{const X=v.current;if(X.length===0||_.current)return;const J=X.filter(ne=>b.current[ne.id]!=="working");if(J.length===0)return;const A=J[Math.floor(Math.random()*J.length)],O=k.current.filter(ne=>ne.members.length===0?!0:ne.members.includes(A.id));if(O.length===0)return;const U=O[Math.floor(Math.random()*O.length)];C.current=0,await M(A.id,U)&&L(U,A.id)},g);return()=>clearInterval(I)},[x,g,M,L]),{triggerCeoReaction:w.useCallback(I=>{if(!x)return;const X=k.current.find(J=>J.id===I);X&&(C.current=0,setTimeout(()=>{L(X,"ceo")},ry))},[x,L])}}const Sv=[[1,8],[3,5],[8,1],[5,3]],lA=[[1,4],[2,3],[4,1],[3,2]];function Cu(e){const n=e===1||e===3?-1:0,a=Sv[e],i=e<2?[0,1]:[1,0],o=n;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:a[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:a[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 Eu(e){const n=e===1||e===3?-1:0,a=Sv[e],i=e<2?[0,1]:[1,0],o=n;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[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 Hl(e,n){const a=e===1||e===3?-1:0,i=lA[e],o=a,u=e%2===0?1:0;return n?[{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 ay={down:[Cu(0),Cu(1),Cu(2),Cu(3)],up:[Eu(0),Eu(1),Eu(2),Eu(3)],right:[Hl(0,!0),Hl(1,!0),Hl(2,!0),Hl(3,!0)],left:[Hl(0,!1),Hl(1,!1),Hl(2,!1),Hl(3,!1)]},Te="#FAFAF7",Hn="#FFFFFF",De="#EDE8E2",nt="#DDD6CC",qo="#1A1A2E",nd="#2A2A2A",Zm="#FFB0B0",ly=[{x:2,y:0,w:1,h:1,c:De},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Hn},{x:5,y:0,w:1,h:1,c:Te},{x:6,y:0,w:1,h:1,c:De},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:Te},{x:3,y:1,w:1,h:1,c:Hn},{x:4,y:1,w:1,h:1,c:Te},{x:5,y:1,w:1,h:1,c:Hn},{x:6,y:1,w:1,h:1,c:Te},{x:7,y:1,w:1,h:1,c:nt},{x:0,y:2,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Hn},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:nt},{x:1,y:3,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:Te},{x:3,y:3,w:1,h:1,c:qo},{x:4,y:3,w:1,h:1,c:Te},{x:5,y:3,w:1,h:1,c:qo},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:De},{x:3,y:4,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:nd},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:3,y:5,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:nt},{x:2,y:6,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:Te},{x:4,y:6,w:1,h:1,c:Hn},{x:5,y:6,w:1,h:1,c:Te},{x:6,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:nt},{x:3,y:7,w:1,h:1,c:De},{x:4,y:7,w:1,h:1,c:Te},{x:5,y:7,w:1,h:1,c:De},{x:6,y:7,w:1,h:1,c:nt}],iA=[{x:3,y:8,w:1,h:1,c:De},{x:5,y:8,w:1,h:1,c:De},{x:3,y:9,w:1,h:1,c:nt},{x:5,y:9,w:1,h:1,c:nt}],sA=[{x:2,y:8,w:1,h:1,c:De},{x:6,y:8,w:1,h:1,c:De},{x:2,y:9,w:1,h:1,c:nt},{x:6,y:9,w:1,h:1,c:nt}],iy=[{x:2,y:0,w:1,h:1,c:De},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Hn},{x:5,y:0,w:1,h:1,c:Te},{x:6,y:0,w:1,h:1,c:De},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:De},{x:7,y:1,w:1,h:1,c:nt},{x:0,y:2,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:nt},{x:1,y:3,w:1,h:1,c:nt},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:Te},{x:5,y:3,w:1,h:1,c:Te},{x:6,y:3,w:1,h:1,c:De},{x:7,y:3,w:1,h:1,c:nt},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:De},{x:6,y:4,w:1,h:1,c:nt},{x:3,y:5,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:nt},{x:2,y:6,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:Te},{x:4,y:6,w:1,h:1,c:Te},{x:5,y:6,w:1,h:1,c:Te},{x:6,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:nt},{x:3,y:7,w:1,h:1,c:De},{x:4,y:7,w:1,h:1,c:Te},{x:5,y:7,w:1,h:1,c:De},{x:6,y:7,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:Hn}],oA=[{x:3,y:8,w:1,h:1,c:De},{x:5,y:8,w:1,h:1,c:De},{x:3,y:9,w:1,h:1,c:nt},{x:5,y:9,w:1,h:1,c:nt}],cA=[{x:2,y:8,w:1,h:1,c:De},{x:6,y:8,w:1,h:1,c:De},{x:2,y:9,w:1,h:1,c:nt},{x:6,y:9,w:1,h:1,c:nt}],bm=[{x:8,y:0,w:1,h:1,c:De},{x:9,y:0,w:1,h:1,c:Te},{x:10,y:0,w:1,h:1,c:Hn},{x:11,y:0,w:1,h:1,c:Te},{x:7,y:1,w:1,h:1,c:nt},{x:8,y:1,w:1,h:1,c:Te},{x:9,y:1,w:1,h:1,c:Hn},{x:10,y:1,w:1,h:1,c:Te},{x:11,y:1,w:1,h:1,c:Te},{x:12,y:1,w:1,h:1,c:De},{x:0,y:2,w:1,h:1,c:Hn},{x:1,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:De},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:Te},{x:9,y:2,w:1,h:1,c:Te},{x:10,y:2,w:1,h:1,c:Te},{x:11,y:2,w:1,h:1,c:Te},{x:12,y:2,w:1,h:1,c:De},{x:0,y:3,w:1,h:1,c:De},{x:1,y:3,w:1,h:1,c:nt},{x:3,y:3,w:1,h:1,c:nt},{x:4,y:3,w:1,h:1,c:De},{x:5,y:3,w:1,h:1,c:Te},{x:6,y:3,w:1,h:1,c:De},{x:7,y:3,w:1,h:1,c:nt},{x:8,y:3,w:1,h:1,c:Te},{x:9,y:3,w:1,h:1,c:qo},{x:10,y:3,w:1,h:1,c:Te},{x:11,y:3,w:1,h:1,c:De},{x:3,y:4,w:1,h:1,c:nt},{x:4,y:4,w:1,h:1,c:De},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:8,y:4,w:1,h:1,c:De},{x:9,y:4,w:1,h:1,c:Te},{x:10,y:4,w:1,h:1,c:nd}],Cv=[{x:4,y:5,w:1,h:1,c:De},{x:6,y:5,w:1,h:1,c:De},{x:8,y:5,w:1,h:1,c:De},{x:10,y:5,w:1,h:1,c:De},{x:4,y:6,w:1,h:1,c:nt},{x:6,y:6,w:1,h:1,c:nt},{x:8,y:6,w:1,h:1,c:nt},{x:10,y:6,w:1,h:1,c:nt}],Ev=[{x:3,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:De},{x:9,y:5,w:1,h:1,c:De},{x:11,y:5,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:nt},{x:5,y:6,w:1,h:1,c:nt},{x:9,y:6,w:1,h:1,c:nt},{x:11,y:6,w:1,h:1,c:nt}];function Jm(e,n=13){return e.map(a=>({...a,x:n-1-a.x}))}const sy=Jm(bm),uA=Jm(Cv),dA=Jm(Ev),fA={down:[[...ly,...iA],[...ly,...sA]],up:[[...iy,...oA],[...iy,...cA]],right:[[...bm,...Cv],[...bm,...Ev]],left:[[...sy,...uA],[...sy,...dA]]},hA=[{x:4,y:5,w:1,h:1,c:Zm}],_n="#FFD4D4",Zr="#FFCCD5",mA=[{x:2,y:0,w:1,h:1,c:nt},{x:3,y:0,w:1,h:1,c:De},{x:4,y:0,w:1,h:1,c:Te},{x:5,y:0,w:1,h:1,c:Hn},{x:6,y:0,w:1,h:1,c:De},{x:7,y:0,w:1,h:1,c:nt},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:Hn},{x:7,y:1,w:1,h:1,c:De},{x:8,y:1,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:qo},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:qo},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:nd},{x:5,y:3,w:1,h:1,c:Zm},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:7,y:4,w:1,h:1,c:nt},{x:0,y:5,w:1,h:1,c:De},{x:1,y:5,w:1,h:1,c:Zr},{x:2,y:5,w:1,h:1,c:Te},{x:3,y:5,w:1,h:1,c:_n},{x:4,y:5,w:1,h:1,c:_n},{x:5,y:5,w:1,h:1,c:_n},{x:6,y:5,w:1,h:1,c:_n},{x:7,y:5,w:1,h:1,c:Te},{x:8,y:5,w:1,h:1,c:Zr},{x:9,y:5,w:1,h:1,c:De},{x:1,y:6,w:1,h:1,c:De},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:_n},{x:4,y:6,w:1,h:1,c:Zr},{x:5,y:6,w:1,h:1,c:Zr},{x:6,y:6,w:1,h:1,c:_n},{x:7,y:6,w:1,h:1,c:Te},{x:8,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:Te},{x:3,y:7,w:1,h:1,c:_n},{x:4,y:7,w:1,h:1,c:_n},{x:5,y:7,w:1,h:1,c:_n},{x:6,y:7,w:1,h:1,c:_n},{x:7,y:7,w:1,h:1,c:Te},{x:0,y:8,w:1,h:1,c:De},{x:1,y:8,w:1,h:1,c:Zr},{x:2,y:8,w:1,h:1,c:nt},{x:3,y:8,w:1,h:1,c:De},{x:4,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:De},{x:7,y:8,w:1,h:1,c:nt},{x:8,y:8,w:1,h:1,c:Zr},{x:9,y:8,w:1,h:1,c:De},{x:4,y:9,w:1,h:1,c:Te},{x:5,y:9,w:1,h:1,c:Hn}],pA=[{x:2,y:0,w:1,h:1,c:nt},{x:3,y:0,w:1,h:1,c:De},{x:4,y:0,w:1,h:1,c:Te},{x:5,y:0,w:1,h:1,c:Hn},{x:6,y:0,w:1,h:1,c:De},{x:7,y:0,w:1,h:1,c:nt},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:Hn},{x:7,y:1,w:1,h:1,c:De},{x:8,y:1,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:De},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:De},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:nd},{x:5,y:3,w:1,h:1,c:Zm},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:7,y:4,w:1,h:1,c:nt},{x:0,y:5,w:1,h:1,c:De},{x:1,y:5,w:1,h:1,c:Zr},{x:2,y:5,w:1,h:1,c:Te},{x:3,y:5,w:1,h:1,c:_n},{x:4,y:5,w:1,h:1,c:_n},{x:5,y:5,w:1,h:1,c:_n},{x:6,y:5,w:1,h:1,c:_n},{x:7,y:5,w:1,h:1,c:Te},{x:8,y:5,w:1,h:1,c:Zr},{x:9,y:5,w:1,h:1,c:De},{x:1,y:6,w:1,h:1,c:De},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:_n},{x:4,y:6,w:1,h:1,c:Zr},{x:5,y:6,w:1,h:1,c:Zr},{x:6,y:6,w:1,h:1,c:_n},{x:7,y:6,w:1,h:1,c:Te},{x:8,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:Te},{x:3,y:7,w:1,h:1,c:_n},{x:4,y:7,w:1,h:1,c:_n},{x:5,y:7,w:1,h:1,c:_n},{x:6,y:7,w:1,h:1,c:_n},{x:7,y:7,w:1,h:1,c:Te},{x:0,y:8,w:1,h:1,c:De},{x:1,y:8,w:1,h:1,c:Zr},{x:2,y:8,w:1,h:1,c:nt},{x:3,y:8,w:1,h:1,c:De},{x:4,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:De},{x:7,y:8,w:1,h:1,c:nt},{x:8,y:8,w:1,h:1,c:Zr},{x:9,y:8,w:1,h:1,c:De},{x:5,y:9,w:1,h:1,c:Te},{x:6,y:9,w:1,h:1,c:Hn}],xA=[{x:1,y:9,w:7,h:1,c:"#100A06",a:.12}],gA=[{x:2,y:6,w:9,h:1,c:"#100A06",a:.12}],yA=[{x:1,y:10,w:8,h:1,c:"#100A06",a:.12}],ut=4,rn=28,In=2,zt=4,St=4,al=[{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 ep(e,n,a){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(n,a),f=Math.ceil(n/d),m=[],h=d*28,x=e.fx+Math.max(8,Math.floor((e.fw-h)/2));for(let g=0;g<f&&m.length<n;g++){const v=Math.min(d,n-g*d);for(let b=0;b<v;b++)m.push({dx:x+b*28,dy:u+g*28,room:e.id})}return m}function bA(e){const i=al[0],o={id:"main",wx:ut+St,wy:ut,ww:160-2*(ut+St),wh:rn,fx:ut+St,fy:ut+rn+In,fw:160-2*(ut+St),fh:120-ut-rn-In-ut,...i},u=ep(o,Math.min(e,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(ut+St))/2),offsetY:10}],f=[{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:d,furniture:f}}function vA(e){const o={id:"exec",wx:ut+St,wy:ut,ww:144-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In,fw:144-ut-St-zt/2,fh:66,...al[0]},u={id:"work",wx:144+zt/2+St,wy:ut,ww:144-zt/2-St-ut,wh:rn,fx:144+zt/2+St,fy:ut+rn+In,fw:144-zt/2-St-ut,fh:66,...al[1]},d={id:"meet",wx:ut+St,wy:ut+rn+In+66+zt,ww:144-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In+66+zt+rn+In,fw:144-ut-St-zt/2,fh:70,...al[2]},f={id:"comm",wx:144+zt/2+St,wy:ut+rn+In+66+zt,ww:144-zt/2-St-ut,wh:rn,fx:144+zt/2+St,fy:ut+rn+In+66+zt+rn+In,fw:144-zt/2-St-ut,fh:70,...al[3]},m={exec:o,work:u,meet:d,comm:f},h=[];let x=e;const g=[[o,Math.min(3,x)],[u,0]];g[1][1]=Math.min(3,x-g[0][1]);const v=[[d,0],[f,0]];let b=x-g[0][1]-g[1][1];b>0&&(v[0][1]=Math.min(2,b),b-=v[0][1]),b>0&&(v[1][1]=Math.min(2,b));for(const[R,I]of[...g,...v])I>0&&h.push(...ep(R,I,3));const j=ut+rn+In+66,k=144-zt/2,N={exec_work:{id:"exec_work",type:"v",doorY:ut+rn+In+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:ut+rn+In+66+zt+rn+In+20+12,xA:k-2,xB:f.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:ut+St+40+14,yA:j-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+zt/2+St+40+14,yA:j-2,yB:f.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"}]},C={exec:o.fy+52,work:u.fy+48,meet:d.fy+56,comm:f.fy+54},_={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:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:f.fx+96,y:f.fy+8},{x:f.fx+60,y:f.fy+54},{x:f.fx+40,y:f.fy+54},{x:f.fx+20,y:f.fy+54}]},M=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(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:42,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:m,desks:h,doors:N,adjacency:E,corridorY:C,waypoints:_,wallDecorations:M,furniture:L}}function wA(e){const d={id:"exec",wx:ut+St,wy:ut,ww:180-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In,fw:180-ut-St-zt/2,fh:82,...al[0]},f={id:"work",wx:180+zt/2+St,wy:ut,ww:180-zt/2-St-ut,wh:rn,fx:180+zt/2+St,fy:ut+rn+In,fw:180-zt/2-St-ut,fh:82,...al[1]},m=ut+rn+In+82,h={id:"meet",wx:ut+St,wy:m+zt,ww:180-ut-St-zt/2,wh:rn,fx:ut+St,fy:m+zt+rn+In,fw:180-ut-St-zt/2,fh:86,...al[2]},x={id:"comm",wx:180+zt/2+St,wy:m+zt,ww:180-zt/2-St-ut,wh:rn,fx:180+zt/2+St,fy:m+zt+rn+In,fw:180-zt/2-St-ut,fh:86,...al[3]},g={exec:d,work:f,meet:h,comm:x},v=[];let b=e;const j=[[d,Math.min(5,b)],[f,0]];j[1][1]=Math.min(5,b-j[0][1]);const k=[[h,0],[x,0]];let N=b-j[0][1]-j[1][1];N>0&&(k[0][1]=Math.min(3,N),N-=k[0][1]),N>0&&(k[1][1]=Math.min(3,N));for(const[X,J]of[...j,...k])J>0&&v.push(...ep(X,J,4));const E=180-zt/2,C={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:E-2,xB:f.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:h.fy+86/2,xA:E-2,xB:x.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:m-2,yB:h.fy+2},work_comm:{id:"work_comm",type:"h",doorX:f.fx+54,yA:m-2,yB:x.fy+2}},_={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"}]},M={exec:d.fy+82-12,work:f.fy+82-12,meet:h.fy+86-12,comm:x.fy+86-12},L={exec:[{x:d.fx+10,y:M.exec},{x:d.fx+d.fw/2,y:M.exec},{x:d.fx+d.fw-10,y:M.exec}],work:[{x:f.fx+10,y:M.work},{x:f.fx+f.fw/2,y:M.work},{x:f.fx+f.fw-10,y:M.work}],meet:[{x:h.fx+10,y:M.meet},{x:h.fx+h.fw/2,y:M.meet},{x:h.fx+h.fw-10,y:M.meet}],comm:[{x:x.fx+10,y:M.comm},{x:x.fx+x.fw/2,y:M.comm},{x:x.fx+x.fw-10,y:M.comm}]},R=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:42,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:g,desks:v,doors:C,adjacency:_,corridorY:M,waypoints:L,wallDecorations:R,furniture:I}}const kA=2;function Nv(e,n,a){return a||(n?n==="L"&&e<=12-kA?"M":n==="M"&&e>12?"L":n:e<=12?"M":"L")}function Av(e,n){switch(n??Nv(e)){case"S":return bA(e);case"M":return vA(e);case"L":return wA(e)}}function jA(e,n){if(!n||Object.keys(n).length===0)return e;const a=i=>i.map(o=>{const u=n[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...e,wallDecorations:a(e.wallDecorations),furniture:a(e.furniture)}}function SA(e,n){if(n)for(const[a,i]of Object.entries(n))e[a]&&(e[a]={...e[a],dx:i.dx,dy:i.dy})}function oy(e,n){if(!n||n.length===0)return e;const a=new Set(n);return{...e,wallDecorations:e.wallDecorations.filter(i=>!a.has(i.id)),furniture:e.furniture.filter(i=>!a.has(i.id))}}function CA(e,n){if(!n||n.length===0)return e;const a=[],i=[];for(const o of n)o.zone==="wall"?a.push(o):i.push(o);return{...e,wallDecorations:[...e.wallDecorations,...a],furniture:[...e.furniture,...i]}}let zo;function EA(e){zo=e}function $(e,n,a,i,o,u){e=Math.round(e),n=Math.round(n),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(zo.globalAlpha=u),zo.fillStyle=o,zo.fillRect(e,n,a,i),u!==void 0&&u!==1&&(zo.globalAlpha=1))}function ot(e,n,a,i){$(e,n,1,1,a,i)}let Bu=1;function As(e){Bu=e}function Na(){return Bu=Bu*16807%2147483647,(Bu&65535)/65535}function Dv(e){const n=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,o=Math.max(n,a,i),u=Math.min(n,a,i);let d=0,f=0;const m=(o+u)/2;if(o!==u){const h=o-u;f=m>.5?h/(2-o-u):h/(o+u),o===n?d=((a-i)/h+(a<i?6:0))/6:o===a?d=((i-n)/h+2)/6:d=((n-a)/h+4)/6}return[d*360,f*100,m*100]}function Tv(e,n,a){e=(e%360+360)%360,n=Math.max(0,Math.min(100,n))/100,a=Math.max(0,Math.min(100,a))/100;const i=n*Math.min(a,1-a),o=d=>{const f=(d+e/30)%12;return a-i*Math.max(-1,Math.min(f-3,9-f,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(o(0))+u(o(8))+u(o(4))}function Aa(e,n=1){const[a,i,o]=Dv(e);return Tv(a+15*n,Math.min(100,i+8),o-12*n)}function vn(e,n=1){const[a,i,o]=Dv(e);return Tv(a-10*n,i-3,o+10*n)}const Ln={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Br={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},va={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Jr="#100A06";function NA(e,n,a=14,i=12){$(e,n,a,i,"#4A3828"),$(e+1,n+1,a-2,i-2,"#5A4838"),$(e+2,n+2,a-4,i-4,"#4A7098"),$(e+2,n+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(a/2);$(e+o,n+1,1,i-2,"#4A3828"),$(e+1,n+Math.floor(i/2),a-2,1,"#4A3828",.5),ot(e+3,n+3,"#8AB8E8",.35),ot(e+o+2,n+3,"#8AB8E8",.25),$(e-1,n+i,a+2,2,"#5A4838"),$(e-1,n+i,a+2,1,vn("#5A4838",.5),.35)}function AA(e,n,a){$(e,n,10,8,"#3A2818"),$(e+1,n+1,8,6,a),$(e+2,n+2,4,3,vn(a,1.2),.3),ot(e+3,n+2,vn(a,2),.25)}function DA(e,n){$(e,n,7,7,"#3A2818"),$(e+1,n+1,5,5,"#F0EDE5"),ot(e+3,n+1,"#AAA"),ot(e+3,n+5,"#AAA"),ot(e+1,n+3,"#AAA"),ot(e+5,n+3,"#AAA"),ot(e+3,n+3,"#222"),$(e+3,n+1,1,2,"#333"),ot(e+4,n+3,"#D32F2F")}function TA(e,n){$(e,n,26,16,"#586878"),$(e+1,n+1,24,13,"#ECEFF1"),$(e+1,n+1,24,1,"#F5F5F5",.4),$(e+3,n+3,14,1,"#1565C0",.6),$(e+3,n+5,18,1,"#333",.2),$(e+3,n+7,12,1,"#D32F2F",.35),$(e+3,n+9,16,1,"#333",.15),$(e+1,n+14,24,2,"#708898"),$(e+3,n+14,3,1,"#D32F2F"),$(e+7,n+14,3,1,"#1565C0"),$(e+11,n+14,3,1,"#2E7D32")}function FA(e,n){$(e,n,22,16,"#6A5030"),$(e+1,n+1,20,14,"#C4A66A"),As(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)Na()>.5&&ot(e+1+i,n+1+a,Na()>.5?"#B89858":"#D4B87A",.18);$(e+2,n+2,5,4,"#FFF176"),$(e+8,n+2,5,4,"#90CAF9"),$(e+14,n+3,5,4,"#CE93D8"),$(e+3,n+8,7,4,"#C8E6C9"),$(e+11,n+8,8,4,"#F8BBD0"),ot(e+4,n+2,"#E53935"),ot(e+10,n+2,"#1E88E5"),ot(e+16,n+3,"#FF9800")}function RA(e,n){$(e,n,20,3,"#5A4030"),$(e,n,20,1,vn("#5A4030",.5),.35),$(e,n+2,20,1,Aa("#5A4030",.5),.3),$(e+2,n-4,3,4,"#E53935"),$(e+2,n-4,3,1,vn("#E53935",1),.3),$(e+6,n-3,2,3,"#1E88E5"),$(e+9,n-5,4,5,"#43A047"),$(e+14,n-3,3,3,"#FFD54F"),ot(e+15,n-3,"#FFF176",.4)}function MA(e,n){$(e,n,16,12,"#1E1E28"),$(e+1,n+1,14,9,"#0C1420"),$(e+2,n+2,12,1,"#EF4444",.6),ot(e+2,n+4,"#4CAF50"),$(e+4,n+4,7,1,"#8b949e",.4),ot(e+2,n+6,"#FF9800"),$(e+4,n+6,5,1,"#8b949e",.3),ot(e+2,n+8,"#42A5F5"),$(e+4,n+8,8,1,"#8b949e",.25),$(e+7,n+10,2,2,"#1E1E28"),$(e+5,n+11,6,1,"#586878")}function zA(e,n,a){$(e+2,n+20,22,2,Jr,.15),$(e,n,22,20,Br.deep),$(e+1,n+1,20,18,Br.base),$(e,n,22,1,Br.hi,.35),$(e,n,1,20,Br.hi,.2);for(const u of[6,12])$(e+1,n+u,20,2,Br.sh),$(e+1,n+u,20,1,Br.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=e+2;for(let u=0;u<5;u++){const d=2+u%2;$(o,n+1,d,5,i[u]),$(o,n+1,d,1,vn(i[u],1),.35),o+=d+1}o=e+2;for(let u=0;u<4;u++)$(o,n+7,4,5,i[u+3]),$(o,n+7,4,1,vn(i[u+3],1),.25),o+=5;$(e+2,n+14,4,4,"#FFD54F"),$(e+8,n+14,7,4,"#90CAF9"),a&&$(e,n-1,22,1,a,.7)}function _A(e,n){$(e+2,n+11,6,2,Jr,.1),$(e+2,n+8,6,4,"#8B5E3C"),$(e+1,n+7,8,2,Aa("#A06E48",.3)),$(e+2,n+7,6,1,vn("#A06E48",.5),.4),$(e+1,n+3,3,4,"#2E7D32"),$(e+5,n+2,3,4,"#2E7D32"),$(e+2,n+1,4,4,"#43A047"),$(e+3,n+0,3,3,"#66BB6A"),ot(e+4,n,"#81C784"),ot(e+3,n+1,"#A5D6A7",.4)}function BA(e,n){wi(e+4,n-4,"down"),wi(e+16,n-4,"down"),wi(e+28,n-4,"down"),$(e+3,n+24,34,3,Jr,.15),$(e,n+2,36,18,Ln.deep),$(e+1,n+3,34,16,Ln.base),$(e+1,n+3,34,1,Ln.hi,.35);for(let a=0;a<14;a+=3)$(e+1,n+4+a,34,1,Aa(Ln.base,.2),.08);$(e,n+20,36,4,Ln.deep),$(e+1,n+21,34,2,Ln.sh),$(e+6,n+7,10,6,"#1A1A24"),$(e+7,n+8,8,4,"#0C1420"),$(e+8,n+9,4,1,"#2A6898",.4),$(e+20,n+8,6,4,"#F0F0F0"),$(e+15,n+7,3,3,"#ECEFF1"),ot(e+16,n+8,"#795548"),wi(e+4,n+24,"up"),wi(e+16,n+24,"up"),wi(e+28,n+24,"up")}function OA(e,n){$(e+2,n+16,36,3,Jr,.15),$(e,n,36,5,"#5D4037"),$(e+1,n+1,34,3,"#6D4C41"),$(e+1,n+1,34,1,vn("#6D4C41",.5),.3),$(e,n+5,36,8,"#5D4037"),$(e+2,n+6,15,6,"#6D4C41"),$(e+3,n+6,13,1,vn("#6D4C41",.5),.35),$(e+19,n+6,15,6,"#6D4C41"),$(e+20,n+6,13,1,vn("#6D4C41",.5),.35),$(e+17,n+6,2,6,"#5D4037"),$(e,n+13,36,3,Aa("#5D4037",1)),$(e-2,n+2,3,12,"#5D4037"),$(e+35,n+2,3,12,"#5D4037"),$(e+4,n+7,6,4,"#FF8A65"),$(e+5,n+7,4,1,vn("#FF8A65",1),.35)}function $A(e,n){$(e+2,n+10,22,2,Jr,.12),$(e,n,22,8,Br.deep),$(e+1,n+1,20,6,Br.base),$(e+1,n+1,20,1,Br.hi,.3),$(e,n+8,22,2,Br.sh),$(e+3,n+2,6,4,"#F0F0F0"),$(e+13,n+3,3,3,"#ECEFF1"),ot(e+14,n+4,"#795548")}function LA(e,n){$(e+1,n+14,10,2,Jr,.12),$(e,n,10,14,"#546E7A"),$(e,n,10,1,vn("#546E7A",1),.35),$(e+1,n+1,8,3,"#78909C"),$(e+1,n+5,8,4,"#37474F"),ot(e+2,n+6,"#EF5350"),ot(e+4,n+6,"#66BB6A"),$(e+2,n+11,4,2,"#ECEFF1")}function IA(e,n){$(e+2,n+18,28,3,Jr,.12),$(e,n,28,18,"#37474F"),$(e+1,n+1,26,15,"#0D47A1"),$(e+2,n+2,24,13,"#1565C0"),$(e+2,n+2,24,4,"#1976D2",.4),$(e+2,n+12,24,3,"#F9A825",.35),$(e+4,n+8,2,5,"#2E7D32"),$(e+6,n+9,2,4,"#43A047"),$(e+20,n+7,2,6,"#2E7D32"),$(e+22,n+8,2,5,"#388E3C"),$(e+9,n+5,4,2,"#FF8A65"),ot(e+12,n+5,"#FF5722"),$(e+16,n+8,3,2,"#FFD54F"),ot(e+15,n+8,"#FFC107"),ot(e+13,n+3,"#90CAF9",.5),ot(e+14,n+4,"#BBDEFB",.35),ot(e+8,n+3,"#BBDEFB",.3),$(e,n+16,28,2,"#455A64"),$(e+1,n+16,26,1,vn("#455A64",.5),.3)}function HA(e,n){$(e,n,24,10,"#1A1A2E"),$(e+2,n+1,20,8,"#E040FB",.15),$(e+3,n+2,4,6,"#E040FB",.7),$(e+4,n+3,2,4,"#1A1A2E"),$(e+8,n+2,1,6,"#00E5FF",.7),$(e+8,n+2,4,1,"#00E5FF",.7),$(e+8,n+4,4,1,"#00E5FF",.7),$(e+11,n+2,1,3,"#00E5FF",.7),$(e+13,n+2,1,6,"#E040FB",.7),$(e+13,n+2,4,1,"#E040FB",.7),$(e+13,n+4,3,1,"#E040FB",.7),$(e+13,n+7,4,1,"#E040FB",.7),$(e+18,n+2,1,6,"#00E5FF",.7),$(e+21,n+2,1,6,"#00E5FF",.7),$(e+19,n+3,1,2,"#00E5FF",.5),$(e+20,n+5,1,2,"#00E5FF",.5)}function UA(e,n){$(e+2,n+28,16,3,Jr,.15),$(e,n,16,28,"#1A237E"),$(e+1,n+1,14,3,"#283593"),$(e+2,n+4,12,10,"#0D1117"),$(e+3,n+5,10,8,"#1B5E20"),$(e+5,n+6,2,2,"#4CAF50"),$(e+9,n+8,2,2,"#FF5722"),$(e+7,n+10,3,1,"#FFD54F"),ot(e+6,n+7,"#81C784"),$(e+1,n+14,14,6,"#1A237E"),$(e+2,n+15,4,4,"#212121"),ot(e+4,n+16,"#F44336"),ot(e+9,n+16,"#F44336"),ot(e+11,n+16,"#2196F3"),ot(e+10,n+18,"#FFEB3B"),$(e,n+20,16,8,"#0D47A1"),$(e+1,n+21,14,6,"#1565C0"),$(e,n+4,1,14,"#FF4081",.4),$(e+15,n+4,1,14,"#FF4081",.4)}function qA(e,n){$(e+2,n+24,20,3,Jr,.15),$(e,n,20,24,"#4E342E"),$(e+1,n+1,18,22,"#5D4037"),$(e+2,n+1,16,4,"#FF6F00"),$(e+3,n+2,14,2,"#FF8F00",.6),$(e+2,n+5,16,10,"#1A1A2E"),$(e+3,n+6,14,8,"#212121"),$(e+4,n+7,4,4,"#333"),$(e+5,n+8,2,2,"#E53935"),$(e+10,n+7,4,4,"#333"),$(e+11,n+8,2,2,"#1E88E5"),$(e+3,n+16,14,6,"#3E2723");for(let a=0;a<7;a++)$(e+4+a*2,n+17,1,4,"#5D4037",.5);$(e+1,n+5,18,1,"#FFD54F",.5),$(e+1,n+15,18,1,"#FFD54F",.5)}function YA(e,n){$(e+2,n+22,22,2,Jr,.12),$(e,n,22,22,Br.deep),$(e+1,n+1,20,20,"#37474F"),$(e+2,n+2,18,18,"#546E7A",.3),$(e+1,n+10,20,1,Br.base),$(e+1,n+10,20,1,Br.hi,.2),$(e+4,n+3,4,5,"#FFD54F"),$(e+5,n+4,2,3,"#FFC107"),$(e+4,n+7,4,1,"#FFA000"),ot(e+5,n+3,"#FFF176",.5),$(e+13,n+4,4,4,"#B0BEC5"),$(e+14,n+3,2,1,"#CFD8DC"),ot(e+14,n+5,"#ECEFF1",.6),$(e+5,n+12,3,3,"#A1887F"),$(e+6,n+11,1,1,"#D7CCC8"),$(e+12,n+12,6,4,"#5D4037"),$(e+13,n+13,4,2,"#FFD54F",.6),$(e+2,n+2,2,18,"#fff",.08)}function XA(e,n){$(e+2,n+16,26,3,Jr,.18),$(e,n,26,10,Ln.deep),$(e+1,n+1,24,8,Ln.base),$(e+1,n+2,24,1,Ln.hi,.2),$(e+1,n+4,24,1,Aa(Ln.base,.2),.1),$(e+1,n+6,24,1,Ln.hi,.15),$(e+1,n+1,24,1,Ln.hi,.4),$(e+1,n+1,1,8,Ln.hi,.2),$(e,n+10,26,5,Ln.deep),$(e+1,n+11,24,3,Ln.sh),$(e+1,n+10,24,1,Aa(Ln.base,1.5),.4),$(e+1,n+14,24,1,Ln.base,.15),$(e+2,n+12,10,1,Ln.deep,.4),$(e+14,n+12,10,1,Ln.deep,.4),ot(e+7,n+11,"#C8D0D8",.6),ot(e+19,n+11,"#C8D0D8",.6),$(e+6,n-5,14,7,"#1E1E28"),$(e+7,n-4,12,5,"#0C1420"),$(e+8,n-3,5,1,"#2A6898",.6),$(e+8,n-2,8,1,"#1A3858",.4),$(e+8,n-1,3,1,"#2A6898",.35),ot(e+7,n-4,"#4A98D8",.25),ot(e+12,n+1,"#4CAF50",.4),$(e+12,n+2,2,3,"#586878"),$(e+10,n+4,6,1,"#8898A8"),$(e+6,n+4,12,4,"#222228"),$(e+6,n+4,12,1,"#333338",.4);for(let a=0;a<5;a++)ot(e+7+a*2,n+5,"#444",.6),ot(e+7+a*2,n+6,"#3A3A3E",.4);$(e+20,n+5,3,4,"#333338"),$(e+20,n+5,3,1,"#444448"),$(e+1,n+3,4,4,"#F0EDE8"),$(e+1,n+3,4,1,"#F8F6F2"),ot(e+2,n+5,"#6D4C41")}function wi(e,n,a){$(e+1,n+9,10,2,Jr,.1),ot(e+5,n+9,"#1E1E22"),ot(e+1,n+10,"#1A1A1E"),ot(e+9,n+10,"#1A1A1E"),ot(e+3,n+11,"#1A1A1E"),ot(e+7,n+11,"#1A1A1E"),$(e+1,n+2,8,6,va.base),$(e+2,n+3,6,4,va.hi,.35),$(e+2,n+3,6,1,vn(va.hi,.5),.25),$(e+1,n+7,8,1,va.deep),a==="up"?($(e,n+7,10,3,va.deep),$(e+1,n+8,8,1,va.sh)):($(e,n-1,10,3,va.deep),$(e+1,n,8,1,va.sh)),$(e,n+3,1,4,va.sh),$(e+9,n+3,1,4,va.sh)}const Fv={bookshelf:(e,n,a)=>zA(e,n,a.accent),plant:(e,n)=>_A(e,n),"meeting-table":(e,n)=>BA(e,n),sofa:(e,n)=>OA(e,n),"coffee-table":(e,n)=>$A(e,n),"coffee-machine":(e,n)=>LA(e,n),window:(e,n,a)=>NA(e,n,a.windowW??16,a.windowH??14),picture:(e,n,a)=>AA(e,n,a.pictureColor??"#1565C0"),clock:(e,n)=>DA(e,n),whiteboard:(e,n)=>TA(e,n),"bulletin-board":(e,n)=>FA(e,n),shelf:(e,n)=>RA(e,n),screen:(e,n)=>MA(e,n),aquarium:(e,n)=>IA(e,n),"neon-sign":(e,n)=>HA(e,n),arcade:(e,n)=>UA(e,n),jukebox:(e,n)=>qA(e,n),"trophy-case":(e,n)=>YA(e,n)};function ks(e,n){const a=e.zone==="wall"?n.wx:n.fx,i=e.zone==="wall"?n.wy:n.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?n.wx+n.ww:n.fx+n.fw)+e.offsetX:a+e.offsetX,y:i+e.offsetY}}function WA(e){for(const n of e.wallDecorations){const a=e.rooms[n.room];if(!a)continue;const{x:i,y:o}=ks(n,a),u=Fv[n.type];u&&u(i,o,n)}}function VA(e,n,a){for(const i of e.furniture){const o=e.rooms[i.room];if(!o||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:d}=ks(i,o),f=Fv[i.type];f&&n.push({y:d,draw:()=>f(u,d,i)})}}function ki(e){const n=[],a=[...e.wallDecorations,...e.furniture];for(const i of a){if(!i.facility)continue;const o=e.rooms[i.room];if(!o)continue;const{x:u,y:d}=ks(i,o);n.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return n}const GA={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12},aquarium:{w:28,h:18},"neon-sign":{w:24,h:10},arcade:{w:16,h:28},jukebox:{w:20,h:24},"trophy-case":{w:22,h:22}};function vm(e){return GA[e]??{w:16,h:16}}function $h(e,n,a,i){for(let o=e.furniture.length-1;o>=0;o--){const u=e.furniture[o],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:f,y:m}=ks(u,d),h=vm(u.type);if(n>=f&&n<=f+h.w&&a>=m&&a<=m+h.h)return u.id}for(let o=e.wallDecorations.length-1;o>=0;o--){const u=e.wallDecorations[o],d=e.rooms[u.room];if(!d)continue;const{x:f,y:m}=ks(u,d),h=vm(u.type);if(n>=f&&n<=f+h.w&&a>=m&&a<=m+h.h)return u.id}return null}function cy(e,n,a,i,o){const d=[...n.wallDecorations,...n.furniture].find(g=>g.id===a);if(!d||d.condition==="no-desks"&&o.has(d.room))return;const f=n.rooms[d.room];if(!f)return;const{x:m,y:h}=ks(d,f),x=vm(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(m-1,h-1,x.w+2,x.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(m-.5,h-.5,x.w+1,x.h+1),e.restore()}function uy(e,n,a,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(n-1,a-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(n-.5,a-.5,27,41),e.restore()}function dy(e,n,a){for(const[i,o]of Object.entries(e))if(n>=o.dx&&n<=o.dx+26&&a>=o.dy&&a<=o.dy+40)return i;return null}const fy=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴",price:0},{type:"clock",zone:"wall",label:"Clock",icon:"🕐",price:0},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚",price:500},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️",price:500},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦",price:800},{type:"window",zone:"wall",label:"Window",icon:"🪟",price:1e3},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️",price:1500},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕",price:1500},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕",price:2e3},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑",price:3e3},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋",price:3e3},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️",price:5e3},{type:"aquarium",zone:"floor",label:"Aquarium",icon:"🐠",price:5e3},{type:"neon-sign",zone:"wall",label:"Neon Sign",icon:"💡",price:3e3},{type:"arcade",zone:"floor",label:"Arcade",icon:"🕹️",price:8e3},{type:"jukebox",zone:"floor",label:"Jukebox",icon:"🎵",price:6e3},{type:"trophy-case",zone:"floor",label:"Trophy Case",icon:"🏆",price:7e3}],Nu=16,KA=4,vi=4,Ou=2,Xt=4,Yl=4;let Je=Av(7);const Gu={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},hy={ceo:{en:["Boss?","What's up?","Time for a meeting?","Got any ideas?","How's everyone doing?"],ko:["대표님?","무슨 일이신가요?","회의 시간이신가요?","좋은 아이디어 있으시면 말씀해주세요.","다들 잘하고 있나요?"],ja:["社長?","何かありますか?","会議の時間ですか?","良いアイデアがあれば教えてください。","みんな元気ですか?"]},cto:{en:["Need anything?","Tech question?","Reviewing architecture.","Deploy in a moment.","Want me to look at the code?"],ko:["뭐 필요하신 거 있으세요?","기술 관련 질문이신가요?","아키텍처 리뷰 중이에요.","배포는 조금만 기다려주세요.","코드 봐드릴까요?"],ja:["何かお手伝いしましょうか?","技術的な質問ですか?","アーキテクチャレビュー中です。","デプロイはもう少しお待ちください。","コード見ましょうか?"]},cbo:{en:["Business question?","Reviewing revenue model.","Want to see market research?","Analyzing competitors.","Can I help?"],ko:["비즈니스 관련 얘기신가요?","수익 모델 검토 중이에요.","시장 조사 결과 보실래요?","경쟁사 분석 중입니다.","뭔가 도와드릴까요?"],ja:["ビジネスの話ですか?","収益モデルを検討中です。","市場調査の結果を見ますか?","競合分析中です。","何かお手伝いしましょうか?"]},pm:{en:["Curious about progress?","Updating the roadmap.","Assigning tasks.","Need to re-prioritize?","Preparing sprint review."],ko:["프로젝트 진행 상황 궁금하신가요?","로드맵 업데이트 중이에요.","태스크 할당 중입니다.","우선순위 조정이 필요할까요?","스프린트 리뷰 준비 중이에요."],ja:["進捗が気になりますか?","ロードマップを更新中です。","タスクを割り当て中です。","優先順位の調整が必要ですか?","スプリントレビューの準備中です。"]},engineer:{en:["Working on it!","Fixing a bug.","Need a code review?","Writing tests.","Pushing a PR."],ko:["일하고 있어요!","버그 수정 중입니다.","코드 리뷰 필요하신가요?","테스트 작성 중이에요.","PR 올리고 있어요."],ja:["作業中です!","バグ修正中です。","コードレビュー必要ですか?","テスト書いてます。","PR出してます。"]},designer:{en:["Got design feedback?","Working on mockups.","Thinking about UI improvements.","Picking colors...","Want to see the prototype?"],ko:["디자인 피드백 있으신가요?","목업 작업 중이에요.","UI 개선안 생각 중입니다.","컬러 팔레트 고민 중이에요.","프로토타입 보여드릴까요?"],ja:["デザインのフィードバックありますか?","モックアップ作業中です。","UI改善案を考えています。","カラーパレットを検討中です。","プロトタイプ見せましょうか?"]},qa:{en:["Testing in progress.","Found a bug!","Writing test cases.","Running regression tests.","Quality check in progress."],ko:["테스트 중이에요.","버그 발견했어요!","테스트 케이스 작성 중입니다.","회귀 테스트 진행 중이에요.","품질 체크 중입니다."],ja:["テスト中です。","バグ見つけました!","テストケース作成中です。","回帰テスト実行中です。","品質チェック中です。"]},"data-analyst":{en:["Analyzing data.","Preparing a report.","Want to check the dashboard?","Tracking metrics.","Found an insight!"],ko:["데이터 분석 중이에요.","리포트 준비 중입니다.","대시보드 확인해보실래요?","지표 추적 중이에요.","인사이트 발견했어요!"],ja:["データ分析中です。","レポート準備中です。","ダッシュボード確認しますか?","指標追跡中です。","インサイト発見しました!"]},default:{en:["Hello!","How can I help?","Working hard.","Have a great day!"],ko:["안녕하세요!","무엇을 도와드릴까요?","열심히 일하고 있어요.","좋은 하루 되세요!"],ja:["こんにちは!","何かお手伝いしましょうか?","頑張って仕事してます。","良い一日を!"]}};function PA(e,n){const a=hy[e]||hy.default;return a[n]||a.en||a.default||[]}let ka=ki(Je);function Rv(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function Mv(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let wn={};function QA(e){const n={};for(let a=0;a<e.length&&a<Je.desks.length;a++)n[e[a]]=Je.desks[a];return n}let Xe,er=null,ji=null,rl=!1,sa=null,zr=null,zv=0,nr=null,$n=null,Ul=null,wa=null,Lh=900;function ZA(e,n){const{wx:a,wy:i,ww:o,wh:u,wallColor:d,baseboardColor:f}=e,m=Aa(d,.5),h=vn(d,.5),x=[];if(n){const g=n.x-a,v=n.w;g>0&&x.push({sx:a,sw:g}),g+v<o&&x.push({sx:n.x+v,sw:o-g-v})}else x.push({sx:a,sw:o});for(const g of x){$(g.sx,i,g.sw,u,d);for(let v=0;v<u;v+=4)$(g.sx,i+v,g.sw,1,h,.08),$(g.sx,i+v+2,g.sw,1,m,.05);As(Math.round(g.sx*7+i*13));for(let v=0;v<g.sw;v+=3)Na()>.4&&$(g.sx+v,i,1,u,h,.04);$(g.sx,i,g.sw,2,h,.3),$(g.sx,i,g.sw,1,vn(d,1),.2),$(g.sx,i+u-2,g.sw,2,m,.3),$(g.sx,i+u,g.sw,Ou,f),$(g.sx,i+u,g.sw,1,vn(f,.5),.4)}n&&($(n.x-1,i,1,u+Ou,"#4A3828"),$(n.x+n.w,i,1,u+Ou,"#4A3828"),$(n.x,i,n.w,1,"#0A0808",.12)),$(e.fx,e.fy,e.fw,3,"#0A0808",.12),$(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function JA(e){const n="#504038",a=Aa(n,.5),i=vn(n,.5),o=e.wx-Yl,u=e.wy,d=e.wh+Ou+e.fh;$(o,u,Yl,d,n),$(o,u,1,d,i,.3),$(o+Yl-1,u,1,d,a,.4);for(let m=0;m<d;m+=6)$(o+1,u+m,Yl-2,1,i,.06);const f=e.wx+e.ww;$(f,u,Yl,d,n),$(f,u,1,d,i,.2),$(f+Yl-1,u,1,d,a,.3)}function Ih(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#B08040",d="#C89848",f="#8A6030",m="#6A4820";$(n,a,i,o,u),As(42);for(let h=0;h<o;h+=5){const x=Math.floor(h/5)%2*10;for(let g=-10;g<i+10;g+=20){const v=n+g+x,b=Math.max(n,v),j=Math.min(v+19,n+i)-b;if(j<=0)continue;const k=Na()>.5?d:u;$(b,a+h,j,4,k,.25),$(b,a+h,j,1,d,.3),$(b,a+h+4,j,1,m,.35),v>=n&&v<n+i&&$(v,a+h,1,4,m,.2),$(b,a+h+2,j,1,f,.1)}}$(n,a,i,2,"#0A0808",.08),$(n,a,2,o,"#0A0808",.06)}function my(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#1C2A38",d="#101820";As(99),$(n,a,i,o,u);for(let f=0;f<o;f+=Nu)for(let m=0;m<i;m+=Nu){const h=Math.min(Nu,i-m),x=Math.min(Nu,o-f);Na()>.5&&$(n+m,a+f,h,x,vn(u,.2),.15),$(n+m+2,a+f+2,h-4,x-4,vn(u,.3),.08),$(n+m,a+f,h,1,d,.5),$(n+m,a+f,1,x,d,.5),$(n+m+1,a+f+1,1,x-1,vn(u,.4),.1),Na()>.85&&ot(n+m+4+Math.floor(Na()*8),a+f+4+Math.floor(Na()*8),"#3A6A9A",.08)}}function e8(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#387848",d="#4A9058",f="#285E38";$(n,a,i,o,u),As(77);for(let h=0;h<o;h+=2)for(let x=0;x<i;x+=2)Na()>.5&&ot(n+x,a+h,d,.1),Na()>.8&&ot(n+x+1,a+h+1,f,.12);const m=5;$(n+m,a+m,i-m*2,1,d,.45),$(n+m,a+o-m-1,i-m*2,1,f,.45),$(n+m,a+m,1,o-m*2,d,.35),$(n+i-m-1,a+m,1,o-m*2,f,.35)}function t8(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#D8C490",d="#B09060",f="#907848";As(55);for(let m=0;m<o;m+=8)for(let h=0;h<i;h+=8){const x=Math.min(8,i-h),g=Math.min(8,o-m),v=(h/8+m/8)%2===0?d:u;$(n+h,a+m,x,g,v),$(n+h+1,a+m+1,x-2,1,vn(v,.4),.2),$(n+h+1,a+m+1,1,g-2,vn(v,.4),.15),$(n+h+x-2,a+m+2,1,g-3,Aa(v,.4),.15),$(n+h+2,a+m+g-2,x-3,1,Aa(v,.4),.15),$(n+h,a+m,x,1,f,.3),$(n+h,a+m,1,g,f,.3)}}function n8(){const{canvasW:e,canvasH:n,rooms:a,doors:i}=Je,o="#2A1E14",u="#3A2E24";if($(0,0,e,vi,o),$(0,n-vi,e,vi,o),$(0,0,vi,n,o),$(e-vi,0,vi,n,o),$(0,0,e,1,u,.3),$(0,0,1,n,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const d=a.exec,f=a.meet,m=e/2,h=m-Xt/2,x=d.fy+d.fh,g=i.exec_work,v=i.meet_comm,b=i.exec_meet,j=i.work_comm,k=24,N=28,E=((g==null?void 0:g.doorY)??d.fy+20)-k/2,C=((b==null?void 0:b.doorX)??vi+Yl+54)-N/2,_=((j==null?void 0:j.doorX)??m+Xt/2+Yl+54)-N/2,M=((v==null?void 0:v.doorY)??f.fy+20)-k/2;$(0,x,C,Xt,o),$(C+N,x,h-C-N,Xt,o),$(h+Xt,x,_-h-Xt,Xt,o),$(_+N,x,e-_-N,Xt,o),$(0,x,C,1,u,.3),$(C+N,x,h-C-N,1,u,.3),$(h+Xt,x,_-h-Xt,1,u,.3),$(_+N,x,e-_-N,1,u,.3),$(h,0,Xt,E,o),$(h,E+k,Xt,x-E-k,o),$(h,x+Xt,Xt,M-x-Xt,o),$(h,M+k,Xt,n-M-k,o),$(h,0,1,E,u,.2),$(h,E+k,1,x-E-k,u,.2),$(h,x+Xt,1,M-x-Xt,u,.2),$(h,M+k,1,n-M-k,u,.2),$(h,E,Xt,k,"#C4A070"),$(h+Xt/2,E,Xt/2,k,"#3A4858"),$(h,M,Xt,k,"#7AA880"),$(h+Xt/2,M,Xt/2,k,"#C8B890");const L="#4A3828";$(h,E-1,Xt,1,L),$(h,E+k,Xt,1,L),$(C-1,x,1,Xt,L),$(C+N,x,1,Xt,L),$(_-1,x,1,Xt,L),$(_+N,x,1,Xt,L),$(h,M-1,Xt,1,L),$(h,M+k,Xt,1,L)}const py=new Map;function r8(e,n="right"){const a=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}|${n}`;let i=py.get(a);if(!i){const o=lm("mini-seated:default"),u=Xb(o,e);let d=u?u.layers.flatMap(f=>f.pixels):[];n==="left"&&d.length>0&&(d=rm(d,12)),i=d,py.set(a,i)}return i}function a8(e,n,a,i="right"){Xl(Xe,r8(a,i),e,n,a)}function l8(e,n,a,i,o,u="right"){wi(e+8,n+20,"up"),o||a8(e+8,n+0+i,a,u),XA(e,n+14)}function i8(e,n,a,i,o){const u=i in ay?i:"down",d=o%4,f=ay[u][d];Xl(Xe,f,e,n,a);const m=d===1||d===3?-1:0;if(a.accessory&&a.accessory!=="none"){const h=mC(a.accessory,u);h&&h.pixels.length>0&&Xl(Xe,h.pixels,e,n+m,a)}Xe.globalAlpha=1}let $o=[],Ei=!1,js=0;function s8(){const e=Object.keys(Je.rooms),n=e[Math.floor(Math.random()*e.length)],a=Je.rooms[n];return{x:a.fx+a.fw/2,y:a.fy+a.fh/2,dir:"down",walkFrame:0,walkTimer:0,path:[],room:n,state:"walking",stateTimer:0,tongueTimer:0,idleTime:0}}function o8(e){if(e.stateTimer--,Ei){js++,e.dir="down",e.walkFrame=0,e.tongueTimer++,e.idleTime=0;return}else js=0;if(e.state==="idle"){if(e.tongueTimer++,e.idleTime++,e.stateTimer<=0){e.state="walking",e.tongueTimer=0;const n=Object.keys(Je.rooms);if(Math.random()<.35&&n.length>1){const a=n.filter(d=>d!==e.room),i=a[Math.floor(Math.random()*a.length)],o=tp(e,i),u=Je.waypoints[i];if(u&&u.length>0){const d=u[Math.floor(Math.random()*u.length)],f=o[o.length-1]??{x:e.x,y:e.y},m=Ni(f.x,f.y,d.x,d.y,i);e.path=[...o,...m]}else e.path=o}else{const a=Je.waypoints[e.room];if(a&&a.length>0){const i=a[Math.floor(Math.random()*a.length)];e.path=Ni(e.x,e.y,i.x,i.y,e.room)}}e.walkTimer=0}}else if(e.state==="walking"){if(e.idleTime=0,e.path.length===0){e.state="idle",e.dir="down",e.stateTimer=120+Math.floor(Math.random()*240);return}const n=e.path[0],a=n.x-e.x,i=n.y-e.y,o=Math.sqrt(a*a+i*i);if(o<1.5){e.x=n.x,e.y=n.y,e.path.shift();for(const[u,d]of Object.entries(Je.rooms))if(e.x>=d.fx&&e.x<=d.fx+d.fw&&e.y>=d.fy&&e.y<=d.fy+d.fh){e.room=u;break}}else e.x+=a/o*.15,e.y+=i/o*.15,Math.abs(a)>Math.abs(i)?e.dir=a>0?"right":"left":e.dir=i>0?"down":"up",e.walkTimer++,e.walkFrame=Math.floor(e.walkTimer/15)%2}}function c8(e){const n=Math.round(e.x),a=Math.round(e.y);if(Ei&&js>90){const d=Math.floor(js/12)%2===0?mA:pA;Xl(Xe,yA,n,a),Xl(Xe,d,n,a);return}const i=e.state==="walking"?e.walkFrame:0,o=fA[e.dir][i],u=e.dir==="left"||e.dir==="right";Xl(Xe,u?gA:xA,n,a),Xl(Xe,o,n,a),e.state==="idle"&&e.dir==="down"&&e.tongueTimer%80<50&&Xl(Xe,hA,n,a)}function u8(e){const n={};let a=0;for(const i of e){const o=wn[i];o&&(n[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:a*17,stateTimer:1200+Math.floor(Math.random()*1800),sittingTime:0,lookDir:"right",isStretching:!1,stretchTimer:0},a++)}return n}function Ni(e,n,a,i,o){const u=Je.corridorY[o]??n,d=[];return n<u-4&&d.push({x:e,y:u}),Math.abs(e-a)>4&&d.push({x:a,y:u}),d.push({x:a,y:i}),d}function Hh(e,n,a,i){const o=Je.adjacency[a];if(!o)return[];const u=o.find(x=>x.room===i);if(!u)return[];const d=Je.doors[u.door];if(!d)return[];const f=[],m=Je.corridorY[a]??n,h=Je.corridorY[i]??n;if(Math.abs(n-m)>4&&f.push({x:e,y:m}),d.type==="v"){const x=u.side==="A"?d.xA:d.xB,g=u.side==="A"?d.xB:d.xA;f.push({x,y:m}),f.push({x,y:d.doorY}),f.push({x:g,y:d.doorY}),f.push({x:g,y:h})}else{const x=u.side==="A"?d.yA:d.yB,g=u.side==="A"?d.yB:d.yA;f.push({x:d.doorX,y:m}),f.push({x:d.doorX,y:x}),f.push({x:d.doorX,y:g}),f.push({x:d.doorX,y:h})}return f}function tp(e,n){const a=Je.adjacency[e.room];if(!a)return[];if(!a.find(o=>o.room===n)){for(const o of a){const u=Je.adjacency[o.room];if(u!=null&&u.find(d=>d.room===n)){const d=Hh(e.x,e.y,e.room,o.room),f=d[d.length-1],m=Hh((f==null?void 0:f.x)??e.x,(f==null?void 0:f.y)??e.y,o.room,n);return[...d,...m]}}return[]}return Hh(e.x,e.y,e.room,n)}function d8(e){if(e.room!==e.homeRoom){const n=tp({...e},e.homeRoom),a=n[n.length-1],i=Ni((a==null?void 0:a.x)??e.x,(a==null?void 0:a.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...n,...i]}return Ni(e.x,e.y,e.homeX,e.homeY,e.room)}function f8(e,n){if(Lh--,Lh<=0){const a=Object.entries(e).filter(([,i])=>i.state==="sitting"&&!i.isStretching);if(a.length>0){const[,i]=a[Math.floor(Math.random()*a.length)];i.isStretching=!0,i.stretchTimer=120}Lh=900}for(const[a,i]of Object.entries(e))if(i.stateTimer--,i.isStretching&&i.stretchTimer>0&&(i.stretchTimer--,i.stretchTimer<=0&&(i.isStretching=!1)),i.state==="sitting"){if(i.sittingTime++,er===a){i.sittingTime=0,i.bobY=-3;const u=wn[a];if(u){const d=u.dx+13;i.lookDir=zv<d?"left":"right"}}else i.bobY=(n+i.bobOff)%60<30?1:0,i.lookDir="right";if(i.stateTimer<=0){i.state="walking",i.x=i.homeX,i.y=i.homeY,i.room=i.homeRoom;const u=Object.keys(Je.rooms);if(Math.random()<.15&&u.length>1){const d=u.filter(x=>x!==i.room),f=d[Math.floor(Math.random()*d.length)],m=tp(i,f),h=Je.waypoints[f];if(h&&h.length>0){const x=h[Math.floor(Math.random()*h.length)],g=m[m.length-1]??{x:i.x,y:i.y},v=Ni(g.x,g.y,x.x,x.y,f);i.path=[...m,...v]}else i.path=m;i.walkTimer=0}else{const d=Je.waypoints[i.room];if(d&&d.length>0){const f=d[Math.floor(Math.random()*d.length)];i.path=Ni(i.x,i.y,f.x,f.y,i.room)}i.walkTimer=0}}}else if(i.state==="walking"||i.state==="returning"){if(i.sittingTime=0,er===a){i.dir="down",i.walkFrame=0;continue}if(i.path.length===0){i.state==="returning"?(i.state="sitting",i.room=i.homeRoom,i.stateTimer=1200+Math.floor(Math.random()*1800)):(i.state="idle",i.dir="down",i.stateTimer=180+Math.floor(Math.random()*360));continue}const u=i.path[0],d=u.x-i.x,f=u.y-i.y,m=Math.sqrt(d*d+f*f);if(m<1.5){i.x=u.x,i.y=u.y,i.path.shift();for(const[h,x]of Object.entries(Je.rooms))if(i.x>=x.fx&&i.x<=x.fx+x.fw&&i.y>=x.fy&&i.y<=x.fy+x.fh){i.room=h;break}}else i.x+=d/m*.2,i.y+=f/m*.2,Math.abs(d)>Math.abs(f)?i.dir=d>0?"right":"left":i.dir=f>0?"down":"up",i.walkTimer++,i.walkFrame=Math.floor(i.walkTimer/12)%4}else if(i.state==="idle"){if(er===a){i.dir="down";continue}if(i.stateTimer<=0)if(Math.random()<.15){i.state="walking";const o=Je.waypoints[i.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];i.path=Ni(i.x,i.y,u.x,u.y,i.room)}i.walkTimer=0}else i.state="returning",i.path=d8(i),i.walkTimer=0}}function h8(e,n,a,i){const{canvasW:o,canvasH:u,rooms:d}=Je;Xe.clearRect(0,0,o,u),$(0,0,o,u,"#2A1E14");const f={wood:Ih,dark:my,carpet:e8,tile:t8};for(const b of Object.values(d))(f[b.floorType]??Ih)(b);const m=Object.keys(d);if(m.length>=4){const b=d.exec,j=d.meet,{doors:k}=Je;if(b&&j&&k.exec_meet&&k.work_comm){const E=(k.exec_meet.doorX??0)-14,C=(k.work_comm.doorX??0)-28/2,_=b.fy+b.fh,M=j.fy;Ih({fx:E,fy:_,fw:28,fh:M-_}),my({fx:C,fy:_,fw:28,fh:M-_})}}const h={};if(m.length>=4){const{doors:b}=Je,j=28,k=b.exec_meet,N=b.work_comm;k!=null&&k.doorX&&(h.meet={x:k.doorX-j/2,w:j}),N!=null&&N.doorX&&(h.comm={x:N.doorX-j/2,w:j})}for(const b of Object.values(d))ZA(b,h[b.id]),JA(b);n8(),WA(Je);const x=[],g=new Set(Object.values(wn).map(b=>b.room));VA(Je,x,g);for(const[b,j]of Object.entries(wn)){const k=e[b];if(!k)continue;const N=k.state==="sitting",E=n(b),C=a[b]==="working",_=k.isStretching&&k.stretchTimer>0?Math.sin(k.stretchTimer*.15)*1:0;x.push({y:j.dy+14,draw:()=>{const M=N?k.bobY+_:0;if(l8(j.dx,j.dy,E,M,!N,k.lookDir),N&&C){const L=Gu[b]??"#388bfd";$(j.dx+7,j.dy+14-4,12,5,L,.15),ot(j.dx+12,j.dy+14+1,"#4CAF50",.8)}}})}for(const[b,j]of Object.entries(e))if(j.state!=="sitting"){const k=n(b);x.push({y:j.y+14,draw:()=>i8(Math.round(j.x),Math.round(j.y),k,j.dir,j.walkFrame)})}i&&x.push({y:i.y+10,draw:()=>c8(i)}),x.sort((b,j)=>b.y-j.y);for(const b of x)b.draw();for(const b of ka){const j=ji===b.id,k=Mv(b);if(Xe.save(),Xe.globalAlpha=j?.9:.5,Xe.fillStyle=b.color,Xe.fillRect(k.cx-1,k.botY-2,3,3),j){const N=Rv(b);Xe.globalAlpha=.3,Xe.strokeStyle=b.color,Xe.lineWidth=1,Xe.strokeRect(N.x-1,N.y-1,N.w+2,N.h+2)}Xe.restore()}if(rl){const b=new Set(Object.values(wn).map(j=>j.room));if(sa&&sa!==zr)if(sa.startsWith("desk:")){const j=sa.slice(5),k=wn[j];k&&uy(Xe,k.dx,k.dy,"#FBBF24")}else cy(Xe,Je,sa,"#FBBF24",b);if(zr)if(zr.startsWith("desk:")){const j=zr.slice(5),k=wn[j];k&&uy(Xe,k.dx,k.dy,"#3B82F6")}else cy(Xe,Je,zr,"#3B82F6",b)}if(er){const b=wn[er],j=e[er];if(b&&j){Xe.save(),Xe.globalAlpha=.25,Xe.fillStyle=Gu[er]??"#fff",j.state==="sitting"?Xe.fillRect(b.dx-1,b.dy+6,28,30):Xe.fillRect(Math.round(j.x)-1,Math.round(j.y)-1,14,24),Xe.globalAlpha=.95,Xe.fillStyle="#FBBF24",Xe.font="bold 8px monospace",Xe.textAlign="center";const k=j.state==="sitting"?b.dx+13:Math.round(j.x)+6,N=j.state==="sitting"?b.dy-1:Math.round(j.y)-5;Xe.fillText("!",k,N),Xe.restore()}}const v=3600;for(const[,b]of Object.entries(e))if(b.state==="sitting"&&b.sittingTime>v&&!b.isStretching){const j=Object.values(wn).find(M=>M.dx+8===b.homeX&&M.dy+34===b.homeY);if(!j)continue;const k=j.dx+13,N=j.dy,E=Math.floor(b.sittingTime/40)%3;Xe.save(),Xe.font="5px monospace",Xe.textAlign="center";const C=[.7,.5,.3],_=[{x:3,y:-2-E},{x:6,y:-5-(E+1)%3},{x:4,y:-8-(E+2)%3}];for(let M=0;M<3;M++)Xe.globalAlpha=C[M],Xe.fillStyle="#93C5FD",Xe.font=`${4+M}px monospace`,Xe.fillText("z",k+_[M].x,N+_[M].y);Xe.restore()}$o=$o.filter(b=>b.life>0);for(const b of $o)b.x+=b.vx,b.y+=b.vy,b.life--,Xe.save(),Xe.globalAlpha=Math.min(1,b.life/(b.maxLife*.3)),Xe.fillStyle=b.color??"#FF6B8A",Xe.font="8px serif",Xe.fillText(b.char,Math.round(b.x),Math.round(b.y)),Xe.restore();if(Ei&&i&&js<=90){const b=Math.round(i.x),j=Math.round(i.y);Xe.save(),Xe.globalAlpha=.9,Xe.fillStyle="#FBBF24",Xe.font="bold 5px monospace",Xe.textAlign="center",Xe.fillText("!",b+4,j-2),Xe.restore()}if(i&&!Ei&&i.state==="idle"&&i.idleTime>600){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(i.idleTime/40)%3;Xe.save();const N=[{x:3,y:-2-k},{x:5,y:-5-(k+1)%3},{x:4,y:-8-(k+2)%3}];for(let E=0;E<3;E++)Xe.globalAlpha=[.7,.5,.3][E],Xe.fillStyle="#93C5FD",Xe.font=`${3+E}px monospace`,Xe.textAlign="center",Xe.fillText("z",b+N[E].x,j+N[E].y);Xe.restore()}if(Ei&&i&&js<=90){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(Date.now()/150)%2===0?-1:1;i.dir==="down"&&(Xe.fillStyle="#FAFAF7",Xe.fillRect(b+4+k,j-1,2,2))}}function m8(e,n){for(let a=0;a<4;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:a%2===0?"♥":"♡",color:"#FF6B8A"})}function p8(e,n){for(let a=0;a<3;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:"💧",color:"#64B5F6"})}function x8({roles:e,projects:n,roleStatuses:a,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:d,onDecisionsClick:f,onKnowledgeClick:m,onSettingsClick:h,onThemeClick:x,onStatsClick:g,getRoleSpeech:v,getAppearance:b,onHireClick:j,onMascotClick:k,roleLevels:N,coinBalance:E=0,onCoinsSpent:C,onFurniturePlaced:_,purchasedPreset:M,language:L="en"}){const R=w.useRef(null),I=w.useRef(null),X=w.useRef(null),J=w.useRef({}),A=w.useRef(null),O=w.useRef(0),U=w.useRef(KA),[Y,ne]=w.useState(!1),[K,q]=w.useState(null),[se,ue]=w.useState(null),V=w.useRef({}),D=w.useRef({}),B=w.useRef([]),H=w.useRef([]);w.useEffect(()=>{rl=Y},[Y]),w.useEffect(()=>{Ul=K,wa=se},[K,se]);const[T,de]=w.useState(!1);w.useEffect(()=>{ye.getPreferences().then(pe=>{const Se=pe.furnitureOverrides;Se&&Object.keys(Se).length>0&&(V.current=Se);const Ne=pe.deskOverrides;Ne&&Object.keys(Ne).length>0&&(D.current=Ne);const G=pe.removedFurniture;G&&G.length>0&&(B.current=G);const ce=pe.addedFurniture;ce&&ce.length>0&&(H.current=ce),de(!0)}).catch(()=>{de(!0)})},[]);const ge=w.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:v,getAppearance:b});ge.current={roleStatuses:a,activeExecs:i,getRoleSpeech:v,getAppearance:b};const he=w.useRef({}),Be=w.useMemo(()=>e.map(pe=>pe.id),[e]),He=w.useRef(Je);w.useEffect(()=>{if(!T)return;const pe=Be.length,Se=Nv(pe,He.current.preset,M),Ne=He.current.preset!==Se;let G=Av(pe,Se);B.current.length>0&&(G=oy(G,B.current)),H.current.length>0&&(G=CA(G,H.current)),Object.keys(V.current).length>0&&(G=jA(G,V.current)),Je=G,He.current=G,wn=QA(Be),Object.keys(D.current).length>0&&SA(wn,D.current),ka=ki(G),J.current=u8(Be),A.current=s8();const ce=R.current;ce&&(ce.width=G.canvasW,ce.height=G.canvasH,Ne&&(ce.style.opacity="0",ce.style.transition="opacity 0.3s",setTimeout(()=>{ce.style.opacity="1"},50))),et()},[Be,M,T]);const Ie=w.useCallback(pe=>{var Se,Ne;return((Ne=(Se=ge.current).getAppearance)==null?void 0:Ne.call(Se,pe))??Pm(pe)},[]),et=w.useCallback(()=>{const pe=I.current,Se=R.current;if(!pe||!Se)return;const Ne=pe.parentElement;if(!Ne)return;const G=Ne.clientWidth,ce=Ne.clientHeight;if(G===0||ce===0)return;const{canvasW:re,canvasH:ve}=Je;let we=Math.min(G/re,ce/ve);we=Math.round(we*2)/2,we=Math.max(2,Math.min(we,5)),U.current=we,Se.style.width=re*we+"px",Se.style.height=ve*we+"px",pe.style.width=re*we+"px",pe.style.height=ve*we+"px"},[]);w.useEffect(()=>{var ve;const pe=R.current;if(!pe)return;const Se=pe.getContext("2d");if(!Se)return;Xe=Se,EA(Se),et();const Ne=new ResizeObserver(()=>et()),G=(ve=I.current)==null?void 0:ve.parentElement;G&&Ne.observe(G);let ce;const re=()=>{O.current++,f8(J.current,O.current),A.current&&o8(A.current),h8(J.current,Ie,ge.current.roleStatuses,A.current),Ve(),ce=requestAnimationFrame(re)};return ce=requestAnimationFrame(re),()=>{cancelAnimationFrame(ce),Ne.disconnect()}},[Ie,et]),w.useEffect(()=>{var re;const pe=X.current;if(!pe)return;pe.innerHTML="";const Se={};for(const ve of e)Se[ve.id]=ve.name;for(const ve of Be){const we=Gu[ve]??"#8b949e",Me=Se[ve],ze=Me&&Me.toLowerCase()!==ve.toLowerCase()?`${ve.toUpperCase()} · ${Me}`:ve.toUpperCase(),Oe=document.createElement("div");Oe.className="td-nametag",Oe.dataset.role=ve;const qe=document.createElement("span");qe.className="td-dot",qe.style.background=we,Oe.appendChild(qe),Oe.appendChild(document.createTextNode(ze));const lt=((re=N==null?void 0:N[ve])==null?void 0:re.level)??1;if(lt>1){const bt=document.createElement("span");bt.className="td-lvl",bt.textContent=`Lv.${lt}`,Oe.appendChild(bt)}pe.appendChild(Oe);const Qe=document.createElement("div");Qe.className="td-bubble",Qe.dataset.role=ve,Qe.dataset.type="bubble",pe.appendChild(Qe)}const Ne={meeting:()=>{const ve=n[0];ve?u(ve.id):d()},bulletin:d,decisions:f,knowledge:m,settings:h,theme:x,stats:g};for(const ve of ka){const we=document.createElement("div");we.className="td-facility-label",we.dataset.facility=ve.id,ve.id==="meeting"&&(we.dataset.questTarget="meeting-room"),ve.id==="knowledge"&&(we.dataset.questTarget="knowledge-hub"),ve.id==="bulletin"&&(we.dataset.questTarget="bulletin-board"),ve.id==="stats"&&(we.dataset.questTarget="stats-btn"),ve.id==="settings"&&(we.dataset.questTarget="settings-btn"),ve.id==="theme"&&(we.dataset.questTarget="theme-btn"),we.textContent=`${ve.icon} ${ve.label}`,we.style.borderColor=`${ve.color}44`;const Me=Ne[ve.id];Me&&we.addEventListener("click",Me),we.addEventListener("mouseenter",()=>{ji=ve.id}),we.addEventListener("mouseleave",()=>{ji=null}),pe.appendChild(we)}const G=document.createElement("div");G.className="td-nametag td-nametag-mascot",G.dataset.role="mascot";const ce=document.createElement("span");ce.className="td-dot",ce.style.background="#ffd700",G.appendChild(ce),G.appendChild(document.createTextNode("Pupu")),G.addEventListener("click",()=>k==null?void 0:k()),pe.appendChild(G)},[Be,e,n,u,d,f,m,h,x,g,k,N]);const Ve=w.useCallback(()=>{var Me;const pe=X.current;if(!pe)return;const Se=U.current,Ne=J.current,{getRoleSpeech:G,roleStatuses:ce,activeExecs:re}=ge.current;for(const ze of Object.keys(Ne)){const Oe=Ne[ze],qe=wn[ze];if(!qe)continue;let lt,Qe,bt;Oe.state==="sitting"?(lt=qe.dx+13,bt=qe.dy+2,Qe=qe.dy+37):(lt=Math.round(Oe.x)+6,bt=Math.round(Oe.y)-2,Qe=Math.round(Oe.y)+18);const Re=lt/Je.canvasW*100,Ue=pe.querySelector(`.td-nametag[data-role="${ze}"]`);if(Ue){Ue.style.left=Re+"%",Ue.style.top=Qe*Se+2+"px";const Bt=Ue.querySelector(".td-dot");if(Bt){const Ot=ce[ze]==="working";Bt.style.background=Ot?"#FBBF24":Gu[ze]??"#8b949e",Ot?Bt.style.animation="td-pulse 1s ease-in-out infinite":Bt.style.animation=""}}const _t=pe.querySelector(`.td-bubble[data-role="${ze}"]`);if(_t){const Bt=Date.now(),Ot=ce[ze]==="working",un=(Me=re.find(Kt=>Kt.roleId===ze))==null?void 0:Me.task,kn=G(ze);let Z="";const $e=he.current[ze];if($e){if($e.speechDismissTime&&Bt>=$e.speechDismissTime&&($e.currentSpeech=null,$e.speechDismissTime=null),$e.hoverStartTime&&!$e.currentSpeech){const Kt=Bt-$e.hoverStartTime,ke=!$e.lastSpeechTime||Bt-$e.lastSpeechTime>=5e3;if(Kt>=2e3&&ke){const kt=PA(ze,L),jn=kt[Math.floor(Math.random()*kt.length)];$e.currentSpeech=jn,$e.lastSpeechTime=Bt,$e.speechDismissTime=Bt+3e3}}Z=$e.currentSpeech||""}const at=Ot&&un?un.slice(0,60):Z?Z.slice(0,60):kn?kn.slice(0,60):"";at&&Oe.state==="sitting"?(_t.style.display="",_t.style.left=Re+"%",_t.style.top=(bt-10)*Se+"px",_t.textContent=at):_t.style.display="none"}}const ve=pe.querySelector(".td-nametag-mascot"),we=A.current;if(ve&&we){const ze=we.dir==="left"||we.dir==="right",Oe=Math.round(we.x)+(ze?6:4),qe=Math.round(we.y)+(ze?7:10);ve.style.left=Oe/Je.canvasW*100+"%",ve.style.top=qe*Se+2+"px"}for(const ze of ka){const Oe=pe.querySelector(`.td-facility-label[data-facility="${ze.id}"]`);if(Oe){const qe=Mv(ze);Oe.style.left=qe.cx/Je.canvasW*100+"%",Oe.style.top=qe.botY*Se-4+"px",Oe.classList.toggle("td-facility-label--hover",ji===ze.id)}}},[]),Ke=w.useCallback(pe=>{const Se=R.current;if(!Se)return null;const Ne=Se.getBoundingClientRect(),G=U.current,ce=(pe.clientX-Ne.left)/G,re=(pe.clientY-Ne.top)/G,ve=J.current;for(const[Me,ze]of Object.entries(wn)){if(!ve[Me])continue;const Oe=ve[Me];if(Oe.state==="sitting"){if(ce>=ze.dx&&ce<=ze.dx+26&&re>=ze.dy&&re<=ze.dy+40)return{type:"role",id:Me}}else if(ce>=Oe.x-2&&ce<=Oe.x+14&&re>=Oe.y-2&&re<=Oe.y+20)return{type:"role",id:Me}}const we=A.current;if(we){const Me=we.dir==="left"||we.dir==="right",ze=Me?13:9,Oe=Me?7:10;if(ce>=we.x&&ce<=we.x+ze&&re>=we.y&&re<=we.y+Oe)return{type:"mascot",id:"mascot"}}for(const Me of ka){const ze=Rv(Me);if(ce>=ze.x&&ce<=ze.x+ze.w&&re>=ze.y&&re<=ze.y+ze.h)return{type:"facility",id:Me.id}}return null},[]),Ee=w.useCallback(pe=>{const Se=R.current;if(!Se)return{mx:0,my:0};const Ne=Se.getBoundingClientRect(),G=U.current;return{mx:(pe.clientX-Ne.left)/G,my:(pe.clientY-Ne.top)/G}},[]),Ae=w.useCallback(pe=>{ye.updatePreferences(pe).catch(()=>{})},[]),yt=w.useCallback(pe=>{const Se=H.current.some(G=>G.id===pe),Ne={};if(Se){const G=H.current.filter(ce=>ce.id!==pe);H.current=G,Ne.addedFurniture=G}else{const G=[...B.current,pe];B.current=G,Ne.removedFurniture=G}Je=oy(Je,[pe]),ka=ki(Je),zr=null,sa=null,Ae(Ne)},[Ae]),dt=w.useCallback((pe,Se)=>{if(!Ul||!wa)return;const Ne=fy.find(Oe=>Oe.type===Ul),G=(Ne==null?void 0:Ne.price)??0;if(G>0&&E<G)return;let ce=null;for(const[Oe,qe]of Object.entries(Je.rooms)){const lt=wa==="wall"?qe.wx:qe.fx,Qe=wa==="wall"?qe.wy:qe.fy,bt=wa==="wall"?qe.ww:qe.fw,Re=wa==="wall"?qe.wh:qe.fh;if(pe>=lt&&pe<=lt+bt&&Se>=Qe&&Se<=Qe+Re){ce=Oe;break}}if(!ce)return;const re=Je.rooms[ce],ve=wa==="wall"?re.wx:re.fx,we=wa==="wall"?re.wy:re.fy,Me={id:`user-${Ul}-${Date.now()}`,type:Ul,room:ce,zone:wa,offsetX:Math.round(pe-ve),offsetY:Math.round(Se-we)},ze=[...H.current,Me];if(H.current=ze,wa==="wall"?Je.wallDecorations.push(Me):Je.furniture.push(Me),ka=ki(Je),Ae({addedFurniture:ze}),_==null||_(Ul,G),G>0){const Oe=Me.type;Ny(async()=>{const{api:qe}=await Promise.resolve().then(()=>Aw);return{api:qe}},void 0).then(({api:qe})=>{qe.spendCoins(G,`furniture: ${Oe}`,Me.id).then(lt=>C==null?void 0:C(lt.balance)).catch(()=>{})})}q(null),ue(null)},[Ae,E,C,_]),xt=w.useCallback(pe=>{const Se=R.current;if(rl&&nr){const{mx:ve,my:we}=Ee(pe),ze=[...Je.furniture,...Je.wallDecorations].find(lt=>lt.id===nr.defId);if(!ze)return;const Oe=ve-nr.startMx,qe=we-nr.startMy;ze.offsetX=Math.round(nr.origOffX+Oe),ze.offsetY=Math.round(nr.origOffY+qe),ka=ki(Je),Se&&(Se.style.cursor="grabbing");return}if(rl&&$n){const{mx:ve,my:we}=Ee(pe),Me=wn[$n.roleId];if(!Me)return;Me.dx=Math.round($n.origDx+(ve-$n.startMx)),Me.dy=Math.round($n.origDy+(we-$n.startMy));const ze=J.current[$n.roleId];ze&&(ze.homeX=Me.dx+8,ze.homeY=Me.dy+34),Se&&(Se.style.cursor="grabbing");return}if(rl){const{mx:ve,my:we}=Ee(pe);if(Ul){Se&&(Se.style.cursor="crosshair");return}const Me=new Set(Object.values(wn).map(Oe=>Oe.room)),ze=$h(Je,ve,we,Me);if(ze)sa=ze;else{const Oe=dy(wn,ve,we);sa=Oe?`desk:${Oe}`:null}er=null,ji=null,Se&&(Se.style.cursor=sa?"grab":"default");return}const Ne=Ke(pe),G=er;er=(Ne==null?void 0:Ne.type)==="role"?Ne.id:null,ji=(Ne==null?void 0:Ne.type)==="facility"?Ne.id:null,Ei=(Ne==null?void 0:Ne.type)==="mascot",sa=null,Se&&(Se.style.cursor=Ne?"pointer":"default");const{mx:ce}=Ee(pe);zv=ce;const re=Date.now();if(er&&er!==G){he.current[er]||(he.current[er]={hoverStartTime:null,lastSpeechTime:null,currentSpeech:null,speechDismissTime:null});const ve=he.current[er];ve.hoverStartTime=re}else if(!er&&G){const ve=he.current[G];ve&&(ve.hoverStartTime=null)}},[Ke,Ee]),jt=w.useCallback(pe=>{if(!rl)return;const{mx:Se,my:Ne}=Ee(pe);if(Ul){dt(Se,Ne),pe.preventDefault();return}const G=new Set(Object.values(wn).map(ve=>ve.room)),ce=$h(Je,Se,Ne,G);if(ce){const we=[...Je.furniture,...Je.wallDecorations].find(Me=>Me.id===ce);we&&(zr=ce,nr={defId:ce,startMx:Se,startMy:Ne,origOffX:we.offsetX,origOffY:we.offsetY},pe.preventDefault());return}const re=dy(wn,Se,Ne);if(re){const ve=wn[re];zr=`desk:${re}`,$n={roleId:re,startMx:Se,startMy:Ne,origDx:ve.dx,origDy:ve.dy},pe.preventDefault();return}zr=null},[Ee,dt]),Wt=w.useCallback(pe=>{if(nr){const Ne=[...Je.furniture,...Je.wallDecorations].find(G=>G.id===nr.defId);if(Ne){const G={...V.current,[Ne.id]:{offsetX:Ne.offsetX,offsetY:Ne.offsetY}};V.current=G,Ae({furnitureOverrides:G}),ka=ki(Je)}nr=null,R.current&&(R.current.style.cursor="grab");return}if($n){const Se=wn[$n.roleId];if(Se){const Ne={...D.current,[$n.roleId]:{dx:Se.dx,dy:Se.dy}};D.current=Ne,Ae({deskOverrides:Ne})}$n=null,R.current&&(R.current.style.cursor="grab")}},[Ae]),Tt=w.useCallback(pe=>{if(!rl)return;pe.preventDefault();const{mx:Se,my:Ne}=Ee(pe),G=new Set(Object.values(wn).map(re=>re.room)),ce=$h(Je,Se,Ne,G);ce&&yt(ce)},[Ee,yt]);w.useEffect(()=>{const pe=Se=>{!rl||!zr||(Se.key==="Delete"||Se.key==="Backspace")&&(zr.startsWith("desk:")||yt(zr))};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[yt]);const Ct=w.useCallback(()=>{if(nr){const Se=[...Je.furniture,...Je.wallDecorations].find(Ne=>Ne.id===nr.defId);Se&&(Se.offsetX=nr.origOffX,Se.offsetY=nr.origOffY,ka=ki(Je)),nr=null}if($n){const pe=wn[$n.roleId];pe&&(pe.dx=$n.origDx,pe.dy=$n.origDy);const Se=J.current[$n.roleId];Se&&(Se.homeX=pe.dx+8,Se.homeY=pe.dy+34),$n=null}er=null,ji=null,Ei=!1,sa=null,R.current&&(R.current.style.cursor="default")},[]),Bn=w.useCallback(pe=>{if(rl)return;const Se=Ke(pe);if(Se){if(Se.type==="role"){const Ne=J.current[Se.id],G=wn[Se.id];if(Ne&&G){const ce=Ne.state==="sitting"?G.dx+13:Math.round(Ne.x)+6,re=Ne.state==="sitting"?G.dy+2:Math.round(Ne.y)-2;p8(ce,re)}o(Se.id);return}if(Se.type==="mascot"){const Ne=A.current;Ne&&m8(Math.round(Ne.x)+4,Math.round(Ne.y)-2),k==null||k();return}switch(Se.id){case"meeting":{const Ne=n[0];Ne?u(Ne.id):d();break}case"bulletin":d();break;case"decisions":f();break;case"knowledge":m();break;case"settings":h==null||h();break;case"theme":x==null||x();break;case"stats":g==null||g();break}}},[Ke,o,u,d,f,m,h,x,g]);return l.jsxs("div",{className:`td-scene${Y?" td-scene--editing":""}`,children:[l.jsxs("div",{ref:I,className:"td-wrap",children:[l.jsx("canvas",{ref:R,width:Je.canvasW,height:Je.canvasH,className:"td-canvas",onClick:Bn,onMouseDown:jt,onMouseUp:Wt,onMouseMove:xt,onMouseLeave:Ct,onContextMenu:Tt}),l.jsx("div",{ref:X,className:"td-overlay"})]}),Y&&l.jsxs("div",{className:"td-edit-banner",children:[l.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),l.jsxs("button",{className:`td-edit-btn${Y?" td-edit-btn--active":""}`,"data-quest-target":"edit-btn",onClick:()=>{ne(pe=>{const Se=!pe;return Se||(q(null),ue(null)),Se}),zr=null,nr=null,$n=null},title:Y?"Exit Edit Mode":"Edit Furniture Layout",children:[l.jsx("span",{className:"td-edit-btn__icon",children:Y?"✓":"✎"}),l.jsx("span",{className:"td-edit-btn__label",children:Y?"DONE":"EDIT"})]}),Y&&l.jsx("div",{className:"td-palette",children:fy.map(pe=>{const Se=pe.price===0||E>=pe.price,Ne=pe.price===0?"Free":`${pe.price>=1e3?`${(pe.price/1e3).toFixed(pe.price%1e3===0?0:1)}K`:pe.price}`;return l.jsxs("button",{className:`td-palette__item${K===pe.type?" td-palette__item--active":""}${Se?"":" td-palette__item--locked"}`,onClick:()=>{Se&&(K===pe.type?(q(null),ue(null)):(q(pe.type),ue(pe.zone)))},title:`${pe.label} — ${Ne}`,style:Se?void 0:{opacity:.4,cursor:"not-allowed"},children:[l.jsx("span",{children:pe.icon}),l.jsx("span",{className:"td-palette__price",style:{fontSize:"7px",color:pe.price===0?"#4CAF50":Se?"#FFD54F":"#EF5350"},children:Ne})]},pe.type)})}),j&&l.jsxs("button",{className:"td-hire-btn","data-quest-target":"hire-btn",onClick:j,title:"Hire New Role",children:[l.jsx("span",{className:"td-hire-btn__icon",children:"+"}),l.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function g8({role:e,appearance:n,onSave:a,onReset:i,onClose:o,theme:u,onThemeChange:d,onUpdateName:f,initialTab:m,characterOnly:h,speechSettings:x,onSpeechSettingsChange:g,language:v,onLanguageChange:b,roleLevel:j,coinBalance:k,purchased:N,onPurchase:E}){var ne;const[C,_]=w.useState(m??"character"),[M,L]=w.useState({...n}),[R,I]=w.useState(e.name),[X,J]=w.useState(!1),A=w.useCallback(()=>L(xs(j)),[j]),O=w.useCallback(()=>{const K=Pm(e.id);L({...K}),i()},[e.id,i]),U=w.useCallback(async()=>{a(M);const K=R.trim();if(f&&K&&K!==e.name){J(!0);try{await f(e.id,K)}catch{}J(!1)}o()},[M,a,o,R,e.name,e.id,f]),Y=l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsxs("span",{children:[e.id.toUpperCase()," –"]}),f?l.jsx("input",{value:R,onChange:K=>I(K.target.value),disabled:X,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}}):l.jsx("span",{children:e.name})]});return l.jsx("div",{className:"customize-overlay",onClick:o,children:l.jsxs("div",{className:"customize-modal",onClick:K=>K.stopPropagation(),children:[l.jsxs("div",{className:"customize-header",children:[l.jsxs("div",{className:"customize-tabs",children:[l.jsx("button",{className:`customize-tab ${C==="character"?"active":""}`,onClick:()=>_("character"),children:"CHARACTER"}),!h&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:`customize-tab ${C==="office"?"active":""}`,onClick:()=>_("office"),children:"OFFICE THEME"}),l.jsx("button",{className:`customize-tab ${C==="settings"?"active":""}`,onClick:()=>_("settings"),children:"SETTINGS"})]})]}),l.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),C==="character"?l.jsx("div",{className:"customize-body",children:l.jsx(gv,{roleId:e.id,appearance:M,onChange:L,onRandomize:A,onReset:O,label:Y,roleLevel:j,coinBalance:k,purchased:N,onPurchase:E})}):C==="office"?l.jsx("div",{className:"customize-body",children:l.jsx("div",{className:"customize-themes",children:Object.entries(il).map(([K,q])=>l.jsxs("button",{className:`customize-theme-card ${u===K?"active":""}`,onClick:()=>d(K),children:[l.jsxs("div",{className:"customize-theme-preview",style:{background:q.vars["--floor-light"],borderColor:q.vars["--pixel-border"]},children:[l.jsx("div",{style:{background:q.vars["--hud-bg"],height:8,borderBottom:`2px solid ${q.vars["--pixel-border"]}`}}),l.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[l.jsx("div",{style:{width:10,height:14,background:q.vars["--accent"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--active-green"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--idle-amber"],borderRadius:1}})]}),l.jsx("div",{style:{background:q.vars["--hud-bg"],height:6,borderTop:`2px solid ${q.vars["--pixel-border"]}`}})]}),l.jsxs("div",{className:"customize-theme-name",children:[q.icon," ",q.name]})]},K))})}):l.jsx("div",{className:"customize-body",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),l.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(K=>l.jsxs("button",{onClick:()=>g==null?void 0:g({mode:K}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(x==null?void 0:x.mode)===K?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(x==null?void 0:x.mode)===K?"rgba(255,255,255,0.08)":"transparent",color:(x==null?void 0:x.mode)===K?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:2},children:K==="template"?"TEMPLATE":K==="llm"?"AI":"AUTO"}),l.jsx("div",{style:{fontSize:9,opacity:.7},children:K==="template"?"Static pool ($0)":K==="llm"?"LLM generated":"Detect engine"})]},K))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(x==null?void 0:x.intervalSec)??18,"s"]}),l.jsx("input",{type:"range",min:5,max:120,step:5,value:(x==null?void 0:x.intervalSec)??18,onChange:K=>g==null?void 0:g({intervalSec:Number(K.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"5s (frequent)"}),l.jsx("span",{children:"120s (rare)"})]})]}),(x==null?void 0:x.mode)!=="template"&&l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((ne=x==null?void 0:x.dailyBudgetUsd)==null?void 0:ne.toFixed(2))??"1.00"]}),l.jsx("input",{type:"range",min:0,max:5,step:.25,value:(x==null?void 0:x.dailyBudgetUsd)??1,onChange:K=>g==null?void 0:g({dailyBudgetUsd:Number(K.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"$0 (unlimited)"}),l.jsx("span",{children:"$5.00/day"})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),l.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:K,label:q})=>l.jsx("button",{onClick:()=>b==null?void 0:b(K),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(v??"auto")===K?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(v??"auto")===K?"rgba(255,255,255,0.08)":"transparent",color:(v??"auto")===K?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:q},K))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),C==="character"&&l.jsxs("div",{className:"customize-footer",children:[l.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),l.jsx("button",{className:"customize-btn customize-btn--save",onClick:U,children:"SAVE"})]})]})})}function xy(e){if(e.length===0)return"";const n={};for(const{file:f}of e){const m=f.split("/"),h=m[0]==="."?m[1]??"root":m[0];(n[h]??(n[h]=[])).push(f)}const a={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[f,m]of Object.entries(n)){const h=a[f]??f;if(m.length===1){const x=m[0].split("/").pop()??m[0];i.push(`${h}/${x}`)}else i.push(`${h} (${m.length} files)`)}const o=e.some(f=>f.status==="A"),u=e.some(f=>f.status==="M");return`${o&&!u?"add":"update"}: ${i.join(", ")}`}function gy(e){const n=Date.now()-new Date(e).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function y8({onInitGit:e,onDelegate:n,delegateRoleName:a}){const[i,o]=w.useState(!1),[u,d]=w.useState(null),f=async()=>{o(!0),d(null);try{await e(),d({ok:!0,message:"Git repository initialized!"})}catch(h){const x=h instanceof Error?h.message:"Failed";x.includes("not installed")||x.includes("noGitBinary")?d({ok:!1,message:"git is not installed on this system"}):d({ok:!1,message:x})}finally{o(!1)}},m=u&&!u.ok&&u.message.includes("not installed");return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(211,47,47,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Git Repository"}),!u&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"This project has no git repository. Initialize one to start saving."}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:f,disabled:i,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:i?"INITIALIZING...":"GIT INIT"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&u.ok&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:u.message}),m&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"#EF5350"},children:"git is not installed on this system."}),l.jsxs("div",{className:"text-[10px] space-y-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:[l.jsx("b",{children:"macOS:"})," xcode-select --install"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Ubuntu/Debian:"})," sudo apt install git"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Windows:"})," ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"git-scm.com/downloads"})]})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:()=>{d(null)},className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&!u.ok&&!m&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:u.message})]})}function b8({repo:e,onConnected:n,onDelegate:a,delegateRoleName:i}){const[o,u]=w.useState("idle"),[d,f]=w.useState(null),[m,h]=w.useState(""),[x,g]=w.useState("private"),[v,b]=w.useState(""),[j,k]=w.useState(null),[N,E]=w.useState(!1),C=async()=>{u("checking"),k(null);try{const R=await ye.getGithubStatus(e);f(R),R.hasRemote?n():R.ghInstalled&&R.authenticated?u("ready"):u("idle")}catch{u("idle")}},_=async()=>{if(m.trim()){E(!0),k(null);try{const R=await ye.githubCreateRepo(m.trim(),x,e);k(R),R.ok&&setTimeout(n,1500)}catch(R){k({ok:!1,message:R instanceof Error?R.message:"Failed"})}finally{E(!1)}}},M=async()=>{if(v.trim()){E(!0),k(null);try{const R=await ye.addRemote(v.trim(),e);k(R),R.ok&&setTimeout(n,1500)}catch(R){k({ok:!1,message:R instanceof Error?R.message:"Failed"})}finally{E(!1)}}},L=a?l.jsxs("button",{onClick:a,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},title:`Ask ${i??"AI"} to set up GitHub remote`,children:["🤖"," ",(i==null?void 0:i.toUpperCase())??"AI"," FIX"]}):null;return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(100,100,255,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Remote — Local Only"}),o==="idle"&&!d&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"CONNECT GITHUB"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),L]}),o==="checking"&&l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"Checking GitHub CLI..."}),o==="idle"&&d&&!d.ghInstalled&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI (gh) not installed."}),l.jsxs("div",{className:"text-[10px] space-y-0.5",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:["Install:"," ",l.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"cli.github.com"})]}),l.jsx("div",{style:{fontFamily:"var(--pixel-font)"},children:"brew install gh && gh auth login"})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD URL MANUALLY"}),L]})]}),o==="idle"&&d&&d.ghInstalled&&!d.authenticated&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI installed but not logged in."}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)",fontFamily:"var(--pixel-font)"},children:"Run in terminal: gh auth login"}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),L]})]}),o==="ready"&&d&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--active-green)"},children:["Logged in as ",d.username||"GitHub user"]}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("input",{type:"text",value:m,onChange:R=>h(R.target.value),placeholder:"repository-name",className:"flex-1 px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("select",{value:x,onChange:R=>g(R.target.value),className:"px-2 py-1.5 text-[10px] outline-none cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:[l.jsx("option",{value:"private",children:"Private"}),l.jsx("option",{value:"public",children:"Public"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:_,disabled:N||!m.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"CREATING...":"CREATE & PUSH"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"USE URL INSTEAD"})]})]}),o==="manual"&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("a",{href:"https://github.com/new",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"Create a new repo on GitHub"})," ","then paste the URL below:"]}),l.jsx("input",{type:"text",value:v,onChange:R=>b(R.target.value),placeholder:"https://github.com/username/repo-name.git",className:"w-full px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:M,disabled:N||!v.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"ADDING...":"ADD REMOTE & PUSH"}),l.jsx("button",{onClick:()=>{u("idle"),f(null)},className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"BACK"})]})]}),j&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:j.ok?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${j.ok?"var(--active-green)":"#D32F2F"}`,color:j.ok?"var(--active-green)":"#EF5350"},children:j.message})]})}function v8({status:e,history:n,onClose:a,onSave:i,onLoadHistory:o,onRestore:u,saving:d,onDelegate:f,delegateRoleName:m,repo:h,onRepoChange:x,syncInfo:g,onPull:v,pulling:b,onRefresh:j,onInitGit:k}){const[N,E]=w.useState("save"),[C,_]=w.useState(""),[M,L]=w.useState(null),[R,I]=w.useState(!1),[X,J]=w.useState(null),[A,O]=w.useState(null),U=w.useRef(null);w.useEffect(()=>{N==="history"&&o()},[N,o]),w.useEffect(()=>{var D;(D=U.current)==null||D.focus()},[]);const Y=[...((e==null?void 0:e.modified)??[]).map(D=>({status:"M",file:D})),...((e==null?void 0:e.untracked)??[]).map(D=>({status:"A",file:D}))],ne=w.useRef(!1);w.useEffect(()=>{!ne.current&&Y.length>0&&!C&&(_(xy(Y)),ne.current=!0)},[Y.length]),w.useEffect(()=>{ne.current=!1,_(""),O(null),J(null),L(null)},[h]);const K=w.useCallback(()=>{_(xy(Y))},[Y]),q=async()=>{L(null),J(null);try{const D=await i(C||void 0);J(D),_("")}catch(D){L(D instanceof Error?D.message:"Save failed")}},se=async()=>{O(null),L(null);try{const D=await v();O(D)}catch(D){L(D instanceof Error?D.message:"Pull failed")}},ue=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){I(!0);try{await u(D),I(!1)}catch(B){L(B instanceof Error?B.message:"Restore failed"),I(!1)}}};w.useEffect(()=>{const D=B=>{B.key==="Escape"&&a()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[a]);const V=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&q()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),l.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:V,children:[l.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE COMPANY"}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[g&&g.hasRemote&&(g.behind>0||g.ahead>0)&&l.jsxs("span",{className:"text-[10px] font-bold",style:{color:g.behind>0?"var(--idle-amber)":"var(--active-green)"},children:[g.behind>0&&`↓${g.behind}`,g.behind>0&&g.ahead>0&&" ",g.ahead>0&&`↑${g.ahead}`]}),l.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]})]}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["akb","code"].map(D=>l.jsx("button",{onClick:()=>x(D),className:"flex-1 py-1.5 text-[10px] font-bold uppercase tracking-wider cursor-pointer",style:{background:h===D?"var(--hud-bg-alt)":"transparent",color:h===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:h===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="akb"?"AKB":"CODE"},D))}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>l.jsx("button",{onClick:()=>E(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:N===D?"var(--hud-bg-alt)":"transparent",color:N===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:N===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[N==="save"&&l.jsxs(l.Fragment,{children:[(e==null?void 0:e.noGit)&&l.jsx(y8,{onInitGit:async()=>{await(k==null?void 0:k()),j==null||j()},onDelegate:f?()=>{f(`Git is not initialized or not installed for this project. Please check if git is installed (run "git --version"). If git is available, initialize the repository with "git init" and make an initial commit. If git is not installed, provide clear instructions for the user's OS to install it.`)}:void 0,delegateRoleName:m}),g&&g.hasRemote&&g.behind>0&&l.jsxs("div",{className:"flex items-center justify-between p-2",style:{background:"rgba(255,180,0,0.08)",border:"1px solid var(--idle-amber)"},children:[l.jsxs("span",{className:"text-[11px]",style:{color:"var(--idle-amber)"},children:[g.behind," commit",g.behind>1?"s":""," behind remote"]}),l.jsx("button",{onClick:se,disabled:b,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--idle-amber)",color:"#000",border:"none",opacity:b?.5:1},children:b?"PULLING...":"↓ PULL"})]}),A&&l.jsx("div",{className:"text-[11px] p-2",style:{background:A.status==="ok"||A.status==="up-to-date"?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${A.status==="ok"||A.status==="up-to-date"?"var(--active-green)":"#D32F2F"}`,color:A.status==="ok"||A.status==="up-to-date"?"var(--active-green)":"#EF5350"},children:A.message}),l.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:Y.length>0?l.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",Y.length," unsaved change",Y.length>1?"s":""]}):l.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),Y.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),l.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:Y.map(({status:D,file:B})=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),l.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:B})]},B))})]}),Y.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),l.jsxs("button",{onClick:K,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),l.jsx("input",{ref:U,type:"text",value:C,onChange:D=>_(D.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),Y.length>0&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:q,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":e!=null&&e.hasRemote?"SAVE & PUSH":"SAVE"}),f&&l.jsxs("button",{onClick:()=>{const D=Y.map(B=>`${B.status} ${B.file}`).join(`
|
|
91
|
+
`);v=I.pop()??"";let X="";for(let J=0;J<I.length;J++){const A=I[J];if(A.startsWith("event: ")){X=A.slice(7).trim();continue}if(A.startsWith("data: ")){let O;try{O=JSON.parse(A.slice(6))}catch{X="";continue}switch(X){case"thinking":O.text&&((N=d.onThinking)==null||N.call(d,O.text));break;case"output":O.text&&d.onText(O.text);break;case"tool":(E=d.onToolUse)==null||E.call(d,O.name,O.input);break;case"dispatch":(C=d.onDispatch)==null||C.call(d,O.roleId,O.task);break;case"dispatch:progress":(_=d.onDispatchProgress)==null||_.call(d,O.roleId,O.type,O);break;case"turn":(M=d.onTurn)==null||M.call(d,O.turn);break;case"done":d.onDone(O);break;case"error":d.onError(O.message??"Unknown error");break;default:O.text&&d.onText(O.text);break}X=""}}}}finally{clearInterval(k)}}).catch(h=>{h.name!=="AbortError"&&d.onError(h.message)}),{abort:n}},[n]),abort:n}}const vv="tycono-appearances",gm="tycono-theme";function Zg(){try{const e=localStorage.getItem(vv);return e?JSON.parse(e):{}}catch{return{}}}function zh(e){localStorage.setItem(vv,JSON.stringify(e))}function Jg(){try{const e=localStorage.getItem(gm);if(e&&e in il)return e}catch{}return"default"}const wv=new Set;for(const e of Object.values(il))for(const n of Object.keys(e.vars))wv.add(n);function _6(e){var i;const n=(i=il[e])==null?void 0:i.vars;if(!n)return;const a=document.documentElement;for(const o of wv)o in n||a.style.removeProperty(o);for(const[o,u]of Object.entries(n))a.style.setProperty(o,u)}const _h={mode:"auto",intervalSec:18,dailyBudgetUsd:1},ym="tycono-speech-settings",Bh="tycono-language";function B6(){try{const e=localStorage.getItem(ym);return e?{..._h,...JSON.parse(e)}:_h}catch{return _h}}function O6(){const[e,n]=w.useState(Zg),[a,i]=w.useState(Jg),[o,u]=w.useState(B6),[d,f]=w.useState(()=>{try{return localStorage.getItem(Bh)??"auto"}catch{return"auto"}}),[m,h]=w.useState(new Set),x=w.useRef(!1);w.useEffect(()=>{x.current||(x.current=!0,ye.getPreferences().then(C=>{const _=Object.keys(C.appearances??{}).length>0||C.theme!=="default";if(C.speech&&(u(M=>({...M,...C.speech})),localStorage.setItem(ym,JSON.stringify(C.speech))),C.language&&(f(C.language),localStorage.setItem(Bh,C.language)),C.purchasedItems&&h(new Set(C.purchasedItems)),_){const M=C.appearances;n(M),zh(M),C.theme&&C.theme in il&&(i(C.theme),localStorage.setItem(gm,C.theme))}else{const M=Zg(),L=Jg();(Object.keys(M).length>0||L!=="default")&&ye.updatePreferences({appearances:M,theme:L}).catch(()=>{})}}).catch(()=>{}))},[]),w.useEffect(()=>{_6(a)},[a]);const g=w.useCallback(C=>e[C]??Pm(C),[e]),v=w.useCallback((C,_)=>{n(M=>{const L={...M,[C]:_};return zh(L),ye.updatePreferences({appearances:L}).catch(()=>{}),L})},[]),b=w.useCallback(C=>{n(_=>{const M={..._};return delete M[C],zh(M),ye.updatePreferences({appearances:M}).catch(()=>{}),M})},[]),j=w.useCallback(C=>{i(C),localStorage.setItem(gm,C),ye.updatePreferences({theme:C}).catch(()=>{})},[]),k=w.useCallback(C=>{u(_=>{const M={..._,...C};return localStorage.setItem(ym,JSON.stringify(M)),ye.updatePreferences({speech:M}).catch(()=>{}),M})},[]),N=w.useCallback(C=>{f(C),localStorage.setItem(Bh,C),ye.updatePreferences({language:C}).catch(()=>{})},[]),E=w.useCallback(C=>{h(_=>{const M=new Set(_);return M.add(C),ye.updatePreferences({purchasedItems:Array.from(M)}).catch(()=>{}),M})},[]);return{appearances:e,getAppearance:g,setAppearance:v,resetAppearance:b,theme:a,setTheme:j,speechSettings:o,setSpeechSettings:k,language:d,setLanguage:N,purchasedItems:m,addPurchasedItem:E}}const $6=3e4,L6=3e5;function I6(){var O;const[e,n]=w.useState("akb"),[a,i]=w.useState(null),[o,u]=w.useState("synced"),[d,f]=w.useState([]),[m,h]=w.useState(null),[x,g]=w.useState(!1),v=w.useRef(null),b=w.useRef(null),j=w.useRef(e);j.current=e;const k=w.useCallback(async()=>{try{const U=await ye.getSaveStatus(j.current);i(U),U.noGit?u("no-git"):u(Y=>Y==="saving"?Y:U.dirty?"dirty":"synced")}catch{u("error")}},[]),N=w.useCallback(async()=>{try{const U=await ye.getSyncStatus(j.current);h({ahead:U.ahead,behind:U.behind,branch:U.branch,hasRemote:U.hasRemote})}catch{}},[]),E=w.useCallback(()=>{v.current&&clearInterval(v.current),k(),v.current=setInterval(k,$6),b.current&&clearInterval(b.current),N(),b.current=setInterval(N,L6)},[k,N]);w.useEffect(()=>()=>{v.current&&clearInterval(v.current),b.current&&clearInterval(b.current)},[]);const C=w.useCallback(U=>{n(U),j.current=U,i(null),h(null),f([]),setTimeout(()=>{k(),N()},0)},[k,N]),_=w.useCallback(async U=>{u("saving");try{const Y=await ye.save(U,j.current);return await k(),Y}catch(Y){throw u("error"),Y}},[k]),M=w.useCallback(async()=>{try{const U=await ye.getSaveHistory(20,j.current);f(U)}catch{}},[]),L=w.useCallback(async U=>{u("saving");try{await ye.restoreSave(U,void 0,j.current),await k()}catch(Y){throw u("error"),Y}},[k]),R=w.useCallback(async()=>{g(!0);try{const U=await ye.pull(j.current);return await k(),await N(),U}catch(U){throw U}finally{g(!1)}},[k,N]),I=w.useCallback(async()=>{try{await ye.initGit(j.current),await k()}catch{u("error")}},[k]),X=a?a.modified.length+a.untracked.length:0,J=((O=a==null?void 0:a.lastCommit)==null?void 0:O.date)??null,A=w.useCallback(async()=>{E()},[E]);return{state:o,dirtyCount:X,lastSaved:J,status:a,save:_,history:d,loadHistory:M,restore:L,refresh:A,initGit:I,repo:e,setRepo:C,syncInfo:m,fetchSyncStatus:N,pull:R,pulling:x}}const ey={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."]},ty={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."]},H6=[{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."}]}],U6=18e3,ny=6e3,q6=2500,Y6=30*6e4,kv="tycono:relationships";function X6(){try{const e=localStorage.getItem(kv);return e?JSON.parse(e):[]}catch{return[]}}function W6(e){localStorage.setItem(kv,JSON.stringify(e))}function ku(e,n,a){const[i,o]=n<a?[n,a]:[a,n];let u=e.find(d=>d.roleA===i&&d.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function ju(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function Su(e){return e[Math.floor(Math.random()*e.length)]}function V6(e,n,a){const i=a.find(f=>f.id===e),o=a.find(f=>f.id===n);if(!i||!o)return null;const u=i.level==="c-level",d=o.level==="c-level";return u&&d?"c-level":i.reportsTo===n||o.reportsTo===e?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function G6(e,n){return e.relation==="any"?!0:e.relation===n}function K6({roles:e,roleStatuses:n,activeExecs:a,getStandupSpeech:i}){const[o,u]=w.useState(new Map),[d,f]=w.useState(X6),m=w.useRef({}),h=w.useRef(null),x=w.useRef(e),g=w.useRef(n),v=w.useRef(a),b=w.useRef(i),j=w.useRef(d);x.current=e,g.current=n,v.current=a,b.current=i,j.current=d,w.useEffect(()=>{const M=Date.now();for(const[L,R]of Object.entries(n))R==="working"&&(m.current[L]=M)},[n]),w.useEffect(()=>{W6(d)},[d]);const k=w.useCallback(M=>{const L=g.current[M],R=v.current.find(O=>O.roleId===M);if(L==="working"&&(R!=null&&R.task))return null;const I=b.current(M);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const X=Date.now(),J=m.current[M]??0;if(X-J>Y6&&Math.random()<.5){const O=ty[M]??ty.engineer;return{text:Su(O),type:"guilt",ts:X}}const A=ey[M]??ey.engineer;return{text:Su(A),type:"personality",ts:X}},[]),N=w.useCallback(M=>{if(h.current)return!1;const L=M.filter(se=>g.current[se.id]!=="working");if(L.length<2)return!1;const R=[...L].sort(()=>Math.random()-.5),I=R[0],X=R[1],J=V6(I.id,X.id,M);if(!J)return!1;const A=ku(j.current,I.id,X.id),O=ju(A),U=H6.filter(se=>G6(se,J)&&O>=se.minFamiliarity);if(U.length===0)return!1;const Y=Su(U);let ne=I.id,K=X.id;Y.relation==="superior-subordinate"&&(X.reportsTo===I.id||I.level==="c-level"?(ne=I.id,K=X.id):(ne=X.id,K=I.id)),h.current={templateId:Y.id,roleA:ne,roleB:K,turnIdx:0,timer:null};const q=se=>{if(!h.current||se>=Y.turns.length){h.current=null,f(B=>{const H=[...B],T=ku(H,ne,K);return T.conversations++,T.familiarity=ju(T),T.lastInteraction=new Date().toISOString(),H}),setTimeout(()=>{u(B=>{const H=new Map(B);return H.delete(ne),H.delete(K),H})},ny);return}const ue=Y.turns[se],V=ue.speaker==="A"?ne:K,D=ue.speaker==="A"?K:ne;u(B=>{const H=new Map(B);if(H.set(V,{text:ue.text,type:"social",partnerId:D,ts:Date.now()}),se>0){const T=Y.turns[se-1].speaker==="A"?ne:K;T!==V&&H.delete(T)}return H}),h.current.turnIdx=se,h.current.timer=setTimeout(()=>q(se+1),q6)};return q(0),!0},[]);w.useEffect(()=>{const M=setInterval(()=>{const L=x.current;if(L.length===0||h.current||Math.random()<.35&&N(L))return;const R=L.filter(J=>g.current[J.id]!=="working");if(R.length===0)return;const I=Su(R),X=k(I.id);X&&(u(J=>{const A=new Map(J);return A.set(I.id,X),A}),setTimeout(()=>{u(J=>{const A=new Map(J),O=A.get(I.id);return O&&O.ts===X.ts&&A.delete(I.id),A})},ny))},U6);return()=>{var L;clearInterval(M),(L=h.current)!=null&&L.timer&&clearTimeout(h.current.timer)}},[k,N]);const E=w.useCallback(M=>{const L=o.get(M);return(L==null?void 0:L.text)??""},[o]),C=w.useCallback((M,L)=>{f(R=>{const I=[...R],X=ku(I,M,L);return X.dispatches++,X.familiarity=ju(X),X.lastInteraction=new Date().toISOString(),I})},[]),_=w.useCallback(M=>{M.length<2||f(L=>{const R=[...L];for(let I=0;I<M.length;I++)for(let X=I+1;X<M.length;X++){const J=ku(R,M[I],M[X]);J.wavesTogether++,J.familiarity=ju(J),J.lastInteraction=new Date().toISOString()}return R})},[]);return{speeches:o,getSpeech:E,relationships:d,notifyDispatch:C,notifyWave:_}}const jv="tycono:office-chat";let P6=0;function Q6(){return`chat-${Date.now()}-${++P6}`}function Oh(){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 Z6(){try{const e=localStorage.getItem(jv);if(e){const n=JSON.parse(e);if(n.find(i=>i.id==="office")&&!n.find(i=>i.id==="general")){const i=n.filter(o=>o.id!=="office");return[...Oh(),...i]}const a=Oh();for(const i of a)n.find(o=>o.id===i.id)||n.unshift(i);return n}}catch{}return Oh()}function J6(e){const n=e.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(jv,JSON.stringify(n))}function eA(){const[e,n]=w.useState(Z6),[a,i]=w.useState(null),[o,u]=w.useState(new Set);w.useEffect(()=>{J6(e)},[e]);const d=w.useCallback(b=>{i(b),b&&u(j=>{const k=new Set(j);return k.delete(b),k})},[]),f=w.useCallback(b=>{const j={...b,id:Q6()};n(k=>{const N=k.map(E=>E.id==="general"?b.type==="dispatch"?{...E,messages:[...E.messages,j].slice(-200)}:E:b.channelId?E.id===b.channelId?{...E,messages:[...E.messages,j].slice(-200)}:E:E.members.length>0&&E.members.includes(b.roleId)?{...E,messages:[...E.messages,j].slice(-200)}:E);return u(E=>{const C=new Set(E);for(const _ of N){const M=k.find(L=>L.id===_.id);M&&_.messages.length>M.messages.length&&C.add(_.id)}return C}),N})},[]),m=w.useCallback((b,j,k)=>{const N=`ch-${Date.now()}`,E={id:N,name:b.startsWith("#")?b:`#${b}`,members:j,isDefault:!1,messages:[],topic:k};n(C=>[...C,E]),i(N)},[]),h=w.useCallback(b=>{n(j=>j.filter(k=>k.id!==b||k.isDefault)),i(j=>j===b?"general":j)},[]),x=w.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,members:j}:N))},[]),g=w.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,topic:j||void 0}:N))},[]),v=w.useCallback(b=>{n(j=>j.map(k=>{if(k.id==="watercooler"){const N=b.filter(E=>E.level!=="c-level").map(E=>E.id);if(k.members.length!==N.length||!N.every(E=>k.members.includes(E)))return{...k,members:N}}return k}))},[]);return{channels:e,activeChannelId:a,setActiveChannelId:d,pushMessage:f,createChannel:m,deleteChannel:h,updateMembers:x,updateTopic:g,unreadChannels:o,syncDefaultMembers:v}}const tA=45e3,ry=5e3,nA=4,rA=20;function aA({roles:e,roleStatuses:n,activeExecs:a,channels:i,relationships:o,pushMessage:u,speechSettings:d,engineType:f,hasApiKey:m}){const x=((d==null?void 0:d.mode)==="auto"?f==="claude-cli"||f==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(m!==!1||f==="claude-cli"),g=((d==null?void 0:d.intervalSec)??tA/1e3)*1e3,v=w.useRef(e),b=w.useRef(n),j=w.useRef(a),k=w.useRef(i),N=w.useRef(o),E=w.useRef(u),C=w.useRef(0),_=w.useRef(!1);v.current=e,b.current=n,j.current=a,k.current=i,N.current=o,E.current=u;const M=w.useCallback(async(I,X)=>{if(_.current)return!1;_.current=!0;try{if(!v.current.find(q=>q.id===I))return!1;const A=X.messages.slice(-rA).map(q=>({roleId:q.roleId,text:q.text,ts:q.ts})),O=v.current.filter(q=>X.members.includes(q.id)),U=N.current.filter(q=>q.roleA===I||q.roleB===I).map(q=>({partnerId:q.roleA===I?q.roleB:q.roleA,familiarity:q.familiarity})),Y=j.current.find(q=>q.roleId===I),ne=Y?{currentTask:Y.task,taskProgress:null}:{currentTask:null,taskProgress:null},K=await ye.chatInChannel({channelId:X.name.replace("#",""),channelTopic:X.topic,roleId:I,history:A,members:O.map(q=>({id:q.id,name:q.name,level:q.level})),relationships:U,workContext:ne});return K.message?(E.current({ts:Date.now(),roleId:I,text:K.message,type:"chat",channelId:X.id}),!0):!1}catch{return!1}finally{_.current=!1}},[]),L=w.useCallback(async(I,X)=>{if(C.current>=nA){C.current=0;return}const J=I.members.filter(Y=>Y!==X&&b.current[Y]!=="working");if(J.length===0){C.current=0;return}const A=J[Math.floor(Math.random()*J.length)];if(Math.random()>.7){C.current=0;return}const O=C.current*2e3,U=Math.random()*5e3;setTimeout(async()=>{C.current++;const Y=k.current.find(K=>K.id===I.id);if(!Y)return;if(await M(A,Y)){const K=.6-C.current*.1;Math.random()<K?L(Y,A):C.current=0}else C.current=0},ry+O+U)},[M]);return w.useEffect(()=>{if(!x)return;const I=setInterval(async()=>{const X=v.current;if(X.length===0||_.current)return;const J=X.filter(ne=>b.current[ne.id]!=="working");if(J.length===0)return;const A=J[Math.floor(Math.random()*J.length)],O=k.current.filter(ne=>ne.members.length===0?!0:ne.members.includes(A.id));if(O.length===0)return;const U=O[Math.floor(Math.random()*O.length)];C.current=0,await M(A.id,U)&&L(U,A.id)},g);return()=>clearInterval(I)},[x,g,M,L]),{triggerCeoReaction:w.useCallback(I=>{if(!x)return;const X=k.current.find(J=>J.id===I);X&&(C.current=0,setTimeout(()=>{L(X,"ceo")},ry))},[x,L])}}const Sv=[[1,8],[3,5],[8,1],[5,3]],lA=[[1,4],[2,3],[4,1],[3,2]];function Cu(e){const n=e===1||e===3?-1:0,a=Sv[e],i=e<2?[0,1]:[1,0],o=n;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:a[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:a[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 Eu(e){const n=e===1||e===3?-1:0,a=Sv[e],i=e<2?[0,1]:[1,0],o=n;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[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 Hl(e,n){const a=e===1||e===3?-1:0,i=lA[e],o=a,u=e%2===0?1:0;return n?[{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 ay={down:[Cu(0),Cu(1),Cu(2),Cu(3)],up:[Eu(0),Eu(1),Eu(2),Eu(3)],right:[Hl(0,!0),Hl(1,!0),Hl(2,!0),Hl(3,!0)],left:[Hl(0,!1),Hl(1,!1),Hl(2,!1),Hl(3,!1)]},Te="#FAFAF7",Hn="#FFFFFF",De="#EDE8E2",nt="#DDD6CC",qo="#1A1A2E",nd="#2A2A2A",Zm="#FFB0B0",ly=[{x:2,y:0,w:1,h:1,c:De},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Hn},{x:5,y:0,w:1,h:1,c:Te},{x:6,y:0,w:1,h:1,c:De},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:Te},{x:3,y:1,w:1,h:1,c:Hn},{x:4,y:1,w:1,h:1,c:Te},{x:5,y:1,w:1,h:1,c:Hn},{x:6,y:1,w:1,h:1,c:Te},{x:7,y:1,w:1,h:1,c:nt},{x:0,y:2,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Hn},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:nt},{x:1,y:3,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:Te},{x:3,y:3,w:1,h:1,c:qo},{x:4,y:3,w:1,h:1,c:Te},{x:5,y:3,w:1,h:1,c:qo},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:De},{x:3,y:4,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:nd},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:3,y:5,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:nt},{x:2,y:6,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:Te},{x:4,y:6,w:1,h:1,c:Hn},{x:5,y:6,w:1,h:1,c:Te},{x:6,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:nt},{x:3,y:7,w:1,h:1,c:De},{x:4,y:7,w:1,h:1,c:Te},{x:5,y:7,w:1,h:1,c:De},{x:6,y:7,w:1,h:1,c:nt}],iA=[{x:3,y:8,w:1,h:1,c:De},{x:5,y:8,w:1,h:1,c:De},{x:3,y:9,w:1,h:1,c:nt},{x:5,y:9,w:1,h:1,c:nt}],sA=[{x:2,y:8,w:1,h:1,c:De},{x:6,y:8,w:1,h:1,c:De},{x:2,y:9,w:1,h:1,c:nt},{x:6,y:9,w:1,h:1,c:nt}],iy=[{x:2,y:0,w:1,h:1,c:De},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Hn},{x:5,y:0,w:1,h:1,c:Te},{x:6,y:0,w:1,h:1,c:De},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:De},{x:7,y:1,w:1,h:1,c:nt},{x:0,y:2,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:nt},{x:1,y:3,w:1,h:1,c:nt},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:Te},{x:5,y:3,w:1,h:1,c:Te},{x:6,y:3,w:1,h:1,c:De},{x:7,y:3,w:1,h:1,c:nt},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:De},{x:6,y:4,w:1,h:1,c:nt},{x:3,y:5,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:nt},{x:2,y:6,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:Te},{x:4,y:6,w:1,h:1,c:Te},{x:5,y:6,w:1,h:1,c:Te},{x:6,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:nt},{x:3,y:7,w:1,h:1,c:De},{x:4,y:7,w:1,h:1,c:Te},{x:5,y:7,w:1,h:1,c:De},{x:6,y:7,w:1,h:1,c:nt},{x:4,y:5,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:Hn}],oA=[{x:3,y:8,w:1,h:1,c:De},{x:5,y:8,w:1,h:1,c:De},{x:3,y:9,w:1,h:1,c:nt},{x:5,y:9,w:1,h:1,c:nt}],cA=[{x:2,y:8,w:1,h:1,c:De},{x:6,y:8,w:1,h:1,c:De},{x:2,y:9,w:1,h:1,c:nt},{x:6,y:9,w:1,h:1,c:nt}],bm=[{x:8,y:0,w:1,h:1,c:De},{x:9,y:0,w:1,h:1,c:Te},{x:10,y:0,w:1,h:1,c:Hn},{x:11,y:0,w:1,h:1,c:Te},{x:7,y:1,w:1,h:1,c:nt},{x:8,y:1,w:1,h:1,c:Te},{x:9,y:1,w:1,h:1,c:Hn},{x:10,y:1,w:1,h:1,c:Te},{x:11,y:1,w:1,h:1,c:Te},{x:12,y:1,w:1,h:1,c:De},{x:0,y:2,w:1,h:1,c:Hn},{x:1,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:De},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:De},{x:8,y:2,w:1,h:1,c:Te},{x:9,y:2,w:1,h:1,c:Te},{x:10,y:2,w:1,h:1,c:Te},{x:11,y:2,w:1,h:1,c:Te},{x:12,y:2,w:1,h:1,c:De},{x:0,y:3,w:1,h:1,c:De},{x:1,y:3,w:1,h:1,c:nt},{x:3,y:3,w:1,h:1,c:nt},{x:4,y:3,w:1,h:1,c:De},{x:5,y:3,w:1,h:1,c:Te},{x:6,y:3,w:1,h:1,c:De},{x:7,y:3,w:1,h:1,c:nt},{x:8,y:3,w:1,h:1,c:Te},{x:9,y:3,w:1,h:1,c:qo},{x:10,y:3,w:1,h:1,c:Te},{x:11,y:3,w:1,h:1,c:De},{x:3,y:4,w:1,h:1,c:nt},{x:4,y:4,w:1,h:1,c:De},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:8,y:4,w:1,h:1,c:De},{x:9,y:4,w:1,h:1,c:Te},{x:10,y:4,w:1,h:1,c:nd}],Cv=[{x:4,y:5,w:1,h:1,c:De},{x:6,y:5,w:1,h:1,c:De},{x:8,y:5,w:1,h:1,c:De},{x:10,y:5,w:1,h:1,c:De},{x:4,y:6,w:1,h:1,c:nt},{x:6,y:6,w:1,h:1,c:nt},{x:8,y:6,w:1,h:1,c:nt},{x:10,y:6,w:1,h:1,c:nt}],Ev=[{x:3,y:5,w:1,h:1,c:De},{x:5,y:5,w:1,h:1,c:De},{x:9,y:5,w:1,h:1,c:De},{x:11,y:5,w:1,h:1,c:De},{x:3,y:6,w:1,h:1,c:nt},{x:5,y:6,w:1,h:1,c:nt},{x:9,y:6,w:1,h:1,c:nt},{x:11,y:6,w:1,h:1,c:nt}];function Jm(e,n=13){return e.map(a=>({...a,x:n-1-a.x}))}const sy=Jm(bm),uA=Jm(Cv),dA=Jm(Ev),fA={down:[[...ly,...iA],[...ly,...sA]],up:[[...iy,...oA],[...iy,...cA]],right:[[...bm,...Cv],[...bm,...Ev]],left:[[...sy,...uA],[...sy,...dA]]},hA=[{x:4,y:5,w:1,h:1,c:Zm}],_n="#FFD4D4",Zr="#FFCCD5",mA=[{x:2,y:0,w:1,h:1,c:nt},{x:3,y:0,w:1,h:1,c:De},{x:4,y:0,w:1,h:1,c:Te},{x:5,y:0,w:1,h:1,c:Hn},{x:6,y:0,w:1,h:1,c:De},{x:7,y:0,w:1,h:1,c:nt},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:Hn},{x:7,y:1,w:1,h:1,c:De},{x:8,y:1,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:qo},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:qo},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:nd},{x:5,y:3,w:1,h:1,c:Zm},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:7,y:4,w:1,h:1,c:nt},{x:0,y:5,w:1,h:1,c:De},{x:1,y:5,w:1,h:1,c:Zr},{x:2,y:5,w:1,h:1,c:Te},{x:3,y:5,w:1,h:1,c:_n},{x:4,y:5,w:1,h:1,c:_n},{x:5,y:5,w:1,h:1,c:_n},{x:6,y:5,w:1,h:1,c:_n},{x:7,y:5,w:1,h:1,c:Te},{x:8,y:5,w:1,h:1,c:Zr},{x:9,y:5,w:1,h:1,c:De},{x:1,y:6,w:1,h:1,c:De},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:_n},{x:4,y:6,w:1,h:1,c:Zr},{x:5,y:6,w:1,h:1,c:Zr},{x:6,y:6,w:1,h:1,c:_n},{x:7,y:6,w:1,h:1,c:Te},{x:8,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:Te},{x:3,y:7,w:1,h:1,c:_n},{x:4,y:7,w:1,h:1,c:_n},{x:5,y:7,w:1,h:1,c:_n},{x:6,y:7,w:1,h:1,c:_n},{x:7,y:7,w:1,h:1,c:Te},{x:0,y:8,w:1,h:1,c:De},{x:1,y:8,w:1,h:1,c:Zr},{x:2,y:8,w:1,h:1,c:nt},{x:3,y:8,w:1,h:1,c:De},{x:4,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:De},{x:7,y:8,w:1,h:1,c:nt},{x:8,y:8,w:1,h:1,c:Zr},{x:9,y:8,w:1,h:1,c:De},{x:4,y:9,w:1,h:1,c:Te},{x:5,y:9,w:1,h:1,c:Hn}],pA=[{x:2,y:0,w:1,h:1,c:nt},{x:3,y:0,w:1,h:1,c:De},{x:4,y:0,w:1,h:1,c:Te},{x:5,y:0,w:1,h:1,c:Hn},{x:6,y:0,w:1,h:1,c:De},{x:7,y:0,w:1,h:1,c:nt},{x:1,y:1,w:1,h:1,c:nt},{x:2,y:1,w:1,h:1,c:De},{x:3,y:1,w:1,h:1,c:Te},{x:4,y:1,w:1,h:1,c:Hn},{x:5,y:1,w:1,h:1,c:Te},{x:6,y:1,w:1,h:1,c:Hn},{x:7,y:1,w:1,h:1,c:De},{x:8,y:1,w:1,h:1,c:nt},{x:1,y:2,w:1,h:1,c:De},{x:2,y:2,w:1,h:1,c:Te},{x:3,y:2,w:1,h:1,c:De},{x:4,y:2,w:1,h:1,c:Te},{x:5,y:2,w:1,h:1,c:Te},{x:6,y:2,w:1,h:1,c:De},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:De},{x:2,y:3,w:1,h:1,c:De},{x:3,y:3,w:1,h:1,c:Te},{x:4,y:3,w:1,h:1,c:nd},{x:5,y:3,w:1,h:1,c:Zm},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:De},{x:2,y:4,w:1,h:1,c:nt},{x:3,y:4,w:1,h:1,c:De},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:De},{x:7,y:4,w:1,h:1,c:nt},{x:0,y:5,w:1,h:1,c:De},{x:1,y:5,w:1,h:1,c:Zr},{x:2,y:5,w:1,h:1,c:Te},{x:3,y:5,w:1,h:1,c:_n},{x:4,y:5,w:1,h:1,c:_n},{x:5,y:5,w:1,h:1,c:_n},{x:6,y:5,w:1,h:1,c:_n},{x:7,y:5,w:1,h:1,c:Te},{x:8,y:5,w:1,h:1,c:Zr},{x:9,y:5,w:1,h:1,c:De},{x:1,y:6,w:1,h:1,c:De},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:_n},{x:4,y:6,w:1,h:1,c:Zr},{x:5,y:6,w:1,h:1,c:Zr},{x:6,y:6,w:1,h:1,c:_n},{x:7,y:6,w:1,h:1,c:Te},{x:8,y:6,w:1,h:1,c:De},{x:2,y:7,w:1,h:1,c:Te},{x:3,y:7,w:1,h:1,c:_n},{x:4,y:7,w:1,h:1,c:_n},{x:5,y:7,w:1,h:1,c:_n},{x:6,y:7,w:1,h:1,c:_n},{x:7,y:7,w:1,h:1,c:Te},{x:0,y:8,w:1,h:1,c:De},{x:1,y:8,w:1,h:1,c:Zr},{x:2,y:8,w:1,h:1,c:nt},{x:3,y:8,w:1,h:1,c:De},{x:4,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:De},{x:7,y:8,w:1,h:1,c:nt},{x:8,y:8,w:1,h:1,c:Zr},{x:9,y:8,w:1,h:1,c:De},{x:5,y:9,w:1,h:1,c:Te},{x:6,y:9,w:1,h:1,c:Hn}],xA=[{x:1,y:9,w:7,h:1,c:"#100A06",a:.12}],gA=[{x:2,y:6,w:9,h:1,c:"#100A06",a:.12}],yA=[{x:1,y:10,w:8,h:1,c:"#100A06",a:.12}],ut=4,rn=28,In=2,zt=4,St=4,al=[{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 ep(e,n,a){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(n,a),f=Math.ceil(n/d),m=[],h=d*28,x=e.fx+Math.max(8,Math.floor((e.fw-h)/2));for(let g=0;g<f&&m.length<n;g++){const v=Math.min(d,n-g*d);for(let b=0;b<v;b++)m.push({dx:x+b*28,dy:u+g*28,room:e.id})}return m}function bA(e){const i=al[0],o={id:"main",wx:ut+St,wy:ut,ww:160-2*(ut+St),wh:rn,fx:ut+St,fy:ut+rn+In,fw:160-2*(ut+St),fh:120-ut-rn-In-ut,...i},u=ep(o,Math.min(e,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(ut+St))/2),offsetY:10}],f=[{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:d,furniture:f}}function vA(e){const o={id:"exec",wx:ut+St,wy:ut,ww:144-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In,fw:144-ut-St-zt/2,fh:66,...al[0]},u={id:"work",wx:144+zt/2+St,wy:ut,ww:144-zt/2-St-ut,wh:rn,fx:144+zt/2+St,fy:ut+rn+In,fw:144-zt/2-St-ut,fh:66,...al[1]},d={id:"meet",wx:ut+St,wy:ut+rn+In+66+zt,ww:144-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In+66+zt+rn+In,fw:144-ut-St-zt/2,fh:70,...al[2]},f={id:"comm",wx:144+zt/2+St,wy:ut+rn+In+66+zt,ww:144-zt/2-St-ut,wh:rn,fx:144+zt/2+St,fy:ut+rn+In+66+zt+rn+In,fw:144-zt/2-St-ut,fh:70,...al[3]},m={exec:o,work:u,meet:d,comm:f},h=[];let x=e;const g=[[o,Math.min(3,x)],[u,0]];g[1][1]=Math.min(3,x-g[0][1]);const v=[[d,0],[f,0]];let b=x-g[0][1]-g[1][1];b>0&&(v[0][1]=Math.min(2,b),b-=v[0][1]),b>0&&(v[1][1]=Math.min(2,b));for(const[R,I]of[...g,...v])I>0&&h.push(...ep(R,I,3));const j=ut+rn+In+66,k=144-zt/2,N={exec_work:{id:"exec_work",type:"v",doorY:ut+rn+In+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:ut+rn+In+66+zt+rn+In+20+12,xA:k-2,xB:f.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:ut+St+40+14,yA:j-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+zt/2+St+40+14,yA:j-2,yB:f.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"}]},C={exec:o.fy+52,work:u.fy+48,meet:d.fy+56,comm:f.fy+54},_={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:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:f.fx+96,y:f.fy+8},{x:f.fx+60,y:f.fy+54},{x:f.fx+40,y:f.fy+54},{x:f.fx+20,y:f.fy+54}]},M=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(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:42,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:m,desks:h,doors:N,adjacency:E,corridorY:C,waypoints:_,wallDecorations:M,furniture:L}}function wA(e){const d={id:"exec",wx:ut+St,wy:ut,ww:180-ut-St-zt/2,wh:rn,fx:ut+St,fy:ut+rn+In,fw:180-ut-St-zt/2,fh:82,...al[0]},f={id:"work",wx:180+zt/2+St,wy:ut,ww:180-zt/2-St-ut,wh:rn,fx:180+zt/2+St,fy:ut+rn+In,fw:180-zt/2-St-ut,fh:82,...al[1]},m=ut+rn+In+82,h={id:"meet",wx:ut+St,wy:m+zt,ww:180-ut-St-zt/2,wh:rn,fx:ut+St,fy:m+zt+rn+In,fw:180-ut-St-zt/2,fh:86,...al[2]},x={id:"comm",wx:180+zt/2+St,wy:m+zt,ww:180-zt/2-St-ut,wh:rn,fx:180+zt/2+St,fy:m+zt+rn+In,fw:180-zt/2-St-ut,fh:86,...al[3]},g={exec:d,work:f,meet:h,comm:x},v=[];let b=e;const j=[[d,Math.min(5,b)],[f,0]];j[1][1]=Math.min(5,b-j[0][1]);const k=[[h,0],[x,0]];let N=b-j[0][1]-j[1][1];N>0&&(k[0][1]=Math.min(3,N),N-=k[0][1]),N>0&&(k[1][1]=Math.min(3,N));for(const[X,J]of[...j,...k])J>0&&v.push(...ep(X,J,4));const E=180-zt/2,C={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:E-2,xB:f.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:h.fy+86/2,xA:E-2,xB:x.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:m-2,yB:h.fy+2},work_comm:{id:"work_comm",type:"h",doorX:f.fx+54,yA:m-2,yB:x.fy+2}},_={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"}]},M={exec:d.fy+82-12,work:f.fy+82-12,meet:h.fy+86-12,comm:x.fy+86-12},L={exec:[{x:d.fx+10,y:M.exec},{x:d.fx+d.fw/2,y:M.exec},{x:d.fx+d.fw-10,y:M.exec}],work:[{x:f.fx+10,y:M.work},{x:f.fx+f.fw/2,y:M.work},{x:f.fx+f.fw-10,y:M.work}],meet:[{x:h.fx+10,y:M.meet},{x:h.fx+h.fw/2,y:M.meet},{x:h.fx+h.fw-10,y:M.meet}],comm:[{x:x.fx+10,y:M.comm},{x:x.fx+x.fw/2,y:M.comm},{x:x.fx+x.fw-10,y:M.comm}]},R=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:42,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:g,desks:v,doors:C,adjacency:_,corridorY:M,waypoints:L,wallDecorations:R,furniture:I}}const kA=2;function Nv(e,n,a){return a||(n?n==="L"&&e<=12-kA?"M":n==="M"&&e>12?"L":n:e<=12?"M":"L")}function Av(e,n){switch(n??Nv(e)){case"S":return bA(e);case"M":return vA(e);case"L":return wA(e)}}function jA(e,n){if(!n||Object.keys(n).length===0)return e;const a=i=>i.map(o=>{const u=n[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...e,wallDecorations:a(e.wallDecorations),furniture:a(e.furniture)}}function SA(e,n){if(n)for(const[a,i]of Object.entries(n))e[a]&&(e[a]={...e[a],dx:i.dx,dy:i.dy})}function oy(e,n){if(!n||n.length===0)return e;const a=new Set(n);return{...e,wallDecorations:e.wallDecorations.filter(i=>!a.has(i.id)),furniture:e.furniture.filter(i=>!a.has(i.id))}}function CA(e,n){if(!n||n.length===0)return e;const a=[],i=[];for(const o of n)o.zone==="wall"?a.push(o):i.push(o);return{...e,wallDecorations:[...e.wallDecorations,...a],furniture:[...e.furniture,...i]}}let zo;function EA(e){zo=e}function $(e,n,a,i,o,u){e=Math.round(e),n=Math.round(n),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(zo.globalAlpha=u),zo.fillStyle=o,zo.fillRect(e,n,a,i),u!==void 0&&u!==1&&(zo.globalAlpha=1))}function ot(e,n,a,i){$(e,n,1,1,a,i)}let Bu=1;function As(e){Bu=e}function Na(){return Bu=Bu*16807%2147483647,(Bu&65535)/65535}function Dv(e){const n=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,o=Math.max(n,a,i),u=Math.min(n,a,i);let d=0,f=0;const m=(o+u)/2;if(o!==u){const h=o-u;f=m>.5?h/(2-o-u):h/(o+u),o===n?d=((a-i)/h+(a<i?6:0))/6:o===a?d=((i-n)/h+2)/6:d=((n-a)/h+4)/6}return[d*360,f*100,m*100]}function Tv(e,n,a){e=(e%360+360)%360,n=Math.max(0,Math.min(100,n))/100,a=Math.max(0,Math.min(100,a))/100;const i=n*Math.min(a,1-a),o=d=>{const f=(d+e/30)%12;return a-i*Math.max(-1,Math.min(f-3,9-f,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(o(0))+u(o(8))+u(o(4))}function Aa(e,n=1){const[a,i,o]=Dv(e);return Tv(a+15*n,Math.min(100,i+8),o-12*n)}function vn(e,n=1){const[a,i,o]=Dv(e);return Tv(a-10*n,i-3,o+10*n)}const Ln={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Br={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},va={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Jr="#100A06";function NA(e,n,a=14,i=12){$(e,n,a,i,"#4A3828"),$(e+1,n+1,a-2,i-2,"#5A4838"),$(e+2,n+2,a-4,i-4,"#4A7098"),$(e+2,n+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(a/2);$(e+o,n+1,1,i-2,"#4A3828"),$(e+1,n+Math.floor(i/2),a-2,1,"#4A3828",.5),ot(e+3,n+3,"#8AB8E8",.35),ot(e+o+2,n+3,"#8AB8E8",.25),$(e-1,n+i,a+2,2,"#5A4838"),$(e-1,n+i,a+2,1,vn("#5A4838",.5),.35)}function AA(e,n,a){$(e,n,10,8,"#3A2818"),$(e+1,n+1,8,6,a),$(e+2,n+2,4,3,vn(a,1.2),.3),ot(e+3,n+2,vn(a,2),.25)}function DA(e,n){$(e,n,7,7,"#3A2818"),$(e+1,n+1,5,5,"#F0EDE5"),ot(e+3,n+1,"#AAA"),ot(e+3,n+5,"#AAA"),ot(e+1,n+3,"#AAA"),ot(e+5,n+3,"#AAA"),ot(e+3,n+3,"#222"),$(e+3,n+1,1,2,"#333"),ot(e+4,n+3,"#D32F2F")}function TA(e,n){$(e,n,26,16,"#586878"),$(e+1,n+1,24,13,"#ECEFF1"),$(e+1,n+1,24,1,"#F5F5F5",.4),$(e+3,n+3,14,1,"#1565C0",.6),$(e+3,n+5,18,1,"#333",.2),$(e+3,n+7,12,1,"#D32F2F",.35),$(e+3,n+9,16,1,"#333",.15),$(e+1,n+14,24,2,"#708898"),$(e+3,n+14,3,1,"#D32F2F"),$(e+7,n+14,3,1,"#1565C0"),$(e+11,n+14,3,1,"#2E7D32")}function FA(e,n){$(e,n,22,16,"#6A5030"),$(e+1,n+1,20,14,"#C4A66A"),As(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)Na()>.5&&ot(e+1+i,n+1+a,Na()>.5?"#B89858":"#D4B87A",.18);$(e+2,n+2,5,4,"#FFF176"),$(e+8,n+2,5,4,"#90CAF9"),$(e+14,n+3,5,4,"#CE93D8"),$(e+3,n+8,7,4,"#C8E6C9"),$(e+11,n+8,8,4,"#F8BBD0"),ot(e+4,n+2,"#E53935"),ot(e+10,n+2,"#1E88E5"),ot(e+16,n+3,"#FF9800")}function RA(e,n){$(e,n,20,3,"#5A4030"),$(e,n,20,1,vn("#5A4030",.5),.35),$(e,n+2,20,1,Aa("#5A4030",.5),.3),$(e+2,n-4,3,4,"#E53935"),$(e+2,n-4,3,1,vn("#E53935",1),.3),$(e+6,n-3,2,3,"#1E88E5"),$(e+9,n-5,4,5,"#43A047"),$(e+14,n-3,3,3,"#FFD54F"),ot(e+15,n-3,"#FFF176",.4)}function MA(e,n){$(e,n,16,12,"#1E1E28"),$(e+1,n+1,14,9,"#0C1420"),$(e+2,n+2,12,1,"#EF4444",.6),ot(e+2,n+4,"#4CAF50"),$(e+4,n+4,7,1,"#8b949e",.4),ot(e+2,n+6,"#FF9800"),$(e+4,n+6,5,1,"#8b949e",.3),ot(e+2,n+8,"#42A5F5"),$(e+4,n+8,8,1,"#8b949e",.25),$(e+7,n+10,2,2,"#1E1E28"),$(e+5,n+11,6,1,"#586878")}function zA(e,n,a){$(e+2,n+20,22,2,Jr,.15),$(e,n,22,20,Br.deep),$(e+1,n+1,20,18,Br.base),$(e,n,22,1,Br.hi,.35),$(e,n,1,20,Br.hi,.2);for(const u of[6,12])$(e+1,n+u,20,2,Br.sh),$(e+1,n+u,20,1,Br.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=e+2;for(let u=0;u<5;u++){const d=2+u%2;$(o,n+1,d,5,i[u]),$(o,n+1,d,1,vn(i[u],1),.35),o+=d+1}o=e+2;for(let u=0;u<4;u++)$(o,n+7,4,5,i[u+3]),$(o,n+7,4,1,vn(i[u+3],1),.25),o+=5;$(e+2,n+14,4,4,"#FFD54F"),$(e+8,n+14,7,4,"#90CAF9"),a&&$(e,n-1,22,1,a,.7)}function _A(e,n){$(e+2,n+11,6,2,Jr,.1),$(e+2,n+8,6,4,"#8B5E3C"),$(e+1,n+7,8,2,Aa("#A06E48",.3)),$(e+2,n+7,6,1,vn("#A06E48",.5),.4),$(e+1,n+3,3,4,"#2E7D32"),$(e+5,n+2,3,4,"#2E7D32"),$(e+2,n+1,4,4,"#43A047"),$(e+3,n+0,3,3,"#66BB6A"),ot(e+4,n,"#81C784"),ot(e+3,n+1,"#A5D6A7",.4)}function BA(e,n){wi(e+4,n-4,"down"),wi(e+16,n-4,"down"),wi(e+28,n-4,"down"),$(e+3,n+24,34,3,Jr,.15),$(e,n+2,36,18,Ln.deep),$(e+1,n+3,34,16,Ln.base),$(e+1,n+3,34,1,Ln.hi,.35);for(let a=0;a<14;a+=3)$(e+1,n+4+a,34,1,Aa(Ln.base,.2),.08);$(e,n+20,36,4,Ln.deep),$(e+1,n+21,34,2,Ln.sh),$(e+6,n+7,10,6,"#1A1A24"),$(e+7,n+8,8,4,"#0C1420"),$(e+8,n+9,4,1,"#2A6898",.4),$(e+20,n+8,6,4,"#F0F0F0"),$(e+15,n+7,3,3,"#ECEFF1"),ot(e+16,n+8,"#795548"),wi(e+4,n+24,"up"),wi(e+16,n+24,"up"),wi(e+28,n+24,"up")}function OA(e,n){$(e+2,n+16,36,3,Jr,.15),$(e,n,36,5,"#5D4037"),$(e+1,n+1,34,3,"#6D4C41"),$(e+1,n+1,34,1,vn("#6D4C41",.5),.3),$(e,n+5,36,8,"#5D4037"),$(e+2,n+6,15,6,"#6D4C41"),$(e+3,n+6,13,1,vn("#6D4C41",.5),.35),$(e+19,n+6,15,6,"#6D4C41"),$(e+20,n+6,13,1,vn("#6D4C41",.5),.35),$(e+17,n+6,2,6,"#5D4037"),$(e,n+13,36,3,Aa("#5D4037",1)),$(e-2,n+2,3,12,"#5D4037"),$(e+35,n+2,3,12,"#5D4037"),$(e+4,n+7,6,4,"#FF8A65"),$(e+5,n+7,4,1,vn("#FF8A65",1),.35)}function $A(e,n){$(e+2,n+10,22,2,Jr,.12),$(e,n,22,8,Br.deep),$(e+1,n+1,20,6,Br.base),$(e+1,n+1,20,1,Br.hi,.3),$(e,n+8,22,2,Br.sh),$(e+3,n+2,6,4,"#F0F0F0"),$(e+13,n+3,3,3,"#ECEFF1"),ot(e+14,n+4,"#795548")}function LA(e,n){$(e+1,n+14,10,2,Jr,.12),$(e,n,10,14,"#546E7A"),$(e,n,10,1,vn("#546E7A",1),.35),$(e+1,n+1,8,3,"#78909C"),$(e+1,n+5,8,4,"#37474F"),ot(e+2,n+6,"#EF5350"),ot(e+4,n+6,"#66BB6A"),$(e+2,n+11,4,2,"#ECEFF1")}function IA(e,n){$(e+2,n+18,28,3,Jr,.12),$(e,n,28,18,"#37474F"),$(e+1,n+1,26,15,"#0D47A1"),$(e+2,n+2,24,13,"#1565C0"),$(e+2,n+2,24,4,"#1976D2",.4),$(e+2,n+12,24,3,"#F9A825",.35),$(e+4,n+8,2,5,"#2E7D32"),$(e+6,n+9,2,4,"#43A047"),$(e+20,n+7,2,6,"#2E7D32"),$(e+22,n+8,2,5,"#388E3C"),$(e+9,n+5,4,2,"#FF8A65"),ot(e+12,n+5,"#FF5722"),$(e+16,n+8,3,2,"#FFD54F"),ot(e+15,n+8,"#FFC107"),ot(e+13,n+3,"#90CAF9",.5),ot(e+14,n+4,"#BBDEFB",.35),ot(e+8,n+3,"#BBDEFB",.3),$(e,n+16,28,2,"#455A64"),$(e+1,n+16,26,1,vn("#455A64",.5),.3)}function HA(e,n){$(e,n,24,10,"#1A1A2E"),$(e+2,n+1,20,8,"#E040FB",.15),$(e+3,n+2,4,6,"#E040FB",.7),$(e+4,n+3,2,4,"#1A1A2E"),$(e+8,n+2,1,6,"#00E5FF",.7),$(e+8,n+2,4,1,"#00E5FF",.7),$(e+8,n+4,4,1,"#00E5FF",.7),$(e+11,n+2,1,3,"#00E5FF",.7),$(e+13,n+2,1,6,"#E040FB",.7),$(e+13,n+2,4,1,"#E040FB",.7),$(e+13,n+4,3,1,"#E040FB",.7),$(e+13,n+7,4,1,"#E040FB",.7),$(e+18,n+2,1,6,"#00E5FF",.7),$(e+21,n+2,1,6,"#00E5FF",.7),$(e+19,n+3,1,2,"#00E5FF",.5),$(e+20,n+5,1,2,"#00E5FF",.5)}function UA(e,n){$(e+2,n+28,16,3,Jr,.15),$(e,n,16,28,"#1A237E"),$(e+1,n+1,14,3,"#283593"),$(e+2,n+4,12,10,"#0D1117"),$(e+3,n+5,10,8,"#1B5E20"),$(e+5,n+6,2,2,"#4CAF50"),$(e+9,n+8,2,2,"#FF5722"),$(e+7,n+10,3,1,"#FFD54F"),ot(e+6,n+7,"#81C784"),$(e+1,n+14,14,6,"#1A237E"),$(e+2,n+15,4,4,"#212121"),ot(e+4,n+16,"#F44336"),ot(e+9,n+16,"#F44336"),ot(e+11,n+16,"#2196F3"),ot(e+10,n+18,"#FFEB3B"),$(e,n+20,16,8,"#0D47A1"),$(e+1,n+21,14,6,"#1565C0"),$(e,n+4,1,14,"#FF4081",.4),$(e+15,n+4,1,14,"#FF4081",.4)}function qA(e,n){$(e+2,n+24,20,3,Jr,.15),$(e,n,20,24,"#4E342E"),$(e+1,n+1,18,22,"#5D4037"),$(e+2,n+1,16,4,"#FF6F00"),$(e+3,n+2,14,2,"#FF8F00",.6),$(e+2,n+5,16,10,"#1A1A2E"),$(e+3,n+6,14,8,"#212121"),$(e+4,n+7,4,4,"#333"),$(e+5,n+8,2,2,"#E53935"),$(e+10,n+7,4,4,"#333"),$(e+11,n+8,2,2,"#1E88E5"),$(e+3,n+16,14,6,"#3E2723");for(let a=0;a<7;a++)$(e+4+a*2,n+17,1,4,"#5D4037",.5);$(e+1,n+5,18,1,"#FFD54F",.5),$(e+1,n+15,18,1,"#FFD54F",.5)}function YA(e,n){$(e+2,n+22,22,2,Jr,.12),$(e,n,22,22,Br.deep),$(e+1,n+1,20,20,"#37474F"),$(e+2,n+2,18,18,"#546E7A",.3),$(e+1,n+10,20,1,Br.base),$(e+1,n+10,20,1,Br.hi,.2),$(e+4,n+3,4,5,"#FFD54F"),$(e+5,n+4,2,3,"#FFC107"),$(e+4,n+7,4,1,"#FFA000"),ot(e+5,n+3,"#FFF176",.5),$(e+13,n+4,4,4,"#B0BEC5"),$(e+14,n+3,2,1,"#CFD8DC"),ot(e+14,n+5,"#ECEFF1",.6),$(e+5,n+12,3,3,"#A1887F"),$(e+6,n+11,1,1,"#D7CCC8"),$(e+12,n+12,6,4,"#5D4037"),$(e+13,n+13,4,2,"#FFD54F",.6),$(e+2,n+2,2,18,"#fff",.08)}function XA(e,n){$(e+2,n+16,26,3,Jr,.18),$(e,n,26,10,Ln.deep),$(e+1,n+1,24,8,Ln.base),$(e+1,n+2,24,1,Ln.hi,.2),$(e+1,n+4,24,1,Aa(Ln.base,.2),.1),$(e+1,n+6,24,1,Ln.hi,.15),$(e+1,n+1,24,1,Ln.hi,.4),$(e+1,n+1,1,8,Ln.hi,.2),$(e,n+10,26,5,Ln.deep),$(e+1,n+11,24,3,Ln.sh),$(e+1,n+10,24,1,Aa(Ln.base,1.5),.4),$(e+1,n+14,24,1,Ln.base,.15),$(e+2,n+12,10,1,Ln.deep,.4),$(e+14,n+12,10,1,Ln.deep,.4),ot(e+7,n+11,"#C8D0D8",.6),ot(e+19,n+11,"#C8D0D8",.6),$(e+6,n-5,14,7,"#1E1E28"),$(e+7,n-4,12,5,"#0C1420"),$(e+8,n-3,5,1,"#2A6898",.6),$(e+8,n-2,8,1,"#1A3858",.4),$(e+8,n-1,3,1,"#2A6898",.35),ot(e+7,n-4,"#4A98D8",.25),ot(e+12,n+1,"#4CAF50",.4),$(e+12,n+2,2,3,"#586878"),$(e+10,n+4,6,1,"#8898A8"),$(e+6,n+4,12,4,"#222228"),$(e+6,n+4,12,1,"#333338",.4);for(let a=0;a<5;a++)ot(e+7+a*2,n+5,"#444",.6),ot(e+7+a*2,n+6,"#3A3A3E",.4);$(e+20,n+5,3,4,"#333338"),$(e+20,n+5,3,1,"#444448"),$(e+1,n+3,4,4,"#F0EDE8"),$(e+1,n+3,4,1,"#F8F6F2"),ot(e+2,n+5,"#6D4C41")}function wi(e,n,a){$(e+1,n+9,10,2,Jr,.1),ot(e+5,n+9,"#1E1E22"),ot(e+1,n+10,"#1A1A1E"),ot(e+9,n+10,"#1A1A1E"),ot(e+3,n+11,"#1A1A1E"),ot(e+7,n+11,"#1A1A1E"),$(e+1,n+2,8,6,va.base),$(e+2,n+3,6,4,va.hi,.35),$(e+2,n+3,6,1,vn(va.hi,.5),.25),$(e+1,n+7,8,1,va.deep),a==="up"?($(e,n+7,10,3,va.deep),$(e+1,n+8,8,1,va.sh)):($(e,n-1,10,3,va.deep),$(e+1,n,8,1,va.sh)),$(e,n+3,1,4,va.sh),$(e+9,n+3,1,4,va.sh)}const Fv={bookshelf:(e,n,a)=>zA(e,n,a.accent),plant:(e,n)=>_A(e,n),"meeting-table":(e,n)=>BA(e,n),sofa:(e,n)=>OA(e,n),"coffee-table":(e,n)=>$A(e,n),"coffee-machine":(e,n)=>LA(e,n),window:(e,n,a)=>NA(e,n,a.windowW??16,a.windowH??14),picture:(e,n,a)=>AA(e,n,a.pictureColor??"#1565C0"),clock:(e,n)=>DA(e,n),whiteboard:(e,n)=>TA(e,n),"bulletin-board":(e,n)=>FA(e,n),shelf:(e,n)=>RA(e,n),screen:(e,n)=>MA(e,n),aquarium:(e,n)=>IA(e,n),"neon-sign":(e,n)=>HA(e,n),arcade:(e,n)=>UA(e,n),jukebox:(e,n)=>qA(e,n),"trophy-case":(e,n)=>YA(e,n)};function ks(e,n){const a=e.zone==="wall"?n.wx:n.fx,i=e.zone==="wall"?n.wy:n.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?n.wx+n.ww:n.fx+n.fw)+e.offsetX:a+e.offsetX,y:i+e.offsetY}}function WA(e){for(const n of e.wallDecorations){const a=e.rooms[n.room];if(!a)continue;const{x:i,y:o}=ks(n,a),u=Fv[n.type];u&&u(i,o,n)}}function VA(e,n,a){for(const i of e.furniture){const o=e.rooms[i.room];if(!o||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:d}=ks(i,o),f=Fv[i.type];f&&n.push({y:d,draw:()=>f(u,d,i)})}}function ki(e){const n=[],a=[...e.wallDecorations,...e.furniture];for(const i of a){if(!i.facility)continue;const o=e.rooms[i.room];if(!o)continue;const{x:u,y:d}=ks(i,o);n.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return n}const GA={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12},aquarium:{w:28,h:18},"neon-sign":{w:24,h:10},arcade:{w:16,h:28},jukebox:{w:20,h:24},"trophy-case":{w:22,h:22}};function vm(e){return GA[e]??{w:16,h:16}}function $h(e,n,a,i){for(let o=e.furniture.length-1;o>=0;o--){const u=e.furniture[o],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:f,y:m}=ks(u,d),h=vm(u.type);if(n>=f&&n<=f+h.w&&a>=m&&a<=m+h.h)return u.id}for(let o=e.wallDecorations.length-1;o>=0;o--){const u=e.wallDecorations[o],d=e.rooms[u.room];if(!d)continue;const{x:f,y:m}=ks(u,d),h=vm(u.type);if(n>=f&&n<=f+h.w&&a>=m&&a<=m+h.h)return u.id}return null}function cy(e,n,a,i,o){const d=[...n.wallDecorations,...n.furniture].find(g=>g.id===a);if(!d||d.condition==="no-desks"&&o.has(d.room))return;const f=n.rooms[d.room];if(!f)return;const{x:m,y:h}=ks(d,f),x=vm(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(m-1,h-1,x.w+2,x.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(m-.5,h-.5,x.w+1,x.h+1),e.restore()}function uy(e,n,a,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(n-1,a-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(n-.5,a-.5,27,41),e.restore()}function dy(e,n,a){for(const[i,o]of Object.entries(e))if(n>=o.dx&&n<=o.dx+26&&a>=o.dy&&a<=o.dy+40)return i;return null}const fy=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴",price:0},{type:"clock",zone:"wall",label:"Clock",icon:"🕐",price:0},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚",price:500},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️",price:500},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦",price:800},{type:"window",zone:"wall",label:"Window",icon:"🪟",price:1e3},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️",price:1500},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕",price:1500},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕",price:2e3},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑",price:3e3},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋",price:3e3},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️",price:5e3},{type:"aquarium",zone:"floor",label:"Aquarium",icon:"🐠",price:5e3},{type:"neon-sign",zone:"wall",label:"Neon Sign",icon:"💡",price:3e3},{type:"arcade",zone:"floor",label:"Arcade",icon:"🕹️",price:8e3},{type:"jukebox",zone:"floor",label:"Jukebox",icon:"🎵",price:6e3},{type:"trophy-case",zone:"floor",label:"Trophy Case",icon:"🏆",price:7e3}],Nu=16,KA=4,vi=4,Ou=2,Xt=4,Yl=4;let Je=Av(7);const Gu={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},hy={ceo:{en:["Boss?","What's up?","Time for a meeting?","Got any ideas?","How's everyone doing?"],ko:["대표님?","무슨 일이신가요?","회의 시간이신가요?","좋은 아이디어 있으시면 말씀해주세요.","다들 잘하고 있나요?"],ja:["社長?","何かありますか?","会議の時間ですか?","良いアイデアがあれば教えてください。","みんな元気ですか?"]},cto:{en:["Need anything?","Tech question?","Reviewing architecture.","Deploy in a moment.","Want me to look at the code?"],ko:["뭐 필요하신 거 있으세요?","기술 관련 질문이신가요?","아키텍처 리뷰 중이에요.","배포는 조금만 기다려주세요.","코드 봐드릴까요?"],ja:["何かお手伝いしましょうか?","技術的な質問ですか?","アーキテクチャレビュー中です。","デプロイはもう少しお待ちください。","コード見ましょうか?"]},cbo:{en:["Business question?","Reviewing revenue model.","Want to see market research?","Analyzing competitors.","Can I help?"],ko:["비즈니스 관련 얘기신가요?","수익 모델 검토 중이에요.","시장 조사 결과 보실래요?","경쟁사 분석 중입니다.","뭔가 도와드릴까요?"],ja:["ビジネスの話ですか?","収益モデルを検討中です。","市場調査の結果を見ますか?","競合分析中です。","何かお手伝いしましょうか?"]},pm:{en:["Curious about progress?","Updating the roadmap.","Assigning tasks.","Need to re-prioritize?","Preparing sprint review."],ko:["프로젝트 진행 상황 궁금하신가요?","로드맵 업데이트 중이에요.","태스크 할당 중입니다.","우선순위 조정이 필요할까요?","스프린트 리뷰 준비 중이에요."],ja:["進捗が気になりますか?","ロードマップを更新中です。","タスクを割り当て中です。","優先順位の調整が必要ですか?","スプリントレビューの準備中です。"]},engineer:{en:["Working on it!","Fixing a bug.","Need a code review?","Writing tests.","Pushing a PR."],ko:["일하고 있어요!","버그 수정 중입니다.","코드 리뷰 필요하신가요?","테스트 작성 중이에요.","PR 올리고 있어요."],ja:["作業中です!","バグ修正中です。","コードレビュー必要ですか?","テスト書いてます。","PR出してます。"]},designer:{en:["Got design feedback?","Working on mockups.","Thinking about UI improvements.","Picking colors...","Want to see the prototype?"],ko:["디자인 피드백 있으신가요?","목업 작업 중이에요.","UI 개선안 생각 중입니다.","컬러 팔레트 고민 중이에요.","프로토타입 보여드릴까요?"],ja:["デザインのフィードバックありますか?","モックアップ作業中です。","UI改善案を考えています。","カラーパレットを検討中です。","プロトタイプ見せましょうか?"]},qa:{en:["Testing in progress.","Found a bug!","Writing test cases.","Running regression tests.","Quality check in progress."],ko:["테스트 중이에요.","버그 발견했어요!","테스트 케이스 작성 중입니다.","회귀 테스트 진행 중이에요.","품질 체크 중입니다."],ja:["テスト中です。","バグ見つけました!","テストケース作成中です。","回帰テスト実行中です。","品質チェック中です。"]},"data-analyst":{en:["Analyzing data.","Preparing a report.","Want to check the dashboard?","Tracking metrics.","Found an insight!"],ko:["데이터 분석 중이에요.","리포트 준비 중입니다.","대시보드 확인해보실래요?","지표 추적 중이에요.","인사이트 발견했어요!"],ja:["データ分析中です。","レポート準備中です。","ダッシュボード確認しますか?","指標追跡中です。","インサイト発見しました!"]},default:{en:["Hello!","How can I help?","Working hard.","Have a great day!"],ko:["안녕하세요!","무엇을 도와드릴까요?","열심히 일하고 있어요.","좋은 하루 되세요!"],ja:["こんにちは!","何かお手伝いしましょうか?","頑張って仕事してます。","良い一日を!"]}};function PA(e,n){const a=hy[e]||hy.default;return a[n]||a.en||a.default||[]}let ka=ki(Je);function Rv(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function Mv(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let wn={};function QA(e){const n={};for(let a=0;a<e.length&&a<Je.desks.length;a++)n[e[a]]=Je.desks[a];return n}let Xe,er=null,ji=null,rl=!1,sa=null,zr=null,zv=0,nr=null,$n=null,Ul=null,wa=null,Lh=900;function ZA(e,n){const{wx:a,wy:i,ww:o,wh:u,wallColor:d,baseboardColor:f}=e,m=Aa(d,.5),h=vn(d,.5),x=[];if(n){const g=n.x-a,v=n.w;g>0&&x.push({sx:a,sw:g}),g+v<o&&x.push({sx:n.x+v,sw:o-g-v})}else x.push({sx:a,sw:o});for(const g of x){$(g.sx,i,g.sw,u,d);for(let v=0;v<u;v+=4)$(g.sx,i+v,g.sw,1,h,.08),$(g.sx,i+v+2,g.sw,1,m,.05);As(Math.round(g.sx*7+i*13));for(let v=0;v<g.sw;v+=3)Na()>.4&&$(g.sx+v,i,1,u,h,.04);$(g.sx,i,g.sw,2,h,.3),$(g.sx,i,g.sw,1,vn(d,1),.2),$(g.sx,i+u-2,g.sw,2,m,.3),$(g.sx,i+u,g.sw,Ou,f),$(g.sx,i+u,g.sw,1,vn(f,.5),.4)}n&&($(n.x-1,i,1,u+Ou,"#4A3828"),$(n.x+n.w,i,1,u+Ou,"#4A3828"),$(n.x,i,n.w,1,"#0A0808",.12)),$(e.fx,e.fy,e.fw,3,"#0A0808",.12),$(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function JA(e){const n="#504038",a=Aa(n,.5),i=vn(n,.5),o=e.wx-Yl,u=e.wy,d=e.wh+Ou+e.fh;$(o,u,Yl,d,n),$(o,u,1,d,i,.3),$(o+Yl-1,u,1,d,a,.4);for(let m=0;m<d;m+=6)$(o+1,u+m,Yl-2,1,i,.06);const f=e.wx+e.ww;$(f,u,Yl,d,n),$(f,u,1,d,i,.2),$(f+Yl-1,u,1,d,a,.3)}function Ih(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#B08040",d="#C89848",f="#8A6030",m="#6A4820";$(n,a,i,o,u),As(42);for(let h=0;h<o;h+=5){const x=Math.floor(h/5)%2*10;for(let g=-10;g<i+10;g+=20){const v=n+g+x,b=Math.max(n,v),j=Math.min(v+19,n+i)-b;if(j<=0)continue;const k=Na()>.5?d:u;$(b,a+h,j,4,k,.25),$(b,a+h,j,1,d,.3),$(b,a+h+4,j,1,m,.35),v>=n&&v<n+i&&$(v,a+h,1,4,m,.2),$(b,a+h+2,j,1,f,.1)}}$(n,a,i,2,"#0A0808",.08),$(n,a,2,o,"#0A0808",.06)}function my(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#1C2A38",d="#101820";As(99),$(n,a,i,o,u);for(let f=0;f<o;f+=Nu)for(let m=0;m<i;m+=Nu){const h=Math.min(Nu,i-m),x=Math.min(Nu,o-f);Na()>.5&&$(n+m,a+f,h,x,vn(u,.2),.15),$(n+m+2,a+f+2,h-4,x-4,vn(u,.3),.08),$(n+m,a+f,h,1,d,.5),$(n+m,a+f,1,x,d,.5),$(n+m+1,a+f+1,1,x-1,vn(u,.4),.1),Na()>.85&&ot(n+m+4+Math.floor(Na()*8),a+f+4+Math.floor(Na()*8),"#3A6A9A",.08)}}function e8(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#387848",d="#4A9058",f="#285E38";$(n,a,i,o,u),As(77);for(let h=0;h<o;h+=2)for(let x=0;x<i;x+=2)Na()>.5&&ot(n+x,a+h,d,.1),Na()>.8&&ot(n+x+1,a+h+1,f,.12);const m=5;$(n+m,a+m,i-m*2,1,d,.45),$(n+m,a+o-m-1,i-m*2,1,f,.45),$(n+m,a+m,1,o-m*2,d,.35),$(n+i-m-1,a+m,1,o-m*2,f,.35)}function t8(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#D8C490",d="#B09060",f="#907848";As(55);for(let m=0;m<o;m+=8)for(let h=0;h<i;h+=8){const x=Math.min(8,i-h),g=Math.min(8,o-m),v=(h/8+m/8)%2===0?d:u;$(n+h,a+m,x,g,v),$(n+h+1,a+m+1,x-2,1,vn(v,.4),.2),$(n+h+1,a+m+1,1,g-2,vn(v,.4),.15),$(n+h+x-2,a+m+2,1,g-3,Aa(v,.4),.15),$(n+h+2,a+m+g-2,x-3,1,Aa(v,.4),.15),$(n+h,a+m,x,1,f,.3),$(n+h,a+m,1,g,f,.3)}}function n8(){const{canvasW:e,canvasH:n,rooms:a,doors:i}=Je,o="#2A1E14",u="#3A2E24";if($(0,0,e,vi,o),$(0,n-vi,e,vi,o),$(0,0,vi,n,o),$(e-vi,0,vi,n,o),$(0,0,e,1,u,.3),$(0,0,1,n,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const d=a.exec,f=a.meet,m=e/2,h=m-Xt/2,x=d.fy+d.fh,g=i.exec_work,v=i.meet_comm,b=i.exec_meet,j=i.work_comm,k=24,N=28,E=((g==null?void 0:g.doorY)??d.fy+20)-k/2,C=((b==null?void 0:b.doorX)??vi+Yl+54)-N/2,_=((j==null?void 0:j.doorX)??m+Xt/2+Yl+54)-N/2,M=((v==null?void 0:v.doorY)??f.fy+20)-k/2;$(0,x,C,Xt,o),$(C+N,x,h-C-N,Xt,o),$(h+Xt,x,_-h-Xt,Xt,o),$(_+N,x,e-_-N,Xt,o),$(0,x,C,1,u,.3),$(C+N,x,h-C-N,1,u,.3),$(h+Xt,x,_-h-Xt,1,u,.3),$(_+N,x,e-_-N,1,u,.3),$(h,0,Xt,E,o),$(h,E+k,Xt,x-E-k,o),$(h,x+Xt,Xt,M-x-Xt,o),$(h,M+k,Xt,n-M-k,o),$(h,0,1,E,u,.2),$(h,E+k,1,x-E-k,u,.2),$(h,x+Xt,1,M-x-Xt,u,.2),$(h,M+k,1,n-M-k,u,.2),$(h,E,Xt,k,"#C4A070"),$(h+Xt/2,E,Xt/2,k,"#3A4858"),$(h,M,Xt,k,"#7AA880"),$(h+Xt/2,M,Xt/2,k,"#C8B890");const L="#4A3828";$(h,E-1,Xt,1,L),$(h,E+k,Xt,1,L),$(C-1,x,1,Xt,L),$(C+N,x,1,Xt,L),$(_-1,x,1,Xt,L),$(_+N,x,1,Xt,L),$(h,M-1,Xt,1,L),$(h,M+k,Xt,1,L)}const py=new Map;function r8(e,n="right"){const a=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}|${n}`;let i=py.get(a);if(!i){const o=lm("mini-seated:default"),u=Xb(o,e);let d=u?u.layers.flatMap(f=>f.pixels):[];n==="left"&&d.length>0&&(d=rm(d,12)),i=d,py.set(a,i)}return i}function a8(e,n,a,i="right"){Xl(Xe,r8(a,i),e,n,a)}function l8(e,n,a,i,o,u="right"){wi(e+8,n+20,"up"),o||a8(e+8,n+0+i,a,u),XA(e,n+14)}function i8(e,n,a,i,o){const u=i in ay?i:"down",d=o%4,f=ay[u][d];Xl(Xe,f,e,n,a);const m=d===1||d===3?-1:0;if(a.accessory&&a.accessory!=="none"){const h=mC(a.accessory,u);h&&h.pixels.length>0&&Xl(Xe,h.pixels,e,n+m,a)}Xe.globalAlpha=1}let $o=[],Ei=!1,js=0;function s8(){const e=Object.keys(Je.rooms),n=e[Math.floor(Math.random()*e.length)],a=Je.rooms[n];return{x:a.fx+a.fw/2,y:a.fy+a.fh/2,dir:"down",walkFrame:0,walkTimer:0,path:[],room:n,state:"walking",stateTimer:0,tongueTimer:0,idleTime:0}}function o8(e){if(e.stateTimer--,Ei){js++,e.dir="down",e.walkFrame=0,e.tongueTimer++,e.idleTime=0;return}else js=0;if(e.state==="idle"){if(e.tongueTimer++,e.idleTime++,e.stateTimer<=0){e.state="walking",e.tongueTimer=0;const n=Object.keys(Je.rooms);if(Math.random()<.35&&n.length>1){const a=n.filter(d=>d!==e.room),i=a[Math.floor(Math.random()*a.length)],o=tp(e,i),u=Je.waypoints[i];if(u&&u.length>0){const d=u[Math.floor(Math.random()*u.length)],f=o[o.length-1]??{x:e.x,y:e.y},m=Ni(f.x,f.y,d.x,d.y,i);e.path=[...o,...m]}else e.path=o}else{const a=Je.waypoints[e.room];if(a&&a.length>0){const i=a[Math.floor(Math.random()*a.length)];e.path=Ni(e.x,e.y,i.x,i.y,e.room)}}e.walkTimer=0}}else if(e.state==="walking"){if(e.idleTime=0,e.path.length===0){e.state="idle",e.dir="down",e.stateTimer=120+Math.floor(Math.random()*240);return}const n=e.path[0],a=n.x-e.x,i=n.y-e.y,o=Math.sqrt(a*a+i*i);if(o<1.5){e.x=n.x,e.y=n.y,e.path.shift();for(const[u,d]of Object.entries(Je.rooms))if(e.x>=d.fx&&e.x<=d.fx+d.fw&&e.y>=d.fy&&e.y<=d.fy+d.fh){e.room=u;break}}else e.x+=a/o*.15,e.y+=i/o*.15,Math.abs(a)>Math.abs(i)?e.dir=a>0?"right":"left":e.dir=i>0?"down":"up",e.walkTimer++,e.walkFrame=Math.floor(e.walkTimer/15)%2}}function c8(e){const n=Math.round(e.x),a=Math.round(e.y);if(Ei&&js>90){const d=Math.floor(js/12)%2===0?mA:pA;Xl(Xe,yA,n,a),Xl(Xe,d,n,a);return}const i=e.state==="walking"?e.walkFrame:0,o=fA[e.dir][i],u=e.dir==="left"||e.dir==="right";Xl(Xe,u?gA:xA,n,a),Xl(Xe,o,n,a),e.state==="idle"&&e.dir==="down"&&e.tongueTimer%80<50&&Xl(Xe,hA,n,a)}function u8(e){const n={};let a=0;for(const i of e){const o=wn[i];o&&(n[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:a*17,stateTimer:1200+Math.floor(Math.random()*1800),sittingTime:0,lookDir:"right",isStretching:!1,stretchTimer:0},a++)}return n}function Ni(e,n,a,i,o){const u=Je.corridorY[o]??n,d=[];return n<u-4&&d.push({x:e,y:u}),Math.abs(e-a)>4&&d.push({x:a,y:u}),d.push({x:a,y:i}),d}function Hh(e,n,a,i){const o=Je.adjacency[a];if(!o)return[];const u=o.find(x=>x.room===i);if(!u)return[];const d=Je.doors[u.door];if(!d)return[];const f=[],m=Je.corridorY[a]??n,h=Je.corridorY[i]??n;if(Math.abs(n-m)>4&&f.push({x:e,y:m}),d.type==="v"){const x=u.side==="A"?d.xA:d.xB,g=u.side==="A"?d.xB:d.xA;f.push({x,y:m}),f.push({x,y:d.doorY}),f.push({x:g,y:d.doorY}),f.push({x:g,y:h})}else{const x=u.side==="A"?d.yA:d.yB,g=u.side==="A"?d.yB:d.yA;f.push({x:d.doorX,y:m}),f.push({x:d.doorX,y:x}),f.push({x:d.doorX,y:g}),f.push({x:d.doorX,y:h})}return f}function tp(e,n){const a=Je.adjacency[e.room];if(!a)return[];if(!a.find(o=>o.room===n)){for(const o of a){const u=Je.adjacency[o.room];if(u!=null&&u.find(d=>d.room===n)){const d=Hh(e.x,e.y,e.room,o.room),f=d[d.length-1],m=Hh((f==null?void 0:f.x)??e.x,(f==null?void 0:f.y)??e.y,o.room,n);return[...d,...m]}}return[]}return Hh(e.x,e.y,e.room,n)}function d8(e){if(e.room!==e.homeRoom){const n=tp({...e},e.homeRoom),a=n[n.length-1],i=Ni((a==null?void 0:a.x)??e.x,(a==null?void 0:a.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...n,...i]}return Ni(e.x,e.y,e.homeX,e.homeY,e.room)}function f8(e,n){if(Lh--,Lh<=0){const a=Object.entries(e).filter(([,i])=>i.state==="sitting"&&!i.isStretching);if(a.length>0){const[,i]=a[Math.floor(Math.random()*a.length)];i.isStretching=!0,i.stretchTimer=120}Lh=900}for(const[a,i]of Object.entries(e))if(i.stateTimer--,i.isStretching&&i.stretchTimer>0&&(i.stretchTimer--,i.stretchTimer<=0&&(i.isStretching=!1)),i.state==="sitting"){if(i.sittingTime++,er===a){i.sittingTime=0,i.bobY=-3;const u=wn[a];if(u){const d=u.dx+13;i.lookDir=zv<d?"left":"right"}}else i.bobY=(n+i.bobOff)%60<30?1:0,i.lookDir="right";if(i.stateTimer<=0){i.state="walking",i.x=i.homeX,i.y=i.homeY,i.room=i.homeRoom;const u=Object.keys(Je.rooms);if(Math.random()<.15&&u.length>1){const d=u.filter(x=>x!==i.room),f=d[Math.floor(Math.random()*d.length)],m=tp(i,f),h=Je.waypoints[f];if(h&&h.length>0){const x=h[Math.floor(Math.random()*h.length)],g=m[m.length-1]??{x:i.x,y:i.y},v=Ni(g.x,g.y,x.x,x.y,f);i.path=[...m,...v]}else i.path=m;i.walkTimer=0}else{const d=Je.waypoints[i.room];if(d&&d.length>0){const f=d[Math.floor(Math.random()*d.length)];i.path=Ni(i.x,i.y,f.x,f.y,i.room)}i.walkTimer=0}}}else if(i.state==="walking"||i.state==="returning"){if(i.sittingTime=0,er===a){i.dir="down",i.walkFrame=0;continue}if(i.path.length===0){i.state==="returning"?(i.state="sitting",i.room=i.homeRoom,i.stateTimer=1200+Math.floor(Math.random()*1800)):(i.state="idle",i.dir="down",i.stateTimer=180+Math.floor(Math.random()*360));continue}const u=i.path[0],d=u.x-i.x,f=u.y-i.y,m=Math.sqrt(d*d+f*f);if(m<1.5){i.x=u.x,i.y=u.y,i.path.shift();for(const[h,x]of Object.entries(Je.rooms))if(i.x>=x.fx&&i.x<=x.fx+x.fw&&i.y>=x.fy&&i.y<=x.fy+x.fh){i.room=h;break}}else i.x+=d/m*.2,i.y+=f/m*.2,Math.abs(d)>Math.abs(f)?i.dir=d>0?"right":"left":i.dir=f>0?"down":"up",i.walkTimer++,i.walkFrame=Math.floor(i.walkTimer/12)%4}else if(i.state==="idle"){if(er===a){i.dir="down";continue}if(i.stateTimer<=0)if(Math.random()<.15){i.state="walking";const o=Je.waypoints[i.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];i.path=Ni(i.x,i.y,u.x,u.y,i.room)}i.walkTimer=0}else i.state="returning",i.path=d8(i),i.walkTimer=0}}function h8(e,n,a,i){const{canvasW:o,canvasH:u,rooms:d}=Je;Xe.clearRect(0,0,o,u),$(0,0,o,u,"#2A1E14");const f={wood:Ih,dark:my,carpet:e8,tile:t8};for(const b of Object.values(d))(f[b.floorType]??Ih)(b);const m=Object.keys(d);if(m.length>=4){const b=d.exec,j=d.meet,{doors:k}=Je;if(b&&j&&k.exec_meet&&k.work_comm){const E=(k.exec_meet.doorX??0)-14,C=(k.work_comm.doorX??0)-28/2,_=b.fy+b.fh,M=j.fy;Ih({fx:E,fy:_,fw:28,fh:M-_}),my({fx:C,fy:_,fw:28,fh:M-_})}}const h={};if(m.length>=4){const{doors:b}=Je,j=28,k=b.exec_meet,N=b.work_comm;k!=null&&k.doorX&&(h.meet={x:k.doorX-j/2,w:j}),N!=null&&N.doorX&&(h.comm={x:N.doorX-j/2,w:j})}for(const b of Object.values(d))ZA(b,h[b.id]),JA(b);n8(),WA(Je);const x=[],g=new Set(Object.values(wn).map(b=>b.room));VA(Je,x,g);for(const[b,j]of Object.entries(wn)){const k=e[b];if(!k)continue;const N=k.state==="sitting",E=n(b),C=a[b]==="working",_=k.isStretching&&k.stretchTimer>0?Math.sin(k.stretchTimer*.15)*1:0;x.push({y:j.dy+14,draw:()=>{const M=N?k.bobY+_:0;if(l8(j.dx,j.dy,E,M,!N,k.lookDir),N&&C){const L=Gu[b]??"#388bfd";$(j.dx+7,j.dy+14-4,12,5,L,.15),ot(j.dx+12,j.dy+14+1,"#4CAF50",.8)}}})}for(const[b,j]of Object.entries(e))if(j.state!=="sitting"){const k=n(b);x.push({y:j.y+14,draw:()=>i8(Math.round(j.x),Math.round(j.y),k,j.dir,j.walkFrame)})}i&&x.push({y:i.y+10,draw:()=>c8(i)}),x.sort((b,j)=>b.y-j.y);for(const b of x)b.draw();for(const b of ka){const j=ji===b.id,k=Mv(b);if(Xe.save(),Xe.globalAlpha=j?.9:.5,Xe.fillStyle=b.color,Xe.fillRect(k.cx-1,k.botY-2,3,3),j){const N=Rv(b);Xe.globalAlpha=.3,Xe.strokeStyle=b.color,Xe.lineWidth=1,Xe.strokeRect(N.x-1,N.y-1,N.w+2,N.h+2)}Xe.restore()}if(rl){const b=new Set(Object.values(wn).map(j=>j.room));if(sa&&sa!==zr)if(sa.startsWith("desk:")){const j=sa.slice(5),k=wn[j];k&&uy(Xe,k.dx,k.dy,"#FBBF24")}else cy(Xe,Je,sa,"#FBBF24",b);if(zr)if(zr.startsWith("desk:")){const j=zr.slice(5),k=wn[j];k&&uy(Xe,k.dx,k.dy,"#3B82F6")}else cy(Xe,Je,zr,"#3B82F6",b)}if(er){const b=wn[er],j=e[er];if(b&&j){Xe.save(),Xe.globalAlpha=.25,Xe.fillStyle=Gu[er]??"#fff",j.state==="sitting"?Xe.fillRect(b.dx-1,b.dy+6,28,30):Xe.fillRect(Math.round(j.x)-1,Math.round(j.y)-1,14,24),Xe.globalAlpha=.95,Xe.fillStyle="#FBBF24",Xe.font="bold 8px monospace",Xe.textAlign="center";const k=j.state==="sitting"?b.dx+13:Math.round(j.x)+6,N=j.state==="sitting"?b.dy-1:Math.round(j.y)-5;Xe.fillText("!",k,N),Xe.restore()}}const v=3600;for(const[,b]of Object.entries(e))if(b.state==="sitting"&&b.sittingTime>v&&!b.isStretching){const j=Object.values(wn).find(M=>M.dx+8===b.homeX&&M.dy+34===b.homeY);if(!j)continue;const k=j.dx+13,N=j.dy,E=Math.floor(b.sittingTime/40)%3;Xe.save(),Xe.font="5px monospace",Xe.textAlign="center";const C=[.7,.5,.3],_=[{x:3,y:-2-E},{x:6,y:-5-(E+1)%3},{x:4,y:-8-(E+2)%3}];for(let M=0;M<3;M++)Xe.globalAlpha=C[M],Xe.fillStyle="#93C5FD",Xe.font=`${4+M}px monospace`,Xe.fillText("z",k+_[M].x,N+_[M].y);Xe.restore()}$o=$o.filter(b=>b.life>0);for(const b of $o)b.x+=b.vx,b.y+=b.vy,b.life--,Xe.save(),Xe.globalAlpha=Math.min(1,b.life/(b.maxLife*.3)),Xe.fillStyle=b.color??"#FF6B8A",Xe.font="8px serif",Xe.fillText(b.char,Math.round(b.x),Math.round(b.y)),Xe.restore();if(Ei&&i&&js<=90){const b=Math.round(i.x),j=Math.round(i.y);Xe.save(),Xe.globalAlpha=.9,Xe.fillStyle="#FBBF24",Xe.font="bold 5px monospace",Xe.textAlign="center",Xe.fillText("!",b+4,j-2),Xe.restore()}if(i&&!Ei&&i.state==="idle"&&i.idleTime>600){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(i.idleTime/40)%3;Xe.save();const N=[{x:3,y:-2-k},{x:5,y:-5-(k+1)%3},{x:4,y:-8-(k+2)%3}];for(let E=0;E<3;E++)Xe.globalAlpha=[.7,.5,.3][E],Xe.fillStyle="#93C5FD",Xe.font=`${3+E}px monospace`,Xe.textAlign="center",Xe.fillText("z",b+N[E].x,j+N[E].y);Xe.restore()}if(Ei&&i&&js<=90){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(Date.now()/150)%2===0?-1:1;i.dir==="down"&&(Xe.fillStyle="#FAFAF7",Xe.fillRect(b+4+k,j-1,2,2))}}function m8(e,n){for(let a=0;a<4;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:a%2===0?"♥":"♡",color:"#FF6B8A"})}function p8(e,n){for(let a=0;a<3;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:"💧",color:"#64B5F6"})}function x8({roles:e,projects:n,roleStatuses:a,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:d,onDecisionsClick:f,onKnowledgeClick:m,onSettingsClick:h,onThemeClick:x,onStatsClick:g,getRoleSpeech:v,getAppearance:b,onHireClick:j,onMascotClick:k,roleLevels:N,coinBalance:E=0,onCoinsSpent:C,onFurniturePlaced:_,purchasedPreset:M,language:L="en"}){const R=w.useRef(null),I=w.useRef(null),X=w.useRef(null),J=w.useRef({}),A=w.useRef(null),O=w.useRef(0),U=w.useRef(KA),[Y,ne]=w.useState(!1),[K,q]=w.useState(null),[se,ue]=w.useState(null),V=w.useRef({}),D=w.useRef({}),B=w.useRef([]),H=w.useRef([]);w.useEffect(()=>{rl=Y},[Y]),w.useEffect(()=>{Ul=K,wa=se},[K,se]);const[T,de]=w.useState(!1);w.useEffect(()=>{ye.getPreferences().then(pe=>{const Se=pe.furnitureOverrides;Se&&Object.keys(Se).length>0&&(V.current=Se);const Ne=pe.deskOverrides;Ne&&Object.keys(Ne).length>0&&(D.current=Ne);const G=pe.removedFurniture;G&&G.length>0&&(B.current=G);const ce=pe.addedFurniture;ce&&ce.length>0&&(H.current=ce),de(!0)}).catch(()=>{de(!0)})},[]);const ge=w.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:v,getAppearance:b});ge.current={roleStatuses:a,activeExecs:i,getRoleSpeech:v,getAppearance:b};const he=w.useRef({}),Be=w.useMemo(()=>e.map(pe=>pe.id),[e]),He=w.useRef(Je);w.useEffect(()=>{if(!T)return;const pe=Be.length,Se=Nv(pe,He.current.preset,M),Ne=He.current.preset!==Se;let G=Av(pe,Se);B.current.length>0&&(G=oy(G,B.current)),H.current.length>0&&(G=CA(G,H.current)),Object.keys(V.current).length>0&&(G=jA(G,V.current)),Je=G,He.current=G,wn=QA(Be),Object.keys(D.current).length>0&&SA(wn,D.current),ka=ki(G),J.current=u8(Be),A.current=s8();const ce=R.current;ce&&(ce.width=G.canvasW,ce.height=G.canvasH,Ne&&(ce.style.opacity="0",ce.style.transition="opacity 0.3s",setTimeout(()=>{ce.style.opacity="1"},50))),et()},[Be,M,T]);const Ie=w.useCallback(pe=>{var Se,Ne;return((Ne=(Se=ge.current).getAppearance)==null?void 0:Ne.call(Se,pe))??Pm(pe)},[]),et=w.useCallback(()=>{const pe=I.current,Se=R.current;if(!pe||!Se)return;const Ne=pe.parentElement;if(!Ne)return;const G=Ne.clientWidth,ce=Ne.clientHeight;if(G===0||ce===0)return;const{canvasW:re,canvasH:ve}=Je;let we=Math.min(G/re,ce/ve);we=Math.round(we*2)/2,we=Math.max(2,Math.min(we,5)),U.current=we,Se.style.width=re*we+"px",Se.style.height=ve*we+"px",pe.style.width=re*we+"px",pe.style.height=ve*we+"px"},[]);w.useEffect(()=>{var ve;const pe=R.current;if(!pe)return;const Se=pe.getContext("2d");if(!Se)return;Xe=Se,EA(Se),et();const Ne=new ResizeObserver(()=>et()),G=(ve=I.current)==null?void 0:ve.parentElement;G&&Ne.observe(G);let ce;const re=()=>{O.current++,f8(J.current,O.current),A.current&&o8(A.current),h8(J.current,Ie,ge.current.roleStatuses,A.current),Ve(),ce=requestAnimationFrame(re)};return ce=requestAnimationFrame(re),()=>{cancelAnimationFrame(ce),Ne.disconnect()}},[Ie,et]),w.useEffect(()=>{var re;const pe=X.current;if(!pe)return;pe.innerHTML="";const Se={};for(const ve of e)Se[ve.id]=ve.name;for(const ve of Be){const we=Gu[ve]??"#8b949e",Me=Se[ve],ze=Me&&Me.toLowerCase()!==ve.toLowerCase()?`${ve.toUpperCase()} · ${Me}`:ve.toUpperCase(),Oe=document.createElement("div");Oe.className="td-nametag",Oe.dataset.role=ve;const qe=document.createElement("span");qe.className="td-dot",qe.style.background=we,Oe.appendChild(qe),Oe.appendChild(document.createTextNode(ze));const lt=((re=N==null?void 0:N[ve])==null?void 0:re.level)??1;if(lt>1){const bt=document.createElement("span");bt.className="td-lvl",bt.textContent=`Lv.${lt}`,Oe.appendChild(bt)}pe.appendChild(Oe);const Qe=document.createElement("div");Qe.className="td-bubble",Qe.dataset.role=ve,Qe.dataset.type="bubble",pe.appendChild(Qe)}const Ne={meeting:()=>{const ve=n[0];ve?u(ve.id):d()},bulletin:d,decisions:f,knowledge:m,settings:h,theme:x,stats:g};for(const ve of ka){const we=document.createElement("div");we.className="td-facility-label",we.dataset.facility=ve.id,ve.id==="meeting"&&(we.dataset.questTarget="meeting-room"),ve.id==="knowledge"&&(we.dataset.questTarget="knowledge-hub"),ve.id==="bulletin"&&(we.dataset.questTarget="bulletin-board"),ve.id==="stats"&&(we.dataset.questTarget="stats-btn"),ve.id==="settings"&&(we.dataset.questTarget="settings-btn"),ve.id==="theme"&&(we.dataset.questTarget="theme-btn"),we.textContent=`${ve.icon} ${ve.label}`,we.style.borderColor=`${ve.color}44`;const Me=Ne[ve.id];Me&&we.addEventListener("click",Me),we.addEventListener("mouseenter",()=>{ji=ve.id}),we.addEventListener("mouseleave",()=>{ji=null}),pe.appendChild(we)}const G=document.createElement("div");G.className="td-nametag td-nametag-mascot",G.dataset.role="mascot";const ce=document.createElement("span");ce.className="td-dot",ce.style.background="#ffd700",G.appendChild(ce),G.appendChild(document.createTextNode("Pupu")),G.addEventListener("click",()=>k==null?void 0:k()),pe.appendChild(G)},[Be,e,n,u,d,f,m,h,x,g,k,N]);const Ve=w.useCallback(()=>{var Me;const pe=X.current;if(!pe)return;const Se=U.current,Ne=J.current,{getRoleSpeech:G,roleStatuses:ce,activeExecs:re}=ge.current;for(const ze of Object.keys(Ne)){const Oe=Ne[ze],qe=wn[ze];if(!qe)continue;let lt,Qe,bt;Oe.state==="sitting"?(lt=qe.dx+13,bt=qe.dy+2,Qe=qe.dy+37):(lt=Math.round(Oe.x)+6,bt=Math.round(Oe.y)-2,Qe=Math.round(Oe.y)+18);const Re=lt/Je.canvasW*100,Ue=pe.querySelector(`.td-nametag[data-role="${ze}"]`);if(Ue){Ue.style.left=Re+"%",Ue.style.top=Qe*Se+2+"px";const Bt=Ue.querySelector(".td-dot");if(Bt){const Ot=ce[ze]==="working";Bt.style.background=Ot?"#FBBF24":Gu[ze]??"#8b949e",Ot?Bt.style.animation="td-pulse 1s ease-in-out infinite":Bt.style.animation=""}}const _t=pe.querySelector(`.td-bubble[data-role="${ze}"]`);if(_t){const Bt=Date.now(),Ot=ce[ze]==="working",un=(Me=re.find(Kt=>Kt.roleId===ze))==null?void 0:Me.task,kn=G(ze);let Z="";const $e=he.current[ze];if($e){if($e.speechDismissTime&&Bt>=$e.speechDismissTime&&($e.currentSpeech=null,$e.speechDismissTime=null),$e.hoverStartTime&&!$e.currentSpeech){const Kt=Bt-$e.hoverStartTime,ke=!$e.lastSpeechTime||Bt-$e.lastSpeechTime>=5e3;if(Kt>=2e3&&ke){const kt=PA(ze,L),jn=kt[Math.floor(Math.random()*kt.length)];$e.currentSpeech=jn,$e.lastSpeechTime=Bt,$e.speechDismissTime=Bt+3e3}}Z=$e.currentSpeech||""}const at=Ot&&un?un.slice(0,60):Z?Z.slice(0,60):kn?kn.slice(0,60):"";at&&Oe.state==="sitting"?(_t.style.display="",_t.style.left=Re+"%",_t.style.top=(bt-10)*Se+"px",_t.textContent=at):_t.style.display="none"}}const ve=pe.querySelector(".td-nametag-mascot"),we=A.current;if(ve&&we){const ze=we.dir==="left"||we.dir==="right",Oe=Math.round(we.x)+(ze?6:4),qe=Math.round(we.y)+(ze?7:10);ve.style.left=Oe/Je.canvasW*100+"%",ve.style.top=qe*Se+2+"px"}for(const ze of ka){const Oe=pe.querySelector(`.td-facility-label[data-facility="${ze.id}"]`);if(Oe){const qe=Mv(ze);Oe.style.left=qe.cx/Je.canvasW*100+"%",Oe.style.top=qe.botY*Se-4+"px",Oe.classList.toggle("td-facility-label--hover",ji===ze.id)}}},[]),Ke=w.useCallback(pe=>{const Se=R.current;if(!Se)return null;const Ne=Se.getBoundingClientRect(),G=U.current,ce=(pe.clientX-Ne.left)/G,re=(pe.clientY-Ne.top)/G,ve=J.current;for(const[Me,ze]of Object.entries(wn)){if(!ve[Me])continue;const Oe=ve[Me];if(Oe.state==="sitting"){if(ce>=ze.dx&&ce<=ze.dx+26&&re>=ze.dy&&re<=ze.dy+40)return{type:"role",id:Me}}else if(ce>=Oe.x-2&&ce<=Oe.x+14&&re>=Oe.y-2&&re<=Oe.y+20)return{type:"role",id:Me}}const we=A.current;if(we){const Me=we.dir==="left"||we.dir==="right",ze=Me?13:9,Oe=Me?7:10;if(ce>=we.x&&ce<=we.x+ze&&re>=we.y&&re<=we.y+Oe)return{type:"mascot",id:"mascot"}}for(const Me of ka){const ze=Rv(Me);if(ce>=ze.x&&ce<=ze.x+ze.w&&re>=ze.y&&re<=ze.y+ze.h)return{type:"facility",id:Me.id}}return null},[]),Ee=w.useCallback(pe=>{const Se=R.current;if(!Se)return{mx:0,my:0};const Ne=Se.getBoundingClientRect(),G=U.current;return{mx:(pe.clientX-Ne.left)/G,my:(pe.clientY-Ne.top)/G}},[]),Ae=w.useCallback(pe=>{ye.updatePreferences(pe).catch(()=>{})},[]),yt=w.useCallback(pe=>{const Se=H.current.some(G=>G.id===pe),Ne={};if(Se){const G=H.current.filter(ce=>ce.id!==pe);H.current=G,Ne.addedFurniture=G}else{const G=[...B.current,pe];B.current=G,Ne.removedFurniture=G}Je=oy(Je,[pe]),ka=ki(Je),zr=null,sa=null,Ae(Ne)},[Ae]),dt=w.useCallback((pe,Se)=>{if(!Ul||!wa)return;const Ne=fy.find(Oe=>Oe.type===Ul),G=(Ne==null?void 0:Ne.price)??0;if(G>0&&E<G)return;let ce=null;for(const[Oe,qe]of Object.entries(Je.rooms)){const lt=wa==="wall"?qe.wx:qe.fx,Qe=wa==="wall"?qe.wy:qe.fy,bt=wa==="wall"?qe.ww:qe.fw,Re=wa==="wall"?qe.wh:qe.fh;if(pe>=lt&&pe<=lt+bt&&Se>=Qe&&Se<=Qe+Re){ce=Oe;break}}if(!ce)return;const re=Je.rooms[ce],ve=wa==="wall"?re.wx:re.fx,we=wa==="wall"?re.wy:re.fy,Me={id:`user-${Ul}-${Date.now()}`,type:Ul,room:ce,zone:wa,offsetX:Math.round(pe-ve),offsetY:Math.round(Se-we)},ze=[...H.current,Me];if(H.current=ze,wa==="wall"?Je.wallDecorations.push(Me):Je.furniture.push(Me),ka=ki(Je),Ae({addedFurniture:ze}),_==null||_(Ul,G),G>0){const Oe=Me.type;Ny(async()=>{const{api:qe}=await Promise.resolve().then(()=>Aw);return{api:qe}},void 0).then(({api:qe})=>{qe.spendCoins(G,`furniture: ${Oe}`,Me.id).then(lt=>C==null?void 0:C(lt.balance)).catch(()=>{})})}q(null),ue(null)},[Ae,E,C,_]),xt=w.useCallback(pe=>{const Se=R.current;if(rl&&nr){const{mx:ve,my:we}=Ee(pe),ze=[...Je.furniture,...Je.wallDecorations].find(lt=>lt.id===nr.defId);if(!ze)return;const Oe=ve-nr.startMx,qe=we-nr.startMy;ze.offsetX=Math.round(nr.origOffX+Oe),ze.offsetY=Math.round(nr.origOffY+qe),ka=ki(Je),Se&&(Se.style.cursor="grabbing");return}if(rl&&$n){const{mx:ve,my:we}=Ee(pe),Me=wn[$n.roleId];if(!Me)return;Me.dx=Math.round($n.origDx+(ve-$n.startMx)),Me.dy=Math.round($n.origDy+(we-$n.startMy));const ze=J.current[$n.roleId];ze&&(ze.homeX=Me.dx+8,ze.homeY=Me.dy+34),Se&&(Se.style.cursor="grabbing");return}if(rl){const{mx:ve,my:we}=Ee(pe);if(Ul){Se&&(Se.style.cursor="crosshair");return}const Me=new Set(Object.values(wn).map(Oe=>Oe.room)),ze=$h(Je,ve,we,Me);if(ze)sa=ze;else{const Oe=dy(wn,ve,we);sa=Oe?`desk:${Oe}`:null}er=null,ji=null,Se&&(Se.style.cursor=sa?"grab":"default");return}const Ne=Ke(pe),G=er;er=(Ne==null?void 0:Ne.type)==="role"?Ne.id:null,ji=(Ne==null?void 0:Ne.type)==="facility"?Ne.id:null,Ei=(Ne==null?void 0:Ne.type)==="mascot",sa=null,Se&&(Se.style.cursor=Ne?"pointer":"default");const{mx:ce}=Ee(pe);zv=ce;const re=Date.now();if(er&&er!==G){he.current[er]||(he.current[er]={hoverStartTime:null,lastSpeechTime:null,currentSpeech:null,speechDismissTime:null});const ve=he.current[er];ve.hoverStartTime=re}else if(!er&&G){const ve=he.current[G];ve&&(ve.hoverStartTime=null)}},[Ke,Ee]),jt=w.useCallback(pe=>{if(!rl)return;const{mx:Se,my:Ne}=Ee(pe);if(Ul){dt(Se,Ne),pe.preventDefault();return}const G=new Set(Object.values(wn).map(ve=>ve.room)),ce=$h(Je,Se,Ne,G);if(ce){const we=[...Je.furniture,...Je.wallDecorations].find(Me=>Me.id===ce);we&&(zr=ce,nr={defId:ce,startMx:Se,startMy:Ne,origOffX:we.offsetX,origOffY:we.offsetY},pe.preventDefault());return}const re=dy(wn,Se,Ne);if(re){const ve=wn[re];zr=`desk:${re}`,$n={roleId:re,startMx:Se,startMy:Ne,origDx:ve.dx,origDy:ve.dy},pe.preventDefault();return}zr=null},[Ee,dt]),Wt=w.useCallback(pe=>{if(nr){const Ne=[...Je.furniture,...Je.wallDecorations].find(G=>G.id===nr.defId);if(Ne){const G={...V.current,[Ne.id]:{offsetX:Ne.offsetX,offsetY:Ne.offsetY}};V.current=G,Ae({furnitureOverrides:G}),ka=ki(Je)}nr=null,R.current&&(R.current.style.cursor="grab");return}if($n){const Se=wn[$n.roleId];if(Se){const Ne={...D.current,[$n.roleId]:{dx:Se.dx,dy:Se.dy}};D.current=Ne,Ae({deskOverrides:Ne})}$n=null,R.current&&(R.current.style.cursor="grab")}},[Ae]),Tt=w.useCallback(pe=>{if(!rl)return;pe.preventDefault();const{mx:Se,my:Ne}=Ee(pe),G=new Set(Object.values(wn).map(re=>re.room)),ce=$h(Je,Se,Ne,G);ce&&yt(ce)},[Ee,yt]);w.useEffect(()=>{const pe=Se=>{!rl||!zr||(Se.key==="Delete"||Se.key==="Backspace")&&(zr.startsWith("desk:")||yt(zr))};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[yt]);const Ct=w.useCallback(()=>{if(nr){const Se=[...Je.furniture,...Je.wallDecorations].find(Ne=>Ne.id===nr.defId);Se&&(Se.offsetX=nr.origOffX,Se.offsetY=nr.origOffY,ka=ki(Je)),nr=null}if($n){const pe=wn[$n.roleId];pe&&(pe.dx=$n.origDx,pe.dy=$n.origDy);const Se=J.current[$n.roleId];Se&&(Se.homeX=pe.dx+8,Se.homeY=pe.dy+34),$n=null}er=null,ji=null,Ei=!1,sa=null,R.current&&(R.current.style.cursor="default")},[]),Bn=w.useCallback(pe=>{if(rl)return;const Se=Ke(pe);if(Se){if(Se.type==="role"){const Ne=J.current[Se.id],G=wn[Se.id];if(Ne&&G){const ce=Ne.state==="sitting"?G.dx+13:Math.round(Ne.x)+6,re=Ne.state==="sitting"?G.dy+2:Math.round(Ne.y)-2;p8(ce,re)}o(Se.id);return}if(Se.type==="mascot"){const Ne=A.current;Ne&&m8(Math.round(Ne.x)+4,Math.round(Ne.y)-2),k==null||k();return}switch(Se.id){case"meeting":{const Ne=n[0];Ne?u(Ne.id):d();break}case"bulletin":d();break;case"decisions":f();break;case"knowledge":m();break;case"settings":h==null||h();break;case"theme":x==null||x();break;case"stats":g==null||g();break}}},[Ke,o,u,d,f,m,h,x,g]);return l.jsxs("div",{className:`td-scene${Y?" td-scene--editing":""}`,children:[l.jsxs("div",{ref:I,className:"td-wrap",children:[l.jsx("canvas",{ref:R,width:Je.canvasW,height:Je.canvasH,className:"td-canvas",onClick:Bn,onMouseDown:jt,onMouseUp:Wt,onMouseMove:xt,onMouseLeave:Ct,onContextMenu:Tt}),l.jsx("div",{ref:X,className:"td-overlay"})]}),Y&&l.jsxs("div",{className:"td-edit-banner",children:[l.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),l.jsxs("button",{className:`td-edit-btn${Y?" td-edit-btn--active":""}`,"data-quest-target":"edit-btn",onClick:()=>{ne(pe=>{const Se=!pe;return Se||(q(null),ue(null)),Se}),zr=null,nr=null,$n=null},title:Y?"Exit Edit Mode":"Edit Furniture Layout",children:[l.jsx("span",{className:"td-edit-btn__icon",children:Y?"✓":"✎"}),l.jsx("span",{className:"td-edit-btn__label",children:Y?"DONE":"EDIT"})]}),Y&&l.jsx("div",{className:"td-palette",children:fy.map(pe=>{const Se=pe.price===0||E>=pe.price,Ne=pe.price===0?"Free":`${pe.price>=1e3?`${(pe.price/1e3).toFixed(pe.price%1e3===0?0:1)}K`:pe.price}`;return l.jsxs("button",{className:`td-palette__item${K===pe.type?" td-palette__item--active":""}${Se?"":" td-palette__item--locked"}`,onClick:()=>{Se&&(K===pe.type?(q(null),ue(null)):(q(pe.type),ue(pe.zone)))},title:`${pe.label} — ${Ne}`,style:Se?void 0:{opacity:.4,cursor:"not-allowed"},children:[l.jsx("span",{children:pe.icon}),l.jsx("span",{className:"td-palette__price",style:{fontSize:"7px",color:pe.price===0?"#4CAF50":Se?"#FFD54F":"#EF5350"},children:Ne})]},pe.type)})}),j&&l.jsxs("button",{className:"td-hire-btn","data-quest-target":"hire-btn",onClick:j,title:"Hire New Role",children:[l.jsx("span",{className:"td-hire-btn__icon",children:"+"}),l.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function g8({role:e,appearance:n,onSave:a,onReset:i,onClose:o,theme:u,onThemeChange:d,onUpdateName:f,initialTab:m,characterOnly:h,speechSettings:x,onSpeechSettingsChange:g,language:v,onLanguageChange:b,roleLevel:j,coinBalance:k,purchased:N,onPurchase:E}){var ne;const[C,_]=w.useState(m??"character"),[M,L]=w.useState({...n}),[R,I]=w.useState(e.name),[X,J]=w.useState(!1),A=w.useCallback(()=>L(xs(j)),[j]),O=w.useCallback(()=>{const K=Pm(e.id);L({...K}),i()},[e.id,i]),U=w.useCallback(async()=>{a(M);const K=R.trim();if(f&&K&&K!==e.name){J(!0);try{await f(e.id,K)}catch{}J(!1)}o()},[M,a,o,R,e.name,e.id,f]),Y=l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsxs("span",{children:[e.id.toUpperCase()," –"]}),f?l.jsx("input",{value:R,onChange:K=>I(K.target.value),disabled:X,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}}):l.jsx("span",{children:e.name})]});return l.jsx("div",{className:"customize-overlay",onClick:o,children:l.jsxs("div",{className:"customize-modal",onClick:K=>K.stopPropagation(),children:[l.jsxs("div",{className:"customize-header",children:[l.jsxs("div",{className:"customize-tabs",children:[l.jsx("button",{className:`customize-tab ${C==="character"?"active":""}`,onClick:()=>_("character"),children:"CHARACTER"}),!h&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:`customize-tab ${C==="office"?"active":""}`,onClick:()=>_("office"),children:"OFFICE THEME"}),l.jsx("button",{className:`customize-tab ${C==="settings"?"active":""}`,onClick:()=>_("settings"),children:"SETTINGS"})]})]}),l.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),C==="character"?l.jsx("div",{className:"customize-body",children:l.jsx(gv,{roleId:e.id,appearance:M,onChange:L,onRandomize:A,onReset:O,label:Y,roleLevel:j,coinBalance:k,purchased:N,onPurchase:E})}):C==="office"?l.jsx("div",{className:"customize-body",children:l.jsx("div",{className:"customize-themes",children:Object.entries(il).map(([K,q])=>l.jsxs("button",{className:`customize-theme-card ${u===K?"active":""}`,onClick:()=>d(K),children:[l.jsxs("div",{className:"customize-theme-preview",style:{background:q.vars["--floor-light"],borderColor:q.vars["--pixel-border"]},children:[l.jsx("div",{style:{background:q.vars["--hud-bg"],height:8,borderBottom:`2px solid ${q.vars["--pixel-border"]}`}}),l.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[l.jsx("div",{style:{width:10,height:14,background:q.vars["--accent"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--active-green"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--idle-amber"],borderRadius:1}})]}),l.jsx("div",{style:{background:q.vars["--hud-bg"],height:6,borderTop:`2px solid ${q.vars["--pixel-border"]}`}})]}),l.jsxs("div",{className:"customize-theme-name",children:[q.icon," ",q.name]})]},K))})}):l.jsx("div",{className:"customize-body",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),l.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(K=>l.jsxs("button",{onClick:()=>g==null?void 0:g({mode:K}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(x==null?void 0:x.mode)===K?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(x==null?void 0:x.mode)===K?"rgba(255,255,255,0.08)":"transparent",color:(x==null?void 0:x.mode)===K?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:2},children:K==="template"?"TEMPLATE":K==="llm"?"AI":"AUTO"}),l.jsx("div",{style:{fontSize:9,opacity:.7},children:K==="template"?"Static pool ($0)":K==="llm"?"LLM generated":"Detect engine"})]},K))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(x==null?void 0:x.intervalSec)??18,"s"]}),l.jsx("input",{type:"range",min:5,max:120,step:5,value:(x==null?void 0:x.intervalSec)??18,onChange:K=>g==null?void 0:g({intervalSec:Number(K.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"5s (frequent)"}),l.jsx("span",{children:"120s (rare)"})]})]}),(x==null?void 0:x.mode)!=="template"&&l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((ne=x==null?void 0:x.dailyBudgetUsd)==null?void 0:ne.toFixed(2))??"1.00"]}),l.jsx("input",{type:"range",min:0,max:5,step:.25,value:(x==null?void 0:x.dailyBudgetUsd)??1,onChange:K=>g==null?void 0:g({dailyBudgetUsd:Number(K.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"$0 (unlimited)"}),l.jsx("span",{children:"$5.00/day"})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),l.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:K,label:q})=>l.jsx("button",{onClick:()=>b==null?void 0:b(K),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(v??"auto")===K?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(v??"auto")===K?"rgba(255,255,255,0.08)":"transparent",color:(v??"auto")===K?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:q},K))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),C==="character"&&l.jsxs("div",{className:"customize-footer",children:[l.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),l.jsx("button",{className:"customize-btn customize-btn--save",onClick:U,children:"SAVE"})]})]})})}function xy(e){if(e.length===0)return"";const n={};for(const{file:f}of e){const m=f.split("/"),h=m[0]==="."?m[1]??"root":m[0];(n[h]??(n[h]=[])).push(f)}const a={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[f,m]of Object.entries(n)){const h=a[f]??f;if(m.length===1){const x=m[0].split("/").pop()??m[0];i.push(`${h}/${x}`)}else i.push(`${h} (${m.length} files)`)}const o=e.some(f=>f.status==="A"),u=e.some(f=>f.status==="M");return`${o&&!u?"add":"update"}: ${i.join(", ")}`}function gy(e){const n=Date.now()-new Date(e).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function y8({onInitGit:e,onDelegate:n,delegateRoleName:a}){const[i,o]=w.useState(!1),[u,d]=w.useState(null),f=async()=>{o(!0),d(null);try{await e(),d({ok:!0,message:"Git repository initialized!"})}catch(h){const x=h instanceof Error?h.message:"Failed";x.includes("not installed")||x.includes("noGitBinary")?d({ok:!1,message:"git is not installed on this system"}):d({ok:!1,message:x})}finally{o(!1)}},m=u&&!u.ok&&u.message.includes("not installed");return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(211,47,47,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Git Repository"}),!u&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"This project has no git repository. Initialize one to start saving."}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:f,disabled:i,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:i?"INITIALIZING...":"GIT INIT"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&u.ok&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:u.message}),m&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"#EF5350"},children:"git is not installed on this system."}),l.jsxs("div",{className:"text-[10px] space-y-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:[l.jsx("b",{children:"macOS:"})," xcode-select --install"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Ubuntu/Debian:"})," sudo apt install git"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Windows:"})," ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"git-scm.com/downloads"})]})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:()=>{d(null)},className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&!u.ok&&!m&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:u.message})]})}function b8({repo:e,onConnected:n,onDelegate:a,delegateRoleName:i}){const[o,u]=w.useState("idle"),[d,f]=w.useState(null),[m,h]=w.useState(""),[x,g]=w.useState("private"),[v,b]=w.useState(""),[j,k]=w.useState(null),[N,E]=w.useState(!1),C=async()=>{u("checking"),k(null);try{const R=await ye.getGithubStatus(e);f(R),R.hasRemote?n():R.ghInstalled&&R.authenticated?u("ready"):u("idle")}catch{u("idle")}},_=async()=>{if(m.trim()){E(!0),k(null);try{const R=await ye.githubCreateRepo(m.trim(),x,e);k(R),R.ok&&setTimeout(n,1500)}catch(R){k({ok:!1,message:R instanceof Error?R.message:"Failed"})}finally{E(!1)}}},M=async()=>{if(v.trim()){E(!0),k(null);try{const R=await ye.addRemote(v.trim(),e);k(R),R.ok&&setTimeout(n,1500)}catch(R){k({ok:!1,message:R instanceof Error?R.message:"Failed"})}finally{E(!1)}}},L=a?l.jsxs("button",{onClick:a,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},title:`Ask ${i??"AI"} to set up GitHub remote`,children:["🤖"," ",(i==null?void 0:i.toUpperCase())??"AI"," FIX"]}):null;return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(100,100,255,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Remote — Local Only"}),o==="idle"&&!d&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"CONNECT GITHUB"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),L]}),o==="checking"&&l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"Checking GitHub CLI..."}),o==="idle"&&d&&!d.ghInstalled&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI (gh) not installed."}),l.jsxs("div",{className:"text-[10px] space-y-0.5",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:["Install:"," ",l.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"cli.github.com"})]}),l.jsx("div",{style:{fontFamily:"var(--pixel-font)"},children:"brew install gh && gh auth login"})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD URL MANUALLY"}),L]})]}),o==="idle"&&d&&d.ghInstalled&&!d.authenticated&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI installed but not logged in."}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)",fontFamily:"var(--pixel-font)"},children:"Run in terminal: gh auth login"}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:C,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),L]})]}),o==="ready"&&d&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--active-green)"},children:["Logged in as ",d.username||"GitHub user"]}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("input",{type:"text",value:m,onChange:R=>h(R.target.value),placeholder:"repository-name",className:"flex-1 px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("select",{value:x,onChange:R=>g(R.target.value),className:"px-2 py-1.5 text-[10px] outline-none cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:[l.jsx("option",{value:"private",children:"Private"}),l.jsx("option",{value:"public",children:"Public"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:_,disabled:N||!m.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"CREATING...":"CREATE & PUSH"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"USE URL INSTEAD"})]})]}),o==="manual"&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("a",{href:"https://github.com/new",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"Create a new repo on GitHub"})," ","then paste the URL below:"]}),l.jsx("input",{type:"text",value:v,onChange:R=>b(R.target.value),placeholder:"https://github.com/username/repo-name.git",className:"w-full px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:M,disabled:N||!v.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"ADDING...":"ADD REMOTE & PUSH"}),l.jsx("button",{onClick:()=>{u("idle"),f(null)},className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"BACK"})]})]}),j&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:j.ok?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${j.ok?"var(--active-green)":"#D32F2F"}`,color:j.ok?"var(--active-green)":"#EF5350"},children:j.message})]})}function v8({status:e,history:n,onClose:a,onSave:i,onLoadHistory:o,onRestore:u,saving:d,onDelegate:f,delegateRoleName:m,repo:h,onRepoChange:x,syncInfo:g,onPull:v,pulling:b,onRefresh:j,onInitGit:k}){const[N,E]=w.useState("save"),[C,_]=w.useState(""),[M,L]=w.useState(null),[R,I]=w.useState(!1),[X,J]=w.useState(null),[A,O]=w.useState(null),U=w.useRef(null);w.useEffect(()=>{N==="history"&&o()},[N,o]),w.useEffect(()=>{var D;(D=U.current)==null||D.focus()},[]);const Y=[...((e==null?void 0:e.modified)??[]).map(D=>({status:"M",file:D})),...((e==null?void 0:e.untracked)??[]).map(D=>({status:"A",file:D}))],ne=w.useRef(!1);w.useEffect(()=>{!ne.current&&Y.length>0&&!C&&(_(xy(Y)),ne.current=!0)},[Y.length]),w.useEffect(()=>{ne.current=!1,_(""),O(null),J(null),L(null)},[h]);const K=w.useCallback(()=>{_(xy(Y))},[Y]),q=async()=>{L(null),J(null);try{const D=await i(C||void 0);J(D),_("")}catch(D){L(D instanceof Error?D.message:"Save failed")}},se=async()=>{O(null),L(null);try{const D=await v();O(D)}catch(D){L(D instanceof Error?D.message:"Pull failed")}},ue=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){I(!0);try{await u(D),I(!1)}catch(B){L(B instanceof Error?B.message:"Restore failed"),I(!1)}}};w.useEffect(()=>{const D=B=>{B.key==="Escape"&&a()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[a]);const V=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&q()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),l.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:V,children:[l.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE COMPANY"}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[g&&g.hasRemote&&(g.behind>0||g.ahead>0)&&l.jsxs("span",{className:"text-[10px] font-bold",style:{color:g.behind>0?"var(--idle-amber)":"var(--active-green)"},children:[g.behind>0&&`↓${g.behind}`,g.behind>0&&g.ahead>0&&" ",g.ahead>0&&`↑${g.ahead}`]}),l.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]})]}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["akb","code"].map(D=>l.jsx("button",{onClick:()=>x(D),className:"flex-1 py-1.5 text-[10px] font-bold uppercase tracking-wider cursor-pointer",style:{background:h===D?"var(--hud-bg-alt)":"transparent",color:h===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:h===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="akb"?"AKB":"CODE"},D))}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>l.jsx("button",{onClick:()=>E(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:N===D?"var(--hud-bg-alt)":"transparent",color:N===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:N===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[N==="save"&&l.jsxs(l.Fragment,{children:[(e==null?void 0:e.noGit)&&l.jsx(y8,{onInitGit:async()=>{await(k==null?void 0:k()),j==null||j()},onDelegate:f?()=>{f(`Git is not initialized or not installed for this project. Please check if git is installed (run "git --version"). If git is available, initialize the repository with "git init" and make an initial commit. If git is not installed, provide clear instructions for the user's OS to install it.`)}:void 0,delegateRoleName:m}),g&&g.hasRemote&&g.behind>0&&l.jsxs("div",{className:"flex items-center justify-between p-2",style:{background:"rgba(255,180,0,0.08)",border:"1px solid var(--idle-amber)"},children:[l.jsxs("span",{className:"text-[11px]",style:{color:"var(--idle-amber)"},children:[g.behind," commit",g.behind>1?"s":""," behind remote"]}),l.jsx("button",{onClick:se,disabled:b,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--idle-amber)",color:"#000",border:"none",opacity:b?.5:1},children:b?"PULLING...":"↓ PULL"})]}),A&&l.jsx("div",{className:"text-[11px] p-2",style:{background:A.status==="ok"||A.status==="up-to-date"?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${A.status==="ok"||A.status==="up-to-date"?"var(--active-green)":"#D32F2F"}`,color:A.status==="ok"||A.status==="up-to-date"?"var(--active-green)":"#EF5350"},children:A.message}),l.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:Y.length>0?l.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",Y.length," unsaved change",Y.length>1?"s":""]}):l.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),Y.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),l.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:Y.map(({status:D,file:B})=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),l.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:B})]},B))})]}),Y.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),l.jsxs("button",{onClick:K,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),l.jsx("input",{ref:U,type:"text",value:C,onChange:D=>_(D.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),Y.length>0&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:q,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":e!=null&&e.hasRemote?"SAVE & PUSH":"SAVE"}),f&&l.jsxs("button",{onClick:()=>{const D=Y.map(B=>`${B.status} ${B.file}`).join(`
|
|
92
92
|
`);f(D)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${m??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(m==null?void 0:m.toUpperCase())??"DELEGATE"]})]}),e&&!e.hasRemote&&!e.noGit&&l.jsx(b8,{repo:h,onConnected:()=>j==null?void 0:j(),onDelegate:f?()=>{f(`Set up a GitHub remote for the ${h==="akb"?"AKB":"Code"} repository and push all commits. If gh CLI is available, use "gh repo create". Otherwise, guide through manual setup. Current repo path can be found in config.`)}:void 0,delegateRoleName:m}),X&&l.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! ",X.filesChanged," file",X.filesChanged>1?"s":""," committed",X.pushed?" & pushed":"",X.pushError?` (push error: ${X.pushError})`:""]}),M&&l.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:M}),(e==null?void 0:e.lastCommit)&&l.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",e.lastCommit.message," (",gy(e.lastCommit.date),")"]})]}),N==="history"&&l.jsxs(l.Fragment,{children:[n.length===0&&l.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),l.jsx("div",{className:"space-y-1",children:n.map(D=>l.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:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),l.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:gy(D.date)})]}),l.jsx("button",{onClick:()=>ue(D.sha),disabled:R,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}function w8({onClose:e}){const[n,a]=w.useState(null),[i,o]=w.useState(!0),[u,d]=w.useState(null),[,f]=w.useState(!1);return w.useEffect(()=>{Promise.all([ye.getCompanyStats(),ye.getPreferences()]).then(async([m,h])=>{a(m);const x=h;if(x.instanceId)try{await wr.syncStats({instanceId:x.instanceId,roleCount:m.company.roleCount,totalTokens:m.company.totalTokens,rolesData:m.roles.map(g=>({roleId:g.roleId,name:g.name,tokens:g.totalTokens}))}),f(!0)}catch{}}).catch(m=>d(m.message)).finally(()=>o(!1))},[]),i?l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!n?l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[l.jsx(Au,{label:"Roles",value:String(n.company.roleCount)}),l.jsx(Au,{label:"Avg Level",value:`Lv.${n.company.avgLevel}`}),l.jsx(Au,{label:"Total Tokens",value:n.company.formattedTokens}),l.jsx(Au,{label:"Total Cost",value:`$${n.company.totalCostUsd.toFixed(2)}`})]}),l.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.roles.map((m,h)=>l.jsx(k8,{role:m,rank:h+1},m.roleId)),n.roles.length===0&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(n.byModel).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(n.byModel).map(([m,h])=>l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:j8(m)}),l.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",h.costUsd.toFixed(2)]})]},m))})]})]})}function Au({label:e,value:n}){return l.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[l.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:e}),l.jsx("div",{style:{fontSize:18,fontWeight:600},children:n})]})}function k8({role:e,rank:n}){const a=["🥇","🥈","🥉"],i=n<=3?a[n-1]:`#${n}`;return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[l.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[l.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),l.jsxs("span",{style:{fontSize:12,color:yy(e.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",e.level]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:l.jsx("div",{style:{width:`${e.progress*100}%`,height:"100%",background:yy(e.level),borderRadius:2,transition:"width 0.3s ease"}})}),l.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:e.formattedTokens})]})]})]})}function yy(e){return e>=20?"#FFD700":e>=10?"#C0A0FF":e>=5?"#4FC3F7":e>=3?"#81C784":"rgba(255,255,255,0.4)"}function j8(e){return e.includes("opus")?"Opus":e.includes("sonnet")?"Sonnet":e.includes("haiku")?"Haiku":e.split("-").slice(0,2).join(" ")}function S8({onClose:e,onSyncComplete:n}){const[a,i]=w.useState([]),[o,u]=w.useState([]),[d,f]=w.useState(!0),[m,h]=w.useState(null),[x,g]=w.useState(new Set),[v,b]=w.useState(null),[j,k]=w.useState(null),N=w.useCallback(async()=>{f(!0),b(null);try{const{roles:C}=await ye.getSyncRoles();i(C);const _=C.filter(M=>M.source.sync!=="off");if(_.length===0){u([]),k(null);return}try{const M=await wr.syncCheck(_.map(R=>({roleId:R.roleId,sourceId:R.source.id,currentVersion:R.source.upstream_version??R.source.forked_at??"0.0.0"})));k(!0);const L=[];for(const R of M.updates){if(!R.hasUpdate)continue;const I=_.find(U=>U.roleId===R.roleId);if(!I)continue;const{character:X}=await wr.syncPull(R.sourceId),J=[];I.persona.trim()!==X.persona.trim()&&J.push({field:"persona",local:I.persona.slice(0,120)+(I.persona.length>120?"...":""),upstream:X.persona.slice(0,120)+(X.persona.length>120?"...":"")});const A=JSON.stringify(I.authority),O=JSON.stringify(X.authority);A!==O&&J.push({field:"authority",local:`${I.authority.autonomous.length} autonomous, ${I.authority.needsApproval.length} approval`,upstream:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`}),J.length>0&&L.push({roleId:R.roleId,roleName:I.name,sourceId:R.sourceId,currentVersion:R.currentVersion,latestVersion:R.latestVersion,fields:J})}u(L)}catch{k(!1),u([])}}catch(C){b(C instanceof Error?C.message:"Failed to check for updates")}finally{f(!1)}},[]);w.useEffect(()=>{N()},[N]);const E=async C=>{h(C.roleId);try{const{character:_,version:M}=await wr.syncPull(C.sourceId);await ye.applySyncUpdate({roleId:C.roleId,changes:{persona:_.persona,authority:_.authority},upstreamVersion:M}),g(L=>new Set(L).add(C.roleId)),n==null||n()}catch(_){b(_ instanceof Error?_.message:"Failed to apply update")}finally{h(null)}};return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{onClick:N,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),v&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:v}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),l.jsx("span",{style:{fontWeight:500},children:a.length}),l.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),l.jsx("span",{style:{fontWeight:500,color:o.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:o.filter(C=>!x.has(C.roleId)).length}),j===!0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),l.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),o.length===0&&!d&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:a.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),o.map(C=>l.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:14,fontWeight:500},children:C.roleName}),l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[C.sourceId," · v",C.currentVersion," → v",C.latestVersion]})]}),x.has(C.roleId)?l.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):l.jsx("button",{onClick:()=>E(C),disabled:m===C.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:m===C.roleId?"wait":"pointer",opacity:m===C.roleId?.6:1},children:m===C.roleId?"Applying...":"Apply Update"})]}),C.fields.map(_=>l.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[l.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:_.field}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[l.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[l.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),l.jsx("br",{}),_.local]}),l.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[l.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),l.jsx("br",{}),_.upstream]})]})]},_.field))]},C.roleId)),a.length>0&&l.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",l.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function C8({onClose:e}){const[n,a]=w.useState(null),[i,o]=w.useState(!0),[u,d]=w.useState(null),[f,m]=w.useState(null),h=w.useCallback(async()=>{o(!0),d(null);try{const C=await ye.getGitStatus();a(C)}catch(C){d(C instanceof Error?C.message:"Failed to load git status")}finally{o(!1)}},[]);w.useEffect(()=>{h()},[h]);const x=async C=>{m(C.path);try{await ye.deleteWorktree(C.path),await h()}catch(_){d(_ instanceof Error?_.message:"Failed to remove worktree")}finally{m(null)}},g=async C=>{m(C);try{await ye.deleteBranch(C),await h()}catch(_){d(_ instanceof Error?_.message:"Failed to delete branch")}finally{m(null)}};if(i&&!n)return l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!n)return l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!n)return null;const v=n.worktrees.filter(C=>C.status==="active"),b=n.worktrees.filter(C=>C.status==="pending-merge"),j=n.worktrees.filter(C=>C.status==="stale");function k(C){const _=C.split("/");if(_.length>1){const M=_[_.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const R of L)if(M.toLowerCase().includes(R))return R}return null}function N(C,_=40){return C.length<=_?C:"..."+C.slice(C.length-_+3)}function E(C){const _=Date.now()-new Date(C).getTime(),M=Math.floor(_/6e4);if(M<1)return"just now";if(M<60)return`${M}m ago`;const L=Math.floor(M/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`}return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{onClick:h,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),l.jsx("span",{style:{fontWeight:500},children:n.currentBranch})]}),l.jsx("div",{children:n.unsavedCount>0&&l.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[n.unsavedCount," unsaved"]})})]}),n.lastCommit&&l.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",n.lastCommit.message.slice(0,60),n.lastCommit.message.length>60?"...":""," · ",E(n.lastCommit.date)]})]}),v.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Du,{label:"Active Worktrees",count:v.length}),v.map(C=>l.jsx(Uh,{wt:C,roleFromBranch:C.roleId||k(C.branch),truncatePath:N,timeAgo:E,removing:f===C.path,onRemove:()=>x(C),statusColor:"#4FC3F7",statusIcon:"📂"},C.path))]}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Du,{label:"Pending Merge",count:b.length}),b.map(C=>l.jsx(Uh,{wt:C,roleFromBranch:C.roleId||k(C.branch),truncatePath:N,timeAgo:E,removing:f===C.path,onRemove:()=>x(C),statusColor:"#FFB74D",statusIcon:"⚠️"},C.path))]}),j.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Du,{label:"Stale",count:j.length}),j.map(C=>l.jsx(Uh,{wt:C,roleFromBranch:C.roleId||k(C.branch),truncatePath:N,timeAgo:E,removing:f===C.path,onRemove:()=>x(C),statusColor:"#ff6b6b",statusIcon:"🔴"},C.path))]}),n.staleBranches.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Du,{label:"Unmerged Branches",count:n.staleBranches.length}),n.staleBranches.map(C=>l.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs("div",{style:{fontSize:13},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),l.jsx("span",{style:{fontWeight:500},children:C})]}),l.jsx("button",{onClick:()=>g(C),disabled:f===C,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:f===C?"wait":"pointer",opacity:f===C?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:f===C?"...":"DELETE"})]},C))]}),v.length===0&&b.length===0&&j.length===0&&n.staleBranches.length===0&&l.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),n.lastMerge&&l.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:n.lastMerge.branch})," · ",n.lastMerge.roleId," · ",E(n.lastMerge.mergedAt)]})]})}function Du({label:e,count:n}){return l.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",n,")"]})}function Uh({wt:e,roleFromBranch:n,truncatePath:a,timeAgo:i,removing:o,onRemove:u,statusColor:d,statusIcon:f}){return l.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[l.jsx("span",{style:{marginRight:6},children:f}),e.branch,n&&l.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:n})]}),e.task&&l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',e.task.slice(0,50),e.task.length>50?"...":"",'"']}),l.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[a(e.path)," · ",e.filesChanged," file",e.filesChanged!==1?"s":""," changed"," · ",i(e.createdAt)]}),e.conflictFiles&&e.conflictFiles.length>0&&l.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",e.conflictFiles.join(", ")]})]}),l.jsx("button",{onClick:u,disabled:o,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:o?"wait":"pointer",opacity:o?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:o?"...":"REMOVE"})]})})}function E8({onClose:e}){const[n,a]=w.useState(null),[i,o]=w.useState(!0),[u,d]=w.useState(null),[f,m]=w.useState(null),h=w.useCallback(async()=>{o(!0),d(null);try{const k=await ye.getActiveSessions();a(k)}catch(k){d(k instanceof Error?k.message:"Failed to load sessions")}finally{o(!1)}},[]);w.useEffect(()=>{h();const k=setInterval(h,1e4);return()=>clearInterval(k)},[h]);const x=async k=>{m(k);try{await ye.deleteActiveSession(k),await h()}catch(N){d(N instanceof Error?N.message:"Failed to remove session")}finally{m(null)}},g=async()=>{try{await ye.cleanupActiveSessions(),await h()}catch(k){d(k instanceof Error?k.message:"Failed to cleanup sessions")}};if(i&&!n)return l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading sessions..."});if(u&&!n)return l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!n)return null;const v=n.sessions.filter(k=>k.status==="active"),b=n.sessions.filter(k=>k.status==="idle"),j=n.sessions.filter(k=>k.status==="dead");return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"ACTIVE SESSIONS"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[j.length>0&&l.jsx("button",{onClick:g,style:{background:"rgba(255,180,100,0.15)",border:"1px solid rgba(255,180,100,0.2)",color:"#FFB74D",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Cleanup Dead"}),l.jsx("button",{onClick:h,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13,display:"flex",justifyContent:"space-between"},children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Sessions: "}),l.jsx("span",{style:{fontWeight:500},children:n.summary.active})]}),l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Ports in use: "}),l.jsx("span",{style:{fontWeight:500},children:n.summary.totalPorts})]})]}),v.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(qh,{label:"Active",count:v.length}),v.map(k=>l.jsx(Yh,{session:k,removing:f===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#4FC3F7"},k.sessionId))]}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(qh,{label:"Idle",count:b.length}),b.map(k=>l.jsx(Yh,{session:k,removing:f===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#FFB74D"},k.sessionId))]}),j.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(qh,{label:"Dead",count:j.length}),j.map(k=>l.jsx(Yh,{session:k,removing:f===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#ff6b6b"},k.sessionId))]}),n.sessions.length===0&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:"No active sessions. Sessions appear when jobs run with port allocation."})]})}function qh({label:e,count:n}){return l.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",n,")"]})}function N8(e){const n=Date.now()-new Date(e).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Yh({session:e,removing:n,onRemove:a,statusColor:i}){const{ports:o}=e;return l.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[l.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:i,marginRight:8,verticalAlign:"middle"}}),l.jsx("span",{style:{textTransform:"uppercase"},children:e.roleName||e.roleId}),e.jobStatus&&l.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)"},children:e.jobStatus})]}),e.task&&l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:4},children:['"',e.task.slice(0,60),e.task.length>60?"...":"",'"']}),l.jsxs("div",{style:{fontSize:11,display:"flex",gap:8,marginBottom:2},children:[l.jsxs("span",{style:{color:"#81C784"},children:["API:",o.api||"?"]}),l.jsxs("span",{style:{color:"#64B5F6"},children:["Vite:",o.vite||"?"]}),o.hmr&&l.jsxs("span",{style:{color:"#FFB74D"},children:["HMR:",o.hmr]})]}),l.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[e.sessionId.slice(0,12),"...",e.worktreePath&&l.jsxs(l.Fragment,{children:[" · ",A8(e.worktreePath)]}),e.pid&&l.jsxs(l.Fragment,{children:[" · ","PID:",e.pid]})," · ",N8(e.startedAt)]})]}),l.jsx("button",{onClick:a,disabled:n,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:n?"wait":"pointer",opacity:n?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:n?"...":"STOP"})]})})}function A8(e,n=35){return e.length<=n?e:"..."+e.slice(e.length-n+3)}function D8({onClose:e,speechSettings:n,onSpeechSettingsChange:a,language:i,onLanguageChange:o,onOpenSync:u,onOpenGitStatus:d,onOpenSessions:f,onOpenStats:m}){var se;const[h,x]=w.useState(null),[g,v]=w.useState(null),[b,j]=w.useState(!1),[k,N]=w.useState(!1),[E,C]=w.useState(!1),[_,M]=w.useState(null),[L,R]=w.useState(""),[I,X]=w.useState(!1),[J,A]=w.useState(!1),[O,U]=w.useState(null),[Y,ne]=w.useState(!1);w.useEffect(()=>{ye.getPreferences().then(async ue=>{const V=ue;if(x(V.instanceId??null),V.instanceId)try{const{name:D}=await wr.getMyName(V.instanceId);v(D)}catch{}}).catch(()=>{}),ye.getCodeRoot().then(({codeRoot:ue})=>{M(ue),ue&&R(ue)}).catch(()=>{})},[]);const K=async()=>{C(!0);try{const V=await(await fetch("/api/preferences/regenerate-token",{method:"POST"})).json();V.ok&&(x(V.newInstanceId),N(!1))}catch{}C(!1)},q=()=>{h&&navigator.clipboard.writeText(h).then(()=>{j(!0),setTimeout(()=>j(!1),2e3)})};return l.jsx("div",{className:"customize-overlay",onClick:e,children:l.jsxs("div",{className:"customize-modal",onClick:ue=>ue.stopPropagation(),style:{maxWidth:480},children:[l.jsxs("div",{className:"customize-header",children:[l.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),l.jsx("button",{className:"customize-close",onClick:e,children:"X"})]}),l.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),l.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(ue=>l.jsxs("button",{onClick:()=>a==null?void 0:a({mode:ue}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(n==null?void 0:n.mode)===ue?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(n==null?void 0:n.mode)===ue?"rgba(255,255,255,0.08)":"transparent",color:(n==null?void 0:n.mode)===ue?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:2},children:ue==="template"?"TEMPLATE":ue==="llm"?"AI":"AUTO"}),l.jsx("div",{style:{fontSize:9,opacity:.7},children:ue==="template"?"Static pool ($0)":ue==="llm"?"LLM generated":"Detect engine"})]},ue))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(n==null?void 0:n.intervalSec)??18,"s"]}),l.jsx("input",{type:"range",min:5,max:120,step:5,value:(n==null?void 0:n.intervalSec)??18,onChange:ue=>a==null?void 0:a({intervalSec:Number(ue.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"5s (frequent)"}),l.jsx("span",{children:"120s (rare)"})]})]}),(n==null?void 0:n.mode)!=="template"&&l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((se=n==null?void 0:n.dailyBudgetUsd)==null?void 0:se.toFixed(2))??"1.00"]}),l.jsx("input",{type:"range",min:0,max:5,step:.25,value:(n==null?void 0:n.dailyBudgetUsd)??1,onChange:ue=>a==null?void 0:a({dailyBudgetUsd:Number(ue.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"$0 (unlimited)"}),l.jsx("span",{children:"$5.00/day"})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),l.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:ue,label:V})=>l.jsx("button",{onClick:()=>o==null?void 0:o(ue),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===ue?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===ue?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===ue?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:V},ue))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"CODE REPOSITORY"}),I?l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",gap:6},children:[l.jsx("input",{type:"text",value:L,onChange:ue=>{R(ue.target.value),U(null)},placeholder:"/path/to/code/repo",style:{flex:1,padding:"8px 10px",fontSize:11,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:6,color:"var(--terminal-text)",fontFamily:"monospace",outline:"none"},autoFocus:!0}),l.jsx("button",{onClick:async()=>{if(L.trim()){A(!0),U(null);try{const ue=await ye.setCodeRoot(L.trim());M(ue.codeRoot),R(ue.codeRoot),X(!1),ne(!0),setTimeout(()=>ne(!1),3e3)}catch(ue){U(ue instanceof Error?ue.message:"Failed to set code root")}finally{A(!1)}}},disabled:J||!L.trim(),style:{padding:"8px 12px",fontSize:10,fontWeight:600,background:"var(--accent)",border:"none",color:"#fff",borderRadius:6,cursor:"pointer",opacity:J||!L.trim()?.5:1},children:J?"...":"Save"}),l.jsx("button",{onClick:()=>{X(!1),R(_||""),U(null)},style:{padding:"8px 10px",fontSize:10,background:"transparent",border:"1px solid rgba(255,255,255,0.1)",color:"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer"},children:"Cancel"})]}),O&&l.jsx("div",{style:{fontSize:9,color:"#ff6b6b",marginTop:4},children:O})]}):l.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[l.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:_?"var(--terminal-text)":"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_||"Not configured"}),l.jsx("button",{onClick:()=>{X(!0),U(null),ne(!1)},style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer"},children:"Change"})]}),Y&&l.jsx("div",{style:{fontSize:9,color:"#4ade80",marginTop:4},children:"Code repository updated!"}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Path to your code repository (separate from AKB). If not set, auto-created as ../[company]-code/ when AI starts working."})]}),h&&l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"STORE TOKEN"}),l.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[l.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),l.jsx("button",{onClick:q,style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:b?"#4ade80":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",whiteSpace:"nowrap"},children:b?"Copied!":"Copy"})]}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Use this token to sign in on the web Store. Keep it secret — anyone with this token can act as you."}),l.jsx("div",{style:{marginTop:6},children:k?l.jsxs("div",{style:{background:"rgba(255,50,50,0.08)",border:"1px solid rgba(255,50,50,0.2)",borderRadius:6,padding:"8px 10px"},children:[l.jsx("div",{style:{fontSize:9,color:"rgba(255,100,100,0.8)",marginBottom:6},children:"This will invalidate your current token. Published characters will lose ownership. No migration."}),l.jsxs("div",{style:{display:"flex",gap:6},children:[l.jsx("button",{onClick:K,disabled:E,style:{padding:"4px 12px",fontSize:9,fontWeight:700,border:"1px solid rgba(255,50,50,0.4)",background:"rgba(255,50,50,0.15)",color:"#ff6464",borderRadius:4,cursor:"pointer"},children:E?"...":"Confirm Regenerate"}),l.jsx("button",{onClick:()=>N(!1),style:{padding:"4px 12px",fontSize:9,border:"none",background:"transparent",color:"var(--terminal-text-muted)",cursor:"pointer"},children:"Cancel"})]})]}):l.jsx("button",{onClick:()=>N(!0),style:{padding:"4px 10px",fontSize:9,fontWeight:600,border:"1px solid rgba(255,100,100,0.2)",background:"transparent",color:"rgba(255,100,100,0.6)",borderRadius:4,cursor:"pointer"},children:"Regenerate Token"})})]}),l.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&l.jsx("button",{onClick:()=>{e(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&l.jsx("button",{onClick:()=>{e(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),f&&l.jsx("button",{onClick:()=>{e(),f()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🖥 SESSIONS"}),m&&l.jsx("button",{onClick:()=>{e(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"}),l.jsx("button",{onClick:()=>window.open("https://tycono.ai/store.html","_blank"),className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🌐 WEB STORE"})]}),g&&l.jsx("div",{style:{textAlign:"center",marginTop:-8},children:l.jsx("a",{href:`https://tycono.ai/profile.html?u=${encodeURIComponent(g)}`,target:"_blank",rel:"noopener noreferrer",style:{fontSize:10,color:"var(--terminal-text-muted)",textDecoration:"none"},onMouseEnter:ue=>ue.currentTarget.style.color="var(--accent)",onMouseLeave:ue=>ue.currentTarget.style.color="var(--terminal-text-muted)",children:"View public profile →"})})]})})]})})}function T8({theme:e,onThemeChange:n,onClose:a}){const i=w.useRef(null);return w.useEffect(()=>{const o=u=>{i.current&&!i.current.contains(u.target)&&a()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[a]),l.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(il).map(([o,u])=>l.jsxs("button",{className:`theme-dropup__item${e===o?" theme-dropup__item--active":""}`,onClick:()=>{n(o),a()},title:u.name,children:[l.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[l.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),l.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),l.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),l.jsx("span",{className:"theme-dropup__name",children:u.icon})]},o))})}const ys={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function F8({roles:e,roleStatuses:n,activeExecs:a,sessions:i,knowledgeDocs:o,roleLevels:u,companyName:d,getAppearance:f,waveCenterWaves:m,renderProfile:h,channel:x,onChannelChange:g,onClose:v,children:b}){const[j,k]=w.useState(!1),N=m.filter(I=>I.rootJobs.some(X=>{const J=n[X.roleId];return J==="working"||J==="thinking"})),E=[...e].sort((I,X)=>I.level==="c-level"&&X.level!=="c-level"?-1:I.level!=="c-level"&&X.level==="c-level"?1:I.name.localeCompare(X.name)),C=e.filter(I=>n[I.id]==="working").length,_=i.filter(I=>I.status==="active").length,M=x.type==="role"?e.find(I=>I.id===x.roleId):null,L=x.type==="dashboard"?"Dashboard":x.type==="terminal"?"Chats":x.type==="wave"?"Wave Center":x.type==="knowledge"?"Knowledge Base":x.type==="operations"?"Operations":x.type==="role"?(M==null?void 0:M.name)??x.roleId:"Dashboard",R=x.type==="terminal"?`${_} active sessions`:x.type==="wave"?`${N.length} running`:x.type==="knowledge"?`${o.length} documents`:x.type==="role"?(M==null?void 0:M.level)==="c-level"?"C-Level":"Team member":`${C} working · ${e.length} total`;return l.jsxs("div",{className:"fixed inset-0 z-[60] flex",style:{background:"var(--terminal-bg, #1C1612)"},children:[l.jsxs("div",{className:"flex flex-col shrink-0 overflow-y-auto",style:{width:240,borderRight:"1px solid var(--terminal-border, #2E261F)",background:"var(--terminal-surface, #1a1510)"},children:[l.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsx("span",{className:"text-[11px] font-bold tracking-wider flex-1",style:{color:"var(--terminal-text, #fff5eb)",fontFamily:"var(--pixel-font)"},children:d}),C>0&&l.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full animate-pulse",style:{background:"#4CAF5020",color:"#4CAF50"},children:[C," live"]})]}),N.length>0&&l.jsxs("button",{className:"mx-3 mt-3 px-3 py-2.5 rounded-lg text-left transition-all hover:opacity-90",style:{background:x.type==="wave"?"#EF444420":"#EF444410",border:"1px solid #EF444430"},onClick:()=>g({type:"wave"}),children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsxs("span",{className:"text-[10px] font-bold truncate flex-1",style:{color:"#EF4444"},children:["⚡"," ",N[0].directive.slice(0,28)]}),l.jsx("span",{className:"text-[7px] px-1.5 py-0.5 rounded font-bold shrink-0",style:{background:"#EF4444",color:"#fff"},children:"LIVE"})]}),l.jsxs("div",{className:"text-[9px]",style:{color:"var(--terminal-text-muted)"},children:[N[0].rootJobs.filter(I=>{const X=n[I.roleId];return X==="working"||X==="thinking"}).length,"/",N[0].rootJobs.length," roles working"]})]}),l.jsxs("div",{className:"mx-3 mt-3 grid grid-cols-2 gap-1.5",children:[l.jsx(Tu,{icon:"💬",label:"Chats",badge:_||void 0,active:x.type==="terminal",onClick:()=>g({type:"terminal"})}),l.jsx(Tu,{icon:"⚡",label:"Waves",live:N.length>0,active:x.type==="wave",onClick:()=>g({type:"wave"})}),l.jsx(Tu,{icon:"📋",label:"Decisions",active:x.type==="operations",onClick:()=>g({type:"operations"})}),l.jsx(Tu,{icon:"📚",label:"Knowledge",badge:o.length||void 0,active:x.type==="knowledge",onClick:()=>g({type:"knowledge"})})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("div",{className:"px-4 py-1 text-[9px] font-bold tracking-widest",style:{color:"var(--terminal-text-muted)"},children:"TEAM"}),E.map(I=>{var Y;const X=n[I.id],J=a.find(ne=>ne.roleId===I.id),A=ys[I.id]??"#666",O=(Y=u[I.id])==null?void 0:Y.level,U=x.type==="role"&&x.roleId===I.id;return l.jsxs("button",{onClick:()=>g({type:"role",roleId:I.id}),className:"flex items-center gap-2.5 w-full px-4 py-1.5 text-left hover:opacity-80 transition-all",style:{background:U?`${A}18`:"transparent",borderLeft:U?`2px solid ${A}`:"2px solid transparent"},children:[l.jsxs("div",{className:"relative shrink-0",style:{width:22,height:22},children:[l.jsx(Vl,{roleId:I.id,appearance:f(I.id),scale:1.3}),l.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full",style:{background:X==="working"?"#4CAF50":X==="idle"?"#FFC107":"#9E9E9E",border:"1.5px solid var(--terminal-surface, #1a1510)"}})]}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"text-[11px] truncate",style:{color:"var(--terminal-text, #fff5eb)"},children:[I.name,O!=null&&l.jsxs("span",{className:"ml-1 opacity-40 text-[8px]",children:["Lv.",O]})]}),J?l.jsx("div",{className:"text-[9px] truncate",style:{color:A},children:J.task.slice(0,28)}):l.jsx("div",{className:"text-[9px]",style:{color:"var(--terminal-text-muted, #887766)"},children:I.level==="c-level"?I.id.toUpperCase():I.id})]}),X==="working"&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:A}})]},I.id)})]}),l.jsx("div",{className:"flex-1"}),a.length>0&&l.jsxs("div",{className:"shrink-0 px-3 pb-2",style:{borderTop:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsxs("div",{className:"px-1 py-1.5 text-[8px] font-bold tracking-widest",style:{color:"var(--terminal-text-muted)"},children:["ACTIVE JOBS (",a.length,")"]}),l.jsx("div",{className:"space-y-0.5 max-h-[140px] overflow-y-auto",children:a.map(I=>{const X=e.find(O=>O.id===I.roleId),J=ys[I.roleId]??"#666",A=x.type==="role"&&x.roleId===I.roleId;return l.jsxs("button",{onClick:()=>g({type:"role",roleId:I.roleId}),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded text-left hover:opacity-80 transition-all",style:{background:A?`${J}18`:"transparent"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:J}}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text, #fff5eb)"},children:(X==null?void 0:X.name)??I.roleId}),l.jsx("div",{className:"text-[8px] truncate",style:{color:"var(--terminal-text-muted)"},children:I.task.slice(0,40)})]})]},I.jobId??I.roleId)})})]}),l.jsx("div",{className:"px-3 py-3 shrink-0",style:{borderTop:"1px solid var(--terminal-border, #2E261F)"},children:l.jsxs("button",{onClick:v,className:"flex items-center gap-2 w-full px-3 py-2.5 rounded-lg hover:opacity-80 transition-opacity",style:{background:"var(--terminal-border, #2E261F)",color:"var(--terminal-text, #fff5eb)"},children:[l.jsx("span",{className:"text-[12px]",children:"🏢"}),l.jsx("span",{className:"text-[11px] font-medium",children:"Office"})]})})]}),l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[x.type==="role"&&M&&l.jsxs("button",{onClick:()=>k(I=>!I),className:"relative shrink-0 rounded-lg overflow-hidden hover:opacity-80 transition-opacity cursor-pointer",style:{width:28,height:28,background:`${ys[M.id]??"#666"}30`},title:"View profile",children:[l.jsx(Vl,{roleId:M.id,appearance:f(M.id),scale:1.5}),l.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full",style:{background:n[M.id]==="working"?"#4CAF50":n[M.id]==="idle"?"#FFC107":"#9E9E9E",border:"2px solid var(--terminal-bg, #1C1612)"}})]}),l.jsx("span",{className:"text-[15px] font-semibold",style:{color:"var(--terminal-text, #fff5eb)"},children:L}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted, #887766)"},children:R}),l.jsx("span",{className:"flex-1"}),x.type==="role"&&l.jsx("button",{onClick:()=>k(I=>!I),className:"text-[10px] px-2 py-1 rounded hover:opacity-80 transition-opacity",style:{color:j?"var(--terminal-text)":"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)",background:j?"var(--terminal-border)":"transparent"},children:"Profile"}),x.type!=="dashboard"&&l.jsx("button",{onClick:()=>g({type:"dashboard"}),className:"text-[10px] px-2 py-1 rounded hover:opacity-80 transition-opacity",style:{color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"Dashboard"})]}),l.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[l.jsx("div",{className:"flex-1 overflow-hidden relative pro-panel-inline",children:b}),j&&x.type==="role"&&h&&l.jsx("div",{className:"shrink-0 overflow-hidden pro-panel-inline",style:{width:420,borderLeft:"1px solid var(--terminal-border, #2E261F)"},children:h(()=>k(!1))})]})]})]})}function R8({role:e,messages:n,isStreaming:a,mode:i,onModeChange:o,onSend:u,isWave:d}){const f=ys[e.id]??"#666";return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx(yv,{messages:n,roleId:e.id,roleColor:f}),d?l.jsxs("div",{className:"shrink-0 px-4 py-2 border-t flex items-center gap-2",style:{borderColor:"var(--terminal-border)",background:"var(--terminal-bg-deeper)"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:{animation:"pulse 2s infinite"}}),l.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"})]}):l.jsx(Qm,{mode:i,onModeChange:o,onSend:(m,h)=>u(m,i,h),disabled:a,disabledReason:a?`${e.id.toUpperCase()} is responding...`:void 0})]})}function M8({role:e,onSend:n,getAppearance:a,onOpenProfile:i}){const[o,u]=w.useState("talk"),d=ys[e.id]??"#666";return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[l.jsx("button",{onClick:i,className:"cursor-pointer hover:opacity-80 transition-opacity",children:l.jsx("div",{className:"rounded-lg p-1",style:{background:`${d}20`},children:l.jsx(Vl,{roleId:e.id,appearance:a(e.id),scale:5})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--terminal-text)"},children:e.name}),l.jsxs("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:[e.level==="c-level"?e.id.toUpperCase():e.id," · Start a conversation"]})]})]}),l.jsx(Qm,{mode:o,onModeChange:u,onSend:f=>n(f,o),disabled:!1})]})}function Tu({icon:e,label:n,active:a,badge:i,live:o,onClick:u}){return l.jsxs("button",{onClick:u,className:"flex flex-col items-center gap-1 py-3 rounded-lg transition-all hover:opacity-90",style:{background:a?"var(--desk-wood, #5C3D2E)":"var(--terminal-border, #2E261F)",border:a?"1px solid var(--desk-wood, #5C3D2E)":"1px solid transparent"},children:[l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"text-[16px]",children:e}),o&&l.jsx("span",{className:"absolute -top-1 -right-2 w-2 h-2 rounded-full animate-pulse",style:{background:"#EF4444"}}),i!==void 0&&i>0&&!o&&l.jsx("span",{className:"absolute -top-1.5 -right-3 text-[7px] px-1 py-0.5 rounded-full font-bold leading-none",style:{background:"var(--desk-wood, #5C3D2E)",color:"#fff",minWidth:14,textAlign:"center"},children:i})]}),l.jsx("span",{className:"text-[10px] font-semibold",style:{color:a?"#fff":"var(--terminal-text, #fff5eb)"},children:n})]})}function z8({roles:e,roleStatuses:n,activeExecs:a,waves:i,knowledgeDocs:o,roleLevels:u,getAppearance:d,onRoleClick:f,onWaveClick:m,onKnowledgeClick:h}){const x=e.filter(g=>n[g.id]==="working");return l.jsx("div",{className:"h-full overflow-y-auto px-6 py-5",children:l.jsxs("div",{className:"space-y-5 max-w-4xl",children:[l.jsxs("div",{className:"flex gap-3",children:[l.jsx(by,{label:"New Wave",icon:"⚡",color:"#EF4444",onClick:m}),l.jsx(by,{label:"Knowledge",icon:"📚",color:"#0D9488",onClick:h})]}),x.length>0&&l.jsx(Fu,{title:"Currently Working",count:x.length,children:a.map(g=>{const v=e.find(j=>j.id===g.roleId),b=ys[g.roleId]??"#666";return l.jsxs("button",{onClick:()=>f(g.roleId),className:"flex items-center gap-3 px-4 py-2.5 rounded hover:opacity-80 w-full text-left",style:{background:`${b}10`},children:[l.jsx("div",{className:"shrink-0",style:{width:24,height:24},children:l.jsx(Vl,{roleId:g.roleId,appearance:d(g.roleId),scale:1.2})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:b},children:v==null?void 0:v.name}),l.jsx("span",{className:"text-[11px] ml-2 truncate",style:{color:"var(--terminal-text-muted)"},children:g.task.slice(0,60)})]}),l.jsx("span",{className:"text-[10px] animate-pulse",style:{color:b},children:"●"})]},g.roleId)})}),l.jsx(Fu,{title:"Team",count:e.length,children:l.jsx("div",{className:"grid grid-cols-3 gap-1 px-2",children:e.map(g=>{var j;const v=n[g.id]??"offline",b=(j=u[g.id])==null?void 0:j.level;return l.jsxs("button",{onClick:()=>f(g.id),className:"flex items-center gap-2 px-3 py-2 rounded hover:opacity-80 text-left",children:[l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:v==="working"?"#4CAF50":v==="idle"?"#FFC107":"#9E9E9E"}}),l.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:g.name}),b!=null&&l.jsxs("span",{className:"text-[9px] opacity-40",children:["Lv.",b]})]},g.id)})})}),i.length>0&&l.jsx(Fu,{title:"Recent Waves",count:i.length,children:i.slice(0,5).map(g=>{var v;return l.jsxs("div",{className:"px-4 py-2 text-[11px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("span",{style:{color:"var(--terminal-text)"},children:["Wave ",g.id]})," — ",(v=g.directive)==null?void 0:v.slice(0,80)]},g.id)})}),l.jsx(Fu,{title:"Knowledge Base",count:o.length,children:l.jsxs("button",{onClick:h,className:"px-4 py-3 text-[11px] hover:opacity-80",style:{color:"var(--terminal-text-muted)"},children:[o.length," documents · Click to explore ","→"]})})]})})}function by({label:e,icon:n,color:a,onClick:i}){return l.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-5 py-3 rounded-lg hover:opacity-80 transition-opacity",style:{background:`${a}15`,border:`1px solid ${a}30`},children:[l.jsx("span",{className:"text-sm",children:n}),l.jsx("span",{className:"text-[12px] font-medium",style:{color:a},children:e})]})}function Fu({title:e,count:n,children:a}){return l.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--terminal-surface, #241E19)",border:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-2",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsx("span",{className:"text-[10px] font-bold tracking-wider",style:{color:"var(--terminal-text-muted)"},children:e.toUpperCase()}),n!==void 0&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{background:"var(--terminal-border)",color:"var(--terminal-text-muted)"},children:n})]}),l.jsx("div",{className:"py-1",children:a})]})}const wm=5e4;function _v(e){return e<wm?1:Math.max(1,Math.floor(Math.sqrt(e/wm)))}function vy(e){return wm*e*e}function _8(e){const n=_v(e),a=vy(n),i=vy(n+1);return Math.min(1,(e-a)/(i-a))}function Xh(e){const n={};for(const[a,i]of Object.entries(e)){const o=i.inputTokens+i.outputTokens;n[a]={level:_v(o),totalTokens:o,progress:_8(o)}}return n}const B8=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:e=>e.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:e=>e.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:e=>e.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:e=>e.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:e=>e.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:e=>e.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:e=>e.roles.some(n=>n.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:e=>e.roles.some(n=>n.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:e=>e.roles.some(n=>n.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:e=>e.roleCount>=3&&e.roles.every(n=>n.level>=5)},{id:"first-launch",name:"First Launch",icon:"🚀",description:"Completed Chapter 2 — gave your first order",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch2-q2"))??!1}},{id:"team-builder",name:"Team Builder",icon:"🏗️",description:"Completed Chapter 4 — dispatched your first wave",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch4-q2"))??!1}},{id:"explorer",name:"Explorer",icon:"🔍",description:"Completed Chapter 5 — customized a character",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch5-q2"))??!1}},{id:"interior-designer",name:"Interior Designer",icon:"🎨",description:"Completed Chapter 7 — bought premium furniture",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch7-q2"))??!1}},{id:"tycoon-master",name:"Tycoon Master",icon:"🎯",description:"Completed all 10 chapters",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch10-q3"))??!1}}];function wy(e){return B8.filter(n=>n.check(e))}const ky={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function O8({importJob:e,onImportDone:n}){var oc,cc,uc,Bs,dc;const[a,i]=w.useState([]),[o,u]=w.useState([]),[d,f]=w.useState([]),[m,h]=w.useState([]),[x,g]=w.useState([]),[v,b]=w.useState([]),[j,k]=w.useState("TYCONO"),[N,E]=w.useState(!0),[C,_]=w.useState(null),[M,L]=w.useState({type:"none"}),[R,I]=w.useState(null),[X,J]=w.useState(null),[A,O]=w.useState([]),[U,Y]=w.useState(!1),[ne,K]=w.useState(!1),[q,se]=w.useState([]),[ue,V]=w.useState([]),[D,B]=w.useState(0),[H,T]=w.useState(!1),[de,ge]=w.useState({}),[he,Be]=w.useState("ceo"),[He,Ie]=w.useState(null),[et,Ve]=w.useState(!1),[Ke,Ee]=w.useState(!1),[Ae,yt]=w.useState({}),dt=w.useRef({}),[xt,jt]=w.useState(!1),[Wt,Tt]=w.useState(null),[Ct,Bn]=w.useState({}),[pe,Se]=w.useState([]),Ne=w.useMemo(()=>{const F={};for(const P of pe)F[P.roleId]=P;return F},[pe]),[G,ce]=w.useState([]),[re,ve]=w.useState(0),[we,Me]=w.useState(Yg()),ze=w.useRef(Yg()),Oe=w.useRef(!1),qe=w.useRef(-1),[lt,Qe]=w.useState(null),bt=w.useRef(null),[Re,Ue]=w.useState(void 0),[_t,Bt]=w.useState(!1);w.useEffect(()=>{ye.getStatus().then(F=>{Ue(F.engine),Bt(!!F.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Ot,setAppearance:un,resetAppearance:kn,theme:Z,setTheme:$e,speechSettings:at,setSpeechSettings:Kt,language:ke,setLanguage:kt,purchasedItems:jn,addPurchasedItem:hn}=O6(),[te,_e]=w.useState(null),[,We]=w.useState("character"),Ze=I6(),[Sn,Wn]=w.useState(!1),[yn,mn]=w.useState(!1),[$r,Ql]=w.useState(!1),[Ds,Fi]=w.useState(!1),[Go,Fa]=w.useState(!1),[Ts,ca]=w.useState(!1),[Ra,Ma]=w.useState(!1),[Vn,Dn]=w.useState(null);w.useEffect(()=>{Ze.refresh()},[]),w.useEffect(()=>{const F=P=>{(P.metaKey||P.ctrlKey)&&P.key==="s"&&(P.preventDefault(),Wn(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[]),w.useEffect(()=>{if(!Ds)return;let F=!1;const P=async()=>{try{const me=await ye.getGitStatus();F||Dn(me)}catch{}};P();const ae=setInterval(P,1e4);return()=>{F=!0,clearInterval(ae)}},[Ds]);const[za,Ri]=w.useState(null),[fr,jr]=w.useState(null),[ol,Fs]=w.useState([]),[_a,Ko]=w.useState(!1),Zl=w.useRef(!1),cl=w.useRef(null);let Lr=w.useRef(0);const lr=w.useRef(new Set),Po=w.useRef(Date.now()),Ba=(F,P,ae)=>{const me={id:Lr.current++,type:F,text:P,detail:ae};Fs(je=>[...je,me])};w.useEffect(()=>{var F;_a&&((F=cl.current)==null||F.scrollIntoView({behavior:"smooth"}))},[ol,_a]),w.useEffect(()=>{e&&(Zl.current||(Zl.current=!0,jr("Scanning knowledge sources..."),Fs([{id:0,type:"scan",text:"Starting knowledge import..."}]),Lr.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e.paths,companyRoot:e.companyRoot})}).then(async F=>{var je;const P=(je=F.body)==null?void 0:je.getReader();if(!P)return;const ae=new TextDecoder;let me="";for(;;){const{done:Le,value:It}=await P.read();if(Le)break;me+=ae.decode(It,{stream:!0});const ft=me.split(`
|
|
93
93
|
`);me=ft.pop()||"";let tt="";for(const Pe of ft)if(Pe.startsWith("event: "))tt=Pe.slice(7).trim();else if(Pe.startsWith("data: ")&&tt){try{const mt=JSON.parse(Pe.slice(6));switch(tt){case"scanning":jr(`Scanning: ${mt.path} (${mt.fileCount} files)`),Ba("scan",`Found ${mt.fileCount} files`,mt.path);break;case"processing":Ri({index:mt.index,total:mt.total}),jr(`Importing knowledge... (${mt.index}/${mt.total})`),Ba("process",`Processing: ${mt.file}`,`${mt.index} / ${mt.total}`);break;case"created":Ba("created",mt.title,mt.summary);break;case"skipped":Ba("process",`Skipped: ${mt.file}`,mt.reason);break;case"done":jr(null),Ri(null),Ba("done",`Import complete! ${mt.created} created, ${mt.skipped} skipped.`),Et(`Knowledge import complete! ${mt.created} documents imported.`,"#2E7D32"),n==null||n();break;case"error":jr(null),Ri(null),Ba("error",mt.message),Et(`Import failed: ${mt.message}`,"#B71C1C"),n==null||n();break}}catch{}tt=""}}}).catch(F=>{jr(null),Ba("error",F.message),Et(`Import error: ${F.message}`,"#B71C1C"),n==null||n()})))},[e]);const[Sr,Ir]=w.useState("iso"),Cr=w.useRef("iso"),[ea,Pt]=w.useState({type:"dashboard"}),[Mi,Qo]=w.useState(typeof window<"u"?window.innerWidth:1200);w.useEffect(()=>{const F=()=>Qo(window.innerWidth);return window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const Jl=Mi<1024,[Gn,Oa]=w.useState(!1),[ua,ul]=w.useState(560),[Un,an]=w.useState([]),[ta,qn]=w.useState(null),[da,$a]=w.useState(null),{sendMessage:zi}=z6(),hr=w.useRef(new Map);w.useEffect(()=>{Promise.all([ye.getCompany().then(F=>{k(F.name),i(F.roles)}),ye.getOrgTree().then(F=>{ge(F.nodes),Be(F.root)}).catch(()=>{}),ye.getCostSummary().then(F=>fl(Xh(F.byRole))).catch(()=>{})]).catch(F=>_(`Failed to load: ${F.message}`)).finally(()=>E(!1)),ye.getProjects().then(u).catch(()=>{}),ye.getStandups().then(f).catch(()=>{}),ye.getWaves().then(h).catch(()=>{}),ye.getDecisions().then(g).catch(()=>{}),ye.getKnowledge().then(b).catch(()=>{}),ye.getQuestProgress().then(F=>{const P=Xg(F);P.activeChapter!==F.activeChapter&&ye.saveQuestProgress(P).catch(()=>{}),Me(P),ze.current=P,Oe.current=!0,ye.getCoins().then(ae=>{var me;ae.totalEarned===0?ye.migrateCoins(((me=P.completedQuests)==null?void 0:me.length)??0).then(je=>ve(je.balance)).catch(()=>{}):ve(ae.balance)}).catch(()=>{})}).catch(()=>{Oe.current=!0})},[]),w.useEffect(()=>{if(qe.current===-1){qe.current=o.length;return}o.length>qe.current&&ln({type:"project_created"}),qe.current=o.length},[o.length]);const _i=w.useRef(!1);w.useEffect(()=>{if(!(!Oe.current||a.length===0||_i.current)){_i.current=!0;for(const F of a)ln({type:"role_hired",condition:{roleId:F.id,roleCount:a.length}})}},[a.length]),w.useEffect(()=>{ye.getSessions().then(F=>{const P=F.filter(me=>me.source!=="wave");if(P.length>0){const me=P.map(Le=>({...Le,messages:[]}));an(me);const je=me.find(Le=>Le.status==="active")??me[0];qn(je.id),dl()}const ae=F.filter(me=>me.source==="wave").map(me=>me.id);ae.length>0&&ye.deleteSessions(ae).catch(()=>{})}).catch(F=>{console.error("Failed to load sessions",F)})},[]),w.useEffect(()=>{const F=()=>{fetch("/api/exec/status").then(ae=>ae.json()).then(ae=>{Bn(ae.statuses??{}),Se(ae.activeExecutions??[])}).catch(()=>{})};F();const P=setInterval(F,3e3);return()=>clearInterval(P)},[]);const fa=w.useMemo(()=>{const F={...Ct};if(da){const P=Un.find(ae=>ae.id===da);P&&(F[P.roleId]="working")}return F},[Ct,da,Un]);w.useEffect(()=>{M.type==="role"?ye.getRole(M.roleId).then(I).catch(console.error):I(null)},[M]);const mr=()=>L({type:"none"}),La=async(F,P)=>{const ae=await ye.updateDecision(F,P);g(me=>me.map(je=>je.id===F?ae:je))},Rs=async F=>{await ye.deleteDecision(F),g(P=>P.filter(ae=>ae.id!==F))},Kn=F=>{L(F),Oa(!1),K(!1)},dl=()=>{Oa(!0),L({type:"none"}),K(!1)},ha=()=>{Cr.current="iso",Pt({type:"wave"}),Ir("pro"),K(!0),Oa(!1),L({type:"none"})},na=async(F,P)=>{const ae=a.find(je=>je.id===F),me=(X==null?void 0:X.mode)==="ask";J(null);try{const je=await ye.startJob({type:"assign",roleId:F,task:P,readOnly:me}),Le=je.jobId,It=je.sessionId??`job-${Le}`,ft=ky[F]??"#666",tt=`${F.toUpperCase()} · ${(ae==null?void 0:ae.name)??F}`;T(!1),O([{sessionId:It,jobId:Le,title:tt,color:ft}]),ln({type:"task_executed",condition:{roleId:F}}),Jt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ae==null?void 0:ae.name)??F}] ${me?"Ask":"Assign"}: ${P}`,type:"dispatch",targetRoleId:F})}catch(je){Et(`Failed to start job: ${je instanceof Error?je.message:"unknown"}`,"#C62828")}},Ms=w.useRef(0),Et=(F,P)=>{const ae=++Ms.current;ce(me=>[...me,{id:ae,message:F,color:P}]),setTimeout(()=>ce(me=>me.filter(je=>je.id!==ae)),4e3)},ma=F=>{bt.current&&clearTimeout(bt.current),Qe(F),bt.current=setTimeout(()=>Qe(null),8e3)},ln=F=>{if(!Oe.current)return;let P=ze.current;const ae=cv(P);let me=0;const je=[];for(const It of ae){if(!BN(It,F))continue;const{progress:ft,quest:tt}=zN(P,It.id);tt&&(P=ft,me+=tt.rewards.coins??0,je.push(tt.title))}if(je.length===0)return;P=Xg(P),ze.current=P,Me(P);const Le=me>0?` 💰 +${me.toLocaleString()}`:"";je.length===1?Et(`📋 Quest complete: ${je[0]}${Le}`,"#7C3AED"):Et(`📋 ${je.length} quests complete!${Le}`,"#7C3AED"),Qe(null),ye.saveQuestProgress(P).catch(()=>{}),me>0&&ye.earnCoins(me,`quests: ${je.length}`,je.join(",")).then(It=>ve(It.balance)).catch(()=>{})};w.useEffect(()=>{if(!lt)return;const F=document.querySelector(`[data-quest-target="${lt}"]`);if(!F)return;F.classList.add("quest-spotlight");const P=()=>{F.classList.remove("quest-spotlight"),Qe(null),bt.current&&clearTimeout(bt.current)};return F.addEventListener("click",P,{once:!0}),()=>{F.classList.remove("quest-spotlight"),F.removeEventListener("click",P)}},[lt]);const fl=F=>{var ae,me;const P=dt.current;for(const[je,Le]of Object.entries(F)){const It=((ae=P[je])==null?void 0:ae.level)??0;if(It>0&&Le.level>It){const ft=((me=a.find(tt=>tt.id===je))==null?void 0:me.name)??je.toUpperCase();Et(`${ft} leveled up to Lv.${Le.level}!`,"#7C3AED")}}dt.current=F,yt(F)};w.useEffect(()=>{const F={roles:Object.entries(Ae).map(([je,Le])=>({id:je,level:Le.level,totalTokens:Le.totalTokens})),totalTokens:Object.values(Ae).reduce((je,Le)=>je+Le.totalTokens,0),roleCount:a.length,completedQuests:we.completedQuests},P=wy(F),ae=new Set(P.map(je=>je.id));if(Date.now()-Po.current>5e3){const je=lr.current;for(const Le of P)je.has(Le.id)||Et(`${Le.icon} Badge earned: ${Le.name}!`,"#D4A017")}lr.current=ae},[Ae,a.length,we.completedQuests]);const hl=w.useMemo(()=>MN(we),[we]),Bi=()=>{var P;const F=A[A.length-1];F&&(Et(`${F.title} completed`,F.color),Jt.pushMessage({ts:Date.now(),roleId:((P=F.title.split(" · ")[0])==null?void 0:P.toLowerCase())??"unknown",text:`[${F.title}] Job completed`,type:"dispatch"})),ye.getStandups().then(f).catch(console.error),ye.getCompany().then(ae=>i(ae.roles)).catch(console.error),ye.getCostSummary().then(ae=>fl(Xh(ae.byRole))).catch(()=>{})},pa=w.useRef(new Map),Zo=F=>{if(pa.current.has(F))return;const P=new AbortController;pa.current.set(F,P),$a(ae=>ae??F),fetch(`/api/sessions/${F}/stream?from=0`,{signal:P.signal}).then(async ae=>{var It,ft;if(!ae.ok||!ae.body)return;const me=ae.body.getReader(),je=new TextDecoder;let Le="";for(;;){const{done:tt,value:Pe}=await me.read();if(tt)break;Le+=je.decode(Pe,{stream:!0});const mt=Le.split(`
|
|
94
94
|
`);Le=mt.pop()??"";let Ft="";for(const xl of mt)if(xl.startsWith("event: "))Ft=xl.slice(7).trim();else if(xl.startsWith("data: ")){try{const sr=JSON.parse(xl.slice(6));Ft==="stream:end"?(an(ct=>ct.map($t=>{if($t.id!==F)return $t;const pn=$t.messages.map(dn=>dn.status==="streaming"?{...dn,status:"done"}:dn);return{...$t,messages:pn}})),$a(ct=>ct===F?null:ct),pa.current.delete(F)):Ft==="activity"&&(sr.type==="text"&&((It=sr.data)!=null&&It.text)?an(ct=>ct.map($t=>{if($t.id!==F)return $t;const pn=[...$t.messages],dn=pn[pn.length-1];return(dn==null?void 0:dn.from)==="role"&&dn.status==="streaming"&&(pn[pn.length-1]={...dn,content:dn.content+sr.data.text}),{...$t,messages:pn}})):sr.type==="thinking"&&((ft=sr.data)!=null&&ft.text)?an(ct=>ct.map($t=>{if($t.id!==F)return $t;const pn=[...$t.messages],dn=pn[pn.length-1];return(dn==null?void 0:dn.from)==="role"&&dn.status==="streaming"&&(pn[pn.length-1]={...dn,thinking:(dn.thinking??"")+sr.data.text}),{...$t,messages:pn}})):(sr.type==="job:done"||sr.type==="job:error")&&(an(ct=>ct.map($t=>{if($t.id!==F)return $t;const pn=$t.messages.map(dn=>dn.status==="streaming"?{...dn,status:sr.type==="job:done"?"done":"error"}:dn);return{...$t,messages:pn}})),$a(ct=>ct===F?null:ct),pa.current.delete(F)))}catch{}Ft=""}}}).catch(()=>{pa.current.delete(F),$a(ae=>ae===F?null:ae)})},Yn=async(F,P,ae)=>{Y(!1);try{const me=await ye.startJob({type:"wave",directive:F,targetRoles:P,...ae&&{attachments:ae}});ln({type:"wave_dispatched"});const je=me.jobIds??(me.jobId?[me.jobId]:[]),Le=he&&de[he]?de[he].children.map(ct=>a.find($t=>$t.id===ct)).filter(ct=>!!ct):a.filter(ct=>ct.level==="c-level"),It=P?Le.filter(ct=>P.includes(ct.id)):Le,ft=me.waveId??`wave-${Date.now()}`,tt=me.sessionIds??[],Pe=je.map((ct,$t)=>{var pn,dn;return{jobId:ct,roleId:((pn=It[$t])==null?void 0:pn.id)??`role-${$t}`,roleName:((dn=It[$t])==null?void 0:dn.name)??`C-Level ${$t+1}`,sessionId:tt[$t]??`wave-${ct}`}});Jt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${F}" → ${Pe.map(ct=>ct.roleName).join(", ")}`,type:"dispatch"});const mt={id:ft,directive:F,rootJobs:Pe,startedAt:Date.now(),sessionIds:tt};se(ct=>[mt,...ct]),ha();const Ft=new Date().toISOString(),sr=(tt.length>0?Pe.map((ct,$t)=>({id:tt[$t]??`wave-${ct.jobId}`,roleId:ct.roleId,title:`WAVE: ${ct.roleName}`,mode:"do",source:"wave",jobId:ct.jobId,messages:[{id:`msg-wave-${ct.jobId}-ceo`,from:"ceo",content:F,type:"directive",status:"done",timestamp:Ft}],status:"active",createdAt:Ft,updatedAt:Ft})):Pe.map(ct=>({id:`wave-${ct.jobId}`,roleId:ct.roleId,title:`WAVE: ${ct.roleName}`,mode:"do",source:"wave",jobId:ct.jobId,messages:[{id:`msg-wave-${ct.jobId}-ceo`,from:"ceo",content:F,type:"directive",status:"done",timestamp:Ft}],status:"active",createdAt:Ft,updatedAt:Ft}))).map((ct,$t)=>({...ct,messages:[...ct.messages,{id:`msg-wave-${Pe[$t].jobId}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:Ft,jobId:Pe[$t].jobId}]}));an(ct=>[...sr,...ct]);for(const ct of sr)Zo(ct.id)}catch(me){Et(`Failed to start wave: ${me instanceof Error?me.message:"unknown"}`,"#C62828")}},ir=()=>{ye.getWaves().then(h).catch(console.error),ye.getStandups().then(f).catch(console.error)},ml=()=>{ye.getCompany().then(F=>i(F.roles)).catch(console.error),ye.getOrgTree().then(F=>{ge(F.nodes),Be(F.root)}).catch(console.error),ye.getCostSummary().then(F=>fl(Xh(F.byRole))).catch(()=>{})},ei=async(F,P)=>{await ye.createRole(F),un(F.id,P),ml(),Et(`${F.name} hired!`,"#2E7D32"),ln({type:"role_hired",condition:{roleId:F.id,roleCount:a.length+1}})},rd=async F=>{var P;await ye.deleteRole(F),ml(),an(ae=>ae.filter(me=>me.roleId!==F)),ta&&((P=Un.find(ae=>ae.id===ta))==null?void 0:P.roleId)===F&&qn(null),Tt(null),Et(`${F.toUpperCase()} removed`,"#B71C1C")},ti=async(F,P)=>{await ye.updateRole(F,P),ml(),M.type==="role"&&M.roleId===F&&ye.getRole(F).then(I).catch(console.error),P.name&&Et(`${F.toUpperCase()} renamed to "${P.name}"`,"#1565C0"),P.persona!==void 0&&(Et(`${F.toUpperCase()} persona updated`,"#2E7D32"),ln({type:"persona_updated"}))},zs=F=>{dl(),ln({type:"terminal_opened"})},pl=async F=>{try{const P=await ye.createSession(F,"talk");an(ae=>[P,...ae]),qn(P.id),dl()}catch(P){console.error("Failed to create session",P),Et(`Failed to create session: ${P instanceof Error?P.message:"API unreachable"}`,"#B71C1C")}},ni=async F=>{try{const P=await ye.createSession(F,"talk");an(ae=>[P,...ae]),qn(P.id)}catch(P){console.error("Failed to create session",P),Et(`Failed to create session: ${P instanceof Error?P.message:"API unreachable"}`,"#B71C1C")}},Jo=async F=>{const P=Ne[F],ae=(P==null?void 0:P.jobId)??(P==null?void 0:P.id);if(ae&&fa[F]==="working"){const je=a.find(Pe=>Pe.id===F),Le=ky[F]??"#666",It=`${F.toUpperCase()} · ${(je==null?void 0:je.name)??F}`,ft=Un.find(Pe=>Pe.roleId===F&&Pe.status==="active"),tt=(ft==null?void 0:ft.id)??`job-${ae}`;O([{sessionId:tt,jobId:ae,title:It,color:Le}]),T(!1);return}const me=Un.find(je=>je.roleId===F);if(me)qn(me.id),Jt.setActiveChannelId(null);else try{const je=await ye.createSession(F,"talk");an(Le=>[je,...Le]),qn(je.id),Jt.setActiveChannelId(null)}catch(je){console.error("Failed to create session",je)}dl()},ec=async F=>{const P=Un.find(ae=>ae.id===F);if((P==null?void 0:P.source)==="wave"){if(P.jobId){const ae=hr.current.get(P.jobId);ae&&(ae.abort(),hr.current.delete(P.jobId))}an(ae=>{var je;const me=ae.filter(Le=>Le.id!==F);return ta===F&&qn(((je=me[0])==null?void 0:je.id)??null),me});return}try{await ye.deleteSession(F),an(ae=>{var je;const me=ae.filter(Le=>Le.id!==F);return ta===F&&qn(((je=me[0])==null?void 0:je.id)??null),me})}catch(ae){console.error("Failed to delete session",ae),Et(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},tc=async()=>{try{const{ids:F}=await ye.deleteEmptySessions();if(F.length===0)return;an(P=>{var me;const ae=P.filter(je=>!F.includes(je.id));return ta&&F.includes(ta)&&qn(((me=ae[0])==null?void 0:me.id)??null),ae}),Et(`Cleared ${F.length} empty session${F.length!==1?"s":""}`,"#2E7D32")}catch(F){Et(`Failed to clear empty sessions: ${F instanceof Error?F.message:"API error"}`,"#B71C1C")}},nc=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const F=Un.filter(P=>P.source!=="wave").map(P=>P.id);for(const P of Un)if(P.source==="wave"&&P.jobId){const ae=hr.current.get(P.jobId);ae&&(ae.abort(),hr.current.delete(P.jobId))}try{F.length>0&&await ye.deleteSessions(F),an([]),qn(null),Et("All sessions closed","#2E7D32")}catch(P){Et(`Failed to close sessions: ${P instanceof Error?P.message:"API error"}`,"#B71C1C")}},Hr=(F,P)=>{an(ae=>ae.map(me=>{if(me.id!==F)return me;const je=[...me.messages],Le=je[je.length-1];if(Le&&Le.from==="role"&&Le.status==="streaming"){const It=[...Le.streamEvents??[],P];je[je.length-1]={...Le,streamEvents:It}}return{...me,messages:je}}))},Ia=(F,P,ae,me)=>{const je={id:`msg-${Date.now()}-ceo`,from:"ceo",content:P,type:ae==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:me},Le={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};an(ft=>ft.map(tt=>tt.id===F?{...tt,messages:[...tt.messages,je,Le],updatedAt:new Date().toISOString()}:tt));const It=Un.find(ft=>ft.id===F);ae==="talk"?ln({type:"talk_mode_used"}):ae==="do"&&(ln({type:"do_mode_used"}),It&&ln({type:"task_executed",condition:{roleId:It.roleId}})),$a(F),zi(F,P,ae,{onThinking:ft=>{an(tt=>tt.map(Pe=>{if(Pe.id!==F)return Pe;const mt=[...Pe.messages],Ft=mt[mt.length-1];return Ft&&Ft.from==="role"&&Ft.status==="streaming"&&(mt[mt.length-1]={...Ft,thinking:(Ft.thinking??"")+ft}),{...Pe,messages:mt}})),Hr(F,{type:"thinking",timestamp:Date.now(),text:ft})},onText:ft=>{an(tt=>tt.map(Pe=>{if(Pe.id!==F)return Pe;const mt=[...Pe.messages],Ft=mt[mt.length-1];return Ft&&Ft.from==="role"&&Ft.status==="streaming"&&(mt[mt.length-1]={...Ft,content:Ft.content+ft}),{...Pe,messages:mt}}))},onToolUse:(ft,tt)=>{Hr(F,{type:"tool",timestamp:Date.now(),toolName:ft,toolInput:tt})},onDispatch:(ft,tt)=>{Hr(F,{type:"dispatch",timestamp:Date.now(),roleId:ft,task:tt})},onDispatchProgress:(ft,tt,Pe)=>{var mt;tt==="tool"?Hr(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ft,progressType:"tool",toolName:Pe.name,toolInput:Pe.input}):tt==="thinking"?Hr(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ft,progressType:"thinking",text:Pe.text}):tt==="text"?Hr(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ft,progressType:"text",text:(mt=Pe.text)==null?void 0:mt.slice(-200)}):(tt==="done"||tt==="error")&&Hr(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:ft,progressType:tt})},onTurn:ft=>{Hr(F,{type:"turn",timestamp:Date.now(),turn:ft})},onDone:()=>{an(ft=>ft.map(tt=>{if(tt.id!==F)return tt;const Pe=tt.messages.map(Ft=>Ft.status==="streaming"?{...Ft,status:"done"}:Ft),mt=tt.messages.length<=2?P.slice(0,40).replace(/\n/g," "):tt.title;return{...tt,messages:Pe,title:mt}})),$a(null)},onError:ft=>{an(tt=>tt.map(Pe=>{if(Pe.id!==F)return Pe;const mt=Pe.messages.map(Ft=>Ft.status==="streaming"?{...Ft,status:"error",content:Ft.content||ft}:Ft);return{...Pe,messages:mt}})),$a(null)}},me)},_s=(F,P)=>{an(ae=>ae.map(me=>me.id===F?{...me,mode:P}:me)),ye.updateSession(F,{mode:P}).catch(console.error)},ad=new Date().toISOString().slice(0,10),rc=o[0],ac={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},lc=F=>{const P=ac[F];if(!P)return"";for(const ae of d){const me=ae.content,je=me.indexOf(`## ${P}`);if(je===-1)continue;const Le=me.indexOf(`
|
|
@@ -107,4 +107,4 @@ ${P}`;Ia(ae.id,me,"do")}catch(ae){Et(`Failed to delegate: ${ae instanceof Error?
|
|
|
107
107
|
|
|
108
108
|
Skip this if you don't have a codebase yet — you can connect one later from Settings.`,tag:"optional",open:U,onToggle:()=>Y(!U),children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${at} flex-1`,placeholder:"/path/to/code/repo",value:ne,onChange:ke=>K(ke.target.value)}),l.jsx("button",{onClick:()=>se(!q),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),q&&l.jsx(Ru,{onSelect:ke=>{K(ke),se(!1)},onClose:()=>se(!1)})]}),l.jsxs(Cy,{icon:"📚",title:"Knowledge Import",hint:"Import existing documents into knowledge base.",help:`Point to folders with docs (.md, .txt, etc.) — AI will read, summarize, and organize them into a searchable knowledge base.
|
|
109
109
|
|
|
110
|
-
Skip this to start with an empty knowledge base. You can import documents anytime from the office.`,tag:"optional",open:ue,onToggle:()=>V(!ue),children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${at} flex-1`,placeholder:"/path/to/docs",value:H,onChange:ke=>T(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&(ke.preventDefault(),Bt())}}),l.jsx("button",{onClick:()=>ge(!de),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:Bt,disabled:!H.trim(),className:"px-3 py-2 rounded text-xs font-medium shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:H.trim()?1:.5},children:"Add"})]}),de&&l.jsx(Ru,{onSelect:ke=>{D.includes(ke)||B([...D,ke]),ge(!1)},onClose:()=>ge(!1)}),D.length>0&&l.jsx("div",{className:"space-y-1 mt-2",children:D.map((ke,kt)=>l.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:[l.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:ke}),l.jsx("button",{onClick:()=>B(D.filter((jn,hn)=>hn!==kt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},kt))})]})]}):l.jsx("div",{className:"space-y-3",children:l.jsxs(Sy,{icon:"🔗",title:"AKB Path",hint:"Directory with existing CLAUDE.md and AKB structure.",help:"Connect to a directory that was previously set up with Tycono. It must contain a CLAUDE.md file. All existing roles, knowledge, and settings will be loaded.",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${at} flex-1`,placeholder:"/path/to/your/akb",value:he,onChange:ke=>{Be(ke.target.value),Ie(null)},autoFocus:!0}),l.jsx("button",{onClick:()=>Ee(!Ke),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:_t,disabled:et||!he.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:et||!he.trim()?.5:1},children:et?"...":"Verify"})]}),He===!0&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found"]}),He===!1&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ke&&l.jsx(Ru,{onSelect:ke=>{Be(ke),Ie(null),Ee(!1)},onClose:()=>Ee(!1)})]})})]}),lt==="team"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),l.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Ae.map(ke=>l.jsxs("div",{className:Kt(dt===ke.id),onClick:()=>xt(ke.id),children:[l.jsx("div",{className:"font-medium text-sm capitalize",children:ke.id}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ke.roles.map(kt=>l.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:kt.id.toUpperCase()},kt.id))})]},ke.id)),l.jsxs("div",{className:Kt(dt==="custom"),onClick:()=>xt("custom"),children:[l.jsx("div",{className:"font-medium text-sm",children:"Custom"}),l.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),lt==="create"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Tt?C==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Tt&&!jt&&!re&&l.jsxs(l.Fragment,{children:[l.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:C==="existing-akb"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Path:"})," ",he]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Company:"})," ",g]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",M||"(default)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),ne.trim()&&l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Code Repo:"})," ",ne]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",D.length>0?`Import ${D.length} source(s)`:"Fresh (empty)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Team:"})," ",dt]}),D.length>0&&l.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),Bn&&l.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:Bn})]}),(jt||re)&&l.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[l.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:re?"Connecting to AKB...":"Scaffolding your company..."})]}),Tt&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),G&&l.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",G]}),l.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:Se.map((ke,kt)=>l.jsxs("div",{className:"py-0.5",children:[l.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ke]},kt))}),(we||ze.length>0)&&l.jsxs("div",{className:"rounded-lg p-4 text-xs space-y-1",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("div",{className:"font-medium mb-2",style:{color:"var(--terminal-text-secondary)"},children:we?"Installing skill tools...":"Skill tools"}),ze.map((ke,kt)=>l.jsxs("div",{className:"py-0.5 flex items-center gap-2",children:[l.jsx("span",{style:{color:ke.event==="installed"||ke.event==="skipped"?"var(--active-green)":ke.event==="error"?"#f87171":"var(--terminal-text-muted)"},children:ke.event==="installed"||ke.event==="skipped"?"✓":ke.event==="error"?"✗":"…"}),l.jsx("span",{children:ke.tool}),l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:ke.detail})]},kt)),we&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("div",{className:"w-3 h-3 border border-current rounded-full animate-spin",style:{borderTopColor:"var(--accent)"}}),l.jsx("span",{children:"Please wait..."})]})]}),D.length>0&&l.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."})]})]})]}),l.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[l.jsx("div",{children:n>0&&!Tt&&l.jsx("button",{onClick:Re,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),l.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[n+1," / ",qe.length]}),l.jsx("div",{children:Tt?l.jsx("button",{onClick:Z,disabled:we,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff",opacity:we?.5:1},children:we?"Setting up tools...":"Enter Office"}):l.jsx("button",{onClick:bt,disabled:!Qe()||jt||re,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Qe()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Qe()&&!jt&&!re?1:.5},children:lt==="create"?jt||re?re?"Connecting...":"Creating...":C==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function np({text:e}){const[n,a]=w.useState(!1),[i,o]=w.useState({top:0,left:0}),u=w.useRef(null),d=()=>{if(u.current){const f=u.current.getBoundingClientRect();o({top:f.bottom+6,left:f.left})}a(!0)};return l.jsxs("span",{className:"inline-flex",ref:u,children:[l.jsx("span",{className:"w-4 h-4 rounded-full text-[9px] font-bold flex items-center justify-center cursor-help shrink-0 select-none",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},onMouseEnter:d,onMouseLeave:()=>a(!1),onClick:f=>{f.stopPropagation(),n?a(!1):d()},children:"?"}),n&&l.jsxs("div",{className:"fixed z-[9999] px-3 py-2 rounded-lg text-[11px] leading-relaxed whitespace-pre-line w-60 shadow-lg pointer-events-none",style:{top:i.top,left:Math.min(i.left,window.innerWidth-260),background:"var(--terminal-bg)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"absolute bottom-full w-0 h-0",style:{left:8,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid var(--terminal-border)"}}),e]})]})}function Sy({icon:e,title:n,hint:a,help:i,children:o}){return l.jsxs("div",{className:"rounded-lg p-3 space-y-2",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(np,{text:i})]}),l.jsx("div",{className:"text-[10px] mt-0.5 ml-6",style:{color:"var(--terminal-text-muted)"},children:a})]}),o]})}function Cy({icon:e,title:n,hint:a,help:i,tag:o,open:u,onToggle:d,children:f}){return l.jsxs("div",{className:"rounded-lg",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"p-3 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)] transition-colors",onClick:d,children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium flex-1",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(np,{text:i}),o&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)"},children:o}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:u?"▲":"▼"})]}),!u&&l.jsx("div",{className:"px-3 pb-2 -mt-1",children:l.jsx("div",{className:"text-[10px] ml-6",style:{color:"var(--terminal-text-muted)"},children:a})}),u&&l.jsx("div",{className:"px-3 pb-3 space-y-2",children:f})]})}function I8(){const[e,n]=w.useState(null),[a,i]=w.useState(!0),[o,u]=w.useState(null),d=w.useCallback(async()=>{i(!0),u(null);try{const f=await ye.getStatus();n(f)}catch(f){u(f instanceof Error?f.message:"Failed to fetch status")}finally{i(!1)}},[]);return w.useEffect(()=>{d()},[d]),{initialized:(e==null?void 0:e.initialized)??!1,companyName:(e==null?void 0:e.companyName)??null,engine:(e==null?void 0:e.engine)??"none",companyRoot:(e==null?void 0:e.companyRoot)??"",loading:a,error:o,refetch:d}}const H8=w.lazy(()=>Ny(()=>import("./preview-app-BfUkkjCs.js"),[]));function Bv(){return l.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function U8(){var e;try{const n=localStorage.getItem("tycono-theme"),a=n&&n in il?n:"default",i=(e=il[a])==null?void 0:e.vars;if(!i)return;const o=document.documentElement;for(const[u,d]of Object.entries(i))o.style.setProperty(u,d)}catch{}}function q8(){const{initialized:e,loading:n,refetch:a}=I8(),[i,o]=w.useState(null);w.useEffect(()=>{U8()},[]);const u=d=>{d&&o(d),a()};return n?l.jsx(Bv,{}):e?l.jsx(O8,{importJob:i,onImportDone:()=>o(null)}):l.jsx(L8,{onComplete:u})}function Y8(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return l.jsx(Ew,{children:e?l.jsx(w.Suspense,{fallback:l.jsx(Bv,{}),children:l.jsx(H8,{})}):l.jsx(q8,{})})}jw.createRoot(document.getElementById("root")).render(l.jsx(w.StrictMode,{children:l.jsx(Y8,{})}));export{hv as H,pv as P,xv as S,G8 as a,mv as b,fv as c,lm as d,aC as e,W8 as f,V8 as g,K8 as h,l as j,w as r};
|
|
110
|
+
Skip this to start with an empty knowledge base. You can import documents anytime from the office.`,tag:"optional",open:ue,onToggle:()=>V(!ue),children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${at} flex-1`,placeholder:"/path/to/docs",value:H,onChange:ke=>T(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&(ke.preventDefault(),Bt())}}),l.jsx("button",{onClick:()=>ge(!de),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:Bt,disabled:!H.trim(),className:"px-3 py-2 rounded text-xs font-medium shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:H.trim()?1:.5},children:"Add"})]}),de&&l.jsx(Ru,{onSelect:ke=>{D.includes(ke)||B([...D,ke]),ge(!1)},onClose:()=>ge(!1)}),D.length>0&&l.jsx("div",{className:"space-y-1 mt-2",children:D.map((ke,kt)=>l.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:[l.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:ke}),l.jsx("button",{onClick:()=>B(D.filter((jn,hn)=>hn!==kt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},kt))})]})]}):l.jsx("div",{className:"space-y-3",children:l.jsxs(Sy,{icon:"🔗",title:"AKB Path",hint:"Directory with existing CLAUDE.md and AKB structure.",help:"Connect to a directory that was previously set up with Tycono. It must contain a CLAUDE.md file. All existing roles, knowledge, and settings will be loaded.",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${at} flex-1`,placeholder:"/path/to/your/akb",value:he,onChange:ke=>{Be(ke.target.value),Ie(null)},autoFocus:!0}),l.jsx("button",{onClick:()=>Ee(!Ke),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:_t,disabled:et||!he.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:et||!he.trim()?.5:1},children:et?"...":"Verify"})]}),He===!0&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found"]}),He===!1&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ke&&l.jsx(Ru,{onSelect:ke=>{Be(ke),Ie(null),Ee(!1)},onClose:()=>Ee(!1)})]})})]}),lt==="team"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),l.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Ae.map(ke=>l.jsxs("div",{className:Kt(dt===ke.id),onClick:()=>xt(ke.id),children:[l.jsx("div",{className:"font-medium text-sm capitalize",children:ke.id}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ke.roles.map(kt=>l.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:kt.id.toUpperCase()},kt.id))})]},ke.id)),l.jsxs("div",{className:Kt(dt==="custom"),onClick:()=>xt("custom"),children:[l.jsx("div",{className:"font-medium text-sm",children:"Custom"}),l.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),lt==="create"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Tt?C==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Tt&&!jt&&!re&&l.jsxs(l.Fragment,{children:[l.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:C==="existing-akb"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Path:"})," ",he]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Company:"})," ",g]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",M||"(default)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),ne.trim()&&l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Code Repo:"})," ",ne]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",D.length>0?`Import ${D.length} source(s)`:"Fresh (empty)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Team:"})," ",dt]}),D.length>0&&l.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),Bn&&l.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:Bn})]}),(jt||re)&&l.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[l.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:re?"Connecting to AKB...":"Scaffolding your company..."})]}),Tt&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),G&&l.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",G]}),l.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:Se.map((ke,kt)=>l.jsxs("div",{className:"py-0.5",children:[l.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",ke]},kt))}),(we||ze.length>0)&&l.jsxs("div",{className:"rounded-lg p-4 text-xs space-y-1",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("div",{className:"font-medium mb-2",style:{color:"var(--terminal-text-secondary)"},children:we?"Installing skill tools...":"Skill tools"}),ze.map((ke,kt)=>l.jsxs("div",{className:"py-0.5 flex items-center gap-2",children:[l.jsx("span",{style:{color:ke.event==="installed"||ke.event==="skipped"?"var(--active-green)":ke.event==="error"?"#f87171":"var(--terminal-text-muted)"},children:ke.event==="installed"||ke.event==="skipped"?"✓":ke.event==="error"?"✗":"…"}),l.jsx("span",{children:ke.tool}),l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:ke.detail})]},kt)),we&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("div",{className:"w-3 h-3 border border-current rounded-full animate-spin",style:{borderTopColor:"var(--accent)"}}),l.jsx("span",{children:"Please wait..."})]})]}),D.length>0&&l.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."})]})]})]}),l.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[l.jsx("div",{children:n>0&&!Tt&&l.jsx("button",{onClick:Re,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),l.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[n+1," / ",qe.length]}),l.jsx("div",{children:Tt?l.jsx("button",{onClick:Z,disabled:we,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff",opacity:we?.5:1},children:we?"Setting up tools...":"Enter Office"}):l.jsx("button",{onClick:bt,disabled:!Qe()||jt||re,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Qe()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Qe()&&!jt&&!re?1:.5},children:lt==="create"?jt||re?re?"Connecting...":"Creating...":C==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function np({text:e}){const[n,a]=w.useState(!1),[i,o]=w.useState({top:0,left:0}),u=w.useRef(null),d=()=>{if(u.current){const f=u.current.getBoundingClientRect();o({top:f.bottom+6,left:f.left})}a(!0)};return l.jsxs("span",{className:"inline-flex",ref:u,children:[l.jsx("span",{className:"w-4 h-4 rounded-full text-[9px] font-bold flex items-center justify-center cursor-help shrink-0 select-none",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},onMouseEnter:d,onMouseLeave:()=>a(!1),onClick:f=>{f.stopPropagation(),n?a(!1):d()},children:"?"}),n&&l.jsxs("div",{className:"fixed z-[9999] px-3 py-2 rounded-lg text-[11px] leading-relaxed whitespace-pre-line w-60 shadow-lg pointer-events-none",style:{top:i.top,left:Math.min(i.left,window.innerWidth-260),background:"var(--terminal-bg)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"absolute bottom-full w-0 h-0",style:{left:8,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid var(--terminal-border)"}}),e]})]})}function Sy({icon:e,title:n,hint:a,help:i,children:o}){return l.jsxs("div",{className:"rounded-lg p-3 space-y-2",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(np,{text:i})]}),l.jsx("div",{className:"text-[10px] mt-0.5 ml-6",style:{color:"var(--terminal-text-muted)"},children:a})]}),o]})}function Cy({icon:e,title:n,hint:a,help:i,tag:o,open:u,onToggle:d,children:f}){return l.jsxs("div",{className:"rounded-lg",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"p-3 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)] transition-colors",onClick:d,children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium flex-1",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(np,{text:i}),o&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)"},children:o}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:u?"▲":"▼"})]}),!u&&l.jsx("div",{className:"px-3 pb-2 -mt-1",children:l.jsx("div",{className:"text-[10px] ml-6",style:{color:"var(--terminal-text-muted)"},children:a})}),u&&l.jsx("div",{className:"px-3 pb-3 space-y-2",children:f})]})}function I8(){const[e,n]=w.useState(null),[a,i]=w.useState(!0),[o,u]=w.useState(null),d=w.useCallback(async()=>{i(!0),u(null);try{const f=await ye.getStatus();n(f)}catch(f){u(f instanceof Error?f.message:"Failed to fetch status")}finally{i(!1)}},[]);return w.useEffect(()=>{d()},[d]),{initialized:(e==null?void 0:e.initialized)??!1,companyName:(e==null?void 0:e.companyName)??null,engine:(e==null?void 0:e.engine)??"none",companyRoot:(e==null?void 0:e.companyRoot)??"",loading:a,error:o,refetch:d}}const H8=w.lazy(()=>Ny(()=>import("./preview-app-COzv8nuC.js"),[]));function Bv(){return l.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function U8(){var e;try{const n=localStorage.getItem("tycono-theme"),a=n&&n in il?n:"default",i=(e=il[a])==null?void 0:e.vars;if(!i)return;const o=document.documentElement;for(const[u,d]of Object.entries(i))o.style.setProperty(u,d)}catch{}}function q8(){const{initialized:e,loading:n,refetch:a}=I8(),[i,o]=w.useState(null);w.useEffect(()=>{U8()},[]);const u=d=>{d&&o(d),a()};return n?l.jsx(Bv,{}):e?l.jsx(O8,{importJob:i,onImportDone:()=>o(null)}):l.jsx(L8,{onComplete:u})}function Y8(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return l.jsx(Ew,{children:e?l.jsx(w.Suspense,{fallback:l.jsx(Bv,{}),children:l.jsx(H8,{})}):l.jsx(q8,{})})}jw.createRoot(document.getElementById("root")).render(l.jsx(w.StrictMode,{children:l.jsx(Y8,{})}));export{hv as H,pv as P,xv as S,G8 as a,mv as b,fv as c,lm as d,aC as e,W8 as f,V8 as g,K8 as h,l as j,w as r};
|