pi-forge 1.4.5 → 1.4.6
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/README.md +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BjMj50k4.js → CodeMirrorEditor-Bh9qbZER.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-BjMj50k4.js.map → CodeMirrorEditor-Bh9qbZER.js.map} +1 -1
- package/dist/client/assets/{index-B6JMmroY.js → index-2HJdevJu.js} +10 -10
- package/dist/client/assets/index-2HJdevJu.js.map +1 -0
- package/dist/client/assets/index-CRmysLou.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +1 -1
- package/dist/client/sw.js.map +1 -1
- package/dist/server/agent-tool-overrides.js +13 -3
- package/dist/server/agent-tool-overrides.js.map +1 -1
- package/dist/server/auth.js +19 -1
- package/dist/server/auth.js.map +1 -1
- package/dist/server/cli.js +49 -1
- package/dist/server/cli.js.map +1 -1
- package/dist/server/config.js +38 -1
- package/dist/server/config.js.map +1 -1
- package/dist/server/file-manager.js +54 -51
- package/dist/server/file-manager.js.map +1 -1
- package/dist/server/git-clone.js +30 -8
- package/dist/server/git-clone.js.map +1 -1
- package/dist/server/git-runner.js +7 -1
- package/dist/server/git-runner.js.map +1 -1
- package/dist/server/index.js +43 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/logo-cache.js +174 -0
- package/dist/server/logo-cache.js.map +1 -0
- package/dist/server/mcp/config.js +31 -2
- package/dist/server/mcp/config.js.map +1 -1
- package/dist/server/mcp/manager.js +3 -2
- package/dist/server/mcp/manager.js.map +1 -1
- package/dist/server/mcp/tool-bridge.js +20 -3
- package/dist/server/mcp/tool-bridge.js.map +1 -1
- package/dist/server/project-manager.js +9 -0
- package/dist/server/project-manager.js.map +1 -1
- package/dist/server/routes/health.js +16 -1
- package/dist/server/routes/health.js.map +1 -1
- package/dist/server/routes/mcp.js +45 -11
- package/dist/server/routes/mcp.js.map +1 -1
- package/dist/server/sandbox-permissions.js +90 -0
- package/dist/server/sandbox-permissions.js.map +1 -0
- package/dist/server/sandbox-startup-permissions.js +11 -14
- package/dist/server/sandbox-startup-permissions.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-B6JMmroY.js.map +0 -1
- package/dist/client/assets/index-DLafQw4G.css +0 -1
|
@@ -6,7 +6,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
6
6
|
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Se=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?xe(n):``}function we(e,t){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe(`Lazy`);case 13:return e.child!==t&&t!==null?xe(`Suspense Fallback`):xe(`Suspense`);case 19:return xe(`SuspenseList`);case 0:case 15:return Ce(e.type,!1);case 11:return Ce(e.type.render,!1);case 1:return Ce(e.type,!0);case 31:return xe(`Activity`);default:return``}}function Te(e){try{var t=``,n=null;do t+=we(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
7
|
Error generating stack: `+e.message+`
|
|
8
8
|
`+e.stack}}var Ee=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Oe=t.unstable_cancelCallback,ke=t.unstable_shouldYield,Ae=t.unstable_requestPaint,je=t.unstable_now,Me=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Pe=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,Le=t.unstable_IdlePriority,Re=t.log,ze=t.unstable_setDisableYieldValue,Be=null,Ve=null;function He(e){if(typeof Re==`function`&&ze(e),Ve&&typeof Ve.setStrictMode==`function`)try{Ve.setStrictMode(Be,e)}catch{}}var Ue=Math.clz32?Math.clz32:Ke,We=Math.log,Ge=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(We(e)/Ge|0)|0}var qe=256,Je=262144,Ye=4194304;function Xe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Xe(n))):i=Xe(o):i=Xe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Xe(n))):i=Xe(o)):i=Xe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 et(){var e=Ye;return Ye<<=1,!(Ye&62914560)&&(Ye=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ue(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&it(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function it(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ue(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function at(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ue(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ot(e,t){var n=t&-t;return n=n&42?1:st(n),(n&(e.suspendedLanes|t))===0?n:0}function st(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function lt(){var e=j.p;return e===0?(e=window.event,e===void 0?32:Ep(e.type)):e}function ut(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var dt=Math.random().toString(36).slice(2),ft=`__reactFiber$`+dt,pt=`__reactProps$`+dt,mt=`__reactContainer$`+dt,ht=`__reactEvents$`+dt,gt=`__reactListeners$`+dt,_t=`__reactHandles$`+dt,vt=`__reactResources$`+dt,yt=`__reactMarker$`+dt;function bt(e){delete e[ft],delete e[pt],delete e[ht],delete e[gt],delete e[_t]}function xt(e){var t=e[ft];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Cf(e);e!==null;){if(n=e[ft])return n;e=Cf(e)}return t}e=n,n=e.parentNode}return null}function St(e){if(e=e[ft]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function wt(e){var t=e[vt];return t||=e[vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Tt(e){e[yt]=!0}var Et=new Set,Dt={};function Ot(e,t){kt(e,t),kt(e+`Capture`,t)}function kt(e,t){for(Dt[e]=t,e=0;e<t.length;e++)Et.add(t[e])}var At=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]*$`),jt={},Mt={};function Nt(e){return Ee.call(Mt,e)?!0:Ee.call(jt,e)?!1:At.test(e)?Mt[e]=!0:(jt[e]=!0,!1)}function Pt(e,t,n){if(Nt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ft(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function It(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Lt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Rt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function zt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bt(e){if(!e._valueTracker){var t=Rt(e)?`checked`:`value`;e._valueTracker=zt(e,t,``+e[t])}}function Vt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Rt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ht(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ut=/[\n"\\]/g;function Wt(e){return e.replace(Ut,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Gt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Lt(t)):e.value!==``+Lt(t)&&(e.value=``+Lt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Kt(e,o,Lt(n)):Kt(e,o,Lt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Lt(s):e.removeAttribute(`name`)}function N(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Bt(e);return}n=n==null?``:``+Lt(n),t=t==null?n:``+Lt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Bt(e)}function Kt(e,t,n){t===`number`&&Ht(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function qt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Lt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function P(e,t,n){if(t!=null&&(t=``+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Lt(n)}function F(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ae(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Lt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Bt(e)}function Jt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt=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 Xt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Yt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Zt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Xt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Xt(e,o,t[o])}function Qt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var $t=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`]]),en=/^[\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 tn(e){return en.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function nn(){}var rn=null;function an(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var on=null,sn=null;function cn(e){var t=St(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Gt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Wt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[pt]||null;if(!a)throw Error(i(90));Gt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Vt(r)}break a;case`textarea`:P(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&qt(e,!!n.multiple,t,!1)}}}var ln=!1;function un(e,t,n){if(ln)return e(t,n);ln=!0;try{return e(t)}finally{if(ln=!1,(on!==null||sn!==null)&&(ku(),on&&(t=on,e=sn,sn=on=null,cn(t),e)))for(t=0;t<e.length;t++)cn(e[t])}}function dn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var fn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),pn=!1;if(fn)try{var mn={};Object.defineProperty(mn,"passive",{get:function(){pn=!0}}),window.addEventListener(`test`,mn,mn),window.removeEventListener(`test`,mn,mn)}catch{pn=!1}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return _n=i.slice(e,1<r?1-r:void 0)}function yn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function bn(){return!0}function xn(){return!1}function Sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?bn:xn,this.isPropagationStopped=xn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=m({},Cn,{view:0,detail:0}),En=Sn(Tn),Dn,On,kn,An=m({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Sn(An),Mn=Sn(m({},An,{dataTransfer:0})),Nn=Sn(m({},Tn,{relatedTarget:0})),Pn=Sn(m({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Sn(m({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Sn(m({},Cn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Sn(m({},Tn,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Sn(m({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Sn(m({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Sn(m({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Sn(m({},An,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),qn=Sn(m({},Cn,{newState:0,oldState:0})),Jn=[9,13,27,32],Yn=fn&&`CompositionEvent`in window,Xn=null;fn&&`documentMode`in document&&(Xn=document.documentMode);var Zn=fn&&`TextEvent`in window&&!Xn,Qn=fn&&(!Yn||Xn&&8<Xn&&11>=Xn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Yn&&tr(e,t)?(e=vn(),_n=gn=hn=null,rr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Qn&&t.locale!==`ko`?null:t.data;default:return null}}var or={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 sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!or[e.type]:t===`textarea`}function cr(e,t,n,r){on?sn?sn.push(r):sn=[r]:on=r,t=Ld(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var lr=null,ur=null;function dr(e){kd(e,0)}function fr(e){if(Vt(Ct(e)))return e}function pr(e,t){if(e===`change`)return t}var I=!1;if(fn){var mr;if(fn){var L=`oninput`in document;if(!L){var hr=document.createElement(`div`);hr.setAttribute(`oninput`,`return;`),L=typeof hr.oninput==`function`}mr=L}else mr=!1;I=mr&&(!document.documentMode||9<document.documentMode)}function gr(){lr&&(lr.detachEvent(`onpropertychange`,_r),ur=lr=null)}function _r(e){if(e.propertyName===`value`&&fr(ur)){var t=[];cr(t,ur,e,an(e)),un(dr,t)}}function vr(e,t,n){e===`focusin`?(gr(),lr=t,ur=n,lr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&gr()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return fr(ur)}function br(e,t){if(e===`click`)return fr(t)}function xr(e,t){if(e===`input`||e===`change`)return fr(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ee.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Ar=fn&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==Ht(r)||(r=jr,`selectionStart`in r&&kr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&wr(Nr,r)||(Nr=r,r=Ld(Mr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionrun:Ir(`Transition`,`TransitionRun`),transitionstart:Ir(`Transition`,`TransitionStart`),transitioncancel:Ir(`Transition`,`TransitionCancel`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};fn&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionrun`),Gr=Br(`transitionstart`),Kr=Br(`transitioncancel`),qr=Br(`transitionend`),Jr=new Map,Yr=`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(` `);Yr.push(`scrollEnd`);function Xr(e,t){Jr.set(e,t),Ot(t,[e])}var Zr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Qr=[],$r=0,ei=0;function ti(){for(var e=$r,t=ei=$r=0;t<e;){var n=Qr[t];Qr[t++]=null;var r=Qr[t];Qr[t++]=null;var i=Qr[t];Qr[t++]=null;var a=Qr[t];if(Qr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ai(n,i,a)}}function ni(e,t,n,r){Qr[$r++]=e,Qr[$r++]=t,Qr[$r++]=n,Qr[$r++]=r,ei|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ri(e,t,n,r){return ni(e,t,n,r),oi(e)}function ii(e,t){return ni(e,null,null,t),oi(e)}function ai(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ue(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function oi(e){if(50<bu)throw bu=0,xu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var si={};function ci(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function li(e,t,n,r){return new ci(e,t,n,r)}function ui(e){return e=e.prototype,!(!e||!e.isReactComponent)}function di(e,t){var n=e.alternate;return n===null?(n=li(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function fi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ui(e)&&(s=1);else if(typeof e==`string`)s=tp(e,n,de.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=li(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return mi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=li(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=li(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=li(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=li(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function mi(e,t,n,r){return e=li(7,e,r,t),e.lanes=n,e}function hi(e,t,n){return e=li(6,e,null,t),e.lanes=n,e}function gi(e){var t=li(18,null,null,0);return t.stateNode=e,t}function _i(e,t,n){return t=li(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vi=new WeakMap;function yi(e,t){if(typeof e==`object`&&e){var n=vi.get(e);return n===void 0?(t={value:e,source:t,stack:Te(t)},vi.set(e,t),t):n}return{value:e,source:t,stack:Te(t)}}var bi=[],xi=0,Si=null,Ci=0,wi=[],Ti=0,Ei=null,Di=1,Oi=``;function ki(e,t){bi[xi++]=Ci,bi[xi++]=Si,Si=e,Ci=t}function Ai(e,t,n){wi[Ti++]=Di,wi[Ti++]=Oi,wi[Ti++]=Ei,Ei=e;var r=Di;e=Oi;var i=32-Ue(r)-1;r&=~(1<<i),n+=1;var a=32-Ue(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Di=1<<32-Ue(t)+i|n<<i|r,Oi=a+e}else Di=1<<a|n<<i|r,Oi=e}function ji(e){e.return!==null&&(ki(e,1),Ai(e,1,0))}function Mi(e){for(;e===Si;)Si=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null;for(;e===Ei;)Ei=wi[--Ti],wi[Ti]=null,Oi=wi[--Ti],wi[Ti]=null,Di=wi[--Ti],wi[Ti]=null}function Ni(e,t){wi[Ti++]=Di,wi[Ti++]=Oi,wi[Ti++]=Ei,Di=t.id,Oi=t.overflow,Ei=e}var Pi=null,Fi=null,Ii=!1,Li=null,Ri=!1,zi=Error(i(519));function Bi(e){throw Gi(yi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),zi}function Vi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ft]=e,t[pt]=r,n){case`dialog`:Ad(`cancel`,t),Ad(`close`,t);break;case`iframe`:case`object`:case`embed`:Ad(`load`,t);break;case`video`:case`audio`:for(n=0;n<Dd.length;n++)Ad(Dd[n],t);break;case`source`:Ad(`error`,t);break;case`img`:case`image`:case`link`:Ad(`error`,t),Ad(`load`,t);break;case`details`:Ad(`toggle`,t);break;case`input`:Ad(`invalid`,t),N(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ad(`invalid`,t);break;case`textarea`:Ad(`invalid`,t),F(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Ud(t.textContent,n)?(r.popover!=null&&(Ad(`beforetoggle`,t),Ad(`toggle`,t)),r.onScroll!=null&&Ad(`scroll`,t),r.onScrollEnd!=null&&Ad(`scrollend`,t),r.onClick!=null&&(t.onclick=nn),t=!0):t=!1,t||Bi(e,!0)}function Hi(e){for(Pi=e.return;Pi;)switch(Pi.tag){case 5:case 31:case 13:Ri=!1;return;case 27:case 3:Ri=!0;return;default:Pi=Pi.return}}function R(e){if(e!==Pi)return!1;if(!Ii)return Hi(e),Ii=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||tf(e.type,e.memoizedProps)),n=!n),n&&Fi&&Bi(e),Hi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Fi=Sf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Fi=Sf(e)}else t===27?(t=Fi,uf(e.type)?(e=xf,xf=null,Fi=e):Fi=t):Fi=Pi?bf(e.stateNode.nextSibling):null;return!0}function Ui(){Fi=Pi=null,Ii=!1}function Wi(){var e=Li;return e!==null&&(ou===null?ou=e:ou.push.apply(ou,e),Li=null),e}function Gi(e){Li===null?Li=[e]:Li.push(e)}var Ki=ce(null),qi=null,Ji=null;function Yi(e,t,n){ue(Ki,t._currentValue),t._currentValue=n}function Xi(e){e._currentValue=Ki.current,le(Ki)}function Zi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Qi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Zi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Zi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function $i(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Cr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===me.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[up]:e.push(up))}a=a.return}e!==null&&Qi(t,e,n,r),t.flags|=262144}function ea(e){for(e=e.firstContext;e!==null;){if(!Cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){qi=e,Ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function na(e){return ia(qi,e)}function ra(e,t){return qi===null&&ta(e),ia(e,t)}function ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ji===null){if(e===null)throw Error(i(308));Ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ji=Ji.next=t;return n}var aa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oa=t.unstable_scheduleCallback,sa=t.unstable_NormalPriority,ca={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new aa,data:new Map,refCount:0}}function ua(e){e.refCount--,e.refCount===0&&oa(sa,function(){e.controller.abort()})}var da=null,fa=0,pa=0,ma=null;function ha(e,t){if(da===null){var n=da=[];fa=0,pa=xd(),ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return fa++,t.then(ga,ga),t}function ga(){if(--fa===0&&da!==null){ma!==null&&(ma.status=`fulfilled`);var e=da;da=null,pa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _a(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var va=A.S;A.S=function(e,t){lu=je(),typeof t==`object`&&t&&typeof t.then==`function`&&ha(e,t),va!==null&&va(e,t)};var ya=ce(null);function ba(){var e=ya.current;return e===null?Wl.pooledCache:e}function xa(e,t){t===null?ue(ya,ya.current):ue(ya,t.pool)}function Sa(){var e=ba();return e===null?null:{parent:ca._currentValue,pool:e}}var Ca=Error(i(460)),wa=Error(i(474)),Ta=Error(i(542)),Ea={then:function(){}};function Da(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Oa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(nn,nn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then(nn,nn);else{if(e=Wl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e}throw z=t,Ca}}function ka(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(z=e,Ca):e}}var z=null;function Aa(){if(z===null)throw Error(i(459));var e=z;return z=null,e}function ja(e){if(e===Ca||e===Ta)throw Error(i(483))}var Ma=null,Na=0;function Pa(e){var t=Na;return Na+=1,Ma===null&&(Ma=[]),Oa(Ma,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ia(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function La(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=di(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=hi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&ka(i)===t.type)?(t=a(t,n.props),Fa(t,n),t.return=e,t):(t=pi(n.type,n.key,n.props,null,e.mode,r),Fa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=_i(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=mi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=hi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=pi(t.type,t.key,t.props,null,e.mode,n),Fa(n,t),n.return=e,n;case v:return t=_i(t,e.mode,n),t.return=e,t;case O:return t=ka(t),f(e,t,n)}if(ae(t)||ne(t))return t=mi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Pa(t),n);if(t.$$typeof===C)return f(e,ra(e,t),n);Ia(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ka(n),p(e,t,n,r)}if(ae(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Pa(n),r);if(n.$$typeof===C)return p(e,t,ra(e,n),r);Ia(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ka(r),m(e,t,n,r,i)}if(ae(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Pa(r),i);if(r.$$typeof===C)return m(e,t,n,ra(t,r),i);Ia(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ii&&ki(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ii&&ki(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ii&&ki(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ii&&ki(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ii&&ki(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ii&&ki(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ka(l)===r.type){n(e,r.sibling),c=a(r,o.props),Fa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=mi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=pi(o.type,o.key,o.props,null,e.mode,c),Fa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=_i(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ka(o),b(e,r,o,c)}if(ae(o))return h(e,r,o,c);if(ne(o)){if(l=ne(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Pa(o),c);if(o.$$typeof===C)return b(e,r,ra(e,o),c);Ia(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=hi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ul&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=oi(e),ai(e,null,n),t}return ni(e,r,t,n),oi(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var qa=!1;function Ja(){if(qa){var e=ma;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Kl&f)===f:(r&f)===f){f!==0&&f===pa&&(qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),eu|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Xa(n[e],t)}var Qa=ce(null),$a=ce(0);function eo(e,t){e=Ql,ue($a,e),ue(Qa,t),Ql=e|t.baseLanes}function to(){ue($a,Ql),ue(Qa,Qa.current)}function no(){Ql=$a.current,le(Qa),le($a)}var ro=ce(null),io=null;function ao(e){var t=e.alternate;ue(uo,uo.current&1),ue(ro,e),io===null&&(t===null||Qa.current!==null||t.memoizedState!==null)&&(io=e)}function oo(e){ue(uo,uo.current),ue(ro,e),io===null&&(io=e)}function so(e){e.tag===22?(ue(uo,uo.current),ue(ro,e),io===null&&(io=e)):co(e)}function co(){ue(uo,uo.current),ue(ro,ro.current)}function lo(e){le(ro),io===e&&(io=null),le(uo)}var uo=ce(0);function fo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||_f(n)||vf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var po=0,mo=null,ho=null,go=null,_o=!1,vo=!1,yo=!1,bo=0,xo=0,So=null,Co=0;function wo(){throw Error(i(321))}function To(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function Eo(e,t,n,r,i,a){return po=a,mo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Hs:Us,yo=!1,a=n(r,i),yo=!1,vo&&(a=Do(t,n,r,i)),B(e),a}function B(e){A.H=Vs;var t=ho!==null&&ho.next!==null;if(po=0,go=ho=mo=null,_o=!1,xo=0,So=null,t)throw Error(i(300));e===null||V||(e=e.dependencies,e!==null&&ea(e)&&(V=!0))}function Do(e,t,n,r){mo=e;var a=0;do{if(vo&&(So=null),xo=0,vo=!1,25<=a)throw Error(i(301));if(a+=1,go=ho=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}A.H=Ws,o=t(n,r)}while(vo);return o}function Oo(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Fo(t):t,e=e.useState()[0],(ho===null?null:ho.memoizedState)!==e&&(mo.flags|=1024),t}function ko(){var e=bo!==0;return bo=0,e}function Ao(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function jo(e){if(_o){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_o=!1}po=0,go=ho=mo=null,vo=!1,xo=bo=0,So=null}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return go===null?mo.memoizedState=go=e:go=go.next=e,go}function No(){if(ho===null){var e=mo.alternate;e=e===null?null:e.memoizedState}else e=ho.next;var t=go===null?mo.memoizedState:go.next;if(t!==null)go=t,ho=e;else{if(e===null)throw mo.alternate===null?Error(i(467)):Error(i(310));ho=e,e={memoizedState:ho.memoizedState,baseState:ho.baseState,baseQueue:ho.baseQueue,queue:ho.queue,next:null},go===null?mo.memoizedState=go=e:go=go.next=e}return go}function Po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fo(e){var t=xo;return xo+=1,So===null&&(So=[]),e=Oa(So,e,t),t=mo,(go===null?t.memoizedState:go.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Hs:Us),e}function Io(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Fo(e);if(e.$$typeof===C)return na(e)}throw Error(i(438,String(e)))}function Lo(e){var t=null,n=mo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=mo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Po(),mo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){return Bo(No(),ho,e)}function Bo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(po&f)===f:(Kl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===pa&&(d=!0);else if((po&p)===p){u=u.next,p===pa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,mo.lanes|=p,eu|=p;f=u.action,yo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,mo.lanes|=f,eu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Cr(o,e.memoizedState)&&(V=!0,d&&(n=ma,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Vo(e){var t=No(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Cr(o,t.memoizedState)||(V=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ho(e,t,n){var r=mo,a=No(),o=Ii;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Cr((ho||a).memoizedState,n);if(s&&(a.memoizedState=n,V=!0),a=a.queue,ps(Go.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||go!==null&&go.memoizedState.tag&1){if(r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,a,n,t),null),Wl===null)throw Error(i(349));o||po&127||Uo(r,t,n)}return n}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=mo.updateQueue,t===null?(t=Po(),mo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function qo(e){var t=ii(e,2);t!==null&&wu(t,e,2)}function Jo(e){var t=Mo();if(typeof e==`function`){var n=e;if(e=n(),yo){He(!0);try{n()}finally{He(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t}function Yo(e,t,n,r){return e.baseState=n,Bo(e,ho,typeof r==`function`?r:Ro)}function Xo(e,t,n,r,a){if(Rs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};A.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),Qo(e,t,s)}catch(n){es(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),Qo(e,t,a)}catch(n){es(e,t,n)}}function Qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$o(e,t,n)},function(n){return es(e,t,n)}):$o(e,t,n)}function $o(e,t,n){t.status=`fulfilled`,t.value=n,ts(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zo(e,n)))}function es(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ts(t),t=t.next;while(t!==r)}e.action=null}function ts(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ns(e,t){return t}function rs(e,t){if(Ii){var n=Wl.formState;if(n!==null){a:{var r=mo;if(Ii){if(Fi){b:{for(var i=Fi,a=Ri;i.nodeType!==8;){if(!a){i=null;break b}if(i=bf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Fi=bf(i.nextSibling),r=i.data===`F!`;break a}}Bi(r)}r=!1}r&&(t=n[0])}}return n=Mo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:t},n.queue=r,n=Fs.bind(null,mo,r),r.dispatch=n,r=Jo(!1),a=Ls.bind(null,mo,!1,r.queue),r=Mo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xo.bind(null,mo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function is(e){return as(No(),ho,e)}function as(e,t,n){if(t=Bo(e,t,ns)[0],e=zo(Ro)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Fo(t)}catch(e){throw e===Ca?Ta:e}else r=t;t=No();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(mo.flags|=2048,cs(9,{destroy:void 0},os.bind(null,i,n),null)),[r,a,e]}function os(e,t){e.action=t}function ss(e){var t=No(),n=ho;if(n!==null)return as(t,n,e);No(),t=t.memoizedState,n=No();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=mo.updateQueue,t===null&&(t=Po(),mo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ls(){return No().memoizedState}function us(e,t,n,r){var i=Mo();mo.flags|=e,i.memoizedState=cs(1|t,{destroy:void 0},n,r===void 0?null:r)}function ds(e,t,n,r){var i=No();r=r===void 0?null:r;var a=i.memoizedState.inst;ho!==null&&r!==null&&To(r,ho.memoizedState.deps)?i.memoizedState=cs(t,a,n,r):(mo.flags|=e,i.memoizedState=cs(1|t,a,n,r))}function fs(e,t){us(8390656,8,e,t)}function ps(e,t){ds(2048,8,e,t)}function ms(e){mo.flags|=4;var t=mo.updateQueue;if(t===null)t=Po(),mo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hs(e){var t=No().memoizedState;return ms({ref:t,nextImpl:e}),function(){if(Ul&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function gs(e,t){return ds(4,2,e,t)}function _s(e,t){return ds(4,4,e,t)}function vs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ys(e,t,n){n=n==null?null:n.concat([e]),ds(4,4,vs.bind(null,t,e),n)}function bs(){}function xs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&To(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ss(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&To(t,r[1]))return r[0];if(r=e(),yo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r}function Cs(e,t,n){return n===void 0||po&1073741824&&!(Kl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Cu(),mo.lanes|=e,eu|=e,n)}function ws(e,t,n,r){return Cr(n,t)?n:Qa.current===null?!(po&42)||po&1073741824&&!(Kl&261930)?(V=!0,e.memoizedState=n):(e=Cu(),mo.lanes|=e,eu|=e,t):(e=Cs(e,n,r),Cr(e,t)||(V=!0),e)}function Ts(e,t,n,r,i){var a=j.p;j.p=a!==0&&8>a?a:8;var o=A.T,s={};A.T=s,Ls(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Is(e,t,_a(c,r),Su(e)):Is(e,t,r,Su(e))}catch(n){Is(e,t,{then:function(){},status:`rejected`,reason:n},Su())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function Es(){}function Ds(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Os(e).queue;Ts(e,a,t,M,n===null?Es:function(){return ks(e),n(r)})}function Os(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:M,baseState:M,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:M},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ks(e){var t=Os(e);t.next===null&&(t=e.alternate.memoizedState),Is(e,t.next.queue,{},Su())}function As(){return na(up)}function js(){return No().memoizedState}function Ms(){return No().memoizedState}function Ns(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Su();e=Ua(n);var r=Wa(t,e,n);r!==null&&(wu(r,t,n),Ga(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Ps(e,t,n){var r=Su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rs(e)?zs(t,n):(n=ri(e,t,n,r),n!==null&&(wu(n,e,r),Bs(n,t,r)))}function Fs(e,t,n){Is(e,t,n,Su())}function Is(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rs(e))zs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Cr(s,o))return ni(e,t,i,0),Wl===null&&ti(),!1}catch{}if(n=ri(e,t,i,r),n!==null)return wu(n,e,r),Bs(n,t,r),!0}return!1}function Ls(e,t,n,r){if(r={lane:2,revertLane:xd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Rs(e)){if(t)throw Error(i(479))}else t=ri(e,n,r,2),t!==null&&wu(t,e,2)}function Rs(e){var t=e.alternate;return e===mo||t!==null&&t===mo}function zs(e,t){vo=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var Vs={readContext:na,use:Io,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useLayoutEffect:wo,useInsertionEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useSyncExternalStore:wo,useId:wo,useHostTransitionStatus:wo,useFormState:wo,useActionState:wo,useOptimistic:wo,useMemoCache:wo,useCacheRefresh:wo};Vs.useEffectEvent=wo;var Hs={readContext:na,use:Io,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:fs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=Mo();t=t===void 0?null:t;var r=e();if(yo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Mo();if(n!==void 0){var i=n(t);if(yo){He(!0);try{n(t)}finally{He(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ps.bind(null,mo,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Fs.bind(null,mo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bs,useDeferredValue:function(e,t){return Cs(Mo(),e,t)},useTransition:function(){var e=Jo(!1);return e=Ts.bind(null,mo,e.queue,!0,!1),Mo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=mo,a=Mo();if(Ii){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Wl===null)throw Error(i(349));Kl&127||Uo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,fs(Go.bind(null,r,o,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,o,n,t),null),n},useId:function(){var e=Mo(),t=Wl.identifierPrefix;if(Ii){var n=Oi,r=Di;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Co++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:As,useFormState:rs,useActionState:rs,useOptimistic:function(e){var t=Mo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ls.bind(null,mo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Lo,useCacheRefresh:function(){return Mo().memoizedState=Ns.bind(null,mo)},useEffectEvent:function(e){var t=Mo(),n={impl:e};return t.memoizedState=n,function(){if(Ul&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Us={readContext:na,use:Io,useCallback:xs,useContext:na,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:zo,useRef:ls,useState:function(){return zo(Ro)},useDebugValue:bs,useDeferredValue:function(e,t){return ws(No(),ho.memoizedState,e,t)},useTransition:function(){var e=zo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:is,useActionState:is,useOptimistic:function(e,t){return Yo(No(),ho,e,t)},useMemoCache:Lo,useCacheRefresh:Ms};Us.useEffectEvent=hs;var Ws={readContext:na,use:Io,useCallback:xs,useContext:na,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:Vo,useRef:ls,useState:function(){return Vo(Ro)},useDebugValue:bs,useDeferredValue:function(e,t){var n=No();return ho===null?Cs(n,e,t):ws(n,ho.memoizedState,e,t)},useTransition:function(){var e=Vo(Ro)[0],t=No().memoizedState;return[typeof e==`boolean`?e:Fo(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:ss,useActionState:ss,useOptimistic:function(e,t){var n=No();return ho===null?(n.baseState=e,[e,n.queue.dispatch]):Yo(n,ho,e,t)},useMemoCache:Lo,useCacheRefresh:Ms};Ws.useEffectEvent=hs;function Gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ks={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Ua(r);i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(wu(t,e,r),Ga(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Ua(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(wu(t,e,r),Ga(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Su(),r=Ua(n);r.tag=2,t!=null&&(r.callback=t),t=Wa(e,r,n),t!==null&&(wu(t,e,n),Ga(t,e,n))}};function qs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!wr(n,r)||!wr(i,a):!0}function Js(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ks.enqueueReplaceState(t,t.state,null)}function Ys(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Xs(e){Zr(e)}function Zs(e){console.error(e)}function Qs(e){Zr(e)}function $s(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ec(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function tc(e,t,n){return n=Ua(n),n.tag=3,n.payload={element:null},n.callback=function(){$s(e,t)},n}function nc(e){return e=Ua(e),e.tag=3,e}function rc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){ec(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){ec(t,n,r),typeof i!=`function`&&(fu===null?fu=new Set([this]):fu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function ic(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&$i(t,n,a,!0),n=ro.current,n!==null){switch(n.tag){case 31:case 13:return io===null?Iu():n.alternate===null&&$l===0&&($l=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),td(e,r,a)),!1;case 22:return n.flags|=65536,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),td(e,r,a)),!1}throw Error(i(435,n.tag))}return td(e,r,a),Iu(),!1}if(Ii)return t=ro.current,t===null?(r!==zi&&(t=Error(i(423),{cause:r}),Gi(yi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=yi(r,n),a=tc(e.stateNode,r,a),Ka(e,a),$l!==4&&($l=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==zi&&(e=Error(i(422),{cause:r}),Gi(yi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=yi(o,n),au===null?au=[o]:au.push(o),$l!==4&&($l=2),t===null)return!0;r=yi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=tc(n.stateNode,r,e),Ka(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(fu===null||!fu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=nc(a),rc(a,e,n,r),Ka(n,a),!1}n=n.return}while(n!==null);return!1}var ac=Error(i(461)),V=!1;function oc(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function sc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ta(t),r=Eo(e,t,n,o,a,i),s=ko(),e!==null&&!V?(Ao(e,t,i),jc(e,t,i)):(Ii&&s&&ji(t),t.flags|=1,oc(e,t,r,i),t.child)}function cc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ui(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,lc(e,t,a,r,i)):(e=pi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Mc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return jc(e,t,i)}return t.flags|=1,e=di(a,r),e.ref=t.ref,e.return=t,t.child=e}function lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref)if(V=!1,t.pendingProps=r=a,Mc(e,i))e.flags&131072&&(V=!0);else return t.lanes=e.lanes,jc(e,t,i)}return _c(e,t,n,r,i)}function uc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xa(t,a===null?null:a.cachePool),a===null?to():eo(t,a),so(t);else return r=t.lanes=536870912,fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&xa(t,null),to(),co(t)):(xa(t,a.cachePool),eo(t,a),co(t),t.memoizedState=null);return oc(e,t,i,n),t.child}function dc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fc(e,t,n,r,i){var a=ba();return a=a===null?null:{parent:ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&xa(t,null),to(),so(t),e!==null&&$i(e,t,r,!0),t.childLanes=i,null}function pc(e,t){return t=Ec({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return Ra(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,lo(t),t.memoizedState=null,e}function hc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ii){if(r.mode===`hidden`)return e=pc(t,r),t.lanes=536870912,dc(null,e);if(oo(t),(e=Fi)?(e=gf(e,Ri),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ei===null?null:{id:Di,overflow:Oi},retryLane:536870912,hydrationErrors:null},n=gi(e),n.return=t,t.child=n,Pi=t,Fi=null)):e=null,e===null)throw Bi(t);return t.lanes=536870912,null}return pc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(oo(t),a)if(t.flags&256)t.flags&=-257,t=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(V||$i(e,t,n,!1),a=(n&e.childLanes)!==0,V||a){if(r=Wl,r!==null&&(s=ot(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ii(e,s),wu(r,e,s),ac;Iu(),t=mc(e,t,n)}else e=o.treeContext,Fi=bf(s.nextSibling),Pi=t,Ii=!0,Li=null,Ri=!1,e!==null&&Ni(t,e),t=pc(t,r),t.flags|=4096;return t}return e=di(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,r,i){return ta(t),n=Eo(e,t,n,r,void 0,i),r=ko(),e!==null&&!V?(Ao(e,t,i),jc(e,t,i)):(Ii&&r&&ji(t),t.flags|=1,oc(e,t,n,i),t.child)}function vc(e,t,n,r,i,a){return ta(t),t.updateQueue=null,n=Do(t,r,n,i),B(e),r=ko(),e!==null&&!V?(Ao(e,t,a),jc(e,t,a)):(Ii&&r&&ji(t),t.flags|=1,oc(e,t,n,a),t.child)}function yc(e,t,n,r,i){if(ta(t),t.stateNode===null){var a=si,o=n.contextType;typeof o==`object`&&o&&(a=na(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ks,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Va(t),o=n.contextType,a.context=typeof o==`object`&&o?na(o):si,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Gs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ks.enqueueReplaceState(a,a.state,null),Ya(t,r,a,i),Ja(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ys(n,s);a.props=c;var l=a.context,u=n.contextType;o=si,typeof u==`object`&&u&&(o=na(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Js(t,a,r,o),Ba=!1;var f=t.memoizedState;a.state=f,Ya(t,r,a,i),Ja(),l=t.memoizedState,s||f!==l||Ba?(typeof d==`function`&&(Gs(t,n,d,r),l=t.memoizedState),(c=Ba||qs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ha(e,t),o=t.memoizedProps,u=Ys(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=si,typeof l==`object`&&l&&(c=na(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Js(t,a,r,c),Ba=!1,f=t.memoizedState,a.state=f,Ya(t,r,a,i),Ja();var p=t.memoizedState;o!==d||f!==p||Ba||e!==null&&e.dependencies!==null&&ea(e.dependencies)?(typeof s==`function`&&(Gs(t,n,s,r),p=t.memoizedState),(u=Ba||qs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ea(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,gc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ra(t,e.child,null,i),t.child=Ra(t,null,n,i)):oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=jc(e,t,i),e}function bc(e,t,n,r){return Ui(),t.flags|=256,oc(e,t,n,r),t.child}var xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:Sa()}}function Cc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ru),e}function wc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(uo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ii){if(a?ao(t):co(t),(e=Fi)?(e=gf(e,Ri),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ei===null?null:{id:Di,overflow:Oi},retryLane:536870912,hydrationErrors:null},n=gi(e),n.return=t,t.child=n,Pi=t,Fi=null)):e=null,e===null)throw Bi(t);return vf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(co(t),a=t.mode,c=Ec({mode:`hidden`,children:c},a),r=mi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(null,r)):(ao(t),Tc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(ao(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState===null?(co(t),c=r.fallback,a=t.mode,r=Ec({mode:`visible`,children:r.children},a),c=mi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ra(t,e.child,null,n),r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,t=dc(null,r)):(co(t),t.child=e.child,t.flags|=128,t=null);else if(ao(t),vf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Gi({value:r,source:null,stack:null}),t=Dc(e,t,n)}else if(V||$i(e,t,n,!1),s=(n&e.childLanes)!==0,V||s){if(s=Wl,s!==null&&(r=ot(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ii(e,r),wu(s,e,r),ac;_f(c)||Iu(),t=Dc(e,t,n)}else _f(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Fi=bf(c.nextSibling),Pi=t,Ii=!0,Li=null,Ri=!1,e!==null&&Ni(t,e),t=Tc(t,r.children),t.flags|=4096);return t}return a?(co(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=di(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=mi(c,a,n,null),c.flags|=2):c=di(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,dc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Sc(n):(a=c.cachePool,a===null?a=Sa():(l=ca._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(e.child,r)):(ao(t),n=e.child,e=n.sibling,n=di(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Tc(e,t){return t=Ec({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ec(e,t){return e=li(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return Ra(t,e.child,null,n),e=Tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zi(e.return,t,n)}function kc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ac(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=uo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,ue(uo,o),oc(e,t,r,n),r=Ii?Ci:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Oc(e,n,t);else if(e.tag===19)Oc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&fo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),kc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&fo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}kc(t,!0,n,null,a,r);break;case`together`:kc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function jc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if($i(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=di(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=di(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&ea(e))):!0}function Nc(e,t,n){switch(t.tag){case 3:he(t,t.stateNode.containerInfo),Yi(t,ca,e.memoizedState.cache),Ui();break;case 27:case 5:_e(t);break;case 4:he(t,t.stateNode.containerInfo);break;case 10:Yi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(ao(t),e=jc(e,t,n),e===null?null:e.sibling):wc(e,t,n):(ao(t),t.flags|=128,null);ao(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=($i(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ue(uo,uo.current),r)break;return null;case 22:return t.lanes=0,uc(e,t,n,t.pendingProps);case 24:Yi(t,ca,e.memoizedState.cache)}return jc(e,t,n)}function Pc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)V=!0;else{if(!Mc(e,n)&&!(t.flags&128))return V=!1,Nc(e,t,n);V=!!(e.flags&131072)}else V=!1,Ii&&t.flags&1048576&&Ai(t,Ci,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e==`function`)ui(e)?(r=Ys(e,r),t.tag=1,t=yc(null,t,e,r,n)):(t.tag=0,t=_c(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=sc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ys(r,t.pendingProps),yc(e,t,r,a,n);case 3:a:{if(he(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ha(e,t),Ya(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Yi(t,ca,r),r!==o.cache&&Qi(t,[ca],n,!0),Ja(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=bc(e,t,r,n);break a}else if(r!==a){a=yi(Error(i(424)),t),Gi(a),t=bc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Fi=bf(e.firstChild),Pi=t,Ii=!0,Li=null,Ri=!0,n=za(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===a){t=jc(e,t,n);break a}oc(e,t,r,n)}t=t.child}return t;case 26:return gc(e,t),e===null?(n=Vf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ii||(n=t.type,e=t.pendingProps,r=Qd(pe.current).createElement(n),r[ft]=t,r[pt]=e,Kd(r,n,e),Tt(r),t.stateNode=r):t.memoizedState=Vf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _e(t),e===null&&Ii&&(r=t.stateNode=wf(t.type,t.pendingProps,pe.current),Pi=t,Ri=!0,a=Fi,uf(t.type)?(xf=a,Fi=bf(r.firstChild)):Fi=a),oc(e,t,t.pendingProps.children,n),gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ii&&((a=r=Fi)&&(r=mf(r,t.type,t.pendingProps,Ri),r===null?a=!1:(t.stateNode=r,Pi=t,Fi=bf(r.firstChild),Ri=!1,a=!0)),a||Bi(t)),_e(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,tf(a,o)?r=null:s!==null&&tf(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Eo(e,t,Oo,null,null,n),up._currentValue=a),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&Ii&&((e=n=Fi)&&(n=hf(n,t.pendingProps,Ri),n===null?e=!1:(t.stateNode=n,Pi=t,Fi=null,e=!0)),e||Bi(t)),null;case 13:return wc(e,t,n);case 4:return he(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ra(t,null,r,n):oc(e,t,r,n),t.child;case 11:return sc(e,t,t.type,t.pendingProps,n);case 7:return oc(e,t,t.pendingProps,n),t.child;case 8:return oc(e,t,t.pendingProps.children,n),t.child;case 12:return oc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Yi(t,t.type,r.value),oc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ta(t),a=na(a),r=r(a),t.flags|=1,oc(e,t,r,n),t.child;case 14:return cc(e,t,t.type,t.pendingProps,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 19:return Ac(e,t,n);case 31:return hc(e,t,n);case 22:return uc(e,t,n,t.pendingProps);case 24:return ta(t),r=na(ca),e===null?(a=ba(),a===null&&(a=Wl,o=la(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Va(t),Yi(t,ca,a)):((e.lanes&n)!==0&&(Ha(e,t),Ya(t,null,null,n),Ja()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Yi(t,ca,r),r!==a.cache&&Qi(t,[ca],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Yi(t,ca,r))),oc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Fc(e){e.flags|=4}function Ic(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Nu())e.flags|=8192;else throw z=Ea,wa}else e.flags&=-16777217}function Lc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!np(t))if(Nu())e.flags|=8192;else throw z=Ea,wa}function Rc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:et(),e.lanes|=t,iu|=t)}function zc(e,t){if(!Ii)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Bc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Vc(e,t,n){var r=t.pendingProps;switch(Mi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bc(t),null;case 1:return Bc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xi(ca),ge(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(R(t)?Fc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Bc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Fc(t),o===null?(Bc(t),Ic(t,a,null,r,n)):(Bc(t),Lc(t,o))):o?o===e.memoizedState?(Bc(t),t.flags&=-16777217):(Fc(t),Bc(t),Lc(t,o)):(e=e.memoizedProps,e!==r&&Fc(t),Bc(t),Ic(t,a,e,r,n)),null;case 27:if(ve(t),n=pe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}e=de.current,R(t)?Vi(t,e):(e=wf(a,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(ve(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}if(o=de.current,R(t))Vi(t,o);else{var s=Qd(pe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Kd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Fc(t)}}return Bc(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,R(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Pi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ud(e.nodeValue,n)),e||Bi(t,!0)}else e=Qd(e).createTextNode(r),e[ft]=t,t.stateNode=e}return Bc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=R(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ft]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(lo(t),t):(lo(t),null);if(t.flags&128)throw Error(i(558))}return Bc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=R(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ft]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),a=!1}else a=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(lo(t),t):(lo(t),null)}return lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Rc(t,t.updateQueue),Bc(t),null);case 4:return ge(),e===null&&Nd(t.stateNode.containerInfo),Bc(t),null;case 10:return Xi(t.type),Bc(t),null;case 19:if(le(uo),r=t.memoizedState,r===null)return Bc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)zc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=fo(e),o!==null){for(t.flags|=128,zc(r,!1),e=o.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fi(n,e),n=n.sibling;return ue(uo,uo.current&1|2),Ii&&ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&je()>uu&&(t.flags|=128,a=!0,zc(r,!1),t.lanes=4194304)}else{if(!a)if(e=fo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ii)return Bc(t),null}else 2*je()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,zc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Bc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=je(),e.sibling=null,n=uo.current,ue(uo,a?n&1|2:n&1),Ii&&ki(t,r.treeForkCount),e);case 22:case 23:return lo(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),n=t.updateQueue,n!==null&&Rc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&le(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),Bc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Hc(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),ge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ve(t),null;case 31:if(t.memoizedState!==null){if(lo(t),t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(uo),null;case 4:return ge(),null;case 10:return Xi(t.type),null;case 22:case 23:return lo(t),no(),e!==null&&le(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Uc(e,t){switch(Mi(t),t.tag){case 3:Xi(ca),ge();break;case 26:case 27:case 5:ve(t);break;case 4:ge();break;case 31:t.memoizedState!==null&&lo(t);break;case 13:lo(t);break;case 19:le(uo);break;case 10:Xi(t.type);break;case 22:case 23:lo(t),no(),e!==null&&le(ya);break;case 24:Xi(ca)}}function Wc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ed(t,t.return,e)}}function Gc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ed(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ed(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){ed(e,e.return,t)}}}function qc(e,t,n){n.props=Ys(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ed(e,t,n)}}function Jc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ed(e,t,n)}}function Yc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){ed(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ed(e,t,n)}else n.current=null}function Xc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ed(e,e.return,t)}}function Zc(e,t,n){try{var r=e.stateNode;qd(r,e.type,n,t),r[pt]=t}catch(t){ed(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&uf(e.type)||e.tag===4}function $c(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&uf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nn));else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Kd(t,r,n),t[ft]=e,t[pt]=n}catch(t){ed(e,e.return,t)}}var rl=!1,il=!1,al=!1,ol=typeof WeakSet==`function`?WeakSet:Set,sl=null;function cl(e,t){if(e=e.containerInfo,Xd=yp,e=Or(e),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Zd={focusedElem:e,selectionRange:n},yp=!1,sl=t;sl!==null;)if(t=sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,sl=e;else for(;sl!==null;){switch(t=sl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ys(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){ed(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)pf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:pf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,sl=e;break}sl=t.return}}function ll(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:wl(e,n),r&4&&Wc(5,n);break;case 1:if(wl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ed(n,n.return,e)}else{var i=Ys(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ed(n,n.return,e)}}r&64&&Kc(n),r&512&&Jc(n,n.return);break;case 3:if(wl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Za(e,t)}catch(e){ed(n,n.return,e)}}break;case 27:t===null&&r&4&&nl(n);case 26:case 5:wl(e,n),t===null&&r&4&&Xc(n),r&512&&Jc(n,n.return);break;case 12:wl(e,n);break;case 31:wl(e,n),r&4&&hl(e,n);break;case 13:wl(e,n),r&4&&gl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=id.bind(null,n),yf(e,n))));break;case 22:if(r=n.memoizedState!==null||rl,!r){t=t!==null&&t.memoizedState!==null||il,i=rl;var a=il;rl=r,(il=t)&&!a?El(e,n,(n.subtreeFlags&8772)!=0):wl(e,n),rl=i,il=a}break;case 30:break;default:wl(e,n)}}function ul(e){var t=e.alternate;t!==null&&(e.alternate=null,ul(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var dl=null,fl=!1;function pl(e,t,n){for(n=n.child;n!==null;)ml(e,t,n),n=n.sibling}function ml(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount==`function`)try{Ve.onCommitFiberUnmount(Be,n)}catch{}switch(n.tag){case 26:il||Yc(n,t),pl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:il||Yc(n,t);var r=dl,i=fl;uf(n.type)&&(dl=n.stateNode,fl=!1),pl(e,t,n),Tf(n.stateNode),dl=r,fl=i;break;case 5:il||Yc(n,t);case 6:if(r=dl,i=fl,dl=null,pl(e,t,n),dl=r,fl=i,dl!==null)if(fl)try{(dl.nodeType===9?dl.body:dl.nodeName===`HTML`?dl.ownerDocument.body:dl).removeChild(n.stateNode)}catch(e){ed(n,t,e)}else try{dl.removeChild(n.stateNode)}catch(e){ed(n,t,e)}break;case 18:dl!==null&&(fl?(e=dl,df(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Gp(e)):df(dl,n.stateNode));break;case 4:r=dl,i=fl,dl=n.stateNode.containerInfo,fl=!0,pl(e,t,n),dl=r,fl=i;break;case 0:case 11:case 14:case 15:Gc(2,n,t),il||Gc(4,n,t),pl(e,t,n);break;case 1:il||(Yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&qc(n,t,r)),pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:il=(r=il)||n.memoizedState!==null,pl(e,t,n),il=r;break;default:pl(e,t,n)}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gp(e)}catch(e){ed(t,t.return,e)}}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gp(e)}catch(e){ed(t,t.return,e)}}function _l(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ol),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ol),t;default:throw Error(i(435,e.tag))}}function vl(e,t){var n=_l(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ad.bind(null,e,t);t.then(r,r)}})}function yl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(uf(c.type)){dl=c.stateNode,fl=!1;break a}break;case 5:dl=c.stateNode,fl=!1;break a;case 3:case 4:dl=c.stateNode.containerInfo,fl=!0;break a}c=c.return}if(dl===null)throw Error(i(160));ml(o,s,a),dl=null,fl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xl(t,e),t=t.sibling}var bl=null;function xl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:yl(t,e),Sl(e),r&4&&(Gc(3,e,e.return),Wc(3,e),Gc(5,e,e.return));break;case 1:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&64&&rl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=bl;if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[yt]||o[ft]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Kd(o,r,n),o[ft]=e,Tt(o),r=o;break a;case`link`:var s=$f(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Kd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=$f(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Kd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ft]=e,Tt(o),r=o}e.stateNode=r}else ep(a,e.type,e.stateNode);else e.stateNode=Jf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Zc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?ep(a,e.type,e.stateNode):Jf(a,r,e.memoizedProps))}break;case 27:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),n!==null&&r&4&&Zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),e.flags&32){a=e.stateNode;try{Jt(a,``)}catch(t){ed(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Zc(e,a,n===null?a:n.memoizedProps)),r&1024&&(al=!0);break;case 6:if(yl(t,e),Sl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){ed(e,e.return,t)}}break;case 3:if(Qf=null,a=bl,bl=Of(t.containerInfo),yl(t,e),bl=a,Sl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Gp(t.containerInfo)}catch(t){ed(e,e.return,t)}al&&(al=!1,Cl(e));break;case 4:r=bl,bl=Of(e.stateNode.containerInfo),yl(t,e),Sl(e),bl=r;break;case 12:yl(t,e),Sl(e);break;case 31:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 13:yl(t,e),Sl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cu=je()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=rl,d=il;if(rl=u||a,il=d||l,yl(t,e),il=d,rl=u,Sl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||rl||il||Tl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){ed(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){ed(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?ff(m,!0):ff(l.stateNode,!1)}catch(e){ed(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,vl(e,n))));break;case 19:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 30:break;case 21:break;default:yl(t,e),Sl(e)}}function Sl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;tl(e,$c(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Jt(o,``),n.flags&=-33),tl(e,$c(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;el(e,$c(e),s);break;default:throw Error(i(161))}}catch(t){ed(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function wl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ll(e,t.alternate,t),t=t.sibling}function Tl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gc(4,t,t.return),Tl(t);break;case 1:Yc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&qc(t,t.return,n),Tl(t);break;case 27:Tf(t.stateNode);case 26:case 5:Yc(t,t.return),Tl(t);break;case 22:t.memoizedState===null&&Tl(t);break;case 30:Tl(t);break;default:Tl(t)}e=e.sibling}}function El(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:El(i,a,n),Wc(4,a);break;case 1:if(El(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ed(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Xa(c[i],s)}catch(e){ed(r,r.return,e)}}n&&o&64&&Kc(a),Jc(a,a.return);break;case 27:nl(a);case 26:case 5:El(i,a,n),n&&r===null&&o&4&&Xc(a),Jc(a,a.return);break;case 12:El(i,a,n);break;case 31:El(i,a,n),n&&o&4&&hl(i,a);break;case 13:El(i,a,n),n&&o&4&&gl(i,a);break;case 22:a.memoizedState===null&&El(i,a,n),Jc(a,a.return);break;case 30:break;default:El(i,a,n)}t=t.sibling}}function Dl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ua(n))}function Ol(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e))}function kl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Al(e,t,n,r),t=t.sibling}function Al(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:kl(e,t,n,r),i&2048&&Wc(9,t);break;case 1:kl(e,t,n,r);break;case 3:kl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e)));break;case 12:if(i&2048){kl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){ed(t,t.return,e)}}else kl(e,t,n,r);break;case 31:kl(e,t,n,r);break;case 13:kl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?kl(e,t,n,r):(a._visibility|=2,jl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?kl(e,t,n,r):Ml(e,t),i&2048&&Dl(o,t);break;case 24:kl(e,t,n,r),i&2048&&Ol(t.alternate,t);break;default:kl(e,t,n,r)}}function jl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:jl(a,o,s,c,i),Wc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,jl(a,o,s,c,i)):u._visibility&2?jl(a,o,s,c,i):Ml(a,o),i&&l&2048&&Dl(o.alternate,o);break;case 24:jl(a,o,s,c,i),i&&l&2048&&Ol(o.alternate,o);break;default:jl(a,o,s,c,i)}t=t.sibling}}function Ml(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ml(n,r),i&2048&&Dl(r.alternate,r);break;case 24:Ml(n,r),i&2048&&Ol(r.alternate,r);break;default:Ml(n,r)}t=t.sibling}}var Nl=8192;function Pl(e,t,n){if(e.subtreeFlags&Nl)for(e=e.child;e!==null;)Fl(e,t,n),e=e.sibling}function Fl(e,t,n){switch(e.tag){case 26:Pl(e,t,n),e.flags&Nl&&e.memoizedState!==null&&rp(n,bl,e.memoizedState,e.memoizedProps);break;case 5:Pl(e,t,n);break;case 3:case 4:var r=bl;bl=Of(e.stateNode.containerInfo),Pl(e,t,n),bl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Nl,Nl=16777216,Pl(e,t,n),Nl=r):Pl(e,t,n));break;default:Pl(e,t,n)}}function Il(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rl(e),e=e.sibling}function Rl(e){switch(e.tag){case 0:case 11:case 15:Ll(e),e.flags&2048&&Gc(9,e,e.return);break;case 3:Ll(e);break;case 12:Ll(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zl(e)):Ll(e);break;default:Ll(e)}}function zl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gc(8,t,t.return),zl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,zl(t));break;default:zl(t)}e=e.sibling}}function Bl(e,t){for(;sl!==null;){var n=sl;switch(n.tag){case 0:case 11:case 15:Gc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ua(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,sl=r;else a:for(n=e;sl!==null;){r=sl;var i=r.sibling,a=r.return;if(ul(r),r===n){sl=null;break a}if(i!==null){i.return=a,sl=i;break a}sl=a}}}var Vl={getCacheForType:function(e){var t=na(ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return na(ca).controller.signal}},Hl=typeof WeakMap==`function`?WeakMap:Map,Ul=0,Wl=null,Gl=null,Kl=0,ql=0,Jl=null,Yl=!1,Xl=!1,Zl=!1,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=null,ou=null,su=!1,cu=0,lu=0,uu=1/0,du=null,fu=null,pu=0,mu=null,hu=null,gu=0,_u=0,vu=null,yu=null,bu=0,xu=null;function Su(){return Ul&2&&Kl!==0?Kl&-Kl:A.T===null?lt():xd()}function Cu(){if(ru===0)if(!(Kl&536870912)||Ii){var e=Je;Je<<=1,!(Je&3932160)&&(Je=262144),ru=e}else ru=536870912;return e=ro.current,e!==null&&(e.flags|=32),ru}function wu(e,t,n){(e===Wl&&(ql===2||ql===9)||e.cancelPendingCommit!==null)&&(ju(e,0),Ou(e,Kl,ru,!1)),nt(e,n),(!(Ul&2)||e!==Wl)&&(e===Wl&&(!(Ul&2)&&(tu|=n),$l===4&&Ou(e,Kl,ru,!1)),pd(e))}function Tu(e,t,n){if(Ul&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Qe(e,t),a=r?zu(e,t):Lu(e,t,!0),o=r;do{if(a===0){Xl&&!r&&Ou(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Du(n)){a=Lu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=au;var l=c.current.memoizedState.isDehydrated;if(l&&(ju(c,s).flags|=256),s=Lu(c,s,!1),s!==2){if(Zl&&!l){c.errorRecoveryDisabledLanes|=o,tu|=o,a=4;break a}o=ou,ou=a,o!==null&&(ou===null?ou=o:ou.push.apply(ou,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ju(e,0),Ou(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Ou(r,t,ru,!Yl);break a;case 2:ou=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=cu+300-je(),10<a)){if(Ou(r,t,ru,!Yl),Ze(r,0,!0)!==0)break a;gu=t,r.timeoutHandle=af(Eu.bind(null,r,n,ou,du,su,t,ru,tu,iu,Yl,o,`Throttled`,-0,0),a);break a}Eu(r,n,ou,du,su,t,ru,tu,iu,Yl,o,null,-0,0)}}break}while(1);pd(e)}function Eu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:nn},Fl(t,a,d);var m=(a&62914560)===a?cu-je():(a&4194048)===a?lu-je():0;if(m=ap(d,m),m!==null){gu=a,e.cancelPendingCommit=m(Ku.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ou(e,a,o,!l);return}}Ku(e,t,a,n,r,i,o,s,c)}function Du(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Cr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ou(e,t,n,r){t&=~nu,t&=~tu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ue(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&it(e,n,t)}function ku(){return Ul&6?!0:(md(0,!1),!1)}function Au(){if(Gl!==null){if(ql===0)var e=Gl.return;else e=Gl,Ji=qi=null,jo(e),Ma=null,Na=0,e=Gl;for(;e!==null;)Uc(e.alternate,e),e=e.return;Gl=null}}function ju(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,of(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),gu=0,Au(),Wl=e,Gl=n=di(e.current,null),Kl=t,ql=0,Jl=null,Yl=!1,Xl=Qe(e,t),Zl=!1,iu=ru=nu=tu=eu=$l=0,ou=au=null,su=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ue(r),a=1<<i;t|=e[i],r&=~a}return Ql=t,ti(),n}function Mu(e,t){mo=null,A.H=Vs,t===Ca||t===Ta?(t=Aa(),ql=3):t===wa?(t=Aa(),ql=4):ql=t===ac?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Jl=t,Gl===null&&($l=1,$s(e,yi(t,e.current)))}function Nu(){var e=ro.current;return e===null?!0:(Kl&4194048)===Kl?io===null:(Kl&62914560)===Kl||Kl&536870912?e===io:!1}function Pu(){var e=A.H;return A.H=Vs,e===null?Vs:e}function Fu(){var e=A.A;return A.A=Vl,e}function Iu(){$l=4,Yl||(Kl&4194048)!==Kl&&ro.current!==null||(Xl=!0),!(eu&134217727)&&!(tu&134217727)||Wl===null||Ou(Wl,Kl,ru,!1)}function Lu(e,t,n){var r=Ul;Ul|=2;var i=Pu(),a=Fu();(Wl!==e||Kl!==t)&&(du=null,ju(e,t)),t=!1;var o=$l;a:do try{if(ql!==0&&Gl!==null){var s=Gl,c=Jl;switch(ql){case 8:Au(),o=6;break a;case 3:case 2:case 9:case 6:ro.current===null&&(t=!0);var l=ql;if(ql=0,Jl=null,Uu(e,s,c,l),n&&Xl){o=0;break a}break;default:l=ql,ql=0,Jl=null,Uu(e,s,c,l)}}Ru(),o=$l;break}catch(t){Mu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ji=qi=null,Ul=r,A.H=i,A.A=a,Gl===null&&(Wl=null,Kl=0,ti()),o}function Ru(){for(;Gl!==null;)Vu(Gl)}function zu(e,t){var n=Ul;Ul|=2;var r=Pu(),a=Fu();Wl!==e||Kl!==t?(du=null,uu=je()+500,ju(e,t)):Xl=Qe(e,t);a:do try{if(ql!==0&&Gl!==null){t=Gl;var o=Jl;b:switch(ql){case 1:ql=0,Jl=null,Uu(e,t,o,1);break;case 2:case 9:if(Da(o)){ql=0,Jl=null,Hu(t);break}t=function(){ql!==2&&ql!==9||Wl!==e||(ql=7),pd(e)},o.then(t,t);break a;case 3:ql=7;break a;case 4:ql=5;break a;case 7:Da(o)?(ql=0,Jl=null,Hu(t)):(ql=0,Jl=null,Uu(e,t,o,7));break;case 5:var s=null;switch(Gl.tag){case 26:s=Gl.memoizedState;case 5:case 27:var c=Gl;if(s?np(s):c.stateNode.complete){ql=0,Jl=null;var l=c.sibling;if(l!==null)Gl=l;else{var u=c.return;u===null?Gl=null:(Gl=u,Wu(u))}break b}}ql=0,Jl=null,Uu(e,t,o,5);break;case 6:ql=0,Jl=null,Uu(e,t,o,6);break;case 8:Au(),$l=6;break a;default:throw Error(i(462))}}Bu();break}catch(t){Mu(e,t)}while(1);return Ji=qi=null,A.H=r,A.A=a,Ul=n,Gl===null?(Wl=null,Kl=0,ti(),$l):0}function Bu(){for(;Gl!==null&&!ke();)Vu(Gl)}function Vu(e){var t=Pc(e.alternate,e,Ql);e.memoizedProps=e.pendingProps,t===null?Wu(e):Gl=t}function Hu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=vc(n,t,t.pendingProps,t.type,void 0,Kl);break;case 11:t=vc(n,t,t.pendingProps,t.type.render,t.ref,Kl);break;case 5:jo(t);default:Uc(n,t),t=Gl=fi(t,Ql),t=Pc(n,t,Ql)}e.memoizedProps=e.pendingProps,t===null?Wu(e):Gl=t}function Uu(e,t,n,r){Ji=qi=null,jo(t),Ma=null,Na=0;var i=t.return;try{if(ic(e,i,t,n,Kl)){$l=1,$s(e,yi(n,e.current)),Gl=null;return}}catch(t){if(i!==null)throw Gl=i,t;$l=1,$s(e,yi(n,e.current)),Gl=null;return}t.flags&32768?(Ii||r===1?e=!0:Xl||Kl&536870912?e=!1:(Yl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ro.current,r!==null&&r.tag===13&&(r.flags|=16384))),Gu(t,e)):Wu(t)}function Wu(e){var t=e;do{if(t.flags&32768){Gu(t,Yl);return}e=t.return;var n=Vc(t.alternate,t,Ql);if(n!==null){Gl=n;return}if(t=t.sibling,t!==null){Gl=t;return}Gl=t=e}while(t!==null);$l===0&&($l=5)}function Gu(e,t){do{var n=Hc(e.alternate,e);if(n!==null){n.flags&=32767,Gl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Gl=e;return}Gl=e=n}while(e!==null);$l=6,Gl=null}function Ku(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Zu();while(pu!==0);if(Ul&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ei,rt(e,n,o,s,c,l),e===Wl&&(Gl=Wl=null,Kl=0),hu=t,mu=e,gu=n,_u=o,vu=a,yu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,od(Fe,function(){return Qu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=A.T,A.T=null,a=j.p,j.p=2,s=Ul,Ul|=4;try{cl(e,t,n)}finally{Ul=s,j.p=a,A.T=r}}pu=1,qu(),Ju(),Yu()}}function qu(){if(pu===1){pu=0;var e=mu,t=hu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Ul;Ul|=4;try{xl(t,e);var a=Zd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Er(s,h),v=Er(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}yp=!!Xd,Zd=Xd=null}finally{Ul=i,j.p=r,A.T=n}}e.current=t,pu=2}}function Ju(){if(pu===2){pu=0;var e=mu,t=hu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Ul;Ul|=4;try{ll(e,t.alternate,t)}finally{Ul=i,j.p=r,A.T=n}}pu=3}}function Yu(){if(pu===4||pu===3){pu=0,Ae();var e=mu,t=hu,n=gu,r=yu;t.subtreeFlags&10256||t.flags&10256?pu=5:(pu=0,hu=mu=null,Xu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(fu=null),ct(n),t=t.stateNode,Ve&&typeof Ve.onCommitFiberRoot==`function`)try{Ve.onCommitFiberRoot(Be,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,i=j.p,j.p=2,A.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{A.T=t,j.p=i}}gu&3&&Zu(),pd(e),i=e.pendingLanes,n&261930&&i&42?e===xu?bu++:(bu=0,xu=e):bu=0,md(0,!1)}}function Xu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ua(t)))}function Zu(){return qu(),Ju(),Yu(),Qu()}function Qu(){if(pu!==5)return!1;var e=mu,t=_u;_u=0;var n=ct(gu),r=A.T,a=j.p;try{j.p=32>n?32:n,A.T=null,n=vu,vu=null;var o=mu,s=gu;if(pu=0,hu=mu=null,gu=0,Ul&6)throw Error(i(331));var c=Ul;if(Ul|=4,Rl(o.current),Al(o,o.current,s,n),Ul=c,md(0,!1),Ve&&typeof Ve.onPostCommitFiberRoot==`function`)try{Ve.onPostCommitFiberRoot(Be,o)}catch{}return!0}finally{j.p=a,A.T=r,Xu(e,t)}}function $u(e,t,n){t=yi(n,t),t=tc(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(nt(e,2),pd(e))}function ed(e,t,n){if(e.tag===3)$u(e,e,n);else for(;t!==null;){if(t.tag===3){$u(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=yi(n,e),n=nc(2),r=Wa(t,n,2),r!==null&&(rc(n,r,t,e),nt(r,2),pd(r));break}}t=t.return}}function td(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Hl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Zl=!0,i.add(n),e=nd.bind(null,e,t,n),t.then(e,e))}function nd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Wl===e&&(Kl&n)===n&&($l===4||$l===3&&(Kl&62914560)===Kl&&300>je()-cu?!(Ul&2)&&ju(e,0):nu|=n,iu===Kl&&(iu=0)),pd(e)}function rd(e,t){t===0&&(t=et()),e=ii(e,t),e!==null&&(nt(e,t),pd(e))}function id(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rd(e,n)}function ad(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),rd(e,n)}function od(e,t){return De(e,t)}var sd=null,cd=null,ld=!1,ud=!1,dd=!1,fd=0;function pd(e){e!==cd&&e.next===null&&(cd===null?sd=cd=e:cd=cd.next=e),ud=!0,ld||(ld=!0,bd())}function md(e,t){if(!dd&&ud){dd=!0;do for(var n=!1,r=sd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ue(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,yd(r,a))}else a=Kl,a=Ze(r,r===Wl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Qe(r,a)||(n=!0,yd(r,a));r=r.next}while(n);dd=!1}}function hd(){gd()}function gd(){ud=ld=!1;var e=0;fd!==0&&rf()&&(e=fd);for(var t=je(),n=null,r=sd;r!==null;){var i=r.next,a=_d(r,t);a===0?(r.next=null,n===null?sd=i:n.next=i,i===null&&(cd=n)):(n=r,(e!==0||a&3)&&(ud=!0)),r=i}pu!==0&&pu!==5||md(e,!1),fd!==0&&(fd=0)}function _d(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ue(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=$e(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Wl,n=Kl,n=Ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ql===2||ql===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Oe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Oe(r),ct(n)){case 2:case 8:n=Pe;break;case 32:n=Fe;break;case 268435456:n=Le;break;default:n=Fe}return r=vd.bind(null,e),n=De(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Oe(r),e.callbackPriority=2,e.callbackNode=null,2}function vd(e,t){if(pu!==0&&pu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Zu()&&e.callbackNode!==n)return null;var r=Kl;return r=Ze(e,e===Wl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Tu(e,r,t),_d(e,je()),e.callbackNode!=null&&e.callbackNode===n?vd.bind(null,e):null)}function yd(e,t){if(Zu())return null;Tu(e,t,!0)}function bd(){cf(function(){Ul&6?De(Ne,hd):gd()})}function xd(){if(fd===0){var e=pa;e===0&&(e=qe,qe<<=1,!(qe&261888)&&(qe=256)),fd=e}return fd}function Sd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:tn(``+e)}function Cd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function wd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Sd((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?Sd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(fd!==0){var e=o?Cd(i,o):new FormData(i);Ds(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Cd(i,o):new FormData(i),Ds(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Td=0;Td<Yr.length;Td++){var Ed=Yr[Td];Xr(Ed.toLowerCase(),`on`+(Ed[0].toUpperCase()+Ed.slice(1)))}Xr(Vr,`onAnimationEnd`),Xr(Hr,`onAnimationIteration`),Xr(Ur,`onAnimationStart`),Xr(`dblclick`,`onDoubleClick`),Xr(`focusin`,`onFocus`),Xr(`focusout`,`onBlur`),Xr(Wr,`onTransitionRun`),Xr(Gr,`onTransitionStart`),Xr(Kr,`onTransitionCancel`),Xr(qr,`onTransitionEnd`),kt(`onMouseEnter`,[`mouseout`,`mouseover`]),kt(`onMouseLeave`,[`mouseout`,`mouseover`]),kt(`onPointerEnter`,[`pointerout`,`pointerover`]),kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ot(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ot(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ot(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ot(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Dd=`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(` `),Od=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Dd));function kd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Zr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Zr(e)}i.currentTarget=null,a=c}}}}function Ad(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Pd(t,e,2,!1),n.add(r))}function jd(e,t,n){var r=0;t&&(r|=4),Pd(n,e,r,t)}var Md=`_reactListening`+Math.random().toString(36).slice(2);function Nd(e){if(!e[Md]){e[Md]=!0,Et.forEach(function(t){t!==`selectionchange`&&(Od.has(t)||jd(t,!1,e),jd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Md]||(t[Md]=!0,jd(`selectionchange`,!1,t))}}function Pd(e,t,n,r){switch(Ep(t)){case 2:var i=bp;break;case 8:i=xp;break;default:i=Sp}n=i.bind(null,t,n,e),i=void 0,!pn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Fd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=xt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}un(function(){var r=a,i=an(n),s=[];a:{var c=Jr.get(e);if(c!==void 0){var l=wn,u=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:l=Hn;break;case`focusin`:u=`focus`,l=Nn;break;case`focusout`:u=`blur`,l=Nn;break;case`beforeblur`:case`afterblur`:l=Nn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Wn;break;case Vr:case Hr:case Ur:l=Pn;break;case qr:l=Gn;break;case`scroll`:case`scrollend`:l=En;break;case`wheel`:l=Kn;break;case`copy`:case`cut`:case`paste`:l=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Un;break;case`toggle`:case`beforetoggle`:l=qn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=dn(m,p),g!=null&&d.push(Id(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==rn&&(u=n.relatedTarget||n.fromElement)&&(xt(u)||u[mt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?xt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=jn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Un,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Ct(l),h=u==null?c:Ct(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,xt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Rd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&zd(s,c,l,d,!1),u!==null&&f!==null&&zd(s,f,u,d,!0)}}a:{if(c=r?Ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=pr;else if(sr(c))if(I)v=xr;else{v=yr;var y=vr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Qt(r.elementType)&&(v=pr):v=br;if(v&&=v(e,r)){cr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Kt(c,`number`,c.value)}switch(y=r?Ct(r):window,e){case`focusin`:(sr(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(s,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(s,n,i)}var b;if(Yn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else rr?tr(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Qn&&n.locale!==`ko`&&(rr||x!==`onCompositionStart`?x===`onCompositionEnd`&&rr&&(b=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,rr=!0)),y=Ld(r,x),0<y.length&&(x=new In(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=nr(n),b!==null&&(x.data=b)))),(b=Zn?ir(e,n):ar(e,n))&&(x=Ld(r,`onBeforeInput`),0<x.length&&(y=new In(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),wd(s,e,r,n,i)}kd(s,t)})}function Id(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ld(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=dn(e,n),i!=null&&r.unshift(Id(e,i,a)),i=dn(e,t),i!=null&&r.push(Id(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Rd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=dn(n,a),l!=null&&o.unshift(Id(n,l,c))):i||(l=dn(n,a),l!=null&&o.push(Id(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Bd=/\r\n?/g,Vd=/\u0000|\uFFFD/g;function Hd(e){return(typeof e==`string`?e:``+e).replace(Bd,`
|
|
9
|
-
`).replace(Vd,``)}function Ud(e,t){return t=Hd(t),Hd(e)===t}function Wd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Wd(e,t,`name`,a.name,a,null),Wd(e,t,`formEncType`,a.formEncType,a,null),Wd(e,t,`formMethod`,a.formMethod,a,null),Wd(e,t,`formTarget`,a.formTarget,a,null)):(Wd(e,t,`encType`,a.encType,a,null),Wd(e,t,`method`,a.method,a,null),Wd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=tn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=$t.get(n)||n,Pt(e,n,r))}}function Gd(e,t,n,r,a,o){switch(n){case`style`:Zt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[pt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}}}function Kd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ad(`error`,e),Ad(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Wd(e,t,o,s,n,null)}}a&&Wd(e,t,`srcSet`,n.srcSet,n,null),r&&Wd(e,t,`src`,n.src,n,null);return;case`input`:Ad(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Wd(e,t,r,d,n,null)}}N(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ad(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Wd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&qt(e,!!r,n,!0):qt(e,!!r,t,!1);return;case`textarea`:for(s in Ad(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Wd(e,t,s,c,n,null)}F(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Wd(e,t,l,r,n,null)}return;case`dialog`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Ad(`cancel`,e),Ad(`close`,e);break;case`iframe`:case`object`:Ad(`load`,e);break;case`video`:case`audio`:for(r=0;r<Dd.length;r++)Ad(Dd[r],e);break;case`image`:Ad(`error`,e),Ad(`load`,e);break;case`details`:Ad(`toggle`,e);break;case`embed`:case`source`:case`link`:Ad(`error`,e),Ad(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Wd(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Gd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Wd(e,t,c,r,n,null))}function qd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Wd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Wd(e,t,p,m,r,f)}}Gt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Wd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Wd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?qt(e,!!n,n?[]:``,!1):qt(e,!!n,t,!0)):qt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Wd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Wd(e,t,s,a,r,o)}P(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Wd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Wd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Wd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Wd(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Gd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Gd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Wd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Wd(e,t,f,p,r,m)}function Jd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Yd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Jd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Jd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Xd=null,Zd=null;function Qd(e){return e.nodeType===9?e:e.ownerDocument}function $d(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function ef(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function tf(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var nf=null;function rf(){var e=window.event;return e&&e.type===`popstate`?e===nf?!1:(nf=e,!0):(nf=null,!1)}var af=typeof setTimeout==`function`?setTimeout:void 0,of=typeof clearTimeout==`function`?clearTimeout:void 0,sf=typeof Promise==`function`?Promise:void 0,cf=typeof queueMicrotask==`function`?queueMicrotask:sf===void 0?af:function(e){return sf.resolve(null).then(e).catch(lf)};function lf(e){setTimeout(function(){throw e})}function uf(e){return e===`head`}function df(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Gp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Tf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Tf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Tf(e.ownerDocument.body);n=i}while(n);Gp(t)}function ff(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function pf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:pf(n),bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=bf(e.nextSibling),e===null)break}return null}function hf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bf(e.nextSibling),e===null))return null;return e}function gf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bf(e.nextSibling),e===null))return null;return e}function _f(e){return e.data===`$?`||e.data===`$~`}function vf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function yf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function bf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var xf=null;function Sf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function wf(e,t,n){switch(t=Qd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bt(e)}var Ef=new Map,Df=new Set;function Of(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var kf=j.d;j.d={f:Af,r:jf,D:Pf,C:Ff,L:If,m:Lf,X:zf,S:Rf,M:Bf};function Af(){var e=kf.f(),t=ku();return e||t}function jf(e){var t=St(e);t!==null&&t.tag===5&&t.type===`form`?ks(t):kf.r(e)}var Mf=typeof document>`u`?null:document;function Nf(e,t,n){var r=Mf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Df.has(i)||(Df.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Pf(e){kf.D(e),Nf(`dns-prefetch`,e,null)}function Ff(e,t){kf.C(e,t),Nf(`preconnect`,e,t)}function If(e,t,n){kf.L(e,t,n);var r=Mf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Hf(e);break;case`script`:a=Kf(e)}Ef.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Ef.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Uf(a))||t===`script`&&r.querySelector(qf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Lf(e,t){kf.m(e,t);var n=Mf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Kf(e)}if(!Ef.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Ef.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function Rf(e,t,n){kf.S(e,t,n);var r=Mf;if(r&&e){var i=wt(r).hoistableStyles,a=Hf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Uf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Ef.get(a))&&Xf(e,n);var c=o=r.createElement(`link`);Tt(c),Kd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Yf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function zf(e,t){kf.X(e,t);var n=Mf;if(n&&e){var r=wt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),Tt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t){kf.M(e,t);var n=Mf;if(n&&e){var r=wt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),Tt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t,n,r){var a=(a=pe.current)?Of(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Hf(n.href),n=wt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Hf(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Uf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Ef.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ef.set(e,n),o||Gf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Kf(n),n=wt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Hf(e){return`href="`+Wt(e)+`"`}function Uf(e){return`link[rel="stylesheet"][`+e+`]`}function Wf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Gf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Kd(t,`link`,n),Tt(t),e.head.appendChild(t))}function Kf(e){return`[src="`+Wt(e)+`"]`}function qf(e){return`script[async]`+e}function Jf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Kd(r,`style`,a),Yf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Hf(n.href);var o=e.querySelector(Uf(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Wf(n),(a=Ef.get(a))&&Xf(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Yf(o,n.precedence,e),t.instance=o;case`script`:return o=Kf(n.src),(a=e.querySelector(qf(o)))?(t.instance=a,Tt(a),a):(r=n,(a=Ef.get(o))&&(r=m({},n),Zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),Kd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Yf(r,n.precedence,e));return t.instance}function Yf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Xf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qf=null;function $f(e,t,n){if(Qf===null){var r=new Map,i=Qf=new Map;i.set(n,r)}else i=Qf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function tp(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function np(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Hf(r.href),a=t.querySelector(Uf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=op.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Wf(r),(i=Ef.get(i))&&Xf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=op.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ip=0;function ap(e,t){return e.stylesheets&&e.count===0&&cp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ip===0&&(ip=62500*Yd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ip?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function op(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sp=null;function cp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sp=new Map,t.forEach(lp,e),sp=null,op.call(e))}function lp(e,t){if(!(t.state.loading&4)){var n=sp.get(e);if(n)var r=n.get(null);else{n=new Map,sp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=op.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var up={$$typeof:C,Provider:null,Consumer:null,_currentValue:M,_currentValue2:M,_threadCount:0};function dp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function fp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new dp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=li(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function pp(e){return e?(e=si,e):si}function mp(e,t,n,r,i,a){i=pp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(wu(n,e,t),Ga(n,e,t))}function hp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gp(e,t){hp(e,t),(e=e.alternate)&&hp(e,t)}function _p(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&wu(t,e,67108864),gp(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=Su();t=st(t);var n=ii(e,t);n!==null&&wu(n,e,t),gp(e,t)}}var yp=!0;function bp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,Sp(e,t,n,r)}finally{j.p=a,A.T=i}}function xp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,Sp(e,t,n,r)}finally{j.p=a,A.T=i}}function Sp(e,t,n,r){if(yp){var i=Cp(r);if(i===null)Fd(e,t,r,wp,n),Fp(e,r);else if(Lp(i,e,t,n,r))r.stopPropagation();else if(Fp(e,r),t&4&&-1<Pp.indexOf(e)){for(;i!==null;){var a=St(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}pd(a),!(Ul&6)&&(uu=je()+500,md(0,!1))}}break;case 31:case 13:s=ii(a,2),s!==null&&wu(s,a,2),ku(),gp(a,2)}if(a=Cp(r),a===null&&Fd(e,t,r,wp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Fd(e,t,r,null,n)}}function Cp(e){return e=an(e),Tp(e)}var wp=null;function Tp(e){if(wp=null,e=xt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return wp=e,null}function Ep(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Dp=!1,Op=null,kp=null,Ap=null,jp=new Map,Mp=new Map,Np=[],Pp=`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 Fp(e,t){switch(e){case`focusin`:case`focusout`:Op=null;break;case`dragenter`:case`dragleave`:kp=null;break;case`mouseover`:case`mouseout`:Ap=null;break;case`pointerover`:case`pointerout`:jp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Mp.delete(t.pointerId)}}function Ip(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=St(t),t!==null&&_p(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Lp(e,t,n,r,i){switch(t){case`focusin`:return Op=Ip(Op,e,t,n,r,i),!0;case`dragenter`:return kp=Ip(kp,e,t,n,r,i),!0;case`mouseover`:return Ap=Ip(Ap,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return jp.set(a,Ip(jp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Mp.set(a,Ip(Mp.get(a)||null,e,t,n,r,i)),!0}return!1}function Rp(e){var t=xt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ut(e.priority,function(){vp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){vp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=St(n),t!==null&&_p(t),e.blockedOn=n,!1;t.shift()}return!0}function Bp(e,t,n){zp(e)&&n.delete(t)}function Vp(){Dp=!1,Op!==null&&zp(Op)&&(Op=null),kp!==null&&zp(kp)&&(kp=null),Ap!==null&&zp(Ap)&&(Ap=null),jp.forEach(Bp),Mp.forEach(Bp)}function Hp(e,n){e.blockedOn===n&&(e.blockedOn=null,Dp||(Dp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vp)))}var Up=null;function Wp(e){Up!==e&&(Up=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Up===e&&(Up=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Tp(r||n)===null)continue;break}var a=St(n);a!==null&&(e.splice(t,3),t-=3,Ds(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Gp(e){function t(t){return Hp(t,e)}Op!==null&&Hp(Op,e),kp!==null&&Hp(kp,e),Ap!==null&&Hp(Ap,e),jp.forEach(t),Mp.forEach(t);for(var n=0;n<Np.length;n++){var r=Np[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Np.length&&(n=Np[0],n.blockedOn===null);)Rp(n),n.blockedOn===null&&Np.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Wp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Tp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Wp(n)}}}function Kp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function qp(e){this._internalRoot=e}H.prototype.render=qp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;mp(n,Su(),e,t,null,null)},H.prototype.unmount=qp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mp(e.current,2,null,e,null,null),ku(),t[mt]=null}};function H(e){this._internalRoot=e}H.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Np.length&&t!==0&&t<Np[n].priority;n++);Np.splice(n,0,e),n===0&&Rp(e)}};var Jp=n.version;if(Jp!==`19.2.7`)throw Error(i(527,Jp,`19.2.7`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Yp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xp.isDisabled&&Xp.supportsFiber)try{Be=Xp.inject(Yp),Ve=Xp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Xs,s=Zs,c=Qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=fp(e,1,!1,null,null,n,r,null,o,s,c,Kp),e[mt]=t.current,Nd(e),new qp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=`modulepreload`,x=function(e){return`/`+e},S={},C=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=x(t,n),t=s(t),t in S)return;S[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:b,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},w=`true`,T=`false`,E=w===`true`,D=T===`true`;function O(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:a,onRegisteredSW:o,onRegisterError:s}=e,c,l,u,d=async(e=!0)=>{await l,E||u?.()};async function f(){if(`serviceWorker`in navigator){if(c=await C(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{s?.(e)}),!c)return;if(u=()=>{c?.messageSkipWaiting()},!D)if(E)c.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),c.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,c?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};c.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),c.addEventListener(`waiting`,t)}c.register({immediate:t}).then(e=>{o?o(`/sw.js`,e):a?.(e)}).catch(e=>{s?.(e)})}}return l=f(),d}var k=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),te=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ne=e=>{let t=te(e);return t.charAt(0).toUpperCase()+t.slice(1)},re={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ie=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ae=(0,v.createContext)({}),A=()=>(0,v.useContext)(ae),j=(0,v.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=A()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,...re,width:t??l??re.width,height:t??l??re.height,stroke:e??f,strokeWidth:m,className:k(`lucide`,p,i),...!a&&!ie(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),M=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(j,{ref:i,iconNode:t,className:k(`lucide-${ee(ne(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ne(e),n},oe=M(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),se=M(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ce=M(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),le=M(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),ue=M(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),de=M(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),fe=M(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),pe=M(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),me=M(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),he=M(`square-x`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ge=M(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),_e=M(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ve=M(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ye=M(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),be=M(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),xe=M(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Se=M(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ce=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),we=M(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Te=M(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ee=M(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),De=M(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Oe=M(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ke=M(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ae=M(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),je=M(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Me=M(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Ne=M(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Pe=M(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Fe=M(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ie=M(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Le=M(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Re=M(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),ze=M(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Be=M(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Ve=M(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),He=M(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ue=M(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),We=M(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]),Ge=M(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Ke=M(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),qe=M(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Je=M(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ye=M(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Xe=M(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ze=M(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Qe=M(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),$e=M(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),et=M(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),tt=M(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),nt=M(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),rt=M(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),it=M(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),at=M(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ot=M(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),st=`(max-width: 767px)`;function ct(){let[e,t]=(0,v.useState)(()=>typeof window>`u`?!1:window.matchMedia(st).matches);return(0,v.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(st),n=e=>t(e.matches);return t(e.matches),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var lt=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ut=(e=>e?lt(e):lt),dt=e=>e;function ft(e,t=dt){let n=v.useSyncExternalStore(e.subscribe,v.useCallback(()=>t(e.getState()),[e,t]),v.useCallback(()=>t(e.getInitialState()),[e,t]));return v.useDebugValue(n),n}var pt=e=>{let t=ut(e),n=e=>ft(t,e);return Object.assign(n,t),n},mt=(e=>e?pt(e):pt);function ht(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var gt=class{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then(()=>new Promise(e)),new Promise(t=>{e=t})}dispatch(e){return ht(this,void 0,void 0,function*(){let t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}})}};function _t(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global}var vt=_t(),yt=vt.Buffer??null,bt=vt.TextEncoder?new vt.TextEncoder:null;function xt(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function St(e,t){let n=t.length>>1;for(let r=0;r<n;r++){let n=r<<1;e[r]=xt(t.charCodeAt(n),t.charCodeAt(n+1))}}function Ct(e,t){if(e.length!==t.length*2)return!1;for(let n=0;n<t.length;n++){let r=n<<1;if(t[n]!==xt(e.charCodeAt(r),e.charCodeAt(r+1)))return!1}return!0}var wt=87,Tt=48;function Et(e,t,n){let r=0;for(let i=0;i<n;i++){let n=t[i]>>>4;e[r++]=n>9?n+wt:n+Tt,n=t[i]&15,e[r++]=n>9?n+wt:n+Tt}return String.fromCharCode.apply(null,e)}var Dt=yt===null?e=>{if(typeof e==`string`)return bt.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Invalid data type!`)}:e=>{if(typeof e==`string`){let t=yt.from(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(yt.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Invalid data type!`)},Ot=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,kt=new Uint8Array(256);for(let e=0;e<64;e++)kt[Ot.charCodeAt(e)]=e;function At(e){let t=Math.floor(e.length*.75),n=e.length;return e[n-1]===`=`&&(--t,e[n-2]===`=`&&--t),t}function jt(e){let t=At(e),n=e.length,r=new Uint8Array(t),i=0;for(let t=0;t<n;t+=4){let n=kt[e.charCodeAt(t)],a=kt[e.charCodeAt(t+1)],o=kt[e.charCodeAt(t+2)],s=kt[e.charCodeAt(t+3)];r[i]=n<<2|a>>4,i+=1,r[i]=(a&15)<<4|o>>2,i+=1,r[i]=(o&3)<<6|s&63,i+=1}return r}var Mt=16*1024,Nt=4,Pt=new gt,Ft=new Map;function It(e,t){return ht(this,void 0,void 0,function*(){let n=null,r=null,i=!1;if(typeof WebAssembly>`u`)throw Error(`WebAssembly is not supported in this environment!`);let a=(e,t=0)=>{r.set(e,t)},o=()=>r,s=()=>n.exports,c=e=>{n.exports.Hash_SetMemorySize(e);let t=n.exports.Hash_GetBuffer(),i=n.exports.memory.buffer;r=new Uint8Array(i,t,e)},l=()=>new DataView(n.exports.memory.buffer).getUint32(n.exports.STATE_SIZE,!0),u=Pt.dispatch(()=>ht(this,void 0,void 0,function*(){if(!Ft.has(e.name)){let t=jt(e.data),n=WebAssembly.compile(t);Ft.set(e.name,n)}let t=yield Ft.get(e.name);n=yield WebAssembly.instantiate(t,{})})),d=()=>ht(this,void 0,void 0,function*(){n||(yield u);let e=n.exports.Hash_GetBuffer(),t=n.exports.memory.buffer;r=new Uint8Array(t,e,Mt)}),f=(e=null)=>{i=!0,n.exports.Hash_Init(e)},p=e=>{let t=0;for(;t<e.length;){let i=e.subarray(t,t+Mt);t+=i.length,r.set(i),n.exports.Hash_Update(i.length)}},m=e=>{if(!i)throw Error(`update() called before init()`);p(Dt(e))},h=new Uint8Array(t*2),g=(e,a=null)=>{if(!i)throw Error(`digest() called before init()`);return i=!1,n.exports.Hash_Final(a),e===`binary`?r.slice(0,t):Et(h,r,t)},_=()=>{if(!i)throw Error(`save() can only be called after init() and before digest()`);let t=n.exports.Hash_GetState(),r=l(),a=n.exports.memory.buffer,o=new Uint8Array(a,t,r),s=new Uint8Array(Nt+r);return St(s,e.hash),s.set(o,Nt),s},v=t=>{if(!(t instanceof Uint8Array))throw Error(`load() expects an Uint8Array generated by save()`);let r=n.exports.Hash_GetState(),a=l(),o=Nt+a,s=n.exports.memory.buffer;if(t.length!==o)throw Error(`Bad state length (expected ${o} bytes, got ${t.length})`);if(!Ct(e.hash,t.subarray(0,Nt)))throw Error(`This state was written by an incompatible hash implementation`);let c=t.subarray(Nt);new Uint8Array(s,r,a).set(c),i=!0},y=e=>typeof e==`string`?e.length<Mt/4:e.byteLength<Mt,b=y;switch(e.name){case`argon2`:case`scrypt`:b=()=>!0;break;case`blake2b`:case`blake2s`:b=(e,t)=>t<=512&&y(e);break;case`blake3`:b=(e,t)=>t===0&&y(e);break;case`xxhash64`:case`xxhash3`:case`xxhash128`:case`crc64`:b=()=>!1;break}return yield d(),{getMemory:o,writeMemory:a,getExports:s,setMemorySize:c,init:f,update:m,digest:g,save:_,load:v,calculate:(e,i=null,a=null)=>{if(!b(e,i))return f(i),m(e),g(`hex`,a);let o=Dt(e);return r.set(o),n.exports.Hash_Calculate(o.length,i,a),Et(h,r,t)},hashLength:t}})}new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt;var Lt={name:`sha256`,data:`AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwgHAAEBAQIAAwUEAQECAgYOAn8BQfCJBQt/AEGACAsHcAgGbWVtb3J5AgAOSGFzaF9HZXRCdWZmZXIAAAlIYXNoX0luaXQAAQtIYXNoX1VwZGF0ZQACCkhhc2hfRmluYWwABA1IYXNoX0dldFN0YXRlAAUOSGFzaF9DYWxjdWxhdGUABgpTVEFURV9TSVpFAwEKnEoHBQBBgAkLnQEAQQBCADcDwIkBQQBBHEEgIABB4AFGIgAbNgLoiQFBAEKnn+anxvST/b5/Qquzj/yRo7Pw2wAgABs3A+CJAUEAQrGWgP6fooWs6ABC/6S5iMWR2oKbfyAAGzcD2IkBQQBCl7rDg5Onlod3QvLmu+Ojp/2npX8gABs3A9CJAUEAQti9loj8oLW+NkLnzKfQ1tDrs7t/IAAbNwPIiQEL7wICAX4Gf0EAQQApA8CJASIBIACtfDcDwIkBAkACQAJAIAGnQT9xIgINAEGACSEDDAELAkBBwAAgAmsiBCAAIAQgAEkbIgNFDQAgA0EDcSEFIAJBgIkBaiEGQQAhAgJAIANBBEkNACADQfwAcSEHQQAhAgNAIAYgAmoiAyACQYAJai0AADoAACADQQFqIAJBgQlqLQAAOgAAIANBAmogAkGCCWotAAA6AAAgA0EDaiACQYMJai0AADoAACAHIAJBBGoiAkcNAAsLIAVFDQADQCAGIAJqIAJBgAlqLQAAOgAAIAJBAWohAiAFQX9qIgUNAAsLIAAgBEkNAUGAiQEQAyAAIARrIQAgBEGACWohAwsCQCAAQcAASQ0AA0AgAxADIANBwABqIQMgAEFAaiIAQT9LDQALCyAARQ0AQQAhAkEAIQUDQCACQYCJAWogAyACai0AADoAACACQQFqIQIgACAFQQFqIgVB/wFxSw0ACwsLoz4BRX9BACAAKAI8IgFBGHQgAUGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyIgFBGXcgAUEOd3MgAUEDdnMgACgCOCICQRh0IAJBgP4DcUEIdHIgAkEIdkGA/gNxIAJBGHZyciICaiAAKAIgIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIgRBGXcgBEEOd3MgBEEDdnMgACgCHCIDQRh0IANBgP4DcUEIdHIgA0EIdkGA/gNxIANBGHZyciIFaiAAKAIEIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIgZBGXcgBkEOd3MgBkEDdnMgACgCACIDQRh0IANBgP4DcUEIdHIgA0EIdkGA/gNxIANBGHZyciIHaiAAKAIkIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIghqIAJBD3cgAkENd3MgAkEKdnNqIgNqIAAoAhgiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiCkEZdyAKQQ53cyAKQQN2cyAAKAIUIglBGHQgCUGA/gNxQQh0ciAJQQh2QYD+A3EgCUEYdnJyIgtqIAJqIAAoAhAiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiDEEZdyAMQQ53cyAMQQN2cyAAKAIMIglBGHQgCUGA/gNxQQh0ciAJQQh2QYD+A3EgCUEYdnJyIg1qIAAoAjAiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiDmogACgCCCIJQRh0IAlBgP4DcUEIdHIgCUEIdkGA/gNxIAlBGHZyciIPQRl3IA9BDndzIA9BA3ZzIAZqIAAoAigiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiEGogAUEPdyABQQ13cyABQQp2c2oiCUEPdyAJQQ13cyAJQQp2c2oiEUEPdyARQQ13cyARQQp2c2oiEkEPdyASQQ13cyASQQp2c2oiE2ogACgCNCIUQRh0IBRBgP4DcUEIdHIgFEEIdkGA/gNxIBRBGHZyciIVQRl3IBVBDndzIBVBA3ZzIA5qIBJqIAAoAiwiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnIiFkEZdyAWQQ53cyAWQQN2cyAQaiARaiAIQRl3IAhBDndzIAhBA3ZzIARqIAlqIAVBGXcgBUEOd3MgBUEDdnMgCmogAWogC0EZdyALQQ53cyALQQN2cyAMaiAVaiANQRl3IA1BDndzIA1BA3ZzIA9qIBZqIANBD3cgA0ENd3MgA0EKdnNqIhRBD3cgFEENd3MgFEEKdnNqIhdBD3cgF0ENd3MgF0EKdnNqIhhBD3cgGEENd3MgGEEKdnNqIhlBD3cgGUENd3MgGUEKdnNqIhpBD3cgGkENd3MgGkEKdnNqIhtBD3cgG0ENd3MgG0EKdnNqIhxBGXcgHEEOd3MgHEEDdnMgAkEZdyACQQ53cyACQQN2cyAVaiAYaiAOQRl3IA5BDndzIA5BA3ZzIBZqIBdqIBBBGXcgEEEOd3MgEEEDdnMgCGogFGogE0EPdyATQQ13cyATQQp2c2oiHUEPdyAdQQ13cyAdQQp2c2oiHkEPdyAeQQ13cyAeQQp2c2oiH2ogE0EZdyATQQ53cyATQQN2cyAYaiADQRl3IANBDndzIANBA3ZzIAFqIBlqIB9BD3cgH0ENd3MgH0EKdnNqIiBqIBJBGXcgEkEOd3MgEkEDdnMgF2ogH2ogEUEZdyARQQ53cyARQQN2cyAUaiAeaiAJQRl3IAlBDndzIAlBA3ZzIANqIB1qIBxBD3cgHEENd3MgHEEKdnNqIiFBD3cgIUENd3MgIUEKdnNqIiJBD3cgIkENd3MgIkEKdnNqIiNBD3cgI0ENd3MgI0EKdnNqIiRqIBtBGXcgG0EOd3MgG0EDdnMgHmogI2ogGkEZdyAaQQ53cyAaQQN2cyAdaiAiaiAZQRl3IBlBDndzIBlBA3ZzIBNqICFqIBhBGXcgGEEOd3MgGEEDdnMgEmogHGogF0EZdyAXQQ53cyAXQQN2cyARaiAbaiAUQRl3IBRBDndzIBRBA3ZzIAlqIBpqICBBD3cgIEENd3MgIEEKdnNqIiVBD3cgJUENd3MgJUEKdnNqIiZBD3cgJkENd3MgJkEKdnNqIidBD3cgJ0ENd3MgJ0EKdnNqIihBD3cgKEENd3MgKEEKdnNqIilBD3cgKUENd3MgKUEKdnNqIipBD3cgKkENd3MgKkEKdnNqIitBGXcgK0EOd3MgK0EDdnMgH0EZdyAfQQ53cyAfQQN2cyAbaiAnaiAeQRl3IB5BDndzIB5BA3ZzIBpqICZqIB1BGXcgHUEOd3MgHUEDdnMgGWogJWogJEEPdyAkQQ13cyAkQQp2c2oiLEEPdyAsQQ13cyAsQQp2c2oiLUEPdyAtQQ13cyAtQQp2c2oiLmogJEEZdyAkQQ53cyAkQQN2cyAnaiAgQRl3ICBBDndzICBBA3ZzIBxqIChqIC5BD3cgLkENd3MgLkEKdnNqIi9qICNBGXcgI0EOd3MgI0EDdnMgJmogLmogIkEZdyAiQQ53cyAiQQN2cyAlaiAtaiAhQRl3ICFBDndzICFBA3ZzICBqICxqICtBD3cgK0ENd3MgK0EKdnNqIjBBD3cgMEENd3MgMEEKdnNqIjFBD3cgMUENd3MgMUEKdnNqIjJBD3cgMkENd3MgMkEKdnNqIjNqICpBGXcgKkEOd3MgKkEDdnMgLWogMmogKUEZdyApQQ53cyApQQN2cyAsaiAxaiAoQRl3IChBDndzIChBA3ZzICRqIDBqICdBGXcgJ0EOd3MgJ0EDdnMgI2ogK2ogJkEZdyAmQQ53cyAmQQN2cyAiaiAqaiAlQRl3ICVBDndzICVBA3ZzICFqIClqIC9BD3cgL0ENd3MgL0EKdnNqIjRBD3cgNEENd3MgNEEKdnNqIjVBD3cgNUENd3MgNUEKdnNqIjZBD3cgNkENd3MgNkEKdnNqIjdBD3cgN0ENd3MgN0EKdnNqIjhBD3cgOEENd3MgOEEKdnNqIjlBD3cgOUENd3MgOUEKdnNqIjogOCA0IC4gLCAhIBsgGSADIA4gBEEAKALYiQEiO0EadyA7QRV3cyA7QQd3c0EAKALkiQEiPGpBACgC4IkBIj1BACgC3IkBIj5zIDtxID1zaiAHakGY36iUBGoiB0EAKALUiQEiP2oiACAMaiA7IA1qID4gD2ogPSAGaiAAID4gO3NxID5zaiAAQRp3IABBFXdzIABBB3dzakGRid2JB2oiQEEAKALQiQEiQWoiDCAAIDtzcSA7c2ogDEEadyAMQRV3cyAMQQd3c2pBz/eDrntqIkJBACgCzIkBIkNqIg0gDCAAc3EgAHNqIA1BGncgDUEVd3MgDUEHd3NqQaW3181+aiJEQQAoAsiJASIAaiIPIA0gDHNxIAxzaiAPQRp3IA9BFXdzIA9BB3dzakHbhNvKA2oiRSBBIEMgAHNxIEMgAHFzIABBHncgAEETd3MgAEEKd3NqIAdqIgZqIgdqIAUgD2ogCiANaiALIAxqIAcgDyANc3EgDXNqIAdBGncgB0EVd3MgB0EHd3NqQfGjxM8FaiIKIAYgAHMgQ3EgBiAAcXMgBkEedyAGQRN3cyAGQQp3c2ogQGoiDGoiBCAHIA9zcSAPc2ogBEEadyAEQRV3cyAEQQd3c2pBpIX+kXlqIgsgDCAGcyAAcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiBCaiINaiIPIAQgB3NxIAdzaiAPQRp3IA9BFXdzIA9BB3dzakHVvfHYemoiQCANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIERqIgZqIgcgDyAEc3EgBHNqIAdBGncgB0EVd3MgB0EHd3NqQZjVnsB9aiJCIAYgDXMgDHEgBiANcXMgBkEedyAGQRN3cyAGQQp3c2ogRWoiDGoiBWogFiAHaiAQIA9qIAggBGogBSAHIA9zcSAPc2ogBUEadyAFQRV3cyAFQQd3c2pBgbaNlAFqIgggDCAGcyANcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiAKaiINaiIPIAUgB3NxIAdzaiAPQRp3IA9BFXdzIA9BB3dzakG+i8ahAmoiDiANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIAtqIgZqIgcgDyAFc3EgBXNqIAdBGncgB0EVd3MgB0EHd3NqQcP7sagFaiIQIAYgDXMgDHEgBiANcXMgBkEedyAGQRN3cyAGQQp3c2ogQGoiDGoiBCAHIA9zcSAPc2ogBEEadyAEQRV3cyAEQQd3c2pB9Lr5lQdqIhYgDCAGcyANcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiBCaiINaiIFaiABIARqIAIgB2ogFSAPaiAFIAQgB3NxIAdzaiAFQRp3IAVBFXdzIAVBB3dzakH+4/qGeGoiByANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIAhqIgFqIgYgBSAEc3EgBHNqIAZBGncgBkEVd3MgBkEHd3NqQaeN8N55aiIEIAEgDXMgDHEgASANcXMgAUEedyABQRN3cyABQQp3c2ogDmoiAmoiDCAGIAVzcSAFc2ogDEEadyAMQRV3cyAMQQd3c2pB9OLvjHxqIgUgAiABcyANcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAQaiIDaiINIAwgBnNxIAZzaiANQRp3IA1BFXdzIA1BB3dzakHB0+2kfmoiCCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBZqIgFqIg8gF2ogESANaiAUIAxqIAkgBmogDyANIAxzcSAMc2ogD0EadyAPQRV3cyAPQQd3c2pBho/5/X5qIgYgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAHaiICaiIJIA8gDXNxIA1zaiAJQRp3IAlBFXdzIAlBB3dzakHGu4b+AGoiDCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIARqIgNqIhEgCSAPc3EgD3NqIBFBGncgEUEVd3MgEUEHd3NqQczDsqACaiINIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogBWoiAWoiFCARIAlzcSAJc2ogFEEadyAUQRV3cyAUQQd3c2pB79ik7wJqIg8gASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAIaiICaiIXaiATIBRqIBggEWogEiAJaiAXIBQgEXNxIBFzaiAXQRp3IBdBFXdzIBdBB3dzakGqidLTBGoiGCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIAZqIgNqIgkgFyAUc3EgFHNqIAlBGncgCUEVd3MgCUEHd3NqQdzTwuUFaiIUIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogDGoiAWoiESAJIBdzcSAXc2ogEUEadyARQRV3cyARQQd3c2pB2pHmtwdqIhcgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiANaiICaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakHSovnBeWoiGSACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIA9qIgNqIhNqIB4gEmogGiARaiAdIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQe2Mx8F6aiIaIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGGoiAWoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pByM+MgHtqIhggASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAUaiICaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakHH/+X6e2oiFCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBdqIgNqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQfOXgLd8aiIXIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGWoiAWoiE2ogICASaiAcIBFqIB8gCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBx6KerX1qIhkgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAaaiICaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakHRxqk2aiIaIAIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGGoiA2oiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pB59KkoQFqIhggAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAUaiIBaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakGFldy9AmoiFCABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBdqIgJqIhMgI2ogJiASaiAiIBFqICUgCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBuMLs8AJqIhcgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAZaiIDaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakH827HpBGoiGSADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBpqIgFqIhEgCSATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQZOa4JkFaiIaIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGGoiAmoiEiARIAlzcSAJc2ogEkEadyASQRV3cyASQQd3c2pB1OapqAZqIhggAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAUaiIDaiITaiAoIBJqICQgEWogJyAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakG7laizB2oiFCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBdqIgFqIgkgEyASc3EgEnNqIAlBGncgCUEVd3MgCUEHd3NqQa6Si454aiIXIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGWoiAmoiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pBhdnIk3lqIhkgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAaaiIDaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakGh0f+VemoiGiADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBhqIgFqIhNqICogEmogLSARaiApIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQcvM6cB6aiIYIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogFGoiAmoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pB8JauknxqIhQgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAXaiIDaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakGjo7G7fGoiFyADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBlqIgFqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQZnQy4x9aiIZIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGmoiAmoiE2ogMCASaiAvIBFqICsgCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBpIzktH1qIhogAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAYaiIDaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakGF67igf2oiGCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBRqIgFqIhEgCSATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQfDAqoMBaiIUIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogF2oiAmoiEiARIAlzcSAJc2ogEkEadyASQRV3cyASQQd3c2pBloKTzQFqIhcgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAZaiIDaiITIDZqIDIgEmogNSARaiAxIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQYjY3fEBaiIZIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGmoiAWoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pBzO6hugJqIhogASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAYaiICaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakG1+cKlA2oiGCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBRqIgNqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQbOZ8MgDaiIUIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogF2oiAWoiE2ogLEEZdyAsQQ53cyAsQQN2cyAoaiA0aiAzQQ93IDNBDXdzIDNBCnZzaiIXIBJqIDcgEWogMyAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakHK1OL2BGoiGyABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBlqIgJqIgkgEyASc3EgEnNqIAlBGncgCUEVd3MgCUEHd3NqQc+U89wFaiIZIAIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGmoiA2oiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pB89+5wQZqIhogAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAYaiIBaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakHuhb6kB2oiHCABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBRqIgJqIhNqIC5BGXcgLkEOd3MgLkEDdnMgKmogNmogLUEZdyAtQQ53cyAtQQN2cyApaiA1aiAXQQ93IBdBDXdzIBdBCnZzaiIUQQ93IBRBDXdzIBRBCnZzaiIYIBJqIDkgEWogFCAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakHvxpXFB2oiCSACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBtqIgNqIhEgEyASc3EgEnNqIBFBGncgEUEVd3MgEUEHd3NqQZTwoaZ4aiIbIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGWoiAWoiEiARIBNzcSATc2ogEkEadyASQRV3cyASQQd3c2pBiISc5nhqIhkgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAaaiICaiITIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakH6//uFeWoiGiACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBxqIgNqIhQgPGo2AuSJAUEAID8gAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAJaiIBIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBtqIgIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGWoiAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAaaiIJajYC1IkBQQAgPSAvQRl3IC9BDndzIC9BA3ZzICtqIDdqIBhBD3cgGEENd3MgGEEKdnNqIhggEWogFCATIBJzcSASc2ogFEEadyAUQRV3cyAUQQd3c2pB69nBonpqIhkgAWoiEWo2AuCJAUEAIEEgCSADcyACcSAJIANxcyAJQR53IAlBE3dzIAlBCndzaiAZaiIBajYC0IkBQQAgPiAwQRl3IDBBDndzIDBBA3ZzIC9qIBdqIDpBD3cgOkENd3MgOkEKdnNqIBJqIBEgFCATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQffH5vd7aiIXIAJqIhJqNgLciQFBACBDIAEgCXMgA3EgASAJcXMgAUEedyABQRN3cyABQQp3c2ogF2oiAmo2AsyJAUEAIDsgNEEZdyA0QQ53cyA0QQN2cyAwaiA4aiAYQQ93IBhBDXdzIBhBCnZzaiATaiASIBEgFHNxIBRzaiASQRp3IBJBFXdzIBJBB3dzakHy8cWzfGoiESADamo2AtiJAUEAIAAgAiABcyAJcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiARamo2AsiJAQuyBgIEfwF+QQAoAsCJASIAQQJ2QQ9xIgFBAnRBgIkBaiICIAIoAgBBfyAAQQN0IgB0QX9zcUGAASAAdHM2AgACQAJAAkAgAUEOSQ0AAkAgAUEORw0AQQBBADYCvIkBC0GAiQEQA0EAIQIMAQsgAUENRg0BIAFBAWohAgsgAiEDAkBBBiACa0EHcSIARQ0AIAIgAGohAyACQQJ0QYCJAWohAQNAIAFBADYCACABQQRqIQEgAEF/aiIADQALCyACQXlqQQdJDQAgA0ECdCEBA0AgAUGYiQFqQgA3AgAgAUGQiQFqQgA3AgAgAUGIiQFqQgA3AgAgAUGAiQFqQgA3AgAgAUEgaiIBQThHDQALC0EAIQFBAEEAKQPAiQEiBKciAEEbdCAAQQt0QYCA/AdxciAAQQV2QYD+A3EgAEEDdEEYdnJyNgK8iQFBACAEQh2IpyIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYCuIkBQYCJARADQQBBACgC5IkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLkiQFBAEEAKALgiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AuCJAUEAQQAoAtyJASIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYC3IkBQQBBACgC2IkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLYiQFBAEEAKALUiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AtSJAUEAQQAoAtCJASIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYC0IkBQQBBACgCzIkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLMiQFBAEEAKALIiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AsiJAQJAQQAoAuiJASICRQ0AQQAhAANAIAFBgAlqIAFByIkBai0AADoAACABQQFqIQEgAiAAQQFqIgBB/wFxSw0ACwsLBgBBgIkBC6MBAEEAQgA3A8CJAUEAQRxBICABQeABRiIBGzYC6IkBQQBCp5/mp8b0k/2+f0Krs4/8kaOz8NsAIAEbNwPgiQFBAEKxloD+n6KFrOgAQv+kuYjFkdqCm38gARs3A9iJAUEAQpe6w4OTp5aHd0Ly5rvjo6f9p6V/IAEbNwPQiQFBAELYvZaI/KC1vjZC58yn0NbQ67O7fyABGzcDyIkBIAAQAhAECwsLAQBBgAgLBHAAAAA=`,hash:`8c18dd94`};new gt,new gt;function Rt(){return It(Lt,32).then(e=>{e.init(256);let t={init:()=>(e.init(256),t),update:n=>(e.update(n),t),digest:t=>e.digest(t),save:()=>e.save(),load:n=>(e.load(n),t),blockSize:64,digestSize:32};return t})}new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt;var zt=`pi-forge/auth-token`,Bt=`pi-forge/auth-expires-at`,Vt=`pi-forge/auth-must-change-password`;function Ht(){let e=localStorage.getItem(zt),t=localStorage.getItem(Bt);if(!(!e||!t)){if(new Date(t).getTime()<=Date.now()){Wt();return}return{token:e,expiresAt:t,mustChangePassword:localStorage.getItem(Vt)===`true`}}}function Ut(e){localStorage.setItem(zt,e.token),localStorage.setItem(Bt,e.expiresAt),localStorage.setItem(Vt,e.mustChangePassword?`true`:`false`)}function Wt(){localStorage.removeItem(zt),localStorage.removeItem(Bt),localStorage.removeItem(Vt)}var Gt=`pi-forge:unauthorized`,N=class extends Error{status;code;constructor(e,t,n){super(n??`${e} ${t}`),this.status=e,this.code=t}},Kt=[`appBackground`,`panelBackground`,`userBubbleBackground`,`assistantBubbleBackground`,`primaryText`,`secondaryText`,`mutedText`,`highlightBackground`,`highlightText`,`selectionBackground`];function qt(e){let t=()=>e();return window.addEventListener(Gt,t),()=>window.removeEventListener(Gt,t)}function P(e,t){throw new N(e,`invalid_response_body`,t)}function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Jt=(e,t)=>{e!=null&&P(t,`expected empty body`)};function Yt(e,t){return(!F(e)||typeof e.authEnabled!=`boolean`)&&P(t,`expected { authEnabled: boolean }`),{authEnabled:e.authEnabled,ldapEnabled:typeof e.ldapEnabled==`boolean`?e.ldapEnabled:!1}}function Xt(e,t){return(!F(e)||typeof e.token!=`string`||typeof e.expiresAt!=`string`||typeof e.mustChangePassword!=`boolean`)&&P(t,`expected { token, expiresAt, mustChangePassword }`),{token:e.token,expiresAt:e.expiresAt,mustChangePassword:e.mustChangePassword}}function Zt(e,t){return Xt(e,t)}var Qt=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function $t(e,t){if(e===void 0)return;F(e)||P(t,`authColorScheme: expected object`);let n=[`pageBackground`,`cardBackground`,`border`,`text`,`mutedText`,`buttonBackground`,`buttonText`,`buttonHoverBackground`],r={};for(let i of n){let n=e[i];typeof n!=`string`&&P(t,`authColorScheme.${i}: expected string`),Qt.test(n)||P(t,`authColorScheme.${i}: expected hex color`),r[i]=n}return r}function en(e){return typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e)}function tn(e,t,n){F(e)||P(t,`${n}: expected object`);let r={};for(let i of Kt){let a=e[i];en(a)||P(t,`${n}.${i}: expected #rrggbb`),r[i]=a}return r}function nn(e,t){return(!F(e)||typeof e.enabled!=`boolean`)&&P(t,`expected server theme config`),{enabled:e.enabled,colors:tn(e.colors,t,`colors`),defaults:tn(e.defaults,t,`defaults`)}}function rn(e,t){(!F(e)||typeof e.minimal!=`boolean`||typeof e.workspaceRoot!=`string`)&&P(t,`expected { minimal: boolean, workspaceRoot: string }`);let n=typeof e.version==`string`?e.version:`unknown`,r=typeof e.passwordAuthEnabled==`boolean`?e.passwordAuthEnabled:!0,i=typeof e.orchestrationEnabled==`boolean`?e.orchestrationEnabled:!1,a=typeof e.authBannerText==`string`?e.authBannerText:void 0,o=typeof e.authBannerHtml==`boolean`?e.authBannerHtml:!1,s=typeof e.authLogoUrl==`string`?e.authLogoUrl:void 0,c=$t(e.authColorScheme,t);return{minimal:e.minimal,workspaceRoot:e.workspaceRoot,version:n,passwordAuthEnabled:r,orchestrationEnabled:i,serverTheme:e.serverTheme===void 0?void 0:nn(e.serverTheme,t),authBannerText:a,authBannerHtml:o,authColorScheme:c,authLogoUrl:s}}function an(e,t){(!F(e)||typeof e.enabled!=`boolean`||!F(e.toolEnv))&&P(t,`expected SandboxSettingsResponse`);let n={};for(let[r,i]of Object.entries(e.toolEnv))typeof i!=`string`&&P(t,`toolEnv values must be strings`),n[r]=i;let r={enabled:e.enabled,toolEnv:n};return typeof e.uid==`number`&&(r.uid=e.uid),typeof e.gid==`number`&&(r.gid=e.gid),typeof e.home==`string`&&(r.home=e.home),r}function on(e,t){return(!F(e)||e.status!==`ok`||typeof e.activeSessions!=`number`||typeof e.activePtys!=`number`)&&P(t,`expected { status: 'ok', activeSessions, activePtys }`),{status:`ok`,activeSessions:e.activeSessions,activePtys:e.activePtys}}function sn(e,t){return(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.path!=`string`||typeof e.createdAt!=`string`)&&P(t,`expected Project`),{id:e.id,name:e.name,path:e.path,createdAt:e.createdAt}}function cn(e,t){return(!F(e)||!Array.isArray(e.projects))&&P(t,`expected { projects: Project[] }`),{projects:e.projects.map(e=>sn(e,t))}}function ln(e,t){return(!F(e)||typeof e.name!=`string`||typeof e.path!=`string`||typeof e.isGitRepo!=`boolean`)&&P(t,`expected BrowseEntry`),{name:e.name,path:e.path,isGitRepo:e.isGitRepo}}function un(e,t){return(!F(e)||typeof e.path!=`string`||!(e.parentPath===null||e.parentPath===void 0||typeof e.parentPath==`string`)||!Array.isArray(e.entries))&&P(t,`expected BrowseResponse`),{path:e.path,parentPath:typeof e.parentPath==`string`?e.parentPath:null,entries:e.entries.map(e=>ln(e,t))}}function dn(e,t){return(!F(e)||typeof e.path!=`string`)&&P(t,`expected { path }`),{path:e.path}}function fn(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.isLive!=`boolean`||typeof e.workspacePath!=`string`||typeof e.lastActivityAt!=`string`||typeof e.createdAt!=`string`||typeof e.messageCount!=`number`||typeof e.firstMessage!=`string`)&&P(t,`expected UnifiedSession`);let n={sessionId:e.sessionId,projectId:e.projectId,isLive:e.isLive,workspacePath:e.workspacePath,lastActivityAt:e.lastActivityAt,createdAt:e.createdAt,messageCount:e.messageCount,firstMessage:e.firstMessage};return typeof e.name==`string`&&(n.name=e.name),typeof e.parentSessionId==`string`&&(n.parentSessionId=e.parentSessionId),typeof e.runId==`string`&&(n.runId=e.runId),typeof e.isExternalLive==`boolean`&&(n.isExternalLive=e.isExternalLive),(e.externalState===`queued`||e.externalState===`running`||e.externalState===`complete`||e.externalState===`failed`||e.externalState===`paused`)&&(n.externalState=e.externalState),typeof e.path==`string`&&(n.path=e.path),n}function pn(e,t){return(!F(e)||!Array.isArray(e.sessions))&&P(t,`expected { sessions: UnifiedSession[] }`),{sessions:e.sessions.map(e=>fn(e,t))}}function mn(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.workspacePath!=`string`||typeof e.createdAt!=`string`||typeof e.lastActivityAt!=`string`||typeof e.isLive!=`boolean`||typeof e.messageCount!=`number`||typeof e.isStreaming!=`boolean`)&&P(t,`expected SessionSummary`);let n={sessionId:e.sessionId,projectId:e.projectId,workspacePath:e.workspacePath,createdAt:e.createdAt,lastActivityAt:e.lastActivityAt,isLive:e.isLive,messageCount:e.messageCount,isStreaming:e.isStreaming};return typeof e.name==`string`&&(n.name=e.name),typeof e.thinkingLevel==`string`&&(n.thinkingLevel=e.thinkingLevel),typeof e.modelProvider==`string`&&(n.modelProvider=e.modelProvider),typeof e.modelId==`string`&&(n.modelId=e.modelId),n}function hn(e,t){(!F(e)||e.accepted!==!0)&&P(t,`expected { accepted: true }`);let n={accepted:!0};return typeof e.sessionName==`string`&&(n.sessionName=e.sessionName),n}function gn(e,t){(!F(e)||typeof e.name!=`string`||typeof e.description!=`string`||e.source!==`global`&&e.source!==`project`&&e.source!==`extension`||typeof e.filePath!=`string`||typeof e.enabled!=`boolean`||typeof e.effective!=`boolean`||typeof e.disableModelInvocation!=`boolean`)&&P(t,`expected SkillSummary`);let n={name:e.name,description:e.description,source:e.source,filePath:e.filePath,enabled:e.enabled,effective:e.effective,disableModelInvocation:e.disableModelInvocation};return typeof e.extensionPath==`string`&&(n.extensionPath=e.extensionPath),(e.projectOverride===`enabled`||e.projectOverride===`disabled`)&&(n.projectOverride=e.projectOverride),n}function _n(e,t){return(!F(e)||!Array.isArray(e.skills))&&P(t,`expected { skills: SkillSummary[] }`),{skills:e.skills.map(e=>gn(e,t))}}function vn(e,t){(!F(e)||!Array.isArray(e.skills)||!Array.isArray(e.diagnostics))&&P(t,`expected { skills: SkillSummary[], diagnostics: SkillDiagnostic[] }`);let n=[];for(let t of e.diagnostics){if(!F(t)||t.type!==`warning`&&t.type!==`error`&&t.type!==`collision`||typeof t.message!=`string`)continue;let e={type:t.type,message:t.message};typeof t.path==`string`&&(e.path=t.path),F(t.collision)&&typeof t.collision.resourceType==`string`&&typeof t.collision.name==`string`&&typeof t.collision.winnerPath==`string`&&typeof t.collision.loserPath==`string`&&(e.collision={resourceType:t.collision.resourceType,name:t.collision.name,winnerPath:t.collision.winnerPath,loserPath:t.collision.loserPath}),n.push(e)}return{skills:e.skills.map(e=>gn(e,t)),diagnostics:n}}function yn(e,t){(!F(e)||!F(e.projects))&&P(t,`expected { projects: { ... } }`);let n={};for(let[t,r]of Object.entries(e.projects))F(r)&&(n[t]={enable:Array.isArray(r.enable)?r.enable.filter(e=>typeof e==`string`):[],disable:Array.isArray(r.disable)?r.disable.filter(e=>typeof e==`string`):[]});return{projects:n}}function bn(e,t){(!F(e)||typeof e.name!=`string`||typeof e.description!=`string`||e.source!==`global`&&e.source!==`project`||typeof e.filePath!=`string`||typeof e.enabled!=`boolean`||typeof e.effective!=`boolean`)&&P(t,`expected PromptSummary`);let n={name:e.name,description:e.description,source:e.source,filePath:e.filePath,enabled:e.enabled,effective:e.effective};return typeof e.argumentHint==`string`&&(n.argumentHint=e.argumentHint),(e.projectOverride===`enabled`||e.projectOverride===`disabled`)&&(n.projectOverride=e.projectOverride),n}function xn(e,t){return(!F(e)||!Array.isArray(e.prompts))&&P(t,`expected { prompts: PromptSummary[] }`),{prompts:e.prompts.map(e=>bn(e,t))}}function Sn(e,t){(!F(e)||!Array.isArray(e.prompts)||!Array.isArray(e.diagnostics))&&P(t,`expected { prompts: PromptSummary[], diagnostics: SkillDiagnostic[] }`);let n=[];for(let t of e.diagnostics){if(!F(t)||t.type!==`warning`&&t.type!==`error`&&t.type!==`collision`||typeof t.message!=`string`)continue;let e={type:t.type,message:t.message};typeof t.path==`string`&&(e.path=t.path),F(t.collision)&&typeof t.collision.resourceType==`string`&&typeof t.collision.name==`string`&&typeof t.collision.winnerPath==`string`&&typeof t.collision.loserPath==`string`&&(e.collision={resourceType:t.collision.resourceType,name:t.collision.name,winnerPath:t.collision.winnerPath,loserPath:t.collision.loserPath}),n.push(e)}return{prompts:e.prompts.map(e=>bn(e,t)),diagnostics:n}}var Cn=yn;function wn(e,t){return(!F(e)||!Array.isArray(e.providers))&&P(t,`expected { providers: [...] }`),{providers:e.providers}}function Tn(e,t){return(!F(e)||!F(e.servers)||!Array.isArray(e.status))&&P(t,`expected { servers, status[] }`),e}function En(e,t){return(!F(e)||typeof e.enabled!=`boolean`||typeof e.connected!=`number`||typeof e.total!=`number`)&&P(t,`expected { enabled, connected, total }`),{enabled:e.enabled,connected:e.connected,total:e.total}}function Dn(e,t){return(!F(e)||!F(e.status))&&P(t,`expected { status: {...} }`),{status:e.status}}function On(e,t){return(!F(e)||!Array.isArray(e.tools))&&P(t,`expected { tools: [...] }`),{tools:e.tools}}function kn(e,t){return(!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}}function An(e,t){return(!F(e)||typeof e.removed!=`boolean`)&&P(t,`expected { removed: boolean }`),{removed:e.removed}}function jn(e,t){return(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`)&&P(t,`expected QuickAction shape`),e}function Mn(e,t){return(!F(e)||!Array.isArray(e.actions))&&P(t,`expected { actions: [...] }`),{actions:e.actions}}function Nn(e,t){(!F(e)||typeof e.success!=`boolean`||typeof e.stdout!=`string`||typeof e.stderr!=`string`||typeof e.durationMs!=`number`||typeof e.timedOut!=`boolean`||typeof e.truncated!=`boolean`)&&P(t,`expected QuickActionRunResult shape`);let n=e.exitCode;return{success:e.success,exitCode:typeof n==`number`?n:null,stdout:e.stdout,stderr:e.stderr,durationMs:e.durationMs,timedOut:e.timedOut,truncated:e.truncated}}function Pn(e,t){return(!F(e)||!Array.isArray(e.processes))&&P(t,`expected { processes: [...] }`),{processes:e.processes}}function Fn(e,t){return(!F(e)||!Array.isArray(e.stdout)||!Array.isArray(e.stderr)||typeof e.status!=`string`)&&P(t,`expected { stdout, stderr, status }`),{stdout:e.stdout,stderr:e.stderr,status:e.status}}function In(e,t){(!F(e)||typeof e.ok!=`boolean`)&&P(t,`expected { ok: boolean }`);let n={ok:e.ok};return typeof e.reason==`string`&&(n.reason=e.reason),n}var Ln=[`agent_end`,`ask_user_question`,`process_alert`,`auto_retry_end`,`compaction_end`,`session_created`,`session_deleted`];function Rn(e,t){(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.url!=`string`||!Array.isArray(e.events)||!F(e.scope)||typeof e.enabled!=`boolean`||typeof e.hasSecret!=`boolean`||typeof e.createdAt!=`string`)&&P(t,`expected webhook config`);let n=e.scope,r;n.kind===`global`?r={kind:`global`}:n.kind===`project`&&typeof n.projectId==`string`?r={kind:`project`,projectId:n.projectId}:P(t,`bad scope`);let i={id:e.id,name:e.name,url:e.url,events:e.events.filter(e=>typeof e==`string`&&Ln.includes(e)),scope:r,enabled:e.enabled,hasSecret:e.hasSecret,createdAt:e.createdAt};return F(e.headers)&&(i.headers=Object.fromEntries(Object.entries(e.headers).filter(([,e])=>typeof e==`string`))),e.insecureTls===!0&&(i.insecureTls=!0),i}function zn(e,t){return(!F(e)||!Array.isArray(e.webhooks))&&P(t,`expected { webhooks: [...] }`),{webhooks:e.webhooks.map(e=>Rn(e,t))}}function Bn(e,t){return(!F(e)||!Array.isArray(e.deliveries))&&P(t,`expected { deliveries: [...] }`),{deliveries:e.deliveries}}function Vn(e,t){return(!F(e)||!Array.isArray(e.tasks)||typeof e.nextId!=`number`)&&P(t,`expected { tasks: [...], nextId: number }`),{tasks:e.tasks,nextId:e.nextId}}function Hn(e,t){return(!F(e)||typeof e.enabled!=`boolean`||typeof e.maxWorkersPerSupervisor!=`number`||typeof e.maxDepth!=`number`||typeof e.disabledReason!=`string`)&&P(t,`expected orchestration config`),{enabled:e.enabled,maxWorkersPerSupervisor:e.maxWorkersPerSupervisor,maxDepth:e.maxDepth,disabledReason:e.disabledReason}}function Un(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.role!=`string`)&&P(t,`expected session link`);let n=e.role;n!==`supervisor`&&n!==`worker`&&n!==`standalone`&&P(t,`bad session role`);let r={sessionId:e.sessionId,role:n};if(typeof e.supervisorId==`string`&&(r.supervisorId=e.supervisorId),Array.isArray(e.workerIds)&&(r.workerIds=e.workerIds.filter(e=>typeof e==`string`)),typeof e.pendingInbox==`number`&&(r.pendingInbox=e.pendingInbox),typeof e.enabledAt==`string`&&(r.enabledAt=e.enabledAt),typeof e.spawnedAt==`string`&&(r.spawnedAt=e.spawnedAt),F(e.spawnedFrom)&&typeof e.spawnedFrom.sessionId==`string`){let t=e.spawnedFrom.mode;(t===`fresh`||t===`summary`)&&(r.spawnedFrom={sessionId:e.spawnedFrom.sessionId,mode:t})}return r}function Wn(e,t){(!F(e)||!Array.isArray(e.workers))&&P(t,`expected { workers: [...] }`);let n=[];for(let t of e.workers){if(!F(t)||typeof t.workerId!=`string`||typeof t.isLive!=`boolean`)continue;let e={workerId:t.workerId,isLive:t.isLive};typeof t.isStreaming==`boolean`&&(e.isStreaming=t.isStreaming),(t.state===`streaming`||t.state===`idle`||t.state===`cold`)&&(e.state=t.state),typeof t.name==`string`&&(e.name=t.name),typeof t.lastActivityAt==`string`&&(e.lastActivityAt=t.lastActivityAt),typeof t.messageCount==`number`&&(e.messageCount=t.messageCount),typeof t.projectId==`string`&&(e.projectId=t.projectId),typeof t.spawnedAt==`string`&&(e.spawnedAt=t.spawnedAt),F(t.spawnedFrom)&&typeof t.spawnedFrom.sessionId==`string`&&typeof t.spawnedFrom.mode==`string`&&(e.spawnedFrom={sessionId:t.spawnedFrom.sessionId,mode:t.spawnedFrom.mode}),n.push(e)}return{workers:n}}function Gn(e,t){(!F(e)||!Array.isArray(e.items))&&P(t,`expected { items: [...] }`);let n=[];for(let t of e.items)!F(t)||typeof t.id!=`string`||typeof t.type!=`string`||typeof t.workerId!=`string`||typeof t.occurredAt!=`string`||!F(t.data)||typeof t.delivered!=`boolean`||n.push({id:t.id,type:t.type,workerId:t.workerId,occurredAt:t.occurredAt,data:t.data,delivered:t.delivered});return{items:n}}function Kn(e,t){return(!F(e)||!F(e.providers))&&P(t,`expected { providers: { ... } }`),e}function qn(e,t){return F(e)||P(t,`expected settings object`),e}function Jn(e,t){return(!F(e)||!F(e.providers))&&P(t,`expected { providers: {...} }`),e}function Yn(e,t){F(e)||P(t,`expected FileTreeNode`);let n=e.type;(typeof e.name!=`string`||typeof e.path!=`string`||n!==`file`&&n!==`directory`)&&P(t,`expected FileTreeNode`);let r={name:e.name,path:e.path,type:n};return Array.isArray(e.children)&&(r.children=e.children.map(e=>Yn(e,t))),typeof e.truncated==`boolean`&&(r.truncated=e.truncated),r}function Xn(e,t){return(!F(e)||typeof e.path!=`string`||typeof e.content!=`string`||typeof e.size!=`number`||typeof e.language!=`string`||typeof e.binary!=`boolean`)&&P(t,`expected FileReadResponse`),{path:e.path,content:e.content,size:e.size,language:e.language,binary:e.binary}}function Zn(e,t){return(!F(e)||!Array.isArray(e.entries))&&P(t,`expected { entries: TurnDiffEntry[] }`),{entries:e.entries.map(e=>((!F(e)||typeof e.file!=`string`||e.tool!==`write`&&e.tool!==`edit`||typeof e.diff!=`string`||typeof e.additions!=`number`||typeof e.deletions!=`number`||typeof e.isPureAddition!=`boolean`)&&P(t,`expected TurnDiffEntry`),{file:e.file,tool:e.tool,diff:e.diff,additions:e.additions,deletions:e.deletions,isPureAddition:e.isPureAddition}))}}function Qn(e,t){(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.files))&&P(t,`expected GitStatus`);let n={isGitRepo:e.isGitRepo,files:e.files.map(e=>{(!F(e)||typeof e.path!=`string`||typeof e.staged!=`boolean`||typeof e.unstaged!=`boolean`||typeof e.kind!=`string`||typeof e.code!=`string`)&&P(t,`expected GitFileStatus`);let n={path:e.path,staged:e.staged,unstaged:e.unstaged,kind:e.kind,code:e.code};return typeof e.originalPath==`string`&&(n.originalPath=e.originalPath),n})};return typeof e.branch==`string`&&(n.branch=e.branch),n}function $n(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||typeof e.diff!=`string`)&&P(t,`expected GitDiffResponse`),{isGitRepo:e.isGitRepo,diff:e.diff}}function er(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.commits))&&P(t,`expected GitLogResponse`),{isGitRepo:e.isGitRepo,commits:e.commits.map(e=>((!F(e)||typeof e.hash!=`string`||typeof e.message!=`string`||typeof e.author!=`string`||typeof e.date!=`string`||!Array.isArray(e.parents)||!Array.isArray(e.refs))&&P(t,`expected GitLogEntry`),{hash:e.hash,message:e.message,author:e.author,date:e.date,parents:e.parents.filter(e=>typeof e==`string`),refs:e.refs.filter(e=>typeof e==`string`)}))}}function tr(e,t){(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.branches))&&P(t,`expected GitBranchesResponse`);let n={isGitRepo:e.isGitRepo,branches:e.branches.map(e=>((!F(e)||typeof e.name!=`string`||typeof e.current!=`boolean`||typeof e.remote!=`boolean`)&&P(t,`expected GitBranch`),{name:e.name,current:e.current,remote:e.remote}))};return typeof e.current==`string`&&(n.current=e.current),n}function nr(e,t){(!F(e)||!Array.isArray(e.messages)||typeof e.totalInputTokens!=`number`||typeof e.totalOutputTokens!=`number`||typeof e.totalCacheReadTokens!=`number`||typeof e.totalCacheWriteTokens!=`number`||typeof e.totalTokens!=`number`||typeof e.totalCost!=`number`||!Array.isArray(e.turns)||!F(e.contextUsage))&&P(t,`expected SessionContextResponse`);let n=e.turns.map(e=>{(!F(e)||typeof e.index!=`number`||typeof e.inputTokens!=`number`||typeof e.outputTokens!=`number`||typeof e.cacheReadTokens!=`number`||typeof e.cacheWriteTokens!=`number`||typeof e.totalTokens!=`number`||typeof e.cost!=`number`||typeof e.model!=`string`||typeof e.provider!=`string`||typeof e.timestamp!=`number`)&&P(t,`expected ContextTurn`);let n={index:e.index,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheReadTokens:e.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens,totalTokens:e.totalTokens,cost:e.cost,model:e.model,provider:e.provider,timestamp:e.timestamp};return typeof e.stopReason==`string`&&(n.stopReason=e.stopReason),n}),r=e.contextUsage,i={contextWindow:typeof r.contextWindow==`number`?r.contextWindow:0};return typeof r.tokens==`number`&&(i.tokens=r.tokens),typeof r.percent==`number`&&(i.percent=r.percent),{messages:e.messages.filter(e=>F(e)),totalInputTokens:e.totalInputTokens,totalOutputTokens:e.totalOutputTokens,totalCacheReadTokens:e.totalCacheReadTokens,totalCacheWriteTokens:e.totalCacheWriteTokens,totalTokens:e.totalTokens,totalCost:e.totalCost,turns:n,contextUsage:i}}function rr(e,t){(!F(e)||!(e.leafId===null||typeof e.leafId==`string`)||!Array.isArray(e.branchIds)||!Array.isArray(e.entries))&&P(t,`expected SessionTreeResponse`);let n=e.branchIds.filter(e=>typeof e==`string`),r=e.entries.map(e=>{(!F(e)||typeof e.id!=`string`||!(e.parentId===null||typeof e.parentId==`string`)||typeof e.type!=`string`||typeof e.timestamp!=`string`)&&P(t,`expected SessionTreeEntry`);let n={id:e.id,parentId:e.parentId,type:e.type,timestamp:e.timestamp};return typeof e.role==`string`&&(n.role=e.role),typeof e.preview==`string`&&(n.preview=e.preview),typeof e.label==`string`&&(n.label=e.label),n});return{leafId:e.leafId,branchIds:n,entries:r}}function ir(e,t){return(!F(e)||!Array.isArray(e.files))&&P(t,`expected { files: UploadedFile[] }`),{files:e.files.map(e=>((!F(e)||typeof e.path!=`string`||typeof e.size!=`number`||typeof e.sha256!=`string`)&&P(t,`expected UploadedFile`),{path:e.path,size:e.size,sha256:e.sha256}))}}function ar(e,t){return(!F(e)||e.engine!==`ripgrep`&&e.engine!==`node`||typeof e.truncated!=`boolean`||!Array.isArray(e.matches))&&P(t,`expected SearchResponse`),{engine:e.engine,truncated:e.truncated,matches:e.matches.map(e=>((!F(e)||typeof e.path!=`string`||typeof e.line!=`number`||typeof e.column!=`number`||typeof e.length!=`number`||typeof e.lineSnippet!=`string`)&&P(t,`expected SearchMatch`),{path:e.path,line:e.line,column:e.column,length:e.length,lineSnippet:e.lineSnippet}))}}function or(e,t){return(!F(e)||e.engine!==`ripgrep`&&e.engine!==`node`||typeof e.truncated!=`boolean`||!Array.isArray(e.results))&&P(t,`expected SessionSearchResponse`),{engine:e.engine,truncated:e.truncated,results:e.results.map(e=>{(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.projectName!=`string`||typeof e.modifiedAt!=`string`||!Array.isArray(e.matches))&&P(t,`expected SessionSearchGroup`);let n={sessionId:e.sessionId,projectId:e.projectId,projectName:e.projectName,modifiedAt:e.modifiedAt,matches:e.matches.map(e=>{(!F(e)||typeof e.messageIndex!=`number`||e.kind!==`user`&&e.kind!==`assistant`&&e.kind!==`tool_call`||typeof e.snippet!=`string`||typeof e.matchOffset!=`number`||typeof e.matchLength!=`number`)&&P(t,`expected SessionSearchMatch`);let n={messageIndex:e.messageIndex,kind:e.kind,snippet:e.snippet,matchOffset:e.matchOffset,matchLength:e.matchLength};return typeof e.messageEnvelopeId==`string`&&(n.messageEnvelopeId=e.messageEnvelopeId),n})};return typeof e.sessionName==`string`&&(n.sessionName=e.sessionName),n})}}function sr(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.remotes))&&P(t,`expected GitRemotesResponse`),{isGitRepo:e.isGitRepo,remotes:e.remotes.map(e=>((!F(e)||typeof e.name!=`string`||typeof e.fetchUrl!=`string`||typeof e.pushUrl!=`string`||typeof e.insecureTls!=`boolean`)&&P(t,`expected GitRemote`),{name:e.name,fetchUrl:e.fetchUrl,pushUrl:e.pushUrl,insecureTls:e.insecureTls}))}}function cr(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.worktrees))&&P(t,`expected GitWorktreesResponse`),{isGitRepo:e.isGitRepo,worktrees:e.worktrees.map(e=>{(!F(e)||typeof e.path!=`string`||typeof e.bare!=`boolean`||typeof e.detached!=`boolean`||typeof e.current!=`boolean`)&&P(t,`expected GitWorktree`);let n={path:e.path,bare:e.bare,detached:e.detached,current:e.current};return typeof e.head==`string`&&(n.head=e.head),typeof e.branch==`string`&&(n.branch=e.branch),n})}}function lr(e,t){return(!F(e)||typeof e.path!=`string`)&&P(t,`expected { path: string }`),{path:e.path}}async function ur(e,t){let n=await Rt();n.init();let r=e.stream().getReader(),i=!1;try{for(;;){let{value:e,done:i}=await r.read();if(i)break;n.update(e),t?.(e.byteLength)}}catch(e){throw i=!0,await r.cancel().catch(()=>void 0),e}finally{i||r.releaseLock()}return n.digest(`hex`)}function dr(e){let t=e,n=t.uploadRelativePath??t.webkitRelativePath;return n!==void 0&&n.length>0?n:e.name}function fr(e){let t=/filename\*=UTF-8''([^;\r\n]+)/i.exec(e);if(t!==null)try{return decodeURIComponent(t[1])}catch{}let n=/filename="([^"]+)"/i.exec(e)??/filename=([^;\r\n]+)/i.exec(e);if(n!==null)return n[1]}function pr(e){if(e===``)return{ok:!0,value:void 0};try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}async function I(e,t,n={}){let r={Accept:`application/json`};if(!n.skipAuth){let e=Ht();e&&(r.Authorization=`Bearer ${e.token}`)}let i=n.body instanceof FormData;n.body!==void 0&&!i&&(r[`Content-Type`]=`application/json`);let a={method:n.method??`GET`,headers:r};n.body!==void 0&&(a.body=i?n.body:JSON.stringify(n.body)),n.signal!==void 0&&(a.signal=n.signal);let o;try{o=await fetch(e,a)}catch(e){throw e instanceof Error&&e.name===`AbortError`?e:new N(0,`network_error`,e.message)}o.status===401&&!n.skipAuth&&(Wt(),window.dispatchEvent(new Event(Gt)));let s=await o.text(),c=pr(s);if(!o.ok){let e;throw e=c.ok&&F(c.value)&&`error`in c.value?String(c.value.error):c.ok?`request_failed`:`invalid_error_body`,new N(o.status,e,c.ok?void 0:`non-JSON ${o.status} body`)}if(!c.ok){if(s.length===0)return t(void 0,o.status);throw new N(o.status,`invalid_response_body`,`server returned non-JSON 2xx body`)}return t(c.value,o.status)}function mr(e,t,n){let r=new URLSearchParams({projectId:e});if(t!==void 0&&r.set(`worktreePath`,t),n!==void 0)for(let[e,t]of Object.entries(n))r.set(e,t);return r.toString()}var L={authStatus:()=>I(`/api/v1/auth/status`,Yt,{skipAuth:!0}),login:(e,t)=>I(`/api/v1/auth/login`,Xt,{method:`POST`,body:t===void 0?{password:e}:{username:t,password:e},skipAuth:!0}),changePassword:(e,t)=>I(`/api/v1/auth/change-password`,Zt,{method:`POST`,body:{currentPassword:e,newPassword:t}}),health:()=>I(`/api/v1/health`,on,{skipAuth:!0}),uiConfig:()=>I(`/api/v1/ui-config`,rn,{skipAuth:!0}),listProjects:()=>I(`/api/v1/projects`,cn),createProject:(e,t)=>I(`/api/v1/projects`,sn,{method:`POST`,body:{name:e,path:t}}),renameProject:(e,t)=>I(`/api/v1/projects/${encodeURIComponent(e)}`,sn,{method:`PATCH`,body:{name:t}}),reorderProjects:e=>I(`/api/v1/projects/order`,cn,{method:`PUT`,body:{ids:e}}),deleteProject:e=>I(`/api/v1/projects/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.cascaded!=`boolean`)&&P(t,`expected { cascaded }`),{cascaded:e.cascaded}),{method:`DELETE`}),browse:e=>I(`/api/v1/projects/browse${e===void 0?``:`?path=${encodeURIComponent(e)}`}`,un),getProjectSystemPrompt:e=>I(`/api/v1/projects/${encodeURIComponent(e)}/system-prompt`,(e,t)=>((!F(e)||typeof e.addendum!=`string`||typeof e.maxBytes!=`number`)&&P(t,`expected { addendum: string, maxBytes: number }`),{addendum:e.addendum,maxBytes:e.maxBytes})),setProjectSystemPrompt:(e,t)=>I(`/api/v1/projects/${encodeURIComponent(e)}/system-prompt`,(e,t)=>((!F(e)||typeof e.addendum!=`string`||typeof e.maxBytes!=`number`)&&P(t,`expected { addendum: string, maxBytes: number }`),{addendum:e.addendum,maxBytes:e.maxBytes}),{method:`PUT`,body:{addendum:t}}),mkdir:(e,t)=>I(`/api/v1/projects/browse/mkdir`,dn,{method:`POST`,body:{parentPath:e,name:t}}),cloneProject:async(e,t)=>{let n={"Content-Type":`application/json`,Accept:`text/event-stream`},r=Ht();r&&(n.Authorization=`Bearer ${r.token}`);let i={method:`POST`,headers:n,body:JSON.stringify(e)};t!==void 0&&(i.signal=t);let a=await fetch(`/api/v1/projects/clone`,i);if(a.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`invalid_token`);if(!a.ok){let e;try{e=await a.json()}catch{}let t=typeof e?.error==`string`?e.error:`clone_failed`,n=typeof e?.message==`string`?e.message:void 0;throw new N(a.status,t,n)}return a},listSessions:e=>I(`/api/v1/sessions${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,pn),createSession:e=>I(`/api/v1/sessions`,mn,{method:`POST`,body:{projectId:e}}),getSession:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}`,mn),getMessages:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/messages`,(e,t)=>((!F(e)||!Array.isArray(e.messages))&&P(t,`expected { messages: [...] }`),{messages:e.messages})),getCompactions:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/compactions`,(e,t)=>((!F(e)||!Array.isArray(e.compactions))&&P(t,`expected { compactions: [...] }`),{compactions:e.compactions})),disposeSession:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),renameSession:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/name`,mn,{method:`POST`,body:{name:t}}),getSessionContext:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/context`,nr,t===void 0?{}:{signal:t}),getSessionTree:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/tree`,rr),navigateSession:(e,t,n)=>{let r={entryId:t};return n?.summarize!==void 0&&(r.summarize=n.summarize),n?.customInstructions!==void 0&&(r.customInstructions=n.customInstructions),n?.label!==void 0&&(r.label=n.label),I(`/api/v1/sessions/${encodeURIComponent(e)}/navigate`,(e,t)=>(F(e)||P(t,`expected navigate result`),e),{method:`POST`,body:r})},forkSession:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/fork`,mn,{method:`POST`,body:{entryId:t}}),getTurnDiff:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/turn-diff`,Zn),prompt:(e,t,n)=>{let r=`/api/v1/sessions/${encodeURIComponent(e)}/prompt`;if(n?.attachments!==void 0&&n.attachments.length>0){let e=new FormData;e.append(`text`,t),n.streamingBehavior!==void 0&&e.append(`streamingBehavior`,n.streamingBehavior);for(let t of n.attachments)e.append(`attachments`,t,t.name);return I(r,hn,{method:`POST`,body:e})}let i={text:t};return n?.streamingBehavior!==void 0&&(i.streamingBehavior=n.streamingBehavior),I(r,hn,{method:`POST`,body:i})},steer:(e,t,n)=>{let r={text:t};return n!==void 0&&(r.mode=n),I(`/api/v1/sessions/${encodeURIComponent(e)}/steer`,hn,{method:`POST`,body:r})},abort:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/abort`,Jt,{method:`POST`}),compact:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/compact`,(e,t)=>(F(e)||P(t,`expected compact result object`),{summary:typeof e.summary==`string`?e.summary:void 0,tokensBefore:typeof e.tokensBefore==`number`?e.tokensBefore:void 0,tokensAfter:typeof e.tokensAfter==`number`?e.tokensAfter:void 0}),{method:`POST`,body:{}}),exec:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/exec`,(e,t)=>((!F(e)||!(`exitCode`in e)||typeof e.output!=`string`||typeof e.durationMs!=`number`||typeof e.truncated!=`boolean`||typeof e.cancelled!=`boolean`)&&P(t,`expected { exitCode, output, durationMs, truncated, cancelled }`),{exitCode:typeof e.exitCode==`number`?e.exitCode:null,output:e.output,durationMs:e.durationMs,truncated:e.truncated,cancelled:e.cancelled}),{method:`POST`,body:{command:t,excludeFromContext:n?.excludeFromContext===!0}}),setModel:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/model`,(e,t)=>((!F(e)||typeof e.provider!=`string`||typeof e.modelId!=`string`)&&P(t,`expected { provider, modelId }`),{provider:e.provider,modelId:e.modelId}),{method:`POST`,body:{provider:t,modelId:n}}),setThinkingLevel:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/thinking-level`,(e,t)=>((!F(e)||typeof e.level!=`string`)&&P(t,`expected { level }`),{level:e.level}),{method:`POST`,body:{level:t}}),getModelsJson:()=>I(`/api/v1/config/models`,Jn),setModelsJson:e=>I(`/api/v1/config/models`,Jn,{method:`PUT`,body:e}),getProviders:()=>I(`/api/v1/config/providers`,wn),getSettings:()=>I(`/api/v1/config/settings`,qn),updateSettings:e=>I(`/api/v1/config/settings`,qn,{method:`PUT`,body:e}),getSandboxSettings:()=>I(`/api/v1/config/sandbox`,an),updateSandboxSettings:e=>I(`/api/v1/config/sandbox`,an,{method:`PUT`,body:{toolEnv:e}}),getServerTheme:()=>I(`/api/v1/config/theme`,nn),updateServerTheme:e=>I(`/api/v1/config/theme`,nn,{method:`PUT`,body:e}),resetServerTheme:()=>I(`/api/v1/config/theme`,nn,{method:`DELETE`}),getAuthSummary:()=>I(`/api/v1/config/auth`,Kn),setApiKey:(e,t)=>I(`/api/v1/config/auth/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.provider!=`string`||e.configured!==!0)&&P(t,`expected { provider, configured: true }`),{provider:e.provider,configured:!0}),{method:`PUT`,body:{apiKey:t}}),removeApiKey:e=>I(`/api/v1/config/auth/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),getMcpSettings:()=>I(`/api/v1/mcp/settings`,En),setMcpEnabled:e=>I(`/api/v1/mcp/settings`,En,{method:`PUT`,body:{enabled:e}}),listMcpServers:e=>I(`/api/v1/mcp/servers${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,Tn),upsertMcpServer:(e,t)=>I(`/api/v1/mcp/servers/${encodeURIComponent(e)}`,kn,{method:`PUT`,body:t}),deleteMcpServer:e=>I(`/api/v1/mcp/servers/${encodeURIComponent(e)}`,An,{method:`DELETE`}),probeMcpServer:(e,t)=>{let n=t===void 0?``:`?projectId=${encodeURIComponent(t)}`;return I(`/api/v1/mcp/servers/${encodeURIComponent(e)}/probe${n}`,Dn,{method:`POST`,body:{}})},listMcpTools:e=>I(`/api/v1/mcp/tools?projectId=${encodeURIComponent(e)}`,On),grantStdioMcpTrust:e=>I(`/api/v1/mcp/trust/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.trusted!=`boolean`||!Array.isArray(e.status))&&P(t,`expected { trusted, status }`),{trusted:e.trusted,status:e.status}),{method:`POST`,body:{}}),revokeStdioMcpTrust:e=>I(`/api/v1/mcp/trust/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.trusted!=`boolean`)&&P(t,`expected { trusted }`),{trusted:e.trusted}),{method:`DELETE`}),listQuickActions:()=>I(`/api/v1/quick-actions`,Mn),createQuickAction:e=>I(`/api/v1/quick-actions`,jn,{method:`POST`,body:e}),updateQuickAction:(e,t)=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}`,jn,{method:`PUT`,body:t}),deleteQuickAction:e=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),runQuickAction:(e,t)=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}/run`,Nn,{method:`POST`,body:{projectId:t}}),submitAskUserQuestionAnswer:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/ask-user-question/answer`,Jt,{method:`POST`,body:t}),cancelAskUserQuestion:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/ask-user-question/answer`,Jt,{method:`POST`,body:{requestId:t,cancelled:!0,answers:[]}}),listTodos:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/todos`,Vn),listProcesses:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes`,Pn),getProcessOutput:(e,t,n)=>{let r=n===void 0?``:`?tail=${n}`;return I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/output${r}`,Fn)},processLogFileUrl:(e,t,n)=>`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/logs/file?stream=${n}`,killProcess:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`,In,{method:`POST`,body:{}}),clearProcesses:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes`,(e,t)=>((!F(e)||typeof e.cleared!=`number`)&&P(t,`expected { cleared: number }`),{cleared:e.cleared}),{method:`DELETE`}),writeProcessStdin:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/stdin`,In,{method:`POST`,body:n}),listWebhooks:e=>I(`/api/v1/webhooks${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,zn),createWebhook:e=>I(`/api/v1/webhooks`,Rn,{method:`POST`,body:e}),updateWebhook:(e,t)=>I(`/api/v1/webhooks/${encodeURIComponent(e)}`,Rn,{method:`PATCH`,body:t}),deleteWebhook:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),testWebhook:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}/test`,(e,t)=>((!F(e)||typeof e.queued!=`boolean`)&&P(t,`expected { queued }`),{queued:e.queued}),{method:`POST`}),listWebhookDeliveries:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}/deliveries`,Bn),orchestrationConfig:()=>I(`/api/v1/orchestration/config`,Hn),getSessionLink:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}`,Un),enableSupervisor:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/enable`,Un,{method:`POST`}),disableSupervisor:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/disable`,Jt,{method:`POST`}),listSupervisorWorkers:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers`,Wn),listSupervisorInbox:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/inbox`,Gn),clearSupervisorInbox:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/inbox/clear`,Jt,{method:`POST`}),detachWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/detach`,Jt,{method:`POST`}),killWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/kill`,(e,t)=>((!F(e)||typeof e.wasLive!=`boolean`)&&P(t,`expected { wasLive }`),{wasLive:e.wasLive}),{method:`POST`}),resumeWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/resume`,(e,t)=>((!F(e)||typeof e.resumed!=`boolean`)&&P(t,`expected { resumed }`),{resumed:e.resumed}),{method:`POST`}),listSkills:e=>I(`/api/v1/config/skills?projectId=${encodeURIComponent(e)}`,vn),listSkillOverrides:()=>I(`/api/v1/config/skills/overrides`,yn),setSkillEnabled:(e,t,n,r=`global`)=>I(`/api/v1/config/skills/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,_n,{method:`PUT`,body:{enabled:n,scope:r}}),clearSkillProjectOverride:(e,t)=>I(`/api/v1/config/skills/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,_n,{method:`DELETE`}),listPrompts:e=>I(`/api/v1/config/prompts?projectId=${encodeURIComponent(e)}`,Sn),listPromptOverrides:()=>I(`/api/v1/config/prompts/overrides`,Cn),setPromptEnabled:(e,t,n,r=`global`)=>I(`/api/v1/config/prompts/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,xn,{method:`PUT`,body:{enabled:n,scope:r}}),clearPromptProjectOverride:(e,t)=>I(`/api/v1/config/prompts/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,xn,{method:`DELETE`}),listTools:e=>I(`/api/v1/config/tools${e!==void 0&&e.length>0?`?projectId=${encodeURIComponent(e)}`:``}`,e=>{if(!F(e)||!Array.isArray(e.builtin)||!Array.isArray(e.mcp)||e.extension!==void 0&&!Array.isArray(e.extension))throw new N(0,`invalid_response_body`);let t=e;return t.extension===void 0&&(t.extension=[]),t}),setToolEnabled:(e,t,n,r=`global`,i)=>{let a=r===`project`&&i!==void 0?`?projectId=${encodeURIComponent(i)}`:``;return I(`/api/v1/config/tools/${e}/${encodeURIComponent(t)}/enabled${a}`,e=>{if(!F(e)||typeof e.family!=`string`||typeof e.name!=`string`||typeof e.enabled!=`boolean`||typeof e.scope!=`string`)throw new N(0,`invalid_response_body`);return{family:e.family,name:e.name,enabled:e.enabled,scope:e.scope}},{method:`PUT`,body:{enabled:n,scope:r}})},listToolOverrides:()=>I(`/api/v1/config/tools/overrides`,e=>{if(!F(e)||typeof e.projects!=`object`||e.projects===null)throw new N(0,`invalid_response_body`);let t=e.projects;for(let e of Object.values(t))(e.extension===void 0||e.extension===null)&&(e.extension={enable:[],disable:[]});return e}),clearToolProjectOverride:(e,t,n)=>I(`/api/v1/config/tools/${e}/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(n)}`,e=>{if(!F(e)||typeof e.family!=`string`||typeof e.name!=`string`||typeof e.projectId!=`string`)throw new N(0,`invalid_response_body`);return{family:e.family,name:e.name,projectId:e.projectId}},{method:`DELETE`}),exportConfig:async()=>{let e={},t=Ht();t!==void 0&&(e.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/v1/config/export`,{headers:e});if(n.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!n.ok){let e=`request_failed`;try{let t=await n.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(n.status,e)}return{blob:await n.blob(),filename:fr(n.headers.get(`Content-Disposition`)??``)??`pi-forge-config.tar.gz`,files:(n.headers.get(`X-Pi-Forge-Files`)??``).split(`,`).filter(e=>e.length>0)}},importConfig:e=>{let t=new FormData;return t.append(`file`,e,e.name),I(`/api/v1/config/import`,e=>{if(!F(e)||!Array.isArray(e.imported)||!Array.isArray(e.skipped)||!Array.isArray(e.errors))throw new N(0,`invalid_response_body`);return e},{method:`POST`,body:t})},exportSkills:async()=>{let e={},t=Ht();t!==void 0&&(e.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/v1/config/skills/export`,{headers:e});if(n.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!n.ok){let e=`request_failed`;try{let t=await n.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(n.status,e)}let r=await n.blob(),i=fr(n.headers.get(`Content-Disposition`)??``)??`pi-forge-skills.tar.gz`,a=n.headers.get(`X-Pi-Forge-File-Count`)??`0`;return{blob:r,filename:i,fileCount:Number.parseInt(a,10)||0}},exportSession:async(e,t)=>{let n={},r=Ht();r!==void 0&&(n.Authorization=`Bearer ${r.token}`);let i=await fetch(`/api/v1/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:n});if(i.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!i.ok){let e=`request_failed`;try{let t=await i.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(i.status,e)}let a=await i.blob(),o=i.headers.get(`Content-Disposition`)??``,s=t===`markdown`?`session.md`:`session.jsonl`;return{blob:a,filename:fr(o)??s}},importSkills:e=>{let t=new FormData;for(let n of e){let e=n.webkitRelativePath,r=e!==void 0&&e.length>0?e:n.name;t.append(`file`,n,r)}return I(`/api/v1/config/skills/import`,e=>{if(!F(e)||!Array.isArray(e.imported)||!Array.isArray(e.skipped))throw new N(0,`invalid_response_body`);return e},{method:`POST`,body:t})},filesTree:(e,t)=>{let n=new URLSearchParams({projectId:e});return t!==void 0&&n.set(`maxDepth`,String(t)),I(`/api/v1/files/tree?${n.toString()}`,Yn)},filesRead:(e,t)=>I(`/api/v1/files/read?${new URLSearchParams({projectId:e,path:t}).toString()}`,Xn),filesWrite:(e,t,n)=>I(`/api/v1/files/write`,lr,{method:`PUT`,body:{projectId:e,path:t,content:n}}),filesMkdir:(e,t,n)=>I(`/api/v1/files/mkdir`,lr,{method:`POST`,body:{projectId:e,parentPath:t,name:n}}),filesRename:(e,t,n)=>I(`/api/v1/files/rename`,lr,{method:`POST`,body:{projectId:e,path:t,name:n}}),filesMove:(e,t,n)=>I(`/api/v1/files/move`,lr,{method:`POST`,body:{projectId:e,src:t,dest:n}}),filesDelete:(e,t,n)=>{let r=new URLSearchParams({projectId:e,path:t});return n?.recursive===!0&&r.set(`recursive`,`true`),I(`/api/v1/files/delete?${r.toString()}`,Jt,{method:`DELETE`})},filesDownload:async(e,t)=>{let n=new URLSearchParams({projectId:e});t!==void 0&&t.length>0&&n.set(`path`,t);let r={},i=Ht();i!==void 0&&(r.Authorization=`Bearer ${i.token}`);let a=await fetch(`/api/v1/files/download?${n.toString()}`,{headers:r});if(a.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!a.ok){let e=`request_failed`;try{let t=await a.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(a.status,e)}return{blob:await a.blob(),filename:fr(a.headers.get(`Content-Disposition`)??``)??`download`}},uploadFiles:async(e,t,n,r)=>{let i=new FormData;i.append(`projectId`,e),i.append(`parentPath`,t),r?.overwrite===!0&&i.append(`overwrite`,`1`);let a=n.reduce((e,t)=>e+t.size,0),o=0;for(let[e,t]of n.entries()){let n=dr(t),s=await ur(t,e=>{o+=e,r?.onHashProgress?.(o,a)});i.append(`path:${e}`,n),i.append(`sha256:${e}`,s)}for(let[e,t]of n.entries())i.append(`file:${e}`,t,dr(t));return I(`/api/v1/files/upload`,ir,{method:`POST`,body:i,...r?.signal===void 0?{}:{signal:r.signal}})},completeFiles:(e,t,n)=>{let r=new URLSearchParams({projectId:e,query:t});return n?.limit!==void 0&&r.set(`limit`,String(n.limit)),I(`/api/v1/files/complete?${r.toString()}`,(e,t)=>((!F(e)||!Array.isArray(e.paths))&&P(t,`expected { paths: string[] }`),{paths:e.paths.filter(e=>typeof e==`string`)}),n?.signal===void 0?{}:{signal:n.signal})},searchFiles:(e,t,n)=>{let r=new URLSearchParams({projectId:e,q:t.query});return t.regex===!0&&r.set(`regex`,`1`),t.caseSensitive===!0&&r.set(`caseSensitive`,`1`),t.includeGitignored===!0&&r.set(`includeGitignored`,`1`),t.include!==void 0&&t.include.length>0&&r.set(`include`,t.include),t.exclude!==void 0&&t.exclude.length>0&&r.set(`exclude`,t.exclude),t.limit!==void 0&&r.set(`limit`,String(t.limit)),I(`/api/v1/files/search?${r.toString()}`,ar,n===void 0?{}:{signal:n})},searchSessions:(e,t)=>{let n=new URLSearchParams({q:e});return t?.sessionLimit!==void 0&&n.set(`sessionLimit`,String(t.sessionLimit)),t?.matchesPerSession!==void 0&&n.set(`matchesPerSession`,String(t.matchesPerSession)),I(`/api/v1/search/sessions?${n.toString()}`,or,t?.signal===void 0?{}:{signal:t.signal})},gitInit:e=>I(`/api/v1/git/init`,(e,t)=>((!F(e)||typeof e.alreadyInitialised!=`boolean`||typeof e.isGitRepo!=`boolean`)&&P(t,`expected { alreadyInitialised, isGitRepo }`),{alreadyInitialised:e.alreadyInitialised,isGitRepo:e.isGitRepo}),{method:`POST`,body:{projectId:e}}),gitStatus:(e,t)=>I(`/api/v1/git/status?${mr(e,t)}`,Qn),gitWorktrees:e=>I(`/api/v1/git/worktrees?${mr(e)}`,cr),gitDiff:(e,t)=>I(`/api/v1/git/diff?${mr(e,t)}`,$n),gitDiffStaged:(e,t)=>I(`/api/v1/git/diff/staged?${mr(e,t)}`,$n),gitDiffFile:(e,t,n,r)=>{let i={path:t};return n&&(i.staged=`1`),I(`/api/v1/git/diff/file?${mr(e,r,i)}`,$n)},gitLog:(e,t,n)=>{let r={};return t!==void 0&&(r.limit=String(t)),I(`/api/v1/git/log?${mr(e,n,r)}`,er)},gitBranches:(e,t)=>I(`/api/v1/git/branches?${mr(e,t)}`,tr),gitRemotes:(e,t)=>I(`/api/v1/git/remotes?${mr(e,t)}`,sr),gitRemoteAdd:(e,t,n,r)=>I(`/api/v1/git/remote/add`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,name:t,url:n,...r?.insecureTls===!0?{insecureTls:!0}:{},...r?.worktreePath===void 0?{}:{worktreePath:r.worktreePath}}}),gitRemoteSetInsecureTls:(e,t,n,r)=>I(`/api/v1/git/remote/tls`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,name:t,insecureTls:n,...r===void 0?{}:{worktreePath:r}}}),gitRemoteRemove:(e,t,n)=>I(`/api/v1/git/remote/${encodeURIComponent(t)}?${mr(e,n)}`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`DELETE`}),gitCheckout:(e,t,n)=>I(`/api/v1/git/checkout`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,branch:t,...n===void 0?{}:{worktreePath:n}}}),gitBranchCreate:(e,t,n)=>{let r={projectId:e,name:t};return n?.startPoint!==void 0&&(r.startPoint=n.startPoint),n?.checkout!==void 0&&(r.checkout=n.checkout),n?.worktreePath!==void 0&&(r.worktreePath=n.worktreePath),I(`/api/v1/git/branch/create`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:r})},gitBranchDelete:(e,t,n,r)=>{let i={};return n===!0&&(i.force=`1`),I(`/api/v1/git/branch/${encodeURIComponent(t)}?${mr(e,r,i)}`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`DELETE`})},gitStage:(e,t,n)=>I(`/api/v1/git/stage`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitUnstage:(e,t,n)=>I(`/api/v1/git/unstage`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitApplyHunks:(e,t,n,r,i)=>I(`/api/v1/git/apply-hunks`,(e,t)=>{(!F(e)||typeof e.ok!=`boolean`)&&P(t,`expected { ok: boolean }`);let n={ok:e.ok};return typeof e.error==`string`&&(n.error=e.error),typeof e.totalHunks==`number`&&(n.totalHunks=e.totalHunks),n},{method:`POST`,body:{projectId:e,path:t,mode:n,hunkIndices:r,...i===void 0?{}:{worktreePath:i}}}),gitRevert:(e,t,n)=>I(`/api/v1/git/revert`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitCommit:(e,t,n)=>I(`/api/v1/git/commit`,(e,t)=>((!F(e)||typeof e.hash!=`string`)&&P(t,`expected { hash }`),{hash:e.hash}),{method:`POST`,body:{projectId:e,message:t,...n===void 0?{}:{worktreePath:n}}}),gitFetch:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.prune!==void 0&&(n.prune=t.prune),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/fetch`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})},gitPull:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.branch!==void 0&&(n.branch=t.branch),t?.rebase!==void 0&&(n.rebase=t.rebase),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/pull`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})},gitPush:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.branch!==void 0&&(n.branch=t.branch),t?.setUpstream!==void 0&&(n.setUpstream=t.setUpstream),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/push`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})}};async function*hr(e){if(e.body===null)return;let t=e.body.pipeThrough(new TextDecoderStream).getReader(),n=``;try{for(;;){let{value:e,done:r}=await t.read();if(r)return;n+=e.replace(/\r\n/g,`
|
|
9
|
+
`).replace(Vd,``)}function Ud(e,t){return t=Hd(t),Hd(e)===t}function Wd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Wd(e,t,`name`,a.name,a,null),Wd(e,t,`formEncType`,a.formEncType,a,null),Wd(e,t,`formMethod`,a.formMethod,a,null),Wd(e,t,`formTarget`,a.formTarget,a,null)):(Wd(e,t,`encType`,a.encType,a,null),Wd(e,t,`method`,a.method,a,null),Wd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=tn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=$t.get(n)||n,Pt(e,n,r))}}function Gd(e,t,n,r,a,o){switch(n){case`style`:Zt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[pt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}}}function Kd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ad(`error`,e),Ad(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Wd(e,t,o,s,n,null)}}a&&Wd(e,t,`srcSet`,n.srcSet,n,null),r&&Wd(e,t,`src`,n.src,n,null);return;case`input`:Ad(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Wd(e,t,r,d,n,null)}}N(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ad(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Wd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&qt(e,!!r,n,!0):qt(e,!!r,t,!1);return;case`textarea`:for(s in Ad(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Wd(e,t,s,c,n,null)}F(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Wd(e,t,l,r,n,null)}return;case`dialog`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Ad(`cancel`,e),Ad(`close`,e);break;case`iframe`:case`object`:Ad(`load`,e);break;case`video`:case`audio`:for(r=0;r<Dd.length;r++)Ad(Dd[r],e);break;case`image`:Ad(`error`,e),Ad(`load`,e);break;case`details`:Ad(`toggle`,e);break;case`embed`:case`source`:case`link`:Ad(`error`,e),Ad(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Wd(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Gd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Wd(e,t,c,r,n,null))}function qd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Wd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Wd(e,t,p,m,r,f)}}Gt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Wd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Wd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?qt(e,!!n,n?[]:``,!1):qt(e,!!n,t,!0)):qt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Wd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Wd(e,t,s,a,r,o)}P(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Wd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Wd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Wd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Wd(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Gd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Gd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Wd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Wd(e,t,f,p,r,m)}function Jd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Yd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Jd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Jd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Xd=null,Zd=null;function Qd(e){return e.nodeType===9?e:e.ownerDocument}function $d(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function ef(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function tf(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var nf=null;function rf(){var e=window.event;return e&&e.type===`popstate`?e===nf?!1:(nf=e,!0):(nf=null,!1)}var af=typeof setTimeout==`function`?setTimeout:void 0,of=typeof clearTimeout==`function`?clearTimeout:void 0,sf=typeof Promise==`function`?Promise:void 0,cf=typeof queueMicrotask==`function`?queueMicrotask:sf===void 0?af:function(e){return sf.resolve(null).then(e).catch(lf)};function lf(e){setTimeout(function(){throw e})}function uf(e){return e===`head`}function df(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Gp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Tf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Tf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Tf(e.ownerDocument.body);n=i}while(n);Gp(t)}function ff(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function pf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:pf(n),bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=bf(e.nextSibling),e===null)break}return null}function hf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bf(e.nextSibling),e===null))return null;return e}function gf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bf(e.nextSibling),e===null))return null;return e}function _f(e){return e.data===`$?`||e.data===`$~`}function vf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function yf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function bf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var xf=null;function Sf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function wf(e,t,n){switch(t=Qd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bt(e)}var Ef=new Map,Df=new Set;function Of(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var kf=j.d;j.d={f:Af,r:jf,D:Pf,C:Ff,L:If,m:Lf,X:zf,S:Rf,M:Bf};function Af(){var e=kf.f(),t=ku();return e||t}function jf(e){var t=St(e);t!==null&&t.tag===5&&t.type===`form`?ks(t):kf.r(e)}var Mf=typeof document>`u`?null:document;function Nf(e,t,n){var r=Mf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Df.has(i)||(Df.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Pf(e){kf.D(e),Nf(`dns-prefetch`,e,null)}function Ff(e,t){kf.C(e,t),Nf(`preconnect`,e,t)}function If(e,t,n){kf.L(e,t,n);var r=Mf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Hf(e);break;case`script`:a=Kf(e)}Ef.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Ef.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Uf(a))||t===`script`&&r.querySelector(qf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Lf(e,t){kf.m(e,t);var n=Mf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Kf(e)}if(!Ef.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Ef.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function Rf(e,t,n){kf.S(e,t,n);var r=Mf;if(r&&e){var i=wt(r).hoistableStyles,a=Hf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Uf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Ef.get(a))&&Xf(e,n);var c=o=r.createElement(`link`);Tt(c),Kd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Yf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function zf(e,t){kf.X(e,t);var n=Mf;if(n&&e){var r=wt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),Tt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t){kf.M(e,t);var n=Mf;if(n&&e){var r=wt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),Tt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t,n,r){var a=(a=pe.current)?Of(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Hf(n.href),n=wt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Hf(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Uf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Ef.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ef.set(e,n),o||Gf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Kf(n),n=wt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Hf(e){return`href="`+Wt(e)+`"`}function Uf(e){return`link[rel="stylesheet"][`+e+`]`}function Wf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Gf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Kd(t,`link`,n),Tt(t),e.head.appendChild(t))}function Kf(e){return`[src="`+Wt(e)+`"]`}function qf(e){return`script[async]`+e}function Jf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Kd(r,`style`,a),Yf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Hf(n.href);var o=e.querySelector(Uf(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Wf(n),(a=Ef.get(a))&&Xf(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Yf(o,n.precedence,e),t.instance=o;case`script`:return o=Kf(n.src),(a=e.querySelector(qf(o)))?(t.instance=a,Tt(a),a):(r=n,(a=Ef.get(o))&&(r=m({},n),Zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),Kd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Yf(r,n.precedence,e));return t.instance}function Yf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Xf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qf=null;function $f(e,t,n){if(Qf===null){var r=new Map,i=Qf=new Map;i.set(n,r)}else i=Qf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function tp(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function np(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Hf(r.href),a=t.querySelector(Uf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=op.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Wf(r),(i=Ef.get(i))&&Xf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=op.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ip=0;function ap(e,t){return e.stylesheets&&e.count===0&&cp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ip===0&&(ip=62500*Yd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ip?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function op(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sp=null;function cp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sp=new Map,t.forEach(lp,e),sp=null,op.call(e))}function lp(e,t){if(!(t.state.loading&4)){var n=sp.get(e);if(n)var r=n.get(null);else{n=new Map,sp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=op.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var up={$$typeof:C,Provider:null,Consumer:null,_currentValue:M,_currentValue2:M,_threadCount:0};function dp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function fp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new dp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=li(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function pp(e){return e?(e=si,e):si}function mp(e,t,n,r,i,a){i=pp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(wu(n,e,t),Ga(n,e,t))}function hp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gp(e,t){hp(e,t),(e=e.alternate)&&hp(e,t)}function _p(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&wu(t,e,67108864),gp(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=Su();t=st(t);var n=ii(e,t);n!==null&&wu(n,e,t),gp(e,t)}}var yp=!0;function bp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,Sp(e,t,n,r)}finally{j.p=a,A.T=i}}function xp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,Sp(e,t,n,r)}finally{j.p=a,A.T=i}}function Sp(e,t,n,r){if(yp){var i=Cp(r);if(i===null)Fd(e,t,r,wp,n),Fp(e,r);else if(Lp(i,e,t,n,r))r.stopPropagation();else if(Fp(e,r),t&4&&-1<Pp.indexOf(e)){for(;i!==null;){var a=St(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}pd(a),!(Ul&6)&&(uu=je()+500,md(0,!1))}}break;case 31:case 13:s=ii(a,2),s!==null&&wu(s,a,2),ku(),gp(a,2)}if(a=Cp(r),a===null&&Fd(e,t,r,wp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Fd(e,t,r,null,n)}}function Cp(e){return e=an(e),Tp(e)}var wp=null;function Tp(e){if(wp=null,e=xt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return wp=e,null}function Ep(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Dp=!1,Op=null,kp=null,Ap=null,jp=new Map,Mp=new Map,Np=[],Pp=`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 Fp(e,t){switch(e){case`focusin`:case`focusout`:Op=null;break;case`dragenter`:case`dragleave`:kp=null;break;case`mouseover`:case`mouseout`:Ap=null;break;case`pointerover`:case`pointerout`:jp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Mp.delete(t.pointerId)}}function Ip(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=St(t),t!==null&&_p(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Lp(e,t,n,r,i){switch(t){case`focusin`:return Op=Ip(Op,e,t,n,r,i),!0;case`dragenter`:return kp=Ip(kp,e,t,n,r,i),!0;case`mouseover`:return Ap=Ip(Ap,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return jp.set(a,Ip(jp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Mp.set(a,Ip(Mp.get(a)||null,e,t,n,r,i)),!0}return!1}function Rp(e){var t=xt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ut(e.priority,function(){vp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){vp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=St(n),t!==null&&_p(t),e.blockedOn=n,!1;t.shift()}return!0}function Bp(e,t,n){zp(e)&&n.delete(t)}function Vp(){Dp=!1,Op!==null&&zp(Op)&&(Op=null),kp!==null&&zp(kp)&&(kp=null),Ap!==null&&zp(Ap)&&(Ap=null),jp.forEach(Bp),Mp.forEach(Bp)}function Hp(e,n){e.blockedOn===n&&(e.blockedOn=null,Dp||(Dp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vp)))}var Up=null;function Wp(e){Up!==e&&(Up=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Up===e&&(Up=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Tp(r||n)===null)continue;break}var a=St(n);a!==null&&(e.splice(t,3),t-=3,Ds(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Gp(e){function t(t){return Hp(t,e)}Op!==null&&Hp(Op,e),kp!==null&&Hp(kp,e),Ap!==null&&Hp(Ap,e),jp.forEach(t),Mp.forEach(t);for(var n=0;n<Np.length;n++){var r=Np[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Np.length&&(n=Np[0],n.blockedOn===null);)Rp(n),n.blockedOn===null&&Np.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Wp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Tp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Wp(n)}}}function Kp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function qp(e){this._internalRoot=e}H.prototype.render=qp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;mp(n,Su(),e,t,null,null)},H.prototype.unmount=qp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mp(e.current,2,null,e,null,null),ku(),t[mt]=null}};function H(e){this._internalRoot=e}H.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Np.length&&t!==0&&t<Np[n].priority;n++);Np.splice(n,0,e),n===0&&Rp(e)}};var Jp=n.version;if(Jp!==`19.2.7`)throw Error(i(527,Jp,`19.2.7`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Yp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xp.isDisabled&&Xp.supportsFiber)try{Be=Xp.inject(Yp),Ve=Xp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Xs,s=Zs,c=Qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=fp(e,1,!1,null,null,n,r,null,o,s,c,Kp),e[mt]=t.current,Nd(e),new qp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=`modulepreload`,x=function(e){return`/`+e},S={},C=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=x(t,n),t=s(t),t in S)return;S[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:b,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},w=`true`,T=`false`,E=w===`true`,D=T===`true`;function O(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:a,onRegisteredSW:o,onRegisterError:s}=e,c,l,u,d=async(e=!0)=>{await l,E||u?.()};async function f(){if(`serviceWorker`in navigator){if(c=await C(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{s?.(e)}),!c)return;if(u=()=>{c?.messageSkipWaiting()},!D)if(E)c.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),c.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,c?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};c.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),c.addEventListener(`waiting`,t)}c.register({immediate:t}).then(e=>{o?o(`/sw.js`,e):a?.(e)}).catch(e=>{s?.(e)})}}return l=f(),d}var k=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),te=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ne=e=>{let t=te(e);return t.charAt(0).toUpperCase()+t.slice(1)},re={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ie=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ae=(0,v.createContext)({}),A=()=>(0,v.useContext)(ae),j=(0,v.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=A()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,...re,width:t??l??re.width,height:t??l??re.height,stroke:e??f,strokeWidth:m,className:k(`lucide`,p,i),...!a&&!ie(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),M=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(j,{ref:i,iconNode:t,className:k(`lucide-${ee(ne(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ne(e),n},oe=M(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),se=M(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ce=M(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),le=M(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),ue=M(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),de=M(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),fe=M(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),pe=M(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),me=M(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),he=M(`square-x`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ge=M(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),_e=M(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ve=M(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ye=M(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),be=M(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),xe=M(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Se=M(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ce=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),we=M(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Te=M(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ee=M(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),De=M(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Oe=M(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ke=M(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ae=M(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),je=M(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Me=M(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Ne=M(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Pe=M(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Fe=M(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ie=M(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Le=M(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Re=M(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),ze=M(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Be=M(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Ve=M(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),He=M(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ue=M(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),We=M(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]),Ge=M(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Ke=M(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),qe=M(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Je=M(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ye=M(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Xe=M(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ze=M(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Qe=M(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),$e=M(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),et=M(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),tt=M(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),nt=M(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),rt=M(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),it=M(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),at=M(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ot=M(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),st=`(max-width: 767px)`;function ct(){let[e,t]=(0,v.useState)(()=>typeof window>`u`?!1:window.matchMedia(st).matches);return(0,v.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(st),n=e=>t(e.matches);return t(e.matches),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var lt=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ut=(e=>e?lt(e):lt),dt=e=>e;function ft(e,t=dt){let n=v.useSyncExternalStore(e.subscribe,v.useCallback(()=>t(e.getState()),[e,t]),v.useCallback(()=>t(e.getInitialState()),[e,t]));return v.useDebugValue(n),n}var pt=e=>{let t=ut(e),n=e=>ft(t,e);return Object.assign(n,t),n},mt=(e=>e?pt(e):pt);function ht(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var gt=class{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then(()=>new Promise(e)),new Promise(t=>{e=t})}dispatch(e){return ht(this,void 0,void 0,function*(){let t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}})}};function _t(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global}var vt=_t(),yt=vt.Buffer??null,bt=vt.TextEncoder?new vt.TextEncoder:null;function xt(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function St(e,t){let n=t.length>>1;for(let r=0;r<n;r++){let n=r<<1;e[r]=xt(t.charCodeAt(n),t.charCodeAt(n+1))}}function Ct(e,t){if(e.length!==t.length*2)return!1;for(let n=0;n<t.length;n++){let r=n<<1;if(t[n]!==xt(e.charCodeAt(r),e.charCodeAt(r+1)))return!1}return!0}var wt=87,Tt=48;function Et(e,t,n){let r=0;for(let i=0;i<n;i++){let n=t[i]>>>4;e[r++]=n>9?n+wt:n+Tt,n=t[i]&15,e[r++]=n>9?n+wt:n+Tt}return String.fromCharCode.apply(null,e)}var Dt=yt===null?e=>{if(typeof e==`string`)return bt.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Invalid data type!`)}:e=>{if(typeof e==`string`){let t=yt.from(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(yt.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Invalid data type!`)},Ot=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,kt=new Uint8Array(256);for(let e=0;e<64;e++)kt[Ot.charCodeAt(e)]=e;function At(e){let t=Math.floor(e.length*.75),n=e.length;return e[n-1]===`=`&&(--t,e[n-2]===`=`&&--t),t}function jt(e){let t=At(e),n=e.length,r=new Uint8Array(t),i=0;for(let t=0;t<n;t+=4){let n=kt[e.charCodeAt(t)],a=kt[e.charCodeAt(t+1)],o=kt[e.charCodeAt(t+2)],s=kt[e.charCodeAt(t+3)];r[i]=n<<2|a>>4,i+=1,r[i]=(a&15)<<4|o>>2,i+=1,r[i]=(o&3)<<6|s&63,i+=1}return r}var Mt=16*1024,Nt=4,Pt=new gt,Ft=new Map;function It(e,t){return ht(this,void 0,void 0,function*(){let n=null,r=null,i=!1;if(typeof WebAssembly>`u`)throw Error(`WebAssembly is not supported in this environment!`);let a=(e,t=0)=>{r.set(e,t)},o=()=>r,s=()=>n.exports,c=e=>{n.exports.Hash_SetMemorySize(e);let t=n.exports.Hash_GetBuffer(),i=n.exports.memory.buffer;r=new Uint8Array(i,t,e)},l=()=>new DataView(n.exports.memory.buffer).getUint32(n.exports.STATE_SIZE,!0),u=Pt.dispatch(()=>ht(this,void 0,void 0,function*(){if(!Ft.has(e.name)){let t=jt(e.data),n=WebAssembly.compile(t);Ft.set(e.name,n)}let t=yield Ft.get(e.name);n=yield WebAssembly.instantiate(t,{})})),d=()=>ht(this,void 0,void 0,function*(){n||(yield u);let e=n.exports.Hash_GetBuffer(),t=n.exports.memory.buffer;r=new Uint8Array(t,e,Mt)}),f=(e=null)=>{i=!0,n.exports.Hash_Init(e)},p=e=>{let t=0;for(;t<e.length;){let i=e.subarray(t,t+Mt);t+=i.length,r.set(i),n.exports.Hash_Update(i.length)}},m=e=>{if(!i)throw Error(`update() called before init()`);p(Dt(e))},h=new Uint8Array(t*2),g=(e,a=null)=>{if(!i)throw Error(`digest() called before init()`);return i=!1,n.exports.Hash_Final(a),e===`binary`?r.slice(0,t):Et(h,r,t)},_=()=>{if(!i)throw Error(`save() can only be called after init() and before digest()`);let t=n.exports.Hash_GetState(),r=l(),a=n.exports.memory.buffer,o=new Uint8Array(a,t,r),s=new Uint8Array(Nt+r);return St(s,e.hash),s.set(o,Nt),s},v=t=>{if(!(t instanceof Uint8Array))throw Error(`load() expects an Uint8Array generated by save()`);let r=n.exports.Hash_GetState(),a=l(),o=Nt+a,s=n.exports.memory.buffer;if(t.length!==o)throw Error(`Bad state length (expected ${o} bytes, got ${t.length})`);if(!Ct(e.hash,t.subarray(0,Nt)))throw Error(`This state was written by an incompatible hash implementation`);let c=t.subarray(Nt);new Uint8Array(s,r,a).set(c),i=!0},y=e=>typeof e==`string`?e.length<Mt/4:e.byteLength<Mt,b=y;switch(e.name){case`argon2`:case`scrypt`:b=()=>!0;break;case`blake2b`:case`blake2s`:b=(e,t)=>t<=512&&y(e);break;case`blake3`:b=(e,t)=>t===0&&y(e);break;case`xxhash64`:case`xxhash3`:case`xxhash128`:case`crc64`:b=()=>!1;break}return yield d(),{getMemory:o,writeMemory:a,getExports:s,setMemorySize:c,init:f,update:m,digest:g,save:_,load:v,calculate:(e,i=null,a=null)=>{if(!b(e,i))return f(i),m(e),g(`hex`,a);let o=Dt(e);return r.set(o),n.exports.Hash_Calculate(o.length,i,a),Et(h,r,t)},hashLength:t}})}new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt;var Lt={name:`sha256`,data:`AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwgHAAEBAQIAAwUEAQECAgYOAn8BQfCJBQt/AEGACAsHcAgGbWVtb3J5AgAOSGFzaF9HZXRCdWZmZXIAAAlIYXNoX0luaXQAAQtIYXNoX1VwZGF0ZQACCkhhc2hfRmluYWwABA1IYXNoX0dldFN0YXRlAAUOSGFzaF9DYWxjdWxhdGUABgpTVEFURV9TSVpFAwEKnEoHBQBBgAkLnQEAQQBCADcDwIkBQQBBHEEgIABB4AFGIgAbNgLoiQFBAEKnn+anxvST/b5/Qquzj/yRo7Pw2wAgABs3A+CJAUEAQrGWgP6fooWs6ABC/6S5iMWR2oKbfyAAGzcD2IkBQQBCl7rDg5Onlod3QvLmu+Ojp/2npX8gABs3A9CJAUEAQti9loj8oLW+NkLnzKfQ1tDrs7t/IAAbNwPIiQEL7wICAX4Gf0EAQQApA8CJASIBIACtfDcDwIkBAkACQAJAIAGnQT9xIgINAEGACSEDDAELAkBBwAAgAmsiBCAAIAQgAEkbIgNFDQAgA0EDcSEFIAJBgIkBaiEGQQAhAgJAIANBBEkNACADQfwAcSEHQQAhAgNAIAYgAmoiAyACQYAJai0AADoAACADQQFqIAJBgQlqLQAAOgAAIANBAmogAkGCCWotAAA6AAAgA0EDaiACQYMJai0AADoAACAHIAJBBGoiAkcNAAsLIAVFDQADQCAGIAJqIAJBgAlqLQAAOgAAIAJBAWohAiAFQX9qIgUNAAsLIAAgBEkNAUGAiQEQAyAAIARrIQAgBEGACWohAwsCQCAAQcAASQ0AA0AgAxADIANBwABqIQMgAEFAaiIAQT9LDQALCyAARQ0AQQAhAkEAIQUDQCACQYCJAWogAyACai0AADoAACACQQFqIQIgACAFQQFqIgVB/wFxSw0ACwsLoz4BRX9BACAAKAI8IgFBGHQgAUGA/gNxQQh0ciABQQh2QYD+A3EgAUEYdnJyIgFBGXcgAUEOd3MgAUEDdnMgACgCOCICQRh0IAJBgP4DcUEIdHIgAkEIdkGA/gNxIAJBGHZyciICaiAAKAIgIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIgRBGXcgBEEOd3MgBEEDdnMgACgCHCIDQRh0IANBgP4DcUEIdHIgA0EIdkGA/gNxIANBGHZyciIFaiAAKAIEIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIgZBGXcgBkEOd3MgBkEDdnMgACgCACIDQRh0IANBgP4DcUEIdHIgA0EIdkGA/gNxIANBGHZyciIHaiAAKAIkIgNBGHQgA0GA/gNxQQh0ciADQQh2QYD+A3EgA0EYdnJyIghqIAJBD3cgAkENd3MgAkEKdnNqIgNqIAAoAhgiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiCkEZdyAKQQ53cyAKQQN2cyAAKAIUIglBGHQgCUGA/gNxQQh0ciAJQQh2QYD+A3EgCUEYdnJyIgtqIAJqIAAoAhAiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiDEEZdyAMQQ53cyAMQQN2cyAAKAIMIglBGHQgCUGA/gNxQQh0ciAJQQh2QYD+A3EgCUEYdnJyIg1qIAAoAjAiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiDmogACgCCCIJQRh0IAlBgP4DcUEIdHIgCUEIdkGA/gNxIAlBGHZyciIPQRl3IA9BDndzIA9BA3ZzIAZqIAAoAigiCUEYdCAJQYD+A3FBCHRyIAlBCHZBgP4DcSAJQRh2cnIiEGogAUEPdyABQQ13cyABQQp2c2oiCUEPdyAJQQ13cyAJQQp2c2oiEUEPdyARQQ13cyARQQp2c2oiEkEPdyASQQ13cyASQQp2c2oiE2ogACgCNCIUQRh0IBRBgP4DcUEIdHIgFEEIdkGA/gNxIBRBGHZyciIVQRl3IBVBDndzIBVBA3ZzIA5qIBJqIAAoAiwiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnIiFkEZdyAWQQ53cyAWQQN2cyAQaiARaiAIQRl3IAhBDndzIAhBA3ZzIARqIAlqIAVBGXcgBUEOd3MgBUEDdnMgCmogAWogC0EZdyALQQ53cyALQQN2cyAMaiAVaiANQRl3IA1BDndzIA1BA3ZzIA9qIBZqIANBD3cgA0ENd3MgA0EKdnNqIhRBD3cgFEENd3MgFEEKdnNqIhdBD3cgF0ENd3MgF0EKdnNqIhhBD3cgGEENd3MgGEEKdnNqIhlBD3cgGUENd3MgGUEKdnNqIhpBD3cgGkENd3MgGkEKdnNqIhtBD3cgG0ENd3MgG0EKdnNqIhxBGXcgHEEOd3MgHEEDdnMgAkEZdyACQQ53cyACQQN2cyAVaiAYaiAOQRl3IA5BDndzIA5BA3ZzIBZqIBdqIBBBGXcgEEEOd3MgEEEDdnMgCGogFGogE0EPdyATQQ13cyATQQp2c2oiHUEPdyAdQQ13cyAdQQp2c2oiHkEPdyAeQQ13cyAeQQp2c2oiH2ogE0EZdyATQQ53cyATQQN2cyAYaiADQRl3IANBDndzIANBA3ZzIAFqIBlqIB9BD3cgH0ENd3MgH0EKdnNqIiBqIBJBGXcgEkEOd3MgEkEDdnMgF2ogH2ogEUEZdyARQQ53cyARQQN2cyAUaiAeaiAJQRl3IAlBDndzIAlBA3ZzIANqIB1qIBxBD3cgHEENd3MgHEEKdnNqIiFBD3cgIUENd3MgIUEKdnNqIiJBD3cgIkENd3MgIkEKdnNqIiNBD3cgI0ENd3MgI0EKdnNqIiRqIBtBGXcgG0EOd3MgG0EDdnMgHmogI2ogGkEZdyAaQQ53cyAaQQN2cyAdaiAiaiAZQRl3IBlBDndzIBlBA3ZzIBNqICFqIBhBGXcgGEEOd3MgGEEDdnMgEmogHGogF0EZdyAXQQ53cyAXQQN2cyARaiAbaiAUQRl3IBRBDndzIBRBA3ZzIAlqIBpqICBBD3cgIEENd3MgIEEKdnNqIiVBD3cgJUENd3MgJUEKdnNqIiZBD3cgJkENd3MgJkEKdnNqIidBD3cgJ0ENd3MgJ0EKdnNqIihBD3cgKEENd3MgKEEKdnNqIilBD3cgKUENd3MgKUEKdnNqIipBD3cgKkENd3MgKkEKdnNqIitBGXcgK0EOd3MgK0EDdnMgH0EZdyAfQQ53cyAfQQN2cyAbaiAnaiAeQRl3IB5BDndzIB5BA3ZzIBpqICZqIB1BGXcgHUEOd3MgHUEDdnMgGWogJWogJEEPdyAkQQ13cyAkQQp2c2oiLEEPdyAsQQ13cyAsQQp2c2oiLUEPdyAtQQ13cyAtQQp2c2oiLmogJEEZdyAkQQ53cyAkQQN2cyAnaiAgQRl3ICBBDndzICBBA3ZzIBxqIChqIC5BD3cgLkENd3MgLkEKdnNqIi9qICNBGXcgI0EOd3MgI0EDdnMgJmogLmogIkEZdyAiQQ53cyAiQQN2cyAlaiAtaiAhQRl3ICFBDndzICFBA3ZzICBqICxqICtBD3cgK0ENd3MgK0EKdnNqIjBBD3cgMEENd3MgMEEKdnNqIjFBD3cgMUENd3MgMUEKdnNqIjJBD3cgMkENd3MgMkEKdnNqIjNqICpBGXcgKkEOd3MgKkEDdnMgLWogMmogKUEZdyApQQ53cyApQQN2cyAsaiAxaiAoQRl3IChBDndzIChBA3ZzICRqIDBqICdBGXcgJ0EOd3MgJ0EDdnMgI2ogK2ogJkEZdyAmQQ53cyAmQQN2cyAiaiAqaiAlQRl3ICVBDndzICVBA3ZzICFqIClqIC9BD3cgL0ENd3MgL0EKdnNqIjRBD3cgNEENd3MgNEEKdnNqIjVBD3cgNUENd3MgNUEKdnNqIjZBD3cgNkENd3MgNkEKdnNqIjdBD3cgN0ENd3MgN0EKdnNqIjhBD3cgOEENd3MgOEEKdnNqIjlBD3cgOUENd3MgOUEKdnNqIjogOCA0IC4gLCAhIBsgGSADIA4gBEEAKALYiQEiO0EadyA7QRV3cyA7QQd3c0EAKALkiQEiPGpBACgC4IkBIj1BACgC3IkBIj5zIDtxID1zaiAHakGY36iUBGoiB0EAKALUiQEiP2oiACAMaiA7IA1qID4gD2ogPSAGaiAAID4gO3NxID5zaiAAQRp3IABBFXdzIABBB3dzakGRid2JB2oiQEEAKALQiQEiQWoiDCAAIDtzcSA7c2ogDEEadyAMQRV3cyAMQQd3c2pBz/eDrntqIkJBACgCzIkBIkNqIg0gDCAAc3EgAHNqIA1BGncgDUEVd3MgDUEHd3NqQaW3181+aiJEQQAoAsiJASIAaiIPIA0gDHNxIAxzaiAPQRp3IA9BFXdzIA9BB3dzakHbhNvKA2oiRSBBIEMgAHNxIEMgAHFzIABBHncgAEETd3MgAEEKd3NqIAdqIgZqIgdqIAUgD2ogCiANaiALIAxqIAcgDyANc3EgDXNqIAdBGncgB0EVd3MgB0EHd3NqQfGjxM8FaiIKIAYgAHMgQ3EgBiAAcXMgBkEedyAGQRN3cyAGQQp3c2ogQGoiDGoiBCAHIA9zcSAPc2ogBEEadyAEQRV3cyAEQQd3c2pBpIX+kXlqIgsgDCAGcyAAcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiBCaiINaiIPIAQgB3NxIAdzaiAPQRp3IA9BFXdzIA9BB3dzakHVvfHYemoiQCANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIERqIgZqIgcgDyAEc3EgBHNqIAdBGncgB0EVd3MgB0EHd3NqQZjVnsB9aiJCIAYgDXMgDHEgBiANcXMgBkEedyAGQRN3cyAGQQp3c2ogRWoiDGoiBWogFiAHaiAQIA9qIAggBGogBSAHIA9zcSAPc2ogBUEadyAFQRV3cyAFQQd3c2pBgbaNlAFqIgggDCAGcyANcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiAKaiINaiIPIAUgB3NxIAdzaiAPQRp3IA9BFXdzIA9BB3dzakG+i8ahAmoiDiANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIAtqIgZqIgcgDyAFc3EgBXNqIAdBGncgB0EVd3MgB0EHd3NqQcP7sagFaiIQIAYgDXMgDHEgBiANcXMgBkEedyAGQRN3cyAGQQp3c2ogQGoiDGoiBCAHIA9zcSAPc2ogBEEadyAEQRV3cyAEQQd3c2pB9Lr5lQdqIhYgDCAGcyANcSAMIAZxcyAMQR53IAxBE3dzIAxBCndzaiBCaiINaiIFaiABIARqIAIgB2ogFSAPaiAFIAQgB3NxIAdzaiAFQRp3IAVBFXdzIAVBB3dzakH+4/qGeGoiByANIAxzIAZxIA0gDHFzIA1BHncgDUETd3MgDUEKd3NqIAhqIgFqIgYgBSAEc3EgBHNqIAZBGncgBkEVd3MgBkEHd3NqQaeN8N55aiIEIAEgDXMgDHEgASANcXMgAUEedyABQRN3cyABQQp3c2ogDmoiAmoiDCAGIAVzcSAFc2ogDEEadyAMQRV3cyAMQQd3c2pB9OLvjHxqIgUgAiABcyANcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAQaiIDaiINIAwgBnNxIAZzaiANQRp3IA1BFXdzIA1BB3dzakHB0+2kfmoiCCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBZqIgFqIg8gF2ogESANaiAUIAxqIAkgBmogDyANIAxzcSAMc2ogD0EadyAPQRV3cyAPQQd3c2pBho/5/X5qIgYgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAHaiICaiIJIA8gDXNxIA1zaiAJQRp3IAlBFXdzIAlBB3dzakHGu4b+AGoiDCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIARqIgNqIhEgCSAPc3EgD3NqIBFBGncgEUEVd3MgEUEHd3NqQczDsqACaiINIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogBWoiAWoiFCARIAlzcSAJc2ogFEEadyAUQRV3cyAUQQd3c2pB79ik7wJqIg8gASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAIaiICaiIXaiATIBRqIBggEWogEiAJaiAXIBQgEXNxIBFzaiAXQRp3IBdBFXdzIBdBB3dzakGqidLTBGoiGCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIAZqIgNqIgkgFyAUc3EgFHNqIAlBGncgCUEVd3MgCUEHd3NqQdzTwuUFaiIUIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogDGoiAWoiESAJIBdzcSAXc2ogEUEadyARQRV3cyARQQd3c2pB2pHmtwdqIhcgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiANaiICaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakHSovnBeWoiGSACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIA9qIgNqIhNqIB4gEmogGiARaiAdIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQe2Mx8F6aiIaIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGGoiAWoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pByM+MgHtqIhggASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAUaiICaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakHH/+X6e2oiFCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBdqIgNqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQfOXgLd8aiIXIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGWoiAWoiE2ogICASaiAcIBFqIB8gCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBx6KerX1qIhkgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAaaiICaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakHRxqk2aiIaIAIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGGoiA2oiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pB59KkoQFqIhggAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAUaiIBaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakGFldy9AmoiFCABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBdqIgJqIhMgI2ogJiASaiAiIBFqICUgCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBuMLs8AJqIhcgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAZaiIDaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakH827HpBGoiGSADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBpqIgFqIhEgCSATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQZOa4JkFaiIaIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGGoiAmoiEiARIAlzcSAJc2ogEkEadyASQRV3cyASQQd3c2pB1OapqAZqIhggAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAUaiIDaiITaiAoIBJqICQgEWogJyAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakG7laizB2oiFCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBdqIgFqIgkgEyASc3EgEnNqIAlBGncgCUEVd3MgCUEHd3NqQa6Si454aiIXIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGWoiAmoiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pBhdnIk3lqIhkgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAaaiIDaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakGh0f+VemoiGiADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBhqIgFqIhNqICogEmogLSARaiApIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQcvM6cB6aiIYIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogFGoiAmoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pB8JauknxqIhQgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAXaiIDaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakGjo7G7fGoiFyADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBlqIgFqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQZnQy4x9aiIZIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGmoiAmoiE2ogMCASaiAvIBFqICsgCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBpIzktH1qIhogAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAYaiIDaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakGF67igf2oiGCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBRqIgFqIhEgCSATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQfDAqoMBaiIUIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogF2oiAmoiEiARIAlzcSAJc2ogEkEadyASQRV3cyASQQd3c2pBloKTzQFqIhcgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAZaiIDaiITIDZqIDIgEmogNSARaiAxIAlqIBMgEiARc3EgEXNqIBNBGncgE0EVd3MgE0EHd3NqQYjY3fEBaiIZIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGmoiAWoiCSATIBJzcSASc2ogCUEadyAJQRV3cyAJQQd3c2pBzO6hugJqIhogASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAYaiICaiIRIAkgE3NxIBNzaiARQRp3IBFBFXdzIBFBB3dzakG1+cKlA2oiGCACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBRqIgNqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQbOZ8MgDaiIUIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogF2oiAWoiE2ogLEEZdyAsQQ53cyAsQQN2cyAoaiA0aiAzQQ93IDNBDXdzIDNBCnZzaiIXIBJqIDcgEWogMyAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakHK1OL2BGoiGyABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBlqIgJqIgkgEyASc3EgEnNqIAlBGncgCUEVd3MgCUEHd3NqQc+U89wFaiIZIAIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGmoiA2oiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pB89+5wQZqIhogAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAYaiIBaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakHuhb6kB2oiHCABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBRqIgJqIhNqIC5BGXcgLkEOd3MgLkEDdnMgKmogNmogLUEZdyAtQQ53cyAtQQN2cyApaiA1aiAXQQ93IBdBDXdzIBdBCnZzaiIUQQ93IBRBDXdzIBRBCnZzaiIYIBJqIDkgEWogFCAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakHvxpXFB2oiCSACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBtqIgNqIhEgEyASc3EgEnNqIBFBGncgEUEVd3MgEUEHd3NqQZTwoaZ4aiIbIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGWoiAWoiEiARIBNzcSATc2ogEkEadyASQRV3cyASQQd3c2pBiISc5nhqIhkgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAaaiICaiITIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakH6//uFeWoiGiACIAFzIANxIAIgAXFzIAJBHncgAkETd3MgAkEKd3NqIBxqIgNqIhQgPGo2AuSJAUEAID8gAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAJaiIBIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBtqIgIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGWoiAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAaaiIJajYC1IkBQQAgPSAvQRl3IC9BDndzIC9BA3ZzICtqIDdqIBhBD3cgGEENd3MgGEEKdnNqIhggEWogFCATIBJzcSASc2ogFEEadyAUQRV3cyAUQQd3c2pB69nBonpqIhkgAWoiEWo2AuCJAUEAIEEgCSADcyACcSAJIANxcyAJQR53IAlBE3dzIAlBCndzaiAZaiIBajYC0IkBQQAgPiAwQRl3IDBBDndzIDBBA3ZzIC9qIBdqIDpBD3cgOkENd3MgOkEKdnNqIBJqIBEgFCATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQffH5vd7aiIXIAJqIhJqNgLciQFBACBDIAEgCXMgA3EgASAJcXMgAUEedyABQRN3cyABQQp3c2ogF2oiAmo2AsyJAUEAIDsgNEEZdyA0QQ53cyA0QQN2cyAwaiA4aiAYQQ93IBhBDXdzIBhBCnZzaiATaiASIBEgFHNxIBRzaiASQRp3IBJBFXdzIBJBB3dzakHy8cWzfGoiESADamo2AtiJAUEAIAAgAiABcyAJcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiARamo2AsiJAQuyBgIEfwF+QQAoAsCJASIAQQJ2QQ9xIgFBAnRBgIkBaiICIAIoAgBBfyAAQQN0IgB0QX9zcUGAASAAdHM2AgACQAJAAkAgAUEOSQ0AAkAgAUEORw0AQQBBADYCvIkBC0GAiQEQA0EAIQIMAQsgAUENRg0BIAFBAWohAgsgAiEDAkBBBiACa0EHcSIARQ0AIAIgAGohAyACQQJ0QYCJAWohAQNAIAFBADYCACABQQRqIQEgAEF/aiIADQALCyACQXlqQQdJDQAgA0ECdCEBA0AgAUGYiQFqQgA3AgAgAUGQiQFqQgA3AgAgAUGIiQFqQgA3AgAgAUGAiQFqQgA3AgAgAUEgaiIBQThHDQALC0EAIQFBAEEAKQPAiQEiBKciAEEbdCAAQQt0QYCA/AdxciAAQQV2QYD+A3EgAEEDdEEYdnJyNgK8iQFBACAEQh2IpyIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYCuIkBQYCJARADQQBBACgC5IkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLkiQFBAEEAKALgiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AuCJAUEAQQAoAtyJASIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYC3IkBQQBBACgC2IkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLYiQFBAEEAKALUiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AtSJAUEAQQAoAtCJASIAQRh0IABBgP4DcUEIdHIgAEEIdkGA/gNxIABBGHZycjYC0IkBQQBBACgCzIkBIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyNgLMiQFBAEEAKALIiQEiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AsiJAQJAQQAoAuiJASICRQ0AQQAhAANAIAFBgAlqIAFByIkBai0AADoAACABQQFqIQEgAiAAQQFqIgBB/wFxSw0ACwsLBgBBgIkBC6MBAEEAQgA3A8CJAUEAQRxBICABQeABRiIBGzYC6IkBQQBCp5/mp8b0k/2+f0Krs4/8kaOz8NsAIAEbNwPgiQFBAEKxloD+n6KFrOgAQv+kuYjFkdqCm38gARs3A9iJAUEAQpe6w4OTp5aHd0Ly5rvjo6f9p6V/IAEbNwPQiQFBAELYvZaI/KC1vjZC58yn0NbQ67O7fyABGzcDyIkBIAAQAhAECwsLAQBBgAgLBHAAAAA=`,hash:`8c18dd94`};new gt,new gt;function Rt(){return It(Lt,32).then(e=>{e.init(256);let t={init:()=>(e.init(256),t),update:n=>(e.update(n),t),digest:t=>e.digest(t),save:()=>e.save(),load:n=>(e.load(n),t),blockSize:64,digestSize:32};return t})}new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt,new gt;var zt=`pi-forge/auth-token`,Bt=`pi-forge/auth-expires-at`,Vt=`pi-forge/auth-must-change-password`;function Ht(){let e=localStorage.getItem(zt),t=localStorage.getItem(Bt);if(!(!e||!t)){if(new Date(t).getTime()<=Date.now()){Wt();return}return{token:e,expiresAt:t,mustChangePassword:localStorage.getItem(Vt)===`true`}}}function Ut(e){localStorage.setItem(zt,e.token),localStorage.setItem(Bt,e.expiresAt),localStorage.setItem(Vt,e.mustChangePassword?`true`:`false`)}function Wt(){localStorage.removeItem(zt),localStorage.removeItem(Bt),localStorage.removeItem(Vt)}var Gt=`pi-forge:unauthorized`,N=class extends Error{status;code;constructor(e,t,n){super(n??`${e} ${t}`),this.status=e,this.code=t}},Kt=[`appBackground`,`panelBackground`,`userBubbleBackground`,`assistantBubbleBackground`,`primaryText`,`secondaryText`,`mutedText`,`highlightBackground`,`highlightText`,`selectionBackground`];function qt(e){let t=()=>e();return window.addEventListener(Gt,t),()=>window.removeEventListener(Gt,t)}function P(e,t){throw new N(e,`invalid_response_body`,t)}function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Jt=(e,t)=>{e!=null&&P(t,`expected empty body`)};function Yt(e,t){return(!F(e)||typeof e.authEnabled!=`boolean`)&&P(t,`expected { authEnabled: boolean }`),{authEnabled:e.authEnabled,ldapEnabled:typeof e.ldapEnabled==`boolean`?e.ldapEnabled:!1}}function Xt(e,t){return(!F(e)||typeof e.token!=`string`||typeof e.expiresAt!=`string`||typeof e.mustChangePassword!=`boolean`)&&P(t,`expected { token, expiresAt, mustChangePassword }`),{token:e.token,expiresAt:e.expiresAt,mustChangePassword:e.mustChangePassword}}function Zt(e,t){return Xt(e,t)}var Qt=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function $t(e,t){if(e===void 0)return;F(e)||P(t,`authColorScheme: expected object`);let n=[`pageBackground`,`cardBackground`,`border`,`text`,`mutedText`,`buttonBackground`,`buttonText`,`buttonHoverBackground`],r={};for(let i of n){let n=e[i];typeof n!=`string`&&P(t,`authColorScheme.${i}: expected string`),Qt.test(n)||P(t,`authColorScheme.${i}: expected hex color`),r[i]=n}return r}function en(e){return typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e)}function tn(e,t,n){F(e)||P(t,`${n}: expected object`);let r={};for(let i of Kt){let a=e[i];en(a)||P(t,`${n}.${i}: expected #rrggbb`),r[i]=a}return r}function nn(e,t){return(!F(e)||typeof e.enabled!=`boolean`)&&P(t,`expected server theme config`),{enabled:e.enabled,colors:tn(e.colors,t,`colors`),defaults:tn(e.defaults,t,`defaults`)}}function rn(e,t){(!F(e)||typeof e.minimal!=`boolean`||typeof e.workspaceRoot!=`string`)&&P(t,`expected { minimal: boolean, workspaceRoot: string }`);let n=typeof e.version==`string`?e.version:`unknown`,r=typeof e.passwordAuthEnabled==`boolean`?e.passwordAuthEnabled:!0,i=typeof e.ldapEnabled==`boolean`?e.ldapEnabled:!1,a=typeof e.orchestrationEnabled==`boolean`?e.orchestrationEnabled:!1,o=typeof e.authBannerText==`string`?e.authBannerText:void 0,s=typeof e.authBannerHtml==`boolean`?e.authBannerHtml:!1,c=e.logoUrlMode===`direct`?`direct`:`cache`,l=typeof e.authLogoUrl==`string`?e.authLogoUrl:void 0,u=typeof e.appLogoDarkUrl==`string`?e.appLogoDarkUrl:void 0,d=typeof e.appLogoLightUrl==`string`?e.appLogoLightUrl:void 0,f=$t(e.authColorScheme,t);return{minimal:e.minimal,workspaceRoot:e.workspaceRoot,version:n,passwordAuthEnabled:r,ldapEnabled:i,orchestrationEnabled:a,serverTheme:e.serverTheme===void 0?void 0:nn(e.serverTheme,t),authBannerText:o,authBannerHtml:s,logoUrlMode:c,authColorScheme:f,authLogoUrl:l,appLogoDarkUrl:u,appLogoLightUrl:d}}function an(e,t){(!F(e)||typeof e.enabled!=`boolean`||!F(e.toolEnv))&&P(t,`expected SandboxSettingsResponse`);let n={};for(let[r,i]of Object.entries(e.toolEnv))typeof i!=`string`&&P(t,`toolEnv values must be strings`),n[r]=i;let r={enabled:e.enabled,toolEnv:n};return typeof e.uid==`number`&&(r.uid=e.uid),typeof e.gid==`number`&&(r.gid=e.gid),typeof e.home==`string`&&(r.home=e.home),r}function on(e,t){return(!F(e)||e.status!==`ok`||typeof e.activeSessions!=`number`||typeof e.activePtys!=`number`)&&P(t,`expected { status: 'ok', activeSessions, activePtys }`),{status:`ok`,activeSessions:e.activeSessions,activePtys:e.activePtys}}function sn(e,t){return(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.path!=`string`||typeof e.createdAt!=`string`)&&P(t,`expected Project`),{id:e.id,name:e.name,path:e.path,createdAt:e.createdAt}}function cn(e,t){return(!F(e)||!Array.isArray(e.projects))&&P(t,`expected { projects: Project[] }`),{projects:e.projects.map(e=>sn(e,t))}}function ln(e,t){return(!F(e)||typeof e.name!=`string`||typeof e.path!=`string`||typeof e.isGitRepo!=`boolean`)&&P(t,`expected BrowseEntry`),{name:e.name,path:e.path,isGitRepo:e.isGitRepo}}function un(e,t){return(!F(e)||typeof e.path!=`string`||!(e.parentPath===null||e.parentPath===void 0||typeof e.parentPath==`string`)||!Array.isArray(e.entries))&&P(t,`expected BrowseResponse`),{path:e.path,parentPath:typeof e.parentPath==`string`?e.parentPath:null,entries:e.entries.map(e=>ln(e,t))}}function dn(e,t){return(!F(e)||typeof e.path!=`string`)&&P(t,`expected { path }`),{path:e.path}}function fn(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.isLive!=`boolean`||typeof e.workspacePath!=`string`||typeof e.lastActivityAt!=`string`||typeof e.createdAt!=`string`||typeof e.messageCount!=`number`||typeof e.firstMessage!=`string`)&&P(t,`expected UnifiedSession`);let n={sessionId:e.sessionId,projectId:e.projectId,isLive:e.isLive,workspacePath:e.workspacePath,lastActivityAt:e.lastActivityAt,createdAt:e.createdAt,messageCount:e.messageCount,firstMessage:e.firstMessage};return typeof e.name==`string`&&(n.name=e.name),typeof e.parentSessionId==`string`&&(n.parentSessionId=e.parentSessionId),typeof e.runId==`string`&&(n.runId=e.runId),typeof e.isExternalLive==`boolean`&&(n.isExternalLive=e.isExternalLive),(e.externalState===`queued`||e.externalState===`running`||e.externalState===`complete`||e.externalState===`failed`||e.externalState===`paused`)&&(n.externalState=e.externalState),typeof e.path==`string`&&(n.path=e.path),n}function pn(e,t){return(!F(e)||!Array.isArray(e.sessions))&&P(t,`expected { sessions: UnifiedSession[] }`),{sessions:e.sessions.map(e=>fn(e,t))}}function mn(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.workspacePath!=`string`||typeof e.createdAt!=`string`||typeof e.lastActivityAt!=`string`||typeof e.isLive!=`boolean`||typeof e.messageCount!=`number`||typeof e.isStreaming!=`boolean`)&&P(t,`expected SessionSummary`);let n={sessionId:e.sessionId,projectId:e.projectId,workspacePath:e.workspacePath,createdAt:e.createdAt,lastActivityAt:e.lastActivityAt,isLive:e.isLive,messageCount:e.messageCount,isStreaming:e.isStreaming};return typeof e.name==`string`&&(n.name=e.name),typeof e.thinkingLevel==`string`&&(n.thinkingLevel=e.thinkingLevel),typeof e.modelProvider==`string`&&(n.modelProvider=e.modelProvider),typeof e.modelId==`string`&&(n.modelId=e.modelId),n}function hn(e,t){(!F(e)||e.accepted!==!0)&&P(t,`expected { accepted: true }`);let n={accepted:!0};return typeof e.sessionName==`string`&&(n.sessionName=e.sessionName),n}function gn(e,t){(!F(e)||typeof e.name!=`string`||typeof e.description!=`string`||e.source!==`global`&&e.source!==`project`&&e.source!==`extension`||typeof e.filePath!=`string`||typeof e.enabled!=`boolean`||typeof e.effective!=`boolean`||typeof e.disableModelInvocation!=`boolean`)&&P(t,`expected SkillSummary`);let n={name:e.name,description:e.description,source:e.source,filePath:e.filePath,enabled:e.enabled,effective:e.effective,disableModelInvocation:e.disableModelInvocation};return typeof e.extensionPath==`string`&&(n.extensionPath=e.extensionPath),(e.projectOverride===`enabled`||e.projectOverride===`disabled`)&&(n.projectOverride=e.projectOverride),n}function _n(e,t){return(!F(e)||!Array.isArray(e.skills))&&P(t,`expected { skills: SkillSummary[] }`),{skills:e.skills.map(e=>gn(e,t))}}function vn(e,t){(!F(e)||!Array.isArray(e.skills)||!Array.isArray(e.diagnostics))&&P(t,`expected { skills: SkillSummary[], diagnostics: SkillDiagnostic[] }`);let n=[];for(let t of e.diagnostics){if(!F(t)||t.type!==`warning`&&t.type!==`error`&&t.type!==`collision`||typeof t.message!=`string`)continue;let e={type:t.type,message:t.message};typeof t.path==`string`&&(e.path=t.path),F(t.collision)&&typeof t.collision.resourceType==`string`&&typeof t.collision.name==`string`&&typeof t.collision.winnerPath==`string`&&typeof t.collision.loserPath==`string`&&(e.collision={resourceType:t.collision.resourceType,name:t.collision.name,winnerPath:t.collision.winnerPath,loserPath:t.collision.loserPath}),n.push(e)}return{skills:e.skills.map(e=>gn(e,t)),diagnostics:n}}function yn(e,t){(!F(e)||!F(e.projects))&&P(t,`expected { projects: { ... } }`);let n={};for(let[t,r]of Object.entries(e.projects))F(r)&&(n[t]={enable:Array.isArray(r.enable)?r.enable.filter(e=>typeof e==`string`):[],disable:Array.isArray(r.disable)?r.disable.filter(e=>typeof e==`string`):[]});return{projects:n}}function bn(e,t){(!F(e)||typeof e.name!=`string`||typeof e.description!=`string`||e.source!==`global`&&e.source!==`project`||typeof e.filePath!=`string`||typeof e.enabled!=`boolean`||typeof e.effective!=`boolean`)&&P(t,`expected PromptSummary`);let n={name:e.name,description:e.description,source:e.source,filePath:e.filePath,enabled:e.enabled,effective:e.effective};return typeof e.argumentHint==`string`&&(n.argumentHint=e.argumentHint),(e.projectOverride===`enabled`||e.projectOverride===`disabled`)&&(n.projectOverride=e.projectOverride),n}function xn(e,t){return(!F(e)||!Array.isArray(e.prompts))&&P(t,`expected { prompts: PromptSummary[] }`),{prompts:e.prompts.map(e=>bn(e,t))}}function Sn(e,t){(!F(e)||!Array.isArray(e.prompts)||!Array.isArray(e.diagnostics))&&P(t,`expected { prompts: PromptSummary[], diagnostics: SkillDiagnostic[] }`);let n=[];for(let t of e.diagnostics){if(!F(t)||t.type!==`warning`&&t.type!==`error`&&t.type!==`collision`||typeof t.message!=`string`)continue;let e={type:t.type,message:t.message};typeof t.path==`string`&&(e.path=t.path),F(t.collision)&&typeof t.collision.resourceType==`string`&&typeof t.collision.name==`string`&&typeof t.collision.winnerPath==`string`&&typeof t.collision.loserPath==`string`&&(e.collision={resourceType:t.collision.resourceType,name:t.collision.name,winnerPath:t.collision.winnerPath,loserPath:t.collision.loserPath}),n.push(e)}return{prompts:e.prompts.map(e=>bn(e,t)),diagnostics:n}}var Cn=yn;function wn(e,t){return(!F(e)||!Array.isArray(e.providers))&&P(t,`expected { providers: [...] }`),{providers:e.providers}}function Tn(e,t){return(!F(e)||!F(e.servers)||!Array.isArray(e.status))&&P(t,`expected { servers, status[] }`),e}function En(e,t){return(!F(e)||typeof e.enabled!=`boolean`||typeof e.connected!=`number`||typeof e.total!=`number`||!F(e.truncation)||typeof e.truncation.enabled!=`boolean`||typeof e.truncation.maxChars!=`number`)&&P(t,`expected { enabled, connected, total, truncation }`),{enabled:e.enabled,connected:e.connected,total:e.total,truncation:{enabled:e.truncation.enabled,maxChars:e.truncation.maxChars}}}function Dn(e,t){return(!F(e)||!F(e.status))&&P(t,`expected { status: {...} }`),{status:e.status}}function On(e,t){return(!F(e)||!Array.isArray(e.tools))&&P(t,`expected { tools: [...] }`),{tools:e.tools}}function kn(e,t){return(!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}}function An(e,t){return(!F(e)||typeof e.removed!=`boolean`)&&P(t,`expected { removed: boolean }`),{removed:e.removed}}function jn(e,t){return(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`)&&P(t,`expected QuickAction shape`),e}function Mn(e,t){return(!F(e)||!Array.isArray(e.actions))&&P(t,`expected { actions: [...] }`),{actions:e.actions}}function Nn(e,t){(!F(e)||typeof e.success!=`boolean`||typeof e.stdout!=`string`||typeof e.stderr!=`string`||typeof e.durationMs!=`number`||typeof e.timedOut!=`boolean`||typeof e.truncated!=`boolean`)&&P(t,`expected QuickActionRunResult shape`);let n=e.exitCode;return{success:e.success,exitCode:typeof n==`number`?n:null,stdout:e.stdout,stderr:e.stderr,durationMs:e.durationMs,timedOut:e.timedOut,truncated:e.truncated}}function Pn(e,t){return(!F(e)||!Array.isArray(e.processes))&&P(t,`expected { processes: [...] }`),{processes:e.processes}}function Fn(e,t){return(!F(e)||!Array.isArray(e.stdout)||!Array.isArray(e.stderr)||typeof e.status!=`string`)&&P(t,`expected { stdout, stderr, status }`),{stdout:e.stdout,stderr:e.stderr,status:e.status}}function In(e,t){(!F(e)||typeof e.ok!=`boolean`)&&P(t,`expected { ok: boolean }`);let n={ok:e.ok};return typeof e.reason==`string`&&(n.reason=e.reason),n}var Ln=[`agent_end`,`ask_user_question`,`process_alert`,`auto_retry_end`,`compaction_end`,`session_created`,`session_deleted`];function Rn(e,t){(!F(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.url!=`string`||!Array.isArray(e.events)||!F(e.scope)||typeof e.enabled!=`boolean`||typeof e.hasSecret!=`boolean`||typeof e.createdAt!=`string`)&&P(t,`expected webhook config`);let n=e.scope,r;n.kind===`global`?r={kind:`global`}:n.kind===`project`&&typeof n.projectId==`string`?r={kind:`project`,projectId:n.projectId}:P(t,`bad scope`);let i={id:e.id,name:e.name,url:e.url,events:e.events.filter(e=>typeof e==`string`&&Ln.includes(e)),scope:r,enabled:e.enabled,hasSecret:e.hasSecret,createdAt:e.createdAt};return F(e.headers)&&(i.headers=Object.fromEntries(Object.entries(e.headers).filter(([,e])=>typeof e==`string`))),e.insecureTls===!0&&(i.insecureTls=!0),i}function zn(e,t){return(!F(e)||!Array.isArray(e.webhooks))&&P(t,`expected { webhooks: [...] }`),{webhooks:e.webhooks.map(e=>Rn(e,t))}}function Bn(e,t){return(!F(e)||!Array.isArray(e.deliveries))&&P(t,`expected { deliveries: [...] }`),{deliveries:e.deliveries}}function Vn(e,t){return(!F(e)||!Array.isArray(e.tasks)||typeof e.nextId!=`number`)&&P(t,`expected { tasks: [...], nextId: number }`),{tasks:e.tasks,nextId:e.nextId}}function Hn(e,t){return(!F(e)||typeof e.enabled!=`boolean`||typeof e.maxWorkersPerSupervisor!=`number`||typeof e.maxDepth!=`number`||typeof e.disabledReason!=`string`)&&P(t,`expected orchestration config`),{enabled:e.enabled,maxWorkersPerSupervisor:e.maxWorkersPerSupervisor,maxDepth:e.maxDepth,disabledReason:e.disabledReason}}function Un(e,t){(!F(e)||typeof e.sessionId!=`string`||typeof e.role!=`string`)&&P(t,`expected session link`);let n=e.role;n!==`supervisor`&&n!==`worker`&&n!==`standalone`&&P(t,`bad session role`);let r={sessionId:e.sessionId,role:n};if(typeof e.supervisorId==`string`&&(r.supervisorId=e.supervisorId),Array.isArray(e.workerIds)&&(r.workerIds=e.workerIds.filter(e=>typeof e==`string`)),typeof e.pendingInbox==`number`&&(r.pendingInbox=e.pendingInbox),typeof e.enabledAt==`string`&&(r.enabledAt=e.enabledAt),typeof e.spawnedAt==`string`&&(r.spawnedAt=e.spawnedAt),F(e.spawnedFrom)&&typeof e.spawnedFrom.sessionId==`string`){let t=e.spawnedFrom.mode;(t===`fresh`||t===`summary`)&&(r.spawnedFrom={sessionId:e.spawnedFrom.sessionId,mode:t})}return r}function Wn(e,t){(!F(e)||!Array.isArray(e.workers))&&P(t,`expected { workers: [...] }`);let n=[];for(let t of e.workers){if(!F(t)||typeof t.workerId!=`string`||typeof t.isLive!=`boolean`)continue;let e={workerId:t.workerId,isLive:t.isLive};typeof t.isStreaming==`boolean`&&(e.isStreaming=t.isStreaming),(t.state===`streaming`||t.state===`idle`||t.state===`cold`)&&(e.state=t.state),typeof t.name==`string`&&(e.name=t.name),typeof t.lastActivityAt==`string`&&(e.lastActivityAt=t.lastActivityAt),typeof t.messageCount==`number`&&(e.messageCount=t.messageCount),typeof t.projectId==`string`&&(e.projectId=t.projectId),typeof t.spawnedAt==`string`&&(e.spawnedAt=t.spawnedAt),F(t.spawnedFrom)&&typeof t.spawnedFrom.sessionId==`string`&&typeof t.spawnedFrom.mode==`string`&&(e.spawnedFrom={sessionId:t.spawnedFrom.sessionId,mode:t.spawnedFrom.mode}),n.push(e)}return{workers:n}}function Gn(e,t){(!F(e)||!Array.isArray(e.items))&&P(t,`expected { items: [...] }`);let n=[];for(let t of e.items)!F(t)||typeof t.id!=`string`||typeof t.type!=`string`||typeof t.workerId!=`string`||typeof t.occurredAt!=`string`||!F(t.data)||typeof t.delivered!=`boolean`||n.push({id:t.id,type:t.type,workerId:t.workerId,occurredAt:t.occurredAt,data:t.data,delivered:t.delivered});return{items:n}}function Kn(e,t){return(!F(e)||!F(e.providers))&&P(t,`expected { providers: { ... } }`),e}function qn(e,t){return F(e)||P(t,`expected settings object`),e}function Jn(e,t){return(!F(e)||!F(e.providers))&&P(t,`expected { providers: {...} }`),e}function Yn(e,t){F(e)||P(t,`expected FileTreeNode`);let n=e.type;(typeof e.name!=`string`||typeof e.path!=`string`||n!==`file`&&n!==`directory`)&&P(t,`expected FileTreeNode`);let r={name:e.name,path:e.path,type:n};return Array.isArray(e.children)&&(r.children=e.children.map(e=>Yn(e,t))),typeof e.truncated==`boolean`&&(r.truncated=e.truncated),r}function Xn(e,t){return(!F(e)||typeof e.path!=`string`||typeof e.content!=`string`||typeof e.size!=`number`||typeof e.language!=`string`||typeof e.binary!=`boolean`)&&P(t,`expected FileReadResponse`),{path:e.path,content:e.content,size:e.size,language:e.language,binary:e.binary}}function Zn(e,t){return(!F(e)||!Array.isArray(e.entries))&&P(t,`expected { entries: TurnDiffEntry[] }`),{entries:e.entries.map(e=>((!F(e)||typeof e.file!=`string`||e.tool!==`write`&&e.tool!==`edit`||typeof e.diff!=`string`||typeof e.additions!=`number`||typeof e.deletions!=`number`||typeof e.isPureAddition!=`boolean`)&&P(t,`expected TurnDiffEntry`),{file:e.file,tool:e.tool,diff:e.diff,additions:e.additions,deletions:e.deletions,isPureAddition:e.isPureAddition}))}}function Qn(e,t){(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.files))&&P(t,`expected GitStatus`);let n={isGitRepo:e.isGitRepo,files:e.files.map(e=>{(!F(e)||typeof e.path!=`string`||typeof e.staged!=`boolean`||typeof e.unstaged!=`boolean`||typeof e.kind!=`string`||typeof e.code!=`string`)&&P(t,`expected GitFileStatus`);let n={path:e.path,staged:e.staged,unstaged:e.unstaged,kind:e.kind,code:e.code};return typeof e.originalPath==`string`&&(n.originalPath=e.originalPath),n})};return typeof e.branch==`string`&&(n.branch=e.branch),n}function $n(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||typeof e.diff!=`string`)&&P(t,`expected GitDiffResponse`),{isGitRepo:e.isGitRepo,diff:e.diff}}function er(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.commits))&&P(t,`expected GitLogResponse`),{isGitRepo:e.isGitRepo,commits:e.commits.map(e=>((!F(e)||typeof e.hash!=`string`||typeof e.message!=`string`||typeof e.author!=`string`||typeof e.date!=`string`||!Array.isArray(e.parents)||!Array.isArray(e.refs))&&P(t,`expected GitLogEntry`),{hash:e.hash,message:e.message,author:e.author,date:e.date,parents:e.parents.filter(e=>typeof e==`string`),refs:e.refs.filter(e=>typeof e==`string`)}))}}function tr(e,t){(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.branches))&&P(t,`expected GitBranchesResponse`);let n={isGitRepo:e.isGitRepo,branches:e.branches.map(e=>((!F(e)||typeof e.name!=`string`||typeof e.current!=`boolean`||typeof e.remote!=`boolean`)&&P(t,`expected GitBranch`),{name:e.name,current:e.current,remote:e.remote}))};return typeof e.current==`string`&&(n.current=e.current),n}function nr(e,t){(!F(e)||!Array.isArray(e.messages)||typeof e.totalInputTokens!=`number`||typeof e.totalOutputTokens!=`number`||typeof e.totalCacheReadTokens!=`number`||typeof e.totalCacheWriteTokens!=`number`||typeof e.totalTokens!=`number`||typeof e.totalCost!=`number`||!Array.isArray(e.turns)||!F(e.contextUsage))&&P(t,`expected SessionContextResponse`);let n=e.turns.map(e=>{(!F(e)||typeof e.index!=`number`||typeof e.inputTokens!=`number`||typeof e.outputTokens!=`number`||typeof e.cacheReadTokens!=`number`||typeof e.cacheWriteTokens!=`number`||typeof e.totalTokens!=`number`||typeof e.cost!=`number`||typeof e.model!=`string`||typeof e.provider!=`string`||typeof e.timestamp!=`number`)&&P(t,`expected ContextTurn`);let n={index:e.index,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheReadTokens:e.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens,totalTokens:e.totalTokens,cost:e.cost,model:e.model,provider:e.provider,timestamp:e.timestamp};return typeof e.stopReason==`string`&&(n.stopReason=e.stopReason),n}),r=e.contextUsage,i={contextWindow:typeof r.contextWindow==`number`?r.contextWindow:0};return typeof r.tokens==`number`&&(i.tokens=r.tokens),typeof r.percent==`number`&&(i.percent=r.percent),{messages:e.messages.filter(e=>F(e)),totalInputTokens:e.totalInputTokens,totalOutputTokens:e.totalOutputTokens,totalCacheReadTokens:e.totalCacheReadTokens,totalCacheWriteTokens:e.totalCacheWriteTokens,totalTokens:e.totalTokens,totalCost:e.totalCost,turns:n,contextUsage:i}}function rr(e,t){(!F(e)||!(e.leafId===null||typeof e.leafId==`string`)||!Array.isArray(e.branchIds)||!Array.isArray(e.entries))&&P(t,`expected SessionTreeResponse`);let n=e.branchIds.filter(e=>typeof e==`string`),r=e.entries.map(e=>{(!F(e)||typeof e.id!=`string`||!(e.parentId===null||typeof e.parentId==`string`)||typeof e.type!=`string`||typeof e.timestamp!=`string`)&&P(t,`expected SessionTreeEntry`);let n={id:e.id,parentId:e.parentId,type:e.type,timestamp:e.timestamp};return typeof e.role==`string`&&(n.role=e.role),typeof e.preview==`string`&&(n.preview=e.preview),typeof e.label==`string`&&(n.label=e.label),n});return{leafId:e.leafId,branchIds:n,entries:r}}function ir(e,t){return(!F(e)||!Array.isArray(e.files))&&P(t,`expected { files: UploadedFile[] }`),{files:e.files.map(e=>((!F(e)||typeof e.path!=`string`||typeof e.size!=`number`||typeof e.sha256!=`string`)&&P(t,`expected UploadedFile`),{path:e.path,size:e.size,sha256:e.sha256}))}}function ar(e,t){return(!F(e)||e.engine!==`ripgrep`&&e.engine!==`node`||typeof e.truncated!=`boolean`||!Array.isArray(e.matches))&&P(t,`expected SearchResponse`),{engine:e.engine,truncated:e.truncated,matches:e.matches.map(e=>((!F(e)||typeof e.path!=`string`||typeof e.line!=`number`||typeof e.column!=`number`||typeof e.length!=`number`||typeof e.lineSnippet!=`string`)&&P(t,`expected SearchMatch`),{path:e.path,line:e.line,column:e.column,length:e.length,lineSnippet:e.lineSnippet}))}}function or(e,t){return(!F(e)||e.engine!==`ripgrep`&&e.engine!==`node`||typeof e.truncated!=`boolean`||!Array.isArray(e.results))&&P(t,`expected SessionSearchResponse`),{engine:e.engine,truncated:e.truncated,results:e.results.map(e=>{(!F(e)||typeof e.sessionId!=`string`||typeof e.projectId!=`string`||typeof e.projectName!=`string`||typeof e.modifiedAt!=`string`||!Array.isArray(e.matches))&&P(t,`expected SessionSearchGroup`);let n={sessionId:e.sessionId,projectId:e.projectId,projectName:e.projectName,modifiedAt:e.modifiedAt,matches:e.matches.map(e=>{(!F(e)||typeof e.messageIndex!=`number`||e.kind!==`user`&&e.kind!==`assistant`&&e.kind!==`tool_call`||typeof e.snippet!=`string`||typeof e.matchOffset!=`number`||typeof e.matchLength!=`number`)&&P(t,`expected SessionSearchMatch`);let n={messageIndex:e.messageIndex,kind:e.kind,snippet:e.snippet,matchOffset:e.matchOffset,matchLength:e.matchLength};return typeof e.messageEnvelopeId==`string`&&(n.messageEnvelopeId=e.messageEnvelopeId),n})};return typeof e.sessionName==`string`&&(n.sessionName=e.sessionName),n})}}function sr(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.remotes))&&P(t,`expected GitRemotesResponse`),{isGitRepo:e.isGitRepo,remotes:e.remotes.map(e=>((!F(e)||typeof e.name!=`string`||typeof e.fetchUrl!=`string`||typeof e.pushUrl!=`string`||typeof e.insecureTls!=`boolean`)&&P(t,`expected GitRemote`),{name:e.name,fetchUrl:e.fetchUrl,pushUrl:e.pushUrl,insecureTls:e.insecureTls}))}}function cr(e,t){return(!F(e)||typeof e.isGitRepo!=`boolean`||!Array.isArray(e.worktrees))&&P(t,`expected GitWorktreesResponse`),{isGitRepo:e.isGitRepo,worktrees:e.worktrees.map(e=>{(!F(e)||typeof e.path!=`string`||typeof e.bare!=`boolean`||typeof e.detached!=`boolean`||typeof e.current!=`boolean`)&&P(t,`expected GitWorktree`);let n={path:e.path,bare:e.bare,detached:e.detached,current:e.current};return typeof e.head==`string`&&(n.head=e.head),typeof e.branch==`string`&&(n.branch=e.branch),n})}}function lr(e,t){return(!F(e)||typeof e.path!=`string`)&&P(t,`expected { path: string }`),{path:e.path}}async function ur(e,t){let n=await Rt();n.init();let r=e.stream().getReader(),i=!1;try{for(;;){let{value:e,done:i}=await r.read();if(i)break;n.update(e),t?.(e.byteLength)}}catch(e){throw i=!0,await r.cancel().catch(()=>void 0),e}finally{i||r.releaseLock()}return n.digest(`hex`)}function dr(e){let t=e,n=t.uploadRelativePath??t.webkitRelativePath;return n!==void 0&&n.length>0?n:e.name}function fr(e){let t=/filename\*=UTF-8''([^;\r\n]+)/i.exec(e);if(t!==null)try{return decodeURIComponent(t[1])}catch{}let n=/filename="([^"]+)"/i.exec(e)??/filename=([^;\r\n]+)/i.exec(e);if(n!==null)return n[1]}function pr(e){if(e===``)return{ok:!0,value:void 0};try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}async function I(e,t,n={}){let r={Accept:`application/json`};if(!n.skipAuth){let e=Ht();e&&(r.Authorization=`Bearer ${e.token}`)}let i=n.body instanceof FormData;n.body!==void 0&&!i&&(r[`Content-Type`]=`application/json`);let a={method:n.method??`GET`,headers:r};n.body!==void 0&&(a.body=i?n.body:JSON.stringify(n.body)),n.signal!==void 0&&(a.signal=n.signal);let o;try{o=await fetch(e,a)}catch(e){throw e instanceof Error&&e.name===`AbortError`?e:new N(0,`network_error`,e.message)}o.status===401&&!n.skipAuth&&(Wt(),window.dispatchEvent(new Event(Gt)));let s=await o.text(),c=pr(s);if(!o.ok){let e;throw e=c.ok&&F(c.value)&&`error`in c.value?String(c.value.error):c.ok?`request_failed`:`invalid_error_body`,new N(o.status,e,c.ok?void 0:`non-JSON ${o.status} body`)}if(!c.ok){if(s.length===0)return t(void 0,o.status);throw new N(o.status,`invalid_response_body`,`server returned non-JSON 2xx body`)}return t(c.value,o.status)}function mr(e,t,n){let r=new URLSearchParams({projectId:e});if(t!==void 0&&r.set(`worktreePath`,t),n!==void 0)for(let[e,t]of Object.entries(n))r.set(e,t);return r.toString()}var L={authStatus:()=>I(`/api/v1/auth/status`,Yt,{skipAuth:!0}),login:(e,t)=>I(`/api/v1/auth/login`,Xt,{method:`POST`,body:t===void 0?{password:e}:{username:t,password:e},skipAuth:!0}),changePassword:(e,t)=>I(`/api/v1/auth/change-password`,Zt,{method:`POST`,body:{currentPassword:e,newPassword:t}}),health:()=>I(`/api/v1/health`,on,{skipAuth:!0}),uiConfig:()=>I(`/api/v1/ui-config`,rn,{skipAuth:!0}),listProjects:()=>I(`/api/v1/projects`,cn),createProject:(e,t)=>I(`/api/v1/projects`,sn,{method:`POST`,body:{name:e,path:t}}),renameProject:(e,t)=>I(`/api/v1/projects/${encodeURIComponent(e)}`,sn,{method:`PATCH`,body:{name:t}}),reorderProjects:e=>I(`/api/v1/projects/order`,cn,{method:`PUT`,body:{ids:e}}),deleteProject:e=>I(`/api/v1/projects/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.cascaded!=`boolean`)&&P(t,`expected { cascaded }`),{cascaded:e.cascaded}),{method:`DELETE`}),browse:e=>I(`/api/v1/projects/browse${e===void 0?``:`?path=${encodeURIComponent(e)}`}`,un),getProjectSystemPrompt:e=>I(`/api/v1/projects/${encodeURIComponent(e)}/system-prompt`,(e,t)=>((!F(e)||typeof e.addendum!=`string`||typeof e.maxBytes!=`number`)&&P(t,`expected { addendum: string, maxBytes: number }`),{addendum:e.addendum,maxBytes:e.maxBytes})),setProjectSystemPrompt:(e,t)=>I(`/api/v1/projects/${encodeURIComponent(e)}/system-prompt`,(e,t)=>((!F(e)||typeof e.addendum!=`string`||typeof e.maxBytes!=`number`)&&P(t,`expected { addendum: string, maxBytes: number }`),{addendum:e.addendum,maxBytes:e.maxBytes}),{method:`PUT`,body:{addendum:t}}),mkdir:(e,t)=>I(`/api/v1/projects/browse/mkdir`,dn,{method:`POST`,body:{parentPath:e,name:t}}),cloneProject:async(e,t)=>{let n={"Content-Type":`application/json`,Accept:`text/event-stream`},r=Ht();r&&(n.Authorization=`Bearer ${r.token}`);let i={method:`POST`,headers:n,body:JSON.stringify(e)};t!==void 0&&(i.signal=t);let a=await fetch(`/api/v1/projects/clone`,i);if(a.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`invalid_token`);if(!a.ok){let e;try{e=await a.json()}catch{}let t=typeof e?.error==`string`?e.error:`clone_failed`,n=typeof e?.message==`string`?e.message:void 0;throw new N(a.status,t,n)}return a},listSessions:e=>I(`/api/v1/sessions${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,pn),createSession:e=>I(`/api/v1/sessions`,mn,{method:`POST`,body:{projectId:e}}),getSession:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}`,mn),getMessages:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/messages`,(e,t)=>((!F(e)||!Array.isArray(e.messages))&&P(t,`expected { messages: [...] }`),{messages:e.messages})),getCompactions:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/compactions`,(e,t)=>((!F(e)||!Array.isArray(e.compactions))&&P(t,`expected { compactions: [...] }`),{compactions:e.compactions})),disposeSession:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),renameSession:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/name`,mn,{method:`POST`,body:{name:t}}),getSessionContext:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/context`,nr,t===void 0?{}:{signal:t}),getSessionTree:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/tree`,rr),navigateSession:(e,t,n)=>{let r={entryId:t};return n?.summarize!==void 0&&(r.summarize=n.summarize),n?.customInstructions!==void 0&&(r.customInstructions=n.customInstructions),n?.label!==void 0&&(r.label=n.label),I(`/api/v1/sessions/${encodeURIComponent(e)}/navigate`,(e,t)=>(F(e)||P(t,`expected navigate result`),e),{method:`POST`,body:r})},forkSession:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/fork`,mn,{method:`POST`,body:{entryId:t}}),getTurnDiff:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/turn-diff`,Zn),prompt:(e,t,n)=>{let r=`/api/v1/sessions/${encodeURIComponent(e)}/prompt`;if(n?.attachments!==void 0&&n.attachments.length>0){let e=new FormData;e.append(`text`,t),n.streamingBehavior!==void 0&&e.append(`streamingBehavior`,n.streamingBehavior);for(let t of n.attachments)e.append(`attachments`,t,t.name);return I(r,hn,{method:`POST`,body:e})}let i={text:t};return n?.streamingBehavior!==void 0&&(i.streamingBehavior=n.streamingBehavior),I(r,hn,{method:`POST`,body:i})},steer:(e,t,n)=>{let r={text:t};return n!==void 0&&(r.mode=n),I(`/api/v1/sessions/${encodeURIComponent(e)}/steer`,hn,{method:`POST`,body:r})},abort:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/abort`,Jt,{method:`POST`}),compact:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/compact`,(e,t)=>(F(e)||P(t,`expected compact result object`),{summary:typeof e.summary==`string`?e.summary:void 0,tokensBefore:typeof e.tokensBefore==`number`?e.tokensBefore:void 0,tokensAfter:typeof e.tokensAfter==`number`?e.tokensAfter:void 0}),{method:`POST`,body:{}}),exec:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/exec`,(e,t)=>((!F(e)||!(`exitCode`in e)||typeof e.output!=`string`||typeof e.durationMs!=`number`||typeof e.truncated!=`boolean`||typeof e.cancelled!=`boolean`)&&P(t,`expected { exitCode, output, durationMs, truncated, cancelled }`),{exitCode:typeof e.exitCode==`number`?e.exitCode:null,output:e.output,durationMs:e.durationMs,truncated:e.truncated,cancelled:e.cancelled}),{method:`POST`,body:{command:t,excludeFromContext:n?.excludeFromContext===!0}}),setModel:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/model`,(e,t)=>((!F(e)||typeof e.provider!=`string`||typeof e.modelId!=`string`)&&P(t,`expected { provider, modelId }`),{provider:e.provider,modelId:e.modelId}),{method:`POST`,body:{provider:t,modelId:n}}),setThinkingLevel:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/thinking-level`,(e,t)=>((!F(e)||typeof e.level!=`string`)&&P(t,`expected { level }`),{level:e.level}),{method:`POST`,body:{level:t}}),getModelsJson:()=>I(`/api/v1/config/models`,Jn),setModelsJson:e=>I(`/api/v1/config/models`,Jn,{method:`PUT`,body:e}),getProviders:()=>I(`/api/v1/config/providers`,wn),getSettings:()=>I(`/api/v1/config/settings`,qn),updateSettings:e=>I(`/api/v1/config/settings`,qn,{method:`PUT`,body:e}),getSandboxSettings:()=>I(`/api/v1/config/sandbox`,an),updateSandboxSettings:e=>I(`/api/v1/config/sandbox`,an,{method:`PUT`,body:{toolEnv:e}}),getServerTheme:()=>I(`/api/v1/config/theme`,nn),updateServerTheme:e=>I(`/api/v1/config/theme`,nn,{method:`PUT`,body:e}),resetServerTheme:()=>I(`/api/v1/config/theme`,nn,{method:`DELETE`}),getAuthSummary:()=>I(`/api/v1/config/auth`,Kn),setApiKey:(e,t)=>I(`/api/v1/config/auth/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.provider!=`string`||e.configured!==!0)&&P(t,`expected { provider, configured: true }`),{provider:e.provider,configured:!0}),{method:`PUT`,body:{apiKey:t}}),removeApiKey:e=>I(`/api/v1/config/auth/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),getMcpSettings:()=>I(`/api/v1/mcp/settings`,En),setMcpEnabled:e=>I(`/api/v1/mcp/settings`,En,{method:`PUT`,body:{enabled:e}}),setMcpTruncation:e=>I(`/api/v1/mcp/settings`,En,{method:`PUT`,body:{truncation:e}}),listMcpServers:e=>I(`/api/v1/mcp/servers${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,Tn),upsertMcpServer:(e,t)=>I(`/api/v1/mcp/servers/${encodeURIComponent(e)}`,kn,{method:`PUT`,body:t}),deleteMcpServer:e=>I(`/api/v1/mcp/servers/${encodeURIComponent(e)}`,An,{method:`DELETE`}),probeMcpServer:(e,t)=>{let n=t===void 0?``:`?projectId=${encodeURIComponent(t)}`;return I(`/api/v1/mcp/servers/${encodeURIComponent(e)}/probe${n}`,Dn,{method:`POST`,body:{}})},listMcpTools:e=>I(`/api/v1/mcp/tools?projectId=${encodeURIComponent(e)}`,On),grantStdioMcpTrust:e=>I(`/api/v1/mcp/trust/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.trusted!=`boolean`||!Array.isArray(e.status))&&P(t,`expected { trusted, status }`),{trusted:e.trusted,status:e.status}),{method:`POST`,body:{}}),revokeStdioMcpTrust:e=>I(`/api/v1/mcp/trust/${encodeURIComponent(e)}`,(e,t)=>((!F(e)||typeof e.trusted!=`boolean`)&&P(t,`expected { trusted }`),{trusted:e.trusted}),{method:`DELETE`}),listQuickActions:()=>I(`/api/v1/quick-actions`,Mn),createQuickAction:e=>I(`/api/v1/quick-actions`,jn,{method:`POST`,body:e}),updateQuickAction:(e,t)=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}`,jn,{method:`PUT`,body:t}),deleteQuickAction:e=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),runQuickAction:(e,t)=>I(`/api/v1/quick-actions/${encodeURIComponent(e)}/run`,Nn,{method:`POST`,body:{projectId:t}}),submitAskUserQuestionAnswer:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/ask-user-question/answer`,Jt,{method:`POST`,body:t}),cancelAskUserQuestion:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/ask-user-question/answer`,Jt,{method:`POST`,body:{requestId:t,cancelled:!0,answers:[]}}),listTodos:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/todos`,Vn),listProcesses:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes`,Pn),getProcessOutput:(e,t,n)=>{let r=n===void 0?``:`?tail=${n}`;return I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/output${r}`,Fn)},processLogFileUrl:(e,t,n)=>`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/logs/file?stream=${n}`,killProcess:(e,t)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`,In,{method:`POST`,body:{}}),clearProcesses:e=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes`,(e,t)=>((!F(e)||typeof e.cleared!=`number`)&&P(t,`expected { cleared: number }`),{cleared:e.cleared}),{method:`DELETE`}),writeProcessStdin:(e,t,n)=>I(`/api/v1/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/stdin`,In,{method:`POST`,body:n}),listWebhooks:e=>I(`/api/v1/webhooks${e===void 0?``:`?projectId=${encodeURIComponent(e)}`}`,zn),createWebhook:e=>I(`/api/v1/webhooks`,Rn,{method:`POST`,body:e}),updateWebhook:(e,t)=>I(`/api/v1/webhooks/${encodeURIComponent(e)}`,Rn,{method:`PATCH`,body:t}),deleteWebhook:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}`,Jt,{method:`DELETE`}),testWebhook:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}/test`,(e,t)=>((!F(e)||typeof e.queued!=`boolean`)&&P(t,`expected { queued }`),{queued:e.queued}),{method:`POST`}),listWebhookDeliveries:e=>I(`/api/v1/webhooks/${encodeURIComponent(e)}/deliveries`,Bn),orchestrationConfig:()=>I(`/api/v1/orchestration/config`,Hn),getSessionLink:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}`,Un),enableSupervisor:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/enable`,Un,{method:`POST`}),disableSupervisor:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/disable`,Jt,{method:`POST`}),listSupervisorWorkers:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers`,Wn),listSupervisorInbox:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/inbox`,Gn),clearSupervisorInbox:e=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/inbox/clear`,Jt,{method:`POST`}),detachWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/detach`,Jt,{method:`POST`}),killWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/kill`,(e,t)=>((!F(e)||typeof e.wasLive!=`boolean`)&&P(t,`expected { wasLive }`),{wasLive:e.wasLive}),{method:`POST`}),resumeWorker:(e,t)=>I(`/api/v1/orchestration/sessions/${encodeURIComponent(e)}/workers/${encodeURIComponent(t)}/resume`,(e,t)=>((!F(e)||typeof e.resumed!=`boolean`)&&P(t,`expected { resumed }`),{resumed:e.resumed}),{method:`POST`}),listSkills:e=>I(`/api/v1/config/skills?projectId=${encodeURIComponent(e)}`,vn),listSkillOverrides:()=>I(`/api/v1/config/skills/overrides`,yn),setSkillEnabled:(e,t,n,r=`global`)=>I(`/api/v1/config/skills/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,_n,{method:`PUT`,body:{enabled:n,scope:r}}),clearSkillProjectOverride:(e,t)=>I(`/api/v1/config/skills/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,_n,{method:`DELETE`}),listPrompts:e=>I(`/api/v1/config/prompts?projectId=${encodeURIComponent(e)}`,Sn),listPromptOverrides:()=>I(`/api/v1/config/prompts/overrides`,Cn),setPromptEnabled:(e,t,n,r=`global`)=>I(`/api/v1/config/prompts/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,xn,{method:`PUT`,body:{enabled:n,scope:r}}),clearPromptProjectOverride:(e,t)=>I(`/api/v1/config/prompts/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(e)}`,xn,{method:`DELETE`}),listTools:e=>I(`/api/v1/config/tools${e!==void 0&&e.length>0?`?projectId=${encodeURIComponent(e)}`:``}`,e=>{if(!F(e)||!Array.isArray(e.builtin)||!Array.isArray(e.mcp)||e.extension!==void 0&&!Array.isArray(e.extension))throw new N(0,`invalid_response_body`);let t=e;return t.extension===void 0&&(t.extension=[]),t}),setToolEnabled:(e,t,n,r=`global`,i)=>{let a=r===`project`&&i!==void 0?`?projectId=${encodeURIComponent(i)}`:``;return I(`/api/v1/config/tools/${e}/${encodeURIComponent(t)}/enabled${a}`,e=>{if(!F(e)||typeof e.family!=`string`||typeof e.name!=`string`||typeof e.enabled!=`boolean`||typeof e.scope!=`string`)throw new N(0,`invalid_response_body`);return{family:e.family,name:e.name,enabled:e.enabled,scope:e.scope}},{method:`PUT`,body:{enabled:n,scope:r}})},listToolOverrides:()=>I(`/api/v1/config/tools/overrides`,e=>{if(!F(e)||typeof e.projects!=`object`||e.projects===null)throw new N(0,`invalid_response_body`);let t=e.projects;for(let e of Object.values(t))(e.extension===void 0||e.extension===null)&&(e.extension={enable:[],disable:[]});return e}),clearToolProjectOverride:(e,t,n)=>I(`/api/v1/config/tools/${e}/${encodeURIComponent(t)}/enabled?projectId=${encodeURIComponent(n)}`,e=>{if(!F(e)||typeof e.family!=`string`||typeof e.name!=`string`||typeof e.projectId!=`string`)throw new N(0,`invalid_response_body`);return{family:e.family,name:e.name,projectId:e.projectId}},{method:`DELETE`}),exportConfig:async()=>{let e={},t=Ht();t!==void 0&&(e.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/v1/config/export`,{headers:e});if(n.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!n.ok){let e=`request_failed`;try{let t=await n.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(n.status,e)}return{blob:await n.blob(),filename:fr(n.headers.get(`Content-Disposition`)??``)??`pi-forge-config.tar.gz`,files:(n.headers.get(`X-Pi-Forge-Files`)??``).split(`,`).filter(e=>e.length>0)}},importConfig:e=>{let t=new FormData;return t.append(`file`,e,e.name),I(`/api/v1/config/import`,e=>{if(!F(e)||!Array.isArray(e.imported)||!Array.isArray(e.skipped)||!Array.isArray(e.errors))throw new N(0,`invalid_response_body`);return e},{method:`POST`,body:t})},exportSkills:async()=>{let e={},t=Ht();t!==void 0&&(e.Authorization=`Bearer ${t.token}`);let n=await fetch(`/api/v1/config/skills/export`,{headers:e});if(n.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!n.ok){let e=`request_failed`;try{let t=await n.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(n.status,e)}let r=await n.blob(),i=fr(n.headers.get(`Content-Disposition`)??``)??`pi-forge-skills.tar.gz`,a=n.headers.get(`X-Pi-Forge-File-Count`)??`0`;return{blob:r,filename:i,fileCount:Number.parseInt(a,10)||0}},exportSession:async(e,t)=>{let n={},r=Ht();r!==void 0&&(n.Authorization=`Bearer ${r.token}`);let i=await fetch(`/api/v1/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:n});if(i.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!i.ok){let e=`request_failed`;try{let t=await i.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(i.status,e)}let a=await i.blob(),o=i.headers.get(`Content-Disposition`)??``,s=t===`markdown`?`session.md`:`session.jsonl`;return{blob:a,filename:fr(o)??s}},importSkills:e=>{let t=new FormData;for(let n of e){let e=n.webkitRelativePath,r=e!==void 0&&e.length>0?e:n.name;t.append(`file`,n,r)}return I(`/api/v1/config/skills/import`,e=>{if(!F(e)||!Array.isArray(e.imported)||!Array.isArray(e.skipped))throw new N(0,`invalid_response_body`);return e},{method:`POST`,body:t})},filesTree:(e,t)=>{let n=new URLSearchParams({projectId:e});return t!==void 0&&n.set(`maxDepth`,String(t)),I(`/api/v1/files/tree?${n.toString()}`,Yn)},filesRead:(e,t)=>I(`/api/v1/files/read?${new URLSearchParams({projectId:e,path:t}).toString()}`,Xn),filesWrite:(e,t,n)=>I(`/api/v1/files/write`,lr,{method:`PUT`,body:{projectId:e,path:t,content:n}}),filesMkdir:(e,t,n)=>I(`/api/v1/files/mkdir`,lr,{method:`POST`,body:{projectId:e,parentPath:t,name:n}}),filesRename:(e,t,n)=>I(`/api/v1/files/rename`,lr,{method:`POST`,body:{projectId:e,path:t,name:n}}),filesMove:(e,t,n)=>I(`/api/v1/files/move`,lr,{method:`POST`,body:{projectId:e,src:t,dest:n}}),filesDelete:(e,t,n)=>{let r=new URLSearchParams({projectId:e,path:t});return n?.recursive===!0&&r.set(`recursive`,`true`),I(`/api/v1/files/delete?${r.toString()}`,Jt,{method:`DELETE`})},filesDownload:async(e,t)=>{let n=new URLSearchParams({projectId:e});t!==void 0&&t.length>0&&n.set(`path`,t);let r={},i=Ht();i!==void 0&&(r.Authorization=`Bearer ${i.token}`);let a=await fetch(`/api/v1/files/download?${n.toString()}`,{headers:r});if(a.status===401)throw Wt(),window.dispatchEvent(new Event(Gt)),new N(401,`unauthorized`);if(!a.ok){let e=`request_failed`;try{let t=await a.json();typeof t.error==`string`&&(e=t.error)}catch{}throw new N(a.status,e)}return{blob:await a.blob(),filename:fr(a.headers.get(`Content-Disposition`)??``)??`download`}},uploadFiles:async(e,t,n,r)=>{let i=new FormData;i.append(`projectId`,e),i.append(`parentPath`,t),r?.overwrite===!0&&i.append(`overwrite`,`1`);let a=n.reduce((e,t)=>e+t.size,0),o=0;for(let[e,t]of n.entries()){let n=dr(t),s=await ur(t,e=>{o+=e,r?.onHashProgress?.(o,a)});i.append(`path:${e}`,n),i.append(`sha256:${e}`,s)}for(let[e,t]of n.entries())i.append(`file:${e}`,t,dr(t));return I(`/api/v1/files/upload`,ir,{method:`POST`,body:i,...r?.signal===void 0?{}:{signal:r.signal}})},completeFiles:(e,t,n)=>{let r=new URLSearchParams({projectId:e,query:t});return n?.limit!==void 0&&r.set(`limit`,String(n.limit)),I(`/api/v1/files/complete?${r.toString()}`,(e,t)=>((!F(e)||!Array.isArray(e.paths))&&P(t,`expected { paths: string[] }`),{paths:e.paths.filter(e=>typeof e==`string`)}),n?.signal===void 0?{}:{signal:n.signal})},searchFiles:(e,t,n)=>{let r=new URLSearchParams({projectId:e,q:t.query});return t.regex===!0&&r.set(`regex`,`1`),t.caseSensitive===!0&&r.set(`caseSensitive`,`1`),t.includeGitignored===!0&&r.set(`includeGitignored`,`1`),t.include!==void 0&&t.include.length>0&&r.set(`include`,t.include),t.exclude!==void 0&&t.exclude.length>0&&r.set(`exclude`,t.exclude),t.limit!==void 0&&r.set(`limit`,String(t.limit)),I(`/api/v1/files/search?${r.toString()}`,ar,n===void 0?{}:{signal:n})},searchSessions:(e,t)=>{let n=new URLSearchParams({q:e});return t?.sessionLimit!==void 0&&n.set(`sessionLimit`,String(t.sessionLimit)),t?.matchesPerSession!==void 0&&n.set(`matchesPerSession`,String(t.matchesPerSession)),I(`/api/v1/search/sessions?${n.toString()}`,or,t?.signal===void 0?{}:{signal:t.signal})},gitInit:e=>I(`/api/v1/git/init`,(e,t)=>((!F(e)||typeof e.alreadyInitialised!=`boolean`||typeof e.isGitRepo!=`boolean`)&&P(t,`expected { alreadyInitialised, isGitRepo }`),{alreadyInitialised:e.alreadyInitialised,isGitRepo:e.isGitRepo}),{method:`POST`,body:{projectId:e}}),gitStatus:(e,t)=>I(`/api/v1/git/status?${mr(e,t)}`,Qn),gitWorktrees:e=>I(`/api/v1/git/worktrees?${mr(e)}`,cr),gitDiff:(e,t)=>I(`/api/v1/git/diff?${mr(e,t)}`,$n),gitDiffStaged:(e,t)=>I(`/api/v1/git/diff/staged?${mr(e,t)}`,$n),gitDiffFile:(e,t,n,r)=>{let i={path:t};return n&&(i.staged=`1`),I(`/api/v1/git/diff/file?${mr(e,r,i)}`,$n)},gitLog:(e,t,n)=>{let r={};return t!==void 0&&(r.limit=String(t)),I(`/api/v1/git/log?${mr(e,n,r)}`,er)},gitBranches:(e,t)=>I(`/api/v1/git/branches?${mr(e,t)}`,tr),gitRemotes:(e,t)=>I(`/api/v1/git/remotes?${mr(e,t)}`,sr),gitRemoteAdd:(e,t,n,r)=>I(`/api/v1/git/remote/add`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,name:t,url:n,...r?.insecureTls===!0?{insecureTls:!0}:{},...r?.worktreePath===void 0?{}:{worktreePath:r.worktreePath}}}),gitRemoteSetInsecureTls:(e,t,n,r)=>I(`/api/v1/git/remote/tls`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,name:t,insecureTls:n,...r===void 0?{}:{worktreePath:r}}}),gitRemoteRemove:(e,t,n)=>I(`/api/v1/git/remote/${encodeURIComponent(t)}?${mr(e,n)}`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`DELETE`}),gitCheckout:(e,t,n)=>I(`/api/v1/git/checkout`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,branch:t,...n===void 0?{}:{worktreePath:n}}}),gitBranchCreate:(e,t,n)=>{let r={projectId:e,name:t};return n?.startPoint!==void 0&&(r.startPoint=n.startPoint),n?.checkout!==void 0&&(r.checkout=n.checkout),n?.worktreePath!==void 0&&(r.worktreePath=n.worktreePath),I(`/api/v1/git/branch/create`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:r})},gitBranchDelete:(e,t,n,r)=>{let i={};return n===!0&&(i.force=`1`),I(`/api/v1/git/branch/${encodeURIComponent(t)}?${mr(e,r,i)}`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`DELETE`})},gitStage:(e,t,n)=>I(`/api/v1/git/stage`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitUnstage:(e,t,n)=>I(`/api/v1/git/unstage`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitApplyHunks:(e,t,n,r,i)=>I(`/api/v1/git/apply-hunks`,(e,t)=>{(!F(e)||typeof e.ok!=`boolean`)&&P(t,`expected { ok: boolean }`);let n={ok:e.ok};return typeof e.error==`string`&&(n.error=e.error),typeof e.totalHunks==`number`&&(n.totalHunks=e.totalHunks),n},{method:`POST`,body:{projectId:e,path:t,mode:n,hunkIndices:r,...i===void 0?{}:{worktreePath:i}}}),gitRevert:(e,t,n)=>I(`/api/v1/git/revert`,(e,t)=>((!F(e)||e.ok!==!0)&&P(t,`expected { ok: true }`),{ok:!0}),{method:`POST`,body:{projectId:e,paths:t,...n===void 0?{}:{worktreePath:n}}}),gitCommit:(e,t,n)=>I(`/api/v1/git/commit`,(e,t)=>((!F(e)||typeof e.hash!=`string`)&&P(t,`expected { hash }`),{hash:e.hash}),{method:`POST`,body:{projectId:e,message:t,...n===void 0?{}:{worktreePath:n}}}),gitFetch:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.prune!==void 0&&(n.prune=t.prune),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/fetch`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})},gitPull:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.branch!==void 0&&(n.branch=t.branch),t?.rebase!==void 0&&(n.rebase=t.rebase),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/pull`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})},gitPush:(e,t)=>{let n={projectId:e};return t?.remote!==void 0&&(n.remote=t.remote),t?.branch!==void 0&&(n.branch=t.branch),t?.setUpstream!==void 0&&(n.setUpstream=t.setUpstream),t?.worktreePath!==void 0&&(n.worktreePath=t.worktreePath),I(`/api/v1/git/push`,(e,t)=>((!F(e)||typeof e.output!=`string`)&&P(t,`expected { output }`),{output:e.output}),{method:`POST`,body:n})}};async function*hr(e){if(e.body===null)return;let t=e.body.pipeThrough(new TextDecoderStream).getReader(),n=``;try{for(;;){let{value:e,done:r}=await t.read();if(r)return;n+=e.replace(/\r\n/g,`
|
|
10
10
|
`);let i=n.indexOf(`
|
|
11
11
|
|
|
12
12
|
`);for(;i!==-1;){let e=n.slice(0,i);n=n.slice(i+2);for(let t of e.split(`
|
|
@@ -20,8 +20,8 @@ Error generating stack: `+e.message+`
|
|
|
20
20
|
`);try{let n=JSON.parse(e);await t.onEvent(n)}catch{}}r=s.indexOf(`
|
|
21
21
|
|
|
22
22
|
`)}}}catch(e){if(e instanceof Error&&e.name===`AbortError`)return`aborted`;throw e instanceof Error?e:Error(String(e))}finally{try{o.releaseLock()}catch{}}}async function Or(e,t){let n=0;for(;;){let r;try{r=await Dr(e,t)}catch(e){if(e instanceof N&&Cr.has(e.status)||(n+=1,t.maxReconnects!==void 0&&t.maxReconnects>0&&n>t.maxReconnects))throw e;let r=Tr(n),i=e instanceof Error?e.message:String(e);t.onReconnect?.({attempt:n,delayMs:r,reason:i});try{await Er(r,t.signal)}catch{return}continue}if(r===`aborted`)return;if(n+=1,t.maxReconnects!==void 0&&t.maxReconnects>0&&n>t.maxReconnects){t.onClose?.();return}let i=Tr(n);t.onReconnect?.({attempt:n,delayMs:i,reason:`server closed stream`});try{await Er(i,t.signal)}catch{return}}}function kr(e){let t=e.assistantMessageEvent;if(t===void 0||typeof t.type!=`string`||!Ar(t.type))return;let n=typeof t.contentIndex==`number`?t.contentIndex:void 0,r=jr(t.partial)??jr(e.message),i=Array.isArray(r?.content)?r.content:void 0,a=n===void 0?i?.map(jr).find(e=>e?.type===`toolCall`):jr(i?.[n]);if(a?.type!==`toolCall`)return;let o=typeof a.name==`string`&&a.name.length>0?a.name:void 0,s=typeof a.partialJson==`string`&&a.partialJson.length>0?a.partialJson:void 0,c=Object.prototype.hasOwnProperty.call(a,`arguments`)?a.arguments:void 0,l={};return o!==void 0&&(l.name=o),s!==void 0&&(l.partialJson=s),c!==void 0&&(l.arguments=c),l}function Ar(e){return e===`toolcall_start`||e===`toolcall_delta`||e===`toolcall_end`}function jr(e){return typeof e==`object`&&e?e:void 0}var Mr=0;function Nr(){let e=globalThis.crypto;if(e!==void 0&&typeof e.getRandomValues==`function`){let t=new Uint8Array(16);return e.getRandomValues(t),t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128,Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}return Mr=(Mr+1)%(2**53-1),`${Date.now().toString(36)}-${Mr.toString(36)}-${Math.random().toString(36).slice(2)}`}function Pr(e){let t=globalThis.crypto;return`${e}-${t!==void 0&&typeof t.randomUUID==`function`?t.randomUUID():Nr()}`}var Fr=`pi-forge`,Ir=Pr(`tab`),Lr;function Rr(){if(Lr!==void 0)return Lr;if(!(typeof BroadcastChannel>`u`))return Lr=new BroadcastChannel(Fr),Lr}function zr(e){let t=Rr();if(t===void 0)return;let n={from:Ir,msg:e};try{t.postMessage(n)}catch{}}function Br(e){let t=Rr();if(t===void 0)return()=>void 0;let n=t=>{let n=t.data;typeof n!=`object`||!n||n.from!==Ir&&(typeof n.msg!=`object`||n.msg===null||e(n.msg))};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)}var Vr=mt((e,t)=>({pendingBySession:{},setPending:t=>e(e=>({pendingBySession:{...e.pendingBySession,[t.sessionId]:t}})),clearPending:(n,r)=>{let i=t().pendingBySession[n];i!==void 0&&(r!==void 0&&i.requestId!==r||e(e=>({pendingBySession:{...e.pendingBySession,[n]:void 0}})))}})),Hr={tasks:[],nextId:1},Ur=mt(e=>({byId:{},set:(t,n)=>e(e=>({byId:{...e.byId,[t]:n}})),clear:t=>e(e=>{let n={...e.byId};return delete n[t],{byId:n}})}));function Wr(e,t){return t===void 0?Hr:e.byId[t]??Hr}function Gr(e){let t=0,n=0,r=0;for(let i of e.tasks)i.status===`pending`?t+=1:i.status===`in_progress`?n+=1:i.status===`completed`&&(r+=1);return{pending:t,inProgress:n,completed:r,total:t+n+r}}var Kr=new Set([`running`,`terminating`,`terminate_timeout`]),qr=50,Jr=[],Yr=[],Xr=mt(e=>({bySession:{},watchesBySession:{},setProcesses:(t,n)=>e(e=>({bySession:{...e.bySession,[t]:n}})),pushWatch:(t,n)=>e(e=>{let r=[...e.watchesBySession[t]??[],n];return r.length>qr&&r.splice(0,r.length-qr),{watchesBySession:{...e.watchesBySession,[t]:r}}}),clearWatches:t=>e(e=>{let n={...e.watchesBySession};return delete n[t],{watchesBySession:n}})}));function Zr(e,t){return t===void 0?Jr:e.bySession[t]??Jr}function Qr(e,t){return t===void 0?Yr:e.watchesBySession[t]??Yr}function $r(e){let t=0;for(let n of e)Kr.has(n.status)&&(t+=1);return t}var ei=`pi-forge/active-session-id`,ti=[],ni=[],ri=[],ii=new Map,ai=new Map,oi=new Map,si=new Map;function ci(e){for(let t of e)if(t.role===`user`&&Array.isArray(t.content))for(let e of t.content){let t=e;if(t.type===`image`&&t.__blobUrl===!0&&typeof t.data==`string`)try{URL.revokeObjectURL(t.data)}catch{}}}function li(e,t){for(let n of Object.values(e.byProject)){let e=n.find(e=>e.sessionId===t);if(e!==void 0)return e}}function ui(e,t){return li(e,t)?.projectId}function di(e){return`Read-only: pi-subagents child is ${e??`running`} externally`}function fi(e,t){let n=e.messagesBySession[t];n!==void 0&&ci(n);let r={...e.messagesBySession};delete r[t];let i={...e.streamingBySession};delete i[t];let a={...e.bannerBySession};delete a[t];let o={...e.streamingTextBySession};delete o[t];let s={...e.activeToolBySession};delete s[t];let c={...e.toolCallGenerationBySession};delete c[t];let l={...e.agentEndCountBySession};delete l[t];let u={...e.fileRefreshCountBySession};delete u[t];let d={...e.turnWriteCountBySession};delete d[t];let f={...e.queuedBySession};delete f[t];let p={};for(let[n,r]of Object.entries(e.byProject))p[n]=r.filter(e=>e.sessionId!==t);return{messagesBySession:r,streamingBySession:i,bannerBySession:a,streamingTextBySession:o,activeToolBySession:s,toolCallGenerationBySession:c,agentEndCountBySession:l,fileRefreshCountBySession:u,turnWriteCountBySession:d,queuedBySession:f,byProject:p,activeSessionId:e.activeSessionId===t?void 0:e.activeSessionId}}var pi=mt((e,t)=>({byProject:{},activeSessionId:localStorage.getItem(ei)??void 0,messagesBySession:{},compactionsBySession:{},pendingDraftBySession:{},streamingBySession:{},bannerBySession:{},streamingTextBySession:{},activeToolBySession:{},toolCallGenerationBySession:{},agentEndCountBySession:{},fileRefreshCountBySession:{},turnWriteCountBySession:{},compactionEndCountBySession:{},queuedBySession:{},pendingScrollByMessageIndex:{},error:void 0,loadingList:!1,loadSessionsForProject:async t=>{e({loadingList:!0,error:void 0});try{let{sessions:n}=await L.listSessions(t);e(e=>({byProject:{...e.byProject,[t]:n},loadingList:!1}))}catch(t){e({loadingList:!1,error:t instanceof N?t.code:t.message})}},createSession:async t=>{e({error:void 0});try{let n=await L.createSession(t),r={sessionId:n.sessionId,projectId:n.projectId,isLive:!0,workspacePath:n.workspacePath,lastActivityAt:n.lastActivityAt,createdAt:n.createdAt,messageCount:n.messageCount,firstMessage:``};return n.name!==void 0&&(r.name=n.name),e(e=>{let i=e.byProject[t]??[];return{byProject:{...e.byProject,[t]:[r,...i]},activeSessionId:n.sessionId}}),localStorage.setItem(ei,n.sessionId),zr({type:`session_created`,projectId:t,session:r}),n}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},renameSession:async(t,n)=>{e({error:void 0});try{let r=await L.renameSession(t,n);e(e=>_i(e,t,r.name)),zr({type:`session_renamed`,sessionId:t,name:r.name})}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},reloadMessages:t=>{hi(e,t)},loadCompactions:async t=>{try{let n=await L.getCompactions(t);e(e=>({compactionsBySession:{...e.compactionsBySession,[t]:n.compactions}}))}catch{}},setPendingDraft:(t,n)=>e(e=>({pendingDraftBySession:{...e.pendingDraftBySession,[t]:n}})),consumePendingDraft:t=>e(e=>{if(e.pendingDraftBySession[t]===void 0)return{};let n={...e.pendingDraftBySession};return delete n[t],{pendingDraftBySession:n}}),requestScrollToMessage:(t,n)=>e(e=>({pendingScrollByMessageIndex:{...e.pendingScrollByMessageIndex,[t]:n}})),consumePendingScroll:n=>{let r=t().pendingScrollByMessageIndex[n];if(r!==void 0)return e(e=>{let t={...e.pendingScrollByMessageIndex};return delete t[n],{pendingScrollByMessageIndex:t}}),r},setActiveSession:t=>{t===void 0?localStorage.removeItem(ei):localStorage.setItem(ei,t),e({activeSessionId:t})},openStream:n=>{let r=li(t(),n),i=t=>{L.getMessages(n).then(({messages:r})=>{e(e=>({messagesBySession:{...e.messagesBySession,[n]:r},streamingBySession:{...e.streamingBySession,[n]:!1},bannerBySession:{...e.bannerBySession,[n]:di(t)}}))}).catch(t=>{let r=t instanceof N?t.code:t.message;e(e=>({bannerBySession:{...e.bannerBySession,[n]:`read-only snapshot failed: ${r}`}}))})};if(r?.isExternalLive===!0&&e(e=>({bannerBySession:{...e.bannerBySession,[n]:di(r.externalState)}})),si.get(n)!==void 0)return;let a=new AbortController;si.set(n,a),t().loadCompactions(n);let o=()=>{si.get(n)===a&&si.delete(n)};Or(`/api/v1/sessions/${encodeURIComponent(n)}/stream`,{signal:a.signal,onEvent:r=>mi(e,t,n,r),onClose:o,onReconnect:({attempt:t,delayMs:r,reason:i})=>{e(e=>({bannerBySession:{...e.bannerBySession,[n]:`Reconnecting (attempt ${t}, ${Math.round(r/1e3)}s) — ${i}`}}))}}).catch(r=>{if(r instanceof N&&r.status===409&&r.code===`external_subagent_active`){o(),i(`running`),Promise.all(Object.keys(t().byProject).map(e=>t().loadSessionsForProject(e)));return}if(r instanceof N&&r.status===404){e(e=>fi(e,n)),t().activeSessionId===void 0&&localStorage.removeItem(ei),o();return}let a=r instanceof N?r.code:r.message;e(e=>({bannerBySession:{...e.bannerBySession,[n]:`stream error: ${a}`}})),o()})},closeStream:e=>{let t=si.get(e);t!==void 0&&(t.abort(),si.get(e)===t&&si.delete(e))},sendPrompt:async(t,n,r)=>{e(e=>({error:void 0,bannerBySession:{...e.bannerBySession,[t]:void 0}}));let i=[{type:`text`,text:n}];if(r!==void 0)for(let e of r)e.type.startsWith(`image/`)?i.push({type:`image`,mimeType:e.type,data:URL.createObjectURL(e),__blobUrl:!0}):i.push({type:`file`,filename:e.name,size:e.size});let a={role:`user`,content:i,timestamp:Date.now()};e(e=>({messagesBySession:{...e.messagesBySession,[t]:[...e.messagesBySession[t]??[],a]}}));try{let i={};r!==void 0&&r.length>0&&(i.attachments=r);let a=await L.prompt(t,n,i);a.sessionName!==void 0&&(e(e=>_i(e,t,a.sessionName)),zr({type:`session_renamed`,sessionId:t,name:a.sessionName}))}catch(n){throw ci([a]),e(e=>{let r=e.messagesBySession[t]??[];return{messagesBySession:{...e.messagesBySession,[t]:r.filter(e=>e!==a)},error:n instanceof N?n.code:n.message,bannerBySession:{...e.bannerBySession,[t]:n instanceof N?`prompt rejected: ${n.code}${n.message===`${n.status} ${n.code}`?``:` — ${n.message}`}`:`prompt rejected: ${n.message}`}}}),n}},sendSteer:async(t,n,r)=>{e({error:void 0});try{await L.steer(t,n,r)}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},abortSession:async t=>{e({error:void 0});try{await L.abort(t)}catch(t){e({error:t instanceof N?t.code:t.message})}},disposeSession:async n=>{e({error:void 0});try{t().closeStream(n);let r=ui(t(),n);await L.disposeSession(n),e(e=>fi(e,n)),t().activeSessionId===void 0&&localStorage.removeItem(ei),r!==void 0&&(zr({type:`session_deleted`,projectId:r,sessionId:n}),t().loadSessionsForProject(r))}catch(t){e({error:t instanceof N?t.code:t.message})}},clearBanner:t=>{e(e=>({bannerBySession:{...e.bannerBySession,[t]:void 0}}))}}));function mi(e,t,n,r){if(r.type===`snapshot`){let t=Object.prototype.hasOwnProperty.call(r,`name`),i=typeof r.name==`string`?r.name:void 0;e(e=>({...t?_i(e,n,i):{},messagesBySession:{...e.messagesBySession,[n]:r.messages??[]},streamingBySession:{...e.streamingBySession,[n]:r.isStreaming??!1},bannerBySession:{...e.bannerBySession,[n]:r.readOnly===!0||r.isExternalLive===!0?di(typeof r.externalState==`string`?r.externalState:void 0):void 0},activeToolBySession:{...e.activeToolBySession,[n]:void 0},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0}}));return}if(r.type===`agent_start`){let t=ai.get(n);t!==void 0&&cancelAnimationFrame(t),ai.delete(n),ii.delete(n),e(e=>({streamingBySession:{...e.streamingBySession,[n]:!0},streamingTextBySession:{...e.streamingTextBySession,[n]:``},bannerBySession:{...e.bannerBySession,[n]:void 0},turnWriteCountBySession:{...e.turnWriteCountBySession,[n]:0},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0}}));return}if(r.type===`agent_end`){let t=ai.get(n);t!==void 0&&cancelAnimationFrame(t),ai.delete(n),ii.delete(n);let i=r.errorMessage,a=typeof i==`string`&&i.length>0?`Agent error: ${i}`:void 0;L.getMessages(n).then(({messages:t})=>{e(e=>{let r=e.messagesBySession[n];r!==void 0&&ci(r);let i=e.bannerBySession[n],o=a??i;return{messagesBySession:{...e.messagesBySession,[n]:t},streamingBySession:{...e.streamingBySession,[n]:!1},streamingTextBySession:{...e.streamingTextBySession,[n]:``},activeToolBySession:{...e.activeToolBySession,[n]:void 0},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0},bannerBySession:{...e.bannerBySession,[n]:o},agentEndCountBySession:{...e.agentEndCountBySession,[n]:(e.agentEndCountBySession[n]??0)+1},fileRefreshCountBySession:(e.turnWriteCountBySession[n]??0)===0?{...e.fileRefreshCountBySession,[n]:(e.fileRefreshCountBySession[n]??0)+1}:e.fileRefreshCountBySession}})}).catch(()=>{e(e=>({streamingBySession:{...e.streamingBySession,[n]:!1},activeToolBySession:{...e.activeToolBySession,[n]:void 0},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0},bannerBySession:{...e.bannerBySession,[n]:a??`Couldn't refresh messages after the agent finished — reload to sync`},agentEndCountBySession:{...e.agentEndCountBySession,[n]:(e.agentEndCountBySession[n]??0)+1},fileRefreshCountBySession:(e.turnWriteCountBySession[n]??0)===0?{...e.fileRefreshCountBySession,[n]:(e.fileRefreshCountBySession[n]??0)+1}:e.fileRefreshCountBySession}))});return}if(r.type===`queue_update`){let t=r,i=Array.isArray(t.steering)?t.steering.filter(e=>typeof e==`string`):[],a=Array.isArray(t.followUp)?t.followUp.filter(e=>typeof e==`string`):[];e(e=>({queuedBySession:{...e.queuedBySession,[n]:i.length===0&&a.length===0?void 0:{steering:i,followUp:a}}}));return}if(r.type===`tool_execution_start`){let t=typeof r.toolName==`string`?r.toolName:`tool`,i=vi(t,r.input??{}),a=i===void 0?{name:t}:{name:t,summary:i};e(e=>({activeToolBySession:{...e.activeToolBySession,[n]:a},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0}})),hi(e,n);return}if(r.type===`tool_execution_end`){let t=gi(r,`write`);e(e=>({activeToolBySession:{...e.activeToolBySession,[n]:void 0},toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:void 0},...t?{fileRefreshCountBySession:{...e.fileRefreshCountBySession,[n]:(e.fileRefreshCountBySession[n]??0)+1},turnWriteCountBySession:{...e.turnWriteCountBySession,[n]:(e.turnWriteCountBySession[n]??0)+1}}:{}})),hi(e,n);return}if(r.type===`session_list_changed`){let e=typeof r.projectId==`string`?r.projectId:void 0;e!==void 0&&t().loadSessionsForProject(e);return}if(r.type===`session_renamed`){let t=typeof r.sessionId==`string`?r.sessionId:n,i=typeof r.name==`string`?r.name:void 0;e(e=>_i(e,t,i)),zr({type:`session_renamed`,sessionId:t,name:i});return}if(r.type===`message_end`||r.type===`tool_result`){if(hi(e,n),r.type===`message_end`){let t=r.message;if(t?.stopReason===`error`){let r=typeof t.errorMessage==`string`?t.errorMessage:``;r.length>0&&e(e=>({bannerBySession:{...e.bannerBySession,[n]:`Agent error: ${r}`}}))}if(t?.role===`assistant`){let t=ai.get(n);t!==void 0&&cancelAnimationFrame(t),ai.delete(n),ii.delete(n),e(e=>({streamingTextBySession:{...e.streamingTextBySession,[n]:``}}))}}return}if(r.type===`ask_user_question`){let e=typeof r.requestId==`string`?r.requestId:void 0,t=Array.isArray(r.questions)?r.questions:void 0;if(e===void 0||t===void 0)return;Vr.getState().setPending({requestId:e,sessionId:n,questions:t});return}if(r.type===`ask_user_question_cancelled`){let e=typeof r.requestId==`string`?r.requestId:void 0;Vr.getState().clearPending(n,e);return}if(r.type===`todo_update`){let e=Array.isArray(r.tasks)?r.tasks:[],t=typeof r.nextId==`number`?r.nextId:1;Ur.getState().set(n,{tasks:e,nextId:t});return}if(r.type===`process_update`){let e=Array.isArray(r.processes)?r.processes:[];Xr.getState().setProcesses(n,e);return}if(r.type===`process_watch`){let e=r.match;e!==void 0&&typeof e.processId==`string`&&typeof e.processName==`string`&&(e.source===`stdout`||e.source===`stderr`)&&typeof e.line==`string`&&typeof e.watch?.pattern==`string`&&Xr.getState().pushWatch(n,{processId:e.processId,processName:e.processName,source:e.source,line:e.line,pattern:e.watch.pattern,at:Date.now()});return}if(r.type!==`process_output`){if(r.type===`user_bash_result`){hi(e,n);return}if(r.type===`message_update`){let t=kr(r);t!==void 0&&e(e=>({toolCallGenerationBySession:{...e.toolCallGenerationBySession,[n]:t}}));let i=r.assistantMessageEvent;if(typeof i==`object`&&i&&i.type===`text_delta`&&typeof i.delta==`string`){let t=i.delta;if(ii.set(n,(ii.get(n)??``)+t),!ai.has(n)){let t=requestAnimationFrame(()=>{ai.delete(n);let t=ii.get(n)??``;t.length!==0&&(ii.delete(n),e(e=>({streamingTextBySession:{...e.streamingTextBySession,[n]:(e.streamingTextBySession[n]??``)+t}})))});ai.set(n,t)}}return}if(r.type===`compaction_start`){e(e=>({bannerBySession:{...e.bannerBySession,[n]:`Compacting context…`}}));return}if(r.type===`compaction_end`){let t=r.errorMessage,i=typeof t==`string`&&t.length>0?`Agent error: ${t}`:void 0;e(e=>({bannerBySession:{...e.bannerBySession,[n]:i},compactionEndCountBySession:{...e.compactionEndCountBySession,[n]:(e.compactionEndCountBySession[n]??0)+1}})),pi.getState().loadCompactions(n),hi(e,n);return}if(r.type===`auto_retry_start`){let t=typeof r.attempt==`number`?r.attempt:`?`,i=typeof r.maxAttempts==`number`?r.maxAttempts:`?`;e(e=>({bannerBySession:{...e.bannerBySession,[n]:`Retrying (${t}/${i})…`}}));return}if(r.type===`auto_retry_end`){let t=r.success!==!1,i=r.finalError,a=!t&&typeof i==`string`&&i.length>0?`Agent error: ${i}`:void 0;e(e=>({bannerBySession:{...e.bannerBySession,[n]:a}}));return}}}function hi(e,t){let n=oi.get(t)??{inflight:!1,queued:!1};if(n.inflight){n.queued=!0,oi.set(t,n);return}n.inflight=!0,oi.set(t,n),L.getMessages(t).then(({messages:n})=>{e(e=>({messagesBySession:{...e.messagesBySession,[t]:n}}))}).catch(()=>{}).finally(()=>{let n=oi.get(t);n!==void 0&&(n.queued?(n.queued=!1,n.inflight=!1,oi.set(t,n),hi(e,t)):oi.delete(t))})}function gi(e,t){return typeof e.toolName==`string`&&e.toolName===t}function _i(e,t,n){let r={};for(let[i,a]of Object.entries(e.byProject))r[i]=a.map(e=>{if(e.sessionId!==t)return e;let r={...e};return n===void 0?delete r.name:r.name=n,r});return{byProject:r}}function vi(e,t){let n=e=>{let n=t[e];return typeof n==`string`&&n.length>0?n:void 0};switch(e){case`bash`:return n(`command`);case`read`:case`write`:case`edit`:return n(`filePath`)??n(`path`)??n(`file`);case`grep`:return n(`pattern`);case`glob`:return n(`pattern`)??n(`path`);default:for(let e of[`path`,`file`,`filePath`,`command`,`pattern`,`query`,`url`]){let t=n(e);if(t!==void 0)return t}return}}globalThis.__piForgeSessionCrossTabRegistered||(globalThis.__piForgeSessionCrossTabCleanup=Br(e=>{if(e.type===`session_created`){let t=e.session,n=typeof t.sessionId==`string`?t.sessionId:void 0;if(n===void 0)return;let r={sessionId:n,projectId:e.projectId,isLive:t.isLive===!0,workspacePath:typeof t.workspacePath==`string`?t.workspacePath:``,lastActivityAt:typeof t.lastActivityAt==`string`?t.lastActivityAt:new Date().toISOString(),createdAt:typeof t.createdAt==`string`?t.createdAt:new Date().toISOString(),messageCount:typeof t.messageCount==`number`?t.messageCount:0,firstMessage:typeof t.firstMessage==`string`?t.firstMessage:``};typeof t.name==`string`&&(r.name=t.name),pi.setState(t=>{let i=t.byProject[e.projectId]??[];return i.some(e=>e.sessionId===n)?{}:{byProject:{...t.byProject,[e.projectId]:[r,...i]}}});return}if(e.type===`session_deleted`){if(pi.setState(t=>fi(t,e.sessionId)),pi.getState().activeSessionId===void 0)try{localStorage.removeItem(ei)}catch{}pi.getState().loadSessionsForProject(e.projectId);return}if(e.type===`session_renamed`){pi.setState(t=>_i(t,e.sessionId,e.name));return}}),globalThis.__piForgeSessionCrossTabRegistered=!0);var yi=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/;function bi(e){if(e.length===0)return[];let t=0,n=0,r=new Map,i=(e,t)=>{let n=r.get(e);n!==`modified`&&(n===`added`&&t===`deletedAbove`||r.set(e,t))},a=()=>{n!==0&&(i(t,`deletedAbove`),n=0)};for(let r of e.split(`
|
|
23
|
-
`)){if(r.startsWith(`@@`)){a();let e=yi.exec(r);if(e===null)continue;t=Number.parseInt(e[1]??`0`,10),n=0;continue}if(r.startsWith(`\\`)||t===0)continue;let e=r.charAt(0);e===` `?(a(),t+=1):e===`-`?n+=1:e===`+`&&(n>0?(i(t,`modified`),--n):i(t,`added`),t+=1)}return a(),Array.from(r.entries()).map(([e,t])=>({line:e,kind:t})).sort((e,t)=>e.line-t.line)}var xi=`forge.editor.tabs.v1:`;function Si(e){try{let t=sessionStorage.getItem(xi+e);if(t===null)return{paths:[],activePath:null};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{paths:[],activePath:null};let r=n,i=Array.isArray(r.paths)?r.paths.filter(e=>typeof e==`string`):[],a=typeof r.activePath==`string`?r.activePath:null;return{paths:i,activePath:i.includes(a??``)?a:i[0]??null}}catch{return{paths:[],activePath:null}}}function Ci(e,t,n){try{sessionStorage.setItem(xi+e,JSON.stringify({paths:t,activePath:n??null}))}catch{}}var wi;function Ti(e,t){e!==void 0&&Ci(e,t.openFiles.map(e=>e.path),t.activePath)}var Ei=mt((e,t)=>({treeByProject:{},treeLoading:{},openFiles:[],activePath:void 0,error:void 0,externallyChanged:{},gitDiffByPath:{},loadGitDiff:async(t,n)=>{try{let r=bi((await L.gitDiffFile(t,n,!1)).diff);e(e=>({gitDiffByPath:{...e.gitDiffByPath,[n]:r}}))}catch{e(e=>{if(!(n in e.gitDiffByPath))return{};let t={...e.gitDiffByPath};return delete t[n],{gitDiffByPath:t}})}},loadTree:async t=>{e(e=>({treeLoading:{...e.treeLoading,[t]:!0},error:void 0}));try{let n=await L.filesTree(t);e(e=>({treeByProject:{...e.treeByProject,[t]:n},treeLoading:{...e.treeLoading,[t]:!1}}))}catch(n){e(e=>({treeLoading:{...e.treeLoading,[t]:!1},error:n instanceof N?n.code:n.message}))}},restoreTabs:async n=>{if(wi===n&&t().openFiles.length>0)return;wi!==n&&e({openFiles:[],activePath:void 0,externallyChanged:{},gitDiffByPath:{}}),wi=n;let r=Si(n);if(r.paths.length!==0){for(let e of r.paths)try{await t().openFile(n,e)}catch{}r.activePath!==null&&t().setActiveFile(r.activePath)}},openFile:async(n,r,i)=>{if(wi=n,t().openFiles.find(e=>e.path===r)!==void 0){e(i===void 0?e=>(Ti(wi,{openFiles:e.openFiles,activePath:r}),{activePath:r}):e=>{let t={openFiles:e.openFiles.map(e=>e.path===r?{...e,pendingNav:i}:e),activePath:r};return Ti(wi,t),t});return}e({error:void 0});try{let a=await L.filesRead(n,r),o={tabId:Di(),path:r,saved:a.content,draft:a.content,dirty:!1,language:a.language,binary:a.binary,saving:!1,savedAt:void 0,saveError:void 0,loadingError:a.binary?`Binary file — open externally to edit.`:void 0};i!==void 0&&(o.pendingNav=i),e(e=>{let t={openFiles:[...e.openFiles,o],activePath:r};return Ti(wi,t),t}),t().loadGitDiff(n,r)}catch(t){e({error:t instanceof N?t.code:t.message})}},closeFile:t=>{e(e=>{let n=e.openFiles.findIndex(e=>e.path===t);if(n===-1)return{};let r=e.openFiles.slice(0,n).concat(e.openFiles.slice(n+1)),i=e.activePath===t?(r[n]??r[n-1]??r[0])?.path:e.activePath,a={...e.externallyChanged};delete a[t];let o={...e.gitDiffByPath};delete o[t];let s={openFiles:r,activePath:i,externallyChanged:a,gitDiffByPath:o};return Ti(wi,s),s})},closeAllFiles:()=>{e(()=>{let e={openFiles:[],activePath:void 0,externallyChanged:{},gitDiffByPath:{}};return Ti(wi,e),e})},setActiveFile:t=>e(e=>(Ti(wi,{openFiles:e.openFiles,activePath:t}),{activePath:t})),consumePendingNav:t=>{e(e=>({openFiles:e.openFiles.map(e=>{if(e.path!==t||e.pendingNav===void 0)return e;let n={...e};return delete n.pendingNav,n})}))},updateDraft:(t,n)=>{e(e=>({openFiles:e.openFiles.map(e=>e.path===t?{...e,draft:n,dirty:n!==e.saved}:e)}))},saveFile:async(n,r)=>{let i=t().openFiles.find(e=>e.path===r);if(!(i===void 0||i.binary)){e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!0,saveError:void 0}:e),error:void 0}));try{await L.filesWrite(n,r,i.draft),e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!1,saved:e.draft,dirty:!1,savedAt:Date.now(),saveError:void 0}:e),externallyChanged:Oi(e.externallyChanged,r)})),t().loadGitDiff(n,r)}catch(t){let n=t instanceof N?t.code:t.message;throw e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!1,saveError:n}:e),error:n})),t}}},reloadFile:async(n,r)=>{e({error:void 0});try{let i=await L.filesRead(n,r);e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saved:i.content,draft:i.content,dirty:!1,language:i.language,binary:i.binary,loadingError:i.binary?`Binary file — open externally to edit.`:void 0}:e),externallyChanged:Oi(e.externallyChanged,r)})),t().loadGitDiff(n,r)}catch(t){e({error:t instanceof N?t.code:t.message})}},refreshOpenFiles:async n=>{let r=t().openFiles.map(e=>({path:e.path,saved:e.saved,dirty:e.dirty}));if(r.length===0)return;let i=await Promise.allSettled(r.map(e=>L.filesRead(n,e.path)));e(e=>{let t=e.openFiles,n=e.externallyChanged;for(let e=0;e<r.length;e++){let a=i[e],o=r[e];if(a===void 0||o===void 0||a.status!==`fulfilled`)continue;let s=a.value;s.content===o.saved&&!o.dirty||s.content!==o.saved&&(o.dirty?n={...n,[o.path]:!0}:(t=t.map(e=>e.path===o.path?{...e,saved:s.content,draft:s.content,dirty:!1,language:s.language,binary:s.binary,loadingError:s.binary?`Binary file — open externally to edit.`:void 0}:e),n=Oi(n,o.path)))}return{openFiles:t,externallyChanged:n}}),await Promise.allSettled(r.map(e=>t().loadGitDiff(n,e.path)))},markExternallyChanged:t=>{e(e=>({externallyChanged:{...e.externallyChanged,[t]:!0}}))},dismissExternallyChanged:t=>{e(e=>({externallyChanged:Oi(e.externallyChanged,t)}))},createFile:async(n,r,i)=>{e({error:void 0});try{let e=`${r}/${i}`;return await L.filesWrite(n,e,``),await t().loadTree(n),e}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},createFolder:async(n,r,i)=>{e({error:void 0});try{await L.filesMkdir(n,r,i),await t().loadTree(n)}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},renameEntry:async(n,r,i)=>{e({error:void 0});try{let{path:a}=await L.filesRename(n,r,i);return e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,path:a}:e),activePath:e.activePath===r?a:e.activePath})),await t().loadTree(n),a}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},moveEntry:async(n,r,i)=>{e({error:void 0});try{let{path:a}=await L.filesMove(n,r,i);return e(e=>({openFiles:e.openFiles.map(e=>{if(e.path===r)return{...e,path:a};let t=`${r}/`;return e.path.startsWith(t)?{...e,path:`${a}/${e.path.slice(t.length)}`}:e}),activePath:e.activePath===r?a:e.activePath!==void 0&&e.activePath.startsWith(`${r}/`)?`${a}/${e.activePath.slice(r.length+1)}`:e.activePath})),await t().loadTree(n),a}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},deleteEntry:async(n,r,i)=>{e({error:void 0});try{await L.filesDelete(n,r,i?.recursive===!0?{recursive:!0}:void 0),t().openFiles.find(e=>e.path===r)!==void 0&&t().closeFile(r),await t().loadTree(n)}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},uploadFiles:async(n,r,i,a)=>{e({error:void 0});try{let e=await L.uploadFiles(n,r,i,{...a?.overwrite===void 0?{}:{overwrite:a.overwrite},...a?.onHashProgress===void 0?{}:{onHashProgress:a.onHashProgress}});return await t().loadTree(n),e.files}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}}}));function Di(){return Pr(`tab`)}function Oi(e,t){if(e[t]===void 0)return e;let n={...e};return delete n[t],n}var ki={appBackground:`--forge-app-bg`,panelBackground:`--forge-panel-bg`,userBubbleBackground:`--forge-user-bubble-bg`,assistantBubbleBackground:`--forge-assistant-bubble-bg`,primaryText:`--forge-text-primary`,secondaryText:`--forge-text-secondary`,mutedText:`--forge-text-muted`,highlightBackground:`--forge-highlight-bg`,highlightText:`--forge-highlight-text`,selectionBackground:`--forge-selection-bg`};function Ai(e){if(typeof document>`u`)return;let t=document.documentElement;if(e===void 0||!e.enabled){t.dataset.serverTheme=`off`;for(let e of Object.values(ki))t.style.removeProperty(e);return}t.dataset.serverTheme=`on`;for(let[n,r]of Object.entries(ki))t.style.setProperty(r,e.colors[n])}var ji=mt(e=>({loaded:!1,minimal:!1,workspaceRoot:``,version:``,passwordAuthEnabled:!0,orchestrationEnabled:!1,serverTheme:void 0,authBannerText:void 0,authBannerHtml:!1,authColorScheme:void 0,authLogoUrl:void 0,error:void 0,setServerTheme:t=>{Ai(t),e({serverTheme:t})},load:async()=>{try{let t=await L.uiConfig();Ai(t.serverTheme),e({loaded:!0,minimal:t.minimal,workspaceRoot:t.workspaceRoot,version:t.version,passwordAuthEnabled:t.passwordAuthEnabled,orchestrationEnabled:t.orchestrationEnabled,serverTheme:t.serverTheme,authBannerText:t.authBannerText,authBannerHtml:t.authBannerHtml,authColorScheme:t.authColorScheme,authLogoUrl:t.authLogoUrl,error:void 0})}catch(t){let n=t instanceof N?t.code:t.message;typeof console<`u`&&console.warn(`[ui-config] load failed:`,n),e({loaded:!0,error:n})}}})),Mi=mt((e,t)=>({loaded:!1,actions:[],error:void 0,load:async()=>{try{let{actions:t}=await L.listQuickActions();e({loaded:!0,actions:t,error:void 0})}catch(t){let n=t instanceof N?t.code:t.message;typeof console<`u`&&console.warn(`[quick-actions] load failed:`,n),e({error:n})}},create:async n=>{let r=await L.createQuickAction(n);return e({actions:[...t().actions,r]}),r},update:async(n,r)=>{let i=await L.updateQuickAction(n,r);return e({actions:t().actions.map(e=>e.id===n?i:e)}),i},remove:async n=>{await L.deleteQuickAction(n),e({actions:t().actions.filter(e=>e.id!==n)})}})),Ni=mt((e,t)=>({runs:[],addRun:n=>e({runs:[...t().runs,n]}),updateRun:(n,r)=>e({runs:t().runs.map(e=>e.runId===n?{...e,...r}:e)}),removeRun:n=>e({runs:t().runs.filter(e=>e.runId!==n)}),runsForSession:e=>t().runs.filter(t=>t.sessionId===e)}));function Pi(e){if(e.length!==4)return e;let t=e[1]??`0`,n=e[2]??`0`,r=e[3]??`0`;return`#${t}${t}${n}${n}${r}${r}`}function Fi(e){let t=Pi(e).slice(1);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function Ii(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Li(e){let[t,n,r]=Fi(e);return .2126*Ii(t)+.7152*Ii(n)+.0722*Ii(r)}function Ri(e,t){let n=Math.max(Li(e),Li(t)),r=Math.min(Li(e),Li(t));return(n+.05)/(r+.05)}function zi(e,t){return Ri(e,t)>=4.5?e:Ri(`#000000`,t)>=Ri(`#ffffff`,t)?`#000000`:`#ffffff`}function Bi(e){let t=e?.pageBackground??`#0a0a0a`,n=e?.cardBackground??`#171717`,r=e?.border??`#262626`,i=e?.text??`#f5f5f5`,a=e?.mutedText??`#a3a3a3`,o=e?.buttonBackground??`#f5f5f5`,s=e?.buttonText??`#171717`,c=e?.buttonHoverBackground??`#ffffff`,l=t,u=zi(i,l);return{"--auth-page-bg":t,"--auth-card-bg":n,"--auth-border":r,"--auth-text":i,"--auth-muted-text":a,"--auth-button-bg":o,"--auth-button-text":s,"--auth-button-hover-bg":c,"--auth-input-bg":l,"--auth-input-text":u,"--auth-placeholder-text":Ri(a,l)>=3?a:u}}var Vi=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Hi=o(((e,t)=>{t.exports=Vi()})),R=Hi(),Ui=new Set([`A`,`B`,`BLOCKQUOTE`,`BR`,`CODE`,`DIV`,`EM`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`HR`,`I`,`LI`,`OL`,`P`,`PRE`,`SECTION`,`SPAN`,`STRONG`,`U`,`UL`]),Wi=new Set([`SCRIPT`,`STYLE`,`TEMPLATE`]);function Gi(e){if(typeof DOMParser>`u`)return``;let t=new DOMParser().parseFromString(e,`text/html`),n=e=>{for(let r of Array.from(e.childNodes)){if(r.nodeType!==Node.ELEMENT_NODE)continue;let e=r;if(Wi.has(e.tagName)){e.remove();continue}if(!Ui.has(e.tagName)){e.replaceWith(t.createTextNode(e.textContent??``));continue}for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase();if(e.tagName===`A`&&n===`href`){try{let r=new URL(t.value,window.location.origin);[`http:`,`https:`,`mailto:`].includes(r.protocol)||e.removeAttribute(n)}catch{e.removeAttribute(n)}continue}e.tagName===`A`&&[`title`,`target`,`rel`].includes(n)||e.removeAttribute(n)}e.tagName===`A`&&e.getAttribute(`href`)!==null&&e.setAttribute(`rel`,`noopener noreferrer`),n(e)}};return n(t.body),t.body.innerHTML}function Ki(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),i=gr(e=>e.login),a=gr(e=>e.ldapEnabled),o=gr(e=>e.loginPending),s=gr(e=>e.loginError),c=ji(e=>e.authBannerText),l=ji(e=>e.authBannerHtml),u=ji(e=>e.authLogoUrl),d=ji(e=>e.authColorScheme),f=(0,v.useMemo)(()=>Bi(d),[d]),p=(0,v.useMemo)(()=>c&&l?Gi(c):``,[l,c]),m=c!==void 0&&c.length>0;return(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-[var(--auth-page-bg)] px-4 py-8 text-[var(--auth-text)]`,style:f,children:(0,R.jsxs)(`div`,{className:`flex w-full max-w-[1536px] flex-col items-center gap-3`,children:[(0,R.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n.length!==0&&(a&&e.trim().length===0||i(n,a?e.trim():void 0))},className:`w-full max-w-sm space-y-4 rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-6 text-[var(--auth-text)] shadow-lg`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`img`,{src:u??`/icons/icon.svg`,alt:``,className:`max-h-6 max-w-24 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`pi-forge`})]}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--auth-muted-text)]`,children:a?`Sign in with your LDAP account.`:`Enter the pi-forge password to continue.`})]}),a&&(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Username`}),(0,R.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),autoFocus:!0,autoComplete:`username`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Password`}),(0,R.jsx)(`input`,{type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!a,autoComplete:`current-password`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),s!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-red-400`,children:s===`invalid_password`?a?`Incorrect username, password, or LDAP group.`:`Incorrect password.`:s===`username_required`?`Username is required.`:`Login failed: ${s}`}),(0,R.jsx)(`button`,{type:`submit`,disabled:o||n.length===0||a&&e.trim().length===0,className:`w-full rounded-md bg-[var(--auth-button-bg)] px-3 py-2 text-sm font-medium text-[var(--auth-button-text)] transition hover:bg-[var(--auth-button-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:o?`Signing in…`:`Sign in`})]}),m&&(l?(0,R.jsx)(`section`,{className:`w-fit max-w-full whitespace-normal break-words rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-4 text-sm text-[var(--auth-text)] shadow-lg [&_*]:max-w-none [&_a]:text-sky-300 [&_a]:underline [&_code]:rounded [&_code]:bg-[var(--auth-page-bg)] [&_code]:px-1 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:text-base [&_h2]:font-semibold [&_h3]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:max-w-none [&_pre]:whitespace-pre-wrap [&_ul]:list-disc [&_ul]:pl-5`,"aria-label":`Authentication notice`,dangerouslySetInnerHTML:{__html:p}}):(0,R.jsx)(`section`,{className:`w-fit max-w-full whitespace-pre-wrap break-words rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-4 text-sm text-[var(--auth-text)] shadow-lg`,"aria-label":`Authentication notice`,children:c}))]})})}var qi=8;function Ji(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(void 0),c=gr(e=>e.changePassword),l=gr(e=>e.changePasswordPending),u=gr(e=>e.changePasswordError),d=gr(e=>e.logout),f=ji(e=>e.authLogoUrl),p=ji(e=>e.authColorScheme),m=(0,v.useMemo)(()=>Bi(p),[p]),h=t=>{if(t.preventDefault(),s(void 0),n.length<qi){s(`new password must be at least ${qi} characters`);return}if(n!==i){s(`new password and confirmation do not match`);return}if(n===e){s(`new password must differ from the current one`);return}c(e,n)},g=o??Yi(u);return(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-[var(--auth-page-bg)] px-4 text-[var(--auth-text)]`,style:m,children:(0,R.jsxs)(`form`,{onSubmit:h,className:`w-full max-w-sm space-y-4 rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-6 text-[var(--auth-text)] shadow-lg`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`img`,{src:f??`/icons/icon.svg`,alt:``,className:`max-h-6 max-w-24 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Set a new password`})]}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--auth-muted-text)]`,children:`You signed in with the deployment-supplied initial password. Pick a new one before continuing — it will be stored as a hash on the pi-forge data volume.`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Current password`}),(0,R.jsx)(`input`,{type:`password`,value:e,onChange:e=>t(e.target.value),autoFocus:!0,autoComplete:`current-password`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`New password`}),(0,R.jsx)(`input`,{type:`password`,value:n,onChange:e=>r(e.target.value),autoComplete:`new-password`,minLength:qi,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Confirm new password`}),(0,R.jsx)(`input`,{type:`password`,value:i,onChange:e=>a(e.target.value),autoComplete:`new-password`,minLength:qi,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),g!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-red-400 light:text-red-700`,children:g}),(0,R.jsx)(`button`,{type:`submit`,disabled:l||e.length===0||n.length===0,className:`w-full rounded-md bg-[var(--auth-button-bg)] px-3 py-2 text-sm font-medium text-[var(--auth-button-text)] transition hover:bg-[var(--auth-button-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:l?`Saving…`:`Set new password`}),(0,R.jsx)(`button`,{type:`button`,onClick:d,className:`w-full rounded-md border border-[var(--auth-border)] px-3 py-2 text-xs text-[var(--auth-muted-text)] hover:border-[var(--auth-muted-text)] hover:text-[var(--auth-text)]`,children:`Sign out`})]})})}function Yi(e){if(e!==void 0)switch(e){case`invalid_password`:return`Current password is incorrect.`;case`password_unchanged`:return`New password must differ from the current one.`;case`ui_password_not_configured`:return`Password auth is not configured on this server.`;case`auth_required`:return`Session expired — sign in again.`;default:return`Could not change password: ${e}`}}var Xi=`pi-forge/install-prompt-dismissed`;function Zi(){return typeof window>`u`?!1:window.navigator.standalone===!0?!0:window.matchMedia?.(`(display-mode: standalone)`).matches??!1}function Qi(){return typeof navigator>`u`?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function $i(){let e=ct(),[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(()=>typeof localStorage>`u`?!1:localStorage.getItem(Xi)===`true`),[a,o]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(typeof window>`u`||Zi()||r)return;let t=e=>{e.preventDefault(),n(e)};if(window.addEventListener(`beforeinstallprompt`,t),Qi()&&e){let e=window.setTimeout(()=>o(!0),1500);return()=>{window.clearTimeout(e),window.removeEventListener(`beforeinstallprompt`,t)}}return()=>window.removeEventListener(`beforeinstallprompt`,t)},[e,r]);let s=()=>{i(!0),n(void 0),o(!1);try{localStorage.setItem(Xi,`true`)}catch{}},c=async()=>{if(t===void 0)return;await t.prompt();let e=await t.userChoice;n(void 0),e.outcome===`accepted`&&s()};return!e||r||Zi()||t===void 0&&!a?null:(0,R.jsx)(`div`,{className:`border-b border-neutral-800 bg-neutral-900 px-3 py-2 text-sm text-neutral-200`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:t===void 0?(0,R.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[`Install: tap `,(0,R.jsx)($e,{size:14,className:`inline shrink-0 text-neutral-400`}),` Share, then `,(0,R.jsx)(`span`,{className:`font-medium`,children:`Add to Home Screen`}),`.`]}):(0,R.jsx)(`span`,{children:`Install pi-forge as an app for a fullscreen experience.`})}),t!==void 0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>void c(),className:`shrink-0 rounded-md bg-neutral-100 px-3 py-1.5 text-xs font-medium text-neutral-900 hover:bg-neutral-200`,children:`Install`}),(0,R.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Dismiss install prompt`,className:`inline-flex min-h-9 min-w-9 shrink-0 items-center justify-center rounded text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,children:(0,R.jsx)(at,{size:16})})]})})}function ea({onClose:e,required:t=!1}){let n=xr(e=>e.create),r=ji(e=>e.minimal),i=ji(e=>e.workspaceRoot),a=xr(e=>e.load),o=xr(e=>e.setActive),[s,c]=(0,v.useState)(`create`),[l,u]=(0,v.useState)(`name`),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(),[_,y]=(0,v.useState)(),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)([]),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(s!==`create`||l!==`browse`)return;let e=!1;return T(!0),g(void 0),L.browse(_).then(t=>{e||(y(t.path),x(t.parentPath),C(t.entries))}).catch(t=>{e||g(t instanceof N?t.code:t.message)}).finally(()=>{e||T(!1)}),()=>{e=!0}},[s,l,_]);let ee=async()=>{let t=d.trim();if(t.length!==0){if(!r){u(`browse`);return}if(i.length===0){g(`workspace_not_loaded`);return}m(!0),g(void 0);try{let{path:r}=await L.mkdir(i,t);await n(t,r),e()}catch(e){g(e instanceof N?e.code:e.message),m(!1)}}},te=async t=>{if(!p){if(i.length>0&&t===i){g(`workspace_root_not_allowed`);return}m(!0),g(void 0);try{await n(d.trim(),t),e()}catch(e){g(e instanceof N?e.code:e.message),m(!1)}}},ne=()=>{b!==null&&y(b)},re=async()=>{if(!(!_||E.trim().length===0)){g(void 0);try{let{path:e}=await L.mkdir(_,E.trim());D(``),k(!1),await te(e)}catch(e){g(e instanceof N?e.code:e.message)}}};return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4`,children:(0,R.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg border border-neutral-800 bg-neutral-900 p-6 shadow-xl`,children:[(0,R.jsxs)(`header`,{className:`mb-4 flex items-center justify-between`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:s===`clone`?`Clone repository`:l===`name`?`New project`:`Pick a folder for "${d.trim()}"`}),!t&&(0,R.jsx)(`button`,{onClick:e,className:`rounded-md px-2 py-1 text-sm text-neutral-400 hover:bg-neutral-800`,children:`Cancel`})]}),l===`name`&&(0,R.jsxs)(`div`,{className:`mb-3 flex gap-1 border-b border-neutral-800`,children:[(0,R.jsx)(ta,{active:s===`create`,onClick:()=>c(`create`),children:`Create / pick folder`}),(0,R.jsx)(ta,{active:s===`clone`,onClick:()=>c(`clone`),children:`Clone repository`})]}),l===`name`&&s===`create`&&(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ee()},className:`space-y-4`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Project name`}),(0,R.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm outline-none focus:border-neutral-500`}),r&&i.length>0&&(0,R.jsxs)(`span`,{className:`block font-mono text-[11px] text-neutral-500`,children:[`Will create `,i,`/`,d.trim().length>0?d.trim():`<name>`]})]}),h!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400 light:text-red-700`,children:[`Error: `,h]}),(0,R.jsx)(`button`,{type:`submit`,disabled:d.trim().length===0||p,className:`w-full rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,children:r?p?`Creating…`:`Create project`:`Next: pick folder`})]}),l===`name`&&s===`clone`&&(0,R.jsx)(na,{initialName:d,workspaceRoot:i,onProjectCreated:async t=>{await a(),o(t),e()},onCancel:e}),s===`create`&&l===`browse`&&(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-neutral-400`,children:[(0,R.jsx)(`button`,{onClick:ne,disabled:b===null,className:`rounded-md border border-neutral-700 px-2 py-1 hover:bg-neutral-800 disabled:cursor-not-allowed disabled:opacity-40`,title:b===null?`At workspace root`:`Up one folder`,children:`↑ up`}),(0,R.jsx)(`code`,{className:`truncate font-mono text-neutral-300`,children:_??`(loading)`})]}),(0,R.jsxs)(`div`,{className:`max-h-64 overflow-y-auto rounded-md border border-neutral-800 bg-neutral-950`,children:[w&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-sm text-neutral-400`,children:`Loading…`}),!w&&S.length===0&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-sm text-neutral-400`,children:`(empty)`}),!w&&S.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 px-3 py-2 text-sm last:border-b-0`,children:[(0,R.jsxs)(`button`,{onClick:()=>y(e.path),className:`flex flex-1 items-center gap-2 text-left text-neutral-200 hover:text-white`,children:[(0,R.jsx)(`span`,{children:`📁`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name}),e.isGitRepo&&(0,R.jsx)(`span`,{className:`rounded-sm bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-300`,children:`git`})]}),(0,R.jsx)(`button`,{onClick:()=>void te(e.path),disabled:p,className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-200 hover:bg-neutral-800 disabled:opacity-50`,children:`Select`})]},e.path))]}),O?(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:`folder name`,className:`flex-1 rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm`,autoFocus:!0}),(0,R.jsx)(`button`,{onClick:()=>void re(),className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900`,children:`Create + select`}),(0,R.jsx)(`button`,{onClick:()=>{k(!1),D(``)},className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`Cancel`})]}):(0,R.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>u(`name`),className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`← Back`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>k(!0),className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`+ New folder`}),(0,R.jsx)(`button`,{onClick:()=>_&&void te(_),disabled:!_||p||i.length>0&&_===i,className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,title:i.length>0&&_===i?`Pick a sub-folder — the workspace root itself can't be a project.`:`Use this folder as the project root`,children:`Select this folder`})]})]})]}),h!==void 0&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-red-400 light:text-red-700`,children:h===`path_not_allowed`?`That folder is outside the workspace root.`:h===`workspace_root_not_allowed`?`Pick a sub-folder — the workspace root itself can't be a project.`:h===`not_a_directory`?`That path is not a directory.`:h===`already_exists`?`A folder with that name already exists.`:h===`duplicate_path`?`Another project already points at that folder.`:h===`network_error`?`Couldn't reach the server.`:`Error: ${h}`})]})})}function ta({active:e,onClick:t,children:n}){return(0,R.jsx)(`button`,{onClick:t,className:`-mb-px border-b-2 px-3 py-2 text-sm transition-colors ${e?`border-neutral-200 text-neutral-100`:`border-transparent text-neutral-400 hover:text-neutral-200`}`,children:n})}function na({initialName:e,workspaceRoot:t,onProjectCreated:n,onCancel:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(e),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(),[T,E]=(0,v.useState)(),[D,O]=(0,v.useState)(null),[k,ee]=(0,v.useState)([]),[te,ne]=(0,v.useState)(!1),re=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{if(!g)try{let e=new URL(i).pathname.split(`/`).filter(e=>e.length>0),t=(e[e.length-1]??``).replace(/\.git$/i,``);t.length>0&&d(t)}catch{}},[i,g]),(0,v.useEffect)(()=>{y||e.trim().length>0||u.length>0&&p(u)},[u,e,y]);let ie=async e=>{if(e.preventDefault(),x)return;if(i.trim().length===0){w(`url_required`);return}if(u.trim().length===0){w(`folder_required`);return}if(f.trim().length===0){w(`name_required`);return}if(t.length===0){w(`workspace_not_loaded`);return}S(!0),w(void 0),E(`starting…`),O(null),ee([]);let r=new AbortController;re.current=r;try{let e={url:i.trim(),parentPath:t,folderName:u.trim(),projectName:f.trim()};o.trim().length>0&&(e.branch=o.trim()),c.length>0&&(e.token=c),m&&(e.insecureTls=!0);let a=await L.cloneProject(e,r.signal),s,l=!1,d=``;for await(let e of hr(a))switch(e.type){case`started`:E(`starting clone`),ee(t=>[...t,`→ cloning ${e.cloneUrlForDisplay}`]);break;case`progress`:E(e.phase),O(e.percent);break;case`stderr`:ee(t=>{let n=[...t,e.line];return n.length>200?n.slice(n.length-200):n});break;case`done`:E(`clone complete, creating project…`),O(100);break;case`project_created`:s=e.project.id;break;case`error`:l=!0,d=e.message;break}if(s!==void 0){await n(s);return}w(l?d:`clone_ended_without_project`)}catch(e){e instanceof Error&&e.name===`AbortError`?w(`cancelled`):w(e instanceof N?`${e.code}: ${e.message??``}`:e.message)}finally{S(!1),re.current=void 0}};return(0,R.jsxs)(`form`,{onSubmit:e=>{ie(e)},className:`space-y-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Repository URL`}),(0,R.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`https://github.com/owner/repo.git`,disabled:x,autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Branch (optional)`}),(0,R.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`default branch`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Folder name`}),(0,R.jsx)(`input`,{value:u,onChange:e=>{d(e.target.value),_(!0)},placeholder:`auto from URL`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Project name`}),(0,R.jsx)(`input`,{value:f,onChange:e=>{p(e.target.value),b(!0)},placeholder:`auto from folder`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm outline-none focus:border-neutral-500 disabled:opacity-60`}),t.length>0&&u.length>0&&(0,R.jsxs)(`span`,{className:`block font-mono text-[11px] text-neutral-500`,children:[`Will clone into `,t,`/`,u]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Access token (optional, for private repos)`}),(0,R.jsx)(`input`,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:`ghp_... / glpat_... / etc.`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`}),(0,R.jsxs)(`span`,{className:`block text-[11px] text-neutral-500`,children:[`Sent over HTTPS, embedded as `,(0,R.jsx)(`code`,{children:`x-access-token:<token>`}),` in the clone URL, and stripped from `,(0,R.jsx)(`code`,{children:`.git/config`}),` after success.`]})]}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-amber-900/40 bg-amber-950/30 px-2 py-1.5 text-xs light:border-amber-300 light:bg-amber-50`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),disabled:x,className:`mt-0.5`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`text-amber-200 light:text-amber-800`,children:`Allow self-signed / invalid TLS certificate`}),(0,R.jsx)(`br`,{}),(0,R.jsxs)(`span`,{className:`text-[11px] text-amber-300/70 light:text-amber-700/80`,children:[`⚠ Disables MITM protection for this clone and persists a URL-scoped local git config entry for future fetch/pull/push. Use only for internal Git hosts with known self-signed certs/private CAs. The server logs `,(0,R.jsx)(`code`,{children:`git-clone-insecure-tls`}),` to stderr on every use.`]})]})]}),(x||T!==void 0)&&(0,R.jsxs)(`div`,{className:`space-y-1 rounded-md border border-neutral-800 bg-neutral-950 p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,R.jsx)(`span`,{className:`text-neutral-300`,children:T??`starting…`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:D===null?``:`${D}%`})]}),D!==null&&(0,R.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded bg-neutral-800`,children:(0,R.jsx)(`div`,{className:`h-full bg-emerald-500 transition-all`,style:{width:`${Math.max(2,Math.min(100,D))}%`}})}),k.length>0&&(0,R.jsxs)(`details`,{open:te,onToggle:e=>ne(e.target.open),className:`pt-1`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-[10px] uppercase tracking-wider text-neutral-500 hover:text-neutral-300`,children:[`Raw output (`,k.length,`)`]}),(0,R.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words font-mono text-[10px] leading-snug text-neutral-400`,children:k.join(`
|
|
24
|
-
`)})]})]}),C!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400 light:text-red-700`,children:[`Error: `,C]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{re.current===void 0?r():re.current.abort()},className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:x?`Cancel clone`:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:x||i.trim().length===0||f.trim().length===0||t.length===0,className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,children:x?`Cloning…`:`Clone + create project`})]})]})}function ra({open:e,onClose:t,title:n,children:r,width:i=`max-w-sm`,initialFocusRef:a}){let o=(0,v.useRef)(null),s=(0,v.useId)(),c=(0,v.useRef)(t),l=(0,v.useRef)(a);return(0,v.useEffect)(()=>{c.current=t}),(0,v.useEffect)(()=>{l.current=a}),(0,v.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=o.current,r=e=>{if(e.key===`Escape`){e.preventDefault(),c.current();return}if(e.key===`Tab`&&o.current!==null){let t=o.current.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}};document.addEventListener(`keydown`,r);let i=window.setTimeout(()=>{let e=l.current?.current;if(e!=null){e.focus();return}(o.current?.querySelector(`a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`))?.focus()},0);return()=>{document.removeEventListener(`keydown`,r),window.clearTimeout(i),t!==null&&document.contains(t)&&n!==null&&n.contains(document.activeElement)&&t.focus()}},[e]),e?(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-labelledby":s,children:(0,R.jsxs)(`div`,{ref:o,className:`w-full ${i} rounded-lg border border-neutral-800 bg-neutral-900 shadow-xl`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-2`,children:[(0,R.jsx)(`h2`,{id:s,className:`text-sm font-medium text-neutral-100`,children:n}),(0,R.jsx)(`button`,{onClick:t,className:`rounded p-2 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (Esc)`,"aria-label":`Close`,children:(0,R.jsx)(at,{size:20})})]}),r]})}):null}function ia({open:e,onClose:t,onSubmit:n,title:r,label:i,initialValue:a=``,placeholder:o,primaryLabel:s=`OK`}){let[c,l]=(0,v.useState)(a),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{e&&l(a)},[e,a]);let d=c.trim(),f=()=>{d.length!==0&&n(d)};return(0,R.jsx)(ra,{open:e,onClose:t,title:r,initialFocusRef:u,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f()},className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:i}),(0,R.jsx)(`input`,{ref:u,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:o,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:d.length===0,className:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white disabled:cursor-not-allowed disabled:opacity-40`,children:s})]})]})})}function aa({open:e,onClose:t,onConfirm:n,title:r,message:i,primaryLabel:a=`Confirm`,tone:o=`default`}){return(0,R.jsx)(ra,{open:e,onClose:t,title:r,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsx)(`p`,{className:`text-xs text-neutral-300`,children:i}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:n,className:o===`danger`?`rounded-md bg-red-700 px-3 py-1 text-xs font-medium text-red-50 hover:bg-red-600`:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white`,children:a})]})]})})}function oa({projectId:e}){let t=pi(t=>t.byProject[e]??ti),n=pi(e=>e.activeSessionId),r=pi(e=>e.loadSessionsForProject),i=pi(e=>e.setActiveSession),a=pi(e=>e.disposeSession),o=pi(e=>e.renameSession),s=xr(e=>e.setActive),c=xr(e=>e.activeProjectId),l=t=>{c!==e&&s(e),i(t)},[u,d]=(0,v.useState)(void 0),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(void 0),[g,_]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{if(g===void 0)return;let e=()=>_(void 0),t=window.setTimeout(e,sa),n=t=>{let n=t.target;n instanceof Element&&n.closest(`[data-armed-delete="${g}"]`)===null&&e()},r=t=>{t.key===`Escape`&&e()};return document.addEventListener(`pointerdown`,n),document.addEventListener(`keydown`,r),()=>{window.clearTimeout(t),document.removeEventListener(`pointerdown`,n),document.removeEventListener(`keydown`,r)}},[g]);let y=e=>{if(g===e){_(void 0),a(e);return}_(e)},[b,x]=(0,v.useState)(new Set),S=()=>x(new Set),C=e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[w,T]=(0,v.useState)(new Map),E=(e,t)=>{T(n=>{let r=new Map(n);return r.set(e,!t),r})},{topLevel:D,childrenByParent:O}=(0,v.useMemo)(()=>{let n=new Map,r=new Set(t.map(e=>e.sessionId));for(let e of t){if(e.parentSessionId===void 0||!r.has(e.parentSessionId)||e.parentSessionId===e.sessionId)continue;let t=n.get(e.parentSessionId);t===void 0?n.set(e.parentSessionId,[e]):t.push(e)}let i=t.filter(e=>e.parentSessionId===void 0||!r.has(e.parentSessionId)||e.parentSessionId===e.sessionId);return i.length===0&&t.length>0&&(i=t),t.some(e=>e.parentSessionId!==void 0)&&console.info(`[sessions] SessionList grouping`,{projectId:e,sessionCount:t.length,topLevelCount:i.length,childCount:Array.from(n.values()).reduce((e,t)=>e+t.length,0),allIds:Array.from(r),parentIdsOnChildren:t.filter(e=>e.parentSessionId!==void 0).map(e=>e.parentSessionId),bucketed:Array.from(n.keys())}),{topLevel:i,childrenByParent:n}},[t,e]),k=async()=>{if(m===void 0)return;let e=m.sessionIds;h(void 0);for(let t of e)try{await a(t)}catch{}S()};(0,v.useEffect)(()=>{r(e)},[e,r]);let ee=(e,t)=>{d(e),p(t)},te=()=>{d(void 0),p(``)},ne=async e=>{let t=f.trim();te();try{await o(e,t)}catch{}},re=(e,t)=>{e.key===`Enter`?(e.preventDefault(),ne(t)):e.key===`Escape`&&(e.preventDefault(),te())},ie=(e,t,r)=>{let i=O.get(e.sessionId)??[],a=w.get(e.sessionId)===!0,o=[(0,R.jsx)(ca,{session:e,isActive:e.sessionId===n,isSelected:b.has(e.sessionId),isRenaming:u===e.sessionId,renameDraft:f,childCount:i.length,isExpanded:a,depth:t,onSelect:l,onToggleSelect:C,onStartRename:ee,onChangeRename:p,onRenameKeyDown:re,onCommitRename:e=>void ne(e),onToggleExpanded:E,isArmedForDelete:g===e.sessionId,onDeleteClick:y},e.sessionId)];if(!a)return o;let s=new Set(r);s.add(e.sessionId);for(let e of i)s.has(e.sessionId)||o.push(...ie(e,t+1,s));return o};return(0,R.jsxs)(`div`,{className:`ml-6 mt-1 space-y-0.5`,children:[t.length===0&&(0,R.jsx)(`p`,{className:`px-2 py-1 text-xs italic text-neutral-600`,children:`No sessions yet.`}),b.size>0&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded bg-neutral-900/60 px-2 py-1 text-[11px] text-neutral-300`,children:[(0,R.jsxs)(`span`,{children:[b.size,` selected`]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>h({sessionIds:Array.from(b)}),className:`rounded border border-red-700/50 px-1.5 py-0.5 text-red-300 hover:bg-red-900/20 light:border-red-400 light:text-red-700 light:hover:bg-red-50`,children:`Delete`}),(0,R.jsx)(`button`,{onClick:S,className:`rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Clear`})]})]}),D.flatMap(e=>ie(e,0,new Set)),(0,R.jsx)(aa,{open:m!==void 0,onClose:()=>h(void 0),onConfirm:()=>void k(),title:`Delete ${m?.sessionIds.length??0} session${(m?.sessionIds.length??0)===1?``:`s`}`,message:`Delete the ${m?.sessionIds.length??0} selected session${(m?.sessionIds.length??0)===1?``:`s`}? Live sessions are killed and on-disk JSONLs are removed. Cannot be undone.`,primaryLabel:`Delete all`,tone:`danger`})]})}var sa=3e3;function ca(e){let{session:t,isActive:n,isSelected:r,isRenaming:i,renameDraft:a,childCount:o,isExpanded:s,depth:c,onSelect:l,onToggleSelect:u,onStartRename:d,onChangeRename:f,onRenameKeyDown:p,onCommitRename:m,onToggleExpanded:h,isArmedForDelete:g,onDeleteClick:_}=e,v=t.name??(t.firstMessage.length>0?t.firstMessage.slice(0,40):`session ${t.sessionId.slice(0,6)}`);return(0,R.jsxs)(`div`,{style:c>0?{marginLeft:`${Math.min(c,3)*8}px`}:void 0,className:`group flex items-center gap-1 rounded border-l-2 border-t border-t-neutral-800/40 px-2 py-0.5 text-xs light:border-t-neutral-200 ${r?`border-l-blue-400 bg-blue-500/15 text-neutral-100 hover:bg-blue-500/25`:n?`border-l-transparent bg-neutral-800 text-neutral-100`:`border-l-transparent text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`}`,children:[o>0?(0,R.jsx)(`button`,{onClick:()=>h(t.sessionId,s),className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-neutral-500 hover:text-neutral-200`,title:`${o} child/worker session${o===1?``:`s`}`,"aria-label":s?`Collapse child sessions`:`Expand child sessions`,children:s?(0,R.jsx)(Se,{size:12}):(0,R.jsx)(we,{size:12})}):(0,R.jsx)(`span`,{className:`inline-block h-4 w-4 shrink-0`,"aria-hidden":`true`}),i?(0,R.jsx)(`input`,{autoFocus:!0,value:a,onFocus:e=>e.currentTarget.select(),onChange:e=>f(e.target.value),onKeyDown:e=>p(e,t.sessionId),onBlur:()=>m(t.sessionId),placeholder:v,maxLength:200,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-xs text-neutral-100 outline-none focus:border-neutral-500`}):(0,R.jsxs)(`button`,{onClick:e=>{if(e.metaKey||e.ctrlKey){u(t.sessionId);return}l(t.sessionId)},onDoubleClick:()=>d(t.sessionId,v),className:`flex-1 truncate text-left`,title:`${t.sessionId} — double-click to rename, Cmd/Ctrl+click to select for bulk delete`,children:[t.isLive&&(0,R.jsx)(`span`,{className:`mr-1 text-emerald-500 light:text-emerald-700`,children:`●`}),t.isExternalLive===!0&&(0,R.jsx)(`span`,{className:`mr-1 text-amber-400 light:text-amber-700`,title:`pi-subagents external ${t.externalState??`running`}`,children:`●`}),c>0&&(0,R.jsx)(`span`,{className:`mr-1 text-purple-400 light:text-purple-700`,title:`child/worker session`,children:`↳`}),v]}),!i&&(0,R.jsx)(`button`,{"data-armed-delete":g?t.sessionId:void 0,onClick:e=>{e.stopPropagation(),_(t.sessionId)},className:g?`inline-flex h-6 items-center rounded border border-red-500 px-1.5 text-[11px] font-medium uppercase leading-none tracking-wide text-red-300 hover:bg-red-500/10 light:border-red-600 light:text-red-700 light:hover:bg-red-100`:`inline-flex h-6 w-6 items-center justify-center rounded text-neutral-500 hover:text-red-400 light:hover:text-red-700`,title:g?`Click again to delete (Esc to cancel)`:t.isLive?`Delete session — also kills the live shell`:`Delete session JSONL from disk`,"aria-label":g?`Confirm delete`:`Delete session`,children:g?`Confirm`:(0,R.jsx)(at,{size:16})})]})}function la({className:e=``}={}){let t=xr(e=>e.projects),n=xr(e=>e.activeProjectId),r=xr(e=>e.collapsed),i=xr(e=>e.setActive),a=xr(e=>e.toggleCollapsed),o=xr(e=>e.remove),s=xr(e=>e.rename),c=xr(e=>e.reorder),l=pi(e=>e.byProject),u=pi(e=>e.createSession),d=pi(e=>e.disposeSession),f=async e=>{n!==e&&i(e);try{await u(e)}catch{}},[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(),[w,T]=(0,v.useState)(void 0),E=(e,t)=>{let n=l[e]??[],r=n.filter(e=>e.isLive).length,i=n.filter(e=>!e.isLive).length;T({id:e,name:t,liveCount:r,onDiskCount:i,acknowledged:!1,submitting:!1})},D=async()=>{if(w===void 0)return;let{id:e}=w;T({...w,submitting:!0});let t=(l[e]??[]).filter(e=>e.isLive).map(e=>e.sessionId);t.length>0&&await Promise.all(t.map(e=>d(e).catch(()=>void 0))),T(void 0),o(e)},O=async e=>{let t=_.trim();if(t.length===0){g(void 0);return}try{await s(e,t)}finally{g(void 0),y(``)}},k=()=>{x(void 0),C(void 0)},ee=async e=>{let n=b;if(k(),n===void 0||n===e)return;let r=t.findIndex(e=>e.id===n),i=t.findIndex(t=>t.id===e);if(r===-1||i===-1)return;let a=t.map(e=>e.id),[o]=a.splice(r,1);if(o!==void 0){a.splice(i,0,o);try{await c(a)}catch{}}};return(0,R.jsxs)(`aside`,{className:`flex h-full w-64 flex-col border-r border-neutral-800 bg-neutral-950 ${e}`,style:{paddingTop:`env(safe-area-inset-top)`,paddingBottom:`env(safe-area-inset-bottom)`},children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:`Projects`}),(0,R.jsx)(`button`,{onClick:()=>m(!0),className:`rounded-md border border-neutral-700 px-2 py-0.5 text-xs text-neutral-200 hover:bg-neutral-800`,children:`+ New`})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-1`,children:[t.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-4 text-sm text-neutral-500`,children:`No projects yet.`}),t.map(e=>{let t=e.id===n,o=r[e.id]??!1;return(0,R.jsxs)(`div`,{className:`mt-1 px-1 ${b===e.id?`opacity-60`:``}`,draggable:h!==e.id,onDragStart:t=>{if(h===e.id){t.preventDefault();return}t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id),x(e.id)},onDragEnter:t=>{t.preventDefault(),b!==void 0&&b!==e.id&&C(e.id)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},onDragEnd:k,onDrop:t=>{t.preventDefault(),ee(e.id)},children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-md px-2 py-1 text-sm ring-inset transition-colors ${S===e.id?`ring-1 ring-cyan-500/70`:t?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900`}`,children:[(0,R.jsx)(`span`,{className:`flex cursor-grab items-center text-neutral-600 group-hover:text-neutral-400`,title:`Drag to reorder projects`,"aria-hidden":`true`,children:(0,R.jsx)(Ie,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>a(e.id),className:`flex items-center text-neutral-500 hover:text-neutral-300`,title:o?`Expand`:`Collapse`,children:o?(0,R.jsx)(we,{size:16}):(0,R.jsx)(Se,{size:16})}),h===e.id?(0,R.jsx)(`input`,{value:_,onChange:e=>y(e.target.value),onBlur:()=>void O(e.id),onKeyDown:t=>{t.key===`Enter`&&O(e.id),t.key===`Escape`&&g(void 0)},autoFocus:!0,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-sm`}):(0,R.jsxs)(`button`,{onClick:()=>i(e.id),onDoubleClick:()=>{g(e.id),y(e.name)},className:`flex min-w-0 flex-1 flex-col items-start text-left leading-tight`,title:e.path,children:[(0,R.jsx)(`span`,{className:`w-full truncate`,children:e.name}),(0,R.jsx)(`span`,{className:`w-full truncate font-mono text-[10px] text-neutral-500`,children:ua(e.path)})]}),(0,R.jsx)(`button`,{onClick:()=>void f(e.id),className:`inline-flex p-1 text-neutral-500 hover:text-neutral-200`,title:`New session in this project`,children:(0,R.jsx)(qe,{size:16})}),(0,R.jsx)(`button`,{onClick:()=>E(e.id,e.name),className:`inline-flex items-center p-1 text-neutral-500 hover:text-red-400`,title:`Delete project (blocked while live sessions exist)`,children:(0,R.jsx)(at,{size:16})})]}),!o&&(0,R.jsx)(oa,{projectId:e.id})]},e.id)})]}),p&&(0,R.jsx)(ea,{onClose:()=>m(!1)}),(0,R.jsx)(ra,{open:w!==void 0,onClose:()=>T(void 0),title:w===void 0?`Delete project`:`Delete project "${w.name}"`,children:w!==void 0&&(()=>{let e=w.liveCount+w.onDiskCount,t=e>0,n=!w.submitting&&(!t||w.acknowledged);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-300`,children:[`Remove "`,w.name,`" from pi-forge.`]}),(0,R.jsxs)(`ul`,{className:`ml-4 list-disc space-y-0.5 text-[11px] text-neutral-400`,children:[(0,R.jsxs)(`li`,{children:[`Project record + the project's session directory (`,(0,R.jsxs)(`code`,{className:`font-mono text-[10px] text-neutral-400`,children:[`.pi/sessions/`,w.id,`/`]}),`) will be deleted.`]}),w.liveCount>0&&(0,R.jsxs)(`li`,{children:[w.liveCount,` live session`,w.liveCount===1?``:`s`,` will be disposed first.`]}),(0,R.jsxs)(`li`,{children:[`The project's workspace folder on disk is `,(0,R.jsx)(`strong`,{children:`not`}),` touched.`]})]}),t&&(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-red-900/40 bg-red-950/30 px-2 py-1.5 text-xs text-red-200 light:border-red-300 light:bg-red-50 light:text-red-800`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:w.acknowledged,onChange:e=>T(t=>t===void 0?t:{...t,acknowledged:e.target.checked}),className:`mt-0.5 h-3 w-3`}),(0,R.jsxs)(`span`,{children:[`Yes, I understand this will delete `,e,` session`,e===1?``:`s`,w.liveCount>0&&w.onDiskCount>0?` (${w.liveCount} live, ${w.onDiskCount} on disk)`:w.liveCount>0?` (${w.liveCount} live)`:``,`. This can't be undone.`]})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>T(void 0),disabled:w.submitting,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800 disabled:opacity-50`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:!n,className:`rounded-md bg-red-700 px-3 py-1 text-xs font-medium text-red-50 hover:bg-red-600 disabled:opacity-50 disabled:hover:bg-red-700`,children:w.submitting?`Deleting…`:`Delete`})]})]})})()})]})}function ua(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t[t.length-1]??e}function da(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=da(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function fa(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=da(e))&&(r&&(r+=` `),r+=t);return r}var pa=Object.create,ma=Object.defineProperty,ha=Object.defineProperties,ga=Object.getOwnPropertyDescriptor,_a=Object.getOwnPropertyDescriptors,va=Object.getOwnPropertyNames,ya=Object.getOwnPropertySymbols,ba=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty,Sa=Object.prototype.propertyIsEnumerable,Ca=(e,t,n)=>t in e?ma(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wa=(e,t)=>{for(var n in t||={})xa.call(t,n)&&Ca(e,n,t[n]);if(ya)for(var n of ya(t))Sa.call(t,n)&&Ca(e,n,t[n]);return e},Ta=(e,t)=>ha(e,_a(t)),Ea=(e,t)=>{var n={};for(var r in e)xa.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ya)for(var r of ya(e))t.indexOf(r)<0&&Sa.call(e,r)&&(n[r]=e[r]);return n},Da=(e,t)=>function(){return t||(0,e[va(e)[0]])((t={exports:{}}).exports,t),t.exports},Oa=(e,t)=>{for(var n in t)ma(e,n,{get:t[n],enumerable:!0})},ka=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of va(t))!xa.call(e,i)&&i!==n&&ma(e,i,{get:()=>t[i],enumerable:!(r=ga(t,i))||r.enumerable});return e},z=((e,t,n)=>(n=e==null?{}:pa(ba(e)),ka(t||!e||!e.__esModule?ma(n,`default`,{value:e,enumerable:!0}):n,e)))(Da({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&`).replace(/</g,`<`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){n||={};var i,a;switch(r.util.type(t)){case`Object`:if(a=r.util.objId(t),n[a])return n[a];for(var o in i={},n[a]=i,t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case`Array`:return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach(function(t,r){i[r]=e(t,n)}),i);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return`none`},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,`gi`),``),t.classList.add(`language-`+n)},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){i||=r.languages;var a=i[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=i[e];return i[e]=o,r.languages.DFS(r.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,i,a){a||={};var o=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],i||s);var c=t[s],l=r.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(r.hooks.run(`before-tokenize`,a),!a.grammar)throw Error(`The language "`+a.language+`" has no grammar.`);return a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run(`after-tokenize`,a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new s;return c(i,i.head,e),o(e,i,t,i.head,0),u(i)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!(!n||!n.length))for(var i=0,a;a=n[i++];)a(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}i.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var i=``;return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`"`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function a(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function o(e,t,n,s,u,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=s.next,C=u;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof i)){var T=1,E;if(v){if(E=a(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,O=E.index+E[0].length,k=C;for(k+=S.value.length;D>=k;)S=S.next,k+=S.value.length;if(k-=S.value.length,C=k,S.value instanceof i)continue;for(var ee=S;ee!==t.tail&&(k<O||typeof ee.value==`string`);ee=ee.next)T++,k+=ee.value.length;T--,w=e.slice(C,k),E.index-=C}else if(E=a(x,0,w,_),!E)continue;var D=E.index,te=E[0],ne=w.slice(0,D),re=w.slice(D+te.length),ie=C+w.length;d&&ie>d.reach&&(d.reach=ie);var ae=S.prev;ne&&(ae=c(t,ae,ne),C+=ne.length),l(t,ae,T);var A=new i(f,g?r.tokenize(te,g):te,y,te);if(S=c(t,ae,A),re&&c(t,S,re),T>1){var j={cause:f+`,`+m,reach:ie};o(e,t,n,S.prev,C,j),d&&j.reach>d.reach&&(d.reach=j.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function l(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function u(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}return r}();t.exports=n,n.default=n}})());z.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},z.languages.markup.tag.inside[`attr-value`].inside.entity=z.languages.markup.entity,z.languages.markup.doctype.inside[`internal-subset`].inside=z.languages.markup,z.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&/,`&`))}),Object.defineProperty(z.languages.markup.tag,"addInlined",{value:function(e,t){var n={},n=(n[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:z.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),t=(n[`language-`+t]={pattern:/[\s\S]+/,inside:z.languages[t]},{});t[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:n},z.languages.insertBefore(`markup`,`cdata`,t)}}),Object.defineProperty(z.languages.markup.tag,"addAttribute",{value:function(e,t){z.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:z.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),z.languages.html=z.languages.markup,z.languages.mathml=z.languages.markup,z.languages.svg=z.languages.markup,z.languages.xml=z.languages.extend(`markup`,{}),z.languages.ssml=z.languages.xml,z.languages.atom=z.languages.xml,z.languages.rss=z.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:`escape`},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r=`(?:[^\\\\-]|`+n.source+`)`,r=RegExp(r+`-`+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:`variable`};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:`operator`},"char-class-punctuation":{pattern:/^\[|\]$/,alias:`punctuation`},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:`operator`}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:`keyword`},{pattern:/\\k<[^<>']+>/,alias:`keyword`,inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:`function`},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:`punctuation`,inside:{"group-name":i}},{pattern:/\)/,alias:`punctuation`}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:`number`},alternation:{pattern:/\|/,alias:`keyword`}}}(z),z.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},z.languages.javascript=z.languages.extend(`clike`,{"class-name":[z.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),z.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,z.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:z.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:z.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:z.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:z.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:z.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),z.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:z.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),z.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),z.languages.markup&&(z.languages.markup.tag.addInlined(`script`,`javascript`),z.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),z.languages.js=z.languages.javascript,z.languages.actionscript=z.languages.extend(`javascript`,{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),z.languages.actionscript[`class-name`].alias=`function`,delete z.languages.actionscript.parameter,delete z.languages.actionscript[`literal-property`],z.languages.markup&&z.languages.insertBefore(`actionscript`,`string`,{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:z.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:`variable`};e.languages.coffeescript=e.languages.extend(`javascript`,{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:`variable`}}),e.languages.insertBefore(`coffeescript`,`comment`,{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:`comment`},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:`regex`,inside:{comment:t,interpolation:n}}}),e.languages.insertBefore(`coffeescript`,`string`,{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:`punctuation`},script:{pattern:/[\s\S]+/,alias:`language-javascript`,inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:`string`},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:`string`,inside:{interpolation:n}}]}),e.languages.insertBefore(`coffeescript`,`keyword`,{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript[`template-string`],e.languages.coffee=e.languages.coffeescript}(z),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(t,n){(t=typeof t==`string`?[t]:t).forEach(function(t){var r=function(e){e.inside||={},e.inside.rest=n},i=`doc-comment`;if(a=e.languages[t]){var a,o=a[i];if((o||=(a=e.languages.insertBefore(t,`comment`,{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:`comment`}}))[i])instanceof RegExp&&(o=a[i]={pattern:o}),Array.isArray(o))for(var s=0,c=o.length;s<c;s++)o[s]instanceof RegExp&&(o[s]={pattern:o[s]}),r(o[s]);else r(o)}})}}),t.addSupport([`java`,`javascript`,`php`],t)}(z),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined(`style`,`css`),t.tag.addAttribute(`style`,`css`))}(z),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+`)*\\]`),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:`keyword`},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside[`selector-function-argument`].inside=t,e.languages.insertBefore(`css`,`property`,{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore(`css`,`function`,{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:`color`},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(z),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(z),function(e){function t(e){return e=e.replace(/<inner>/g,function(){return`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var n="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",r=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return n}),i=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`,a=(e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+r+i+`(?:`+r+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+r+i+`)(?:`+r+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+r+`)`+i+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+r+`$`),inside:{"table-header":{pattern:RegExp(n),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:t(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:t(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){e.language!==`markdown`&&e.language!==`md`||function e(t){if(t&&typeof t!=`string`)for(var n=0,r=t.length;n<r;n++){var i,a=t[n];a.type===`code`?(i=a.content[1],a=a.content[3],i&&a&&i.type===`code-language`&&a.type===`code-block`&&typeof i.content==`string`&&(i=i.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`),i=`language-`+(i=(/[a-z][\w-]*/i.exec(i)||[``])[0].toLowerCase()),a.alias?typeof a.alias==`string`?a.alias=[a.alias,i]:a.alias.push(i):a.alias=[i])):e(a.content)}}(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var c=t.classes[r],c=/language-(.+)/.exec(c);if(c){n=c[1];break}}var l,u=e.languages[n];u?t.content=e.highlight(function(e){return e=e.replace(a,``),e=e.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var n;return(t=t.toLowerCase())[0]===`#`?(n=t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1)),s(n)):o[t]||e})}(t.content),u,n):n&&n!==`none`&&e.plugins.autoloader&&(l=`md-`+new Date().valueOf()+`-`+Math.floor(0x2386f26fc10000*Math.random()),t.attributes.id=l,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(l);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}),RegExp(e.languages.markup.tag.pattern.source,`gi`)),o={amp:`&`,lt:`<`,gt:`>`,quot:`"`},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(z),z.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:`string`,inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:z.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:`function`},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:`class-name`},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},z.hooks.add(`after-tokenize`,function(e){if(e.language===`graphql`)for(var t=e.tokens.filter(function(e){return typeof e!=`string`&&e.type!==`comment`&&e.type!==`scalar`}),n=0;n<t.length;){var r=t[n++];if(r.type===`keyword`&&r.content===`mutation`){var i=[];if(d([`definition-mutation`,`punctuation`])&&u(1).content===`(`){n+=2;var a=f(/^\($/,/^\)$/);if(a===-1)continue;for(;n<a;n++){var o=u(0);o.type===`variable`&&(p(o,`variable-input`),i.push(o.content))}n=a+1}if(d([`punctuation`,`property-query`])&&u(0).content===`{`&&(n++,p(u(0),`property-mutation`),0<i.length)){var s=f(/^\{$/,/^\}$/);if(s!==-1)for(var c=n;c<s;c++){var l=t[c];l.type===`variable`&&0<=i.indexOf(l.content)&&p(l,`variable-input`)}}}}function u(e){return t[n+e]}function d(e,t){t||=0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function f(e,r){for(var i=1,a=n;a<t.length;a++){var o=t[a],s=o.content;if(o.type===`punctuation`&&typeof s==`string`){if(e.test(s))i++;else if(r.test(s)&&--i===0)return a}}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}}),z.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript[`template-string`],n=t.pattern.source,r=t.inside.interpolation,i=r.inside[`interpolation-punctuation`],a=r.pattern.source;function o(t,r){if(e.languages[t])return{pattern:RegExp(`((?:`+r+`)\\s*)`+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run(`before-tokenize`,t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run(`after-tokenize`,t),t.tokens}function c(t,n,o){var c=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),l=0,u={},c=s(c.map(function(e){if(typeof e==`string`)return e;for(var n,r,e=e.content;t.indexOf((r=l++,n=`___`+o.toUpperCase()+`_`+r+`___`))!==-1;);return u[n]=e,n}).join(``),n,o),d=Object.keys(u);return l=0,function t(n){for(var a=0;a<n.length;a++){if(l>=d.length)return;var o,c,f,p,m,h,g,_=n[a];typeof _==`string`||typeof _.content==`string`?(o=d[l],(g=(h=typeof _==`string`?_:_.content).indexOf(o))!==-1&&(++l,c=h.substring(0,g),m=u[o],f=void 0,(p={})[`interpolation-punctuation`]=i,(p=e.tokenize(m,p)).length===3&&((f=[1,1]).push.apply(f,s(p[1],e.languages.javascript,`javascript`)),p.splice.apply(p,f)),f=new e.Token(`interpolation`,p,r.alias,m),p=h.substring(g+o.length),m=[],c&&m.push(c),m.push(f),p&&(t(h=[p]),m.push.apply(m,h)),typeof _==`string`?(n.splice.apply(n,[a,1].concat(m)),a+=m.length-1):_.content=m)):(g=_.content,t(Array.isArray(g)?g:[g]))}}(c),new e.Token(o,c,`language-`+o,t)}e.languages.javascript[`template-string`]=[o(`css`,`\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)`),o(`html`,`\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?=`),o(`svg`,`\\bsvg`),o(`markdown`,`\\b(?:markdown|md)`),o(`graphql`,`\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)`),o(`sql`,`\\bsql`),t].filter(Boolean);var l={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return typeof e==`string`?e:Array.isArray(e)?e.map(u).join(``):u(e.content)}e.hooks.add(`after-tokenize`,function(t){t.language in l&&function t(n){for(var r=0,i=n.length;r<i;r++){var a,o,s,l=n[r];typeof l!=`string`&&(a=l.content,Array.isArray(a)?l.type===`template-string`?(l=a[1],a.length===3&&typeof l!=`string`&&l.type===`embedded-code`&&(o=u(l),l=l.alias,l=Array.isArray(l)?l[0]:l,s=e.languages[l])&&(a[1]=c(o,s,l))):t(a):typeof a!=`string`&&t([a]))}}(t.tokens)})}(z),function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript}(z),function(e){var t=e.languages.javascript,n=`\\{(?:[^{}]|\\{(?:[^{}]|\\{[^{}]*\\})*\\})+\\}`,r=`(@(?:arg|argument|param|property)\\s+(?:`+n+`\\s+)?)`;e.languages.jsdoc=e.languages.extend(`javadoclike`,{parameter:{pattern:RegExp(r+`(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?=\\s|$)`),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore(`jsdoc`,`keyword`,{"optional-parameter":{pattern:RegExp(r+`\\[(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?:=[^[\\]]+)?\\](?=\\s|$)`),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:`language-javascript`},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(`(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\\s+(?:<TYPE>\\s+)?)[A-Z]\\w*(?:\\.[A-Z]\\w*)*`.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp(`(@[a-z]+\\s+)`+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:`language-javascript`}}}}),e.languages.javadoclike.addSupport(`javascript`,e.languages.jsdoc)}(z),function(e){e.languages.flow=e.languages.extend(`javascript`,{}),e.languages.insertBefore(`flow`,`keyword`,{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:`class-name`}]}),e.languages.flow[`function-variable`].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore(`flow`,`operator`,{"flow-punctuation":{pattern:/\{\||\|\}/,alias:`punctuation`}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(z),z.languages.n4js=z.languages.extend(`javascript`,{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),z.languages.insertBefore(`n4js`,`constant`,{annotation:{pattern:/@+\w+/,alias:`operator`}}),z.languages.n4jsd=z.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,function(){return`(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*`}),t)}e.languages.insertBefore(`javascript`,`function-variable`,{"method-variable":{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript[`function-variable`].pattern.source),lookbehind:!0,alias:[`function-variable`,`method`,`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`function`,{method:{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript.function.source),lookbehind:!0,alias:[`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`constant`,{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:`class-name`},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:`class-name`}]}),e.languages.insertBefore(`javascript`,`keyword`,{imports:{pattern:t(`(\\bimport\\b\\s*)(?:<ID>(?:\\s*,\\s*(?:\\*\\s*as\\s+<ID>|\\{[^{}]*\\}))?|\\*\\s*as\\s+<ID>|\\{[^{}]*\\})(?=\\s*\\bfrom\\b)`),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(`(\\bexport\\b\\s*)(?:\\*(?:\\s*as\\s+<ID>)?(?=\\s*\\bfrom\\b)|\\{[^{}]*\\})`),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:`module`},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:`control-flow`},{pattern:/\bnull\b/,alias:[`null`,`nil`]},{pattern:/\bundefined\b/,alias:`nil`}),e.languages.insertBefore(`javascript`,`operator`,{spread:{pattern:/\.{3}/,alias:`operator`},arrow:{pattern:/=>/,alias:`operator`}}),e.languages.insertBefore(`javascript`,`punctuation`,{"property-access":{pattern:t(`(\\.\\s*)#?<ID>`),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:`variable`},console:{pattern:/\bconsole(?=\s*\.)/,alias:`class-name`}});for(var n=[`function`,`function-variable`,`method`,`method-variable`,`property-access`],r=0;r<n.length;r++){var i=n[r],a=e.languages.javascript[i],i=(a=e.util.type(a)===`RegExp`?e.languages.javascript[i]={pattern:a}:a).inside||{};(a.inside=i)[`maybe-class-name`]=/^[A-Z][\s\S]*/}}(z),function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?0<n.length&&n[n.length-1].tagName===s(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content!==`/>`&&n.push({tagName:s(i.content[0].content[1]),openedBraces:0}):0<n.length&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&0<n.length&&n[n.length-1].openedBraces===0&&(a=s(i),r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(a+=s(t[r+1]),t.splice(r+1,1)),0<r&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(a=s(t[r-1])+a,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,a,null,a)),i.content&&typeof i.content!=`string`&&o(i.content)}}var s=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(s).join(``):``};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||o(e.tokens)})}(z),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`],e.languages.tsx.tag);t.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+t.pattern.source+`)`,t.pattern.flags),t.lookbehind=!0}(z),z.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),alias:`property`,inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:`constant`},"other-directive":{pattern:/#\w+\b/,alias:`property`},attribute:{pattern:/@\w+/,alias:`atrule`},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:`function`},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:`important`},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:`constant`},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:`keyword`},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},z.languages.swift[`string-literal`].forEach(function(e){e.inside.interpolation.inside=z.languages.swift}),function(e){e.languages.kotlin=e.languages.extend(`clike`,{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin[`class-name`];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:`punctuation`},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore(`kotlin`,`string`,{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:`multiline`,inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:`singleline`,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore(`kotlin`,`keyword`,{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:`builtin`}}),e.languages.insertBefore(`kotlin`,`function`,{label:{pattern:/\b\w+@|@\w+\b/,alias:`symbol`}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(z),z.languages.c=z.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),z.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),z.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},z.languages.c.string],char:z.languages.c.char,comment:z.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:z.languages.c}}}}),z.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete z.languages.c.boolean,z.languages.objectivec=z.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete z.languages.objectivec[`class-name`],z.languages.objc=z.languages.objectivec,z.languages.reason=z.languages.extend(`clike`,{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),z.languages.insertBefore(`reason`,`class-name`,{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:`symbol`}}),delete z.languages.reason.function,function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(z),z.languages.go=z.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),z.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete z.languages.go[`class-name`],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])}(z),z.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},z.languages.python[`string-interpolation`].inside.interpolation.inside.rest=z.languages.python,z.languages.py=z.languages.python,z.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},z.languages.webmanifest=z.languages.json;var Aa={};Oa(Aa,{dracula:()=>ja,duotoneDark:()=>Ma,duotoneLight:()=>Na,github:()=>Pa,gruvboxMaterialDark:()=>Xa,gruvboxMaterialLight:()=>Za,jettwaveDark:()=>Ka,jettwaveLight:()=>qa,nightOwl:()=>Fa,nightOwlLight:()=>Ia,oceanicNext:()=>Ra,okaidia:()=>za,oneDark:()=>Ja,oneLight:()=>Ya,palenight:()=>Ba,shadesOfPurple:()=>Va,synthwave84:()=>Ha,ultramin:()=>Ua,vsDark:()=>Wa,vsLight:()=>Ga});var ja={plain:{color:`#F8F8F2`,backgroundColor:`#282A36`},styles:[{types:[`prolog`,`constant`,`builtin`],style:{color:`rgb(189, 147, 249)`}},{types:[`inserted`,`function`],style:{color:`rgb(80, 250, 123)`}},{types:[`deleted`],style:{color:`rgb(255, 85, 85)`}},{types:[`changed`],style:{color:`rgb(255, 184, 108)`}},{types:[`punctuation`,`symbol`],style:{color:`rgb(248, 248, 242)`}},{types:[`string`,`char`,`tag`,`selector`],style:{color:`rgb(255, 121, 198)`}},{types:[`keyword`,`variable`],style:{color:`rgb(189, 147, 249)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(98, 114, 164)`}},{types:[`attr-name`],style:{color:`rgb(241, 250, 140)`}}]},Ma={plain:{backgroundColor:`#2a2734`,color:`#9a86fd`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#6c6783`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#e09142`}},{types:[`property`,`function`],style:{color:`#9a86fd`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#eeebff`}},{types:[`attr-name`],style:{color:`#c4b9fe`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`,`placeholder`,`variable`],style:{color:`#ffcc99`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#c4b9fe`}}]},Na={plain:{backgroundColor:`#faf8f5`,color:`#728fcb`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#b6ad9a`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#063289`}},{types:[`property`,`function`],style:{color:`#b29762`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#2d2006`}},{types:[`attr-name`],style:{color:`#896724`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`],style:{color:`#728fcb`}},{types:[`placeholder`,`variable`],style:{color:`#93abdc`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#896724`}}]},Pa={plain:{color:`#393A34`,backgroundColor:`#f6f8fa`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`],style:{color:`#999988`,fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}},{types:[`string`,`attr-value`],style:{color:`#e3116c`}},{types:[`punctuation`,`operator`],style:{color:`#393A34`}},{types:[`entity`,`url`,`symbol`,`number`,`boolean`,`variable`,`constant`,`property`,`regex`,`inserted`],style:{color:`#36acaa`}},{types:[`atrule`,`keyword`,`attr-name`,`selector`],style:{color:`#00a4db`}},{types:[`function`,`deleted`,`tag`],style:{color:`#d73a49`}},{types:[`function-variable`],style:{color:`#6f42c1`}},{types:[`tag`,`selector`,`keyword`],style:{color:`#00009f`}}]},Fa={plain:{color:`#d6deeb`,backgroundColor:`#011627`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(99, 119, 119)`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`rgb(173, 219, 103)`}},{types:[`variable`],style:{color:`rgb(214, 222, 235)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`],style:{color:`rgb(199, 146, 234)`}},{types:[`selector`,`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(255, 203, 139)`}},{types:[`tag`,`operator`,`keyword`],style:{color:`rgb(127, 219, 202)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`property`],style:{color:`rgb(128, 203, 196)`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}}]},Ia={plain:{color:`#403f53`,backgroundColor:`#FBFBFB`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(72, 118, 214)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(152, 159, 177)`,fontStyle:`italic`}},{types:[`string`,`builtin`,`char`,`constant`,`url`],style:{color:`rgb(72, 118, 214)`}},{types:[`variable`],style:{color:`rgb(201, 103, 101)`}},{types:[`number`],style:{color:`rgb(170, 9, 130)`}},{types:[`punctuation`],style:{color:`rgb(153, 76, 195)`}},{types:[`function`,`selector`,`doctype`],style:{color:`rgb(153, 76, 195)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(17, 17, 17)`}},{types:[`tag`],style:{color:`rgb(153, 76, 195)`}},{types:[`operator`,`property`,`keyword`,`namespace`],style:{color:`rgb(12, 150, 155)`}},{types:[`boolean`],style:{color:`rgb(188, 84, 84)`}}]},La={char:`#D8DEE9`,comment:`#999999`,keyword:`#c5a5c5`,primitive:`#5a9bcf`,string:`#8dc891`,variable:`#d7deea`,boolean:`#ff8b50`,punctuation:`#5FB3B3`,tag:`#fc929e`,function:`#79b6f2`,className:`#FAC863`,method:`#6699CC`,operator:`#fc929e`},Ra={plain:{backgroundColor:`#282c34`,color:`#ffffff`},styles:[{types:[`attr-name`],style:{color:La.keyword}},{types:[`attr-value`],style:{color:La.string}},{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`,`shebang`],style:{color:La.comment}},{types:[`property`,`number`,`function-name`,`constant`,`symbol`,`deleted`],style:{color:La.primitive}},{types:[`boolean`],style:{color:La.boolean}},{types:[`tag`],style:{color:La.tag}},{types:[`string`],style:{color:La.string}},{types:[`punctuation`],style:{color:La.string}},{types:[`selector`,`char`,`builtin`,`inserted`],style:{color:La.char}},{types:[`function`],style:{color:La.function}},{types:[`operator`,`entity`,`url`,`variable`],style:{color:La.variable}},{types:[`keyword`],style:{color:La.keyword}},{types:[`atrule`,`class-name`],style:{color:La.className}},{types:[`important`],style:{fontWeight:`400`}},{types:[`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}}]},za={plain:{color:`#f8f8f2`,backgroundColor:`#272822`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`#f92672`,fontStyle:`italic`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`#8292a2`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`#a6e22e`}},{types:[`variable`],style:{color:`#f8f8f2`}},{types:[`number`],style:{color:`#ae81ff`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`#e6db74`}},{types:[`punctuation`],style:{color:`#f8f8f2`}},{types:[`selector`,`doctype`],style:{color:`#a6e22e`,fontStyle:`italic`}},{types:[`tag`,`operator`,`keyword`],style:{color:`#66d9ef`}},{types:[`boolean`],style:{color:`#ae81ff`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`,opacity:.7}},{types:[`tag`,`property`],style:{color:`#f92672`}},{types:[`attr-name`],style:{color:`#a6e22e !important`}},{types:[`doctype`],style:{color:`#8292a2`}},{types:[`rule`],style:{color:`#e6db74`}}]},Ba={plain:{color:`#bfc7d5`,backgroundColor:`#292d3e`},styles:[{types:[`comment`],style:{color:`rgb(105, 112, 152)`,fontStyle:`italic`}},{types:[`string`,`inserted`],style:{color:`rgb(195, 232, 141)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`,`selector`],style:{color:`rgb(199, 146, 234)`}},{types:[`variable`],style:{color:`rgb(191, 199, 213)`}},{types:[`class-name`,`attr-name`],style:{color:`rgb(255, 203, 107)`}},{types:[`tag`,`deleted`],style:{color:`rgb(255, 85, 114)`}},{types:[`operator`],style:{color:`rgb(137, 221, 255)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`keyword`],style:{fontStyle:`italic`}},{types:[`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}},{types:[`url`],style:{color:`rgb(221, 221, 221)`}}]},Va={plain:{color:`#9EFEFF`,backgroundColor:`#2D2A55`},styles:[{types:[`changed`],style:{color:`rgb(255, 238, 128)`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`}},{types:[`comment`],style:{color:`rgb(179, 98, 255)`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`rgb(255, 255, 255)`}},{types:[`constant`],style:{color:`rgb(255, 98, 140)`}},{types:[`string`,`url`],style:{color:`rgb(165, 255, 144)`}},{types:[`variable`],style:{color:`rgb(255, 238, 128)`}},{types:[`number`,`boolean`],style:{color:`rgb(255, 98, 140)`}},{types:[`attr-name`],style:{color:`rgb(255, 180, 84)`}},{types:[`keyword`,`operator`,`property`,`namespace`,`tag`,`selector`,`doctype`],style:{color:`rgb(255, 157, 0)`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`rgb(250, 208, 0)`}}]},Ha={plain:{backgroundColor:`linear-gradient(to bottom, #2a2139 75%, #34294f)`,backgroundImage:`#34294f`,color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`},styles:[{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`],style:{color:`#495495`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`#ccc`}},{types:[`tag`,`attr-name`,`namespace`,`number`,`unit`,`hexcode`,`deleted`],style:{color:`#e2777a`}},{types:[`property`,`selector`],style:{color:`#72f1b8`,textShadow:`0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475`}},{types:[`function-name`],style:{color:`#6196cc`}},{types:[`boolean`,`selector-id`,`function`],style:{color:`#fdfdfd`,textShadow:`0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975`}},{types:[`class-name`,`maybe-class-name`,`builtin`],style:{color:`#fff5f6`,textShadow:`0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75`}},{types:[`constant`,`symbol`],style:{color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`}},{types:[`important`,`atrule`,`keyword`,`selector-class`],style:{color:`#f4eee4`,textShadow:`0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575`}},{types:[`string`,`char`,`attr-value`,`regex`,`variable`],style:{color:`#f87c32`}},{types:[`parameter`],style:{fontStyle:`italic`}},{types:[`entity`,`url`],style:{color:`#67cdcc`}},{types:[`operator`],style:{color:`ffffffee`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`entity`],style:{cursor:`help`}},{types:[`inserted`],style:{color:`green`}}]},Ua={plain:{color:`#282a2e`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(197, 200, 198)`}},{types:[`string`,`number`,`builtin`,`variable`],style:{color:`rgb(150, 152, 150)`}},{types:[`class-name`,`function`,`tag`,`attr-name`],style:{color:`rgb(40, 42, 46)`}}]},Wa={plain:{color:`#9CDCFE`,backgroundColor:`#1E1E1E`},styles:[{types:[`prolog`],style:{color:`rgb(0, 0, 128)`}},{types:[`comment`],style:{color:`rgb(106, 153, 85)`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`rgb(86, 156, 214)`}},{types:[`number`,`inserted`],style:{color:`rgb(181, 206, 168)`}},{types:[`constant`],style:{color:`rgb(100, 102, 149)`}},{types:[`attr-name`,`variable`],style:{color:`rgb(156, 220, 254)`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`rgb(206, 145, 120)`}},{types:[`selector`],style:{color:`rgb(215, 186, 125)`}},{types:[`tag`],style:{color:`rgb(78, 201, 176)`}},{types:[`tag`],languages:[`markup`],style:{color:`rgb(86, 156, 214)`}},{types:[`punctuation`,`operator`],style:{color:`rgb(212, 212, 212)`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`rgb(220, 220, 170)`}},{types:[`class-name`],style:{color:`rgb(78, 201, 176)`}},{types:[`char`],style:{color:`rgb(209, 105, 105)`}}]},Ga={plain:{color:`#000000`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(0, 128, 0)`}},{types:[`builtin`],style:{color:`rgb(0, 112, 193)`}},{types:[`number`,`variable`,`inserted`],style:{color:`rgb(9, 134, 88)`}},{types:[`operator`],style:{color:`rgb(0, 0, 0)`}},{types:[`constant`,`char`],style:{color:`rgb(129, 31, 63)`}},{types:[`tag`],style:{color:`rgb(128, 0, 0)`}},{types:[`attr-name`],style:{color:`rgb(255, 0, 0)`}},{types:[`deleted`,`string`],style:{color:`rgb(163, 21, 21)`}},{types:[`changed`,`punctuation`],style:{color:`rgb(4, 81, 165)`}},{types:[`function`,`keyword`],style:{color:`rgb(0, 0, 255)`}},{types:[`class-name`],style:{color:`rgb(38, 127, 153)`}}]},Ka={plain:{color:`#f8fafc`,backgroundColor:`#011627`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#569CD6`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#f8fafc`}},{types:[`attr-name`,`variable`],style:{color:`#9CDCFE`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#cbd5e1`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#D4D4D4`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#7dd3fc`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},qa={plain:{color:`#0f172a`,backgroundColor:`#f1f5f9`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#0c4a6e`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#0f172a`}},{types:[`attr-name`,`variable`],style:{color:`#0c4a6e`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#64748b`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#475569`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#0e7490`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},Ja={plain:{backgroundColor:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(220, 10%, 40%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(220, 14%, 71%)`}},{types:[`attr-name`,`class-name`,`maybe-class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(29, 54%, 61%)`}},{types:[`keyword`],style:{color:`hsl(286, 60%, 67%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(355, 65%, 65%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`],style:{color:`hsl(95, 38%, 62%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(207, 82%, 66%)`}},{types:[`url`],style:{color:`hsl(187, 47%, 55%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(220, 14%, 71%)`}}]},Ya={plain:{backgroundColor:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(230, 4%, 64%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(230, 8%, 24%)`}},{types:[`attr-name`,`class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(35, 99%, 36%)`}},{types:[`keyword`],style:{color:`hsl(301, 63%, 40%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(5, 74%, 59%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`,`punctuation`],style:{color:`hsl(119, 34%, 47%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(221, 87%, 60%)`}},{types:[`url`],style:{color:`hsl(198, 99%, 37%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(230, 8%, 24%)`}}]},Xa={plain:{color:`#ebdbb2`,backgroundColor:`#292828`},styles:[{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`,`function`],style:{color:`#d8a657`}},{types:[`property-access`],style:{color:`#7daea3`}},{types:[`tag`],style:{color:`#e78a4e`}},{types:[`attr-name`,`char`,`url`,`regex`],style:{color:`#a9b665`}},{types:[`attr-value`,`string`],style:{color:`#89b482`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#ea6962`}},{types:[`entity`,`number`,`symbol`],style:{color:`#d3869b`}}]},Za={plain:{color:`#654735`,backgroundColor:`#f9f5d7`},styles:[{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#af2528`}},{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`],style:{color:`#b4730e`}},{types:[`string`,`attr-value`],style:{color:`#477a5b`}},{types:[`property-access`],style:{color:`#266b79`}},{types:[`function`,`attr-name`,`char`,`url`],style:{color:`#72761e`}},{types:[`tag`],style:{color:`#b94c07`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`entity`,`number`,`symbol`],style:{color:`#924f79`}}]},Qa=e=>(0,v.useCallback)(t=>{var n=t,{className:r,style:i,line:a}=n;let o=Ta(wa({},Ea(n,[`className`,`style`,`line`])),{className:fa(`token-line`,r)});return typeof e==`object`&&`plain`in e&&(o.style=e.plain),typeof i==`object`&&(o.style=wa(wa({},o.style||{}),i)),o},[e]),$a=e=>{let t=(0,v.useCallback)(({types:t,empty:n})=>{if(e!=null)return t.length===1&&t[0]===`plain`?n==null?void 0:{display:`inline-block`}:t.length===1&&n!=null?e[t[0]]:Object.assign(n==null?{}:{display:`inline-block`},...t.map(t=>e[t]))},[e]);return(0,v.useCallback)(e=>{var n=e,{token:r,className:i,style:a}=n;let o=Ta(wa({},Ea(n,[`token`,`className`,`style`])),{className:fa(`token`,...r.types,i),children:r.content,style:t(r)});return a!=null&&(o.style=wa(wa({},o.style||{}),a)),o},[t])},eo=/\r\n|\r|\n/,to=e=>{e.length===0?e.push({types:[`plain`],content:`
|
|
23
|
+
`)){if(r.startsWith(`@@`)){a();let e=yi.exec(r);if(e===null)continue;t=Number.parseInt(e[1]??`0`,10),n=0;continue}if(r.startsWith(`\\`)||t===0)continue;let e=r.charAt(0);e===` `?(a(),t+=1):e===`-`?n+=1:e===`+`&&(n>0?(i(t,`modified`),--n):i(t,`added`),t+=1)}return a(),Array.from(r.entries()).map(([e,t])=>({line:e,kind:t})).sort((e,t)=>e.line-t.line)}var xi=`forge.editor.tabs.v1:`;function Si(e){try{let t=sessionStorage.getItem(xi+e);if(t===null)return{paths:[],activePath:null};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{paths:[],activePath:null};let r=n,i=Array.isArray(r.paths)?r.paths.filter(e=>typeof e==`string`):[],a=typeof r.activePath==`string`?r.activePath:null;return{paths:i,activePath:i.includes(a??``)?a:i[0]??null}}catch{return{paths:[],activePath:null}}}function Ci(e,t,n){try{sessionStorage.setItem(xi+e,JSON.stringify({paths:t,activePath:n??null}))}catch{}}var wi;function Ti(e,t){e!==void 0&&Ci(e,t.openFiles.map(e=>e.path),t.activePath)}var Ei=mt((e,t)=>({treeByProject:{},treeLoading:{},openFiles:[],activePath:void 0,error:void 0,externallyChanged:{},gitDiffByPath:{},loadGitDiff:async(t,n)=>{try{let r=bi((await L.gitDiffFile(t,n,!1)).diff);e(e=>({gitDiffByPath:{...e.gitDiffByPath,[n]:r}}))}catch{e(e=>{if(!(n in e.gitDiffByPath))return{};let t={...e.gitDiffByPath};return delete t[n],{gitDiffByPath:t}})}},loadTree:async t=>{e(e=>({treeLoading:{...e.treeLoading,[t]:!0},error:void 0}));try{let n=await L.filesTree(t);e(e=>({treeByProject:{...e.treeByProject,[t]:n},treeLoading:{...e.treeLoading,[t]:!1}}))}catch(n){e(e=>({treeLoading:{...e.treeLoading,[t]:!1},error:n instanceof N?n.code:n.message}))}},restoreTabs:async n=>{if(wi===n&&t().openFiles.length>0)return;wi!==n&&e({openFiles:[],activePath:void 0,externallyChanged:{},gitDiffByPath:{}}),wi=n;let r=Si(n);if(r.paths.length!==0){for(let e of r.paths)try{await t().openFile(n,e)}catch{}r.activePath!==null&&t().setActiveFile(r.activePath)}},openFile:async(n,r,i)=>{if(wi=n,t().openFiles.find(e=>e.path===r)!==void 0){e(i===void 0?e=>(Ti(wi,{openFiles:e.openFiles,activePath:r}),{activePath:r}):e=>{let t={openFiles:e.openFiles.map(e=>e.path===r?{...e,pendingNav:i}:e),activePath:r};return Ti(wi,t),t});return}e({error:void 0});try{let a=await L.filesRead(n,r),o={tabId:Di(),path:r,saved:a.content,draft:a.content,dirty:!1,language:a.language,binary:a.binary,saving:!1,savedAt:void 0,saveError:void 0,loadingError:a.binary?`Binary file — open externally to edit.`:void 0};i!==void 0&&(o.pendingNav=i),e(e=>{let t={openFiles:[...e.openFiles,o],activePath:r};return Ti(wi,t),t}),t().loadGitDiff(n,r)}catch(t){e({error:t instanceof N?t.code:t.message})}},closeFile:t=>{e(e=>{let n=e.openFiles.findIndex(e=>e.path===t);if(n===-1)return{};let r=e.openFiles.slice(0,n).concat(e.openFiles.slice(n+1)),i=e.activePath===t?(r[n]??r[n-1]??r[0])?.path:e.activePath,a={...e.externallyChanged};delete a[t];let o={...e.gitDiffByPath};delete o[t];let s={openFiles:r,activePath:i,externallyChanged:a,gitDiffByPath:o};return Ti(wi,s),s})},closeAllFiles:()=>{e(()=>{let e={openFiles:[],activePath:void 0,externallyChanged:{},gitDiffByPath:{}};return Ti(wi,e),e})},setActiveFile:t=>e(e=>(Ti(wi,{openFiles:e.openFiles,activePath:t}),{activePath:t})),consumePendingNav:t=>{e(e=>({openFiles:e.openFiles.map(e=>{if(e.path!==t||e.pendingNav===void 0)return e;let n={...e};return delete n.pendingNav,n})}))},updateDraft:(t,n)=>{e(e=>({openFiles:e.openFiles.map(e=>e.path===t?{...e,draft:n,dirty:n!==e.saved}:e)}))},saveFile:async(n,r)=>{let i=t().openFiles.find(e=>e.path===r);if(!(i===void 0||i.binary)){e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!0,saveError:void 0}:e),error:void 0}));try{await L.filesWrite(n,r,i.draft),e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!1,saved:e.draft,dirty:!1,savedAt:Date.now(),saveError:void 0}:e),externallyChanged:Oi(e.externallyChanged,r)})),t().loadGitDiff(n,r)}catch(t){let n=t instanceof N?t.code:t.message;throw e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saving:!1,saveError:n}:e),error:n})),t}}},reloadFile:async(n,r)=>{e({error:void 0});try{let i=await L.filesRead(n,r);e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,saved:i.content,draft:i.content,dirty:!1,language:i.language,binary:i.binary,loadingError:i.binary?`Binary file — open externally to edit.`:void 0}:e),externallyChanged:Oi(e.externallyChanged,r)})),t().loadGitDiff(n,r)}catch(t){e({error:t instanceof N?t.code:t.message})}},refreshOpenFiles:async n=>{let r=t().openFiles.map(e=>({path:e.path,saved:e.saved,dirty:e.dirty}));if(r.length===0)return;let i=await Promise.allSettled(r.map(e=>L.filesRead(n,e.path)));e(e=>{let t=e.openFiles,n=e.externallyChanged;for(let e=0;e<r.length;e++){let a=i[e],o=r[e];if(a===void 0||o===void 0||a.status!==`fulfilled`)continue;let s=a.value;s.content===o.saved&&!o.dirty||s.content!==o.saved&&(o.dirty?n={...n,[o.path]:!0}:(t=t.map(e=>e.path===o.path?{...e,saved:s.content,draft:s.content,dirty:!1,language:s.language,binary:s.binary,loadingError:s.binary?`Binary file — open externally to edit.`:void 0}:e),n=Oi(n,o.path)))}return{openFiles:t,externallyChanged:n}}),await Promise.allSettled(r.map(e=>t().loadGitDiff(n,e.path)))},markExternallyChanged:t=>{e(e=>({externallyChanged:{...e.externallyChanged,[t]:!0}}))},dismissExternallyChanged:t=>{e(e=>({externallyChanged:Oi(e.externallyChanged,t)}))},createFile:async(n,r,i)=>{e({error:void 0});try{let e=`${r}/${i}`;return await L.filesWrite(n,e,``),await t().loadTree(n),e}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},createFolder:async(n,r,i)=>{e({error:void 0});try{await L.filesMkdir(n,r,i),await t().loadTree(n)}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},renameEntry:async(n,r,i)=>{e({error:void 0});try{let{path:a}=await L.filesRename(n,r,i);return e(e=>({openFiles:e.openFiles.map(e=>e.path===r?{...e,path:a}:e),activePath:e.activePath===r?a:e.activePath})),await t().loadTree(n),a}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},moveEntry:async(n,r,i)=>{e({error:void 0});try{let{path:a}=await L.filesMove(n,r,i);return e(e=>({openFiles:e.openFiles.map(e=>{if(e.path===r)return{...e,path:a};let t=`${r}/`;return e.path.startsWith(t)?{...e,path:`${a}/${e.path.slice(t.length)}`}:e}),activePath:e.activePath===r?a:e.activePath!==void 0&&e.activePath.startsWith(`${r}/`)?`${a}/${e.activePath.slice(r.length+1)}`:e.activePath})),await t().loadTree(n),a}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},deleteEntry:async(n,r,i)=>{e({error:void 0});try{await L.filesDelete(n,r,i?.recursive===!0?{recursive:!0}:void 0),t().openFiles.find(e=>e.path===r)!==void 0&&t().closeFile(r),await t().loadTree(n)}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}},uploadFiles:async(n,r,i,a)=>{e({error:void 0});try{let e=await L.uploadFiles(n,r,i,{...a?.overwrite===void 0?{}:{overwrite:a.overwrite},...a?.onHashProgress===void 0?{}:{onHashProgress:a.onHashProgress}});return await t().loadTree(n),e.files}catch(t){throw e({error:t instanceof N?t.code:t.message}),t}}}));function Di(){return Pr(`tab`)}function Oi(e,t){if(e[t]===void 0)return e;let n={...e};return delete n[t],n}var ki={appBackground:`--forge-app-bg`,panelBackground:`--forge-panel-bg`,userBubbleBackground:`--forge-user-bubble-bg`,assistantBubbleBackground:`--forge-assistant-bubble-bg`,primaryText:`--forge-text-primary`,secondaryText:`--forge-text-secondary`,mutedText:`--forge-text-muted`,highlightBackground:`--forge-highlight-bg`,highlightText:`--forge-highlight-text`,selectionBackground:`--forge-selection-bg`};function Ai(e){if(typeof document>`u`)return;let t=document.documentElement;if(e===void 0||!e.enabled){t.dataset.serverTheme=`off`;for(let e of Object.values(ki))t.style.removeProperty(e);return}t.dataset.serverTheme=`on`;for(let[n,r]of Object.entries(ki))t.style.setProperty(r,e.colors[n])}var ji=mt(e=>({loaded:!1,minimal:!1,workspaceRoot:``,version:``,passwordAuthEnabled:!0,ldapEnabled:!1,orchestrationEnabled:!1,serverTheme:void 0,authBannerText:void 0,authBannerHtml:!1,logoUrlMode:`cache`,authColorScheme:void 0,authLogoUrl:void 0,appLogoDarkUrl:void 0,appLogoLightUrl:void 0,error:void 0,setServerTheme:t=>{Ai(t),e({serverTheme:t})},load:async()=>{try{let t=await L.uiConfig();Ai(t.serverTheme),e({loaded:!0,minimal:t.minimal,workspaceRoot:t.workspaceRoot,version:t.version,passwordAuthEnabled:t.passwordAuthEnabled,ldapEnabled:t.ldapEnabled,orchestrationEnabled:t.orchestrationEnabled,serverTheme:t.serverTheme,authBannerText:t.authBannerText,authBannerHtml:t.authBannerHtml,logoUrlMode:t.logoUrlMode,authColorScheme:t.authColorScheme,authLogoUrl:t.authLogoUrl,appLogoDarkUrl:t.appLogoDarkUrl,appLogoLightUrl:t.appLogoLightUrl,error:void 0})}catch(t){let n=t instanceof N?t.code:t.message;typeof console<`u`&&console.warn(`[ui-config] load failed:`,n),e({loaded:!0,error:n})}}})),Mi=mt((e,t)=>({loaded:!1,actions:[],error:void 0,load:async()=>{try{let{actions:t}=await L.listQuickActions();e({loaded:!0,actions:t,error:void 0})}catch(t){let n=t instanceof N?t.code:t.message;typeof console<`u`&&console.warn(`[quick-actions] load failed:`,n),e({error:n})}},create:async n=>{let r=await L.createQuickAction(n);return e({actions:[...t().actions,r]}),r},update:async(n,r)=>{let i=await L.updateQuickAction(n,r);return e({actions:t().actions.map(e=>e.id===n?i:e)}),i},remove:async n=>{await L.deleteQuickAction(n),e({actions:t().actions.filter(e=>e.id!==n)})}})),Ni=mt((e,t)=>({runs:[],addRun:n=>e({runs:[...t().runs,n]}),updateRun:(n,r)=>e({runs:t().runs.map(e=>e.runId===n?{...e,...r}:e)}),removeRun:n=>e({runs:t().runs.filter(e=>e.runId!==n)}),runsForSession:e=>t().runs.filter(t=>t.sessionId===e)}));function Pi(e){if(e.length!==4)return e;let t=e[1]??`0`,n=e[2]??`0`,r=e[3]??`0`;return`#${t}${t}${n}${n}${r}${r}`}function Fi(e){let t=Pi(e).slice(1);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function Ii(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Li(e){let[t,n,r]=Fi(e);return .2126*Ii(t)+.7152*Ii(n)+.0722*Ii(r)}function Ri(e,t){let n=Math.max(Li(e),Li(t)),r=Math.min(Li(e),Li(t));return(n+.05)/(r+.05)}function zi(e,t){return Ri(e,t)>=4.5?e:Ri(`#000000`,t)>=Ri(`#ffffff`,t)?`#000000`:`#ffffff`}function Bi(e){let t=e?.pageBackground??`#0a0a0a`,n=e?.cardBackground??`#171717`,r=e?.border??`#262626`,i=e?.text??`#f5f5f5`,a=e?.mutedText??`#a3a3a3`,o=e?.buttonBackground??`#f5f5f5`,s=e?.buttonText??`#171717`,c=e?.buttonHoverBackground??`#ffffff`,l=t,u=zi(i,l);return{"--auth-page-bg":t,"--auth-card-bg":n,"--auth-border":r,"--auth-text":i,"--auth-muted-text":a,"--auth-button-bg":o,"--auth-button-text":s,"--auth-button-hover-bg":c,"--auth-input-bg":l,"--auth-input-text":u,"--auth-placeholder-text":Ri(a,l)>=3?a:u}}var Vi=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Hi=o(((e,t)=>{t.exports=Vi()})),R=Hi(),Ui=new Set([`A`,`B`,`BLOCKQUOTE`,`BR`,`CODE`,`DIV`,`EM`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`HR`,`I`,`LI`,`OL`,`P`,`PRE`,`SECTION`,`SPAN`,`STRONG`,`U`,`UL`]),Wi=new Set([`SCRIPT`,`STYLE`,`TEMPLATE`]);function Gi(e){if(typeof DOMParser>`u`)return``;let t=new DOMParser().parseFromString(e,`text/html`),n=e=>{for(let r of Array.from(e.childNodes)){if(r.nodeType!==Node.ELEMENT_NODE)continue;let e=r;if(Wi.has(e.tagName)){e.remove();continue}if(!Ui.has(e.tagName)){e.replaceWith(t.createTextNode(e.textContent??``));continue}for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase();if(e.tagName===`A`&&n===`href`){try{let r=new URL(t.value,window.location.origin);[`http:`,`https:`,`mailto:`].includes(r.protocol)||e.removeAttribute(n)}catch{e.removeAttribute(n)}continue}e.tagName===`A`&&[`title`,`target`,`rel`].includes(n)||e.removeAttribute(n)}e.tagName===`A`&&e.getAttribute(`href`)!==null&&e.setAttribute(`rel`,`noopener noreferrer`),n(e)}};return n(t.body),t.body.innerHTML}function Ki(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),i=gr(e=>e.login),a=gr(e=>e.ldapEnabled),o=gr(e=>e.loginPending),s=gr(e=>e.loginError),c=ji(e=>e.authBannerText),l=ji(e=>e.authBannerHtml),u=ji(e=>e.authLogoUrl),d=ji(e=>e.authColorScheme),f=(0,v.useMemo)(()=>Bi(d),[d]),p=(0,v.useMemo)(()=>c&&l?Gi(c):``,[l,c]),m=c!==void 0&&c.length>0;return(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-[var(--auth-page-bg)] px-4 py-8 text-[var(--auth-text)]`,style:f,children:(0,R.jsxs)(`div`,{className:`flex w-full max-w-[1536px] flex-col items-center gap-3`,children:[(0,R.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n.length!==0&&(a&&e.trim().length===0||i(n,a?e.trim():void 0))},className:`w-full max-w-sm space-y-4 rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-6 text-[var(--auth-text)] shadow-lg`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`img`,{src:u??`/icons/icon.svg`,alt:``,className:`max-h-6 max-w-24 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`pi-forge`})]}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--auth-muted-text)]`,children:a?`Sign in with your LDAP account.`:`Enter the pi-forge password to continue.`})]}),a&&(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Username`}),(0,R.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),autoFocus:!0,autoComplete:`username`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Password`}),(0,R.jsx)(`input`,{type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!a,autoComplete:`current-password`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),s!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-red-400`,children:s===`invalid_password`?a?`Incorrect username, password, or LDAP group.`:`Incorrect password.`:s===`username_required`?`Username is required.`:`Login failed: ${s}`}),(0,R.jsx)(`button`,{type:`submit`,disabled:o||n.length===0||a&&e.trim().length===0,className:`w-full rounded-md bg-[var(--auth-button-bg)] px-3 py-2 text-sm font-medium text-[var(--auth-button-text)] transition hover:bg-[var(--auth-button-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:o?`Signing in…`:`Sign in`})]}),m&&(l?(0,R.jsx)(`section`,{className:`w-fit max-w-full whitespace-normal break-words rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-4 text-sm text-[var(--auth-text)] shadow-lg [&_*]:max-w-none [&_a]:text-sky-300 [&_a]:underline [&_code]:rounded [&_code]:bg-[var(--auth-page-bg)] [&_code]:px-1 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:text-base [&_h2]:font-semibold [&_h3]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:max-w-none [&_pre]:whitespace-pre-wrap [&_ul]:list-disc [&_ul]:pl-5`,"aria-label":`Authentication notice`,dangerouslySetInnerHTML:{__html:p}}):(0,R.jsx)(`section`,{className:`w-fit max-w-full whitespace-pre-wrap break-words rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-4 text-sm text-[var(--auth-text)] shadow-lg`,"aria-label":`Authentication notice`,children:c}))]})})}var qi=8;function Ji(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(void 0),c=gr(e=>e.changePassword),l=gr(e=>e.changePasswordPending),u=gr(e=>e.changePasswordError),d=gr(e=>e.logout),f=ji(e=>e.authLogoUrl),p=ji(e=>e.authColorScheme),m=(0,v.useMemo)(()=>Bi(p),[p]),h=t=>{if(t.preventDefault(),s(void 0),n.length<qi){s(`new password must be at least ${qi} characters`);return}if(n!==i){s(`new password and confirmation do not match`);return}if(n===e){s(`new password must differ from the current one`);return}c(e,n)},g=o??Yi(u);return(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-[var(--auth-page-bg)] px-4 text-[var(--auth-text)]`,style:m,children:(0,R.jsxs)(`form`,{onSubmit:h,className:`w-full max-w-sm space-y-4 rounded-lg border border-[var(--auth-border)] bg-[var(--auth-card-bg)] p-6 text-[var(--auth-text)] shadow-lg`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`img`,{src:f??`/icons/icon.svg`,alt:``,className:`max-h-6 max-w-24 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:`Set a new password`})]}),(0,R.jsx)(`p`,{className:`text-sm text-[var(--auth-muted-text)]`,children:`You signed in with the deployment-supplied initial password. Pick a new one before continuing — it will be stored as a hash on the pi-forge data volume.`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Current password`}),(0,R.jsx)(`input`,{type:`password`,value:e,onChange:e=>t(e.target.value),autoFocus:!0,autoComplete:`current-password`,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`New password`}),(0,R.jsx)(`input`,{type:`password`,value:n,onChange:e=>r(e.target.value),autoComplete:`new-password`,minLength:qi,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-[var(--auth-text)]`,children:`Confirm new password`}),(0,R.jsx)(`input`,{type:`password`,value:i,onChange:e=>a(e.target.value),autoComplete:`new-password`,minLength:qi,className:`w-full rounded-md border border-[var(--auth-border)] bg-[var(--auth-input-bg)] px-3 py-2 text-sm text-[var(--auth-input-text)] caret-[var(--auth-input-text)] outline-none placeholder:text-[var(--auth-placeholder-text)] focus:border-[var(--auth-muted-text)] [-webkit-text-fill-color:var(--auth-input-text)]`})]}),g!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-red-400 light:text-red-700`,children:g}),(0,R.jsx)(`button`,{type:`submit`,disabled:l||e.length===0||n.length===0,className:`w-full rounded-md bg-[var(--auth-button-bg)] px-3 py-2 text-sm font-medium text-[var(--auth-button-text)] transition hover:bg-[var(--auth-button-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:l?`Saving…`:`Set new password`}),(0,R.jsx)(`button`,{type:`button`,onClick:d,className:`w-full rounded-md border border-[var(--auth-border)] px-3 py-2 text-xs text-[var(--auth-muted-text)] hover:border-[var(--auth-muted-text)] hover:text-[var(--auth-text)]`,children:`Sign out`})]})})}function Yi(e){if(e!==void 0)switch(e){case`invalid_password`:return`Current password is incorrect.`;case`password_unchanged`:return`New password must differ from the current one.`;case`ui_password_not_configured`:return`Password auth is not configured on this server.`;case`auth_required`:return`Session expired — sign in again.`;default:return`Could not change password: ${e}`}}var Xi=`pi-forge/install-prompt-dismissed`;function Zi(){return typeof window>`u`?!1:window.navigator.standalone===!0?!0:window.matchMedia?.(`(display-mode: standalone)`).matches??!1}function Qi(){return typeof navigator>`u`?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function $i(){let e=ct(),[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(()=>typeof localStorage>`u`?!1:localStorage.getItem(Xi)===`true`),[a,o]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(typeof window>`u`||Zi()||r)return;let t=e=>{e.preventDefault(),n(e)};if(window.addEventListener(`beforeinstallprompt`,t),Qi()&&e){let e=window.setTimeout(()=>o(!0),1500);return()=>{window.clearTimeout(e),window.removeEventListener(`beforeinstallprompt`,t)}}return()=>window.removeEventListener(`beforeinstallprompt`,t)},[e,r]);let s=()=>{i(!0),n(void 0),o(!1);try{localStorage.setItem(Xi,`true`)}catch{}},c=async()=>{if(t===void 0)return;await t.prompt();let e=await t.userChoice;n(void 0),e.outcome===`accepted`&&s()};return!e||r||Zi()||t===void 0&&!a?null:(0,R.jsx)(`div`,{className:`border-b border-neutral-800 bg-neutral-900 px-3 py-2 text-sm text-neutral-200`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:t===void 0?(0,R.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[`Install: tap `,(0,R.jsx)($e,{size:14,className:`inline shrink-0 text-neutral-400`}),` Share, then `,(0,R.jsx)(`span`,{className:`font-medium`,children:`Add to Home Screen`}),`.`]}):(0,R.jsx)(`span`,{children:`Install pi-forge as an app for a fullscreen experience.`})}),t!==void 0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>void c(),className:`shrink-0 rounded-md bg-neutral-100 px-3 py-1.5 text-xs font-medium text-neutral-900 hover:bg-neutral-200`,children:`Install`}),(0,R.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Dismiss install prompt`,className:`inline-flex min-h-9 min-w-9 shrink-0 items-center justify-center rounded text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,children:(0,R.jsx)(at,{size:16})})]})})}function ea({onClose:e,required:t=!1}){let n=xr(e=>e.create),r=ji(e=>e.minimal),i=ji(e=>e.workspaceRoot),a=xr(e=>e.load),o=xr(e=>e.setActive),[s,c]=(0,v.useState)(`create`),[l,u]=(0,v.useState)(`name`),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(),[_,y]=(0,v.useState)(),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)([]),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(s!==`create`||l!==`browse`)return;let e=!1;return T(!0),g(void 0),L.browse(_).then(t=>{e||(y(t.path),x(t.parentPath),C(t.entries))}).catch(t=>{e||g(t instanceof N?t.code:t.message)}).finally(()=>{e||T(!1)}),()=>{e=!0}},[s,l,_]);let ee=async()=>{let t=d.trim();if(t.length!==0){if(!r){u(`browse`);return}if(i.length===0){g(`workspace_not_loaded`);return}m(!0),g(void 0);try{let{path:r}=await L.mkdir(i,t);await n(t,r),e()}catch(e){g(e instanceof N?e.code:e.message),m(!1)}}},te=async t=>{if(!p){if(i.length>0&&t===i){g(`workspace_root_not_allowed`);return}m(!0),g(void 0);try{await n(d.trim(),t),e()}catch(e){g(e instanceof N?e.code:e.message),m(!1)}}},ne=()=>{b!==null&&y(b)},re=async()=>{if(!(!_||E.trim().length===0)){g(void 0);try{let{path:e}=await L.mkdir(_,E.trim());D(``),k(!1),await te(e)}catch(e){g(e instanceof N?e.code:e.message)}}};return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4`,children:(0,R.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg border border-neutral-800 bg-neutral-900 p-6 shadow-xl`,children:[(0,R.jsxs)(`header`,{className:`mb-4 flex items-center justify-between`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:s===`clone`?`Clone repository`:l===`name`?`New project`:`Pick a folder for "${d.trim()}"`}),!t&&(0,R.jsx)(`button`,{onClick:e,className:`rounded-md px-2 py-1 text-sm text-neutral-400 hover:bg-neutral-800`,children:`Cancel`})]}),l===`name`&&(0,R.jsxs)(`div`,{className:`mb-3 flex gap-1 border-b border-neutral-800`,children:[(0,R.jsx)(ta,{active:s===`create`,onClick:()=>c(`create`),children:`Create / pick folder`}),(0,R.jsx)(ta,{active:s===`clone`,onClick:()=>c(`clone`),children:`Clone repository`})]}),l===`name`&&s===`create`&&(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ee()},className:`space-y-4`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Project name`}),(0,R.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm outline-none focus:border-neutral-500`}),r&&i.length>0&&(0,R.jsxs)(`span`,{className:`block font-mono text-[11px] text-neutral-500`,children:[`Will create `,i,`/`,d.trim().length>0?d.trim():`<name>`]})]}),h!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400 light:text-red-700`,children:[`Error: `,h]}),(0,R.jsx)(`button`,{type:`submit`,disabled:d.trim().length===0||p,className:`w-full rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,children:r?p?`Creating…`:`Create project`:`Next: pick folder`})]}),l===`name`&&s===`clone`&&(0,R.jsx)(na,{initialName:d,workspaceRoot:i,onProjectCreated:async t=>{await a(),o(t),e()},onCancel:e}),s===`create`&&l===`browse`&&(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-neutral-400`,children:[(0,R.jsx)(`button`,{onClick:ne,disabled:b===null,className:`rounded-md border border-neutral-700 px-2 py-1 hover:bg-neutral-800 disabled:cursor-not-allowed disabled:opacity-40`,title:b===null?`At workspace root`:`Up one folder`,children:`↑ up`}),(0,R.jsx)(`code`,{className:`truncate font-mono text-neutral-300`,children:_??`(loading)`})]}),(0,R.jsxs)(`div`,{className:`max-h-64 overflow-y-auto rounded-md border border-neutral-800 bg-neutral-950`,children:[w&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-sm text-neutral-400`,children:`Loading…`}),!w&&S.length===0&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-sm text-neutral-400`,children:`(empty)`}),!w&&S.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 px-3 py-2 text-sm last:border-b-0`,children:[(0,R.jsxs)(`button`,{onClick:()=>y(e.path),className:`flex flex-1 items-center gap-2 text-left text-neutral-200 hover:text-white`,children:[(0,R.jsx)(`span`,{children:`📁`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name}),e.isGitRepo&&(0,R.jsx)(`span`,{className:`rounded-sm bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-300`,children:`git`})]}),(0,R.jsx)(`button`,{onClick:()=>void te(e.path),disabled:p,className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-200 hover:bg-neutral-800 disabled:opacity-50`,children:`Select`})]},e.path))]}),O?(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:`folder name`,className:`flex-1 rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm`,autoFocus:!0}),(0,R.jsx)(`button`,{onClick:()=>void re(),className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900`,children:`Create + select`}),(0,R.jsx)(`button`,{onClick:()=>{k(!1),D(``)},className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`Cancel`})]}):(0,R.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>u(`name`),className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`← Back`}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>k(!0),className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:`+ New folder`}),(0,R.jsx)(`button`,{onClick:()=>_&&void te(_),disabled:!_||p||i.length>0&&_===i,className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,title:i.length>0&&_===i?`Pick a sub-folder — the workspace root itself can't be a project.`:`Use this folder as the project root`,children:`Select this folder`})]})]})]}),h!==void 0&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-red-400 light:text-red-700`,children:h===`path_not_allowed`?`That folder is outside the workspace root.`:h===`workspace_root_not_allowed`?`Pick a sub-folder — the workspace root itself can't be a project.`:h===`not_a_directory`?`That path is not a directory.`:h===`already_exists`?`A folder with that name already exists.`:h===`duplicate_path`?`Another project already points at that folder.`:h===`network_error`?`Couldn't reach the server.`:`Error: ${h}`})]})})}function ta({active:e,onClick:t,children:n}){return(0,R.jsx)(`button`,{onClick:t,className:`-mb-px border-b-2 px-3 py-2 text-sm transition-colors ${e?`border-neutral-200 text-neutral-100`:`border-transparent text-neutral-400 hover:text-neutral-200`}`,children:n})}function na({initialName:e,workspaceRoot:t,onProjectCreated:n,onCancel:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(e),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(),[T,E]=(0,v.useState)(),[D,O]=(0,v.useState)(null),[k,ee]=(0,v.useState)([]),[te,ne]=(0,v.useState)(!1),re=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{if(!g)try{let e=new URL(i).pathname.split(`/`).filter(e=>e.length>0),t=(e[e.length-1]??``).replace(/\.git$/i,``);t.length>0&&d(t)}catch{}},[i,g]),(0,v.useEffect)(()=>{y||e.trim().length>0||u.length>0&&p(u)},[u,e,y]);let ie=async e=>{if(e.preventDefault(),x)return;if(i.trim().length===0){w(`url_required`);return}if(u.trim().length===0){w(`folder_required`);return}if(f.trim().length===0){w(`name_required`);return}if(t.length===0){w(`workspace_not_loaded`);return}S(!0),w(void 0),E(`starting…`),O(null),ee([]);let r=new AbortController;re.current=r;try{let e={url:i.trim(),parentPath:t,folderName:u.trim(),projectName:f.trim()};o.trim().length>0&&(e.branch=o.trim()),c.length>0&&(e.token=c),m&&(e.insecureTls=!0);let a=await L.cloneProject(e,r.signal),s,l=!1,d=``;for await(let e of hr(a))switch(e.type){case`started`:E(`starting clone`),ee(t=>[...t,`→ cloning ${e.cloneUrlForDisplay}`]);break;case`progress`:E(e.phase),O(e.percent);break;case`stderr`:ee(t=>{let n=[...t,e.line];return n.length>200?n.slice(n.length-200):n});break;case`done`:E(`clone complete, creating project…`),O(100);break;case`project_created`:s=e.project.id;break;case`error`:l=!0,d=e.message;break}if(s!==void 0){await n(s);return}w(l?d:`clone_ended_without_project`)}catch(e){e instanceof Error&&e.name===`AbortError`?w(`cancelled`):w(e instanceof N?`${e.code}: ${e.message??``}`:e.message)}finally{S(!1),re.current=void 0}};return(0,R.jsxs)(`form`,{onSubmit:e=>{ie(e)},className:`space-y-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Repository URL`}),(0,R.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`https://github.com/owner/repo.git`,disabled:x,autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Branch (optional)`}),(0,R.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`default branch`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Folder name`}),(0,R.jsx)(`input`,{value:u,onChange:e=>{d(e.target.value),_(!0)},placeholder:`auto from URL`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`})]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Project name`}),(0,R.jsx)(`input`,{value:f,onChange:e=>{p(e.target.value),b(!0)},placeholder:`auto from folder`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 text-sm outline-none focus:border-neutral-500 disabled:opacity-60`}),t.length>0&&u.length>0&&(0,R.jsxs)(`span`,{className:`block font-mono text-[11px] text-neutral-500`,children:[`Will clone into `,t,`/`,u]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-neutral-300`,children:`Access token (optional, for private repos)`}),(0,R.jsx)(`input`,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:`ghp_... / glpat_... / etc.`,disabled:x,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-2 font-mono text-xs outline-none focus:border-neutral-500 disabled:opacity-60`}),(0,R.jsxs)(`span`,{className:`block text-[11px] text-neutral-500`,children:[`Sent over HTTPS, embedded as `,(0,R.jsx)(`code`,{children:`x-access-token:<token>`}),` in the clone URL, and stripped from `,(0,R.jsx)(`code`,{children:`.git/config`}),` after success.`]})]}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-amber-900/40 bg-amber-950/30 px-2 py-1.5 text-xs light:border-amber-300 light:bg-amber-50`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),disabled:x,className:`mt-0.5`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`text-amber-200 light:text-amber-800`,children:`Allow self-signed / invalid TLS certificate`}),(0,R.jsx)(`br`,{}),(0,R.jsxs)(`span`,{className:`text-[11px] text-amber-300/70 light:text-amber-700/80`,children:[`⚠ Disables MITM protection for this clone and persists a URL-scoped local git config entry for future fetch/pull/push. Use only for internal Git hosts with known self-signed certs/private CAs. The server logs `,(0,R.jsx)(`code`,{children:`git-clone-insecure-tls`}),` to stderr on every use.`]})]})]}),(x||T!==void 0)&&(0,R.jsxs)(`div`,{className:`space-y-1 rounded-md border border-neutral-800 bg-neutral-950 p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,R.jsx)(`span`,{className:`text-neutral-300`,children:T??`starting…`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:D===null?``:`${D}%`})]}),D!==null&&(0,R.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded bg-neutral-800`,children:(0,R.jsx)(`div`,{className:`h-full bg-emerald-500 transition-all`,style:{width:`${Math.max(2,Math.min(100,D))}%`}})}),k.length>0&&(0,R.jsxs)(`details`,{open:te,onToggle:e=>ne(e.target.open),className:`pt-1`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-[10px] uppercase tracking-wider text-neutral-500 hover:text-neutral-300`,children:[`Raw output (`,k.length,`)`]}),(0,R.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words font-mono text-[10px] leading-snug text-neutral-400`,children:k.join(`
|
|
24
|
+
`)})]})]}),C!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400 light:text-red-700`,children:[`Error: `,C]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{re.current===void 0?r():re.current.abort()},className:`rounded-md border border-neutral-700 px-3 py-2 text-sm text-neutral-300`,children:x?`Cancel clone`:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:x||i.trim().length===0||f.trim().length===0||t.length===0,className:`rounded-md bg-neutral-100 px-3 py-2 text-sm font-medium text-neutral-900 disabled:opacity-50`,children:x?`Cloning…`:`Clone + create project`})]})]})}function ra({open:e,onClose:t,title:n,children:r,width:i=`max-w-sm`,initialFocusRef:a}){let o=(0,v.useRef)(null),s=(0,v.useId)(),c=(0,v.useRef)(t),l=(0,v.useRef)(a);return(0,v.useEffect)(()=>{c.current=t}),(0,v.useEffect)(()=>{l.current=a}),(0,v.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=o.current,r=e=>{if(e.key===`Escape`){e.preventDefault(),c.current();return}if(e.key===`Tab`&&o.current!==null){let t=o.current.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}};document.addEventListener(`keydown`,r);let i=window.setTimeout(()=>{let e=l.current?.current;if(e!=null){e.focus();return}(o.current?.querySelector(`a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`))?.focus()},0);return()=>{document.removeEventListener(`keydown`,r),window.clearTimeout(i),t!==null&&document.contains(t)&&n!==null&&n.contains(document.activeElement)&&t.focus()}},[e]),e?(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-labelledby":s,children:(0,R.jsxs)(`div`,{ref:o,className:`w-full ${i} rounded-lg border border-neutral-800 bg-neutral-900 shadow-xl`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-2`,children:[(0,R.jsx)(`h2`,{id:s,className:`text-sm font-medium text-neutral-100`,children:n}),(0,R.jsx)(`button`,{onClick:t,className:`rounded p-2 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (Esc)`,"aria-label":`Close`,children:(0,R.jsx)(at,{size:20})})]}),r]})}):null}function ia({open:e,onClose:t,onSubmit:n,title:r,label:i,initialValue:a=``,placeholder:o,primaryLabel:s=`OK`}){let[c,l]=(0,v.useState)(a),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{e&&l(a)},[e,a]);let d=c.trim(),f=()=>{d.length!==0&&n(d)};return(0,R.jsx)(ra,{open:e,onClose:t,title:r,initialFocusRef:u,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f()},className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:i}),(0,R.jsx)(`input`,{ref:u,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:o,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:d.length===0,className:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white disabled:cursor-not-allowed disabled:opacity-40`,children:s})]})]})})}function aa({open:e,onClose:t,onConfirm:n,title:r,message:i,primaryLabel:a=`Confirm`,tone:o=`default`}){return(0,R.jsx)(ra,{open:e,onClose:t,title:r,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsx)(`p`,{className:`text-xs text-neutral-300`,children:i}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:n,className:o===`danger`?`rounded-md bg-red-700 px-3 py-1 text-xs font-medium text-red-50 hover:bg-red-600`:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white`,children:a})]})]})})}function oa({projectId:e}){let t=pi(t=>t.byProject[e]??ti),n=pi(e=>e.activeSessionId),r=pi(e=>e.loadSessionsForProject),i=pi(e=>e.setActiveSession),a=pi(e=>e.disposeSession),o=pi(e=>e.renameSession),s=xr(e=>e.setActive),c=xr(e=>e.activeProjectId),l=t=>{c!==e&&s(e),i(t)},[u,d]=(0,v.useState)(void 0),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(void 0),[g,_]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{if(g===void 0)return;let e=()=>_(void 0),t=window.setTimeout(e,sa),n=t=>{let n=t.target;n instanceof Element&&n.closest(`[data-armed-delete="${g}"]`)===null&&e()},r=t=>{t.key===`Escape`&&e()};return document.addEventListener(`pointerdown`,n),document.addEventListener(`keydown`,r),()=>{window.clearTimeout(t),document.removeEventListener(`pointerdown`,n),document.removeEventListener(`keydown`,r)}},[g]);let y=e=>{if(g===e){_(void 0),a(e);return}_(e)},[b,x]=(0,v.useState)(new Set),S=()=>x(new Set),C=e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[w,T]=(0,v.useState)(new Map),E=(e,t)=>{T(n=>{let r=new Map(n);return r.set(e,!t),r})},{topLevel:D,childrenByParent:O}=(0,v.useMemo)(()=>{let n=new Map,r=new Set(t.map(e=>e.sessionId));for(let e of t){if(e.parentSessionId===void 0||!r.has(e.parentSessionId)||e.parentSessionId===e.sessionId)continue;let t=n.get(e.parentSessionId);t===void 0?n.set(e.parentSessionId,[e]):t.push(e)}let i=t.filter(e=>e.parentSessionId===void 0||!r.has(e.parentSessionId)||e.parentSessionId===e.sessionId);return i.length===0&&t.length>0&&(i=t),t.some(e=>e.parentSessionId!==void 0)&&console.info(`[sessions] SessionList grouping`,{projectId:e,sessionCount:t.length,topLevelCount:i.length,childCount:Array.from(n.values()).reduce((e,t)=>e+t.length,0),allIds:Array.from(r),parentIdsOnChildren:t.filter(e=>e.parentSessionId!==void 0).map(e=>e.parentSessionId),bucketed:Array.from(n.keys())}),{topLevel:i,childrenByParent:n}},[t,e]),k=async()=>{if(m===void 0)return;let e=m.sessionIds;h(void 0);for(let t of e)try{await a(t)}catch{}S()};(0,v.useEffect)(()=>{r(e)},[e,r]);let ee=(e,t)=>{d(e),p(t)},te=()=>{d(void 0),p(``)},ne=async e=>{let t=f.trim();te();try{await o(e,t)}catch{}},re=(e,t)=>{e.key===`Enter`?(e.preventDefault(),ne(t)):e.key===`Escape`&&(e.preventDefault(),te())},ie=(e,t,r)=>{let i=O.get(e.sessionId)??[],a=w.get(e.sessionId)===!0,o=[(0,R.jsx)(ca,{session:e,isActive:e.sessionId===n,isSelected:b.has(e.sessionId),isRenaming:u===e.sessionId,renameDraft:f,childCount:i.length,isExpanded:a,depth:t,onSelect:l,onToggleSelect:C,onStartRename:ee,onChangeRename:p,onRenameKeyDown:re,onCommitRename:e=>void ne(e),onToggleExpanded:E,isArmedForDelete:g===e.sessionId,onDeleteClick:y},e.sessionId)];if(!a)return o;let s=new Set(r);s.add(e.sessionId);for(let e of i)s.has(e.sessionId)||o.push(...ie(e,t+1,s));return o};return(0,R.jsxs)(`div`,{className:`ml-6 mt-1 space-y-0.5`,children:[t.length===0&&(0,R.jsx)(`p`,{className:`px-2 py-1 text-xs italic text-neutral-600`,children:`No sessions yet.`}),b.size>0&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded bg-neutral-900/60 px-2 py-1 text-[11px] text-neutral-300`,children:[(0,R.jsxs)(`span`,{children:[b.size,` selected`]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>h({sessionIds:Array.from(b)}),className:`rounded border border-red-700/50 px-1.5 py-0.5 text-red-300 hover:bg-red-900/20 light:border-red-400 light:text-red-700 light:hover:bg-red-50`,children:`Delete`}),(0,R.jsx)(`button`,{onClick:S,className:`rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Clear`})]})]}),D.flatMap(e=>ie(e,0,new Set)),(0,R.jsx)(aa,{open:m!==void 0,onClose:()=>h(void 0),onConfirm:()=>void k(),title:`Delete ${m?.sessionIds.length??0} session${(m?.sessionIds.length??0)===1?``:`s`}`,message:`Delete the ${m?.sessionIds.length??0} selected session${(m?.sessionIds.length??0)===1?``:`s`}? Live sessions are killed and on-disk JSONLs are removed. Cannot be undone.`,primaryLabel:`Delete all`,tone:`danger`})]})}var sa=3e3;function ca(e){let{session:t,isActive:n,isSelected:r,isRenaming:i,renameDraft:a,childCount:o,isExpanded:s,depth:c,onSelect:l,onToggleSelect:u,onStartRename:d,onChangeRename:f,onRenameKeyDown:p,onCommitRename:m,onToggleExpanded:h,isArmedForDelete:g,onDeleteClick:_}=e,v=t.name??(t.firstMessage.length>0?t.firstMessage.slice(0,40):`session ${t.sessionId.slice(0,6)}`);return(0,R.jsxs)(`div`,{style:c>0?{marginLeft:`${Math.min(c,3)*8}px`}:void 0,className:`group flex items-center gap-1 rounded border-l-2 border-t border-t-neutral-800/40 px-2 py-0.5 text-xs light:border-t-neutral-200 ${r?`border-l-blue-400 bg-blue-500/15 text-neutral-100 hover:bg-blue-500/25`:n?`border-l-transparent bg-neutral-800 text-neutral-100`:`border-l-transparent text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`}`,children:[o>0?(0,R.jsx)(`button`,{onClick:()=>h(t.sessionId,s),className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-neutral-500 hover:text-neutral-200`,title:`${o} child/worker session${o===1?``:`s`}`,"aria-label":s?`Collapse child sessions`:`Expand child sessions`,children:s?(0,R.jsx)(Se,{size:12}):(0,R.jsx)(we,{size:12})}):(0,R.jsx)(`span`,{className:`inline-block h-4 w-4 shrink-0`,"aria-hidden":`true`}),i?(0,R.jsx)(`input`,{autoFocus:!0,value:a,onFocus:e=>e.currentTarget.select(),onChange:e=>f(e.target.value),onKeyDown:e=>p(e,t.sessionId),onBlur:()=>m(t.sessionId),placeholder:v,maxLength:200,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-xs text-neutral-100 outline-none focus:border-neutral-500`}):(0,R.jsxs)(`button`,{onClick:e=>{if(e.metaKey||e.ctrlKey){u(t.sessionId);return}l(t.sessionId)},onDoubleClick:()=>d(t.sessionId,v),className:`flex-1 truncate text-left`,title:`${t.sessionId} — double-click to rename, Cmd/Ctrl+click to select for bulk delete`,children:[c>0&&(0,R.jsx)(`span`,{className:`mr-1 text-purple-400 light:text-purple-700`,title:`child/worker session`,children:`↳`}),v]}),!i&&(0,R.jsx)(`button`,{"data-armed-delete":g?t.sessionId:void 0,onClick:e=>{e.stopPropagation(),_(t.sessionId)},className:g?`inline-flex h-6 items-center rounded border border-red-500 px-1.5 text-[11px] font-medium uppercase leading-none tracking-wide text-red-300 hover:bg-red-500/10 light:border-red-600 light:text-red-700 light:hover:bg-red-100`:`inline-flex h-6 w-6 items-center justify-center rounded text-neutral-500 hover:text-red-400 light:hover:text-red-700`,title:g?`Click again to delete (Esc to cancel)`:t.isLive?`Delete session — also kills the live shell`:`Delete session JSONL from disk`,"aria-label":g?`Confirm delete`:`Delete session`,children:g?`Confirm`:(0,R.jsx)(at,{size:16})})]})}function la({className:e=``}={}){let t=xr(e=>e.projects),n=xr(e=>e.activeProjectId),r=xr(e=>e.collapsed),i=xr(e=>e.setActive),a=xr(e=>e.toggleCollapsed),o=xr(e=>e.remove),s=xr(e=>e.rename),c=xr(e=>e.reorder),l=pi(e=>e.byProject),u=pi(e=>e.createSession),d=pi(e=>e.disposeSession),f=async e=>{n!==e&&i(e);try{await u(e)}catch{}},[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(),[w,T]=(0,v.useState)(void 0),E=(e,t)=>{let n=l[e]??[],r=n.filter(e=>e.isLive).length,i=n.filter(e=>!e.isLive).length;T({id:e,name:t,liveCount:r,onDiskCount:i,acknowledged:!1,submitting:!1})},D=async()=>{if(w===void 0)return;let{id:e}=w;T({...w,submitting:!0});let t=(l[e]??[]).filter(e=>e.isLive).map(e=>e.sessionId);t.length>0&&await Promise.all(t.map(e=>d(e).catch(()=>void 0))),T(void 0),o(e)},O=async e=>{let t=_.trim();if(t.length===0){g(void 0);return}try{await s(e,t)}finally{g(void 0),y(``)}},k=()=>{x(void 0),C(void 0)},ee=async e=>{let n=b;if(k(),n===void 0||n===e)return;let r=t.findIndex(e=>e.id===n),i=t.findIndex(t=>t.id===e);if(r===-1||i===-1)return;let a=t.map(e=>e.id),[o]=a.splice(r,1);if(o!==void 0){a.splice(i,0,o);try{await c(a)}catch{}}};return(0,R.jsxs)(`aside`,{className:`flex h-full w-64 flex-col border-r border-neutral-800 bg-neutral-950 ${e}`,style:{paddingTop:`env(safe-area-inset-top)`,paddingBottom:`env(safe-area-inset-bottom)`},children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:`Projects`}),(0,R.jsx)(`button`,{onClick:()=>m(!0),className:`rounded-md border border-neutral-700 px-2 py-0.5 text-xs text-neutral-200 hover:bg-neutral-800`,children:`+ New`})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-1`,children:[t.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-4 text-sm text-neutral-500`,children:`No projects yet.`}),t.map(e=>{let t=e.id===n,o=r[e.id]??!1;return(0,R.jsxs)(`div`,{className:`mt-1 px-1 ${b===e.id?`opacity-60`:``}`,draggable:h!==e.id,onDragStart:t=>{if(h===e.id){t.preventDefault();return}t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id),x(e.id)},onDragEnter:t=>{t.preventDefault(),b!==void 0&&b!==e.id&&C(e.id)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},onDragEnd:k,onDrop:t=>{t.preventDefault(),ee(e.id)},children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-md px-2 py-1 text-sm ring-inset transition-colors ${S===e.id?`ring-1 ring-cyan-500/70`:t?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900`}`,children:[(0,R.jsx)(`span`,{className:`flex cursor-grab items-center text-neutral-600 group-hover:text-neutral-400`,title:`Drag to reorder projects`,"aria-hidden":`true`,children:(0,R.jsx)(Ie,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>a(e.id),className:`flex items-center text-neutral-500 hover:text-neutral-300`,title:o?`Expand`:`Collapse`,children:o?(0,R.jsx)(we,{size:16}):(0,R.jsx)(Se,{size:16})}),h===e.id?(0,R.jsx)(`input`,{value:_,onChange:e=>y(e.target.value),onBlur:()=>void O(e.id),onKeyDown:t=>{t.key===`Enter`&&O(e.id),t.key===`Escape`&&g(void 0)},autoFocus:!0,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-sm`}):(0,R.jsxs)(`button`,{onClick:()=>i(e.id),onDoubleClick:()=>{g(e.id),y(e.name)},className:`flex min-w-0 flex-1 flex-col items-start text-left leading-tight`,title:e.path,children:[(0,R.jsx)(`span`,{className:`w-full truncate`,children:e.name}),(0,R.jsx)(`span`,{className:`w-full truncate font-mono text-[10px] text-neutral-500`,children:ua(e.path)})]}),(0,R.jsx)(`button`,{onClick:()=>void f(e.id),className:`inline-flex p-1 text-neutral-500 hover:text-neutral-200`,title:`New session in this project`,children:(0,R.jsx)(qe,{size:16})}),(0,R.jsx)(`button`,{onClick:()=>E(e.id,e.name),className:`inline-flex items-center p-1 text-neutral-500 hover:text-red-400`,title:`Delete project (blocked while live sessions exist)`,children:(0,R.jsx)(at,{size:16})})]}),!o&&(0,R.jsx)(oa,{projectId:e.id})]},e.id)})]}),p&&(0,R.jsx)(ea,{onClose:()=>m(!1)}),(0,R.jsx)(ra,{open:w!==void 0,onClose:()=>T(void 0),title:w===void 0?`Delete project`:`Delete project "${w.name}"`,children:w!==void 0&&(()=>{let e=w.liveCount+w.onDiskCount,t=e>0,n=!w.submitting&&(!t||w.acknowledged);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-300`,children:[`Remove "`,w.name,`" from pi-forge.`]}),(0,R.jsxs)(`ul`,{className:`ml-4 list-disc space-y-0.5 text-[11px] text-neutral-400`,children:[(0,R.jsxs)(`li`,{children:[`Project record + the project's session directory (`,(0,R.jsxs)(`code`,{className:`font-mono text-[10px] text-neutral-400`,children:[`.pi/sessions/`,w.id,`/`]}),`) will be deleted.`]}),w.liveCount>0&&(0,R.jsxs)(`li`,{children:[w.liveCount,` live session`,w.liveCount===1?``:`s`,` will be disposed first.`]}),(0,R.jsxs)(`li`,{children:[`The project's workspace folder on disk is `,(0,R.jsx)(`strong`,{children:`not`}),` touched.`]})]}),t&&(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-red-900/40 bg-red-950/30 px-2 py-1.5 text-xs text-red-200 light:border-red-300 light:bg-red-50 light:text-red-800`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:w.acknowledged,onChange:e=>T(t=>t===void 0?t:{...t,acknowledged:e.target.checked}),className:`mt-0.5 h-3 w-3`}),(0,R.jsxs)(`span`,{children:[`Yes, I understand this will delete `,e,` session`,e===1?``:`s`,w.liveCount>0&&w.onDiskCount>0?` (${w.liveCount} live, ${w.onDiskCount} on disk)`:w.liveCount>0?` (${w.liveCount} live)`:``,`. This can't be undone.`]})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>T(void 0),disabled:w.submitting,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800 disabled:opacity-50`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:!n,className:`rounded-md bg-red-700 px-3 py-1 text-xs font-medium text-red-50 hover:bg-red-600 disabled:opacity-50 disabled:hover:bg-red-700`,children:w.submitting?`Deleting…`:`Delete`})]})]})})()})]})}function ua(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t[t.length-1]??e}function da(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=da(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function fa(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=da(e))&&(r&&(r+=` `),r+=t);return r}var pa=Object.create,ma=Object.defineProperty,ha=Object.defineProperties,ga=Object.getOwnPropertyDescriptor,_a=Object.getOwnPropertyDescriptors,va=Object.getOwnPropertyNames,ya=Object.getOwnPropertySymbols,ba=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty,Sa=Object.prototype.propertyIsEnumerable,Ca=(e,t,n)=>t in e?ma(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wa=(e,t)=>{for(var n in t||={})xa.call(t,n)&&Ca(e,n,t[n]);if(ya)for(var n of ya(t))Sa.call(t,n)&&Ca(e,n,t[n]);return e},Ta=(e,t)=>ha(e,_a(t)),Ea=(e,t)=>{var n={};for(var r in e)xa.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ya)for(var r of ya(e))t.indexOf(r)<0&&Sa.call(e,r)&&(n[r]=e[r]);return n},Da=(e,t)=>function(){return t||(0,e[va(e)[0]])((t={exports:{}}).exports,t),t.exports},Oa=(e,t)=>{for(var n in t)ma(e,n,{get:t[n],enumerable:!0})},ka=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of va(t))!xa.call(e,i)&&i!==n&&ma(e,i,{get:()=>t[i],enumerable:!(r=ga(t,i))||r.enumerable});return e},z=((e,t,n)=>(n=e==null?{}:pa(ba(e)),ka(t||!e||!e.__esModule?ma(n,`default`,{value:e,enumerable:!0}):n,e)))(Da({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&`).replace(/</g,`<`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){n||={};var i,a;switch(r.util.type(t)){case`Object`:if(a=r.util.objId(t),n[a])return n[a];for(var o in i={},n[a]=i,t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case`Array`:return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach(function(t,r){i[r]=e(t,n)}),i);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return`none`},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,`gi`),``),t.classList.add(`language-`+n)},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){i||=r.languages;var a=i[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=i[e];return i[e]=o,r.languages.DFS(r.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,i,a){a||={};var o=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],i||s);var c=t[s],l=r.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(r.hooks.run(`before-tokenize`,a),!a.grammar)throw Error(`The language "`+a.language+`" has no grammar.`);return a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run(`after-tokenize`,a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new s;return c(i,i.head,e),o(e,i,t,i.head,0),u(i)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!(!n||!n.length))for(var i=0,a;a=n[i++];)a(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}i.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var i=``;return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`"`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function a(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function o(e,t,n,s,u,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=s.next,C=u;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof i)){var T=1,E;if(v){if(E=a(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,O=E.index+E[0].length,k=C;for(k+=S.value.length;D>=k;)S=S.next,k+=S.value.length;if(k-=S.value.length,C=k,S.value instanceof i)continue;for(var ee=S;ee!==t.tail&&(k<O||typeof ee.value==`string`);ee=ee.next)T++,k+=ee.value.length;T--,w=e.slice(C,k),E.index-=C}else if(E=a(x,0,w,_),!E)continue;var D=E.index,te=E[0],ne=w.slice(0,D),re=w.slice(D+te.length),ie=C+w.length;d&&ie>d.reach&&(d.reach=ie);var ae=S.prev;ne&&(ae=c(t,ae,ne),C+=ne.length),l(t,ae,T);var A=new i(f,g?r.tokenize(te,g):te,y,te);if(S=c(t,ae,A),re&&c(t,S,re),T>1){var j={cause:f+`,`+m,reach:ie};o(e,t,n,S.prev,C,j),d&&j.reach>d.reach&&(d.reach=j.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function l(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function u(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}return r}();t.exports=n,n.default=n}})());z.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},z.languages.markup.tag.inside[`attr-value`].inside.entity=z.languages.markup.entity,z.languages.markup.doctype.inside[`internal-subset`].inside=z.languages.markup,z.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&/,`&`))}),Object.defineProperty(z.languages.markup.tag,"addInlined",{value:function(e,t){var n={},n=(n[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:z.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),t=(n[`language-`+t]={pattern:/[\s\S]+/,inside:z.languages[t]},{});t[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:n},z.languages.insertBefore(`markup`,`cdata`,t)}}),Object.defineProperty(z.languages.markup.tag,"addAttribute",{value:function(e,t){z.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:z.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),z.languages.html=z.languages.markup,z.languages.mathml=z.languages.markup,z.languages.svg=z.languages.markup,z.languages.xml=z.languages.extend(`markup`,{}),z.languages.ssml=z.languages.xml,z.languages.atom=z.languages.xml,z.languages.rss=z.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:`escape`},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r=`(?:[^\\\\-]|`+n.source+`)`,r=RegExp(r+`-`+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:`variable`};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:`operator`},"char-class-punctuation":{pattern:/^\[|\]$/,alias:`punctuation`},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:`operator`}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:`keyword`},{pattern:/\\k<[^<>']+>/,alias:`keyword`,inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:`function`},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:`punctuation`,inside:{"group-name":i}},{pattern:/\)/,alias:`punctuation`}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:`number`},alternation:{pattern:/\|/,alias:`keyword`}}}(z),z.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},z.languages.javascript=z.languages.extend(`clike`,{"class-name":[z.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),z.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,z.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:z.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:z.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:z.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:z.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:z.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),z.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:z.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),z.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),z.languages.markup&&(z.languages.markup.tag.addInlined(`script`,`javascript`),z.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),z.languages.js=z.languages.javascript,z.languages.actionscript=z.languages.extend(`javascript`,{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),z.languages.actionscript[`class-name`].alias=`function`,delete z.languages.actionscript.parameter,delete z.languages.actionscript[`literal-property`],z.languages.markup&&z.languages.insertBefore(`actionscript`,`string`,{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:z.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:`variable`};e.languages.coffeescript=e.languages.extend(`javascript`,{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:`variable`}}),e.languages.insertBefore(`coffeescript`,`comment`,{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:`comment`},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:`regex`,inside:{comment:t,interpolation:n}}}),e.languages.insertBefore(`coffeescript`,`string`,{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:`punctuation`},script:{pattern:/[\s\S]+/,alias:`language-javascript`,inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:`string`},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:`string`,inside:{interpolation:n}}]}),e.languages.insertBefore(`coffeescript`,`keyword`,{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript[`template-string`],e.languages.coffee=e.languages.coffeescript}(z),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(t,n){(t=typeof t==`string`?[t]:t).forEach(function(t){var r=function(e){e.inside||={},e.inside.rest=n},i=`doc-comment`;if(a=e.languages[t]){var a,o=a[i];if((o||=(a=e.languages.insertBefore(t,`comment`,{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:`comment`}}))[i])instanceof RegExp&&(o=a[i]={pattern:o}),Array.isArray(o))for(var s=0,c=o.length;s<c;s++)o[s]instanceof RegExp&&(o[s]={pattern:o[s]}),r(o[s]);else r(o)}})}}),t.addSupport([`java`,`javascript`,`php`],t)}(z),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined(`style`,`css`),t.tag.addAttribute(`style`,`css`))}(z),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+`)*\\]`),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:`keyword`},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside[`selector-function-argument`].inside=t,e.languages.insertBefore(`css`,`property`,{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore(`css`,`function`,{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:`color`},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(z),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(z),function(e){function t(e){return e=e.replace(/<inner>/g,function(){return`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var n="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",r=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return n}),i=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`,a=(e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+r+i+`(?:`+r+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+r+i+`)(?:`+r+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+r+`)`+i+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+r+`$`),inside:{"table-header":{pattern:RegExp(n),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:t(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:t(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){e.language!==`markdown`&&e.language!==`md`||function e(t){if(t&&typeof t!=`string`)for(var n=0,r=t.length;n<r;n++){var i,a=t[n];a.type===`code`?(i=a.content[1],a=a.content[3],i&&a&&i.type===`code-language`&&a.type===`code-block`&&typeof i.content==`string`&&(i=i.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`),i=`language-`+(i=(/[a-z][\w-]*/i.exec(i)||[``])[0].toLowerCase()),a.alias?typeof a.alias==`string`?a.alias=[a.alias,i]:a.alias.push(i):a.alias=[i])):e(a.content)}}(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var c=t.classes[r],c=/language-(.+)/.exec(c);if(c){n=c[1];break}}var l,u=e.languages[n];u?t.content=e.highlight(function(e){return e=e.replace(a,``),e=e.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var n;return(t=t.toLowerCase())[0]===`#`?(n=t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1)),s(n)):o[t]||e})}(t.content),u,n):n&&n!==`none`&&e.plugins.autoloader&&(l=`md-`+new Date().valueOf()+`-`+Math.floor(0x2386f26fc10000*Math.random()),t.attributes.id=l,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(l);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}),RegExp(e.languages.markup.tag.pattern.source,`gi`)),o={amp:`&`,lt:`<`,gt:`>`,quot:`"`},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(z),z.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:`string`,inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:z.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:`function`},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:`class-name`},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},z.hooks.add(`after-tokenize`,function(e){if(e.language===`graphql`)for(var t=e.tokens.filter(function(e){return typeof e!=`string`&&e.type!==`comment`&&e.type!==`scalar`}),n=0;n<t.length;){var r=t[n++];if(r.type===`keyword`&&r.content===`mutation`){var i=[];if(d([`definition-mutation`,`punctuation`])&&u(1).content===`(`){n+=2;var a=f(/^\($/,/^\)$/);if(a===-1)continue;for(;n<a;n++){var o=u(0);o.type===`variable`&&(p(o,`variable-input`),i.push(o.content))}n=a+1}if(d([`punctuation`,`property-query`])&&u(0).content===`{`&&(n++,p(u(0),`property-mutation`),0<i.length)){var s=f(/^\{$/,/^\}$/);if(s!==-1)for(var c=n;c<s;c++){var l=t[c];l.type===`variable`&&0<=i.indexOf(l.content)&&p(l,`variable-input`)}}}}function u(e){return t[n+e]}function d(e,t){t||=0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function f(e,r){for(var i=1,a=n;a<t.length;a++){var o=t[a],s=o.content;if(o.type===`punctuation`&&typeof s==`string`){if(e.test(s))i++;else if(r.test(s)&&--i===0)return a}}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}}),z.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript[`template-string`],n=t.pattern.source,r=t.inside.interpolation,i=r.inside[`interpolation-punctuation`],a=r.pattern.source;function o(t,r){if(e.languages[t])return{pattern:RegExp(`((?:`+r+`)\\s*)`+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run(`before-tokenize`,t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run(`after-tokenize`,t),t.tokens}function c(t,n,o){var c=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),l=0,u={},c=s(c.map(function(e){if(typeof e==`string`)return e;for(var n,r,e=e.content;t.indexOf((r=l++,n=`___`+o.toUpperCase()+`_`+r+`___`))!==-1;);return u[n]=e,n}).join(``),n,o),d=Object.keys(u);return l=0,function t(n){for(var a=0;a<n.length;a++){if(l>=d.length)return;var o,c,f,p,m,h,g,_=n[a];typeof _==`string`||typeof _.content==`string`?(o=d[l],(g=(h=typeof _==`string`?_:_.content).indexOf(o))!==-1&&(++l,c=h.substring(0,g),m=u[o],f=void 0,(p={})[`interpolation-punctuation`]=i,(p=e.tokenize(m,p)).length===3&&((f=[1,1]).push.apply(f,s(p[1],e.languages.javascript,`javascript`)),p.splice.apply(p,f)),f=new e.Token(`interpolation`,p,r.alias,m),p=h.substring(g+o.length),m=[],c&&m.push(c),m.push(f),p&&(t(h=[p]),m.push.apply(m,h)),typeof _==`string`?(n.splice.apply(n,[a,1].concat(m)),a+=m.length-1):_.content=m)):(g=_.content,t(Array.isArray(g)?g:[g]))}}(c),new e.Token(o,c,`language-`+o,t)}e.languages.javascript[`template-string`]=[o(`css`,`\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)`),o(`html`,`\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?=`),o(`svg`,`\\bsvg`),o(`markdown`,`\\b(?:markdown|md)`),o(`graphql`,`\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)`),o(`sql`,`\\bsql`),t].filter(Boolean);var l={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return typeof e==`string`?e:Array.isArray(e)?e.map(u).join(``):u(e.content)}e.hooks.add(`after-tokenize`,function(t){t.language in l&&function t(n){for(var r=0,i=n.length;r<i;r++){var a,o,s,l=n[r];typeof l!=`string`&&(a=l.content,Array.isArray(a)?l.type===`template-string`?(l=a[1],a.length===3&&typeof l!=`string`&&l.type===`embedded-code`&&(o=u(l),l=l.alias,l=Array.isArray(l)?l[0]:l,s=e.languages[l])&&(a[1]=c(o,s,l))):t(a):typeof a!=`string`&&t([a]))}}(t.tokens)})}(z),function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript}(z),function(e){var t=e.languages.javascript,n=`\\{(?:[^{}]|\\{(?:[^{}]|\\{[^{}]*\\})*\\})+\\}`,r=`(@(?:arg|argument|param|property)\\s+(?:`+n+`\\s+)?)`;e.languages.jsdoc=e.languages.extend(`javadoclike`,{parameter:{pattern:RegExp(r+`(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?=\\s|$)`),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore(`jsdoc`,`keyword`,{"optional-parameter":{pattern:RegExp(r+`\\[(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?:=[^[\\]]+)?\\](?=\\s|$)`),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:`language-javascript`},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(`(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\\s+(?:<TYPE>\\s+)?)[A-Z]\\w*(?:\\.[A-Z]\\w*)*`.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp(`(@[a-z]+\\s+)`+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:`language-javascript`}}}}),e.languages.javadoclike.addSupport(`javascript`,e.languages.jsdoc)}(z),function(e){e.languages.flow=e.languages.extend(`javascript`,{}),e.languages.insertBefore(`flow`,`keyword`,{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:`class-name`}]}),e.languages.flow[`function-variable`].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore(`flow`,`operator`,{"flow-punctuation":{pattern:/\{\||\|\}/,alias:`punctuation`}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(z),z.languages.n4js=z.languages.extend(`javascript`,{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),z.languages.insertBefore(`n4js`,`constant`,{annotation:{pattern:/@+\w+/,alias:`operator`}}),z.languages.n4jsd=z.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,function(){return`(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*`}),t)}e.languages.insertBefore(`javascript`,`function-variable`,{"method-variable":{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript[`function-variable`].pattern.source),lookbehind:!0,alias:[`function-variable`,`method`,`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`function`,{method:{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript.function.source),lookbehind:!0,alias:[`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`constant`,{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:`class-name`},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:`class-name`}]}),e.languages.insertBefore(`javascript`,`keyword`,{imports:{pattern:t(`(\\bimport\\b\\s*)(?:<ID>(?:\\s*,\\s*(?:\\*\\s*as\\s+<ID>|\\{[^{}]*\\}))?|\\*\\s*as\\s+<ID>|\\{[^{}]*\\})(?=\\s*\\bfrom\\b)`),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(`(\\bexport\\b\\s*)(?:\\*(?:\\s*as\\s+<ID>)?(?=\\s*\\bfrom\\b)|\\{[^{}]*\\})`),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:`module`},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:`control-flow`},{pattern:/\bnull\b/,alias:[`null`,`nil`]},{pattern:/\bundefined\b/,alias:`nil`}),e.languages.insertBefore(`javascript`,`operator`,{spread:{pattern:/\.{3}/,alias:`operator`},arrow:{pattern:/=>/,alias:`operator`}}),e.languages.insertBefore(`javascript`,`punctuation`,{"property-access":{pattern:t(`(\\.\\s*)#?<ID>`),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:`variable`},console:{pattern:/\bconsole(?=\s*\.)/,alias:`class-name`}});for(var n=[`function`,`function-variable`,`method`,`method-variable`,`property-access`],r=0;r<n.length;r++){var i=n[r],a=e.languages.javascript[i],i=(a=e.util.type(a)===`RegExp`?e.languages.javascript[i]={pattern:a}:a).inside||{};(a.inside=i)[`maybe-class-name`]=/^[A-Z][\s\S]*/}}(z),function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?0<n.length&&n[n.length-1].tagName===s(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content!==`/>`&&n.push({tagName:s(i.content[0].content[1]),openedBraces:0}):0<n.length&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&0<n.length&&n[n.length-1].openedBraces===0&&(a=s(i),r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(a+=s(t[r+1]),t.splice(r+1,1)),0<r&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(a=s(t[r-1])+a,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,a,null,a)),i.content&&typeof i.content!=`string`&&o(i.content)}}var s=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(s).join(``):``};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||o(e.tokens)})}(z),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`],e.languages.tsx.tag);t.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+t.pattern.source+`)`,t.pattern.flags),t.lookbehind=!0}(z),z.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),alias:`property`,inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:`constant`},"other-directive":{pattern:/#\w+\b/,alias:`property`},attribute:{pattern:/@\w+/,alias:`atrule`},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:`function`},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:`important`},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:`constant`},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:`keyword`},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},z.languages.swift[`string-literal`].forEach(function(e){e.inside.interpolation.inside=z.languages.swift}),function(e){e.languages.kotlin=e.languages.extend(`clike`,{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin[`class-name`];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:`punctuation`},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore(`kotlin`,`string`,{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:`multiline`,inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:`singleline`,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore(`kotlin`,`keyword`,{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:`builtin`}}),e.languages.insertBefore(`kotlin`,`function`,{label:{pattern:/\b\w+@|@\w+\b/,alias:`symbol`}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(z),z.languages.c=z.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),z.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),z.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},z.languages.c.string],char:z.languages.c.char,comment:z.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:z.languages.c}}}}),z.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete z.languages.c.boolean,z.languages.objectivec=z.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete z.languages.objectivec[`class-name`],z.languages.objc=z.languages.objectivec,z.languages.reason=z.languages.extend(`clike`,{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),z.languages.insertBefore(`reason`,`class-name`,{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:`symbol`}}),delete z.languages.reason.function,function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(z),z.languages.go=z.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),z.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete z.languages.go[`class-name`],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])}(z),z.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},z.languages.python[`string-interpolation`].inside.interpolation.inside.rest=z.languages.python,z.languages.py=z.languages.python,z.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},z.languages.webmanifest=z.languages.json;var Aa={};Oa(Aa,{dracula:()=>ja,duotoneDark:()=>Ma,duotoneLight:()=>Na,github:()=>Pa,gruvboxMaterialDark:()=>Xa,gruvboxMaterialLight:()=>Za,jettwaveDark:()=>Ka,jettwaveLight:()=>qa,nightOwl:()=>Fa,nightOwlLight:()=>Ia,oceanicNext:()=>Ra,okaidia:()=>za,oneDark:()=>Ja,oneLight:()=>Ya,palenight:()=>Ba,shadesOfPurple:()=>Va,synthwave84:()=>Ha,ultramin:()=>Ua,vsDark:()=>Wa,vsLight:()=>Ga});var ja={plain:{color:`#F8F8F2`,backgroundColor:`#282A36`},styles:[{types:[`prolog`,`constant`,`builtin`],style:{color:`rgb(189, 147, 249)`}},{types:[`inserted`,`function`],style:{color:`rgb(80, 250, 123)`}},{types:[`deleted`],style:{color:`rgb(255, 85, 85)`}},{types:[`changed`],style:{color:`rgb(255, 184, 108)`}},{types:[`punctuation`,`symbol`],style:{color:`rgb(248, 248, 242)`}},{types:[`string`,`char`,`tag`,`selector`],style:{color:`rgb(255, 121, 198)`}},{types:[`keyword`,`variable`],style:{color:`rgb(189, 147, 249)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(98, 114, 164)`}},{types:[`attr-name`],style:{color:`rgb(241, 250, 140)`}}]},Ma={plain:{backgroundColor:`#2a2734`,color:`#9a86fd`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#6c6783`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#e09142`}},{types:[`property`,`function`],style:{color:`#9a86fd`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#eeebff`}},{types:[`attr-name`],style:{color:`#c4b9fe`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`,`placeholder`,`variable`],style:{color:`#ffcc99`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#c4b9fe`}}]},Na={plain:{backgroundColor:`#faf8f5`,color:`#728fcb`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#b6ad9a`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#063289`}},{types:[`property`,`function`],style:{color:`#b29762`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#2d2006`}},{types:[`attr-name`],style:{color:`#896724`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`],style:{color:`#728fcb`}},{types:[`placeholder`,`variable`],style:{color:`#93abdc`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#896724`}}]},Pa={plain:{color:`#393A34`,backgroundColor:`#f6f8fa`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`],style:{color:`#999988`,fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}},{types:[`string`,`attr-value`],style:{color:`#e3116c`}},{types:[`punctuation`,`operator`],style:{color:`#393A34`}},{types:[`entity`,`url`,`symbol`,`number`,`boolean`,`variable`,`constant`,`property`,`regex`,`inserted`],style:{color:`#36acaa`}},{types:[`atrule`,`keyword`,`attr-name`,`selector`],style:{color:`#00a4db`}},{types:[`function`,`deleted`,`tag`],style:{color:`#d73a49`}},{types:[`function-variable`],style:{color:`#6f42c1`}},{types:[`tag`,`selector`,`keyword`],style:{color:`#00009f`}}]},Fa={plain:{color:`#d6deeb`,backgroundColor:`#011627`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(99, 119, 119)`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`rgb(173, 219, 103)`}},{types:[`variable`],style:{color:`rgb(214, 222, 235)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`],style:{color:`rgb(199, 146, 234)`}},{types:[`selector`,`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(255, 203, 139)`}},{types:[`tag`,`operator`,`keyword`],style:{color:`rgb(127, 219, 202)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`property`],style:{color:`rgb(128, 203, 196)`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}}]},Ia={plain:{color:`#403f53`,backgroundColor:`#FBFBFB`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(72, 118, 214)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(152, 159, 177)`,fontStyle:`italic`}},{types:[`string`,`builtin`,`char`,`constant`,`url`],style:{color:`rgb(72, 118, 214)`}},{types:[`variable`],style:{color:`rgb(201, 103, 101)`}},{types:[`number`],style:{color:`rgb(170, 9, 130)`}},{types:[`punctuation`],style:{color:`rgb(153, 76, 195)`}},{types:[`function`,`selector`,`doctype`],style:{color:`rgb(153, 76, 195)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(17, 17, 17)`}},{types:[`tag`],style:{color:`rgb(153, 76, 195)`}},{types:[`operator`,`property`,`keyword`,`namespace`],style:{color:`rgb(12, 150, 155)`}},{types:[`boolean`],style:{color:`rgb(188, 84, 84)`}}]},La={char:`#D8DEE9`,comment:`#999999`,keyword:`#c5a5c5`,primitive:`#5a9bcf`,string:`#8dc891`,variable:`#d7deea`,boolean:`#ff8b50`,punctuation:`#5FB3B3`,tag:`#fc929e`,function:`#79b6f2`,className:`#FAC863`,method:`#6699CC`,operator:`#fc929e`},Ra={plain:{backgroundColor:`#282c34`,color:`#ffffff`},styles:[{types:[`attr-name`],style:{color:La.keyword}},{types:[`attr-value`],style:{color:La.string}},{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`,`shebang`],style:{color:La.comment}},{types:[`property`,`number`,`function-name`,`constant`,`symbol`,`deleted`],style:{color:La.primitive}},{types:[`boolean`],style:{color:La.boolean}},{types:[`tag`],style:{color:La.tag}},{types:[`string`],style:{color:La.string}},{types:[`punctuation`],style:{color:La.string}},{types:[`selector`,`char`,`builtin`,`inserted`],style:{color:La.char}},{types:[`function`],style:{color:La.function}},{types:[`operator`,`entity`,`url`,`variable`],style:{color:La.variable}},{types:[`keyword`],style:{color:La.keyword}},{types:[`atrule`,`class-name`],style:{color:La.className}},{types:[`important`],style:{fontWeight:`400`}},{types:[`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}}]},za={plain:{color:`#f8f8f2`,backgroundColor:`#272822`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`#f92672`,fontStyle:`italic`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`#8292a2`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`#a6e22e`}},{types:[`variable`],style:{color:`#f8f8f2`}},{types:[`number`],style:{color:`#ae81ff`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`#e6db74`}},{types:[`punctuation`],style:{color:`#f8f8f2`}},{types:[`selector`,`doctype`],style:{color:`#a6e22e`,fontStyle:`italic`}},{types:[`tag`,`operator`,`keyword`],style:{color:`#66d9ef`}},{types:[`boolean`],style:{color:`#ae81ff`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`,opacity:.7}},{types:[`tag`,`property`],style:{color:`#f92672`}},{types:[`attr-name`],style:{color:`#a6e22e !important`}},{types:[`doctype`],style:{color:`#8292a2`}},{types:[`rule`],style:{color:`#e6db74`}}]},Ba={plain:{color:`#bfc7d5`,backgroundColor:`#292d3e`},styles:[{types:[`comment`],style:{color:`rgb(105, 112, 152)`,fontStyle:`italic`}},{types:[`string`,`inserted`],style:{color:`rgb(195, 232, 141)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`,`selector`],style:{color:`rgb(199, 146, 234)`}},{types:[`variable`],style:{color:`rgb(191, 199, 213)`}},{types:[`class-name`,`attr-name`],style:{color:`rgb(255, 203, 107)`}},{types:[`tag`,`deleted`],style:{color:`rgb(255, 85, 114)`}},{types:[`operator`],style:{color:`rgb(137, 221, 255)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`keyword`],style:{fontStyle:`italic`}},{types:[`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}},{types:[`url`],style:{color:`rgb(221, 221, 221)`}}]},Va={plain:{color:`#9EFEFF`,backgroundColor:`#2D2A55`},styles:[{types:[`changed`],style:{color:`rgb(255, 238, 128)`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`}},{types:[`comment`],style:{color:`rgb(179, 98, 255)`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`rgb(255, 255, 255)`}},{types:[`constant`],style:{color:`rgb(255, 98, 140)`}},{types:[`string`,`url`],style:{color:`rgb(165, 255, 144)`}},{types:[`variable`],style:{color:`rgb(255, 238, 128)`}},{types:[`number`,`boolean`],style:{color:`rgb(255, 98, 140)`}},{types:[`attr-name`],style:{color:`rgb(255, 180, 84)`}},{types:[`keyword`,`operator`,`property`,`namespace`,`tag`,`selector`,`doctype`],style:{color:`rgb(255, 157, 0)`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`rgb(250, 208, 0)`}}]},Ha={plain:{backgroundColor:`linear-gradient(to bottom, #2a2139 75%, #34294f)`,backgroundImage:`#34294f`,color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`},styles:[{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`],style:{color:`#495495`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`#ccc`}},{types:[`tag`,`attr-name`,`namespace`,`number`,`unit`,`hexcode`,`deleted`],style:{color:`#e2777a`}},{types:[`property`,`selector`],style:{color:`#72f1b8`,textShadow:`0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475`}},{types:[`function-name`],style:{color:`#6196cc`}},{types:[`boolean`,`selector-id`,`function`],style:{color:`#fdfdfd`,textShadow:`0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975`}},{types:[`class-name`,`maybe-class-name`,`builtin`],style:{color:`#fff5f6`,textShadow:`0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75`}},{types:[`constant`,`symbol`],style:{color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`}},{types:[`important`,`atrule`,`keyword`,`selector-class`],style:{color:`#f4eee4`,textShadow:`0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575`}},{types:[`string`,`char`,`attr-value`,`regex`,`variable`],style:{color:`#f87c32`}},{types:[`parameter`],style:{fontStyle:`italic`}},{types:[`entity`,`url`],style:{color:`#67cdcc`}},{types:[`operator`],style:{color:`ffffffee`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`entity`],style:{cursor:`help`}},{types:[`inserted`],style:{color:`green`}}]},Ua={plain:{color:`#282a2e`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(197, 200, 198)`}},{types:[`string`,`number`,`builtin`,`variable`],style:{color:`rgb(150, 152, 150)`}},{types:[`class-name`,`function`,`tag`,`attr-name`],style:{color:`rgb(40, 42, 46)`}}]},Wa={plain:{color:`#9CDCFE`,backgroundColor:`#1E1E1E`},styles:[{types:[`prolog`],style:{color:`rgb(0, 0, 128)`}},{types:[`comment`],style:{color:`rgb(106, 153, 85)`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`rgb(86, 156, 214)`}},{types:[`number`,`inserted`],style:{color:`rgb(181, 206, 168)`}},{types:[`constant`],style:{color:`rgb(100, 102, 149)`}},{types:[`attr-name`,`variable`],style:{color:`rgb(156, 220, 254)`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`rgb(206, 145, 120)`}},{types:[`selector`],style:{color:`rgb(215, 186, 125)`}},{types:[`tag`],style:{color:`rgb(78, 201, 176)`}},{types:[`tag`],languages:[`markup`],style:{color:`rgb(86, 156, 214)`}},{types:[`punctuation`,`operator`],style:{color:`rgb(212, 212, 212)`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`rgb(220, 220, 170)`}},{types:[`class-name`],style:{color:`rgb(78, 201, 176)`}},{types:[`char`],style:{color:`rgb(209, 105, 105)`}}]},Ga={plain:{color:`#000000`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(0, 128, 0)`}},{types:[`builtin`],style:{color:`rgb(0, 112, 193)`}},{types:[`number`,`variable`,`inserted`],style:{color:`rgb(9, 134, 88)`}},{types:[`operator`],style:{color:`rgb(0, 0, 0)`}},{types:[`constant`,`char`],style:{color:`rgb(129, 31, 63)`}},{types:[`tag`],style:{color:`rgb(128, 0, 0)`}},{types:[`attr-name`],style:{color:`rgb(255, 0, 0)`}},{types:[`deleted`,`string`],style:{color:`rgb(163, 21, 21)`}},{types:[`changed`,`punctuation`],style:{color:`rgb(4, 81, 165)`}},{types:[`function`,`keyword`],style:{color:`rgb(0, 0, 255)`}},{types:[`class-name`],style:{color:`rgb(38, 127, 153)`}}]},Ka={plain:{color:`#f8fafc`,backgroundColor:`#011627`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#569CD6`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#f8fafc`}},{types:[`attr-name`,`variable`],style:{color:`#9CDCFE`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#cbd5e1`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#D4D4D4`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#7dd3fc`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},qa={plain:{color:`#0f172a`,backgroundColor:`#f1f5f9`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#0c4a6e`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#0f172a`}},{types:[`attr-name`,`variable`],style:{color:`#0c4a6e`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#64748b`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#475569`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#0e7490`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},Ja={plain:{backgroundColor:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(220, 10%, 40%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(220, 14%, 71%)`}},{types:[`attr-name`,`class-name`,`maybe-class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(29, 54%, 61%)`}},{types:[`keyword`],style:{color:`hsl(286, 60%, 67%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(355, 65%, 65%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`],style:{color:`hsl(95, 38%, 62%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(207, 82%, 66%)`}},{types:[`url`],style:{color:`hsl(187, 47%, 55%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(220, 14%, 71%)`}}]},Ya={plain:{backgroundColor:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(230, 4%, 64%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(230, 8%, 24%)`}},{types:[`attr-name`,`class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(35, 99%, 36%)`}},{types:[`keyword`],style:{color:`hsl(301, 63%, 40%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(5, 74%, 59%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`,`punctuation`],style:{color:`hsl(119, 34%, 47%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(221, 87%, 60%)`}},{types:[`url`],style:{color:`hsl(198, 99%, 37%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(230, 8%, 24%)`}}]},Xa={plain:{color:`#ebdbb2`,backgroundColor:`#292828`},styles:[{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`,`function`],style:{color:`#d8a657`}},{types:[`property-access`],style:{color:`#7daea3`}},{types:[`tag`],style:{color:`#e78a4e`}},{types:[`attr-name`,`char`,`url`,`regex`],style:{color:`#a9b665`}},{types:[`attr-value`,`string`],style:{color:`#89b482`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#ea6962`}},{types:[`entity`,`number`,`symbol`],style:{color:`#d3869b`}}]},Za={plain:{color:`#654735`,backgroundColor:`#f9f5d7`},styles:[{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#af2528`}},{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`],style:{color:`#b4730e`}},{types:[`string`,`attr-value`],style:{color:`#477a5b`}},{types:[`property-access`],style:{color:`#266b79`}},{types:[`function`,`attr-name`,`char`,`url`],style:{color:`#72761e`}},{types:[`tag`],style:{color:`#b94c07`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`entity`,`number`,`symbol`],style:{color:`#924f79`}}]},Qa=e=>(0,v.useCallback)(t=>{var n=t,{className:r,style:i,line:a}=n;let o=Ta(wa({},Ea(n,[`className`,`style`,`line`])),{className:fa(`token-line`,r)});return typeof e==`object`&&`plain`in e&&(o.style=e.plain),typeof i==`object`&&(o.style=wa(wa({},o.style||{}),i)),o},[e]),$a=e=>{let t=(0,v.useCallback)(({types:t,empty:n})=>{if(e!=null)return t.length===1&&t[0]===`plain`?n==null?void 0:{display:`inline-block`}:t.length===1&&n!=null?e[t[0]]:Object.assign(n==null?{}:{display:`inline-block`},...t.map(t=>e[t]))},[e]);return(0,v.useCallback)(e=>{var n=e,{token:r,className:i,style:a}=n;let o=Ta(wa({},Ea(n,[`token`,`className`,`style`])),{className:fa(`token`,...r.types,i),children:r.content,style:t(r)});return a!=null&&(o.style=wa(wa({},o.style||{}),a)),o},[t])},eo=/\r\n|\r|\n/,to=e=>{e.length===0?e.push({types:[`plain`],content:`
|
|
25
25
|
`,empty:!0}):e.length===1&&e[0].content===``&&(e[0].content=`
|
|
26
26
|
`,e[0].empty=!0)},no=(e,t)=>{let n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},ro=e=>{let t=[[]],n=[e],r=[0],i=[e.length],a=0,o=0,s=[],c=[s];for(;o>-1;){for(;(a=r[o]++)<i[o];){let e,l=t[o],u=n[o][a];if(typeof u==`string`?(l=o>0?l:[`plain`],e=u):(l=no(l,u.type),u.alias&&(l=no(l,u.alias)),e=u.content),typeof e!=`string`){o++,t.push(l),n.push(e),r.push(0),i.push(e.length);continue}let d=e.split(eo),f=d.length;s.push({types:l,content:d[0]});for(let e=1;e<f;e++)to(s),c.push(s=[]),s.push({types:l,content:d[e]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return to(s),c},io=({prism:e,code:t,grammar:n,language:r})=>(0,v.useMemo)(()=>{if(n==null)return ro([t]);let i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run(`before-tokenize`,i),i.tokens=e.tokenize(t,n),e.hooks.run(`after-tokenize`,i),ro(i.tokens)},[t,n,r,e]),ao=(e,t)=>{let{plain:n}=e,r=e.styles.reduce((e,n)=>{let{languages:r,style:i}=n;return r&&!r.includes(t)||n.types.forEach(t=>{e[t]=wa(wa({},e[t]),i)}),e},{});return r.root=n,r.plain=Ta(wa({},n),{backgroundColor:void 0}),r},oo=({children:e,language:t,code:n,theme:r,prism:i})=>{let a=t.toLowerCase(),o=ao(r,a),s=Qa(o),c=$a(o),l=i.languages[a];return e({tokens:io({prism:i,language:a,code:n,grammar:l}),className:`prism-code language-${a}`,style:o==null?{}:o.root,getLineProps:s,getTokenProps:c})},so=e=>(0,v.createElement)(oo,Ta(wa({},e),{prism:e.prism||z,theme:e.theme||Wa,code:e.code,language:e.language}));function co(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function lo(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var uo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fo=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,po={};function mo(e,t){return((t||po).jsx?fo:uo).test(e)}var ho=/[ \t\n\f\r]/g;function go(e){return typeof e==`object`?e.type===`text`?_o(e.value):!1:_o(e)}function _o(e){return e.replace(ho,``)===``}var vo=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};vo.prototype.normal={},vo.prototype.property={},vo.prototype.space=void 0;function yo(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vo(n,r,t)}function bo(e){return e.toLowerCase()}var xo=class{constructor(e,t){this.attribute=t,this.property=e}};xo.prototype.attribute=``,xo.prototype.booleanish=!1,xo.prototype.boolean=!1,xo.prototype.commaOrSpaceSeparated=!1,xo.prototype.commaSeparated=!1,xo.prototype.defined=!1,xo.prototype.mustUseProperty=!1,xo.prototype.number=!1,xo.prototype.overloadedBoolean=!1,xo.prototype.property=``,xo.prototype.spaceSeparated=!1,xo.prototype.space=void 0;var So=s({boolean:()=>wo,booleanish:()=>To,commaOrSpaceSeparated:()=>ko,commaSeparated:()=>Oo,number:()=>B,overloadedBoolean:()=>Eo,spaceSeparated:()=>Do}),Co=0,wo=Ao(),To=Ao(),Eo=Ao(),B=Ao(),Do=Ao(),Oo=Ao(),ko=Ao();function Ao(){return 2**++Co}var jo=Object.keys(So),Mo=class extends xo{constructor(e,t,n,r){let i=-1;if(super(e,t),No(this,`space`,r),typeof n==`number`)for(;++i<jo.length;){let e=jo[i];No(this,jo[i],(n&So[e])===So[e])}}};Mo.prototype.defined=!0;function No(e,t,n){n&&(e[t]=n)}function Po(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Mo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[bo(r)]=r,n[bo(a.attribute)]=r}return new vo(t,n,e.space)}var Fo=Po({properties:{ariaActiveDescendant:null,ariaAtomic:To,ariaAutoComplete:null,ariaBusy:To,ariaChecked:To,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:Do,ariaCurrent:null,ariaDescribedBy:Do,ariaDetails:null,ariaDisabled:To,ariaDropEffect:Do,ariaErrorMessage:null,ariaExpanded:To,ariaFlowTo:Do,ariaGrabbed:To,ariaHasPopup:null,ariaHidden:To,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Do,ariaLevel:B,ariaLive:null,ariaModal:To,ariaMultiLine:To,ariaMultiSelectable:To,ariaOrientation:null,ariaOwns:Do,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:To,ariaReadOnly:To,ariaRelevant:null,ariaRequired:To,ariaRoleDescription:Do,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:To,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Io(e,t){return t in e?e[t]:t}function Lo(e,t){return Io(e,t.toLowerCase())}var Ro=Po({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Oo,acceptCharset:Do,accessKey:Do,action:null,allow:null,allowFullScreen:wo,allowPaymentRequest:wo,allowUserMedia:wo,alpha:wo,alt:null,as:null,async:wo,autoCapitalize:null,autoComplete:Do,autoFocus:wo,autoPlay:wo,blocking:Do,capture:null,charSet:null,checked:wo,cite:null,className:Do,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:To,controls:wo,controlsList:Do,coords:B|Oo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wo,defer:wo,dir:null,dirName:null,disabled:wo,download:Eo,draggable:To,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wo,formTarget:null,headers:Do,height:B,hidden:Eo,high:B,href:null,hrefLang:null,htmlFor:Do,httpEquiv:Do,id:null,imageSizes:null,imageSrcSet:null,inert:wo,inputMode:null,integrity:null,is:null,isMap:wo,itemId:null,itemProp:Do,itemRef:Do,itemScope:wo,itemType:Do,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wo,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:wo,muted:wo,name:null,nonce:null,noModule:wo,noValidate:wo,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:wo,optimum:B,pattern:null,ping:Do,placeholder:null,playsInline:wo,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wo,referrerPolicy:null,rel:Do,required:wo,reversed:wo,rows:B,rowSpan:B,sandbox:Do,scope:null,scoped:wo,seamless:wo,selected:wo,shadowRootClonable:wo,shadowRootCustomElementRegistry:wo,shadowRootDelegatesFocus:wo,shadowRootMode:null,shadowRootSerializable:wo,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:To,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:wo,useMap:null,value:To,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Do,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wo,declare:wo,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:wo,noHref:wo,noShade:wo,noWrap:wo,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:To,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:wo,disablePictureInPicture:wo,disableRemotePlayback:wo,exportParts:Oo,part:Do,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:Lo}),zo=Po({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`,maskType:`mask-type`,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:ko,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:Do,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:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:wo,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,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:Oo,g2:Oo,glyphName:Oo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:ko,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,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:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Do,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ko,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ko,rev:ko,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ko,requiredFeatures:ko,requiredFonts:ko,requiredFormats:ko,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:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:ko,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ko,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ko,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Io}),Bo=Po({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Vo=Po({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Lo}),Ho=Po({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Uo={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`},Wo=/[A-Z]/g,Go=/-[a-z]/g,Ko=/^data[-\w.:]+$/i;function qo(e,t){let n=bo(t),r=t,i=xo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ko.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Go,Yo);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Go.test(e)){let n=e.replace(Wo,Jo);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Mo}return new i(r,t)}function Jo(e){return`-`+e.toLowerCase()}function Yo(e){return e.charAt(1).toUpperCase()}var Xo=yo([Fo,Ro,Bo,Vo,Ho],`html`),Zo=yo([Fo,zo,Bo,Vo,Ho],`svg`);function Qo(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function $o(e){return e.join(` `).trim()}var es=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`/`,d=`*`,f=``;function p(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,p=1;function h(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
27
27
|
`);p=~n?e.length-n:p+e.length}function g(){var e={line:l,column:p};return function(t){return t.position=new _(e),b(),t}}function _(e){this.start=e,this.end={line:l,column:p},this.source=t.source}_.prototype.content=e;function v(n){var r=Error(t.source+`:`+l+`:`+p+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=p,r.source=e,!t.silent)throw r}function y(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function b(){y(i)}function x(e){var t;for(e||=[];t=S();)t!==!1&&e.push(t);return e}function S(){var t=g();if(!(u!=e.charAt(0)||d!=e.charAt(1))){for(var n=2;f!=e.charAt(n)&&(d!=e.charAt(n)||u!=e.charAt(n+1));)++n;if(n+=2,f===e.charAt(n-1))return v(`End of comment missing`);var r=e.slice(2,n-2);return p+=2,h(r),e=e.slice(n),p+=2,t({type:`comment`,comment:r})}}function C(){var e=g(),t=y(a);if(t){if(S(),!y(o))return v(`property missing ':'`);var r=y(s),i=e({type:`declaration`,property:m(t[0].replace(n,f)),value:r?m(r[0].replace(n,f)):f});return y(c),i}}function w(){var e=[];x(e);for(var t;t=C();)t!==!1&&(e.push(t),x(e));return e}return b(),w()}function m(e){return e?e.replace(l,f):f}t.exports=p})),ts=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(es());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),ns=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),rs=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ts()),r=ns();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),is=os(`end`),as=os(`start`);function os(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function ss(e){let t=as(e),n=is(e);if(t&&n)return{start:t,end:n}}function cs(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?us(e.position):`start`in e||`end`in e?us(e):`line`in e||`column`in e?ls(e):``}function ls(e){return ds(e&&e.line)+`:`+ds(e&&e.column)}function us(e){return ls(e&&e.start)+`-`+ls(e&&e.end)}function ds(e){return e&&typeof e==`number`?e:1}var fs=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=cs(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};fs.prototype.file=``,fs.prototype.name=``,fs.prototype.reason=``,fs.prototype.message=``,fs.prototype.stack=``,fs.prototype.column=void 0,fs.prototype.line=void 0,fs.prototype.ancestors=void 0,fs.prototype.cause=void 0,fs.prototype.fatal=void 0,fs.prototype.place=void 0,fs.prototype.ruleId=void 0,fs.prototype.source=void 0;var ps=l(rs(),1),ms={}.hasOwnProperty,hs=new Map,gs=/[A-Z]/g,_s=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),vs=new Set([`td`,`th`]);function ys(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=As(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ks(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Zo:Xo,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bs(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bs(e,t,n){if(t.type===`element`)return xs(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ss(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ws(e,t,n);if(t.type===`mdxjsEsm`)return Cs(e,t);if(t.type===`root`)return Ts(e,t,n);if(t.type===`text`)return Es(e,t)}function xs(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Zo,e.schema=i),e.ancestors.push(t);let a=Is(e,t.tagName,!1),o=js(e,t),s=Ns(e,t);return _s.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!go(e):!0})),Ds(e,o,a,t),Os(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ss(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ls(e,t.position)}function Cs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ls(e,t.position)}function ws(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Zo,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Is(e,t.name,!0),o=Ms(e,t),s=Ns(e,t);return Ds(e,o,a,t),Os(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ts(e,t,n){let r={};return Os(r,Ns(e,t)),e.create(t,e.Fragment,r,n)}function Es(e,t){return t.value}function Ds(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Os(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ks(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function As(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=as(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function js(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&ms.call(t.properties,i)){let a=Ps(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&vs.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ms(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ls(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ls(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Ns(e,t){let n=[],r=-1,i=e.passKeys?new Map:hs;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=bs(e,a,o);s!==void 0&&n.push(s)}return n}function Ps(e,t,n){let r=qo(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?lo(n):$o(n)),r.property===`style`){let t=typeof n==`object`?n:Fs(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Rs(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Uo[r.property]||r.property:r.attribute,n]}}function Fs(e,t){try{return(0,ps.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fs("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Is(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=mo(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=mo(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return ms.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ls(e)}function Ls(e,t){let n=new fs("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Rs(e){let t={},n;for(n in e)ms.call(e,n)&&(t[zs(n)]=e[n]);return t}function zs(e){let t=e.replace(gs,Bs);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Bs(e){return`-`+e.toLowerCase()}var Vs={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`]},Hs={};function Us(e,t){let n=t||Hs;return Ws(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Ws(e,t,n){if(Ks(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Gs(e.children,t,n)}return Array.isArray(e)?Gs(e,t,n):``}function Gs(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ws(e[i],t,n);return r.join(``)}function Ks(e){return!!(e&&typeof e==`object`)}function qs(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Js(e,t){return e.length>0?(qs(e,e.length,0,t),e):t}var Ys={}.hasOwnProperty;function Xs(e){let t={},n=-1;for(;++n<e.length;)Zs(t,e[n]);return t}function Zs(e,t){let n;for(n in t){let r=(Ys.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ys.call(r,a)||(r[a]=[]);let e=i[a];Qs(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Qs(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);qs(e,0,0,r)}var $s=uc(/[A-Za-z]/),ec=uc(/[\dA-Za-z]/),tc=uc(/[#-'*+\--9=?A-Z^-~]/);function nc(e){return e!==null&&(e<32||e===127)}var rc=uc(/\d/),ic=uc(/[\dA-Fa-f]/),ac=uc(/[!-/:-@[-`{-~]/);function V(e){return e!==null&&e<-2}function oc(e){return e!==null&&(e<0||e===32)}function sc(e){return e===-2||e===-1||e===32}var cc=uc(/\p{P}|\p{S}/u),lc=uc(/\s/);function uc(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function dc(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return sc(r)?(e.enter(n),s(r)):t(r)}function s(r){return sc(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var fc={tokenize:pc};function pc(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),dc(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return V(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var mc={tokenize:gc},hc={tokenize:_c};function gc(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return qs(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hc,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(hc,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return V(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;qs(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function _c(e,t,n){return dc(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function vc(e){if(e===null||oc(e)||lc(e))return 1;if(cc(e))return 2}function yc(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var bc={name:`attention`,resolveAll:xc,tokenize:Sc};function xc(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Cc(d,-c),Cc(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Js(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Js(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Js(l,yc(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Js(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Js(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,qs(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Sc(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vc(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=vc(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Cc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var wc={name:`autolink`,tokenize:Tc};function Tc(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return $s(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||ec(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||ec(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||nc(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):tc(t)?(e.consume(t),l):n(t)}function u(e){return ec(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||ec(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ec={partial:!0,tokenize:Dc};function Dc(e,t,n){return r;function r(t){return sc(t)?dc(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||V(e)?t(e):n(e)}}var Oc={continuation:{tokenize:Ac},exit:jc,name:`blockQuote`,tokenize:kc};function kc(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return sc(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ac(e,t,n){let r=this;return i;function i(t){return sc(t)?dc(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Oc,t,n)(r)}}function jc(e){e.exit(`blockQuote`)}var Mc={name:`characterEscape`,tokenize:Nc};function Nc(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return ac(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Pc=document.createElement(`i`);function Fc(e){let t=`&`+e+`;`;Pc.innerHTML=t;let n=Pc.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}var Ic={name:`characterReference`,tokenize:Lc};function Lc(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=ec,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=ic,u):(e.enter(`characterReferenceValue`),a=7,o=rc,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===ec&&!Fc(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Rc={partial:!0,tokenize:Vc},zc={concrete:!0,name:`codeFenced`,tokenize:Bc};function Bc(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),sc(t)?dc(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||V(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Rc,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||V(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):sc(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),dc(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||V(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||V(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&sc(t)?dc(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||V(t)?e.check(Rc,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||V(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),sc(t)?dc(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),sc(t)?dc(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||V(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Vc(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Hc={name:`codeIndented`,tokenize:Wc},Uc={partial:!0,tokenize:Gc};function Wc(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),dc(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):V(t)?e.attempt(Uc,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||V(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Gc(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):V(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):dc(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):V(e)?i(e):n(e)}}var Kc={name:`codeText`,previous:Jc,resolve:qc,tokenize:Yc};function qc(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Jc(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Yc(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):V(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||V(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Xc=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Zc(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Zc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Zc(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Zc(this.left,t.reverse())}}};function Zc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Qc(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Xc(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,$c(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return qs(e,0,1/0,u.slice(0)),!l}function $c(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var el={resolve:nl,tokenize:rl},tl={partial:!0,tokenize:il};function nl(e){return Qc(e),e}function rl(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):V(t)?e.check(tl,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function il(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),dc(e,a,`linePrefix`)}function a(i){if(i===null||V(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function al(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||nc(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||V(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||oc(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||nc(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function ol(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):V(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||V(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!sc(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function sl(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):V(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),dc(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||V(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function cl(e,t){let n;return r;function r(i){return V(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):sc(i)?dc(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}function ll(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var ul={name:`definition`,tokenize:fl},dl={partial:!0,tokenize:pl};function fl(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ol.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=ll(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return oc(t)?cl(e,l)(t):l(t)}function l(t){return al(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(dl,d,d)(t)}function d(t){return sc(t)?dc(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||V(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function pl(e,t,n){return r;function r(t){return oc(t)?cl(e,i)(t):n(t)}function i(t){return sl(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return sc(t)?dc(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||V(e)?t(e):n(e)}}var ml={name:`hardBreakEscape`,tokenize:hl};function hl(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return V(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var gl={name:`headingAtx`,resolve:_l,tokenize:vl};function _l(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},qs(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function vl(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||oc(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||V(n)?(e.exit(`atxHeading`),t(n)):sc(n)?dc(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||oc(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var yl=`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`.split(`.`),bl=[`pre`,`script`,`style`,`textarea`],xl={concrete:!0,name:`htmlFlow`,resolveTo:wl,tokenize:Tl},Sl={partial:!0,tokenize:Dl},Cl={partial:!0,tokenize:El};function wl(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Tl(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:A):$s(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):$s(a)?(e.consume(a),i=4,r.interrupt?t:A):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:A):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return $s(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||oc(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&bl.includes(l)?(i=1,r.interrupt?t(s):O(s)):yl.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||ec(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return sc(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||$s(t)?(e.consume(t),b):sc(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||ec(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):sc(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):sc(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||V(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||oc(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||sc(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||V(t)?O(t):sc(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),re):t===62&&i===4?(e.consume(t),j):t===63&&i===3?(e.consume(t),A):t===93&&i===5?(e.consume(t),ae):V(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Sl,M,k)(t)):t===null||V(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Cl,ee,M)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||V(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),A):O(t)}function re(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return bl.includes(n)?(e.consume(t),j):O(t)}return $s(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),A):O(t)}function A(t){return t===62?(e.consume(t),j):t===45&&i===2?(e.consume(t),A):O(t)}function j(t){return t===null||V(t)?(e.exit(`htmlFlowData`),M(t)):(e.consume(t),j)}function M(n){return e.exit(`htmlFlow`),t(n)}}function El(e,t,n){let r=this;return i;function i(t){return V(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Dl(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ec,t,n)}}var Ol={name:`htmlText`,tokenize:kl};function kl(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):$s(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):$s(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):V(t)?(o=d,re(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):V(t)?(o=h,re(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):V(t)?(o=v,re(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):V(t)?(o=y,re(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return $s(t)?(e.consume(t),S):n(t)}function S(t){return t===45||ec(t)?(e.consume(t),S):C(t)}function C(t){return V(t)?(o=C,re(t)):sc(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||ec(t)?(e.consume(t),w):t===47||t===62||oc(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||$s(t)?(e.consume(t),E):V(t)?(o=T,re(t)):sc(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||ec(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):V(t)?(o=D,re(t)):sc(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):V(t)?(o=O,re(t)):sc(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):V(t)?(o=k,re(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||oc(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||oc(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function re(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return sc(t)?dc(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var Al={name:`labelEnd`,resolveAll:Pl,resolveTo:Fl,tokenize:Il},jl={tokenize:Ll},Ml={tokenize:Rl},Nl={tokenize:zl};function Pl(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&qs(e,0,e.length,n),e}function Fl(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Js(s,e.slice(a+1,a+r+3)),s=Js(s,[[`enter`,u,t]]),s=Js(s,yc(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Js(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Js(s,e.slice(o+1)),s=Js(s,[[`exit`,c,t]]),qs(e,a,e.length,s),e}function Il(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(ll(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(jl,u,o?u:d)(t):t===91?e.attempt(Ml,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Nl,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Ll(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return oc(t)?cl(e,a)(t):a(t)}function a(t){return t===41?u(t):al(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return oc(t)?cl(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?sl(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return oc(t)?cl(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Rl(e,t,n){let r=this;return i;function i(t){return ol.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(ll(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function zl(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Bl={name:`labelStartImage`,resolveAll:Al.resolveAll,tokenize:Vl};function Vl(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Hl={name:`labelStartLink`,resolveAll:Al.resolveAll,tokenize:Ul};function Ul(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Wl={name:`lineEnding`,tokenize:Gl};function Gl(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),dc(e,t,`linePrefix`)}}var Kl={name:`thematicBreak`,tokenize:ql};function ql(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||V(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),sc(t)?dc(e,s,`whitespace`)(t):s(t))}}var Jl={continuation:{tokenize:Ql},exit:eu,name:`list`,tokenize:Zl},Yl={partial:!0,tokenize:tu},Xl={partial:!0,tokenize:$l};function Zl(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:rc(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Kl,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return rc(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ec,r.interrupt?n:u,e.attempt(Yl,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return sc(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Ql(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ec,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dc(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!sc(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Xl,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,dc(e,e.attempt(Jl,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function $l(e,t,n){let r=this;return dc(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function eu(e){e.exit(this.containerState.type)}function tu(e,t,n){let r=this;return dc(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!sc(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var nu={name:`setextUnderline`,resolveTo:ru,tokenize:iu};function ru(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function iu(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),sc(t)?dc(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||V(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var au={tokenize:ou};function ou(e){let t=this,n=e.attempt(Ec,r,e.attempt(this.parser.constructs.flowInitial,i,dc(e,e.attempt(this.parser.constructs.flow,i,e.attempt(el,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var su={resolveAll:du()},cu=uu(`string`),lu=uu(`text`);function uu(e){return{resolveAll:du(e===`text`?fu:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function du(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function fu(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var pu=s({attentionMarkers:()=>xu,contentInitial:()=>hu,disable:()=>Su,document:()=>mu,flow:()=>_u,flowInitial:()=>gu,insideSpan:()=>bu,string:()=>vu,text:()=>yu}),mu={42:Jl,43:Jl,45:Jl,48:Jl,49:Jl,50:Jl,51:Jl,52:Jl,53:Jl,54:Jl,55:Jl,56:Jl,57:Jl,62:Oc},hu={91:ul},gu={[-2]:Hc,[-1]:Hc,32:Hc},_u={35:gl,42:Kl,45:[nu,Kl],60:xl,61:nu,95:Kl,96:zc,126:zc},vu={38:Ic,92:Mc},yu={[-5]:Wl,[-4]:Wl,[-3]:Wl,33:Bl,38:Ic,42:bc,60:[wc,Ol],91:Hl,92:[ml,Mc],93:Al,95:bc,96:Kc},bu={null:[bc,su]},xu={null:[42,95]},Su={null:[]};function Cu(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Js(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=yc(a,l.events,l),l.events):[]}function f(e,t){return Tu(p(e),t)}function p(e){return wu(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){V(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&qs(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function wu(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Tu(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
@@ -355,15 +355,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
355
355
|
`),xe=be?d.slice(1).split(/\s/)[0]??``:``,[Se,Ce]=(0,v.useState)([]);(0,v.useEffect)(()=>{if(D===void 0){Ce([]);return}let e=!1;return L.listPrompts(D.id).then(t=>{e||Ce(t.prompts.filter(e=>e.effective).map(e=>{let t={name:e.name,description:e.description};return e.argumentHint!==void 0&&(t.argumentHint=e.argumentHint),t}))}).catch(()=>{e||Ce([])}),()=>{e=!0}},[D?.id,me]);let we=kA(e=>e.pendingInsert),Te=kA(e=>e.consumePendingInsert);(0,v.useEffect)(()=>{we!==void 0&&we.sessionId===e&&(f(e=>e.length===0?we.text:e+(e.endsWith(`
|
|
356
356
|
`)?``:`
|
|
357
357
|
|
|
358
|
-
`)+we.text),Te(),setTimeout(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},0))},[we,e,Te]);let Ee=(()=>{if(!t&&!r){if(d.startsWith(`!!`))return`local`;if(d.startsWith(`!`))return`context`}})(),De=(0,v.useMemo)(()=>{let n=[{name:`/compact`,description:`Manually compact the session context`,available:!t,run:async()=>{try{await L.compact(e),c(e)}catch(e){qe(`Compact failed: ${e instanceof N?e.code:e.message}`)}}},{name:`/clear`,description:`Compact context (alias for /compact)`,available:!t,run:async()=>{try{await L.compact(e),c(e)}catch(e){qe(`Clear failed: ${e instanceof N?e.code:e.message}`)}}},{name:`/abort`,description:`Stop the agent (alias for the Abort button)`,available:t,run:()=>l(e)},{name:`/settings`,description:`Open the Settings panel`,available:!0,run:()=>de()},{name:`/skills`,description:`Open Settings → Skills`,available:!0,run:()=>de(`skills`)},{name:`/mcp`,description:`Open Settings → MCP`,available:!0,run:()=>de(`mcp`)},{name:`/providers`,description:`Open Settings → Providers`,available:!0,run:()=>de(`providers`)},{name:`/help`,description:r?"Show what `/` and `@` do in the input":"Show what `/`, `!`, `@` do in the input",available:!0,run:()=>{qe(r?`/<cmd> runs a pi-forge command (compact, abort, settings, …). @<path> references a project file (autocomplete from the popover).`:`/<cmd> runs a pi-forge command (compact, abort, settings, …). !cmd runs bash (output → next LLM context); !!cmd runs bash local-only. @<path> references a project file (autocomplete from the popover).`)}}];for(let e of Se){let r=e.argumentHint===void 0?e.description:`${e.description} — args: ${e.argumentHint}`;n.push({name:`/${e.name}`,description:r,available:!t,run:()=>{let t=`/${e.name} `;f(t),requestAnimationFrame(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(t.length,t.length))})}})}return n},[t,e,l,c,de,r,Se]),Oe=(0,v.useMemo)(()=>{let e=xe.toLowerCase();return e.length===0?De:De.filter(t=>t.name.slice(1).toLowerCase().startsWith(e))},[De,xe]),ke=(0,v.useMemo)(()=>{if(!be)return!1;let e=d.slice(1).split(/\s/)[0]??``;return e.length===0||!Se.some(t=>t.name===e)?!1:d===`/${e}`||d.startsWith(`/${e} `)},[be,d,Se]),Ae=e=>{let t=Oe[e??ge];t===void 0||!t.available||(f(``),_e(0),t.run())},je=(0,v.useRef)(0),[Me,Ne]=(0,v.useState)([]),Pe=(0,v.useRef)(new Map),Fe=(0,v.useRef)(null),Ie=(0,v.useRef)(null),[ze,Be]=(0,v.useState)(!1),Ve=(0,v.useRef)(null),[He,Ue]=(0,v.useState)(void 0),We=new Set(`doc.xls.ppt.pptx.vsd.vsdx.odt.ods.odp.rtf.zip.tar.gz.bz2.xz.7z.rar.exe.dll.so.dylib.bin.o.a.class.jar.wasm.mp3.mp4.m4a.wav.flac.ogg.avi.mov.wmv.mkv.heic.heif.tiff.tif.bmp.ico.psd.ttf.otf.woff.woff2.eot.sqlite.db.iso.dmg`.split(`.`)),[Ke,qe]=(0,v.useState)(void 0),Je=e=>{qe(void 0);let t=Me,n=[...t],r=t.filter(e=>e.type.startsWith(`image/`)).length;for(let t of e){if(n.length>=8){qe(`Up to 8 attachments per message; "${t.name}" dropped.`);continue}if(t.size>20971520){qe(`"${t.name}" exceeds the 20 MB per-file limit.`);continue}if(t.type.startsWith(`image/`)&&r>=4){qe(`Up to 4 images per message; "${t.name}" dropped.`);continue}let e=t.name.includes(`.`)?t.name.split(`.`).pop()?.toLowerCase():void 0;if(e!==void 0&&We.has(e)){qe(`"${t.name}" is a binary format that the agent can't read directly. Convert to text/markdown (or to a PNG/JPEG screenshot for diagrams) and try again.`);continue}n.push(t),t.type.startsWith(`image/`)&&(r+=1,Pe.current.set(t,URL.createObjectURL(t)))}Ne(n)},Xe=e=>{let t=Pe.current.get(e);t!==void 0&&(URL.revokeObjectURL(t),Pe.current.delete(e)),Ne(t=>t.filter(t=>t!==e))},Ze=()=>{for(let e of Pe.current.values())URL.revokeObjectURL(e);Pe.current.clear(),Ne([]),qe(void 0)},Qe=e=>{let r=$j(e.clipboardData);if(r.length!==0){if(n){qe(`This pi-subagents child is running externally and is read-only.`);return}if(t){qe(`Images pasted while streaming aren't attached. Wait for the current run to finish.`);return}Je(r)}};(0,v.useEffect)(()=>{let e=Pe.current;return()=>{for(let t of e.values())URL.revokeObjectURL(t);e.clear()}},[]);let $e=pi(t=>t.messagesBySession[e]??ni),[et,tt]=(0,v.useState)(0),nt=(0,v.useMemo)(()=>{let t=pM(e),n=hM($e),r=new Set,i=[];for(let e of[...t,...n])r.has(e)||(r.add(e),i.push(e));return i},[$e,e,et]),[rt,it]=(0,v.useState)(void 0),ot=(0,v.useRef)(``);(0,v.useEffect)(()=>{it(void 0),ot.current=``},[e]),(0,v.useEffect)(()=>{je.current=0},[e]);let st=gM+e,[lt,ut]=(0,v.useState)(void 0),[dt,ft]=(0,v.useState)(void 0),[pt,mt]=(0,v.useState)(()=>localStorage.getItem(gM+e)??``),[ht,gt]=(0,v.useState)(void 0),[_t,vt]=(0,v.useState)(void 0),[yt,bt]=(0,v.useState)(void 0),[xt,St]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{L.getProviders().then(ut).catch(e=>{gt(`models unavailable (${e instanceof N?e.code:e.message})`)}),L.getSettings().then(e=>{ft({provider:typeof e.defaultProvider==`string`?e.defaultProvider:``,modelId:typeof e.defaultModel==`string`?e.defaultModel:``})}).catch(()=>{})},[]),(0,v.useEffect)(()=>{let t=localStorage.getItem(gM+e)??``;mt(t),gt(void 0),bt(void 0),vt(void 0),St(void 0);{let t=e;L.getSession(t).then(n=>{t===e&&(vt(n.thinkingLevel),n.modelProvider!==void 0&&n.modelId!==void 0&&St({provider:n.modelProvider,modelId:n.modelId}))}).catch(()=>{})}if(t===``)return;let[n,...r]=t.split(`:`),i=r.join(`:`);if(n===void 0||i.length===0)return;let a=e;L.setModel(a,n,i).catch(t=>{a===e&>(`set model failed: ${t instanceof N?t.code:t.message}`)})},[e]);let Ct=pi(t=>t.pendingDraftBySession[e]),wt=pi(e=>e.consumePendingDraft);(0,v.useEffect)(()=>{Ct!==void 0&&(f(Ct),wt(e))},[Ct,e,wt]),(0,v.useEffect)(()=>{if(fe===void 0||fe.seq<=he.current)return;he.current=fe.seq;let e=fe.text;f(t=>t.length===0?e:`${t}${/\s$/.test(t)?``:` `}${e}`),requestAnimationFrame(()=>{let e=O.current;if(e===null)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)}),pe()},[fe,pe]);let Tt=async t=>{if(mt(t),t===``){localStorage.removeItem(st);return}let[n,...r]=t.split(`:`),i=r.join(`:`);if(!(n===void 0||i.length===0))try{await L.setModel(e,n,i),localStorage.setItem(st,t),gt(void 0);let r=e;L.getSession(r).then(t=>{r===e&&(vt(t.thinkingLevel),t.modelProvider!==void 0&&t.modelId!==void 0&&St({provider:t.modelProvider,modelId:t.modelId}))}).catch(()=>{})}catch(e){gt(`set model failed: ${e instanceof N?e.code:e.message}`)}},Et=(0,v.useMemo)(()=>{if(lt===void 0)return;let e,t;if(pt.length>0){let[n,...r]=pt.split(`:`);if(n===void 0)return;e=n,t=r.join(`:`)}else if(xt!==void 0)e=xt.provider,t=xt.modelId;else return;return lt.providers.find(t=>t.provider===e)?.models.find(e=>e.id===t)},[lt,pt,xt]),Dt=async t=>{vt(t);try{vt((await L.setThinkingLevel(e,t)).level),bt(void 0)}catch(e){bt(`set thinking level failed: ${e instanceof N?e.code:e.message}`)}},Ot=async()=>{let i=d,a=i.trim();if(n){qe(`This pi-subagents child is running externally and is read-only.`);return}if(!(a.length===0&&Me.length===0||p)){if(a.length>0&&(mM(e,a),tt(e=>e+1)),be&&!ke){Oe.length>0?Ae():qe(`Unknown command "${d.split(/\s/)[0]??d}". Type /help to see commands.`);return}m(!0);try{if(!t&&/^!!?[^!]/.test(a)){if(r){qe(`Bash exec is disabled in this deployment.`);return}let t=a.startsWith(`!!`),n=a.slice(t?2:1).trim();if(n.length===0){qe("Empty bash command. Type something after the `!`.");return}Me.length>0&&(Ze(),qe("Attachments aren't sent with `!` exec. Cleared.")),await L.exec(e,n,{excludeFromContext:t}),c(e),f(``),it(void 0),ot.current=``;return}t?(Me.length>0&&(Ze(),qe(`Attachments aren't sent on steer (mid-turn). Cleared.`)),await s(e,i)):await o(e,i,Me.length>0?Me:void 0),f(``),Ze(),it(void 0),ot.current=``,k&&O.current?.blur()}catch(e){qe(`Command failed: ${e instanceof N?e.code:e.message}`)}finally{m(!1)}}},kt=n=>{if(be){if(n.key===`Escape`){n.preventDefault(),f(``);return}if(Oe.length>0){if(n.key===`ArrowDown`){n.preventDefault(),_e(e=>Math.min(e+1,Oe.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),_e(e=>Math.max(e-1,0));return}if((n.key===`Enter`||n.key===`Tab`)&&!(ke&&n.key===`Enter`)){n.preventDefault(),Ae();return}}else if(n.key===`Enter`&&!n.shiftKey){n.preventDefault(),qe(`Unknown command "${d.split(/\s/)[0]??d}". Type /help to see commands, or backspace the leading / to send as a prompt.`);return}}if(j!==void 0&&oe.length>0){if(n.key===`ArrowDown`){n.preventDefault(),le(e=>Math.min(e+1,oe.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),le(e=>Math.max(e-1,0));return}if(n.key===`Enter`&&n.metaKey!==!0&&n.ctrlKey!==!0||n.key===`Tab`){let e=oe[ce];if(e!==void 0){n.preventDefault(),Mt(e);return}}if(n.key===`Escape`){n.preventDefault(),Nt();return}}if(eM(n,{isMobile:k})){n.preventDefault(),Ot();return}if(n.key===`ArrowUp`){let e=rt!==void 0;if(e||d.length===0){if(nt.length===0)return;n.preventDefault();let t=e?Math.min((rt??0)+1,nt.length-1):0;e||(ot.current=d),it(t);let r=nt[t];r!==void 0&&f(r)}return}if(n.key===`ArrowDown`){if(rt===void 0)return;if(n.preventDefault(),rt>0){let e=rt-1;it(e);let t=nt[e];t!==void 0&&f(t)}else it(void 0),f(ot.current),ot.current=``;return}if(n.key===`Escape`){if(!t)return;n.preventDefault();let r=Date.now(),i=r-je.current;je.current=r,i<yM&&(je.current=0,l(e))}},At=e=>{f(e),rt!==void 0&&(it(void 0),ot.current=``);let t=jt(e,O.current?.selectionStart??e.length);M(t),t===void 0&&se([]),le(0)};function jt(e,t){let n=t-1;for(;n>=0;){let r=e[n];if(r===void 0)break;if(/\s/.test(r))return;if(r===`@`){let r=n===0?` `:e[n-1];return r===void 0||/\s/.test(r)?{start:n,end:t,query:e.slice(n+1,t)}:void 0}--n}}(0,v.useEffect)(()=>{if(j===void 0||D===void 0)return;let e=ue.current+1;ue.current=e;let t=window.setTimeout(()=>{L.completeFiles(D.id,j.query,{limit:20}).then(t=>{ue.current===e&&(se(t.paths),le(0))}).catch(()=>{ue.current===e&&se([])})},100);return()=>window.clearTimeout(t)},[j,D]);let Mt=e=>{if(j===void 0)return;let t=d.slice(0,j.start),n=d.slice(j.end),r=`@"${e}"`;f(`${t}${r}${n}`),M(void 0),se([]);let i=t.length+r.length;requestAnimationFrame(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(i,i))})},Nt=()=>{M(void 0),se([])},Pt=cM(d),Ft=e=>{let t=uM(e);f(e=>e.replace(t,(e,t)=>t).trimEnd())};return(0,v.useEffect)(()=>{if(!ze)return;let e=e=>{let t=Ve.current;t!==null&&(t.contains(e.target)||Be(!1))},t=e=>{e.key===`Escape`&&Be(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`touchstart`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`touchstart`,e),window.removeEventListener(`keydown`,t)}},[ze]),(0,v.useLayoutEffect)(()=>{let e=O.current;if(e===null)return;let t=e.style.height;e.style.height=`auto`;let n=e.scrollHeight;e.style.height=t;let r=k?void 0:re,i=k?44:r===void 0?80:60,a=Math.round(window.innerHeight*(k?.25:te)),o=Math.max(i,r??a),s=r===void 0?Math.max(i,Math.min(n,o)):o,c={height:s,maxHeight:o,overflowing:n>s};Ue(e=>e?.height===c.height&&e.maxHeight===c.maxHeight&&e.overflowing===c.overflowing?e:c)},[d,k,re]),(0,R.jsxs)(`div`,{className:`forge-chat-input-root bg-neutral-950`,children:[(0,R.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize chat input`,onPointerDown:ae,className:`group relative hidden h-px cursor-row-resize bg-neutral-800 hover:bg-neutral-600 active:bg-neutral-500 md:block`,children:(0,R.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-2`})}),(0,R.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-2 px-3 pt-2 md:px-6 md:py-3`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom))`},children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(xM,{providers:lt,defaultModel:dt,value:pt,onChange:e=>void Tt(e)}),Et!==void 0&&Et.supportedThinkingLevels.length>1&&_t!==void 0&&(0,R.jsx)(SM,{value:_t,options:Et.supportedThinkingLevels,onChange:e=>void Dt(e)}),Pt.length>0&&(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:Pt.map((e,t)=>(0,R.jsxs)(`span`,{className:`inline-flex max-w-[220px] items-center gap-1 truncate rounded border border-emerald-700/60 bg-emerald-900/20 px-1.5 py-0.5 text-[11px] text-emerald-200`,title:`@${e} — model will use its read tool to load this file when it needs to`,children:[(0,R.jsx)(ye,{size:11,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>Ft(e),className:`-mr-0.5 ml-0.5 rounded p-0.5 text-emerald-300/70 hover:bg-emerald-900/40 hover:text-emerald-100`,title:`Remove @${e}`,children:(0,R.jsx)(at,{size:10})})]},`ref-${t}-${e}`))}),(ht!==void 0||yt!==void 0||re!==void 0||h.total>0||y>0)&&(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[ht!==void 0&&(0,R.jsx)(`span`,{className:`text-[11px] text-red-400`,children:ht}),yt!==void 0&&(0,R.jsx)(`span`,{className:`text-[11px] text-red-400`,children:yt}),!k&&re!==void 0&&(0,R.jsx)(`button`,{type:`button`,onClick:A,className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Reset chat input height to default`,"aria-label":`Reset chat input height to default`,children:(0,R.jsx)(Ye,{size:12})}),y>0&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsxs)(`button`,{ref:T,type:`button`,onClick:()=>{k?S(e=>!e):b()},className:`flex items-center gap-1 rounded px-1.5 py-1 text-[11px] ${k&&x?`bg-neutral-800 text-neutral-100 light:bg-neutral-200 light:text-neutral-900`:`text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200 light:text-neutral-600 light:hover:bg-neutral-200 light:hover:text-neutral-900`}`,title:k?`${y} background process(es) running — show list`:`${y} background process(es) running — view processes panel`,"aria-label":k?`Show processes list`:`View processes panel`,"aria-expanded":k?x:void 0,children:[(0,R.jsx)(ve,{size:12,className:`text-emerald-400 light:text-emerald-700`}),(0,R.jsx)(`span`,{children:y})]}),k&&(0,R.jsx)(iM,{open:x,onClose:()=>S(!1),anchorRef:T,sessionId:e})]}),h.total>0&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsxs)(`button`,{ref:E,type:`button`,onClick:()=>{k?w(e=>!e):_(!g)},className:`flex items-center gap-1 rounded px-1.5 py-1 text-[11px] ${(k?C:g)?`bg-amber-900/40 text-amber-200 light:bg-amber-100 light:text-amber-900`:`text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200 light:text-neutral-600 light:hover:bg-neutral-200 light:hover:text-neutral-900`}`,title:k?`Tasks: ${h.completed}/${h.total} done${h.inProgress>0?`, ${h.inProgress} in progress`:``}`:g?`Hide todo panel`:`Show todo panel (${h.completed}/${h.total} done${h.inProgress>0?`, ${h.inProgress} in progress`:``})`,"aria-label":k?`Show tasks list`:`Toggle todo panel`,"aria-expanded":k?C:void 0,"aria-pressed":k?void 0:g,children:[(0,R.jsx)(Re,{size:12}),(0,R.jsxs)(`span`,{children:[h.completed,`/`,h.total]})]}),k&&(0,R.jsx)(sM,{open:C,onClose:()=>w(!1),anchorRef:E,sessionId:e})]})]})]}),u!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400`,children:[`Error: `,u]}),Ke!==void 0&&(0,R.jsx)(`p`,{className:`text-xs text-amber-400`,children:Ke}),Me.length>0&&(0,R.jsx)(CM,{attachments:Me,previewUrls:Pe.current,onRemove:Xe}),(0,R.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,R.jsx)(`input`,{ref:Fe,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files!==null&&Je(e.target.files),e.target.value=``}}),k&&(0,R.jsx)(`input`,{ref:Ie,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files!==null&&Je(e.target.files),e.target.value=``}}),k?(0,R.jsxs)(`div`,{className:`relative`,ref:Ve,children:[(0,R.jsx)(`button`,{onClick:()=>Be(e=>!e),disabled:p||t||n,"aria-label":`Attach`,"aria-expanded":ze,className:`inline-flex min-h-11 min-w-11 items-center justify-center self-stretch rounded-md border border-neutral-700 bg-neutral-900 px-2 text-neutral-300 hover:border-neutral-500 hover:text-neutral-100 disabled:cursor-not-allowed disabled:opacity-50`,title:t?`Attachments aren't sent on steer (mid-turn).`:`Attach a photo or a file`,children:(0,R.jsx)(Ge,{size:16})}),ze&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 z-20 mb-1 flex flex-col overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsxs)(`button`,{onClick:()=>{Ie.current?.click(),Be(!1)},className:`flex min-h-11 items-center gap-2 px-3 text-left text-[14px] text-neutral-200 hover:bg-neutral-800`,children:[(0,R.jsx)(Le,{size:16,className:`shrink-0 text-neutral-400`}),`Photo`]}),(0,R.jsxs)(`button`,{onClick:()=>{Fe.current?.click(),Be(!1)},className:`flex min-h-11 items-center gap-2 border-t border-neutral-800 px-3 text-left text-[14px] text-neutral-200 hover:bg-neutral-800`,children:[(0,R.jsx)(Ge,{size:16,className:`shrink-0 text-neutral-400`}),`File`]})]})]}):(0,R.jsx)(`button`,{onClick:()=>Fe.current?.click(),disabled:p||t||n,"aria-label":`Attach files`,className:`inline-flex items-center justify-center self-stretch rounded-md border border-neutral-700 bg-neutral-900 px-2 text-neutral-300 hover:border-neutral-500 hover:text-neutral-100 disabled:cursor-not-allowed disabled:opacity-50`,title:t?`Attachments aren't sent on steer (mid-turn). Wait for the current run to finish.`:`Attach files (images go into model context; text files are prepended to the prompt)`,children:(0,R.jsx)(Ge,{size:14})}),(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[be&&Oe.length>0&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 mb-1 overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto py-1 md:max-h-64`,children:Oe.map((e,t)=>(0,R.jsx)(`button`,{onMouseDown:n=>{n.preventDefault(),e.available&&(_e(t),Ae(t))},onMouseEnter:()=>_e(t),disabled:!e.available,className:`block w-full px-3 py-2.5 text-left text-[14px] md:py-1 md:text-[12px] ${t===ge&&e.available?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900/80`} ${e.available?``:`opacity-40`}`,title:e.available?e.description:`${e.description} — unavailable right now`,children:(0,R.jsxs)(`div`,{className:`flex flex-col md:block`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-200`,children:e.name}),(0,R.jsx)(`span`,{className:`text-[12px] text-neutral-500 md:ml-2 md:text-[10px]`,children:e.description})]})},e.name))}),(0,R.jsx)(`div`,{className:`hidden border-t border-neutral-800 px-3 py-1 text-[10px] text-neutral-500 md:block`,children:`↑↓ navigate · Enter/Tab run · Esc cancel`})]}),j!==void 0&&oe.length>0&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 mb-1 overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto py-1 md:max-h-64`,children:oe.map((e,t)=>(0,R.jsx)(`button`,{onMouseDown:t=>{t.preventDefault(),Mt(e)},onMouseEnter:()=>le(t),className:`block w-full truncate px-3 py-2.5 text-left font-mono text-[14px] md:py-1 md:text-[12px] ${t===ce?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900/80`}`,title:e,children:e},e))}),(0,R.jsx)(`div`,{className:`hidden border-t border-neutral-800 px-3 py-1 text-[10px] text-neutral-500 md:block`,children:`↑↓ navigate · Enter/Tab insert · Esc close`})]}),(0,R.jsx)(`textarea`,{ref:O,value:d,onChange:e=>At(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,onKeyDown:kt,onPaste:Qe,onBlur:()=>{setTimeout(()=>{O.current!==document.activeElement&&Nt()},0)},placeholder:n?`Read-only while this pi-subagents child is running externally…`:a?`Auto-retry in progress — your message will be queued and sent after the retry completes…`:t?k?`Steer the agent…`:`Steer the agent (Enter to send; Shift+Enter for newline)…`:k?r?"Ask pi — Enter for newline; Send to submit; `/` runs commands, `@path` references files…":"Ask pi — Enter for newline; Send to submit; `/` runs commands, `!` runs bash, `@path` references files…":r?"Ask pi (Enter to send; Shift+Enter for newline) — `/` runs commands, `@path` references files…":"Ask pi (Enter to send; Shift+Enter for newline) — `/` runs commands, `!` runs bash, `@path` references files…",title:a?`The agent is auto-retrying after a provider error. New messages are queued and delivered when the retry succeeds.`:void 0,rows:k?2:3,disabled:n,style:He===void 0?void 0:{height:`${He.height}px`,maxHeight:`${He.maxHeight}px`,overflowY:He.overflowing?`auto`:`hidden`},className:`block w-full resize-none rounded-md border bg-neutral-900 px-3 py-2 text-sm text-neutral-100 outline-none disabled:cursor-not-allowed disabled:opacity-60 min-h-11 md:min-h-0 ${Ee===`local`?`border-amber-500 focus:border-amber-400`:Ee===`context`?`border-emerald-500 focus:border-emerald-400`:`border-neutral-700 focus:border-neutral-500`}`}),Ee!==void 0&&(0,R.jsx)(`span`,{className:`pointer-events-none absolute right-2 top-2 select-none rounded px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide ${Ee===`local`?`bg-amber-500/15 text-amber-300`:`bg-emerald-500/15 text-emerald-300`}`,title:Ee===`local`?`!! — runs bash; output stays local (excluded from LLM context)`:`! — runs bash; output is added to the next turn's LLM context`,children:Ee===`local`?`bash · local`:`bash · context`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 self-stretch md:flex-row md:items-end md:self-auto`,children:[(0,R.jsx)(`button`,{onClick:()=>void Ot(),disabled:d.trim().length===0&&Me.length===0||p||n,className:`flex-1 rounded-md bg-neutral-100 px-4 text-sm font-medium text-neutral-900 disabled:cursor-not-allowed disabled:opacity-50 md:flex-none md:py-2`,title:t?`Send (Enter or Cmd/Ctrl+Enter; Pi queues at the next agent break — steer or follow-up depending on agent state)`:`Send (Enter or Cmd/Ctrl+Enter)`,children:`Send`}),t&&(0,R.jsx)(`button`,{onClick:()=>void l(e),className:`flex-1 rounded-md border border-red-700/60 bg-red-950/30 px-3 text-sm font-medium text-red-300 hover:bg-red-900/40 hover:text-red-100 md:flex-none md:py-2 light:border-red-700 light:bg-red-600 light:text-white light:hover:bg-red-700 light:hover:text-white`,title:`Stop the agent (or press Esc twice in the textbox)`,children:`Abort`})]})]}),t&&(0,R.jsx)(`p`,{className:`text-[10px] text-neutral-600`,children:`Enter, Cmd/Ctrl+Enter, or Send queues at the next agent break — Pi picks steer or follow-up. Abort: stop the agent (or press Esc twice in the textbox).`})]})]})}function xM({providers:e,defaultModel:t,value:n,onChange:r}){let i=(0,v.useMemo)(()=>_M(e),[e]),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0),d=(0,v.useRef)(null),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=(0,v.useMemo)(()=>{if(s.trim().length===0)return i;let e=[];for(let t of i){let n=vM(t,s);n!==void 0&&e.push({opt:t,score:n})}return e.sort((e,t)=>e.score-t.score),e.map(e=>e.opt)},[i,s]),h=i.find(e=>e.value===n),g=t!==void 0&&t.provider.length>0&&t.modelId.length>0?`${t.provider} / ${t.modelId}`:``,_=h===void 0?g.length>0?`${g} (default)`:`default model`:`${h.provider} / ${h.name}`;(0,v.useEffect)(()=>{if(!a)return;let e=e=>{d.current!==null&&(d.current.contains(e.target)||o(!1))};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),(0,v.useEffect)(()=>{a&&(c(``),u(0),requestAnimationFrame(()=>f.current?.focus()))},[a]),(0,v.useEffect)(()=>{!a||p.current===null||p.current.querySelector(`[data-idx="${l}"]`)?.scrollIntoView({block:`nearest`})},[a,l]);let y=e=>{if(e===-1)r(``);else{let t=m[e];if(t===void 0)return;r(t.value)}o(!1)};return(0,R.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,R.jsxs)(`button`,{onClick:()=>o(e=>!e),disabled:e===void 0,className:`flex max-w-[260px] items-center gap-1 truncate rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-left text-[11px] text-neutral-200 disabled:opacity-50`,title:`Override the model for this session (click to search)`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`model:`}),(0,R.jsx)(`span`,{className:`truncate`,children:_}),(0,R.jsx)(`span`,{className:`ml-1 text-neutral-500`,children:`▾`})]}),a&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 z-10 mb-1 w-[360px] rounded border border-neutral-700 bg-neutral-950 shadow-xl`,children:[(0,R.jsx)(`input`,{ref:f,value:s,onChange:e=>{c(e.target.value),u(0)},autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(e+1,m.length-1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(e-1,-1))):e.key===`Enter`?(e.preventDefault(),y(l)):e.key===`Escape`&&(e.preventDefault(),o(!1))},placeholder:`Search provider or model…`,className:`w-full border-b border-neutral-800 bg-transparent px-3 py-2 text-xs text-neutral-100 outline-none`}),(0,R.jsxs)(`div`,{ref:p,className:`max-h-72 overflow-y-auto py-1`,children:[(0,R.jsxs)(`button`,{"data-idx":-1,onMouseEnter:()=>u(-1),onClick:()=>y(-1),className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${l===-1?`bg-neutral-800 text-neutral-100`:`text-neutral-400`}`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{children:`Use agent default`}),g.length>0&&(0,R.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:g})]}),n===``&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]}),m.length===0?(0,R.jsx)(`p`,{className:`px-3 py-2 text-xs italic text-neutral-500`,children:`No models match. Add an API key in Settings → Providers.`}):m.map((e,t)=>(0,R.jsxs)(`button`,{"data-idx":t,onMouseEnter:()=>u(t),onClick:()=>y(t),className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${t===l?`bg-neutral-800 text-neutral-100`:`text-neutral-300`}`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:e.provider}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e.name})]}),e.value===n&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]},e.value))]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 px-3 py-1.5 text-[10px] text-neutral-600`,children:[m.length,` of `,i.length,` models — ↑↓ to move, Enter to pick, Esc to close`]})]})]})}function SM({value:e,options:t,onChange:n}){let[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!r)return;let e=e=>{a.current!==null&&(a.current.contains(e.target)||i(!1))};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[r]),(0,R.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,R.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`flex items-center gap-1 rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-left text-[11px] text-neutral-200`,title:`Override the thinking level for this session`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`thinking:`}),(0,R.jsx)(`span`,{className:`truncate`,children:e}),(0,R.jsx)(`span`,{className:`ml-1 text-neutral-500`,children:`▾`})]}),r&&(0,R.jsx)(`div`,{className:`absolute bottom-full left-0 z-10 mb-1 w-[140px] rounded border border-neutral-700 bg-neutral-950 shadow-xl`,children:t.map(t=>(0,R.jsxs)(`button`,{onClick:()=>{n(t),i(!1)},className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${t===e?`bg-neutral-800 text-neutral-100`:`text-neutral-300`}`,children:[(0,R.jsx)(`span`,{children:t}),t===e&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]},t))})]})}function CM({attachments:e,previewUrls:t,onRemove:n}){return(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,r)=>{let i=e.type.startsWith(`image/`),a=t.get(e);return(0,R.jsxs)(`div`,{className:`group relative flex items-center gap-1.5 rounded-md border border-neutral-700 bg-neutral-900 pr-1 text-xs text-neutral-200`,children:[i&&a!==void 0?(0,R.jsx)(`img`,{src:a,alt:e.name,className:`h-12 w-12 shrink-0 rounded-l-md object-cover`}):(0,R.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-l-md bg-neutral-800 text-neutral-400`,children:i?(0,R.jsx)(Le,{size:14}):(0,R.jsx)(Ge,{size:12})}),(0,R.jsxs)(`span`,{className:`flex flex-col py-1 pl-1`,children:[(0,R.jsx)(`span`,{className:`max-w-[160px] truncate font-mono text-[11px]`,title:e.name,children:e.name}),(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-500`,children:wM(e.size)})]}),(0,R.jsx)(`button`,{onClick:()=>n(e),className:`ml-1 rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-red-300`,title:`Remove ${e.name}`,children:(0,R.jsx)(at,{size:16})})]},`${r}-${e.name}`)})})}function wM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function TM({sessionId:e,alreadyOnChangesTab:t,onOpen:n}){let r=pi(t=>t.streamingBySession[e]??!1),i=pi(t=>t.agentEndCountBySession[e]??0),[a,o]=(0,v.useState)(0);return(0,v.useEffect)(()=>{o(0)},[e]),(0,v.useEffect)(()=>{if(r)return;let t=!1;return L.getTurnDiff(e).then(e=>{t||o(e.entries.length)}).catch(e=>{t||(e instanceof N&&e.status===404||typeof console<`u`&&console.warn(`[ChangedFilesBadge] turn-diff fetch failed:`,e),o(0))}),()=>{t=!0}},[e,i,r]),a===0||t?null:(0,R.jsx)(`div`,{className:`border-t border-neutral-800 bg-neutral-950 px-6 py-2`,children:(0,R.jsx)(`div`,{className:`mx-auto max-w-3xl`,children:(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2 rounded-md border border-neutral-700 bg-neutral-900 px-3 py-1.5 text-xs text-neutral-200 hover:border-neutral-500 hover:bg-neutral-800`,title:`Open the Last turn pane to review what the agent just wrote`,children:[(0,R.jsx)(je,{size:12}),a===1?`1 file edited`:`${a} files edited`,(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-500`,children:`— review`})]})})})}var EM=3e4;function DM(e){return JSON.stringify(e)}function OM(e,t){return e?.enabled===t.enabled&&e.connected===t.connected&&e.total===t.total}function kM(e,t){return e!==void 0&&DM(e.status)===DM(t.status)&&DM(e.stdioTrust)===DM(t.stdioTrust)}var AM=[];function jM(e){return e instanceof N?e.code:e instanceof Error?e.message:String(e)}var MM=mt((e,t)=>({settings:void 0,globalServers:{},byProject:{},loading:!1,error:void 0,pollHandle:void 0,startPolling:()=>{if(t().pollHandle!==void 0)return;let n=!1,r=()=>{typeof document<`u`&&document.hidden||n||(n=!0,(async()=>{try{let e=Object.keys(t().byProject);await t().refreshSettings(),await Promise.all(e.map(e=>t().refreshProject(e)))}finally{n=!1}})())};r(),e({pollHandle:window.setInterval(r,EM)})},stopPolling:()=>{let n=t().pollHandle;n!==void 0&&(window.clearInterval(n),e({pollHandle:void 0}))},refreshSettings:async()=>{try{let t=await L.getMcpSettings();e(e=>OM(e.settings,t)?{error:void 0}:{settings:t,error:void 0})}catch(t){if(!(t instanceof N)||t.status===401)return;e({error:jM(t)})}},refreshProject:async n=>{if(n===void 0){try{let t=await L.listMcpServers();e(e=>DM(e.globalServers)===DM(t.servers)?{error:void 0}:{globalServers:t.servers,error:void 0})}catch(t){if(t instanceof N&&t.status===401)return;e({error:jM(t)})}return}t().byProject[n]===void 0&&e({loading:!0});try{let t=await L.listMcpServers(n);e(e=>{let r={status:t.status,loadedAt:Date.now()};t.stdioTrust!==void 0&&(r.stdioTrust=t.stdioTrust);let i=DM(e.globalServers)===DM(t.servers),a=kM(e.byProject[n],r);return{loading:!1,error:void 0,...i?{}:{globalServers:t.servers},...a?{}:{byProject:{...e.byProject,[n]:r}}}})}catch(t){e({loading:!1,error:jM(t)})}},setMcpEnabled:async n=>{let r=t().settings;r!==void 0&&e({settings:{...r,enabled:n}});try{e({settings:await L.setMcpEnabled(n),error:void 0})}catch(t){throw r!==void 0&&e({settings:r}),e({error:jM(t)}),t}},upsertServer:async(n,r)=>{try{await L.upsertMcpServer(n,r),await Promise.all([t().refreshSettings(),...Object.keys(t().byProject).map(e=>t().refreshProject(e))])}catch(t){throw e({error:jM(t)}),t}},deleteServer:async n=>{try{await L.deleteMcpServer(n),await Promise.all([t().refreshSettings(),...Object.keys(t().byProject).map(e=>t().refreshProject(e))])}catch(t){throw e({error:jM(t)}),t}},probeServer:async(n,r)=>{try{await L.probeMcpServer(n,r),await Promise.all([t().refreshSettings(),t().refreshProject(r)])}catch(t){throw e({error:jM(t)}),t}},grantStdioTrust:async n=>{try{await L.grantStdioMcpTrust(n),await t().refreshProject(n)}catch(t){throw e({error:jM(t)}),t}},revokeStdioTrust:async n=>{try{await L.revokeStdioMcpTrust(n),await t().refreshProject(n)}catch(t){throw e({error:jM(t)}),t}}})),NM={agent_end:`Agent turn finished`,ask_user_question:`Agent asked a question (waiting on user)`,process_alert:`Background process exited`,auto_retry_end:`Auto-retry exhausted (provider failure)`,compaction_end:`Context compaction completed`,session_created:`Session created`,session_deleted:`Session deleted`};function PM(){return{name:``,url:``,events:new Set,scope:{kind:`global`},secret:``,headersText:``,insecureTls:!1,enabled:!0}}function FM(e){return{id:e.id,name:e.name,url:e.url,events:new Set(e.events),scope:e.scope,secret:``,headersText:e.headers===void 0?``:Object.entries(e.headers).map(([e,t])=>`${e}: ${t}`).join(`
|
|
358
|
+
`)+we.text),Te(),setTimeout(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},0))},[we,e,Te]);let Ee=(()=>{if(!t&&!r){if(d.startsWith(`!!`))return`local`;if(d.startsWith(`!`))return`context`}})(),De=(0,v.useMemo)(()=>{let n=[{name:`/compact`,description:`Manually compact the session context`,available:!t,run:async()=>{try{await L.compact(e),c(e)}catch(e){qe(`Compact failed: ${e instanceof N?e.code:e.message}`)}}},{name:`/clear`,description:`Compact context (alias for /compact)`,available:!t,run:async()=>{try{await L.compact(e),c(e)}catch(e){qe(`Clear failed: ${e instanceof N?e.code:e.message}`)}}},{name:`/abort`,description:`Stop the agent (alias for the Abort button)`,available:t,run:()=>l(e)},{name:`/settings`,description:`Open the Settings panel`,available:!0,run:()=>de()},{name:`/skills`,description:`Open Settings → Skills`,available:!0,run:()=>de(`skills`)},{name:`/mcp`,description:`Open Settings → MCP`,available:!0,run:()=>de(`mcp`)},{name:`/providers`,description:`Open Settings → Providers`,available:!0,run:()=>de(`providers`)},{name:`/help`,description:r?"Show what `/` and `@` do in the input":"Show what `/`, `!`, `@` do in the input",available:!0,run:()=>{qe(r?`/<cmd> runs a pi-forge command (compact, abort, settings, …). @<path> references a project file (autocomplete from the popover).`:`/<cmd> runs a pi-forge command (compact, abort, settings, …). !cmd runs bash (output → next LLM context); !!cmd runs bash local-only. @<path> references a project file (autocomplete from the popover).`)}}];for(let e of Se){let r=e.argumentHint===void 0?e.description:`${e.description} — args: ${e.argumentHint}`;n.push({name:`/${e.name}`,description:r,available:!t,run:()=>{let t=`/${e.name} `;f(t),requestAnimationFrame(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(t.length,t.length))})}})}return n},[t,e,l,c,de,r,Se]),Oe=(0,v.useMemo)(()=>{let e=xe.toLowerCase();return e.length===0?De:De.filter(t=>t.name.slice(1).toLowerCase().startsWith(e))},[De,xe]),ke=(0,v.useMemo)(()=>{if(!be)return!1;let e=d.slice(1).split(/\s/)[0]??``;return e.length===0||!Se.some(t=>t.name===e)?!1:d===`/${e}`||d.startsWith(`/${e} `)},[be,d,Se]),Ae=e=>{let t=Oe[e??ge];t===void 0||!t.available||(f(``),_e(0),t.run())},je=(0,v.useRef)(0),[Me,Ne]=(0,v.useState)([]),Pe=(0,v.useRef)(new Map),Fe=(0,v.useRef)(null),Ie=(0,v.useRef)(null),[ze,Be]=(0,v.useState)(!1),Ve=(0,v.useRef)(null),[He,Ue]=(0,v.useState)(void 0),We=new Set(`doc.xls.ppt.pptx.vsd.vsdx.odt.ods.odp.rtf.zip.tar.gz.bz2.xz.7z.rar.exe.dll.so.dylib.bin.o.a.class.jar.wasm.mp3.mp4.m4a.wav.flac.ogg.avi.mov.wmv.mkv.heic.heif.tiff.tif.bmp.ico.psd.ttf.otf.woff.woff2.eot.sqlite.db.iso.dmg`.split(`.`)),[Ke,qe]=(0,v.useState)(void 0),Je=e=>{qe(void 0);let t=Me,n=[...t],r=t.filter(e=>e.type.startsWith(`image/`)).length;for(let t of e){if(n.length>=8){qe(`Up to 8 attachments per message; "${t.name}" dropped.`);continue}if(t.size>20971520){qe(`"${t.name}" exceeds the 20 MB per-file limit.`);continue}if(t.type.startsWith(`image/`)&&r>=4){qe(`Up to 4 images per message; "${t.name}" dropped.`);continue}let e=t.name.includes(`.`)?t.name.split(`.`).pop()?.toLowerCase():void 0;if(e!==void 0&&We.has(e)){qe(`"${t.name}" is a binary format that the agent can't read directly. Convert to text/markdown (or to a PNG/JPEG screenshot for diagrams) and try again.`);continue}n.push(t),t.type.startsWith(`image/`)&&(r+=1,Pe.current.set(t,URL.createObjectURL(t)))}Ne(n)},Xe=e=>{let t=Pe.current.get(e);t!==void 0&&(URL.revokeObjectURL(t),Pe.current.delete(e)),Ne(t=>t.filter(t=>t!==e))},Ze=()=>{for(let e of Pe.current.values())URL.revokeObjectURL(e);Pe.current.clear(),Ne([]),qe(void 0)},Qe=e=>{let r=$j(e.clipboardData);if(r.length!==0){if(n){qe(`This pi-subagents child is running externally and is read-only.`);return}if(t){qe(`Images pasted while streaming aren't attached. Wait for the current run to finish.`);return}Je(r)}};(0,v.useEffect)(()=>{let e=Pe.current;return()=>{for(let t of e.values())URL.revokeObjectURL(t);e.clear()}},[]);let $e=pi(t=>t.messagesBySession[e]??ni),[et,tt]=(0,v.useState)(0),nt=(0,v.useMemo)(()=>{let t=pM(e),n=hM($e),r=new Set,i=[];for(let e of[...t,...n])r.has(e)||(r.add(e),i.push(e));return i},[$e,e,et]),[rt,it]=(0,v.useState)(void 0),ot=(0,v.useRef)(``);(0,v.useEffect)(()=>{it(void 0),ot.current=``},[e]),(0,v.useEffect)(()=>{je.current=0},[e]);let st=gM+e,[lt,ut]=(0,v.useState)(void 0),[dt,ft]=(0,v.useState)(void 0),[pt,mt]=(0,v.useState)(()=>localStorage.getItem(gM+e)??``),[ht,gt]=(0,v.useState)(void 0),[_t,vt]=(0,v.useState)(void 0),[yt,bt]=(0,v.useState)(void 0),[xt,St]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{L.getProviders().then(ut).catch(e=>{gt(`models unavailable (${e instanceof N?e.code:e.message})`)}),L.getSettings().then(e=>{ft({provider:typeof e.defaultProvider==`string`?e.defaultProvider:``,modelId:typeof e.defaultModel==`string`?e.defaultModel:``})}).catch(()=>{})},[]),(0,v.useEffect)(()=>{let t=localStorage.getItem(gM+e)??``;mt(t),gt(void 0),bt(void 0),vt(void 0),St(void 0);{let t=e;L.getSession(t).then(n=>{t===e&&(vt(n.thinkingLevel),n.modelProvider!==void 0&&n.modelId!==void 0&&St({provider:n.modelProvider,modelId:n.modelId}))}).catch(()=>{})}if(t===``)return;let[n,...r]=t.split(`:`),i=r.join(`:`);if(n===void 0||i.length===0)return;let a=e;L.setModel(a,n,i).catch(t=>{a===e&>(`set model failed: ${t instanceof N?t.code:t.message}`)})},[e]);let Ct=pi(t=>t.pendingDraftBySession[e]),wt=pi(e=>e.consumePendingDraft);(0,v.useEffect)(()=>{Ct!==void 0&&(f(Ct),wt(e))},[Ct,e,wt]),(0,v.useEffect)(()=>{if(fe===void 0||fe.seq<=he.current)return;he.current=fe.seq;let e=fe.text;f(t=>t.length===0?e:`${t}${/\s$/.test(t)?``:` `}${e}`),requestAnimationFrame(()=>{let e=O.current;if(e===null)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)}),pe()},[fe,pe]);let Tt=async t=>{if(mt(t),t===``){localStorage.removeItem(st);return}let[n,...r]=t.split(`:`),i=r.join(`:`);if(!(n===void 0||i.length===0))try{await L.setModel(e,n,i),localStorage.setItem(st,t),gt(void 0);let r=e;L.getSession(r).then(t=>{r===e&&(vt(t.thinkingLevel),t.modelProvider!==void 0&&t.modelId!==void 0&&St({provider:t.modelProvider,modelId:t.modelId}))}).catch(()=>{})}catch(e){gt(`set model failed: ${e instanceof N?e.code:e.message}`)}},Et=(0,v.useMemo)(()=>{if(lt===void 0)return;let e,t;if(pt.length>0){let[n,...r]=pt.split(`:`);if(n===void 0)return;e=n,t=r.join(`:`)}else if(xt!==void 0)e=xt.provider,t=xt.modelId;else return;return lt.providers.find(t=>t.provider===e)?.models.find(e=>e.id===t)},[lt,pt,xt]),Dt=async t=>{vt(t);try{vt((await L.setThinkingLevel(e,t)).level),bt(void 0)}catch(e){bt(`set thinking level failed: ${e instanceof N?e.code:e.message}`)}},Ot=async()=>{let i=d,a=i.trim();if(n){qe(`This pi-subagents child is running externally and is read-only.`);return}if(!(a.length===0&&Me.length===0||p)){if(a.length>0&&(mM(e,a),tt(e=>e+1)),be&&!ke){Oe.length>0?Ae():qe(`Unknown command "${d.split(/\s/)[0]??d}". Type /help to see commands.`);return}m(!0);try{if(!t&&/^!!?[^!]/.test(a)){if(r){qe(`Bash exec is disabled in this deployment.`);return}let t=a.startsWith(`!!`),n=a.slice(t?2:1).trim();if(n.length===0){qe("Empty bash command. Type something after the `!`.");return}Me.length>0&&(Ze(),qe("Attachments aren't sent with `!` exec. Cleared.")),await L.exec(e,n,{excludeFromContext:t}),c(e),f(``),it(void 0),ot.current=``;return}t?(Me.length>0&&(Ze(),qe(`Attachments aren't sent on steer (mid-turn). Cleared.`)),await s(e,i)):await o(e,i,Me.length>0?Me:void 0),f(``),Ze(),it(void 0),ot.current=``,k&&O.current?.blur()}catch(e){qe(`Command failed: ${e instanceof N?e.code:e.message}`)}finally{m(!1)}}},kt=n=>{if(be){if(n.key===`Escape`){n.preventDefault(),f(``);return}if(Oe.length>0){if(n.key===`ArrowDown`){n.preventDefault(),_e(e=>Math.min(e+1,Oe.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),_e(e=>Math.max(e-1,0));return}if((n.key===`Enter`||n.key===`Tab`)&&!(ke&&n.key===`Enter`)){n.preventDefault(),Ae();return}}else if(n.key===`Enter`&&!n.shiftKey){n.preventDefault(),qe(`Unknown command "${d.split(/\s/)[0]??d}". Type /help to see commands, or backspace the leading / to send as a prompt.`);return}}if(j!==void 0&&oe.length>0){if(n.key===`ArrowDown`){n.preventDefault(),le(e=>Math.min(e+1,oe.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),le(e=>Math.max(e-1,0));return}if(n.key===`Enter`&&n.metaKey!==!0&&n.ctrlKey!==!0||n.key===`Tab`){let e=oe[ce];if(e!==void 0){n.preventDefault(),Mt(e);return}}if(n.key===`Escape`){n.preventDefault(),Nt();return}}if(eM(n,{isMobile:k})){n.preventDefault(),Ot();return}if(n.key===`ArrowUp`){let e=rt!==void 0;if(e||d.length===0){if(nt.length===0)return;n.preventDefault();let t=e?Math.min((rt??0)+1,nt.length-1):0;e||(ot.current=d),it(t);let r=nt[t];r!==void 0&&f(r)}return}if(n.key===`ArrowDown`){if(rt===void 0)return;if(n.preventDefault(),rt>0){let e=rt-1;it(e);let t=nt[e];t!==void 0&&f(t)}else it(void 0),f(ot.current),ot.current=``;return}if(n.key===`Escape`){if(!t)return;n.preventDefault();let r=Date.now(),i=r-je.current;je.current=r,i<yM&&(je.current=0,l(e))}},At=e=>{f(e),rt!==void 0&&(it(void 0),ot.current=``);let t=jt(e,O.current?.selectionStart??e.length);M(t),t===void 0&&se([]),le(0)};function jt(e,t){let n=t-1;for(;n>=0;){let r=e[n];if(r===void 0)break;if(/\s/.test(r))return;if(r===`@`){let r=n===0?` `:e[n-1];return r===void 0||/\s/.test(r)?{start:n,end:t,query:e.slice(n+1,t)}:void 0}--n}}(0,v.useEffect)(()=>{if(j===void 0||D===void 0)return;let e=ue.current+1;ue.current=e;let t=window.setTimeout(()=>{L.completeFiles(D.id,j.query,{limit:20}).then(t=>{ue.current===e&&(se(t.paths),le(0))}).catch(()=>{ue.current===e&&se([])})},100);return()=>window.clearTimeout(t)},[j,D]);let Mt=e=>{if(j===void 0)return;let t=d.slice(0,j.start),n=d.slice(j.end),r=`@"${e}"`;f(`${t}${r}${n}`),M(void 0),se([]);let i=t.length+r.length;requestAnimationFrame(()=>{let e=O.current;e!==null&&(e.focus(),e.setSelectionRange(i,i))})},Nt=()=>{M(void 0),se([])},Pt=cM(d),Ft=e=>{let t=uM(e);f(e=>e.replace(t,(e,t)=>t).trimEnd())};return(0,v.useEffect)(()=>{if(!ze)return;let e=e=>{let t=Ve.current;t!==null&&(t.contains(e.target)||Be(!1))},t=e=>{e.key===`Escape`&&Be(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`touchstart`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`touchstart`,e),window.removeEventListener(`keydown`,t)}},[ze]),(0,v.useLayoutEffect)(()=>{let e=O.current;if(e===null)return;let t=e.style.height;e.style.height=`auto`;let n=e.scrollHeight;e.style.height=t;let r=k?void 0:re,i=k?44:r===void 0?80:60,a=Math.round(window.innerHeight*(k?.25:te)),o=Math.max(i,r??a),s=r===void 0?Math.max(i,Math.min(n,o)):o,c={height:s,maxHeight:o,overflowing:n>s};Ue(e=>e?.height===c.height&&e.maxHeight===c.maxHeight&&e.overflowing===c.overflowing?e:c)},[d,k,re]),(0,R.jsxs)(`div`,{className:`forge-chat-input-root bg-neutral-950`,children:[(0,R.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize chat input`,onPointerDown:ae,className:`group relative hidden h-px cursor-row-resize bg-neutral-800 hover:bg-neutral-600 active:bg-neutral-500 md:block`,children:(0,R.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-2`})}),(0,R.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-2 px-3 pt-2 md:px-6 md:py-3`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom))`},children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(xM,{providers:lt,defaultModel:dt,value:pt,onChange:e=>void Tt(e)}),Et!==void 0&&Et.supportedThinkingLevels.length>1&&_t!==void 0&&(0,R.jsx)(SM,{value:_t,options:Et.supportedThinkingLevels,onChange:e=>void Dt(e)}),Pt.length>0&&(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:Pt.map((e,t)=>(0,R.jsxs)(`span`,{className:`inline-flex max-w-[220px] items-center gap-1 truncate rounded border border-emerald-700/60 bg-emerald-900/20 px-1.5 py-0.5 text-[11px] text-emerald-200`,title:`@${e} — model will use its read tool to load this file when it needs to`,children:[(0,R.jsx)(ye,{size:11,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>Ft(e),className:`-mr-0.5 ml-0.5 rounded p-0.5 text-emerald-300/70 hover:bg-emerald-900/40 hover:text-emerald-100`,title:`Remove @${e}`,children:(0,R.jsx)(at,{size:10})})]},`ref-${t}-${e}`))}),(ht!==void 0||yt!==void 0||re!==void 0||h.total>0||y>0)&&(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[ht!==void 0&&(0,R.jsx)(`span`,{className:`text-[11px] text-red-400`,children:ht}),yt!==void 0&&(0,R.jsx)(`span`,{className:`text-[11px] text-red-400`,children:yt}),!k&&re!==void 0&&(0,R.jsx)(`button`,{type:`button`,onClick:A,className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Reset chat input height to default`,"aria-label":`Reset chat input height to default`,children:(0,R.jsx)(Ye,{size:12})}),y>0&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsxs)(`button`,{ref:T,type:`button`,onClick:()=>{k?S(e=>!e):b()},className:`flex items-center gap-1 rounded px-1.5 py-1 text-[11px] ${k&&x?`bg-neutral-800 text-neutral-100 light:bg-neutral-200 light:text-neutral-900`:`text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200 light:text-neutral-600 light:hover:bg-neutral-200 light:hover:text-neutral-900`}`,title:k?`${y} background process(es) running — show list`:`${y} background process(es) running — view processes panel`,"aria-label":k?`Show processes list`:`View processes panel`,"aria-expanded":k?x:void 0,children:[(0,R.jsx)(ve,{size:12,className:`text-emerald-400 light:text-emerald-700`}),(0,R.jsx)(`span`,{children:y})]}),k&&(0,R.jsx)(iM,{open:x,onClose:()=>S(!1),anchorRef:T,sessionId:e})]}),h.total>0&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsxs)(`button`,{ref:E,type:`button`,onClick:()=>{k?w(e=>!e):_(!g)},className:`flex items-center gap-1 rounded px-1.5 py-1 text-[11px] ${(k?C:g)?`bg-amber-900/40 text-amber-200 light:bg-amber-100 light:text-amber-900`:`text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200 light:text-neutral-600 light:hover:bg-neutral-200 light:hover:text-neutral-900`}`,title:k?`Tasks: ${h.completed}/${h.total} done${h.inProgress>0?`, ${h.inProgress} in progress`:``}`:g?`Hide todo panel`:`Show todo panel (${h.completed}/${h.total} done${h.inProgress>0?`, ${h.inProgress} in progress`:``})`,"aria-label":k?`Show tasks list`:`Toggle todo panel`,"aria-expanded":k?C:void 0,"aria-pressed":k?void 0:g,children:[(0,R.jsx)(Re,{size:12}),(0,R.jsxs)(`span`,{children:[h.completed,`/`,h.total]})]}),k&&(0,R.jsx)(sM,{open:C,onClose:()=>w(!1),anchorRef:E,sessionId:e})]})]})]}),u!==void 0&&(0,R.jsxs)(`p`,{className:`text-xs text-red-400`,children:[`Error: `,u]}),Ke!==void 0&&(0,R.jsx)(`p`,{className:`text-xs text-amber-400`,children:Ke}),Me.length>0&&(0,R.jsx)(CM,{attachments:Me,previewUrls:Pe.current,onRemove:Xe}),(0,R.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,R.jsx)(`input`,{ref:Fe,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files!==null&&Je(e.target.files),e.target.value=``}}),k&&(0,R.jsx)(`input`,{ref:Ie,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files!==null&&Je(e.target.files),e.target.value=``}}),k?(0,R.jsxs)(`div`,{className:`relative`,ref:Ve,children:[(0,R.jsx)(`button`,{onClick:()=>Be(e=>!e),disabled:p||t||n,"aria-label":`Attach`,"aria-expanded":ze,className:`inline-flex min-h-11 min-w-11 items-center justify-center self-stretch rounded-md border border-neutral-700 bg-neutral-900 px-2 text-neutral-300 hover:border-neutral-500 hover:text-neutral-100 disabled:cursor-not-allowed disabled:opacity-50`,title:t?`Attachments aren't sent on steer (mid-turn).`:`Attach a photo or a file`,children:(0,R.jsx)(Ge,{size:16})}),ze&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 z-20 mb-1 flex flex-col overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsxs)(`button`,{onClick:()=>{Ie.current?.click(),Be(!1)},className:`flex min-h-11 items-center gap-2 px-3 text-left text-[14px] text-neutral-200 hover:bg-neutral-800`,children:[(0,R.jsx)(Le,{size:16,className:`shrink-0 text-neutral-400`}),`Photo`]}),(0,R.jsxs)(`button`,{onClick:()=>{Fe.current?.click(),Be(!1)},className:`flex min-h-11 items-center gap-2 border-t border-neutral-800 px-3 text-left text-[14px] text-neutral-200 hover:bg-neutral-800`,children:[(0,R.jsx)(Ge,{size:16,className:`shrink-0 text-neutral-400`}),`File`]})]})]}):(0,R.jsx)(`button`,{onClick:()=>Fe.current?.click(),disabled:p||t||n,"aria-label":`Attach files`,className:`inline-flex items-center justify-center self-stretch rounded-md border border-neutral-700 bg-neutral-900 px-2 text-neutral-300 hover:border-neutral-500 hover:text-neutral-100 disabled:cursor-not-allowed disabled:opacity-50`,title:t?`Attachments aren't sent on steer (mid-turn). Wait for the current run to finish.`:`Attach files (images go into model context; text files are prepended to the prompt)`,children:(0,R.jsx)(Ge,{size:14})}),(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[be&&Oe.length>0&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 mb-1 overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto py-1 md:max-h-64`,children:Oe.map((e,t)=>(0,R.jsx)(`button`,{onMouseDown:n=>{n.preventDefault(),e.available&&(_e(t),Ae(t))},onMouseEnter:()=>_e(t),disabled:!e.available,className:`block w-full px-3 py-2.5 text-left text-[14px] md:py-1 md:text-[12px] ${t===ge&&e.available?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900/80`} ${e.available?``:`opacity-40`}`,title:e.available?e.description:`${e.description} — unavailable right now`,children:(0,R.jsxs)(`div`,{className:`flex flex-col md:block`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-200`,children:e.name}),(0,R.jsx)(`span`,{className:`text-[12px] text-neutral-500 md:ml-2 md:text-[10px]`,children:e.description})]})},e.name))}),(0,R.jsx)(`div`,{className:`hidden border-t border-neutral-800 px-3 py-1 text-[10px] text-neutral-500 md:block`,children:`↑↓ navigate · Enter/Tab run · Esc cancel`})]}),j!==void 0&&oe.length>0&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 mb-1 overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,children:[(0,R.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto py-1 md:max-h-64`,children:oe.map((e,t)=>(0,R.jsx)(`button`,{onMouseDown:t=>{t.preventDefault(),Mt(e)},onMouseEnter:()=>le(t),className:`block w-full truncate px-3 py-2.5 text-left font-mono text-[14px] md:py-1 md:text-[12px] ${t===ce?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-900/80`}`,title:e,children:e},e))}),(0,R.jsx)(`div`,{className:`hidden border-t border-neutral-800 px-3 py-1 text-[10px] text-neutral-500 md:block`,children:`↑↓ navigate · Enter/Tab insert · Esc close`})]}),(0,R.jsx)(`textarea`,{ref:O,value:d,onChange:e=>At(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,onKeyDown:kt,onPaste:Qe,onBlur:()=>{setTimeout(()=>{O.current!==document.activeElement&&Nt()},0)},placeholder:n?`Read-only while this pi-subagents child is running externally…`:a?`Auto-retry in progress — your message will be queued and sent after the retry completes…`:t?k?`Steer the agent…`:`Steer the agent (Enter to send; Shift+Enter for newline)…`:k?r?"Ask pi — Enter for newline; Send to submit; `/` runs commands, `@path` references files…":"Ask pi — Enter for newline; Send to submit; `/` runs commands, `!` runs bash, `@path` references files…":r?"Ask pi (Enter to send; Shift+Enter for newline) — `/` runs commands, `@path` references files…":"Ask pi (Enter to send; Shift+Enter for newline) — `/` runs commands, `!` runs bash, `@path` references files…",title:a?`The agent is auto-retrying after a provider error. New messages are queued and delivered when the retry succeeds.`:void 0,rows:k?2:3,disabled:n,style:He===void 0?void 0:{height:`${He.height}px`,maxHeight:`${He.maxHeight}px`,overflowY:He.overflowing?`auto`:`hidden`},className:`block w-full resize-none rounded-md border bg-neutral-900 px-3 py-2 text-sm text-neutral-100 outline-none disabled:cursor-not-allowed disabled:opacity-60 min-h-11 md:min-h-0 ${Ee===`local`?`border-amber-500 focus:border-amber-400`:Ee===`context`?`border-emerald-500 focus:border-emerald-400`:`border-neutral-700 focus:border-neutral-500`}`}),Ee!==void 0&&(0,R.jsx)(`span`,{className:`pointer-events-none absolute right-2 top-2 select-none rounded px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide ${Ee===`local`?`bg-amber-500/15 text-amber-300`:`bg-emerald-500/15 text-emerald-300`}`,title:Ee===`local`?`!! — runs bash; output stays local (excluded from LLM context)`:`! — runs bash; output is added to the next turn's LLM context`,children:Ee===`local`?`bash · local`:`bash · context`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 self-stretch md:flex-row md:items-end md:self-auto`,children:[(0,R.jsx)(`button`,{onClick:()=>void Ot(),disabled:d.trim().length===0&&Me.length===0||p||n,className:`flex-1 rounded-md bg-neutral-100 px-4 text-sm font-medium text-neutral-900 disabled:cursor-not-allowed disabled:opacity-50 md:flex-none md:py-2`,title:t?`Send (Enter or Cmd/Ctrl+Enter; Pi queues at the next agent break — steer or follow-up depending on agent state)`:`Send (Enter or Cmd/Ctrl+Enter)`,children:`Send`}),t&&(0,R.jsx)(`button`,{onClick:()=>void l(e),className:`flex-1 rounded-md border border-red-700/60 bg-red-950/30 px-3 text-sm font-medium text-red-300 hover:bg-red-900/40 hover:text-red-100 md:flex-none md:py-2 light:border-red-700 light:bg-red-600 light:text-white light:hover:bg-red-700 light:hover:text-white`,title:`Stop the agent (or press Esc twice in the textbox)`,children:`Abort`})]})]}),t&&(0,R.jsx)(`p`,{className:`text-[10px] text-neutral-600`,children:`Enter, Cmd/Ctrl+Enter, or Send queues at the next agent break — Pi picks steer or follow-up. Abort: stop the agent (or press Esc twice in the textbox).`})]})]})}function xM({providers:e,defaultModel:t,value:n,onChange:r}){let i=(0,v.useMemo)(()=>_M(e),[e]),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0),d=(0,v.useRef)(null),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=(0,v.useMemo)(()=>{if(s.trim().length===0)return i;let e=[];for(let t of i){let n=vM(t,s);n!==void 0&&e.push({opt:t,score:n})}return e.sort((e,t)=>e.score-t.score),e.map(e=>e.opt)},[i,s]),h=i.find(e=>e.value===n),g=t!==void 0&&t.provider.length>0&&t.modelId.length>0?`${t.provider} / ${t.modelId}`:``,_=h===void 0?g.length>0?`${g} (default)`:`default model`:`${h.provider} / ${h.name}`;(0,v.useEffect)(()=>{if(!a)return;let e=e=>{d.current!==null&&(d.current.contains(e.target)||o(!1))};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),(0,v.useEffect)(()=>{a&&(c(``),u(0),requestAnimationFrame(()=>f.current?.focus()))},[a]),(0,v.useEffect)(()=>{!a||p.current===null||p.current.querySelector(`[data-idx="${l}"]`)?.scrollIntoView({block:`nearest`})},[a,l]);let y=e=>{if(e===-1)r(``);else{let t=m[e];if(t===void 0)return;r(t.value)}o(!1)};return(0,R.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,R.jsxs)(`button`,{onClick:()=>o(e=>!e),disabled:e===void 0,className:`flex max-w-[260px] items-center gap-1 truncate rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-left text-[11px] text-neutral-200 disabled:opacity-50`,title:`Override the model for this session (click to search)`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`model:`}),(0,R.jsx)(`span`,{className:`truncate`,children:_}),(0,R.jsx)(`span`,{className:`ml-1 text-neutral-500`,children:`▾`})]}),a&&(0,R.jsxs)(`div`,{className:`absolute bottom-full left-0 z-10 mb-1 w-[360px] rounded border border-neutral-700 bg-neutral-950 shadow-xl`,children:[(0,R.jsx)(`input`,{ref:f,value:s,onChange:e=>{c(e.target.value),u(0)},autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(e+1,m.length-1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(e-1,-1))):e.key===`Enter`?(e.preventDefault(),y(l)):e.key===`Escape`&&(e.preventDefault(),o(!1))},placeholder:`Search provider or model…`,className:`w-full border-b border-neutral-800 bg-transparent px-3 py-2 text-xs text-neutral-100 outline-none`}),(0,R.jsxs)(`div`,{ref:p,className:`max-h-72 overflow-y-auto py-1`,children:[(0,R.jsxs)(`button`,{"data-idx":-1,onMouseEnter:()=>u(-1),onClick:()=>y(-1),className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${l===-1?`bg-neutral-800 text-neutral-100`:`text-neutral-400`}`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{children:`Use agent default`}),g.length>0&&(0,R.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:g})]}),n===``&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]}),m.length===0?(0,R.jsx)(`p`,{className:`px-3 py-2 text-xs italic text-neutral-500`,children:`No models match. Add an API key in Settings → Providers.`}):m.map((e,t)=>(0,R.jsxs)(`button`,{"data-idx":t,onMouseEnter:()=>u(t),onClick:()=>y(t),className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${t===l?`bg-neutral-800 text-neutral-100`:`text-neutral-300`}`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:e.provider}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e.name})]}),e.value===n&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]},e.value))]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 px-3 py-1.5 text-[10px] text-neutral-600`,children:[m.length,` of `,i.length,` models — ↑↓ to move, Enter to pick, Esc to close`]})]})]})}function SM({value:e,options:t,onChange:n}){let[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!r)return;let e=e=>{a.current!==null&&(a.current.contains(e.target)||i(!1))};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[r]),(0,R.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,R.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`flex items-center gap-1 rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-left text-[11px] text-neutral-200`,title:`Override the thinking level for this session`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`thinking:`}),(0,R.jsx)(`span`,{className:`truncate`,children:e}),(0,R.jsx)(`span`,{className:`ml-1 text-neutral-500`,children:`▾`})]}),r&&(0,R.jsx)(`div`,{className:`absolute bottom-full left-0 z-10 mb-1 w-[140px] rounded border border-neutral-700 bg-neutral-950 shadow-xl`,children:t.map(t=>(0,R.jsxs)(`button`,{onClick:()=>{n(t),i(!1)},className:`flex w-full items-center justify-between px-3 py-1.5 text-left text-xs ${t===e?`bg-neutral-800 text-neutral-100`:`text-neutral-300`}`,children:[(0,R.jsx)(`span`,{children:t}),t===e&&(0,R.jsx)(`span`,{className:`text-emerald-400`,children:`●`})]},t))})]})}function CM({attachments:e,previewUrls:t,onRemove:n}){return(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,r)=>{let i=e.type.startsWith(`image/`),a=t.get(e);return(0,R.jsxs)(`div`,{className:`group relative flex items-center gap-1.5 rounded-md border border-neutral-700 bg-neutral-900 pr-1 text-xs text-neutral-200`,children:[i&&a!==void 0?(0,R.jsx)(`img`,{src:a,alt:e.name,className:`h-12 w-12 shrink-0 rounded-l-md object-cover`}):(0,R.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-l-md bg-neutral-800 text-neutral-400`,children:i?(0,R.jsx)(Le,{size:14}):(0,R.jsx)(Ge,{size:12})}),(0,R.jsxs)(`span`,{className:`flex flex-col py-1 pl-1`,children:[(0,R.jsx)(`span`,{className:`max-w-[160px] truncate font-mono text-[11px]`,title:e.name,children:e.name}),(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-500`,children:wM(e.size)})]}),(0,R.jsx)(`button`,{onClick:()=>n(e),className:`ml-1 rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-red-300`,title:`Remove ${e.name}`,children:(0,R.jsx)(at,{size:16})})]},`${r}-${e.name}`)})})}function wM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function TM({sessionId:e,alreadyOnChangesTab:t,onOpen:n}){let r=pi(t=>t.streamingBySession[e]??!1),i=pi(t=>t.agentEndCountBySession[e]??0),[a,o]=(0,v.useState)(0);return(0,v.useEffect)(()=>{o(0)},[e]),(0,v.useEffect)(()=>{if(r)return;let t=!1;return L.getTurnDiff(e).then(e=>{t||o(e.entries.length)}).catch(e=>{t||(e instanceof N&&e.status===404||typeof console<`u`&&console.warn(`[ChangedFilesBadge] turn-diff fetch failed:`,e),o(0))}),()=>{t=!0}},[e,i,r]),a===0||t?null:(0,R.jsx)(`div`,{className:`border-t border-neutral-800 bg-neutral-950 px-6 py-2`,children:(0,R.jsx)(`div`,{className:`mx-auto max-w-3xl`,children:(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2 rounded-md border border-neutral-700 bg-neutral-900 px-3 py-1.5 text-xs text-neutral-200 hover:border-neutral-500 hover:bg-neutral-800`,title:`Open the Last turn pane to review what the agent just wrote`,children:[(0,R.jsx)(je,{size:12}),a===1?`1 file edited`:`${a} files edited`,(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-500`,children:`— review`})]})})})}var EM=3e4;function DM(e){return JSON.stringify(e)}function OM(e,t){return e?.enabled===t.enabled&&e.connected===t.connected&&e.total===t.total&&e.truncation.enabled===t.truncation.enabled&&e.truncation.maxChars===t.truncation.maxChars}function kM(e,t){return e!==void 0&&DM(e.status)===DM(t.status)&&DM(e.stdioTrust)===DM(t.stdioTrust)}var AM=[];function jM(e){return e instanceof N?e.code:e instanceof Error?e.message:String(e)}var MM=mt((e,t)=>({settings:void 0,globalServers:{},byProject:{},loading:!1,error:void 0,pollHandle:void 0,startPolling:()=>{if(t().pollHandle!==void 0)return;let n=!1,r=()=>{typeof document<`u`&&document.hidden||n||(n=!0,(async()=>{try{let e=Object.keys(t().byProject);await t().refreshSettings(),await Promise.all(e.map(e=>t().refreshProject(e)))}finally{n=!1}})())};r(),e({pollHandle:window.setInterval(r,EM)})},stopPolling:()=>{let n=t().pollHandle;n!==void 0&&(window.clearInterval(n),e({pollHandle:void 0}))},refreshSettings:async()=>{try{let t=await L.getMcpSettings();e(e=>OM(e.settings,t)?{error:void 0}:{settings:t,error:void 0})}catch(t){if(!(t instanceof N)||t.status===401)return;e({error:jM(t)})}},refreshProject:async n=>{if(n===void 0){try{let t=await L.listMcpServers();e(e=>DM(e.globalServers)===DM(t.servers)?{error:void 0}:{globalServers:t.servers,error:void 0})}catch(t){if(t instanceof N&&t.status===401)return;e({error:jM(t)})}return}t().byProject[n]===void 0&&e({loading:!0});try{let t=await L.listMcpServers(n);e(e=>{let r={status:t.status,loadedAt:Date.now()};t.stdioTrust!==void 0&&(r.stdioTrust=t.stdioTrust);let i=DM(e.globalServers)===DM(t.servers),a=kM(e.byProject[n],r);return{loading:!1,error:void 0,...i?{}:{globalServers:t.servers},...a?{}:{byProject:{...e.byProject,[n]:r}}}})}catch(t){e({loading:!1,error:jM(t)})}},setMcpEnabled:async n=>{let r=t().settings;r!==void 0&&e({settings:{...r,enabled:n}});try{e({settings:await L.setMcpEnabled(n),error:void 0})}catch(t){throw r!==void 0&&e({settings:r}),e({error:jM(t)}),t}},setMcpTruncation:async n=>{let r=t().settings;r!==void 0&&e({settings:{...r,truncation:n}});try{e({settings:await L.setMcpTruncation(n),error:void 0})}catch(t){throw r!==void 0&&e({settings:r}),e({error:jM(t)}),t}},upsertServer:async(n,r)=>{try{await L.upsertMcpServer(n,r),await Promise.all([t().refreshSettings(),...Object.keys(t().byProject).map(e=>t().refreshProject(e))])}catch(t){throw e({error:jM(t)}),t}},deleteServer:async n=>{try{await L.deleteMcpServer(n),await Promise.all([t().refreshSettings(),...Object.keys(t().byProject).map(e=>t().refreshProject(e))])}catch(t){throw e({error:jM(t)}),t}},probeServer:async(n,r)=>{try{await L.probeMcpServer(n,r),await Promise.all([t().refreshSettings(),t().refreshProject(r)])}catch(t){throw e({error:jM(t)}),t}},grantStdioTrust:async n=>{try{await L.grantStdioMcpTrust(n),await t().refreshProject(n)}catch(t){throw e({error:jM(t)}),t}},revokeStdioTrust:async n=>{try{await L.revokeStdioMcpTrust(n),await t().refreshProject(n)}catch(t){throw e({error:jM(t)}),t}}})),NM={agent_end:`Agent turn finished`,ask_user_question:`Agent asked a question (waiting on user)`,process_alert:`Background process exited`,auto_retry_end:`Auto-retry exhausted (provider failure)`,compaction_end:`Context compaction completed`,session_created:`Session created`,session_deleted:`Session deleted`};function PM(){return{name:``,url:``,events:new Set,scope:{kind:`global`},secret:``,headersText:``,insecureTls:!1,enabled:!0}}function FM(e){return{id:e.id,name:e.name,url:e.url,events:new Set(e.events),scope:e.scope,secret:``,headersText:e.headers===void 0?``:Object.entries(e.headers).map(([e,t])=>`${e}: ${t}`).join(`
|
|
359
359
|
`),insecureTls:e.insecureTls===!0,enabled:e.enabled}}function IM(e){let t={};for(let n of e.split(`
|
|
360
360
|
`)){let e=n.trim();if(e.length===0)continue;let r=e.indexOf(`:`);if(r===-1)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();i.length!==0&&(t[i]=a)}return Object.keys(t).length===0?void 0:t}function LM({onError:e}){let t=xr(e=>e.projects),[n,r]=(0,v.useState)([]),[i,a]=(0,v.useState)(!0),[o,s]=(0,v.useState)(void 0),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),m=(0,v.useCallback)(async()=>{e(void 0),a(!0);try{let{webhooks:e}=await L.listWebhooks();r(e)}catch(t){e(t instanceof N?t.code:t.message)}finally{a(!1)}},[e]);(0,v.useEffect)(()=>{m()},[m]);let h=async()=>{if(o===void 0)return;let t=Array.from(o.events);if(o.name.trim().length===0){e(`name_required`);return}if(o.url.trim().length===0){e(`url_required`);return}if(t.length===0){e(`no_events`);return}l(!0),e(void 0);try{let e={name:o.name.trim(),url:o.url.trim(),events:t,scope:o.scope,enabled:o.enabled};o.secret.length>0&&(e.secret=o.secret);let n=IM(o.headersText);if(n!==void 0&&(e.headers=n),o.insecureTls&&(e.insecureTls=!0),o.id===void 0)await L.createWebhook(e);else{let t={name:e.name,url:e.url,events:e.events,scope:e.scope,enabled:o.enabled,headers:n??{},insecureTls:o.insecureTls};o.secret.length>0&&(t.secret=o.secret),await L.updateWebhook(o.id,t)}s(void 0),await m()}catch(t){e(t instanceof N?`${t.code}: ${t.message??``}`:t.message)}finally{l(!1)}},g=async t=>{e(void 0);try{await L.deleteWebhook(t),d(void 0),await m()}catch(t){e(t instanceof N?t.code:t.message)}},_=async t=>{e(void 0);try{await L.testWebhook(t),p(t)}catch(t){e(t instanceof N?t.code:t.message)}};return i?(0,R.jsx)(`p`,{className:`px-4 py-6 text-sm text-neutral-400`,children:`Loading…`}):(0,R.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`p`,{className:`text-sm text-neutral-400`,children:[`Webhooks fire HTTP POSTs to URLs you configure when agent or session events happen. Useful for Slack notifications, CI integrations, audit logs, etc. Stored at`,` `,(0,R.jsx)(`code`,{className:`font-mono text-xs`,children:`$FORGE_DATA_DIR/webhooks.json`}),`.`]}),o===void 0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(PM()),className:`shrink-0 rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900`,children:`+ New webhook`})]}),o!==void 0&&(0,R.jsx)(RM,{draft:o,projects:t.map(e=>({id:e.id,name:e.name})),submitting:c,onChange:s,onCancel:()=>s(void 0),onSave:()=>void h()}),n.length===0?(0,R.jsx)(`p`,{className:`rounded border border-dashed border-neutral-700 px-4 py-6 text-center text-sm italic text-neutral-500`,children:`No webhooks configured.`}):(0,R.jsx)(`ul`,{className:`space-y-2`,children:n.map(e=>(0,R.jsx)(zM,{webhook:e,projects:t.map(e=>({id:e.id,name:e.name})),isPendingDelete:u===e.id,isExpanded:f===e.id,onArmDelete:()=>d(e.id),onCancelDelete:()=>d(void 0),onConfirmDelete:()=>void g(e.id),onEdit:()=>s(FM(e)),onTest:()=>void _(e.id),onToggleDeliveries:()=>p(t=>t===e.id?void 0:e.id)},e.id))})]})}function RM({draft:e,projects:t,submitting:n,onChange:r,onCancel:i,onSave:a}){let o=e.id!==void 0,s=t=>r({...e,...t}),c=t=>{let n=new Set(e.events);n.has(t)?n.delete(t):n.add(t),s({events:n})};return(0,R.jsxs)(`div`,{className:`space-y-3 rounded-md border border-neutral-700 bg-neutral-950 p-3`,children:[(0,R.jsx)(`header`,{className:`text-xs uppercase tracking-wider text-neutral-400`,children:o?`Edit webhook`:`New webhook`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`Name`}),(0,R.jsx)(`input`,{value:e.name,onChange:e=>s({name:e.target.value}),placeholder:`my-slack-channel`,disabled:n,className:`w-full rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-sm outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`URL (HTTPS only)`}),(0,R.jsx)(`input`,{value:e.url,onChange:e=>s({url:e.target.value}),placeholder:`https://hooks.slack.com/...`,disabled:n,className:`w-full rounded border border-neutral-700 bg-neutral-900 px-2 py-1 font-mono text-xs outline-none focus:border-neutral-500`})]})]}),(0,R.jsxs)(`fieldset`,{className:`space-y-1`,children:[(0,R.jsx)(`legend`,{className:`text-xs text-neutral-300`,children:`Events`}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-1 sm:grid-cols-2`,children:Ln.map(t=>(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-neutral-800 px-2 py-1.5 hover:border-neutral-600`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.events.has(t),onChange:()=>c(t),disabled:n,className:`mt-0.5`}),(0,R.jsxs)(`span`,{className:`flex flex-col text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-200`,children:NM[t]}),(0,R.jsx)(`code`,{className:`font-mono text-[10px] text-neutral-500`,children:t})]})]},t))})]}),(0,R.jsxs)(`fieldset`,{className:`space-y-1`,children:[(0,R.jsx)(`legend`,{className:`text-xs text-neutral-300`,children:`Scope`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`input`,{type:`radio`,checked:e.scope.kind===`global`,onChange:()=>s({scope:{kind:`global`}}),disabled:n}),(0,R.jsx)(`span`,{children:`Global (every project)`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`input`,{type:`radio`,checked:e.scope.kind===`project`,onChange:()=>s({scope:{kind:`project`,projectId:t[0]?.id??``}}),disabled:n||t.length===0}),(0,R.jsx)(`span`,{children:`Specific project:`}),(0,R.jsx)(`select`,{value:e.scope.kind===`project`?e.scope.projectId:``,onChange:e=>s({scope:{kind:`project`,projectId:e.target.value}}),disabled:n||e.scope.kind!==`project`,className:`rounded border border-neutral-700 bg-neutral-900 px-2 py-0.5`,children:t.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))})]})]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-xs text-neutral-300`,children:[`HMAC secret (optional)`,` `,o&&(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`— leave blank to keep the existing secret`})]}),(0,R.jsx)(`input`,{type:`password`,value:e.secret,onChange:e=>s({secret:e.target.value}),placeholder:o?`(unchanged)`:`shared secret for X-Pi-Forge-Signature`,disabled:n,className:`w-full rounded border border-neutral-700 bg-neutral-900 px-2 py-1 font-mono text-xs outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-xs text-neutral-300`,children:[`Custom headers (optional, one per line, `,(0,R.jsx)(`code`,{children:`Name: value`}),`)`]}),(0,R.jsx)(`textarea`,{rows:3,value:e.headersText,onChange:e=>s({headersText:e.target.value}),placeholder:`Authorization: Bearer xxx
|
|
361
361
|
X-Custom: value`,disabled:n,className:`w-full rounded border border-neutral-700 bg-neutral-900 px-2 py-1 font-mono text-xs outline-none focus:border-neutral-500`}),o&&(0,R.jsxs)(`span`,{className:`block text-[11px] text-neutral-500`,children:[`Stored values are masked as `,(0,R.jsx)(`code`,{className:`font-mono`,children:`***REDACTED***`}),` for safety. Leave any line with the sentinel intact to keep the original value; replace it to update; delete the line to remove the header.`]})]}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-amber-900/40 bg-amber-950/30 px-2 py-1.5 text-xs light:border-amber-300 light:bg-amber-50`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.insecureTls,onChange:e=>s({insecureTls:e.target.checked}),disabled:n,className:`mt-0.5`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`text-amber-200 light:text-amber-800`,children:`Allow self-signed / invalid TLS certificate`}),(0,R.jsx)(`br`,{}),(0,R.jsx)(`span`,{className:`text-[11px] text-amber-300/70 light:text-amber-700/80`,children:`⚠ Disables MITM protection. Use only for internal hosts with known self-signed certs. Every fire logs to stderr so the relaxed security is visible in operator logs.`})]})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:e=>s({enabled:e.target.checked}),disabled:n}),(0,R.jsx)(`span`,{children:`Enabled (disable to pause without losing config)`})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,className:`rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:bg-neutral-800 disabled:opacity-50`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:a,disabled:n,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 disabled:opacity-50`,children:n?`Saving…`:o?`Save changes`:`Create webhook`})]})]})}function zM({webhook:e,projects:t,isPendingDelete:n,isExpanded:r,onArmDelete:i,onCancelDelete:a,onConfirmDelete:o,onEdit:s,onTest:c,onToggleDeliveries:l}){let u=e.scope.kind===`global`?`Global`:`Project: ${t.find(t=>t.id===e.scope.kind&&t.id===e.scope.projectId)?.name??e.scope.projectId}`;return(0,R.jsxs)(`li`,{className:`rounded-md border ${e.enabled?`border-neutral-800`:`border-neutral-800/60 opacity-60`} bg-neutral-900`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:l,className:`mt-0.5 text-neutral-500 hover:text-neutral-300`,"aria-label":r?`Hide deliveries`:`Show recent deliveries`,children:r?(0,R.jsx)(Se,{size:14}):(0,R.jsx)(we,{size:14})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-medium text-neutral-100`,children:e.name}),(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${e.enabled?`bg-emerald-900/40 text-emerald-300`:`bg-neutral-800 text-neutral-400`}`,children:e.enabled?`enabled`:`disabled`}),(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-300`,children:u}),e.hasSecret&&(0,R.jsx)(`span`,{className:`rounded bg-sky-900/40 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-sky-300`,children:`signed`}),e.insecureTls===!0&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-amber-300`,title:`TLS cert validation disabled for this webhook`,children:`insecure TLS`})]}),(0,R.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-neutral-500`,children:e.url}),(0,R.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-500`,children:e.events.join(` · `)})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:c,className:`rounded border border-neutral-700 px-2 py-1 text-[11px] text-neutral-300 hover:bg-neutral-800`,title:`Fire a synthetic webhook.test event at this webhook`,children:[(0,R.jsx)(Qe,{size:12,className:`mr-1 inline`}),`Test`]}),(0,R.jsx)(`button`,{type:`button`,onClick:s,className:`rounded border border-neutral-700 px-2 py-1 text-[11px] text-neutral-300 hover:bg-neutral-800`,children:`Edit`}),n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:o,className:`rounded bg-red-700 px-2 py-1 text-[11px] font-medium text-red-50`,children:`Confirm`}),(0,R.jsx)(`button`,{type:`button`,onClick:a,className:`rounded border border-neutral-700 px-2 py-1 text-[11px] text-neutral-300 hover:bg-neutral-800`,children:`Cancel`})]}):(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`rounded border border-neutral-700 px-2 py-1 text-[11px] text-red-300 hover:bg-red-900/40`,title:`Delete this webhook`,"aria-label":`Delete this webhook`,children:(0,R.jsx)(tt,{size:12})})]})]}),r&&(0,R.jsx)(BM,{webhookId:e.id})]})}function BM({webhookId:e}){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!0),[a,o]=(0,v.useState)(),s=(0,v.useCallback)(async()=>{i(!0),o(void 0);try{let{deliveries:t}=await L.listWebhookDeliveries(e);n(t)}catch(e){o(e instanceof N?e.code:e.message)}finally{i(!1)}},[e]);return(0,v.useEffect)(()=>{s();let e=window.setInterval(()=>void s(),3e3);return()=>window.clearInterval(e)},[s]),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 bg-neutral-950 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,R.jsxs)(`span`,{className:`text-[11px] uppercase tracking-wider text-neutral-500`,children:[`Recent deliveries `,t.length>0&&`(${t.length})`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void s(),className:`rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-300 hover:bg-neutral-800`,children:`Refresh`})]}),r&&(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Loading…`}),a!==void 0&&(0,R.jsx)(`p`,{className:`text-xs text-red-400`,children:a}),!r&&a===void 0&&t.length===0&&(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`No deliveries yet.`}),t.length>0&&(0,R.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,R.jsxs)(`li`,{className:`grid grid-cols-12 items-baseline gap-2 rounded bg-neutral-900 px-2 py-1 font-mono text-[10px]`,children:[(0,R.jsxs)(`span`,{className:`col-span-2 ${e.status===`delivered`?`text-emerald-400`:e.status===`failed`?`text-red-400`:`text-amber-400`}`,children:[e.status,e.statusCode===void 0?``:` ${e.statusCode}`]}),(0,R.jsx)(`span`,{className:`col-span-2 text-neutral-400`,children:e.event}),(0,R.jsxs)(`span`,{className:`col-span-1 text-neutral-500`,children:[`a`,e.attempt]}),(0,R.jsxs)(`span`,{className:`col-span-2 text-neutral-500`,children:[e.durationMs,`ms`]}),(0,R.jsx)(`span`,{className:`col-span-5 truncate text-neutral-500`,title:e.errorPreview??``,children:e.errorPreview??new Date(e.requestedAt).toLocaleString()})]},e.id))})]})}function VM({onClose:e,initialTab:t}){let n=ji(e=>e.minimal),r=(0,v.useMemo)(()=>n?[`skills`,`prompts`,`systemPrompt`,`tools`,`sandbox`,`quickActions`,`appearance`,`backup`,`general`]:[`providers`,`agent`,`mcp`,`tools`,`sandbox`,`skills`,`prompts`,`systemPrompt`,`quickActions`,`webhooks`,`appearance`,`backup`,`general`],[n]),[i,a]=(0,v.useState)(t??(n?`skills`:`providers`));(0,v.useEffect)(()=>{r.includes(i)||a(r[0])},[r,i]),(0,v.useEffect)(()=>{t!==void 0&&r.includes(t)&&a(t)},[t,r]);let[o,s]=(0,v.useState)(void 0);return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8`,onClick:e,children:(0,R.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`flex h-full max-h-[720px] w-full max-w-[88rem] flex-col overflow-hidden rounded-lg border border-neutral-800 bg-neutral-950 shadow-2xl`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-neutral-800 px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`-mx-1 min-w-0 flex-1 overflow-x-auto px-1`,children:(0,R.jsx)(`div`,{className:`flex min-w-max items-center gap-1`,children:r.map(e=>(0,R.jsx)(`button`,{onClick:()=>a(e),className:`shrink-0 whitespace-nowrap rounded px-3 py-1 text-xs ${i===e?`bg-neutral-800 text-neutral-100`:`text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`}`,children:e===`providers`?`Providers`:e===`agent`?`Agent`:e===`mcp`?`MCP`:e===`tools`?`Tools`:e===`sandbox`?`Sandbox`:e===`skills`?`Skills`:e===`prompts`?`Prompts`:e===`systemPrompt`?`System Prompt`:e===`quickActions`?`Quick Actions`:e===`webhooks`?`Webhooks`:e===`appearance`?`Appearance`:e===`backup`?`Backup`:`General`},e))})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>{let e=Ht(),t=e===void 0?`/api/docs`:`/api/docs?token=${encodeURIComponent(e.token)}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,title:`Open the OpenAPI / Swagger UI in a new tab. Carries your auth token automatically.`,children:`API Docs ↗`}),(0,R.jsx)(`button`,{onClick:e,className:`rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,title:`Close (Esc)`,children:`Close`})]})]}),o!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-4 py-2 text-xs text-red-300`,children:o}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto px-4 py-3 text-sm text-neutral-200`,children:[i===`providers`&&(0,R.jsx)(UM,{onError:s}),i===`agent`&&(0,R.jsx)(GM,{onError:s}),i===`mcp`&&(0,R.jsx)(CN,{onError:s}),i===`tools`&&(0,R.jsx)(oN,{onError:s}),i===`sandbox`&&(0,R.jsx)(aN,{onError:s}),i===`skills`&&(0,R.jsx)(QM,{onError:s}),i===`prompts`&&(0,R.jsx)($M,{onError:s}),i===`systemPrompt`&&(0,R.jsx)(cN,{onError:s}),i===`quickActions`&&(0,R.jsx)(uN,{onError:s}),i===`webhooks`&&(0,R.jsx)(LM,{onError:s}),i===`appearance`&&(0,R.jsx)(dN,{}),i===`backup`&&(0,R.jsx)(yN,{onError:s}),i===`general`&&(0,R.jsx)(AN,{})]})]})})}function HM(e){return e instanceof N?e.code:e.message}function UM({onError:e}){let[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(void 0),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),d=async()=>{e(void 0);try{let[e,t]=await Promise.all([L.getProviders(),L.getAuthSummary()]);n(e),i(t)}catch(t){e(`Failed to load providers: ${HM(t)}`)}};(0,v.useEffect)(()=>{d()},[]);let f=async t=>{if(s.trim().length!==0){u(!0);try{await L.setApiKey(t,s.trim()),o(void 0),c(``),await d()}catch(t){e(`Save key failed: ${HM(t)}`)}finally{u(!1)}}},p=async t=>{if(confirm(`Remove the stored key for "${t}"?`)){u(!0);try{await L.removeApiKey(t),await d()}catch(t){e(`Remove key failed: ${HM(t)}`)}finally{u(!1)}}};return t===void 0?(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Loading providers…`}):(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Built-in providers and anything in `,(0,R.jsx)(`code`,{className:`font-mono`,children:`models.json`}),`. Stored API keys are presence-only — actual values are never sent to the browser.`]}),t.providers.length===0&&(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`No providers configured.`}),t.providers.map(e=>{let t=r?.providers[e.provider],n=t?.configured===!0,i=a===e.provider;return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 bg-neutral-900/40 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-sm text-neutral-100`,children:e.provider}),(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${n?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:`bg-neutral-800 text-neutral-500`}`,children:n?`key set`:`no key`}),t?.source!==void 0&&(0,R.jsxs)(`span`,{className:`text-[10px] text-neutral-500`,children:[`via `,t.source]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[!i&&(0,R.jsx)(`button`,{onClick:()=>{o(e.provider),c(``)},className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:n?`Replace key`:`Add key`}),n&&!i&&(0,R.jsx)(`button`,{onClick:()=>void p(e.provider),disabled:l,className:`rounded border border-red-700/50 px-2 py-0.5 text-red-300 hover:bg-red-900/20 disabled:opacity-50`,children:`Remove`})]})]}),i&&(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:`Paste API key`,autoFocus:!0,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>void f(e.provider),disabled:l||s.trim().length===0,className:`rounded bg-neutral-100 px-2 py-1 text-xs font-medium text-neutral-900 disabled:opacity-50`,children:`Save`}),(0,R.jsx)(`button`,{onClick:()=>{o(void 0),c(``)},className:`rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300`,children:`Cancel`})]}),(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-[11px] text-neutral-500 light:text-neutral-600`,children:[e.models.length,` model`,e.models.length===1?``:`s`]}),(0,R.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-[11px]`,children:e.models.map(e=>(0,R.jsxs)(`li`,{className:`flex justify-between font-mono`,children:[(0,R.jsx)(`span`,{className:e.hasAuth?`text-neutral-300`:`text-neutral-600 light:text-neutral-400`,children:e.name}),(0,R.jsxs)(`span`,{className:`text-neutral-600 light:text-neutral-400`,children:[`ctx `,Math.round(e.contextWindow/1e3),`k`]})]},e.id))})]})]},e.provider)}),(0,R.jsx)(WM,{onError:e})]})}function WM({onError:e}){let[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0);JM(a,()=>o(void 0));let s=async()=>{try{let e=await L.getModelsJson();n(JSON.stringify(e,null,2))}catch(t){e(`Load models.json failed: ${HM(t)}`)}},c=async()=>{if(t===void 0)return;let n;try{n=JSON.parse(t)}catch{e(`models.json: invalid JSON`);return}if(typeof n!=`object`||!n||typeof n.providers!=`object`||n.providers===null){e(`models.json: top-level must be { "providers": { ... } }`);return}i(!0),o(void 0);try{await L.setModelsJson(n),e(void 0),o(Date.now())}catch(t){e(`Save failed: ${HM(t)}`)}finally{i(!1)}};return(0,R.jsxs)(`details`,{className:`rounded border border-neutral-800 bg-neutral-900/40 p-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-xs text-neutral-300`,onClick:()=>{t===void 0&&s()},children:`Custom providers (models.json)`}),(0,R.jsx)(`p`,{className:`mt-1 text-[11px] text-neutral-500`,children:`Raw JSON editor. Add vLLM / LiteLLM / Ollama / OpenAI-compatible endpoints here. The SDK validates on next session creation.`}),t===void 0?(0,R.jsx)(`p`,{className:`mt-2 text-xs italic text-neutral-500`,children:`Loading…`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`textarea`,{value:t,onChange:e=>n(e.target.value),spellCheck:!1,rows:10,className:`mt-2 w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 text-xs`,children:[a!==void 0&&(0,R.jsx)(`span`,{className:`text-emerald-400 light:text-emerald-700`,"aria-live":`polite`,children:`Saved`}),(0,R.jsx)(`button`,{onClick:()=>void s(),disabled:r,className:`rounded border border-neutral-700 px-2 py-1 text-neutral-300`,children:`Reload`}),(0,R.jsx)(`button`,{onClick:()=>void c(),disabled:r,className:`rounded bg-neutral-100 px-3 py-1 font-medium text-neutral-900 disabled:opacity-50`,children:r?`Saving…`:`Save`})]})]})]})}function GM({onError:e}){let[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(`form`),s=async()=>{e(void 0);try{n(await L.getSettings())}catch(t){e(`Failed to load settings: ${HM(t)}`)}};(0,v.useEffect)(()=>{s()},[]);let c=e=>{if(t===void 0)return``;let n=t[e];return typeof n==`string`?n:``},l=async t=>{i(!0);try{n(await L.updateSettings(t))}catch(t){e(`Save failed: ${HM(t)}`)}finally{i(!1)}};return t===void 0?(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Loading settings…`}):a===`json`?(0,R.jsx)(KM,{initial:t,onSave:async r=>{let a={...r};for(let e of Object.keys(t))e in r||(a[e]=null);i(!0);try{n(await L.updateSettings(a)),e(void 0)}catch(t){throw e(`Save failed: ${HM(t)}`),t}finally{i(!1)}},onSwitchToForm:()=>o(`form`),busy:r,onError:e}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Defaults for new sessions. The form covers common keys; switch to JSON to edit anything the SDK accepts.`}),(0,R.jsx)(`button`,{onClick:()=>o(`json`),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500`,children:`Edit as JSON`})]}),(0,R.jsx)(YM,{label:`Default provider`,hint:`e.g. anthropic, openai, google, custom`,children:(0,R.jsx)(XM,{value:c(`defaultProvider`),onSave:e=>l({defaultProvider:e.length===0?null:e}),disabled:r})}),(0,R.jsx)(YM,{label:`Default model`,hint:`model id from the chosen provider`,children:(0,R.jsx)(XM,{value:c(`defaultModel`),onSave:e=>l({defaultModel:e.length===0?null:e}),disabled:r})}),(0,R.jsx)(YM,{label:`Thinking level`,hint:`off, low, medium, high (provider-dependent)`,children:(0,R.jsx)(ZM,{value:c(`defaultThinkingLevel`),options:[``,`off`,`low`,`medium`,`high`],onSave:e=>l({defaultThinkingLevel:e.length===0?null:e}),disabled:r})})]})}function KM({initial:e,onSave:t,onSwitchToForm:n,busy:r,onError:i}){let[a,o]=(0,v.useState)(()=>JSON.stringify(e,null,2)),[s,c]=(0,v.useState)(void 0);JM(s,()=>c(void 0));let l=async()=>{let e;try{e=JSON.parse(a)}catch{i(`settings.json: invalid JSON`);return}if(typeof e!=`object`||!e||Array.isArray(e)){i(`settings.json: top-level must be an object`);return}c(void 0);try{await t(e),c(Date.now())}catch{}};return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`p`,{className:`text-[11px] text-neutral-500`,children:[`Raw `,(0,R.jsx)(`code`,{className:`font-mono`,children:`settings.json`}),`. Keys removed here are deleted on save (mapped to `,(0,R.jsx)(`code`,{className:`font-mono`,children:`null`}),` in the merge patch). The SDK validates on next session creation.`]}),(0,R.jsx)(`button`,{onClick:n,className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500`,children:`Back to form`})]}),(0,R.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),spellCheck:!1,rows:18,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[s!==void 0&&(0,R.jsx)(`span`,{className:`text-emerald-400 light:text-emerald-700`,"aria-live":`polite`,children:`Saved`}),(0,R.jsx)(`button`,{onClick:()=>o(JSON.stringify(e,null,2)),disabled:r,className:`rounded border border-neutral-700 px-2 py-1 text-neutral-300`,children:`Reset`}),(0,R.jsx)(`button`,{onClick:()=>void l(),disabled:r,className:`rounded bg-neutral-100 px-3 py-1 font-medium text-neutral-900 disabled:opacity-50`,children:r?`Saving…`:`Save`})]})]})}var qM=2500;function JM(e,t){(0,v.useEffect)(()=>{if(e===void 0)return;let n=window.setTimeout(t,qM);return()=>window.clearTimeout(n)},[e,t])}function YM({label:e,hint:t,children:n}){return(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`label`,{className:`block text-xs font-medium text-neutral-200`,children:e}),t!==void 0&&(0,R.jsx)(`p`,{className:`text-[11px] text-neutral-500`,children:t}),n]})}function XM({value:e,onSave:t,disabled:n}){let[r,i]=(0,v.useState)(e);return(0,v.useEffect)(()=>i(e),[e]),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),disabled:n,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>void t(r),disabled:n||r===e,className:`rounded bg-neutral-100 px-2 py-1 text-xs font-medium text-neutral-900 disabled:opacity-50`,children:`Save`})]})}function ZM({value:e,options:t,onSave:n,disabled:r}){return(0,R.jsx)(`select`,{value:e,disabled:r,onChange:e=>void n(e.target.value),className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100`,children:t.map(e=>(0,R.jsx)(`option`,{value:e,children:e.length===0?`(unset)`:e},e))})}function QM({onError:e}){let t=Sr(),n=xr(e=>e.projects),[r,i]=(0,v.useState)(void 0),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)({}),[d,f]=(0,v.useState)(!1),p=async()=>{if(t!==void 0){e(void 0);try{let[{skills:e,diagnostics:n},r]=await Promise.all([L.listSkills(t.id),L.listSkillOverrides()]);i(e),o(n),c(r.projects)}catch(t){e(`Failed to load skills: ${HM(t)}`)}}};if((0,v.useEffect)(()=>{p()},[t?.id]),t===void 0)return(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Pick a project from the header to manage its skills.`});if(r===void 0)return(0,R.jsxs)(`p`,{className:`text-xs italic text-neutral-500`,children:[`Loading skills for `,t.name,`…`]});let m=async(n,r)=>{f(!0);try{let{skills:e}=await L.setSkillEnabled(t.id,n,r,`global`);i(e)}catch(t){e(`Toggle failed: ${HM(t)}`)}finally{f(!1)}},h=async(t,n,r)=>{f(!0);try{r===void 0?await L.clearSkillProjectOverride(t,n):await L.setSkillEnabled(t,n,r===`enabled`,`project`),await p()}catch(t){e(`Override write failed: ${HM(t)}`)}finally{f(!1)}},g=(e,t)=>{let n=s[e];if(n!==void 0){if(n.enable.includes(t))return`enabled`;if(n.disable.includes(t))return`disabled`}};return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Skills discovered in `,(0,R.jsx)(`code`,{className:`font-mono`,children:`~/.pi/agent/skills/`}),` and`,` `,(0,R.jsxs)(`code`,{className:`font-mono`,children:[t.path,`/.pi/skills/`]}),`. The global toggle writes to pi's `,(0,R.jsx)(`code`,{className:`font-mono`,children:`settings.skills`}),`; per-project overrides write to the pi-forge-private file at`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:"${FORGE_DATA_DIR}/skills-overrides.json"}),`.`]}),(0,R.jsxs)(`div`,{className:`rounded border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-[11px] text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[`Skill changes apply to the `,(0,R.jsx)(`strong`,{children:`next session`}),` you start in the affected project. Live sessions keep the skill set they booted with — start a new session to use a freshly enabled skill.`]}),a.length>0&&(0,R.jsx)(eN,{diagnostics:a}),r.length===0&&(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`No skills found for this project.`}),r.map(e=>{let r=`${e.source}:${e.name}`,i=l[r]===!0,a=n.map(t=>({project:t,state:g(t.id,e.name)})).filter(e=>e.state!==void 0),o=n.filter(t=>g(t.id,e.name)===void 0);return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 bg-neutral-900/40`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 inline-block h-2.5 w-2.5 rounded-full ${e.effective?`bg-emerald-500`:`bg-neutral-700`}`,title:`Effective for ${t.name}: ${e.effective?`enabled`:`disabled`}`}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-100`,children:e.name}),(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-400`,children:e.source}),e.projectOverride!==void 0&&(0,R.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${e.projectOverride===`enabled`?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:`bg-red-900/40 text-red-300 light:bg-red-100 light:text-red-800`}`,title:`Active project ('${t.name}') has an override`,children:[`Project: `,e.projectOverride]})]}),(0,R.jsx)(`p`,{className:`text-xs text-neutral-400`,children:e.description||`(no description)`}),(0,R.jsx)(`p`,{className:`font-mono text-[10px] text-neutral-600`,children:e.filePath})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs`,children:[(0,R.jsxs)(`button`,{onClick:()=>void m(e.name,!e.enabled),disabled:d,className:`rounded border px-2 py-0.5 ${e.enabled?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Global enable in pi's settings.skills`,children:[`Global: `,e.enabled?`enabled`:`disabled`]}),(0,R.jsx)(`button`,{onClick:()=>u(e=>({...e,[r]:!i})),className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,title:`Show per-project overrides`,children:i?`▾ Overrides`:`▸ Overrides (${a.length})`})]})]}),i&&(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 px-3 py-2`,children:[a.length===0?(0,R.jsx)(`p`,{className:`mb-2 text-[11px] italic text-neutral-500`,children:`No project overrides yet — every project inherits the global state.`}):(0,R.jsx)(`div`,{className:`mb-2 space-y-1`,children:a.map(({project:t,state:n})=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded bg-neutral-900/60 px-2 py-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`truncate text-neutral-200`,title:t.path,children:t.name}),(0,R.jsx)(tN,{value:n,disabled:d,onChange:n=>void h(t.id,e.name,n)})]},t.id))}),o.length>0&&(0,R.jsx)(nN,{projects:o,disabled:d,onAdd:(t,n)=>void h(t,e.name,n)})]})]},r)})]})}function $M({onError:e}){let t=Sr(),n=xr(e=>e.projects),r=qj(e=>e.bumpPromptsRefresh),[i,a]=(0,v.useState)(void 0),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)({}),[u,d]=(0,v.useState)({}),[f,p]=(0,v.useState)(!1),m=async()=>{if(t!==void 0){e(void 0);try{let[{prompts:e,diagnostics:n},r]=await Promise.all([L.listPrompts(t.id),L.listPromptOverrides()]);a(e),s(n),l(r.projects)}catch(t){e(`Failed to load prompts: ${HM(t)}`)}}};if((0,v.useEffect)(()=>{m()},[t?.id]),t===void 0)return(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Pick a project from the header to manage its prompts.`});if(i===void 0)return(0,R.jsxs)(`p`,{className:`text-xs italic text-neutral-500`,children:[`Loading prompts for `,t.name,`…`]});let h=async(n,i)=>{p(!0);try{let{prompts:e}=await L.setPromptEnabled(t.id,n,i,`global`);a(e),r()}catch(t){e(`Toggle failed: ${HM(t)}`)}finally{p(!1)}},g=async(t,n,i)=>{p(!0);try{i===void 0?await L.clearPromptProjectOverride(t,n):await L.setPromptEnabled(t,n,i===`enabled`,`project`),await m(),r()}catch(t){e(`Override write failed: ${HM(t)}`)}finally{p(!1)}},_=(e,t)=>{let n=c[e];if(n!==void 0){if(n.enable.includes(t))return`enabled`;if(n.disable.includes(t))return`disabled`}};return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Pi prompt templates discovered in `,(0,R.jsx)(`code`,{className:`font-mono`,children:`~/.pi/agent/prompts/`}),` `,`and `,(0,R.jsxs)(`code`,{className:`font-mono`,children:[t.path,`/.pi/prompts/`]}),`. Invoke from the chat input via `,(0,R.jsx)(`code`,{className:`font-mono`,children:`/<name>`}),`; the global toggle writes to pi's `,(0,R.jsx)(`code`,{className:`font-mono`,children:`settings.prompts`}),`; per-project overrides write to `,(0,R.jsx)(`code`,{className:`font-mono`,children:"${FORGE_DATA_DIR}/prompts-overrides.json"}),`.`]}),(0,R.jsxs)(`div`,{className:`rounded border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-[11px] text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[`Prompt changes apply to the `,(0,R.jsx)(`strong`,{children:`next session`}),` you start in the affected project. Live sessions keep the prompt set they booted with — start a new session to use a freshly enabled prompt.`]}),o.length>0&&(0,R.jsx)(eN,{diagnostics:o}),i.length===0&&(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`No prompts found for this project.`}),i.map(e=>{let r=`${e.source}:${e.name}`,i=u[r]===!0,a=n.map(t=>({project:t,state:_(t.id,e.name)})).filter(e=>e.state!==void 0),o=n.filter(t=>_(t.id,e.name)===void 0);return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 bg-neutral-900/40`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 inline-block h-2.5 w-2.5 rounded-full ${e.effective?`bg-emerald-500`:`bg-neutral-700`}`,title:`Effective for ${t.name}: ${e.effective?`enabled`:`disabled`}`}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-neutral-100`,children:[`/`,e.name]}),(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-400`,children:e.source}),e.argumentHint!==void 0&&(0,R.jsx)(`span`,{className:`rounded bg-neutral-800/60 px-1.5 py-0.5 font-mono text-[10px] text-neutral-300`,title:`Argument hint from the prompt's frontmatter`,children:e.argumentHint}),e.projectOverride!==void 0&&(0,R.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${e.projectOverride===`enabled`?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:`bg-red-900/40 text-red-300 light:bg-red-100 light:text-red-800`}`,title:`Active project ('${t.name}') has an override`,children:[`Project: `,e.projectOverride]})]}),(0,R.jsx)(`p`,{className:`text-xs text-neutral-400`,children:e.description||`(no description)`}),(0,R.jsx)(`p`,{className:`font-mono text-[10px] text-neutral-600`,children:e.filePath})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs`,children:[(0,R.jsxs)(`button`,{onClick:()=>void h(e.name,!e.enabled),disabled:f,className:`rounded border px-2 py-0.5 ${e.enabled?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Global enable in pi's settings.prompts`,children:[`Global: `,e.enabled?`enabled`:`disabled`]}),(0,R.jsx)(`button`,{onClick:()=>d(e=>({...e,[r]:!i})),className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,title:`Show per-project overrides`,children:i?`▾ Overrides`:`▸ Overrides (${a.length})`})]})]}),i&&(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 px-3 py-2`,children:[a.length===0?(0,R.jsx)(`p`,{className:`mb-2 text-[11px] italic text-neutral-500`,children:`No project overrides yet — every project inherits the global state.`}):(0,R.jsx)(`div`,{className:`mb-2 space-y-1`,children:a.map(({project:t,state:n})=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded bg-neutral-900/60 px-2 py-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`truncate text-neutral-200`,title:t.path,children:t.name}),(0,R.jsx)(tN,{value:n,disabled:f,onChange:n=>void g(t.id,e.name,n)})]},t.id))}),o.length>0&&(0,R.jsx)(nN,{projects:o,disabled:f,onAdd:(t,n)=>void g(t,e.name,n)})]})]},r)})]})}function eN({diagnostics:e}){return(0,R.jsxs)(`div`,{className:`space-y-1 rounded border border-red-700/40 bg-red-900/10 px-3 py-2 text-[11px] text-red-200`,children:[(0,R.jsxs)(`p`,{className:`font-medium`,children:[e.length,` skill `,e.length===1?`file`:`files`,` were not loaded:`]}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,R.jsxs)(`li`,{className:`border-l-2 border-red-700/60 pl-2`,children:[(0,R.jsxs)(`div`,{className:`text-red-100`,children:[(0,R.jsx)(`span`,{className:`rounded bg-red-900/40 px-1 py-0.5 text-[10px] uppercase tracking-wider text-red-300`,children:e.type}),` `,e.message]}),e.collision!==void 0&&(0,R.jsxs)(`div`,{className:`mt-0.5 font-mono text-[10px] text-red-300/80`,children:[(0,R.jsxs)(`div`,{children:[`loser:\xA0\xA0`,(0,R.jsx)(`span`,{className:`text-red-200`,children:e.collision.loserPath})]}),(0,R.jsxs)(`div`,{children:[`winner:\xA0`,(0,R.jsx)(`span`,{className:`text-red-200`,children:e.collision.winnerPath})]}),(0,R.jsxs)(`div`,{className:`mt-1 text-red-300/70`,children:[`Add `,(0,R.jsxs)(`code`,{className:`rounded bg-red-900/40 px-1`,children:[`name: `,`<unique>`]}),` to the loser's frontmatter, or move it to`,` `,(0,R.jsx)(`code`,{className:`rounded bg-red-900/40 px-1`,children:`<unique>/SKILL.md`}),` so the parent dir name disambiguates.`]})]}),e.collision===void 0&&e.path!==void 0&&(0,R.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-red-300/80`,children:e.path})]},t))})]})}function tN({value:e,disabled:t,onChange:n}){let r=(e,r,i)=>(0,R.jsx)(`button`,{onClick:()=>n(r),disabled:t,className:`rounded px-2 py-0.5 text-[11px] ${i?r===`enabled`?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:r===`disabled`?`bg-red-900/40 text-red-300 light:bg-red-100 light:text-red-800`:`bg-neutral-800 text-neutral-400`:`text-neutral-500 hover:bg-neutral-800 hover:text-neutral-300`}`,children:e});return(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded border border-neutral-700 px-0.5`,children:[r(`Inherit`,void 0,e===void 0),r(`Enabled`,`enabled`,e===`enabled`),r(`Disabled`,`disabled`,e===`disabled`)]})}function nN({projects:e,disabled:t,onAdd:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);return r?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[11px]`,children:[(0,R.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-0.5 text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:``,children:`Pick project…`}),e.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,R.jsx)(`button`,{onClick:()=>{a.length!==0&&(n(a,`enabled`),i(!1),o(``))},disabled:t||a.length===0,className:`rounded bg-emerald-900/40 px-2 py-0.5 text-emerald-300 disabled:opacity-50 light:bg-emerald-100 light:text-emerald-800`,children:`Enable here`}),(0,R.jsx)(`button`,{onClick:()=>{a.length!==0&&(n(a,`disabled`),i(!1),o(``))},disabled:t||a.length===0,className:`rounded bg-red-900/40 px-2 py-0.5 text-red-300 disabled:opacity-50`,children:`Disable here`}),(0,R.jsx)(`button`,{onClick:()=>{i(!1),o(``)},className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-400 hover:border-neutral-500`,children:`Cancel`})]}):(0,R.jsx)(`button`,{onClick:()=>i(!0),disabled:t,className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500`,children:`+ Add override for…`})}function rN(e){return Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({id:Pr(`sandbox-env`),name:e,value:t,revealed:!1}))}function iN(e){let t={};for(let[n,r]of e.entries()){let e=r.name.trim();if(!(e.length===0&&r.value.length===0)){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e))throw Error(`Row ${n+1}: invalid environment variable name`);t[e]=r.value}}return t}function aN({onError:e}){let[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!0),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;return o(!0),L.getSandboxSettings().then(r=>{t||(n(r),i(rN(r.toolEnv)),e(void 0))}).catch(n=>{t||e(HM(n))}).finally(()=>{t||o(!1)}),()=>{t=!0}},[e]);async function d(t){t.preventDefault(),u(!1);let a;try{a=iN(r)}catch(t){e(t instanceof Error?t.message:String(t));return}c(!0);try{let t=await L.updateSandboxSettings(a);n(t),i(rN(t.toolEnv)),e(void 0),u(!0)}catch(t){e(HM(t))}finally{c(!1)}}return(0,R.jsxs)(`form`,{onSubmit:e=>{d(e)},className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-neutral-100`,children:`Sandbox mode`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-neutral-400`,children:`Configure environment variables injected into future agent tool calls. Sandbox enablement, UID/GID, and tool HOME are deploy-time settings; changes here take effect for new or refreshed sessions.`})]}),(0,R.jsx)(`div`,{className:`rounded border border-neutral-800 bg-neutral-950 p-3 text-xs text-neutral-300`,children:a?(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`Loading sandbox settings…`}):t?.enabled?(0,R.jsxs)(`span`,{children:[`Enabled`,t.uid===void 0?``:` · uid ${t.uid}`,t.gid===void 0?``:` · gid ${t.gid}`,t.home===void 0?``:` · home ${t.home}`]}):(0,R.jsx)(`span`,{className:`text-amber-300`,children:`Sandbox tool overrides are disabled. Saved variables are persisted, but only injected into forge-managed tool shells; full filesystem sandboxing requires AGENT_TOOL_SANDBOX_ENABLED=true.`})}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-neutral-300`,children:`Tool environment`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{i(e=>[...e,{id:Pr(`sandbox-env`),name:``,value:``,revealed:!1}]),u(!1)},className:`rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:`Add variable`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[r.length===0&&(0,R.jsx)(`div`,{className:`rounded border border-dashed border-neutral-800 px-3 py-4 text-xs text-neutral-500`,children:`No sandbox tool environment variables configured.`}),r.map(e=>(0,R.jsxs)(`div`,{className:`grid gap-2 rounded border border-neutral-800 p-2 md:grid-cols-[minmax(0,1fr)_minmax(0,2fr)_auto_auto]`,children:[(0,R.jsx)(`input`,{value:e.name,onChange:t=>{let n=t.target.value;i(t=>t.map(t=>t.id===e.id?{...t,name:n}:t)),u(!1)},placeholder:`HTTP_PROXY`,spellCheck:!1,className:`rounded border border-neutral-800 bg-neutral-950 px-2 py-1 font-mono text-xs text-neutral-100 outline-none focus:border-neutral-600`,"aria-label":`Environment variable name`}),(0,R.jsx)(`input`,{value:e.value,onChange:t=>{let n=t.target.value;i(t=>t.map(t=>t.id===e.id?{...t,value:n}:t)),u(!1)},type:e.revealed?`text`:`password`,placeholder:`value`,spellCheck:!1,autoComplete:`off`,className:`rounded border border-neutral-800 bg-neutral-950 px-2 py-1 font-mono text-xs text-neutral-100 outline-none focus:border-neutral-600`,"aria-label":`Environment variable value`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(t=>t.map(t=>t.id===e.id?{...t,revealed:!t.revealed}:t)),className:`rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:e.revealed?`Hide`:`Reveal`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{i(t=>t.filter(t=>t.id!==e.id)),u(!1)},className:`rounded border border-red-900/60 px-2 py-1 text-xs text-red-300 hover:border-red-700`,children:`Remove`})]},e.id))]})]}),(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Values are masked by default and only revealed per row. They are still stored in pi-forge data and passed to tool processes, so avoid secrets unless that storage is protected.`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`button`,{type:`submit`,disabled:a||s,className:`rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-500 disabled:opacity-50`,children:s?`Saving…`:`Save sandbox env`}),l&&(0,R.jsx)(`span`,{className:`text-xs text-green-400`,children:`Saved`})]})]})}function oN({onError:e}){let t=xr(e=>e.projects),[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)(!1),c=async()=>{e(void 0);try{let[e,t]=await Promise.all([L.listTools(),L.listToolOverrides()]);r(e),a(t.projects)}catch(t){e(`Failed to load tools: ${HM(t)}`)}};(0,v.useEffect)(()=>{c()},[]);let l=async(t,n,r)=>{s(!0);try{await L.setToolEnabled(t,n,r,`global`),await c()}catch(t){e(`Toggle failed: ${HM(t)}`)}finally{s(!1)}},u=async(t,n,r,i)=>{s(!0);try{i===void 0?await L.clearToolProjectOverride(t,r,n):await L.setToolEnabled(t,r,i===`enabled`,`project`,n),await c()}catch(t){e(`Override write failed: ${HM(t)}`)}finally{s(!1)}};return n===void 0?(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Loading tools…`}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Toggle individual built-in tools the agent can call. The global toggle on the right is the default for every project. Use `,(0,R.jsx)(`strong`,{children:`Overrides`}),` to enable/disable a tool per project — explicit project overrides win over the global default. Changes apply to the next session — already-running sessions keep the tool set they started with. MCP server tools live under their respective server in the `,(0,R.jsx)(`strong`,{children:`MCP`}),` tab.`]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:`Built-in tools`}),(0,R.jsx)(`div`,{className:`space-y-2`,children:n.builtin.map(e=>(0,R.jsx)(sN,{family:`builtin`,name:e.name,fqn:e.name,description:e.description,globalEnabled:e.globalEnabled,projects:t,allOverrides:i,busy:o,onToggleGlobal:t=>void l(`builtin`,e.name,t),onSetProjectOverride:(t,n)=>void u(`builtin`,t,e.name,n)},`builtin:${e.name}`))})]}),n.extension.length>0&&(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:`Extension tools`}),(0,R.jsxs)(`p`,{className:`mb-2 text-[11px] text-neutral-500`,children:[`Tools registered programmatically by pi extensions installed under`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`~/.pi/agent/extensions/`}),` or a project's`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.pi/extensions/`}),`. Disabled tools are dropped from the allowlist passed to the next session — the extension itself remains loaded.`]}),(0,R.jsx)(`div`,{className:`space-y-4`,children:n.extension.map(e=>(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`text-[11px] font-semibold text-neutral-300`,children:[`Package: `,(0,R.jsx)(`code`,{className:`font-mono text-neutral-400`,children:e.packageSource})]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:e.tools.map(n=>(0,R.jsx)(sN,{family:`extension`,name:n.name,fqn:n.name,description:n.description,globalEnabled:n.globalEnabled,projects:t,allOverrides:i,busy:o,onToggleGlobal:e=>void l(`extension`,n.name,e),onSetProjectOverride:(e,t)=>void u(`extension`,e,n.name,t)},`extension:${e.packageSource}:${n.name}`))})]},e.packageSource))})]})]})}function sN({family:e,name:t,fqn:n,description:r,globalEnabled:i,projects:a,allOverrides:o,busy:s,onToggleGlobal:c,onSetProjectOverride:l}){let[u,d]=(0,v.useState)(!1),f=t=>{let r=o[t];if(r===void 0)return;let i=e===`builtin`?r.builtin:e===`mcp`?r.mcp:r.extension;if(i!==void 0){if(i.enable.includes(n))return`enabled`;if(i.disable.includes(n))return`disabled`}},p=a.map(e=>({project:e,state:f(e.id)})).filter(e=>e.state!==void 0),m=a.filter(e=>f(e.id)===void 0);return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 bg-neutral-900/40`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 inline-block h-2.5 w-2.5 rounded-full ${i?`bg-emerald-500`:`bg-neutral-700`}`,title:`Global default: ${i?`enabled`:`disabled`}`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-100`,children:t}),n!==t&&(0,R.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-500`,title:`Bridged tool name pi sees on the wire`,children:n})]}),r.length>0&&(0,R.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-neutral-500`,title:r,children:r})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs`,children:[(0,R.jsxs)(`button`,{onClick:()=>c(!i),disabled:s,className:`rounded border px-2 py-0.5 disabled:opacity-50 ${i?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Global default for every project that doesn't override`,children:[`Global: `,i?`enabled`:`disabled`]}),(0,R.jsx)(`button`,{onClick:()=>d(e=>!e),className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,title:`Show per-project overrides`,children:u?`▾ Overrides`:`▸ Overrides (${p.length})`})]})]}),u&&(0,R.jsxs)(`div`,{className:`border-t border-neutral-800 px-3 py-2`,children:[p.length===0?(0,R.jsx)(`p`,{className:`mb-2 text-[11px] italic text-neutral-500`,children:`No project overrides yet — every project inherits the global state.`}):(0,R.jsx)(`div`,{className:`mb-2 space-y-1`,children:p.map(({project:e,state:t})=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded bg-neutral-900/60 px-2 py-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`truncate text-neutral-200`,title:e.path,children:e.name}),(0,R.jsx)(tN,{value:t,disabled:s,onChange:t=>l(e.id,t)})]},e.id))}),m.length>0&&(0,R.jsx)(nN,{projects:m,disabled:s,onAdd:(e,t)=>l(e,t)}),a.length===0&&(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-500`,children:`No projects exist yet. Create a project first to add per-project overrides.`})]})]})}function cN({onError:e}){let t=Sr(),[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(2e4),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(void 0);if((0,v.useEffect)(()=>{if(t===void 0){r(void 0),a(``);return}let n=!1;return e(void 0),(async()=>{try{let e=await L.getProjectSystemPrompt(t.id);if(n)return;r(e.addendum),a(e.addendum),s(e.maxBytes)}catch(t){if(n)return;e(`Failed to load system prompt: ${HM(t)}`)}})(),()=>{n=!0}},[t?.id]),t===void 0)return(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Pick a project from the header to edit its system prompt addendum.`});if(n===void 0)return(0,R.jsxs)(`p`,{className:`text-xs italic text-neutral-500`,children:[`Loading system prompt for `,t.name,`…`]});let f=new Blob([i]).size,p=f>o,m=i!==n,h=async()=>{if(!p){l(!0),d(void 0),e(void 0);try{let e=await L.setProjectSystemPrompt(t.id,i);r(e.addendum),a(e.addendum),s(e.maxBytes),d(`Saved. Applies to the next session you start in this project.`),window.setTimeout(()=>d(void 0),4e3)}catch(t){e(`Save failed: ${HM(t)}`)}finally{l(!1)}}},g=async()=>{if(confirm(`Clear the system prompt addendum for "${t.name}"?`)){l(!0),d(void 0),e(void 0);try{let e=await L.setProjectSystemPrompt(t.id,``);r(e.addendum),a(e.addendum),s(e.maxBytes),d(`Cleared. Applies to the next session you start in this project.`),window.setTimeout(()=>d(void 0),4e3)}catch(t){e(`Clear failed: ${HM(t)}`)}finally{l(!1)}}};return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 text-xs text-neutral-400`,children:[(0,R.jsxs)(`p`,{children:[`Free-form text appended to the agent's base system prompt for sessions in`,` `,(0,R.jsx)(`strong`,{className:`text-neutral-200`,children:t.name}),`. Use this to layer project-specific behavior on top of pi's defaults — coding conventions, domain context, persona, etc.`]}),(0,R.jsxs)(`p`,{className:`text-[11px]`,children:[`Append-only — the base prompt (which defines the tool-calling protocol) is not editable. Changes apply to the `,(0,R.jsx)(`strong`,{children:`next session`}),` you start in this project; running sessions keep the prompt they were built with.`]})]}),(0,R.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),disabled:c,rows:14,spellCheck:!1,placeholder:"e.g. This project uses TypeScript strict mode and never uses default exports. Always run `npm run check` before declaring a task complete.",className:`w-full resize-y rounded border border-neutral-800 bg-neutral-900 px-3 py-2 font-mono text-xs leading-relaxed text-neutral-100 placeholder:text-neutral-600 focus:border-neutral-600 focus:outline-none disabled:opacity-50`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px]`,children:[(0,R.jsxs)(`span`,{className:p?`text-red-400`:`text-neutral-500`,children:[f.toLocaleString(),` / `,o.toLocaleString(),` bytes`,p&&` — too long, please trim before saving`]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u!==void 0&&(0,R.jsx)(`span`,{className:`text-green-400`,children:u}),m&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>a(n),disabled:c,className:`rounded border border-neutral-800 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-600 disabled:opacity-50`,children:`Revert`}),n.length>0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>void g(),disabled:c,className:`rounded border border-neutral-800 px-3 py-1 text-xs text-neutral-300 hover:border-red-500 hover:text-red-300 disabled:opacity-50`,children:`Clear`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:c||p||!m,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white disabled:opacity-50`,children:c?`Saving…`:`Save`})]})]})]})}function lN(e){return{name:``,kind:e,enabled:!0,command:``,timeoutSec:`30`,text:``,mode:`send`}}function uN({onError:e}){let t=ji(e=>e.minimal),n=Mi(e=>e.loaded),r=Mi(e=>e.actions),i=Mi(e=>e.load),a=Mi(e=>e.create),o=Mi(e=>e.update),s=Mi(e=>e.remove),[c,l]=(0,v.useState)(void 0),[u,d]=(0,v.useState)(void 0),[f,p]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e(void 0),n||i()},[i,n,e]);let m=e=>{let t=typeof e.command==`string`&&e.command.length>0;l({id:e.id,name:e.name,kind:t?`command`:`prompt`,enabled:e.enabled!==!1,command:e.command??``,timeoutSec:String(Math.round((e.timeoutMs??3e4)/1e3)),text:e.text??``,mode:e.mode??`send`})},h=async()=>{if(c===void 0)return;let t=c.name.trim();if(t.length===0){e(`Name is required`);return}let n={name:t,enabled:c.enabled};if(c.kind===`command`){let t=c.command.trim();if(t.length===0){e(`Command is required`);return}n.command=t;let r=Number.parseInt(c.timeoutSec,10);Number.isFinite(r)&&r>0&&(n.timeoutMs=r*1e3)}else{let t=c.text.trim();if(t.length===0){e(`Prompt text is required`);return}n.text=t,n.mode=c.mode}p(!0);try{c.id===void 0?await a(n):await o(c.id,n),l(void 0),e(void 0)}catch(t){e(`Save failed: ${HM(t)}`)}finally{p(!1)}},g=async t=>{p(!0);try{await s(t),d(void 0),c?.id===t&&l(void 0)}catch(t){e(`Delete failed: ${HM(t)}`)}finally{p(!1)}};return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-neutral-100`,children:`Quick action chips`}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-neutral-400`,children:[`One-click buttons on the chat toolbar. Two kinds:`,` `,(0,R.jsx)(`span`,{className:`text-amber-400 light:text-amber-700`,children:`command`}),` chips run a shell snippet in the active project's folder;`,` `,(0,R.jsx)(`span`,{className:`text-sky-400 light:text-sky-700`,children:`prompt`}),` chips either send a templated prompt to the agent or insert it into the composer so you can tweak it before sending. Chips are stored globally (not per-project) — they're your personal toolbox.`]})]}),t&&(0,R.jsx)(`div`,{className:`rounded border border-amber-700/40 bg-amber-900/20 px-3 py-2 text-xs text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:`MINIMAL_UI is enabled. Command chips are listed below but are hidden from the toolbar and the server refuses to run them. Prompt chips are unaffected.`}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[r.length===0&&n&&(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`No chips defined yet. Click “New” below to add one.`}),r.map(e=>{let n=typeof e.command==`string`&&e.command.length>0,r=t&&n;return(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-neutral-800 bg-neutral-900/40 px-3 py-2 text-xs light:border-neutral-300 light:bg-neutral-50 ${e.enabled===!1?`opacity-60`:``}`,children:[(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${n?`bg-amber-900/40 text-amber-300 light:bg-amber-100 light:text-amber-900`:`bg-sky-900/40 text-sky-300 light:bg-sky-100 light:text-sky-900`}`,children:n?`cmd`:`prompt`}),(0,R.jsx)(`span`,{className:`flex-1 truncate font-medium text-neutral-200`,children:e.name}),e.enabled===!1&&(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:`disabled`}),r&&(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-amber-400 light:text-amber-700`,children:`hidden by MINIMAL_UI`}),(0,R.jsx)(`button`,{onClick:()=>m(e),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500 light:border-neutral-400`,children:`Edit`}),u===e.id?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{onClick:()=>void g(e.id),disabled:f,className:`rounded border border-red-700 px-2 py-0.5 text-[11px] text-red-300 hover:bg-red-900/40 light:border-red-400 light:text-red-700`,children:`Confirm`}),(0,R.jsx)(`button`,{onClick:()=>d(void 0),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-400 hover:border-neutral-500 light:border-neutral-400`,children:`Cancel`})]}):(0,R.jsx)(`button`,{onClick:()=>d(e.id),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-400 hover:border-red-500 hover:text-red-300 light:border-neutral-400`,children:`Delete`})]},e.id)})]}),c===void 0&&(0,R.jsx)(`button`,{onClick:()=>l(lN(`prompt`)),className:`rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 light:border-neutral-400`,children:`+ New chip`}),c!==void 0&&(0,R.jsxs)(`div`,{className:`space-y-3 rounded border border-neutral-700 bg-neutral-900/60 p-3 light:border-neutral-300 light:bg-white`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Name`}),(0,R.jsx)(`input`,{value:c.name,onChange:e=>l({...c,name:e.target.value}),placeholder:`e.g. Run tests`,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-sm text-neutral-100 light:border-neutral-300 light:bg-white`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Kind`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-neutral-300`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`input`,{type:`radio`,checked:c.kind===`prompt`,onChange:()=>l({...c,kind:`prompt`})}),`Prompt`]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 ${t?`opacity-50`:``}`,title:t?`Command chips are disabled by MINIMAL_UI. The server refuses to run them.`:void 0,children:[(0,R.jsx)(`input`,{type:`radio`,checked:c.kind===`command`,disabled:t,onChange:()=>l({...c,kind:`command`})}),`Command`,t?` (disabled by MINIMAL_UI)`:``]})]})]}),c.kind===`command`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Command`}),(0,R.jsx)(`textarea`,{value:c.command,onChange:e=>l({...c,command:e.target.value}),rows:3,placeholder:`npm test`,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-xs text-neutral-100 light:border-neutral-300 light:bg-white`}),(0,R.jsxs)(`p`,{className:`mt-1 text-[11px] text-neutral-500`,children:[`Runs in the active project's folder via `,(0,R.jsx)(`code`,{children:`/bin/sh -c`}),`. Multi-line is fine (`,(0,R.jsx)(`code`,{children:`&&`}),`, `,(0,R.jsx)(`code`,{children:`;`}),`, etc.). Environment is scrubbed of pi-forge and provider secrets (same as the integrated terminal).`]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Timeout (seconds)`}),(0,R.jsx)(`input`,{value:c.timeoutSec,onChange:e=>l({...c,timeoutSec:e.target.value}),placeholder:`30`,className:`w-24 rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-sm text-neutral-100 light:border-neutral-300 light:bg-white`}),(0,R.jsx)(`p`,{className:`mt-1 text-[11px] text-neutral-500`,children:`Max 300 (five minutes). Past that, use the integrated terminal.`})]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Prompt text`}),(0,R.jsx)(`textarea`,{value:c.text,onChange:e=>l({...c,text:e.target.value}),rows:4,placeholder:`Review the staged changes for security issues.`,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 light:border-neutral-300 light:bg-white`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] uppercase tracking-wider text-neutral-400`,children:`Mode`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-neutral-300`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`input`,{type:`radio`,checked:c.mode===`send`,onChange:()=>l({...c,mode:`send`})}),`Send immediately`]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`input`,{type:`radio`,checked:c.mode===`insert`,onChange:()=>l({...c,mode:`insert`})}),`Insert into composer`]})]})]})]}),(0,R.jsx)(`div`,{children:(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-neutral-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:c.enabled,onChange:e=>l({...c,enabled:e.target.checked})}),`Enabled (visible in the menu)`]})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-neutral-800 pt-3 light:border-neutral-300`,children:[(0,R.jsx)(`button`,{onClick:()=>void h(),disabled:f,className:`rounded bg-emerald-700 px-3 py-1 text-xs text-white hover:bg-emerald-600 disabled:opacity-50`,children:c.id===void 0?`Create`:`Save`}),(0,R.jsx)(`button`,{onClick:()=>l(void 0),className:`rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500 light:border-neutral-400`,children:`Cancel`})]})]})]})}function dN(){let e=PC(e=>e.theme),t=PC(e=>e.setTheme),n=ji(e=>e.serverTheme),r=ji(e=>e.setServerTheme),[i,a]=(0,v.useState)(n),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(e),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{let e=!1;return L.getServerTheme().then(t=>{e||(a(t),r(t),f(void 0))}).catch(t=>{e||f(t instanceof N?t.code:t.message)}),()=>{e=!0}},[r]);let p=(e,t)=>{a(n=>n===void 0?n:{...n,colors:{...n.colors,[e]:t}})},m=e=>{a(t=>t===void 0?t:{...t,enabled:!0,colors:pN[e]})},h=()=>{if(i===void 0)return;let e={kind:`pi-forge-server-theme`,version:1,exportedAt:new Date().toISOString(),enabled:i.enabled,colors:i.colors},t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pi-forge-theme.json`,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},g=async e=>{u(!0),f(void 0);try{let t=gN(JSON.parse(await e.text()),i?.defaults),n=await L.updateServerTheme(t);a(n),r(n)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1),o.current!==null&&(o.current.value=``)}},_=async()=>{if(i!==void 0){u(!0),f(void 0);try{let e=await L.updateServerTheme({enabled:i.enabled,colors:i.colors});a(e),r(e)}catch(e){f((e instanceof N,e.message))}finally{u(!1)}}},y=async()=>{u(!0),f(void 0);try{let e=await L.resetServerTheme();a(e),r(e)}catch(e){f((e instanceof N,e.message))}finally{u(!1)}};return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-neutral-100`,children:`Theme`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-neutral-400`,children:`Sets the base color palette for the chrome, editor, and terminal. Persisted in this browser only — open in another browser to use a different base theme there.`})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:TC.map(n=>(0,R.jsxs)(`button`,{onClick:()=>t(n.id),className:`flex items-center justify-between gap-3 rounded border px-3 py-2 text-left ${n.id===e?`border-neutral-400 bg-neutral-800`:`border-neutral-700 hover:border-neutral-500`}`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-sm text-neutral-100`,children:n.label}),(0,R.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:n.mode})]}),(0,R.jsx)(vN,{id:n.id})]},n.id))})]}),(0,R.jsxs)(`div`,{className:`space-y-3 border-t border-neutral-800 pt-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-neutral-100`,children:`Global custom colors`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-neutral-400`,children:`Server-side overrides for broad UI surfaces: app background, chat bubbles, text, highlights, and selection. Applies globally to every browser using this instance.`})]}),d!==void 0&&(0,R.jsx)(`div`,{className:`rounded border border-red-800 bg-red-950/40 px-3 py-2 text-xs text-red-200`,children:d}),i===void 0?(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Loading custom colors…`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-neutral-200`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:e=>a(t=>t===void 0?t:{...t,enabled:e.target.checked})}),`Enable global custom colors`]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded border border-neutral-800 bg-neutral-900/30 p-2`,children:[(0,R.jsxs)(`label`,{className:`min-w-48 flex-1 text-xs text-neutral-400`,children:[`Start from appearance`,(0,R.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`mt-1 w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1.5 text-sm text-neutral-100`,children:TC.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,R.jsx)(`button`,{onClick:()=>m(s),disabled:l,className:`rounded border border-neutral-700 px-3 py-1.5 text-sm text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,children:`Copy colors`})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Kt.map(e=>(0,R.jsx)(_N,{colorKey:e,value:i.colors[e],defaultValue:i.defaults[e],onChange:t=>p(e,t)},e))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{onClick:()=>void _(),disabled:l,className:`rounded bg-neutral-100 px-3 py-1.5 text-sm font-medium text-neutral-900 hover:bg-white disabled:opacity-50`,children:`Save custom colors`}),(0,R.jsx)(`button`,{onClick:h,disabled:l,className:`rounded border border-neutral-700 px-3 py-1.5 text-sm text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,children:`Export theme`}),(0,R.jsx)(`button`,{onClick:()=>o.current?.click(),disabled:l,className:`rounded border border-neutral-700 px-3 py-1.5 text-sm text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,children:`Import theme`}),(0,R.jsx)(`input`,{ref:o,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.currentTarget.files?.[0];t!==void 0&&g(t)}}),(0,R.jsx)(`button`,{onClick:()=>void y(),disabled:l,className:`rounded border border-neutral-700 px-3 py-1.5 text-sm text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,children:`Reset`})]})]})]})]})}var fN={appBackground:`App background`,panelBackground:`Panel background`,userBubbleBackground:`User bubble`,assistantBubbleBackground:`Assistant bubble`,primaryText:`Text 1 — primary`,secondaryText:`Text 2 — secondary`,mutedText:`Text 3 — muted`,highlightBackground:`Highlight background`,highlightText:`Highlight text`,selectionBackground:`Selection background`},pN={dark:{appBackground:`#0a0a0a`,panelBackground:`#171717`,userBubbleBackground:`#262626`,assistantBubbleBackground:`#171717`,primaryText:`#f5f5f5`,secondaryText:`#d4d4d4`,mutedText:`#a3a3a3`,highlightBackground:`#facc15`,highlightText:`#111827`,selectionBackground:`#525252`},light:{appBackground:`#ffffff`,panelBackground:`#f3f4f6`,userBubbleBackground:`#e5e7eb`,assistantBubbleBackground:`#f3f4f6`,primaryText:`#171717`,secondaryText:`#374151`,mutedText:`#64748b`,highlightBackground:`#fde68a`,highlightText:`#78350f`,selectionBackground:`#cbd5e1`},dracula:{appBackground:`#191a21`,panelBackground:`#21222c`,userBubbleBackground:`#2a2c3d`,assistantBubbleBackground:`#21222c`,primaryText:`#f8f8f2`,secondaryText:`#c8c8c0`,mutedText:`#9c9ca0`,highlightBackground:`#ffb86c`,highlightText:`#191a21`,selectionBackground:`#44475a`},"solarized-dark":{appBackground:`#002b36`,panelBackground:`#04212a`,userBubbleBackground:`#052b36`,assistantBubbleBackground:`#04212a`,primaryText:`#eee8d5`,secondaryText:`#93a1a1`,mutedText:`#839496`,highlightBackground:`#b58900`,highlightText:`#002b36`,selectionBackground:`#586e75`},"catppuccin-mocha":{appBackground:`#11111b`,panelBackground:`#1e1e2e`,userBubbleBackground:`#313244`,assistantBubbleBackground:`#1e1e2e`,primaryText:`#cdd6f4`,secondaryText:`#9399b2`,mutedText:`#7f849c`,highlightBackground:`#f9e2af`,highlightText:`#11111b`,selectionBackground:`#585b70`}};function mN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hN(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function gN(e,t){let n=mN(e)&&mN(e.colors)?e.colors:e;if(!mN(n))throw Error(`Theme import must be a JSON object with colors.`);let r={...t??pN.dark};for(let e of Kt){let t=n[e];if(t!==void 0){if(typeof t!=`string`||!hN(t))throw Error(`${fN[e]} must be a 6-digit hex color like #0a0a0a.`);r[e]=t}}return{enabled:mN(e)&&typeof e.enabled==`boolean`?e.enabled:!0,colors:r}}function _N({colorKey:e,value:t,defaultValue:n,onChange:r}){return(0,R.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded border border-neutral-800 bg-neutral-900/40 px-3 py-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-sm text-neutral-100`,children:fN[e]}),(0,R.jsxs)(`div`,{className:`font-mono text-[10px] text-neutral-500`,children:[`Default `,n]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`color`,value:hN(t)?t:n,onChange:e=>r(e.target.value),className:`h-8 w-10 cursor-pointer rounded border border-neutral-700 bg-transparent p-0`}),(0,R.jsx)(`input`,{type:`text`,value:t,onChange:e=>r(e.target.value),pattern:`^#[0-9a-fA-F]{6}$`,className:`w-24 rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-xs text-neutral-100`})]})]})}function vN({id:e}){return(0,R.jsxs)(`div`,{"data-theme":e,className:`flex h-6 overflow-hidden rounded border border-neutral-700`,children:[(0,R.jsx)(`div`,{className:`w-4 bg-neutral-950`}),(0,R.jsx)(`div`,{className:`w-4 bg-neutral-800`}),(0,R.jsx)(`div`,{className:`w-4 bg-neutral-500`}),(0,R.jsx)(`div`,{className:`w-4 bg-neutral-200`})]})}function yN({onError:e}){let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(void 0),[a,o]=(0,v.useState)(void 0),s=(0,v.useRef)(null),[c,l]=(0,v.useState)(void 0),[u,d]=(0,v.useState)(void 0),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=async()=>{e(void 0),n(!0),o(void 0);try{let{blob:e,filename:t,files:n}=await L.exportConfig(),r=URL.createObjectURL(e),a=document.createElement(`a`);a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),requestAnimationFrame(()=>URL.revokeObjectURL(r)),i({filename:t,files:n})}catch(t){e(`Export failed: ${HM(t)}`)}finally{n(!1)}},h=async t=>{e(void 0),n(!0),i(void 0);try{o(await L.importConfig(t))}catch(t){e(`Import failed: ${HM(t)}`)}finally{n(!1),s.current&&(s.current.value=``)}},g=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),requestAnimationFrame(()=>URL.revokeObjectURL(n))},_=async()=>{e(void 0),n(!0),d(void 0),l(void 0);try{let{blob:e,filename:t,fileCount:n}=await L.exportSkills();g(e,t),l({filename:t,fileCount:n})}catch(t){t instanceof N&&t.code===`skills_directory_empty`?l({filename:``,fileCount:0}):e(`Skills export failed: ${HM(t)}`)}finally{n(!1)}},y=async t=>{if(t.length!==0){e(void 0),n(!0),l(void 0);try{d(await L.importSkills(t))}catch(t){e(`Skills import failed: ${HM(t)}`)}finally{n(!1),f.current&&(f.current.value=``),p.current&&(p.current.value=``)}}};return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-sm font-medium text-neutral-100`,children:`Export config`}),(0,R.jsxs)(`p`,{className:`mb-3 text-xs text-neutral-400`,children:[`Downloads a `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.tar.gz`}),` with`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`mcp.json`}),`,`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`settings.json`}),`,`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`models.json`}),`,`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`skills-overrides.json`}),`, and`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`tool-overrides.json`}),`. Provider auth (`,(0,R.jsx)(`code`,{className:`font-mono`,children:`auth.json`}),` — API keys, OAuth tokens) is`,` `,(0,R.jsx)(`strong`,{children:`not`}),` included; re-authenticate providers after restoring on a new install.`]}),(0,R.jsx)(`button`,{onClick:()=>void m(),disabled:t,className:`rounded border border-neutral-700 bg-neutral-900 px-3 py-1.5 text-xs text-neutral-100 hover:border-neutral-500 disabled:opacity-50`,children:t?`Exporting…`:`Download config archive`}),r!==void 0&&(0,R.jsxs)(`p`,{className:`mt-2 text-xs text-emerald-400 light:text-emerald-700`,children:[`Exported `,(0,R.jsx)(`code`,{className:`font-mono`,children:r.filename}),` (`,r.files.length===0?`no files were on disk`:`included: ${r.files.join(`, `)}`,`)`]})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-sm font-medium text-neutral-100`,children:`Import config`}),(0,R.jsxs)(`p`,{className:`mb-3 text-xs text-neutral-400`,children:[`Restores a previously-exported archive. Each file is parsed before any disk write — if any file fails validation, `,(0,R.jsx)(`strong`,{children:`nothing`}),` is imported. Existing live agent sessions keep their original settings until restarted.`]}),(0,R.jsx)(`input`,{ref:s,type:`file`,accept:`.gz,.tgz,application/gzip,application/x-gzip`,disabled:t,onChange:e=>{let t=e.target.files?.[0];t!==void 0&&h(t)},className:`block text-xs text-neutral-300 file:mr-3 file:rounded file:border file:border-neutral-700 file:bg-neutral-900 file:px-3 file:py-1.5 file:text-xs file:text-neutral-100 hover:file:border-neutral-500 disabled:opacity-50`}),a!==void 0&&(0,R.jsxs)(`div`,{className:`mt-3 space-y-1 text-xs`,children:[a.imported.length>0&&(0,R.jsxs)(`p`,{className:`text-emerald-400 light:text-emerald-700`,children:[`Imported: `,(0,R.jsx)(`code`,{className:`font-mono`,children:a.imported.join(`, `)})]}),a.skipped.length>0&&(0,R.jsxs)(`p`,{className:`text-amber-400 light:text-amber-700`,children:[`Skipped (not in allow-list):`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:a.skipped.join(`, `)})]}),a.errors.length>0&&(0,R.jsxs)(`div`,{className:`text-red-400`,children:[(0,R.jsx)(`p`,{children:`Errors — nothing was written:`}),(0,R.jsx)(`ul`,{className:`ml-4 list-disc`,children:a.errors.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`code`,{className:`font-mono`,children:e.file}),`: `,e.reason]},e.file))})]}),a.imported.length===0&&a.errors.length===0&&a.skipped.length===0&&(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Archive was empty.`})]})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-sm font-medium text-neutral-100`,children:`Export skills`}),(0,R.jsxs)(`p`,{className:`mb-3 text-xs text-neutral-400`,children:[`Downloads a `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.tar.gz`}),` of every file under`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`~/.pi/agent/skills/`}),` — both single-file (`,(0,R.jsx)(`code`,{className:`font-mono`,children:`<name>.md`}),`) and directory skills (`,(0,R.jsx)(`code`,{className:`font-mono`,children:`<name>/SKILL.md`}),` + assets) round-trip verbatim.`]}),(0,R.jsx)(`button`,{onClick:()=>void _(),disabled:t,className:`rounded border border-neutral-700 bg-neutral-900 px-3 py-1.5 text-xs text-neutral-100 hover:border-neutral-500 disabled:opacity-50`,children:t?`Working…`:`Download skills archive`}),c!==void 0&&(c.fileCount===0?(0,R.jsx)(`p`,{className:`mt-2 text-xs text-neutral-400`,children:`No skills to export — your skills directory is empty.`}):(0,R.jsxs)(`p`,{className:`mt-2 text-xs text-emerald-400 light:text-emerald-700`,children:[`Exported `,(0,R.jsx)(`code`,{className:`font-mono`,children:c.filename}),` (`,c.fileCount,` file`,c.fileCount===1?``:`s`,` packed)`]}))]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-sm font-medium text-neutral-100`,children:`Import skills`}),(0,R.jsxs)(`p`,{className:`mb-3 text-xs text-neutral-400`,children:[`Restore skills from a previously-exported `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.tar.gz`}),`, OR upload a folder of skill files directly. Existing files at the same path are`,` `,(0,R.jsx)(`strong`,{children:`overwritten`}),`; new files are added. Path traversal and absolute paths are rejected.`]}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-neutral-500`,children:`From tar.gz`}),(0,R.jsx)(`input`,{ref:f,type:`file`,accept:`.gz,.tgz,application/gzip,application/x-gzip`,disabled:t,onChange:e=>{let t=e.target.files?.[0];t!==void 0&&y([t])},className:`block text-xs text-neutral-300 file:mr-3 file:rounded file:border file:border-neutral-700 file:bg-neutral-900 file:px-3 file:py-1.5 file:text-xs file:text-neutral-100 hover:file:border-neutral-500 disabled:opacity-50`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-neutral-500`,children:`From folder (Chromium / WebKit only)`}),(0,R.jsx)(`input`,{ref:p,type:`file`,multiple:!0,webkitdirectory:``,disabled:t,onChange:e=>{let t=e.target.files;t===null||t.length===0||y(Array.from(t))},className:`block text-xs text-neutral-300 file:mr-3 file:rounded file:border file:border-neutral-700 file:bg-neutral-900 file:px-3 file:py-1.5 file:text-xs file:text-neutral-100 hover:file:border-neutral-500 disabled:opacity-50`})]})]}),u!==void 0&&(0,R.jsxs)(`div`,{className:`mt-3 space-y-1 text-xs`,children:[u.imported.length>0&&(0,R.jsxs)(`p`,{className:`text-emerald-400 light:text-emerald-700`,children:[`Imported `,u.imported.length,` file`,u.imported.length===1?``:`s`,`:`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:u.imported.join(`, `)})]}),u.skipped.length>0&&(0,R.jsxs)(`div`,{className:`text-amber-400 light:text-amber-700`,children:[(0,R.jsxs)(`p`,{children:[`Skipped `,u.skipped.length,` entr`,u.skipped.length===1?`y`:`ies`,`:`]}),(0,R.jsx)(`ul`,{className:`ml-4 list-disc`,children:u.skipped.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`code`,{className:`font-mono`,children:e.name}),` (`,e.reason,`)`]},e.name))})]}),u.imported.length===0&&u.skipped.length===0&&(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`No files were imported.`})]})]})]})}var bN=`***REDACTED***`;function xN(){return{name:``,kind:`remote`,enabled:!0,url:``,transport:`auto`,headers:[],command:``,argsText:``,env:[],cwd:``}}function SN(e){return e.split(`
|
|
362
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}function CN({onError:e}){let t=Sr(),n=xr(e=>e.projects),r=MM(e=>e.settings),i=MM(e=>e.globalServers),a=MM(e=>e.byProject[t?.id??`__no_project__`]?.status??AM),o=MM(e=>e.byProject[t?.id??`__no_project__`]?.stdioTrust),s=MM(e=>e.refreshProject),c=MM(e=>e.setMcpEnabled),l=MM(e=>e.
|
|
363
|
-
`),env:Object.entries(t.env??{}).map(([e,t])=>({key:e,value:t})),cwd:t.cwd??``}))},re=()=>{_(void 0),h(xN())},ie=async()=>{if(m===void 0)return;if(m.name.trim().length===0){e(`Name is required.`);return}if(m.kind===`remote`&&m.url.trim().length===0){e(`URL is required for remote servers.`);return}if(m.kind===`stdio`&&m.command.trim().length===0){e(`Command is required for stdio servers.`);return}let t={enabled:m.enabled};if(m.kind===`remote`){t.url=m.url,t.transport=m.transport;let e={};for(let t of m.headers)t.key.trim().length!==0&&(e[t.key]=t.value);Object.keys(e).length>0&&(t.headers=e)}else{t.command=m.command;let e=SN(m.argsText);e.length>0&&(t.args=e);let n={};for(let e of m.env)e.key.trim().length!==0&&(n[e.key]=e.value);Object.keys(n).length>0&&(t.env=n),m.cwd.trim().length>0&&(t.cwd=m.cwd)}b(!0);try{await l(m.name,t),e(void 0),h(void 0),_(void 0)}catch(t){e(`Failed to save server: ${HM(t)}`)}finally{b(!1)}},ae=async t=>{if(window.confirm(`Remove MCP server '${t}' from the global registry?`)){b(!0);try{await u(t),e(void 0)}catch(t){e(`Failed to remove server: ${HM(t)}`)}finally{b(!1)}}},A=async(n,r)=>{S(n);try{await d(n,r===`project`?t?.id:void 0),e(void 0),k()}catch(t){e(`Probe failed for '${n}': ${HM(t)}`)}finally{S(void 0)}},j=async(t,n)=>{b(!0);try{await L.setToolEnabled(`mcp`,t,n,`global`),await k()}catch(t){e(`Toggle failed: ${HM(t)}`)}finally{b(!1)}},M=async(t,n,r)=>{b(!0);try{r===void 0?await L.clearToolProjectOverride(`mcp`,n,t):await L.setToolEnabled(`mcp`,n,r===`enabled`,`project`,t),await k()}catch(t){e(`Override write failed: ${HM(t)}`)}finally{b(!1)}},oe=e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(r===void 0)return(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Loading MCP config…`});let se=r.enabled,ce=a.filter(e=>e.scope===`global`),le=a.filter(e=>e.scope===`project`);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`MCP servers extend the agent with custom tools. Servers configured here are loaded by every new session. Project-scoped servers in `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` at the project root are also loaded for sessions in that project (project entries override globals on name collision).`]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-neutral-800 bg-neutral-900/40 p-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-neutral-100`,children:`MCP tools`}),(0,R.jsx)(`div`,{className:`text-[11px] text-neutral-500`,children:`Master switch. When off, no MCP tools reach the agent regardless of per-server state.`})]}),(0,R.jsx)(`button`,{onClick:()=>void ee(!se),disabled:y,className:`rounded border px-3 py-1 text-xs ${se?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,children:se?`Enabled`:`Disabled`})]}),t!==void 0&&(0,R.jsx)(EN,{projectName:t.name,trusted:o?.trusted===!0,gatedCount:a.filter(e=>e.scope===`project`&&e.state===`trust_required`).length,busy:y,onGrant:async()=>{b(!0);try{await f(t.id),e(void 0)}catch(t){e(`Failed to grant trust: ${HM(t)}`)}finally{b(!1)}},onRevoke:async()=>{if(window.confirm(`Revoke stdio MCP trust for "${t.name}"? This disconnects every running project-scoped MCP server.`)){b(!0);try{await p(t.id),e(void 0)}catch(t){e(`Failed to revoke trust: ${HM(t)}`)}finally{b(!1)}}}}),(0,R.jsx)(wN,{title:`Global servers`,emptyHint:`No global MCP servers configured. Click 'Add server' to add one.`,servers:ce.map(e=>({status:e,config:i[e.name]})),editable:!0,editingName:g??null,probingName:x??null,toolsByServer:C,expandedServers:D,allOverrides:T,projects:n,busy:y,onToggleExpanded:oe,onToggleToolGlobal:(e,t)=>void j(e,t),onSetProjectToolOverride:(e,t,n)=>void M(e,t,n),onToggle:(e,t)=>void te(e,t),onProbe:e=>void A(e,`global`),onEdit:ne,onRemove:e=>void ae(e)}),t!==void 0&&(0,R.jsx)(wN,{title:`Project servers (${t.name})`,emptyHint:(0,R.jsxs)(R.Fragment,{children:[`No project servers. Add a `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` file at the project root to define some — supports both`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`{ servers: {...} }`}),` and the standard`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`{ mcpServers: {...} }`}),` shape.`]}),servers:le.map(e=>({status:e,config:void 0})),editable:!1,probingName:x??null,toolsByServer:C,expandedServers:D,allOverrides:T,projects:n,busy:y,onToggleExpanded:oe,onToggleToolGlobal:(e,t)=>void j(e,t),onSetProjectToolOverride:(e,t,n)=>void M(e,t,n),onProbe:e=>void A(e,`project`)}),m===void 0?(0,R.jsx)(`button`,{onClick:re,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500`,children:`+ Add server`}):(0,R.jsx)(DN,{draft:m,isEditing:g!==void 0,busy:y,onChange:h,onSave:()=>void ie(),onCancel:()=>{h(void 0),_(void 0)}})]})}function wN(e){return(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:e.title}),e.servers.length===0?(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-500`,children:e.emptyHint}):(0,R.jsx)(`div`,{className:`space-y-2`,children:e.servers.map(t=>{let n=t.status,r=e.editingName===n.name,i=e.probingName===n.name,a=`${n.scope}:${n.name}`,o=e.toolsByServer.get(a)??[],s=e.expandedServers.has(a),c=o.length>0;return(0,R.jsxs)(`div`,{className:`rounded border ${r?`border-neutral-500 bg-neutral-900`:`border-neutral-800 bg-neutral-900/40`}`,children:[(0,R.jsxs)(`div`,{className:`p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>c&&e.onToggleExpanded(a),disabled:!c,className:`flex h-5 w-5 items-center justify-center rounded text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 disabled:opacity-30`,title:c?s?`Hide tools`:`Show tools`:`No tools to show (server not connected or empty)`,children:s?(0,R.jsx)(Se,{size:16}):(0,R.jsx)(we,{size:16})}),(0,R.jsx)(TN,{state:n.state}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-neutral-100`,children:n.name}),(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-400`,children:n.transport??`auto`}),(0,R.jsxs)(`span`,{className:`text-[11px] text-neutral-500`,children:[n.toolCount,` tools`]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs`,children:[e.editable&&e.onToggle!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onToggle?.(n.name,!n.enabled),className:`rounded border px-2 py-0.5 ${n.enabled?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-400 hover:border-neutral-500`}`,children:n.enabled?`Enabled`:`Disabled`}),(0,R.jsx)(`button`,{onClick:()=>e.onProbe(n.name),disabled:i,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,title:`Reconnect and refresh tool list`,children:i?`Probing…`:`Probe`}),e.editable&&e.onEdit!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onEdit?.(n.name),className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Edit`}),e.editable&&e.onRemove!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onRemove?.(n.name),className:`rounded border border-red-700/50 px-2 py-0.5 text-red-300 hover:bg-red-900/20`,children:`Remove`})]})]}),n.kind===`stdio`?(0,R.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-neutral-500`,title:`${n.command??``} ${(n.args??[]).join(` `)}`.trim(),children:[n.command,` `,(n.args??[]).join(` `)]}):(0,R.jsx)(`div`,{className:`mt-1 truncate text-[11px] text-neutral-500`,title:n.url??``,children:n.url}),n.lastError!==void 0&&(0,R.jsx)(`div`,{className:`mt-1 truncate text-[11px] text-red-300 light:text-red-700`,title:n.lastError,children:n.lastError})]}),s&&c&&(0,R.jsxs)(`div`,{className:`space-y-2 border-t border-neutral-800 bg-neutral-950/40 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:`Tools`}),(0,R.jsx)(`div`,{className:`space-y-2`,children:o.map(t=>(0,R.jsx)(sN,{family:`mcp`,name:t.shortName,fqn:t.name,description:t.description,globalEnabled:t.globalEnabled,projects:e.projects,allOverrides:e.allOverrides,busy:e.busy,onToggleGlobal:n=>e.onToggleToolGlobal(t.name,n),onSetProjectOverride:(n,r)=>e.onSetProjectToolOverride(n,t.name,r)},`mcp:${t.name}`))})]})]},a)})})]})}function TN({state:e}){return(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e===`connected`?`bg-emerald-500`:e===`connecting`?`bg-amber-400 animate-pulse`:e===`error`?`bg-red-500`:e===`disabled`?`bg-neutral-700`:`bg-neutral-500`}`,title:e})}function EN(e){return e.trusted?(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-neutral-800 bg-neutral-900/40 px-3 py-1.5 text-[11px] text-neutral-500`,children:[(0,R.jsxs)(`span`,{children:[`Stdio MCP trust granted for`,` `,(0,R.jsx)(`strong`,{className:`text-neutral-300`,children:e.projectName}),`. Project-local stdio MCP servers from `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` will spawn on session create.`]}),(0,R.jsx)(`button`,{onClick:()=>void e.onRevoke(),disabled:e.busy,className:`rounded border border-neutral-700 px-2 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500 hover:text-neutral-200 disabled:opacity-50`,title:`Disconnects every running project-scoped MCP server`,children:`Revoke`})]}):e.gatedCount===0?null:(0,R.jsxs)(`div`,{className:`rounded border border-amber-700/40 bg-amber-900/20 p-3 text-xs text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsxs)(`div`,{className:`mb-2 font-medium`,children:[`This project wants to spawn `,e.gatedCount,` stdio MCP server`,e.gatedCount===1?``:`s`,`.`]}),(0,R.jsxs)(`p`,{className:`text-[11px] leading-relaxed`,children:[(0,R.jsx)(`strong`,{children:e.projectName}),`'s `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` declares MCP server`,e.gatedCount===1?``:`s`,` that pi-forge would launch as local subprocess`,e.gatedCount===1?``:`es`,`. Stdio MCP runs arbitrary commands on this machine with whatever env you've passed through — only trust projects whose`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` you've reviewed and approve of. Remote (URL) entries in this project are unaffected by this gate.`]}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsx)(`button`,{onClick:()=>void e.onGrant(),disabled:e.busy,className:`rounded bg-amber-200 px-3 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-100 disabled:opacity-50 light:bg-amber-600 light:text-amber-50 light:hover:bg-amber-700`,children:e.busy?`Granting…`:`Trust this project`})})]})}function DN(e){let{draft:t,busy:n}=e,r=(n,r)=>{e.onChange({...t,[n]:r})};return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-700 bg-neutral-900 p-3`,children:[(0,R.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:e.isEditing?`Edit '${t.name}'`:`Add MCP server`}),(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded border border-neutral-800 bg-neutral-950 p-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`Type`}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 ${e.isEditing?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[(0,R.jsx)(`input`,{type:`radio`,name:`mcp-kind`,checked:t.kind===`remote`,disabled:e.isEditing,onChange:()=>r(`kind`,`remote`)}),(0,R.jsx)(`span`,{children:`Remote URL`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 ${e.isEditing?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[(0,R.jsx)(`input`,{type:`radio`,name:`mcp-kind`,checked:t.kind===`stdio`,disabled:e.isEditing,onChange:()=>r(`kind`,`stdio`)}),(0,R.jsx)(`span`,{children:`Local subprocess (stdio)`})]}),e.isEditing&&(0,R.jsx)(`span`,{className:`text-[10px] italic text-neutral-600`,children:`Locked while editing — delete and re-add to change type.`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[80px_1fr] items-center gap-2 text-xs`,children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Name`}),(0,R.jsx)(`input`,{value:t.name,onChange:e=>r(`name`,e.target.value),disabled:e.isEditing,placeholder:`my-server`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500 disabled:opacity-50`}),t.kind===`remote`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`URL`}),(0,R.jsx)(`input`,{value:t.url,onChange:e=>r(`url`,e.target.value),placeholder:`https://mcp.example.com/sse`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Transport`}),(0,R.jsxs)(`select`,{value:t.transport,onChange:e=>r(`transport`,e.target.value),className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:`auto`,children:`auto (StreamableHTTP, fall back to SSE)`}),(0,R.jsx)(`option`,{value:`streamable-http`,children:`streamable-http`}),(0,R.jsx)(`option`,{value:`sse`,children:`sse`})]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Command`}),(0,R.jsx)(`input`,{value:t.command,onChange:e=>r(`command`,e.target.value),placeholder:`npx (or absolute path to a binary)`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`self-start pt-1 text-neutral-500`,children:`Args`}),(0,R.jsx)(`textarea`,{value:t.argsText,onChange:e=>r(`argsText`,e.target.value),placeholder:`-y
|
|
364
|
-
@modelcontextprotocol/server-everything`,rows:3,spellCheck:!1,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`cwd`}),(0,R.jsx)(`input`,{value:t.cwd,onChange:e=>r(`cwd`,e.target.value),placeholder:`(blank ↦ default: project path for project servers)`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Enabled`}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.enabled,onChange:e=>r(`enabled`,e.target.checked)}),(0,R.jsx)(`span`,{className:`text-[11px] text-neutral-500`,children:`Disabled servers don't connect or contribute tools.`})]})]}),t.kind===`remote`?(0,R.jsx)(ON,{label:`Headers`,emptyHint:"No headers. Add `Authorization: Bearer …` here for auth.",keyPlaceholder:`Authorization`,valuePlaceholder:`Bearer …`,rows:t.headers,onChange:e=>r(`headers`,e)}):(0,R.jsx)(ON,{label:`Env`,emptyHint:`No env. Add API keys / config your subprocess needs (PATH / HOME / locale are inherited automatically).`,keyPlaceholder:`GITHUB_TOKEN`,valuePlaceholder:`ghp_…`,rows:t.env,onChange:e=>r(`env`,e)}),(0,R.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{onClick:e.onCancel,className:`rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:`Cancel`}),(0,R.jsx)(`button`,{onClick:e.onSave,disabled:n,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 disabled:opacity-50`,children:n?`Saving…`:`Save`})]})]})}function ON(e){let{rows:t}=e;return(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,R.jsx)(`h5`,{className:`text-[11px] font-semibold uppercase tracking-wider text-neutral-500`,children:e.label}),(0,R.jsxs)(`button`,{onClick:()=>e.onChange([...t,{key:``,value:``}]),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500`,children:[`+ `,e.label.replace(/s$/,``)]})]}),t.length===0&&(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-600`,children:e.emptyHint}),t.map((n,r)=>(0,R.jsxs)(`div`,{className:`mb-1 grid grid-cols-[1fr_2fr_auto] gap-1`,children:[(0,R.jsx)(`input`,{value:n.key,onChange:i=>{let a=[...t];a[r]={...n,key:i.target.value},e.onChange(a)},placeholder:e.keyPlaceholder,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-[11px] font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`input`,{value:n.value===bN?``:n.value,onChange:i=>{let a=[...t];a[r]={...n,value:i.target.value},e.onChange(a)},placeholder:n.value===bN?`leave blank to keep stored value`:e.valuePlaceholder,type:`password`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-[11px] font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>e.onChange(t.filter((e,t)=>t!==r)),className:`rounded border border-neutral-700 px-2 text-[11px] text-neutral-400 hover:text-red-300 light:hover:text-red-700`,title:`Remove ${e.label.toLowerCase()}`,children:`×`})]},r)),t.some(e=>e.value===bN)&&(0,R.jsx)(`p`,{className:`mt-1 text-[10px] italic text-neutral-500`,children:`Values with the redaction sentinel keep their stored value when you save.`})]})}var kN=8;function AN(){let e=ji(e=>e.version),t=ji(e=>e.loaded),n=ji(e=>e.passwordAuthEnabled);return(0,R.jsxs)(`div`,{className:`space-y-6 text-sm text-neutral-300`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsx)(`h2`,{className:`text-base font-semibold text-neutral-100`,children:`pi-forge`}),(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Browser interface for the`,` `,(0,R.jsx)(`a`,{href:`https://github.com/badlogic/pi-mono`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`pi coding agent`}),`.`]})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Version`}),(0,R.jsx)(`p`,{className:`font-mono text-sm`,children:t?e.length>0?e:(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`unknown`}):(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`loading…`})})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Links`}),(0,R.jsxs)(`ul`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`github.com/Devin-Marks/pi-forge`})}),(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge/blob/main/CHANGELOG.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`Changelog`})}),(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge/blob/main/SECURITY.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`Security`})})]})]}),n&&(0,R.jsx)(jN,{})]})}function jN(){let e=gr(e=>e.changePassword),t=gr(e=>e.changePasswordPending),n=gr(e=>e.changePasswordError),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(void 0),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(p.current&&!t&&n===void 0){i(``),o(``),c(``),f(!0);let e=window.setTimeout(()=>f(!1),2500);return()=>window.clearTimeout(e)}p.current=t},[t,n]);let m=t=>{if(t.preventDefault(),u(void 0),f(!1),a.length<kN){u(`New password must be at least ${kN} characters.`);return}if(a!==s){u(`New password and confirmation do not match.`);return}if(a===r){u(`New password must differ from the current one.`);return}e(r,a)},h=l??MN(n);return(0,R.jsxs)(`section`,{className:`space-y-2 border-t border-neutral-800 pt-5`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Change password`}),(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Updates the scrypt hash on disk; existing browser sessions stay signed in.`}),(0,R.jsxs)(`form`,{onSubmit:m,className:`space-y-2`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`Current password`}),(0,R.jsx)(`input`,{type:`password`,value:r,onChange:e=>i(e.target.value),autoComplete:`current-password`,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`New password`}),(0,R.jsx)(`input`,{type:`password`,value:a,onChange:e=>o(e.target.value),autoComplete:`new-password`,minLength:kN,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`Confirm new password`}),(0,R.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),autoComplete:`new-password`,minLength:kN,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),h!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:h}),d&&(0,R.jsx)(`p`,{role:`status`,className:`text-xs text-emerald-400 light:text-emerald-700`,children:`Password updated.`}),(0,R.jsx)(`button`,{type:`submit`,disabled:t||r.length===0||a.length===0,className:`rounded-md bg-neutral-100 px-3 py-1.5 text-xs font-medium text-neutral-900 transition hover:bg-white disabled:cursor-not-allowed disabled:opacity-50`,children:t?`Saving…`:`Update password`})]})]})}function MN(e){if(e!==void 0)switch(e){case`invalid_password`:return`Current password is incorrect.`;case`password_unchanged`:return`New password must differ from the current one.`;case`ui_password_not_configured`:return`Password auth is not configured on this server.`;case`auth_required`:return`Session expired — sign in again.`;default:return`Could not change password: ${e}`}}function NN({sessionId:e}){let t=Vr(t=>t.pendingBySession[e]);return t===void 0?null:(0,R.jsx)(PN,{pending:t},t.requestId)}function PN({pending:e}){let t=Vr(e=>e.clearPending),[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(void 0),[c,l]=(0,v.useState)(()=>e.questions.map(()=>null)),u=e.questions[n];if(u===void 0)return null;let d=e=>{l(t=>{let r=t.slice();return r[n]={...r[n]??{},...e},r})},f=c[n],p=()=>u.multiSelect===!0?f?.multiLabels!==void 0&&f.multiLabels.length>0:f?.selectedLabel!==void 0||f?.customText!==void 0&&f.customText.trim().length>0,m=()=>{let t=[];for(let n=0;n<e.questions.length;n+=1){let r=e.questions[n],i=c[n];if(i!=null){if(r.multiSelect===!0){t.push({questionIndex:n,question:r.question,kind:`multi`,answer:null,...i.multiLabels===void 0?{}:{selected:i.multiLabels}});continue}if(i.selectedLabel!==void 0){let e=r.options.find(e=>e.label===i.selectedLabel);t.push({questionIndex:n,question:r.question,kind:`option`,answer:i.selectedLabel,...e?.preview===void 0?{}:{preview:e.preview}});continue}if(i.customText!==void 0&&i.customText.trim().length>0){t.push({questionIndex:n,question:r.question,kind:`custom`,answer:i.customText.trim()});continue}}}return t},h=async()=>{if(p()){if(n<e.questions.length-1){r(n+1);return}a(!0),s(void 0);try{await L.submitAskUserQuestionAnswer(e.sessionId,{requestId:e.requestId,answers:m()}),t(e.sessionId,e.requestId)}catch(e){s(e instanceof N?`${e.code}: ${e.message}`:e.message),a(!1)}}},g=async()=>{a(!0),s(void 0);try{let r={questionIndex:n,question:u.question,kind:`chat`,answer:`Chat about this`};await L.submitAskUserQuestionAnswer(e.sessionId,{requestId:e.requestId,answers:[r],cancelled:!0}),t(e.sessionId,e.requestId)}catch(e){s(e instanceof N?`${e.code}: ${e.message}`:e.message),a(!1)}};return(0,R.jsx)(`div`,{className:`flex max-h-[60vh] shrink-0 flex-col overflow-hidden border-t border-amber-700/50 bg-neutral-900/40 light:border-amber-400 light:bg-amber-50/60`,children:(0,R.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-4 py-2 light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-amber-400 light:text-amber-700`,children:`Agent question`}),e.questions.length>1&&(0,R.jsx)(`div`,{className:`ml-2 flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:e.questions.map((e,t)=>(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${t===n?`bg-amber-900/40 text-amber-200 light:bg-amber-100 light:text-amber-900`:c[t]===null?`text-neutral-500`:`bg-neutral-800 text-neutral-300 light:bg-neutral-200 light:text-neutral-700`}`,title:e.question,children:e.header},t))}),(0,R.jsx)(`div`,{className:`flex-1`}),(0,R.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:[n+1,` of `,e.questions.length]})]}),o!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-4 py-2 text-xs text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:o}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3`,children:(0,R.jsx)(FN,{question:u,draft:f??null,onChange:e=>d(e)})}),(0,R.jsxs)(`footer`,{className:`flex items-center gap-2 border-t border-neutral-800 px-4 py-2 light:border-neutral-200`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(),disabled:i,className:`flex items-center gap-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500 disabled:opacity-50 light:border-neutral-400 light:text-neutral-700`,title:`Abandon the structured questionnaire and reply in free-form chat`,children:[(0,R.jsx)(Be,{size:12}),`Chat about this`]}),(0,R.jsx)(`div`,{className:`flex-1`}),n>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(n-1),disabled:i,className:`flex items-center gap-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500 disabled:opacity-50 light:border-neutral-400 light:text-neutral-700`,children:[(0,R.jsx)(Ce,{size:12}),`Back`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void h(),disabled:i||!p(),className:`flex items-center gap-1 rounded bg-emerald-700 px-3 py-1 text-xs text-white hover:bg-emerald-600 disabled:opacity-50`,children:[i?(0,R.jsx)(pe,{size:12,className:`animate-spin`}):null,n<e.questions.length-1?(0,R.jsxs)(R.Fragment,{children:[`Next `,(0,R.jsx)(we,{size:12})]}):i?`Submitting…`:`Submit`]})]})]})})}function FN({question:e,draft:t,onChange:n}){let r=(0,v.useMemo)(()=>e.options.some(e=>typeof e.preview==`string`&&e.preview.length>0),[e.options]),i=e.multiSelect===!0,a=!i&&!r,[o,s]=(0,v.useState)(void 0),c=e.options.find(e=>e.label===o);return(0,v.useEffect)(()=>{r&&o===void 0&&e.options[0]!==void 0&&s(e.options[0].label)},[r,o,e.options]),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-base font-medium text-neutral-100 light:text-neutral-900`,children:e.question}),r&&!i?(0,R.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,R.jsx)(`div`,{className:`col-span-1 space-y-1`,children:e.options.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{n({selectedLabel:e.label}),s(e.label)},onMouseEnter:()=>s(e.label),className:`w-full rounded border px-2 py-1.5 text-left text-xs ${t?.selectedLabel===e.label?`border-emerald-600 bg-emerald-900/30 text-emerald-100 light:bg-emerald-50 light:text-emerald-900`:o===e.label?`border-neutral-600 bg-neutral-900 text-neutral-100 light:border-neutral-400 light:bg-neutral-100 light:text-neutral-900`:`border-neutral-800 bg-neutral-900/40 text-neutral-300 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50 light:text-neutral-700`}`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]},e.label))}),(0,R.jsx)(`div`,{className:`col-span-2 overflow-auto rounded border border-neutral-800 bg-neutral-950 p-3 light:border-neutral-300 light:bg-neutral-50`,children:c?.preview!==void 0&&c.preview.length>0?(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[11px] text-neutral-200 light:text-neutral-800`,children:c.preview}):(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500 light:text-neutral-600`,children:`No preview for this option.`})})]}):i?(0,R.jsx)(`div`,{className:`space-y-1`,children:e.options.map(e=>{let r=(t?.multiLabels??[]).includes(e.label);return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded border px-2 py-1.5 text-xs ${r?`border-emerald-600 bg-emerald-900/30 light:bg-emerald-50`:`border-neutral-800 bg-neutral-900/40 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50`}`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>{let i=new Set(t?.multiLabels??[]);r?i.delete(e.label):i.add(e.label),n({multiLabels:Array.from(i)})},className:`mt-1`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium text-neutral-100 light:text-neutral-900`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]})]},e.label)})}):(0,R.jsxs)(`div`,{className:`space-y-1`,children:[e.options.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n({selectedLabel:e.label,customText:void 0}),className:`w-full rounded border px-2 py-1.5 text-left text-xs ${t?.selectedLabel===e.label?`border-emerald-600 bg-emerald-900/30 light:bg-emerald-50`:`border-neutral-800 bg-neutral-900/40 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50`}`,children:[(0,R.jsx)(`div`,{className:`font-medium text-neutral-100 light:text-neutral-900`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]},e.label)),a&&(0,R.jsxs)(`div`,{className:`pt-2`,children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:`Type something`}),(0,R.jsx)(`textarea`,{value:t?.customText??``,onChange:e=>n({customText:e.target.value,selectedLabel:void 0}),rows:2,placeholder:`Or type your own answer…`,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 light:border-neutral-300 light:bg-white light:text-neutral-900`})]})]})]})}function IN({sessionId:e,onClose:t}){let n=Ur(t=>Wr(t,e)),r=Ur(e=>e.set),[i,a]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{let t=!1;return L.listTodos(e).then(n=>{if(t)return;let i=Ur.getState().byId[e];(i===void 0||i.tasks.length===0)&&r(e,{tasks:n.tasks,nextId:n.nextId})}).catch(e=>{t||a(e instanceof N?e.code:e.message)}),()=>{t=!0}},[e,r]);let o=(0,v.useMemo)(()=>Gr(n),[n]),s=(0,v.useMemo)(()=>LN(n.tasks),[n.tasks]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-neutral-950 text-neutral-200 light:bg-white light:text-neutral-900`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-3 py-1.5 text-xs light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-neutral-400 light:text-neutral-600`,children:`Todos`}),(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[o.completed,`/`,o.total,o.inProgress>0?` · ${o.inProgress} in progress`:``]}),(0,R.jsx)(`div`,{className:`flex-1`}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200 light:hover:bg-neutral-200 light:hover:text-neutral-900`,title:`Hide todo panel`,children:(0,R.jsx)(at,{size:12})})]}),i!==void 0&&n.tasks.length===0&&(0,R.jsxs)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:[`Failed to load todos: `,i]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:o.total===0?(0,R.jsx)(`p`,{className:`px-1 text-[11px] italic text-neutral-500 light:text-neutral-600`,children:`No todos yet. The agent will add tasks here when it's planning multi-step work.`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[s.in_progress.length>0&&(0,R.jsx)(RN,{label:`In Progress`,tasks:s.in_progress}),s.pending.length>0&&(0,R.jsx)(RN,{label:`Pending`,tasks:s.pending}),s.completed.length>0&&(0,R.jsx)(RN,{label:`Completed`,tasks:s.completed})]})})]})}function LN(e){let t={pending:[],in_progress:[],completed:[],deleted:[]};for(let n of e)t[n.status].push(n);return t}function RN({label:e,tasks:t}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 px-1 text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:e}),(0,R.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,R.jsx)(zN,{task:e},e.id))})]})}function zN({task:e}){let[t,n]=(0,v.useState)(!1),r=e.description!==void 0||e.activeForm!==void 0||e.blockedBy!==void 0&&e.blockedBy.length>0||e.owner!==void 0;return(0,R.jsxs)(`div`,{className:`rounded border border-transparent px-1 py-0.5 text-xs hover:border-neutral-800 light:hover:border-neutral-300`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(e=>!e),className:`flex w-full items-start gap-1.5 text-left ${r?`cursor-pointer`:`cursor-default`}`,children:[r&&(0,R.jsx)(we,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 transition-transform light:text-neutral-600 ${t?`rotate-90`:``}`}),!r&&(0,R.jsx)(`span`,{className:`inline-block w-[11px] shrink-0`}),(0,R.jsx)(BN,{status:e.status,activeForm:e.activeForm}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`${e.status===`completed`?`text-neutral-500 line-through light:text-neutral-500`:e.status===`in_progress`?`text-neutral-100 light:text-neutral-900`:`text-neutral-300 light:text-neutral-700`}`,children:e.subject}),e.status===`in_progress`&&e.activeForm!==void 0&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] italic text-amber-400 light:text-amber-700`,children:e.activeForm})]}),(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:[`#`,e.id]})]}),t&&r&&(0,R.jsxs)(`div`,{className:`mt-1 space-y-0.5 pl-[34px] text-[11px] text-neutral-400 light:text-neutral-600`,children:[e.description!==void 0&&(0,R.jsx)(`div`,{children:e.description}),e.blockedBy!==void 0&&e.blockedBy.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:`blocked by:`}),` `,e.blockedBy.map(e=>`#${e}`).join(`, `)]}),e.owner!==void 0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:`owner:`}),` `,e.owner]})]})]})}function BN({status:e,activeForm:t}){return e===`in_progress`?(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-amber-400 light:text-amber-700`,"aria-label":t??`in progress`}):e===`completed`?(0,R.jsx)(xe,{size:11,className:`mt-0.5 shrink-0 text-emerald-400 light:text-emerald-700`,"aria-label":`completed`}):e===`deleted`?(0,R.jsx)(at,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 light:text-neutral-500`,"aria-label":`deleted`}):(0,R.jsx)(Ee,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 light:text-neutral-500`,"aria-label":`pending`})}function VN({sessionId:e}){let t=Xr(t=>Zr(t,e)),n=Xr(t=>Qr(t,e)),r=Xr(e=>e.setProcesses),i=Xr(e=>e.clearWatches),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;return L.listProcesses(e).then(n=>{if(t)return;let i=Xr.getState().bySession[e];(i===void 0||i.length===0)&&r(e,n.processes)}).catch(e=>{t||o(e instanceof N?e.code:e.message)}),()=>{t=!0}},[e,r]);let l=(0,v.useMemo)(()=>HN(t),[t]),u=$r(t),d=t.length-u,f=async()=>{c(!0),o(void 0);try{await L.clearProcesses(e)}catch(e){o(e instanceof N?e.code:e.message)}finally{c(!1)}};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-neutral-950 text-neutral-200 light:bg-white light:text-neutral-900`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-3 py-1.5 text-xs light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-neutral-400 light:text-neutral-600`,children:`Processes`}),(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[u,` running · `,d,` finished`]}),(0,R.jsx)(`div`,{className:`flex-1`}),d>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void f(),disabled:s,className:`flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500 hover:text-neutral-200 disabled:opacity-50 light:border-neutral-400 light:text-neutral-600`,title:`Drop all FINISHED processes from the list (running ones stay)`,children:[(0,R.jsx)(tt,{size:10}),`Clear finished`]})]}),a!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:a}),n.length>0&&(0,R.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-amber-700/40 bg-amber-900/20 px-3 py-1.5 text-[11px] text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsx)(be,{size:11,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[n.slice(-3).map((e,t)=>(0,R.jsxs)(`div`,{className:`truncate font-mono`,children:[(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[`[`,e.processName,`]`]}),` `,e.line]},`${e.processId}-${t}`)),n.length>3&&(0,R.jsxs)(`div`,{className:`text-neutral-500 light:text-neutral-600`,children:[`+`,n.length-3,` more watch match(es)`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded p-0.5 text-amber-300 hover:text-amber-100 light:text-amber-700 light:hover:text-amber-900`,title:`Clear watch alerts`,children:(0,R.jsx)(Ye,{size:11})})]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.length===0?(0,R.jsx)(`p`,{className:`px-1 text-[11px] italic text-neutral-500 light:text-neutral-600`,children:`No background processes yet. The agent will add them here when it starts dev servers, test watchers, builds, etc.`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.live.length>0&&(0,R.jsx)(UN,{label:`Running`,items:l.live,sessionId:e}),l.finished.length>0&&(0,R.jsx)(UN,{label:`Finished`,items:l.finished,sessionId:e})]})}),(0,R.jsx)(`footer`,{className:`border-t border-neutral-800 px-3 py-1 text-[10px] italic text-neutral-500 light:border-neutral-200 light:text-neutral-600`,children:`In-memory only — processes don't survive a server restart.`})]})}function HN(e){let t=[],n=[];for(let r of e)Kr.has(r.status)?t.push(r):n.push(r);return{live:t,finished:n}}function UN({label:e,items:t,sessionId:n}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 px-1 text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:e}),(0,R.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,R.jsx)(WN,{process:e,sessionId:n},e.id))})]})}function WN({process:e,sessionId:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(void 0),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(void 0),u=Kr.has(e.status);(0,v.useEffect)(()=>{if(!n)return;let r=!1;return L.getProcessOutput(t,e.id,80).then(e=>{r||a(e)}).catch(()=>{}),()=>{r=!0}},[n,t,e.id,e.endTime,e.status]);let d=Xr(e=>e.setProcesses),f=async()=>{s(!0),l(void 0);try{let n=await L.killProcess(t,e.id);n.ok||l(n.reason??`kill failed`),setTimeout(()=>{L.listProcesses(t).then(e=>d(t,e.processes)).catch(()=>void 0)},800)}catch(e){l(e instanceof N?e.code:e.message)}finally{s(!1)}},p=qN(e.startTime,e.endTime);return(0,R.jsxs)(`div`,{className:`rounded border px-1.5 py-1 text-xs ${GN(e.status)} ${u?`bg-neutral-900/40 light:bg-neutral-50`:`bg-neutral-900/20 light:bg-neutral-50/60`}`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-start gap-1.5 text-left`,children:[(0,R.jsx)(we,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 transition-transform light:text-neutral-600 ${n?`rotate-90`:``}`}),(0,R.jsx)(KN,{status:e.status,success:e.success}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-neutral-100 light:text-neutral-900`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:e.id})]}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[10px] text-neutral-500 light:text-neutral-600`,children:e.command})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:p})]}),n&&(0,R.jsxs)(`div`,{className:`mt-1 space-y-1 pl-[24px]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-neutral-500 light:text-neutral-600`,children:[(0,R.jsxs)(`span`,{children:[`PID `,e.pid]}),e.exitCode!==null&&(0,R.jsxs)(`span`,{children:[`exit `,e.exitCode]}),(0,R.jsx)(`div`,{className:`flex-1`}),u&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void f(),disabled:o,className:`flex items-center gap-1 rounded border border-red-700/40 px-1.5 py-0.5 text-[10px] text-red-300 hover:bg-red-900/40 disabled:opacity-50 light:border-red-400 light:text-red-700 light:hover:bg-red-100`,children:[(0,R.jsx)(se,{size:10}),`Kill`]})]}),c!==void 0&&(0,R.jsx)(`div`,{className:`text-[10px] text-red-300 light:text-red-700`,children:c}),i!==void 0&&i.stdout.length>0&&(0,R.jsxs)(`details`,{className:`rounded bg-neutral-950 light:bg-white`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer px-1 py-0.5 text-[10px] uppercase tracking-wider text-neutral-500 hover:text-neutral-300 light:text-neutral-600 light:hover:text-neutral-900`,children:`stdout (tail)`}),(0,R.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap px-1.5 py-1 font-mono text-[10px] text-neutral-300 light:text-neutral-800`,children:i.stdout.join(`
|
|
362
|
+
`).map(e=>e.trim()).filter(e=>e.length>0)}function CN({onError:e}){let t=Sr(),n=xr(e=>e.projects),r=MM(e=>e.settings),i=MM(e=>e.globalServers),a=MM(e=>e.byProject[t?.id??`__no_project__`]?.status??AM),o=MM(e=>e.byProject[t?.id??`__no_project__`]?.stdioTrust),s=MM(e=>e.refreshProject),c=MM(e=>e.setMcpEnabled),l=MM(e=>e.setMcpTruncation),u=MM(e=>e.upsertServer),d=MM(e=>e.deleteServer),f=MM(e=>e.probeServer),p=MM(e=>e.grantStdioTrust),m=MM(e=>e.revokeStdioTrust),[h,g]=(0,v.useState)(void 0),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(void 0),[w,T]=(0,v.useState)(void 0),[E,D]=(0,v.useState)(new Map),[O,k]=(0,v.useState)({}),[ee,te]=(0,v.useState)(new Set),ne=async()=>{try{let[e,n]=await Promise.all([L.listTools(t?.id),L.listToolOverrides()]),r=new Map;for(let t of e.mcp)r.set(`${t.scope}:${t.server}`,t.tools);D(r),k(n.projects)}catch(t){e(`Failed to load tool listing: ${HM(t)}`)}};(0,v.useEffect)(()=>{s(t?.id).catch(t=>{e(`Failed to load MCP config: ${HM(t)}`)}),ne()},[t?.id]);let re=async n=>{x(!0);try{await c(n),e(void 0),await s(t?.id)}catch(t){e(`Failed to toggle MCP: ${HM(t)}`)}finally{x(!1)}},ie=async t=>{x(!0);try{await l(t),T(void 0),e(void 0)}catch(t){e(`Failed to update MCP truncation: ${HM(t)}`)}finally{x(!1)}},ae=async(t,n)=>{let r=i[t];if(r!==void 0){x(!0);try{await u(t,{...r,enabled:n}),e(void 0)}catch(t){e(`Failed to update server: ${HM(t)}`)}finally{x(!1)}}},A=e=>{let t=i[e];t!==void 0&&(y(e),g({name:e,kind:typeof t.command==`string`&&t.command.length>0?`stdio`:`remote`,enabled:t.enabled!==!1,url:t.url??``,transport:t.transport??`auto`,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),command:t.command??``,argsText:(t.args??[]).join(`
|
|
363
|
+
`),env:Object.entries(t.env??{}).map(([e,t])=>({key:e,value:t})),cwd:t.cwd??``}))},j=()=>{y(void 0),g(xN())},M=async()=>{if(h===void 0)return;if(h.name.trim().length===0){e(`Name is required.`);return}if(h.kind===`remote`&&h.url.trim().length===0){e(`URL is required for remote servers.`);return}if(h.kind===`stdio`&&h.command.trim().length===0){e(`Command is required for stdio servers.`);return}let t={enabled:h.enabled};if(h.kind===`remote`){t.url=h.url,t.transport=h.transport;let e={};for(let t of h.headers)t.key.trim().length!==0&&(e[t.key]=t.value);Object.keys(e).length>0&&(t.headers=e)}else{t.command=h.command;let e=SN(h.argsText);e.length>0&&(t.args=e);let n={};for(let e of h.env)e.key.trim().length!==0&&(n[e.key]=e.value);Object.keys(n).length>0&&(t.env=n),h.cwd.trim().length>0&&(t.cwd=h.cwd)}x(!0);try{await u(h.name,t),e(void 0),g(void 0),y(void 0)}catch(t){e(`Failed to save server: ${HM(t)}`)}finally{x(!1)}},oe=async t=>{if(window.confirm(`Remove MCP server '${t}' from the global registry?`)){x(!0);try{await d(t),e(void 0)}catch(t){e(`Failed to remove server: ${HM(t)}`)}finally{x(!1)}}},se=async(n,r)=>{C(n);try{await f(n,r===`project`?t?.id:void 0),e(void 0),ne()}catch(t){e(`Probe failed for '${n}': ${HM(t)}`)}finally{C(void 0)}},ce=async(t,n)=>{x(!0);try{await L.setToolEnabled(`mcp`,t,n,`global`),await ne()}catch(t){e(`Toggle failed: ${HM(t)}`)}finally{x(!1)}},le=async(t,n,r)=>{x(!0);try{r===void 0?await L.clearToolProjectOverride(`mcp`,n,t):await L.setToolEnabled(`mcp`,n,r===`enabled`,`project`,t),await ne()}catch(t){e(`Override write failed: ${HM(t)}`)}finally{x(!1)}},ue=e=>{te(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(r===void 0)return(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500`,children:`Loading MCP config…`});let de=r.enabled,fe=a.filter(e=>e.scope===`global`),pe=a.filter(e=>e.scope===`project`);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`MCP servers extend the agent with custom tools. Servers configured here are loaded by every new session. Project-scoped servers in `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` at the project root are also loaded for sessions in that project (project entries override globals on name collision).`]}),(0,R.jsxs)(`div`,{className:`space-y-3 rounded border border-neutral-800 bg-neutral-900/40 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-neutral-100`,children:`MCP tools`}),(0,R.jsx)(`div`,{className:`text-[11px] text-neutral-500`,children:`Master switch. When off, no MCP tools reach the agent regardless of per-server state.`})]}),(0,R.jsx)(`button`,{onClick:()=>void re(!de),disabled:b,className:`rounded border px-3 py-1 text-xs ${de?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,children:de?`Enabled`:`Disabled`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 border-t border-neutral-800 pt-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-[240px] flex-1`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-neutral-100`,children:`Result truncation`}),(0,R.jsx)(`div`,{className:`text-[11px] text-neutral-500`,children:`Caps total text returned by each MCP tool before it enters agent context. Images pass through unchanged. Disable only for trusted, bounded tools.`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`label`,{className:`text-[11px] text-neutral-500`,htmlFor:`mcp-truncation-max`,children:`Max chars`}),(0,R.jsx)(`input`,{id:`mcp-truncation-max`,type:`number`,min:1,max:1e6,value:w??String(r.truncation.maxChars),onChange:e=>T(e.target.value),onBlur:()=>{let e=Number.parseInt(w??String(r.truncation.maxChars),10);Number.isFinite(e)&&e>=1&&e!==r.truncation.maxChars?ie({...r.truncation,maxChars:e}):T(void 0)},disabled:b||!r.truncation.enabled,className:`w-28 rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 disabled:opacity-50`}),(0,R.jsx)(`button`,{onClick:()=>void ie({...r.truncation,enabled:!r.truncation.enabled}),disabled:b,className:`rounded border px-3 py-1 text-xs ${r.truncation.enabled?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,children:r.truncation.enabled?`Truncating`:`Pass-through`})]})]})]}),t!==void 0&&(0,R.jsx)(EN,{projectName:t.name,trusted:o?.trusted===!0,gatedCount:a.filter(e=>e.scope===`project`&&e.state===`trust_required`).length,busy:b,onGrant:async()=>{x(!0);try{await p(t.id),e(void 0)}catch(t){e(`Failed to grant trust: ${HM(t)}`)}finally{x(!1)}},onRevoke:async()=>{if(window.confirm(`Revoke stdio MCP trust for "${t.name}"? This disconnects every running project-scoped MCP server.`)){x(!0);try{await m(t.id),e(void 0)}catch(t){e(`Failed to revoke trust: ${HM(t)}`)}finally{x(!1)}}}}),(0,R.jsx)(wN,{title:`Global servers`,emptyHint:`No global MCP servers configured. Click 'Add server' to add one.`,servers:fe.map(e=>({status:e,config:i[e.name]})),editable:!0,editingName:_??null,probingName:S??null,toolsByServer:E,expandedServers:ee,allOverrides:O,projects:n,busy:b,onToggleExpanded:ue,onToggleToolGlobal:(e,t)=>void ce(e,t),onSetProjectToolOverride:(e,t,n)=>void le(e,t,n),onToggle:(e,t)=>void ae(e,t),onProbe:e=>void se(e,`global`),onEdit:A,onRemove:e=>void oe(e)}),t!==void 0&&(0,R.jsx)(wN,{title:`Project servers (${t.name})`,emptyHint:(0,R.jsxs)(R.Fragment,{children:[`No project servers. Add a `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` file at the project root to define some — supports both`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`{ servers: {...} }`}),` and the standard`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`{ mcpServers: {...} }`}),` shape.`]}),servers:pe.map(e=>({status:e,config:void 0})),editable:!1,probingName:S??null,toolsByServer:E,expandedServers:ee,allOverrides:O,projects:n,busy:b,onToggleExpanded:ue,onToggleToolGlobal:(e,t)=>void ce(e,t),onSetProjectToolOverride:(e,t,n)=>void le(e,t,n),onProbe:e=>void se(e,`project`)}),h===void 0?(0,R.jsx)(`button`,{onClick:j,className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500`,children:`+ Add server`}):(0,R.jsx)(DN,{draft:h,isEditing:_!==void 0,busy:b,onChange:g,onSave:()=>void M(),onCancel:()=>{g(void 0),y(void 0)}})]})}function wN(e){return(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:e.title}),e.servers.length===0?(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-500`,children:e.emptyHint}):(0,R.jsx)(`div`,{className:`space-y-2`,children:e.servers.map(t=>{let n=t.status,r=e.editingName===n.name,i=e.probingName===n.name,a=`${n.scope}:${n.name}`,o=e.toolsByServer.get(a)??[],s=e.expandedServers.has(a),c=o.length>0;return(0,R.jsxs)(`div`,{className:`rounded border ${r?`border-neutral-500 bg-neutral-900`:`border-neutral-800 bg-neutral-900/40`}`,children:[(0,R.jsxs)(`div`,{className:`p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>c&&e.onToggleExpanded(a),disabled:!c,className:`flex h-5 w-5 items-center justify-center rounded text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 disabled:opacity-30`,title:c?s?`Hide tools`:`Show tools`:`No tools to show (server not connected or empty)`,children:s?(0,R.jsx)(Se,{size:16}):(0,R.jsx)(we,{size:16})}),(0,R.jsx)(TN,{state:n.state}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-neutral-100`,children:n.name}),(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-neutral-400`,children:n.transport??`auto`}),(0,R.jsxs)(`span`,{className:`text-[11px] text-neutral-500`,children:[n.toolCount,` tools`]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs`,children:[e.editable&&e.onToggle!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onToggle?.(n.name,!n.enabled),className:`rounded border px-2 py-0.5 ${n.enabled?`border-emerald-700/50 bg-emerald-900/20 text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`:`border-neutral-700 text-neutral-400 hover:border-neutral-500`}`,children:n.enabled?`Enabled`:`Disabled`}),(0,R.jsx)(`button`,{onClick:()=>e.onProbe(n.name),disabled:i,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500 disabled:opacity-50`,title:`Reconnect and refresh tool list`,children:i?`Probing…`:`Probe`}),e.editable&&e.onEdit!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onEdit?.(n.name),className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Edit`}),e.editable&&e.onRemove!==void 0&&(0,R.jsx)(`button`,{onClick:()=>e.onRemove?.(n.name),className:`rounded border border-red-700/50 px-2 py-0.5 text-red-300 hover:bg-red-900/20`,children:`Remove`})]})]}),n.kind===`stdio`?(0,R.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-neutral-500`,title:`${n.command??``} ${(n.args??[]).join(` `)}`.trim(),children:[n.command,` `,(n.args??[]).join(` `)]}):(0,R.jsx)(`div`,{className:`mt-1 truncate text-[11px] text-neutral-500`,title:n.url??``,children:n.url}),n.lastError!==void 0&&(0,R.jsx)(`div`,{className:`mt-1 truncate text-[11px] text-red-300 light:text-red-700`,title:n.lastError,children:n.lastError})]}),s&&c&&(0,R.jsxs)(`div`,{className:`space-y-2 border-t border-neutral-800 bg-neutral-950/40 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:`Tools`}),(0,R.jsx)(`div`,{className:`space-y-2`,children:o.map(t=>(0,R.jsx)(sN,{family:`mcp`,name:t.shortName,fqn:t.name,description:t.description,globalEnabled:t.globalEnabled,projects:e.projects,allOverrides:e.allOverrides,busy:e.busy,onToggleGlobal:n=>e.onToggleToolGlobal(t.name,n),onSetProjectOverride:(n,r)=>e.onSetProjectToolOverride(n,t.name,r)},`mcp:${t.name}`))})]})]},a)})})]})}function TN({state:e}){return(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e===`connected`?`bg-emerald-500`:e===`connecting`?`bg-amber-400 animate-pulse`:e===`error`?`bg-red-500`:e===`disabled`?`bg-neutral-700`:`bg-neutral-500`}`,title:e})}function EN(e){return e.trusted?(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-neutral-800 bg-neutral-900/40 px-3 py-1.5 text-[11px] text-neutral-500`,children:[(0,R.jsxs)(`span`,{children:[`Stdio MCP trust granted for`,` `,(0,R.jsx)(`strong`,{className:`text-neutral-300`,children:e.projectName}),`. Project-local stdio MCP servers from `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` will spawn on session create.`]}),(0,R.jsx)(`button`,{onClick:()=>void e.onRevoke(),disabled:e.busy,className:`rounded border border-neutral-700 px-2 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500 hover:text-neutral-200 disabled:opacity-50`,title:`Disconnects every running project-scoped MCP server`,children:`Revoke`})]}):e.gatedCount===0?null:(0,R.jsxs)(`div`,{className:`rounded border border-amber-700/40 bg-amber-900/20 p-3 text-xs text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsxs)(`div`,{className:`mb-2 font-medium`,children:[`This project wants to spawn `,e.gatedCount,` stdio MCP server`,e.gatedCount===1?``:`s`,`.`]}),(0,R.jsxs)(`p`,{className:`text-[11px] leading-relaxed`,children:[(0,R.jsx)(`strong`,{children:e.projectName}),`'s `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` declares MCP server`,e.gatedCount===1?``:`s`,` that pi-forge would launch as local subprocess`,e.gatedCount===1?``:`es`,`. Stdio MCP runs arbitrary commands on this machine with whatever env you've passed through — only trust projects whose`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`.mcp.json`}),` you've reviewed and approve of. Remote (URL) entries in this project are unaffected by this gate.`]}),(0,R.jsx)(`div`,{className:`mt-2 flex gap-2`,children:(0,R.jsx)(`button`,{onClick:()=>void e.onGrant(),disabled:e.busy,className:`rounded bg-amber-200 px-3 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-100 disabled:opacity-50 light:bg-amber-600 light:text-amber-50 light:hover:bg-amber-700`,children:e.busy?`Granting…`:`Trust this project`})})]})}function DN(e){let{draft:t,busy:n}=e,r=(n,r)=>{e.onChange({...t,[n]:r})};return(0,R.jsxs)(`div`,{className:`rounded border border-neutral-700 bg-neutral-900 p-3`,children:[(0,R.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-400`,children:e.isEditing?`Edit '${t.name}'`:`Add MCP server`}),(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded border border-neutral-800 bg-neutral-950 p-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`Type`}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 ${e.isEditing?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[(0,R.jsx)(`input`,{type:`radio`,name:`mcp-kind`,checked:t.kind===`remote`,disabled:e.isEditing,onChange:()=>r(`kind`,`remote`)}),(0,R.jsx)(`span`,{children:`Remote URL`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 ${e.isEditing?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[(0,R.jsx)(`input`,{type:`radio`,name:`mcp-kind`,checked:t.kind===`stdio`,disabled:e.isEditing,onChange:()=>r(`kind`,`stdio`)}),(0,R.jsx)(`span`,{children:`Local subprocess (stdio)`})]}),e.isEditing&&(0,R.jsx)(`span`,{className:`text-[10px] italic text-neutral-600`,children:`Locked while editing — delete and re-add to change type.`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[80px_1fr] items-center gap-2 text-xs`,children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Name`}),(0,R.jsx)(`input`,{value:t.name,onChange:e=>r(`name`,e.target.value),disabled:e.isEditing,placeholder:`my-server`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500 disabled:opacity-50`}),t.kind===`remote`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`URL`}),(0,R.jsx)(`input`,{value:t.url,onChange:e=>r(`url`,e.target.value),placeholder:`https://mcp.example.com/sse`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Transport`}),(0,R.jsxs)(`select`,{value:t.transport,onChange:e=>r(`transport`,e.target.value),className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:`auto`,children:`auto (StreamableHTTP, fall back to SSE)`}),(0,R.jsx)(`option`,{value:`streamable-http`,children:`streamable-http`}),(0,R.jsx)(`option`,{value:`sse`,children:`sse`})]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Command`}),(0,R.jsx)(`input`,{value:t.command,onChange:e=>r(`command`,e.target.value),placeholder:`npx (or absolute path to a binary)`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`self-start pt-1 text-neutral-500`,children:`Args`}),(0,R.jsx)(`textarea`,{value:t.argsText,onChange:e=>r(`argsText`,e.target.value),placeholder:`-y
|
|
364
|
+
@modelcontextprotocol/server-everything`,rows:3,spellCheck:!1,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`cwd`}),(0,R.jsx)(`input`,{value:t.cwd,onChange:e=>r(`cwd`,e.target.value),placeholder:`(blank ↦ default: project path for project servers)`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 font-mono text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsx)(`label`,{className:`text-neutral-500`,children:`Enabled`}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.enabled,onChange:e=>r(`enabled`,e.target.checked)}),(0,R.jsx)(`span`,{className:`text-[11px] text-neutral-500`,children:`Disabled servers don't connect or contribute tools.`})]})]}),t.kind===`remote`?(0,R.jsx)(ON,{label:`Headers`,emptyHint:"No headers. Add `Authorization: Bearer …` here for auth.",keyPlaceholder:`Authorization`,valuePlaceholder:`Bearer …`,rows:t.headers,onChange:e=>r(`headers`,e)}):(0,R.jsx)(ON,{label:`Env`,emptyHint:`No env. Add API keys / config your subprocess needs (PATH / HOME / locale are inherited automatically).`,keyPlaceholder:`GITHUB_TOKEN`,valuePlaceholder:`ghp_…`,rows:t.env,onChange:e=>r(`env`,e)}),(0,R.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{onClick:e.onCancel,className:`rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:`Cancel`}),(0,R.jsx)(`button`,{onClick:e.onSave,disabled:n,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 disabled:opacity-50`,children:n?`Saving…`:`Save`})]})]})}function ON(e){let{rows:t}=e;return(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,R.jsx)(`h5`,{className:`text-[11px] font-semibold uppercase tracking-wider text-neutral-500`,children:e.label}),(0,R.jsxs)(`button`,{onClick:()=>e.onChange([...t,{key:``,value:``}]),className:`rounded border border-neutral-700 px-2 py-0.5 text-[11px] text-neutral-300 hover:border-neutral-500`,children:[`+ `,e.label.replace(/s$/,``)]})]}),t.length===0&&(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-600`,children:e.emptyHint}),t.map((n,r)=>(0,R.jsxs)(`div`,{className:`mb-1 grid grid-cols-[1fr_2fr_auto] gap-1`,children:[(0,R.jsx)(`input`,{value:n.key,onChange:i=>{let a=[...t];a[r]={...n,key:i.target.value},e.onChange(a)},placeholder:e.keyPlaceholder,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-[11px] font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`input`,{value:n.value===bN?``:n.value,onChange:i=>{let a=[...t];a[r]={...n,value:i.target.value},e.onChange(a)},placeholder:n.value===bN?`leave blank to keep stored value`:e.valuePlaceholder,type:`password`,className:`rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-[11px] font-mono text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>e.onChange(t.filter((e,t)=>t!==r)),className:`rounded border border-neutral-700 px-2 text-[11px] text-neutral-400 hover:text-red-300 light:hover:text-red-700`,title:`Remove ${e.label.toLowerCase()}`,children:`×`})]},r)),t.some(e=>e.value===bN)&&(0,R.jsx)(`p`,{className:`mt-1 text-[10px] italic text-neutral-500`,children:`Values with the redaction sentinel keep their stored value when you save.`})]})}var kN=8;function AN(){let e=ji(e=>e.version),t=ji(e=>e.loaded),n=ji(e=>e.passwordAuthEnabled),r=ji(e=>e.ldapEnabled),i=gr(e=>e.ldapEnabled),a=t&&n&&!r&&!i;return(0,R.jsxs)(`div`,{className:`space-y-6 text-sm text-neutral-300`,children:[(0,R.jsxs)(`header`,{className:`space-y-1`,children:[(0,R.jsx)(`h2`,{className:`text-base font-semibold text-neutral-100`,children:`pi-forge`}),(0,R.jsxs)(`p`,{className:`text-xs text-neutral-500`,children:[`Browser interface for the`,` `,(0,R.jsx)(`a`,{href:`https://github.com/badlogic/pi-mono`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`pi coding agent`}),`.`]})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Version`}),(0,R.jsx)(`p`,{className:`font-mono text-sm`,children:t?e.length>0?e:(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`unknown`}):(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`loading…`})})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Links`}),(0,R.jsxs)(`ul`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`github.com/Devin-Marks/pi-forge`})}),(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge/blob/main/CHANGELOG.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`Changelog`})}),(0,R.jsx)(`li`,{children:(0,R.jsx)(`a`,{href:`https://github.com/Devin-Marks/pi-forge/blob/main/SECURITY.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 underline hover:text-blue-300 light:text-blue-700 light:hover:text-blue-900`,children:`Security`})})]})]}),a&&(0,R.jsx)(jN,{})]})}function jN(){let e=gr(e=>e.changePassword),t=gr(e=>e.changePasswordPending),n=gr(e=>e.changePasswordError),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(void 0),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(p.current&&!t&&n===void 0){i(``),o(``),c(``),f(!0);let e=window.setTimeout(()=>f(!1),2500);return()=>window.clearTimeout(e)}p.current=t},[t,n]);let m=t=>{if(t.preventDefault(),u(void 0),f(!1),a.length<kN){u(`New password must be at least ${kN} characters.`);return}if(a!==s){u(`New password and confirmation do not match.`);return}if(a===r){u(`New password must differ from the current one.`);return}e(r,a)},h=l??MN(n);return(0,R.jsxs)(`section`,{className:`space-y-2 border-t border-neutral-800 pt-5`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-neutral-500`,children:`Change password`}),(0,R.jsx)(`p`,{className:`text-xs text-neutral-500`,children:`Updates the scrypt hash on disk; existing browser sessions stay signed in.`}),(0,R.jsxs)(`form`,{onSubmit:m,className:`space-y-2`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`Current password`}),(0,R.jsx)(`input`,{type:`password`,value:r,onChange:e=>i(e.target.value),autoComplete:`current-password`,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`New password`}),(0,R.jsx)(`input`,{type:`password`,value:a,onChange:e=>o(e.target.value),autoComplete:`new-password`,minLength:kN,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-400`,children:`Confirm new password`}),(0,R.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),autoComplete:`new-password`,minLength:kN,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 text-sm outline-none focus:border-neutral-500`})]}),h!==void 0&&(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:h}),d&&(0,R.jsx)(`p`,{role:`status`,className:`text-xs text-emerald-400 light:text-emerald-700`,children:`Password updated.`}),(0,R.jsx)(`button`,{type:`submit`,disabled:t||r.length===0||a.length===0,className:`rounded-md bg-neutral-100 px-3 py-1.5 text-xs font-medium text-neutral-900 transition hover:bg-white disabled:cursor-not-allowed disabled:opacity-50`,children:t?`Saving…`:`Update password`})]})]})}function MN(e){if(e!==void 0)switch(e){case`invalid_password`:return`Current password is incorrect.`;case`password_unchanged`:return`New password must differ from the current one.`;case`ui_password_not_configured`:return`Password auth is not configured on this server.`;case`auth_required`:return`Session expired — sign in again.`;default:return`Could not change password: ${e}`}}function NN({sessionId:e}){let t=Vr(t=>t.pendingBySession[e]);return t===void 0?null:(0,R.jsx)(PN,{pending:t},t.requestId)}function PN({pending:e}){let t=Vr(e=>e.clearPending),[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(void 0),[c,l]=(0,v.useState)(()=>e.questions.map(()=>null)),u=e.questions[n];if(u===void 0)return null;let d=e=>{l(t=>{let r=t.slice();return r[n]={...r[n]??{},...e},r})},f=c[n],p=()=>u.multiSelect===!0?f?.multiLabels!==void 0&&f.multiLabels.length>0:f?.selectedLabel!==void 0||f?.customText!==void 0&&f.customText.trim().length>0,m=()=>{let t=[];for(let n=0;n<e.questions.length;n+=1){let r=e.questions[n],i=c[n];if(i!=null){if(r.multiSelect===!0){t.push({questionIndex:n,question:r.question,kind:`multi`,answer:null,...i.multiLabels===void 0?{}:{selected:i.multiLabels}});continue}if(i.selectedLabel!==void 0){let e=r.options.find(e=>e.label===i.selectedLabel);t.push({questionIndex:n,question:r.question,kind:`option`,answer:i.selectedLabel,...e?.preview===void 0?{}:{preview:e.preview}});continue}if(i.customText!==void 0&&i.customText.trim().length>0){t.push({questionIndex:n,question:r.question,kind:`custom`,answer:i.customText.trim()});continue}}}return t},h=async()=>{if(p()){if(n<e.questions.length-1){r(n+1);return}a(!0),s(void 0);try{await L.submitAskUserQuestionAnswer(e.sessionId,{requestId:e.requestId,answers:m()}),t(e.sessionId,e.requestId)}catch(e){s(e instanceof N?`${e.code}: ${e.message}`:e.message),a(!1)}}},g=async()=>{a(!0),s(void 0);try{let r={questionIndex:n,question:u.question,kind:`chat`,answer:`Chat about this`};await L.submitAskUserQuestionAnswer(e.sessionId,{requestId:e.requestId,answers:[r],cancelled:!0}),t(e.sessionId,e.requestId)}catch(e){s(e instanceof N?`${e.code}: ${e.message}`:e.message),a(!1)}};return(0,R.jsx)(`div`,{className:`flex max-h-[60vh] shrink-0 flex-col overflow-hidden border-t border-amber-700/50 bg-neutral-900/40 light:border-amber-400 light:bg-amber-50/60`,children:(0,R.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-4 py-2 light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-amber-400 light:text-amber-700`,children:`Agent question`}),e.questions.length>1&&(0,R.jsx)(`div`,{className:`ml-2 flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:e.questions.map((e,t)=>(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${t===n?`bg-amber-900/40 text-amber-200 light:bg-amber-100 light:text-amber-900`:c[t]===null?`text-neutral-500`:`bg-neutral-800 text-neutral-300 light:bg-neutral-200 light:text-neutral-700`}`,title:e.question,children:e.header},t))}),(0,R.jsx)(`div`,{className:`flex-1`}),(0,R.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:[n+1,` of `,e.questions.length]})]}),o!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-4 py-2 text-xs text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:o}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3`,children:(0,R.jsx)(FN,{question:u,draft:f??null,onChange:e=>d(e)})}),(0,R.jsxs)(`footer`,{className:`flex items-center gap-2 border-t border-neutral-800 px-4 py-2 light:border-neutral-200`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(),disabled:i,className:`flex items-center gap-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500 disabled:opacity-50 light:border-neutral-400 light:text-neutral-700`,title:`Abandon the structured questionnaire and reply in free-form chat`,children:[(0,R.jsx)(Be,{size:12}),`Chat about this`]}),(0,R.jsx)(`div`,{className:`flex-1`}),n>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(n-1),disabled:i,className:`flex items-center gap-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-300 hover:border-neutral-500 disabled:opacity-50 light:border-neutral-400 light:text-neutral-700`,children:[(0,R.jsx)(Ce,{size:12}),`Back`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void h(),disabled:i||!p(),className:`flex items-center gap-1 rounded bg-emerald-700 px-3 py-1 text-xs text-white hover:bg-emerald-600 disabled:opacity-50`,children:[i?(0,R.jsx)(pe,{size:12,className:`animate-spin`}):null,n<e.questions.length-1?(0,R.jsxs)(R.Fragment,{children:[`Next `,(0,R.jsx)(we,{size:12})]}):i?`Submitting…`:`Submit`]})]})]})})}function FN({question:e,draft:t,onChange:n}){let r=(0,v.useMemo)(()=>e.options.some(e=>typeof e.preview==`string`&&e.preview.length>0),[e.options]),i=e.multiSelect===!0,a=!i&&!r,[o,s]=(0,v.useState)(void 0),c=e.options.find(e=>e.label===o);return(0,v.useEffect)(()=>{r&&o===void 0&&e.options[0]!==void 0&&s(e.options[0].label)},[r,o,e.options]),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-base font-medium text-neutral-100 light:text-neutral-900`,children:e.question}),r&&!i?(0,R.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,R.jsx)(`div`,{className:`col-span-1 space-y-1`,children:e.options.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{n({selectedLabel:e.label}),s(e.label)},onMouseEnter:()=>s(e.label),className:`w-full rounded border px-2 py-1.5 text-left text-xs ${t?.selectedLabel===e.label?`border-emerald-600 bg-emerald-900/30 text-emerald-100 light:bg-emerald-50 light:text-emerald-900`:o===e.label?`border-neutral-600 bg-neutral-900 text-neutral-100 light:border-neutral-400 light:bg-neutral-100 light:text-neutral-900`:`border-neutral-800 bg-neutral-900/40 text-neutral-300 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50 light:text-neutral-700`}`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]},e.label))}),(0,R.jsx)(`div`,{className:`col-span-2 overflow-auto rounded border border-neutral-800 bg-neutral-950 p-3 light:border-neutral-300 light:bg-neutral-50`,children:c?.preview!==void 0&&c.preview.length>0?(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[11px] text-neutral-200 light:text-neutral-800`,children:c.preview}):(0,R.jsx)(`p`,{className:`text-xs italic text-neutral-500 light:text-neutral-600`,children:`No preview for this option.`})})]}):i?(0,R.jsx)(`div`,{className:`space-y-1`,children:e.options.map(e=>{let r=(t?.multiLabels??[]).includes(e.label);return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded border px-2 py-1.5 text-xs ${r?`border-emerald-600 bg-emerald-900/30 light:bg-emerald-50`:`border-neutral-800 bg-neutral-900/40 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50`}`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>{let i=new Set(t?.multiLabels??[]);r?i.delete(e.label):i.add(e.label),n({multiLabels:Array.from(i)})},className:`mt-1`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium text-neutral-100 light:text-neutral-900`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]})]},e.label)})}):(0,R.jsxs)(`div`,{className:`space-y-1`,children:[e.options.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n({selectedLabel:e.label,customText:void 0}),className:`w-full rounded border px-2 py-1.5 text-left text-xs ${t?.selectedLabel===e.label?`border-emerald-600 bg-emerald-900/30 light:bg-emerald-50`:`border-neutral-800 bg-neutral-900/40 hover:border-neutral-600 light:border-neutral-300 light:bg-neutral-50`}`,children:[(0,R.jsx)(`div`,{className:`font-medium text-neutral-100 light:text-neutral-900`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-neutral-400 light:text-neutral-600`,children:e.description})]},e.label)),a&&(0,R.jsxs)(`div`,{className:`pt-2`,children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:`Type something`}),(0,R.jsx)(`textarea`,{value:t?.customText??``,onChange:e=>n({customText:e.target.value,selectedLabel:void 0}),rows:2,placeholder:`Or type your own answer…`,className:`w-full rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 light:border-neutral-300 light:bg-white light:text-neutral-900`})]})]})]})}function IN({sessionId:e,onClose:t}){let n=Ur(t=>Wr(t,e)),r=Ur(e=>e.set),[i,a]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{let t=!1;return L.listTodos(e).then(n=>{if(t)return;let i=Ur.getState().byId[e];(i===void 0||i.tasks.length===0)&&r(e,{tasks:n.tasks,nextId:n.nextId})}).catch(e=>{t||a(e instanceof N?e.code:e.message)}),()=>{t=!0}},[e,r]);let o=(0,v.useMemo)(()=>Gr(n),[n]),s=(0,v.useMemo)(()=>LN(n.tasks),[n.tasks]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-neutral-950 text-neutral-200 light:bg-white light:text-neutral-900`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-3 py-1.5 text-xs light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-neutral-400 light:text-neutral-600`,children:`Todos`}),(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[o.completed,`/`,o.total,o.inProgress>0?` · ${o.inProgress} in progress`:``]}),(0,R.jsx)(`div`,{className:`flex-1`}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200 light:hover:bg-neutral-200 light:hover:text-neutral-900`,title:`Hide todo panel`,children:(0,R.jsx)(at,{size:12})})]}),i!==void 0&&n.tasks.length===0&&(0,R.jsxs)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:[`Failed to load todos: `,i]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:o.total===0?(0,R.jsx)(`p`,{className:`px-1 text-[11px] italic text-neutral-500 light:text-neutral-600`,children:`No todos yet. The agent will add tasks here when it's planning multi-step work.`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[s.in_progress.length>0&&(0,R.jsx)(RN,{label:`In Progress`,tasks:s.in_progress}),s.pending.length>0&&(0,R.jsx)(RN,{label:`Pending`,tasks:s.pending}),s.completed.length>0&&(0,R.jsx)(RN,{label:`Completed`,tasks:s.completed})]})})]})}function LN(e){let t={pending:[],in_progress:[],completed:[],deleted:[]};for(let n of e)t[n.status].push(n);return t}function RN({label:e,tasks:t}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 px-1 text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:e}),(0,R.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,R.jsx)(zN,{task:e},e.id))})]})}function zN({task:e}){let[t,n]=(0,v.useState)(!1),r=e.description!==void 0||e.activeForm!==void 0||e.blockedBy!==void 0&&e.blockedBy.length>0||e.owner!==void 0;return(0,R.jsxs)(`div`,{className:`rounded border border-transparent px-1 py-0.5 text-xs hover:border-neutral-800 light:hover:border-neutral-300`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(e=>!e),className:`flex w-full items-start gap-1.5 text-left ${r?`cursor-pointer`:`cursor-default`}`,children:[r&&(0,R.jsx)(we,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 transition-transform light:text-neutral-600 ${t?`rotate-90`:``}`}),!r&&(0,R.jsx)(`span`,{className:`inline-block w-[11px] shrink-0`}),(0,R.jsx)(BN,{status:e.status,activeForm:e.activeForm}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`${e.status===`completed`?`text-neutral-500 line-through light:text-neutral-500`:e.status===`in_progress`?`text-neutral-100 light:text-neutral-900`:`text-neutral-300 light:text-neutral-700`}`,children:e.subject}),e.status===`in_progress`&&e.activeForm!==void 0&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] italic text-amber-400 light:text-amber-700`,children:e.activeForm})]}),(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:[`#`,e.id]})]}),t&&r&&(0,R.jsxs)(`div`,{className:`mt-1 space-y-0.5 pl-[34px] text-[11px] text-neutral-400 light:text-neutral-600`,children:[e.description!==void 0&&(0,R.jsx)(`div`,{children:e.description}),e.blockedBy!==void 0&&e.blockedBy.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:`blocked by:`}),` `,e.blockedBy.map(e=>`#${e}`).join(`, `)]}),e.owner!==void 0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:`owner:`}),` `,e.owner]})]})]})}function BN({status:e,activeForm:t}){return e===`in_progress`?(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-amber-400 light:text-amber-700`,"aria-label":t??`in progress`}):e===`completed`?(0,R.jsx)(xe,{size:11,className:`mt-0.5 shrink-0 text-emerald-400 light:text-emerald-700`,"aria-label":`completed`}):e===`deleted`?(0,R.jsx)(at,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 light:text-neutral-500`,"aria-label":`deleted`}):(0,R.jsx)(Ee,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 light:text-neutral-500`,"aria-label":`pending`})}function VN({sessionId:e}){let t=Xr(t=>Zr(t,e)),n=Xr(t=>Qr(t,e)),r=Xr(e=>e.setProcesses),i=Xr(e=>e.clearWatches),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;return L.listProcesses(e).then(n=>{if(t)return;let i=Xr.getState().bySession[e];(i===void 0||i.length===0)&&r(e,n.processes)}).catch(e=>{t||o(e instanceof N?e.code:e.message)}),()=>{t=!0}},[e,r]);let l=(0,v.useMemo)(()=>HN(t),[t]),u=$r(t),d=t.length-u,f=async()=>{c(!0),o(void 0);try{await L.clearProcesses(e)}catch(e){o(e instanceof N?e.code:e.message)}finally{c(!1)}};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-neutral-950 text-neutral-200 light:bg-white light:text-neutral-900`,children:[(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-neutral-800 px-3 py-1.5 text-xs light:border-neutral-200`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-neutral-400 light:text-neutral-600`,children:`Processes`}),(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[u,` running · `,d,` finished`]}),(0,R.jsx)(`div`,{className:`flex-1`}),d>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void f(),disabled:s,className:`flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500 hover:text-neutral-200 disabled:opacity-50 light:border-neutral-400 light:text-neutral-600`,title:`Drop all FINISHED processes from the list (running ones stay)`,children:[(0,R.jsx)(tt,{size:10}),`Clear finished`]})]}),a!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-800`,children:a}),n.length>0&&(0,R.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-amber-700/40 bg-amber-900/20 px-3 py-1.5 text-[11px] text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsx)(be,{size:11,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[n.slice(-3).map((e,t)=>(0,R.jsxs)(`div`,{className:`truncate font-mono`,children:[(0,R.jsxs)(`span`,{className:`text-neutral-500 light:text-neutral-600`,children:[`[`,e.processName,`]`]}),` `,e.line]},`${e.processId}-${t}`)),n.length>3&&(0,R.jsxs)(`div`,{className:`text-neutral-500 light:text-neutral-600`,children:[`+`,n.length-3,` more watch match(es)`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded p-0.5 text-amber-300 hover:text-amber-100 light:text-amber-700 light:hover:text-amber-900`,title:`Clear watch alerts`,children:(0,R.jsx)(Ye,{size:11})})]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.length===0?(0,R.jsx)(`p`,{className:`px-1 text-[11px] italic text-neutral-500 light:text-neutral-600`,children:`No background processes yet. The agent will add them here when it starts dev servers, test watchers, builds, etc.`}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.live.length>0&&(0,R.jsx)(UN,{label:`Running`,items:l.live,sessionId:e}),l.finished.length>0&&(0,R.jsx)(UN,{label:`Finished`,items:l.finished,sessionId:e})]})}),(0,R.jsx)(`footer`,{className:`border-t border-neutral-800 px-3 py-1 text-[10px] italic text-neutral-500 light:border-neutral-200 light:text-neutral-600`,children:`In-memory only — processes don't survive a server restart.`})]})}function HN(e){let t=[],n=[];for(let r of e)Kr.has(r.status)?t.push(r):n.push(r);return{live:t,finished:n}}function UN({label:e,items:t,sessionId:n}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 px-1 text-[10px] uppercase tracking-wider text-neutral-500 light:text-neutral-600`,children:e}),(0,R.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,R.jsx)(WN,{process:e,sessionId:n},e.id))})]})}function WN({process:e,sessionId:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(void 0),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(void 0),u=Kr.has(e.status);(0,v.useEffect)(()=>{if(!n)return;let r=!1;return L.getProcessOutput(t,e.id,80).then(e=>{r||a(e)}).catch(()=>{}),()=>{r=!0}},[n,t,e.id,e.endTime,e.status]);let d=Xr(e=>e.setProcesses),f=async()=>{s(!0),l(void 0);try{let n=await L.killProcess(t,e.id);n.ok||l(n.reason??`kill failed`),setTimeout(()=>{L.listProcesses(t).then(e=>d(t,e.processes)).catch(()=>void 0)},800)}catch(e){l(e instanceof N?e.code:e.message)}finally{s(!1)}},p=qN(e.startTime,e.endTime);return(0,R.jsxs)(`div`,{className:`rounded border px-1.5 py-1 text-xs ${GN(e.status)} ${u?`bg-neutral-900/40 light:bg-neutral-50`:`bg-neutral-900/20 light:bg-neutral-50/60`}`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-start gap-1.5 text-left`,children:[(0,R.jsx)(we,{size:11,className:`mt-0.5 shrink-0 text-neutral-500 transition-transform light:text-neutral-600 ${n?`rotate-90`:``}`}),(0,R.jsx)(KN,{status:e.status,success:e.success}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-neutral-100 light:text-neutral-900`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:e.id})]}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[10px] text-neutral-500 light:text-neutral-600`,children:e.command})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[10px] text-neutral-500 light:text-neutral-600`,children:p})]}),n&&(0,R.jsxs)(`div`,{className:`mt-1 space-y-1 pl-[24px]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-neutral-500 light:text-neutral-600`,children:[(0,R.jsxs)(`span`,{children:[`PID `,e.pid]}),e.exitCode!==null&&(0,R.jsxs)(`span`,{children:[`exit `,e.exitCode]}),(0,R.jsx)(`div`,{className:`flex-1`}),u&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void f(),disabled:o,className:`flex items-center gap-1 rounded border border-red-700/40 px-1.5 py-0.5 text-[10px] text-red-300 hover:bg-red-900/40 disabled:opacity-50 light:border-red-400 light:text-red-700 light:hover:bg-red-100`,children:[(0,R.jsx)(se,{size:10}),`Kill`]})]}),c!==void 0&&(0,R.jsx)(`div`,{className:`text-[10px] text-red-300 light:text-red-700`,children:c}),i!==void 0&&i.stdout.length>0&&(0,R.jsxs)(`details`,{className:`rounded bg-neutral-950 light:bg-white`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer px-1 py-0.5 text-[10px] uppercase tracking-wider text-neutral-500 hover:text-neutral-300 light:text-neutral-600 light:hover:text-neutral-900`,children:`stdout (tail)`}),(0,R.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap px-1.5 py-1 font-mono text-[10px] text-neutral-300 light:text-neutral-800`,children:i.stdout.join(`
|
|
365
365
|
`)})]}),i!==void 0&&i.stderr.length>0&&(0,R.jsxs)(`details`,{className:`rounded bg-neutral-950 light:bg-white`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer px-1 py-0.5 text-[10px] uppercase tracking-wider text-neutral-500 hover:text-neutral-300 light:text-neutral-600 light:hover:text-neutral-900`,children:`stderr (tail)`}),(0,R.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap px-1.5 py-1 font-mono text-[10px] text-red-300 light:text-red-700`,children:i.stderr.join(`
|
|
366
|
-
`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 text-[10px]`,children:[(0,R.jsx)(YN,{sessionId:t,processId:e.id,stream:`stdout`}),(0,R.jsx)(YN,{sessionId:t,processId:e.id,stream:`stderr`})]})]})]})}function GN(e){return e===`running`||e===`terminating`?`border-neutral-700 light:border-neutral-300`:e===`terminate_timeout`?`border-amber-700/50 light:border-amber-400`:e===`killed`?`border-amber-700/40 light:border-amber-400`:`border-neutral-800 light:border-neutral-200`}function KN({status:e,success:t}){return e===`running`?(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-emerald-400 light:text-emerald-700`,"aria-label":`running`}):e===`terminating`||e===`terminate_timeout`?(0,R.jsx)(ot,{size:11,className:`mt-0.5 shrink-0 text-amber-400 light:text-amber-700`,"aria-label":`terminating`}):e===`killed`?(0,R.jsx)(_e,{size:11,className:`mt-0.5 shrink-0 text-amber-400 light:text-amber-700`,"aria-label":`killed`}):t===!0?(0,R.jsx)(oe,{size:11,className:`mt-0.5 shrink-0 text-emerald-400 light:text-emerald-700`,"aria-label":`exited 0`}):(0,R.jsx)(se,{size:11,className:`mt-0.5 shrink-0 text-red-400 light:text-red-700`,"aria-label":`exited non-zero`})}function qN(e,t){let n=(t??Date.now())-e;if(n<1e3)return`${n}ms`;let r=n/1e3;if(r<60)return`${r.toFixed(1)}s`;let i=r/60;return i<60?`${i.toFixed(1)}m`:`${(i/60).toFixed(1)}h`}function JN(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function YN({sessionId:e,processId:t,stream:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0);return(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let r=window.open(`about:blank`,`_blank`);if(r===null){o(`popup blocked — allow popups for this site`);return}i(!0),o(void 0),(async()=>{try{let i=L.processLogFileUrl(e,t,n),a=Ht(),s={};a!==void 0&&(s.Authorization=`Bearer ${a.token}`);let c=await fetch(i,{headers:s});if(!c.ok){r.close(),o(`${c.status} ${c.statusText}`);return}let l=await c.text(),u=`<!doctype html><html><head><meta charset="utf-8"><title>${JN(`${n} — ${t}`)}</title><meta name="color-scheme" content="dark light"><style>html,body{margin:0;padding:0;background:#0a0a0a;color:#e5e5e5;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:1.5;tab-size:4}@media (prefers-color-scheme: light){html,body{background:#fafafa;color:#171717}}pre{margin:0;padding:1rem;white-space:pre-wrap;word-break:break-word}</style></head><body><pre>${JN(l)}</pre></body></html>`,d=new Blob([u],{type:`text/html;charset=utf-8`}),f=URL.createObjectURL(d);r.location.href=f,setTimeout(()=>URL.revokeObjectURL(f),6e4)}catch(e){r.close(),o(e instanceof Error?e.message:String(e))}finally{i(!1)}})()},disabled:r,className:`text-sky-400 hover:underline disabled:opacity-50 light:text-sky-700`,title:a,children:r?`loading…`:a===void 0?`full ${n} log`:`${n}: ${a}`})}function XN(){let e=Sr(),t=Ei(t=>e===void 0?void 0:t.treeByProject[e.id]),n=Ei(t=>e===void 0?!1:t.treeLoading[e.id]??!1),r=Ei(e=>e.error),i=Ei(e=>e.loadTree),a=Ei(e=>e.openFile),o=Ei(e=>e.createFile),s=Ei(e=>e.createFolder),c=Ei(e=>e.renameEntry),l=Ei(e=>e.moveEntry),u=Ei(e=>e.deleteEntry),[d,f]=(0,v.useState)({"":!0}),[p,m]=(0,v.useState)(void 0),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(void 0),[S,C]=(0,v.useState)(void 0),w=(0,v.useRef)(null),T=(0,v.useRef)(void 0),E=Ei(e=>e.uploadFiles),[D,O]=(0,v.useState)(void 0),k=qj(e=>e.requestChatInsert),ee=qj(e=>e.openEditorPane),[te,ne]=(0,v.useState)(new Set);if((0,v.useEffect)(()=>{e!==void 0&&i(e.id)},[e?.id,i]),e===void 0)return(0,R.jsx)(`div`,{className:`p-4 text-xs italic text-neutral-500`,children:`Select a project to browse its files.`});let re=async(t,n,r)=>{x(void 0);try{if(t===`file`){let t=await o(e.id,n,r);await a(e.id,t),ee()}else await s(e.id,n,r)}catch{}},ie=(e,t,n)=>{f(e=>({...e,[t]:!0})),x({kind:`create`,entryKind:n,parentAbsPath:e})},ae=(e,t)=>{m(e),g(t)},A=async t=>{let n=h.trim();if(m(void 0),g(``),n.length!==0)try{await c(e.id,t,n)}catch{}},j=()=>ne(new Set),M=e=>{ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=(e,t,n)=>{x({kind:`delete`,absPath:e,name:t,isDir:n,recursive:!1})},se=async()=>{if(b?.kind!==`delete`)return;let{absPath:t,name:n,isDir:r,recursive:i}=b;x(void 0);try{await u(e.id,t,i?{recursive:!0}:void 0)}catch(e){if(e instanceof N&&e.code===`directory_not_empty`){x({kind:`delete`,absPath:t,name:n,isDir:r,recursive:!0});return}}},ce=async()=>{if(b?.kind!==`deleteMany`)return;let{paths:t}=b;x(void 0);for(let n of t)try{await u(e.id,n,{recursive:!0})}catch{}j()},le=async t=>{if(t.type===`directory`){f(e=>({...e,[t.path]:!e[t.path]}));return}await a(e.id,eP(e.path,t.path)),ee()},de=(e,t)=>{e.preventDefault(),e.stopPropagation(),O({x:e.clientX,y:e.clientY,kind:t.isDir?`folder`:`file`,absPath:t.absPath,name:t.name,relPath:t.relPath})},fe=t=>{t.preventDefault(),O({x:t.clientX,y:t.clientY,kind:`empty`,absPath:e.path,name:``,relPath:``})},me=t=>{let n=t;t.startsWith(`${e.path}/`)&&(n=t.slice(e.path.length+1)),k(/\s/.test(n)?`@"${n}"`:`@${n}`),O(void 0)},he=async(t,n)=>{t.preventDefault(),t.stopPropagation(),y(void 0);let r=t.dataTransfer.getData(`application/x-pi-path`);if(r.length===0&&oP(t.dataTransfer,`Files`)){await ge(n,await cP(t.dataTransfer));return}if(r.length===0)return;let i=r.split(`/`).pop()??``;if(i.length===0)return;let a=`${n}/${i}`;if(a!==r&&!(n===r||n.startsWith(`${r}/`)))try{await l(e.id,r,a)}catch{}},ge=async(t,n)=>{if(n.length===0)return;let r=n.reduce((e,t)=>e+t.size,0);C(`Hashing ${n.length} file${n.length===1?``:`s`} (${aP(r)})…`);try{let r=await E(e.id,t,n,{onHashProgress:(e,t)=>{C(e<t?`Hashing ${aP(e)} / ${aP(t)} (${Math.floor(e/t*100)}%)…`:`Uploading ${n.length} file${n.length===1?``:`s`} (${aP(t)})…`)}});C(`Uploaded ${r.length} file${r.length===1?``:`s`}.`),window.setTimeout(()=>C(void 0),2500)}catch{C(void 0)}},_e=e=>{T.current=e,w.current?.click()},ve=async t=>{C(`Preparing download…`);try{let{blob:n,filename:r}=await L.filesDownload(e.id,t),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=r,document.body.appendChild(a),a.click(),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),1e3),C(void 0)}catch(e){C(void 0),Ei.setState({error:e instanceof Error?e.message:`download_failed`})}},ye=async t=>{let n=t.target.files,r=n===null?[]:Array.from(n),i=T.current??e.path;t.target.value=``,T.current=void 0,r.length!==0&&await ge(i,r)};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col text-xs text-neutral-300`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-neutral-200`,title:e.path,children:e.name}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>x({kind:`create`,entryKind:`file`,parentAbsPath:e.path}),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`New file`,children:(0,R.jsx)(ue,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>x({kind:`create`,entryKind:`folder`,parentAbsPath:e.path}),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`New folder`,children:(0,R.jsx)(Ne,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>_e(e.path),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Upload files into project root (drag-and-drop also works on any folder)`,children:(0,R.jsx)(rt,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>void ve(void 0),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Download project as .tar.gz (skips node_modules, .git, dist, etc.)`,children:(0,R.jsx)(Oe,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>void i(e.id),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Refresh`,children:(0,R.jsx)(Je,{size:14,className:n?`animate-spin`:``})})]})]}),(0,R.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void ye(e)}),S!==void 0&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-emerald-700/40 bg-emerald-900/20 px-3 py-1.5 text-[11px] text-emerald-200 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`,children:[!S.startsWith(`Uploaded`)&&(0,R.jsx)(pe,{size:11,className:`animate-spin`}),(0,R.jsx)(`span`,{children:S})]}),r!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:r}),te.size>0&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 bg-neutral-900/60 px-3 py-1.5 text-[11px] text-neutral-300`,children:[(0,R.jsxs)(`span`,{children:[te.size,` selected`,(0,R.jsx)(`span`,{className:`ml-2 text-neutral-500`,children:`(Cmd/Ctrl+click rows to add or remove)`})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>x({kind:`deleteMany`,paths:Array.from(te)}),className:`rounded border border-red-700/50 px-2 py-0.5 text-red-300 hover:bg-red-900/20 light:border-red-400 light:text-red-700 light:hover:bg-red-50`,children:`Delete selected`}),(0,R.jsx)(`button`,{onClick:j,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Clear`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-1`,onContextMenu:fe,onDragOver:e=>{let t=oP(e.dataTransfer,`application/x-pi-path`),n=oP(e.dataTransfer,`Files`);(t||n)&&(e.preventDefault(),e.dataTransfer.dropEffect=n?`copy`:`move`)},onDrop:t=>void he(t,e.path),children:[t===void 0&&!n&&(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`Tree not loaded.`}),t!==void 0&&(0,R.jsx)($N,{node:t,depth:0,projectPath:e.path,expanded:d,onToggle:e=>f(t=>({...t,[e]:!t[e]})),onOpen:e=>void le(e),renaming:p,renameDraft:h,onRenameDraftChange:g,onRenameCommit:e=>void A(e),onRenameStart:ae,onDelete:(e,t,n)=>oe(e,t,n),onCreate:(e,t,n)=>ie(e,t,n),onUpload:e=>_e(e),onDownload:e=>void ve(e),dropTarget:_,onDropTargetChange:y,onDrop:(e,t)=>void he(e,t),onContextMenu:de,selectedPaths:te,onToggleSelect:M})]}),(0,R.jsx)(ia,{open:b?.kind===`create`,onClose:()=>x(void 0),onSubmit:e=>{b?.kind===`create`&&re(b.entryKind,b.parentAbsPath,e)},title:nP(b,e.path),label:rP(b,e.path),placeholder:iP(b),primaryLabel:`Create`}),(0,R.jsx)(aa,{open:b?.kind===`delete`,onClose:()=>x(void 0),onConfirm:()=>void se(),title:b?.kind===`delete`?b.recursive?`"${b.name}" is not empty`:b.isDir?`Delete directory`:`Delete file`:``,message:b?.kind===`delete`?b.recursive?`"${b.name}" contains files. Delete the directory and ALL its contents? This cannot be undone.`:`Delete ${b.isDir?`directory`:`file`} "${b.name}"? This cannot be undone.`:``,primaryLabel:b?.kind===`delete`&&b.recursive?`Delete contents`:`Delete`,tone:`danger`}),(0,R.jsx)(aa,{open:b?.kind===`deleteMany`,onClose:()=>x(void 0),onConfirm:()=>void ce(),title:b?.kind===`deleteMany`?`Delete ${b.paths.length} item${b.paths.length===1?``:`s`}`:``,message:b?.kind===`deleteMany`?`Delete the ${b.paths.length} selected file${b.paths.length===1?``:`s`} / folder${b.paths.length===1?``:`s`}? Folders are deleted recursively. This cannot be undone.`:``,primaryLabel:`Delete all`,tone:`danger`}),D!==void 0&&(0,R.jsx)(ZN,{x:D.x,y:D.y,kind:D.kind,onClose:()=>O(void 0),onAddAsContext:()=>me(D.absPath),...D.kind!==`empty`&&{onRename:()=>ae(D.absPath,D.name),onDelete:()=>oe(D.absPath,D.name,D.kind===`folder`),onDownload:()=>void ve(D.absPath)},...D.kind!==`file`&&{onAddFile:()=>ie(D.absPath,D.relPath,`file`),onAddFolder:()=>ie(D.absPath,D.relPath,`folder`)}})]})}function ZN(e){let t=(0,v.useRef)(e.onClose);t.current=e.onClose,(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t.current()},n=()=>t.current();window.addEventListener(`keydown`,e);let r=setTimeout(()=>window.addEventListener(`mousedown`,n),0);return()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`mousedown`,n),clearTimeout(r)}},[]);let n=t=>{if(t!==void 0)return()=>{t(),e.onClose()}},r=e.kind===`empty`?void 0:n(e.onAddAsContext),i=n(e.onRename),a=n(e.onDelete),o=n(e.onDownload),s=n(e.onAddFile),c=n(e.onAddFolder);return(0,R.jsxs)(`div`,{className:`fixed z-50 min-w-[200px] overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,style:{left:e.x,top:e.y},onMouseDown:e=>e.stopPropagation(),children:[r!==void 0&&(0,R.jsx)(QN,{onClick:r,icon:(0,R.jsx)(ye,{size:12}),label:`Add as @ context`,title:e.kind===`folder`?`Append @<path>/ to the chat input so the model can ls / grep this folder`:`Append @<path> to the chat input so the file's content is sent with the next prompt`}),s!==void 0&&(0,R.jsx)(QN,{onClick:s,icon:(0,R.jsx)(ue,{size:12}),label:`Add file`,title:e.kind===`folder`?`Create a new file inside this folder`:`Create a new file at the project root`}),c!==void 0&&(0,R.jsx)(QN,{onClick:c,icon:(0,R.jsx)(Ne,{size:12}),label:`Add folder`,title:e.kind===`folder`?`Create a new subfolder inside this folder`:`Create a new folder at the project root`}),i!==void 0&&(0,R.jsx)(QN,{onClick:i,icon:(0,R.jsx)(Ke,{size:12}),label:`Rename`,title:`Rename this file or folder`}),o!==void 0&&(0,R.jsx)(QN,{onClick:o,icon:(0,R.jsx)(Oe,{size:12}),label:`Download`,title:e.kind===`folder`?`Download folder as .tar.gz`:`Download this file`}),a!==void 0&&(0,R.jsx)(QN,{onClick:a,icon:(0,R.jsx)(tt,{size:12}),label:`Delete`,title:`Delete this file or folder`,tone:`danger`})]})}function QN(e){let t=e.tone===`danger`;return(0,R.jsxs)(`button`,{type:`button`,onClick:e.onClick,title:e.title,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs ${t?`text-red-300 hover:bg-red-900/30 hover:text-red-100 light:text-red-700 light:hover:bg-red-100 light:hover:text-red-900`:`text-neutral-200 hover:bg-neutral-800`}`,children:[e.icon,e.label]})}function $N(e){let{node:t,depth:n,projectPath:r}=e;if(n===0&&t.type===`directory`)return(0,R.jsx)(`ul`,{children:t.children?.map(t=>(0,R.jsx)($N,{...e,node:t,depth:1},t.path))});let i=eP(r,t.path),a=t.type===`directory`,o=a&&(e.expanded[t.path]??!1),s=e.renaming===i,c=a&&e.dropTarget===i;return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 border-l-2 py-0.5 pr-2 ${e.selectedPaths.has(i)?`border-blue-400 bg-blue-500/15 hover:bg-blue-500/25`:`border-transparent hover:bg-neutral-900`} ${c?`bg-emerald-900/30 ring-1 ring-emerald-700/50`:``}`,style:{paddingLeft:`${n*12+6}px`},onContextMenu:s?void 0:n=>e.onContextMenu(n,{absPath:i,isDir:a,name:t.name,relPath:t.path}),draggable:!s,onDragStart:e=>{e.dataTransfer.setData(`application/x-pi-path`,i),e.dataTransfer.effectAllowed=`move`},onDragOver:a?t=>{let n=oP(t.dataTransfer,`Files`),r=oP(t.dataTransfer,`application/x-pi-path`);!n&&!r||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=n?`copy`:`move`,e.dropTarget!==i&&e.onDropTargetChange(i))}:void 0,onDragLeave:a?()=>{e.dropTarget===i&&e.onDropTargetChange(void 0)}:void 0,onDrop:a?t=>{t.stopPropagation(),e.onDrop(t,i)}:void 0,children:[(0,R.jsxs)(`button`,{onClick:n=>{if(n.metaKey||n.ctrlKey){e.onToggleSelect(i);return}e.onOpen(t)},className:`flex flex-1 items-center gap-1 truncate text-left`,title:i,children:[a?o?(0,R.jsx)(Se,{size:12,className:`text-neutral-500`}):(0,R.jsx)(we,{size:12,className:`text-neutral-500`}):(0,R.jsx)(`span`,{className:`inline-block w-3`}),s?(0,R.jsx)(`input`,{autoFocus:!0,value:e.renameDraft,onChange:t=>e.onRenameDraftChange(t.target.value),onKeyDown:t=>{(t.key===`Enter`||t.key===`Escape`)&&(t.preventDefault(),e.onRenameCommit(i))},onBlur:()=>e.onRenameCommit(i),onClick:e=>e.stopPropagation(),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}):(0,R.jsx)(`span`,{className:`truncate ${a?`text-neutral-200`:`text-neutral-300`}`,children:t.name}),t.truncated===!0&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] text-neutral-600`,children:`…`})]}),!s&&(0,R.jsxs)(`div`,{className:`hidden items-center gap-0.5 group-hover:flex`,children:[a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onCreate(i,t.path,`file`)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`New file in this folder`,children:(0,R.jsx)(ue,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onCreate(i,t.path,`folder`)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`New subfolder in this folder`,children:(0,R.jsx)(Ne,{size:11})}),(0,R.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onUpload(i)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Upload into this folder`,children:(0,R.jsx)(rt,{size:11})})]}),(0,R.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onDownload(i)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:a?`Download folder as .tar.gz`:`Download file`,children:(0,R.jsx)(Oe,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onRenameStart(i,t.name)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Rename`,children:(0,R.jsx)(Ke,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onDelete(i,t.name,a)},className:`rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 light:hover:bg-red-100 light:hover:text-red-700`,title:`Delete`,children:(0,R.jsx)(tt,{size:11})})]})]}),a&&o&&t.children!==void 0&&(0,R.jsx)(`ul`,{children:t.children.map(t=>(0,R.jsx)($N,{...e,node:t,depth:n+1},t.path))})]})}function eP(e,t){return t===``?e:`${e}/${t.replaceAll(`\\`,`/`)}`}function tP(e,t){if(e!==t)return e.startsWith(`${t}/`)?e.slice(t.length+1):e}function nP(e,t){if(e?.kind!==`create`)return``;let n=tP(e.parentAbsPath,t),r=e.entryKind===`folder`?`folder`:`file`;return n===void 0?`New ${r}`:`New ${r} in ${n}/`}function rP(e,t){if(e?.kind!==`create`)return``;let n=tP(e.parentAbsPath,t),r=e.entryKind===`folder`?`Folder name`:`File name`;return n===void 0?`${r} (relative to project root)`:`${r} (in ${n}/)`}function iP(e){return e?.kind===`create`?e.entryKind===`folder`?`utils`:`index.ts`:``}function aP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function oP(e,t){return Array.from(e.types).some(e=>e===t)}function sP(e){return e.webkitGetAsEntry?.()??null}async function cP(e){let t=Array.from(e.items).map(e=>sP(e)).filter(e=>e!==null);if(t.length===0)return Array.from(e.files).map(e=>fP(e,e.name));let n=[];for(let e of t)await lP(e,e.name,n);return n}async function lP(e,t,n){if(e.isFile){let r=await uP(e);n.push(fP(r,t));return}if(!e.isDirectory)return;let r=await dP(e);await Promise.all(r.map(e=>lP(e,`${t}/${e.name}`,n)))}function uP(e){return new Promise((t,n)=>e.file(t,n))}async function dP(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function fP(e,t){let n=e;return n.uploadRelativePath=t,n}var pP=`forge.editor.wrap.`,mP=[];function hP(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)),n=t===-1?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r+1).toLowerCase()}function gP(e){try{let t=localStorage.getItem(pP+e);if(t===`0`)return!1;if(t===`1`)return!0}catch{}return!0}function _P(e,t){try{localStorage.setItem(pP+e,t?`1`:`0`)}catch{}}var vP=(0,v.lazy)(()=>C(()=>import(`./CodeMirrorEditor-BjMj50k4.js`).then(e=>({default:e.CodeMirrorEditor})),[]));function yP(){let e=Sr(),t=Ei(e=>e.openFiles),n=Ei(e=>e.activePath),r=Ei(e=>e.setActiveFile),i=Ei(e=>e.closeFile),a=Ei(e=>e.closeAllFiles),o=Ei(e=>e.updateDraft),s=Ei(e=>e.saveFile),c=Ei(e=>e.reloadFile),l=Ei(e=>e.externallyChanged),u=Ei(e=>e.gitDiffByPath),d=t.find(e=>e.path===n),f=d===void 0?``:hP(d.path),[p,m]=(0,v.useState)(()=>gP(f));(0,v.useEffect)(()=>{m(gP(f))},[f]);let h=(0,v.useCallback)(()=>{m(e=>{let t=!e;return _P(f,t),t})},[f]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col bg-neutral-950 text-sm text-neutral-200`,children:[(0,R.jsx)(xP,{files:t,activePath:n,externallyChanged:l,onActivate:r,onClose:i,onCloseAll:a}),d===void 0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-xs italic text-neutral-500`,children:`No file open. Click a file in the tree to start editing.`}):(0,R.jsxs)(R.Fragment,{children:[l[d.path]===!0&&(0,R.jsx)(SP,{path:d.path,onReload:()=>{e!==void 0&&c(e.id,d.path)},onDiscard:()=>Ei.getState().dismissExternallyChanged(d.path)}),d.binary?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-neutral-500`,children:d.loadingError??`Binary file.`}):(0,R.jsx)(v.Suspense,{fallback:(0,R.jsx)(bP,{}),children:(0,R.jsx)(vP,{file:d,wrap:p,diffChanges:u[d.path]??mP,onChange:e=>o(d.path,e),onSaveShortcut:()=>{e!==void 0&&s(e.id,d.path)},onConsumePendingNav:e=>Ei.getState().consumePendingNav(e)},d.tabId)}),(0,R.jsx)(CP,{file:d,wrap:p,onToggleWrap:h,onSave:()=>{e!==void 0&&s(e.id,d.path)}})]})]})}function bP(){return(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-xs italic text-neutral-500`,children:`Loading editor…`})}function xP({files:e,activePath:t,externallyChanged:n,onActivate:r,onClose:i,onCloseAll:a}){if(e.length===0)return null;let o=e.filter(e=>e.dirty).length;return(0,R.jsxs)(`div`,{className:`flex border-b border-neutral-800 bg-neutral-900/40`,children:[(0,R.jsx)(`button`,{onClick:()=>{o>0&&!window.confirm(`Close ${e.length} tab${e.length===1?``:`s`}? ${o} ha${o===1?`s`:`ve`} unsaved changes that will be lost.`)||a()},className:`flex shrink-0 items-center justify-center border-r border-neutral-800 px-2 py-1.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close all ${e.length} tab${e.length===1?``:`s`}`,children:(0,R.jsx)(he,{size:14})}),(0,R.jsx)(`div`,{className:`flex flex-1 overflow-x-auto`,children:e.map(e=>{let a=e.path.split(`/`).pop()??e.path,o=e.path===t,s=n[e.path]===!0;return(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 border-r border-neutral-800 px-3 py-1.5 text-xs ${o?`bg-neutral-950 text-neutral-100`:`text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`} ${s?`bg-amber-900/30 text-amber-200 light:bg-amber-100 light:text-amber-800`:``}`,title:s?`${e.path}\n\nExternal change while you have unsaved edits — open the tab to review.`:e.path,children:[(0,R.jsxs)(`button`,{onClick:()=>r(e.path),className:`truncate`,children:[s?(0,R.jsx)(_e,{size:11,className:`mr-1 inline text-amber-400 light:text-amber-700`}):e.dirty?(0,R.jsx)(`span`,{className:`mr-1.5 inline-block h-2.5 w-2.5 rounded-full bg-amber-400 align-middle`,"aria-label":`Unsaved changes`,title:`Unsaved changes`}):null,a]}),(0,R.jsx)(`button`,{onClick:()=>i(e.path),className:`rounded p-1 text-neutral-600 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (any unsaved changes are lost)`,children:(0,R.jsx)(at,{size:16})})]},e.tabId)})})]})}function SP({path:e,onReload:t,onDiscard:n}){return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-amber-700/40 bg-amber-900/20 px-4 py-1.5 text-xs text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsxs)(`span`,{children:[`File changed externally — local edits in this tab are stale. Reload from disk?`,(0,R.jsx)(`span`,{className:`ml-2 font-mono text-[10px] text-amber-400/70 light:text-amber-700/80`,children:e})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:t,className:`rounded border border-amber-700/50 px-2 py-0.5 hover:bg-amber-900/30 light:border-amber-400 light:hover:bg-amber-100`,children:`Reload`}),(0,R.jsx)(`button`,{onClick:n,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Keep mine`})]})]})}function CP({file:e,wrap:t,onToggleWrap:n,onSave:r}){let i=e.dirty,a=e.saving,o=e.savedAt,s=e.saveError,c,l=`text-neutral-500`;s===void 0?a?c=`Saving…`:i?(c=`Unsaved changes`,l=`text-amber-400 light:text-amber-700`):o===void 0?c=`Up to date`:(c=`Saved ${new Date(o).toLocaleTimeString()}`,l=`text-emerald-500 light:text-emerald-700`):(c=`Save failed (${s}) — Cmd/Ctrl+S or Save to retry`,l=`text-rose-400 light:text-rose-700`);let u=(i||s!==void 0)&&!a&&!e.binary;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-neutral-800 bg-neutral-900/40 px-3 py-1 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:e.language}),(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-1 rounded px-1 py-0.5 text-[10px] hover:bg-neutral-800 ${t?`text-neutral-300`:`text-neutral-500`}`,title:t?`Wrap on (click to switch to horizontal scroll, persisted per file extension)`:`Wrap off (click to enable wrap, persisted per file extension)`,children:[(0,R.jsx)(ge,{size:11}),t?`wrap`:`no wrap`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:l,children:c}),(0,R.jsxs)(`button`,{onClick:r,disabled:!u,className:`flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-200 hover:border-neutral-500 disabled:cursor-not-allowed disabled:border-neutral-800 disabled:text-neutral-600`,title:`Save (Cmd/Ctrl+S)`,children:[(0,R.jsx)(Xe,{size:11}),`Save`]})]})]})}var wP=o(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
366
|
+
`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 text-[10px]`,children:[(0,R.jsx)(YN,{sessionId:t,processId:e.id,stream:`stdout`}),(0,R.jsx)(YN,{sessionId:t,processId:e.id,stream:`stderr`})]})]})]})}function GN(e){return e===`running`||e===`terminating`?`border-neutral-700 light:border-neutral-300`:e===`terminate_timeout`?`border-amber-700/50 light:border-amber-400`:e===`killed`?`border-amber-700/40 light:border-amber-400`:`border-neutral-800 light:border-neutral-200`}function KN({status:e,success:t}){return e===`running`?(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-emerald-400 light:text-emerald-700`,"aria-label":`running`}):e===`terminating`||e===`terminate_timeout`?(0,R.jsx)(ot,{size:11,className:`mt-0.5 shrink-0 text-amber-400 light:text-amber-700`,"aria-label":`terminating`}):e===`killed`?(0,R.jsx)(_e,{size:11,className:`mt-0.5 shrink-0 text-amber-400 light:text-amber-700`,"aria-label":`killed`}):t===!0?(0,R.jsx)(oe,{size:11,className:`mt-0.5 shrink-0 text-emerald-400 light:text-emerald-700`,"aria-label":`exited 0`}):(0,R.jsx)(se,{size:11,className:`mt-0.5 shrink-0 text-red-400 light:text-red-700`,"aria-label":`exited non-zero`})}function qN(e,t){let n=(t??Date.now())-e;if(n<1e3)return`${n}ms`;let r=n/1e3;if(r<60)return`${r.toFixed(1)}s`;let i=r/60;return i<60?`${i.toFixed(1)}m`:`${(i/60).toFixed(1)}h`}function JN(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function YN({sessionId:e,processId:t,stream:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0);return(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let r=window.open(`about:blank`,`_blank`);if(r===null){o(`popup blocked — allow popups for this site`);return}i(!0),o(void 0),(async()=>{try{let i=L.processLogFileUrl(e,t,n),a=Ht(),s={};a!==void 0&&(s.Authorization=`Bearer ${a.token}`);let c=await fetch(i,{headers:s});if(!c.ok){r.close(),o(`${c.status} ${c.statusText}`);return}let l=await c.text(),u=`<!doctype html><html><head><meta charset="utf-8"><title>${JN(`${n} — ${t}`)}</title><meta name="color-scheme" content="dark light"><style>html,body{margin:0;padding:0;background:#0a0a0a;color:#e5e5e5;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:1.5;tab-size:4}@media (prefers-color-scheme: light){html,body{background:#fafafa;color:#171717}}pre{margin:0;padding:1rem;white-space:pre-wrap;word-break:break-word}</style></head><body><pre>${JN(l)}</pre></body></html>`,d=new Blob([u],{type:`text/html;charset=utf-8`}),f=URL.createObjectURL(d);r.location.href=f,setTimeout(()=>URL.revokeObjectURL(f),6e4)}catch(e){r.close(),o(e instanceof Error?e.message:String(e))}finally{i(!1)}})()},disabled:r,className:`text-sky-400 hover:underline disabled:opacity-50 light:text-sky-700`,title:a,children:r?`loading…`:a===void 0?`full ${n} log`:`${n}: ${a}`})}function XN(){let e=Sr(),t=Ei(t=>e===void 0?void 0:t.treeByProject[e.id]),n=Ei(t=>e===void 0?!1:t.treeLoading[e.id]??!1),r=Ei(e=>e.error),i=Ei(e=>e.loadTree),a=Ei(e=>e.openFile),o=Ei(e=>e.createFile),s=Ei(e=>e.createFolder),c=Ei(e=>e.renameEntry),l=Ei(e=>e.moveEntry),u=Ei(e=>e.deleteEntry),[d,f]=(0,v.useState)({"":!0}),[p,m]=(0,v.useState)(void 0),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(void 0),[S,C]=(0,v.useState)(void 0),w=(0,v.useRef)(null),T=(0,v.useRef)(void 0),E=Ei(e=>e.uploadFiles),[D,O]=(0,v.useState)(void 0),k=qj(e=>e.requestChatInsert),ee=qj(e=>e.openEditorPane),[te,ne]=(0,v.useState)(new Set);if((0,v.useEffect)(()=>{e!==void 0&&i(e.id)},[e?.id,i]),e===void 0)return(0,R.jsx)(`div`,{className:`p-4 text-xs italic text-neutral-500`,children:`Select a project to browse its files.`});let re=async(t,n,r)=>{x(void 0);try{if(t===`file`){let t=await o(e.id,n,r);await a(e.id,t),ee()}else await s(e.id,n,r)}catch{}},ie=(e,t,n)=>{f(e=>({...e,[t]:!0})),x({kind:`create`,entryKind:n,parentAbsPath:e})},ae=(e,t)=>{m(e),g(t)},A=async t=>{let n=h.trim();if(m(void 0),g(``),n.length!==0)try{await c(e.id,t,n)}catch{}},j=()=>ne(new Set),M=e=>{ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=(e,t,n)=>{x({kind:`delete`,absPath:e,name:t,isDir:n,recursive:!1})},se=async()=>{if(b?.kind!==`delete`)return;let{absPath:t,name:n,isDir:r,recursive:i}=b;x(void 0);try{await u(e.id,t,i?{recursive:!0}:void 0)}catch(e){if(e instanceof N&&e.code===`directory_not_empty`){x({kind:`delete`,absPath:t,name:n,isDir:r,recursive:!0});return}}},ce=async()=>{if(b?.kind!==`deleteMany`)return;let{paths:t}=b;x(void 0);for(let n of t)try{await u(e.id,n,{recursive:!0})}catch{}j()},le=async t=>{if(t.type===`directory`){f(e=>({...e,[t.path]:!e[t.path]}));return}await a(e.id,eP(e.path,t.path)),ee()},de=(e,t)=>{e.preventDefault(),e.stopPropagation(),O({x:e.clientX,y:e.clientY,kind:t.isDir?`folder`:`file`,absPath:t.absPath,name:t.name,relPath:t.relPath})},fe=t=>{t.preventDefault(),O({x:t.clientX,y:t.clientY,kind:`empty`,absPath:e.path,name:``,relPath:``})},me=t=>{let n=t;t.startsWith(`${e.path}/`)&&(n=t.slice(e.path.length+1)),k(/\s/.test(n)?`@"${n}"`:`@${n}`),O(void 0)},he=async(t,n)=>{t.preventDefault(),t.stopPropagation(),y(void 0);let r=t.dataTransfer.getData(`application/x-pi-path`);if(r.length===0&&oP(t.dataTransfer,`Files`)){await ge(n,await cP(t.dataTransfer));return}if(r.length===0)return;let i=r.split(`/`).pop()??``;if(i.length===0)return;let a=`${n}/${i}`;if(a!==r&&!(n===r||n.startsWith(`${r}/`)))try{await l(e.id,r,a)}catch{}},ge=async(t,n)=>{if(n.length===0)return;let r=n.reduce((e,t)=>e+t.size,0);C(`Hashing ${n.length} file${n.length===1?``:`s`} (${aP(r)})…`);try{let r=await E(e.id,t,n,{onHashProgress:(e,t)=>{C(e<t?`Hashing ${aP(e)} / ${aP(t)} (${Math.floor(e/t*100)}%)…`:`Uploading ${n.length} file${n.length===1?``:`s`} (${aP(t)})…`)}});C(`Uploaded ${r.length} file${r.length===1?``:`s`}.`),window.setTimeout(()=>C(void 0),2500)}catch{C(void 0)}},_e=e=>{T.current=e,w.current?.click()},ve=async t=>{C(`Preparing download…`);try{let{blob:n,filename:r}=await L.filesDownload(e.id,t),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=r,document.body.appendChild(a),a.click(),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),1e3),C(void 0)}catch(e){C(void 0),Ei.setState({error:e instanceof Error?e.message:`download_failed`})}},ye=async t=>{let n=t.target.files,r=n===null?[]:Array.from(n),i=T.current??e.path;t.target.value=``,T.current=void 0,r.length!==0&&await ge(i,r)};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col text-xs text-neutral-300`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-neutral-200`,title:e.path,children:e.name}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>x({kind:`create`,entryKind:`file`,parentAbsPath:e.path}),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`New file`,children:(0,R.jsx)(ue,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>x({kind:`create`,entryKind:`folder`,parentAbsPath:e.path}),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`New folder`,children:(0,R.jsx)(Ne,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>_e(e.path),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Upload files into project root (drag-and-drop also works on any folder)`,children:(0,R.jsx)(rt,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>void ve(void 0),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Download project as .tar.gz (skips node_modules, .git, dist, etc.)`,children:(0,R.jsx)(Oe,{size:14})}),(0,R.jsx)(`button`,{onClick:()=>void i(e.id),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Refresh`,children:(0,R.jsx)(Je,{size:14,className:n?`animate-spin`:``})})]})]}),(0,R.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void ye(e)}),S!==void 0&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-emerald-700/40 bg-emerald-900/20 px-3 py-1.5 text-[11px] text-emerald-200 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`,children:[!S.startsWith(`Uploaded`)&&(0,R.jsx)(pe,{size:11,className:`animate-spin`}),(0,R.jsx)(`span`,{children:S})]}),r!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:r}),te.size>0&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 bg-neutral-900/60 px-3 py-1.5 text-[11px] text-neutral-300`,children:[(0,R.jsxs)(`span`,{children:[te.size,` selected`,(0,R.jsx)(`span`,{className:`ml-2 text-neutral-500`,children:`(Cmd/Ctrl+click rows to add or remove)`})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>x({kind:`deleteMany`,paths:Array.from(te)}),className:`rounded border border-red-700/50 px-2 py-0.5 text-red-300 hover:bg-red-900/20 light:border-red-400 light:text-red-700 light:hover:bg-red-50`,children:`Delete selected`}),(0,R.jsx)(`button`,{onClick:j,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Clear`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-1`,onContextMenu:fe,onDragOver:e=>{let t=oP(e.dataTransfer,`application/x-pi-path`),n=oP(e.dataTransfer,`Files`);(t||n)&&(e.preventDefault(),e.dataTransfer.dropEffect=n?`copy`:`move`)},onDrop:t=>void he(t,e.path),children:[t===void 0&&!n&&(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`Tree not loaded.`}),t!==void 0&&(0,R.jsx)($N,{node:t,depth:0,projectPath:e.path,expanded:d,onToggle:e=>f(t=>({...t,[e]:!t[e]})),onOpen:e=>void le(e),renaming:p,renameDraft:h,onRenameDraftChange:g,onRenameCommit:e=>void A(e),onRenameStart:ae,onDelete:(e,t,n)=>oe(e,t,n),onCreate:(e,t,n)=>ie(e,t,n),onUpload:e=>_e(e),onDownload:e=>void ve(e),dropTarget:_,onDropTargetChange:y,onDrop:(e,t)=>void he(e,t),onContextMenu:de,selectedPaths:te,onToggleSelect:M})]}),(0,R.jsx)(ia,{open:b?.kind===`create`,onClose:()=>x(void 0),onSubmit:e=>{b?.kind===`create`&&re(b.entryKind,b.parentAbsPath,e)},title:nP(b,e.path),label:rP(b,e.path),placeholder:iP(b),primaryLabel:`Create`}),(0,R.jsx)(aa,{open:b?.kind===`delete`,onClose:()=>x(void 0),onConfirm:()=>void se(),title:b?.kind===`delete`?b.recursive?`"${b.name}" is not empty`:b.isDir?`Delete directory`:`Delete file`:``,message:b?.kind===`delete`?b.recursive?`"${b.name}" contains files. Delete the directory and ALL its contents? This cannot be undone.`:`Delete ${b.isDir?`directory`:`file`} "${b.name}"? This cannot be undone.`:``,primaryLabel:b?.kind===`delete`&&b.recursive?`Delete contents`:`Delete`,tone:`danger`}),(0,R.jsx)(aa,{open:b?.kind===`deleteMany`,onClose:()=>x(void 0),onConfirm:()=>void ce(),title:b?.kind===`deleteMany`?`Delete ${b.paths.length} item${b.paths.length===1?``:`s`}`:``,message:b?.kind===`deleteMany`?`Delete the ${b.paths.length} selected file${b.paths.length===1?``:`s`} / folder${b.paths.length===1?``:`s`}? Folders are deleted recursively. This cannot be undone.`:``,primaryLabel:`Delete all`,tone:`danger`}),D!==void 0&&(0,R.jsx)(ZN,{x:D.x,y:D.y,kind:D.kind,onClose:()=>O(void 0),onAddAsContext:()=>me(D.absPath),...D.kind!==`empty`&&{onRename:()=>ae(D.absPath,D.name),onDelete:()=>oe(D.absPath,D.name,D.kind===`folder`),onDownload:()=>void ve(D.absPath)},...D.kind!==`file`&&{onAddFile:()=>ie(D.absPath,D.relPath,`file`),onAddFolder:()=>ie(D.absPath,D.relPath,`folder`)}})]})}function ZN(e){let t=(0,v.useRef)(e.onClose);t.current=e.onClose,(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t.current()},n=()=>t.current();window.addEventListener(`keydown`,e);let r=setTimeout(()=>window.addEventListener(`mousedown`,n),0);return()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`mousedown`,n),clearTimeout(r)}},[]);let n=t=>{if(t!==void 0)return()=>{t(),e.onClose()}},r=e.kind===`empty`?void 0:n(e.onAddAsContext),i=n(e.onRename),a=n(e.onDelete),o=n(e.onDownload),s=n(e.onAddFile),c=n(e.onAddFolder);return(0,R.jsxs)(`div`,{className:`fixed z-50 min-w-[200px] overflow-hidden rounded-md border border-neutral-700 bg-neutral-900 shadow-lg`,style:{left:e.x,top:e.y},onMouseDown:e=>e.stopPropagation(),children:[r!==void 0&&(0,R.jsx)(QN,{onClick:r,icon:(0,R.jsx)(ye,{size:12}),label:`Add as @ context`,title:e.kind===`folder`?`Append @<path>/ to the chat input so the model can ls / grep this folder`:`Append @<path> to the chat input so the file's content is sent with the next prompt`}),s!==void 0&&(0,R.jsx)(QN,{onClick:s,icon:(0,R.jsx)(ue,{size:12}),label:`Add file`,title:e.kind===`folder`?`Create a new file inside this folder`:`Create a new file at the project root`}),c!==void 0&&(0,R.jsx)(QN,{onClick:c,icon:(0,R.jsx)(Ne,{size:12}),label:`Add folder`,title:e.kind===`folder`?`Create a new subfolder inside this folder`:`Create a new folder at the project root`}),i!==void 0&&(0,R.jsx)(QN,{onClick:i,icon:(0,R.jsx)(Ke,{size:12}),label:`Rename`,title:`Rename this file or folder`}),o!==void 0&&(0,R.jsx)(QN,{onClick:o,icon:(0,R.jsx)(Oe,{size:12}),label:`Download`,title:e.kind===`folder`?`Download folder as .tar.gz`:`Download this file`}),a!==void 0&&(0,R.jsx)(QN,{onClick:a,icon:(0,R.jsx)(tt,{size:12}),label:`Delete`,title:`Delete this file or folder`,tone:`danger`})]})}function QN(e){let t=e.tone===`danger`;return(0,R.jsxs)(`button`,{type:`button`,onClick:e.onClick,title:e.title,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs ${t?`text-red-300 hover:bg-red-900/30 hover:text-red-100 light:text-red-700 light:hover:bg-red-100 light:hover:text-red-900`:`text-neutral-200 hover:bg-neutral-800`}`,children:[e.icon,e.label]})}function $N(e){let{node:t,depth:n,projectPath:r}=e;if(n===0&&t.type===`directory`)return(0,R.jsx)(`ul`,{children:t.children?.map(t=>(0,R.jsx)($N,{...e,node:t,depth:1},t.path))});let i=eP(r,t.path),a=t.type===`directory`,o=a&&(e.expanded[t.path]??!1),s=e.renaming===i,c=a&&e.dropTarget===i;return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 border-l-2 py-0.5 pr-2 ${e.selectedPaths.has(i)?`border-blue-400 bg-blue-500/15 hover:bg-blue-500/25`:`border-transparent hover:bg-neutral-900`} ${c?`bg-emerald-900/30 ring-1 ring-emerald-700/50`:``}`,style:{paddingLeft:`${n*12+6}px`},onContextMenu:s?void 0:n=>e.onContextMenu(n,{absPath:i,isDir:a,name:t.name,relPath:t.path}),draggable:!s,onDragStart:e=>{e.dataTransfer.setData(`application/x-pi-path`,i),e.dataTransfer.effectAllowed=`move`},onDragOver:a?t=>{let n=oP(t.dataTransfer,`Files`),r=oP(t.dataTransfer,`application/x-pi-path`);!n&&!r||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=n?`copy`:`move`,e.dropTarget!==i&&e.onDropTargetChange(i))}:void 0,onDragLeave:a?()=>{e.dropTarget===i&&e.onDropTargetChange(void 0)}:void 0,onDrop:a?t=>{t.stopPropagation(),e.onDrop(t,i)}:void 0,children:[(0,R.jsxs)(`button`,{onClick:n=>{if(n.metaKey||n.ctrlKey){e.onToggleSelect(i);return}e.onOpen(t)},className:`flex flex-1 items-center gap-1 truncate text-left`,title:i,children:[a?o?(0,R.jsx)(Se,{size:12,className:`text-neutral-500`}):(0,R.jsx)(we,{size:12,className:`text-neutral-500`}):(0,R.jsx)(`span`,{className:`inline-block w-3`}),s?(0,R.jsx)(`input`,{autoFocus:!0,value:e.renameDraft,onChange:t=>e.onRenameDraftChange(t.target.value),onKeyDown:t=>{(t.key===`Enter`||t.key===`Escape`)&&(t.preventDefault(),e.onRenameCommit(i))},onBlur:()=>e.onRenameCommit(i),onClick:e=>e.stopPropagation(),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`}):(0,R.jsx)(`span`,{className:`truncate ${a?`text-neutral-200`:`text-neutral-300`}`,children:t.name}),t.truncated===!0&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] text-neutral-600`,children:`…`})]}),!s&&(0,R.jsxs)(`div`,{className:`hidden items-center gap-0.5 group-hover:flex`,children:[a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onCreate(i,t.path,`file`)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`New file in this folder`,children:(0,R.jsx)(ue,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onCreate(i,t.path,`folder`)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`New subfolder in this folder`,children:(0,R.jsx)(Ne,{size:11})}),(0,R.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onUpload(i)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Upload into this folder`,children:(0,R.jsx)(rt,{size:11})})]}),(0,R.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onDownload(i)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:a?`Download folder as .tar.gz`:`Download file`,children:(0,R.jsx)(Oe,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onRenameStart(i,t.name)},className:`rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Rename`,children:(0,R.jsx)(Ke,{size:11})}),(0,R.jsx)(`button`,{onClick:n=>{n.stopPropagation(),e.onDelete(i,t.name,a)},className:`rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 light:hover:bg-red-100 light:hover:text-red-700`,title:`Delete`,children:(0,R.jsx)(tt,{size:11})})]})]}),a&&o&&t.children!==void 0&&(0,R.jsx)(`ul`,{children:t.children.map(t=>(0,R.jsx)($N,{...e,node:t,depth:n+1},t.path))})]})}function eP(e,t){return t===``?e:`${e}/${t.replaceAll(`\\`,`/`)}`}function tP(e,t){if(e!==t)return e.startsWith(`${t}/`)?e.slice(t.length+1):e}function nP(e,t){if(e?.kind!==`create`)return``;let n=tP(e.parentAbsPath,t),r=e.entryKind===`folder`?`folder`:`file`;return n===void 0?`New ${r}`:`New ${r} in ${n}/`}function rP(e,t){if(e?.kind!==`create`)return``;let n=tP(e.parentAbsPath,t),r=e.entryKind===`folder`?`Folder name`:`File name`;return n===void 0?`${r} (relative to project root)`:`${r} (in ${n}/)`}function iP(e){return e?.kind===`create`?e.entryKind===`folder`?`utils`:`index.ts`:``}function aP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function oP(e,t){return Array.from(e.types).some(e=>e===t)}function sP(e){return e.webkitGetAsEntry?.()??null}async function cP(e){let t=Array.from(e.items).map(e=>sP(e)).filter(e=>e!==null);if(t.length===0)return Array.from(e.files).map(e=>fP(e,e.name));let n=[];for(let e of t)await lP(e,e.name,n);return n}async function lP(e,t,n){if(e.isFile){let r=await uP(e);n.push(fP(r,t));return}if(!e.isDirectory)return;let r=await dP(e);await Promise.all(r.map(e=>lP(e,`${t}/${e.name}`,n)))}function uP(e){return new Promise((t,n)=>e.file(t,n))}async function dP(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function fP(e,t){let n=e;return n.uploadRelativePath=t,n}var pP=`forge.editor.wrap.`,mP=[];function hP(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)),n=t===-1?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r+1).toLowerCase()}function gP(e){try{let t=localStorage.getItem(pP+e);if(t===`0`)return!1;if(t===`1`)return!0}catch{}return!0}function _P(e,t){try{localStorage.setItem(pP+e,t?`1`:`0`)}catch{}}var vP=(0,v.lazy)(()=>C(()=>import(`./CodeMirrorEditor-Bh9qbZER.js`).then(e=>({default:e.CodeMirrorEditor})),[]));function yP(){let e=Sr(),t=Ei(e=>e.openFiles),n=Ei(e=>e.activePath),r=Ei(e=>e.setActiveFile),i=Ei(e=>e.closeFile),a=Ei(e=>e.closeAllFiles),o=Ei(e=>e.updateDraft),s=Ei(e=>e.saveFile),c=Ei(e=>e.reloadFile),l=Ei(e=>e.externallyChanged),u=Ei(e=>e.gitDiffByPath),d=t.find(e=>e.path===n),f=d===void 0?``:hP(d.path),[p,m]=(0,v.useState)(()=>gP(f));(0,v.useEffect)(()=>{m(gP(f))},[f]);let h=(0,v.useCallback)(()=>{m(e=>{let t=!e;return _P(f,t),t})},[f]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col bg-neutral-950 text-sm text-neutral-200`,children:[(0,R.jsx)(xP,{files:t,activePath:n,externallyChanged:l,onActivate:r,onClose:i,onCloseAll:a}),d===void 0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-xs italic text-neutral-500`,children:`No file open. Click a file in the tree to start editing.`}):(0,R.jsxs)(R.Fragment,{children:[l[d.path]===!0&&(0,R.jsx)(SP,{path:d.path,onReload:()=>{e!==void 0&&c(e.id,d.path)},onDiscard:()=>Ei.getState().dismissExternallyChanged(d.path)}),d.binary?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-neutral-500`,children:d.loadingError??`Binary file.`}):(0,R.jsx)(v.Suspense,{fallback:(0,R.jsx)(bP,{}),children:(0,R.jsx)(vP,{file:d,wrap:p,diffChanges:u[d.path]??mP,onChange:e=>o(d.path,e),onSaveShortcut:()=>{e!==void 0&&s(e.id,d.path)},onConsumePendingNav:e=>Ei.getState().consumePendingNav(e)},d.tabId)}),(0,R.jsx)(CP,{file:d,wrap:p,onToggleWrap:h,onSave:()=>{e!==void 0&&s(e.id,d.path)}})]})]})}function bP(){return(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-xs italic text-neutral-500`,children:`Loading editor…`})}function xP({files:e,activePath:t,externallyChanged:n,onActivate:r,onClose:i,onCloseAll:a}){if(e.length===0)return null;let o=e.filter(e=>e.dirty).length;return(0,R.jsxs)(`div`,{className:`flex border-b border-neutral-800 bg-neutral-900/40`,children:[(0,R.jsx)(`button`,{onClick:()=>{o>0&&!window.confirm(`Close ${e.length} tab${e.length===1?``:`s`}? ${o} ha${o===1?`s`:`ve`} unsaved changes that will be lost.`)||a()},className:`flex shrink-0 items-center justify-center border-r border-neutral-800 px-2 py-1.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close all ${e.length} tab${e.length===1?``:`s`}`,children:(0,R.jsx)(he,{size:14})}),(0,R.jsx)(`div`,{className:`flex flex-1 overflow-x-auto`,children:e.map(e=>{let a=e.path.split(`/`).pop()??e.path,o=e.path===t,s=n[e.path]===!0;return(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 border-r border-neutral-800 px-3 py-1.5 text-xs ${o?`bg-neutral-950 text-neutral-100`:`text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`} ${s?`bg-amber-900/30 text-amber-200 light:bg-amber-100 light:text-amber-800`:``}`,title:s?`${e.path}\n\nExternal change while you have unsaved edits — open the tab to review.`:e.path,children:[(0,R.jsxs)(`button`,{onClick:()=>r(e.path),className:`truncate`,children:[s?(0,R.jsx)(_e,{size:11,className:`mr-1 inline text-amber-400 light:text-amber-700`}):e.dirty?(0,R.jsx)(`span`,{className:`mr-1.5 inline-block h-2.5 w-2.5 rounded-full bg-amber-400 align-middle`,"aria-label":`Unsaved changes`,title:`Unsaved changes`}):null,a]}),(0,R.jsx)(`button`,{onClick:()=>i(e.path),className:`rounded p-1 text-neutral-600 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (any unsaved changes are lost)`,children:(0,R.jsx)(at,{size:16})})]},e.tabId)})})]})}function SP({path:e,onReload:t,onDiscard:n}){return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-amber-700/40 bg-amber-900/20 px-4 py-1.5 text-xs text-amber-200 light:border-amber-300 light:bg-amber-50 light:text-amber-800`,children:[(0,R.jsxs)(`span`,{children:[`File changed externally — local edits in this tab are stale. Reload from disk?`,(0,R.jsx)(`span`,{className:`ml-2 font-mono text-[10px] text-amber-400/70 light:text-amber-700/80`,children:e})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:t,className:`rounded border border-amber-700/50 px-2 py-0.5 hover:bg-amber-900/30 light:border-amber-400 light:hover:bg-amber-100`,children:`Reload`}),(0,R.jsx)(`button`,{onClick:n,className:`rounded border border-neutral-700 px-2 py-0.5 text-neutral-300 hover:border-neutral-500`,children:`Keep mine`})]})]})}function CP({file:e,wrap:t,onToggleWrap:n,onSave:r}){let i=e.dirty,a=e.saving,o=e.savedAt,s=e.saveError,c,l=`text-neutral-500`;s===void 0?a?c=`Saving…`:i?(c=`Unsaved changes`,l=`text-amber-400 light:text-amber-700`):o===void 0?c=`Up to date`:(c=`Saved ${new Date(o).toLocaleTimeString()}`,l=`text-emerald-500 light:text-emerald-700`):(c=`Save failed (${s}) — Cmd/Ctrl+S or Save to retry`,l=`text-rose-400 light:text-rose-700`);let u=(i||s!==void 0)&&!a&&!e.binary;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-neutral-800 bg-neutral-900/40 px-3 py-1 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:e.language}),(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-1 rounded px-1 py-0.5 text-[10px] hover:bg-neutral-800 ${t?`text-neutral-300`:`text-neutral-500`}`,title:t?`Wrap on (click to switch to horizontal scroll, persisted per file extension)`:`Wrap off (click to enable wrap, persisted per file extension)`,children:[(0,R.jsx)(ge,{size:11}),t?`wrap`:`no wrap`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:l,children:c}),(0,R.jsxs)(`button`,{onClick:r,disabled:!u,className:`flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-200 hover:border-neutral-500 disabled:cursor-not-allowed disabled:border-neutral-800 disabled:text-neutral-600`,title:`Save (Cmd/Ctrl+S)`,children:[(0,R.jsx)(Xe,{size:11}),`Save`]})]})]})}var wP=o(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
367
367
|
`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
368
368
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),ee=n(9074),te=n(2585),ne=n(5435),re=n(4567),ie=n(779);class ae extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(ee.DecorationService),this._instantiationService.setService(te.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(re.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(re.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case ne.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case ne.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=ae},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,ee=0,te=[],ne=m!==-1&&g!==-1;for(let re=0;re<x;re++){e.loadCell(re,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let ie=!1,ae=re,A=this._workCell;if(v.length>0&&re===v[0][0]){ie=!0;let t=v.shift();A=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),ae=t[1]-1,x=A.getWidth()}let j=this._isCellInSelection(re,t),M=n&&re===s,oe=ne&&re>=m&&re<=g,se=!1;this._decorationService.forEachDecorationAtCell(re,t,void 0,(e=>{se=!0}));let ce=A.getChars()||o.WHITESPACE_CELL_CHAR;if(ce===` `&&(A.isUnderline()||A.isOverline())&&(ce=`\xA0`),ee=x*u-f.get(ce,A.isBold(),A.isItalic()),b){if(S&&(j&&k||!j&&!k&&A.bg===w)&&(j&&k&&y.selectionForeground||A.fg===T)&&A.extended.ext===E&&oe===D&&ee===O&&!M&&!ie&&!se){A.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=ce,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=A.bg,T=A.fg,E=A.extended.ext,D=oe,O=ee,k=j,ie&&s>=re&&s<=ae&&(s=re),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(te.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&te.push(`xterm-cursor-blink`),te.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:te.push(`xterm-cursor-outline`);break;case`block`:te.push(`xterm-cursor-block`);break;case`bar`:te.push(`xterm-cursor-bar`);break;case`underline`:te.push(`xterm-cursor-underline`)}}if(A.isBold()&&te.push(`xterm-bold`),A.isItalic()&&te.push(`xterm-italic`),A.isDim()&&te.push(`xterm-dim`),C=A.isInvisible()?o.WHITESPACE_CELL_CHAR:A.getChars()||o.WHITESPACE_CELL_CHAR,A.isUnderline()&&(te.push(`xterm-underline-${A.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(A.getUnderlineColor()).join(`,`)})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}A.isOverline()&&(te.push(`xterm-overline`),C===` `&&(C=`\xA0`)),A.isStrikethrough()&&te.push(`xterm-strikethrough`),oe&&(b.style.textDecoration=`underline`);let le=A.getFgColor(),ue=A.getFgColorMode(),de=A.getBgColor(),fe=A.getBgColorMode(),pe=!!A.isInverse();if(pe){let e=le;le=de,de=e;let t=ue;ue=fe,fe=t}let me,he,ge,_e=!1;switch(this._decorationService.forEachDecorationAtCell(re,t,void 0,(e=>{e.options.layer!==`top`&&_e||(e.backgroundColorRGB&&(fe=50331648,de=e.backgroundColorRGB.rgba>>8&16777215,me=e.backgroundColorRGB),e.foregroundColorRGB&&(ue=50331648,le=e.foregroundColorRGB.rgba>>8&16777215,he=e.foregroundColorRGB),_e=e.options.layer===`top`)})),!_e&&j&&(me=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,de=me.rgba>>8&16777215,fe=50331648,_e=!0,y.selectionForeground&&(ue=50331648,le=y.selectionForeground.rgba>>8&16777215,he=y.selectionForeground)),_e&&te.push(`xterm-decoration-top`),fe){case 16777216:case 33554432:ge=y.ansi[de],te.push(`xterm-bg-${de}`);break;case 50331648:ge=l.channels.toColor(de>>16,de>>8&255,255&de),this._addStyle(b,`background-color:#${h((de>>>0).toString(16),`0`,6)}`);break;default:pe?(ge=y.foreground,te.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ge=y.background}switch(me||A.isDim()&&(me=l.color.multiplyOpacity(ge,.5)),ue){case 16777216:case 33554432:A.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(b,ge,y.ansi[le],A,me,void 0)||te.push(`xterm-fg-${le}`);break;case 50331648:let e=l.channels.toColor(le>>16&255,le>>8&255,255&le);this._applyMinimumContrast(b,ge,e,A,me,he)||this._addStyle(b,`color:#${h(le.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,ge,y.foreground,A,me,he)||pe&&te.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}te.length&&=(b.className=te.join(` `),0),M||ie||se?b.textContent=C:S++,ee!==this.defaultSpacing&&(b.style.letterSpacing=`${ee}px`),_.push(b),re=ae}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
|
|
369
369
|
`:`
|
|
@@ -371,5 +371,5 @@ X-Custom: value`,disabled:n,className:`w-full rounded border border-neutral-700
|
|
|
371
371
|
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`[M${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
372
372
|
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))}))(),TP=2,EP=1,DP=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(TP,Math.floor(u/e.css.cell.width)),rows:Math.max(EP,Math.floor(l/e.css.cell.height))}}},OP=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=AP.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function kP(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var AP=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!kP(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},jP=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function MP(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var NP=class{constructor(e=MP,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||jP;this._linkProvider=this._terminal.registerLinkProvider(new OP(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},PP=`forge.terminal.tabs.v1`;function FP(){try{if(sessionStorage.getItem(PP)===null){let e=localStorage.getItem(PP);e!==null&&(sessionStorage.setItem(PP,e),localStorage.removeItem(PP))}let e=sessionStorage.getItem(PP);if(e===null)return{tabs:[],activeTabId:void 0};let t=JSON.parse(e);if(typeof t!=`object`||!t||!Array.isArray(t.tabs))return{tabs:[],activeTabId:void 0};let n=[];for(let e of t.tabs)typeof e==`object`&&e&&typeof e.id==`string`&&typeof e.projectId==`string`&&typeof e.label==`string`&&typeof e.createdAt==`number`&&n.push(e);let r=t.activeTabId,i=typeof r==`string`?r:void 0;return{tabs:n,activeTabId:n.some(e=>e.id===i)?i:n[0]?.id}}catch{return{tabs:[],activeTabId:void 0}}}function IP(e){try{sessionStorage.setItem(PP,JSON.stringify(e))}catch{}}var LP=0,RP=()=>`term-${Date.now().toString(36)}-${(LP++).toString(36)}`,zP=FP(),BP=mt(e=>({tabs:zP.tabs,activeTabId:zP.activeTabId,openTab:t=>{let n=RP();return e(e=>{let r={id:n,projectId:t,label:`Terminal ${e.tabs.filter(e=>e.projectId===t).length+1}`,createdAt:Date.now()},i={tabs:[...e.tabs,r],activeTabId:n};return IP(i),i}),n},closeTab:t=>{e(e=>{let n=e.tabs.findIndex(e=>e.id===t);if(n===-1)return{};let r=e.tabs.slice(0,n).concat(e.tabs.slice(n+1)),i={tabs:r,activeTabId:e.activeTabId===t?(r[n]??r[n-1]??r[0])?.id:e.activeTabId};return IP(i),i})},setActiveTab:t=>e(e=>(IP({tabs:{...e,activeTabId:t}.tabs,activeTabId:t}),{activeTabId:t})),closeProjectTabs:t=>{e(e=>{let n=e.tabs.filter(e=>e.projectId!==t),r={tabs:n,activeTabId:n.some(t=>t.id===e.activeTabId)?e.activeTabId:n[0]?.id};return IP(r),r})}})),VP=new Map;function HP(e){let t=e.querySelector(`textarea`);t!==null&&(t.setAttribute(`autocomplete`,`off`),t.setAttribute(`autocorrect`,`off`),t.setAttribute(`autocapitalize`,`none`),t.setAttribute(`spellcheck`,`false`))}function UP(e,t=!1){let n=e.term.cols,r=e.term.rows;!t&&n===e.lastSize.cols&&r===e.lastSize.rows||(e.lastSize={cols:n,rows:r},e.ws.readyState===WebSocket.OPEN&&e.ws.send(JSON.stringify({type:`resize`,cols:n,rows:r})))}function WP(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function GP(e,t=!1){let n=e.term.element,r=n?.parentElement,i=e.term._core,a=i?._renderService.dimensions.css.cell;if(n===void 0||r==null||i===void 0||a===void 0){e.fit.fit(),UP(e,t);return}if(a.width<=0||a.height<=0){e.fit.fit(),UP(e,t);return}let o=window.getComputedStyle(n),s=WP(o.paddingLeft)+WP(o.paddingRight),c=WP(o.paddingTop)+WP(o.paddingBottom),l=e.term.options.scrollback===0?0:i.viewport.scrollBarWidth,u=r.getBoundingClientRect(),d=Math.max(2,Math.floor((u.width-s-l)/a.width)),f=Math.max(1,Math.floor((u.height-c)/a.height));(e.term.cols!==d||e.term.rows!==f)&&(i._renderService.clear(),e.term.resize(d,f)),UP(e,t)}function KP(e){let t=[1,2,4,8,16,30];return(t[Math.min(e,t.length-1)]??30)*1e3}function qP(e){return e===1e3||e===4401||e===4404}function JP(){let e=Sr(),t=BP(e=>e.tabs),n=BP(e=>e.activeTabId),r=BP(e=>e.openTab),i=BP(e=>e.closeTab),a=BP(e=>e.setActiveTab),o=xr(e=>e.projects),s=t.filter(t=>t.projectId===e?.id),c=s.find(e=>e.id===n)??s[0],l=new Map(o.map(e=>[e.id,e.path]));if(e===void 0)return(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center text-xs italic text-neutral-500`,children:`Select a project to open a terminal.`});let u=()=>{r(e.id)},d=e=>{ZP(e),i(e)};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col bg-black`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 bg-neutral-900/40 px-2 py-1`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-1 overflow-x-auto`,children:[s.length===0&&(0,R.jsx)(`span`,{className:`px-2 text-[11px] italic text-neutral-500`,children:`No terminals open.`}),s.map(e=>(0,R.jsxs)(`div`,{className:`group flex items-center gap-1 rounded px-2 py-0.5 text-xs ${e.id===c?.id?`bg-neutral-800 text-neutral-100`:`text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`}`,children:[(0,R.jsxs)(`button`,{onClick:()=>a(e.id),className:`flex items-center gap-1`,children:[(0,R.jsx)(et,{size:11}),e.label]}),(0,R.jsx)(`button`,{onClick:()=>d(e.id),className:`rounded p-1 text-neutral-600 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close terminal (kills the PTY)`,children:(0,R.jsx)(at,{size:16})})]},e.id)),(0,R.jsxs)(`button`,{onClick:u,className:`ml-1 flex items-center gap-1 rounded px-2 py-0.5 text-xs text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200 light:text-neutral-200 light:hover:bg-neutral-800 light:hover:text-neutral-50`,title:`New terminal`,children:[(0,R.jsx)(qe,{size:14}),`New`]})]})}),(0,R.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[s.length===0&&(0,R.jsxs)(`div`,{className:`flex h-full items-center justify-center text-xs italic text-neutral-500`,children:[`Click "New" to open a terminal in `,e.path,`.`]}),t.map(t=>(0,R.jsx)(YP,{tab:t,projectPath:l.get(t.projectId)??``,visible:t.projectId===e.id&&t.id===c?.id},t.id))]})]})}function YP({tab:e,projectPath:t,visible:n}){let r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(r.current===null)return;let t=r.current,n=VP.get(e.id);if(n!==void 0){try{let e=n.term.element;e!==void 0&&e.parentNode!==t?t.appendChild(e):n.term.open(t),HP(t),GP(n,!0)}catch{}let e=new ResizeObserver(()=>{try{GP(n)}catch{}});e.observe(t);try{n.observer.disconnect()}catch{}return n.observer=e,requestAnimationFrame(()=>{try{GP(n),n.term.focus()}catch{}}),()=>{try{e.disconnect()}catch{}}}let i=new wP.Terminal({theme:{background:IC(`--pi-terminal-bg`,`#0a0a0a`),foreground:IC(`--pi-terminal-fg`,`#e5e5e5`),cursor:IC(`--pi-terminal-fg`,`#e5e5e5`),black:IC(`--color-neutral-800`,`#262626`),brightBlack:IC(`--color-neutral-600`,`#525252`)},fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:13,cursorBlink:!0,scrollback:5e3,convertEol:!1}),a=new DP,o=new NP;i.loadAddon(a),i.loadAddon(o),i.open(t),HP(t),a.fit();let s={cols:i.cols,rows:i.rows},c=XP(e.id,e.projectId,i,s,!1);i.onData(t=>{let n=VP.get(e.id)?.ws;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:`input`,data:t}))});let l=new ResizeObserver(()=>{try{let t=VP.get(e.id);if(t===void 0)return;GP(t)}catch{}});l.observe(r.current);let u={term:i,fit:a,ws:c,observer:l,lastSize:s,reconnectAttempt:0,reconnectTimer:void 0,disposed:!1};return VP.set(e.id,u),requestAnimationFrame(()=>{try{GP(u,!0)}catch{}}),()=>{try{l.disconnect()}catch{}}},[e.id]),(0,v.useEffect)(()=>{if(!n)return;let t=VP.get(e.id);t!==void 0&&requestAnimationFrame(()=>{try{GP(t),t.term.focus()}catch{}})},[n,e.id]),(0,v.useEffect)(()=>{let t=VP.get(e.id);t!==void 0&&(t.term.options.theme={background:IC(`--pi-terminal-bg`,`#0a0a0a`),foreground:IC(`--pi-terminal-fg`,`#e5e5e5`),cursor:IC(`--pi-terminal-fg`,`#e5e5e5`),black:IC(`--color-neutral-800`,`#262626`),brightBlack:IC(`--color-neutral-600`,`#525252`)})},[PC(e=>e.theme),e.id]),(0,R.jsx)(`div`,{ref:r,onClick:()=>{VP.get(e.id)?.term.focus()},className:`pi-terminal-host absolute inset-y-0 left-2 right-0`,style:{visibility:n?`visible`:`hidden`,pointerEvents:n?`auto`:`none`,zIndex:+!!n},title:t})}function XP(e,t,n,r,i){let a=window.location.protocol===`https:`?`wss`:`ws`,o=Ht(),s=o===void 0?``:`&token=${encodeURIComponent(o.token)}`,c=`${a}://${window.location.host}/api/v1/terminal?projectId=${encodeURIComponent(t)}&tabId=${encodeURIComponent(e)}${s}`,l=new WebSocket(c);return l.binaryType=`arraybuffer`,l.onopen=()=>{let t=VP.get(e),n=t===void 0?r:{cols:t.term.cols,rows:t.term.rows};l.send(JSON.stringify({type:`resize`,cols:n.cols,rows:n.rows})),t!==void 0&&(t.lastSize=n,t.reconnectAttempt=0)},l.onmessage=e=>{typeof e.data==`string`?n.write(e.data):e.data instanceof ArrayBuffer&&n.write(new Uint8Array(e.data))},l.onclose=r=>{let i=VP.get(e);if(i===void 0||i.disposed)return;if(qP(r.code)){let e=`[connection closed: ${String(r.code)}]`;r.code===4401?e=`[connection closed (4401): your session expired — refresh the page after logging back in]`:r.code===4404&&(e=`[connection closed (4404): project no longer exists]`),n.write(`\r\n${e}\r\n`);return}let a=i.reconnectAttempt+1;i.reconnectAttempt=a;let o=KP(a);n.write(`\r\n[connection lost (${String(r.code)}) — reconnecting in ${String(o/1e3)}s, attempt ${String(a)}]\r\n`),i.reconnectTimer=setTimeout(()=>{let r=VP.get(e);r===void 0||r.disposed||(r.reconnectTimer=void 0,r.ws=XP(e,t,n,r.lastSize,!0))},o)},l}function ZP(e){let t=VP.get(e);if(t!==void 0){t.disposed=!0,t.reconnectTimer!==void 0&&clearTimeout(t.reconnectTimer),VP.delete(e);try{t.observer.disconnect()}catch{}try{(t.ws.readyState===WebSocket.OPEN||t.ws.readyState===WebSocket.CONNECTING)&&t.ws.close(1e3,`tab_closed`)}catch{}try{t.term.dispose()}catch{}}}function QP(){let e=ct(),[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(void 0),[d,f]=(0,v.useState)(0),p=(0,v.useRef)(null),m=(0,v.useRef)(null),h=(0,v.useRef)(void 0),g=xr(e=>e.setActive),_=xr(e=>e.activeProjectId),y=pi(e=>e.setActiveSession),b=pi(e=>e.requestScrollToMessage),x=(0,v.useMemo)(()=>{let e=[];return r.forEach((t,n)=>{t.matches.forEach((r,i)=>{e.push({group:t,match:r,groupIndex:n,matchIndex:i})})}),e},[r]);if((0,v.useEffect)(()=>{f(0)},[r]),(0,v.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),p.current?.focus(),p.current?.select())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,v.useEffect)(()=>{if(!a)return;let e=e=>{m.current!==null&&(m.current.contains(e.target)||o(!1))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,v.useEffect)(()=>{if(t.trim().length===0){i([]),u(void 0),c(!1),h.current?.abort();return}let e=new AbortController;h.current?.abort(),h.current=e,c(!0),u(void 0);let n=window.setTimeout(()=>{L.searchSessions(t.trim(),{signal:e.signal}).then(t=>{e.signal.aborted||(i(t.results),c(!1),o(!0))}).catch(t=>{e.signal.aborted||(c(!1),u(t instanceof Error?t.message:`search failed`))})},250);return()=>{window.clearTimeout(n),e.abort()}},[t]),e)return null;let S=(e,t)=>{b(e.sessionId,t.messageIndex),_!==e.projectId&&g(e.projectId),y(e.sessionId),o(!1),n(``),p.current?.blur()},C=e=>{if(e.key===`Escape`){o(!1),p.current?.blur();return}if(!(!a||x.length===0)){if(e.key===`ArrowDown`)e.preventDefault(),f(e=>Math.min(x.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=x[d];t!==void 0&&S(t.group,t.match)}}},w=e=>{let t=e.snippet.slice(0,e.matchOffset),n=e.snippet.slice(e.matchOffset,e.matchOffset+e.matchLength),r=e.snippet.slice(e.matchOffset+e.matchLength);return(0,R.jsxs)(R.Fragment,{children:[t,(0,R.jsx)(`mark`,{className:`rounded bg-amber-300/30 text-amber-100 light:bg-amber-200 light:text-amber-900`,children:n}),r]})},T=e=>e===`user`?`you`:e===`assistant`?`agent`:`tool`;return(0,R.jsxs)(`div`,{ref:m,className:`relative`,children:[(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(Ze,{size:13,className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-neutral-500`,"aria-hidden":`true`}),(0,R.jsx)(`input`,{ref:p,type:`text`,value:t,onChange:e=>n(e.target.value),onFocus:()=>{r.length>0&&o(!0)},onKeyDown:C,placeholder:`Search sessions… ⌘K`,"aria-label":`Search across all sessions`,className:`w-64 rounded-md border border-neutral-700 bg-neutral-900 py-1 pl-7 pr-7 text-xs text-neutral-200 placeholder-neutral-500 focus:border-neutral-500 focus:outline-none`}),t.length>0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>{n(``),i([]),o(!1),p.current?.focus()},"aria-label":`Clear search`,className:`absolute right-1 top-1/2 -translate-y-1/2 rounded p-0.5 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200`,children:(0,R.jsx)(at,{size:12})})]}),a&&(0,R.jsxs)(`div`,{role:`listbox`,"aria-label":`Search results`,className:`absolute right-0 top-full z-50 mt-1 max-h-[60vh] w-96 overflow-y-auto rounded-md border border-neutral-700 bg-neutral-900 shadow-xl`,children:[s&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-xs text-neutral-400`,children:`Searching…`}),!s&&l!==void 0&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-xs text-amber-400 light:text-amber-700`,children:l}),!s&&l===void 0&&x.length===0&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-xs text-neutral-500`,children:`No matches.`}),x.length>0&&(0,R.jsx)(`div`,{children:r.map((e,t)=>(0,R.jsxs)(`div`,{className:`border-b border-neutral-800 last:border-b-0`,children:[(0,R.jsxs)(`div`,{className:`bg-neutral-950 px-3 py-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:[(0,R.jsx)(`span`,{className:`text-neutral-300`,children:e.projectName}),e.sessionName!==void 0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`mx-1.5 text-neutral-600`,children:`/`}),(0,R.jsx)(`span`,{className:`text-neutral-400 normal-case tracking-normal`,children:e.sessionName})]})]}),e.matches.map((n,r)=>{let i=x.findIndex(e=>e.groupIndex===t&&e.matchIndex===r),a=i===d;return(0,R.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,onMouseEnter:()=>f(i),onClick:()=>S(e,n),className:`flex w-full items-start gap-2 px-3 py-1.5 text-left text-xs ${a?`bg-neutral-800 text-neutral-100`:`text-neutral-300 hover:bg-neutral-800/60`}`,children:[(0,R.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-neutral-800 px-1 py-0.5 text-[9px] uppercase tracking-wider text-neutral-400`,children:T(n.kind)}),(0,R.jsx)(`span`,{className:`flex-1 break-words`,children:w(n)})]},`${n.messageIndex}-${n.matchOffset}`)})]},e.sessionId))})]})]})}function $P(){let e=MM(e=>e.settings),t=qj(e=>e.openSettings);if(e===void 0||e.total===0&&e.enabled)return null;let{enabled:n,connected:r,total:i}=e,a=n?r===i?`bg-emerald-500`:r===0?`bg-red-500`:`bg-amber-400`:`bg-neutral-600`,o=n?`MCP ${r}/${i}`:`MCP off`;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`mcp`),className:`inline-flex items-center gap-1.5 rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500 hover:text-neutral-100`,title:n?`${r} of ${i} MCP server(s) connected. Click to open Settings → MCP.`:`MCP tools disabled. Click to open Settings → MCP.`,children:[(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full ${a}`}),o]})}var eF=`forge.turnDiff.viewType`;function tF(){try{return localStorage.getItem(eF)===`split`?`split`:`unified`}catch{return`unified`}}function nF(){let e=pi(e=>e.activeSessionId),t=pi(t=>e===void 0?0:t.agentEndCountBySession[e]??0),n=pi(t=>e===void 0?!1:t.streamingBySession[e]??!1),[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)({}),[d,f]=(0,v.useState)(tF),p=e=>{f(e);try{localStorage.setItem(eF,e)}catch{}},m=async()=>{if(e!==void 0){c(!0),o(void 0);try{i((await L.getTurnDiff(e)).entries)}catch(e){e instanceof N&&e.status===404?i([]):(i([]),o(e instanceof N?e.code:e.message))}finally{c(!1)}}};return(0,v.useEffect)(()=>{i([]),o(void 0)},[e]),(0,v.useEffect)(()=>{e===void 0||n||m()},[e,t,n]),e===void 0?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs italic text-neutral-500`,children:`Pick a session to see its file changes.`}):(0,R.jsxs)(`div`,{className:`flex h-full flex-col text-xs text-neutral-300`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-neutral-200`,children:[(0,R.jsx)(je,{size:13}),`Last turn`,r.length>0&&(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] text-neutral-400`,children:r.length})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>p(d===`split`?`unified`:`split`),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:d===`split`?`Switch to unified view`:`Switch to side-by-side view`,children:d===`split`?(0,R.jsx)(me,{size:13}):(0,R.jsx)(le,{size:13})}),(0,R.jsx)(`button`,{onClick:()=>void m(),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Refresh diff`,children:(0,R.jsx)(Je,{size:13,className:s?`animate-spin`:``})})]})]}),a!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300`,children:a}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-3 italic text-neutral-500`,children:s?`Loading…`:a===void 0?`No file changes from the most recent turn.`:`Couldn't load the latest turn diff (see banner).`}),r.map(e=>{let t=l[e.file]??!1,n=e.file.split(`/`).pop()??e.file;return(0,R.jsxs)(`div`,{className:`border-b border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>u(n=>({...n,[e.file]:!t})),className:`flex w-full items-center justify-between gap-2 px-3 py-2 text-left hover:bg-neutral-900`,title:e.file,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate font-mono text-neutral-200`,children:n}),e.isPureAddition&&(0,R.jsx)(`span`,{className:`rounded bg-emerald-900/40 px-1 py-0.5 text-[9px] uppercase tracking-wider text-emerald-300 light:bg-emerald-100 light:text-emerald-800`,children:`new`})]}),(0,R.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2 text-[11px]`,children:[(0,R.jsxs)(`span`,{className:`text-emerald-400 light:text-emerald-700`,children:[`+`,e.additions]}),(0,R.jsxs)(`span`,{className:`text-red-400 light:text-red-700`,children:[`−`,e.deletions]})]})]}),t&&(0,R.jsx)(Xk,{diff:e.diff,viewType:d})]},e.file)})]})]})}var rF=15e3;function iF(e,t){let[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)(void 0),o=pi(e=>e.activeSessionId),s=pi(e=>o===void 0?!1:e.streamingBySession[o]??!1),c=pi(e=>o===void 0?0:e.agentEndCountBySession[o]??0),l=(0,v.useRef)(0),u=async()=>{if(e===void 0)return;let n=l.current,i=e;try{let e=await L.gitStatus(i,t);if(l.current!==n)return;r(e),a(void 0)}catch(e){if(l.current!==n)return;a(e instanceof N?e.code:e.message)}};return(0,v.useEffect)(()=>{l.current+=1,r(void 0),a(void 0)},[e,t]),(0,v.useEffect)(()=>{if(e===void 0)return;if(u(),s)return()=>void 0;let t=window.setInterval(()=>{u()},rF);return()=>{window.clearInterval(t)}},[e,t,s]),(0,v.useEffect)(()=>{e!==void 0&&c!==0&&u()},[e,t,o,c]),{status:n,error:i,refresh:u}}function aF(e){let t=[],n=[];for(let r of e){let e=t.slice(),i=t.findIndex(e=>e===r.hash);i===-1&&(i=t.findIndex(e=>e===void 0),i===-1&&(i=t.length,t.push(void 0)));let a=[];for(let e=0;e<t.length;e++)t[e]===r.hash&&a.push(e);for(let e of a)t[e]=void 0;let o=[];if(r.parents.length>0){let e=r.parents[0];t[i]=e,o.push({lane:i,parent:e})}for(let e=1;e<r.parents.length;e++){let n=r.parents[e],i=t.findIndex(e=>e===n);i===-1&&(i=t.findIndex(e=>e===void 0),i===-1&&(i=t.length,t.push(void 0)),t[i]=n),o.push({lane:i,parent:n})}for(;t.length>0&&t[t.length-1]===void 0;)t.pop();let s=[];for(let t=0;t<e.length;t++)e[t]!==void 0&&t!==i&&(a.includes(t)||s.push(t));let c=Math.max(i+1,t.length,...a.map(e=>e+1),...o.map(e=>e.lane+1),...s.map(e=>e+1));n.push({hash:r.hash,lane:i,incomingLanes:a,outgoingLanes:o,through:s,width:c})}return n}var oF=[`#a5b4fc`,`#fde047`,`#a3e635`,`#f472b6`,`#67e8f9`,`#fb923c`,`#c084fc`,`#86efac`];function sF(e){return oF[e%oF.length]??`#a5b4fc`}function cF(e,t){return e!==void 0&&t!==void 0?`${e}/${t}`:e===void 0?t===void 0?`the configured upstream`:`origin/${t}`:e}function lF(e){return e.split(`
|
|
373
373
|
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`From `)).at(-1)}function uF(e,t){let n=cF(t),r=lF(e);return r===void 0?`Fetch complete from ${n}. No remote updates were reported.`:`Fetch complete from ${n}. Latest update: ${r}`}function dF(e,t,n){let r=cF(t,n);if(/already up[- ]to[- ]date\.?/i.test(e))return`Already up to date. Your local branch matches ${r}.`;let i=lF(e);return i===void 0?`Pull complete from ${r}. Refreshing the working tree status now.`:`Pull complete from ${r}. Latest update: ${i}`}function fF(e,t){return e===`fetch`?`Fetch failed: ${t}. Check the remote name, network connection, and Git credentials.`:`Pull failed: ${t}. If there are conflicts, resolve them in the terminal, then refresh git status.`}function pF(){let e=Sr(),t=e?.id,[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)(void 0),{status:o,error:s,refresh:c}=iF(t,i),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(void 0),[h,g]=(0,v.useState)(void 0),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(void 0),[S,C]=(0,v.useState)(void 0),[w,T]=(0,v.useState)(void 0),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[ee,te]=(0,v.useState)(!1),[ne,re]=(0,v.useState)(void 0),[ie,ae]=(0,v.useState)(void 0),[A,j]=(0,v.useState)(void 0),[M,oe]=(0,v.useState)(!1),[se,ce]=(0,v.useState)(``),[ue,fe]=(0,v.useState)(``),[pe,he]=(0,v.useState)(!1),[ge,_e]=(0,v.useState)(void 0),ve=async()=>{if(e!==void 0)try{T((await L.gitRemotes(e.id,i)).remotes)}catch(e){g(e instanceof N?e.code:e.message)}},ye=async()=>{if(e===void 0)return;let t=se.trim(),n=ue.trim();if(!(t.length===0||n.length===0)){j(t),g(void 0);try{let r={insecureTls:pe};i!==void 0&&(r.worktreePath=i),await L.gitRemoteAdd(e.id,t,n,r),oe(!1),ce(``),fe(``),he(!1),await ve()}catch(e){g(e instanceof N?e.message||e.code:e.message)}finally{j(void 0)}}},be=async(t,n)=>{if(e!==void 0){j(t),g(void 0);try{await L.gitRemoteSetInsecureTls(e.id,t,n,i),await ve()}catch(e){g(e instanceof N?e.message||e.code:e.message)}finally{j(void 0)}}},Se=async()=>{if(e===void 0||ge===void 0)return;let t=ge;_e(void 0),j(t),g(void 0);try{await L.gitRemoteRemove(e.id,t,i),await ve()}catch(e){g(e instanceof N?e.message||e.code:e.message)}finally{j(void 0)}},Ce=async()=>{if(e!==void 0)try{C((await L.gitBranches(e.id,i)).branches)}catch(e){g(e instanceof N?e.code:e.message)}},we=async t=>{if(e!==void 0){re(t),g(void 0);try{await L.gitCheckout(e.id,t,i),await Ce(),c()}catch(e){g(e instanceof N?e.code:e.message)}finally{re(void 0)}}},Te=async t=>{if(e!==void 0){ae(void 0),re(t),g(void 0);try{let n={checkout:!0};i!==void 0&&(n.worktreePath=i),await L.gitBranchCreate(e.id,t,n),await Ce(),c()}catch(e){g(e instanceof N?e.code:e.message)}finally{re(void 0)}}},Ee=async t=>{if(e===void 0||ie?.kind!==`delete`)return;let{name:n}=ie;ae(void 0),re(n),g(void 0);try{await L.gitBranchDelete(e.id,n,t,i),await Ce()}catch(e){g(e instanceof N?e.code:e.message)}finally{re(void 0)}},[De,Oe]=(0,v.useState)({}),[ke,Ae]=(0,v.useState)(void 0),[je,Me]=(0,v.useState)(void 0),[Ne,Pe]=(0,v.useState)(``),[Ie,Le]=(0,v.useState)(!1),[Re,ze]=(0,v.useState)(!1),[Be,Ve]=(0,v.useState)(()=>{try{return localStorage.getItem(`forge.gitPanel.viewType`)===`split`?`split`:`unified`}catch{return`unified`}}),He=e=>{Ve(e);try{localStorage.setItem(`forge.gitPanel.viewType`,e)}catch{}};if((0,v.useEffect)(()=>{r(void 0),a(void 0),x(void 0),C(void 0),T(void 0),Oe({}),t!==void 0&&L.gitWorktrees(t).then(e=>{r(e.worktrees),a((e.worktrees.find(e=>e.current)??e.worktrees[0])?.path)}).catch(e=>g(e instanceof N?e.code:e.message))},[t]),(0,v.useEffect)(()=>{x(void 0),C(void 0),T(void 0),Oe({}),y(void 0),g(void 0)},[i]),(0,v.useEffect)(()=>{if(o===void 0)return;let e=new Set(o.files.map(e=>e.path));Oe(t=>{let n=!1,r={};for(let[i,a]of Object.entries(t)){let t=i.split(`|`)[0]??``;e.has(t)?r[i]=a:n=!0}return n?r:t})},[o]),(0,v.useEffect)(()=>{E&&e!==void 0&&L.gitLog(e.id,30).then(e=>x(e.commits)).catch(e=>g(e instanceof N?e.code:e.message))},[E,e?.id]),(0,v.useEffect)(()=>{O&&e!==void 0&&L.gitBranches(e.id).then(e=>C(e.branches)).catch(e=>g(e instanceof N?e.code:e.message))},[O,e?.id]),(0,v.useEffect)(()=>{ee&&e!==void 0&&L.gitRemotes(e.id).then(e=>T(e.remotes)).catch(e=>g(e instanceof N?e.code:e.message))},[ee,e?.id]),e===void 0)return(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs italic text-neutral-500`,children:`Pick a project to see its git status.`});if(o?.isGitRepo===!1){let t=async()=>{f(!0),g(void 0);try{await L.gitInit(e.id),await c()}catch(e){g(e instanceof N?e.code:e.message)}finally{f(!1)}};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-4 text-center text-xs text-neutral-500`,children:[(0,R.jsxs)(`p`,{className:`italic`,children:[e.name,` isn't a git repository.`]}),(0,R.jsx)(`button`,{onClick:()=>void t(),disabled:d,className:`rounded-md bg-neutral-100 px-3 py-1.5 text-xs font-medium text-neutral-900 hover:bg-white disabled:cursor-not-allowed disabled:opacity-50`,title:"Run `git init -b main` in the project root",children:d?`Initializing…`:`Initialize git repo`}),(0,R.jsxs)(`p`,{className:`text-[10px] text-neutral-600`,children:[`Default branch will be `,(0,R.jsx)(`code`,{className:`font-mono text-neutral-400`,children:`main`}),`.`]}),h!==void 0&&(0,R.jsxs)(`p`,{className:`text-[10px] text-red-400 light:text-red-700`,children:[`git init failed: `,h]})]})}let Ue=o?.files.filter(e=>e.staged)??[],We=o?.files.filter(e=>e.unstaged)??[],Ge=o?.files.filter(e=>e.kind===`untracked`)??[],Ke=async(t,n)=>{let r=`${t.path}|${n?`staged`:`unstaged`}`;if(De[r]!==void 0){Oe(e=>{let t={...e};return delete t[r],t});return}Oe(e=>({...e,[r]:`loading`}));try{let a=await L.gitDiffFile(e.id,t.path,n,i);Oe(e=>({...e,[r]:a.diff}))}catch{Oe(e=>({...e,[r]:`error`}))}},Ye=async t=>{if(t.length!==0){f(!0),g(void 0);try{await L.gitStage(e.id,t,i),await c()}catch(e){g((e instanceof N,e.message))}finally{f(!1)}}},Xe=async t=>{if(t.length!==0){f(!0),g(void 0),y(void 0);try{await L.gitRevert(e.id,t,i),y(t.length===1?`Reverted ${t[0]}`:`Reverted ${t.length} files`),await c()}catch(e){g((e instanceof N,e.message))}finally{f(!1)}}},Ze=async t=>{if(t.length!==0){f(!0),g(void 0);try{await L.gitUnstage(e.id,t,i),await c()}catch(e){g((e instanceof N,e.message))}finally{f(!1)}}},Qe=async(t,n,r)=>{Ae(t.path),g(void 0);try{let a=await L.gitApplyHunks(e.id,t.path,r,[n],i);if(a.ok!==!0){g(`Hunk apply failed: ${a.error??`unknown_error`}`);return}await Promise.all([$e(t,!0),$e(t,!1),c()])}catch(e){g((e instanceof N,e.message))}finally{Ae(void 0)}},$e=async(t,n)=>{let r=`${t.path}|${n?`staged`:`unstaged`}`;if(De[r]!==void 0){Oe(e=>({...e,[r]:`loading`}));try{let a=await L.gitDiffFile(e.id,t.path,n,i);Oe(e=>{if(a.diff.length===0){let t={...e};return delete t[r],t}return{...e,[r]:a.diff}})}catch{Oe(e=>({...e,[r]:`error`}))}}},et=async()=>{let t=l.trim();if(t.length!==0){f(!0),g(void 0),y(void 0);try{let{hash:n}=await L.gitCommit(e.id,t,i);u(``),y(`Committed ${n.slice(0,7)}`),await c(),E&&x((await L.gitLog(e.id,30,i)).commits)}catch(e){g((e instanceof N,e.message))}finally{f(!1)}}},nt=(()=>{if(w!==void 0)return w.map(e=>e.name).sort();if(S===void 0)return[];let e=new Set;for(let t of S){if(!t.remote)continue;let n=t.name.indexOf(`/`);n>0&&e.add(t.name.slice(0,n))}return Array.from(e).sort()})(),it=S===void 0?[]:S.filter(e=>!e.remote).map(e=>e.name).sort(),at=async()=>{f(!0),m(`fetch`),g(void 0),y(`Fetching from ${cF(je)}…`);try{let t={};je!==void 0&&(t.remote=je),i!==void 0&&(t.worktreePath=i);let{output:n}=await L.gitFetch(e.id,t);y(uF(n,je))}catch(e){let t=(e instanceof N,e.message);y(void 0),g(fF(`fetch`,t))}finally{f(!1),m(void 0)}},ot=async()=>{f(!0),m(`pull`),g(void 0);let t=Ne.trim(),n=t.length>0?t:void 0;y(`Pulling from ${cF(je,n)}…`);try{let t={};je!==void 0&&(t.remote=je),n!==void 0&&(t.branch=n),i!==void 0&&(t.worktreePath=i);let{output:r}=await L.gitPull(e.id,t);y(dF(r,je,n)),c()}catch(e){let t=(e instanceof N,e.message);y(void 0),g(fF(`pull`,t))}finally{f(!1),m(void 0)}},st=async()=>{f(!0),g(void 0),y(void 0);try{let t={};je!==void 0&&(t.remote=je);let n=Ne.trim();n.length>0&&(t.branch=n),Ie&&(t.setUpstream=!0),i!==void 0&&(t.worktreePath=i);let{output:r}=await L.gitPush(e.id,t);y(r.trim().length>0?r.trim().split(`
|
|
374
|
-
`).pop()??`Pushed`:`Pushed`),Ie&&Le(!1)}catch(e){g((e instanceof N,e.message))}finally{f(!1)}},ct=e=>{let t=e.path.split(/[\\/]/).filter(Boolean).pop()??e.path;return e.branch===void 0?e.detached&&e.head!==void 0?`${e.head.slice(0,7)} — ${t}`:t:`${e.branch} — ${t}`};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col text-xs text-neutral-300`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-neutral-200`,children:[(0,R.jsx)(Fe,{size:13,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:o?.branch??`—`}),o!==void 0&&o.files.length>0&&(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] text-neutral-400`,children:o.files.length})]}),(0,R.jsxs)(`label`,{className:`mt-1 flex items-center gap-1.5 text-[10px] text-neutral-500`,children:[(0,R.jsx)(`span`,{className:`shrink-0 uppercase tracking-wider`,children:`Worktree`}),(0,R.jsx)(`select`,{value:i??``,onChange:e=>a(e.target.value||void 0),disabled:n===void 0||n.length<=1,className:`min-w-0 flex-1 rounded border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-[10px] text-neutral-200 outline-none hover:border-neutral-600 focus:border-neutral-500 disabled:cursor-not-allowed disabled:border-neutral-800 disabled:text-neutral-500`,title:i===void 0?`Loading git worktrees`:`Viewing git info for ${i}`,children:n===void 0?(0,R.jsx)(`option`,{value:``,children:`Loading…`}):n.length===0?(0,R.jsx)(`option`,{value:``,children:`No worktrees`}):n.map(e=>(0,R.jsx)(`option`,{value:e.path,children:ct(e)},e.path))})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>He(Be===`split`?`unified`:`split`),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:Be===`split`?`Switch git diffs to unified view`:`Switch git diffs to side-by-side view`,children:Be===`split`?(0,R.jsx)(me,{size:13}):(0,R.jsx)(le,{size:13})}),(0,R.jsx)(`button`,{onClick:()=>void c(),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Refresh`,children:(0,R.jsx)(Je,{size:13,className:d?`animate-spin`:``})})]})]}),(s!==void 0||h!==void 0)&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:h??s}),_!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-emerald-700/40 bg-emerald-900/20 px-3 py-1.5 text-[11px] text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`,children:_}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[o===void 0&&(0,R.jsx)(`p`,{className:`px-3 py-3 italic text-neutral-500`,children:`Loading…`}),o?.files.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-3 italic text-neutral-500`,children:`Working tree clean.`}),Ue.length>0&&(0,R.jsx)(hF,{label:`Staged`,files:Ue,actionLabel:`Unstage all`,onGroupAction:()=>void Ze(Ue.map(e=>e.path)),onFileAction:e=>void Ze([e.path]),fileActionLabel:`Unstage`,onRevert:e=>void Xe([e.path]),onClickFile:e=>void Ke(e,!0),openDiffs:De,staged:!0,diffViewType:Be,onHunkAction:(e,t)=>void Qe(e,t,`unstage`),pendingHunkPath:ke}),We.length>0&&(0,R.jsx)(hF,{label:`Unstaged`,files:We,actionLabel:`Stage all`,onGroupAction:()=>void Ye(We.map(e=>e.path)),onFileAction:e=>void Ye([e.path]),fileActionLabel:`Stage`,onRevert:e=>void Xe([e.path]),onClickFile:e=>void Ke(e,!1),openDiffs:De,staged:!1,diffViewType:Be,onHunkAction:(e,t)=>void Qe(e,t,`stage`),pendingHunkPath:ke}),Ge.length>0&&(0,R.jsx)(hF,{label:`Untracked`,files:Ge,actionLabel:`Stage all`,onGroupAction:()=>void Ye(Ge.map(e=>e.path)),onFileAction:e=>void Ye([e.path]),fileActionLabel:`Stage`,onRevert:void 0,onClickFile:e=>void Ke(e,!1),openDiffs:De,staged:!1,diffViewType:Be}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60 px-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:[(0,R.jsx)(de,{size:10}),` Commit`]}),(0,R.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:`Commit message…`,rows:3,className:`w-full resize-none rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] text-neutral-500`,children:[Ue.length,` staged`]}),(0,R.jsx)(`button`,{onClick:()=>void et(),disabled:d||Ue.length===0||l.trim().length===0,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:`Commit`})]})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60 px-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(rt,{size:10}),` Push`]}),(0,R.jsx)(`button`,{onClick:()=>{ze(e=>!e),!Re&&S===void 0&&L.gitBranches(e.id).then(e=>C(e.branches)).catch(()=>void 0),!Re&&w===void 0&&L.gitRemotes(e.id).then(e=>T(e.remotes)).catch(()=>void 0)},className:`rounded px-1 py-0.5 text-[10px] normal-case text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`,children:Re?`Hide options`:`Options`})]}),Re&&(0,R.jsxs)(`div`,{className:`mb-2 space-y-1.5 rounded border border-neutral-800 bg-neutral-900/40 p-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`w-16 shrink-0 text-neutral-400`,children:`Remote`}),nt.length>0?(0,R.jsxs)(`select`,{value:je??``,onChange:e=>Me(e.target.value===``?void 0:e.target.value),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:``,children:`configured upstream`}),nt.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):(0,R.jsx)(`input`,{type:`text`,value:je??``,onChange:e=>Me(e.target.value.length===0?void 0:e.target.value),placeholder:`origin`,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`w-16 shrink-0 text-neutral-400`,children:`Branch`}),it.length>0?(0,R.jsxs)(`select`,{value:Ne,onChange:e=>Pe(e.target.value),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:``,children:o?.branch??`current branch`}),it.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):(0,R.jsx)(`input`,{type:`text`,value:Ne,onChange:e=>Pe(e.target.value),placeholder:o?.branch??`current`,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px] text-neutral-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:Ie,onChange:e=>Le(e.target.checked),className:`h-3 w-3`}),(0,R.jsx)(`span`,{children:`Set upstream (first push of a new branch)`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>void at(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:je===void 0?`Fetch remote-tracking updates from the configured upstream; the working tree is not changed.`:`Fetch remote-tracking updates from ${je}; the working tree is not changed.`,children:p===`fetch`?`Fetching…`:`Fetch`}),(0,R.jsx)(`button`,{onClick:()=>void ot(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:`Fetch and merge the selected upstream into this worktree. Conflicts are shown in the error banner; resolve them in the integrated terminal.`,children:p===`pull`?`Pulling…`:`Pull`}),(0,R.jsx)(`button`,{onClick:()=>void st(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:je===void 0&&Ne.trim().length===0?`git push (configured upstream)`:`git push ${je??`(upstream)`}${Ne.trim().length>0?` ${Ne.trim()}`:``}`,children:`Push`})]})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>D(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Log`}),(0,R.jsx)(`span`,{children:E?`−`:`+`})]}),E&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:b===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):b.length===0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`No commits yet.`}):(0,R.jsx)(yF,{commits:b})})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>k(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Branches`}),(0,R.jsx)(`span`,{children:O?`−`:`+`})]}),O&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:S===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ul`,{className:`space-y-0.5`,children:S.map(e=>{let t=ne===e.name;return(0,R.jsxs)(`li`,{className:`group flex items-center gap-1 rounded px-1 py-0.5 font-mono hover:bg-neutral-900 ${e.current?`text-emerald-400 light:text-emerald-700`:`text-neutral-300`}`,children:[(0,R.jsx)(`span`,{className:`w-3 shrink-0`,children:e.current?(0,R.jsx)(xe,{size:10}):null}),(0,R.jsx)(`span`,{className:`flex-1 truncate`,title:e.name,children:e.name}),e.remote&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] text-neutral-600`,children:`remote`}),!e.current&&(0,R.jsxs)(`div`,{className:`hidden gap-0.5 group-hover:flex`,children:[(0,R.jsx)(`button`,{onClick:()=>void we(e.name),disabled:t,className:`rounded px-1 py-0.5 text-[10px] text-neutral-400 hover:bg-neutral-800 hover:text-neutral-100 disabled:opacity-40`,title:e.remote?`Checkout (creates a tracking branch from ${e.name})`:`Checkout ${e.name}`,children:`checkout`}),!e.remote&&(0,R.jsx)(`button`,{onClick:()=>ae({kind:`delete`,name:e.name}),disabled:t,className:`rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 disabled:opacity-40 light:hover:bg-red-100 light:hover:text-red-700`,title:`Delete branch`,children:(0,R.jsx)(tt,{size:10})})]})]},e.name)})}),(0,R.jsxs)(`button`,{onClick:()=>ae({kind:`create`}),className:`mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,children:[(0,R.jsx)(qe,{size:10}),` New branch`]})]})})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>te(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Remotes`}),(0,R.jsx)(`span`,{children:ee?`−`:`+`})]}),ee&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:w===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):(0,R.jsxs)(R.Fragment,{children:[w.length===0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`No remotes configured.`}):(0,R.jsx)(`ul`,{className:`space-y-1`,children:w.map(e=>{let t=e.fetchUrl!==e.pushUrl,n=A===e.name;return(0,R.jsxs)(`li`,{className:`group flex flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-200`,children:e.name}),t&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/30 px-1 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,children:`fetch ≠ push`}),e.insecureTls&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,title:`TLS certificate verification disabled for this remote URL in local git config`,children:`ignore tls`}),(0,R.jsx)(`button`,{onClick:()=>_e(e.name),disabled:n,className:`ml-auto hidden rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 disabled:opacity-40 group-hover:inline-flex light:hover:bg-red-100 light:hover:text-red-700`,title:`Remove remote "${e.name}"`,children:(0,R.jsx)(tt,{size:10})})]}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[10px] text-neutral-500`,title:e.fetchUrl,children:e.fetchUrl}),t&&(0,R.jsxs)(`span`,{className:`break-all font-mono text-[10px] text-neutral-500`,title:`push → ${e.pushUrl}`,children:[`push → `,e.pushUrl]}),(0,R.jsxs)(`label`,{className:`mt-0.5 flex items-start gap-1.5 text-[10px] text-neutral-500`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.insecureTls,onChange:t=>void be(e.name,t.target.checked),disabled:n,className:`mt-0.5 h-3 w-3`}),(0,R.jsx)(`span`,{children:`Ignore SSL/TLS verification for this remote (local repo config only)`})]})]},e.name)})}),(0,R.jsxs)(`button`,{onClick:()=>{ce(``),fe(``),he(!1),oe(!0)},className:`mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,children:[(0,R.jsx)(qe,{size:10}),` Add remote`]})]})})]})]}),(0,R.jsx)(ia,{open:ie?.kind===`create`,onClose:()=>ae(void 0),onSubmit:e=>void Te(e),title:`New branch`,label:`Branch name`,placeholder:`feature/my-change`,primaryLabel:`Create + checkout`}),(0,R.jsx)(aa,{open:ie?.kind===`delete`,onClose:()=>ae(void 0),onConfirm:()=>void Ee(!1),title:`Delete branch`,message:ie?.kind===`delete`?`Delete branch "${ie.name}"? Refused if not merged into HEAD; force-delete from the terminal if you really mean it.`:``,primaryLabel:`Delete`,tone:`danger`}),(0,R.jsx)(ra,{open:M,onClose:()=>oe(!1),title:`Add remote`,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ye()},className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`Name`}),(0,R.jsx)(`input`,{type:`text`,value:se,onChange:e=>ce(e.target.value),placeholder:`origin`,autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 font-mono text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`URL`}),(0,R.jsx)(`input`,{type:`text`,value:ue,onChange:e=>fe(e.target.value),placeholder:`git@github.com:user/repo.git`,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 font-mono text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-amber-900/40 bg-amber-950/30 px-2 py-1.5 text-xs light:border-amber-300 light:bg-amber-50`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:pe,onChange:e=>he(e.target.checked),className:`mt-0.5`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`text-amber-200 light:text-amber-800`,children:`Ignore SSL/TLS verification for this remote`}),(0,R.jsx)(`br`,{}),(0,R.jsx)(`span`,{className:`text-[11px] text-amber-300/70 light:text-amber-700/80`,children:`Persists only in this repository as URL-scoped git config. Use only for internal Git hosts with a known self-signed/private-CA certificate.`})]})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>oe(!1),className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:se.trim().length===0||ue.trim().length===0,className:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white disabled:cursor-not-allowed disabled:opacity-40`,children:`Add`})]})]})}),(0,R.jsx)(aa,{open:ge!==void 0,onClose:()=>_e(void 0),onConfirm:()=>void Se(),title:`Remove remote`,message:ge===void 0?``:`Remove remote "${ge}"? The local repo loses its reference to this URL; existing commits aren't affected.`,primaryLabel:`Remove`,tone:`danger`})]})}var mF=3e3;function hF(e){let[t,n]=(0,v.useState)(void 0),r=(0,v.useRef)(void 0),i=()=>{r.current!==void 0&&(window.clearTimeout(r.current),r.current=void 0),n(void 0)};(0,v.useEffect)(()=>()=>{r.current!==void 0&&window.clearTimeout(r.current)},[]);let a=a=>{if(e.onRevert!==void 0){if(t===a.path){i(),e.onRevert(a);return}r.current!==void 0&&window.clearTimeout(r.current),n(a.path),r.current=window.setTimeout(()=>{n(void 0),r.current=void 0},mF)}};return(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:[e.label,` (`,e.files.length,`)`]}),(0,R.jsx)(`button`,{onClick:e.onGroupAction,className:`text-[10px] text-neutral-400 hover:text-neutral-200`,children:e.actionLabel})]}),(0,R.jsx)(`ul`,{children:e.files.map(n=>{let r=`${n.path}|${e.staged?`staged`:`unstaged`}`,i=e.openDiffs[r],o=t===n.path;return(0,R.jsxs)(`li`,{className:`border-t border-neutral-900`,children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{className:`inline-block w-5 shrink-0 text-center font-mono text-[10px] text-neutral-500`,title:`porcelain code: ${n.code}`,children:gF(n.kind)}),(0,R.jsx)(`button`,{onClick:()=>e.onClickFile(n),className:`flex-1 truncate text-left font-mono`,title:n.path,children:n.path}),e.onRevert!==void 0&&(0,R.jsxs)(`button`,{onClick:()=>a(n),className:o?`inline-flex items-center gap-1 rounded bg-red-900/40 px-1 py-0.5 text-[10px] text-red-200 light:bg-red-100 light:text-red-800`:`hidden items-center gap-1 text-[10px] text-neutral-500 hover:text-red-300 group-hover:inline-flex light:hover:text-red-700`,title:o?`Click again to discard local changes (this cannot be undone)`:`Revert: discard local changes for this file`,children:[(0,R.jsx)(nt,{size:10}),o?`Confirm?`:`Revert`]}),(0,R.jsxs)(`button`,{onClick:()=>e.onFileAction(n),className:`ml-3 hidden items-center gap-1 text-[10px] text-neutral-500 hover:text-neutral-200 group-hover:inline-flex`,children:[e.fileActionLabel===`Stage`?(0,R.jsx)(qe,{size:10}):e.fileActionLabel===`Unstage`?(0,R.jsx)(Ue,{size:10}):null,e.fileActionLabel]})]}),i!==void 0&&(0,R.jsx)(`div`,{className:`border-t border-neutral-900 bg-neutral-950`,children:i===`loading`?(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`Loading…`}):i===`error`?(0,R.jsx)(`p`,{className:`px-3 py-2 text-red-400 light:text-red-700`,children:`Failed to load diff.`}):i.length===0?(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`(no diff — file is binary or unchanged)`}):(0,R.jsx)(Xk,{diff:i,viewType:e.diffViewType,onHunkAction:e.onHunkAction===void 0?void 0:t=>e.onHunkAction?.(n,t),hunkActionLabel:e.staged?`Unstage hunk`:`Stage hunk`,hunkActionDisabled:e.pendingHunkPath===n.path})})]},n.path)})})]})}function gF(e){switch(e){case`modified`:return`M`;case`added`:return`A`;case`deleted`:return`D`;case`renamed`:return`R`;case`copied`:return`C`;case`untracked`:return`?`;case`ignored`:return`!`;case`conflicted`:return`U`;default:return`·`}}var _F=14,vF=36;function yF({commits:e}){let t=aF(e),n=Math.max(1,...t.map(e=>e.width));return(0,R.jsx)(`ul`,{className:`space-y-0`,children:e.map((e,r)=>{let i=t[r];return i===void 0?null:(0,R.jsxs)(`li`,{className:`group flex items-stretch`,children:[(0,R.jsx)(bF,{layout:i,isLast:r===t.length-1,maxLanes:n}),(0,R.jsxs)(`div`,{className:`flex flex-col justify-center gap-0.5 pl-2`,style:{minHeight:vF},children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:e.hash.slice(0,7)}),e.refs.map((e,t)=>(0,R.jsx)(xF,{ref_:e},`${t}-${e}`)),(0,R.jsx)(`span`,{className:`truncate text-neutral-200`,title:e.message,children:e.message})]}),(0,R.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-600`,children:[e.author,` · `,new Date(e.date).toLocaleString()]})]})]},e.hash)})})}function bF({layout:e,isLast:t,maxLanes:n}){let r=n*_F,i=vF,a=e.lane*_F+_F/2,o=i/2,s=[];for(let t of e.through){let e=t*_F+_F/2;s.push({x1:e,y1:0,x2:e,y2:i,color:sF(t)})}for(let t of e.incomingLanes){let e=t*_F+_F/2;s.push({x1:e,y1:0,x2:a,y2:o,color:sF(t)})}if(!t)for(let t of e.outgoingLanes){let e=t.lane*_F+_F/2;s.push({x1:a,y1:o,x2:e,y2:i,color:sF(t.lane)})}if(t&&e.outgoingLanes.length>0)for(let t of e.outgoingLanes){let e=t.lane*_F+_F/2;s.push({x1:a,y1:o,x2:e,y2:24,color:sF(t.lane)})}return(0,R.jsxs)(`svg`,{width:r,height:i,viewBox:`0 0 ${r} ${i}`,className:`shrink-0`,"aria-hidden":!0,children:[s.map((e,t)=>(0,R.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:1.5,strokeLinecap:`round`},t)),(0,R.jsx)(`circle`,{cx:a,cy:o,r:3.5,fill:sF(e.lane)})]})}function xF({ref_:e}){let t=e.startsWith(`HEAD ->`)||e===`HEAD`,n=e.startsWith(`tag:`),r=t?e.replace(/^HEAD ->\s*/,``):n?e.replace(/^tag:\s*/,``):e;return(0,R.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0 text-[9px] uppercase tracking-wider ${t?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:n?`bg-amber-900/40 text-amber-300 light:bg-amber-100 light:text-amber-800`:e.includes(`/`)?`bg-neutral-800 text-neutral-500`:`bg-neutral-800 text-neutral-300`}`,children:n?`▼ ${r}`:r})}var SF=250,CF=2,wF=200;function TF(){let e=Sr(),t=Ei(e=>e.openFile),n=qj(e=>e.openEditorPane),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(void 0),w=(0,v.useRef)(void 0),T=(0,v.useCallback)(async t=>{if(e===void 0)return;if(t.length<CF){y(void 0),C(void 0);return}w.current?.abort();let n=new AbortController;w.current=n,x(!0),C(void 0);try{let r={query:t,regex:a,caseSensitive:s,includeGitignored:l,limit:wF,...d.length>0?{include:d}:{},...p.length>0?{exclude:p}:{}},i=await L.searchFiles(e.id,r,n.signal);if(n.signal.aborted)return;y(i)}catch(e){if(n.signal.aborted||e instanceof Error&&e.name===`AbortError`)return;e instanceof N&&e.code===`invalid_response_body`?C(`server returned an unexpected response`):e instanceof Error?C(e.message):C(`search failed`),y(void 0)}finally{n.signal.aborted||x(!1)}},[e,a,s,l,d,p]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void T(r),SF);return()=>window.clearTimeout(e)},[r,T]),(0,v.useEffect)(()=>()=>{w.current?.abort()},[]);let E=(0,v.useMemo)(()=>DF(_?.matches??[]),[_]);return e===void 0?(0,R.jsx)(`div`,{className:`p-4 text-xs italic text-neutral-500`,children:`Select a project to search its files.`}):(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-b border-neutral-800 bg-neutral-900/40 p-2`,children:[(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(Ze,{size:12,className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-neutral-500`}),(0,R.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:a?`Regex…`:`Search project…`,className:`w-full rounded border border-neutral-700 bg-neutral-900 py-1.5 pl-7 pr-2 text-xs text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`,autoFocus:!0})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[(0,R.jsx)(OF,{label:`Regex`,active:a,onClick:()=>o(e=>!e)}),(0,R.jsx)(OF,{label:`Aa`,title:`Case sensitive`,active:s,onClick:()=>c(e=>!e)}),(0,R.jsx)(OF,{label:`+ignored`,title:`Include files that .gitignore would normally skip`,active:l,onClick:()=>u(e=>!e)}),(0,R.jsxs)(`button`,{onClick:()=>g(e=>!e),className:`ml-auto flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500`,children:[h?(0,R.jsx)(Se,{size:10}):(0,R.jsx)(we,{size:10}),`Globs`]})]}),h&&(0,R.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-1.5`,children:[(0,R.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`include glob — e.g. **/*.ts`,className:`rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-[11px] text-neutral-200 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`}),(0,R.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`exclude glob — e.g. **/dist/**`,className:`rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-[11px] text-neutral-200 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-auto`,children:[(0,R.jsx)(kF,{query:r,loading:b,error:S,results:_,totalFiles:E.length}),(0,R.jsx)(`ul`,{className:`divide-y divide-neutral-900`,children:E.map(([r,i])=>(0,R.jsx)(AF,{path:r,matches:i,onPick:i=>{t(e.id,EF(e.path,r),{line:i.line,column:i.column}),n()}},r))})]})]})}function EF(e,t){return t.startsWith(`/`)?t:`${e}${e.endsWith(`/`)?``:`/`}${t}`}function DF(e){let t=new Map;for(let n of e){let e=t.get(n.path);e===void 0?t.set(n.path,[n]):e.push(n)}return Array.from(t.entries())}function OF({label:e,title:t,active:n,onClick:r}){return(0,R.jsx)(`button`,{onClick:r,title:t,className:`rounded border px-1.5 py-0.5 text-[10px] ${n?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-400 hover:border-neutral-500`}`,children:e})}function kF({query:e,loading:t,error:n,results:r,totalFiles:i}){return e.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-center text-xs text-neutral-500`,children:[(0,R.jsx)(Me,{size:20,className:`text-neutral-700`}),(0,R.jsx)(`p`,{children:`Type to search across project files.`}),(0,R.jsxs)(`p`,{className:`text-[10px] text-neutral-600`,children:[`Min `,CF,` chars · Click a result to jump to that line.`]})]}):e.length<CF?(0,R.jsxs)(`div`,{className:`px-4 py-3 text-xs italic text-neutral-500`,children:[`Keep typing — at least `,CF,` characters.`]}):t&&r===void 0?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-neutral-400`,children:[(0,R.jsx)(pe,{size:12,className:`animate-spin`}),` Searching…`]}):n===void 0?r===void 0?null:r.matches.length===0?(0,R.jsx)(`div`,{className:`px-4 py-3 text-xs italic text-neutral-500`,children:`No matches.`}):(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 bg-neutral-950/60 px-3 py-1.5 text-[10px]`,children:[(0,R.jsxs)(`span`,{className:`text-neutral-400`,children:[r.matches.length,` match`,r.matches.length===1?``:`es`,` in `,i,` `,`file`,i===1?``:`s`,r.truncated&&(0,R.jsxs)(`span`,{className:`ml-1 text-amber-400 light:text-amber-700`,children:[`· truncated at `,wF]})]}),r.engine===`node`&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1.5 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,title:`ripgrep was not found on this host — using the slower in-process fallback`,children:`fallback`})]}):(0,R.jsx)(`div`,{className:`px-4 py-3 text-xs text-rose-400 light:text-rose-700`,children:n})}function AF({path:e,matches:t,onPick:n}){let[r,i]=(0,v.useState)(!0);return(0,R.jsxs)(`li`,{className:`bg-neutral-950`,children:[(0,R.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`flex w-full items-center gap-1 truncate px-2 py-1 text-left text-[11px] text-neutral-300 hover:bg-neutral-900`,title:e,children:[r?(0,R.jsx)(Se,{size:11}):(0,R.jsx)(we,{size:11}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e}),(0,R.jsx)(`span`,{className:`ml-auto text-[10px] text-neutral-500`,children:t.length})]}),r&&(0,R.jsx)(`ul`,{children:t.map((t,r)=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{onClick:()=>n(t),className:`flex w-full gap-2 px-2 py-0.5 text-left font-mono text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,title:`${e}:${t.line}:${t.column}`,children:[(0,R.jsx)(`span`,{className:`w-10 shrink-0 text-right text-neutral-600`,children:t.line}),(0,R.jsx)(`span`,{className:`truncate`,children:jF(t.lineSnippet,t.column,t.length)})]})},`${t.line}:${t.column}:${r}`))})]})}function jF(e,t,n){let r=Math.max(0,Math.min(e.length,t-1)),i=Math.max(r,Math.min(e.length,r+n)),a=e.length-e.trimStart().length,o=Math.min(a,r),s=e.slice(o,r),c=e.slice(r,i),l=e.slice(i);return n===0||c.length===0?(0,R.jsx)(`span`,{children:e.slice(o)}):(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{children:s}),(0,R.jsx)(`span`,{className:`bg-amber-700/30 text-amber-100 light:bg-amber-200 light:text-amber-900`,children:c}),(0,R.jsx)(`span`,{children:l})]})}var MF=3;function NF(){let e=pi(e=>e.activeSessionId),t=pi(t=>e===void 0?0:t.agentEndCountBySession[e]??0),n=pi(t=>e===void 0?0:t.compactionEndCountBySession[e]??0),r=pi(t=>e===void 0?!1:t.streamingBySession[e]??!1),i=pi(t=>e===void 0?``:t.streamingTextBySession[e]??``),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(void 0),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(void 0),b=(0,v.useRef)(void 0),x=async()=>{if(e===void 0){o(void 0);return}b.current?.abort();let t=new AbortController;b.current=t,c(!0),u(void 0);try{let n=await L.getSessionContext(e,t.signal);if(t.signal.aborted)return;o(n)}catch(e){if(t.signal.aborted||e instanceof Error&&e.name===`AbortError`)return;e instanceof N&&e.status===404?(o(void 0),u(void 0)):u(e instanceof N?e.code:e.message)}finally{t.signal.aborted||c(!1)}};return(0,v.useEffect)(()=>{x()},[e,t,n]),(0,v.useEffect)(()=>()=>{b.current?.abort()},[]),e===void 0?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 py-6 text-center text-xs italic text-neutral-500`,children:`Select a session to inspect its context.`}):(0,R.jsxs)(`div`,{className:`flex h-full flex-col bg-neutral-950 text-xs text-neutral-200`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 bg-neutral-900/40 px-3 py-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-400`,children:`Context inspector`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[s&&(0,R.jsx)(pe,{size:11,className:`animate-spin text-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>void x(),disabled:s,className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200 disabled:opacity-40`,title:`Refresh`,children:(0,R.jsx)(Je,{size:11,className:s?`animate-spin`:``})})]})]}),l!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:l}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:a===void 0?(0,R.jsx)(`div`,{className:`px-4 py-6 text-center text-xs italic text-neutral-500`,children:s?`Loading…`:`No data — try refresh.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(PF,{data:a,turnsExpanded:d,onToggleTurns:()=>f(e=>!e)}),(0,R.jsx)(zF,{messages:a.messages,showThinking:p,onToggleThinking:()=>m(e=>!e),onViewRaw:(e,t)=>y({index:e,payload:t}),search:h,onSearchChange:g,...r&&i.length>0?{streamingTail:{content:i}}:{}})]})}),_!==void 0&&(0,R.jsx)(VF,{title:`Message ${_.index} — raw AgentMessage JSON`,payload:_.payload,onClose:()=>y(void 0)})]})}function PF({data:e,turnsExpanded:t,onToggleTurns:n}){let r=e.contextUsage,i=(0,v.useMemo)(()=>LF(e.messages,r.tokens),[e.messages,r.tokens]),a=(0,v.useMemo)(()=>GF(e.messages,e.turns),[e.messages,e.turns]),o=r.tokens??i.total,s=r.contextWindow>0?Math.min(1,o/r.contextWindow):0;return(0,R.jsxs)(`div`,{className:`space-y-2 border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[10px] text-neutral-400`,children:[(0,R.jsxs)(`span`,{children:[`Context window (`,r.tokens===void 0?`estimate`:`current`,`)`]}),(0,R.jsxs)(`span`,{children:[JF(o),` /`,` `,r.contextWindow>0?JF(r.contextWindow):`unknown`,r.contextWindow>0&&(0,R.jsxs)(`span`,{className:`ml-1 text-neutral-600`,children:[`(`,(s*100).toFixed(1),`%)`]})]})]}),(0,R.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded bg-neutral-800`,children:(0,R.jsx)(`div`,{className:`h-full ${s>.9?`bg-red-500`:s>.7?`bg-amber-500`:`bg-emerald-500`}`,style:{width:`${Math.max(2,Math.min(100,s*100))}%`}})})]}),(0,R.jsx)(IF,{breakdown:i,contextWindow:r.contextWindow}),(0,R.jsxs)(`div`,{className:`space-y-0.5 border-t border-neutral-800 pt-1.5`,children:[e.turns.length>0&&(()=>{let t=e.turns[e.turns.length-1],n=a.get(t.index)??0;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`Last turn`}),(0,R.jsxs)(`span`,{className:`font-mono text-neutral-300`,title:`New = user message + tool results since the prior assistant turn (estimate). Out = assistant output tokens. Cost = that turn's billed cost.`,children:[`~`,JF(n),` new · `,JF(t.outputTokens),` out ·`,` `,YF(t.cost)]})]})})(),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.input` per turn — NEW non-cached input the LLM saw across the session. Excludes cached portions (tracked separately below).",children:`Input (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalInputTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.cacheRead` per turn — prior context served from the prompt cache. Counted ONCE PER API CALL: every turn re-reads the same cached content and re-pays the (discounted) read fee, so this number grows ~quadratically with conversation length. Billed at ~10% of input rate on most providers.",children:`Cache served (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalCacheReadTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.cacheWrite` per turn — portions cached for reuse on subsequent turns. Billed at ~125% of input rate; small premium up front for big savings on the cache-served line.",children:`Cache written (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalCacheWriteTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.output` per turn — assistant tokens generated.",children:`Output (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalOutputTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-medium`,children:[(0,R.jsx)(`span`,{className:`text-neutral-300`,children:`Total cost`}),(0,R.jsx)(`span`,{className:`font-mono text-emerald-400 light:text-emerald-700`,children:YF(e.totalCost)})]})]}),e.turns.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-400 hover:text-neutral-200`,children:[t?(0,R.jsx)(Se,{size:10}):(0,R.jsx)(we,{size:10}),`Per-turn (`,e.turns.length,`)`]}),t&&(0,R.jsx)(RF,{turns:e.turns,newDeltas:a})]})]})}var FF=[{key:`systemAndTools`,label:`System + tools`,color:`#64748b`},{key:`userPrompts`,label:`User prompts`,color:`#0ea5e9`},{key:`assistantText`,label:`Assistant text`,color:`#a78bfa`},{key:`thinking`,label:`Thinking`,color:`#71717a`},{key:`toolCalls`,label:`Tool calls`,color:`#f59e0b`},{key:`toolResults`,label:`Tool results`,color:`#10b981`},{key:`images`,label:`Images`,color:`#ec4899`}];function IF({breakdown:e,contextWindow:t}){let n=e.total;return n===0?null:(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[10px] text-neutral-400`,children:[(0,R.jsx)(`span`,{children:`What’s in the context`}),(0,R.jsxs)(`span`,{className:`text-neutral-600`,title:`Sum of category estimates (~chars/3)`,children:[`~`,JF(n),` tok`,t>0&&(0,R.jsxs)(`span`,{className:`ml-1`,children:[`(`,(n/t*100).toFixed(1),`%)`]})]})]}),(0,R.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded bg-neutral-800`,children:FF.map(t=>{let r=e[t.key];if(r===0)return null;let i=r/n*100;return(0,R.jsx)(`div`,{style:{width:`${i}%`,background:t.color},title:`${t.label}: ${JF(r)} tok (${i.toFixed(1)}%)`},t.key)})}),(0,R.jsx)(`ul`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-[10px]`,children:FF.map(t=>{let r=e[t.key];if(r===0)return null;let i=r/n*100;return(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-sm`,style:{background:t.color},"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`flex-1 truncate text-neutral-400`,children:t.label}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-300`,children:JF(r)}),(0,R.jsxs)(`span`,{className:`w-10 text-right text-neutral-600`,children:[i.toFixed(0),`%`]})]},t.key)})})]})}function LF(e,t){let n=0,r=0,i=0,a=0,o=0,s=0;for(let t of e){let e=typeof t.role==`string`?t.role:``,c=t.content;if(e===`user`){if(typeof c==`string`)n+=c.length;else if(Array.isArray(c))for(let e of c){let t=e;t.type===`text`&&typeof t.text==`string`?n+=t.text.length:t.type===`image`&&(s+=1)}}else if(e===`assistant`&&Array.isArray(c))for(let e of c){let t=e;if(t.type===`text`&&typeof t.text==`string`)r+=t.text.length;else if(t.type===`thinking`&&typeof t.thinking==`string`)i+=t.thinking.length;else if(t.type===`toolCall`)try{a+=JSON.stringify(t.arguments??{}).length}catch{a+=String(t.arguments??``).length}}else if(e===`toolResult`){if(typeof c==`string`)o+=c.length;else if(Array.isArray(c))for(let e of c){let t=e;t.type===`text`&&typeof t.text==`string`?o+=t.text.length:t.type===`image`&&(s+=1)}}}let c=e=>Math.ceil(e/MF),l=c(n),u=c(r),d=c(i),f=c(a),p=c(o),m=s*1500,h=l+u+d+f+p+m,g=t!==void 0&&t>h?t-h:0;return{systemAndTools:g,userPrompts:l,assistantText:u,thinking:d,toolCalls:f,toolResults:p,images:m,total:h+g}}function RF({turns:e,newDeltas:t}){return(0,R.jsx)(`div`,{className:`mt-1 overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full font-mono text-[10px]`,children:[(0,R.jsx)(`thead`,{className:`text-neutral-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`pr-2 text-left font-normal`,children:`#`}),(0,R.jsx)(`th`,{className:`pr-2 text-left font-normal`,children:`Model`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Estimated new tokens this turn — user message + tool results since the prior assistant turn (~chars/3 estimate). Distinct from Prompt.`,children:`New`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Full prompt sent to the LLM = usage.input + cacheRead + cacheWrite. Includes ALL re-sent prior context — this grows monotonically with conversation length, which is normal LLM behavior.`,children:`Prompt`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Assistant output tokens this turn`,children:`Out`}),(0,R.jsx)(`th`,{className:`text-right font-normal`,title:`Cost billed for this turn`,children:`Cost`})]})}),(0,R.jsx)(`tbody`,{className:`text-neutral-300`,children:e.map((e,n)=>{let r=e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens,i=t.get(e.index)??0;return(0,R.jsxs)(`tr`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsx)(`td`,{className:`pr-2 text-neutral-600`,children:n+1}),(0,R.jsx)(`td`,{className:`max-w-[140px] truncate pr-2`,title:`${e.provider}/${e.model}`,children:e.model}),(0,R.jsxs)(`td`,{className:`pr-2 text-right text-neutral-200`,title:`New content (estimate)`,children:[`~`,JF(i)]}),(0,R.jsx)(`td`,{className:`pr-2 text-right`,title:`input ${JF(e.inputTokens)} + cR ${JF(e.cacheReadTokens)} + cW ${JF(e.cacheWriteTokens)}`,children:JF(r)}),(0,R.jsx)(`td`,{className:`pr-2 text-right`,children:JF(e.outputTokens)}),(0,R.jsx)(`td`,{className:`text-right text-emerald-400 light:text-emerald-700`,children:YF(e.cost)})]},`${e.index}-${e.timestamp}`)})})]})})}function zF({messages:e,showThinking:t,onToggleThinking:n,onViewRaw:r,search:i,onSearchChange:a,streamingTail:o}){let s=i.trim().toLowerCase(),c=(0,v.useMemo)(()=>s.length===0?e.map((e,t)=>({msg:e,originalIndex:t})):e.map((e,t)=>({msg:e,originalIndex:t})).filter(({msg:e})=>(typeof e.role==`string`?e.role.toLowerCase():``).includes(s)?!0:UF(e,!0).toLowerCase().includes(s)),[e,s]);return(0,R.jsxs)(`div`,{className:`px-2 py-2`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 px-1`,children:[(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wider text-neutral-400`,children:[`Messages (`,s.length>0?`${c.length}/${e.length}`:e.length,`)`]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-neutral-500 hover:text-neutral-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t,onChange:n,className:`h-3 w-3`}),`Show thinking blocks`]})]}),e.length>=10&&(0,R.jsxs)(`div`,{className:`relative mb-1 px-1`,children:[(0,R.jsx)(Ze,{size:11,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-500`}),(0,R.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Find in messages…`,className:`w-full rounded border border-neutral-800 bg-neutral-950 py-1 pl-6 pr-2 text-[11px] text-neutral-200 placeholder:text-neutral-600 focus:border-neutral-600 focus:outline-none`})]}),(0,R.jsxs)(`ul`,{className:`space-y-1`,children:[c.map(({msg:e,originalIndex:n})=>(0,R.jsx)(BF,{index:n,message:e,showThinking:t,onViewRaw:()=>r(n,e)},n)),o!==void 0&&s.length===0&&(0,R.jsx)(`li`,{className:`rounded border border-violet-700/40 bg-violet-900/10 light:border-violet-300 light:bg-violet-50`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 px-2 py-1.5`,children:[(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-violet-300 light:text-violet-700`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,R.jsx)(`span`,{className:`rounded bg-violet-900/40 px-1.5 py-0.5 text-[9px] uppercase tracking-wider text-violet-300 light:bg-violet-100 light:text-violet-800`,children:`assistant (streaming)`})}),(0,R.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-neutral-300`,children:o.content})]})]})})]})]})}function BF({index:e,message:t,showThinking:n,onViewRaw:r}){let[i,a]=(0,v.useState)(!1),o=typeof t.role==`string`?t.role:`unknown`,s=o===`compactionSummary`,c=(0,v.useMemo)(()=>UF(t,n),[t,n]),l=WF(t),u=typeof t.timestamp==`number`?t.timestamp:0;return(0,R.jsxs)(`li`,{className:`rounded border border-neutral-800/70 bg-neutral-900/30`,children:[(0,R.jsxs)(`button`,{onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 px-2 py-1.5 text-left hover:bg-neutral-900/60`,children:[(0,R.jsx)(`span`,{className:`pt-0.5 text-neutral-600`,children:i?(0,R.jsx)(Se,{size:11}):(0,R.jsx)(we,{size:11})}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] uppercase tracking-wider ${HF(o)}`,children:o}),s&&(0,R.jsx)(`span`,{className:`rounded bg-fuchsia-900/40 px-1.5 py-0.5 text-[9px] text-fuchsia-300 light:bg-fuchsia-100 light:text-fuchsia-800`,children:`compacted`}),(0,R.jsxs)(`span`,{className:`text-[10px] text-neutral-600`,children:[`~`,JF(l),` tok`]}),u>0&&(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-600`,children:new Date(u).toLocaleTimeString()})]}),!i&&c.length>0&&(0,R.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-neutral-400`,children:c})]}),(0,R.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-100`,title:`View raw AgentMessage JSON`,children:(0,R.jsx)(ce,{size:11})})]}),i&&(0,R.jsx)(`div`,{className:`space-y-1 border-t border-neutral-800/70 px-3 py-2`,children:KF(t,n,e)})]})}function VF({title:e,payload:t,onClose:n}){let r=(0,v.useMemo)(()=>{try{return JSON.stringify(t,null,2)}catch{return String(t)}},[t]);return(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-4 py-8`,onClick:n,children:(0,R.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`flex h-full max-h-[720px] w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-neutral-800 bg-neutral-950 shadow-2xl`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-200`,children:e}),(0,R.jsx)(`button`,{onClick:n,className:`rounded p-2 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (Esc)`,children:(0,R.jsx)(at,{size:20})})]}),(0,R.jsx)(so,{code:r,language:`json`,theme:Aa.vsDark,children:({style:e,tokens:t,getLineProps:n,getTokenProps:r})=>(0,R.jsx)(`pre`,{className:`flex-1 overflow-auto whitespace-pre p-3 font-mono text-[11px]`,style:{...e,background:`transparent`},children:t.map((e,t)=>(0,R.jsx)(`div`,{...n({line:e}),children:e.map((e,t)=>(0,R.jsx)(`span`,{...r({token:e})},t))},t))})})]})})}function HF(e){return e===`user`?`bg-sky-900/40 text-sky-300 light:bg-sky-100 light:text-sky-800`:e===`assistant`?`bg-violet-900/40 text-violet-300 light:bg-violet-100 light:text-violet-800`:e===`tool`||e===`toolResult`?`bg-amber-900/40 text-amber-300 light:bg-amber-100 light:text-amber-800`:e===`compactionSummary`?`bg-fuchsia-900/40 text-fuchsia-300 light:bg-fuchsia-100 light:text-fuchsia-800`:`bg-neutral-800 text-neutral-400`}function UF(e,t){let n=e.content;if(typeof n==`string`)return n.slice(0,200);if(!Array.isArray(n))return``;let r=[];for(let e of n){let n=e;n.type===`thinking`&&!t||(n.type===`text`&&typeof n.text==`string`?r.push(n.text):n.type===`thinking`&&typeof n.thinking==`string`?r.push(`[thinking] ${n.thinking}`):n.type===`toolCall`&&typeof n.name==`string`&&r.push(`[tool: ${n.name}]`))}return r.join(` `).slice(0,200)}function WF(e){let t=e.usage;if(t!==void 0&&typeof t.totalTokens==`number`)return t.totalTokens;let n=e.content;if(typeof n==`string`)return Math.ceil(n.length/MF);if(!Array.isArray(n))return 0;let r=0,i=0;for(let e of n){let t=e;typeof t.text==`string`&&(r+=t.text.length),t.type===`image`&&(i+=1)}return Math.ceil(r/MF)+i*1500}function GF(e,t){let n=new Map,r=-1;for(let i of t){let t=0;for(let n=r+1;n<i.index;n++){let r=e[n];if(r===void 0)continue;let i=typeof r.role==`string`?r.role:``;i!==`user`&&i!==`toolResult`||(t+=WF(r))}n.set(i.index,t),r=i.index}return n}function KF(e,t,n){let r=typeof e.role==`string`?e.role:`unknown`,i=e.content;return r===`toolResult`?(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`p`,{className:`mb-1 text-[10px] text-neutral-500`,children:[`tool: `,(0,R.jsx)(`span`,{className:`font-mono`,children:String(e.toolName??`unknown`)}),` `,e.isError===!0&&(0,R.jsx)(`span`,{className:`text-red-400 light:text-red-700`,children:`(error)`})]}),(0,R.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-neutral-950 p-2 font-mono text-[10px] text-neutral-300`,children:qF(i)})]}):Array.isArray(i)?(0,R.jsx)(R.Fragment,{children:i.map((e,r)=>{let i=e;if(i.type===`thinking`&&!t)return null;if(i.type===`text`||i.type===`thinking`){let e=i.type===`thinking`?i.thinking:i.text;return(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[11px] ${i.type===`thinking`?`italic text-neutral-500`:`text-neutral-200`}`,children:String(e??``)},`${n}-${r}`)}return i.type===`toolCall`?(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 p-2`,children:[(0,R.jsxs)(`p`,{className:`mb-1 text-[10px] text-neutral-500`,children:[`tool call: `,(0,R.jsx)(`span`,{className:`font-mono`,children:String(i.name??`unknown`)})]}),(0,R.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-300`,children:qF(i.arguments)})]},`${n}-${r}`):i.type===`image`?(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-500`,children:`[image attachment]`},`${n}-${r}`):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-500`,children:qF(i)},`${n}-${r}`)})}):typeof i==`string`?(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[11px] text-neutral-200`,children:i}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-500`,children:qF(e)})}function qF(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function JF(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(2)}M`}function YF(e){return e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function XF({getStartSize:e,onResize:t,direction:n,minSize:r,maxSize:i,orientation:a=`vertical`}){let o=(0,v.useRef)(null),s=a===`horizontal`,c=s?`row-resize`:`col-resize`;(0,v.useEffect)(()=>{let e=()=>{o.current!==null&&(o.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`))},t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),window.addEventListener(`blur`,e),()=>{e(),window.removeEventListener(`keydown`,t),window.removeEventListener(`blur`,e)}},[]);let l=t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),o.current={start:s?t.clientY:t.clientX,startSize:e()},document.body.style.cursor=c,document.body.style.userSelect=`none`},u=e=>{if(o.current===null)return;let a=(s?e.clientY:e.clientX)-o.current.start,c=o.current.startSize+a*n;t(Math.min(Math.max(c,r),i))},d=e=>{o.current!==null&&(e.currentTarget.releasePointerCapture(e.pointerId),o.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`))},f=s?`h-1 w-full cursor-row-resize`:`w-1 h-full cursor-col-resize`,p=s?`absolute inset-x-0 -top-1 -bottom-1`:`absolute inset-y-0 -left-1 -right-1`;return(0,R.jsx)(`div`,{onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:d,className:`group relative shrink-0 bg-neutral-800 hover:bg-neutral-600 active:bg-neutral-500 ${f}`,role:`separator`,"aria-orientation":s?`horizontal`:`vertical`,children:(0,R.jsx)(`div`,{className:p})})}var ZF=`pi-forge/files-width`,QF=`pi-forge/editor-width`,$F=`pi-forge/terminal-height`,eI=`pi-forge/todo-panel-height`,tI=280,nI=480,rI=280,iI=200,aI=200,oI=320,sI=320,cI=140,lI=100;function uI(e,t){let n=localStorage.getItem(e);if(n===null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)&&r>0?r:t}function dI(){let e=gr(e=>e.ready),t=gr(e=>e.isAuthenticated),n=gr(e=>e.mustChangePassword),r=gr(e=>e.bootstrap),i=gr(e=>e.logout),a=xr(e=>e.projects),o=xr(e=>!e.loading),s=xr(e=>e.load),c=Sr(),l=xr(e=>e.activeProjectId),u=pi(e=>e.activeSessionId),d=ct(),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/files-open`)===`true`),y=e=>{_(e),localStorage.setItem(`pi-forge/files-open`,e?`true`:`false`)},[b,x]=(0,v.useState)(()=>{let e=localStorage.getItem(`pi-forge/right-tab`);return e===`files`||e===`search`||e===`changes`||e===`git`||e===`context`||e===`processes`?e:`files`}),S=e=>{x(e),localStorage.setItem(`pi-forge/right-tab`,e)},[C,w]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/terminal-open`)===`true`),T=e=>{w(e),localStorage.setItem(`pi-forge/terminal-open`,e?`true`:`false`)},[E,D]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/chat-open`)!==`false`),O=e=>{D(e),localStorage.setItem(`pi-forge/chat-open`,e?`true`:`false`)},[k,ee]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/editor-open`)!==`false`),te=e=>{ee(e),localStorage.setItem(`pi-forge/editor-open`,e?`true`:`false`)},[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(()=>uI($F,rI)),A=(0,v.useRef)(ie);(0,v.useEffect)(()=>{A.current=ie,localStorage.setItem($F,String(ie))},[ie]);let[j,M]=(0,v.useState)(()=>uI(eI,iI)),oe=(0,v.useRef)(j);(0,v.useEffect)(()=>{oe.current=j,localStorage.setItem(eI,String(j))},[j]);let se=qj(e=>e.todoPanelOpen);(0,v.useEffect)(()=>{se&&!g&&!d&&y(!0)},[se]);let ce=qj(e=>e.openProcessesTabSeq);(0,v.useEffect)(()=>{ce!==0&&(!g&&!d&&y(!0),S(`processes`))},[ce]);let le=qj(e=>e.openEditorPaneSeq);(0,v.useEffect)(()=>{le!==0&&te(!0)},[le]);let[ue,de]=(0,v.useState)(()=>uI(ZF,tI)),[fe,pe]=(0,v.useState)(()=>uI(QF,nI)),me=(0,v.useRef)(ue),he=(0,v.useRef)(fe);(0,v.useEffect)(()=>{me.current=ue,localStorage.setItem(ZF,String(ue))},[ue]),(0,v.useEffect)(()=>{he.current=fe,localStorage.setItem(QF,String(fe))},[fe]);let ge=Ei(e=>e.openFiles.length),_e=k&&ge>0,ve=iF(e&&t&&!n?c?.id:void 0).status?.files.length??0,ye=$r(Xr(e=>Zr(e,u))),be=pi(e=>u===void 0?0:e.fileRefreshCountBySession[u]??0),xe=Ei(e=>e.loadTree),Se=Ei(e=>e.restoreTabs),Ce=Ei(e=>e.refreshOpenFiles);(0,v.useEffect)(()=>{c===void 0||be===0||(xe(c.id),Ce(c.id))},[c?.id,be]),(0,v.useEffect)(()=>{c!==void 0&&Se(c.id)},[c?.id]),(0,v.useEffect)(()=>{if(!m)return;let e=e=>{e.key===`Escape`&&h(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let we=(0,v.useRef)(!0);(0,v.useEffect)(()=>{if(we.current){we.current=!1;return}f&&p(!1)},[l,u]),(0,v.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p(!1)};window.addEventListener(`keydown`,e);let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{window.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[f]),(0,v.useEffect)(()=>{!d&&f&&p(!1)},[d,f]);let Te=qj(e=>e.settingsRequest),Ee=qj(e=>e.clearSettingsRequest),[De,Oe]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{Te!==void 0&&(h(!0),Te.tab!==void 0&&Oe(Te.tab),Ee())},[Te,Ee]),(0,v.useEffect)(()=>{r()},[r]);let ke=ji(e=>e.load),je=ji(e=>e.minimal),Me=ji(e=>e.authLogoUrl);(0,v.useEffect)(()=>{ke()},[ke]),(0,v.useEffect)(()=>{t&&!n&&s()},[t,n,s]);let Ne=Mi(e=>e.load);(0,v.useEffect)(()=>{t&&!n&&Ne()},[t,n,Ne]);let Fe=MM(e=>e.startPolling),Ie=MM(e=>e.stopPolling);return(0,v.useEffect)(()=>{t&&!n?Fe():Ie()},[t,n,Fe,Ie]),e?t?n?(0,R.jsx)(Ji,{}):(0,R.jsxs)(`div`,{className:`forge-app-shell flex h-screen flex-col bg-neutral-950 text-neutral-100`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-2`,style:{paddingTop:`max(0.5rem, env(safe-area-inset-top))`},children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),"aria-label":f?`Close project sidebar`:`Open project sidebar`,"aria-expanded":f,className:`-ml-1 inline-flex min-h-11 min-w-11 items-center justify-center rounded-md text-neutral-300 hover:bg-neutral-800 md:hidden`,children:(0,R.jsx)(ze,{size:20})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`img`,{src:Me??`/icons/icon.svg`,alt:``,className:`max-h-8 max-w-28 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:`pi-forge`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`div`,{className:`hidden md:contents`,children:[(0,R.jsxs)(`button`,{onClick:()=>O(!E),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${E?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the chat pane`,children:[(0,R.jsx)(He,{size:13}),`Chat`]}),(0,R.jsxs)(`button`,{onClick:()=>te(!k),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${k?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the editor pane (open tabs persist across reloads)`,children:[(0,R.jsx)(Ae,{size:13}),`Editor`]}),(0,R.jsxs)(`button`,{onClick:()=>y(!g),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${g?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the file browser tree`,children:[(0,R.jsx)(Pe,{size:13}),`Files`]}),!je&&(0,R.jsxs)(`button`,{onClick:()=>T(!C),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${C?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the integrated terminal`,children:[(0,R.jsx)(et,{size:13}),`Terminal`]})]}),(0,R.jsx)(`div`,{className:`hidden md:block`,children:(0,R.jsx)(QP,{})}),(0,R.jsx)($P,{}),(0,R.jsx)(`button`,{onClick:()=>h(!0),className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,title:`Settings (providers, agent defaults, MCP, skills)`,children:`Settings`}),(0,R.jsx)(`button`,{onClick:i,className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:`Sign out`})]})]}),(0,R.jsx)($i,{}),m&&(0,R.jsx)(VM,{onClose:()=>{h(!1),Oe(void 0)},...De===void 0?{}:{initialTab:De}}),(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[f&&(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 md:hidden`,onClick:()=>p(!1),"aria-hidden":!0}),d&&!f&&(0,R.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-20 w-5 md:hidden`,"aria-hidden":!0,onPointerDown:e=>{let t=e.clientX,n=!1,r=e=>{n||e.clientX-t>50&&(p(!0),n=!0,i())},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),window.removeEventListener(`pointercancel`,i)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i),window.addEventListener(`pointercancel`,i)}}),(0,R.jsx)(la,{className:`fixed inset-y-0 left-0 z-40 shadow-2xl transition-transform duration-200 ease-out md:static md:inset-auto md:z-auto md:shadow-none md:transition-none `+(f?`max-md:translate-x-0`:`max-md:-translate-x-full`)}),(0,R.jsxs)(`main`,{className:`flex flex-1 overflow-hidden`,children:[E&&(0,R.jsx)(`div`,{className:`forge-chat-column flex flex-1 flex-col overflow-hidden`,children:o&&a.length===0?ne?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center`,children:(0,R.jsxs)(`div`,{className:`space-y-3 text-sm text-neutral-400`,children:[(0,R.jsx)(`p`,{children:`No projects yet.`}),(0,R.jsx)(`button`,{onClick:()=>re(!1),className:`rounded-md bg-neutral-100 px-3 py-1.5 text-sm font-medium text-neutral-900 hover:bg-white`,children:`+ New project`})]})}):(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,R.jsx)(ea,{onClose:()=>re(!0)})}):u===void 0?c?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center`,children:(0,R.jsxs)(`div`,{className:`space-y-3 text-sm text-neutral-400`,children:[(0,R.jsx)(`h2`,{className:`text-xl font-semibold text-neutral-100`,children:c.name}),(0,R.jsx)(`p`,{className:`font-mono text-xs`,children:c.path}),(0,R.jsx)(`p`,{children:`Pick a session from the sidebar — or start a new one here.`}),(0,R.jsx)(`button`,{onClick:()=>{pi.getState().createSession(c.id)},className:`rounded-md bg-neutral-100 px-3 py-1.5 text-sm font-medium text-neutral-900 hover:bg-white`,children:`+ New session`})]})}):(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,R.jsx)(`p`,{className:`text-sm text-neutral-400`,children:`Select a project from the sidebar.`})}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ej,{sessionId:u}),!je&&(0,R.jsx)(TM,{sessionId:u,alreadyOnChangesTab:g&&b===`changes`,onOpen:()=>{g||y(!0),S(`changes`)}}),(0,R.jsx)(NN,{sessionId:u}),(0,R.jsx)(bM,{sessionId:u})]})}),!d&&_e&&(E?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{getStartSize:()=>he.current,onResize:e=>pe(e),direction:-1,minSize:oI,maxSize:Math.max(oI,window.innerWidth-(g?ue:0)-sI-240)}),(0,R.jsx)(`div`,{className:`flex shrink-0 flex-col border-l border-neutral-800`,style:{width:`${fe}px`},children:(0,R.jsx)(yP,{})})]}):(0,R.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,R.jsx)(yP,{})})),!d&&g&&(()=>{let e=!E&&!_e,t=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`flex border-b border-neutral-800 bg-neutral-900/40`,children:(je?[`files`,`search`,`processes`,`context`]:[`files`,`search`,`changes`,`git`,`processes`,`context`]).map(e=>(0,R.jsxs)(`button`,{onClick:()=>S(e),className:`flex items-center gap-1 px-3 py-1.5 text-[11px] uppercase tracking-wider ${b===e?`border-b border-neutral-100 text-neutral-100`:`text-neutral-500 hover:text-neutral-300`}`,children:[e===`files`?`Files`:e===`search`?`Search`:e===`changes`?`Last turn`:e===`git`?`Git`:e===`processes`?`Processes`:`Context`,e===`git`&&ve>0&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1 py-0.5 text-[9px] text-amber-300 light:bg-amber-100 light:text-amber-800`,children:ve}),e===`processes`&&ye>0&&(0,R.jsx)(`span`,{className:`rounded bg-emerald-900/40 px-1 py-0.5 text-[9px] text-emerald-300 light:bg-emerald-100 light:text-emerald-800`,children:ye})]},e))}),(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b===`files`?(0,R.jsx)(XN,{}):b===`search`?(0,R.jsx)(TF,{}):!je&&b===`changes`?(0,R.jsx)(nF,{}):!je&&b===`git`?(0,R.jsx)(pF,{}):b===`context`?(0,R.jsx)(NF,{}):b===`processes`&&u!==void 0?(0,R.jsx)(VN,{sessionId:u}):(0,R.jsx)(XN,{})}),se&&u!==void 0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{orientation:`horizontal`,getStartSize:()=>oe.current,onResize:e=>M(e),direction:-1,minSize:lI,maxSize:Math.max(lI,window.innerHeight*.7)}),(0,R.jsx)(`div`,{className:`shrink-0 overflow-hidden border-t border-neutral-800 light:border-neutral-200`,style:{height:`${j}px`},children:(0,R.jsx)(IN,{sessionId:u,onClose:()=>qj.getState().setTodoPanelOpen(!1)})})]})]})]});return e?(0,R.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:t}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{getStartSize:()=>me.current,onResize:e=>de(e),direction:-1,minSize:aI,maxSize:Math.max(aI,window.innerWidth-sI-240-(_e?oI:0))}),(0,R.jsx)(`div`,{className:`flex shrink-0 flex-col border-l border-neutral-800`,style:{width:`${ue}px`},children:t})]})})()]})]}),!d&&!je&&C&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{orientation:`horizontal`,getStartSize:()=>A.current,onResize:e=>ae(e),direction:-1,minSize:cI,maxSize:Math.max(cI,Math.floor(window.innerHeight*.7))}),(0,R.jsx)(`div`,{className:`shrink-0 border-t border-neutral-800`,style:{height:`${ie}px`},children:(0,R.jsx)(JP,{})})]})]})]}):(0,R.jsx)(Ki,{}):(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center text-sm text-neutral-400`,children:`Loading…`})}NC(),O({immediate:!0});var fI=class extends v.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[pi-forge] root render error`,e,t)}render(){return this.state.error===null?this.props.children:(0,R.jsxs)(`main`,{style:{padding:`2rem`,fontFamily:`monospace`,color:`#fca5a5`,background:`#0a0a0a`,minHeight:`100vh`,whiteSpace:`pre-wrap`,overflow:`auto`},children:[(0,R.jsx)(`h1`,{style:{color:`#fff`,marginBottom:`1rem`},children:`pi-forge: render crash`}),(0,R.jsx)(`p`,{style:{color:`#d4d4d4`,marginBottom:`1rem`},children:this.state.error.message}),(0,R.jsx)(`pre`,{style:{fontSize:`11px`,color:`#a3a3a3`},children:this.state.error.stack??`(no stack)`}),(0,R.jsx)(`p`,{style:{marginTop:`2rem`,color:`#71717a`,fontSize:`12px`},children:`Tip: open the browser console for more detail. Try clearing localStorage (devtools → Application → Local Storage → Clear) and refreshing if the error mentions stale state.`})]})}};window.addEventListener(`error`,e=>{console.error(`[pi-forge] uncaught error`,e.error)}),window.addEventListener(`unhandledrejection`,e=>{console.error(`[pi-forge] unhandled rejection`,e.reason)});var pI=document.getElementById(`root`);if(!pI)throw Error(`#root element missing in index.html`);(0,y.createRoot)(pI).render((0,R.jsx)(v.StrictMode,{children:(0,R.jsx)(fI,{children:(0,R.jsx)(dI,{})})}));export{l as a,d as i,PC as n,Hi as r,FC as t};
|
|
375
|
-
//# sourceMappingURL=index-
|
|
374
|
+
`).pop()??`Pushed`:`Pushed`),Ie&&Le(!1)}catch(e){g((e instanceof N,e.message))}finally{f(!1)}},ct=e=>{let t=e.path.split(/[\\/]/).filter(Boolean).pop()??e.path;return e.branch===void 0?e.detached&&e.head!==void 0?`${e.head.slice(0,7)} — ${t}`:t:`${e.branch} — ${t}`};return(0,R.jsxs)(`div`,{className:`flex h-full flex-col text-xs text-neutral-300`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-neutral-200`,children:[(0,R.jsx)(Fe,{size:13,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:o?.branch??`—`}),o!==void 0&&o.files.length>0&&(0,R.jsx)(`span`,{className:`rounded bg-neutral-800 px-1.5 py-0.5 text-[10px] text-neutral-400`,children:o.files.length})]}),(0,R.jsxs)(`label`,{className:`mt-1 flex items-center gap-1.5 text-[10px] text-neutral-500`,children:[(0,R.jsx)(`span`,{className:`shrink-0 uppercase tracking-wider`,children:`Worktree`}),(0,R.jsx)(`select`,{value:i??``,onChange:e=>a(e.target.value||void 0),disabled:n===void 0||n.length<=1,className:`min-w-0 flex-1 rounded border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-[10px] text-neutral-200 outline-none hover:border-neutral-600 focus:border-neutral-500 disabled:cursor-not-allowed disabled:border-neutral-800 disabled:text-neutral-500`,title:i===void 0?`Loading git worktrees`:`Viewing git info for ${i}`,children:n===void 0?(0,R.jsx)(`option`,{value:``,children:`Loading…`}):n.length===0?(0,R.jsx)(`option`,{value:``,children:`No worktrees`}):n.map(e=>(0,R.jsx)(`option`,{value:e.path,children:ct(e)},e.path))})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>He(Be===`split`?`unified`:`split`),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:Be===`split`?`Switch git diffs to unified view`:`Switch git diffs to side-by-side view`,children:Be===`split`?(0,R.jsx)(me,{size:13}):(0,R.jsx)(le,{size:13})}),(0,R.jsx)(`button`,{onClick:()=>void c(),className:`rounded p-1 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Refresh`,children:(0,R.jsx)(Je,{size:13,className:d?`animate-spin`:``})})]})]}),(s!==void 0||h!==void 0)&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:h??s}),_!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-emerald-700/40 bg-emerald-900/20 px-3 py-1.5 text-[11px] text-emerald-300 light:border-emerald-300 light:bg-emerald-50 light:text-emerald-800`,children:_}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[o===void 0&&(0,R.jsx)(`p`,{className:`px-3 py-3 italic text-neutral-500`,children:`Loading…`}),o?.files.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-3 italic text-neutral-500`,children:`Working tree clean.`}),Ue.length>0&&(0,R.jsx)(hF,{label:`Staged`,files:Ue,actionLabel:`Unstage all`,onGroupAction:()=>void Ze(Ue.map(e=>e.path)),onFileAction:e=>void Ze([e.path]),fileActionLabel:`Unstage`,onRevert:e=>void Xe([e.path]),onClickFile:e=>void Ke(e,!0),openDiffs:De,staged:!0,diffViewType:Be,onHunkAction:(e,t)=>void Qe(e,t,`unstage`),pendingHunkPath:ke}),We.length>0&&(0,R.jsx)(hF,{label:`Unstaged`,files:We,actionLabel:`Stage all`,onGroupAction:()=>void Ye(We.map(e=>e.path)),onFileAction:e=>void Ye([e.path]),fileActionLabel:`Stage`,onRevert:e=>void Xe([e.path]),onClickFile:e=>void Ke(e,!1),openDiffs:De,staged:!1,diffViewType:Be,onHunkAction:(e,t)=>void Qe(e,t,`stage`),pendingHunkPath:ke}),Ge.length>0&&(0,R.jsx)(hF,{label:`Untracked`,files:Ge,actionLabel:`Stage all`,onGroupAction:()=>void Ye(Ge.map(e=>e.path)),onFileAction:e=>void Ye([e.path]),fileActionLabel:`Stage`,onRevert:void 0,onClickFile:e=>void Ke(e,!1),openDiffs:De,staged:!1,diffViewType:Be}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60 px-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:[(0,R.jsx)(de,{size:10}),` Commit`]}),(0,R.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:`Commit message…`,rows:3,className:`w-full resize-none rounded border border-neutral-700 bg-neutral-950 px-2 py-1 text-xs text-neutral-100 outline-none focus:border-neutral-500`}),(0,R.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] text-neutral-500`,children:[Ue.length,` staged`]}),(0,R.jsx)(`button`,{onClick:()=>void et(),disabled:d||Ue.length===0||l.trim().length===0,className:`rounded bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:`Commit`})]})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60 px-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-1 text-[10px] uppercase tracking-wider text-neutral-500`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(rt,{size:10}),` Push`]}),(0,R.jsx)(`button`,{onClick:()=>{ze(e=>!e),!Re&&S===void 0&&L.gitBranches(e.id).then(e=>C(e.branches)).catch(()=>void 0),!Re&&w===void 0&&L.gitRemotes(e.id).then(e=>T(e.remotes)).catch(()=>void 0)},className:`rounded px-1 py-0.5 text-[10px] normal-case text-neutral-400 hover:bg-neutral-900 hover:text-neutral-200`,children:Re?`Hide options`:`Options`})]}),Re&&(0,R.jsxs)(`div`,{className:`mb-2 space-y-1.5 rounded border border-neutral-800 bg-neutral-900/40 p-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`w-16 shrink-0 text-neutral-400`,children:`Remote`}),nt.length>0?(0,R.jsxs)(`select`,{value:je??``,onChange:e=>Me(e.target.value===``?void 0:e.target.value),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:``,children:`configured upstream`}),nt.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):(0,R.jsx)(`input`,{type:`text`,value:je??``,onChange:e=>Me(e.target.value.length===0?void 0:e.target.value),placeholder:`origin`,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`w-16 shrink-0 text-neutral-400`,children:`Branch`}),it.length>0?(0,R.jsxs)(`select`,{value:Ne,onChange:e=>Pe(e.target.value),className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`,children:[(0,R.jsx)(`option`,{value:``,children:o?.branch??`current branch`}),it.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):(0,R.jsx)(`input`,{type:`text`,value:Ne,onChange:e=>Pe(e.target.value),placeholder:o?.branch??`current`,className:`flex-1 rounded border border-neutral-700 bg-neutral-950 px-1 py-0.5 text-[11px] text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px] text-neutral-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:Ie,onChange:e=>Le(e.target.checked),className:`h-3 w-3`}),(0,R.jsx)(`span`,{children:`Set upstream (first push of a new branch)`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{onClick:()=>void at(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:je===void 0?`Fetch remote-tracking updates from the configured upstream; the working tree is not changed.`:`Fetch remote-tracking updates from ${je}; the working tree is not changed.`,children:p===`fetch`?`Fetching…`:`Fetch`}),(0,R.jsx)(`button`,{onClick:()=>void ot(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:`Fetch and merge the selected upstream into this worktree. Conflicts are shown in the error banner; resolve them in the integrated terminal.`,children:p===`pull`?`Pulling…`:`Pull`}),(0,R.jsx)(`button`,{onClick:()=>void st(),disabled:d,className:`flex-1 rounded border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:border-neutral-500 disabled:opacity-50`,title:je===void 0&&Ne.trim().length===0?`git push (configured upstream)`:`git push ${je??`(upstream)`}${Ne.trim().length>0?` ${Ne.trim()}`:``}`,children:`Push`})]})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>D(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Log`}),(0,R.jsx)(`span`,{children:E?`−`:`+`})]}),E&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:b===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):b.length===0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`No commits yet.`}):(0,R.jsx)(yF,{commits:b})})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>k(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Branches`}),(0,R.jsx)(`span`,{children:O?`−`:`+`})]}),O&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:S===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ul`,{className:`space-y-0.5`,children:S.map(e=>{let t=ne===e.name;return(0,R.jsxs)(`li`,{className:`group flex items-center gap-1 rounded px-1 py-0.5 font-mono hover:bg-neutral-900 ${e.current?`text-emerald-400 light:text-emerald-700`:`text-neutral-300`}`,children:[(0,R.jsx)(`span`,{className:`w-3 shrink-0`,children:e.current?(0,R.jsx)(xe,{size:10}):null}),(0,R.jsx)(`span`,{className:`flex-1 truncate`,title:e.name,children:e.name}),e.remote&&(0,R.jsx)(`span`,{className:`ml-1 text-[10px] text-neutral-600`,children:`remote`}),!e.current&&(0,R.jsxs)(`div`,{className:`hidden gap-0.5 group-hover:flex`,children:[(0,R.jsx)(`button`,{onClick:()=>void we(e.name),disabled:t,className:`rounded px-1 py-0.5 text-[10px] text-neutral-400 hover:bg-neutral-800 hover:text-neutral-100 disabled:opacity-40`,title:e.remote?`Checkout (creates a tracking branch from ${e.name})`:`Checkout ${e.name}`,children:`checkout`}),!e.remote&&(0,R.jsx)(`button`,{onClick:()=>ae({kind:`delete`,name:e.name}),disabled:t,className:`rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 disabled:opacity-40 light:hover:bg-red-100 light:hover:text-red-700`,title:`Delete branch`,children:(0,R.jsx)(tt,{size:10})})]})]},e.name)})}),(0,R.jsxs)(`button`,{onClick:()=>ae({kind:`create`}),className:`mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,children:[(0,R.jsx)(qe,{size:10}),` New branch`]})]})})]}),(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`button`,{onClick:()=>te(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-[10px] uppercase tracking-wider text-neutral-400 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{children:`Remotes`}),(0,R.jsx)(`span`,{children:ee?`−`:`+`})]}),ee&&(0,R.jsx)(`div`,{className:`px-3 pb-3 text-[11px]`,children:w===void 0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`Loading…`}):(0,R.jsxs)(R.Fragment,{children:[w.length===0?(0,R.jsx)(`p`,{className:`italic text-neutral-500`,children:`No remotes configured.`}):(0,R.jsx)(`ul`,{className:`space-y-1`,children:w.map(e=>{let t=e.fetchUrl!==e.pushUrl,n=A===e.name;return(0,R.jsxs)(`li`,{className:`group flex flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-200`,children:e.name}),t&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/30 px-1 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,children:`fetch ≠ push`}),e.insecureTls&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,title:`TLS certificate verification disabled for this remote URL in local git config`,children:`ignore tls`}),(0,R.jsx)(`button`,{onClick:()=>_e(e.name),disabled:n,className:`ml-auto hidden rounded p-0.5 text-neutral-500 hover:bg-red-900/30 hover:text-red-300 disabled:opacity-40 group-hover:inline-flex light:hover:bg-red-100 light:hover:text-red-700`,title:`Remove remote "${e.name}"`,children:(0,R.jsx)(tt,{size:10})})]}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[10px] text-neutral-500`,title:e.fetchUrl,children:e.fetchUrl}),t&&(0,R.jsxs)(`span`,{className:`break-all font-mono text-[10px] text-neutral-500`,title:`push → ${e.pushUrl}`,children:[`push → `,e.pushUrl]}),(0,R.jsxs)(`label`,{className:`mt-0.5 flex items-start gap-1.5 text-[10px] text-neutral-500`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.insecureTls,onChange:t=>void be(e.name,t.target.checked),disabled:n,className:`mt-0.5 h-3 w-3`}),(0,R.jsx)(`span`,{children:`Ignore SSL/TLS verification for this remote (local repo config only)`})]})]},e.name)})}),(0,R.jsxs)(`button`,{onClick:()=>{ce(``),fe(``),he(!1),oe(!0)},className:`mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,children:[(0,R.jsx)(qe,{size:10}),` Add remote`]})]})})]})]}),(0,R.jsx)(ia,{open:ie?.kind===`create`,onClose:()=>ae(void 0),onSubmit:e=>void Te(e),title:`New branch`,label:`Branch name`,placeholder:`feature/my-change`,primaryLabel:`Create + checkout`}),(0,R.jsx)(aa,{open:ie?.kind===`delete`,onClose:()=>ae(void 0),onConfirm:()=>void Ee(!1),title:`Delete branch`,message:ie?.kind===`delete`?`Delete branch "${ie.name}"? Refused if not merged into HEAD; force-delete from the terminal if you really mean it.`:``,primaryLabel:`Delete`,tone:`danger`}),(0,R.jsx)(ra,{open:M,onClose:()=>oe(!1),title:`Add remote`,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ye()},className:`flex flex-col gap-3 px-4 py-3`,children:[(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`Name`}),(0,R.jsx)(`input`,{type:`text`,value:se,onChange:e=>ce(e.target.value),placeholder:`origin`,autoFocus:!0,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 font-mono text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-300`,children:`URL`}),(0,R.jsx)(`input`,{type:`text`,value:ue,onChange:e=>fe(e.target.value),placeholder:`git@github.com:user/repo.git`,className:`w-full rounded-md border border-neutral-700 bg-neutral-950 px-3 py-1.5 font-mono text-sm text-neutral-100 outline-none focus:border-neutral-500`})]}),(0,R.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-amber-900/40 bg-amber-950/30 px-2 py-1.5 text-xs light:border-amber-300 light:bg-amber-50`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:pe,onChange:e=>he(e.target.checked),className:`mt-0.5`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`text-amber-200 light:text-amber-800`,children:`Ignore SSL/TLS verification for this remote`}),(0,R.jsx)(`br`,{}),(0,R.jsx)(`span`,{className:`text-[11px] text-amber-300/70 light:text-amber-700/80`,children:`Persists only in this repository as URL-scoped git config. Use only for internal Git hosts with a known self-signed/private-CA certificate.`})]})]}),(0,R.jsxs)(`footer`,{className:`flex justify-end gap-2 pt-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>oe(!1),className:`rounded-md border border-neutral-700 px-3 py-1 text-xs text-neutral-200 hover:bg-neutral-800`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,disabled:se.trim().length===0||ue.trim().length===0,className:`rounded-md bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-900 hover:bg-white disabled:cursor-not-allowed disabled:opacity-40`,children:`Add`})]})]})}),(0,R.jsx)(aa,{open:ge!==void 0,onClose:()=>_e(void 0),onConfirm:()=>void Se(),title:`Remove remote`,message:ge===void 0?``:`Remove remote "${ge}"? The local repo loses its reference to this URL; existing commits aren't affected.`,primaryLabel:`Remove`,tone:`danger`})]})}var mF=3e3;function hF(e){let[t,n]=(0,v.useState)(void 0),r=(0,v.useRef)(void 0),i=()=>{r.current!==void 0&&(window.clearTimeout(r.current),r.current=void 0),n(void 0)};(0,v.useEffect)(()=>()=>{r.current!==void 0&&window.clearTimeout(r.current)},[]);let a=a=>{if(e.onRevert!==void 0){if(t===a.path){i(),e.onRevert(a);return}r.current!==void 0&&window.clearTimeout(r.current),n(a.path),r.current=window.setTimeout(()=>{n(void 0),r.current=void 0},mF)}};return(0,R.jsxs)(`div`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-500`,children:[e.label,` (`,e.files.length,`)`]}),(0,R.jsx)(`button`,{onClick:e.onGroupAction,className:`text-[10px] text-neutral-400 hover:text-neutral-200`,children:e.actionLabel})]}),(0,R.jsx)(`ul`,{children:e.files.map(n=>{let r=`${n.path}|${e.staged?`staged`:`unstaged`}`,i=e.openDiffs[r],o=t===n.path;return(0,R.jsxs)(`li`,{className:`border-t border-neutral-900`,children:[(0,R.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 hover:bg-neutral-900`,children:[(0,R.jsx)(`span`,{className:`inline-block w-5 shrink-0 text-center font-mono text-[10px] text-neutral-500`,title:`porcelain code: ${n.code}`,children:gF(n.kind)}),(0,R.jsx)(`button`,{onClick:()=>e.onClickFile(n),className:`flex-1 truncate text-left font-mono`,title:n.path,children:n.path}),e.onRevert!==void 0&&(0,R.jsxs)(`button`,{onClick:()=>a(n),className:o?`inline-flex items-center gap-1 rounded bg-red-900/40 px-1 py-0.5 text-[10px] text-red-200 light:bg-red-100 light:text-red-800`:`hidden items-center gap-1 text-[10px] text-neutral-500 hover:text-red-300 group-hover:inline-flex light:hover:text-red-700`,title:o?`Click again to discard local changes (this cannot be undone)`:`Revert: discard local changes for this file`,children:[(0,R.jsx)(nt,{size:10}),o?`Confirm?`:`Revert`]}),(0,R.jsxs)(`button`,{onClick:()=>e.onFileAction(n),className:`ml-3 hidden items-center gap-1 text-[10px] text-neutral-500 hover:text-neutral-200 group-hover:inline-flex`,children:[e.fileActionLabel===`Stage`?(0,R.jsx)(qe,{size:10}):e.fileActionLabel===`Unstage`?(0,R.jsx)(Ue,{size:10}):null,e.fileActionLabel]})]}),i!==void 0&&(0,R.jsx)(`div`,{className:`border-t border-neutral-900 bg-neutral-950`,children:i===`loading`?(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`Loading…`}):i===`error`?(0,R.jsx)(`p`,{className:`px-3 py-2 text-red-400 light:text-red-700`,children:`Failed to load diff.`}):i.length===0?(0,R.jsx)(`p`,{className:`px-3 py-2 italic text-neutral-500`,children:`(no diff — file is binary or unchanged)`}):(0,R.jsx)(Xk,{diff:i,viewType:e.diffViewType,onHunkAction:e.onHunkAction===void 0?void 0:t=>e.onHunkAction?.(n,t),hunkActionLabel:e.staged?`Unstage hunk`:`Stage hunk`,hunkActionDisabled:e.pendingHunkPath===n.path})})]},n.path)})})]})}function gF(e){switch(e){case`modified`:return`M`;case`added`:return`A`;case`deleted`:return`D`;case`renamed`:return`R`;case`copied`:return`C`;case`untracked`:return`?`;case`ignored`:return`!`;case`conflicted`:return`U`;default:return`·`}}var _F=14,vF=36;function yF({commits:e}){let t=aF(e),n=Math.max(1,...t.map(e=>e.width));return(0,R.jsx)(`ul`,{className:`space-y-0`,children:e.map((e,r)=>{let i=t[r];return i===void 0?null:(0,R.jsxs)(`li`,{className:`group flex items-stretch`,children:[(0,R.jsx)(bF,{layout:i,isLast:r===t.length-1,maxLanes:n}),(0,R.jsxs)(`div`,{className:`flex flex-col justify-center gap-0.5 pl-2`,style:{minHeight:vF},children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-neutral-500`,children:e.hash.slice(0,7)}),e.refs.map((e,t)=>(0,R.jsx)(xF,{ref_:e},`${t}-${e}`)),(0,R.jsx)(`span`,{className:`truncate text-neutral-200`,title:e.message,children:e.message})]}),(0,R.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-600`,children:[e.author,` · `,new Date(e.date).toLocaleString()]})]})]},e.hash)})})}function bF({layout:e,isLast:t,maxLanes:n}){let r=n*_F,i=vF,a=e.lane*_F+_F/2,o=i/2,s=[];for(let t of e.through){let e=t*_F+_F/2;s.push({x1:e,y1:0,x2:e,y2:i,color:sF(t)})}for(let t of e.incomingLanes){let e=t*_F+_F/2;s.push({x1:e,y1:0,x2:a,y2:o,color:sF(t)})}if(!t)for(let t of e.outgoingLanes){let e=t.lane*_F+_F/2;s.push({x1:a,y1:o,x2:e,y2:i,color:sF(t.lane)})}if(t&&e.outgoingLanes.length>0)for(let t of e.outgoingLanes){let e=t.lane*_F+_F/2;s.push({x1:a,y1:o,x2:e,y2:24,color:sF(t.lane)})}return(0,R.jsxs)(`svg`,{width:r,height:i,viewBox:`0 0 ${r} ${i}`,className:`shrink-0`,"aria-hidden":!0,children:[s.map((e,t)=>(0,R.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:1.5,strokeLinecap:`round`},t)),(0,R.jsx)(`circle`,{cx:a,cy:o,r:3.5,fill:sF(e.lane)})]})}function xF({ref_:e}){let t=e.startsWith(`HEAD ->`)||e===`HEAD`,n=e.startsWith(`tag:`),r=t?e.replace(/^HEAD ->\s*/,``):n?e.replace(/^tag:\s*/,``):e;return(0,R.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0 text-[9px] uppercase tracking-wider ${t?`bg-emerald-900/40 text-emerald-300 light:bg-emerald-100 light:text-emerald-800`:n?`bg-amber-900/40 text-amber-300 light:bg-amber-100 light:text-amber-800`:e.includes(`/`)?`bg-neutral-800 text-neutral-500`:`bg-neutral-800 text-neutral-300`}`,children:n?`▼ ${r}`:r})}var SF=250,CF=2,wF=200;function TF(){let e=Sr(),t=Ei(e=>e.openFile),n=qj(e=>e.openEditorPane),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(void 0),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(void 0),w=(0,v.useRef)(void 0),T=(0,v.useCallback)(async t=>{if(e===void 0)return;if(t.length<CF){y(void 0),C(void 0);return}w.current?.abort();let n=new AbortController;w.current=n,x(!0),C(void 0);try{let r={query:t,regex:a,caseSensitive:s,includeGitignored:l,limit:wF,...d.length>0?{include:d}:{},...p.length>0?{exclude:p}:{}},i=await L.searchFiles(e.id,r,n.signal);if(n.signal.aborted)return;y(i)}catch(e){if(n.signal.aborted||e instanceof Error&&e.name===`AbortError`)return;e instanceof N&&e.code===`invalid_response_body`?C(`server returned an unexpected response`):e instanceof Error?C(e.message):C(`search failed`),y(void 0)}finally{n.signal.aborted||x(!1)}},[e,a,s,l,d,p]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void T(r),SF);return()=>window.clearTimeout(e)},[r,T]),(0,v.useEffect)(()=>()=>{w.current?.abort()},[]);let E=(0,v.useMemo)(()=>DF(_?.matches??[]),[_]);return e===void 0?(0,R.jsx)(`div`,{className:`p-4 text-xs italic text-neutral-500`,children:`Select a project to search its files.`}):(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-b border-neutral-800 bg-neutral-900/40 p-2`,children:[(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(Ze,{size:12,className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-neutral-500`}),(0,R.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:a?`Regex…`:`Search project…`,className:`w-full rounded border border-neutral-700 bg-neutral-900 py-1.5 pl-7 pr-2 text-xs text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`,autoFocus:!0})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[(0,R.jsx)(OF,{label:`Regex`,active:a,onClick:()=>o(e=>!e)}),(0,R.jsx)(OF,{label:`Aa`,title:`Case sensitive`,active:s,onClick:()=>c(e=>!e)}),(0,R.jsx)(OF,{label:`+ignored`,title:`Include files that .gitignore would normally skip`,active:l,onClick:()=>u(e=>!e)}),(0,R.jsxs)(`button`,{onClick:()=>g(e=>!e),className:`ml-auto flex items-center gap-1 rounded border border-neutral-700 px-1.5 py-0.5 text-[10px] text-neutral-400 hover:border-neutral-500`,children:[h?(0,R.jsx)(Se,{size:10}):(0,R.jsx)(we,{size:10}),`Globs`]})]}),h&&(0,R.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-1.5`,children:[(0,R.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`include glob — e.g. **/*.ts`,className:`rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-[11px] text-neutral-200 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`}),(0,R.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`exclude glob — e.g. **/dist/**`,className:`rounded border border-neutral-700 bg-neutral-900 px-2 py-1 text-[11px] text-neutral-200 placeholder:text-neutral-500 focus:border-neutral-500 focus:outline-none`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-auto`,children:[(0,R.jsx)(kF,{query:r,loading:b,error:S,results:_,totalFiles:E.length}),(0,R.jsx)(`ul`,{className:`divide-y divide-neutral-900`,children:E.map(([r,i])=>(0,R.jsx)(AF,{path:r,matches:i,onPick:i=>{t(e.id,EF(e.path,r),{line:i.line,column:i.column}),n()}},r))})]})]})}function EF(e,t){return t.startsWith(`/`)?t:`${e}${e.endsWith(`/`)?``:`/`}${t}`}function DF(e){let t=new Map;for(let n of e){let e=t.get(n.path);e===void 0?t.set(n.path,[n]):e.push(n)}return Array.from(t.entries())}function OF({label:e,title:t,active:n,onClick:r}){return(0,R.jsx)(`button`,{onClick:r,title:t,className:`rounded border px-1.5 py-0.5 text-[10px] ${n?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-400 hover:border-neutral-500`}`,children:e})}function kF({query:e,loading:t,error:n,results:r,totalFiles:i}){return e.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-center text-xs text-neutral-500`,children:[(0,R.jsx)(Me,{size:20,className:`text-neutral-700`}),(0,R.jsx)(`p`,{children:`Type to search across project files.`}),(0,R.jsxs)(`p`,{className:`text-[10px] text-neutral-600`,children:[`Min `,CF,` chars · Click a result to jump to that line.`]})]}):e.length<CF?(0,R.jsxs)(`div`,{className:`px-4 py-3 text-xs italic text-neutral-500`,children:[`Keep typing — at least `,CF,` characters.`]}):t&&r===void 0?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-neutral-400`,children:[(0,R.jsx)(pe,{size:12,className:`animate-spin`}),` Searching…`]}):n===void 0?r===void 0?null:r.matches.length===0?(0,R.jsx)(`div`,{className:`px-4 py-3 text-xs italic text-neutral-500`,children:`No matches.`}):(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-neutral-800 bg-neutral-950/60 px-3 py-1.5 text-[10px]`,children:[(0,R.jsxs)(`span`,{className:`text-neutral-400`,children:[r.matches.length,` match`,r.matches.length===1?``:`es`,` in `,i,` `,`file`,i===1?``:`s`,r.truncated&&(0,R.jsxs)(`span`,{className:`ml-1 text-amber-400 light:text-amber-700`,children:[`· truncated at `,wF]})]}),r.engine===`node`&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1.5 py-0.5 text-[9px] uppercase tracking-wider text-amber-300 light:bg-amber-100 light:text-amber-800`,title:`ripgrep was not found on this host — using the slower in-process fallback`,children:`fallback`})]}):(0,R.jsx)(`div`,{className:`px-4 py-3 text-xs text-rose-400 light:text-rose-700`,children:n})}function AF({path:e,matches:t,onPick:n}){let[r,i]=(0,v.useState)(!0);return(0,R.jsxs)(`li`,{className:`bg-neutral-950`,children:[(0,R.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`flex w-full items-center gap-1 truncate px-2 py-1 text-left text-[11px] text-neutral-300 hover:bg-neutral-900`,title:e,children:[r?(0,R.jsx)(Se,{size:11}):(0,R.jsx)(we,{size:11}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e}),(0,R.jsx)(`span`,{className:`ml-auto text-[10px] text-neutral-500`,children:t.length})]}),r&&(0,R.jsx)(`ul`,{children:t.map((t,r)=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{onClick:()=>n(t),className:`flex w-full gap-2 px-2 py-0.5 text-left font-mono text-[11px] text-neutral-400 hover:bg-neutral-900 hover:text-neutral-100`,title:`${e}:${t.line}:${t.column}`,children:[(0,R.jsx)(`span`,{className:`w-10 shrink-0 text-right text-neutral-600`,children:t.line}),(0,R.jsx)(`span`,{className:`truncate`,children:jF(t.lineSnippet,t.column,t.length)})]})},`${t.line}:${t.column}:${r}`))})]})}function jF(e,t,n){let r=Math.max(0,Math.min(e.length,t-1)),i=Math.max(r,Math.min(e.length,r+n)),a=e.length-e.trimStart().length,o=Math.min(a,r),s=e.slice(o,r),c=e.slice(r,i),l=e.slice(i);return n===0||c.length===0?(0,R.jsx)(`span`,{children:e.slice(o)}):(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{children:s}),(0,R.jsx)(`span`,{className:`bg-amber-700/30 text-amber-100 light:bg-amber-200 light:text-amber-900`,children:c}),(0,R.jsx)(`span`,{children:l})]})}var MF=3;function NF(){let e=pi(e=>e.activeSessionId),t=pi(t=>e===void 0?0:t.agentEndCountBySession[e]??0),n=pi(t=>e===void 0?0:t.compactionEndCountBySession[e]??0),r=pi(t=>e===void 0?!1:t.streamingBySession[e]??!1),i=pi(t=>e===void 0?``:t.streamingTextBySession[e]??``),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(void 0),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(void 0),b=(0,v.useRef)(void 0),x=async()=>{if(e===void 0){o(void 0);return}b.current?.abort();let t=new AbortController;b.current=t,c(!0),u(void 0);try{let n=await L.getSessionContext(e,t.signal);if(t.signal.aborted)return;o(n)}catch(e){if(t.signal.aborted||e instanceof Error&&e.name===`AbortError`)return;e instanceof N&&e.status===404?(o(void 0),u(void 0)):u(e instanceof N?e.code:e.message)}finally{t.signal.aborted||c(!1)}};return(0,v.useEffect)(()=>{x()},[e,t,n]),(0,v.useEffect)(()=>()=>{b.current?.abort()},[]),e===void 0?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 py-6 text-center text-xs italic text-neutral-500`,children:`Select a session to inspect its context.`}):(0,R.jsxs)(`div`,{className:`flex h-full flex-col bg-neutral-950 text-xs text-neutral-200`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 bg-neutral-900/40 px-3 py-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-neutral-400`,children:`Context inspector`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[s&&(0,R.jsx)(pe,{size:11,className:`animate-spin text-neutral-500`}),(0,R.jsx)(`button`,{onClick:()=>void x(),disabled:s,className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-200 disabled:opacity-40`,title:`Refresh`,children:(0,R.jsx)(Je,{size:11,className:s?`animate-spin`:``})})]})]}),l!==void 0&&(0,R.jsx)(`div`,{className:`border-b border-red-700/40 bg-red-900/20 px-3 py-1.5 text-[11px] text-red-300 light:border-red-300 light:bg-red-50 light:text-red-700`,children:l}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:a===void 0?(0,R.jsx)(`div`,{className:`px-4 py-6 text-center text-xs italic text-neutral-500`,children:s?`Loading…`:`No data — try refresh.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(PF,{data:a,turnsExpanded:d,onToggleTurns:()=>f(e=>!e)}),(0,R.jsx)(zF,{messages:a.messages,showThinking:p,onToggleThinking:()=>m(e=>!e),onViewRaw:(e,t)=>y({index:e,payload:t}),search:h,onSearchChange:g,...r&&i.length>0?{streamingTail:{content:i}}:{}})]})}),_!==void 0&&(0,R.jsx)(VF,{title:`Message ${_.index} — raw AgentMessage JSON`,payload:_.payload,onClose:()=>y(void 0)})]})}function PF({data:e,turnsExpanded:t,onToggleTurns:n}){let r=e.contextUsage,i=(0,v.useMemo)(()=>LF(e.messages,r.tokens),[e.messages,r.tokens]),a=(0,v.useMemo)(()=>GF(e.messages,e.turns),[e.messages,e.turns]),o=r.tokens??i.total,s=r.contextWindow>0?Math.min(1,o/r.contextWindow):0;return(0,R.jsxs)(`div`,{className:`space-y-2 border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[10px] text-neutral-400`,children:[(0,R.jsxs)(`span`,{children:[`Context window (`,r.tokens===void 0?`estimate`:`current`,`)`]}),(0,R.jsxs)(`span`,{children:[JF(o),` /`,` `,r.contextWindow>0?JF(r.contextWindow):`unknown`,r.contextWindow>0&&(0,R.jsxs)(`span`,{className:`ml-1 text-neutral-600`,children:[`(`,(s*100).toFixed(1),`%)`]})]})]}),(0,R.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded bg-neutral-800`,children:(0,R.jsx)(`div`,{className:`h-full ${s>.9?`bg-red-500`:s>.7?`bg-amber-500`:`bg-emerald-500`}`,style:{width:`${Math.max(2,Math.min(100,s*100))}%`}})})]}),(0,R.jsx)(IF,{breakdown:i,contextWindow:r.contextWindow}),(0,R.jsxs)(`div`,{className:`space-y-0.5 border-t border-neutral-800 pt-1.5`,children:[e.turns.length>0&&(()=>{let t=e.turns[e.turns.length-1],n=a.get(t.index)??0;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,children:`Last turn`}),(0,R.jsxs)(`span`,{className:`font-mono text-neutral-300`,title:`New = user message + tool results since the prior assistant turn (estimate). Out = assistant output tokens. Cost = that turn's billed cost.`,children:[`~`,JF(n),` new · `,JF(t.outputTokens),` out ·`,` `,YF(t.cost)]})]})})(),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.input` per turn — NEW non-cached input the LLM saw across the session. Excludes cached portions (tracked separately below).",children:`Input (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalInputTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.cacheRead` per turn — prior context served from the prompt cache. Counted ONCE PER API CALL: every turn re-reads the same cached content and re-pays the (discounted) read fee, so this number grows ~quadratically with conversation length. Billed at ~10% of input rate on most providers.",children:`Cache served (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalCacheReadTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.cacheWrite` per turn — portions cached for reuse on subsequent turns. Billed at ~125% of input rate; small premium up front for big savings on the cache-served line.",children:`Cache written (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalCacheWriteTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-neutral-500`,title:"Sum of `usage.output` per turn — assistant tokens generated.",children:`Output (lifetime)`}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-400`,children:JF(e.totalOutputTokens)})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-medium`,children:[(0,R.jsx)(`span`,{className:`text-neutral-300`,children:`Total cost`}),(0,R.jsx)(`span`,{className:`font-mono text-emerald-400 light:text-emerald-700`,children:YF(e.totalCost)})]})]}),e.turns.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{onClick:n,className:`flex items-center gap-1 text-[10px] uppercase tracking-wider text-neutral-400 hover:text-neutral-200`,children:[t?(0,R.jsx)(Se,{size:10}):(0,R.jsx)(we,{size:10}),`Per-turn (`,e.turns.length,`)`]}),t&&(0,R.jsx)(RF,{turns:e.turns,newDeltas:a})]})]})}var FF=[{key:`systemAndTools`,label:`System + tools`,color:`#64748b`},{key:`userPrompts`,label:`User prompts`,color:`#0ea5e9`},{key:`assistantText`,label:`Assistant text`,color:`#a78bfa`},{key:`thinking`,label:`Thinking`,color:`#71717a`},{key:`toolCalls`,label:`Tool calls`,color:`#f59e0b`},{key:`toolResults`,label:`Tool results`,color:`#10b981`},{key:`images`,label:`Images`,color:`#ec4899`}];function IF({breakdown:e,contextWindow:t}){let n=e.total;return n===0?null:(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[10px] text-neutral-400`,children:[(0,R.jsx)(`span`,{children:`What’s in the context`}),(0,R.jsxs)(`span`,{className:`text-neutral-600`,title:`Sum of category estimates (~chars/3)`,children:[`~`,JF(n),` tok`,t>0&&(0,R.jsxs)(`span`,{className:`ml-1`,children:[`(`,(n/t*100).toFixed(1),`%)`]})]})]}),(0,R.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded bg-neutral-800`,children:FF.map(t=>{let r=e[t.key];if(r===0)return null;let i=r/n*100;return(0,R.jsx)(`div`,{style:{width:`${i}%`,background:t.color},title:`${t.label}: ${JF(r)} tok (${i.toFixed(1)}%)`},t.key)})}),(0,R.jsx)(`ul`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-[10px]`,children:FF.map(t=>{let r=e[t.key];if(r===0)return null;let i=r/n*100;return(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-sm`,style:{background:t.color},"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`flex-1 truncate text-neutral-400`,children:t.label}),(0,R.jsx)(`span`,{className:`font-mono text-neutral-300`,children:JF(r)}),(0,R.jsxs)(`span`,{className:`w-10 text-right text-neutral-600`,children:[i.toFixed(0),`%`]})]},t.key)})})]})}function LF(e,t){let n=0,r=0,i=0,a=0,o=0,s=0;for(let t of e){let e=typeof t.role==`string`?t.role:``,c=t.content;if(e===`user`){if(typeof c==`string`)n+=c.length;else if(Array.isArray(c))for(let e of c){let t=e;t.type===`text`&&typeof t.text==`string`?n+=t.text.length:t.type===`image`&&(s+=1)}}else if(e===`assistant`&&Array.isArray(c))for(let e of c){let t=e;if(t.type===`text`&&typeof t.text==`string`)r+=t.text.length;else if(t.type===`thinking`&&typeof t.thinking==`string`)i+=t.thinking.length;else if(t.type===`toolCall`)try{a+=JSON.stringify(t.arguments??{}).length}catch{a+=String(t.arguments??``).length}}else if(e===`toolResult`){if(typeof c==`string`)o+=c.length;else if(Array.isArray(c))for(let e of c){let t=e;t.type===`text`&&typeof t.text==`string`?o+=t.text.length:t.type===`image`&&(s+=1)}}}let c=e=>Math.ceil(e/MF),l=c(n),u=c(r),d=c(i),f=c(a),p=c(o),m=s*1500,h=l+u+d+f+p+m,g=t!==void 0&&t>h?t-h:0;return{systemAndTools:g,userPrompts:l,assistantText:u,thinking:d,toolCalls:f,toolResults:p,images:m,total:h+g}}function RF({turns:e,newDeltas:t}){return(0,R.jsx)(`div`,{className:`mt-1 overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full font-mono text-[10px]`,children:[(0,R.jsx)(`thead`,{className:`text-neutral-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`pr-2 text-left font-normal`,children:`#`}),(0,R.jsx)(`th`,{className:`pr-2 text-left font-normal`,children:`Model`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Estimated new tokens this turn — user message + tool results since the prior assistant turn (~chars/3 estimate). Distinct from Prompt.`,children:`New`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Full prompt sent to the LLM = usage.input + cacheRead + cacheWrite. Includes ALL re-sent prior context — this grows monotonically with conversation length, which is normal LLM behavior.`,children:`Prompt`}),(0,R.jsx)(`th`,{className:`pr-2 text-right font-normal`,title:`Assistant output tokens this turn`,children:`Out`}),(0,R.jsx)(`th`,{className:`text-right font-normal`,title:`Cost billed for this turn`,children:`Cost`})]})}),(0,R.jsx)(`tbody`,{className:`text-neutral-300`,children:e.map((e,n)=>{let r=e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens,i=t.get(e.index)??0;return(0,R.jsxs)(`tr`,{className:`border-t border-neutral-800/60`,children:[(0,R.jsx)(`td`,{className:`pr-2 text-neutral-600`,children:n+1}),(0,R.jsx)(`td`,{className:`max-w-[140px] truncate pr-2`,title:`${e.provider}/${e.model}`,children:e.model}),(0,R.jsxs)(`td`,{className:`pr-2 text-right text-neutral-200`,title:`New content (estimate)`,children:[`~`,JF(i)]}),(0,R.jsx)(`td`,{className:`pr-2 text-right`,title:`input ${JF(e.inputTokens)} + cR ${JF(e.cacheReadTokens)} + cW ${JF(e.cacheWriteTokens)}`,children:JF(r)}),(0,R.jsx)(`td`,{className:`pr-2 text-right`,children:JF(e.outputTokens)}),(0,R.jsx)(`td`,{className:`text-right text-emerald-400 light:text-emerald-700`,children:YF(e.cost)})]},`${e.index}-${e.timestamp}`)})})]})})}function zF({messages:e,showThinking:t,onToggleThinking:n,onViewRaw:r,search:i,onSearchChange:a,streamingTail:o}){let s=i.trim().toLowerCase(),c=(0,v.useMemo)(()=>s.length===0?e.map((e,t)=>({msg:e,originalIndex:t})):e.map((e,t)=>({msg:e,originalIndex:t})).filter(({msg:e})=>(typeof e.role==`string`?e.role.toLowerCase():``).includes(s)?!0:UF(e,!0).toLowerCase().includes(s)),[e,s]);return(0,R.jsxs)(`div`,{className:`px-2 py-2`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 px-1`,children:[(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wider text-neutral-400`,children:[`Messages (`,s.length>0?`${c.length}/${e.length}`:e.length,`)`]}),(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-neutral-500 hover:text-neutral-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t,onChange:n,className:`h-3 w-3`}),`Show thinking blocks`]})]}),e.length>=10&&(0,R.jsxs)(`div`,{className:`relative mb-1 px-1`,children:[(0,R.jsx)(Ze,{size:11,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-500`}),(0,R.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Find in messages…`,className:`w-full rounded border border-neutral-800 bg-neutral-950 py-1 pl-6 pr-2 text-[11px] text-neutral-200 placeholder:text-neutral-600 focus:border-neutral-600 focus:outline-none`})]}),(0,R.jsxs)(`ul`,{className:`space-y-1`,children:[c.map(({msg:e,originalIndex:n})=>(0,R.jsx)(BF,{index:n,message:e,showThinking:t,onViewRaw:()=>r(n,e)},n)),o!==void 0&&s.length===0&&(0,R.jsx)(`li`,{className:`rounded border border-violet-700/40 bg-violet-900/10 light:border-violet-300 light:bg-violet-50`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 px-2 py-1.5`,children:[(0,R.jsx)(pe,{size:11,className:`mt-0.5 shrink-0 animate-spin text-violet-300 light:text-violet-700`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,R.jsx)(`span`,{className:`rounded bg-violet-900/40 px-1.5 py-0.5 text-[9px] uppercase tracking-wider text-violet-300 light:bg-violet-100 light:text-violet-800`,children:`assistant (streaming)`})}),(0,R.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-neutral-300`,children:o.content})]})]})})]})]})}function BF({index:e,message:t,showThinking:n,onViewRaw:r}){let[i,a]=(0,v.useState)(!1),o=typeof t.role==`string`?t.role:`unknown`,s=o===`compactionSummary`,c=(0,v.useMemo)(()=>UF(t,n),[t,n]),l=WF(t),u=typeof t.timestamp==`number`?t.timestamp:0;return(0,R.jsxs)(`li`,{className:`rounded border border-neutral-800/70 bg-neutral-900/30`,children:[(0,R.jsxs)(`button`,{onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 px-2 py-1.5 text-left hover:bg-neutral-900/60`,children:[(0,R.jsx)(`span`,{className:`pt-0.5 text-neutral-600`,children:i?(0,R.jsx)(Se,{size:11}):(0,R.jsx)(we,{size:11})}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] uppercase tracking-wider ${HF(o)}`,children:o}),s&&(0,R.jsx)(`span`,{className:`rounded bg-fuchsia-900/40 px-1.5 py-0.5 text-[9px] text-fuchsia-300 light:bg-fuchsia-100 light:text-fuchsia-800`,children:`compacted`}),(0,R.jsxs)(`span`,{className:`text-[10px] text-neutral-600`,children:[`~`,JF(l),` tok`]}),u>0&&(0,R.jsx)(`span`,{className:`text-[10px] text-neutral-600`,children:new Date(u).toLocaleTimeString()})]}),!i&&c.length>0&&(0,R.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-neutral-400`,children:c})]}),(0,R.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},className:`rounded p-1 text-neutral-500 hover:bg-neutral-800 hover:text-neutral-100`,title:`View raw AgentMessage JSON`,children:(0,R.jsx)(ce,{size:11})})]}),i&&(0,R.jsx)(`div`,{className:`space-y-1 border-t border-neutral-800/70 px-3 py-2`,children:KF(t,n,e)})]})}function VF({title:e,payload:t,onClose:n}){let r=(0,v.useMemo)(()=>{try{return JSON.stringify(t,null,2)}catch{return String(t)}},[t]);return(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-4 py-8`,onClick:n,children:(0,R.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`flex h-full max-h-[720px] w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-neutral-800 bg-neutral-950 shadow-2xl`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs text-neutral-200`,children:e}),(0,R.jsx)(`button`,{onClick:n,className:`rounded p-2 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-200`,title:`Close (Esc)`,children:(0,R.jsx)(at,{size:20})})]}),(0,R.jsx)(so,{code:r,language:`json`,theme:Aa.vsDark,children:({style:e,tokens:t,getLineProps:n,getTokenProps:r})=>(0,R.jsx)(`pre`,{className:`flex-1 overflow-auto whitespace-pre p-3 font-mono text-[11px]`,style:{...e,background:`transparent`},children:t.map((e,t)=>(0,R.jsx)(`div`,{...n({line:e}),children:e.map((e,t)=>(0,R.jsx)(`span`,{...r({token:e})},t))},t))})})]})})}function HF(e){return e===`user`?`bg-sky-900/40 text-sky-300 light:bg-sky-100 light:text-sky-800`:e===`assistant`?`bg-violet-900/40 text-violet-300 light:bg-violet-100 light:text-violet-800`:e===`tool`||e===`toolResult`?`bg-amber-900/40 text-amber-300 light:bg-amber-100 light:text-amber-800`:e===`compactionSummary`?`bg-fuchsia-900/40 text-fuchsia-300 light:bg-fuchsia-100 light:text-fuchsia-800`:`bg-neutral-800 text-neutral-400`}function UF(e,t){let n=e.content;if(typeof n==`string`)return n.slice(0,200);if(!Array.isArray(n))return``;let r=[];for(let e of n){let n=e;n.type===`thinking`&&!t||(n.type===`text`&&typeof n.text==`string`?r.push(n.text):n.type===`thinking`&&typeof n.thinking==`string`?r.push(`[thinking] ${n.thinking}`):n.type===`toolCall`&&typeof n.name==`string`&&r.push(`[tool: ${n.name}]`))}return r.join(` `).slice(0,200)}function WF(e){let t=e.usage;if(t!==void 0&&typeof t.totalTokens==`number`)return t.totalTokens;let n=e.content;if(typeof n==`string`)return Math.ceil(n.length/MF);if(!Array.isArray(n))return 0;let r=0,i=0;for(let e of n){let t=e;typeof t.text==`string`&&(r+=t.text.length),t.type===`image`&&(i+=1)}return Math.ceil(r/MF)+i*1500}function GF(e,t){let n=new Map,r=-1;for(let i of t){let t=0;for(let n=r+1;n<i.index;n++){let r=e[n];if(r===void 0)continue;let i=typeof r.role==`string`?r.role:``;i!==`user`&&i!==`toolResult`||(t+=WF(r))}n.set(i.index,t),r=i.index}return n}function KF(e,t,n){let r=typeof e.role==`string`?e.role:`unknown`,i=e.content;return r===`toolResult`?(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`p`,{className:`mb-1 text-[10px] text-neutral-500`,children:[`tool: `,(0,R.jsx)(`span`,{className:`font-mono`,children:String(e.toolName??`unknown`)}),` `,e.isError===!0&&(0,R.jsx)(`span`,{className:`text-red-400 light:text-red-700`,children:`(error)`})]}),(0,R.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-neutral-950 p-2 font-mono text-[10px] text-neutral-300`,children:qF(i)})]}):Array.isArray(i)?(0,R.jsx)(R.Fragment,{children:i.map((e,r)=>{let i=e;if(i.type===`thinking`&&!t)return null;if(i.type===`text`||i.type===`thinking`){let e=i.type===`thinking`?i.thinking:i.text;return(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[11px] ${i.type===`thinking`?`italic text-neutral-500`:`text-neutral-200`}`,children:String(e??``)},`${n}-${r}`)}return i.type===`toolCall`?(0,R.jsxs)(`div`,{className:`rounded border border-neutral-800 p-2`,children:[(0,R.jsxs)(`p`,{className:`mb-1 text-[10px] text-neutral-500`,children:[`tool call: `,(0,R.jsx)(`span`,{className:`font-mono`,children:String(i.name??`unknown`)})]}),(0,R.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-300`,children:qF(i.arguments)})]},`${n}-${r}`):i.type===`image`?(0,R.jsx)(`p`,{className:`text-[11px] italic text-neutral-500`,children:`[image attachment]`},`${n}-${r}`):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-500`,children:qF(i)},`${n}-${r}`)})}):typeof i==`string`?(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[11px] text-neutral-200`,children:i}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[10px] text-neutral-500`,children:qF(e)})}function qF(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function JF(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(2)}M`}function YF(e){return e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function XF({getStartSize:e,onResize:t,direction:n,minSize:r,maxSize:i,orientation:a=`vertical`}){let o=(0,v.useRef)(null),s=a===`horizontal`,c=s?`row-resize`:`col-resize`;(0,v.useEffect)(()=>{let e=()=>{o.current!==null&&(o.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`))},t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),window.addEventListener(`blur`,e),()=>{e(),window.removeEventListener(`keydown`,t),window.removeEventListener(`blur`,e)}},[]);let l=t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),o.current={start:s?t.clientY:t.clientX,startSize:e()},document.body.style.cursor=c,document.body.style.userSelect=`none`},u=e=>{if(o.current===null)return;let a=(s?e.clientY:e.clientX)-o.current.start,c=o.current.startSize+a*n;t(Math.min(Math.max(c,r),i))},d=e=>{o.current!==null&&(e.currentTarget.releasePointerCapture(e.pointerId),o.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`))},f=s?`h-1 w-full cursor-row-resize`:`w-1 h-full cursor-col-resize`,p=s?`absolute inset-x-0 -top-1 -bottom-1`:`absolute inset-y-0 -left-1 -right-1`;return(0,R.jsx)(`div`,{onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:d,className:`group relative shrink-0 bg-neutral-800 hover:bg-neutral-600 active:bg-neutral-500 ${f}`,role:`separator`,"aria-orientation":s?`horizontal`:`vertical`,children:(0,R.jsx)(`div`,{className:p})})}var ZF=`pi-forge/files-width`,QF=`pi-forge/editor-width`,$F=`pi-forge/terminal-height`,eI=`pi-forge/todo-panel-height`,tI=280,nI=480,rI=280,iI=200,aI=200,oI=320,sI=320,cI=140,lI=100;function uI(e,t){let n=localStorage.getItem(e);if(n===null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)&&r>0?r:t}function dI(){let e=gr(e=>e.ready),t=gr(e=>e.isAuthenticated),n=gr(e=>e.mustChangePassword),r=gr(e=>e.bootstrap),i=gr(e=>e.logout),a=xr(e=>e.projects),o=xr(e=>!e.loading),s=xr(e=>e.load),c=Sr(),l=xr(e=>e.activeProjectId),u=pi(e=>e.activeSessionId),d=ct(),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/files-open`)===`true`),y=e=>{_(e),localStorage.setItem(`pi-forge/files-open`,e?`true`:`false`)},[b,x]=(0,v.useState)(()=>{let e=localStorage.getItem(`pi-forge/right-tab`);return e===`files`||e===`search`||e===`changes`||e===`git`||e===`context`||e===`processes`?e:`files`}),S=e=>{x(e),localStorage.setItem(`pi-forge/right-tab`,e)},[C,w]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/terminal-open`)===`true`),T=e=>{w(e),localStorage.setItem(`pi-forge/terminal-open`,e?`true`:`false`)},[E,D]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/chat-open`)!==`false`),O=e=>{D(e),localStorage.setItem(`pi-forge/chat-open`,e?`true`:`false`)},[k,ee]=(0,v.useState)(()=>localStorage.getItem(`pi-forge/editor-open`)!==`false`),te=e=>{ee(e),localStorage.setItem(`pi-forge/editor-open`,e?`true`:`false`)},[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(()=>uI($F,rI)),A=(0,v.useRef)(ie);(0,v.useEffect)(()=>{A.current=ie,localStorage.setItem($F,String(ie))},[ie]);let[j,M]=(0,v.useState)(()=>uI(eI,iI)),oe=(0,v.useRef)(j);(0,v.useEffect)(()=>{oe.current=j,localStorage.setItem(eI,String(j))},[j]);let se=qj(e=>e.todoPanelOpen);(0,v.useEffect)(()=>{se&&!g&&!d&&y(!0)},[se]);let ce=qj(e=>e.openProcessesTabSeq);(0,v.useEffect)(()=>{ce!==0&&(!g&&!d&&y(!0),S(`processes`))},[ce]);let le=qj(e=>e.openEditorPaneSeq);(0,v.useEffect)(()=>{le!==0&&te(!0)},[le]);let[ue,de]=(0,v.useState)(()=>uI(ZF,tI)),[fe,pe]=(0,v.useState)(()=>uI(QF,nI)),me=(0,v.useRef)(ue),he=(0,v.useRef)(fe);(0,v.useEffect)(()=>{me.current=ue,localStorage.setItem(ZF,String(ue))},[ue]),(0,v.useEffect)(()=>{he.current=fe,localStorage.setItem(QF,String(fe))},[fe]);let ge=Ei(e=>e.openFiles.length),_e=k&&ge>0,ve=iF(e&&t&&!n?c?.id:void 0).status?.files.length??0,ye=$r(Xr(e=>Zr(e,u))),be=pi(e=>u===void 0?0:e.fileRefreshCountBySession[u]??0),xe=Ei(e=>e.loadTree),Se=Ei(e=>e.restoreTabs),Ce=Ei(e=>e.refreshOpenFiles);(0,v.useEffect)(()=>{c===void 0||be===0||(xe(c.id),Ce(c.id))},[c?.id,be]),(0,v.useEffect)(()=>{c!==void 0&&Se(c.id)},[c?.id]),(0,v.useEffect)(()=>{if(!m)return;let e=e=>{e.key===`Escape`&&h(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let we=(0,v.useRef)(!0);(0,v.useEffect)(()=>{if(we.current){we.current=!1;return}f&&p(!1)},[l,u]),(0,v.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p(!1)};window.addEventListener(`keydown`,e);let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{window.removeEventListener(`keydown`,e),document.body.style.overflow=t}},[f]),(0,v.useEffect)(()=>{!d&&f&&p(!1)},[d,f]);let Te=qj(e=>e.settingsRequest),Ee=qj(e=>e.clearSettingsRequest),[De,Oe]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{Te!==void 0&&(h(!0),Te.tab!==void 0&&Oe(Te.tab),Ee())},[Te,Ee]),(0,v.useEffect)(()=>{r()},[r]);let ke=ji(e=>e.load),je=ji(e=>e.minimal),Me=ji(e=>e.authLogoUrl),Ne=ji(e=>e.appLogoDarkUrl),Fe=ji(e=>e.appLogoLightUrl),Ie=FC(PC(e=>e.theme)).mode===`light`?Fe??Ne??Me:Ne??Fe??Me;(0,v.useEffect)(()=>{ke()},[ke]),(0,v.useEffect)(()=>{t&&!n&&s()},[t,n,s]);let Le=Mi(e=>e.load);(0,v.useEffect)(()=>{t&&!n&&Le()},[t,n,Le]);let Re=MM(e=>e.startPolling),Be=MM(e=>e.stopPolling);return(0,v.useEffect)(()=>{t&&!n?Re():Be()},[t,n,Re,Be]),e?t?n?(0,R.jsx)(Ji,{}):(0,R.jsxs)(`div`,{className:`forge-app-shell flex h-screen flex-col bg-neutral-950 text-neutral-100`,children:[(0,R.jsxs)(`header`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-2`,style:{paddingTop:`max(0.5rem, env(safe-area-inset-top))`},children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),"aria-label":f?`Close project sidebar`:`Open project sidebar`,"aria-expanded":f,className:`-ml-1 inline-flex min-h-11 min-w-11 items-center justify-center rounded-md text-neutral-300 hover:bg-neutral-800 md:hidden`,children:(0,R.jsx)(ze,{size:20})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(`img`,{src:Ie??`/icons/icon.svg`,alt:``,className:`max-h-8 max-w-28 shrink-0 object-contain`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`shrink-0 text-sm font-semibold tracking-tight`,children:`pi-forge`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`div`,{className:`hidden md:contents`,children:[(0,R.jsxs)(`button`,{onClick:()=>O(!E),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${E?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the chat pane`,children:[(0,R.jsx)(He,{size:13}),`Chat`]}),(0,R.jsxs)(`button`,{onClick:()=>te(!k),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${k?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the editor pane (open tabs persist across reloads)`,children:[(0,R.jsx)(Ae,{size:13}),`Editor`]}),(0,R.jsxs)(`button`,{onClick:()=>y(!g),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${g?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the file browser tree`,children:[(0,R.jsx)(Pe,{size:13}),`Files`]}),!je&&(0,R.jsxs)(`button`,{onClick:()=>T(!C),className:`flex items-center gap-1 rounded-md border px-2 py-1 text-xs ${C?`border-neutral-500 bg-neutral-800 text-neutral-100`:`border-neutral-700 text-neutral-300 hover:border-neutral-500`}`,title:`Toggle the integrated terminal`,children:[(0,R.jsx)(et,{size:13}),`Terminal`]})]}),(0,R.jsx)(`div`,{className:`hidden md:block`,children:(0,R.jsx)(QP,{})}),(0,R.jsx)($P,{}),(0,R.jsx)(`button`,{onClick:()=>h(!0),className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,title:`Settings (providers, agent defaults, MCP, skills)`,children:`Settings`}),(0,R.jsx)(`button`,{onClick:i,className:`rounded-md border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:border-neutral-500`,children:`Sign out`})]})]}),(0,R.jsx)($i,{}),m&&(0,R.jsx)(VM,{onClose:()=>{h(!1),Oe(void 0)},...De===void 0?{}:{initialTab:De}}),(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[f&&(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 md:hidden`,onClick:()=>p(!1),"aria-hidden":!0}),d&&!f&&(0,R.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-20 w-5 md:hidden`,"aria-hidden":!0,onPointerDown:e=>{let t=e.clientX,n=!1,r=e=>{n||e.clientX-t>50&&(p(!0),n=!0,i())},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),window.removeEventListener(`pointercancel`,i)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i),window.addEventListener(`pointercancel`,i)}}),(0,R.jsx)(la,{className:`fixed inset-y-0 left-0 z-40 shadow-2xl transition-transform duration-200 ease-out md:static md:inset-auto md:z-auto md:shadow-none md:transition-none `+(f?`max-md:translate-x-0`:`max-md:-translate-x-full`)}),(0,R.jsxs)(`main`,{className:`flex flex-1 overflow-hidden`,children:[E&&(0,R.jsx)(`div`,{className:`forge-chat-column flex flex-1 flex-col overflow-hidden`,children:o&&a.length===0?ne?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center`,children:(0,R.jsxs)(`div`,{className:`space-y-3 text-sm text-neutral-400`,children:[(0,R.jsx)(`p`,{children:`No projects yet.`}),(0,R.jsx)(`button`,{onClick:()=>re(!1),className:`rounded-md bg-neutral-100 px-3 py-1.5 text-sm font-medium text-neutral-900 hover:bg-white`,children:`+ New project`})]})}):(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,R.jsx)(ea,{onClose:()=>re(!0)})}):u===void 0?c?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center`,children:(0,R.jsxs)(`div`,{className:`space-y-3 text-sm text-neutral-400`,children:[(0,R.jsx)(`h2`,{className:`text-xl font-semibold text-neutral-100`,children:c.name}),(0,R.jsx)(`p`,{className:`font-mono text-xs`,children:c.path}),(0,R.jsx)(`p`,{children:`Pick a session from the sidebar — or start a new one here.`}),(0,R.jsx)(`button`,{onClick:()=>{pi.getState().createSession(c.id)},className:`rounded-md bg-neutral-100 px-3 py-1.5 text-sm font-medium text-neutral-900 hover:bg-white`,children:`+ New session`})]})}):(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,R.jsx)(`p`,{className:`text-sm text-neutral-400`,children:`Select a project from the sidebar.`})}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ej,{sessionId:u}),!je&&(0,R.jsx)(TM,{sessionId:u,alreadyOnChangesTab:g&&b===`changes`,onOpen:()=>{g||y(!0),S(`changes`)}}),(0,R.jsx)(NN,{sessionId:u}),(0,R.jsx)(bM,{sessionId:u})]})}),!d&&_e&&(E?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{getStartSize:()=>he.current,onResize:e=>pe(e),direction:-1,minSize:oI,maxSize:Math.max(oI,window.innerWidth-(g?ue:0)-sI-240)}),(0,R.jsx)(`div`,{className:`flex shrink-0 flex-col border-l border-neutral-800`,style:{width:`${fe}px`},children:(0,R.jsx)(yP,{})})]}):(0,R.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,R.jsx)(yP,{})})),!d&&g&&(()=>{let e=!E&&!_e,t=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`flex border-b border-neutral-800 bg-neutral-900/40`,children:(je?[`files`,`search`,`processes`,`context`]:[`files`,`search`,`changes`,`git`,`processes`,`context`]).map(e=>(0,R.jsxs)(`button`,{onClick:()=>S(e),className:`flex items-center gap-1 px-3 py-1.5 text-[11px] uppercase tracking-wider ${b===e?`border-b border-neutral-100 text-neutral-100`:`text-neutral-500 hover:text-neutral-300`}`,children:[e===`files`?`Files`:e===`search`?`Search`:e===`changes`?`Last turn`:e===`git`?`Git`:e===`processes`?`Processes`:`Context`,e===`git`&&ve>0&&(0,R.jsx)(`span`,{className:`rounded bg-amber-900/40 px-1 py-0.5 text-[9px] text-amber-300 light:bg-amber-100 light:text-amber-800`,children:ve}),e===`processes`&&ye>0&&(0,R.jsx)(`span`,{className:`rounded bg-emerald-900/40 px-1 py-0.5 text-[9px] text-emerald-300 light:bg-emerald-100 light:text-emerald-800`,children:ye})]},e))}),(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b===`files`?(0,R.jsx)(XN,{}):b===`search`?(0,R.jsx)(TF,{}):!je&&b===`changes`?(0,R.jsx)(nF,{}):!je&&b===`git`?(0,R.jsx)(pF,{}):b===`context`?(0,R.jsx)(NF,{}):b===`processes`&&u!==void 0?(0,R.jsx)(VN,{sessionId:u}):(0,R.jsx)(XN,{})}),se&&u!==void 0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{orientation:`horizontal`,getStartSize:()=>oe.current,onResize:e=>M(e),direction:-1,minSize:lI,maxSize:Math.max(lI,window.innerHeight*.7)}),(0,R.jsx)(`div`,{className:`shrink-0 overflow-hidden border-t border-neutral-800 light:border-neutral-200`,style:{height:`${j}px`},children:(0,R.jsx)(IN,{sessionId:u,onClose:()=>qj.getState().setTodoPanelOpen(!1)})})]})]})]});return e?(0,R.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:t}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{getStartSize:()=>me.current,onResize:e=>de(e),direction:-1,minSize:aI,maxSize:Math.max(aI,window.innerWidth-sI-240-(_e?oI:0))}),(0,R.jsx)(`div`,{className:`flex shrink-0 flex-col border-l border-neutral-800`,style:{width:`${ue}px`},children:t})]})})()]})]}),!d&&!je&&C&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(XF,{orientation:`horizontal`,getStartSize:()=>A.current,onResize:e=>ae(e),direction:-1,minSize:cI,maxSize:Math.max(cI,Math.floor(window.innerHeight*.7))}),(0,R.jsx)(`div`,{className:`shrink-0 border-t border-neutral-800`,style:{height:`${ie}px`},children:(0,R.jsx)(JP,{})})]})]})]}):(0,R.jsx)(Ki,{}):(0,R.jsx)(`main`,{className:`flex min-h-screen items-center justify-center text-sm text-neutral-400`,children:`Loading…`})}NC(),O({immediate:!0});var fI=class extends v.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[pi-forge] root render error`,e,t)}render(){return this.state.error===null?this.props.children:(0,R.jsxs)(`main`,{style:{padding:`2rem`,fontFamily:`monospace`,color:`#fca5a5`,background:`#0a0a0a`,minHeight:`100vh`,whiteSpace:`pre-wrap`,overflow:`auto`},children:[(0,R.jsx)(`h1`,{style:{color:`#fff`,marginBottom:`1rem`},children:`pi-forge: render crash`}),(0,R.jsx)(`p`,{style:{color:`#d4d4d4`,marginBottom:`1rem`},children:this.state.error.message}),(0,R.jsx)(`pre`,{style:{fontSize:`11px`,color:`#a3a3a3`},children:this.state.error.stack??`(no stack)`}),(0,R.jsx)(`p`,{style:{marginTop:`2rem`,color:`#71717a`,fontSize:`12px`},children:`Tip: open the browser console for more detail. Try clearing localStorage (devtools → Application → Local Storage → Clear) and refreshing if the error mentions stale state.`})]})}};window.addEventListener(`error`,e=>{console.error(`[pi-forge] uncaught error`,e.error)}),window.addEventListener(`unhandledrejection`,e=>{console.error(`[pi-forge] unhandled rejection`,e.reason)});var pI=document.getElementById(`root`);if(!pI)throw Error(`#root element missing in index.html`);(0,y.createRoot)(pI).render((0,R.jsx)(v.StrictMode,{children:(0,R.jsx)(fI,{children:(0,R.jsx)(dI,{})})}));export{l as a,d as i,PC as n,Hi as r,FC as t};
|
|
375
|
+
//# sourceMappingURL=index-2HJdevJu.js.map
|