@cnrai/pave 0.11.117 → 0.11.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pave.js +10 -10
- package/sandbox/SandboxRunner.js +1 -1
- package/sandbox/permission.js +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-D6cn5wHQ.js → abnfDiagram-VCTEODGH-Cy0FMT8v.js} +1 -1
- package/web/assets/{arc-Cgg1pPo1.js → arc-kJE6D1oE.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-CVCqcx0H.js → architectureDiagram-5GKGNRK7-K76ITJrD.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-BVvGfSsI.js → blockDiagram-I7D4REHJ-BGB31XYl.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-CoAaF4F6.js → c4Diagram-7LVT6UL2-BaTB0qVN.js} +1 -1
- package/web/assets/channel-ybnroZSU.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-DRwB_8QH.js → chunk-2Q5K7J3B-5VZx1LU6.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-KPbf86IQ.js → chunk-5VM5RSS4-DuMaH8uD.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-qm9nxfgN.js → chunk-F27PBJKO-ggoWV0gJ.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-B0TXVrgK.js → chunk-IMKFNOWR-IIoMeeLm.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-DZiqlLm3.js → chunk-JWPE2WC7-byKDbXzn.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-DKBflxCZ.js → chunk-POPQ4Y6H-C6AQdNDO.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-rq4Tz0t5.js → chunk-SVP7TREG-C-5cV70J.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-DRBdNvh2.js → chunk-TICWLB2K-BONlrmZq.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-F4LpLsLg.js → chunk-XXDRQBXY-CrOrFLeE.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-DVpCWxGN.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-DVpCWxGN.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-kw9FmMCr.js → cose-bilkent-JH36ORCC-CmljJJEJ.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-STdeqNxD.js → cynefin-OW5HDTMX-7Qtt21YP.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-C6R2omqO.js → cynefinDiagram-5FMLGOSQ-DxqZpyGR.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-C6TnIXl4.js → dagre-GXQ25YYZ-BL7U9TXO.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-C1uGt8Jk.js → diagram-S7CK7UJ4-kq53HXrQ.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-DQiZ4QHO.js → diagram-UQ7AKVKN-ChqT9cBv.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-BLp5d0GD.js → diagram-VSXAHHWV-Lt5a1Qri.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-Tq7YTE7N.js → diagram-VX7I27RA-DLw6iF4f.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-BFT1MnvB.js → diagram-Z3DM3KII-Dhj1WGQr.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-Cka24Dyv.js → ebnfDiagram-PWID7BFC-DZmfK0ER.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-CUMdnEEF.js → erDiagram-RLTQ6QDP-J8EphrWK.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-DzTjBjNJ.js → flowDiagram-HODETNUW-COyBJLfP.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-BMFTeGu6.js → ganttDiagram-EL5Y4UJY-DTQCulp7.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-BdBqDuuv.js → gitGraphDiagram-WWUBYQGX-BFMzAa8R.js} +1 -1
- package/web/assets/index-BU4RL3Oc.js +132 -0
- package/web/assets/index-DvmXgMDn.css +10 -0
- package/web/assets/{infoDiagram-27XIBGKW-BKW9MIwW.js → infoDiagram-27XIBGKW-B0VZh3Cg.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-B6LE7sdV.js → ishikawaDiagram-5VMMS53U-BELx0FR2.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-BTs_Puj9.js → journeyDiagram-3NMN7TZE-CUAJIh2b.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-Cl6qpiZE.js → kanban-definition-UXKFOSKX-DovK08HT.js} +1 -1
- package/web/assets/{layout-BHEqown4.js → layout-Bskhkyv5.js} +1 -1
- package/web/assets/{linear-BtzEZgES.js → linear-CyvGAyrR.js} +1 -1
- package/web/assets/{mermaid.core-5bZB2_Y2.js → mermaid.core-CYiw0kXn.js} +5 -5
- package/web/assets/{mindmap-definition-YA3MSWOX-SCcxEI4Z.js → mindmap-definition-YA3MSWOX-C_8fi_h8.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-GRRojmU8.js → pegDiagram-XKGWAZYB-DQgUieRG.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-DXz3NhOp.js → pieDiagram-E7YTZNPT-Bmpmpxie.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-QbD2mtuR.js → quadrantDiagram-AXDQQJYC-BUBV4AXR.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-DXHe4p7s.js → railroadDiagram-O6MQD6OU-FOFi7cPV.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-RpZBvizx.js → requirementDiagram-BXWQKSXE-DdhHxUze.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-C9p8fSGa.js → sankeyDiagram-P5KCCOFB-6OaH9E7j.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-BMliNvrN.js → sequenceDiagram-WJ2MYXX4-DOUkp_Hw.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-Cf6XVo6c.js → sizeCapture-INFHLROL-B-EXES5m.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-CWNFuaUy.js → stateDiagram-D77RDMKH-DE0t8Vv8.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-DDCRbnvH.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-CQW7z0ZN.js → swimlanes-42K2YHIH-FiGnHrZR.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-CKmSn5Vi.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-CFJuxS3x.js → timeline-definition-24CTP7MA-DqxypfQR.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-B1gQ6XL1.js → vennDiagram-4TSXK5OY-BDEA7Eeb.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-BU9TDExq.js → wardleyDiagram-VM6X3IG4-D_7_rEdL.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-C4HBksS_.js → xychartDiagram-S5SC5T6Z-By-YodQ2.js} +1 -1
- package/web/assets/zh-TW-BL_iUqM_.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/channel-BCngv8V4.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-C5-rUctc.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-C5-rUctc.js +0 -1
- package/web/assets/index-BR8XdK24.css +0 -10
- package/web/assets/index-wZiCPBWs.js +0 -129
- package/web/assets/stateDiagram-v2-MP3YSRHH-D0aLTNwc.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-T7PbS3FF.js +0 -8
- package/web/assets/zh-TW-GZcBUO6X.js +0 -1
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Yd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lh={exports:{}},$c={},Oh={exports:{}},Nn={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var N_;function QI(){if(N_)return Nn;N_=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function m(G){return G===null||typeof G!="object"?null:(G=g&&G[g]||G["@@iterator"],typeof G=="function"?G:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(G,X,B){this.props=G,this.context=X,this.refs=k,this.updater=B||x}_.prototype.isReactComponent={},_.prototype.setState=function(G,X){if(typeof G!="object"&&typeof G!="function"&&G!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,G,X,"setState")},_.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function S(){}S.prototype=_.prototype;function E(G,X,B){this.props=G,this.context=X,this.refs=k,this.updater=B||x}var N=E.prototype=new S;N.constructor=E,v(N,_.prototype),N.isPureReactComponent=!0;var R=Array.isArray,T=Object.prototype.hasOwnProperty,j={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function M(G,X,B){var te,V={},U=null,oe=null;if(X!=null)for(te in X.ref!==void 0&&(oe=X.ref),X.key!==void 0&&(U=""+X.key),X)T.call(X,te)&&!I.hasOwnProperty(te)&&(V[te]=X[te]);var ae=arguments.length-2;if(ae===1)V.children=B;else if(1<ae){for(var xe=Array(ae),Se=0;Se<ae;Se++)xe[Se]=arguments[Se+2];V.children=xe}if(G&&G.defaultProps)for(te in ae=G.defaultProps,ae)V[te]===void 0&&(V[te]=ae[te]);return{$$typeof:e,type:G,key:U,ref:oe,props:V,_owner:j.current}}function L(G,X){return{$$typeof:e,type:G.type,key:X,ref:G.ref,props:G.props,_owner:G._owner}}function A(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function O(G){var X={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(B){return X[B]})}var F=/\/+/g;function Q(G,X){return typeof G=="object"&&G!==null&&G.key!=null?O(""+G.key):X.toString(36)}function H(G,X,B,te,V){var U=typeof G;(U==="undefined"||U==="boolean")&&(G=null);var oe=!1;if(G===null)oe=!0;else switch(U){case"string":case"number":oe=!0;break;case"object":switch(G.$$typeof){case e:case t:oe=!0}}if(oe)return oe=G,V=V(oe),G=te===""?"."+Q(oe,0):te,R(V)?(B="",G!=null&&(B=G.replace(F,"$&/")+"/"),H(V,X,B,"",function(Se){return Se})):V!=null&&(A(V)&&(V=L(V,B+(!V.key||oe&&oe.key===V.key?"":(""+V.key).replace(F,"$&/")+"/")+G)),X.push(V)),1;if(oe=0,te=te===""?".":te+":",R(G))for(var ae=0;ae<G.length;ae++){U=G[ae];var xe=te+Q(U,ae);oe+=H(U,X,B,xe,V)}else if(xe=m(G),typeof xe=="function")for(G=xe.call(G),ae=0;!(U=G.next()).done;)U=U.value,xe=te+Q(U,ae++),oe+=H(U,X,B,xe,V);else if(U==="object")throw X=String(G),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.");return oe}function P(G,X,B){if(G==null)return G;var te=[],V=0;return H(G,te,"","",function(U){return X.call(B,U,V++)}),te}function K(G){if(G._status===-1){var X=G._result;X=X(),X.then(function(B){(G._status===0||G._status===-1)&&(G._status=1,G._result=B)},function(B){(G._status===0||G._status===-1)&&(G._status=2,G._result=B)}),G._status===-1&&(G._status=0,G._result=X)}if(G._status===1)return G._result.default;throw G._result}var W={current:null},Y={transition:null},ce={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:Y,ReactCurrentOwner:j};function z(){throw Error("act(...) is not supported in production builds of React.")}return Nn.Children={map:P,forEach:function(G,X,B){P(G,function(){X.apply(this,arguments)},B)},count:function(G){var X=0;return P(G,function(){X++}),X},toArray:function(G){return P(G,function(X){return X})||[]},only:function(G){if(!A(G))throw Error("React.Children.only expected to receive a single React element child.");return G}},Nn.Component=_,Nn.Fragment=n,Nn.Profiler=a,Nn.PureComponent=E,Nn.StrictMode=r,Nn.Suspense=d,Nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce,Nn.act=z,Nn.cloneElement=function(G,X,B){if(G==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+G+".");var te=v({},G.props),V=G.key,U=G.ref,oe=G._owner;if(X!=null){if(X.ref!==void 0&&(U=X.ref,oe=j.current),X.key!==void 0&&(V=""+X.key),G.type&&G.type.defaultProps)var ae=G.type.defaultProps;for(xe in X)T.call(X,xe)&&!I.hasOwnProperty(xe)&&(te[xe]=X[xe]===void 0&&ae!==void 0?ae[xe]:X[xe])}var xe=arguments.length-2;if(xe===1)te.children=B;else if(1<xe){ae=Array(xe);for(var Se=0;Se<xe;Se++)ae[Se]=arguments[Se+2];te.children=ae}return{$$typeof:e,type:G.type,key:V,ref:U,props:te,_owner:oe}},Nn.createContext=function(G){return G={$$typeof:l,_currentValue:G,_currentValue2:G,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},G.Provider={$$typeof:o,_context:G},G.Consumer=G},Nn.createElement=M,Nn.createFactory=function(G){var X=M.bind(null,G);return X.type=G,X},Nn.createRef=function(){return{current:null}},Nn.forwardRef=function(G){return{$$typeof:u,render:G}},Nn.isValidElement=A,Nn.lazy=function(G){return{$$typeof:p,_payload:{_status:-1,_result:G},_init:K}},Nn.memo=function(G,X){return{$$typeof:f,type:G,compare:X===void 0?null:X}},Nn.startTransition=function(G){var X=Y.transition;Y.transition={};try{G()}finally{Y.transition=X}},Nn.unstable_act=z,Nn.useCallback=function(G,X){return W.current.useCallback(G,X)},Nn.useContext=function(G){return W.current.useContext(G)},Nn.useDebugValue=function(){},Nn.useDeferredValue=function(G){return W.current.useDeferredValue(G)},Nn.useEffect=function(G,X){return W.current.useEffect(G,X)},Nn.useId=function(){return W.current.useId()},Nn.useImperativeHandle=function(G,X,B){return W.current.useImperativeHandle(G,X,B)},Nn.useInsertionEffect=function(G,X){return W.current.useInsertionEffect(G,X)},Nn.useLayoutEffect=function(G,X){return W.current.useLayoutEffect(G,X)},Nn.useMemo=function(G,X){return W.current.useMemo(G,X)},Nn.useReducer=function(G,X,B){return W.current.useReducer(G,X,B)},Nn.useRef=function(G){return W.current.useRef(G)},Nn.useState=function(G){return W.current.useState(G)},Nn.useSyncExternalStore=function(G,X,B){return W.current.useSyncExternalStore(G,X,B)},Nn.useTransition=function(){return W.current.useTransition()},Nn.version="18.3.1",Nn}var C_;function Yv(){return C_||(C_=1,Oh.exports=QI()),Oh.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var j_;function XI(){if(j_)return $c;j_=1;var e=Yv(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var p,g={},m=null,x=null;f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(x=d.ref);for(p in d)r.call(d,p)&&!o.hasOwnProperty(p)&&(g[p]=d[p]);if(u&&u.defaultProps)for(p in d=u.defaultProps,d)g[p]===void 0&&(g[p]=d[p]);return{$$typeof:t,type:u,key:m,ref:x,props:g,_owner:a.current}}return $c.Fragment=n,$c.jsx=l,$c.jsxs=l,$c}var T_;function ZI(){return T_||(T_=1,Lh.exports=XI()),Lh.exports}var i=ZI(),y=Yv();const Lt=$o(y);var Qd={},Dh={exports:{}},Ai={},Ph={exports:{}},Fh={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var R_;function JI(){return R_||(R_=1,(function(e){function t(Y,ce){var z=Y.length;Y.push(ce);e:for(;0<z;){var G=z-1>>>1,X=Y[G];if(0<a(X,ce))Y[G]=ce,Y[z]=X,z=G;else break e}}function n(Y){return Y.length===0?null:Y[0]}function r(Y){if(Y.length===0)return null;var ce=Y[0],z=Y.pop();if(z!==ce){Y[0]=z;e:for(var G=0,X=Y.length,B=X>>>1;G<B;){var te=2*(G+1)-1,V=Y[te],U=te+1,oe=Y[U];if(0>a(V,z))U<X&&0>a(oe,V)?(Y[G]=oe,Y[U]=z,G=U):(Y[G]=V,Y[te]=z,G=te);else if(U<X&&0>a(oe,z))Y[G]=oe,Y[U]=z,G=U;else break e}}return ce}function a(Y,ce){var z=Y.sortIndex-ce.sortIndex;return z!==0?z:Y.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],p=1,g=null,m=3,x=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(Y){for(var ce=n(f);ce!==null;){if(ce.callback===null)r(f);else if(ce.startTime<=Y)r(f),ce.sortIndex=ce.expirationTime,t(d,ce);else break;ce=n(f)}}function R(Y){if(k=!1,N(Y),!v)if(n(d)!==null)v=!0,K(T);else{var ce=n(f);ce!==null&&W(R,ce.startTime-Y)}}function T(Y,ce){v=!1,k&&(k=!1,S(M),M=-1),x=!0;var z=m;try{for(N(ce),g=n(d);g!==null&&(!(g.expirationTime>ce)||Y&&!O());){var G=g.callback;if(typeof G=="function"){g.callback=null,m=g.priorityLevel;var X=G(g.expirationTime<=ce);ce=e.unstable_now(),typeof X=="function"?g.callback=X:g===n(d)&&r(d),N(ce)}else r(d);g=n(d)}if(g!==null)var B=!0;else{var te=n(f);te!==null&&W(R,te.startTime-ce),B=!1}return B}finally{g=null,m=z,x=!1}}var j=!1,I=null,M=-1,L=5,A=-1;function O(){return!(e.unstable_now()-A<L)}function F(){if(I!==null){var Y=e.unstable_now();A=Y;var ce=!0;try{ce=I(!0,Y)}finally{ce?Q():(j=!1,I=null)}}else j=!1}var Q;if(typeof E=="function")Q=function(){E(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,P=H.port2;H.port1.onmessage=F,Q=function(){P.postMessage(null)}}else Q=function(){_(F,0)};function K(Y){I=Y,j||(j=!0,Q())}function W(Y,ce){M=_(function(){Y(e.unstable_now())},ce)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){v||x||(v=!0,K(T))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Y){switch(m){case 1:case 2:case 3:var ce=3;break;default:ce=m}var z=m;m=ce;try{return Y()}finally{m=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,ce){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var z=m;m=Y;try{return ce()}finally{m=z}},e.unstable_scheduleCallback=function(Y,ce,z){var G=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,Y){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=z+X,Y={id:p++,callback:ce,priorityLevel:Y,startTime:z,expirationTime:X,sortIndex:-1},z>G?(Y.sortIndex=z,t(f,Y),n(d)===null&&Y===n(f)&&(k?(S(M),M=-1):k=!0,W(R,z-G))):(Y.sortIndex=X,t(d,Y),v||x||(v=!0,K(T))),Y},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(Y){var ce=m;return function(){var z=m;m=ce;try{return Y.apply(this,arguments)}finally{m=z}}}})(Fh)),Fh}var A_;function eM(){return A_||(A_=1,Ph.exports=JI()),Ph.exports}/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var I_;function tM(){if(I_)return Ai;I_=1;var e=Yv(),t=eM();function n(s){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+s,h=1;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+s+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(a[s]=c,s=0;s<c.length;s++)r.add(c[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},g={};function m(s){return d.call(g,s)?!0:d.call(p,s)?!1:f.test(s)?g[s]=!0:(p[s]=!0,!1)}function x(s,c,h,b){if(h!==null&&h.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return b?!1:h!==null?!h.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function v(s,c,h,b){if(c===null||typeof c>"u"||x(s,c,h,b))return!0;if(b)return!1;if(h!==null)switch(h.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function k(s,c,h,b,w,C,q){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=w,this.mustUseProperty=h,this.propertyName=s,this.type=c,this.sanitizeURL=C,this.removeEmptyString=q}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){_[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var c=s[0];_[c]=new k(c,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){_[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){_[s]=new k(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){_[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){_[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){_[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){_[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){_[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function E(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var c=s.replace(S,E);_[c]=new k(c,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var c=s.replace(S,E);_[c]=new k(c,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var c=s.replace(S,E);_[c]=new k(c,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),_.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function N(s,c,h,b){var w=_.hasOwnProperty(c)?_[c]:null;(w!==null?w.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,h,w,b)&&(h=null),b||w===null?m(c)&&(h===null?s.removeAttribute(c):s.setAttribute(c,""+h)):w.mustUseProperty?s[w.propertyName]=h===null?w.type===3?!1:"":h:(c=w.attributeName,b=w.attributeNamespace,h===null?s.removeAttribute(c):(w=w.type,h=w===3||w===4&&h===!0?"":""+h,b?s.setAttributeNS(b,c,h):s.setAttribute(c,h))))}var R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),j=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),O=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),Y=Symbol.iterator;function ce(s){return s===null||typeof s!="object"?null:(s=Y&&s[Y]||s["@@iterator"],typeof s=="function"?s:null)}var z=Object.assign,G;function X(s){if(G===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);G=c&&c[1]||""}return`
|
|
34
|
-
`+G+s}var B=!1;function te(s,c){if(!s||B)return"";B=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(Ee){var b=Ee}Reflect.construct(s,[],c)}else{try{c.call()}catch(Ee){b=Ee}s.call(c.prototype)}else{try{throw Error()}catch(Ee){b=Ee}s()}}catch(Ee){if(Ee&&b&&typeof Ee.stack=="string"){for(var w=Ee.stack.split(`
|
|
35
|
-
`),C=b.stack.split(`
|
|
36
|
-
`),q=w.length-1,ne=C.length-1;1<=q&&0<=ne&&w[q]!==C[ne];)ne--;for(;1<=q&&0<=ne;q--,ne--)if(w[q]!==C[ne]){if(q!==1||ne!==1)do if(q--,ne--,0>ne||w[q]!==C[ne]){var le=`
|
|
37
|
-
`+w[q].replace(" at new "," at ");return s.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",s.displayName)),le}while(1<=q&&0<=ne);break}}}finally{B=!1,Error.prepareStackTrace=h}return(s=s?s.displayName||s.name:"")?X(s):""}function V(s){switch(s.tag){case 5:return X(s.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 2:case 15:return s=te(s.type,!1),s;case 11:return s=te(s.type.render,!1),s;case 1:return s=te(s.type,!0),s;default:return""}}function U(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case I:return"Fragment";case j:return"Portal";case L:return"Profiler";case M:return"StrictMode";case Q:return"Suspense";case H:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case O:return(s.displayName||"Context")+".Consumer";case A:return(s._context.displayName||"Context")+".Provider";case F:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case P:return c=s.displayName||null,c!==null?c:U(s.type)||"Memo";case K:c=s._payload,s=s._init;try{return U(s(c))}catch{}}return null}function oe(s){var c=s.type;switch(s.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=c.render,s=s.displayName||s.name||"",c.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(c);case 8:return c===M?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ae(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function xe(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Se(s){var c=xe(s)?"checked":"value",h=Object.getOwnPropertyDescriptor(s.constructor.prototype,c),b=""+s[c];if(!s.hasOwnProperty(c)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,C=h.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return w.call(this)},set:function(q){b=""+q,C.call(this,q)}}),Object.defineProperty(s,c,{enumerable:h.enumerable}),{getValue:function(){return b},setValue:function(q){b=""+q},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function Xe(s){s._valueTracker||(s._valueTracker=Se(s))}function bt(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var h=c.getValue(),b="";return s&&(b=xe(s)?s.checked?"true":"false":s.value),s=b,s!==h?(c.setValue(s),!0):!1}function at(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function yt(s,c){var h=c.checked;return z({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??s._wrapperState.initialChecked})}function et(s,c){var h=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;h=ae(c.value!=null?c.value:h),s._wrapperState={initialChecked:b,initialValue:h,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Ie(s,c){c=c.checked,c!=null&&N(s,"checked",c,!1)}function Ge(s,c){Ie(s,c);var h=ae(c.value),b=c.type;if(h!=null)b==="number"?(h===0&&s.value===""||s.value!=h)&&(s.value=""+h):s.value!==""+h&&(s.value=""+h);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}c.hasOwnProperty("value")?kt(s,c.type,h):c.hasOwnProperty("defaultValue")&&kt(s,c.type,ae(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function tt(s,c,h){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var b=c.type;if(!(b!=="submit"&&b!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+s._wrapperState.initialValue,h||c===s.value||(s.value=c),s.defaultValue=c}h=s.name,h!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,h!==""&&(s.name=h)}function kt(s,c,h){(c!=="number"||at(s.ownerDocument)!==s)&&(h==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+h&&(s.defaultValue=""+h))}var Kt=Array.isArray;function an(s,c,h,b){if(s=s.options,c){c={};for(var w=0;w<h.length;w++)c["$"+h[w]]=!0;for(h=0;h<s.length;h++)w=c.hasOwnProperty("$"+s[h].value),s[h].selected!==w&&(s[h].selected=w),w&&b&&(s[h].defaultSelected=!0)}else{for(h=""+ae(h),c=null,w=0;w<s.length;w++){if(s[w].value===h){s[w].selected=!0,b&&(s[w].defaultSelected=!0);return}c!==null||s[w].disabled||(c=s[w])}c!==null&&(c.selected=!0)}}function Vt(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return z({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function ze(s,c){var h=c.value;if(h==null){if(h=c.children,c=c.defaultValue,h!=null){if(c!=null)throw Error(n(92));if(Kt(h)){if(1<h.length)throw Error(n(93));h=h[0]}c=h}c==null&&(c=""),h=c}s._wrapperState={initialValue:ae(h)}}function De(s,c){var h=ae(c.value),b=ae(c.defaultValue);h!=null&&(h=""+h,h!==s.value&&(s.value=h),c.defaultValue==null&&s.defaultValue!==h&&(s.defaultValue=h)),b!=null&&(s.defaultValue=""+b)}function nt(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function ft(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ue(s,c){return s==null||s==="http://www.w3.org/1999/xhtml"?ft(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var be,qe=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,h,b,w){MSApp.execUnsafeLocalFunction(function(){return s(c,h,b,w)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(be=be||document.createElement("div"),be.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=be.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function me(s,c){if(c){var h=s.firstChild;if(h&&h===s.lastChild&&h.nodeType===3){h.nodeValue=c;return}}s.textContent=c}var pt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},gt=["Webkit","ms","Moz","O"];Object.keys(pt).forEach(function(s){gt.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),pt[c]=pt[s]})});function wt(s,c,h){return c==null||typeof c=="boolean"||c===""?"":h||typeof c!="number"||c===0||pt.hasOwnProperty(s)&&pt[s]?(""+c).trim():c+"px"}function ht(s,c){s=s.style;for(var h in c)if(c.hasOwnProperty(h)){var b=h.indexOf("--")===0,w=wt(h,c[h],b);h==="float"&&(h="cssFloat"),b?s.setProperty(h,w):s[h]=w}}var $t=z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Wt(s,c){if(c){if($t[s]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function Je(s,c){if(s.indexOf("-")===-1)return typeof c.is=="string";switch(s){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 zt=null;function St(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Yt=null,cn=null,xn=null;function Rn(s){if(s=os(s)){if(typeof Yt!="function")throw Error(n(280));var c=s.stateNode;c&&(c=xl(c),Yt(s.stateNode,s.type,c))}}function re(s){cn?xn?xn.push(s):xn=[s]:cn=s}function Te(){if(cn){var s=cn,c=xn;if(xn=cn=null,Rn(s),c)for(s=0;s<c.length;s++)Rn(c[s])}}function rt(s,c){return s(c)}function Pt(){}var Be=!1;function lt(s,c,h){if(Be)return s(c,h);Be=!0;try{return rt(s,c,h)}finally{Be=!1,(cn!==null||xn!==null)&&(Pt(),Te())}}function ke(s,c){var h=s.stateNode;if(h===null)return null;var b=xl(h);if(b===null)return null;h=b[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(s=s.type,b=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!b;break e;default:s=!1}if(s)return null;if(h&&typeof h!="function")throw Error(n(231,c,typeof h));return h}var Ce=!1;if(u)try{var Ye={};Object.defineProperty(Ye,"passive",{get:function(){Ce=!0}}),window.addEventListener("test",Ye,Ye),window.removeEventListener("test",Ye,Ye)}catch{Ce=!1}function xt(s,c,h,b,w,C,q,ne,le){var Ee=Array.prototype.slice.call(arguments,3);try{c.apply(h,Ee)}catch(Ze){this.onError(Ze)}}var ie=!1,Pe=null,$e=!1,Tt=null,Ne={onError:function(s){ie=!0,Pe=s}};function We(s,c,h,b,w,C,q,ne,le){ie=!1,Pe=null,xt.apply(Ne,arguments)}function Et(s,c,h,b,w,C,q,ne,le){if(We.apply(this,arguments),ie){if(ie){var Ee=Pe;ie=!1,Pe=null}else throw Error(n(198));$e||($e=!0,Tt=Ee)}}function vn(s){var c=s,h=s;if(s.alternate)for(;c.return;)c=c.return;else{s=c;do c=s,(c.flags&4098)!==0&&(h=c.return),s=c.return;while(s)}return c.tag===3?h:null}function vr(s){if(s.tag===13){var c=s.memoizedState;if(c===null&&(s=s.alternate,s!==null&&(c=s.memoizedState)),c!==null)return c.dehydrated}return null}function pn(s){if(vn(s)!==s)throw Error(n(188))}function jn(s){var c=s.alternate;if(!c){if(c=vn(s),c===null)throw Error(n(188));return c!==s?null:s}for(var h=s,b=c;;){var w=h.return;if(w===null)break;var C=w.alternate;if(C===null){if(b=w.return,b!==null){h=b;continue}break}if(w.child===C.child){for(C=w.child;C;){if(C===h)return pn(w),s;if(C===b)return pn(w),c;C=C.sibling}throw Error(n(188))}if(h.return!==b.return)h=w,b=C;else{for(var q=!1,ne=w.child;ne;){if(ne===h){q=!0,h=w,b=C;break}if(ne===b){q=!0,b=w,h=C;break}ne=ne.sibling}if(!q){for(ne=C.child;ne;){if(ne===h){q=!0,h=C,b=w;break}if(ne===b){q=!0,b=C,h=w;break}ne=ne.sibling}if(!q)throw Error(n(189))}}if(h.alternate!==b)throw Error(n(190))}if(h.tag!==3)throw Error(n(188));return h.stateNode.current===h?s:c}function Fr(s){return s=jn(s),s!==null?pe(s):null}function pe(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=pe(s);if(c!==null)return c;s=s.sibling}return null}var Xn=t.unstable_scheduleCallback,Br=t.unstable_cancelCallback,ki=t.unstable_shouldYield,Ji=t.unstable_requestPaint,Kn=t.unstable_now,_s=t.unstable_getCurrentPriorityLevel,pi=t.unstable_ImmediatePriority,ea=t.unstable_UserBlockingPriority,Ba=t.unstable_NormalPriority,je=t.unstable_LowPriority,mt=t.unstable_IdlePriority,It=null,gn=null;function Ln(s){if(gn&&typeof gn.onCommitFiberRoot=="function")try{gn.onCommitFiberRoot(It,s,void 0,(s.current.flags&128)===128)}catch{}}var Wn=Math.clz32?Math.clz32:ar,Sr=Math.log,Pi=Math.LN2;function ar(s){return s>>>=0,s===0?32:31-(Sr(s)/Pi|0)|0}var Er=64,hi=4194304;function ti(s){switch(s&-s){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: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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function ni(s,c){var h=s.pendingLanes;if(h===0)return 0;var b=0,w=s.suspendedLanes,C=s.pingedLanes,q=h&268435455;if(q!==0){var ne=q&~w;ne!==0?b=ti(ne):(C&=q,C!==0&&(b=ti(C)))}else q=h&~w,q!==0?b=ti(q):C!==0&&(b=ti(C));if(b===0)return 0;if(c!==0&&c!==b&&(c&w)===0&&(w=b&-b,C=c&-c,w>=C||w===16&&(C&4194240)!==0))return c;if((b&4)!==0&&(b|=h&16),c=s.entangledLanes,c!==0)for(s=s.entanglements,c&=b;0<c;)h=31-Wn(c),w=1<<h,b|=s[h],c&=~w;return b}function va(s,c){switch(s){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ta(s,c){for(var h=s.suspendedLanes,b=s.pingedLanes,w=s.expirationTimes,C=s.pendingLanes;0<C;){var q=31-Wn(C),ne=1<<q,le=w[q];le===-1?((ne&h)===0||(ne&b)!==0)&&(w[q]=va(ne,c)):le<=c&&(s.expiredLanes|=ne),C&=~ne}}function ka(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function _a(){var s=Er;return Er<<=1,(Er&4194240)===0&&(Er=64),s}function gi(s){for(var c=[],h=0;31>h;h++)c.push(s);return c}function Gr(s,c,h){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-Wn(c),s[c]=h}function Nr(s,c){var h=s.pendingLanes&~c;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=c,s.mutableReadLanes&=c,s.entangledLanes&=c,c=s.entanglements;var b=s.eventTimes;for(s=s.expirationTimes;0<h;){var w=31-Wn(h),C=1<<w;c[w]=0,b[w]=-1,s[w]=-1,h&=~C}}function Kr(s,c){var h=s.entangledLanes|=c;for(s=s.entanglements;h;){var b=31-Wn(h),w=1<<b;w&c|s[b]&c&&(s[b]|=c),h&=~w}}var un=0;function Ut(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var ir,Vn,sn,_i,zr,na=!1,ri=[],Qe=null,ut=null,Gt=null,kn=new Map,In=new Map,Zn=[],wi="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 submit".split(" ");function es(s,c){switch(s){case"focusin":case"focusout":Qe=null;break;case"dragenter":case"dragleave":ut=null;break;case"mouseover":case"mouseout":Gt=null;break;case"pointerover":case"pointerout":kn.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":In.delete(c.pointerId)}}function Fi(s,c,h,b,w,C){return s===null||s.nativeEvent!==C?(s={blockedOn:c,domEventName:h,eventSystemFlags:b,nativeEvent:C,targetContainers:[w]},c!==null&&(c=os(c),c!==null&&Vn(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,w!==null&&c.indexOf(w)===-1&&c.push(w),s)}function ts(s,c,h,b,w){switch(c){case"focusin":return Qe=Fi(Qe,s,c,h,b,w),!0;case"dragenter":return ut=Fi(ut,s,c,h,b,w),!0;case"mouseover":return Gt=Fi(Gt,s,c,h,b,w),!0;case"pointerover":var C=w.pointerId;return kn.set(C,Fi(kn.get(C)||null,s,c,h,b,w)),!0;case"gotpointercapture":return C=w.pointerId,In.set(C,Fi(In.get(C)||null,s,c,h,b,w)),!0}return!1}function wa(s){var c=$i(s.target);if(c!==null){var h=vn(c);if(h!==null){if(c=h.tag,c===13){if(c=vr(h),c!==null){s.blockedOn=c,zr(s.priority,function(){sn(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){s.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Fe(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var h=Cr(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(h===null){h=s.nativeEvent;var b=new h.constructor(h.type,h);zt=b,h.target.dispatchEvent(b),zt=null}else return c=os(h),c!==null&&Vn(c),s.blockedOn=h,!1;c.shift()}return!0}function $(s,c,h){Fe(s)&&h.delete(c)}function de(){na=!1,Qe!==null&&Fe(Qe)&&(Qe=null),ut!==null&&Fe(ut)&&(ut=null),Gt!==null&&Fe(Gt)&&(Gt=null),kn.forEach($),In.forEach($)}function Me(s,c){s.blockedOn===c&&(s.blockedOn=null,na||(na=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,de)))}function Oe(s){function c(w){return Me(w,s)}if(0<ri.length){Me(ri[0],s);for(var h=1;h<ri.length;h++){var b=ri[h];b.blockedOn===s&&(b.blockedOn=null)}}for(Qe!==null&&Me(Qe,s),ut!==null&&Me(ut,s),Gt!==null&&Me(Gt,s),kn.forEach(c),In.forEach(c),h=0;h<Zn.length;h++)b=Zn[h],b.blockedOn===s&&(b.blockedOn=null);for(;0<Zn.length&&(h=Zn[0],h.blockedOn===null);)wa(h),h.blockedOn===null&&Zn.shift()}var Nt=R.ReactCurrentBatchConfig,Ht=!0;function Ue(s,c,h,b){var w=un,C=Nt.transition;Nt.transition=null;try{un=1,Yr(s,c,h,b)}finally{un=w,Nt.transition=C}}function fr(s,c,h,b){var w=un,C=Nt.transition;Nt.transition=null;try{un=4,Yr(s,c,h,b)}finally{un=w,Nt.transition=C}}function Yr(s,c,h,b){if(Ht){var w=Cr(s,c,h,b);if(w===null)pl(s,c,b,mr,h),es(s,b);else if(ts(w,s,c,h,b))b.stopPropagation();else if(es(s,b),c&4&&-1<wi.indexOf(s)){for(;w!==null;){var C=os(w);if(C!==null&&ir(C),C=Cr(s,c,h,b),C===null&&pl(s,c,b,mr,h),C===w)break;w=C}w!==null&&b.stopPropagation()}else pl(s,c,b,null,h)}}var mr=null;function Cr(s,c,h,b){if(mr=null,s=St(b),s=$i(s),s!==null)if(c=vn(s),c===null)s=null;else if(h=c.tag,h===13){if(s=vr(c),s!==null)return s;s=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;s=null}else c!==s&&(s=null);return mr=s,null}function ra(s){switch(s){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(_s()){case pi:return 1;case ea:return 4;case Ba:case je:return 16;case mt:return 536870912;default:return 16}default:return 16}}var sr=null,za=null,Zo=null;function Jo(){if(Zo)return Zo;var s,c=za,h=c.length,b,w="value"in sr?sr.value:sr.textContent,C=w.length;for(s=0;s<h&&c[s]===w[s];s++);var q=h-s;for(b=1;b<=q&&c[h-b]===w[C-b];b++);return Zo=w.slice(s,1<b?1-b:void 0)}function qa(s){var c=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&c===13&&(s=13)):s=c,s===10&&(s=13),32<=s||s===13?s:0}function el(){return!0}function tl(){return!1}function ii(s){function c(h,b,w,C,q){this._reactName=h,this._targetInst=w,this.type=b,this.nativeEvent=C,this.target=q,this.currentTarget=null;for(var ne in s)s.hasOwnProperty(ne)&&(h=s[ne],this[ne]=h?h(C):C[ne]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?el:tl,this.isPropagationStopped=tl,this}return z(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=el)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=el)},persist:function(){},isPersistent:el}),c}var ws={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ao=ii(ws),so=z({},ws,{view:0,detail:0}),Np=ii(so),ns,Jl,Ua,Ss=z({},so,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rc,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Ua&&(Ua&&s.type==="mousemove"?(ns=s.screenX-Ua.screenX,Jl=s.screenY-Ua.screenY):Jl=ns=0,Ua=s),ns)},movementY:function(s){return"movementY"in s?s.movementY:Jl}}),nl=ii(Ss),rl=z({},Ss,{dataTransfer:0}),il=ii(rl),oo=z({},so,{relatedTarget:0}),ia=ii(oo),Bi=z({},ws,{animationName:0,elapsedTime:0,pseudoElement:0}),al=ii(Bi),Es=z({},ws,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Ns=ii(Es),ec=z({},ws,{data:0}),tc=ii(ec),Cp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nc={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"},jp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tp(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=jp[s])?!!c[s]:!1}function rc(){return Tp}var Vu=z({},so,{key:function(s){if(s.key){var c=Cp[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=qa(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?nc[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rc,charCode:function(s){return s.type==="keypress"?qa(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?qa(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),sl=ii(Vu),Gu=z({},Ss,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ku=ii(Gu),ol=z({},so,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rc}),ic=ii(ol),Yu=z({},ws,{propertyName:0,elapsedTime:0,pseudoElement:0}),ac=ii(Yu),sc=z({},Ss,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Qu=ii(sc),oc=[9,13,27,32],lc=u&&"CompositionEvent"in window,lo=null;u&&"documentMode"in document&&(lo=document.documentMode);var Xu=u&&"TextEvent"in window&&!lo,co=u&&(!lc||lo&&8<lo&&11>=lo),rs=" ",cc=!1;function Zu(s,c){switch(s){case"keyup":return oc.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uc(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var aa=!1;function Ju(s,c){switch(s){case"compositionend":return uc(c);case"keypress":return c.which!==32?null:(cc=!0,rs);case"textInput":return s=c.data,s===rs&&cc?null:s;default:return null}}function dc(s,c){if(aa)return s==="compositionend"||!lc&&Zu(s,c)?(s=Jo(),Zo=za=sr=null,aa=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return co&&c.locale!=="ko"?null:c.data;default:return null}}var Rp={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 ll(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!Rp[s.type]:c==="textarea"}function ed(s,c,h,b){re(b),c=hl(c,"onChange"),0<c.length&&(h=new ao("onChange","change",null,h,b),s.push({event:h,listeners:c}))}var is=null,uo=null;function fc(s){dl(s,0)}function cl(s){var c=Ls(s);if(bt(c))return s}function An(s,c){if(s==="change")return c}var td=!1;if(u){var Cs;if(u){var xr="oninput"in document;if(!xr){var nd=document.createElement("div");nd.setAttribute("oninput","return;"),xr=typeof nd.oninput=="function"}Cs=xr}else Cs=!1;td=Cs&&(!document.documentMode||9<document.documentMode)}function pc(){is&&(is.detachEvent("onpropertychange",hc),uo=is=null)}function hc(s){if(s.propertyName==="value"&&cl(uo)){var c=[];ed(c,uo,s,St(s)),lt(fc,c)}}function rd(s,c,h){s==="focusin"?(pc(),is=c,uo=h,is.attachEvent("onpropertychange",hc)):s==="focusout"&&pc()}function id(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return cl(uo)}function ad(s,c){if(s==="click")return cl(c)}function sd(s,c){if(s==="input"||s==="change")return cl(c)}function od(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var Si=typeof Object.is=="function"?Object.is:od;function js(s,c){if(Si(s,c))return!0;if(typeof s!="object"||s===null||typeof c!="object"||c===null)return!1;var h=Object.keys(s),b=Object.keys(c);if(h.length!==b.length)return!1;for(b=0;b<h.length;b++){var w=h[b];if(!d.call(c,w)||!Si(s[w],c[w]))return!1}return!0}function gc(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ft(s,c){var h=gc(s);s=0;for(var b;h;){if(h.nodeType===3){if(b=s+h.textContent.length,s<=c&&b>=c)return{node:h,offset:c-s};s=b}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=gc(h)}}function mc(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?mc(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function ai(){for(var s=window,c=at();c instanceof s.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)s=c.contentWindow;else break;c=at(s.document)}return c}function xc(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c&&(c==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||c==="textarea"||s.contentEditable==="true")}function yc(s){var c=ai(),h=s.focusedElem,b=s.selectionRange;if(c!==h&&h&&h.ownerDocument&&mc(h.ownerDocument.documentElement,h)){if(b!==null&&xc(h)){if(c=b.start,s=b.end,s===void 0&&(s=c),"selectionStart"in h)h.selectionStart=c,h.selectionEnd=Math.min(s,h.value.length);else if(s=(c=h.ownerDocument||document)&&c.defaultView||window,s.getSelection){s=s.getSelection();var w=h.textContent.length,C=Math.min(b.start,w);b=b.end===void 0?C:Math.min(b.end,w),!s.extend&&C>b&&(w=b,b=C,C=w),w=Ft(h,C);var q=Ft(h,b);w&&q&&(s.rangeCount!==1||s.anchorNode!==w.node||s.anchorOffset!==w.offset||s.focusNode!==q.node||s.focusOffset!==q.offset)&&(c=c.createRange(),c.setStart(w.node,w.offset),s.removeAllRanges(),C>b?(s.addRange(c),s.extend(q.node,q.offset)):(c.setEnd(q.node,q.offset),s.addRange(c)))}}for(c=[],s=h;s=s.parentNode;)s.nodeType===1&&c.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<c.length;h++)s=c[h],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var bc=u&&"documentMode"in document&&11>=document.documentMode,zi=null,vc=null,Ei=null,fo=!1;function Ni(s,c,h){var b=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;fo||zi==null||zi!==at(b)||(b=zi,"selectionStart"in b&&xc(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Ei&&js(Ei,b)||(Ei=b,b=hl(vc,"onSelect"),0<b.length&&(c=new ao("onSelect","select",null,c,h),s.push({event:c,listeners:b}),c.target=zi)))}function as(s,c){var h={};return h[s.toLowerCase()]=c.toLowerCase(),h["Webkit"+s]="webkit"+c,h["Moz"+s]="moz"+c,h}var Sa={animationend:as("Animation","AnimationEnd"),animationiteration:as("Animation","AnimationIteration"),animationstart:as("Animation","AnimationStart"),transitionend:as("Transition","TransitionEnd")},Ts={},ld={};u&&(ld=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function po(s){if(Ts[s])return Ts[s];if(!Sa[s])return s;var c=Sa[s],h;for(h in c)if(c.hasOwnProperty(h)&&h in ld)return Ts[s]=c[h];return s}var ho=po("animationend"),ss=po("animationiteration"),cd=po("animationstart"),ul=po("transitionend"),Rs=new Map,ud="abort auxClick 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(" ");function sa(s,c){Rs.set(s,c),o(c,[s])}for(var qi=0;qi<ud.length;qi++){var kc=ud[qi],Ap=kc.toLowerCase(),Ui=kc[0].toUpperCase()+kc.slice(1);sa(Ap,"on"+Ui)}sa(ho,"onAnimationEnd"),sa(ss,"onAnimationIteration"),sa(cd,"onAnimationStart"),sa("dblclick","onDoubleClick"),sa("focusin","onFocus"),sa("focusout","onBlur"),sa(ul,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var go="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(" "),Ip=new Set("cancel close invalid load scroll toggle".split(" ").concat(go));function mo(s,c,h){var b=s.type||"unknown-event";s.currentTarget=h,Et(b,c,void 0,s),s.currentTarget=null}function dl(s,c){c=(c&4)!==0;for(var h=0;h<s.length;h++){var b=s[h],w=b.event;b=b.listeners;e:{var C=void 0;if(c)for(var q=b.length-1;0<=q;q--){var ne=b[q],le=ne.instance,Ee=ne.currentTarget;if(ne=ne.listener,le!==C&&w.isPropagationStopped())break e;mo(w,ne,Ee),C=le}else for(q=0;q<b.length;q++){if(ne=b[q],le=ne.instance,Ee=ne.currentTarget,ne=ne.listener,le!==C&&w.isPropagationStopped())break e;mo(w,ne,Ee),C=le}}}if($e)throw s=Tt,$e=!1,Tt=null,s}function Sn(s,c){var h=c[Cc];h===void 0&&(h=c[Cc]=new Set);var b=s+"__bubble";h.has(b)||(dd(c,s,2,!1),h.add(b))}function _c(s,c,h){var b=0;c&&(b|=4),dd(h,s,b,c)}var fl="_reactListening"+Math.random().toString(36).slice(2);function xo(s){if(!s[fl]){s[fl]=!0,r.forEach(function(h){h!=="selectionchange"&&(Ip.has(h)||_c(h,!1,s),_c(h,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[fl]||(c[fl]=!0,_c("selectionchange",!1,c))}}function dd(s,c,h,b){switch(ra(c)){case 1:var w=Ue;break;case 4:w=fr;break;default:w=Yr}h=w.bind(null,c,h,s),w=void 0,!Ce||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(w=!0),b?w!==void 0?s.addEventListener(c,h,{capture:!0,passive:w}):s.addEventListener(c,h,!0):w!==void 0?s.addEventListener(c,h,{passive:w}):s.addEventListener(c,h,!1)}function pl(s,c,h,b,w){var C=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var q=b.tag;if(q===3||q===4){var ne=b.stateNode.containerInfo;if(ne===w||ne.nodeType===8&&ne.parentNode===w)break;if(q===4)for(q=b.return;q!==null;){var le=q.tag;if((le===3||le===4)&&(le=q.stateNode.containerInfo,le===w||le.nodeType===8&&le.parentNode===w))return;q=q.return}for(;ne!==null;){if(q=$i(ne),q===null)return;if(le=q.tag,le===5||le===6){b=C=q;continue e}ne=ne.parentNode}}b=b.return}lt(function(){var Ee=C,Ze=St(h),it=[];e:{var Ke=Rs.get(s);if(Ke!==void 0){var Ct=ao,At=s;switch(s){case"keypress":if(qa(h)===0)break e;case"keydown":case"keyup":Ct=sl;break;case"focusin":At="focus",Ct=ia;break;case"focusout":At="blur",Ct=ia;break;case"beforeblur":case"afterblur":Ct=ia;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ct=nl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ct=il;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ct=ic;break;case ho:case ss:case cd:Ct=al;break;case ul:Ct=ac;break;case"scroll":Ct=Np;break;case"wheel":Ct=Qu;break;case"copy":case"cut":case"paste":Ct=Ns;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ct=Ku}var Mt=(c&4)!==0,kr=!Mt&&s==="scroll",ve=Mt?Ke!==null?Ke+"Capture":null:Ke;Mt=[];for(var ge=Ee,_e;ge!==null;){_e=ge;var dt=_e.stateNode;if(_e.tag===5&&dt!==null&&(_e=dt,ve!==null&&(dt=ke(ge,ve),dt!=null&&Mt.push(As(ge,dt,_e)))),kr)break;ge=ge.return}0<Mt.length&&(Ke=new Ct(Ke,At,null,h,Ze),it.push({event:Ke,listeners:Mt}))}}if((c&7)===0){e:{if(Ke=s==="mouseover"||s==="pointerover",Ct=s==="mouseout"||s==="pointerout",Ke&&h!==zt&&(At=h.relatedTarget||h.fromElement)&&($i(At)||At[Ea]))break e;if((Ct||Ke)&&(Ke=Ze.window===Ze?Ze:(Ke=Ze.ownerDocument)?Ke.defaultView||Ke.parentWindow:window,Ct?(At=h.relatedTarget||h.toElement,Ct=Ee,At=At?$i(At):null,At!==null&&(kr=vn(At),At!==kr||At.tag!==5&&At.tag!==6)&&(At=null)):(Ct=null,At=Ee),Ct!==At)){if(Mt=nl,dt="onMouseLeave",ve="onMouseEnter",ge="mouse",(s==="pointerout"||s==="pointerover")&&(Mt=Ku,dt="onPointerLeave",ve="onPointerEnter",ge="pointer"),kr=Ct==null?Ke:Ls(Ct),_e=At==null?Ke:Ls(At),Ke=new Mt(dt,ge+"leave",Ct,h,Ze),Ke.target=kr,Ke.relatedTarget=_e,dt=null,$i(Ze)===Ee&&(Mt=new Mt(ve,ge+"enter",At,h,Ze),Mt.target=_e,Mt.relatedTarget=kr,dt=Mt),kr=dt,Ct&&At)t:{for(Mt=Ct,ve=At,ge=0,_e=Mt;_e;_e=Is(_e))ge++;for(_e=0,dt=ve;dt;dt=Is(dt))_e++;for(;0<ge-_e;)Mt=Is(Mt),ge--;for(;0<_e-ge;)ve=Is(ve),_e--;for(;ge--;){if(Mt===ve||ve!==null&&Mt===ve.alternate)break t;Mt=Is(Mt),ve=Is(ve)}Mt=null}else Mt=null;Ct!==null&&fd(it,Ke,Ct,Mt,!1),At!==null&&kr!==null&&fd(it,kr,At,Mt,!0)}}e:{if(Ke=Ee?Ls(Ee):window,Ct=Ke.nodeName&&Ke.nodeName.toLowerCase(),Ct==="select"||Ct==="input"&&Ke.type==="file")var Ot=An;else if(ll(Ke))if(td)Ot=sd;else{Ot=id;var Xt=rd}else(Ct=Ke.nodeName)&&Ct.toLowerCase()==="input"&&(Ke.type==="checkbox"||Ke.type==="radio")&&(Ot=ad);if(Ot&&(Ot=Ot(s,Ee))){ed(it,Ot,h,Ze);break e}Xt&&Xt(s,Ke,Ee),s==="focusout"&&(Xt=Ke._wrapperState)&&Xt.controlled&&Ke.type==="number"&&kt(Ke,"number",Ke.value)}switch(Xt=Ee?Ls(Ee):window,s){case"focusin":(ll(Xt)||Xt.contentEditable==="true")&&(zi=Xt,vc=Ee,Ei=null);break;case"focusout":Ei=vc=zi=null;break;case"mousedown":fo=!0;break;case"contextmenu":case"mouseup":case"dragend":fo=!1,Ni(it,h,Ze);break;case"selectionchange":if(bc)break;case"keydown":case"keyup":Ni(it,h,Ze)}var Zt;if(lc)e:{switch(s){case"compositionstart":var on="onCompositionStart";break e;case"compositionend":on="onCompositionEnd";break e;case"compositionupdate":on="onCompositionUpdate";break e}on=void 0}else aa?Zu(s,h)&&(on="onCompositionEnd"):s==="keydown"&&h.keyCode===229&&(on="onCompositionStart");on&&(co&&h.locale!=="ko"&&(aa||on!=="onCompositionStart"?on==="onCompositionEnd"&&aa&&(Zt=Jo()):(sr=Ze,za="value"in sr?sr.value:sr.textContent,aa=!0)),Xt=hl(Ee,on),0<Xt.length&&(on=new tc(on,s,null,h,Ze),it.push({event:on,listeners:Xt}),Zt?on.data=Zt:(Zt=uc(h),Zt!==null&&(on.data=Zt)))),(Zt=Xu?Ju(s,h):dc(s,h))&&(Ee=hl(Ee,"onBeforeInput"),0<Ee.length&&(Ze=new tc("onBeforeInput","beforeinput",null,h,Ze),it.push({event:Ze,listeners:Ee}),Ze.data=Zt))}dl(it,c)})}function As(s,c,h){return{instance:s,listener:c,currentTarget:h}}function hl(s,c){for(var h=c+"Capture",b=[];s!==null;){var w=s,C=w.stateNode;w.tag===5&&C!==null&&(w=C,C=ke(s,h),C!=null&&b.unshift(As(s,C,w)),C=ke(s,c),C!=null&&b.push(As(s,C,w))),s=s.return}return b}function Is(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function fd(s,c,h,b,w){for(var C=c._reactName,q=[];h!==null&&h!==b;){var ne=h,le=ne.alternate,Ee=ne.stateNode;if(le!==null&&le===b)break;ne.tag===5&&Ee!==null&&(ne=Ee,w?(le=ke(h,C),le!=null&&q.unshift(As(h,le,ne))):w||(le=ke(h,C),le!=null&&q.push(As(h,le,ne)))),h=h.return}q.length!==0&&s.push({event:c,listeners:q})}var Mp=/\r\n?/g,Lp=/\u0000|\uFFFD/g;function pd(s){return(typeof s=="string"?s:""+s).replace(Mp,`
|
|
38
|
-
`).replace(Lp,"")}function yo(s,c,h){if(c=pd(c),pd(s)!==c&&h)throw Error(n(425))}function Ms(){}var gl=null,wc=null;function Sc(s,c){return s==="textarea"||s==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var Ec=typeof setTimeout=="function"?setTimeout:void 0,Op=typeof clearTimeout=="function"?clearTimeout:void 0,hd=typeof Promise=="function"?Promise:void 0,bo=typeof queueMicrotask=="function"?queueMicrotask:typeof hd<"u"?function(s){return hd.resolve(null).then(s).catch(Dp)}:Ec;function Dp(s){setTimeout(function(){throw s})}function Nc(s,c){var h=c,b=0;do{var w=h.nextSibling;if(s.removeChild(h),w&&w.nodeType===8)if(h=w.data,h==="/$"){if(b===0){s.removeChild(w),Oe(c);return}b--}else h!=="$"&&h!=="$?"&&h!=="$!"||b++;h=w}while(h);Oe(c)}function Ci(s){for(;s!=null;s=s.nextSibling){var c=s.nodeType;if(c===1||c===3)break;if(c===8){if(c=s.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return s}function ml(s){s=s.previousSibling;for(var c=0;s;){if(s.nodeType===8){var h=s.data;if(h==="$"||h==="$!"||h==="$?"){if(c===0)return s;c--}else h==="/$"&&c++}s=s.previousSibling}return null}var si=Math.random().toString(36).slice(2),oa="__reactFiber$"+si,vo="__reactProps$"+si,Ea="__reactContainer$"+si,Cc="__reactEvents$"+si,Pp="__reactListeners$"+si,Hi="__reactHandles$"+si;function $i(s){var c=s[oa];if(c)return c;for(var h=s.parentNode;h;){if(c=h[Ea]||h[oa]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(s=ml(s);s!==null;){if(h=s[oa])return h;s=ml(s)}return c}s=h,h=s.parentNode}return null}function os(s){return s=s[oa]||s[Ea],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Ls(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function xl(s){return s[vo]||null}var Ha=[],Os=-1;function la(s){return{current:s}}function Jn(s){0>Os||(s.current=Ha[Os],Ha[Os]=null,Os--)}function Yn(s,c){Os++,Ha[Os]=s.current,s.current=c}var $a={},qr=la($a),Qr=la(!1),ca=$a;function ua(s,c){var h=s.type.contextTypes;if(!h)return $a;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var w={},C;for(C in h)w[C]=c[C];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=w),w}function Ir(s){return s=s.childContextTypes,s!=null}function ko(){Jn(Qr),Jn(qr)}function jc(s,c,h){if(qr.current!==$a)throw Error(n(168));Yn(qr,c),Yn(Qr,h)}function Tc(s,c,h){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return h;b=b.getChildContext();for(var w in b)if(!(w in c))throw Error(n(108,oe(s)||"Unknown",w));return z({},h,b)}function D(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||$a,ca=qr.current,Yn(qr,s),Yn(Qr,Qr.current),!0}function J(s,c,h){var b=s.stateNode;if(!b)throw Error(n(169));h?(s=Tc(s,c,ca),b.__reactInternalMemoizedMergedChildContext=s,Jn(Qr),Jn(qr),Yn(qr,s)):Jn(Qr),Yn(Qr,h)}var ee=null,se=!1,he=!1;function Re(s){ee===null?ee=[s]:ee.push(s)}function Ae(s){se=!0,Re(s)}function _t(){if(!he&&ee!==null){he=!0;var s=0,c=un;try{var h=ee;for(un=1;s<h.length;s++){var b=h[s];do b=b(!0);while(b!==null)}ee=null,se=!1}catch(w){throw ee!==null&&(ee=ee.slice(s+1)),Xn(pi,_t),w}finally{un=c,he=!1}}return null}var tn=[],Mn=0,zn=null,_n=0,ye=[],Z=0,fe=null,we=1,Le="";function He(s,c){tn[Mn++]=_n,tn[Mn++]=zn,zn=s,_n=c}function vt(s,c,h){ye[Z++]=we,ye[Z++]=Le,ye[Z++]=fe,fe=s;var b=we;s=Le;var w=32-Wn(b)-1;b&=~(1<<w),h+=1;var C=32-Wn(c)+w;if(30<C){var q=w-w%5;C=(b&(1<<q)-1).toString(32),b>>=q,w-=q,we=1<<32-Wn(c)+w|h<<w|b,Le=C+s}else we=1<<C|h<<w|b,Le=s}function qt(s){s.return!==null&&(He(s,1),vt(s,1,0))}function Bt(s){for(;s===zn;)zn=tn[--Mn],tn[Mn]=null,_n=tn[--Mn],tn[Mn]=null;for(;s===fe;)fe=ye[--Z],ye[Z]=null,Le=ye[--Z],ye[Z]=null,we=ye[--Z],ye[Z]=null}var Jt=null,En=null,dn=!1,Hn=null;function Gn(s,c){var h=ha(5,null,null,0);h.elementType="DELETED",h.stateNode=c,h.return=s,c=s.deletions,c===null?(s.deletions=[h],s.flags|=16):c.push(h)}function yl(s,c){switch(s.tag){case 5:var h=s.type;return c=c.nodeType!==1||h.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(s.stateNode=c,Jt=s,En=Ci(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,Jt=s,En=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(h=fe!==null?{id:we,overflow:Le}:null,s.memoizedState={dehydrated:c,treeContext:h,retryLane:1073741824},h=ha(18,null,null,0),h.stateNode=c,h.return=s,s.child=h,Jt=s,En=null,!0):!1;default:return!1}}function Ds(s){return(s.mode&1)!==0&&(s.flags&128)===0}function ls(s){if(dn){var c=En;if(c){var h=c;if(!yl(s,c)){if(Ds(s))throw Error(n(418));c=Ci(h.nextSibling);var b=Jt;c&&yl(s,c)?Gn(b,h):(s.flags=s.flags&-4097|2,dn=!1,Jt=s)}}else{if(Ds(s))throw Error(n(418));s.flags=s.flags&-4097|2,dn=!1,Jt=s}}}function gd(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Jt=s}function _o(s){if(s!==Jt)return!1;if(!dn)return gd(s),dn=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!Sc(s.type,s.memoizedProps)),c&&(c=En)){if(Ds(s))throw Rc(),Error(n(418));for(;c;)Gn(s,c),c=Ci(c.nextSibling)}if(gd(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,c=0;s;){if(s.nodeType===8){var h=s.data;if(h==="/$"){if(c===0){En=Ci(s.nextSibling);break e}c--}else h!=="$"&&h!=="$!"&&h!=="$?"||c++}s=s.nextSibling}En=null}}else En=Jt?Ci(s.stateNode.nextSibling):null;return!0}function Rc(){for(var s=En;s;)s=Ci(s.nextSibling)}function Wa(){En=Jt=null,dn=!1}function bl(s){Hn===null?Hn=[s]:Hn.push(s)}var md=R.ReactCurrentBatchConfig;function Ps(s,c,h){if(s=h.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(n(309));var b=h.stateNode}if(!b)throw Error(n(147,s));var w=b,C=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(q){var ne=w.refs;q===null?delete ne[C]:ne[C]=q},c._stringRef=C,c)}if(typeof s!="string")throw Error(n(284));if(!h._owner)throw Error(n(290,s))}return s}function qn(s,c){throw s=Object.prototype.toString.call(c),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Wi(s){var c=s._init;return c(s._payload)}function Mr(s){function c(ve,ge){if(s){var _e=ve.deletions;_e===null?(ve.deletions=[ge],ve.flags|=16):_e.push(ge)}}function h(ve,ge){if(!s)return null;for(;ge!==null;)c(ve,ge),ge=ge.sibling;return null}function b(ve,ge){for(ve=new Map;ge!==null;)ge.key!==null?ve.set(ge.key,ge):ve.set(ge.index,ge),ge=ge.sibling;return ve}function w(ve,ge){return ve=Ws(ve,ge),ve.index=0,ve.sibling=null,ve}function C(ve,ge,_e){return ve.index=_e,s?(_e=ve.alternate,_e!==null?(_e=_e.index,_e<ge?(ve.flags|=2,ge):_e):(ve.flags|=2,ge)):(ve.flags|=1048576,ge)}function q(ve){return s&&ve.alternate===null&&(ve.flags|=2),ve}function ne(ve,ge,_e,dt){return ge===null||ge.tag!==6?(ge=jh(_e,ve.mode,dt),ge.return=ve,ge):(ge=w(ge,_e),ge.return=ve,ge)}function le(ve,ge,_e,dt){var Ot=_e.type;return Ot===I?Ze(ve,ge,_e.props.children,dt,_e.key):ge!==null&&(ge.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===K&&Wi(Ot)===ge.type)?(dt=w(ge,_e.props),dt.ref=Ps(ve,ge,_e),dt.return=ve,dt):(dt=qd(_e.type,_e.key,_e.props,null,ve.mode,dt),dt.ref=Ps(ve,ge,_e),dt.return=ve,dt)}function Ee(ve,ge,_e,dt){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==_e.containerInfo||ge.stateNode.implementation!==_e.implementation?(ge=Th(_e,ve.mode,dt),ge.return=ve,ge):(ge=w(ge,_e.children||[]),ge.return=ve,ge)}function Ze(ve,ge,_e,dt,Ot){return ge===null||ge.tag!==7?(ge=Ro(_e,ve.mode,dt,Ot),ge.return=ve,ge):(ge=w(ge,_e),ge.return=ve,ge)}function it(ve,ge,_e){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return ge=jh(""+ge,ve.mode,_e),ge.return=ve,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case T:return _e=qd(ge.type,ge.key,ge.props,null,ve.mode,_e),_e.ref=Ps(ve,null,ge),_e.return=ve,_e;case j:return ge=Th(ge,ve.mode,_e),ge.return=ve,ge;case K:var dt=ge._init;return it(ve,dt(ge._payload),_e)}if(Kt(ge)||ce(ge))return ge=Ro(ge,ve.mode,_e,null),ge.return=ve,ge;qn(ve,ge)}return null}function Ke(ve,ge,_e,dt){var Ot=ge!==null?ge.key:null;if(typeof _e=="string"&&_e!==""||typeof _e=="number")return Ot!==null?null:ne(ve,ge,""+_e,dt);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case T:return _e.key===Ot?le(ve,ge,_e,dt):null;case j:return _e.key===Ot?Ee(ve,ge,_e,dt):null;case K:return Ot=_e._init,Ke(ve,ge,Ot(_e._payload),dt)}if(Kt(_e)||ce(_e))return Ot!==null?null:Ze(ve,ge,_e,dt,null);qn(ve,_e)}return null}function Ct(ve,ge,_e,dt,Ot){if(typeof dt=="string"&&dt!==""||typeof dt=="number")return ve=ve.get(_e)||null,ne(ge,ve,""+dt,Ot);if(typeof dt=="object"&&dt!==null){switch(dt.$$typeof){case T:return ve=ve.get(dt.key===null?_e:dt.key)||null,le(ge,ve,dt,Ot);case j:return ve=ve.get(dt.key===null?_e:dt.key)||null,Ee(ge,ve,dt,Ot);case K:var Xt=dt._init;return Ct(ve,ge,_e,Xt(dt._payload),Ot)}if(Kt(dt)||ce(dt))return ve=ve.get(_e)||null,Ze(ge,ve,dt,Ot,null);qn(ge,dt)}return null}function At(ve,ge,_e,dt){for(var Ot=null,Xt=null,Zt=ge,on=ge=0,$r=null;Zt!==null&&on<_e.length;on++){Zt.index>on?($r=Zt,Zt=null):$r=Zt.sibling;var Pn=Ke(ve,Zt,_e[on],dt);if(Pn===null){Zt===null&&(Zt=$r);break}s&&Zt&&Pn.alternate===null&&c(ve,Zt),ge=C(Pn,ge,on),Xt===null?Ot=Pn:Xt.sibling=Pn,Xt=Pn,Zt=$r}if(on===_e.length)return h(ve,Zt),dn&&He(ve,on),Ot;if(Zt===null){for(;on<_e.length;on++)Zt=it(ve,_e[on],dt),Zt!==null&&(ge=C(Zt,ge,on),Xt===null?Ot=Zt:Xt.sibling=Zt,Xt=Zt);return dn&&He(ve,on),Ot}for(Zt=b(ve,Zt);on<_e.length;on++)$r=Ct(Zt,ve,on,_e[on],dt),$r!==null&&(s&&$r.alternate!==null&&Zt.delete($r.key===null?on:$r.key),ge=C($r,ge,on),Xt===null?Ot=$r:Xt.sibling=$r,Xt=$r);return s&&Zt.forEach(function(Vs){return c(ve,Vs)}),dn&&He(ve,on),Ot}function Mt(ve,ge,_e,dt){var Ot=ce(_e);if(typeof Ot!="function")throw Error(n(150));if(_e=Ot.call(_e),_e==null)throw Error(n(151));for(var Xt=Ot=null,Zt=ge,on=ge=0,$r=null,Pn=_e.next();Zt!==null&&!Pn.done;on++,Pn=_e.next()){Zt.index>on?($r=Zt,Zt=null):$r=Zt.sibling;var Vs=Ke(ve,Zt,Pn.value,dt);if(Vs===null){Zt===null&&(Zt=$r);break}s&&Zt&&Vs.alternate===null&&c(ve,Zt),ge=C(Vs,ge,on),Xt===null?Ot=Vs:Xt.sibling=Vs,Xt=Vs,Zt=$r}if(Pn.done)return h(ve,Zt),dn&&He(ve,on),Ot;if(Zt===null){for(;!Pn.done;on++,Pn=_e.next())Pn=it(ve,Pn.value,dt),Pn!==null&&(ge=C(Pn,ge,on),Xt===null?Ot=Pn:Xt.sibling=Pn,Xt=Pn);return dn&&He(ve,on),Ot}for(Zt=b(ve,Zt);!Pn.done;on++,Pn=_e.next())Pn=Ct(Zt,ve,on,Pn.value,dt),Pn!==null&&(s&&Pn.alternate!==null&&Zt.delete(Pn.key===null?on:Pn.key),ge=C(Pn,ge,on),Xt===null?Ot=Pn:Xt.sibling=Pn,Xt=Pn);return s&&Zt.forEach(function(YI){return c(ve,YI)}),dn&&He(ve,on),Ot}function kr(ve,ge,_e,dt){if(typeof _e=="object"&&_e!==null&&_e.type===I&&_e.key===null&&(_e=_e.props.children),typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case T:e:{for(var Ot=_e.key,Xt=ge;Xt!==null;){if(Xt.key===Ot){if(Ot=_e.type,Ot===I){if(Xt.tag===7){h(ve,Xt.sibling),ge=w(Xt,_e.props.children),ge.return=ve,ve=ge;break e}}else if(Xt.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===K&&Wi(Ot)===Xt.type){h(ve,Xt.sibling),ge=w(Xt,_e.props),ge.ref=Ps(ve,Xt,_e),ge.return=ve,ve=ge;break e}h(ve,Xt);break}else c(ve,Xt);Xt=Xt.sibling}_e.type===I?(ge=Ro(_e.props.children,ve.mode,dt,_e.key),ge.return=ve,ve=ge):(dt=qd(_e.type,_e.key,_e.props,null,ve.mode,dt),dt.ref=Ps(ve,ge,_e),dt.return=ve,ve=dt)}return q(ve);case j:e:{for(Xt=_e.key;ge!==null;){if(ge.key===Xt)if(ge.tag===4&&ge.stateNode.containerInfo===_e.containerInfo&&ge.stateNode.implementation===_e.implementation){h(ve,ge.sibling),ge=w(ge,_e.children||[]),ge.return=ve,ve=ge;break e}else{h(ve,ge);break}else c(ve,ge);ge=ge.sibling}ge=Th(_e,ve.mode,dt),ge.return=ve,ve=ge}return q(ve);case K:return Xt=_e._init,kr(ve,ge,Xt(_e._payload),dt)}if(Kt(_e))return At(ve,ge,_e,dt);if(ce(_e))return Mt(ve,ge,_e,dt);qn(ve,_e)}return typeof _e=="string"&&_e!==""||typeof _e=="number"?(_e=""+_e,ge!==null&&ge.tag===6?(h(ve,ge.sibling),ge=w(ge,_e),ge.return=ve,ve=ge):(h(ve,ge),ge=jh(_e,ve.mode,dt),ge.return=ve,ve=ge),q(ve)):h(ve,ge)}return kr}var yr=Mr(!0),xd=Mr(!1),yd=la(null),bd=null,vl=null,Fp=null;function Bp(){Fp=vl=bd=null}function zp(s){var c=yd.current;Jn(yd),s._currentValue=c}function qp(s,c,h){for(;s!==null;){var b=s.alternate;if((s.childLanes&c)!==c?(s.childLanes|=c,b!==null&&(b.childLanes|=c)):b!==null&&(b.childLanes&c)!==c&&(b.childLanes|=c),s===h)break;s=s.return}}function kl(s,c){bd=s,Fp=vl=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(ji=!0),s.firstContext=null)}function da(s){var c=s._currentValue;if(Fp!==s)if(s={context:s,memoizedValue:c,next:null},vl===null){if(bd===null)throw Error(n(308));vl=s,bd.dependencies={lanes:0,firstContext:s}}else vl=vl.next=s;return c}var wo=null;function Up(s){wo===null?wo=[s]:wo.push(s)}function s1(s,c,h,b){var w=c.interleaved;return w===null?(h.next=h,Up(c)):(h.next=w.next,w.next=h),c.interleaved=h,cs(s,b)}function cs(s,c){s.lanes|=c;var h=s.alternate;for(h!==null&&(h.lanes|=c),h=s,s=s.return;s!==null;)s.childLanes|=c,h=s.alternate,h!==null&&(h.childLanes|=c),h=s,s=s.return;return h.tag===3?h.stateNode:null}var Fs=!1;function Hp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function o1(s,c){s=s.updateQueue,c.updateQueue===s&&(c.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function us(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function Bs(s,c,h){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(On&2)!==0){var w=b.pending;return w===null?c.next=c:(c.next=w.next,w.next=c),b.pending=c,cs(s,h)}return w=b.interleaved,w===null?(c.next=c,Up(b)):(c.next=w.next,w.next=c),b.interleaved=c,cs(s,h)}function vd(s,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194240)!==0)){var b=c.lanes;b&=s.pendingLanes,h|=b,c.lanes=h,Kr(s,h)}}function l1(s,c){var h=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,h===b)){var w=null,C=null;if(h=h.firstBaseUpdate,h!==null){do{var q={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};C===null?w=C=q:C=C.next=q,h=h.next}while(h!==null);C===null?w=C=c:C=C.next=c}else w=C=c;h={baseState:b.baseState,firstBaseUpdate:w,lastBaseUpdate:C,shared:b.shared,effects:b.effects},s.updateQueue=h;return}s=h.lastBaseUpdate,s===null?h.firstBaseUpdate=c:s.next=c,h.lastBaseUpdate=c}function kd(s,c,h,b){var w=s.updateQueue;Fs=!1;var C=w.firstBaseUpdate,q=w.lastBaseUpdate,ne=w.shared.pending;if(ne!==null){w.shared.pending=null;var le=ne,Ee=le.next;le.next=null,q===null?C=Ee:q.next=Ee,q=le;var Ze=s.alternate;Ze!==null&&(Ze=Ze.updateQueue,ne=Ze.lastBaseUpdate,ne!==q&&(ne===null?Ze.firstBaseUpdate=Ee:ne.next=Ee,Ze.lastBaseUpdate=le))}if(C!==null){var it=w.baseState;q=0,Ze=Ee=le=null,ne=C;do{var Ke=ne.lane,Ct=ne.eventTime;if((b&Ke)===Ke){Ze!==null&&(Ze=Ze.next={eventTime:Ct,lane:0,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null});e:{var At=s,Mt=ne;switch(Ke=c,Ct=h,Mt.tag){case 1:if(At=Mt.payload,typeof At=="function"){it=At.call(Ct,it,Ke);break e}it=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=Mt.payload,Ke=typeof At=="function"?At.call(Ct,it,Ke):At,Ke==null)break e;it=z({},it,Ke);break e;case 2:Fs=!0}}ne.callback!==null&&ne.lane!==0&&(s.flags|=64,Ke=w.effects,Ke===null?w.effects=[ne]:Ke.push(ne))}else Ct={eventTime:Ct,lane:Ke,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null},Ze===null?(Ee=Ze=Ct,le=it):Ze=Ze.next=Ct,q|=Ke;if(ne=ne.next,ne===null){if(ne=w.shared.pending,ne===null)break;Ke=ne,ne=Ke.next,Ke.next=null,w.lastBaseUpdate=Ke,w.shared.pending=null}}while(!0);if(Ze===null&&(le=it),w.baseState=le,w.firstBaseUpdate=Ee,w.lastBaseUpdate=Ze,c=w.shared.interleaved,c!==null){w=c;do q|=w.lane,w=w.next;while(w!==c)}else C===null&&(w.shared.lanes=0);No|=q,s.lanes=q,s.memoizedState=it}}function c1(s,c,h){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],w=b.callback;if(w!==null){if(b.callback=null,b=h,typeof w!="function")throw Error(n(191,w));w.call(b)}}}var Ac={},Va=la(Ac),Ic=la(Ac),Mc=la(Ac);function So(s){if(s===Ac)throw Error(n(174));return s}function $p(s,c){switch(Yn(Mc,c),Yn(Ic,s),Yn(Va,Ac),s=c.nodeType,s){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:ue(null,"");break;default:s=s===8?c.parentNode:c,c=s.namespaceURI||null,s=s.tagName,c=ue(c,s)}Jn(Va),Yn(Va,c)}function _l(){Jn(Va),Jn(Ic),Jn(Mc)}function u1(s){So(Mc.current);var c=So(Va.current),h=ue(c,s.type);c!==h&&(Yn(Ic,s),Yn(Va,h))}function Wp(s){Ic.current===s&&(Jn(Va),Jn(Ic))}var pr=la(0);function _d(s){for(var c=s;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===s)break;for(;c.sibling===null;){if(c.return===null||c.return===s)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Vp=[];function Gp(){for(var s=0;s<Vp.length;s++)Vp[s]._workInProgressVersionPrimary=null;Vp.length=0}var wd=R.ReactCurrentDispatcher,Kp=R.ReactCurrentBatchConfig,Eo=0,hr=null,Lr=null,Ur=null,Sd=!1,Lc=!1,Oc=0,xI=0;function oi(){throw Error(n(321))}function Yp(s,c){if(c===null)return!1;for(var h=0;h<c.length&&h<s.length;h++)if(!Si(s[h],c[h]))return!1;return!0}function Qp(s,c,h,b,w,C){if(Eo=C,hr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,wd.current=s===null||s.memoizedState===null?kI:_I,s=h(b,w),Lc){C=0;do{if(Lc=!1,Oc=0,25<=C)throw Error(n(301));C+=1,Ur=Lr=null,c.updateQueue=null,wd.current=wI,s=h(b,w)}while(Lc)}if(wd.current=Cd,c=Lr!==null&&Lr.next!==null,Eo=0,Ur=Lr=hr=null,Sd=!1,c)throw Error(n(300));return s}function Xp(){var s=Oc!==0;return Oc=0,s}function Ga(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?hr.memoizedState=Ur=s:Ur=Ur.next=s,Ur}function fa(){if(Lr===null){var s=hr.alternate;s=s!==null?s.memoizedState:null}else s=Lr.next;var c=Ur===null?hr.memoizedState:Ur.next;if(c!==null)Ur=c,Lr=s;else{if(s===null)throw Error(n(310));Lr=s,s={memoizedState:Lr.memoizedState,baseState:Lr.baseState,baseQueue:Lr.baseQueue,queue:Lr.queue,next:null},Ur===null?hr.memoizedState=Ur=s:Ur=Ur.next=s}return Ur}function Dc(s,c){return typeof c=="function"?c(s):c}function Zp(s){var c=fa(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=s;var b=Lr,w=b.baseQueue,C=h.pending;if(C!==null){if(w!==null){var q=w.next;w.next=C.next,C.next=q}b.baseQueue=w=C,h.pending=null}if(w!==null){C=w.next,b=b.baseState;var ne=q=null,le=null,Ee=C;do{var Ze=Ee.lane;if((Eo&Ze)===Ze)le!==null&&(le=le.next={lane:0,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),b=Ee.hasEagerState?Ee.eagerState:s(b,Ee.action);else{var it={lane:Ze,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null};le===null?(ne=le=it,q=b):le=le.next=it,hr.lanes|=Ze,No|=Ze}Ee=Ee.next}while(Ee!==null&&Ee!==C);le===null?q=b:le.next=ne,Si(b,c.memoizedState)||(ji=!0),c.memoizedState=b,c.baseState=q,c.baseQueue=le,h.lastRenderedState=b}if(s=h.interleaved,s!==null){w=s;do C=w.lane,hr.lanes|=C,No|=C,w=w.next;while(w!==s)}else w===null&&(h.lanes=0);return[c.memoizedState,h.dispatch]}function Jp(s){var c=fa(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=s;var b=h.dispatch,w=h.pending,C=c.memoizedState;if(w!==null){h.pending=null;var q=w=w.next;do C=s(C,q.action),q=q.next;while(q!==w);Si(C,c.memoizedState)||(ji=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),h.lastRenderedState=C}return[C,b]}function d1(){}function f1(s,c){var h=hr,b=fa(),w=c(),C=!Si(b.memoizedState,w);if(C&&(b.memoizedState=w,ji=!0),b=b.queue,eh(g1.bind(null,h,b,s),[s]),b.getSnapshot!==c||C||Ur!==null&&Ur.memoizedState.tag&1){if(h.flags|=2048,Pc(9,h1.bind(null,h,b,w,c),void 0,null),Hr===null)throw Error(n(349));(Eo&30)!==0||p1(h,c,w)}return w}function p1(s,c,h){s.flags|=16384,s={getSnapshot:c,value:h},c=hr.updateQueue,c===null?(c={lastEffect:null,stores:null},hr.updateQueue=c,c.stores=[s]):(h=c.stores,h===null?c.stores=[s]:h.push(s))}function h1(s,c,h,b){c.value=h,c.getSnapshot=b,m1(c)&&x1(s)}function g1(s,c,h){return h(function(){m1(c)&&x1(s)})}function m1(s){var c=s.getSnapshot;s=s.value;try{var h=c();return!Si(s,h)}catch{return!0}}function x1(s){var c=cs(s,1);c!==null&&Ta(c,s,1,-1)}function y1(s){var c=Ga();return typeof s=="function"&&(s=s()),c.memoizedState=c.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Dc,lastRenderedState:s},c.queue=s,s=s.dispatch=vI.bind(null,hr,s),[c.memoizedState,s]}function Pc(s,c,h,b){return s={tag:s,create:c,destroy:h,deps:b,next:null},c=hr.updateQueue,c===null?(c={lastEffect:null,stores:null},hr.updateQueue=c,c.lastEffect=s.next=s):(h=c.lastEffect,h===null?c.lastEffect=s.next=s:(b=h.next,h.next=s,s.next=b,c.lastEffect=s)),s}function b1(){return fa().memoizedState}function Ed(s,c,h,b){var w=Ga();hr.flags|=s,w.memoizedState=Pc(1|c,h,void 0,b===void 0?null:b)}function Nd(s,c,h,b){var w=fa();b=b===void 0?null:b;var C=void 0;if(Lr!==null){var q=Lr.memoizedState;if(C=q.destroy,b!==null&&Yp(b,q.deps)){w.memoizedState=Pc(c,h,C,b);return}}hr.flags|=s,w.memoizedState=Pc(1|c,h,C,b)}function v1(s,c){return Ed(8390656,8,s,c)}function eh(s,c){return Nd(2048,8,s,c)}function k1(s,c){return Nd(4,2,s,c)}function _1(s,c){return Nd(4,4,s,c)}function w1(s,c){if(typeof c=="function")return s=s(),c(s),function(){c(null)};if(c!=null)return s=s(),c.current=s,function(){c.current=null}}function S1(s,c,h){return h=h!=null?h.concat([s]):null,Nd(4,4,w1.bind(null,c,s),h)}function th(){}function E1(s,c){var h=fa();c=c===void 0?null:c;var b=h.memoizedState;return b!==null&&c!==null&&Yp(c,b[1])?b[0]:(h.memoizedState=[s,c],s)}function N1(s,c){var h=fa();c=c===void 0?null:c;var b=h.memoizedState;return b!==null&&c!==null&&Yp(c,b[1])?b[0]:(s=s(),h.memoizedState=[s,c],s)}function C1(s,c,h){return(Eo&21)===0?(s.baseState&&(s.baseState=!1,ji=!0),s.memoizedState=h):(Si(h,c)||(h=_a(),hr.lanes|=h,No|=h,s.baseState=!0),c)}function yI(s,c){var h=un;un=h!==0&&4>h?h:4,s(!0);var b=Kp.transition;Kp.transition={};try{s(!1),c()}finally{un=h,Kp.transition=b}}function j1(){return fa().memoizedState}function bI(s,c,h){var b=Hs(s);if(h={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null},T1(s))R1(c,h);else if(h=s1(s,c,h,b),h!==null){var w=xi();Ta(h,s,b,w),A1(h,c,b)}}function vI(s,c,h){var b=Hs(s),w={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null};if(T1(s))R1(c,w);else{var C=s.alternate;if(s.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var q=c.lastRenderedState,ne=C(q,h);if(w.hasEagerState=!0,w.eagerState=ne,Si(ne,q)){var le=c.interleaved;le===null?(w.next=w,Up(c)):(w.next=le.next,le.next=w),c.interleaved=w;return}}catch{}finally{}h=s1(s,c,w,b),h!==null&&(w=xi(),Ta(h,s,b,w),A1(h,c,b))}}function T1(s){var c=s.alternate;return s===hr||c!==null&&c===hr}function R1(s,c){Lc=Sd=!0;var h=s.pending;h===null?c.next=c:(c.next=h.next,h.next=c),s.pending=c}function A1(s,c,h){if((h&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,h|=b,c.lanes=h,Kr(s,h)}}var Cd={readContext:da,useCallback:oi,useContext:oi,useEffect:oi,useImperativeHandle:oi,useInsertionEffect:oi,useLayoutEffect:oi,useMemo:oi,useReducer:oi,useRef:oi,useState:oi,useDebugValue:oi,useDeferredValue:oi,useTransition:oi,useMutableSource:oi,useSyncExternalStore:oi,useId:oi,unstable_isNewReconciler:!1},kI={readContext:da,useCallback:function(s,c){return Ga().memoizedState=[s,c===void 0?null:c],s},useContext:da,useEffect:v1,useImperativeHandle:function(s,c,h){return h=h!=null?h.concat([s]):null,Ed(4194308,4,w1.bind(null,c,s),h)},useLayoutEffect:function(s,c){return Ed(4194308,4,s,c)},useInsertionEffect:function(s,c){return Ed(4,2,s,c)},useMemo:function(s,c){var h=Ga();return c=c===void 0?null:c,s=s(),h.memoizedState=[s,c],s},useReducer:function(s,c,h){var b=Ga();return c=h!==void 0?h(c):c,b.memoizedState=b.baseState=c,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},b.queue=s,s=s.dispatch=bI.bind(null,hr,s),[b.memoizedState,s]},useRef:function(s){var c=Ga();return s={current:s},c.memoizedState=s},useState:y1,useDebugValue:th,useDeferredValue:function(s){return Ga().memoizedState=s},useTransition:function(){var s=y1(!1),c=s[0];return s=yI.bind(null,s[1]),Ga().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,h){var b=hr,w=Ga();if(dn){if(h===void 0)throw Error(n(407));h=h()}else{if(h=c(),Hr===null)throw Error(n(349));(Eo&30)!==0||p1(b,c,h)}w.memoizedState=h;var C={value:h,getSnapshot:c};return w.queue=C,v1(g1.bind(null,b,C,s),[s]),b.flags|=2048,Pc(9,h1.bind(null,b,C,h,c),void 0,null),h},useId:function(){var s=Ga(),c=Hr.identifierPrefix;if(dn){var h=Le,b=we;h=(b&~(1<<32-Wn(b)-1)).toString(32)+h,c=":"+c+"R"+h,h=Oc++,0<h&&(c+="H"+h.toString(32)),c+=":"}else h=xI++,c=":"+c+"r"+h.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},_I={readContext:da,useCallback:E1,useContext:da,useEffect:eh,useImperativeHandle:S1,useInsertionEffect:k1,useLayoutEffect:_1,useMemo:N1,useReducer:Zp,useRef:b1,useState:function(){return Zp(Dc)},useDebugValue:th,useDeferredValue:function(s){var c=fa();return C1(c,Lr.memoizedState,s)},useTransition:function(){var s=Zp(Dc)[0],c=fa().memoizedState;return[s,c]},useMutableSource:d1,useSyncExternalStore:f1,useId:j1,unstable_isNewReconciler:!1},wI={readContext:da,useCallback:E1,useContext:da,useEffect:eh,useImperativeHandle:S1,useInsertionEffect:k1,useLayoutEffect:_1,useMemo:N1,useReducer:Jp,useRef:b1,useState:function(){return Jp(Dc)},useDebugValue:th,useDeferredValue:function(s){var c=fa();return Lr===null?c.memoizedState=s:C1(c,Lr.memoizedState,s)},useTransition:function(){var s=Jp(Dc)[0],c=fa().memoizedState;return[s,c]},useMutableSource:d1,useSyncExternalStore:f1,useId:j1,unstable_isNewReconciler:!1};function Na(s,c){if(s&&s.defaultProps){c=z({},c),s=s.defaultProps;for(var h in s)c[h]===void 0&&(c[h]=s[h]);return c}return c}function nh(s,c,h,b){c=s.memoizedState,h=h(b,c),h=h==null?c:z({},c,h),s.memoizedState=h,s.lanes===0&&(s.updateQueue.baseState=h)}var jd={isMounted:function(s){return(s=s._reactInternals)?vn(s)===s:!1},enqueueSetState:function(s,c,h){s=s._reactInternals;var b=xi(),w=Hs(s),C=us(b,w);C.payload=c,h!=null&&(C.callback=h),c=Bs(s,C,w),c!==null&&(Ta(c,s,w,b),vd(c,s,w))},enqueueReplaceState:function(s,c,h){s=s._reactInternals;var b=xi(),w=Hs(s),C=us(b,w);C.tag=1,C.payload=c,h!=null&&(C.callback=h),c=Bs(s,C,w),c!==null&&(Ta(c,s,w,b),vd(c,s,w))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var h=xi(),b=Hs(s),w=us(h,b);w.tag=2,c!=null&&(w.callback=c),c=Bs(s,w,b),c!==null&&(Ta(c,s,b,h),vd(c,s,b))}};function I1(s,c,h,b,w,C,q){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,C,q):c.prototype&&c.prototype.isPureReactComponent?!js(h,b)||!js(w,C):!0}function M1(s,c,h){var b=!1,w=$a,C=c.contextType;return typeof C=="object"&&C!==null?C=da(C):(w=Ir(c)?ca:qr.current,b=c.contextTypes,C=(b=b!=null)?ua(s,w):$a),c=new c(h,C),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=jd,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=w,s.__reactInternalMemoizedMaskedChildContext=C),c}function L1(s,c,h,b){s=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,b),c.state!==s&&jd.enqueueReplaceState(c,c.state,null)}function rh(s,c,h,b){var w=s.stateNode;w.props=h,w.state=s.memoizedState,w.refs={},Hp(s);var C=c.contextType;typeof C=="object"&&C!==null?w.context=da(C):(C=Ir(c)?ca:qr.current,w.context=ua(s,C)),w.state=s.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(nh(s,c,C,h),w.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(c=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),c!==w.state&&jd.enqueueReplaceState(w,w.state,null),kd(s,h,w,b),w.state=s.memoizedState),typeof w.componentDidMount=="function"&&(s.flags|=4194308)}function wl(s,c){try{var h="",b=c;do h+=V(b),b=b.return;while(b);var w=h}catch(C){w=`
|
|
39
|
-
Error generating stack: `+C.message+`
|
|
40
|
-
`+C.stack}return{value:s,source:c,stack:w,digest:null}}function ih(s,c,h){return{value:s,source:null,stack:h??null,digest:c??null}}function ah(s,c){try{console.error(c.value)}catch(h){setTimeout(function(){throw h})}}var SI=typeof WeakMap=="function"?WeakMap:Map;function O1(s,c,h){h=us(-1,h),h.tag=3,h.payload={element:null};var b=c.value;return h.callback=function(){Od||(Od=!0,vh=b),ah(s,c)},h}function D1(s,c,h){h=us(-1,h),h.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var w=c.value;h.payload=function(){return b(w)},h.callback=function(){ah(s,c)}}var C=s.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(h.callback=function(){ah(s,c),typeof b!="function"&&(qs===null?qs=new Set([this]):qs.add(this));var q=c.stack;this.componentDidCatch(c.value,{componentStack:q!==null?q:""})}),h}function P1(s,c,h){var b=s.pingCache;if(b===null){b=s.pingCache=new SI;var w=new Set;b.set(c,w)}else w=b.get(c),w===void 0&&(w=new Set,b.set(c,w));w.has(h)||(w.add(h),s=FI.bind(null,s,c,h),c.then(s,s))}function F1(s){do{var c;if((c=s.tag===13)&&(c=s.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return s;s=s.return}while(s!==null);return null}function B1(s,c,h,b,w){return(s.mode&1)===0?(s===c?s.flags|=65536:(s.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(c=us(-1,1),c.tag=2,Bs(h,c,1))),h.lanes|=1),s):(s.flags|=65536,s.lanes=w,s)}var EI=R.ReactCurrentOwner,ji=!1;function mi(s,c,h,b){c.child=s===null?xd(c,null,h,b):yr(c,s.child,h,b)}function z1(s,c,h,b,w){h=h.render;var C=c.ref;return kl(c,w),b=Qp(s,c,h,b,C,w),h=Xp(),s!==null&&!ji?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~w,ds(s,c,w)):(dn&&h&&qt(c),c.flags|=1,mi(s,c,b,w),c.child)}function q1(s,c,h,b,w){if(s===null){var C=h.type;return typeof C=="function"&&!Ch(C)&&C.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(c.tag=15,c.type=C,U1(s,c,C,b,w)):(s=qd(h.type,null,b,c,c.mode,w),s.ref=c.ref,s.return=c,c.child=s)}if(C=s.child,(s.lanes&w)===0){var q=C.memoizedProps;if(h=h.compare,h=h!==null?h:js,h(q,b)&&s.ref===c.ref)return ds(s,c,w)}return c.flags|=1,s=Ws(C,b),s.ref=c.ref,s.return=c,c.child=s}function U1(s,c,h,b,w){if(s!==null){var C=s.memoizedProps;if(js(C,b)&&s.ref===c.ref)if(ji=!1,c.pendingProps=b=C,(s.lanes&w)!==0)(s.flags&131072)!==0&&(ji=!0);else return c.lanes=s.lanes,ds(s,c,w)}return sh(s,c,h,b,w)}function H1(s,c,h){var b=c.pendingProps,w=b.children,C=s!==null?s.memoizedState:null;if(b.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Yn(El,Vi),Vi|=h;else{if((h&1073741824)===0)return s=C!==null?C.baseLanes|h:h,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,Yn(El,Vi),Vi|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=C!==null?C.baseLanes:h,Yn(El,Vi),Vi|=b}else C!==null?(b=C.baseLanes|h,c.memoizedState=null):b=h,Yn(El,Vi),Vi|=b;return mi(s,c,w,h),c.child}function $1(s,c){var h=c.ref;(s===null&&h!==null||s!==null&&s.ref!==h)&&(c.flags|=512,c.flags|=2097152)}function sh(s,c,h,b,w){var C=Ir(h)?ca:qr.current;return C=ua(c,C),kl(c,w),h=Qp(s,c,h,b,C,w),b=Xp(),s!==null&&!ji?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~w,ds(s,c,w)):(dn&&b&&qt(c),c.flags|=1,mi(s,c,h,w),c.child)}function W1(s,c,h,b,w){if(Ir(h)){var C=!0;D(c)}else C=!1;if(kl(c,w),c.stateNode===null)Rd(s,c),M1(c,h,b),rh(c,h,b,w),b=!0;else if(s===null){var q=c.stateNode,ne=c.memoizedProps;q.props=ne;var le=q.context,Ee=h.contextType;typeof Ee=="object"&&Ee!==null?Ee=da(Ee):(Ee=Ir(h)?ca:qr.current,Ee=ua(c,Ee));var Ze=h.getDerivedStateFromProps,it=typeof Ze=="function"||typeof q.getSnapshotBeforeUpdate=="function";it||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(ne!==b||le!==Ee)&&L1(c,q,b,Ee),Fs=!1;var Ke=c.memoizedState;q.state=Ke,kd(c,b,q,w),le=c.memoizedState,ne!==b||Ke!==le||Qr.current||Fs?(typeof Ze=="function"&&(nh(c,h,Ze,b),le=c.memoizedState),(ne=Fs||I1(c,h,ne,b,Ke,le,Ee))?(it||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(c.flags|=4194308)):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=le),q.props=b,q.state=le,q.context=Ee,b=ne):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{q=c.stateNode,o1(s,c),ne=c.memoizedProps,Ee=c.type===c.elementType?ne:Na(c.type,ne),q.props=Ee,it=c.pendingProps,Ke=q.context,le=h.contextType,typeof le=="object"&&le!==null?le=da(le):(le=Ir(h)?ca:qr.current,le=ua(c,le));var Ct=h.getDerivedStateFromProps;(Ze=typeof Ct=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(ne!==it||Ke!==le)&&L1(c,q,b,le),Fs=!1,Ke=c.memoizedState,q.state=Ke,kd(c,b,q,w);var At=c.memoizedState;ne!==it||Ke!==At||Qr.current||Fs?(typeof Ct=="function"&&(nh(c,h,Ct,b),At=c.memoizedState),(Ee=Fs||I1(c,h,Ee,b,Ke,At,le)||!1)?(Ze||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(b,At,le),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(b,At,le)),typeof q.componentDidUpdate=="function"&&(c.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof q.componentDidUpdate!="function"||ne===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||ne===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=At),q.props=b,q.state=At,q.context=le,b=Ee):(typeof q.componentDidUpdate!="function"||ne===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||ne===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=1024),b=!1)}return oh(s,c,h,b,C,w)}function oh(s,c,h,b,w,C){$1(s,c);var q=(c.flags&128)!==0;if(!b&&!q)return w&&J(c,h,!1),ds(s,c,C);b=c.stateNode,EI.current=c;var ne=q&&typeof h.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&q?(c.child=yr(c,s.child,null,C),c.child=yr(c,null,ne,C)):mi(s,c,ne,C),c.memoizedState=b.state,w&&J(c,h,!0),c.child}function V1(s){var c=s.stateNode;c.pendingContext?jc(s,c.pendingContext,c.pendingContext!==c.context):c.context&&jc(s,c.context,!1),$p(s,c.containerInfo)}function G1(s,c,h,b,w){return Wa(),bl(w),c.flags|=256,mi(s,c,h,b),c.child}var lh={dehydrated:null,treeContext:null,retryLane:0};function ch(s){return{baseLanes:s,cachePool:null,transitions:null}}function K1(s,c,h){var b=c.pendingProps,w=pr.current,C=!1,q=(c.flags&128)!==0,ne;if((ne=q)||(ne=s!==null&&s.memoizedState===null?!1:(w&2)!==0),ne?(C=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(w|=1),Yn(pr,w&1),s===null)return ls(c),s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((c.mode&1)===0?c.lanes=1:s.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(q=b.children,s=b.fallback,C?(b=c.mode,C=c.child,q={mode:"hidden",children:q},(b&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=q):C=Ud(q,b,0,null),s=Ro(s,b,h,null),C.return=c,s.return=c,C.sibling=s,c.child=C,c.child.memoizedState=ch(h),c.memoizedState=lh,s):uh(c,q));if(w=s.memoizedState,w!==null&&(ne=w.dehydrated,ne!==null))return NI(s,c,q,b,ne,w,h);if(C){C=b.fallback,q=c.mode,w=s.child,ne=w.sibling;var le={mode:"hidden",children:b.children};return(q&1)===0&&c.child!==w?(b=c.child,b.childLanes=0,b.pendingProps=le,c.deletions=null):(b=Ws(w,le),b.subtreeFlags=w.subtreeFlags&14680064),ne!==null?C=Ws(ne,C):(C=Ro(C,q,h,null),C.flags|=2),C.return=c,b.return=c,b.sibling=C,c.child=b,b=C,C=c.child,q=s.child.memoizedState,q=q===null?ch(h):{baseLanes:q.baseLanes|h,cachePool:null,transitions:q.transitions},C.memoizedState=q,C.childLanes=s.childLanes&~h,c.memoizedState=lh,b}return C=s.child,s=C.sibling,b=Ws(C,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=h),b.return=c,b.sibling=null,s!==null&&(h=c.deletions,h===null?(c.deletions=[s],c.flags|=16):h.push(s)),c.child=b,c.memoizedState=null,b}function uh(s,c){return c=Ud({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function Td(s,c,h,b){return b!==null&&bl(b),yr(c,s.child,null,h),s=uh(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function NI(s,c,h,b,w,C,q){if(h)return c.flags&256?(c.flags&=-257,b=ih(Error(n(422))),Td(s,c,q,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(C=b.fallback,w=c.mode,b=Ud({mode:"visible",children:b.children},w,0,null),C=Ro(C,w,q,null),C.flags|=2,b.return=c,C.return=c,b.sibling=C,c.child=b,(c.mode&1)!==0&&yr(c,s.child,null,q),c.child.memoizedState=ch(q),c.memoizedState=lh,C);if((c.mode&1)===0)return Td(s,c,q,null);if(w.data==="$!"){if(b=w.nextSibling&&w.nextSibling.dataset,b)var ne=b.dgst;return b=ne,C=Error(n(419)),b=ih(C,b,void 0),Td(s,c,q,b)}if(ne=(q&s.childLanes)!==0,ji||ne){if(b=Hr,b!==null){switch(q&-q){case 4:w=2;break;case 16:w=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(b.suspendedLanes|q))!==0?0:w,w!==0&&w!==C.retryLane&&(C.retryLane=w,cs(s,w),Ta(b,s,w,-1))}return Nh(),b=ih(Error(n(421))),Td(s,c,q,b)}return w.data==="$?"?(c.flags|=128,c.child=s.child,c=BI.bind(null,s),w._reactRetry=c,null):(s=C.treeContext,En=Ci(w.nextSibling),Jt=c,dn=!0,Hn=null,s!==null&&(ye[Z++]=we,ye[Z++]=Le,ye[Z++]=fe,we=s.id,Le=s.overflow,fe=c),c=uh(c,b.children),c.flags|=4096,c)}function Y1(s,c,h){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),qp(s.return,c,h)}function dh(s,c,h,b,w){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:h,tailMode:w}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=b,C.tail=h,C.tailMode=w)}function Q1(s,c,h){var b=c.pendingProps,w=b.revealOrder,C=b.tail;if(mi(s,c,b.children,h),b=pr.current,(b&2)!==0)b=b&1|2,c.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=c.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Y1(s,h,c);else if(s.tag===19)Y1(s,h,c);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===c)break e;for(;s.sibling===null;){if(s.return===null||s.return===c)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}b&=1}if(Yn(pr,b),(c.mode&1)===0)c.memoizedState=null;else switch(w){case"forwards":for(h=c.child,w=null;h!==null;)s=h.alternate,s!==null&&_d(s)===null&&(w=h),h=h.sibling;h=w,h===null?(w=c.child,c.child=null):(w=h.sibling,h.sibling=null),dh(c,!1,w,h,C);break;case"backwards":for(h=null,w=c.child,c.child=null;w!==null;){if(s=w.alternate,s!==null&&_d(s)===null){c.child=w;break}s=w.sibling,w.sibling=h,h=w,w=s}dh(c,!0,h,null,C);break;case"together":dh(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Rd(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function ds(s,c,h){if(s!==null&&(c.dependencies=s.dependencies),No|=c.lanes,(h&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(n(153));if(c.child!==null){for(s=c.child,h=Ws(s,s.pendingProps),c.child=h,h.return=c;s.sibling!==null;)s=s.sibling,h=h.sibling=Ws(s,s.pendingProps),h.return=c;h.sibling=null}return c.child}function CI(s,c,h){switch(c.tag){case 3:V1(c),Wa();break;case 5:u1(c);break;case 1:Ir(c.type)&&D(c);break;case 4:$p(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,w=c.memoizedProps.value;Yn(yd,b._currentValue),b._currentValue=w;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(Yn(pr,pr.current&1),c.flags|=128,null):(h&c.child.childLanes)!==0?K1(s,c,h):(Yn(pr,pr.current&1),s=ds(s,c,h),s!==null?s.sibling:null);Yn(pr,pr.current&1);break;case 19:if(b=(h&c.childLanes)!==0,(s.flags&128)!==0){if(b)return Q1(s,c,h);c.flags|=128}if(w=c.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Yn(pr,pr.current),b)break;return null;case 22:case 23:return c.lanes=0,H1(s,c,h)}return ds(s,c,h)}var X1,fh,Z1,J1;X1=function(s,c){for(var h=c.child;h!==null;){if(h.tag===5||h.tag===6)s.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},fh=function(){},Z1=function(s,c,h,b){var w=s.memoizedProps;if(w!==b){s=c.stateNode,So(Va.current);var C=null;switch(h){case"input":w=yt(s,w),b=yt(s,b),C=[];break;case"select":w=z({},w,{value:void 0}),b=z({},b,{value:void 0}),C=[];break;case"textarea":w=Vt(s,w),b=Vt(s,b),C=[];break;default:typeof w.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=Ms)}Wt(h,b);var q;h=null;for(Ee in w)if(!b.hasOwnProperty(Ee)&&w.hasOwnProperty(Ee)&&w[Ee]!=null)if(Ee==="style"){var ne=w[Ee];for(q in ne)ne.hasOwnProperty(q)&&(h||(h={}),h[q]="")}else Ee!=="dangerouslySetInnerHTML"&&Ee!=="children"&&Ee!=="suppressContentEditableWarning"&&Ee!=="suppressHydrationWarning"&&Ee!=="autoFocus"&&(a.hasOwnProperty(Ee)?C||(C=[]):(C=C||[]).push(Ee,null));for(Ee in b){var le=b[Ee];if(ne=w!=null?w[Ee]:void 0,b.hasOwnProperty(Ee)&&le!==ne&&(le!=null||ne!=null))if(Ee==="style")if(ne){for(q in ne)!ne.hasOwnProperty(q)||le&&le.hasOwnProperty(q)||(h||(h={}),h[q]="");for(q in le)le.hasOwnProperty(q)&&ne[q]!==le[q]&&(h||(h={}),h[q]=le[q])}else h||(C||(C=[]),C.push(Ee,h)),h=le;else Ee==="dangerouslySetInnerHTML"?(le=le?le.__html:void 0,ne=ne?ne.__html:void 0,le!=null&&ne!==le&&(C=C||[]).push(Ee,le)):Ee==="children"?typeof le!="string"&&typeof le!="number"||(C=C||[]).push(Ee,""+le):Ee!=="suppressContentEditableWarning"&&Ee!=="suppressHydrationWarning"&&(a.hasOwnProperty(Ee)?(le!=null&&Ee==="onScroll"&&Sn("scroll",s),C||ne===le||(C=[])):(C=C||[]).push(Ee,le))}h&&(C=C||[]).push("style",h);var Ee=C;(c.updateQueue=Ee)&&(c.flags|=4)}},J1=function(s,c,h,b){h!==b&&(c.flags|=4)};function Fc(s,c){if(!dn)switch(s.tailMode){case"hidden":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?s.tail=null:h.sibling=null;break;case"collapsed":h=s.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?c||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function li(s){var c=s.alternate!==null&&s.alternate.child===s.child,h=0,b=0;if(c)for(var w=s.child;w!==null;)h|=w.lanes|w.childLanes,b|=w.subtreeFlags&14680064,b|=w.flags&14680064,w.return=s,w=w.sibling;else for(w=s.child;w!==null;)h|=w.lanes|w.childLanes,b|=w.subtreeFlags,b|=w.flags,w.return=s,w=w.sibling;return s.subtreeFlags|=b,s.childLanes=h,c}function jI(s,c,h){var b=c.pendingProps;switch(Bt(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return li(c),null;case 1:return Ir(c.type)&&ko(),li(c),null;case 3:return b=c.stateNode,_l(),Jn(Qr),Jn(qr),Gp(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(_o(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Hn!==null&&(wh(Hn),Hn=null))),fh(s,c),li(c),null;case 5:Wp(c);var w=So(Mc.current);if(h=c.type,s!==null&&c.stateNode!=null)Z1(s,c,h,b,w),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(n(166));return li(c),null}if(s=So(Va.current),_o(c)){b=c.stateNode,h=c.type;var C=c.memoizedProps;switch(b[oa]=c,b[vo]=C,s=(c.mode&1)!==0,h){case"dialog":Sn("cancel",b),Sn("close",b);break;case"iframe":case"object":case"embed":Sn("load",b);break;case"video":case"audio":for(w=0;w<go.length;w++)Sn(go[w],b);break;case"source":Sn("error",b);break;case"img":case"image":case"link":Sn("error",b),Sn("load",b);break;case"details":Sn("toggle",b);break;case"input":et(b,C),Sn("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!C.multiple},Sn("invalid",b);break;case"textarea":ze(b,C),Sn("invalid",b)}Wt(h,C),w=null;for(var q in C)if(C.hasOwnProperty(q)){var ne=C[q];q==="children"?typeof ne=="string"?b.textContent!==ne&&(C.suppressHydrationWarning!==!0&&yo(b.textContent,ne,s),w=["children",ne]):typeof ne=="number"&&b.textContent!==""+ne&&(C.suppressHydrationWarning!==!0&&yo(b.textContent,ne,s),w=["children",""+ne]):a.hasOwnProperty(q)&&ne!=null&&q==="onScroll"&&Sn("scroll",b)}switch(h){case"input":Xe(b),tt(b,C,!0);break;case"textarea":Xe(b),nt(b);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(b.onclick=Ms)}b=w,c.updateQueue=b,b!==null&&(c.flags|=4)}else{q=w.nodeType===9?w:w.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=ft(h)),s==="http://www.w3.org/1999/xhtml"?h==="script"?(s=q.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=q.createElement(h,{is:b.is}):(s=q.createElement(h),h==="select"&&(q=s,b.multiple?q.multiple=!0:b.size&&(q.size=b.size))):s=q.createElementNS(s,h),s[oa]=c,s[vo]=b,X1(s,c,!1,!1),c.stateNode=s;e:{switch(q=Je(h,b),h){case"dialog":Sn("cancel",s),Sn("close",s),w=b;break;case"iframe":case"object":case"embed":Sn("load",s),w=b;break;case"video":case"audio":for(w=0;w<go.length;w++)Sn(go[w],s);w=b;break;case"source":Sn("error",s),w=b;break;case"img":case"image":case"link":Sn("error",s),Sn("load",s),w=b;break;case"details":Sn("toggle",s),w=b;break;case"input":et(s,b),w=yt(s,b),Sn("invalid",s);break;case"option":w=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},w=z({},b,{value:void 0}),Sn("invalid",s);break;case"textarea":ze(s,b),w=Vt(s,b),Sn("invalid",s);break;default:w=b}Wt(h,w),ne=w;for(C in ne)if(ne.hasOwnProperty(C)){var le=ne[C];C==="style"?ht(s,le):C==="dangerouslySetInnerHTML"?(le=le?le.__html:void 0,le!=null&&qe(s,le)):C==="children"?typeof le=="string"?(h!=="textarea"||le!=="")&&me(s,le):typeof le=="number"&&me(s,""+le):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(a.hasOwnProperty(C)?le!=null&&C==="onScroll"&&Sn("scroll",s):le!=null&&N(s,C,le,q))}switch(h){case"input":Xe(s),tt(s,b,!1);break;case"textarea":Xe(s),nt(s);break;case"option":b.value!=null&&s.setAttribute("value",""+ae(b.value));break;case"select":s.multiple=!!b.multiple,C=b.value,C!=null?an(s,!!b.multiple,C,!1):b.defaultValue!=null&&an(s,!!b.multiple,b.defaultValue,!0);break;default:typeof w.onClick=="function"&&(s.onclick=Ms)}switch(h){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return li(c),null;case 6:if(s&&c.stateNode!=null)J1(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(h=So(Mc.current),So(Va.current),_o(c)){if(b=c.stateNode,h=c.memoizedProps,b[oa]=c,(C=b.nodeValue!==h)&&(s=Jt,s!==null))switch(s.tag){case 3:yo(b.nodeValue,h,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&yo(b.nodeValue,h,(s.mode&1)!==0)}C&&(c.flags|=4)}else b=(h.nodeType===9?h:h.ownerDocument).createTextNode(b),b[oa]=c,c.stateNode=b}return li(c),null;case 13:if(Jn(pr),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(dn&&En!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Rc(),Wa(),c.flags|=98560,C=!1;else if(C=_o(c),b!==null&&b.dehydrated!==null){if(s===null){if(!C)throw Error(n(318));if(C=c.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[oa]=c}else Wa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;li(c),C=!1}else Hn!==null&&(wh(Hn),Hn=null),C=!0;if(!C)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=h,c):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(c.child.flags|=8192,(c.mode&1)!==0&&(s===null||(pr.current&1)!==0?Or===0&&(Or=3):Nh())),c.updateQueue!==null&&(c.flags|=4),li(c),null);case 4:return _l(),fh(s,c),s===null&&xo(c.stateNode.containerInfo),li(c),null;case 10:return zp(c.type._context),li(c),null;case 17:return Ir(c.type)&&ko(),li(c),null;case 19:if(Jn(pr),C=c.memoizedState,C===null)return li(c),null;if(b=(c.flags&128)!==0,q=C.rendering,q===null)if(b)Fc(C,!1);else{if(Or!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(q=_d(s),q!==null){for(c.flags|=128,Fc(C,!1),b=q.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=h,h=c.child;h!==null;)C=h,s=b,C.flags&=14680066,q=C.alternate,q===null?(C.childLanes=0,C.lanes=s,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=q.childLanes,C.lanes=q.lanes,C.child=q.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=q.memoizedProps,C.memoizedState=q.memoizedState,C.updateQueue=q.updateQueue,C.type=q.type,s=q.dependencies,C.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),h=h.sibling;return Yn(pr,pr.current&1|2),c.child}s=s.sibling}C.tail!==null&&Kn()>Nl&&(c.flags|=128,b=!0,Fc(C,!1),c.lanes=4194304)}else{if(!b)if(s=_d(q),s!==null){if(c.flags|=128,b=!0,h=s.updateQueue,h!==null&&(c.updateQueue=h,c.flags|=4),Fc(C,!0),C.tail===null&&C.tailMode==="hidden"&&!q.alternate&&!dn)return li(c),null}else 2*Kn()-C.renderingStartTime>Nl&&h!==1073741824&&(c.flags|=128,b=!0,Fc(C,!1),c.lanes=4194304);C.isBackwards?(q.sibling=c.child,c.child=q):(h=C.last,h!==null?h.sibling=q:c.child=q,C.last=q)}return C.tail!==null?(c=C.tail,C.rendering=c,C.tail=c.sibling,C.renderingStartTime=Kn(),c.sibling=null,h=pr.current,Yn(pr,b?h&1|2:h&1),c):(li(c),null);case 22:case 23:return Eh(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?(Vi&1073741824)!==0&&(li(c),c.subtreeFlags&6&&(c.flags|=8192)):li(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function TI(s,c){switch(Bt(c),c.tag){case 1:return Ir(c.type)&&ko(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return _l(),Jn(Qr),Jn(qr),Gp(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return Wp(c),null;case 13:if(Jn(pr),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Wa()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return Jn(pr),null;case 4:return _l(),null;case 10:return zp(c.type._context),null;case 22:case 23:return Eh(),null;case 24:return null;default:return null}}var Ad=!1,ci=!1,RI=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function Sl(s,c){var h=s.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(b){br(s,c,b)}else h.current=null}function ph(s,c,h){try{h()}catch(b){br(s,c,b)}}var e_=!1;function AI(s,c){if(gl=Ht,s=ai(),xc(s)){if("selectionStart"in s)var h={start:s.selectionStart,end:s.selectionEnd};else e:{h=(h=s.ownerDocument)&&h.defaultView||window;var b=h.getSelection&&h.getSelection();if(b&&b.rangeCount!==0){h=b.anchorNode;var w=b.anchorOffset,C=b.focusNode;b=b.focusOffset;try{h.nodeType,C.nodeType}catch{h=null;break e}var q=0,ne=-1,le=-1,Ee=0,Ze=0,it=s,Ke=null;t:for(;;){for(var Ct;it!==h||w!==0&&it.nodeType!==3||(ne=q+w),it!==C||b!==0&&it.nodeType!==3||(le=q+b),it.nodeType===3&&(q+=it.nodeValue.length),(Ct=it.firstChild)!==null;)Ke=it,it=Ct;for(;;){if(it===s)break t;if(Ke===h&&++Ee===w&&(ne=q),Ke===C&&++Ze===b&&(le=q),(Ct=it.nextSibling)!==null)break;it=Ke,Ke=it.parentNode}it=Ct}h=ne===-1||le===-1?null:{start:ne,end:le}}else h=null}h=h||{start:0,end:0}}else h=null;for(wc={focusedElem:s,selectionRange:h},Ht=!1,Rt=c;Rt!==null;)if(c=Rt,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,Rt=s;else for(;Rt!==null;){c=Rt;try{var At=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(At!==null){var Mt=At.memoizedProps,kr=At.memoizedState,ve=c.stateNode,ge=ve.getSnapshotBeforeUpdate(c.elementType===c.type?Mt:Na(c.type,Mt),kr);ve.__reactInternalSnapshotBeforeUpdate=ge}break;case 3:var _e=c.stateNode.containerInfo;_e.nodeType===1?_e.textContent="":_e.nodeType===9&&_e.documentElement&&_e.removeChild(_e.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(dt){br(c,c.return,dt)}if(s=c.sibling,s!==null){s.return=c.return,Rt=s;break}Rt=c.return}return At=e_,e_=!1,At}function Bc(s,c,h){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var w=b=b.next;do{if((w.tag&s)===s){var C=w.destroy;w.destroy=void 0,C!==void 0&&ph(c,h,C)}w=w.next}while(w!==b)}}function Id(s,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&s)===s){var b=h.create;h.destroy=b()}h=h.next}while(h!==c)}}function hh(s){var c=s.ref;if(c!==null){var h=s.stateNode;switch(s.tag){case 5:s=h;break;default:s=h}typeof c=="function"?c(s):c.current=s}}function t_(s){var c=s.alternate;c!==null&&(s.alternate=null,t_(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[oa],delete c[vo],delete c[Cc],delete c[Pp],delete c[Hi])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function n_(s){return s.tag===5||s.tag===3||s.tag===4}function r_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||n_(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function gh(s,c,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?h.nodeType===8?h.parentNode.insertBefore(s,c):h.insertBefore(s,c):(h.nodeType===8?(c=h.parentNode,c.insertBefore(s,h)):(c=h,c.appendChild(s)),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=Ms));else if(b!==4&&(s=s.child,s!==null))for(gh(s,c,h),s=s.sibling;s!==null;)gh(s,c,h),s=s.sibling}function mh(s,c,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?h.insertBefore(s,c):h.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(mh(s,c,h),s=s.sibling;s!==null;)mh(s,c,h),s=s.sibling}var Xr=null,Ca=!1;function zs(s,c,h){for(h=h.child;h!==null;)i_(s,c,h),h=h.sibling}function i_(s,c,h){if(gn&&typeof gn.onCommitFiberUnmount=="function")try{gn.onCommitFiberUnmount(It,h)}catch{}switch(h.tag){case 5:ci||Sl(h,c);case 6:var b=Xr,w=Ca;Xr=null,zs(s,c,h),Xr=b,Ca=w,Xr!==null&&(Ca?(s=Xr,h=h.stateNode,s.nodeType===8?s.parentNode.removeChild(h):s.removeChild(h)):Xr.removeChild(h.stateNode));break;case 18:Xr!==null&&(Ca?(s=Xr,h=h.stateNode,s.nodeType===8?Nc(s.parentNode,h):s.nodeType===1&&Nc(s,h),Oe(s)):Nc(Xr,h.stateNode));break;case 4:b=Xr,w=Ca,Xr=h.stateNode.containerInfo,Ca=!0,zs(s,c,h),Xr=b,Ca=w;break;case 0:case 11:case 14:case 15:if(!ci&&(b=h.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){w=b=b.next;do{var C=w,q=C.destroy;C=C.tag,q!==void 0&&((C&2)!==0||(C&4)!==0)&&ph(h,c,q),w=w.next}while(w!==b)}zs(s,c,h);break;case 1:if(!ci&&(Sl(h,c),b=h.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=h.memoizedProps,b.state=h.memoizedState,b.componentWillUnmount()}catch(ne){br(h,c,ne)}zs(s,c,h);break;case 21:zs(s,c,h);break;case 22:h.mode&1?(ci=(b=ci)||h.memoizedState!==null,zs(s,c,h),ci=b):zs(s,c,h);break;default:zs(s,c,h)}}function a_(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var h=s.stateNode;h===null&&(h=s.stateNode=new RI),c.forEach(function(b){var w=zI.bind(null,s,b);h.has(b)||(h.add(b),b.then(w,w))})}}function ja(s,c){var h=c.deletions;if(h!==null)for(var b=0;b<h.length;b++){var w=h[b];try{var C=s,q=c,ne=q;e:for(;ne!==null;){switch(ne.tag){case 5:Xr=ne.stateNode,Ca=!1;break e;case 3:Xr=ne.stateNode.containerInfo,Ca=!0;break e;case 4:Xr=ne.stateNode.containerInfo,Ca=!0;break e}ne=ne.return}if(Xr===null)throw Error(n(160));i_(C,q,w),Xr=null,Ca=!1;var le=w.alternate;le!==null&&(le.return=null),w.return=null}catch(Ee){br(w,c,Ee)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)s_(c,s),c=c.sibling}function s_(s,c){var h=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(ja(c,s),Ka(s),b&4){try{Bc(3,s,s.return),Id(3,s)}catch(Mt){br(s,s.return,Mt)}try{Bc(5,s,s.return)}catch(Mt){br(s,s.return,Mt)}}break;case 1:ja(c,s),Ka(s),b&512&&h!==null&&Sl(h,h.return);break;case 5:if(ja(c,s),Ka(s),b&512&&h!==null&&Sl(h,h.return),s.flags&32){var w=s.stateNode;try{me(w,"")}catch(Mt){br(s,s.return,Mt)}}if(b&4&&(w=s.stateNode,w!=null)){var C=s.memoizedProps,q=h!==null?h.memoizedProps:C,ne=s.type,le=s.updateQueue;if(s.updateQueue=null,le!==null)try{ne==="input"&&C.type==="radio"&&C.name!=null&&Ie(w,C),Je(ne,q);var Ee=Je(ne,C);for(q=0;q<le.length;q+=2){var Ze=le[q],it=le[q+1];Ze==="style"?ht(w,it):Ze==="dangerouslySetInnerHTML"?qe(w,it):Ze==="children"?me(w,it):N(w,Ze,it,Ee)}switch(ne){case"input":Ge(w,C);break;case"textarea":De(w,C);break;case"select":var Ke=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!C.multiple;var Ct=C.value;Ct!=null?an(w,!!C.multiple,Ct,!1):Ke!==!!C.multiple&&(C.defaultValue!=null?an(w,!!C.multiple,C.defaultValue,!0):an(w,!!C.multiple,C.multiple?[]:"",!1))}w[vo]=C}catch(Mt){br(s,s.return,Mt)}}break;case 6:if(ja(c,s),Ka(s),b&4){if(s.stateNode===null)throw Error(n(162));w=s.stateNode,C=s.memoizedProps;try{w.nodeValue=C}catch(Mt){br(s,s.return,Mt)}}break;case 3:if(ja(c,s),Ka(s),b&4&&h!==null&&h.memoizedState.isDehydrated)try{Oe(c.containerInfo)}catch(Mt){br(s,s.return,Mt)}break;case 4:ja(c,s),Ka(s);break;case 13:ja(c,s),Ka(s),w=s.child,w.flags&8192&&(C=w.memoizedState!==null,w.stateNode.isHidden=C,!C||w.alternate!==null&&w.alternate.memoizedState!==null||(bh=Kn())),b&4&&a_(s);break;case 22:if(Ze=h!==null&&h.memoizedState!==null,s.mode&1?(ci=(Ee=ci)||Ze,ja(c,s),ci=Ee):ja(c,s),Ka(s),b&8192){if(Ee=s.memoizedState!==null,(s.stateNode.isHidden=Ee)&&!Ze&&(s.mode&1)!==0)for(Rt=s,Ze=s.child;Ze!==null;){for(it=Rt=Ze;Rt!==null;){switch(Ke=Rt,Ct=Ke.child,Ke.tag){case 0:case 11:case 14:case 15:Bc(4,Ke,Ke.return);break;case 1:Sl(Ke,Ke.return);var At=Ke.stateNode;if(typeof At.componentWillUnmount=="function"){b=Ke,h=Ke.return;try{c=b,At.props=c.memoizedProps,At.state=c.memoizedState,At.componentWillUnmount()}catch(Mt){br(b,h,Mt)}}break;case 5:Sl(Ke,Ke.return);break;case 22:if(Ke.memoizedState!==null){c_(it);continue}}Ct!==null?(Ct.return=Ke,Rt=Ct):c_(it)}Ze=Ze.sibling}e:for(Ze=null,it=s;;){if(it.tag===5){if(Ze===null){Ze=it;try{w=it.stateNode,Ee?(C=w.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(ne=it.stateNode,le=it.memoizedProps.style,q=le!=null&&le.hasOwnProperty("display")?le.display:null,ne.style.display=wt("display",q))}catch(Mt){br(s,s.return,Mt)}}}else if(it.tag===6){if(Ze===null)try{it.stateNode.nodeValue=Ee?"":it.memoizedProps}catch(Mt){br(s,s.return,Mt)}}else if((it.tag!==22&&it.tag!==23||it.memoizedState===null||it===s)&&it.child!==null){it.child.return=it,it=it.child;continue}if(it===s)break e;for(;it.sibling===null;){if(it.return===null||it.return===s)break e;Ze===it&&(Ze=null),it=it.return}Ze===it&&(Ze=null),it.sibling.return=it.return,it=it.sibling}}break;case 19:ja(c,s),Ka(s),b&4&&a_(s);break;case 21:break;default:ja(c,s),Ka(s)}}function Ka(s){var c=s.flags;if(c&2){try{e:{for(var h=s.return;h!==null;){if(n_(h)){var b=h;break e}h=h.return}throw Error(n(160))}switch(b.tag){case 5:var w=b.stateNode;b.flags&32&&(me(w,""),b.flags&=-33);var C=r_(s);mh(s,C,w);break;case 3:case 4:var q=b.stateNode.containerInfo,ne=r_(s);gh(s,ne,q);break;default:throw Error(n(161))}}catch(le){br(s,s.return,le)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function II(s,c,h){Rt=s,o_(s)}function o_(s,c,h){for(var b=(s.mode&1)!==0;Rt!==null;){var w=Rt,C=w.child;if(w.tag===22&&b){var q=w.memoizedState!==null||Ad;if(!q){var ne=w.alternate,le=ne!==null&&ne.memoizedState!==null||ci;ne=Ad;var Ee=ci;if(Ad=q,(ci=le)&&!Ee)for(Rt=w;Rt!==null;)q=Rt,le=q.child,q.tag===22&&q.memoizedState!==null?u_(w):le!==null?(le.return=q,Rt=le):u_(w);for(;C!==null;)Rt=C,o_(C),C=C.sibling;Rt=w,Ad=ne,ci=Ee}l_(s)}else(w.subtreeFlags&8772)!==0&&C!==null?(C.return=w,Rt=C):l_(s)}}function l_(s){for(;Rt!==null;){var c=Rt;if((c.flags&8772)!==0){var h=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:ci||Id(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!ci)if(h===null)b.componentDidMount();else{var w=c.elementType===c.type?h.memoizedProps:Na(c.type,h.memoizedProps);b.componentDidUpdate(w,h.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&c1(c,C,b);break;case 3:var q=c.updateQueue;if(q!==null){if(h=null,c.child!==null)switch(c.child.tag){case 5:h=c.child.stateNode;break;case 1:h=c.child.stateNode}c1(c,q,h)}break;case 5:var ne=c.stateNode;if(h===null&&c.flags&4){h=ne;var le=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":le.autoFocus&&h.focus();break;case"img":le.src&&(h.src=le.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var Ee=c.alternate;if(Ee!==null){var Ze=Ee.memoizedState;if(Ze!==null){var it=Ze.dehydrated;it!==null&&Oe(it)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}ci||c.flags&512&&hh(c)}catch(Ke){br(c,c.return,Ke)}}if(c===s){Rt=null;break}if(h=c.sibling,h!==null){h.return=c.return,Rt=h;break}Rt=c.return}}function c_(s){for(;Rt!==null;){var c=Rt;if(c===s){Rt=null;break}var h=c.sibling;if(h!==null){h.return=c.return,Rt=h;break}Rt=c.return}}function u_(s){for(;Rt!==null;){var c=Rt;try{switch(c.tag){case 0:case 11:case 15:var h=c.return;try{Id(4,c)}catch(le){br(c,h,le)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var w=c.return;try{b.componentDidMount()}catch(le){br(c,w,le)}}var C=c.return;try{hh(c)}catch(le){br(c,C,le)}break;case 5:var q=c.return;try{hh(c)}catch(le){br(c,q,le)}}}catch(le){br(c,c.return,le)}if(c===s){Rt=null;break}var ne=c.sibling;if(ne!==null){ne.return=c.return,Rt=ne;break}Rt=c.return}}var MI=Math.ceil,Md=R.ReactCurrentDispatcher,xh=R.ReactCurrentOwner,pa=R.ReactCurrentBatchConfig,On=0,Hr=null,jr=null,Zr=0,Vi=0,El=la(0),Or=0,zc=null,No=0,Ld=0,yh=0,qc=null,Ti=null,bh=0,Nl=1/0,fs=null,Od=!1,vh=null,qs=null,Dd=!1,Us=null,Pd=0,Uc=0,kh=null,Fd=-1,Bd=0;function xi(){return(On&6)!==0?Kn():Fd!==-1?Fd:Fd=Kn()}function Hs(s){return(s.mode&1)===0?1:(On&2)!==0&&Zr!==0?Zr&-Zr:md.transition!==null?(Bd===0&&(Bd=_a()),Bd):(s=un,s!==0||(s=window.event,s=s===void 0?16:ra(s.type)),s)}function Ta(s,c,h,b){if(50<Uc)throw Uc=0,kh=null,Error(n(185));Gr(s,h,b),((On&2)===0||s!==Hr)&&(s===Hr&&((On&2)===0&&(Ld|=h),Or===4&&$s(s,Zr)),Ri(s,b),h===1&&On===0&&(c.mode&1)===0&&(Nl=Kn()+500,se&&_t()))}function Ri(s,c){var h=s.callbackNode;ta(s,c);var b=ni(s,s===Hr?Zr:0);if(b===0)h!==null&&Br(h),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(h!=null&&Br(h),c===1)s.tag===0?Ae(f_.bind(null,s)):Re(f_.bind(null,s)),bo(function(){(On&6)===0&&_t()}),h=null;else{switch(Ut(b)){case 1:h=pi;break;case 4:h=ea;break;case 16:h=Ba;break;case 536870912:h=mt;break;default:h=Ba}h=v_(h,d_.bind(null,s))}s.callbackPriority=c,s.callbackNode=h}}function d_(s,c){if(Fd=-1,Bd=0,(On&6)!==0)throw Error(n(327));var h=s.callbackNode;if(Cl()&&s.callbackNode!==h)return null;var b=ni(s,s===Hr?Zr:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=zd(s,b);else{c=b;var w=On;On|=2;var C=h_();(Hr!==s||Zr!==c)&&(fs=null,Nl=Kn()+500,jo(s,c));do try{DI();break}catch(ne){p_(s,ne)}while(!0);Bp(),Md.current=C,On=w,jr!==null?c=0:(Hr=null,Zr=0,c=Or)}if(c!==0){if(c===2&&(w=ka(s),w!==0&&(b=w,c=_h(s,w))),c===1)throw h=zc,jo(s,0),$s(s,b),Ri(s,Kn()),h;if(c===6)$s(s,b);else{if(w=s.current.alternate,(b&30)===0&&!LI(w)&&(c=zd(s,b),c===2&&(C=ka(s),C!==0&&(b=C,c=_h(s,C))),c===1))throw h=zc,jo(s,0),$s(s,b),Ri(s,Kn()),h;switch(s.finishedWork=w,s.finishedLanes=b,c){case 0:case 1:throw Error(n(345));case 2:To(s,Ti,fs);break;case 3:if($s(s,b),(b&130023424)===b&&(c=bh+500-Kn(),10<c)){if(ni(s,0)!==0)break;if(w=s.suspendedLanes,(w&b)!==b){xi(),s.pingedLanes|=s.suspendedLanes&w;break}s.timeoutHandle=Ec(To.bind(null,s,Ti,fs),c);break}To(s,Ti,fs);break;case 4:if($s(s,b),(b&4194240)===b)break;for(c=s.eventTimes,w=-1;0<b;){var q=31-Wn(b);C=1<<q,q=c[q],q>w&&(w=q),b&=~C}if(b=w,b=Kn()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*MI(b/1960))-b,10<b){s.timeoutHandle=Ec(To.bind(null,s,Ti,fs),b);break}To(s,Ti,fs);break;case 5:To(s,Ti,fs);break;default:throw Error(n(329))}}}return Ri(s,Kn()),s.callbackNode===h?d_.bind(null,s):null}function _h(s,c){var h=qc;return s.current.memoizedState.isDehydrated&&(jo(s,c).flags|=256),s=zd(s,c),s!==2&&(c=Ti,Ti=h,c!==null&&wh(c)),s}function wh(s){Ti===null?Ti=s:Ti.push.apply(Ti,s)}function LI(s){for(var c=s;;){if(c.flags&16384){var h=c.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var b=0;b<h.length;b++){var w=h[b],C=w.getSnapshot;w=w.value;try{if(!Si(C(),w))return!1}catch{return!1}}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===s)break;for(;c.sibling===null;){if(c.return===null||c.return===s)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function $s(s,c){for(c&=~yh,c&=~Ld,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var h=31-Wn(c),b=1<<h;s[h]=-1,c&=~b}}function f_(s){if((On&6)!==0)throw Error(n(327));Cl();var c=ni(s,0);if((c&1)===0)return Ri(s,Kn()),null;var h=zd(s,c);if(s.tag!==0&&h===2){var b=ka(s);b!==0&&(c=b,h=_h(s,b))}if(h===1)throw h=zc,jo(s,0),$s(s,c),Ri(s,Kn()),h;if(h===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,To(s,Ti,fs),Ri(s,Kn()),null}function Sh(s,c){var h=On;On|=1;try{return s(c)}finally{On=h,On===0&&(Nl=Kn()+500,se&&_t())}}function Co(s){Us!==null&&Us.tag===0&&(On&6)===0&&Cl();var c=On;On|=1;var h=pa.transition,b=un;try{if(pa.transition=null,un=1,s)return s()}finally{un=b,pa.transition=h,On=c,(On&6)===0&&_t()}}function Eh(){Vi=El.current,Jn(El)}function jo(s,c){s.finishedWork=null,s.finishedLanes=0;var h=s.timeoutHandle;if(h!==-1&&(s.timeoutHandle=-1,Op(h)),jr!==null)for(h=jr.return;h!==null;){var b=h;switch(Bt(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&ko();break;case 3:_l(),Jn(Qr),Jn(qr),Gp();break;case 5:Wp(b);break;case 4:_l();break;case 13:Jn(pr);break;case 19:Jn(pr);break;case 10:zp(b.type._context);break;case 22:case 23:Eh()}h=h.return}if(Hr=s,jr=s=Ws(s.current,null),Zr=Vi=c,Or=0,zc=null,yh=Ld=No=0,Ti=qc=null,wo!==null){for(c=0;c<wo.length;c++)if(h=wo[c],b=h.interleaved,b!==null){h.interleaved=null;var w=b.next,C=h.pending;if(C!==null){var q=C.next;C.next=w,b.next=q}h.pending=b}wo=null}return s}function p_(s,c){do{var h=jr;try{if(Bp(),wd.current=Cd,Sd){for(var b=hr.memoizedState;b!==null;){var w=b.queue;w!==null&&(w.pending=null),b=b.next}Sd=!1}if(Eo=0,Ur=Lr=hr=null,Lc=!1,Oc=0,xh.current=null,h===null||h.return===null){Or=1,zc=c,jr=null;break}e:{var C=s,q=h.return,ne=h,le=c;if(c=Zr,ne.flags|=32768,le!==null&&typeof le=="object"&&typeof le.then=="function"){var Ee=le,Ze=ne,it=Ze.tag;if((Ze.mode&1)===0&&(it===0||it===11||it===15)){var Ke=Ze.alternate;Ke?(Ze.updateQueue=Ke.updateQueue,Ze.memoizedState=Ke.memoizedState,Ze.lanes=Ke.lanes):(Ze.updateQueue=null,Ze.memoizedState=null)}var Ct=F1(q);if(Ct!==null){Ct.flags&=-257,B1(Ct,q,ne,C,c),Ct.mode&1&&P1(C,Ee,c),c=Ct,le=Ee;var At=c.updateQueue;if(At===null){var Mt=new Set;Mt.add(le),c.updateQueue=Mt}else At.add(le);break e}else{if((c&1)===0){P1(C,Ee,c),Nh();break e}le=Error(n(426))}}else if(dn&&ne.mode&1){var kr=F1(q);if(kr!==null){(kr.flags&65536)===0&&(kr.flags|=256),B1(kr,q,ne,C,c),bl(wl(le,ne));break e}}C=le=wl(le,ne),Or!==4&&(Or=2),qc===null?qc=[C]:qc.push(C),C=q;do{switch(C.tag){case 3:C.flags|=65536,c&=-c,C.lanes|=c;var ve=O1(C,le,c);l1(C,ve);break e;case 1:ne=le;var ge=C.type,_e=C.stateNode;if((C.flags&128)===0&&(typeof ge.getDerivedStateFromError=="function"||_e!==null&&typeof _e.componentDidCatch=="function"&&(qs===null||!qs.has(_e)))){C.flags|=65536,c&=-c,C.lanes|=c;var dt=D1(C,ne,c);l1(C,dt);break e}}C=C.return}while(C!==null)}m_(h)}catch(Ot){c=Ot,jr===h&&h!==null&&(jr=h=h.return);continue}break}while(!0)}function h_(){var s=Md.current;return Md.current=Cd,s===null?Cd:s}function Nh(){(Or===0||Or===3||Or===2)&&(Or=4),Hr===null||(No&268435455)===0&&(Ld&268435455)===0||$s(Hr,Zr)}function zd(s,c){var h=On;On|=2;var b=h_();(Hr!==s||Zr!==c)&&(fs=null,jo(s,c));do try{OI();break}catch(w){p_(s,w)}while(!0);if(Bp(),On=h,Md.current=b,jr!==null)throw Error(n(261));return Hr=null,Zr=0,Or}function OI(){for(;jr!==null;)g_(jr)}function DI(){for(;jr!==null&&!ki();)g_(jr)}function g_(s){var c=b_(s.alternate,s,Vi);s.memoizedProps=s.pendingProps,c===null?m_(s):jr=c,xh.current=null}function m_(s){var c=s;do{var h=c.alternate;if(s=c.return,(c.flags&32768)===0){if(h=jI(h,c,Vi),h!==null){jr=h;return}}else{if(h=TI(h,c),h!==null){h.flags&=32767,jr=h;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Or=6,jr=null;return}}if(c=c.sibling,c!==null){jr=c;return}jr=c=s}while(c!==null);Or===0&&(Or=5)}function To(s,c,h){var b=un,w=pa.transition;try{pa.transition=null,un=1,PI(s,c,h,b)}finally{pa.transition=w,un=b}return null}function PI(s,c,h,b){do Cl();while(Us!==null);if((On&6)!==0)throw Error(n(327));h=s.finishedWork;var w=s.finishedLanes;if(h===null)return null;if(s.finishedWork=null,s.finishedLanes=0,h===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var C=h.lanes|h.childLanes;if(Nr(s,C),s===Hr&&(jr=Hr=null,Zr=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||Dd||(Dd=!0,v_(Ba,function(){return Cl(),null})),C=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||C){C=pa.transition,pa.transition=null;var q=un;un=1;var ne=On;On|=4,xh.current=null,AI(s,h),s_(h,s),yc(wc),Ht=!!gl,wc=gl=null,s.current=h,II(h),Ji(),On=ne,un=q,pa.transition=C}else s.current=h;if(Dd&&(Dd=!1,Us=s,Pd=w),C=s.pendingLanes,C===0&&(qs=null),Ln(h.stateNode),Ri(s,Kn()),c!==null)for(b=s.onRecoverableError,h=0;h<c.length;h++)w=c[h],b(w.value,{componentStack:w.stack,digest:w.digest});if(Od)throw Od=!1,s=vh,vh=null,s;return(Pd&1)!==0&&s.tag!==0&&Cl(),C=s.pendingLanes,(C&1)!==0?s===kh?Uc++:(Uc=0,kh=s):Uc=0,_t(),null}function Cl(){if(Us!==null){var s=Ut(Pd),c=pa.transition,h=un;try{if(pa.transition=null,un=16>s?16:s,Us===null)var b=!1;else{if(s=Us,Us=null,Pd=0,(On&6)!==0)throw Error(n(331));var w=On;for(On|=4,Rt=s.current;Rt!==null;){var C=Rt,q=C.child;if((Rt.flags&16)!==0){var ne=C.deletions;if(ne!==null){for(var le=0;le<ne.length;le++){var Ee=ne[le];for(Rt=Ee;Rt!==null;){var Ze=Rt;switch(Ze.tag){case 0:case 11:case 15:Bc(8,Ze,C)}var it=Ze.child;if(it!==null)it.return=Ze,Rt=it;else for(;Rt!==null;){Ze=Rt;var Ke=Ze.sibling,Ct=Ze.return;if(t_(Ze),Ze===Ee){Rt=null;break}if(Ke!==null){Ke.return=Ct,Rt=Ke;break}Rt=Ct}}}var At=C.alternate;if(At!==null){var Mt=At.child;if(Mt!==null){At.child=null;do{var kr=Mt.sibling;Mt.sibling=null,Mt=kr}while(Mt!==null)}}Rt=C}}if((C.subtreeFlags&2064)!==0&&q!==null)q.return=C,Rt=q;else e:for(;Rt!==null;){if(C=Rt,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:Bc(9,C,C.return)}var ve=C.sibling;if(ve!==null){ve.return=C.return,Rt=ve;break e}Rt=C.return}}var ge=s.current;for(Rt=ge;Rt!==null;){q=Rt;var _e=q.child;if((q.subtreeFlags&2064)!==0&&_e!==null)_e.return=q,Rt=_e;else e:for(q=ge;Rt!==null;){if(ne=Rt,(ne.flags&2048)!==0)try{switch(ne.tag){case 0:case 11:case 15:Id(9,ne)}}catch(Ot){br(ne,ne.return,Ot)}if(ne===q){Rt=null;break e}var dt=ne.sibling;if(dt!==null){dt.return=ne.return,Rt=dt;break e}Rt=ne.return}}if(On=w,_t(),gn&&typeof gn.onPostCommitFiberRoot=="function")try{gn.onPostCommitFiberRoot(It,s)}catch{}b=!0}return b}finally{un=h,pa.transition=c}}return!1}function x_(s,c,h){c=wl(h,c),c=O1(s,c,1),s=Bs(s,c,1),c=xi(),s!==null&&(Gr(s,1,c),Ri(s,c))}function br(s,c,h){if(s.tag===3)x_(s,s,h);else for(;c!==null;){if(c.tag===3){x_(c,s,h);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(qs===null||!qs.has(b))){s=wl(h,s),s=D1(c,s,1),c=Bs(c,s,1),s=xi(),c!==null&&(Gr(c,1,s),Ri(c,s));break}}c=c.return}}function FI(s,c,h){var b=s.pingCache;b!==null&&b.delete(c),c=xi(),s.pingedLanes|=s.suspendedLanes&h,Hr===s&&(Zr&h)===h&&(Or===4||Or===3&&(Zr&130023424)===Zr&&500>Kn()-bh?jo(s,0):yh|=h),Ri(s,c)}function y_(s,c){c===0&&((s.mode&1)===0?c=1:(c=hi,hi<<=1,(hi&130023424)===0&&(hi=4194304)));var h=xi();s=cs(s,c),s!==null&&(Gr(s,c,h),Ri(s,h))}function BI(s){var c=s.memoizedState,h=0;c!==null&&(h=c.retryLane),y_(s,h)}function zI(s,c){var h=0;switch(s.tag){case 13:var b=s.stateNode,w=s.memoizedState;w!==null&&(h=w.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(n(314))}b!==null&&b.delete(c),y_(s,h)}var b_;b_=function(s,c,h){if(s!==null)if(s.memoizedProps!==c.pendingProps||Qr.current)ji=!0;else{if((s.lanes&h)===0&&(c.flags&128)===0)return ji=!1,CI(s,c,h);ji=(s.flags&131072)!==0}else ji=!1,dn&&(c.flags&1048576)!==0&&vt(c,_n,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;Rd(s,c),s=c.pendingProps;var w=ua(c,qr.current);kl(c,h),w=Qp(null,c,b,s,w,h);var C=Xp();return c.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Ir(b)?(C=!0,D(c)):C=!1,c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Hp(c),w.updater=jd,c.stateNode=w,w._reactInternals=c,rh(c,b,s,h),c=oh(null,c,b,!0,C,h)):(c.tag=0,dn&&C&&qt(c),mi(null,c,w,h),c=c.child),c;case 16:b=c.elementType;e:{switch(Rd(s,c),s=c.pendingProps,w=b._init,b=w(b._payload),c.type=b,w=c.tag=UI(b),s=Na(b,s),w){case 0:c=sh(null,c,b,s,h);break e;case 1:c=W1(null,c,b,s,h);break e;case 11:c=z1(null,c,b,s,h);break e;case 14:c=q1(null,c,b,Na(b.type,s),h);break e}throw Error(n(306,b,""))}return c;case 0:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:Na(b,w),sh(s,c,b,w,h);case 1:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:Na(b,w),W1(s,c,b,w,h);case 3:e:{if(V1(c),s===null)throw Error(n(387));b=c.pendingProps,C=c.memoizedState,w=C.element,o1(s,c),kd(c,b,null,h);var q=c.memoizedState;if(b=q.element,C.isDehydrated)if(C={element:b,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){w=wl(Error(n(423)),c),c=G1(s,c,b,h,w);break e}else if(b!==w){w=wl(Error(n(424)),c),c=G1(s,c,b,h,w);break e}else for(En=Ci(c.stateNode.containerInfo.firstChild),Jt=c,dn=!0,Hn=null,h=xd(c,null,b,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Wa(),b===w){c=ds(s,c,h);break e}mi(s,c,b,h)}c=c.child}return c;case 5:return u1(c),s===null&&ls(c),b=c.type,w=c.pendingProps,C=s!==null?s.memoizedProps:null,q=w.children,Sc(b,w)?q=null:C!==null&&Sc(b,C)&&(c.flags|=32),$1(s,c),mi(s,c,q,h),c.child;case 6:return s===null&&ls(c),null;case 13:return K1(s,c,h);case 4:return $p(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=yr(c,null,b,h):mi(s,c,b,h),c.child;case 11:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:Na(b,w),z1(s,c,b,w,h);case 7:return mi(s,c,c.pendingProps,h),c.child;case 8:return mi(s,c,c.pendingProps.children,h),c.child;case 12:return mi(s,c,c.pendingProps.children,h),c.child;case 10:e:{if(b=c.type._context,w=c.pendingProps,C=c.memoizedProps,q=w.value,Yn(yd,b._currentValue),b._currentValue=q,C!==null)if(Si(C.value,q)){if(C.children===w.children&&!Qr.current){c=ds(s,c,h);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var ne=C.dependencies;if(ne!==null){q=C.child;for(var le=ne.firstContext;le!==null;){if(le.context===b){if(C.tag===1){le=us(-1,h&-h),le.tag=2;var Ee=C.updateQueue;if(Ee!==null){Ee=Ee.shared;var Ze=Ee.pending;Ze===null?le.next=le:(le.next=Ze.next,Ze.next=le),Ee.pending=le}}C.lanes|=h,le=C.alternate,le!==null&&(le.lanes|=h),qp(C.return,h,c),ne.lanes|=h;break}le=le.next}}else if(C.tag===10)q=C.type===c.type?null:C.child;else if(C.tag===18){if(q=C.return,q===null)throw Error(n(341));q.lanes|=h,ne=q.alternate,ne!==null&&(ne.lanes|=h),qp(q,h,c),q=C.sibling}else q=C.child;if(q!==null)q.return=C;else for(q=C;q!==null;){if(q===c){q=null;break}if(C=q.sibling,C!==null){C.return=q.return,q=C;break}q=q.return}C=q}mi(s,c,w.children,h),c=c.child}return c;case 9:return w=c.type,b=c.pendingProps.children,kl(c,h),w=da(w),b=b(w),c.flags|=1,mi(s,c,b,h),c.child;case 14:return b=c.type,w=Na(b,c.pendingProps),w=Na(b.type,w),q1(s,c,b,w,h);case 15:return U1(s,c,c.type,c.pendingProps,h);case 17:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:Na(b,w),Rd(s,c),c.tag=1,Ir(b)?(s=!0,D(c)):s=!1,kl(c,h),M1(c,b,w),rh(c,b,w,h),oh(null,c,b,!0,s,h);case 19:return Q1(s,c,h);case 22:return H1(s,c,h)}throw Error(n(156,c.tag))};function v_(s,c){return Xn(s,c)}function qI(s,c,h,b){this.tag=s,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ha(s,c,h,b){return new qI(s,c,h,b)}function Ch(s){return s=s.prototype,!(!s||!s.isReactComponent)}function UI(s){if(typeof s=="function")return Ch(s)?1:0;if(s!=null){if(s=s.$$typeof,s===F)return 11;if(s===P)return 14}return 2}function Ws(s,c){var h=s.alternate;return h===null?(h=ha(s.tag,c,s.key,s.mode),h.elementType=s.elementType,h.type=s.type,h.stateNode=s.stateNode,h.alternate=s,s.alternate=h):(h.pendingProps=c,h.type=s.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=s.flags&14680064,h.childLanes=s.childLanes,h.lanes=s.lanes,h.child=s.child,h.memoizedProps=s.memoizedProps,h.memoizedState=s.memoizedState,h.updateQueue=s.updateQueue,c=s.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=s.sibling,h.index=s.index,h.ref=s.ref,h}function qd(s,c,h,b,w,C){var q=2;if(b=s,typeof s=="function")Ch(s)&&(q=1);else if(typeof s=="string")q=5;else e:switch(s){case I:return Ro(h.children,w,C,c);case M:q=8,w|=8;break;case L:return s=ha(12,h,c,w|2),s.elementType=L,s.lanes=C,s;case Q:return s=ha(13,h,c,w),s.elementType=Q,s.lanes=C,s;case H:return s=ha(19,h,c,w),s.elementType=H,s.lanes=C,s;case W:return Ud(h,w,C,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case A:q=10;break e;case O:q=9;break e;case F:q=11;break e;case P:q=14;break e;case K:q=16,b=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return c=ha(q,h,c,w),c.elementType=s,c.type=b,c.lanes=C,c}function Ro(s,c,h,b){return s=ha(7,s,b,c),s.lanes=h,s}function Ud(s,c,h,b){return s=ha(22,s,b,c),s.elementType=W,s.lanes=h,s.stateNode={isHidden:!1},s}function jh(s,c,h){return s=ha(6,s,null,c),s.lanes=h,s}function Th(s,c,h){return c=ha(4,s.children!==null?s.children:[],s.key,c),c.lanes=h,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function HI(s,c,h,b,w){this.tag=c,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gi(0),this.expirationTimes=gi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gi(0),this.identifierPrefix=b,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Rh(s,c,h,b,w,C,q,ne,le){return s=new HI(s,c,h,ne,le),c===1?(c=1,C===!0&&(c|=8)):c=0,C=ha(3,null,null,c),s.current=C,C.stateNode=s,C.memoizedState={element:b,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hp(C),s}function $I(s,c,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:j,key:b==null?null:""+b,children:s,containerInfo:c,implementation:h}}function k_(s){if(!s)return $a;s=s._reactInternals;e:{if(vn(s)!==s||s.tag!==1)throw Error(n(170));var c=s;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Ir(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(s.tag===1){var h=s.type;if(Ir(h))return Tc(s,h,c)}return c}function __(s,c,h,b,w,C,q,ne,le){return s=Rh(h,b,!0,s,w,C,q,ne,le),s.context=k_(null),h=s.current,b=xi(),w=Hs(h),C=us(b,w),C.callback=c??null,Bs(h,C,w),s.current.lanes=w,Gr(s,w,b),Ri(s,b),s}function Hd(s,c,h,b){var w=c.current,C=xi(),q=Hs(w);return h=k_(h),c.context===null?c.context=h:c.pendingContext=h,c=us(C,q),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=Bs(w,c,q),s!==null&&(Ta(s,w,q,C),vd(s,w,q)),q}function $d(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function w_(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var h=s.retryLane;s.retryLane=h!==0&&h<c?h:c}}function Ah(s,c){w_(s,c),(s=s.alternate)&&w_(s,c)}function WI(){return null}var S_=typeof reportError=="function"?reportError:function(s){console.error(s)};function Ih(s){this._internalRoot=s}Wd.prototype.render=Ih.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(n(409));Hd(s,c,null,null)},Wd.prototype.unmount=Ih.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;Co(function(){Hd(null,s,null,null)}),c[Ea]=null}};function Wd(s){this._internalRoot=s}Wd.prototype.unstable_scheduleHydration=function(s){if(s){var c=_i();s={blockedOn:null,target:s,priority:c};for(var h=0;h<Zn.length&&c!==0&&c<Zn[h].priority;h++);Zn.splice(h,0,s),h===0&&wa(s)}};function Mh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Vd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function E_(){}function VI(s,c,h,b,w){if(w){if(typeof b=="function"){var C=b;b=function(){var Ee=$d(q);C.call(Ee)}}var q=__(c,b,s,0,null,!1,!1,"",E_);return s._reactRootContainer=q,s[Ea]=q.current,xo(s.nodeType===8?s.parentNode:s),Co(),q}for(;w=s.lastChild;)s.removeChild(w);if(typeof b=="function"){var ne=b;b=function(){var Ee=$d(le);ne.call(Ee)}}var le=Rh(s,0,!1,null,null,!1,!1,"",E_);return s._reactRootContainer=le,s[Ea]=le.current,xo(s.nodeType===8?s.parentNode:s),Co(function(){Hd(c,le,h,b)}),le}function Gd(s,c,h,b,w){var C=h._reactRootContainer;if(C){var q=C;if(typeof w=="function"){var ne=w;w=function(){var le=$d(q);ne.call(le)}}Hd(c,q,s,w)}else q=VI(h,c,s,w,b);return $d(q)}ir=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var h=ti(c.pendingLanes);h!==0&&(Kr(c,h|1),Ri(c,Kn()),(On&6)===0&&(Nl=Kn()+500,_t()))}break;case 13:Co(function(){var b=cs(s,1);if(b!==null){var w=xi();Ta(b,s,1,w)}}),Ah(s,1)}},Vn=function(s){if(s.tag===13){var c=cs(s,134217728);if(c!==null){var h=xi();Ta(c,s,134217728,h)}Ah(s,134217728)}},sn=function(s){if(s.tag===13){var c=Hs(s),h=cs(s,c);if(h!==null){var b=xi();Ta(h,s,c,b)}Ah(s,c)}},_i=function(){return un},zr=function(s,c){var h=un;try{return un=s,c()}finally{un=h}},Yt=function(s,c,h){switch(c){case"input":if(Ge(s,h),c=h.name,h.type==="radio"&&c!=null){for(h=s;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<h.length;c++){var b=h[c];if(b!==s&&b.form===s.form){var w=xl(b);if(!w)throw Error(n(90));bt(b),Ge(b,w)}}}break;case"textarea":De(s,h);break;case"select":c=h.value,c!=null&&an(s,!!h.multiple,c,!1)}},rt=Sh,Pt=Co;var GI={usingClientEntryPoint:!1,Events:[os,Ls,xl,re,Te,Sh]},Hc={findFiberByHostInstance:$i,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},KI={bundleType:Hc.bundleType,version:Hc.version,rendererPackageName:Hc.rendererPackageName,rendererConfig:Hc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:R.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Fr(s),s===null?null:s.stateNode},findFiberByHostInstance:Hc.findFiberByHostInstance||WI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kd.isDisabled&&Kd.supportsFiber)try{It=Kd.inject(KI),gn=Kd}catch{}}return Ai.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GI,Ai.createPortal=function(s,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mh(c))throw Error(n(200));return $I(s,c,null,h)},Ai.createRoot=function(s,c){if(!Mh(s))throw Error(n(299));var h=!1,b="",w=S_;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(w=c.onRecoverableError)),c=Rh(s,1,!1,null,null,h,!1,b,w),s[Ea]=c.current,xo(s.nodeType===8?s.parentNode:s),new Ih(c)},Ai.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var c=s._reactInternals;if(c===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Fr(c),s=s===null?null:s.stateNode,s},Ai.flushSync=function(s){return Co(s)},Ai.hydrate=function(s,c,h){if(!Vd(c))throw Error(n(200));return Gd(null,s,c,!0,h)},Ai.hydrateRoot=function(s,c,h){if(!Mh(s))throw Error(n(405));var b=h!=null&&h.hydratedSources||null,w=!1,C="",q=S_;if(h!=null&&(h.unstable_strictMode===!0&&(w=!0),h.identifierPrefix!==void 0&&(C=h.identifierPrefix),h.onRecoverableError!==void 0&&(q=h.onRecoverableError)),c=__(c,null,s,1,h??null,w,!1,C,q),s[Ea]=c.current,xo(s),b)for(s=0;s<b.length;s++)h=b[s],w=h._getVersion,w=w(h._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[h,w]:c.mutableSourceEagerHydrationData.push(h,w);return new Wd(c)},Ai.render=function(s,c,h){if(!Vd(c))throw Error(n(200));return Gd(null,s,c,!1,h)},Ai.unmountComponentAtNode=function(s){if(!Vd(s))throw Error(n(40));return s._reactRootContainer?(Co(function(){Gd(null,null,s,!1,function(){s._reactRootContainer=null,s[Ea]=null})}),!0):!1},Ai.unstable_batchedUpdates=Sh,Ai.unstable_renderSubtreeIntoContainer=function(s,c,h,b){if(!Vd(h))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return Gd(s,c,h,!1,b)},Ai.version="18.3.1-next-f1338f8080-20240426",Ai}var M_;function h4(){if(M_)return Dh.exports;M_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Dh.exports=tM(),Dh.exports}var L_;function nM(){if(L_)return Qd;L_=1;var e=h4();return Qd.createRoot=e.createRoot,Qd.hydrateRoot=e.hydrateRoot,Qd}var rM=nM();const iM=$o(rM),aM="modulepreload",sM=function(e){return"/"+e},O_={},g4=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=l(n.map(f=>{if(f=sM(f),f in O_)return;O_[f]=!0;const p=f.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":aM,p||(m.as="script"),m.crossOrigin="",m.href=f,d&&m.setAttribute("nonce",d),document.head.appendChild(m),p)return new Promise((x,v)=>{m.addEventListener("load",x),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return a.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},ms={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.version":"PAVE version","app.welcome_start":"Start a conversation to get going.","app.welcome_subtitle":"Your AI-powered development assistant","app.welcome_title":"Welcome to PAVE","chat.attach_image":"Attach image","chat.attach_file":"Attach file (image, docx, pdf, text)","chat.attachment":"Attachment","chat.attachment_with_index":"Attachment {index}","chat.copied":"Copied!","chat.copy":"Copy","chat.copy_message":"Copy message","chat.cancel_queued":"Remove from queue","chat.queued":"Queued","chat.edit_queued":"Edit queued message","chat.edit_resend":"Edit and resend","chat.read_only":"Read-only","chat.read_only_desc":"This is a read-only session from the TUI. Messages cannot be sent.","chat.regenerate":"Regenerate response","chat.scroll_to_bottom":"Scroll to bottom","chat.send_button":"Send message","chat.send_hint":"Press Enter to send, Shift+Enter for new line. Type / for commands","chat.send_placeholder":"Send a message...","chat.stop_generating":"Stop generating","chat.tool_bash":"Running command","chat.tool_edit":"Editing file","chat.tool_glob":"Searching files","chat.tool_grep":"Searching code","chat.tool_preparing":"Preparing tool call","chat.tool_preparing_name":"Preparing {name}","chat.tool_read":"Reading file","chat.tool_write":"Writing file","chat.viewing_terminal":"Viewing Terminal session (read-only)","chat.yesterday":"Yesterday","chat.yesterday_time":"Yesterday {time}","chat.viewing_archive":"Viewing archived session (read-only)","chat.compacting_context":"Compacting context","chat.compacted_switch_to_new":"Compacted — switch to new session","chat.unpin_compacted":"Unpin — go back to original","chat.show_thinking":"Show thinking","chat.hide_thinking":"Hide thinking","chat.hide_chat_input":"Hide chat input","chat.show_chat_input":"Show chat input","chat.monitor_only":"Monitor-only — input hidden","chat.thinking":"Thinking","chat.error_badge":"Error","chat.assistant_typing":"Assistant is typing","chat.working_directory":"Working Directory","chat.working_directory_current":"Current:","chat.working_directory_recent":"Recent:","chat.working_directory_change":"Change","chat.working_directory_cancel":"Cancel","chat.working_directory_create":"Create Directory","chat.working_directory_not_found":"Directory does not exist","chat.working_directory_invalid":"Invalid path","chat.working_directory_checking":"Checking path...","chat.working_directory_changed":"Working directory changed to {path}","chat.working_directory_created":"Directory created: {path}","chat.working_directory_create_failed":"Failed to create directory: {error}","chat.working_directory_remove_recent":"Remove from recent","chat.working_directory_has_agents_md":"Contains AGENTS.md","chat.working_directory_no_agents_md":"No AGENTS.md in this directory","chat.working_directory_new_path":"New path","chat.working_directory_placeholder":"/path/to/directory or ~/projects/...","chat.working_directory_not_set":"(not set)","chat.idle_injection_title":"Idle Injection","chat.idle_injection_toggle":"Enable idle injection","chat.idle_injection_message":"Injection message","chat.idle_injection_message_placeholder":"Message to inject when idle","chat.idle_injection_interval":"Idle interval (seconds)","chat.idle_injection_interval_desc":"How long to wait after the LLM finishes responding before injecting.","chat.idle_injection_max":"Max injections (0 = unlimited)","chat.idle_injection_max_desc":"Stops injecting after this many times. 0 means no limit.","chat.idle_injection_timeout_toggle":"Enable LLM timeout detection","chat.idle_injection_timeout_toggle_desc":"Detect when the LLM is stuck (no response) and re-inject.","chat.idle_injection_timeout_threshold":"Timeout threshold (seconds)","chat.idle_injection_timeout_threshold_desc":"How long to wait for the first token before considering the LLM hung.","chat.idle_injection_timeout_cooldown":"Timeout cooldown (seconds)","chat.idle_injection_timeout_cooldown_desc":"How long to wait after a timeout before re-injecting.","chat.idle_injection_save":"Save","chat.idle_injection_disable":"Disable","chat.idle_injection_saving":"Saving...","chat.idle_injection_disabling":"Disabling...","chat.idle_injection_saved":"Settings saved","chat.idle_injection_disabled_toast":"Idle injection disabled","chat.idle_injection_enabled_toast":"Idle injection enabled","chat.idle_injection_fired_toast":"Idle injection fired","chat.idle_injection_timeout_toast":"LLM timeout detected — retrying","chat.idle_injection_auto_badge":"auto","chat.session_info_title":"Session info","chat.session_info_soul":"Soul file","chat.session_info_soul_default":"Default AGENTS.md walk","chat.session_info_model":"Model","chat.session_info_reasoning":"Reasoning effort","chat.session_info_idle_injection":"Auto-injection","chat.session_info_scheduled":"Scheduled injections","chat.session_info_directory":"Working directory","chat.session_info_view_soul":"View soul","chat.session_info_copied":"Copied","chat.session_info_soul_error":"Could not read the soul file","chat.session_info_soul_loading":"Loading soul file…","chat.session_info_idle_on":"on","chat.session_info_idle_every":"every {s}s","scheduled_injection.title":"Scheduled Injections","scheduled_injection.subtitle":"Automatically inject messages at scheduled times","scheduled_injection.add":"Add Schedule","scheduled_injection.empty":"No schedules configured. Add one above.","scheduled_injection.time":"Time","scheduled_injection.repeat":"Repeat","scheduled_injection.repeat_every_day":"Every day","scheduled_injection.repeat_weekdays":"Weekdays","scheduled_injection.repeat_weekends":"Weekends","scheduled_injection.repeat_custom":"Custom","scheduled_injection.timezone":"Timezone","scheduled_injection.message":"Message (optional)","scheduled_injection.message_placeholder":"Leave empty for default check-in message","scheduled_injection.enabled":"Enabled","scheduled_injection.save":"Save Schedule","scheduled_injection.saving":"Saving...","scheduled_injection.delete":"Delete","scheduled_injection.day_sun":"Sun","scheduled_injection.day_mon":"Mon","scheduled_injection.day_tue":"Tue","scheduled_injection.day_wed":"Wed","scheduled_injection.day_thu":"Thu","scheduled_injection.day_fri":"Fri","scheduled_injection.day_sat":"Sat","scheduled_injection.fired_toast":"Scheduled injection fired","scheduled_injection.error_generic":"Failed to save schedule","chat.interrupted_badge":"Interrupted","chat.stopped_badge":"Stopped","chat.stopped_notice":"Stopped by user","chat.moe_auto":"Auto","chat.moe_fast":"Fast","chat.moe_fastest":"Fastest","chat.moe_tooltip":"Expert count — lower is faster but less accurate","chat.reasoning_max":"Max","chat.reasoning_high":"High","chat.reasoning_off":"Off","chat.reasoning_tooltip":"Reasoning effort — higher is smarter but slower","chat.idle_injection_mode":"Dispatch mode","chat.idle_injection_mode_desc":"How the injected message is queued.","chat.idle_injection_mode_urgent":"Urgent (between tool calls)","chat.idle_injection_mode_normal":"Normal (after turn)","chat.idle_injection_mode_idle":"Idle (after turn + delay)","chat.idle_injection_wait_ms":"Idle wait delay (seconds)","chat.idle_injection_wait_ms_desc":"Extra delay before dispatching when in Idle mode.","chat.quote_selection":"Quote","chat.copy_selection":"Copy","chat.quote_remove":"Remove quote","chat.quote_clear_all":"Clear all quotes","chat.quoted_from_assistant":"Quoted from assistant","chat.quoted_from_you":"Quoted from you","chat.quote_truncated":"Quote truncated to fit the limit","common.back":"Back","common.cancel":"Cancel","common.close":"Close","common.confirm":"Confirm","common.delete":"Delete","common.deleting":"Deleting...","common.edit":"Edit","common.error":"Error","common.loading":"Loading...","common.no":"No","common.optional":"(optional)","common.retry":"Retry","common.save":"Save","common.unknown_error":"Unknown error","common.success":"Success","common.yes":"Yes","login.email_placeholder":"Email","login.or":"or","login.password_placeholder":"Password","login.pave_subtitle":"Personal AI Virtual Environment","login.powered_by":"Powered by PAVE","login.sign_in":"Sign in to continue","login.sign_in_with_google":"Sign in with Google","login.sign_in_with_cloudflare":"Sign in with Cloudflare Access","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.error":"Question failed","question.expired":"Question expired","question.input_placeholder":"Type your answer...","question.select_all":"Select all that apply","question.submit":"Submit","question.submit_n":"Submit {count} answers","question.submitting":"Submitting...","question.reconnecting":"Reconnecting…","question.resolve_failed":"Could not reach the question service.","question.retry_connection":"Retry","question.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.compaction":"Compaction","settings.category.sessionBanner":"Session Banner","settings.category.sessionBehavior":"Session Behavior","settings.currently_set_to":"Currently set to: {path}","settings.default_prefix":"Default: {value}","settings.default_empty":"(empty)","settings.description":"Configure PAVE runtime settings. Most changes apply on save; some (e.g. timeouts) may require restarting PAVE.","settings.env_badge":"env","settings.env_override":"This value is currently overridden by the {envVar} environment variable.","settings.failed_to_load":"Failed to load settings: {error}","settings.language":"Language","settings.language_description":"Select your preferred language for the interface","settings.language_auto_applied":"✓ Language applied automatically","settings.no_changes":"No changes to save.","settings.not_set":"Not set","settings.enabled":"Enabled","settings.disabled":"Disabled","settings.notification_sound":"Notification Sound","settings.notification_sound_desc":"Play a sound when new inbox messages arrive","settings.native_notifications":"Native Notifications","settings.native_notifications_desc":"Show browser notifications for new inbox messages","settings.native_notifications_blocked":"Notifications blocked by browser — enable in browser settings","settings.native_notifications_permission":"Click to enable — permission will be requested","settings.native_notifications_unsupported":"Not supported in this browser","settings.auto_saved":"Changes apply immediately","settings.notifications":"Notifications","settings.partial_save":"Some settings could not be saved. See errors below.","settings.requires_restart":"(requires restart)","settings.reset":"Reset","settings.save":"Save","settings.save_failed":"Failed to save: {error}","settings.saved":"Settings saved successfully.","settings.saving":"Saving...","settings.source_default":"Default","settings.source_env":"ENV","settings.source_saved":"Saved","settings.title":"Settings","settings.category.experimental":"Experimental Features","settings.category.developer":"Developer","settings.v2.badge":"Settings","settings.v2.search_placeholder":"Search settings…","settings.v2.search_clear":"Clear search","settings.v2.no_matches":"No settings match your search.","settings.v2.search_results":"{count} matching settings","settings.v2.open":"Open","settings.v2.unsaved":"{count} unsaved","settings.v2.groups_aria":"Setting groups","settings.validating":"Validating...","settings.apply":"Apply","settings.workspace":"Workspace","settings.working_dir":"Working Directory","settings.working_dir_desc":"Set a custom working directory for file operations and tool execution. Leave empty to use the server default.","settings.working_dir_reset":"Working directory reset to server default","settings.working_dir_updated":"Working directory updated to: {path}","settings.working_dir_invalid":"Invalid directory path: {error}","settings.version_title":"Version","settings.current_version":"Current version","settings.latest_version":"Latest version","settings.update_available":"Update available","settings.update_button":"Update","settings.no_updates":"No updates available","settings.check_updates":"Check for Updates","settings.checking_updates":"Checking for updates…","settings.update_in_progress":"Update in progress…","settings.update_success":"Update successful","settings.update_failed":"Update failed","settings.check_updates_failed":"Check for updates failed","settings.model_registry.title":"Model Registry","settings.model_registry.builtin":"Built-in Models","settings.model_registry.user":"User Models","settings.model_registry.add_model":"+ Add Model","settings.model_registry.no_user_models":'No user-defined models. Click "+ Add Model" to add one.',"settings.model_registry.name":"Model Name","settings.model_registry.name_placeholder":"Model name (e.g. my-custom-model)","settings.model_registry.provider":"Provider","settings.model_registry.provider_placeholder":"e.g. openai","settings.model_registry.displayName":"Display Name","settings.model_registry.displayName_placeholder":"My Model","settings.model_registry.url":"Endpoint URL","settings.model_registry.url_placeholder":"http(s)://… or pave(s)://…","settings.model_registry.tier":"Tier","settings.model_registry.tier_placeholder":"e.g. fast, premium","settings.model_registry.limit_context":"Context Limit","settings.model_registry.limit_output":"Output Limit","settings.model_registry.cost_input":"Input Cost ($/1M tokens)","settings.model_registry.cost_output":"Output Cost ($/1M tokens)","settings.model_registry.save":"Save","settings.model_registry.saving":"Saving...","settings.model_registry.cancel":"Cancel","settings.model_registry.add":"Add","settings.model_registry.adding":"Adding...","settings.model_registry.edit":"Edit model","settings.model_registry.delete":"Delete model","settings.model_registry.delete_confirm":'Remove model "{name}" from the registry?',"settings.model_registry.loading":"Loading model registry...","settings.model_registry.load_error":"Failed to load registry: {error}","settings.model_registry.context_k":"{value}K ctx","settings.model_registry.target":"Alias Target (optional)","settings.model_registry.target_placeholder":"e.g. github-copilot/claude-opus-4.7","settings.model_registry.target_hint":"If set, this entry is an alias — selections route to the target model. Leave empty for a self-contained model with its own endpoint URL.","settings.model_registry.spec":"Model Spec","settings.model_registry.spec_placeholder":"e.g. github-copilot/claude-opus-4.7 or pave://host/path?model=…","settings.model_registry.spec_hint":"Enter a provider/model alias (e.g. github-copilot/claude-opus-4.7) or a full pave://, paves://, http://, or https:// URL. URLs are detected automatically.","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits & cost)","settings.model_registry.error_name_required":"Model name is required","settings.model_registry.error_name_reserved":'Model name "{name}" is reserved',"settings.model_registry.error_name_exists":'A model named "{name}" already exists',"settings.model_registry.error_rename_cleanup":"Renamed, but failed to remove old entry: {error}","settings.custom_model":"Custom model...","settings.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","sidebar.conversations":"Conversations","sidebar.delete":"Delete","sidebar.delete_all":"Delete All Conversations","sidebar.delete_all_confirm":"Delete the conversations listed here? Sessions belonging to other apps are left alone. This cannot be undone.","sidebar.delete_all_title":"Delete All Sessions","sidebar.delete_confirm":"Delete this conversation?","sidebar.delete_title":"Delete Session","sidebar.hide":"Hide sidebar","sidebar.load_more":"Load more conversations","sidebar.load_more_count":"Load more — showing {loaded} of {total}","sidebar.all_loaded_count":"All {total} conversations shown","sidebar.search_result_count":"{total} matching conversations","sidebar.show_other_apps":"Show other apps","sidebar.hide_other_apps":"Hide other apps","sidebar.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.resize":"Resize sidebar","sidebar.regenerate_title":"Regenerate Title","sidebar.send_to_session":"Send to another session","send_to_session.title":"Send to another session","send_to_session.target_label":"Send to","send_to_session.message_label":"Message","send_to_session.delivery_note":"Delivered by the app that has that session open, usually within a couple of seconds. It may be a different app than this one.","send_to_session.queued":"Queued. It will be picked up by whichever app has that session open.","send_to_session.no_targets":"No other sessions to send to.","send_to_session.send":"Send","send_to_session.sending":"Sending...","send_to_session.cancel":"Cancel","send_to_session.close":"Close","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.untitled":"Untitled","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.archive":"Archive","sidebar.unarchive":"Unarchive","sidebar.confirmArchive":"Archive this session? It will be hidden from the sidebar.","sidebar.show_archived":"Show archived","sidebar.hide_archived":"Hide archived","sidebar.pinned":"Pinned","sidebar.today":"Today","sidebar.yesterday":"Yesterday","sidebar.this_week":"This Week","sidebar.this_month":"This Month","sidebar.older":"Older","sidebar.archived":"Archived","sidebar.export":"Export as YAML","sidebar.import":"Import session","sidebar.drop_to_import":"Drop session file to import","sidebar.session_processing":"Session is processing","sidebar.icon_pinned":"Pinned — kept at the top and exempt from cleanup","sidebar.icon_archive":"Archive copy — a read-only snapshot of an earlier conversation","sidebar.icon_compacted":"Compacted — older messages were summarized to free context","sidebar.more_actions":"More actions","sidebar.age_now":"now","sidebar.age_minutes":"{n}m","sidebar.age_hours":"{n}h","sidebar.age_days":"{n}d","sidebar.age_weeks":"{n}w","import.invalid_file_type":"Only .yaml or .yml session files can be imported","import.file_too_large":"Import file too large (max 10MB)","import.read_error":"Failed to read file. Please try again.","skills.back_to_chat":"Back to chat","skills.cancel":"Cancel","skills.clear_all":"Clear all","skills.clear_confirm":"Clear all credentials for {skill}?","skills.clear_title":"Clear Credentials","skills.close":"Close","skills.close_credential_editor":"Close credential editor","skills.configure":"Configure","skills.configure_skill":"Configure {skill}","skills.configured":"Configured","skills.current_value":"(current: {value})","skills.enter_token":"Enter at least one token value","skills.enter_value":"Enter value...","skills.install":"Install","skills.installed":"Installed","skills.installed_count":"{installed} installed, {available} available","skills.installing":"Installing...","skills.install_failed":"Install failed: {error}","skills.leave_blank":"Leave blank to keep current","skills.load_installed_failed":"Failed to load installed skills: {error}","skills.load_marketplace_failed":"Failed to load marketplace: {error}","skills.needs_setup":"Needs setup","skills.no_credentials_needed":"This skill does not require any credentials.","skills.no_description":"No description","skills.no_match":"No skills match your search.","skills.no_skills":"No skills found.","skills.not_installed":"Not installed","skills.oauth_connect":"Connect with {provider}","skills.oauth_connect_hint":"Use OAuth to authenticate with {provider}. Click the button below to open the authorization page.","skills.oauth_connected":"Connected to {provider}","skills.oauth_disconnect":"Disconnect from {provider}","skills.oauth_connecting":"Connecting...","skills.oauth_needs_credentials":"Enter Client ID and Client Secret above first, then you can connect to {provider}.","skills.save":"Save","skills.saving":"Saving...","skills.search_placeholder":"Search skills...","skills.skill_management":"Skill Management","skills.subtitle":"Manage AI tool capabilities","skills.tab_all":"All","skills.tab_available":"Available","skills.tab_installed":"Installed","skills.tab_marketplace":"Marketplace","skills.title":"Skills","skills.check_updates":"Check for Updates","skills.checking_updates":"Checking...","skills.update":"Update","skills.updating":"Updating...","skills.update_available":"Update available: v{version}","skills.update_success":"Updated to v{version}","skills.update_failed":"Update failed","skills.update_check_failed":"Check failed","skills.update_check_failures":"{count} check failed","skills.update_unsupported":"Manual install","skills.update_unsupported_count":"{count} not checked","skills.up_to_date":"Up to date","skills.updates_available":"{count} update(s) available","skills.no_updates":"All skills are up to date","skills.uninstall":"Uninstall","skills.uninstall_title":"Uninstall Skill","skills.uninstall_confirm":"Uninstall {skill}? Your saved credentials will be preserved.","skills.uninstalling":"Uninstalling...","skills.uninstall_failed":"Uninstall failed: {error}","skills.toggle_title":"Manage skills for this session","skills.toggle_header":"Session Skills","skills.toggle_hint":"Toggle skills on/off for this chat only","skills.default":"Default","skills.default_for_new_sessions":"Enable by default for new sessions","skills.reset_to_defaults":"Reset to defaults","auth.device_code_title":"GitHub Copilot Authentication","auth.device_code_instructions":"Open {url} and enter code: {code}","auth.device_code_waiting":"Waiting for authorization...","task.activity":"Activity","task.awaiting":"Awaiting approval","task.completed":"Completed","task.error":"Error","task.no_active":"No active tasks. Send a message to get started.","task.processing":"Processing...","task.tool_bash":"Bash","task.tool_edit":"Edit","task.tool_editing":"Editing {target}","task.tool_glob":"Glob","task.tool_glob_desc":"Searching for files","task.tool_grep":"Grep","task.tool_grep_desc":"Searching code","task.tool_read":"Read","task.tool_reading":"Reading {target}","task.tool_write":"Write","task.tool_writing":"Writing {target}","task.working":"Working on it...","terminal.decrease_font":"Decrease font size","terminal.increase_font":"Increase font size","terminal.matrix_mode":"Matrix","terminal.no_output":"No terminal output yet","terminal.prompt":"$","theme.dark":"Switch to dark mode","theme.light":"Switch to light mode","time.days":"{count}d ","time.hours":"{count}h ","time.just_now":"just now","time.milliseconds":"{count}ms","time.minutes":"{count}m ","time.seconds":"{count}s","token.cache_read":"Cache Read","token.cache_write":"Cache Write","token.generating":"Generating...","token.idle":"Idle","token.input":"Input","token.model":"Model","token.output":"Output","token.session_cost":"Session","token.tokens":"tokens","token.total_cost":"Total Cost","token_usage.compacting":"Compacting...","token_usage.generating":"Generating...","token_usage.idle":"Idle","token_usage.messages":"Messages","token_usage.model":"Model","token_usage.originally":"Originally","token_usage.session_info":"Session Info","token_usage.status":"Status","tool.completed":"Done","tool.error":"Error","tool.running":"Running...","tool.tool":"Tool","user_menu.agents":"Agent Management","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","spotlight.title":"Search Sessions","spotlight.new_chat":"New Chat","spotlight.placeholder":"Search sessions by title...","spotlight.results":"Session results","spotlight.recent_sessions":"Recent Sessions","spotlight.no_results":"No sessions found","spotlight.searching":"Searching...","spotlight.untitled":"Untitled Session","spotlight.current":"current","spotlight.navigate":"navigate","spotlight.select":"select","spotlight.close":"close","slashCommand.title":"Skills","slashCommand.skills":"Skills","slashCommand.commands":"commands","slashCommand.command":"command","slashCommand.noResults":"No matching commands","slashCommand.notConfigured":"not configured","slashCommand.back":"Back to skills","slashCommand.navigate":"navigate","slashCommand.select":"select","slashCommand.close":"close","slashCommand.hint":"Type / to see available commands","archiveViewer.title":"Original Conversation History","archiveViewer.messages":"messages","archiveViewer.loading":"Loading archived messages...","archiveViewer.noArchive":"No archived history available for this session.","archiveViewer.readOnly":"Read-only archive","archiveViewer.archivedAt":"Archived","archiveViewer.close":"Close","archiveViewer.loadError":"Failed to load archive","archiveViewer.you":"You","archiveViewer.assistant":"Assistant","compaction.title":"Conversation compacted","compaction.showSummary":"Show summary","compaction.viewOriginal":"View original history","compaction.viewInHistory":"View in History","compaction.server.title":"Server auto-compact","compaction.server.status":"Context auto-compacted by server","compaction.mode.client":"Client (PAVE summarizes)","compaction.mode.server":"Server (vllm-mlx auto-compact)","compaction.mode.auto":"Auto (detect from provider)","compaction.banner_title":"This session was compacted from a previous conversation.","compaction.view_original":"View original","compaction.dismiss":"Dismiss","compaction.user_message_label":"Summarizing our conversation to keep things efficient.","compaction.continuation_message_label":"Compaction done. Please continue.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Conversation summarized — {count} earlier messages collapsed; summary below","messages.load_earlier":"Load earlier messages","messages.loading_earlier":"Loading earlier messages...","compaction.hide_history":"Hide messages before compaction","compaction.empty_title":"This conversation was summarized","compaction.empty_body":"Earlier messages are collapsed to save context. Show them to see the full history.","compaction.empty_action":"Show {count} earlier messages","credits.limit_reached":"Credit Limit Reached","credits.limit_message":"You've used all your available credits. Add more to continue using the service.","credits.add_credits":"Add Credits","credits.dismiss":"Dismiss","dlp.heading":"Privacy & DLP Settings","dlp.subtitle":"Configure data loss prevention patterns and privacy mode","dlp.title":"DLP Settings","dlp.close":"Close DLP settings","dlp.cancel":"Cancel","dlp.save":"Save","dlp.saving":"Saving...","dlp.discard_title":"Discard Changes","dlp.discard_confirm":"Discard unsaved changes to DLP settings?","dlp.enable_label":"Enable Data Loss Prevention","dlp.enable_desc":"When enabled, outgoing messages are scanned for sensitive data before sending to the AI model.","dlp.default_action_label":"Default action on detection","dlp.default_action_desc":"What happens when a pattern matches. 'Ask' shows a modal, 'Always reroute' sends to the private model, 'Warn only' logs and proceeds.","dlp.reroute_model_label":"Private model (reroute target)","dlp.reroute_model_desc":"The model/provider used for private mode. Format: provider/modelID","dlp.builtin_patterns":"Built-in patterns","dlp.builtin_desc":"Always-available detection patterns. Toggle individual patterns on or off.","dlp.user_patterns":"Custom patterns","dlp.user_patterns_desc":"Patterns you define. These are saved to your policy file and persist across restarts.","dlp.no_user_patterns":"No custom patterns yet. Add one below.","dlp.add_pattern":"Add a pattern","dlp.pattern_name":"Name","dlp.regex_pattern":"Regex","dlp.severity":"Severity","dlp.add":"Add","dlp.remove_pattern":"Remove pattern","dlp.remove_pattern_aria":"Remove pattern {name}","dlp.pattern_exists":"Pattern '{name}' already exists","dlp.name_required":"Pattern name is required","dlp.regex_required":"Regex pattern is required","dlp.invalid_regex":"Invalid regex syntax","user_menu.board":"Agent Board","board.title":"Agent Board","board.back_to_chat":"Back to chat","board.back_to_topics":"Back to topics","board.read_only_hint":"Agents post here via tools — this page is read-only","board.post_count":"{count} posts","board.search_placeholder":"Search the board…","board.search":"Search","board.clear_search":"Clear","board.search_results":"{count} matches","board.no_matches":"No matches","board.no_topics":"No topics yet — agents create them with the board tools","board.no_posts":"No posts","board.post_deleted":"[deleted]","board.delete_post":"Delete post","board.delete_topic":"Delete topic","board.prev_page":"Previous","board.next_page":"Next","board.page_info":"{from}–{to} of {total}","user_menu.capabilities":"Capabilities","capabilities.title":"Capabilities","capabilities.back_to_chat":"Back to chat","capabilities.close":"Close","capabilities.search_placeholder":"Search capabilities…","capabilities.filter_all":"All","capabilities.filter_skill":"Skills","capabilities.filter_mcp":"MCPs","capabilities.no_capabilities":"No capabilities match.","capabilities.no_description":"No description.","capabilities.docs":"Docs","capabilities.docs_missing":"No docs found for this skill.","capabilities.install":"Install","capabilities.update":"Update","capabilities.uninstall":"Uninstall","capabilities.uninstall_confirm":"Confirm uninstall","capabilities.cancel":"Cancel","capabilities.done":"Done.","capabilities.needs_review":"Needs review — tool surface changed after approval","capabilities.requires_mcps":"Requires MCPs","capabilities.composite_installed":"Installed skill {name} with its MCPs","capabilities.changed_tools":"Changed tools (not bridged until re-approval):","capabilities.reapprove":"Re-approve","capabilities.mcp_error":"MCP error","capabilities.token_label":"API token (bearer)","capabilities.token_stored":"token stored","capabilities.token_placeholder":"Paste the token — stored in ~/.pave/tokens.yaml, never in servers.json","capabilities.token_save":"Save token","capabilities.token_clear":"Clear token","capabilities.token_note":"The token is attached only inside the MCP manager; it is never exposed to the model, shell, or skills.","capabilities.bridged":"Bridged tools","capabilities.deferred":"deferred","capabilities.retry":"Retry","capabilities.oauth_connect":"Connect account","capabilities.oauth_pending":"Waiting for authorization… complete it in the browser window that opened.","capabilities.oauth_connected":"Connected. The capability is ready.","capabilities.oauth_reconsent":"Re-consent required: the stored grant cannot be refreshed (or the server url/auth changed). Connect again — the old token is never sent to a new origin.","app.triggers_tab":"Triggers","triggers.title":"Triggers","triggers.back_to_chat":"Back to chat","triggers.create":"New trigger","triggers.edit":"Edit","triggers.delete":"Delete","triggers.copy":"Copy","triggers.copy_failed":"Could not copy the webhook URL.","triggers.reveal":"Reveal","triggers.hide":"Hide","triggers.empty":"No triggers yet.","triggers.loading":"Loading triggers…","triggers.dismiss":"Dismiss","triggers.cancel":"Cancel","triggers.save":"Save","triggers.name":"Name","triggers.type":"Type","triggers.target_mode":"Target","triggers.target_existing":"Existing session","triggers.target_spawn":"New session","triggers.session_id":"Session ID","triggers.soul":"Soul","triggers.model":"Model","triggers.template":"Message template","triggers.payload_format":"Body format","triggers.payload_format_help":"How the inbound body is delivered when no template is set. YAML is easier to read; JSON is the default.","triggers.experimental_tag":"experimental","triggers.request_failed":"The request failed."},Zs={en:ms},oM={"zh-TW":()=>g4(()=>import("./zh-TW-GZcBUO6X.js"),[])},Pl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function D_(e){if(Zs[e])return Zs[e];const t=oM[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),ms;try{const n=await t();return Zs[e]=n.default||n,Zs[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),ms}}function m4(e,t,n){let r=e[t];return r===void 0&&e!==ms&&(r=ms[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(a,o)=>{const l=n[o];return l!==void 0?String(l):a}):r}const x4=y.createContext(null);function lM({initialLocale:e="en",children:t}){const r=Pl.map(m=>m.code).includes(e)?e:"en",[a,o]=y.useState(r),[l,u]=y.useState(Zs[r]||ms),d=y.useRef(0);y.useEffect(()=>{let m=!1;if(r!=="en"&&!Zs[r]){const x=++d.current;D_(r).then(v=>{if(m||d.current!==x)return;const k=v===ms&&r!=="en"?"en":r;Zs[k]=v,u(v),k!==r&&o(k)})}return()=>{m=!0,d.current+=1}},[]);const f=y.useCallback(async m=>{const x=++d.current,v=await D_(m);if(d.current!==x)return;const k=v===ms&&m!=="en"?"en":m;Zs[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),p=y.useCallback((m,x)=>m4(l,m,x),[l]),g=y.useMemo(()=>({t:p,locale:a,setLocale:f,availableLocales:Pl}),[p,a,f]);return i.jsx(x4.Provider,{value:g,children:t})}function rn(){const e=y.useContext(x4);return e||{t:(t,n)=>m4(ms,t,n),locale:"en",setLocale:()=>{},availableLocales:Pl}}function cM(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Pl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Pl.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=Pl.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function uM({darkMode:e,onToggle:t}){const{t:n}=rn();return i.jsx("button",{onClick:t,className:"p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}var Qv=h4();const dM=$o(Qv);function fM({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=rn(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(function(){e&&p.current&&p.current.focus()},[e]),y.useEffect(function(){if(!e)return;function v(k){k.key==="Escape"&&(typeof k.preventDefault=="function"&&k.preventDefault(),typeof k.stopImmediatePropagation=="function"?k.stopImmediatePropagation():typeof k.stopPropagation=="function"&&k.stopPropagation(),t())}return document.addEventListener("keydown",v,!0),function(){document.removeEventListener("keydown",v,!0)}},[e,t]),y.useEffect(function(){if(!e||!f.current)return;function v(k){if(k.key==="Tab"){var _=f.current.querySelectorAll("button:not([disabled])");if(_.length!==0){var S=_[0],E=_[_.length-1];k.shiftKey?document.activeElement===S&&(k.preventDefault(),E.focus()):document.activeElement===E&&(k.preventDefault(),S.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var g=o||d("confirm_dialog.confirm"),m=l||d("confirm_dialog.cancel"),x=u?"bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white":"bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white";return i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(v){v.target===v.currentTarget&&t()},children:i.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-label":r,className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-hidden transition-all duration-150",children:[i.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),i.jsx("div",{className:"px-5 py-4",children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a})}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.jsx("button",{ref:p,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:m}),i.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 "+x,children:g})]})]})})}const y4=y.createContext(null);function pM({children:e}){var{t}=rn(),n=y.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},a=y.useState(r),o=a[0],l=a[1],u=y.useCallback(function(p){n.current&&(n.current(!1),n.current=null);var g=p||{};return new Promise(function(m){n.current=m,l({open:!0,title:g.title||t("confirm_dialog.confirm"),message:g.message||"",confirmLabel:g.confirmLabel||"",cancelLabel:g.cancelLabel||"",destructive:g.destructive||!1})})},[t]),d=y.useCallback(function(){l(r),n.current&&(n.current(!1),n.current=null)},[]),f=y.useCallback(function(){l(r),n.current&&(n.current(!0),n.current=null)},[]);return i.jsxs(y4.Provider,{value:u,children:[e,i.jsx(fM,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function Iu(){var e=y.useContext(y4);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const Gf=180,wu=256,b4=480,hM=360;function v4(e){const n=(Number.isFinite(e)?e:1280)-hM;return Math.min(b4,Math.max(Gf,n))}function cv(e,t){const n=v4(t),r=Number.isFinite(e)?e:wu;return Math.min(n,Math.max(Gf,Math.round(r)))}function gM(e){if(e==null||e==="")return wu;const t=parseInt(e,10);return!Number.isFinite(t)||t<Gf||t>b4?wu:t}function P_(e,t,n){const r=Number.isFinite(e)?e:t;return Math.min(n,Math.max(t,Math.round(r)))}const mM=8,xM=32;function yM({effectiveWidth:e,effectiveMaxWidth:t,minWidth:n=Gf,onCommit:r,getPaneEl:a}){const{t:o}=rn(),l=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=y.useRef(e);f.current=e,y.useEffect(()=>()=>{d.current&&d.current()},[]);const p=m=>{if(m.pointerType==="mouse"&&m.button!==0)return;m.preventDefault();const x=m.currentTarget,v=a?a():null,k=m.clientX,_=f.current;try{x.setPointerCapture(m.pointerId)}catch{}l.current=m.pointerId;const S=document.body.style.cursor,E=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let N=!1;const R=M=>{if(l.current!==null&&M.pointerId!==l.current)return;const L=cv(_+(M.clientX-k),window.innerWidth);v&&v.style.setProperty("--pave-sidebar-w",L+"px"),u.current=L},T=M=>{if(N)return;N=!0,window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",j),window.removeEventListener("lostpointercapture",j),document.body.style.cursor=S,document.body.style.userSelect=E;const L=l.current;if(l.current=null,L!==null)try{x.releasePointerCapture(L)}catch{}M&&u.current!==null?r(u.current):v&&v.style.setProperty("--pave-sidebar-w",f.current+"px"),u.current=null,d.current=null},j=()=>T(!1),I=()=>T(!0);window.addEventListener("pointermove",R),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",j),window.addEventListener("lostpointercapture",j),d.current=()=>T(!1)},g=m=>{const x=m.shiftKey?xM:mM;let v=null;m.key==="ArrowLeft"?v=e-x:m.key==="ArrowRight"?v=e+x:m.key==="Home"?v=n:m.key==="End"&&(v=t),v!==null&&(m.preventDefault(),r(cv(v,window.innerWidth)))};return i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o("sidebar.resize"),"aria-valuemin":n,"aria-valuemax":t,"aria-valuenow":e,tabIndex:0,onPointerDown:p,onKeyDown:g,className:"hidden md:block absolute right-0 top-0 bottom-0 w-2 z-10 cursor-ew-resize touch-none select-none group",children:i.jsx("div",{className:"pointer-events-none ml-auto h-full w-0.5 bg-current text-gray-500 dark:text-gray-400 opacity-80 group-hover:w-1 group-hover:opacity-100"})})}function bM(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const a=new Date(r);if(a.setDate(a.getDate()-1),n>=a)return"yesterday";const o=new Date(r);if(o.setDate(o.getDate()-o.getDay()),n>=o)return"thisWeek";const l=new Date(t.getFullYear(),t.getMonth(),1);return n>=l?"thisMonth":"older"}function vM(e,t){const n={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},r={today:t("sidebar.today"),yesterday:t("sidebar.yesterday"),thisWeek:t("sidebar.this_week"),thisMonth:t("sidebar.this_month"),older:t("sidebar.older")};for(let l=0;l<e.length;l++){const u=e[l],d=bM(u.time&&u.time.updated?u.time.updated:0);n[d].push(u)}const a=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<a.length;l++){const u=a[l];n[u].length>0&&o.push({key:u,label:r[u],sessions:n[u]})}return o}function kM(e,t){if(!e)return"";const n=Date.now()-e;if(n<60*1e3)return t("sidebar.age_now");const r=Math.floor(n/(60*1e3));if(r<60)return t("sidebar.age_minutes",{n:r});const a=Math.floor(r/60);if(a<24)return t("sidebar.age_hours",{n:a});const o=Math.floor(a/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function F_(e){return e.source==="archive"||e._readOnly}const _M={rename:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z",regenerate:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15",export:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",archive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4",unarchive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4l3 3m0 0l3-3m-3 3V12",delete:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",more:"M6 12h.01M12 12h.01M18 12h.01",send:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"};function Ao({name:e,className:t}){return i.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:_M[e]})})}function B_({className:e,filled:t}){return i.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:i.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})})}const Bh=216,Xd=8;function wM({anchor:e,items:t,label:n,onClose:r}){const a=y.useRef(null),[o,l]=y.useState(null);y.useEffect(()=>{const d=a.current;if(!d)return;const f=d.offsetHeight;let p=e.align==="right"?e.x-Bh:e.x;p=Math.max(Xd,Math.min(p,window.innerWidth-Bh-Xd));let g=e.y;g+f>window.innerHeight-Xd&&(g=Math.max(Xd,e.flipY-f)),l({left:p,top:g})},[e]),y.useEffect(()=>{if(!o||!a.current)return;const d=a.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),y.useEffect(()=>{function d(p){a.current&&!a.current.contains(p.target)&&r()}function f(p){p.key==="Escape"&&(p.stopPropagation(),r())}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f,!0),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f,!0),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[r]);const u=d=>{if(d.key!=="ArrowDown"&&d.key!=="ArrowUp")return;d.preventDefault();const f=Array.from(a.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const p=f.indexOf(document.activeElement),g=d.key==="ArrowDown"?(p+1)%f.length:(p-1+f.length)%f.length;f[g].focus()};return Qv.createPortal(i.jsx("div",{ref:a,role:"menu","aria-label":n,onKeyDown:u,className:"fixed z-50 py-1 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 shadow-lg",style:{width:Bh,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?i.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):i.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{r(),d.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${d.danger?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:[i.jsx("span",{className:"shrink-0 opacity-70",children:d.icon}),i.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function SM({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:a,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:p,onExportSession:g,onSendToSession:m,onImportSession:x,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:S,onClose:E,onToggle:N,hasMoreSessions:R,onLoadMoreSessions:T,showOtherApps:j,onToggleShowOtherApps:I,hasMoreOtherApps:M,onLoadMoreOtherApps:L,otherAppsCount:A,search:O,onSearchChange:F,loadedCount:Q,totalCount:H,sidebarWidth:P=wu,onSidebarWidthChange:K}){const{t:W}=rn(),Y=Iu(),[ce,z]=y.useState(O||"");y.useEffect(()=>{typeof O=="string"&&O!==ce&&z(O)},[O]);const G=me=>{z(me),F&&F(me)},[X,B]=y.useState(null),[te,V]=y.useState(""),[U,oe]=y.useState(null),ae=y.useRef(null),xe=y.useRef(null),[Se,Xe]=y.useState(()=>typeof window<"u"?window.innerWidth:1280);y.useEffect(()=>{let me=0;const pt=()=>{me||(me=requestAnimationFrame(()=>{me=0,Xe(window.innerWidth)}))};return window.addEventListener("resize",pt),()=>{window.removeEventListener("resize",pt),me&&cancelAnimationFrame(me)}},[]);const bt=cv(P,Se),at=v4(Se);y.useLayoutEffect(()=>{xe.current&&xe.current.style.setProperty("--pave-sidebar-w",bt+"px")},[bt]);const yt=y.useCallback(()=>xe.current,[]),et=y.useCallback(()=>{const me=ae.current;ae.current=null,oe(null),me&&me.isConnected&&me.focus()},[]),Ie=(me,pt,gt)=>{ae.current=gt||null,oe({id:me.id,anchor:pt})},Ge=ce?e.filter(function(me){return(me.title||W("sidebar.untitled")).toLowerCase().includes(ce.toLowerCase())}):e,{pinnedSessions:tt,regularSessions:kt,archivedSessions:Kt}=y.useMemo(()=>{const me=[],pt=[],gt=[];for(let wt=0;wt<Ge.length;wt++){const ht=Ge[wt];ht.archived?gt.push(ht):ht.pinned?me.push(ht):pt.push(ht)}return{pinnedSessions:me,regularSessions:pt,archivedSessions:gt}},[Ge]),an=y.useMemo(()=>vM(kt,W),[kt,W]),Vt=me=>{B(me.id),V(me.title||"")},ze=me=>{te.trim()&&u(me,te.trim()),B(null),V("")},De=async me=>{!me.archived&&!await Y({title:W("sidebar.archive"),message:W("sidebar.confirmArchive"),confirmLabel:W("sidebar.archive")})||p(me.id,!me.archived)},nt=async me=>{await Y({title:W("sidebar.delete_title"),message:W("sidebar.delete_confirm"),destructive:!0,confirmLabel:W("sidebar.delete")})&&o(me.id)},ft=me=>{if(F_(me))return[];const pt=[{key:"rename",label:W("sidebar.rename"),hint:"F2",icon:i.jsx(Ao,{name:"rename",className:"w-4 h-4"}),onSelect:()=>Vt(me)}];d&&pt.push({key:"regenerate",label:W("sidebar.regenerate_title"),icon:i.jsx(Ao,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(me.id)}),g&&pt.push({key:"export",label:W("sidebar.export"),icon:i.jsx(Ao,{name:"export",className:"w-4 h-4"}),onSelect:()=>g(me.id)}),m&&pt.push({key:"send-to-session",label:W("sidebar.send_to_session"),icon:i.jsx(Ao,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(me.id)});const gt=[];return f&&(!me.archived||me.pinned)&>.push({key:"pin",label:me.pinned?W("sidebar.unpin"):W("sidebar.pin"),icon:i.jsx(B_,{className:"w-4 h-4",filled:me.pinned}),onSelect:()=>f(me.id,!me.pinned)}),p&>.push({key:"archive",label:me.archived?W("sidebar.unarchive"):W("sidebar.archive"),icon:i.jsx(Ao,{name:me.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>De(me)}),gt.length>0&&(pt.push({key:"sep-state",separator:!0}),pt.push(...gt)),pt.push({key:"sep-danger",separator:!0}),pt.push({key:"delete",label:W("sidebar.delete"),hint:"Del",danger:!0,icon:i.jsx(Ao,{name:"delete",className:"w-4 h-4"}),onSelect:()=>nt(me)}),pt},ue=y.useMemo(()=>U&&e.find(me=>me.id===U.id)||null,[U,e]);y.useEffect(()=>{U&&!ue&&et()},[U,ue,et]);const be=(me,pt)=>{const gt=pt&&pt.dimmed,wt=F_(me),ht=!!(U&&U.id===me.id),$t=!wt,Wt=(Je,zt)=>Ie(me,Je,zt);return i.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${me.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":gt?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>r(me.id),onContextMenu:Je=>{!$t||X===me.id||(Je.preventDefault(),Wt({x:Je.clientX,y:Je.clientY,flipY:Je.clientY,align:"left"},Je.currentTarget))},onKeyDown:Je=>{if(Je.currentTarget===Je.target){if(Je.key==="Enter"||Je.key===" "){Je.preventDefault(),r(me.id);return}if($t){if(Je.key==="F2")Je.preventDefault(),Vt(me);else if(Je.key==="Delete")Je.preventDefault(),nt(me);else if(Je.key==="ContextMenu"){Je.preventDefault();const zt=Je.currentTarget.getBoundingClientRect();Wt({x:zt.right,y:zt.bottom,flipY:zt.top,align:"right"},Je.currentTarget)}}}},children:X===me.id?i.jsx("input",{autoFocus:!0,value:te,onChange:Je=>V(Je.target.value),onBlur:()=>ze(me.id),onKeyDown:Je=>{Je.key==="Enter"?(Je.preventDefault(),Je.stopPropagation(),Je.currentTarget.blur()):Je.key==="Escape"?(Je.stopPropagation(),B(null)):Je.key===" "&&Je.stopPropagation()},onClick:Je=>Je.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-hidden"}):i.jsxs(i.Fragment,{children:[me.pinned&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",role:"img",title:W("sidebar.icon_pinned"),"aria-label":W("sidebar.icon_pinned"),children:i.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})}),me.source==="archive"&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:W("sidebar.icon_archive"),"aria-label":W("sidebar.icon_archive"),children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"})}),me.compactedAt&&me.source!=="archive"&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:W("sidebar.icon_compacted"),"aria-label":W("sidebar.icon_compacted"),children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),n[me.id]&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse shrink-0",role:"status",title:W("sidebar.session_processing"),"aria-label":W("sidebar.session_processing")}),i.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${gt?"italic":""}`,"data-menu-open":ht?"true":"false",children:[i.jsx("span",{className:"truncate min-w-0",children:me.title||W("sidebar.untitled")}),me.archived&&i.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 shrink-0",children:["(",W("sidebar.archived"),")"]})]}),i.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[i.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${ht?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:kM(me.time&&me.time.updated,W)}),i.jsxs("div",{className:`items-center gap-0.5 ${ht?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!me.archived||me.pinned)&&i.jsx("button",{onClick:Je=>{Je.stopPropagation(),f(me.id,!me.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:me.pinned?W("sidebar.unpin"):W("sidebar.pin"),"aria-label":me.pinned?W("sidebar.unpin"):W("sidebar.pin"),children:i.jsx(B_,{className:`w-4 h-4 ${me.pinned?"text-amber-500":""}`,filled:me.pinned})}),$t&&i.jsx("button",{onClick:Je=>{Je.stopPropagation();const zt=Je.currentTarget.getBoundingClientRect();Wt({x:zt.right,y:zt.bottom+4,flipY:zt.top-4,align:"right"},Je.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${ht?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":W("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":ht,children:i.jsx(Ao,{name:"more",className:"w-4 h-4"})})]})]})]})},me.id)},qe=me=>i.jsx("div",{className:"px-2 pt-3 pb-1",children:i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:me})});return i.jsxs(i.Fragment,{children:[S&&i.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:E}),!S&&i.jsx("div",{className:"shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:i.jsx("button",{onClick:N,className:"p-1.5 rounded-lg bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:W("sidebar.show"),"aria-label":W("sidebar.show"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsxs("aside",{ref:xe,className:`
|
|
41
|
-
${S?"translate-x-0":"-translate-x-full"}
|
|
42
|
-
transition-transform duration-200 ease-in-out
|
|
43
|
-
fixed md:relative z-30 md:z-auto
|
|
44
|
-
top-14 md:top-0 bottom-0 left-0
|
|
45
|
-
w-64 md:w-[var(--pave-sidebar-w,16rem)] border-r border-gray-200 dark:border-gray-800
|
|
46
|
-
bg-gray-50 dark:bg-gray-900 flex flex-col
|
|
47
|
-
${S?"md:flex":"md:hidden"}
|
|
48
|
-
`,children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:W("sidebar.conversations")}),i.jsx("button",{onClick:N,className:"p-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:W("sidebar.hide"),"aria-label":W("sidebar.hide"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),i.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[i.jsx("button",{onClick:a,className:"flex-1 py-2 px-4 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:W("app.new_chat")}),x&&i.jsx("button",{onClick:()=>{const me=document.createElement("input");me.type="file",me.accept=".yaml,.yml",me.onchange=pt=>{const gt=pt&&pt.target&&pt.target.files,wt=gt&>[0];if(wt){const ht=wt.name.toLowerCase();if(!ht.endsWith(".yaml")&&!ht.endsWith(".yml")){v&&v(W("import.invalid_file_type"));return}const $t=10*1024*1024;if(wt.size>$t){v&&v(W("import.file_too_large"));return}const Wt=new FileReader;Wt.onload=Je=>{const zt=Je&&Je.target?Je.target.result:null;if(typeof zt!="string"){v&&v(W("import.read_error"));return}x(zt)},Wt.onerror=()=>{v&&v(W("import.read_error"))},Wt.readAsText(wt)}},me.click()},className:"py-2 px-3 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 text-sm transition-colors",title:W("sidebar.import"),"aria-label":W("sidebar.import"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})})]}),i.jsx("div",{className:"px-3 pb-2",children:i.jsx("input",{type:"text",placeholder:W("sidebar.search_placeholder"),value:ce,onChange:me=>G(me.target.value),className:"w-full px-3 py-1.5 rounded-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-hidden focus:ring-2 focus:ring-primary-500/30"})}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[tt.length===0&&an.every(me=>me.sessions.length===0)&&(!k||Kt.length===0)&&i.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:W(ce?"sidebar.no_matches":"sidebar.no_conversations")}),tt.length>0&&i.jsxs(i.Fragment,{children:[qe(W("sidebar.pinned")),tt.map(me=>be(me))]}),an.map(me=>i.jsxs("div",{children:[(tt.length>0||an.length>1)&&qe(me.label),me.sessions.map(pt=>be(pt))]},me.key)),k&&Kt.length>0&&i.jsxs(i.Fragment,{children:[qe(W("sidebar.archived")),Kt.map(me=>be(me,{dimmed:!0}))]}),(R||M)&&(T||L)&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.jsxs("button",{onClick:()=>{R&&T&&T(),M&&L&&L()},className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-primary-600 dark:text-primary-400 hover:bg-primary-50 dark:hover:bg-primary-900/20 transition-colors",children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof H=="number"&&H>0&&typeof Q=="number"?W("sidebar.load_more_count",{loaded:Q+(A||0),total:H+(A||0)}):W("sidebar.load_more")]})}),!R&&!M&&typeof H=="number"&&H>0&&i.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:ce?W("sidebar.search_result_count",{total:H+(A||0)}):W("sidebar.all_loaded_count",{total:H+(A||0)})}),I&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.jsxs("button",{onClick:I,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M4 5h16a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6a1 1 0 011-1z"})}),W(j?"sidebar.hide_other_apps":"sidebar.show_other_apps")]})}),_&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.jsxs("button",{onClick:_,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L21 21"}):i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})}),W(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),Ge.some(function(me){return me.source!=="legacy"&&!me._readOnly})&&l&&i.jsx("div",{className:"pt-3 pb-2 px-1",children:i.jsxs("button",{onClick:async()=>{await Y({title:W("sidebar.delete_all_title"),message:W("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:W("sidebar.delete_all")})&&l()},className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg border border-red-300 dark:border-red-800 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 text-xs font-medium transition-colors",children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),W("sidebar.delete_all")]})})]}),K&&i.jsx(yM,{effectiveWidth:bt,effectiveMaxWidth:at,onCommit:K,getPaneEl:yt})]}),U&&ue&&i.jsx(wM,{anchor:U.anchor,items:ft(ue),label:W("sidebar.more_actions"),onClose:et})]})}const Xs="pave-draft-";function EM(e){return Xs+e}function NM(e){if(e)try{localStorage.removeItem(EM(e))}catch{}}function CM(e){const t=new Set;return e.forEach(n=>{n&&n.id&&t.add(n.id)}),t}function jM(e,t,n){return!e||!e.id||t.has(e.id)?!1:Number.isFinite(e.prependedAt)&&e.prependedAt>=n}function z_({fetched:e,current:t,prependsSince:n}={}){const r=Array.isArray(e)?e:[],a=Array.isArray(t)?t:[],o=typeof n=="number"?n:1/0,l=CM(r),u=a.filter(d=>jM(d,l,o));return u.length===0?r:u.concat(r)}function TM(){const e=typeof window<"u"&&window.__PAVE_BASE_PATH__||"";if(typeof e!="string")return"";const t=e.trim().replace(/\/+$/,"");return t?t.charAt(0)==="/"?t:"/"+t:""}function wr(e){const t=TM(),n=typeof e=="string"?e:"";return t?n?t+(n.charAt(0)==="/"?n:"/"+n):t:n}const Pa=wr(""),uv="pave-working-directory";function Fl(){if(typeof window>"u")return null;try{return localStorage.getItem(uv)||null}catch{return null}}function zh(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(uv):localStorage.setItem(uv,e)}catch{}}const k4="web";let dv=null;function q_(e){dv=e}let Wc=null,U_=0;function Xv(){return Wc||(Date.now()<U_?Promise.resolve(!1):(Wc=(async()=>{let e=!1,t=null;try{const n=await fetch(`${Pa}/auth/membership/restore`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(n.ok){const r=await n.json().catch(()=>({}));e=!!r.authenticated,t=r.user||null}}catch{e=!1}finally{U_=Date.now()+5e3,Wc=null}try{dv&&dv({recovered:e,user:t})}catch{}return e})(),Wc))}function H_(e){return typeof e=="string"&&e.indexOf("/auth/")===0}let su=null,Vc=null;async function RM(){return su||(Vc||(Vc=fetch(`${Pa}/api/csrf-token`).then(e=>e.ok?e.json():null).then(e=>(Vc=null,su=e&&typeof e.token=="string"?e.token:null,su)).catch(()=>(Vc=null,null))),Vc)}async function st(e,t={}){const n=Fl(),r={"Content-Type":"application/json","X-PAVE-Client":k4,...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:a,...o}=t,l=(o.method||"GET").toUpperCase(),u=o.csrf===!0;if(delete o.csrf,(l!=="GET"||u)&&!H_(e)){const f=await RM();f&&(r["X-CSRF-Token"]=f)}const d=await fetch(`${Pa}${e}`,{...o,headers:r});if(!d.ok){d.status===401&&!H_(e)&&(su=null,Xv());let f=null;try{const g=await d.text();try{f=JSON.parse(g)}catch{f=null}if(!f){const m=new Error(`${d.status}: ${g||d.statusText}`);throw m.status=d.status,m}}catch(g){if(g.message)throw g.status===void 0&&(g.status=d.status),g;const m=new Error(`${d.status}: ${d.statusText}`);throw m.status=d.status,m}const p=new Error(`${d.status}: ${f.error||f.message||JSON.stringify(f)}`);throw p.status=d.status,p.body=f,d.status===403&&typeof f.error=="string"&&f.error.indexOf("direct local access")!==-1&&(p.message=`${d.status}: Start OAuth from a direct local session.`),f.reauthRequired&&(p.reauthRequired=!0),p}return d.json()}function Dl(e){const t=new URLSearchParams;e&&(typeof e.limit=="number"&&Number.isFinite(e.limit)&&e.limit>0&&t.set("limit",String(e.limit)),typeof e.offset=="number"&&Number.isFinite(e.offset)&&t.set("offset",String(e.offset)),e.includeArchived&&t.set("includeArchived","true"),typeof e.q=="string"&&e.q.trim()&&t.set("q",e.q.trim()),e.onlyOtherApps&&t.set("onlyOtherApps","true"),e.onlyArchived&&t.set("onlyArchived","true")),t.set("includeOtherApps",e&&e.includeOtherApps===!1?"false":"true");const n=t.toString(),r=n?`/session?${n}`:"/session";return st(r)}function $_(e){return st("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function qh(e){return st(`/session/${e}`)}function AM(e){return st(`/session/${e}/soul`)}function Ki(e,t){return st(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function IM(e){return st(`/session/${e}/regenerate-title`,{method:"POST"})}function MM(e,{senderSessionID:t,text:n}){return st(`/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:n})})}function LM(e){return st(`/session/${e}/fork`,{method:"POST"})}function OM(e){return st(`/session/${e}`,{method:"DELETE"})}function DM(e){return st(`/session/${e}/archive/session`,{method:"POST"})}function PM(){return st("/session",{method:"DELETE"})}function W_(e,t,n){const r=new URLSearchParams;t&&r.set("fresh","1"),n&&n.limit!=null&&r.set("limit",String(n.limit)),n&&n.before&&r.set("before",n.before);const a=r.toString();return st(`/session/${e}/message${a?"?"+a:""}`)}function V_(e,t,n,r,a,o){const l={content:t,async:!0};return n&&n.length>0&&(l.parts=n),r&&(l.model=r),a&&(l.agent=a),o&&o.enqueue&&(l.enqueue=!0,o.priority&&(l.priority=o.priority),o.displayContent&&(l.displayContent=o.displayContent)),o&&o.moeTopK&&(l.moe_top_k=o.moeTopK),o&&o.reasoningEffort&&(l.reasoning_effort=o.reasoningEffort),o&&o.adaptiveQuality&&(l.adaptive_quality=!0),st(`/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function Uh(e){return st(`/session/${e}/queue`)}function G_(e,t,n){const r={content:t};return n&&n.parts&&(r.parts=n.parts),n&&n.model&&(r.model=n.model),n&&n.agent&&(r.agent=n.agent),n&&n.priority&&(r.priority=n.priority),n&&n.displayContent&&(r.displayContent=n.displayContent),n&&n.moeTopK&&(r.moe_top_k=n.moeTopK),n&&n.reasoningEffort&&(r.reasoning_effort=n.reasoningEffort),n&&n.adaptiveQuality&&(r.adaptive_quality=!0),st(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function K_(e,t){return st(`/session/${e}/queue/${t}`,{method:"DELETE"})}function FM(e,t){return st(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function BM(e){return st(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function zM(e){return st(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function qM(e){return st(`/session/${e}/abort`,{method:"POST"})}function _4(e){return st(`/session/${e}/idle-injection`)}function UM(e,t){return st(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function HM(e){return st(`/session/${e}/idle-injection`,{method:"DELETE"})}function $M(e){return st(`/session/${e}/scheduled-injections`)}function WM(e,t){return st(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function VM(e,t,n){return st(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function GM(e,t){return st(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function KM(){return st("/config/providers")}function fv(){return st("/api/models/registry")}function YM(){return st("/auth/status")}function QM(){return st("/auth/logout",{method:"POST"})}function XM(){return st("/api/permissions/pending")}function ZM(e){return st(`/api/permissions/confirm/${e}`,{method:"POST"})}function JM(e){return st(`/api/permissions/deny/${e}`,{method:"POST"})}function eL(){return st("/api/questions/pending")}function tL(e,t){return st(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function nL(e){return st(`/api/questions/${e}/reject`,{method:"POST"})}function Zv(){return st("/skills")}function rL(){return st("/capabilities")}function iL(e){return st(`/capabilities/${encodeURIComponent(e)}/docs`)}function aL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/install`,{method:"POST"})}function sL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/status`)}function oL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/update`,{method:"POST"})}function lL(e,t){return st(`/capabilities/mcp/${encodeURIComponent(e)}`,{method:"DELETE"})}function cL(e,t,n){return st(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify({access:t,refresh:void 0})})}function uL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function dL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/review`,{method:"POST"})}function fL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/refresh`,{method:"POST"})}function pL(e){return st("/capabilities/mcp/custom/add",{method:"POST",body:JSON.stringify({url:e})})}function hL(e){return st(`/capabilities/skill/${encodeURIComponent(e)}/install`,{method:"POST"})}function gL(e){return st(`/capabilities/skill/${encodeURIComponent(e)}`,{method:"DELETE"})}function mL(e){return st(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function xL(e,t){return st(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/result${t?`?state=${encodeURIComponent(t)}`:""}`,{csrf:!0})}function yL(){return st("/skills/commands")}function bL(){return st("/skills/registry")}function vL(e){return st(`/skills/${encodeURIComponent(e)}`)}function kL(e){return st(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function _L(e){return st(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function wL(){return st("/skills/check-updates")}function SL(e,t){return st(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function EL(e){return st(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function NL(e){return st(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function w4(){return st("/api/skill-defaults")}function CL(e){return st("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function jL(e){return st(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function TL(e){return st(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function RL(e,t){return st(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function Y_(){return st("/config")}function AL(){return st("/inspector/sessions")}async function IL(e){const t=Fl(),n={"X-PAVE-Client":k4};t&&(n["x-opencode-directory"]=t);const r=await fetch(`${Pa}/inspector/session/${encodeURIComponent(e)}/events`,{headers:n});if(!r.ok){const a=new Error(`${r.status}: ${r.statusText}`);throw a.status=r.status,a}return r.text()}function Q_(e,t){return st(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function ML(e){return st(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function LL(e){const t=e?"?model="+encodeURIComponent(e):"";return st("/config/adaptive-quality"+t)}function pv(){return st("/path")}function X_(e){return st("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function OL(e){return st("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function S4(){return st("/settings")}function DL(e){return st("/settings",{method:"PUT",body:JSON.stringify(e)})}async function PL(e){const t=await fetch(Pa+"/session/"+e+"/export",{credentials:"include"});if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Export failed")}const n=await t.blob(),r=t.headers.get("X-Filename")||"session.yaml",a=URL.createObjectURL(n),o=document.createElement("a");o.href=a,o.download=r,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(a),o.parentNode&&o.parentNode.removeChild(o)},0)}function FL(e){return st("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function BL(e,t,n,r){const a=Fl(),o={};a&&(o["x-opencode-directory"]=a),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=Pa+"/api/transcribe";const u=[];t&&u.push("language="+encodeURIComponent(t)),n&&u.push("model="+encodeURIComponent(n));const d=r&&r.initialPrompt;d&&u.push("initial_prompt="+encodeURIComponent(d)),u.length>0&&(l+="?"+u.join("&"));const f=await fetch(l,{method:"POST",credentials:"include",headers:o,body:e}),p=await f.text();let g=null;if(p)try{g=JSON.parse(p)}catch{}if(!f.ok){const m=new Error(g&&g.error||"Transcription failed (HTTP "+f.status+")");throw m.status=f.status,m.code=g&&g.code,m.fallback=g&&g.fallback,m}if(!g){const m=new Error("Invalid response from transcription endpoint");throw m.code="invalid_response",m.fallback=!0,m}return g}let Al=null,ou=0;function hv(){const e=Date.now();return Al&&e<ou||(Al=st("/api/transcribe/config").then(t=>(ou=Date.now()+5e3,t)).catch(t=>{throw Al=null,ou=0,t}),ou=1/0),Al}function zL(e){return Al=null,ou=0,st("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function Z_(){return st("/session/status")}function qL(e){return st(`/session/${encodeURIComponent(e)}/dlp/status`)}function UL(){return st("/api/dlp/policy")}function HL(e){return st("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function J_(e){const t=await fetch(`${Pa}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function $L(e){return(await fetch(`${Pa}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function Hh(e){try{const t=await fetch(`${Pa}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function WL(e){const t=await fetch(`${Pa}/session/${e}/plan`,{credentials:"include"});if(!t.ok){const n=new Error(t.status===404?"PLAN.md not found":`${t.status}: ${t.statusText}`);throw n.status=t.status,n}return t.json()}async function ew(e){try{const t=await fetch(`${Pa}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function VL(e){const t=new URLSearchParams;e&&(e.category&&t.set("category",e.category),t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const n=t.toString();return st(`/api/board/topics${n?`?${n}`:""}`)}function tw(e){return st(`/api/board/topic/${encodeURIComponent(e)}`)}function GL(e){return st(`/api/board/search?q=${encodeURIComponent(e)}`)}function KL(e){return st(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function YL(e,t){return st(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}const xs=wr("");async function ys(e,t={}){const n=await fetch(e,{credentials:"include",...t});return n.status===401&&await Xv()?fetch(e,{credentials:"include",...t}):n}function Hl(e,t){const n=new Error(t);return n.status=e.status,n}async function QL(){const e=await ys(xs+"/api/pricing");if(!e.ok)throw Hl(e,"Failed to fetch pricing: "+e.statusText);return e.json()}async function XL(e){const t=await ys(xs+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw Hl(t,n.error||"Failed to update pricing")}return t.json()}async function ZL(){const e=await ys(xs+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw Hl(e,t.error||"Failed to reset pricing")}return e.json()}async function $h(){const e=await ys(xs+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",n=await e.json().catch(()=>({})),r=n.error||n.message||n.output||e.statusText;throw r?r.indexOf(t)===0||r===t?new Error(r):new Error(t+": "+r):new Error(t)}return e.json()}async function JL(){const e=await ys(xs+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function e3(){const e=await ys(xs+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(n)===0||a===n?new Error(a):new Error(n+": "+a):new Error(n)}const t=await e.json();if(t.status!=="success"){let n=t.error||t.message||"";throw t.output&&!t.error&&!t.message?n="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(n+=t.output?" ("+t.output+")":""),n||(n="Update returned unexpected status: "+(t.status||"unknown")),new Error(n)}return t}async function nw(e,t){const n=await ys(xs+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw Hl(n,r.error||"Failed to save model: "+n.statusText)}return n.json()}async function rw(e){const t=await ys(xs+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw Hl(t,n.error||"Failed to delete model: "+t.statusText)}return t.json()}async function t3(){const e=await ys(xs+"/api/models");if(!e.ok)throw Hl(e,"Failed to fetch models: "+e.statusText);return e.json()}function n3(){return st("/api/trigger")}function r3(e){return st("/api/trigger",{method:"POST",body:JSON.stringify(e)})}function i3(e,t){return st(`/api/trigger/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}function a3(e){return st(`/api/trigger/${encodeURIComponent(e)}`,{method:"DELETE"})}function s3(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function o3({open:e,onClose:t,senderSessionID:n}){var{t:r}=rn(),a=y.useRef(null),o=y.useRef(null),l=y.useState([]),u=l[0],d=l[1],f=y.useState(""),p=f[0],g=f[1],m=y.useState(""),x=m[0],v=m[1],k=y.useState(!1),_=k[0],S=k[1],E=y.useState(""),N=E[0],R=E[1],T=y.useState(!1),j=T[0],I=T[1];y.useEffect(function(){if(e){var A=!1;return R(""),I(!1),v(""),Dl({includeOtherApps:!0,limit:100}).then(function(O){if(!A){var F=Array.isArray(O)?O:O&&O.sessions||[],Q=F.filter(function(H){return H&&H.id!==n});d(Q),g(Q.length?Q[0].id:"")}}).catch(function(O){A||R(O&&O.message?O.message:String(O))}),function(){A=!0}}},[e,n]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function A(O){O.key==="Escape"&&(typeof O.preventDefault=="function"&&O.preventDefault(),typeof O.stopImmediatePropagation=="function"?O.stopImmediatePropagation():typeof O.stopPropagation=="function"&&O.stopPropagation(),t())}return document.addEventListener("keydown",A,!0),function(){document.removeEventListener("keydown",A,!0)}},[e,t]);var M=y.useCallback(function(){!p||!x.trim()||_||(S(!0),R(""),MM(p,{senderSessionID:n,text:x}).then(function(){S(!1),I(!0)}).catch(function(A){S(!1),R(A&&A.message?A.message:String(A))}))},[p,x,_,n]);if(!e)return null;var L=!!p&&!!x.trim()&&!_;return i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(A){A.target===A.currentTarget&&t()},children:i.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":r("send_to_session.title"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 outline-hidden transition-all duration-150",children:[i.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("send_to_session.title")})}),i.jsxs("div",{className:"px-5 py-4 space-y-3",children:[j?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("send_to_session.queued")}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.target_label"),i.jsx("select",{value:p,onChange:function(A){g(A.target.value)},className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2",children:u.map(function(A){return i.jsx("option",{value:A.id,children:(A.title||A.id)+" — "+s3(A)},A.id)})})]}),u.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("send_to_session.no_targets")}):null,i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.message_label"),i.jsx("textarea",{ref:o,value:x,onChange:function(A){v(A.target.value)},rows:4,className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2"})]}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("send_to_session.delivery_note")})]}),N?i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:N}):null]}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:r(j?"send_to_session.close":"send_to_session.cancel")}),j?null:i.jsx("button",{type:"button",onClick:M,disabled:!L,className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus:ring-2 focus:ring-offset-2",children:r(_?"send_to_session.sending":"send_to_session.send")})]})]})})}const Kf=0,eo=1,$l=2,E4=4;function iw(e){return()=>e}function l3(e){e()}function N4(e,t){return n=>e(t(n))}function aw(e,t){return()=>e(t)}function c3(e,t){return n=>e(t,n)}function Jv(e){return e!==void 0}function u3(...e){return()=>{e.map(l3)}}function Wl(){}function Yf(e,t){return t(e),e}function d3(e,t){return t(e)}function cr(...e){return e}function Un(e,t){return e(eo,t)}function hn(e,t){e(Kf,t)}function ek(e){e($l)}function nr(e){return e(E4)}function Dt(e,t){return Un(e,c3(t,Kf))}function Ia(e,t){const n=e(eo,r=>{n(),t(r)});return n}function sw(e){let t,n;return r=>a=>{t=a,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function C4(e,t){return e===t}function lr(e=C4){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Qt(e){return t=>n=>{e(n)&&t(n)}}function jt(e){return t=>N4(t,e)}function Qi(e){return t=>()=>{t(e)}}function Ve(e,...t){const n=f3(...t);return((r,a)=>{switch(r){case $l:ek(e);return;case eo:return Un(e,n(a))}})}function Aa(e,t){return n=>r=>{n(t=e(t,r))}}function Uo(e){return t=>n=>{e>0?e--:t(n)}}function gs(e){let t=null,n;return r=>a=>{t=a,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function yn(...e){const t=Array.from({length:e.length});let n=0,r=null;const a=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Un(o,d=>{const f=n;n|=u,t[l]=d,f!==a&&n===a&&r&&(r(),r=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};n===a?u():r=u}}function f3(...e){return t=>e.reduceRight(d3,t)}function p3(e){let t,n;const r=()=>t==null?void 0:t();return function(a,o){switch(a){case eo:return o?n===o?void 0:(r(),n=o,t=Un(e,o),t):(r(),Wl);case $l:r(),n=null;return}}}function ct(e){let t=e;const n=Cn();return((r,a)=>{switch(r){case Kf:t=a;break;case eo:{a(t);break}case E4:return t}return n(r,a)})}function Wr(e,t){return Yf(ct(t),n=>Dt(e,n))}function Cn(){const e=[];return((t,n)=>{switch(t){case Kf:e.slice().forEach(r=>{r(n)});return;case $l:e.splice(0);return;case eo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Zi(e){return Yf(Cn(),t=>Dt(e,t))}const h3={singleton:!0};function Bn(e,t=[],n=h3){const{singleton:r}=n;return{constructor:e,dependencies:t,id:g3(),singleton:r}}const g3=()=>Symbol("id");function m3(e){const t=new Map,n=({constructor:r,dependencies:a,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=r(a.map(d=>n(d)));return l&&t.set(o,u),u};return n(e)}function _r(...e){const t=Cn(),n=Array.from({length:e.length});let r=0;const a=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Un(o,d=>{n[l]=d,r|=u,r===a&&hn(t,n)})}),function(o,l){switch(o){case $l:{ek(t);return}case eo:return r===a&&l(n),Un(t,l)}}}function nn(e,t=C4){return Ve(e,lr(t))}function Tf(...e){return function(t,n){switch(t){case $l:return;case eo:return u3(...e.map(r=>Un(r,n)))}}}const Pr={DEBUG:0,INFO:1,WARN:2,ERROR:3},x3={[Pr.DEBUG]:"debug",[Pr.ERROR]:"error",[Pr.INFO]:"log",[Pr.WARN]:"warn"},y3=()=>typeof globalThis>"u"?window:globalThis,to=Bn(()=>{const e=ct(Pr.ERROR);return{log:ct((t,n,r=Pr.INFO)=>{const a=y3().VIRTUOSO_LOG_LEVEL??nr(e);r>=a&&console[x3[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function b3(e){return"self"in e?e.document.documentElement:e}function j4(e){const t=b3(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function Do(e,t){return j4(e)?-t:t}function ow(e,t){return j4(e)?-t:t}function Wo(e,t,n){return tk(e,t,n).callbackRef}function tk(e,t,n){const r=Lt.useRef(null);let a=l=>{};const o=Lt.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const u=()=>{const d=l[0].target;d.offsetParent!==null&&e(d)};n?u():requestAnimationFrame(u)}):null,[e,n]);return a=l=>{l&&t?(o==null||o.observe(l),r.current=l):(r.current&&(o==null||o.unobserve(r.current)),r.current=null)},{callbackRef:a,ref:r}}function v3(e,t,n,r,a,o,l,u,d){const f=Lt.useCallback(p=>{var E;const g=k3(p.children,t,u?"offsetWidth":"offsetHeight",a);let m=p.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const x=((E=m.lastElementChild)==null?void 0:E.dataset.viewportType)==="window";let v;x&&(v=m.ownerDocument.defaultView);const k=l?u?l.scrollWidth:l.scrollHeight:x?u?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:u?m.scrollWidth:m.scrollHeight,_=l?u?l.offsetWidth:l.offsetHeight:x?u?v.innerWidth:v.innerHeight:u?m.offsetWidth:m.offsetHeight,S=l?u?Do(l,l.scrollLeft):l.scrollTop:x?u?Do(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?Do(m,m.scrollLeft):m.scrollTop;r({scrollHeight:k,scrollTop:Math.max(S,0),viewportHeight:_}),o==null||o(u?lw("column-gap",getComputedStyle(p).columnGap,a):lw("row-gap",getComputedStyle(p).rowGap,a)),g!==null&&e(g)},[e,t,a,o,l,r,u]);return tk(f,n,d)}function k3(e,t,n,r){const a=e.length;if(a===0)return null;const o=[];for(let l=0;l<a;l++){const u=e.item(l);if(u.dataset.index===void 0)continue;const d=parseInt(u.dataset.index,10),f=parseFloat(u.dataset.knownSize),p=t(u,n);if(p===0&&r("Zero-sized element, this should not happen",{child:u},Pr.ERROR),p===f)continue;const g=o[o.length-1];o.length===0||g.size!==p||g.endIndex!==d-1?o.push({endIndex:d,size:p,startIndex:d}):o[o.length-1].endIndex++}return o}function lw(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Pr.WARN),t==="normal"?0:parseInt(t??"0",10)}const nk=typeof document>"u"?Lt.useEffect:Lt.useLayoutEffect;function T4(e,t,n){const r=Lt.useRef(null),a=Lt.useCallback(d=>{if(!(d!=null&&d.offsetParent))return;const f=d.getBoundingClientRect(),p=f.width;let g,m;if(t){const x=t.getBoundingClientRect(),v=f.top-x.top;m=x.height-Math.max(0,v),g=v+t.scrollTop}else{const x=l.current.ownerDocument.defaultView;m=x.innerHeight-Math.max(0,f.top),g=f.top+x.scrollY}r.current={listHeight:f.height,offsetTop:g,visibleHeight:m,visibleWidth:p},e(r.current)},[e,t]),{callbackRef:o,ref:l}=tk(a,!0,n),u=Lt.useCallback(()=>{a(l.current)},[a,l]);return Lt.useEffect(()=>{var f;if(t){t.addEventListener("scroll",u);const p=new ResizeObserver(()=>{requestAnimationFrame(u)});return p.observe(t),()=>{t.removeEventListener("scroll",u),p.unobserve(t)}}const d=(f=l.current)==null?void 0:f.ownerDocument.defaultView;return d==null||d.addEventListener("scroll",u),d==null||d.addEventListener("resize",u),()=>{d==null||d.removeEventListener("scroll",u),d==null||d.removeEventListener("resize",u)}},[u,t,l]),o}const vi=Bn(()=>{const e=Cn(),t=Cn(),n=ct(0),r=Cn(),a=Cn(),o=ct(0),l=Cn(),u=Cn(),d=ct(0),f=ct(0),p=ct(0),g=ct(0),m=Cn(),x=Cn(),v=ct(!1),k=ct(!1),_=ct(!1);return Dt(Ve(e,jt(({scrollTop:S})=>S)),t),Dt(Ve(e,jt(({scrollHeight:S})=>S)),u),Dt(t,o),{deviation:n,deviationCommitted:r,fixedFooterHeight:p,fixedHeaderHeight:f,footerHeight:g,headerHeight:d,horizontalDirection:k,scrollBy:x,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:a,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),Su={lvl:0};function R4(e,t){const n=e.length;if(n===0)return[];let{index:r,value:a}=t(e[0]);const o=[];for(let l=1;l<n;l++){const{index:u,value:d}=t(e[l]);o.push({end:u-1,start:r,value:a}),r=u,a=d}return o.push({end:1/0,start:r,value:a}),o}function $n(e){return e===Su}function Eu(e,t){if(!$n(e))return t===e.k?e.v:t<e.k?Eu(e.l,t):Eu(e.r,t)}function Oa(e,t,n="k"){if($n(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Oa(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Oa(e.l,t,n)}function Li(e,t,n){return $n(e)?M4(t,n,1):t===e.k?Dr(e,{k:t,v:n}):t<e.k?cw(Dr(e,{l:Li(e.l,t,n)})):cw(Dr(e,{r:Li(e.r,t,n)}))}function Po(){return Su}function Bl(e,t,n){if($n(e))return[];const r=Oa(e,t)[0];return _3(mv(e,r,n))}function gv(e,t){if($n(e))return Su;const{k:n,l:r,r:a}=e;if(t===n){if($n(r))return a;if($n(a))return r;const[o,l]=I4(r);return _f(Dr(e,{k:o,l:A4(r),v:l}))}return t<n?_f(Dr(e,{l:gv(r,t)})):_f(Dr(e,{r:gv(a,t)}))}function Fo(e){return $n(e)?[]:[...Fo(e.l),{k:e.k,v:e.v},...Fo(e.r)]}function mv(e,t,n){if($n(e))return[];const{k:r,l:a,r:o,v:l}=e;let u=[];return r>t&&(u=u.concat(mv(a,t,n))),r>=t&&r<=n&&u.push({k:r,v:l}),r<=n&&(u=u.concat(mv(o,t,n))),u}function _f(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Wh(t))return L4(Dr(e,{lvl:n-1}));if(!$n(t)&&!$n(t.r))return Dr(t.r,{l:Dr(t,{r:t.r.l}),lvl:n,r:Dr(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Wh(e))return xv(Dr(e,{lvl:n-1}));if(!$n(r)&&!$n(r.l)){const a=r.l,o=Wh(a)?r.lvl-1:r.lvl;return Dr(a,{l:Dr(e,{lvl:n-1,r:a.l}),lvl:a.lvl+1,r:xv(Dr(r,{l:a.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Dr(e,t){return M4(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function A4(e){return $n(e.r)?e.l:_f(Dr(e,{r:A4(e.r)}))}function Wh(e){return $n(e)||e.lvl>e.r.lvl}function I4(e){return $n(e.r)?[e.k,e.v]:I4(e.r)}function M4(e,t,n,r=Su,a=Su){return{k:e,l:r,lvl:n,r:a,v:t}}function cw(e){return xv(L4(e))}function L4(e){const{l:t}=e;return!$n(t)&&t.lvl===e.lvl?Dr(t,{r:Dr(e,{l:t.r})}):e}function xv(e){const{lvl:t,r:n}=e;return!$n(n)&&!$n(n.r)&&n.lvl===t&&n.r.lvl===t?Dr(n,{l:Dr(e,{r:n.l}),lvl:t+1}):e}function _3(e){return R4(e,({k:t,v:n})=>({index:t,value:n}))}function O4(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ql(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const rk=Bn(()=>({recalcInProgress:ct(!1)}),[],{singleton:!0});function D4(e,t,n){return e[Rf(e,t,n)]}function Rf(e,t,n,r=0){let a=e.length-1;for(;r<=a;){const o=Math.floor((r+a)/2),l=e[o],u=n(l,t);if(u===0)return o;if(u===-1){if(a-r<2)return o-1;a=o-1}else{if(a===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function w3(e,t,n,r){const a=Rf(e,t,r),o=Rf(e,n,r,a);return e.slice(a,o+1)}function Js(e,t){return Math.round(e.getBoundingClientRect()[t])}function Qf(e){return!$n(e.groupOffsetTree)}function ik({index:e},t){return t===e?0:t<e?-1:1}function uw(){return{groupIndices:[],groupOffsetTree:Po(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Po()}}function S3(e,t){let n=$n(e)?0:1/0;for(const r of t){const{endIndex:a,size:o,startIndex:l}=r;if(n=Math.min(n,l),$n(e)){e=Li(e,0,o);continue}const u=Bl(e,l-1,a+1);if(u.some(A3(r)))continue;let d=!1,f=!1;for(const{end:p,start:g,value:m}of u)d?(a>=g||o===m)&&(e=gv(e,g)):(f=m!==o,d=!0),p>a&&a>=g&&m!==o&&(e=Li(e,a+1,m));f&&(e=Li(e,l,o))}return[e,n]}function E3(e){return e.groupIndex!==void 0}function N3({offset:e},t){return t===e?0:t<e?-1:1}function Nu(e,t,n){if(t.length===0)return 0;const{index:r,offset:a,size:o}=D4(t,e,ik),l=e-r,u=o*l+(l-1)*n+a;return u>0?u+n:u}function P4(e,t){if(!Qf(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function F4(e,t,n){if(E3(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let a=P4(r,t);return a=Math.max(0,Math.min(n,a)),a}function C3(e,t,n,r=0){return r>0&&(t=Math.max(t,D4(e,r,ik).offset)),R4(w3(e,t,n,N3),R3)}function j3(e,[t,n,r,a]){t.length>0&&r("received item sizes",t,Pr.DEBUG);const o=e.sizeTree;let l=o,u=0;if(n.length>0&&$n(o)&&t.length===2){const m=t[0].size,x=t[1].size;l=n.reduce((v,k)=>Li(Li(v,k,m),k+1,x),l)}else[l,u]=S3(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:p,offsetTree:g}=yv(e.offsetTree,u,l,a);return{groupIndices:n,groupOffsetTree:n.reduce((m,x)=>Li(m,x,Nu(x,g,a)),Po()),lastIndex:d,lastOffset:f,lastSize:p,offsetTree:g,sizeTree:l}}function T3(e){return Fo(e).map(({k:t,v:n},r,a)=>{const o=a[r+1];return{endIndex:o===void 0?1/0:o.k-1,size:n,startIndex:t}})}function dw(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function yv(e,t,n,r){let a=e,o=0,l=0,u=0,d=0;if(t===0)a=[];else{d=Rf(a,t-1,ik),u=a[d].offset;const f=Oa(n,t-1);o=f[0],l=f[1],a.length&&a[d].size===Oa(n,t)[1]&&(d-=1),a=a.slice(0,d+1)}for(const{start:f,value:p}of Bl(n,t,1/0)){const g=f-o,m=g*l+u+g*r;a.push({index:f,offset:m,size:p}),o=f,u=m,l=p}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:a}}function R3(e){return{index:e.index,value:e}}function A3(e){const{endIndex:t,size:n,startIndex:r}=e;return a=>a.start===r&&(a.end===t||a.end===1/0)&&a.value===n}const I3={offsetHeight:"height",offsetWidth:"width"},Xa=Bn(([{log:e},{recalcInProgress:t}])=>{const n=Cn(),r=Cn(),a=Wr(r,0),o=Cn(),l=Cn(),u=ct(0),d=ct([]),f=ct(void 0),p=ct(void 0),g=ct(void 0),m=ct(void 0),x=ct((M,L)=>Js(M,I3[L])),v=ct(void 0),k=ct(0),_=uw(),S=Cn(),E=Wr(Ve(Tf(n,S),yn(d,e,k),Aa((M,[L,...A])=>{if(L===null){const[O]=A;return{...uw(),groupIndices:O,groupOffsetTree:O.reduce((F,Q,H)=>Li(F,Q,H),Po())}}return j3(M,[L,...A])},_),lr()),_),N=Wr(Ve(d,lr(),Aa((M,L)=>({current:L,prev:M.current}),{current:[],prev:[]}),jt(({prev:M})=>M)),[]);Dt(Ve(d,Qt(M=>M.length>0),yn(E,k),jt(([M,L,A])=>{const O=M.reduce((F,Q,H)=>Li(F,Q,Nu(Q,L.offsetTree,A)||H),Po());return{...L,groupIndices:M,groupOffsetTree:O}})),E),Dt(Ve(r,yn(E),Qt(([M,{lastIndex:L}])=>M<L),jt(([M,{lastIndex:L,lastSize:A}])=>[{endIndex:L,size:A,startIndex:M}])),n),Dt(f,p);const R=Wr(Ve(f,jt(M=>M===void 0)),!0);Dt(Ve(p,Qt(M=>M!==void 0&&$n(nr(E).sizeTree)),jt(M=>{const L=nr(g),A=nr(d).length>0;return L!==void 0&&L!==0?A?[{endIndex:0,size:L,startIndex:0},{endIndex:1,size:M,startIndex:1}]:[]:[{endIndex:0,size:M,startIndex:0}]})),n),Dt(Ve(m,Qt(M=>M!==void 0&&M.length>0&&$n(nr(E).sizeTree)),jt(M=>{const L=[];let A=M[0],O=0;for(let F=1;F<M.length;F++){const Q=M[F];Q!==A&&(L.push({endIndex:F-1,size:A,startIndex:O}),A=Q,O=F)}return L.push({endIndex:M.length-1,size:A,startIndex:O}),L})),n),Dt(Ve(d,yn(g,p),Qt(([,M,L])=>M!==void 0&&L!==void 0),jt(([M,L,A])=>{const O=[];for(let F=0;F<M.length;F++){const Q=M[F],H=M[F+1];O.push({startIndex:Q,endIndex:Q,size:L}),H!==void 0&&O.push({startIndex:Q+1,endIndex:H-1,size:A})}return O})),n);const T=Zi(Ve(n,yn(E),Aa(({sizes:M},[L,A])=>({changed:A!==M,sizes:A}),{changed:!1,sizes:_}),jt(M=>M.changed)));Un(Ve(u,Aa((M,L)=>({diff:M.prev-L,prev:L}),{diff:0,prev:0}),jt(M=>M.diff)),M=>{const{groupIndices:L}=nr(E);if(M>0)hn(t,!0),hn(o,M+dw(M,L));else if(M<0){const A=nr(N);A.length>0&&(M-=dw(-M,A)),hn(l,M)}}),Un(Ve(u,yn(e)),([M,L])=>{M<0&&L("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:u},Pr.ERROR)});const j=Zi(o);Dt(Ve(o,yn(E),jt(([M,L])=>{const A=L.groupIndices.length>0,O=[],F=L.lastSize;if(A){const Q=Eu(L.sizeTree,0);let H=0,P=0;for(;H<M;){const W=L.groupIndices[P],Y=L.groupIndices.length===P+1?1/0:L.groupIndices[P+1]-W-1;O.push({endIndex:W,size:Q,startIndex:W}),O.push({endIndex:W+1+Y-1,size:F,startIndex:W+1}),P++,H+=Y+1}const K=Fo(L.sizeTree);return H!==M&&K.shift(),K.reduce((W,{k:Y,v:ce})=>{let z=W.ranges;return W.prevSize!==0&&(z=[...W.ranges,{endIndex:Y+M-1,size:W.prevSize,startIndex:W.prevIndex}]),{prevIndex:Y+M,prevSize:ce,ranges:z}},{prevIndex:M,prevSize:0,ranges:O}).ranges}return Fo(L.sizeTree).reduce((Q,{k:H,v:P})=>({prevIndex:H+M,prevSize:P,ranges:[...Q.ranges,{endIndex:H+M-1,size:Q.prevSize,startIndex:Q.prevIndex}]}),{prevIndex:0,prevSize:F,ranges:[]}).ranges})),n);const I=Zi(Ve(l,yn(E,k),jt(([M,{offsetTree:L},A])=>{const O=-M;return Nu(O,L,A)})));return Dt(Ve(l,yn(E,k),jt(([M,L,A])=>{if(L.groupIndices.length>0){if($n(L.sizeTree))return L;let F=Po();const Q=nr(N);let H=0,P=0,K=0;for(;H<-M;){K=Q[P];const W=Q[P+1]-K-1;P++,H+=W+1}if(F=Fo(L.sizeTree).reduce((W,{k:Y,v:ce})=>Li(W,Math.max(0,Y+M),ce),F),H!==-M){const W=Eu(L.sizeTree,K);F=Li(F,0,W);const Y=Oa(L.sizeTree,-M+1)[1];F=Li(F,1,Y)}return{...L,sizeTree:F,...yv(L.offsetTree,0,F,A)}}const O=Fo(L.sizeTree).reduce((F,{k:Q,v:H})=>Li(F,Math.max(0,Q+M),H),Po());return{...L,sizeTree:O,...yv(L.offsetTree,0,O,A)}})),E),{beforeUnshiftWith:j,data:v,defaultItemSize:p,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:g,gap:k,groupIndices:d,heightEstimates:m,itemSize:x,listRefresh:T,resetSizes:S,shiftWith:l,shiftWithOffset:I,sizeRanges:n,sizes:E,statefulTotalCount:a,totalCount:r,trackItemSizes:R,unshiftWith:o}},cr(to,rk),{singleton:!0});function M3(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const B4=Bn(([{groupIndices:e,resetSizes:t,sizeRanges:n,sizes:r,statefulTotalCount:a,totalCount:o,trackItemSizes:l},{headerHeight:u,scrollTop:d}])=>{const f=Cn(),p=Cn(),g=Zi(Ve(f,jt(M3))),m=Wr(Ve(n,yn(a,e),Qt(([,x,v])=>x>v.length),Qi(!0)),!1);return Dt(Ve(g,Aa(([,x],v)=>[x,v],[{groupIndices:[],totalCount:0},{groupIndices:[],totalCount:0}]),yn(r,l,m),Qt(([[x,v],{sizeTree:k},_,S])=>{const E=x.groupIndices.length>0&&x.totalCount===x.groupIndices.length,N=v.totalCount>v.groupIndices.length;return _&&!S&&E&&N&&!$n(k)}),Qi(null)),t),Dt(Ve(g,jt(x=>x.totalCount)),o),Dt(Ve(g,jt(x=>x.groupIndices)),e),Dt(Ve(_r(d,r,u),Qt(([x,v])=>Qf(v)),jt(([x,v,k])=>Oa(v.groupOffsetTree,Math.max(x-k,0),"v")[0]),lr(),jt(x=>[x])),p),{groupCounts:f,topItemsIndexes:p}},cr(Xa,vi)),no=Bn(([{log:e}])=>{const t=ct(!1),n=Zi(Ve(t,Qt(r=>r),lr()));return Un(t,r=>{r&&nr(e)("props updated",{},Pr.DEBUG)}),{didMount:n,propsReady:t}},cr(to),{singleton:!0}),L3=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function z4(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!L3)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const Mu=Bn(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:p,viewportHeight:g},{log:m}])=>{const x=Cn(),v=Cn(),k=ct(0);let _=null,S=null,E=null;function N(){_!==null&&(_(),_=null),E!==null&&(E(),E=null),S&&(clearTimeout(S),S=null),hn(d,!1)}return Dt(Ve(x,yn(n,g,r,k,u,l,m),yn(e,o,a),jt(([[R,T,j,I,M,L,A,O],F,Q,H])=>{const P=z4(R),{align:K,behavior:W,offset:Y}=P,ce=I-1,z=F4(P,T,ce);let G=Nu(z,T.offsetTree,F)+L;K==="end"?(G+=Q+Oa(T.sizeTree,z)[1]-j+H,z===ce&&(G+=A)):K==="center"?G+=(Q+Oa(T.sizeTree,z)[1]-j+H)/2:G-=M,Y!==void 0&&Y!==0&&(G+=Y);const X=B=>{N(),B?(O("retrying to scroll to",{location:R},Pr.DEBUG),hn(x,R)):(hn(v,!0),O("list did not change, scroll successful",{},Pr.DEBUG))};if(N(),W==="smooth"){let B=!1;E=Un(t,te=>{B=B||te}),_=Ia(p,()=>{X(B)})}else _=Ia(Ve(t,O3(150)),X);return S=setTimeout(()=>{N()},1200),hn(d,!0),O("scrolling from index to",{behavior:W,index:z,top:G},Pr.DEBUG),{behavior:W,top:G}})),f),{scrollTargetReached:v,scrollToIndex:x,topListHeight:k}},cr(Xa,vi,to),{singleton:!0});function O3(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function ak(e,t){e===0?t():requestAnimationFrame(()=>{ak(e-1,t)})}function sk(e,t){if(e===void 0)return 0;const n=t-1,r=typeof e=="number"?e:e.index==="LAST"?n:e.index;return Math.max(0,Math.min(r,n))}function bv(e){return e===void 0?!0:typeof e=="number"?e===0:e.index===0&&(e.align===void 0||e.align==="start")&&(e.offset===void 0||e.offset===0)}const Lu=Bn(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:a,scrollToIndex:o},{didMount:l}])=>{const u=ct(!0),d=ct(0),f=ct(!0);return Dt(Ve(l,yn(d),Qt(([p,g])=>!bv(g)),Qi(!1)),u),Dt(Ve(l,yn(d),Qt(([p,g])=>!bv(g)),Qi(!1)),f),Un(Ve(_r(t,l),yn(u,n,e,f),Qt(([[,p],g,{sizeTree:m},x,v])=>p&&(!$n(m)||Jv(x))&&!g&&!v),yn(d)),([,p])=>{if(p===void 0){hn(u,!0),hn(f,!0);return}Ia(a,()=>{hn(f,!0)}),ak(4,()=>{Ia(r,()=>{hn(u,!0)}),hn(o,p)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},cr(Xa,vi,Mu,no),{singleton:!0});function q4(e,t){return Math.abs(e-t)<1.01}const Cu="up",hu="down",D3="none",P3={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},F3=0,Ou=Bn(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:a,viewportHeight:o}])=>{const l=ct(!1),u=ct(!0),d=Cn(),f=Cn(),p=ct(4),g=ct(F3),m=Wr(Ve(Tf(Ve(nn(a),Uo(1),Qi(!0)),Ve(nn(a),Uo(1),Qi(!1),sw(100))),lr()),!1),x=Wr(Ve(Tf(Ve(n,Qi(!0)),Ve(n,Qi(!1),sw(200))),lr()),!1);Dt(Ve(_r(nn(a),nn(g)),jt(([E,N])=>E<=N),lr()),u),Dt(Ve(u,gs(50)),f);const v=Zi(Ve(_r(r,nn(o),nn(t),nn(e),nn(p)),Aa((E,[{scrollHeight:N,scrollTop:R},T,j,I,M])=>{const L=R+T-N>-M,A={scrollHeight:N,scrollTop:R,viewportHeight:T};if(L){let F,Q;return R>E.state.scrollTop?(F="SCROLLED_DOWN",Q=E.state.scrollTop-R):(F="SIZE_DECREASED",Q=E.state.scrollTop-R||E.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:Q,state:A}}let O;return A.scrollHeight>E.state.scrollHeight?O="SIZE_INCREASED":T<E.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":R<E.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:A}},P3),lr((E,N)=>E!==void 0&&E.atBottom===N.atBottom))),k=Wr(Ve(r,Aa((E,{scrollHeight:N,scrollTop:R,viewportHeight:T})=>{if(!q4(E.scrollHeight,N)){const j=N-(R+T)<1;return E.scrollTop!==R&&j?{changed:!0,jump:E.scrollTop-R,scrollHeight:N,scrollTop:R}:{changed:!0,jump:0,scrollHeight:N,scrollTop:R}}return{changed:!1,jump:0,scrollHeight:N,scrollTop:R}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Qt(E=>E.changed),jt(E=>E.jump)),0);Dt(Ve(v,jt(E=>E.atBottom)),l),Dt(Ve(l,gs(50)),d);const _=ct(hu);Dt(Ve(r,jt(({scrollTop:E})=>E),lr(),Aa((E,N)=>nr(x)?{direction:E.direction,prevScrollTop:N}:{direction:N<E.prevScrollTop?Cu:hu,prevScrollTop:N},{direction:hu,prevScrollTop:0}),jt(E=>E.direction)),_),Dt(Ve(r,gs(50),Qi(D3)),_);const S=ct(0);return Dt(Ve(m,Qt(E=>!E),Qi(0)),S),Dt(Ve(a,gs(100),yn(m),Qt(([E,N])=>N),Aa(([E,N],[R])=>[N,R],[0,0]),jt(([E,N])=>N-E)),S),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:p,atTopStateChange:f,atTopThreshold:g,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:S}},cr(vi)),ju="top",Tu="bottom",fw="none";function pw(e,t,n){return typeof e=="number"?n===Cu&&t===ju||n===hu&&t===Tu?e:0:n===Cu?t===ju?e.main:e.reverse:t===Tu?e.main:e.reverse}function hw(e,t){return typeof e=="number"?e:e[t]??0}const ok=Bn(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:a}])=>{const o=Cn(),l=ct(0),u=ct(0),d=ct(0),f=Wr(Ve(_r(nn(r),nn(a),nn(n),nn(o,ql),nn(d),nn(l),nn(t),nn(e),nn(u)),jt(([p,g,m,[x,v],k,_,S,E,N])=>{const R=p-E,T=_+S,j=Math.max(m-R,0);let I=fw;const M=hw(N,ju),L=hw(N,Tu);return x-=E,x+=m+S,v+=m+S,v-=E,x>p+T-M&&(I=Cu),v<p-j+g+L&&(I=hu),I!==fw?[Math.max(R-m-pw(k,ju,I)-M,0),R-j-S+g+pw(k,Tu,I)+L]:null}),Qt(p=>p!==null),lr(ql)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},cr(vi),{singleton:!0});function B3(e,t,n,r){if(Qf(t)){const a=r-t.groupIndices.length;if(a<=0)return[{index:t.groupIndices[0],offset:0,size:0}];const o=P4(Math.min(e,a-1),t);return[{index:Oa(t.groupOffsetTree,o)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:o,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Vh={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function wf(e,t,n,r,a,o){const{lastIndex:l,lastOffset:u,lastSize:d}=a;let f=0,p=0;if(e.length>0){f=e[0].offset;const k=e[e.length-1];p=k.offset+k.size}const g=n-l,m=u+g*d+(g-1)*r,x=f,v=m-p;return{bottom:p,firstItemIndex:o,items:gw(e,a,o),offsetBottom:v,offsetTop:f,top:x,topItems:gw(t,a,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:n}}function U4(e,t,n,r,a,o){let l=0;if(n.groupIndices.length>0)for(const x of n.groupIndices){if(x-l>=e)break;l++}const u=e+l,d=o!==void 0,f=(o==null?void 0:o.length)??0,p=sk(t,d?f:u),g=d?Math.max(0,Math.min(u,f-p)):u,m=Array.from({length:g}).map((x,v)=>({data:o==null?void 0:o[v+p],index:v+p,offset:0,size:0}));return wf(m,[],g,a,n,r)}function gw(e,t,n){if(e.length===0)return[];if(!Qf(t))return e.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const r=e[0].index,a=e[e.length-1].index,o=[],l=Bl(t.groupOffsetTree,r,a);let u,d=0;for(const f of e){(!u||u.end<f.index)&&(u=l.shift(),d=t.groupIndices.indexOf(u.start));let p;f.index===u.start?p={index:d,type:"group"}:p={groupIndex:d,index:f.index-(d+1)+n},o.push({...p,data:f.data,offset:f.offset,originalIndex:f.index,size:f.size})}return o}function mw(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const Vo=Bn(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:a},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:p},{topListHeight:g},m,{didMount:x},{recalcInProgress:v}])=>{const k=ct([]),_=ct(0),S=Wr(Ve(r,Qt(({sizeTree:M})=>!$n(M)),Qi(!0)),!1),E=Cn(),N=ct(0);Dt(o.topItemsIndexes,k);const R=Wr(Ve(_r(x,v,nn(d,ql),nn(a),nn(r),nn(f),p,nn(k),nn(t),nn(n),nn(N),e,nn(_)),Qt(([M,L,,A,,,,,,,,O])=>{const F=O!==void 0&&O.length!==A;return M&&!L&&!F}),jt(([,,[M,L],A,O,F,Q,H,P,K,W,Y,ce])=>{var Se,Xe;const z=O,{offsetTree:G,sizeTree:X}=z;if(A===0)return{...Vh,totalCount:A};if(M===0&&L===0)return ce===0?{...Vh,totalCount:A}:U4(ce,F,O,P,K,Y);if($n(X))return ce>0&&!nr(S)?null:wf(B3(sk(F,A),z,Y,A),[],A,K,z,P);const B=[];if(H.length>0){const bt=H[0],at=H[H.length-1];let yt=0;for(const et of Bl(X,bt,at)){const Ie=et.value,Ge=Math.max(et.start,bt),tt=Math.min(et.end,at);for(let kt=Ge;kt<=tt;kt++)B.push({data:Y==null?void 0:Y[kt],index:kt,offset:yt,size:Ie}),yt+=Ie}}if(!Q)return wf([],B,A,K,z,P);const te=H.length>0?H[H.length-1]+1:0,V=C3(G,M,L,te);if(V.length===0)return null;const U=A-1,oe=Yf([],bt=>{for(const at of V){const yt=at.value;let et=yt.offset,Ie=at.start;const Ge=yt.size;if(yt.offset<M){Ie+=Math.floor((M-yt.offset+K)/(Ge+K));const kt=Ie-at.start;et+=kt*Ge+kt*K}Ie<te&&(et+=(te-Ie)*Ge,Ie=te);const tt=Math.min(at.end,U);for(let kt=Ie;kt<=tt&&!(et>=L);kt++)bt.push({data:Y==null?void 0:Y[kt],index:kt,offset:et,size:Ge}),et+=Ge+K}}),ae=mw(W,ju),xe=mw(W,Tu);if(oe.length>0&&(ae>0||xe>0)){const bt=oe[0],at=oe[oe.length-1];if(ae>0&&bt.index>te){const yt=Math.min(ae,bt.index-te),et=[];let Ie=bt.offset;for(let Ge=bt.index-1;Ge>=bt.index-yt;Ge--){const tt=((Se=Bl(X,Ge,Ge)[0])==null?void 0:Se.value)??bt.size;Ie-=tt+K,et.unshift({data:Y==null?void 0:Y[Ge],index:Ge,offset:Ie,size:tt})}oe.unshift(...et)}if(xe>0&&at.index<U){const yt=Math.min(xe,U-at.index);let et=at.offset+at.size+K;for(let Ie=at.index+1;Ie<=at.index+yt;Ie++){const Ge=((Xe=Bl(X,Ie,Ie)[0])==null?void 0:Xe.value)??at.size;oe.push({data:Y==null?void 0:Y[Ie],index:Ie,offset:et,size:Ge}),et+=Ge+K}}}return wf(oe,B,A,K,z,P)}),Qt(M=>M!==null),lr()),Vh);Dt(Ve(e,Qt(Jv),jt(M=>M==null?void 0:M.length)),a),Dt(Ve(R,jt(M=>M.topListHeight)),g),Dt(g,u),Dt(Ve(R,jt(M=>[M.top,M.bottom])),l),Dt(Ve(R,jt(M=>M.items)),E);const T=Zi(Ve(R,Qt(({items:M})=>M.length>0),yn(a,e),Qt(([{items:M},L])=>M[M.length-1].originalIndex===L-1),jt(([{items:M},L,A])=>{const O=M[M.length-1],F=O.type==="group"?O.index+1:(O.groupIndex??-1)+1;return[L-1-F,A]}),lr(ql),Qt(([M])=>M>=0),jt(([M])=>M))),j=Zi(Ve(R,gs(200),Qt(({items:M,topItems:L})=>M.length>0&&M[0].originalIndex===L.length),jt(({items:M})=>M[0].index),lr())),I=Zi(Ve(R,Qt(({items:M})=>M.length>0),jt(({items:M})=>{let L=0,A=M.length-1;for(;M[L].type==="group"&&L<A;)L++;for(;M[A].type==="group"&&A>L;)A--;return{endIndex:M[A].index,startIndex:M[L].index}}),lr(O4)));return{endReached:T,initialItemCount:_,itemsRendered:E,listState:R,minOverscanItemCount:N,rangeChanged:I,startReached:j,topItemsIndexes:k,...m}},cr(Xa,B4,ok,Lu,Mu,Ou,no,rk),{singleton:!0}),H4=Bn(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:a}])=>{const o=Cn(),l=Wr(Ve(_r(n,e,r,t,a),jt(([u,d,f,p,g])=>u+d+f+p+g.offsetBottom+g.bottom)),0);return Dt(nn(l),o),{totalListHeight:l,totalListHeightChanged:o}},cr(vi,Vo),{singleton:!0}),z3=Bn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ct(!1),r=Wr(Ve(_r(n,e,t),Qt(([a])=>a),jt(([,a,o])=>Math.max(0,a-o)),gs(0),lr()),0);return{alignToBottom:n,paddingTopAddition:r}},cr(vi,H4),{singleton:!0}),$4=Bn(()=>({context:ct(null)})),q3=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...a},viewportBottom:o,viewportTop:l})=>t<l?{...a,align:n??"start",...r===void 0?{}:{behavior:r}}:e>o?{...a,align:n??"end",...r===void 0?{}:{behavior:r}}:null,W4=Bn(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:a,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const p=Cn();return Dt(Ve(p,yn(t,d,n,o,a,r,u),yn(e),jt(([[g,m,x,v,k,_,S,E],N])=>{const{calculateViewLocation:R=q3,done:T,...j}=g,I=F4(g,m,v-1),M=Nu(I,m.offsetTree,N)+k+_,L=M+Oa(m.sizeTree,I)[1],A=E+_,O=E+x-S,F=R({itemBottom:L,itemTop:M,locationParams:j,viewportBottom:O,viewportTop:A});return F===null?T==null||T():T&&Ia(Ve(l,Qt(Q=>!Q),Uo(nr(l)?1:2)),T),F}),Qt(g=>g!==null)),f),{scrollIntoView:p}},cr(Xa,vi,Mu,Vo,to),{singleton:!0});function xw(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const U3=(e,t)=>typeof e=="function"?xw(e(t)):t&&xw(e),H3=Bn(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:a,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:p},{scrollingInProgress:g},{context:m},{scrollIntoView:x}])=>{const v=ct(!1),k=Cn();let _=null;function S(T){hn(l,{align:"end",behavior:T,index:"LAST"})}Un(Ve(_r(Ve(nn(t),Uo(1)),d),yn(nn(v),o,u,g),jt(([[T,j],I,M,L,A])=>{let O=j&&L,F="auto";return O&&(F=U3(I,M||A),O=O&&F!==!1),{followOutputBehavior:F,shouldFollow:O,totalCount:T}}),Qt(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:j})=>{_!==null&&(_(),_=null),nr(n)===void 0?_=Ia(e,()=>{nr(p)("following output to ",{totalCount:j},Pr.DEBUG),S(T),_=null}):requestAnimationFrame(()=>{nr(p)("following output to ",{totalCount:j},Pr.DEBUG),S(T)})});function E(T){const j=Ia(a,I=>{T&&!I.atBottom&&I.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(nr(p)("scrolling to bottom due to increased size",{},Pr.DEBUG),S("auto"))});setTimeout(j,100)}Un(Ve(_r(nn(v),t,f),Qt(([T,,j])=>T!==!1&&j),Aa(({value:T},[,j])=>({refreshed:T===j,value:j}),{refreshed:!1,value:0}),Qt(({refreshed:T})=>T),yn(v,t)),([,T])=>{nr(u)&&E(T!==!1)}),Un(k,()=>{E(nr(v)!==!1)}),Un(_r(nn(v),a),([T,j])=>{T!==!1&&!j.atBottom&&j.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&S("auto")});const N=ct(null),R=Cn();return Dt(Tf(Ve(nn(r),jt(T=>(T==null?void 0:T.length)??0)),Ve(nn(t))),R),Un(Ve(_r(Ve(R,Uo(1)),d),yn(nn(N),u,g,m),jt(([[T,j],I,M,L,A])=>j&&M&&(I==null?void 0:I({context:A,totalCount:T,scrollingInProgress:L}))),Qt(T=>!!T),gs(0)),T=>{_!==null&&(_(),_=null),nr(n)===void 0?_=Ia(e,()=>{nr(p)("scrolling into view",{}),hn(x,T),_=null}):requestAnimationFrame(()=>{nr(p)("scrolling into view",{}),hn(x,T)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:N}},cr(Xa,Ou,Mu,Lu,no,to,vi,$4,W4)),$3=Bn(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:a},{initialItemCount:o,listState:l},{didMount:u}])=>(Dt(Ve(u,yn(o),Qt(([,d])=>d!==0),yn(a,r,t,n,e),jt(([[,d],f,p,g,m,x])=>U4(d,f,p,g,m,x))),l),{}),cr(Xa,Lu,Vo,no),{singleton:!0}),W3=Bn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ct(0);return Un(Ve(e,yn(r),Qt(([,a])=>a!==0),jt(([,a])=>({top:a}))),a=>{Ia(Ve(n,Uo(1),Qt(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{hn(t,a)})})}),{initialScrollTop:r}},cr(no,vi,Vo),{singleton:!0}),V4=Bn(([{scrollVelocity:e}])=>{const t=ct(!1),n=Cn(),r=ct(!1);return Dt(Ve(e,yn(r,t,n),Qt(([a,o])=>o!==!1&&o!==void 0),jt(([a,o,l,u])=>{const{enter:d,exit:f}=o;if(l){if(f(a,u))return!1}else if(d(a,u))return!0;return l}),lr()),t),Un(Ve(_r(t,e,n),yn(r)),([[a,o,l],u])=>{a&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},cr(Ou),{singleton:!0}),lk=Bn(([{scrollContainerState:e,scrollTo:t}])=>{const n=Cn(),r=Cn(),a=Cn(),o=ct(!1),l=ct(void 0);return Dt(Ve(_r(n,r),jt(([{scrollTop:u,viewportHeight:d},{offsetTop:f,listHeight:p}])=>({scrollHeight:p,scrollTop:Math.max(0,u-f),viewportHeight:d}))),e),Dt(Ve(t,yn(r),jt(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),a),{customScrollParent:l,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:a,windowViewportRect:r}},cr(vi)),V3=Bn(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:a},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=Cn(),p=ct(void 0),g=ct(null),m=ct(null);return Dt(u,g),Dt(d,m),Un(Ve(f,yn(t,r,l,g,m,n)),([x,v,k,_,S,E,N])=>{const R=T3(v.sizeTree);_&&S!==null&&E!==null&&(k=S.scrollTop-E.offsetTop),k-=N,x({ranges:R,scrollTop:k})}),Dt(Ve(p,Qt(Jv),jt(G3)),a),Dt(Ve(o,yn(p),Qt(([,x])=>x!==void 0),lr(),jt(([,x])=>x.ranges)),e),{getState:f,restoreStateFrom:p}},cr(Xa,vi,Lu,no,lk));function G3(e){return{align:"start",index:0,offset:e.scrollTop}}const K3=Bn(([{topItemsIndexes:e}])=>{const t=ct(0);return Dt(Ve(t,Qt(n=>n>=0),jt(n=>Array.from({length:n}).map((r,a)=>a))),e),{topItemCount:t}},cr(Vo));function G4(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Y3=G4(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Q3=Bn(([{deviation:e,deviationCommitted:t,scrollBy:n,scrollingInProgress:r,scrollTop:a},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:p,gap:g,shiftWithOffset:m,sizes:x},{log:v},{recalcInProgress:k}])=>{const _=Zi(Ve(f,yn(u),Aa(([,R,T,j],[{bottom:I,items:M,offsetBottom:L,totalCount:A},O])=>{const F=I+L;let Q=0;return T===A&&R.length>0&&M.length>0&&(M[0].originalIndex===0&&R[0].originalIndex===0||(Q=F-j,Q!==0&&(Q+=O))),[Q,M,A,F]},[0,[],0,0]),Qt(([R])=>R!==0),yn(a,d,r,o,v,k),Qt(([,R,T,j,,,I])=>!I&&!j&&R!==0&&T===Cu),jt(([[R],,,,,T])=>(T("Upward scrolling compensation",{amount:R},Pr.DEBUG),R))));function S(R){R>0?(hn(n,{behavior:"auto",top:-R}),hn(e,0)):(hn(e,0),hn(n,{behavior:"auto",top:-R}))}Un(Ve(_,yn(e,l)),([R,T,j])=>{j&&Y3()?hn(e,T-R):S(-R)}),Un(Ve(_r(Wr(l,!1),e,k),Qt(([R,T,j])=>!R&&!j&&T!==0),jt(([R,T])=>T),gs(1)),S),Dt(Ve(m,jt(R=>({top:-R}))),n);let E=null;function N(){if(E===null)return;const{offset:R}=E;E=null,hn(n,{top:R}),requestAnimationFrame(()=>{hn(e,0),hn(k,!1)})}return Un(t,R=>{E===null||!E.acknowledgeable||R===E.offset&&N()}),Un(Ve(p,yn(x,g),jt(([R,{groupIndices:T,lastSize:j,sizeTree:I},M])=>{function L(H){return H*(j+M)}if(T.length===0)return L(R);let A=0;const O=Eu(I,0);let F=0,Q=0;for(;F<R;){F++,A+=O;let H=T.length===Q+1?1/0:T[Q+1]-T[Q]-1;F+H>R&&(A-=O,H=R-F+1),F+=H,A+=L(H),Q++}return A})),R=>{E={acknowledgeable:nr(e)!==R,offset:R},hn(e,R),requestAnimationFrame(N)}),{deviation:e}},cr(vi,Ou,Vo,Xa,to,rk)),X3=Bn(([e,t,n,r,a,o,l,u,d,f,p])=>({...e,...t,...n,...r,...a,...o,...l,...u,...d,...f,...p}),cr(ok,$3,no,V4,H4,W3,z3,lk,W4,to,$4)),K4=Bn(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:a,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:p,statefulTotalCount:g,totalCount:m,trackItemSizes:x},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},S,E,N,R,{scrollToIndex:T},j,{topItemCount:I},{groupCounts:M},L])=>{const{listState:A,minOverscanItemCount:O,topItemsIndexes:F,rangeChanged:Q,...H}=R;return Dt(Q,L.scrollSeekRangeChanged),Dt(Ve(_r(L.windowViewportRect,S.headerHeight,S.fixedHeaderHeight),jt(([P,K,W])=>Math.max(K+W+1,P.visibleHeight))),S.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:a,gap:o,groupCounts:M,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:I,topItemsIndexes:F,totalCount:m,...N,groupIndices:l,itemSize:d,listState:A,minOverscanItemCount:O,scrollToIndex:T,statefulTotalCount:g,trackItemSizes:x,rangeChanged:Q,...H,...L,...S,sizes:p,...E}},cr(Xa,Lu,vi,V3,H3,Vo,Mu,Q3,K3,B4,X3));function Z3(e,t){const n={},r={};let a=0;const o=e.length;for(;a<o;)r[e[a]]=1,a+=1;for(const l in t)Object.hasOwn(r,l)||(n[l]=t[l]);return n}const Zd=typeof document>"u"?Lt.useEffect:Lt.useLayoutEffect;function Y4(e,t,n){const r=Object.keys(t.required||{}),a=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Lt.createContext({});function d(_,S){_.propsReady!==void 0&&hn(_.propsReady,!1);for(const E of r){const N=_[t.required[E]];hn(N,S[E])}for(const E of a)if(E in S){const N=_[t.optional[E]];hn(N,S[E])}_.propsReady!==void 0&&hn(_.propsReady,!0)}function f(_){return o.reduce((S,E)=>(S[E]=N=>{const R=_[t.methods[E]];hn(R,N)},S),{})}function p(_){return l.reduce((S,E)=>(S[E]=p3(_[t.events[E]]),S),{})}const g=Lt.forwardRef(function(_,S){const{children:E,...N}=_,[R]=Lt.useState(()=>Yf(m3(e),I=>{d(I,N)})),[T]=Lt.useState(aw(p,R));Zd(()=>{for(const I of l)I in N&&Un(T[I],N[I]);return()=>{Object.values(T).map(ek)}},[N,T,R]),Zd(()=>{d(R,N)}),Lt.useImperativeHandle(S,iw(f(R)));const j=n;return i.jsx(u.Provider,{value:R,children:n===void 0?E:i.jsx(j,{...Z3([...r,...a,...l],N),children:E})})}),m=_=>{const S=Lt.useContext(u);return Lt.useCallback(E=>{hn(S[_],E)},[S,_])},x=_=>{const S=Lt.useContext(u)[_],E=Lt.useCallback(N=>Un(S,N),[S]);return Lt.useSyncExternalStore(E,()=>nr(S),()=>nr(S))},v=_=>{const S=Lt.useContext(u)[_],[E,N]=Lt.useState(aw(nr,S));return Zd(()=>Un(S,R=>{R!==E&&N(iw(R))}),[S,E]),E},k=parseInt(Lt.version,10)>=18?x:v;return{Component:g,useEmitter:(_,S)=>{const E=Lt.useContext(u)[_];Zd(()=>Un(E,S),[S,E])},useEmitterValue:k,usePublisher:m}}const Q4=Lt.createContext(void 0),X4=Lt.createContext(void 0),Gh="-webkit-sticky",yw="sticky",ck=G4(()=>{if(typeof document>"u")return yw;const e=document.createElement("div");return e.style.position=Gh,e.style.position===Gh?Gh:yw});function Kh(e){return"self"in e}function J3(e){return"body"in e}function Z4(e,t,n,r=Wl,a,o){const l=Lt.useRef(null),u=Lt.useRef(null),d=Lt.useRef(null),f=Lt.useCallback(g=>{let m,x,v;const k=g.target;if(J3(k)||Kh(k)){const S=Kh(k)?k:k.defaultView;v=o===!0?Do(S,S.scrollX):S.scrollY,m=o===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight,x=o===!0?S.innerWidth:S.innerHeight}else v=o===!0?Do(k,k.scrollLeft):k.scrollTop,m=o===!0?k.scrollWidth:k.scrollHeight,x=o===!0?k.offsetWidth:k.offsetHeight;const _=()=>{e({scrollHeight:m,scrollTop:Math.max(v,0),viewportHeight:x})};g.suppressFlushSync===!0?_():dM.flushSync(_),u.current!==null&&(v===u.current||v<=0||v===m-x)&&(u.current=null,t(!0),d.current&&(clearTimeout(d.current),d.current=null))},[e,t,o]);Lt.useEffect(()=>{const g=a??l.current;return r(a??l.current),f({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",f,{passive:!0}),()=>{r(null),g.removeEventListener("scroll",f)}},[l,f,n,r,a]);function p(g){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const x=g.behavior==="smooth";let v,k,_;Kh(m)?(k=Math.max(Js(m.document.documentElement,o===!0?"width":"height"),o===!0?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),v=o===!0?m.innerWidth:m.innerHeight,_=o===!0?Do(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=Js(m,o===!0?"width":"height"),_=o===!0?Do(m,m.scrollLeft):m.scrollTop);const S=k-v;if(g.top===void 0){m.scrollTo(g);return}const E=Math.ceil(Math.max(Math.min(S,g.top),0));if(g.top=E,q4(v,k)||E===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),x&&t(!0);return}x?(u.current=E,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,u.current=null,t(!0)},1e3)):u.current=null,o===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},left:ow(m,E)}),m.scrollTo(g)}return{scrollByCallback:Lt.useCallback(g=>{o===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},...g.top===void 0?{}:{left:ow(l.current,g.top)}}),l.current.scrollBy(g)},[o]),scrollerRef:l,scrollToCallback:p}}function uk(e){return e}const eO=Bn(()=>{const e=ct(u=>`Item ${u}`),t=ct(u=>`Group ${u}`),n=ct({}),r=ct(uk),a=ct("div"),o=ct(Wl),l=(u,d=null)=>Wr(Ve(n,jt(f=>f[u]),lr()),d);return{components:n,computeItemKey:r,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:a,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),tO=Bn(([e,t])=>({...e,...t}),cr(K4,eO)),nO=({height:e})=>i.jsx("div",{style:{height:e}}),rO={overflowAnchor:"none",position:ck(),zIndex:1},J4={overflowAnchor:"none"},iO={...J4,display:"inline-block",height:"100%"},bw=Lt.memo(function({showTopList:e=!1}){const t=ln("listState"),n=Xi("sizeRanges"),r=ln("useWindowScroll"),a=ln("customScrollParent"),o=Xi("windowScrollContainerState"),l=Xi("scrollContainerState"),u=a||r?o:l,d=ln("itemContent"),f=ln("context"),p=ln("groupContent"),g=ln("trackItemSizes"),m=ln("itemSize"),x=ln("log"),v=Xi("gap"),k=ln("horizontalDirection"),{callbackRef:_}=v3(n,m,g,e?Wl:u,x,v,a,k,ln("skipAnimationFrameInResizeObserver")),[S,E]=Lt.useState(0);fk("deviation",P=>{S!==P&&E(P)});const N=Xi("deviationCommitted");nk(()=>{N(S)},[S,N]);const R=ln("EmptyPlaceholder"),T=ln("ScrollSeekPlaceholder")??nO,j=ln("ListComponent"),I=ln("ItemComponent"),M=ln("GroupComponent"),L=ln("computeItemKey"),A=ln("isSeeking"),O=ln("groupIndices").length>0,F=ln("alignToBottom"),Q=ln("initialItemFinalLocationReached"),H=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:S===0?F?"auto":0:S,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:S===0?F?"auto":0:S,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...Q?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&R!==null&&R!==void 0?i.jsx(R,{...ui(R,f)}):i.jsx(j,{...ui(j,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:H,children:(e?t.topItems:t.items).map(P=>{const K=P.originalIndex,W=L(K+t.firstItemIndex,P.data,f);return A?y.createElement(T,{...ui(T,f),height:P.size,index:P.index,key:W,type:P.type||"item",...P.type==="group"?{}:{groupIndex:P.groupIndex}}):P.type==="group"?y.createElement(M,{...ui(M,f),"data-index":K,"data-item-index":P.index,"data-known-size":P.size,key:W,style:rO},p(P.index,f)):y.createElement(I,{...ui(I,f),...lO(I,P.data),"data-index":K,"data-item-group-index":P.groupIndex,"data-item-index":P.index,"data-known-size":P.size,key:W,style:k?iO:J4},O?d(P.index,P.groupIndex,P.data,f):d(P.index,P.data,f))})})}),aO={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},sO={outline:"none",overflowX:"auto",position:"relative"},dk=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),e5=(e,t,n=0)=>({...dk(e),position:t?"relative":"absolute",top:t?-n:0}),oO={position:ck(),top:0,width:"100%",zIndex:1};function ui(e,t){if(typeof e!="string")return{context:t}}function lO(e,t){return{item:typeof e=="string"?void 0:t}}const cO=Lt.memo(function(){const e=ln("HeaderComponent"),t=Xi("headerHeight"),n=ln("HeaderFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Js(o,"height"))},[t]),!0,ln("skipAnimationFrameInResizeObserver")),a=ln("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...ui(e,a)})}):null}),uO=Lt.memo(function(){const e=ln("FooterComponent"),t=Xi("footerHeight"),n=ln("HeaderFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Js(o,"height"))},[t]),!0,ln("skipAnimationFrameInResizeObserver")),a=ln("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...ui(e,a)})}):null});function t5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Lt.memo(function({children:r,style:a,context:o,...l}){const u=n("scrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("scrollerRef"),g=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:x,scrollToCallback:v}=Z4(u,f,d,p,void 0,g);return e("scrollTo",v),e("scrollBy",m),i.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...g?sO:aO,...a},tabIndex:0,...l,...ui(d,o),children:r})})}function n5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Lt.memo(function({children:r,style:a,context:o,...l}){const u=n("windowScrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("totalListHeight"),g=t("deviation"),m=t("customScrollParent"),x=Lt.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:S}=Z4(u,f,d,v,m);return nk(()=>{var E;return _.current=m??((E=x.current)==null?void 0:E.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",S),e("scrollBy",k),i.jsx(d,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...p===0?void 0:{height:p+g}},...l,...ui(d,o),children:r})})}const dO=({children:e})=>{const t=Lt.useContext(Q4),n=Xi("viewportHeight"),r=Xi("fixedItemHeight"),a=ln("alignToBottom"),o=ln("horizontalDirection"),l=Lt.useMemo(()=>N4(n,d=>Js(d,o?"width":"height")),[n,o]),u=Wo(l,!0,ln("skipAnimationFrameInResizeObserver"));return Lt.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),i.jsx("div",{"data-viewport-type":"element",ref:u,style:dk(a),children:e})},fO=({children:e})=>{const t=Lt.useContext(Q4),n=Xi("windowViewportRect"),r=Xi("fixedItemHeight"),a=ln("customScrollParent"),o=ln("useWindowScroll"),l=ln("topListHeight"),u=T4(n,a,ln("skipAnimationFrameInResizeObserver")),d=ln("alignToBottom");return Lt.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),i.jsx("div",{"data-viewport-type":"window",ref:u,style:e5(d,o,l),children:e})},pO=({children:e})=>{const t=ln("TopItemListComponent")??"div",n=ln("headerHeight"),r={...oO,marginTop:`${n}px`},a=ln("context");return i.jsx(t,{style:r,...ui(t,a),children:e})},hO=Lt.memo(function(e){const t=ln("useWindowScroll"),n=ln("topItemsIndexes").length>0,r=ln("customScrollParent"),a=ln("context");return i.jsxs(r||t?xO:mO,{...e,context:a,children:[n&&i.jsx(pO,{children:i.jsx(bw,{showTopList:!0})}),i.jsxs(r||t?fO:dO,{children:[i.jsx(cO,{}),i.jsx(bw,{}),i.jsx(uO,{})]})]})}),{Component:gO,useEmitter:fk,useEmitterValue:ln,usePublisher:Xi}=Y4(tO,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},hO),mO=t5({useEmitter:fk,useEmitterValue:ln,usePublisher:Xi}),xO=n5({useEmitter:fk,useEmitterValue:ln,usePublisher:Xi}),r5=gO,yO=Bn(()=>{const e=ct(f=>i.jsxs("td",{children:["Item $",f]})),t=ct(null),n=ct(f=>i.jsxs("td",{colSpan:1e3,children:["Group ",f]})),r=ct(null),a=ct(null),o=ct({}),l=ct(uk),u=ct(Wl),d=(f,p=null)=>Wr(Ve(o,jt(g=>g[f]),lr()),p);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:a,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TableBodyComponent:d("TableBody","tbody"),TableComponent:d("Table","table"),TableFooterComponent:d("TableFoot","tfoot"),TableHeadComponent:d("TableHead","thead"),TableRowComponent:d("TableRow","tr"),GroupComponent:d("Group","tr")}});cr(K4,yO);ck();const vw={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},bO={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:kw,floor:Af,max:gu,min:Yh,round:_w}=Math;function ww(e,t,n){return Array.from({length:t-e+1}).map((r,a)=>({data:n===null?null:n[a+e],index:a+e}))}function vO(e){return{...bO,items:e}}function Jd(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function kO(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const _O=Bn(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:a,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:p,viewportHeight:g},m,x,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:S,windowScrollContainerState:E,windowScrollTo:N,windowViewportRect:R},T])=>{const j=ct(0),I=ct(0),M=ct(vw),L=ct({height:0,width:0}),A=ct({height:0,width:0}),O=Cn(),F=Cn(),Q=ct(0),H=ct(null),P=ct({column:0,row:0}),K=Cn(),W=Cn(),Y=ct(!1),ce=ct(0),z=ct(!0),G=ct(!1),X=ct(!1);Un(Ve(v,yn(ce),Qt(([ae,xe])=>!bv(xe))),()=>{hn(z,!1)}),Un(Ve(_r(v,z,A,L,ce,G),Qt(([ae,xe,Se,Xe,,bt])=>ae&&!xe&&Se.height!==0&&Xe.height!==0&&!bt)),([,,,,ae])=>{if(ae===void 0){hn(z,!0);return}hn(G,!0),ak(1,()=>{hn(O,ae)}),Ia(Ve(f),()=>{hn(t,[0,0]),hn(z,!0)})}),Dt(Ve(W,Qt(ae=>ae!=null&&ae.scrollTop>0),Qi(0)),I),Un(Ve(v,yn(W),Qt(([,ae])=>ae!=null)),([,ae])=>{ae&&(hn(L,ae.viewport),hn(A,ae.item),hn(P,ae.gap),ae.scrollTop>0&&(hn(Y,!0),Ia(Ve(f,Uo(1)),xe=>{hn(Y,!1)}),hn(d,{top:ae.scrollTop})))}),Dt(Ve(L,jt(({height:ae})=>ae)),g),Dt(Ve(_r(nn(L,Jd),nn(A,Jd),nn(P,(ae,xe)=>ae!==void 0&&ae.column===xe.column&&ae.row===xe.row),nn(f)),jt(([ae,xe,Se,Xe])=>({gap:Se,item:xe,scrollTop:Xe,viewport:ae}))),K),Dt(Ve(_r(nn(j),r,nn(P,kO),nn(A,Jd),nn(L,Jd),nn(H),nn(I),nn(Y),nn(z),nn(ce)),Qt(([,,,,,,,ae])=>!ae),jt(([ae,[xe,Se],Xe,bt,at,yt,et,,Ie,Ge])=>{const{column:tt,row:kt}=Xe,{height:Kt,width:an}=bt,{width:Vt}=at;if(et===0&&(ae===0||Vt===0))return vw;if(an===0){const pt=sk(Ge,ae),gt=pt+Math.max(et-1,0);return vO(ww(pt,gt,yt))}const ze=i5(Vt,an,tt);let De,nt;Ie?xe===0&&Se===0&&et>0?(De=0,nt=et-1):(De=ze*Af((xe+kt)/(Kt+kt)),nt=ze*kw((Se+kt)/(Kt+kt))-1,nt=Yh(ae-1,gu(nt,ze-1)),De=Yh(nt,gu(0,De))):(De=0,nt=-1);const ft=ww(De,nt,yt),{bottom:ue,top:be}=Sw(at,Xe,bt,ft),qe=kw(ae/ze),me=qe*Kt+(qe-1)*kt-ue;return{bottom:ue,itemHeight:Kt,items:ft,itemWidth:an,offsetBottom:me,offsetTop:be,top:be}})),M),Dt(Ve(H,Qt(ae=>ae!==null),jt(ae=>ae.length)),j),Dt(Ve(_r(L,A,M,P),Qt(([ae,xe,{items:Se}])=>Se.length>0&&xe.height!==0&&ae.height!==0),jt(([ae,xe,{items:Se},Xe])=>{const{bottom:bt,top:at}=Sw(ae,Xe,xe,Se);return[at,bt]}),lr(ql)),t);const B=ct(!1);Dt(Ve(f,yn(B),jt(([ae,xe])=>xe||ae!==0)),B);const te=Zi(Ve(_r(M,j),Qt(([{items:ae},xe])=>{const Se=nr(H);return ae.length>0&&(Se===null||Se.length===xe)}),yn(B),Qt(([[ae,xe],Se])=>{const Xe=ae.items[ae.items.length-1].index===xe-1;return(Se||ae.bottom>0&&ae.itemHeight>0&&ae.offsetBottom===0&&ae.items.length===xe)&&Xe}),jt(([[,ae]])=>[ae-1,nr(H)]),lr(ql),jt(([ae])=>ae))),V=Zi(Ve(nn(M),Qt(({items:ae})=>ae.length>0&&ae[0].index===0),Qi(0),lr())),U=Zi(Ve(nn(M),yn(Y),Qt(([{items:ae},xe])=>ae.length>0&&!xe),jt(([{items:ae}])=>({endIndex:ae[ae.length-1].index,startIndex:ae[0].index})),lr(O4),gs(0)));Dt(U,x.scrollSeekRangeChanged),Dt(Ve(O,yn(L,A,j,P),jt(([ae,xe,Se,Xe,bt])=>{const at=z4(ae),{align:yt,behavior:et,offset:Ie}=at;let Ge=at.index;Ge==="LAST"&&(Ge=Xe-1),Ge=gu(0,Yh(Xe-1,Ge));let tt=vv(xe,bt,Se,Ge);return yt==="end"?tt=_w(tt-xe.height+Se.height):yt==="center"&&(tt=_w(tt-xe.height/2+Se.height/2)),Ie!==void 0&&Ie!==0&&(tt+=Ie),{behavior:et,top:tt}})),d);const oe=Wr(Ve(M,jt(ae=>ae.offsetBottom+ae.bottom)),0);return Dt(Ve(R,jt(ae=>({height:ae.visibleHeight,width:ae.visibleWidth}))),L),{customScrollParent:_,data:H,deviation:Q,footerHeight:a,gap:P,headerHeight:o,increaseViewportBy:e,initialItemCount:I,itemDimensions:A,overscan:n,restoreStateFrom:W,scrollBy:l,scrollContainerState:u,scrollHeight:F,scrollTo:d,scrollToIndex:O,scrollTop:f,smoothScrollTargetReached:p,totalCount:j,useWindowScroll:S,viewportDimensions:L,windowScrollContainerState:E,windowScrollTo:N,windowViewportRect:R,...x,gridState:M,horizontalDirection:X,initialTopMostItemIndex:ce,totalListHeight:oe,...m,endReached:te,propsReady:k,rangeChanged:U,startReached:V,stateChanged:K,stateRestoreInProgress:Y,...T}},cr(ok,vi,Ou,V4,no,lk,to));function i5(e,t,n){return gu(1,Af((e+n)/(Af(t)+n)))}function Sw(e,t,n,r){const{height:a}=n;if(a===void 0||r.length===0)return{bottom:0,top:0};const o=vv(e,t,n,r[0].index);return{bottom:vv(e,t,n,r[r.length-1].index)+a,top:o}}function vv(e,t,n,r){const a=i5(e.width,n.width,t.column),o=Af(r/a),l=o*n.height+gu(0,o-1)*t.row;return l>0?l+t.row:l}const wO=Bn(()=>{const e=ct(g=>`Item ${g}`),t=ct({}),n=ct(null),r=ct("virtuoso-grid-item"),a=ct("virtuoso-grid-list"),o=ct(uk),l=ct("div"),u=ct(Wl),d=(g,m=null)=>Wr(Ve(t,jt(x=>x[g]),lr()),m),f=ct(!1),p=ct(!1);return Dt(nn(p),f),{components:t,computeItemKey:o,context:n,FooterComponent:d("Footer"),HeaderComponent:d("Header"),headerFooterTag:l,itemClassName:r,ItemComponent:d("Item","div"),itemContent:e,listClassName:a,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:p,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),SO=Bn(([e,t])=>({...e,...t}),cr(_O,wO)),EO=Lt.memo(function(){const e=or("gridState"),t=or("listClassName"),n=or("itemClassName"),r=or("itemContent"),a=or("computeItemKey"),o=or("isSeeking"),l=xa("scrollHeight"),u=or("ItemComponent"),d=or("ListComponent"),f=or("ScrollSeekPlaceholder"),p=or("context"),g=xa("itemDimensions"),m=xa("gap"),x=or("log"),v=or("stateRestoreInProgress"),k=xa("reportReadyState"),_=Wo(Lt.useMemo(()=>S=>{const E=S.parentElement.parentElement.scrollHeight;l(E);const N=S.firstChild;if(N!==null){const{height:R,width:T}=N.getBoundingClientRect();g({height:R,width:T})}m({column:Ew("column-gap",getComputedStyle(S).columnGap,x),row:Ew("row-gap",getComputedStyle(S).rowGap,x)})},[l,g,m,x]),!0,!1);return nk(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:i.jsx(d,{className:t,ref:_,...ui(d,p),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(S=>{const E=a(S.index,S.data,p);return o?i.jsx(f,{...ui(f,p),height:e.itemHeight,index:S.index,width:e.itemWidth},E):y.createElement(u,{...ui(u,p),className:n,"data-index":S.index,key:E},r(S.index,S.data,p))})})}),NO=Lt.memo(function(){const e=or("HeaderComponent"),t=xa("headerHeight"),n=or("headerFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Js(o,"height"))},[t]),!0,!1),a=or("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...ui(e,a)})}):null}),CO=Lt.memo(function(){const e=or("FooterComponent"),t=xa("footerHeight"),n=or("headerFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Js(o,"height"))},[t]),!0,!1),a=or("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...ui(e,a)})}):null}),jO=({children:e})=>{const t=Lt.useContext(X4),n=xa("itemDimensions"),r=xa("viewportDimensions"),a=Wo(Lt.useMemo(()=>o=>{r(o.getBoundingClientRect())},[r]),!0,!1);return Lt.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),i.jsx("div",{ref:a,style:dk(!1),children:e})},TO=({children:e})=>{const t=Lt.useContext(X4),n=xa("windowViewportRect"),r=xa("itemDimensions"),a=or("customScrollParent"),o=or("useWindowScroll"),l=T4(n,a,!1);return Lt.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),i.jsx("div",{ref:l,style:e5(!1,o),children:e})},RO=Lt.memo(function({...e}){const t=or("useWindowScroll"),n=or("customScrollParent"),r=n||t?IO:AO,a=n||t?TO:jO,o=or("context");return i.jsx(r,{...e,...ui(r,o),children:i.jsxs(a,{children:[i.jsx(NO,{}),i.jsx(EO,{}),i.jsx(CO,{})]})})}),{useEmitter:a5,useEmitterValue:or,usePublisher:xa}=Y4(SO,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},RO),AO=t5({useEmitter:a5,useEmitterValue:or,usePublisher:xa}),IO=n5({useEmitter:a5,useEmitterValue:or,usePublisher:xa});function Ew(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Pr.WARN),t==="normal"?0:parseInt(t??"0",10)}function MO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const LO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DO={};function Nw(e,t){return(DO.jsx?OO:LO).test(e)}const PO=/[ \t\n\f\r]/g;function FO(e){return typeof e=="object"?e.type==="text"?Cw(e.value):!1:Cw(e)}function Cw(e){return e.replace(PO,"")===""}class Du{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Du.prototype.normal={};Du.prototype.property={};Du.prototype.space=void 0;function s5(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Du(n,r,t)}function kv(e){return e.toLowerCase()}class Di{constructor(t,n){this.attribute=n,this.property=t}}Di.prototype.attribute="";Di.prototype.booleanish=!1;Di.prototype.boolean=!1;Di.prototype.commaOrSpaceSeparated=!1;Di.prototype.commaSeparated=!1;Di.prototype.defined=!1;Di.prototype.mustUseProperty=!1;Di.prototype.number=!1;Di.prototype.overloadedBoolean=!1;Di.prototype.property="";Di.prototype.spaceSeparated=!1;Di.prototype.space=void 0;let BO=0;const fn=Go(),Rr=Go(),_v=Go(),ot=Go(),tr=Go(),zo=Go(),Gi=Go();function Go(){return 2**++BO}const wv=Object.freeze(Object.defineProperty({__proto__:null,boolean:fn,booleanish:Rr,commaOrSpaceSeparated:Gi,commaSeparated:zo,number:ot,overloadedBoolean:_v,spaceSeparated:tr},Symbol.toStringTag,{value:"Module"})),Qh=Object.keys(wv);class pk extends Di{constructor(t,n,r,a){let o=-1;if(super(t,n),jw(this,"space",a),typeof r=="number")for(;++o<Qh.length;){const l=Qh[o];jw(this,Qh[o],(r&wv[l])===wv[l])}}}pk.prototype.defined=!0;function jw(e,t,n){n&&(e[t]=n)}function Vl(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new pk(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[kv(r)]=r,n[kv(o.attribute)]=r}return new Du(t,n,e.space)}const o5=Vl({properties:{ariaActiveDescendant:null,ariaAtomic:Rr,ariaAutoComplete:null,ariaBusy:Rr,ariaChecked:Rr,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:tr,ariaCurrent:null,ariaDescribedBy:tr,ariaDetails:null,ariaDisabled:Rr,ariaDropEffect:tr,ariaErrorMessage:null,ariaExpanded:Rr,ariaFlowTo:tr,ariaGrabbed:Rr,ariaHasPopup:null,ariaHidden:Rr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tr,ariaLevel:ot,ariaLive:null,ariaModal:Rr,ariaMultiLine:Rr,ariaMultiSelectable:Rr,ariaOrientation:null,ariaOwns:tr,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:Rr,ariaReadOnly:Rr,ariaRelevant:null,ariaRequired:Rr,ariaRoleDescription:tr,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:Rr,ariaSetSize:ot,ariaSort:null,ariaValueMax:ot,ariaValueMin:ot,ariaValueNow:ot,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function l5(e,t){return t in e?e[t]:t}function c5(e,t){return l5(e,t.toLowerCase())}const zO=Vl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:zo,acceptCharset:tr,accessKey:tr,action:null,allow:null,allowFullScreen:fn,allowPaymentRequest:fn,allowUserMedia:fn,alpha:fn,alt:null,as:null,async:fn,autoCapitalize:null,autoComplete:tr,autoFocus:fn,autoPlay:fn,blocking:tr,capture:null,charSet:null,checked:fn,cite:null,className:tr,closedBy:null,colorSpace:null,cols:ot,colSpan:ot,command:null,commandFor:null,content:null,contentEditable:Rr,controls:fn,controlsList:tr,coords:ot|zo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:fn,defer:fn,dir:null,dirName:null,disabled:fn,download:_v,draggable:Rr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:fn,formTarget:null,headers:tr,height:ot,hidden:_v,high:ot,href:null,hrefLang:null,htmlFor:tr,httpEquiv:tr,id:null,imageSizes:null,imageSrcSet:null,inert:fn,inputMode:null,integrity:null,is:null,isMap:fn,itemId:null,itemProp:tr,itemRef:tr,itemScope:fn,itemType:tr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:fn,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:fn,muted:fn,name:null,nonce:null,noModule:fn,noValidate:fn,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:fn,optimum:ot,pattern:null,ping:tr,placeholder:null,playsInline:fn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:fn,referrerPolicy:null,rel:tr,required:fn,reversed:fn,rows:ot,rowSpan:ot,sandbox:tr,scope:null,scoped:fn,seamless:fn,selected:fn,shadowRootClonable:fn,shadowRootCustomElementRegistry:fn,shadowRootDelegatesFocus:fn,shadowRootMode:null,shadowRootSerializable:fn,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:Rr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ot,step:null,style:null,tabIndex:ot,target:null,title:null,translate:null,type:null,typeMustMatch:fn,useMap:null,value:Rr,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tr,axis:null,background:null,bgColor:null,border:ot,borderColor:null,bottomMargin:ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:fn,declare:fn,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:fn,noHref:fn,noShade:fn,noWrap:fn,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:Rr,standby:null,summary:null,text:null,topMargin:ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ot,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:fn,disablePictureInPicture:fn,disableRemotePlayback:fn,exportParts:zo,part:tr,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:c5}),qO=Vl({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:Gi,accentHeight:ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ot,amplitude:ot,arabicForm:null,ascent:ot,attributeName:null,attributeType:null,azimuth:ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ot,by:null,calcMode:null,capHeight:ot,className:tr,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:ot,diffuseConstant:ot,direction:null,display:null,dur:null,divisor:ot,dominantBaseline:null,download:fn,dx:null,dy:null,edgeMode:null,editable:null,elevation:ot,enableBackground:null,end:null,event:null,exponent:ot,externalResourcesRequired:null,fill:null,fillOpacity:ot,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:zo,g2:zo,glyphName:zo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ot,horizOriginX:ot,horizOriginY:ot,id:null,ideographic:ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ot,k:ot,k1:ot,k2:ot,k3:ot,k4:ot,kernelMatrix:Gi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ot,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:ot,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:ot,overlineThickness:ot,paintOrder:null,panose1:null,path:null,pathLength:ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gi,rev:Gi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gi,requiredFeatures:Gi,requiredFonts:Gi,requiredFormats:Gi,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:ot,specularExponent:ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ot,strikethroughThickness:ot,string:null,stroke:null,strokeDashArray:Gi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ot,strokeOpacity:ot,strokeWidth:null,style:null,surfaceScale:ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gi,tabIndex:ot,tableValues:null,target:null,targetX:ot,targetY:ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ot,underlineThickness:ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ot,values:null,vAlphabetic:ot,vMathematical:ot,vectorEffect:null,vHanging:ot,vIdeographic:ot,version:null,vertAdvY:ot,vertOriginX:ot,vertOriginY:ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:l5}),u5=Vl({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()}}),d5=Vl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:c5}),f5=Vl({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"},HO=/[A-Z]/g,Tw=/-[a-z]/g,$O=/^data[-\w.:]+$/i;function WO(e,t){const n=kv(t);let r=t,a=Di;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$O.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Tw,GO);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Tw.test(o)){let l=o.replace(HO,VO);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=pk}return new a(r,t)}function VO(e){return"-"+e.toLowerCase()}function GO(e){return e.charAt(1).toUpperCase()}const KO=s5([o5,zO,u5,d5,f5],"html"),hk=s5([o5,qO,u5,d5,f5],"svg");function YO(e){return e.join(" ").trim()}var jl={},Xh,Rw;function QO(){if(Rw)return Xh;Rw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
|
|
49
|
-
`,f="/",p="*",g="",m="comment",x="declaration";function v(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var E=1,N=1;function R(H){var P=H.match(t);P&&(E+=P.length);var K=H.lastIndexOf(d);N=~K?H.length-K:N+H.length}function T(){var H={line:E,column:N};return function(P){return P.position=new j(H),L(),P}}function j(H){this.start=H,this.end={line:E,column:N},this.source=S.source}j.prototype.content=_;function I(H){var P=new Error(S.source+":"+E+":"+N+": "+H);if(P.reason=H,P.filename=S.source,P.line=E,P.column=N,P.source=_,!S.silent)throw P}function M(H){var P=H.exec(_);if(P){var K=P[0];return R(K),_=_.slice(K.length),P}}function L(){M(n)}function A(H){var P;for(H=H||[];P=O();)P!==!1&&H.push(P);return H}function O(){var H=T();if(!(f!=_.charAt(0)||p!=_.charAt(1))){for(var P=2;g!=_.charAt(P)&&(p!=_.charAt(P)||f!=_.charAt(P+1));)++P;if(P+=2,g===_.charAt(P-1))return I("End of comment missing");var K=_.slice(2,P-2);return N+=2,R(K),_=_.slice(P),N+=2,H({type:m,comment:K})}}function F(){var H=T(),P=M(r);if(P){if(O(),!M(a))return I("property missing ':'");var K=M(o),W=H({type:x,property:k(P[0].replace(e,g)),value:K?k(K[0].replace(e,g)):g});return M(l),W}}function Q(){var H=[];A(H);for(var P;P=F();)P!==!1&&(H.push(P),A(H));return H}return L(),Q()}function k(_){return _?_.replace(u,g):g}return Xh=v,Xh}var Aw;function XO(){if(Aw)return jl;Aw=1;var e=jl&&jl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jl,"__esModule",{value:!0}),jl.default=n;const t=e(QO());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const l=(0,t.default)(r),u=typeof a=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;u?a(f,p,d):p&&(o=o||{},o[f]=p)}),o}return jl}var Gc={},Iw;function ZO(){if(Iw)return Gc;Iw=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},u=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,u):f=f.replace(r,u),f.replace(t,l))};return Gc.camelCase=d,Gc}var Kc,Mw;function JO(){if(Mw)return Kc;Mw=1;var e=Kc&&Kc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(XO()),n=ZO();function r(a,o){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(u,d){u&&d&&(l[(0,n.camelCase)(u,o)]=d)}),l}return r.default=r,Kc=r,Kc}var eD=JO();const tD=$o(eD),p5=h5("end"),gk=h5("start");function h5(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function nD(e){const t=gk(e),n=p5(e);if(t&&n)return{start:t,end:n}}function mu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Lw(e.position):"start"in e||"end"in e?Lw(e):"line"in e||"column"in e?Sv(e):""}function Sv(e){return Ow(e&&e.line)+":"+Ow(e&&e.column)}function Lw(e){return Sv(e&&e.start)+"-"+Sv(e&&e.end)}function Ow(e){return e&&typeof e=="number"?e:1}class fi extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(l=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?o.ruleId=r:(o.source=r.slice(0,d),o.ruleId=r.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=u?u.line:void 0,this.name=mu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}fi.prototype.file="";fi.prototype.name="";fi.prototype.reason="";fi.prototype.message="";fi.prototype.stack="";fi.prototype.column=void 0;fi.prototype.line=void 0;fi.prototype.ancestors=void 0;fi.prototype.cause=void 0;fi.prototype.fatal=void 0;fi.prototype.place=void 0;fi.prototype.ruleId=void 0;fi.prototype.source=void 0;const mk={}.hasOwnProperty,rD=new Map,iD=/[A-Z]/g,aD=new Set(["table","tbody","thead","tfoot","tr"]),sD=new Set(["td","th"]),g5="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function oD(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=gD(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=hD(n,t.jsx,t.jsxs)}const a={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"?hk:KO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=m5(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function m5(e,t,n){if(t.type==="element")return lD(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cD(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return dD(e,t,n);if(t.type==="mdxjsEsm")return uD(e,t);if(t.type==="root")return fD(e,t,n);if(t.type==="text")return pD(e,t)}function lD(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=hk,e.schema=a),e.ancestors.push(t);const o=y5(e,t.tagName,!1),l=mD(e,t);let u=yk(e,t);return aD.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!FO(d):!0})),x5(e,l,o,t),xk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function cD(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ru(e,t.position)}function uD(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ru(e,t.position)}function dD(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=hk,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:y5(e,t.name,!0),l=xD(e,t),u=yk(e,t);return x5(e,l,o,t),xk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function fD(e,t,n){const r={};return xk(r,yk(e,t)),e.create(t,e.Fragment,r,n)}function pD(e,t){return t.value}function x5(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function hD(e,t,n){return r;function r(a,o,l,u){const f=Array.isArray(l.children)?n:t;return u?f(o,l,u):f(o,l)}}function gD(e,t){return n;function n(r,a,o,l){const u=Array.isArray(o.children),d=gk(r);return t(a,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function mD(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&mk.call(t.properties,a)){const o=yD(e,a,t.properties[a]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&sD.has(t.tagName)?r=u:n[l]=u}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function xD(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Ru(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,o=e.evaluater.evaluateExpression(u.expression)}else Ru(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function yk(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:rD;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const f=a.get(d)||0;l=d+"-"+f,a.set(d,f+1)}}const u=m5(e,o,l);u!==void 0&&n.push(u)}return n}function yD(e,t,n){const r=WO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?MO(n):YO(n)),r.property==="style"){let a=typeof n=="object"?n:bD(e,String(n));return e.stylePropertyNameCase==="css"&&(a=vD(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?UO[r.property]||r.property:r.attribute,n]}}function bD(e,t){try{return tD(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new fi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=g5+"#cannot-parse-style-attribute",a}}function y5(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,l;for(;++o<a.length;){const u=Nw(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=Nw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return mk.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ru(e)}function Ru(e,t){const n=new fi("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=g5+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vD(e){const t={};let n;for(n in e)mk.call(e,n)&&(t[kD(n)]=e[n]);return t}function kD(e){let t=e.replace(iD,_D);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function _D(e){return"-"+e.toLowerCase()}const Zh={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"]},wD={};function bk(e,t){const n=wD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return b5(e,r,a)}function b5(e,t,n){if(SD(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 Dw(e.children,t,n)}return Array.isArray(e)?Dw(e,t,n):""}function Dw(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=b5(e[a],t,n);return r.join("")}function SD(e){return!!(e&&typeof e=="object")}const Pw=document.createElement("i");function vk(e){const t="&"+e+";";Pw.innerHTML=t;const n=Pw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ma(e,t,n,r){const a=e.length;let o=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function ma(e,t){return e.length>0?(Ma(e,e.length,0,t),e):t}const Fw={}.hasOwnProperty;function v5(e){const t={};let n=-1;for(;++n<e.length;)ED(t,e[n]);return t}function ED(e,t){let n;for(n in t){const a=(Fw.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){Fw.call(a,l)||(a[l]=[]);const u=o[l];ND(a[l],Array.isArray(u)?u:u?[u]:[])}}}function ND(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ma(e,0,0,r)}function k5(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function La(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bi=ro(/[A-Za-z]/),di=ro(/[\dA-Za-z]/),CD=ro(/[#-'*+\--9=?A-Z^-~]/);function If(e){return e!==null&&(e<32||e===127)}const Ev=ro(/\d/),jD=ro(/[\dA-Fa-f]/),TD=ro(/[!-/:-@[-`{-~]/);function en(e){return e!==null&&e<-2}function rr(e){return e!==null&&(e<0||e===32)}function wn(e){return e===-2||e===-1||e===32}const Xf=ro(new RegExp("\\p{P}|\\p{S}","u")),Ho=ro(/\s/);function ro(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gl(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&di(e.charCodeAt(n+1))&&di(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(n+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),a=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Fn(e,t,n,r){const a=r?r-1:1/0;let o=0;return l;function l(d){return wn(d)?(e.enter(n),u(d)):t(d)}function u(d){return wn(d)&&o++<a?(e.consume(d),u):(e.exit(n),t(d))}}function _5(e,t,n,r,a,o){let l=0;return u;function u(p){return wn(p)?(e.enter(r),d(p)):f(p)}function d(p){return wn(p)&&l<o?(e.consume(p),l++,d):(e.exit(r),f(p))}function f(p){return l>=a?t(p):n(p)}}const RD={tokenize:AD};function AD(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Fn(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),o(u)}function o(u){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return en(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}let Mf=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){Bw(this,t,n,r,!1)}addBefore(t,n,r){Bw(this,t,n,r,!0)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0,this.index.clear()}};function Bw(e,t,n,r,a){if(n===0&&r.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,a?(r.push(...o[2]),o[2]=r):o[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}const ID={tokenize:MD},zw={tokenize:LD};function MD(e){const t=this,n=[];let r=0,a,o,l;return u;function u(N){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,d,f)(N)}return f(N)}function d(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const R=t.events.length;let T=R,j;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){j=t.events[T][1].end;break}S(r);let I=R;for(;I<t.events.length;)t.events[I][1].end={...j},I++;const M=new Mf;return M.add(T+1,0,t.events.slice(R)),M.add(R,I-R,[]),M.consume(t.events),f(N)}return u(N)}function f(N){if(r===n.length){if(!a)return m(N);if(a.currentConstruct&&a.currentConstruct.concrete)return v(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(zw,p,g)(N)}function p(N){return a&&E(),S(r),m(N)}function g(N){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,v(N)}function m(N){return t.containerState={},e.attempt(zw,x,v)(N)}function x(N){return r++,n.push([t.currentConstruct,t.containerState]),m(N)}function v(N){if(N===null){a&&E(),S(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(N)}function k(N){if(N===null){_(e.exit("chunkFlow"),!0),S(0),e.consume(N);return}return en(N)?(e.consume(N),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(N),k)}function _(N,R){const T=t.sliceStream(N);if(R&&T.push(null),N.previous=o,o&&(o.next=N),o=N,a.defineSkip(N.start),a.write(T),t.parser.lazy[N.start.line]){let j=a.events.length;for(;j--;)if(a.events[j][1].start.offset<l&&(!a.events[j][1].end||a.events[j][1].end.offset>l))return;const I=t.events.length;let M=I,L,A;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(L){A=t.events[M][1].end;break}L=!0}for(S(r),j=I;j<t.events.length;)t.events[j][1].end={...A},j++;const O=new Mf;O.add(M+1,0,t.events.slice(I)),O.add(I,j-I,[]),O.consume(t.events)}}function S(N){let R=n.length;for(;R-- >N;){const T=n[R];t.containerState=T[1],T[0].exit.call(t,e)}n.length=N}function E(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function LD(e,t,n){return Fn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lf(e){if(e===null||rr(e)||Ho(e))return 1;if(Xf(e))return 2}function Zf(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Nv={name:"attention",resolveAll:OD,tokenize:DD};function OD(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let a=n;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,l={...e[a][1].end},u={...e[n][1].start};qw(l,-o),qw(u,o);const d={type:o>1?"strongSequence":"emphasisSequence",start:l,end:{...e[a][1].end}},f={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:u},p={type:o>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},g={type:o>1?"strong":"emphasis",start:{...d.start},end:{...f.end}};e[a][1].end={...d.start},e[n][1].start={...f.end},r=[],e[a][1].end.offset-e[a][1].start.offset&&(r=ma(r,[["enter",e[a][1],t],["exit",e[a][1],t]])),r=ma(r,[["enter",g,t],["enter",d,t],["exit",d,t],["enter",p,t]]),r=ma(r,Zf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),r=ma(r,[["exit",p,t],["enter",f,t],["exit",f,t],["exit",g,t]]);let m=0;e[n][1].end.offset-e[n][1].start.offset&&(m=2,r=ma(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),Ma(e,a-1,n-a+3,r),n=a+r.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function DD(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Lf(r);let o;return l;function l(d){return o=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===o)return e.consume(d),u;const f=e.exit("attentionSequence"),p=Lf(d),g=!p||p===2&&a||n.includes(d)&&d!==42&&d!==95,m=!a||a===2&&p||n.includes(r)&&r!==42&&r!==95;return f._open=!!(o===42?g:g&&(a||!m)),f._close=!!(o===42?m:m&&(p||!g)),t(d)}}function qw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PD={name:"autolink",tokenize:FD};function FD(e,t,n){let r=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return bi(x)?(e.consume(x),l):x===64?n(x):f(x)}function l(x){return x===43||x===45||x===46||di(x)?(r=1,u(x)):f(x)}function u(x){return x===58?(e.consume(x),r=0,d):(x===43||x===45||x===46||di(x))&&r++<32?(e.consume(x),u):(r=0,f(x))}function d(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||If(x)?n(x):(e.consume(x),d)}function f(x){return x===64?(e.consume(x),p):CD(x)?(e.consume(x),f):n(x)}function p(x){return di(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),r=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):m(x)}function m(x){if((x===45||di(x))&&r++<63){const v=x===45?m:g;return e.consume(x),v}return n(x)}}const Pu={partial:!0,tokenize:BD};function BD(e,t,n){return r;function r(o){return wn(o)?Fn(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||en(o)?t(o):n(o)}}const w5={continuation:{tokenize:qD},exit:UD,name:"blockQuote",tokenize:zD};function zD(e,t,n){const r=this;return a;function a(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return wn(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function qD(e,t,n){const r=this;return a;function a(l){return wn(l)?Fn(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(w5,t,n)(l)}}function UD(e){e.exit("blockQuote")}const S5={name:"characterEscape",tokenize:HD};function HD(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return TD(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const E5={name:"characterReference",tokenize:$D};function $D(e,t,n){const r=this;let a=0,o,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=di,p(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=jD,p):(e.enter("characterReferenceValue"),o=7,l=Ev,p(g))}function p(g){if(g===59&&a){const m=e.exit("characterReferenceValue");return l===di&&!vk(r.sliceSerialize(m))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&a++<o?(e.consume(g),p):n(g)}}const Cv={partial:!0,tokenize:WD};function WD(e,t,n){const r=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Uw={concrete:!0,name:"codeFenced",tokenize:VD};function VD(e,t,n){const r=this,a={partial:!0,tokenize:T};let o=0,l=0,u;return d;function d(j){return f(j)}function f(j){const I=r.events[r.events.length-1];return o=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,u=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===u?(l++,e.consume(j),p):l<3?n(j):(e.exit("codeFencedFenceSequence"),wn(j)?Fn(e,g,"whitespace")(j):g(j))}function g(j){return j===null||en(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Cv,k,R)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(j))}function m(j){return j===null||en(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(j)):wn(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Fn(e,x,"whitespace")(j)):j===96&&j===u?n(j):(e.consume(j),m)}function x(j){return j===null||en(j)?g(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===null||en(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(j)):j===96&&j===u?n(j):(e.consume(j),v)}function k(j){return e.attempt(a,R,_)(j)}function _(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),S}function S(j){return o>0&&wn(j)?Fn(e,E,"linePrefix",o+1)(j):E(j)}function E(j){return j===null||en(j)?e.check(Cv,k,R)(j):(e.enter("codeFlowValue"),N(j))}function N(j){return j===null||en(j)?(e.exit("codeFlowValue"),E(j)):(e.consume(j),N)}function R(j){return e.exit("codeFenced"),t(j)}function T(j,I,M){let L=0;return A;function A(P){return j.enter("lineEnding"),j.consume(P),j.exit("lineEnding"),O}function O(P){return j.enter("codeFencedFence"),wn(P)?Fn(j,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):F(P)}function F(P){return P===u?(j.enter("codeFencedFenceSequence"),Q(P)):M(P)}function Q(P){return P===u?(L++,j.consume(P),Q):L>=l?(j.exit("codeFencedFenceSequence"),wn(P)?Fn(j,H,"whitespace")(P):H(P)):M(P)}function H(P){return P===null||en(P)?(j.exit("codeFencedFence"),I(P)):M(P)}}}const Jh={name:"codeIndented",tokenize:KD},GD={partial:!0,tokenize:YD};function KD(e,t,n){return r;function r(u){return e.enter("codeIndented"),_5(e,a,n,"linePrefix",4,4)(u)}function a(u){return u===null?l(u):en(u)?e.attempt(GD,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||en(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function YD(e,t,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):en(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):_5(e,t,o,"linePrefix",4,4)(l)}function o(l){return en(l)?a(l):n(l)}}const QD={name:"codeText",previous:ZD,resolve:XD,tokenize:JD};function XD(e){let t=e.length-4,n=3,r,a;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;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function ZD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JD(e,t,n){let r=0,a,o;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),r++,u):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(o=e.enter("codeTextSequence"),a=0,p(g)):en(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||en(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),f)}function p(g){return g===96?(e.consume(g),a++,p):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",f(g))}}class eP{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Yc(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Yc(this.left,n.reverse())}}}function Yc(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 N5(e){const t={};let n=-1,r,a,o,l,u,d,f;const p=new eP(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,tP(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,a=void 0;o--;)if(l=p.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(r[1].end={...p.get(a)[1].start},u=p.slice(a,n),u.unshift(r),p.splice(a,n-a+1,u))}}return Ma(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function tP(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,d=[],f={};let p,g,m=-1,x=n,v=0,k=0;const _=[k];for(;x;){for(;e.get(++a)[1]!==x;);o.push(a),x._tokenizer||(p=r.sliceStream(x),x.next||p.push(null),g&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++m<u.length;)u[m][0]==="exit"&&u[m-1][0]==="enter"&&u[m][1].type===u[m-1][1].type&&u[m][1].start.line!==u[m][1].end.line&&(k=m+1,_.push(k),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(l.events=[],x?(x._tokenizer=void 0,x.previous=void 0):_.pop(),m=_.length;m--;){const S=u.slice(_[m],_[m+1]),E=o.pop();d.push([E,E+S.length-1]),e.splice(E,2,S)}for(d.reverse(),m=-1;++m<d.length;)f[v+d[m][0]]=v+d[m][1],v+=d[m][1]-d[m][0]-1;return f}const nP={resolve:iP,tokenize:aP},rP={partial:!0,tokenize:sP};function iP(e){return N5(e),e}function aP(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(u)}function a(u){return u===null?o(u):en(u)?e.check(rP,l,o)(u):(e.consume(u),a)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function sP(e,t,n){const r=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Fn(e,o,"linePrefix")}function o(l){if(l===null||en(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function C5(e,t,n,r,a,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return g;function g(S){return S===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(S),e.exit(o),m):S===null||S===32||S===41||If(S)?n(S):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(S))}function m(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),x(S))}function x(S){return S===62?(e.exit("chunkString"),e.exit(u),m(S)):S===null||S===60||en(S)?n(S):(e.consume(S),S===92?v:x)}function v(S){return S===60||S===62||S===92?(e.consume(S),x):x(S)}function k(S){return!p&&(S===null||S===41||rr(S))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(S)):p<f&&S===40?(e.consume(S),p++,k):S===41?(e.consume(S),p--,k):S===null||S===32||S===40||If(S)?n(S):(e.consume(S),S===92?_:k)}function _(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function j5(e,t,n,r,a,o){const l=this;let u=0,d;return f;function f(x){return e.enter(r),e.enter(a),e.consume(x),e.exit(a),e.enter(o),p}function p(x){return u>999||x===null||x===91||x===93&&!d||x===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(x):x===93?(e.exit(o),e.enter(a),e.consume(x),e.exit(a),e.exit(r),t):en(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||en(x)||u++>999?(e.exit("chunkString"),p(x)):(e.consume(x),d||(d=!wn(x)),x===92?m:g)}function m(x){return x===91||x===92||x===93?(e.consume(x),u++,g):g(x)}}function T5(e,t,n,r,a,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),l=m===40?41:m,d):n(m)}function d(m){return m===l?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?n(m):en(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Fn(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===l||m===null||en(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?g:p)}function g(m){return m===l||m===92?(e.consume(m),p):p(m)}}function xu(e,t){let n;return r;function r(a){return en(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):wn(a)?Fn(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const oP={name:"definition",tokenize:cP},lP={partial:!0,tokenize:uP};function cP(e,t,n){const r=this;let a;return o;function o(x){return e.enter("definition"),l(x)}function l(x){return j5.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function u(x){return a=La(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),d):n(x)}function d(x){return rr(x)?xu(e,f)(x):f(x)}function f(x){return C5(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(lP,g,g)(x)}function g(x){return wn(x)?Fn(e,m,"whitespace")(x):m(x)}function m(x){return x===null||en(x)?(e.exit("definition"),r.parser.defined.push(a),t(x)):n(x)}}function uP(e,t,n){return r;function r(u){return rr(u)?xu(e,a)(u):n(u)}function a(u){return T5(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return wn(u)?Fn(e,l,"whitespace")(u):l(u)}function l(u){return u===null||en(u)?t(u):n(u)}}const dP={name:"hardBreakEscape",tokenize:fP};function fP(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return en(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const pP={name:"headingAtx",resolve:hP,tokenize:gP};function hP(e,t){let n=e.length-2,r=3;if(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){const a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"};Ma(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])}return e}function gP(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||rr(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||en(p)?(e.exit("atxHeading"),t(p)):wn(p)?Fn(e,u,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),u(p))}function f(p){return p===null||p===35||rr(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const mP=["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"],Hw=["pre","script","style","textarea"],xP={concrete:!0,name:"htmlFlow",resolveTo:bP,tokenize:vP},yP={partial:!0,tokenize:kP};function bP(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 vP(e,t,n){const r=this;let a,o,l,u,d;return f;function f(B){return p(B)}function p(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),g}function g(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),o=!0,k):B===63?(e.consume(B),a=3,r.interrupt?t:z):bi(B)?(e.consume(B),l=String.fromCharCode(B),_):n(B)}function m(B){return B===45?(e.consume(B),a=2,x):B===91?(e.consume(B),a=5,u=0,v):bi(B)?(e.consume(B),a=4,r.interrupt?t:z):n(B)}function x(B){return B===45?(e.consume(B),r.interrupt?t:z):n(B)}function v(B){const te="CDATA[";return B===te.charCodeAt(u++)?(e.consume(B),u===te.length?r.interrupt?t:F:v):n(B)}function k(B){return bi(B)?(e.consume(B),l=String.fromCharCode(B),_):n(B)}function _(B){if(B===null||B===47||B===62||rr(B)){const te=B===47,V=l.toLowerCase();return!te&&!o&&Hw.includes(V)?(a=1,r.interrupt?t(B):F(B)):mP.includes(l.toLowerCase())?(a=6,te?(e.consume(B),S):r.interrupt?t(B):F(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):o?E(B):N(B))}return B===45||di(B)?(e.consume(B),l+=String.fromCharCode(B),_):n(B)}function S(B){return B===62?(e.consume(B),r.interrupt?t:F):n(B)}function E(B){return wn(B)?(e.consume(B),E):A(B)}function N(B){return B===47?(e.consume(B),A):B===58||B===95||bi(B)?(e.consume(B),R):wn(B)?(e.consume(B),N):A(B)}function R(B){return B===45||B===46||B===58||B===95||di(B)?(e.consume(B),R):T(B)}function T(B){return B===61?(e.consume(B),j):wn(B)?(e.consume(B),T):N(B)}function j(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),d=B,I):wn(B)?(e.consume(B),j):M(B)}function I(B){return B===d?(e.consume(B),d=null,L):B===null||en(B)?n(B):(e.consume(B),I)}function M(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||rr(B)?T(B):(e.consume(B),M)}function L(B){return B===47||B===62||wn(B)?N(B):n(B)}function A(B){return B===62?(e.consume(B),O):n(B)}function O(B){return B===null||en(B)?F(B):wn(B)?(e.consume(B),O):n(B)}function F(B){return B===45&&a===2?(e.consume(B),K):B===60&&a===1?(e.consume(B),W):B===62&&a===4?(e.consume(B),G):B===63&&a===3?(e.consume(B),z):B===93&&a===5?(e.consume(B),ce):en(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(yP,X,Q)(B)):B===null||en(B)?(e.exit("htmlFlowData"),Q(B)):(e.consume(B),F)}function Q(B){return e.check(Cv,H,X)(B)}function H(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),P}function P(B){return B===null||en(B)?Q(B):(e.enter("htmlFlowData"),F(B))}function K(B){return B===45?(e.consume(B),z):F(B)}function W(B){return B===47?(e.consume(B),l="",Y):F(B)}function Y(B){if(B===62){const te=l.toLowerCase();return Hw.includes(te)?(e.consume(B),G):F(B)}return bi(B)&&l.length<8?(e.consume(B),l+=String.fromCharCode(B),Y):F(B)}function ce(B){return B===93?(e.consume(B),z):F(B)}function z(B){return B===62?(e.consume(B),G):B===45&&a===2?(e.consume(B),z):F(B)}function G(B){return B===null||en(B)?(e.exit("htmlFlowData"),X(B)):(e.consume(B),G)}function X(B){return e.exit("htmlFlow"),t(B)}}function kP(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Pu,t,n)}}const _P={name:"htmlText",tokenize:wP};function wP(e,t,n){const r=this;let a,o,l;return u;function u(z){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(z),d}function d(z){return z===33?(e.consume(z),f):z===47?(e.consume(z),T):z===63?(e.consume(z),N):bi(z)?(e.consume(z),M):n(z)}function f(z){return z===45?(e.consume(z),p):z===91?(e.consume(z),o=0,v):bi(z)?(e.consume(z),E):n(z)}function p(z){return z===45?(e.consume(z),x):n(z)}function g(z){return z===null?n(z):z===45?(e.consume(z),m):en(z)?(l=g,W(z)):(e.consume(z),g)}function m(z){return z===45?(e.consume(z),x):g(z)}function x(z){return z===62?K(z):z===45?m(z):g(z)}function v(z){const G="CDATA[";return z===G.charCodeAt(o++)?(e.consume(z),o===G.length?k:v):n(z)}function k(z){return z===null?n(z):z===93?(e.consume(z),_):en(z)?(l=k,W(z)):(e.consume(z),k)}function _(z){return z===93?(e.consume(z),S):k(z)}function S(z){return z===62?K(z):z===93?(e.consume(z),S):k(z)}function E(z){return z===null||z===62?K(z):en(z)?(l=E,W(z)):(e.consume(z),E)}function N(z){return z===null?n(z):z===63?(e.consume(z),R):en(z)?(l=N,W(z)):(e.consume(z),N)}function R(z){return z===62?K(z):N(z)}function T(z){return bi(z)?(e.consume(z),j):n(z)}function j(z){return z===45||di(z)?(e.consume(z),j):I(z)}function I(z){return en(z)?(l=I,W(z)):wn(z)?(e.consume(z),I):K(z)}function M(z){return z===45||di(z)?(e.consume(z),M):z===47||z===62||rr(z)?L(z):n(z)}function L(z){return z===47?(e.consume(z),K):z===58||z===95||bi(z)?(e.consume(z),A):en(z)?(l=L,W(z)):wn(z)?(e.consume(z),L):K(z)}function A(z){return z===45||z===46||z===58||z===95||di(z)?(e.consume(z),A):O(z)}function O(z){return z===61?(e.consume(z),F):en(z)?(l=O,W(z)):wn(z)?(e.consume(z),O):L(z)}function F(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),a=z,Q):en(z)?(l=F,W(z)):wn(z)?(e.consume(z),F):(e.consume(z),H)}function Q(z){return z===a?(e.consume(z),a=void 0,P):z===null?n(z):en(z)?(l=Q,W(z)):(e.consume(z),Q)}function H(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||rr(z)?L(z):(e.consume(z),H)}function P(z){return z===47||z===62||rr(z)?L(z):n(z)}function K(z){return z===62?(e.consume(z),e.exit("htmlTextData"),e.exit("htmlText"),t):n(z)}function W(z){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),Y}function Y(z){return wn(z)?Fn(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ce(z)}function ce(z){return e.enter("htmlTextData"),l(z)}}const kk={name:"labelEnd",resolveAll:CP,resolveTo:jP,tokenize:TP},SP={tokenize:RP},EP={tokenize:AP},NP={tokenize:IP};function CP(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ma(e,0,e.length,n),e}function jP(e,t){let n=e.length,r=0,a,o,l;for(;n--;){const p=e[n][1];if(a){if(p.type==="link"||p.type==="labelLink"&&p._inactive)break;e[n][0]==="enter"&&p.type==="labelLink"&&(p._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(p.type==="labelImage"||p.type==="labelLink")&&!p._balanced&&(a=n,p.type!=="labelLink")){r=2;break}}else p.type==="labelEnd"&&(o=n)}const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=ma(l,e.slice(a+1,a+r+3)),l=ma(l,[["enter",f,t]]),l=ma(l,Zf(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),l=ma(l,[["exit",f,t],e[o-2],e[o-1],["exit",d,t]]),l=ma(l,e.slice(o+1)),l=ma(l,[["exit",u,t]]),Ma(e,a,e.length,l),e}function TP(e,t,n){const r=this,a=r._labelStarts;let o,l;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();o=a[a.length-1]}return u;function u(m){return o?o._inactive?g(m):(l=r.parser.defined.includes(La(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),d):n(m)}function d(m){return m===40?e.attempt(SP,p,l?p:g)(m):m===91?e.attempt(EP,p,l?f:g)(m):l?p(m):g(m)}function f(m){return e.attempt(NP,p,g)(m)}function p(m){return a.pop(),t(m)}function g(m){return o._balanced=!0,n(m)}}function RP(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return rr(g)?xu(e,o)(g):o(g)}function o(g){return g===41?p(g):C5(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return rr(g)?xu(e,d)(g):p(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?T5(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function f(g){return rr(g)?xu(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function AP(e,t,n){const r=this;return a;function a(u){return j5.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(La(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function IP(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const MP={name:"labelStartImage",resolveAll:kk.resolveAll,tokenize:LP};function LP(e,t,n){const r=this;let a;return o;function o(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),a=e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(d))}}const OP={name:"labelStartLink",resolveAll:kk.resolveAll,tokenize:DP};function DP(e,t,n){const r=this;let a;return o;function o(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),a=e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(u))}}const eg={name:"lineEnding",tokenize:PP};function PP(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Fn(e,t,"linePrefix")}}const Sf={name:"thematicBreak",tokenize:FP};function FP(e,t,n){let r=0,a;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return a=f,u(f)}function u(f){return f===a?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||en(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===a?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),wn(f)?Fn(e,u,"whitespace")(f):u(f))}}const Ii={continuation:{tokenize:UP},exit:$P,name:"list",tokenize:qP},BP={partial:!0,tokenize:WP},zP={partial:!0,tokenize:HP};function qP(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return u;function u(x){const v=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:Ev(x)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Sf,n,f)(x):f(x);if(!r.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(x)}return n(x)}function d(x){return Ev(x)&&++l<10?(e.consume(x),d):(!r.interrupt||l<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),f(x)):n(x)}function f(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,e.check(Pu,r.interrupt?n:p,e.attempt(BP,m,g))}function p(x){return r.containerState.initialBlankLine=!0,o++,m(x)}function g(x){return wn(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),m):n(x)}function m(x){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function UP(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Pu,a,o);function a(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Fn(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!wn(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zP,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Fn(e,e.attempt(Ii,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function HP(e,t,n){const r=this;return Fn(e,a,"listItemIndent",r.containerState.size+1);function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function $P(e){e.exit(this.containerState.type)}function WP(e,t,n){const r=this;return Fn(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const l=r.events[r.events.length-1];return!wn(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const $w={name:"setextUnderline",resolveTo:VP,tokenize:GP};function VP(e,t){const n=new Mf;let r=e.length,a,o,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&n.add(r,1,[]),!l&&e[r][1].type==="definition"&&(l=r);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",l?(n.add(o,0,[["enter",u,t]]),n.add(l+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[l][1].end}):e[a][1]=u,n.add(e.length,0,[["exit",u,t]]),n.consume(e),e}function GP(e,t,n){const r=this;let a;return o;function o(f){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),a=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===a?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),wn(f)?Fn(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||en(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const KP={tokenize:YP};function YP(e){const t=this,n=e.attempt(Pu,r,e.attempt(this.parser.constructs.flowInitial,a,Fn(e,e.attempt(this.parser.constructs.flow,a,e.attempt(nP,a)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const QP={resolveAll:A5()},XP=R5("string"),ZP=R5("text");function R5(e){return{resolveAll:A5(e==="text"?JP:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,l,u);return l;function l(p){return f(p)?o(p):u(p)}function u(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const g=a[p];let m=-1;if(g)for(;++m<g.length;){const x=g[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function A5(e){return t;function t(n,r){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,r):n}}function JP(e,t){const n=new Mf;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],o=t.sliceStream(a);let l=o.length,u=-1,d=0,f;for(;l--;){const p=o[l];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(p===-2)f=!0,d++;else if(p!==-1){l++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(d=0),d){const p={type:r===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:a.start._bufferIndex+u,_index:a.start._index+l,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...p.start},a.start.offset===a.end.offset?Object.assign(a,p):n.add(r,0,[["enter",p,t],["exit",p,t]])}r++}return n.consume(e),e}const e6={42:Ii,43:Ii,45:Ii,48:Ii,49:Ii,50:Ii,51:Ii,52:Ii,53:Ii,54:Ii,55:Ii,56:Ii,57:Ii,62:w5},t6={91:oP},n6={[-2]:Jh,[-1]:Jh,32:Jh},r6={35:pP,42:Sf,45:[$w,Sf],60:xP,61:$w,95:Sf,96:Uw,126:Uw},i6={38:E5,92:S5},a6={[-5]:eg,[-4]:eg,[-3]:eg,33:MP,38:E5,42:Nv,60:[PD,_P],91:OP,92:[dP,S5],93:kk,95:Nv,96:QD},s6={null:[Nv,QP]},o6={null:[42,95]},l6={null:[]},c6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:o6,contentInitial:t6,disable:l6,document:e6,flow:r6,flowInitial:n6,insideSpan:s6,string:i6,text:a6},Symbol.toStringTag,{value:"Module"}));function u6(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let l=[],u=[];const d={attempt:I(T),check:I(j),consume:E,enter:N,exit:R,interrupt:I(j,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:x,write:g};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function g(O){return l=ma(l,O),_(),l[l.length-1]!==null?[]:(M(t,0),f.events=Zf(o,f.events,f),f.events)}function m(O,F){return f6(x(O),F)}function x(O){return d6(l,O)}function v(){const{_bufferIndex:O,_index:F,line:Q,column:H,offset:P}=r;return{_bufferIndex:O,_index:F,line:Q,column:H,offset:P}}function k(O){a[O.line]=O.column,A()}function _(){for(;r._index<l.length;){const O=l[r._index];if(typeof O=="string"){const F=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<O.length;)S(O.charCodeAt(r._bufferIndex))}else S(O)}}function S(O){p=p(O)}function E(O){en(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,A()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=O}function N(O,F){const Q=F||{};return Q.type=O,Q.start=v(),f.events.push(["enter",Q,f]),u.push(Q),Q}function R(O){const F=u.pop();return F.end=v(),f.events.push(["exit",F,f]),F}function T(O,F){M(O,F.from)}function j(O,F){F.restore()}function I(O,F){return Q;function Q(H,P,K){let W,Y,ce,z;return Array.isArray(H)?X(H):"tokenize"in H?X([H]):G(H);function G(U){return oe;function oe(ae){const xe=ae!==null&&U[ae],Se=ae!==null&&U.null,Xe=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return X(Xe)(ae)}}function X(U){return W=U,Y=0,U.length===0?K:B(U[Y])}function B(U){return oe;function oe(ae){return z=L(),ce=U,U.partial||(f.currentConstruct=U),U.name&&f.parser.constructs.disable.null.includes(U.name)?V():U.tokenize.call(F?Object.assign(Object.create(f),F):f,d,te,V)(ae)}}function te(U){return O(ce,z),P}function V(U){return z.restore(),++Y<W.length?B(W[Y]):K}}}function M(O,F){O.resolveAll&&!o.includes(O)&&o.push(O),O.resolve&&Ma(f.events,F,f.events.length-F,O.resolve(f.events.slice(F),f)),O.resolveTo&&(f.events=O.resolveTo(f.events,f))}function L(){const O=v(),F=f.previous,Q=f.currentConstruct,H=f.events.length,P=Array.from(u);return{from:H,restore:K};function K(){r=O,f.previous=F,f.currentConstruct=Q,f.events.length=H,u=P,A()}}function A(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function d6(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(r,o)];else{if(l=e.slice(n,a),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[a].slice(0,o))}return l}function f6(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
50
|
-
`;break}case-3:{l=`\r
|
|
51
|
-
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(o)}a=o===-2,r.push(l)}return r.join("")}function p6(e){const r={constructs:v5([c6,...(e||{}).extensions||[]]),content:a(RD),defined:[],document:a(ID),flow:a(KP),lazy:{},string:a(XP),text:a(ZP)};return r;function a(o){return l;function l(u){return u6(r,o,u)}}}function h6(e){for(;!N5(e););return e}const Ww=/[\0\t\n\r]/g;function g6(){let e=1,t="",n=!0,r;return a;function a(o,l,u){o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o));const d=[];let f=0;for(t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){Ww.lastIndex=f;const p=Ww.exec(o),g=p&&p.index!==void 0?p.index:o.length,m=o.charCodeAt(g);if(!p){t=o.slice(f);break}if(m===10&&f===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),f<g&&(d.push(o.slice(f,g)),e+=g-f),m){case 0:{d.push(65533),e++;break}case 9:{const x=Math.ceil(e/4)*4;for(d.push(-2);e++<x;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}f=g+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const m6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function x6(e){return e.replace(m6,y6)}function y6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return k5(n.slice(o?2:1),o?16:10)}return vk(n)||e}const I5={}.hasOwnProperty;function b6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),v6(n)(h6(p6(n).document().write(g6()(e,t,!0))))}function v6(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Kt),autolinkProtocol:A,autolinkEmail:A,atxHeading:l(Ie),blockQuote:l(Xe),characterEscape:A,characterReference:A,codeFenced:l(bt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(bt,u),codeText:l(at,u),codeTextData:A,data:A,codeFlowValue:A,definition:l(yt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(et),hardBreakEscape:l(Ge),hardBreakTrailing:l(Ge),htmlFlow:l(tt,u),htmlFlowData:A,htmlText:l(tt,u),htmlTextData:A,image:l(kt),label:u,link:l(Kt),listItem:l(Vt),listItemValue:x,listOrdered:l(an,m),listUnordered:l(an),paragraph:l(ze),reference:te,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(Ie),strong:l(De),thematicBreak:l(ft)},exit:{atxHeading:f(),atxHeadingSequence:j,autolink:f(),autolinkEmail:Se,autolinkProtocol:xe,blockQuote:f(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:oe,characterReference:ae,codeFenced:f(S),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:O,codeIndented:f(E),codeText:f(K),codeTextData:O,data:O,definition:f(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:R,emphasis:f(),hardBreakEscape:f(Q),hardBreakTrailing:f(Q),htmlFlow:f(H),htmlFlowData:O,htmlText:f(P),htmlTextData:O,image:f(Y),label:z,labelText:ce,lineEnding:F,link:f(W),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:V,resourceDestinationString:G,resourceTitleString:X,resource:B,setextHeading:f(L),setextHeadingLineSequence:M,setextHeadingText:I,strong:f(),thematicBreak:f()}};M5(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let be={type:"root",children:[],position:void 0};const qe={stack:[be],tokenStack:[],config:t,enter:d,exit:p,buffer:u,resume:g,data:n},me=[],pt=[];let gt=-1;for(;++gt<ue.length;)if(pt.push(ue[gt]),ue[gt][1].type==="listOrdered"||ue[gt][1].type==="listUnordered")if(ue[gt][0]==="enter")me.push(pt.length-1);else{const wt=me.pop();o(pt,wt)}for(ue=pt,gt=-1;++gt<ue.length;){const wt=t[ue[gt][0]];ue[gt][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...qe,sliceSerialize:ue[gt][2].sliceSerialize},ue[gt][1]),I5.call(wt,ue[gt][1].type)&&wt[ue[gt][1].type].call({...qe,sliceSerialize:ue[gt][2].sliceSerialize},ue[gt][1]),ue[gt][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...qe,sliceSerialize:ue[gt][2].sliceSerialize},ue[gt][1])}if(qe.tokenStack.length>0){const wt=qe.tokenStack[qe.tokenStack.length-1];(wt[1]||Vw).call(qe,void 0,wt[0])}for(be.position={start:Gs(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Gs(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},gt=-1;++gt<t.transforms.length;)be=t.transforms[gt](be)||be;return be}function a(ue,be,qe){let me=-1;for(;++me<ue.length;)ue[me].call(be,qe)}function o(ue,be){const qe=ue.length-1;let me=be-1,pt=-1,gt=!1,wt,ht,$t,Wt;const Je=[];for(;++me<=qe;){const Yt=ue[me];switch(Yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Yt[0]==="enter"?pt++:pt--,Wt=void 0;break}case"lineEndingBlank":{Yt[0]==="enter"&&(wt&&!Wt&&!pt&&!$t&&($t=me),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!pt&&Yt[0]==="enter"&&Yt[1].type==="listItemPrefix"||pt===-1&&Yt[0]==="exit"&&(Yt[1].type==="listUnordered"||Yt[1].type==="listOrdered")){if(wt){let cn=me;for(ht=void 0;cn--;){const xn=ue[cn];if(xn[1].type==="lineEnding"||xn[1].type==="lineEndingBlank"){if(xn[0]==="exit")continue;ht&&(ue[ht][1].type="lineEndingBlank",gt=!0),xn[1].type="lineEnding",ht=cn}else if(!(xn[1].type==="linePrefix"||xn[1].type==="blockQuotePrefix"||xn[1].type==="blockQuotePrefixWhitespace"||xn[1].type==="blockQuoteMarker"||xn[1].type==="listItemIndent"))break}$t&&(!ht||$t<ht)&&(wt._spread=!0),wt.end=Object.assign({},ht?ue[ht][1].start:Yt[1].end),Je.push({at:ht||me,event:["exit",wt,Yt[2]]})}if(Yt[1].type==="listItemPrefix"){const cn={type:"listItem",_spread:!1,start:Object.assign({},Yt[1].start),end:void 0};wt=cn,Je.push({at:me,event:["enter",cn,Yt[2]]}),$t=void 0,Wt=!0}}}const zt=ue.splice(be);let St=0;for(me=-1;++me<zt.length;){for(;St<Je.length&&Je[St].at===be+me;)ue.push(Je[St++].event);ue.push(zt[me])}ue[be][1]._spread=gt}function l(ue,be){return qe;function qe(me){d.call(this,ue(me),me),be&&be.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(ue,be,qe){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([be,qe||void 0]),ue.position={start:Gs(be.start),end:void 0}}function f(ue){return be;function be(qe){ue&&ue.call(this,qe),p.call(this,qe)}}function p(ue,be){const qe=this.stack.pop(),me=this.tokenStack.pop();if(!me)throw new Error("Cannot close `"+ue.type+"` ("+mu({start:ue.start,end:ue.end})+"): it’s not open");me[0].type!==ue.type&&(be?be.call(this,ue,me[0]):(me[1]||Vw).call(this,ue,me[0])),qe.position.end=Gs(ue.end)}function g(){return bk(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.lang=ue}function k(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.meta=ue}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/(\r?\n|\r)$/g,"")}function N(ue){const be=this.resume(),qe=this.stack[this.stack.length-1];qe.label=be,qe.identifier=La(this.sliceSerialize(ue)).toLowerCase()}function R(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function T(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function j(ue){const be=this.stack[this.stack.length-1];if(!be.depth){const qe=this.sliceSerialize(ue).length;be.depth=qe}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function M(ue){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function A(ue){const qe=this.stack[this.stack.length-1].children;let me=qe[qe.length-1];(!me||me.type!=="text")&&(me=nt(),me.position={start:Gs(ue.start),end:void 0},qe.push(me)),this.stack.push(me)}function O(ue){const be=this.stack.pop();be.value+=this.sliceSerialize(ue),be.position.end=Gs(ue.end)}function F(ue){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=be.children[be.children.length-1];qe.position.end=Gs(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(A.call(this,ue),O.call(this,ue))}function Q(){this.data.atHardBreak=!0}function H(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function P(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function K(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function W(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Y(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ce(ue){const be=this.sliceSerialize(ue),qe=this.stack[this.stack.length-2];qe.label=x6(be),qe.identifier=La(be).toLowerCase()}function z(){const ue=this.stack[this.stack.length-1],be=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const me=ue.children;qe.children=me}else qe.alt=be}function G(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function X(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function B(){this.data.inReference=void 0}function te(){this.data.referenceType="collapsed"}function V(ue){const be=this.resume(),qe=this.stack[this.stack.length-1];qe.label=be,qe.identifier=La(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function U(ue){this.data.characterReferenceType=ue.type}function oe(ue){const be=this.sliceSerialize(ue),qe=this.data.characterReferenceType;let me;qe?(me=k5(be,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=vk(be);const pt=this.stack[this.stack.length-1];pt.value+=me}function ae(ue){const be=this.stack.pop();be.position.end=Gs(ue.end)}function xe(ue){O.call(this,ue);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ue)}function Se(ue){O.call(this,ue);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ue)}function Xe(){return{type:"blockquote",children:[],position:void 0}}function bt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function at(){return{type:"inlineCode",value:"",position:void 0}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function et(){return{type:"emphasis",children:[],position:void 0}}function Ie(){return{type:"heading",depth:0,children:[],position:void 0}}function Ge(){return{type:"break",position:void 0}}function tt(){return{type:"html",value:"",position:void 0}}function kt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Kt(){return{type:"link",title:null,url:"",children:[],position:void 0}}function an(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[],position:void 0}}function Vt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[],position:void 0}}function ze(){return{type:"paragraph",children:[],position:void 0}}function De(){return{type:"strong",children:[],position:void 0}}function nt(){return{type:"text",value:"",position:void 0}}function ft(){return{type:"thematicBreak",position:void 0}}}function Gs(e){return{line:e.line,column:e.column,offset:e.offset}}function M5(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?M5(e,r):k6(e,r)}}function k6(e,t){let n;for(n in t)if(I5.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[n];r&&e[n].push(r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Vw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+mu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+mu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+mu({start:t.start,end:t.end})+") is still open")}function _6(e){const t=this;t.parser=n;function n(r){return b6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function w6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function S6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
-
`}]}function E6(e,t){const n=t.value?t.value+`
|
|
53
|
-
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function N6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Gl(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,u+=1,e.footnoteCounts.set(r,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function T6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function L5(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=r:a.push({type:"text",value:r}),a}function A6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return L5(e,t);const a={src:Gl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function I6(e,t){const n={src:Gl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function M6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function L6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return L5(e,t);const a={href:Gl(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function O6(e,t){const n={href:Gl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function D6(e,t,n){const r=e.all(t),a=n?P6(n):O5(t),o={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(a||u!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
54
|
-
`}),p.type==="element"&&p.tagName==="p"&&!a?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
55
|
-
`});const f={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,f),e.applyData(t,f)}function P6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=O5(n[r])}return t}function O5(e){const t=e.spread;return t??e.children.length>1}function F6(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const l=r[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function B6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function z6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function q6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U6(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=gk(t.children[1]),d=p5(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),a.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function H6(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let d=-1;const f=[];for(;++d<u;){const g=t.children[d],m={},x=l?l[d]:void 0;x&&(m.align=x);let v={type:"element",tagName:o,properties:m,children:[]};g&&(v.children=e.all(g),e.patch(g,v),v=e.applyData(g,v)),f.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function $6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Gw=9,Kw=32;function W6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(Yw(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(Yw(t.slice(a),a>0,!1)),o.join("")}function Yw(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===Gw||o===Kw;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===Gw||o===Kw;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function V6(e,t){const n={type:"text",value:W6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function G6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const K6={blockquote:w6,break:S6,code:E6,delete:N6,emphasis:C6,footnoteReference:j6,heading:T6,html:R6,imageReference:A6,image:I6,inlineCode:M6,linkReference:L6,link:O6,listItem:D6,list:F6,paragraph:B6,root:z6,strong:q6,table:U6,tableCell:$6,tableRow:H6,text:V6,thematicBreak:G6,toml:ef,yaml:ef,definition:ef,footnoteDefinition:ef};function ef(){}const D5=-1,Jf=0,yu=1,Of=2,_k=3,wk=4,Sk=5,Ek=6,P5=7,F5=8,{defineProperty:Y6}=Object,B5=typeof self=="object"?self:globalThis,Qw=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new B5[e](t)},Q6=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,l]=t[a];switch(o){case Jf:case D5:return n(l,a);case yu:{const u=n([],a);for(const d of l)u.push(r(d));return u}case Of:{const u=n({},a);for(const[d,f]of l){const p=r(d),g=r(f);p==="__proto__"?Y6(u,p,{value:g,configurable:!0,enumerable:!0,writable:!0}):u[p]=g}return u}case _k:return n(new Date(l),a);case wk:{const{source:u,flags:d}=l;return n(new RegExp(u,d),a)}case Sk:{const u=n(new Map,a);for(const[d,f]of l)u.set(r(d),r(f));return u}case Ek:{const u=n(new Set,a);for(const d of l)u.add(r(d));return u}case P5:{const{name:u,message:d}=l;return n(typeof B5[u]=="function"?Qw(u,d):new Error(d),a)}case F5:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}case"-0":return-0}return n(Qw(o,l),a)};return r},Xw=e=>Q6(new Map,e)(0),Mo="",{toString:X6}={},{keys:Z6,is:J6}=Object,Qc=e=>{const t=typeof e;if(t!=="object"||!e)return[Jf,t];const n=X6.call(e).slice(8,-1);switch(n){case"Array":return[yu,Mo];case"Object":return[Of,Mo];case"Date":return[_k,Mo];case"RegExp":return[wk,Mo];case"Map":return[Sk,Mo];case"Set":return[Ek,Mo];case"DataView":return[yu,n]}return n.includes("Array")?[yu,n]:e instanceof Error?[P5,e.name||"Error"]:[Of,n]},tf=([e,t])=>e===Jf&&(t==="function"||t==="symbol"),e7=(e,t,n,r)=>{const a=(l,u)=>{const d=r.push(l)-1;return n.set(u,d),d},o=l=>{if(n.has(l))return n.get(l);let[u,d]=Qc(l);switch(u){case Jf:{let p=l;switch(d){case"bigint":u=F5,p=l.toString();break;case"number":if(!l&&J6(l,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return a([D5],l)}return a([u,p],l)}case yu:{if(d){let m=l;return d==="DataView"?m=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(m=new Uint8Array(l)),a([d,[...m]],l)}const p=[],g=a([u,p],l);for(const m of l)p.push(o(m));return g}case Of:{if(d)switch(d){case"BigInt":return a([d,l.toString()],l);case"Boolean":case"Number":case"String":return a([d,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const p=[],g=a([u,p],l);for(const m of Z6(l))(e||!tf(Qc(l[m])))&&p.push([o(m),o(l[m])]);return g}case _k:return a([u,isNaN(l.getTime())?Mo:l.toISOString()],l);case wk:{const{source:p,flags:g}=l;return a([u,{source:p,flags:g}],l)}case Sk:{const p=[],g=a([u,p],l);for(const[m,x]of l)(e||!(tf(Qc(m))||tf(Qc(x))))&&p.push([o(m),o(x)]);return g}case Ek:{const p=[],g=a([u,p],l);for(const m of l)(e||!tf(Qc(m)))&&p.push(o(m));return g}}const{message:f}=l;return a([u,{name:d,message:f}],l)};return o},Zw=(e,{json:t,lossy:n}={})=>{const r=[];return e7(!(t||n),!!t,new Map,r)(e),r},Df=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Xw(Zw(e,t)):structuredClone(e):(e,t)=>Xw(Zw(e,t));function t7(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function n7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function r7(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||t7,r=e.options.footnoteBackLabel||n7,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),g=String(f.identifier).toUpperCase(),m=Gl(g.toLowerCase());let x=0;const v=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++x<=k;){v.length>0&&v.push({type:"text",value:" "});let E=typeof n=="string"?n:n(d,x);typeof E=="string"&&(E={type:"text",value:E}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,x),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const _=p[p.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const E=_.children[_.children.length-1];E&&E.type==="text"?E.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...v)}else p.push(...v);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(p,!0)};e.patch(f,S),u.push(S)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Df(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
56
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
57
|
-
`}]}}const ep=(function(e){if(e==null)return o7;if(typeof e=="function")return tp(e);if(typeof e=="object")return Array.isArray(e)?i7(e):a7(e);if(typeof e=="string")return s7(e);throw new Error("Expected function, string, or object as test")});function i7(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ep(e[n]);return tp(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function a7(e){const t=e;return tp(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function s7(e){return tp(t);function t(n){return n&&n.type===e}}function tp(e){return t;function t(n,r,a){return!!(l7(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function o7(){return!0}function l7(e){return e!==null&&typeof e=="object"&&"type"in e}const z5=[],c7=!0,Ef=!1,jv="skip";function Tv(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let a=!0,o,l,u,d;if(typeof n=="function"||n&&typeof n=="object"?(o=t,l=n,r&&(a=!1)):(l=t,n&&(a=!1)),typeof l=="function")u=l;else if(l&&typeof l=="object"){if(!(l.enter===null||l.enter===void 0))if(typeof l.enter=="function")u=l.enter;else throw new Error("Unexpected value `"+l.enter+"` for `visitors.enter`, expected optional visitor");if(typeof l.exit=="function")d=l.exit;else throw new Error("Unexpected value `"+l.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+l+"` for `enter` or `visitors`, expected visitor or object with visitors");const f=ep(o),p=a?1:-1;g(e,void 0,[])();function g(m,x,v){const k=m&&typeof m=="object"?m:{};if(typeof k.type=="string"){const S=typeof k.tagName=="string"?k.tagName:typeof k.name=="string"?k.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(m.type+(S?"<"+S+">":""))+")"})}return _;function _(){const S=!o||f(m,x,v[v.length-1]||void 0);let E=z5;if(u&&S&&(E=Jw(u(m,v,x)),E[0]===Ef))return E;if("children"in m&&m.children){const N=m;if(N.children&&E[0]!==jv){let R=(a?-1:N.children.length)+p;const T=[...v,N];for(;R>-1&&R<N.children.length;){const j=N.children[R],I=g(j,R,T)();if(I[0]===Ef)return I;R=typeof I[1]=="number"?I[1]:R+p}}}if(d&&S){const N=Jw(d(m,v,x));if(N[0]===jv)throw new Error("Unexpected value `"+N[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(N[0]===Ef||typeof N[1]=="number")return N}return E}}}function Jw(e){return Array.isArray(e)?e:typeof e=="number"?[c7,e]:e==null?z5:[e]}function np(e,t,n,r){let a,o,l;typeof n=="function"||n&&typeof n=="object"?(a=t,o=n,l=r):(o=t,l=n),typeof o=="function"?Tv(e,a,Rv(o),l):Tv(e,a,u7(o),l)}function u7(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?Rv(e.enter):e.enter,exit:typeof e.exit=="function"?Rv(e.exit):e.exit}}function Rv(e){return t;function t(n,r,a){return e(n,a,r[r.length-1])}}const Av={}.hasOwnProperty,d7={};function f7(e,t){const n=t||d7,r=new Map,a=new Map,o=new Map,l={...K6,...n.handlers},u={all:f,applyData:h7,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:n,patch:p7,wrap:m7};return np(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?r:a,m=String(p.identifier).toUpperCase();g.has(m)||g.set(m,p)}}),u;function d(p,g){const m=p.type,x=u.handlers[m];if(Av.call(u.handlers,m)&&x)return x(u,p,g);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in p){const{children:k,..._}=p,S=Df(_);return S.children=u.all(p),S}return Df(p)}return(u.options.unknownHandler||g7)(u,p,g)}function f(p){const g=[];if("children"in p){const m=p.children;let x=-1;for(;++x<m.length;){const v=u.one(m[x],p);if(v){if(x&&m[x-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=e2(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=e2(k.value))}Array.isArray(v)?g.push(...v):g.push(v)}}}return g}}function p7(e,t){e.position&&(t.position=nD(e))}function h7(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,Df(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function g7(e,t){const n=t.data||{},r="value"in t&&!(Av.call(n,"hProperties")||Av.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function m7(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
58
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
59
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
60
|
-
`}),n}function e2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function t2(e,t){const n=f7(e,t),r=n.one(e,void 0),a=r7(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
61
|
-
`},a),o}function x7(e,t){return e&&"run"in e?async function(n,r){const a=t2(n,{file:r,...t});await e.run(a,r)}:function(n,r){return t2(n,{file:r,...e||t})}}function n2(e){if(e)throw e}var tg,r2;function y7(){if(r2)return tg;r2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!g)return!1;var m;for(m in f);return typeof m>"u"||e.call(f,m)},l=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},u=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return tg=function d(){var f,p,g,m,x,v,k=arguments[0],_=1,S=arguments.length,E=!1;for(typeof k=="boolean"&&(E=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<S;++_)if(f=arguments[_],f!=null)for(p in f)g=u(k,p),m=u(f,p),k!==m&&(E&&m&&(o(m)||(x=a(m)))?(x?(x=!1,v=g&&a(g)?g:[]):v=g&&o(g)?g:{},l(k,{name:p,newValue:d(E,v,m)})):typeof m<"u"&&l(k,{name:p,newValue:m}));return k},tg}var b7=y7();const ng=$o(b7);function Iv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function v7(){const e=[],t={run:n,use:r};return t;function n(...a){let o=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...a);function u(d,...f){const p=e[++o];let g=-1;if(d){l(d);return}for(;++g<a.length;)(f[g]===null||f[g]===void 0)&&(f[g]=a[g]);a=f,p?k7(p,u)(...f):l(null,...f)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function k7(e,t){let n;return r;function r(...l){const u=e.length>l.length;let d;u&&l.push(a);try{d=e.apply(this,l)}catch(f){const p=f;if(u&&n)throw p;return a(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,a):d instanceof Error?a(d):o(d))}function a(l,...u){n||(n=!0,t(l,...u))}function o(l){a(null,l)}}const Qa={basename:_7,dirname:w7,extname:S7,join:E7,sep:"/"};function _7(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fu(e);let n=0,r=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else l<0&&(o=!0,l=a+1),u>-1&&(e.codePointAt(a)===t.codePointAt(u--)?u<0&&(r=a):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function w7(e){if(Fu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function S7(e){Fu(e);let t=e.length,n=-1,r=0,a=-1,o=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function E7(...e){let t=-1,n;for(;++t<e.length;)Fu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":N7(n)}function N7(e){Fu(e);const t=e.codePointAt(0)===47;let n=C7(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function C7(e,t){let n="",r=0,a=-1,o=0,l=-1,u,d;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(a===l-1||o===1))if(a!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),a=l,o=0;continue}}else if(n.length>0){n="",r=0,a=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),r=l-a-1;a=l,o=0}else u===46&&o>-1?o++:o=-1}return n}function Fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const j7={cwd:T7};function T7(){return"/"}function Mv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function R7(e){if(typeof e=="string")e=new URL(e);else if(!Mv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return A7(e)}function A7(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const rg=["history","path","basename","stem","extname","dirname"];class q5{constructor(t){let n;t?Mv(t)?n={path:t}:typeof t=="string"||I7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":j7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<rg.length;){const o=rg[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)rg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Qa.basename(this.path):void 0}set basename(t){ag(t,"basename"),ig(t,"basename"),this.path=Qa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qa.dirname(this.path):void 0}set dirname(t){i2(this.basename,"dirname"),this.path=Qa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qa.extname(this.path):void 0}set extname(t){if(ig(t,"extname"),i2(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Qa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Mv(t)&&(t=R7(t)),ag(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qa.basename(this.path,this.extname):void 0}set stem(t){ag(t,"stem"),ig(t,"stem"),this.path=Qa.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new fi(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ig(e,t){if(e&&e.includes(Qa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qa.sep+"`")}function ag(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function i2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function I7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M7=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),L7={}.hasOwnProperty;class Nk extends M7{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=v7()}copy(){const t=new Nk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(ng(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lg("data",this.frozen),this.namespace[t]=n,this):L7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=nf(t),r=this.parser||this.Parser;return sg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),sg("process",this.parser||this.Parser),og("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,l){const u=nf(t),d=r.parse(u);r.run(d,u,function(p,g,m){if(p||!g||!m)return f(p);const x=g,v=r.stringify(x,m);P7(v)?m.value=v:m.result=v,f(p,m)});function f(p,g){p||!g?l(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),sg("processSync",this.parser||this.Parser),og("processSync",this.compiler||this.Compiler),this.process(t,a),s2("processSync","process",n),r;function a(o,l){n=!0,n2(o),r=l}}run(t,n,r){a2(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,u){const d=nf(n);a.run(t,d,f);function f(p,g,m){const x=g||t;p?u(p):l?l(x):r(void 0,x,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),s2("runSync","run",r),a;function o(l,u){n2(l),a=u,r=!0}}stringify(t,n){this.freeze();const r=nf(n),a=this.compiler||this.Compiler;return og("stringify",a),a2(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(lg("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...g]=f;d(p,g)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(f.plugins),f.settings&&(a.settings=ng(!0,a.settings,f.settings))}function u(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const g=f[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let g=-1,m=-1;for(;++g<r.length;)if(r[g][0]===f){m=g;break}if(m===-1)r.push([f,...p]);else if(p.length>0){let[x,...v]=p;const k=r[m][1];Iv(k)&&Iv(x)&&(x=ng(!0,k,x)),r[m]=[f,x,...v]}}}}const O7=new Nk().freeze();function sg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function og(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function a2(e){if(!Iv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function s2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function nf(e){return D7(e)?e:new q5(e)}function D7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function P7(e){return typeof e=="string"||F7(e)}function F7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const B7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",o2=[],l2={allowDangerousHtml:!0},z7=/^(https?|ircs?|mailto|xmpp)$/i,q7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function lu(e){const t=U7(e),n=H7(e);return $7(t.runSync(t.parse(n),n),e)}function U7(e){const t=e.rehypePlugins||o2,n=e.remarkPlugins||o2,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...l2}:l2;return O7().use(_6).use(n).use(x7,r).use(t)}function H7(e){const t=e.children||"",n=new q5;return typeof t=="string"&&(n.value=t),n}function $7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||W7;for(const p of q7)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+B7+p.id,void 0);return np(e,f),oD(e,{Fragment:i.Fragment,components:a,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function f(p,g,m){if(p.type==="raw"&&m&&typeof g=="number")return l?m.children.splice(g,1):m.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let x;for(x in Zh)if(Object.hasOwn(Zh,x)&&Object.hasOwn(p.properties,x)){const v=p.properties[x],k=Zh[x];(k===null||k.includes(p.tagName))&&(p.properties[x]=d(String(v||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!x&&r&&typeof g=="number"&&(x=!r(p,g,m)),x&&m&&typeof g=="number")return u&&p.children?m.children.splice(g,1,...p.children):m.children.splice(g,1),g}}}function W7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||z7.test(e.slice(0,t))?e:""}function c2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function V7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function G7(e,t,n){const a=ep((n||{}).ignore||[]),o=K7(t);let l=-1;for(;++l<o.length;)Tv(e,u);function u(f,p,g){if(f.type==="text"&&typeof g=="number")return d(f,p,g);if(a(f,g,p[p.length-1]))return jv}function d(f,p,g){const m=p[p.length-1],x=o[l][0],v=o[l][1];let k=0,_=!1,S=[];x.lastIndex=0;let E=x.exec(f.value);for(;E;){const R=E.index,T={index:E.index,input:E.input,stack:[...p,f]};let j=v(...E,T);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1)x.lastIndex=R+1;else{if(k!==R&&N({type:"text",value:f.value.slice(k,R)}),Array.isArray(j))for(const I of j)N(I);else j&&N(j);k=R+E[0].length,_=!0}if(!x.global)break;E=x.exec(f.value)}return _?(k<f.value.length&&N({type:"text",value:f.value.slice(k)}),m.children.splice(g,1,...S)):S=[f],g+S.length;function N(R){const T=S[S.length-1];T&&T.type==="text"&&R.type==="text"?T.value+=R.value:S.push(R)}}}function K7(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([Y7(a[0]),Q7(a[1])])}return t}function Y7(e){return typeof e=="string"?new RegExp(V7(e),"g"):e}function Q7(e){return typeof e=="function"?e:function(){return e}}const cg="phrasing",ug=["autolink","link","image","label"];function X7(){return{transforms:[i8],enter:{literalAutolink:J7,literalAutolinkEmail:dg,literalAutolinkHttp:dg,literalAutolinkWww:dg},exit:{literalAutolink:r8,literalAutolinkEmail:n8,literalAutolinkHttp:e8,literalAutolinkWww:t8}}}function Z7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cg,notInConstruct:ug},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cg,notInConstruct:ug},{character:":",before:"[ps]",after:"\\/",inConstruct:cg,notInConstruct:ug}]}}function J7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function dg(e){this.config.enter.autolinkProtocol.call(this,e)}function e8(e){this.config.exit.autolinkProtocol.call(this,e)}function t8(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function n8(e){this.config.exit.autolinkEmail.call(this,e)}function r8(e){this.exit(e)}function i8(e){G7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,a8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),s8]],{ignore:["link","linkReference"]})}function a8(e,t,n,r,a){let o="";if(!U5(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!o8(n)))return!1;const l=l8(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function s8(e,t,n,r){return!U5(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function o8(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function l8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=c2(e,"(");let o=c2(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function U5(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ho(n)||Xf(n))&&(!t||n!==47)}H5.peek=x8;function c8(){this.buffer()}function u8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function d8(){this.buffer()}function f8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function p8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=La(this.sliceSerialize(e)).toLowerCase(),n.label=t}function h8(e){this.exit(e)}function g8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=La(this.sliceSerialize(e)).toLowerCase(),n.label=t}function m8(e){this.exit(e)}function x8(){return"["}function H5(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=a.move("]"),o}function y8(){return{enter:{gfmFootnoteCallString:c8,gfmFootnoteCall:u8,gfmFootnoteDefinitionLabelString:d8,gfmFootnoteDefinition:f8},exit:{gfmFootnoteCallString:p8,gfmFootnoteCall:h8,gfmFootnoteDefinitionLabelString:g8,gfmFootnoteDefinition:m8}}}function b8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:H5},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,l){const u=o.createTracker(l);let d=u.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return d+=u.move(o.safe(o.associationId(r),{before:d,after:"]"})),p(),d+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),d+=u.move((t?`
|
|
62
|
-
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?$5:v8))),f(),d}}function v8(e,t,n){return t===0?e:$5(e,t,n)}function $5(e,t,n){return(n?"":" ")+e}const k8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ck.attention=N8;Ck.peek=C8;function _8(){return{canContainEols:["delete"],enter:{strikethrough:S8},exit:{strikethrough:E8}}}function w8(){return{handlers:{delete:Ck},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:k8}]}}function S8(e){this.enter({type:"delete",children:[],position:void 0},e)}function E8(e){this.exit(e)}function Ck(e,t,n,r){const a=n.createTracker(r),o=n.stack.includes("strikethrough")?"~":"~~",l=n.enter("strikethrough");let u=a.move(o);return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move(o),l(),u}function N8(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function C8(){return"~"}function j8(e){return e.length}function T8(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||j8,o=[],l=[],u=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],_=[];let S=-1;for(e[p].length>f&&(f=e[p].length);++S<e[p].length;){const E=R8(e[p][S]);if(n.alignDelimiters!==!1){const N=a(E);_[S]=N,(d[S]===void 0||N>d[S])&&(d[S]=N)}k.push(E)}l[p]=k,u[p]=_}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<f;)o[g]=u2(r[g]);else{const k=u2(r);for(;++g<f;)o[g]=k}g=-1;const m=[],x=[];for(;++g<f;){const k=o[g];let _="",S="";k===99?(_=":",S=":"):k===108?_=":":k===114&&(S=":");let E=n.alignDelimiters===!1?1:Math.max(1,d[g]-_.length-S.length);const N=_+"-".repeat(E)+S;n.alignDelimiters!==!1&&(E=_.length+E+S.length,E>d[g]&&(d[g]=E),x[g]=E),m[g]=N}l.splice(1,0,m),u.splice(1,0,x),p=-1;const v=[];for(;++p<l.length;){const k=l[p],_=u[p];g=-1;const S=[];for(;++g<f;){const E=k[g]||"";let N="",R="";if(n.alignDelimiters!==!1){const T=d[g]-(_[g]||0),j=o[g];j===114?N=" ".repeat(T):j===99?T%2?(N=" ".repeat(T/2+.5),R=" ".repeat(T/2-.5)):(N=" ".repeat(T/2),R=N):R=" ".repeat(T)}n.delimiterStart!==!1&&!g&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||g)&&S.push(" "),n.alignDelimiters!==!1&&S.push(N),S.push(E),n.alignDelimiters!==!1&&S.push(R),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||g!==f-1)&&S.push("|")}v.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return v.join(`
|
|
63
|
-
`)}function R8(e){return e==null?"":String(e)}function u2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const A8=ep(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function I8(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),M8);return a(),l}function M8(e,t,n){return">"+(n?"":" ")+e}function L8(e,t){return d2(e,t.inConstruct,!0)&&!d2(e,t.notInConstruct,!1)}function d2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function f2(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;){const o=n.unsafe[a];if(o.character===`
|
|
64
|
-
`&&!o.before&&!o.after&&L8(n.stack,o))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
65
|
-
`}function O8(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>l&&(l=o):o=1,a=r+t.length,r=n.indexOf(t,a);return l}function D8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function P8(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function F8(e,t,n,r){const a=P8(n),o=e.value||"";if(D8(e,n)){const g=n.enter("codeIndented"),m=n.indentLines(o,B8);return g(),m}const l=n.createTracker(r),u=a.repeat(Math.max(O8(o,a)+1,3)),d=n.enter("codeFenced"),f=a==="`"?"GraveAccent":"Tilde";let p=l.move(u);if(e.lang){const g=n.enter(`codeFencedLang${f}`);p+=l.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${f}`);p+=l.move(" "),p+=l.move(n.safe(e.meta,{before:p,after:`
|
|
66
|
-
`,encode:["`"],...l.current()})),g()}return p+=l.move(`
|
|
67
|
-
`),o&&(p+=l.move(o+`
|
|
68
|
-
`)),p+=l.move(u),d(),p}function B8(e,t,n){return(n?"":" ")+e}function jk(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function z8(e,t,n,r){const a=jk(n),o=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("[");return f+=d.move(n.safe(n.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":`
|
|
69
|
-
`,...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),u()),l(),f}function q8(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}Tk.attention=U8;Tk.peek=H8;function Tk(e,t,n,r){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},r);return a(),o}function U8(e,t){return{construct:"emphasis",markers:q8(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function H8(e,t,n){return n.options.emphasis||"*"}function $8(e){return"&#x"+e.toString(16).toUpperCase()+";"}function W8(e,t){let n=!1;return np(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ef}),!!((!e.depth||e.depth<3)&&bk(e)&&(t.options.setext||n))}function V8(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(W8(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
70
|
-
`,after:`
|
|
71
|
-
`});return m(),g(),x+`
|
|
72
|
-
`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
73
|
-
`))+1))}const l="#".repeat(a),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(l+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
|
|
74
|
-
`,...o.current()});const p=f.charCodeAt(0);return(p===9||p===32)&&(f=$8(p)+f.slice(1)),f=f?l+" "+f:l,n.options.closeAtx&&(f+=" "+l),d(),u(),f}W5.peek=G8;function W5(e){return e.value||""}function G8(){return"<"}V5.peek=K8;function V5(e,t,n,r){const a=jk(n),o=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("![");return f+=d.move(n.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),u()),f+=d.move(")"),l(),f}function K8(){return"!"}G5.peek=Y8;function G5(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let d=u.move("![");const f=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=n.stack;n.stack=p.filter(function(m){return m!=="phrasing"}),l=n.enter("reference");const g=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),a==="full"||!f||f!==g?d+=u.move(g+"]"):a==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function Y8(){return"!"}K5.peek=Q8;function K5(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],u=n.compilePattern(l);if(!l.atBreak)continue;let d;for(;d=u.exec(r);){let f=d.index;r.charCodeAt(f)===10&&r.charCodeAt(f-1)===13&&f--,r=r.slice(0,f)+" "+r.slice(d.index+1)}}return a+r+a}function Q8(){return"`"}function Y5(e,t){const n=bk(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Q5.peek=X8;function Q5(e,t,n,r){const a=jk(n),o=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);if(Y5(e,n)){const p=n.stack;n.stack=p.filter(function(x){return x!=="phrasing"});const g=n.enter("autolink");let m=l.move("<");return m+=l.move(n.containerPhrasing(e,{before:m,after:">",...l.current()})),m+=l.move(">"),g(),n.stack=p,m}const u=n.enter("link");let d=n.enter("label"),f=l.move("[");return f+=l.move(n.containerPhrasing(e,{before:f,after:"](",...l.current()})),f+=l.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=l.move("<"),f+=l.move(n.safe(e.url,{before:f,after:">",...l.current()})),f+=l.move(">")):(d=n.enter("destinationRaw"),f+=l.move(n.safe(e.url,{before:f,after:e.title?" ":")",...l.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=l.move(" "+a),f+=l.move(n.safe(e.title,{before:f,after:a,...l.current()})),f+=l.move(a),d()),f+=l.move(")"),u(),f}function X8(e,t,n){return Y5(e,n)?"<":"["}X5.peek=Z8;function X5(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let d=u.move("[");const f=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=n.stack;n.stack=p.filter(function(m){return m!=="phrasing"}),l=n.enter("reference");const g=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),a==="full"||!f||f!==g?d+=u.move(g+"]"):a==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function Z8(){return"["}function Rk(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function J8(e){const t=Rk(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function e9(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Z5(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function t9(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?e9(n):Rk(n);const u=e.ordered?l==="."?")":".":J8(n);let d=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),Z5(n)===l&&p){let g=-1;for(;++g<e.children.length;){const m=e.children[g];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(l=u),n.bulletCurrent=l;const f=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,a(),f}function n9(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function r9(e,t,n,r){const a=n9(n);let o=n.bulletCurrent||Rk(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(l-o.length)),u.shift(l);const d=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,u.current()),p);return d(),f;function p(g,m,x){return m?(x?"":" ".repeat(l))+g:(x?o:o+" ".repeat(l-o.length))+g}}function i9(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),a(),l}function a9(e,t,n,r){if(!e.children.some(function(u){return A8(u)}))return n.containerFlow(e,r);const o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),l}function s9(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ak.attention=o9;Ak.peek=l9;function Ak(e,t,n,r){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},r);return a(),o}function o9(e,t){return{construct:"strong",markers:s9(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function l9(e,t,n){return n.options.strong||"*"}function c9(e,t,n,r){const a=t?t.children:[],o=a.indexOf(e);return n.safe(e.value,{...r,afterNode:a[o+1],beforeNode:a[o-1]})}function u9(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function d9(e,t,n){const r=(Z5(n)+(n.options.ruleSpaces?" ":"")).repeat(u9(n));return n.options.ruleSpaces?r.slice(0,-1):r}const J5={blockquote:I8,break:f2,code:F8,definition:z8,emphasis:Tk,hardBreak:f2,heading:V8,html:W5,image:V5,imageReference:G5,inlineCode:K5,link:Q5,linkReference:X5,list:t9,listItem:r9,paragraph:i9,root:a9,strong:Ak,text:c9,thematicBreak:d9};function f9(){return{enter:{table:p9,tableData:p2,tableHeader:p2,tableRow:g9},exit:{codeText:m9,table:h9,tableData:fg,tableHeader:fg,tableRow:fg}}}function p9(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function h9(e){this.exit(e),this.data.inTable=void 0}function g9(e){this.enter({type:"tableRow",children:[]},e)}function fg(e){this.exit(e)}function p2(e){this.enter({type:"tableCell",children:[]},e)}function m9(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,x9));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function x9(e,t){return t==="|"?t:e}function y9(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
75
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:l,tableCell:d,tableRow:u}};function l(x,v,k,_){return f(p(x,k,_),x.align)}function u(x,v,k,_){const S=g(x,k,_),E=f([S]);return E.slice(0,E.indexOf(`
|
|
76
|
-
`))}function d(x,v,k,_){const S=k.enter("tableCell"),E=k.enter("phrasing"),N=k.containerPhrasing(x,{..._,before:o,after:o});return E(),S(),N}function f(x,v){return T8(x,{align:v,alignDelimiters:r,padding:n,stringLength:a})}function p(x,v,k){const _=x.children;let S=-1;const E=[],N=v.enter("table");for(;++S<_.length;)E[S]=g(_[S],v,k);return N(),E}function g(x,v,k){const _=x.children;let S=-1;const E=[],N=v.enter("tableRow");for(;++S<_.length;)E[S]=d(_[S],x,v,k);return N(),E}function m(x,v,k){let _=J5.inlineCode(x,v,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function b9(){return{exit:{taskListCheckValueChecked:h2,taskListCheckValueUnchecked:h2,paragraph:k9}}}function v9(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_9}}}function h2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function k9(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,l;for(;++o<a.length;){const u=a[o];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function _9(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(l);let d=J5.listItem(e,t,n,{...r,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(p){return p+l}}function w9(){return[X7(),y8(),_8(),f9(),b9()]}function S9(e){return{extensions:[Z7(),b8(e),w8(),y9(e),v9()]}}const E9={tokenize:A9,partial:!0},eR={tokenize:I9,partial:!0},tR={tokenize:M9,partial:!0},nR={tokenize:L9,partial:!0},N9={tokenize:O9,partial:!0},rR={name:"wwwAutolink",tokenize:T9,previous:aR},iR={name:"protocolAutolink",tokenize:R9,previous:sR},bs={name:"emailAutolink",tokenize:j9,previous:oR},Za={};function C9(){return{text:Za}}let Io=48;for(;Io<123;)Za[Io]=bs,Io++,Io===58?Io=65:Io===91&&(Io=97);Za[43]=bs;Za[45]=bs;Za[46]=bs;Za[95]=bs;Za[72]=[bs,iR];Za[104]=[bs,iR];Za[87]=[bs,rR];Za[119]=[bs,rR];function j9(e,t,n){const r=this;let a,o;return l;function l(g){return!Lv(g)||!oR.call(r,r.previous)||Ik(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(g))}function u(g){return Lv(g)?(e.consume(g),u):g===64?(e.consume(g),d):n(g)}function d(g){return g===46?e.check(N9,p,f)(g):g===45||g===95||di(g)?(o=!0,e.consume(g),d):p(g)}function f(g){return e.consume(g),a=!0,d}function p(g){return o&&a&&bi(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function T9(e,t,n){const r=this;return a;function a(l){return l!==87&&l!==119||!aR.call(r,r.previous)||Ik(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(E9,e.attempt(eR,e.attempt(tR,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function R9(e,t,n){const r=this;let a="",o=!1;return l;function l(g){return(g===72||g===104)&&sR.call(r,r.previous)&&!Ik(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),u):n(g)}function u(g){if(bi(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),u;if(g===58){const m=a.toLowerCase();if(m==="http"||m==="https")return e.consume(g),d}return n(g)}function d(g){return g===47?(e.consume(g),o?f:(o=!0,d)):n(g)}function f(g){return g===null||If(g)||rr(g)||Ho(g)||Xf(g)?n(g):e.attempt(eR,e.attempt(tR,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function A9(e,t,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),a):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function I9(e,t,n){let r,a,o;return l;function l(f){return f===46||f===95?e.check(nR,d,u)(f):f===null||rr(f)||Ho(f)||f!==45&&Xf(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?r=!0:(a=r,r=void 0),e.consume(f),l}function d(f){return a||r||!o?n(f):t(f)}}function M9(e,t){let n=0,r=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&r<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(nR,t,o)(l):l===null||rr(l)||Ho(l)?t(l):(e.consume(l),a)}function o(l){return l===41&&r++,e.consume(l),a}}function L9(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),a):u===60||u===null||rr(u)||Ho(u)?t(u):n(u)}function a(u){return u===null||u===40||u===91||rr(u)||Ho(u)?t(u):r(u)}function o(u){return bi(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):bi(u)?(e.consume(u),l):n(u)}}function O9(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return di(o)?n(o):t(o)}}function aR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rr(e)}function sR(e){return!bi(e)}function oR(e){return!(e===47||Lv(e))}function Lv(e){return e===43||e===45||e===46||e===95||di(e)}function Ik(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const D9={tokenize:$9,partial:!0};function P9(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:q9,continuation:{tokenize:U9},exit:H9}},text:{91:{name:"gfmFootnoteCall",tokenize:z9},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:F9,resolveTo:B9}}}}function F9(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const d=r.events[a][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return u;function u(d){if(!l||!l._balanced)return n(d);const f=La(r.sliceSerialize({start:l.end,end:r.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function B9(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function z9(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),d}function d(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(o>999||g===93&&!l||g===null||g===91||rr(g))return n(g);if(g===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(La(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return rr(g)||(l=!0),o++,e.consume(g),g===92?p:f}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,f):f(g)}}function q9(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,u;return d;function d(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(v)}function p(v){if(l>999||v===93&&!u||v===null||v===91||rr(v))return n(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=La(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return rr(v)||(u=!0),l++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),l++,p):p(v)}function m(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),a.includes(o)||a.push(o),Fn(e,x,"gfmFootnoteDefinitionWhitespace")):n(v)}function x(v){return t(v)}}function U9(e,t,n){return e.check(Pu,t,e.attempt(D9,t,n))}function H9(e){e.exit("gfmFootnoteDefinition")}function $9(e,t,n){const r=this;return Fn(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function W9(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,u){let d=-1;for(;++d<l.length;)if(l[d][0]==="enter"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._close){let f=d;for(;f--;)if(l[f][0]==="exit"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._open&&l[d][1].end.offset-l[d][1].start.offset===l[f][1].end.offset-l[f][1].start.offset){l[d][1].type="strikethroughSequence",l[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},l[f][1].start),end:Object.assign({},l[d][1].end)},g={type:"strikethroughText",start:Object.assign({},l[f][1].end),end:Object.assign({},l[d][1].start)},m=[["enter",p,u],["enter",l[f][1],u],["exit",l[f][1],u],["enter",g,u]],x=u.parser.constructs.insideSpan.null;x&&Ma(m,m.length,0,Zf(x,l.slice(f+1,d),u)),Ma(m,m.length,0,[["exit",g,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",p,u]]),Ma(l,f-1,d-f+3,m),d=f+m.length-2;break}}for(d=-1;++d<l.length;)l[d][1].type==="strikethroughSequenceTemporary"&&(l[d][1].type="data");return l}function o(l,u,d){const f=this.previous,p=this.events;let g=0;return m;function m(v){return f===126&&p[p.length-1][1].type!=="characterEscape"?d(v):(l.enter("strikethroughSequenceTemporary"),x(v))}function x(v){const k=Lf(f);if(v===126)return g>1?d(v):(l.consume(v),g++,x);if(g<2&&!n)return d(v);const _=l.exit("strikethroughSequenceTemporary"),S=Lf(v);return _._open=!S||S===2&&!!k,_._close=!k||k===2&&!!S,u(v)}}}class V9{constructor(){this.map=[],this.index=new Map}add(t,n,r){G9(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0,this.index.clear()}}function G9(e,t,n,r){if(n===0&&r.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...r);return}const o=[t,n,r];e.map.push(o),e.index.set(t,o)}function K9(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Y9(){return{flow:{null:{name:"table",tokenize:Q9,resolveAll:X9}}}}function Q9(e,t,n){const r=this;let a=0,o=0,l;return u;function u(A){let O=r.events.length-1;for(;O>-1;){const{type:H}=r.events[O][1];if(H==="lineEnding"||H==="linePrefix")O--;else break}const F=O>-1?r.events[O][1].type:null,Q=F==="tableHead"||F==="tableRow"?j:d;return Q===j&&r.parser.lazy[r.now().line]?n(A):Q(A)}function d(A){return e.enter("tableHead"),e.enter("tableRow"),f(A)}function f(A){return A===124||(l=!0,o+=1),p(A)}function p(A){return A===null?n(A):en(A)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),x):n(A):wn(A)?Fn(e,p,"whitespace")(A):(o+=1,l&&(l=!1,a+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),g(A)))}function g(A){return A===null||A===124||rr(A)?(e.exit("data"),p(A)):(e.consume(A),A===92?m:g)}function m(A){return A===92||A===124?(e.consume(A),g):g(A)}function x(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),l=!1,wn(A)?Fn(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):v(A))}function v(A){return A===45||A===58?_(A):A===124?(l=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),k):T(A)}function k(A){return wn(A)?Fn(e,_,"whitespace")(A):_(A)}function _(A){return A===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),S):A===45?(o+=1,S(A)):A===null||en(A)?R(A):T(A)}function S(A){return A===45?(e.enter("tableDelimiterFiller"),E(A)):T(A)}function E(A){return A===45?(e.consume(A),E):A===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(A))}function N(A){return wn(A)?Fn(e,R,"whitespace")(A):R(A)}function R(A){return A===124?v(A):A===null||en(A)?!l||a!==o?T(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):T(A)}function T(A){return n(A)}function j(A){return e.enter("tableRow"),I(A)}function I(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),I):A===null||en(A)?(e.exit("tableRow"),t(A)):wn(A)?Fn(e,I,"whitespace")(A):(e.enter("data"),M(A))}function M(A){return A===null||A===124||rr(A)?(e.exit("data"),I(A)):(e.consume(A),A===92?L:M)}function L(A){return A===92||A===124?(e.consume(A),M):M(A)}}function X9(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,p,g;const m=new V9;for(;++n<e.length;){const x=e[n],v=x[1];x[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&(g2(m,t,d,f,p),p=void 0,d=0),f={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(n,0,[["enter",f,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,o=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(n,0,[["enter",p,t]])),a=v.type==="tableDelimiterRow"?2:p?3:1):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],g=rf(m,t,o,a,void 0,g),o=[0,0,0,0]),l[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],g=rf(m,t,o,a,void 0,g)),o=l,l=[o[1],n,0,0])):v.type==="tableHead"?(u=!0,d=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=n,o[1]!==0?(l[0]=l[1],g=rf(m,t,o,a,n,g)):l[1]!==0&&(g=rf(m,t,l,a,n,g)),a=0):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=n)}for(d!==0&&g2(m,t,d,f,p),m.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=K9(t.events,n))}return e}function rf(e,t,n,r,a,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},Il(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=Il(t.events,n[1]);if(o={type:l,start:Object.assign({},d),end:Object.assign({},d)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=Il(t.events,n[2]),p=Il(t.events,n[3]),g={type:u,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const m=t.events[n[2]],x=t.events[n[3]];if(m[1].end=Object.assign({},x[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,k=n[3]-n[2]-1;e.add(v,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return a!==void 0&&(o.end=Object.assign({},Il(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function g2(e,t,n,r,a){const o=[],l=Il(t.events,n);a&&(a.end=Object.assign({},l),o.push(["exit",a,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Il(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Z9={name:"tasklistCheck",tokenize:eF};function J9(){return{text:{91:Z9}}}function eF(e,t,n){const r=this;return a;function a(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return rr(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(d)}function u(d){return en(d)?t(d):wn(d)?e.check({tokenize:tF},t,n)(d):n(d)}}function tF(e,t,n){return Fn(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function nF(e){return v5([C9(),P9(),W9(e),Y9(),J9()])}const rF={};function cu(e){const t=this,n=e||rF,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(nF(n)),o.push(w9()),l.push(S9(n))}const m2=/\n/g,x2=/[\t ]+/g,iF=/^[\t\n\f\r ]+$/,y2=new Set(["caption","col","colgroup","tbody","td","tfoot","th","thead","tr"]),aF=new Set(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title"]),lR=new Set(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function sF(e,t){const n=t||{},r="children"in e?e.children:[];let a=!1,o=!1;e.type==="element"&&(a=lR.has(e.tagName),o=e.tagName==="table"||rp(e));const l=dR(e,{whitespace:n.whitespace||"normal"}),u=[];(e.type==="text"||e.type==="comment")&&Dv(u,uR(e,{breakAfter:!0,breakBefore:!0}));let d=-1;for(;++d<r.length;){const g=r[d+1],m=g?g.type==="element"&&g.tagName==="br":a,x=d?void 0:a;Dv(u,cR(r[d],d,e,{breakAfter:m,breakBefore:x,rowAfter:o?fR(e,d,void 0):void 0,whitespace:l}))}const f=[];let p;for(d=-1;++d<u.length;){const g=u[d];typeof g=="number"?p!==void 0&&g>p&&(p=g):g&&(p!==void 0&&p>-1&&f.push(`
|
|
77
|
-
`.repeat(p)||" "),p=-1,f.push(g))}return f.join("")}function cR(e,t,n,r){if(e.type==="element")return oF(e,t,n,r);if(e.type==="text"){if(iF.test(e.value)&&n.type==="element"&&(n.tagName==="table"||n.tagName==="tr"||rp(n))){const a=n.children[t-1],o=n.children[t+1];if((!a||a.type==="element"&&y2.has(a.tagName))&&(!o||o.type==="element"&&y2.has(o.tagName)))return[]}return r.whitespace==="normal"?uR(e,r):lF(e)}return[]}function oF(e,t,n,r){var g,m;const a=dR(e,r),o=e.children||[],l=e.tagName==="table"||rp(e);let u=-1;const d=[];if(aF.has(e.tagName)||(g=e.properties)!=null&&g.hidden||e.tagName==="dialog"&&!((m=e.properties)!=null&&m.open))return d;let f,p;for(e.tagName==="br"||Pf(e)&&(r.rowAfter||Ov(n,t,Pf))?p=`
|
|
78
|
-
`:e.tagName==="p"?(f=2,p=2):lR.has(e.tagName)&&(f=1,p=1);++u<o.length;){const x=o[u+1],v=x?x.type==="element"&&x.tagName==="br":p,k=u?void 0:f;Dv(d,cR(o[u],u,e,{breakAfter:v,breakBefore:k,rowAfter:l?fR(e,u,r.rowAfter):void 0,whitespace:a}))}return b2(e)&&Ov(n,t,b2)&&d.push(" "),f&&d.unshift(f),p&&d.push(p),d}function uR(e,t){const n=String(e.value),r=[],a=[];let o=0;for(;o<=n.length;){m2.lastIndex=o;const d=m2.exec(n),f=d&&"index"in d?d.index:n.length;r.push(cF(n.slice(o,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?t.breakBefore:!0,f===n.length?t.breakAfter:!0)),o=f+1}let l=-1,u;for(;++l<r.length;)r[l].charCodeAt(r[l].length-1)===8203||l<r.length-1&&r[l+1].charCodeAt(0)===8203?(a.push(r[l]),u=void 0):r[l]?(typeof u=="number"&&a.push(u),a.push(r[l]),u=0):(l===0||l===r.length-1)&&a.push(0);return a}function lF(e){return[String(e.value)]}function cF(e,t,n){const r=[];let a=0,o;for(;a<e.length;){x2.lastIndex=a;const l=x2.exec(e);o=l?l.index:e.length,!a&&!o&&l&&!t&&r.push(""),a!==o&&r.push(e.slice(a,o)),a=l?o+l[0].length:o}return a!==o&&!n&&r.push(""),r.join(" ")}function dR(e,t){var n,r;if(e.type==="element")switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return(n=e.properties)!=null&&n.wrap?"pre-wrap":"pre";case"td":case"th":return(r=e.properties)!=null&&r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}function fR(e,t,n){return e.type==="element"&&e.tagName==="table"?Ov(e,t,uF):n}function Ov(e,t,n){for(;++t<e.children.length;){const r=e.children[t];if(r.type==="element"&&n(r))return!0}return!1}function Dv(e,t){let n=-1;for(;++n<t.length;)e.push(t[n])}function b2(e){return e.tagName==="td"||e.tagName==="th"}function rp(e){return e.tagName==="tbody"||e.tagName==="tfoot"||e.tagName==="thead"}function uF(e){if(Pf(e))return!0;if(rp(e)){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n.type==="element"&&Pf(n))return!0}}return!1}function Pf(e){return e.tagName==="tr"}function dF(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],R={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},j=[T,g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:j.concat([{begin:/\(/,end:/\)/,keywords:R,contains:j.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,relevance:0},{begin:x,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,M,T,j,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function fF(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=dF(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function pF(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},u={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,a]};a.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],x=e.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},k=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],S={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],N=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],R=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],T=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:k,literal:_,built_in:[...E,...N,"set","shopt",...R,...T]},contains:[x,e.SHEBANG(),v,g,o,l,S,u,d,f,p,n]}}function hF(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+e.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},S=[g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:S.concat([{begin:/\(/,end:/\)/,keywords:_,contains:S.concat(["self"]),relevance:0}]),relevance:0},N={begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:x,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(E,N,S,[g,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:g,strings:f,keywords:_}}}function gF(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],R={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},j=[T,g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:j.concat([{begin:/\(/,end:/\)/,keywords:R,contains:j.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,relevance:0},{begin:x,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,M,T,j,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function mF(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],l={keyword:a.concat(o),built_in:t,literal:r},u=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9'_]+|(\\b[\\d'_]+(\\.[\\d'_]*)?|\\.[\\d'_]+)([eE][-+]?[\\d'_]+)?)"}],relevance:0},f={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},p={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},g=e.inherit(p,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:l},x=e.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,x]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},_=e.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},x]});m.contains=[k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],x.contains=[_,v,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const S={variants:[f,k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},N=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",R={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:l,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},S,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},u,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[u,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+N+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:l,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[S,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},R]}}const xF=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),yF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],bF=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],vF=[...yF,...bF],kF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),_F=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),wF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),SF=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function EF(e){const t=e.regex,n=xF(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="and or not only",o=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",u=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+_F.join("|")+")"},{begin:":(:)?("+wF.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+SF.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,n.UNICODE_RANGE,...u,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...u,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:kF.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+vF.join("|")+")\\b"}]}}function NF(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function CF(e){const o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:o,illegal:/["']/}]}]}}function jF(e){const t=e.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function TF(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},u={begin:/\[/,end:/\]/,contains:[r,o,a,l,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,p=/'[^']*'/,g=t.either(d,f,p),m=t.concat(g,"(\\s*\\.\\s*",g,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,u,o,a,l,n]}}]}}var Ml="[0-9](_*[0-9])*",af=`\\.(${Ml})`,sf="[0-9a-fA-F](_*[0-9a-fA-F])*",v2={className:"number",variants:[{begin:`(\\b(${Ml})((${af})|\\.)?|(${af}))[eE][+-]?(${Ml})[fFdD]?\\b`},{begin:`\\b(${Ml})((${af})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${af})[fFdD]?\\b`},{begin:`\\b(${Ml})[fFdD]\\b`},{begin:`\\b0[xX]((${sf})\\.?|(${sf})?\\.(${sf}))[pP][+-]?(${Ml})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${sf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function pR(e,t,n){return n===-1?"":e.replace(t,r=>pR(e,t,n-1))}function RF(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+pR("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),d={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},f={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},p={className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:d,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:d,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v2,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},v2,f]}}const k2="[A-Za-z$_][0-9A-Za-z$_]*",AF=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],IF=["true","false","null","undefined","NaN","Infinity"],hR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],gR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],mR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],MF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LF=[].concat(mR,hR,gR);function OF(e){const t=e.regex,n=(Y,{after:ce})=>{const z="</"+Y[0].slice(1);return Y.input.indexOf(z,ce)!==-1},r=k2,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ce)=>{const z=Y[0].length+Y.index,G=Y.input[z];if(G==="<"||G===","){ce.ignoreMatch();return}G===">"&&(n(Y,{after:z})||ce.ignoreMatch());let X;const B=Y.input.substring(z);if(X=B.match(/^\s*=/)){ce.ignoreMatch();return}if((X=B.match(/^\s+extends\s+/))&&X.index===0){ce.ignoreMatch();return}}},u={$pattern:k2,keyword:AF,literal:IF,built_in:LF,"variable.language":MF},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${p})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:u,contains:[]},x={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},N=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,{match:/\$\d+/},g];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const R=[].concat(E,m.contains),T=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(R)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},I={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},M={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...hR,...gR]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Y){return t.concat("(?!",Y.join("|"),")")}const Q={match:t.concat(/\b/,F([...mR,"super","import","await"].map(Y=>`${Y}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},H={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",W={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:M},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,E,{match:/\$\d+/},g,M,{scope:"attr",match:r+t.lookahead(":"),relevance:0},W,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:K,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},H,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},Q,O,I,P,{match:/\$[(.]/}]}}const DF="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",PF={scope:"number",match:DF,relevance:0};function FF(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:r},contains:[t,n,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,PF,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ll="[0-9](_*[0-9])*",of=`\\.(${Ll})`,lf="[0-9a-fA-F](_*[0-9a-fA-F])*",BF={className:"number",variants:[{begin:`(\\b(${Ll})((${of})|\\.)?|(${of}))[eE][+-]?(${Ll})[fFdD]?\\b`},{begin:`\\b(${Ll})((${of})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${of})[fFdD]?\\b`},{begin:`\\b(${Ll})[fFdD]\\b`},{begin:`\\b0[xX]((${lf})\\.?|(${lf})?\\.(${lf}))[pP][+-]?(${Ll})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${lf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function zF(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,a]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,a]}]};a.contains.push(l);const u={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},d={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(l,{className:"string"}),"self"]}]},f=BF,p=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),g={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=g;return m.variants[1].contains=[g],g.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,p,n,r,u,d,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[g,e.C_LINE_COMMENT_MODE,p],relevance:0},e.C_LINE_COMMENT_MODE,p,u,d,l,e.C_NUMBER_MODE]},p]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},u,d]},l,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
79
|
-
`},f]}}const qF=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),UF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],HF=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],$F=[...UF,...HF],WF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),xR=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),yR=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),VF=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),GF=xR.concat(yR).sort().reverse();function KF(e){const t=qF(e),n=GF,r="and or not only",a="[\\w-]+",o="("+a+"|@\\{"+a+"\\})",l=[],u=[],d=function(N){return{className:"string",begin:"~?"+N+".*?"+N}},f=function(N,R,T){return{className:N,begin:R,relevance:T}},p={$pattern:/[a-z-]+/,keyword:r,attribute:WF.join(" ")},g={begin:"\\(",end:"\\)",contains:u,keywords:p,relevance:0};u.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d("'"),d('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.UNICODE_RANGE,t.HEXCOLOR,g,f("variable","@@?"+a,10),f("variable","@\\{"+a+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=u.concat({begin:/\{/,end:/\}/,contains:l}),x={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(u)},v={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+VF.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:u}}]},k={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:p,returnEnd:!0,contains:u,relevance:0}},_={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:m}},S={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,x,f("keyword","all\\b"),f("variable","@\\{"+a+"\\}"),{begin:"\\b("+$F.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,f("selector-tag",o,0),f("selector-id","#"+o),f("selector-class","\\."+o,0),f("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+xR.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+yR.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:a+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[S]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,E,v,S,x,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function YF(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},a=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function QF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},a={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},l={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,a,o,l]}}function XF(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},u=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,u,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},p={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(f,{contains:[]}),m=e.inherit(p,{contains:[]});f.contains.push(m),p.contains.push(g);let x=[n,d];return[f,p,g,m].forEach(S=>{S.contains=S.contains.concat(x)}),x=x.concat(f,p),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:x},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:x}]}]},n,o,f,p,{className:"quote",begin:"^>\\s+",contains:x,end:"$"},a,r,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ZF(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,u={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:u,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function JF(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},l={begin:/->\{/,end:/\}/},u={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[u]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},p=[e.BACKSLASH_ESCAPE,o,d],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,S="\\1")=>{const E=S==="\\1"?S:t.concat(S,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,S,r)},x=(k,_,S)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,S,r),v=[d,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),l,{className:"string",contains:p,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},f,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",t.either(...g,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:x("(?:m|qr)?",/\//,/\//)},{begin:x("m|qr",t.either(...g,{capture:!0}),/\1/)},{begin:x("m|qr",/\(/,/\)/)},{begin:x("m|qr",/\[/,/\]/)},{begin:x("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u,f]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=v,l.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:a,contains:v}}function eB(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),a=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=t.concat(/[A-Z]+/,n),l={scope:"variable",match:"\\$+"+r},u={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},f=e.inherit(e.APOS_STRING_MODE,{illegal:null}),p=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(d)}),g={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(H,P)=>{P.data._beginMatch=H[1]||H[2]},"on:end":(H,P)=>{P.data._beginMatch!==H[1]&&P.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),x=`[
|
|
80
|
-
]`,v={scope:"string",variants:[p,f,g,m]},k={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},_=["false","null","true"],S=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],R={keyword:S,literal:(H=>{const P=[];return H.forEach(K=>{P.push(K),K.toLowerCase()===K?P.push(K.toUpperCase()):P.push(K.toLowerCase())}),P})(_),built_in:E},T=H=>H.map(P=>P.replace(/\|\d+$/,"")),j={variants:[{match:[/new/,t.concat(x,"+"),t.concat("(?!",T(E).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},I=t.concat(r,"\\b(?!\\()"),M={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{1:"title.class",3:"variable.constant"}},{match:[a,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},L={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[L,l,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,j]},O={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",T(S).join("\\b|"),"|",T(E).join("\\b|"),"\\b)"),r,t.concat(x,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(O);const F=[L,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,j],Q={begin:t.concat(/#\[\s*\\?/,t.either(a,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...F]},...F,{scope:"meta",variants:[{match:a},{match:o}]}]};return{case_insensitive:!1,keywords:R,contains:[Q,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},u,{scope:"variable.language",match:/\$this\b/},l,O,M,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},j,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:R,contains:["self",Q,l,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},v,k]}}function tB(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function nB(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function rB(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],u={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:u,illegal:/#/},p={begin:/\{\{/,relevance:0},g={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d,p,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,p,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",x=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${r.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${x}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${x})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${v})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${v})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${v})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${v})`},{begin:`\\b(${m})[jJ](?=${v})`}]},_={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:u,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,g,e.HASH_COMMENT_MODE]}]};return f.contains=[g,k,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:u,illegal:/(<\/|\?)|=>/,contains:[d,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},g,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,S,g]}]}}function iB(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function aB(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function sB(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(r,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},u={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},f=[e.COMMENT("#","$",{contains:[u]}),e.COMMENT("^=begin","^=end",{contains:[u],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],p={className:"subst",begin:/#\{/,end:/\}/,keywords:l},g={className:"string",contains:[e.BACKSLASH_ESCAPE,p],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,p]})]}]},m="[1-9](_?[0-9])*|0",x="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${x}))?([eE][+-]?(${x})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},k={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},j=[g,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:l},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[k]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[g,{begin:n}],relevance:0},v,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,p],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,f),relevance:0}].concat(d,f);p.contains=j,k.contains=j;const A=[{begin:/^\s*=>/,starts:{end:"$",contains:j}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:j}}];return f.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(A).concat(f).concat(j)}}function oB(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),a=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,t.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",u=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],p=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:p,keyword:u,literal:d,built_in:f},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+l},{begin:"\\b0o([0-7_]+)"+l},{begin:"\\b0x([A-Fa-f0-9_]+)"+l},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+l}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:p}},{className:"punctuation",begin:"->"},o]}}const lB=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),cB=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],uB=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],dB=[...cB,...uB],fB=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),pB=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),hB=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),gB=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function mB(e){const t=lB(e),n=hB,r=pB,a="@[a-z-]+",o="and or not only",u={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+dB.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},u,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+gB.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,u,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:fB.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},u,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function xB(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yB(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],u=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],p=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],g=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],x=p,v=[...f,...d].filter(T=>!p.includes(T)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={match:t.concat(/\b/,t.either(...x),/\s*\(/),relevance:0,keywords:{built_in:x}};function E(T){return t.concat(/\b/,t.either(...T.map(j=>j.replace(/\s+/,"\\s+"))),/\b/)}const N={scope:"keyword",match:E(m),relevance:0};function R(T,{exceptions:j,when:I}={}){const M=I;return j=j||[],T.map(L=>L.match(/\|\d+$/)||j.includes(L)?L:M(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(v,{when:T=>T.length<3}),literal:o,type:u,built_in:g},contains:[{scope:"type",match:E(l)},N,S,k,r,a,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,_]}}function bR(e){return e?typeof e=="string"?e:e.source:null}function Xc(e){return Qn("(?=",e,")")}function Qn(...e){return e.map(n=>bR(n)).join("")}function bB(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function yi(...e){return"("+(bB(e).capture?"":"?:")+e.map(r=>bR(r)).join("|")+")"}const Mk=e=>Qn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),vB=["Protocol","Type"].map(Mk),_2=["init","self"].map(Mk),kB=["Any","Self"],pg=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],w2=["false","nil","true"],_B=["assignment","associativity","higherThan","left","lowerThan","none","right"],wB=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],S2=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],vR=yi(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),kR=yi(vR,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hg=Qn(vR,kR,"*"),_R=yi(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Ff=yi(_R,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ya=Qn(_R,Ff,"*"),cf=Qn(/[A-Z]/,Ff,"*"),SB=["attached","autoclosure",Qn(/convention\(/,yi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Qn(/objc\(/,Ya,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],EB=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function NB(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,yi(...vB,..._2)],className:{2:"keyword"}},o={match:Qn(/\./,yi(...pg)),relevance:0},l=pg.filter(Ie=>typeof Ie=="string").concat(["_|0"]),u=pg.filter(Ie=>typeof Ie!="string").concat(kB).map(Mk),d={variants:[{className:"keyword",match:yi(...u,..._2)}]},f={$pattern:yi(/\b\w+/,/#\w+/),keyword:l.concat(wB),literal:w2},p=[a,o,d],g={match:Qn(/\./,yi(...S2)),relevance:0},m={className:"built_in",match:Qn(/\b/,yi(...S2),/(?=\()/)},x=[g,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:hg},{match:`\\.(\\.|${kR})+`}]},_=[v,k],S="([0-9]_*)+",E="([0-9a-fA-F]_*)+",N={className:"number",relevance:0,variants:[{match:`\\b(${S})(\\.(${S}))?([eE][+-]?(${S}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${S}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},R=(Ie="")=>({className:"subst",variants:[{match:Qn(/\\/,Ie,/[0\\tnr"']/)},{match:Qn(/\\/,Ie,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(Ie="")=>({className:"subst",match:Qn(/\\/,Ie,/[\t ]*(?:[\r\n]|\r\n)/)}),j=(Ie="")=>({className:"subst",label:"interpol",begin:Qn(/\\/,Ie,/\(/),end:/\)/}),I=(Ie="")=>({begin:Qn(Ie,/"""/),end:Qn(/"""/,Ie),contains:[R(Ie),T(Ie),j(Ie)]}),M=(Ie="")=>({begin:Qn(Ie,/"/),end:Qn(/"/,Ie),contains:[R(Ie),j(Ie)]}),L={className:"string",variants:[I(),I("#"),I("##"),I("###"),M(),M("#"),M("##"),M("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],O={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},F=Ie=>{const Ge=Qn(Ie,/\//),tt=Qn(/\//,Ie);return{begin:Ge,end:tt,contains:[...A,{scope:"comment",begin:`#(?!.*${tt})`,end:/$/}]}},Q={scope:"regexp",variants:[F("###"),F("##"),F("#"),O]},H={match:Qn(/`/,Ya,/`/)},P={className:"variable",match:/\$\d+/},K={className:"variable",match:`\\$${Ff}+`},W=[H,P,K],Y={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:EB,contains:[..._,N,L]}]}},ce={scope:"keyword",match:Qn(/@/,yi(...SB),Xc(yi(/\(/,/\s+/)))},z={scope:"meta",match:Qn(/@/,Ya)},G=[Y,ce,z],X={match:Xc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Qn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ff,"+")},{className:"type",match:cf,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Qn(/\s+&\s+/,Xc(cf)),relevance:0}]},B={begin:/</,end:/>/,keywords:f,contains:[...r,...p,...G,v,X]};X.contains.push(B);const te={match:Qn(Ya,/\s*:/),keywords:"_|0",relevance:0},V={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",te,...r,Q,...p,...x,..._,N,L,...W,...G,X]},U={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,X]},oe={begin:yi(Xc(Qn(Ya,/\s*:/)),Xc(Qn(Ya,/\s+/,Ya,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ya}]},ae={begin:/\(/,end:/\)/,keywords:f,contains:[oe,...r,...p,..._,N,L,...G,X,V],endsParent:!0,illegal:/["']/},xe={match:[/(func|macro)/,/\s+/,yi(H.match,Ya,hg)],className:{1:"keyword",3:"title.function"},contains:[U,ae,t],illegal:[/\[/,/%/]},Se={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[U,ae,t],illegal:/\[|%/},Xe={match:[/operator/,/\s+/,hg],className:{1:"keyword",3:"title"}},bt={begin:[/precedencegroup/,/\s+/,cf],className:{1:"keyword",3:"title"},contains:[X],keywords:[..._B,...w2],end:/}/},at={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},yt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},et={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ya,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[U,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:cf},...p],relevance:0}]};for(const Ie of L.variants){const Ge=Ie.contains.find(kt=>kt.label==="interpol");Ge.keywords=f;const tt=[...p,...x,..._,N,L,...W];Ge.contains=[...tt,{begin:/\(/,end:/\)/,contains:["self",...tt]}]}return{name:"Swift",keywords:f,contains:[...r,xe,Se,at,yt,et,Xe,bt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},Q,...p,...x,..._,N,L,...W,...G,X,V]}}const Bf="[A-Za-z$_][0-9A-Za-z$_]*",wR=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],SR=["true","false","null","undefined","NaN","Infinity"],ER=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],NR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],CR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],TR=[].concat(CR,ER,NR);function CB(e){const t=e.regex,n=(Y,{after:ce})=>{const z="</"+Y[0].slice(1);return Y.input.indexOf(z,ce)!==-1},r=Bf,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ce)=>{const z=Y[0].length+Y.index,G=Y.input[z];if(G==="<"||G===","){ce.ignoreMatch();return}G===">"&&(n(Y,{after:z})||ce.ignoreMatch());let X;const B=Y.input.substring(z);if(X=B.match(/^\s*=/)){ce.ignoreMatch();return}if((X=B.match(/^\s+extends\s+/))&&X.index===0){ce.ignoreMatch();return}}},u={$pattern:Bf,keyword:wR,literal:SR,built_in:TR,"variable.language":jR},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${p})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:u,contains:[]},x={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},N=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,{match:/\$\d+/},g];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const R=[].concat(E,m.contains),T=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(R)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},I={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},M={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ER,...NR]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Y){return t.concat("(?!",Y.join("|"),")")}const Q={match:t.concat(/\b/,F([...CR,"super","import","await"].map(Y=>`${Y}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},H={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",W={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:M},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,E,{match:/\$\d+/},g,M,{scope:"attr",match:r+t.lookahead(":"),relevance:0},W,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:K,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},H,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},Q,O,I,P,{match:/\$[(.]/}]}}function jB(e){const t=e.regex,n=CB(e),r=Bf,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[n.exports.CLASS_REFERENCE]},u={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},d=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:Bf,keyword:wR.concat(d),literal:SR,built_in:TR.concat(a),"variable.language":jR},p={className:"meta",begin:"@"+r},g=(k,_,S)=>{const E=k.contains.findIndex(N=>N.label===_);if(E===-1)throw new Error("can not find mode to replace");k.contains.splice(E,1,S)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(p);const m=n.contains.find(k=>k.scope==="attr"),x=Object.assign({},m,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,m,x]),n.contains=n.contains.concat([p,o,l,x]),g(n,"shebang",e.SHEBANG()),g(n,"use_strict",u);const v=n.contains.find(k=>k.label==="func.def");return v.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function TB(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,l=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,u=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,a),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,a),/ +/,t.either(l,u),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},p={className:"label",begin:/^\w+:/},g=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,d,f,p,g,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function RB(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],a={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},l={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},u={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,l,a,e.QUOTE_STRING_MODE,d,f,u]}}function AB(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(o,{begin:/\(/,end:/\)/}),u=e.inherit(e.APOS_STRING_MODE,{className:"string"}),d=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,d,u,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,l,d,u]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function IB(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,a]},u=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},x={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},v={begin:/\{/,end:/\}/,contains:[x],illegal:"\\n",relevance:0},k={begin:"\\[",end:"\\]",contains:[x],illegal:"\\n",relevance:0},_=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},m,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},v,k,o,l],S=[..._];return S.pop(),S.push(u),x.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const MB={arduino:fF,bash:pF,c:hF,cpp:gF,csharp:mF,css:EF,diff:NF,go:CF,graphql:jF,ini:TF,java:RF,javascript:OF,json:FF,kotlin:zF,less:KF,lua:YF,makefile:QF,markdown:XF,objectivec:ZF,perl:JF,php:eB,"php-template":tB,plaintext:nB,python:rB,"python-repl":iB,r:aB,ruby:sB,rust:oB,scss:mB,shell:xB,sql:yB,swift:NB,typescript:jB,vbnet:TB,wasm:RB,xml:AB,yaml:IB};var gg,E2;function LB(){if(E2)return gg;E2=1;function e(re){return re instanceof Map?re.clear=re.delete=re.set=function(){throw new Error("map is read-only")}:re instanceof Set&&(re.add=re.clear=re.delete=function(){throw new Error("set is read-only")}),Object.freeze(re),Object.getOwnPropertyNames(re).forEach(Te=>{const rt=re[Te],Pt=typeof rt;(Pt==="object"||Pt==="function")&&!Object.isFrozen(rt)&&e(rt)}),re}class t{constructor(Te){Te.data===void 0&&(Te.data={}),this.data=Te.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(re){return re.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(re,...Te){const rt=Object.create(null);for(const Pt in re)rt[Pt]=re[Pt];return Te.forEach(function(Pt){for(const Be in Pt)rt[Be]=Pt[Be]}),rt}const a="</span>",o=re=>!!re.scope,l=(re,{prefix:Te})=>{if(re.startsWith("language:"))return re.replace("language:","language-");if(re.includes(".")){const rt=re.split(".");return[`${Te}${rt.shift()}`,...rt.map((Pt,Be)=>`${Pt}${"_".repeat(Be+1)}`)].join(" ")}return`${Te}${re}`};class u{constructor(Te,rt){this.buffer="",this.classPrefix=rt.classPrefix,Te.walk(this)}addText(Te){this.buffer+=n(Te)}openNode(Te){if(!o(Te))return;const rt=l(Te.scope,{prefix:this.classPrefix});this.span(rt)}closeNode(Te){o(Te)&&(this.buffer+=a)}value(){return this.buffer}span(Te){this.buffer+=`<span class="${Te}">`}}const d=(re={})=>{const Te={children:[]};return Object.assign(Te,re),Te};class f{constructor(){this.rootNode=d(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(Te){this.top.children.push(Te)}openNode(Te){const rt=d({scope:Te});this.add(rt),this.stack.push(rt)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Te){return this.constructor._walk(Te,this.rootNode)}static _walk(Te,rt){return typeof rt=="string"?Te.addText(rt):rt.children&&(Te.openNode(rt),rt.children.forEach(Pt=>this._walk(Te,Pt)),Te.closeNode(rt)),Te}static _collapse(Te){typeof Te!="string"&&Te.children&&(Te.children.every(rt=>typeof rt=="string")?Te.children=[Te.children.join("")]:Te.children.forEach(rt=>{f._collapse(rt)}))}}class p extends f{constructor(Te){super(),this.options=Te}addText(Te){Te!==""&&this.add(Te)}startScope(Te){this.openNode(Te)}endScope(){this.closeNode()}__addSublanguage(Te,rt){const Pt=Te.root;rt&&(Pt.scope=`language:${rt}`),this.add(Pt)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(re){return re?typeof re=="string"?re:re.source:null}function m(re){return k("(?=",re,")")}function x(re){return k("(?:",re,")*")}function v(re){return k("(?:",re,")?")}function k(...re){return re.map(rt=>g(rt)).join("")}function _(re){const Te=re[re.length-1];return typeof Te=="object"&&Te.constructor===Object?(re.splice(re.length-1,1),Te):{}}function S(...re){return"("+(_(re).capture?"":"?:")+re.map(Pt=>g(Pt)).join("|")+")"}function E(re){return new RegExp(re.toString()+"|").exec("").length-1}function N(re,Te){const rt=re&&re.exec(Te);return rt&&rt.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(re,{joinWith:Te}){let rt=0;return re.map(Pt=>{rt+=1;const Be=rt;let lt=g(Pt),ke="";for(;lt.length>0;){const Ce=R.exec(lt);if(!Ce){ke+=lt;break}ke+=lt.substring(0,Ce.index),lt=lt.substring(Ce.index+Ce[0].length),Ce[0][0]==="\\"&&Ce[1]?ke+="\\"+String(Number(Ce[1])+Be):(ke+=Ce[0],Ce[0]==="("&&rt++)}return ke}).map(Pt=>`(${Pt})`).join(Te)}const j=/\b\B/,I="[a-zA-Z]\\w*",M="[a-zA-Z_]\\w*",L="\\b\\d+(\\.\\d+)?",A="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",F="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Q=(re={})=>{const Te=/^#![ ]*\//;return re.binary&&(re.begin=k(Te,/.*\b/,re.binary,/\b.*/)),r({scope:"meta",begin:Te,end:/$/,relevance:0,"on:begin":(rt,Pt)=>{rt.index!==0&&Pt.ignoreMatch()}},re)},H={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[H]},K={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[H]},W={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Y=function(re,Te,rt={}){const Pt=r({scope:"comment",begin:re,end:Te,contains:[]},rt);Pt.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Be=S("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pt.contains.push({begin:k(/[ ]+/,"(",Be,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pt},ce=Y("//","$"),z=Y("/\\*","\\*/"),G=Y("#","$"),X={scope:"number",begin:L,relevance:0},B={scope:"number",begin:A,relevance:0},te={scope:"number",begin:O,relevance:0},V={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[H,{begin:/\[/,end:/\]/,relevance:0,contains:[H]}]},U={scope:"title",begin:I,relevance:0},oe={scope:"title",begin:M,relevance:0},ae={begin:"\\.\\s*"+M,relevance:0};var Se=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:H,BINARY_NUMBER_MODE:te,BINARY_NUMBER_RE:O,COMMENT:Y,C_BLOCK_COMMENT_MODE:z,C_LINE_COMMENT_MODE:ce,C_NUMBER_MODE:B,C_NUMBER_RE:A,END_SAME_AS_BEGIN:function(re){return Object.assign(re,{"on:begin":(Te,rt)=>{rt.data._beginMatch=Te[1]},"on:end":(Te,rt)=>{rt.data._beginMatch!==Te[1]&&rt.ignoreMatch()}})},HASH_COMMENT_MODE:G,IDENT_RE:I,MATCH_NOTHING_RE:j,METHOD_GUARD:ae,NUMBER_MODE:X,NUMBER_RE:L,PHRASAL_WORDS_MODE:W,QUOTE_STRING_MODE:K,REGEXP_MODE:V,RE_STARTERS_RE:F,SHEBANG:Q,TITLE_MODE:U,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:oe});function Xe(re,Te){re.input[re.index-1]==="."&&Te.ignoreMatch()}function bt(re,Te){re.className!==void 0&&(re.scope=re.className,delete re.className)}function at(re,Te){Te&&re.beginKeywords&&(re.begin="\\b("+re.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",re.__beforeBegin=Xe,re.keywords=re.keywords||re.beginKeywords,delete re.beginKeywords,re.relevance===void 0&&(re.relevance=0))}function yt(re,Te){Array.isArray(re.illegal)&&(re.illegal=S(...re.illegal))}function et(re,Te){if(re.match){if(re.begin||re.end)throw new Error("begin & end are not supported with match");re.begin=re.match,delete re.match}}function Ie(re,Te){re.relevance===void 0&&(re.relevance=1)}const Ge=(re,Te)=>{if(!re.beforeMatch)return;if(re.starts)throw new Error("beforeMatch cannot be used with starts");const rt=Object.assign({},re);Object.keys(re).forEach(Pt=>{delete re[Pt]}),re.keywords=rt.keywords,re.begin=k(rt.beforeMatch,m(rt.begin)),re.starts={relevance:0,contains:[Object.assign(rt,{endsParent:!0})]},re.relevance=0,delete rt.beforeMatch},tt=["of","and","for","in","not","or","if","then","parent","list","value"],kt="keyword";function Kt(re,Te,rt=kt){const Pt=Object.create(null);return typeof re=="string"?Be(rt,re.split(" ")):Array.isArray(re)?Be(rt,re):Object.keys(re).forEach(function(lt){Object.assign(Pt,Kt(re[lt],Te,lt))}),Pt;function Be(lt,ke){Te&&(ke=ke.map(Ce=>Ce.toLowerCase())),ke.forEach(function(Ce){const Ye=Ce.split("|");Pt[Ye[0]]=[lt,an(Ye[0],Ye[1])]})}}function an(re,Te){return Te?Number(Te):Vt(re)?0:1}function Vt(re){return tt.includes(re.toLowerCase())}const ze={},De=re=>{console.error(re)},nt=(re,...Te)=>{console.log(`WARN: ${re}`,...Te)},ft=(re,Te)=>{ze[`${re}/${Te}`]||(console.log(`Deprecated as of ${re}. ${Te}`),ze[`${re}/${Te}`]=!0)},ue=new Error;function be(re,Te,{key:rt}){let Pt=0;const Be=re[rt],lt={},ke={};for(let Ce=1;Ce<=Te.length;Ce++)ke[Ce+Pt]=Be[Ce],lt[Ce+Pt]=!0,Pt+=E(Te[Ce-1]);re[rt]=ke,re[rt]._emit=lt,re[rt]._multi=!0}function qe(re){if(Array.isArray(re.begin)){if(re.skip||re.excludeBegin||re.returnBegin)throw De("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ue;if(typeof re.beginScope!="object"||re.beginScope===null)throw De("beginScope must be object"),ue;be(re,re.begin,{key:"beginScope"}),re.begin=T(re.begin,{joinWith:""})}}function me(re){if(Array.isArray(re.end)){if(re.skip||re.excludeEnd||re.returnEnd)throw De("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ue;if(typeof re.endScope!="object"||re.endScope===null)throw De("endScope must be object"),ue;be(re,re.end,{key:"endScope"}),re.end=T(re.end,{joinWith:""})}}function pt(re){re.scope&&typeof re.scope=="object"&&re.scope!==null&&(re.beginScope=re.scope,delete re.scope)}function gt(re){pt(re),typeof re.beginScope=="string"&&(re.beginScope={_wrap:re.beginScope}),typeof re.endScope=="string"&&(re.endScope={_wrap:re.endScope}),qe(re),me(re)}function wt(re){function Te(ke,Ce){return new RegExp(g(ke),"m"+(re.case_insensitive?"i":"")+(re.unicodeRegex?"u":"")+(Ce?"g":""))}class rt{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ce,Ye){Ye.position=this.position++,this.matchIndexes[this.matchAt]=Ye,this.regexes.push([Ye,Ce]),this.matchAt+=E(Ce)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ce=this.regexes.map(Ye=>Ye[1]);this.matcherRe=Te(T(Ce,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ce){this.matcherRe.lastIndex=this.lastIndex;const Ye=this.matcherRe.exec(Ce);if(!Ye)return null;const xt=Ye.findIndex((Pe,$e)=>$e>0&&Pe!==void 0),ie=this.matchIndexes[xt];return Ye.splice(0,xt),Object.assign(Ye,ie)}}class Pt{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ce){if(this.multiRegexes[Ce])return this.multiRegexes[Ce];const Ye=new rt;return this.rules.slice(Ce).forEach(([xt,ie])=>Ye.addRule(xt,ie)),Ye.compile(),this.multiRegexes[Ce]=Ye,Ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ce,Ye){this.rules.push([Ce,Ye]),Ye.type==="begin"&&this.count++}exec(Ce){const Ye=this.getMatcher(this.regexIndex);Ye.lastIndex=this.lastIndex;let xt=Ye.exec(Ce);if(this.resumingScanAtSamePosition()&&!(xt&&xt.index===this.lastIndex)){const ie=this.getMatcher(0);ie.lastIndex=this.lastIndex+1,xt=ie.exec(Ce)}return xt&&(this.regexIndex+=xt.position+1,this.regexIndex===this.count&&this.considerAll()),xt}}function Be(ke){const Ce=new Pt;return ke.contains.forEach(Ye=>Ce.addRule(Ye.begin,{rule:Ye,type:"begin"})),ke.terminatorEnd&&Ce.addRule(ke.terminatorEnd,{type:"end"}),ke.illegal&&Ce.addRule(ke.illegal,{type:"illegal"}),Ce}function lt(ke,Ce){const Ye=ke;if(ke.isCompiled)return Ye;[bt,et,gt,Ge].forEach(ie=>ie(ke,Ce)),re.compilerExtensions.forEach(ie=>ie(ke,Ce)),ke.__beforeBegin=null,[at,yt,Ie].forEach(ie=>ie(ke,Ce)),ke.isCompiled=!0;let xt=null;return typeof ke.keywords=="object"&&ke.keywords.$pattern&&(ke.keywords=Object.assign({},ke.keywords),xt=ke.keywords.$pattern,delete ke.keywords.$pattern),xt=xt||/\w+/,ke.keywords&&(ke.keywords=Kt(ke.keywords,re.case_insensitive)),Ye.keywordPatternRe=Te(xt,!0),Ce&&(ke.begin||(ke.begin=/\B|\b/),Ye.beginRe=Te(Ye.begin),!ke.end&&!ke.endsWithParent&&(ke.end=/\B|\b/),ke.end&&(Ye.endRe=Te(Ye.end)),Ye.terminatorEnd=g(Ye.end)||"",ke.endsWithParent&&Ce.terminatorEnd&&(Ye.terminatorEnd+=(ke.end?"|":"")+Ce.terminatorEnd)),ke.illegal&&(Ye.illegalRe=Te(ke.illegal)),ke.contains||(ke.contains=[]),ke.contains=[].concat(...ke.contains.map(function(ie){return $t(ie==="self"?ke:ie)})),ke.contains.forEach(function(ie){lt(ie,Ye)}),ke.starts&<(ke.starts,Ce),Ye.matcher=Be(Ye),Ye}if(re.compilerExtensions||(re.compilerExtensions=[]),re.contains&&re.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return re.classNameAliases=r(re.classNameAliases||{}),lt(re)}function ht(re){return re?re.endsWithParent||ht(re.starts):!1}function $t(re){return re.variants&&!re.cachedVariants&&(re.cachedVariants=re.variants.map(function(Te){return r(re,{variants:null},Te)})),re.cachedVariants?re.cachedVariants:ht(re)?r(re,{starts:re.starts?r(re.starts):null}):Object.isFrozen(re)?r(re):re}var Wt="11.11.2";class Je extends Error{constructor(Te,rt){super(Te),this.name="HTMLInjectionError",this.html=rt}}const zt=n,St=r,Yt=Symbol("nomatch"),cn=7,xn=function(re){const Te=Object.create(null),rt=Object.create(null),Pt=[];let Be=!0;const lt="Could not find the language '{}', did you forget to load/include a language module?",ke={disableAutodetect:!0,name:"Plain text",contains:[]};let Ce={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Ye(je){return Ce.noHighlightRe.test(je)}function xt(je){let mt=je.className+" ";mt+=je.parentNode?je.parentNode.className:"";const It=Ce.languageDetectRe.exec(mt);if(It){const gn=Br(It[1]);return gn||(nt(lt.replace("{}",It[1])),nt("Falling back to no-highlight mode for this block.",je)),gn?It[1]:"no-highlight"}return mt.split(/\s+/).find(gn=>Ye(gn)||Br(gn))}function ie(je,mt,It){let gn="",Ln="";typeof mt=="object"?(gn=je,It=mt.ignoreIllegals,Ln=mt.language):(ft("10.7.0","highlight(lang, code, ...args) has been deprecated."),ft("10.7.0",`Please use highlight(code, options) instead.
|
|
81
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),Ln=je,gn=mt),It===void 0&&(It=!0);const Wn={code:gn,language:Ln};ea("before:highlight",Wn);const Sr=Wn.result?Wn.result:Pe(Wn.language,Wn.code,It);return Sr.code=Wn.code,ea("after:highlight",Sr),Sr}function Pe(je,mt,It,gn){const Ln=Object.create(null);function Wn(Qe,ut){return Qe.keywords[ut]}function Sr(){if(!Ut.keywords){Vn.addText(sn);return}let Qe=0;Ut.keywordPatternRe.lastIndex=0;let ut=Ut.keywordPatternRe.exec(sn),Gt="";for(;ut;){Gt+=sn.substring(Qe,ut.index);const kn=Nr.case_insensitive?ut[0].toLowerCase():ut[0],In=Wn(Ut,kn);if(In){const[Zn,wi]=In;if(Vn.addText(Gt),Gt="",Ln[kn]=(Ln[kn]||0)+1,Ln[kn]<=cn&&(_i+=wi),Zn.startsWith("_"))Gt+=ut[0];else{const es=Nr.classNameAliases[Zn]||Zn;Er(ut[0],es)}}else Gt+=ut[0];Qe=Ut.keywordPatternRe.lastIndex,ut=Ut.keywordPatternRe.exec(sn)}Gt+=sn.substring(Qe),Vn.addText(Gt)}function Pi(){if(sn==="")return;let Qe=null;if(typeof Ut.subLanguage=="string"){if(!Te[Ut.subLanguage]){Vn.addText(sn);return}Qe=Pe(Ut.subLanguage,sn,!0,ir[Ut.subLanguage]),ir[Ut.subLanguage]=Qe._top}else Qe=Tt(sn,Ut.subLanguage.length?Ut.subLanguage:null);Ut.relevance>0&&(_i+=Qe.relevance),Vn.__addSublanguage(Qe._emitter,Qe.language)}function ar(){Ut.subLanguage!=null?Pi():Sr(),sn=""}function Er(Qe,ut){Qe!==""&&(Vn.startScope(ut),Vn.addText(Qe),Vn.endScope())}function hi(Qe,ut){let Gt=1;const kn=ut.length-1;for(;Gt<=kn;){if(!Qe._emit[Gt]){Gt++;continue}const In=Nr.classNameAliases[Qe[Gt]]||Qe[Gt],Zn=ut[Gt];In?Er(Zn,In):(sn=Zn,Sr(),sn=""),Gt++}}function ti(Qe,ut){return Qe.scope&&typeof Qe.scope=="string"&&Vn.openNode(Nr.classNameAliases[Qe.scope]||Qe.scope),Qe.beginScope&&(Qe.beginScope._wrap?(Er(sn,Nr.classNameAliases[Qe.beginScope._wrap]||Qe.beginScope._wrap),sn=""):Qe.beginScope._multi&&(hi(Qe.beginScope,ut),sn="")),Ut=Object.create(Qe,{parent:{value:Ut}}),Ut}function ni(Qe,ut,Gt){let kn=N(Qe.endRe,Gt);if(kn){if(Qe["on:end"]){const In=new t(Qe);Qe["on:end"](ut,In),In.isMatchIgnored&&(kn=!1)}if(kn){for(;Qe.endsParent&&Qe.parent;)Qe=Qe.parent;return Qe}}if(Qe.endsWithParent)return ni(Qe.parent,ut,Gt)}function va(Qe){return Ut.matcher.regexIndex===0?(sn+=Qe[0],1):(ri=!0,0)}function ta(Qe){const ut=Qe[0],Gt=Qe.rule,kn=new t(Gt),In=[Gt.__beforeBegin,Gt["on:begin"]];for(const Zn of In)if(Zn&&(Zn(Qe,kn),kn.isMatchIgnored))return va(ut);return Gt.skip?sn+=ut:(Gt.excludeBegin&&(sn+=ut),ar(),!Gt.returnBegin&&!Gt.excludeBegin&&(sn=ut)),ti(Gt,Qe),Gt.returnBegin?0:ut.length}function ka(Qe){const ut=Qe[0],Gt=mt.substring(Qe.index),kn=ni(Ut,Qe,Gt);if(!kn)return Yt;const In=Ut;Ut.endScope&&Ut.endScope._wrap?(ar(),Er(ut,Ut.endScope._wrap)):Ut.endScope&&Ut.endScope._multi?(ar(),hi(Ut.endScope,Qe)):In.skip?sn+=ut:(In.returnEnd||In.excludeEnd||(sn+=ut),ar(),In.excludeEnd&&(sn=ut));do Ut.scope&&Vn.closeNode(),!Ut.skip&&!Ut.subLanguage&&(_i+=Ut.relevance),Ut=Ut.parent;while(Ut!==kn.parent);return kn.starts&&ti(kn.starts,Qe),In.returnEnd?0:ut.length}function _a(){const Qe=[];for(let ut=Ut;ut!==Nr;ut=ut.parent)ut.scope&&Qe.unshift(ut.scope);Qe.forEach(ut=>Vn.openNode(ut))}let gi={};function Gr(Qe,ut){const Gt=ut&&ut[0];if(sn+=Qe,Gt==null)return ar(),0;if(gi.type==="begin"&&ut.type==="end"&&gi.index===ut.index&&Gt===""){if(sn+=mt.slice(ut.index,ut.index+1),!Be){const kn=new Error(`0 width match regex (${je})`);throw kn.languageName=je,kn.badRule=gi.rule,kn}return 1}if(gi=ut,ut.type==="begin")return ta(ut);if(ut.type==="illegal"&&!It){const kn=new Error('Illegal lexeme "'+Gt+'" for mode "'+(Ut.scope||"<unnamed>")+'"');throw kn.mode=Ut,kn}else if(ut.type==="end"){const kn=ka(ut);if(kn!==Yt)return kn}if(ut.type==="illegal"&&Gt==="")return ut.index===mt.length||(sn+=`
|
|
82
|
-
`),1;if(na>1e5&&na>ut.index*3)throw new Error("potential infinite loop, way more iterations than matches");return sn+=Gt,Gt.length}const Nr=Br(je);if(!Nr)throw De(lt.replace("{}",je)),new Error('Unknown language: "'+je+'"');const Kr=wt(Nr);let un="",Ut=gn||Kr;const ir={},Vn=new Ce.__emitter(Ce);_a();let sn="",_i=0,zr=0,na=0,ri=!1;try{if(Nr.__emitTokens)Nr.__emitTokens(mt,Vn);else{for(Ut.matcher.considerAll();;){na++,ri?ri=!1:Ut.matcher.considerAll(),Ut.matcher.lastIndex=zr;const Qe=Ut.matcher.exec(mt);if(!Qe)break;const ut=mt.substring(zr,Qe.index),Gt=Gr(ut,Qe);zr=Qe.index+Gt}Gr(mt.substring(zr))}return Vn.finalize(),un=Vn.toHTML(),{language:je,value:un,relevance:_i,illegal:!1,_emitter:Vn,_top:Ut}}catch(Qe){if(Qe.message&&Qe.message.includes("Illegal"))return{language:je,value:zt(mt),illegal:!0,relevance:0,_illegalBy:{message:Qe.message,index:zr,context:mt.slice(zr-100,zr+100),mode:Qe.mode,resultSoFar:un},_emitter:Vn};if(Be)return{language:je,value:zt(mt),illegal:!1,relevance:0,errorRaised:Qe,_emitter:Vn,_top:Ut};throw Qe}}function $e(je){const mt={value:zt(je),illegal:!1,relevance:0,_top:ke,_emitter:new Ce.__emitter(Ce)};return mt._emitter.addText(je),mt}function Tt(je,mt){mt=mt||Ce.languages||Object.keys(Te);const It=$e(je),gn=mt.filter(Br).filter(Ji).map(ar=>Pe(ar,je,!1));gn.unshift(It);const Ln=gn.sort((ar,Er)=>{if(ar.relevance!==Er.relevance)return Er.relevance-ar.relevance;if(ar.language&&Er.language){if(Br(ar.language).supersetOf===Er.language)return 1;if(Br(Er.language).supersetOf===ar.language)return-1}return 0}),[Wn,Sr]=Ln,Pi=Wn;return Pi.secondBest=Sr,Pi}function Ne(je,mt,It){const gn=mt&&rt[mt]||It;je.classList.add("hljs"),je.classList.add(`language-${gn}`)}function We(je){let mt=null;const It=xt(je);if(Ye(It))return;if(ea("before:highlightElement",{el:je,language:It}),je.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",je);return}if(je.children.length>0&&(Ce.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(je)),Ce.throwUnescapedHTML))throw new Je("One of your code blocks includes unescaped HTML.",je.innerHTML);mt=je;const gn=mt.textContent,Ln=It?ie(gn,{language:It,ignoreIllegals:!0}):Tt(gn);je.innerHTML=Ln.value,je.dataset.highlighted="yes",Ne(je,It,Ln.language),je.result={language:Ln.language,re:Ln.relevance,relevance:Ln.relevance},Ln.secondBest&&(je.secondBest={language:Ln.secondBest.language,relevance:Ln.secondBest.relevance}),ea("after:highlightElement",{el:je,result:Ln,text:gn})}function Et(je){Ce=St(Ce,je)}const vn=()=>{jn(),ft("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function vr(){jn(),ft("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let pn=!1;function jn(){function je(){jn()}if(document.readyState==="loading"){pn||window.addEventListener("DOMContentLoaded",je,!1),pn=!0;return}document.querySelectorAll(Ce.cssSelector).forEach(We)}function Fr(je,mt){let It=null;try{It=mt(re)}catch(gn){if(De("Language definition for '{}' could not be registered.".replace("{}",je)),Be)De(gn);else throw gn;It=ke}It.name||(It.name=je),Te[je]=It,It.rawDefinition=mt.bind(null,re),It.aliases&&ki(It.aliases,{languageName:je})}function pe(je){delete Te[je];for(const mt of Object.keys(rt))rt[mt]===je&&delete rt[mt]}function Xn(){return Object.keys(Te)}function Br(je){return je=(je||"").toLowerCase(),Te[je]||Te[rt[je]]}function ki(je,{languageName:mt}){typeof je=="string"&&(je=[je]),je.forEach(It=>{rt[It.toLowerCase()]=mt})}function Ji(je){const mt=Br(je);return mt&&!mt.disableAutodetect}function Kn(je){je["before:highlightBlock"]&&!je["before:highlightElement"]&&(je["before:highlightElement"]=mt=>{je["before:highlightBlock"](Object.assign({block:mt.el},mt))}),je["after:highlightBlock"]&&!je["after:highlightElement"]&&(je["after:highlightElement"]=mt=>{je["after:highlightBlock"](Object.assign({block:mt.el},mt))})}function _s(je){Kn(je),Pt.push(je)}function pi(je){const mt=Pt.indexOf(je);mt!==-1&&Pt.splice(mt,1)}function ea(je,mt){const It=je;Pt.forEach(function(gn){gn[It]&&gn[It](mt)})}function Ba(je){return ft("10.7.0","highlightBlock will be removed entirely in v12.0"),ft("10.7.0","Please use highlightElement now."),We(je)}Object.assign(re,{highlight:ie,highlightAuto:Tt,highlightAll:jn,highlightElement:We,highlightBlock:Ba,configure:Et,initHighlighting:vn,initHighlightingOnLoad:vr,registerLanguage:Fr,unregisterLanguage:pe,listLanguages:Xn,getLanguage:Br,registerAliases:ki,autoDetection:Ji,inherit:St,addPlugin:_s,removePlugin:pi}),re.debugMode=function(){Be=!1},re.safeMode=function(){Be=!0},re.versionString=Wt,re.regex={concat:k,lookahead:m,either:S,optional:v,anyNumberOfTimes:x};for(const je in Se)typeof Se[je]=="object"&&e(Se[je]);return Object.assign(re,Se),re},Rn=xn({});return Rn.newInstance=()=>xn({}),gg=Rn,Rn.HighlightJS=Rn,Rn.default=Rn,gg}var OB=LB();const DB=$o(OB),N2={},PB="hljs-";function FB(e){const t=DB.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:a,register:o,registerAlias:l,registered:u};function n(d,f,p){const g=p||N2,m=typeof g.prefix=="string"?g.prefix:PB;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:BB,classPrefix:m});const x=t.highlight(f,{ignoreIllegals:!0,language:d});if(x.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:x.errorRaised});const v=x._emitter.root,k=v.data;return k.language=x.language,k.relevance=x.relevance,v}function r(d,f){const g=(f||N2).subset||a();let m=-1,x=0,v;for(;++m<g.length;){const k=g[m];if(!t.getLanguage(k))continue;const _=n(k,d,f);_.data&&_.data.relevance!==void 0&&_.data.relevance>x&&(x=_.data.relevance,v=_)}return v||{type:"root",children:[],data:{language:void 0,relevance:x}}}function a(){return t.listLanguages()}function o(d,f){if(typeof d=="string")t.registerLanguage(d,f);else{let p;for(p in d)Object.hasOwn(d,p)&&t.registerLanguage(p,d[p])}}function l(d,f){if(typeof d=="string")t.registerAliases(typeof f=="string"?f:[...f],{languageName:d});else{let p;for(p in d)if(Object.hasOwn(d,p)){const g=d[p];t.registerAliases(typeof g=="string"?g:[...g],{languageName:p})}}}function u(d){return!!t.getLanguage(d)}}class BB{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],a=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:a}):r.children.push(...a)}openNode(t){const n=this,r=t.split(".").map(function(l,u){return u?l+"_".repeat(u):n.options.classPrefix+l}),a=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const zB={};function uf(e){const t=e||zB,n=t.aliases,r=t.detect||!1,a=t.languages||MB,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=FB(a);if(n&&f.registerAlias(n),l){const p=l.indexOf("-");d=p===-1?l:l.slice(0,p)}return function(p,g){np(p,"element",function(m,x,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=qB(m);if(k===!1||!k&&!r||k&&o&&o.includes(k))return;Array.isArray(m.properties.className)||(m.properties.className=[]),m.properties.className.includes(d)||m.properties.className.unshift(d);const _=sF(m,{whitespace:"pre"});let S;try{S=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(E){const N=E;if(k&&/Unknown language/.test(N.message)){g.message("Cannot highlight as `"+k+"`, it’s not registered",{ancestors:[v,m],cause:N,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw N}!k&&S.data&&S.data.language&&m.properties.className.push("language-"+S.data.language),S.children.length>0&&(m.children=S.children)})}}function qB(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const a=String(t[n]);if(a==="no-highlight"||a==="nohighlight")return!1;!r&&a.slice(0,5)==="lang-"&&(r=a.slice(5)),!r&&a.slice(0,9)==="language-"&&(r=a.slice(9))}return r}function uu(){function e(t){const n=new Set(["strong","emphasis","delete"]);function r(a){if(a.children)for(let o=0;o<a.children.length;o++){const l=a.children[o];if(n.has(l.type)){if(o>0){const f=a.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
|
|
83
|
-
`)&&(f.value+=" "):(a.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<a.children.length?a.children[u]:null;d&&(d.type==="text"?d.value&&/^[a-zA-Z0-9]/.test(d.value)&&!d.value.startsWith(" ")&&!d.value.startsWith(`
|
|
84
|
-
`)&&(d.value=" "+d.value):n.has(d.type)&&a.children.splice(u,0,{type:"text",value:" "}))}r(l)}}return r(t),t}return e}function Nf({children:e,language:t,className:n,frameless:r,...a}){const[o,l]=y.useState(!1),u=String(e).replace(/\n$/,""),d=n||(t?"language-"+t:""),f=async()=>{try{await navigator.clipboard.writeText(u),l(!0),setTimeout(()=>l(!1),2e3)}catch{const p=document.createElement("textarea");p.value=u,document.body.appendChild(p),p.select(),document.execCommand("copy"),document.body.removeChild(p),l(!0),setTimeout(()=>l(!1),2e3)}};return r?i.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[i.jsx("button",{onMouseDown:function(p){p.preventDefault()},onClick:f,className:"absolute top-2 right-2 z-10 p-1.5 rounded-md bg-gray-200/80 dark:bg-gray-700/80 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors backdrop-blur-xs",title:"Copy","aria-label":"Copy code",children:o?i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),i.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:i.jsx("code",{className:d||void 0,children:e})})]}):i.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-900 dark:bg-gray-950 my-3 px-1.5 py-0.5",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-gray-800 dark:bg-gray-900 text-xs text-gray-400",children:[i.jsx("span",{children:t||"code"}),i.jsx("button",{onMouseDown:function(p){p.preventDefault()},onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})})]}),i.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:i.jsx("code",{className:d||void 0,children:e})})]})}function ip(e,t){if(!t)return"";try{const n=typeof t=="string"?JSON.parse(t):t;if(n.command)return n.command;if(n.filePath&&e==="read")return`read ${n.filePath}`;if(n.pattern&&e==="grep"){const r=n.path||n.include||".";return`grep "${n.pattern}" ${r}`}if(n.pattern&&e==="glob")return`glob "${n.pattern}"`;if(n.filePath&&e==="edit")return`edit ${n.filePath}`;if(n.filePath&&e==="write")return`write ${n.filePath}`;if(n._purpose&&e==="task")return`task "${n._purpose}"`;if(n.url&&(e==="webfetch"||e==="fetch"))return`fetch ${n.url}`;if(n.action&&e==="todo"){let r=`todo ${n.action}`;return n.text&&(r+=` "${n.text}"`),n.id&&(r+=` #${n.id}`),r}if(n.action&&e==="permission"){let r=`permission ${n.action}`;return n.type&&(r+=` ${n.type}`),n.target&&(r+=` ${n.target}`),r}{const r=[];for(const[a,o]of Object.entries(n))if(!(o==null||o===""))if(typeof o=="boolean")o&&r.push(`--${a}`);else if(Array.isArray(o)){const u=o.some(f=>typeof f=="object"&&f!==null)?JSON.stringify(o):o.map(f=>String(f)).join(", "),d=u.length>60?u.slice(0,60)+"...":u;r.push(`--${a} "${d}"`)}else{const l=typeof o=="object"&&o!==null?JSON.stringify(o):String(o),u=l.length>60?l.slice(0,60)+"...":l;r.push(`--${a} "${u}"`)}return r.length>0?`${e} ${r.join(" ")}`:e||""}}catch{return""}}function qo(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function UB(e){if(!e)return null;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}return t&&t.canvas&&t.canvas.type&&t.canvas.source?t.canvas:null}function HB({part:e}){const{t}=rn(),{tool:n,state:r}=e,[a,o]=y.useState(!1);if(!r)return null;const l=r.status||"running",u=r.title||n||t("tool.tool"),d=ip(n||u,r.input),f=r.input&&r.input._purpose?r.input._purpose:null,p=l==="completed"?UB(r.output):null,g=!f||a,m={running:"border-yellow-400 bg-yellow-50 dark:bg-yellow-900/20",completed:"border-green-400 bg-green-50 dark:bg-green-900/20",error:"border-red-400 bg-red-50 dark:bg-red-900/20",pending_confirmation:"border-blue-400 bg-blue-50 dark:bg-blue-900/20"},x={running:i.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:i.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:i.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:i.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})};return i.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${m[l]||m.running}`,children:[i.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!a):void 0,children:[x[l]||x.running,f?i.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):i.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&i.jsx("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),g&&d&&!p&&i.jsxs("div",{className:"mt-2 font-mono text-xs bg-gray-900 dark:bg-gray-950 text-gray-100 rounded px-2 py-1.5 overflow-x-auto",children:[i.jsx("span",{className:"text-green-400 select-none",children:"$ "}),i.jsx("span",{className:"text-gray-100",children:d})]}),p?i.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[i.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v14a1 1 0 01-1 1H5a1 1 0 01-1-1V5z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),i.jsxs("span",{children:[p.type==="mermaid"?"Mermaid diagram":p.type==="svg"?"SVG illustration":"Math",p.title?i.jsxs(i.Fragment,{children:[": ",i.jsx("span",{className:"font-medium",children:p.title})]}):null," rendered → see ",i.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):r.output&&l==="completed"&&g&&i.jsx("pre",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400 overflow-x-auto max-h-32 overflow-y-auto whitespace-pre-wrap break-all max-w-full",children:qo((typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,600)).slice(0,500)}),r.error&&g&&i.jsx("pre",{className:"mt-2 text-xs text-red-600 dark:text-red-400 whitespace-pre-wrap break-all overflow-x-auto max-w-full",children:qo(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function $B({part:e}){const{tool:t,state:n}=e,[r,a]=y.useState(!1);if(!n)return null;const o=n.status||"running",l=n.title||t||"Tool",u=ip(t||l,n.input),d=n.input&&n.input._purpose?n.input._purpose:null,f=!d||r;return i.jsxs("div",{className:"py-1",children:[i.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>a(!r):void 0,children:[o==="running"&&i.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&i.jsx("svg",{className:"w-3 h-3 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&i.jsx("svg",{className:"w-3 h-3 text-red-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&i.jsx("svg",{className:"w-3 h-3 text-blue-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),d?i.jsx("span",{className:"font-medium truncate flex-1",children:d}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-medium truncate",children:l}),u&&i.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&i.jsx("svg",{className:`w-3 h-3 text-gray-400 shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&i.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),n.output&&o==="completed"&&f&&i.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:qo(typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)).slice(0,500)}),n.error&&f&&i.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:qo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)}),n.error&&!f&&i.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:qo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function WB({text:e,isStreaming:t}){const{t:n}=rn(),[r,a]=y.useState(!1),o=e&&e.trim().length>0,l=t&&!r?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return i.jsxs("div",{className:"py-1",children:[i.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>a(!r):void 0,children:[t?i.jsxs("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):i.jsx("svg",{className:"w-3 h-3 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i.jsx("span",{className:`font-medium shrink-0 ${l?"":"flex-1"}`,children:n("chat.thinking")}),l&&i.jsx("span",{className:"flex-1 min-w-0 font-medium italic opacity-80 whitespace-nowrap overflow-hidden flex justify-end",style:{maskImage:"linear-gradient(to right, transparent, black 24px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 24px)"},children:l}),o&&i.jsx("svg",{className:`w-3 h-3 text-gray-400 shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),r&&o&&i.jsx("div",{className:"mt-1 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:i.jsx(lu,{remarkPlugins:[cu,uu],children:e})})]})}function VB(e){return!!(e.hasError||e.hasText||e.hasImages||e.hasTools&&e.toolsVisibleHere||e.isFrameless&&e.hasReasoning&&!e.hideThinking||e.finish==="aborted"||e.finish==="interrupted")}const mg=2500,df=5,Zc=new Map;function GB(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function KB({part:e,questionId:t,questions:n}){const{t:r}=rn(),{state:a}=e,o=a&&a.status||"running",l=a&&a.input||{},u=Array.isArray(n)&&n.length>0?n:Array.isArray(l.questions)&&l.questions.length>0?l.questions:[{text:"(no question)",options:void 0}],d=o==="completed",f=o==="error",p=(a&&a.error||"").replace(/^Error:\s*/,""),g=a&&a.output||"",[m,x]=y.useState({}),[v,k]=y.useState({}),[_,S]=y.useState(null),[E,N]=y.useState(null),[R,T]=y.useState(t),[j,I]=y.useState(0),[M,L]=y.useState(()=>{const X=e.callID||e.id,B=X&&Zc.get(X);return!!(B&&B.attempts>=df)}),A=y.useRef(!0),O=y.useRef(null),F=y.useRef(null);y.useEffect(()=>{t&&T(t)},[t]);const Q=e.callID||e.id||null;y.useEffect(()=>{if(!a||d||f||R||!Q)return;let X=Zc.get(Q);X||(X={attempts:0,lastAt:0},Zc.set(Q,X)),F.current=X;let B=!1,te=null;const V=()=>{if(!(B||!A.current)){if(X.attempts>=df){L(!0);return}te=setTimeout(U,mg)}},U=()=>{B||!A.current||X.attempts>=df||(X.attempts+=1,X.lastAt=Date.now(),eL().then(oe=>{if(B||!A.current)return;const ae=Array.isArray(oe&&oe.pending)?oe.pending:[];for(var xe=0;xe<ae.length;xe++){var Se=ae[xe],Xe=Se.tool&&Se.tool.callID?Se.tool.callID:null;if(Xe===Q&&Se.id){Zc.delete(Q),L(!1),T(Se.id);return}}V()}).catch(()=>{V()}))};if(X.attempts<df){const oe=Date.now()-X.lastAt;X.attempts===0||oe>=mg?U():te=setTimeout(U,mg-oe)}return()=>{B=!0,te&&clearTimeout(te)}},[a,d,f,R,Q,j]);const H=y.useCallback(()=>{Q&&Zc.delete(Q),L(!1),I(X=>X+1)},[Q]);y.useEffect(()=>()=>{A.current=!1},[]),y.useEffect(()=>{!d&&O.current&&(O.current.focus(),O.current.scrollIntoView({behavior:"smooth",block:"center"}))},[d]);const P=X=>{var B,te;return(((B=m[X])==null?void 0:B.length)??0)>0||(((te=v[X])==null?void 0:te.trim().length)??0)>0},K=u.every((X,B)=>P(B)),W=(X,B,te)=>{x(V=>{const U=V[X]??[];return te?{...V,[X]:U.includes(B)?U.filter(oe=>oe!==B):[...U,B]}:{...V,[X]:U.includes(B)?[]:[B]}})},Y=y.useCallback(async()=>{if(!K||!R)return;const X=u.map((B,te)=>{var oe;const V=m[te]??[],U=(oe=v[te])==null?void 0:oe.trim();return U?[...V,U]:V});S("reply"),N(null);try{const B=await tL(R,X);if(!A.current)return;B&&B.success===!1&&(N(B.error||"Failed to reply"),S(null))}catch(B){if(!A.current)return;N(B.message||"Failed to reply"),S(null)}},[R,u,m,v,K]),ce=y.useCallback(async()=>{if(R){S("reject"),N(null);try{const X=await nL(R);if(!A.current)return;X&&X.success===!1&&(N(X.error||"Failed to dismiss"),S(null))}catch(X){if(!A.current)return;N(X.message||"Failed to dismiss"),S(null)}}},[R]);if(!a)return null;const z=X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),Y())};if(d)return i.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/50 dark:bg-primary-900/10 p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")}),i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),u.map((X,B)=>i.jsxs("div",{className:B>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:X.text}),g&&i.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:YB(g,B,u.length)})]},B))]});if(f)return i.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-red-400 bg-red-50/30 dark:bg-red-900/10 p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",children:r("question.title")}),i.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]}),i.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:r("question.error")}),p&&i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:p})]});let G=!1;return i.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/30 dark:bg-primary-900/10 p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 shrink-0 animate-pulse",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")})]}),u.map((X,B)=>{const te=Array.isArray(X.options)?X.options:[],V=te.length>0,U=X.multiple===!0,oe=X.custom!==!1,ae=m[B]??[],xe=oe&&!G;return xe&&(G=!0),i.jsxs("div",{className:B>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(X.header||U)&&i.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[X.header&&i.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-primary-600 dark:text-primary-400 bg-primary-100 dark:bg-primary-900/30 rounded px-1.5 py-0.5",children:X.header}),U&&i.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:r("question.select_all")})]}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:X.text}),V&&i.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:te.map((Se,Xe)=>{const bt=GB(Se),at=ae.includes(bt);return i.jsx("button",{onClick:()=>W(B,bt,U),disabled:_!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${at?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300":"border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-pressed":at,children:bt},Xe)})}),oe&&i.jsx("input",{ref:xe?O:void 0,type:"text",value:v[B]??"",onChange:Se=>k(Xe=>({...Xe,[B]:Se.target.value})),onKeyDown:z,disabled:_!==null,placeholder:r(V?"question.custom_placeholder":"question.input_placeholder"),className:"w-full px-3 py-2 text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]},B)}),E&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:E}),!R&&!d&&!M&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:r("question.reconnecting")||"Reconnecting…"}),!R&&!d&&M&&i.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[i.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:r("question.resolve_failed")||"Could not reach the question service."}),i.jsx("button",{onClick:H,className:"px-2 py-1 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:r("question.retry_connection")||"Retry"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[i.jsx("button",{onClick:ce,disabled:_!==null||!R,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(_==="reject"?"question.dismissing":"question.dismiss")}),i.jsx("button",{onClick:Y,disabled:_!==null||!K||!R,className:"px-3 py-1.5 text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:_==="reply"?r("question.submitting"):u.length>1?r("question.submit_n",{count:u.length}):r("question.submit")})]})]})}function YB(e,t,n){if(n===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const r=e.split(`
|
|
85
|
-
`),a=`[${t+1}] `;for(const o of r)if(o.startsWith(a))return o.slice(a.length);return e}function QB({sessionId:e}){const{t}=rn(),[n,r]=y.useState(null),[a,o]=y.useState(!1),[l,u]=y.useState(null),[d,f]=y.useState(!1),[p,g]=y.useState(null),m=y.useRef(null),x=n!==null;y.useEffect(()=>{if(!a)return;const E=N=>{N.key==="Escape"&&(N.stopPropagation(),o(!1))};return window.addEventListener("keydown",E),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",E)},[a]);const v=async()=>{if(!(x||!e)){o(!0),f(!0),g(null);try{const{content:E}=await WL(e);u(typeof E=="string"?E:"")}catch(E){console.error("Failed to load PLAN.md:",E),g(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{x||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{x||r("dismissed")},S="inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed";return i.jsxs("div",{className:"mt-2 flex flex-col gap-2 rounded-xl border border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 px-3 py-2.5 transition-opacity "+(x?"opacity-50":""),children:[i.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:v,disabled:x||d||!e,className:S+" border-sky-300 dark:border-sky-700 text-sky-700 dark:text-sky-300 hover:bg-sky-100 dark:hover:bg-sky-900/40",children:t("planCard.showPlan")}),i.jsx("button",{type:"button",onClick:k,disabled:x,className:S+" border-emerald-300 dark:border-emerald-700 text-emerald-700 dark:text-emerald-300 hover:bg-emerald-100 dark:hover:bg-emerald-900/40",children:t("planCard.execute")}),i.jsx("button",{type:"button",onClick:_,disabled:x,className:S+" border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/40",children:t("planCard.keepPlanning")})]}),x&&i.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(n==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),a&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":t("planCard.heading"),className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg bg-white dark:bg-gray-800 shadow-xl",onClick:E=>E.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[i.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),i.jsx("button",{ref:m,type:"button",onClick:()=>o(!1),className:"rounded p-1 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-200","aria-label":t("planCard.close"),children:"✕"})]}),d?i.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):p?i.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:p}):i.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs text-gray-800 dark:text-gray-200",children:l})]})})]})}const XB="plan.md";function ZB(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function JB(e){return typeof e!="string"||!e?!1:ZB(e).toLowerCase()===XB}function ez(e){if(!Array.isArray(e))return null;let t=null;for(const n of e){if(!n||n.type!=="tool"||n.tool!=="write"&&n.tool!=="edit")continue;const r=n.state&&n.state.input||{};JB(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function Lk(e,t,n=!1){if(t){const r=Object.values(t).filter(a=>a.type==="reasoning"&&n?!1:a.type==="text"||a.type==="reasoning"||a.type==="error").map(a=>a.text||a.delta||"").join(`
|
|
86
|
-
|
|
87
|
-
`);if(r)return r}return!e||e.length===0?"":e.filter(r=>r.type==="reasoning"&&n?!1:r.type==="text"||r.type==="reasoning"||r.type==="error").map(r=>r.text||"").join(`
|
|
88
|
-
|
|
89
|
-
`)}function tz(e,t,n){const r=Lk(e,t,n);if(!e||e.length===0)return r;const a=[];for(let o=0;o<e.length;o++){const l=e[o];if(l.type!=="tool")continue;const u=l.tool||l.state&&l.state.title||"",d=l.state||{},f=d.input||{},p=[];u&&p.push(u),f._purpose&&p.push(f._purpose);const g=Object.keys(f).filter(m=>m!=="_purpose");if(g.length>0){const m={};for(let x=0;x<g.length;x++)m[g[x]]=f[g[x]];try{p.push(JSON.stringify(m))}catch{}}if(d.output){let m=typeof d.output=="string"?d.output:(function(){try{return JSON.stringify(d.output,null,2)}catch{return String(d.output)}})();m=m.replace(/\x1b\[[0-9;]*m/g,""),m.length>500&&(m=m.slice(0,500)),p.push(m)}if(d.error){const m=typeof d.error=="string"?d.error:d.error.message||String(d.error);p.push(m)}p.length>0&&a.push(p.join(`
|
|
90
|
-
`))}return a.length===0?r:r+`
|
|
91
|
-
|
|
92
|
-
`+a.join(`
|
|
93
|
-
|
|
94
|
-
`)}function nz(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
|
|
95
|
-
`),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
|
|
96
|
-
`),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
|
|
97
|
-
`),t=t.replace(/`[^`\n]+`/g," "),t=t.replace(/!\[[^\]]*\]\([^)]*\)/g," "),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/^\[[^\]]+\]:\s.*$/gm," "),t=t.replace(/<(https?:\/\/[^>]+)>/g,"$1"),t=t.replace(/<\/?[a-zA-Z][^>]*>/g," "),t}const rz=5,iz=2e3,az=6e3,Pv="… [truncated]",sz=/^\*\*Quoted from (assistant|you)(?:, (.+?))?:\*\*$/,RR="```text",AR="```";let C2=0;function oz(){return C2+=1,"q-"+Date.now()+"-"+C2}function Ok(e,t=iz){if(typeof e!="string")return"";const n=e.replace(/\r\n?/g,`
|
|
98
|
-
`).replace(/^\n+/,"").replace(/\s+$/,"");return n.length<=t?n:n.slice(0,t)+Pv}function lz(e){return e.reduce((t,n)=>n&&typeof n.text=="string"?t+n.text.length:t,0)}function cz(e,t){const n=Array.isArray(e)?e:[];if(n.length>=rz)return!1;const r=Ok(t);return r?lz(n)+r.length<=az:!1}function uz(e,t){const n=e==="assistant"?"Quoted from assistant":"Quoted from you",r=typeof t=="string"?t.trim():"";return r?n+", "+r+":":n+":"}function dz(e){return e?"> "+e:">"}function j2(e,t){for(const n of t.split(`
|
|
99
|
-
`))e.push(dz(n))}function fz(e){const t=e||{},n=["> **"+uz(t.sourceRole,t.sourceTime)+"**"],r=Ok(t.text);return t.fromCode===!0?(n.push("> "+RR),j2(n,r),n.push("> "+AR)):j2(n,r),n.join(`
|
|
100
|
-
`)}function pz(e,t){if(!Array.isArray(e)||e.length===0)return t;const n=String(t||"").trim(),r=e.map(a=>fz(a)).join(`
|
|
101
|
-
|
|
102
|
-
`);return n?r+`
|
|
103
|
-
|
|
104
|
-
`+n:r}function Dk(e){return typeof e!="string"||e.charAt(0)!==">"?null:e.charAt(1)===" "?e.slice(2):e.slice(1)}function IR(e){if(e===null)return null;const t=sz.exec(e.trim());return t?t[0].slice(2,-2):null}function hz(e,t){const n=[];let r=t;for(;r<e.length;){const u=Dk(e[r]);if(u===null)break;n.push(u),r+=1}const a=n[n.length-1],o=n.length>=2&&n[0]===RR&&a===AR;return{body:(o?n.slice(1,-1):n).join(`
|
|
105
|
-
`),fromCode:o,next:r}}function gz(e){const t=[];let n=0,r=0;for(;n<e.length;){const a=IR(Dk(e[n]));if(a===null)break;const o=hz(e,n+1);t.push({header:a,body:o.body,fromCode:o.fromCode}),n=o.next,r=n,e[n]===""&&(n+=1)}return{quotes:t,end:r}}function mz(e,t){return t>=e.length?"":e.slice(t).join(`
|
|
106
|
-
`).replace(/^\n+/,"")}function xz(e){if(typeof e!="string"||e==="")return{quotes:[],rest:""};const t=e.split(`
|
|
107
|
-
`);if(IR(Dk(t[0]))===null)return{quotes:[],rest:e};const n=gz(t);return{quotes:n.quotes,rest:mz(t,n.end)}}function yz(e){if(!e||!e.anchorNode)return!1;const t=e.anchorNode,n=t.nodeType===1?t:t.parentElement;return!n||typeof n.closest!="function"?!1:!!(n.closest("pre")||n.closest("[data-code-block]"))}function bz(e){return typeof e=="string"&&e.trim()!==""}function vz(){const e=document.getSelection?document.getSelection():null;if(!e||!e.rangeCount||!e.getRangeAt)return null;const t=[];for(let n=0;n<e.rangeCount;n+=1)try{t.push(e.getRangeAt(n))}catch{}return t.length?t:null}function kz(e){if(e)try{const t=document.getSelection?document.getSelection():null;if(!t||!t.removeAllRanges||!t.addRange)return;t.removeAllRanges();for(let n=0;n<e.length;n+=1)t.addRange(e[n])}catch{}}function _z(e){let t=null;try{t=vz()}catch{}const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.style.position="fixed",n.style.top="-1000px";let r=!1,a=!1;try{document.body.appendChild(n),a=!0,n.select(),typeof document.execCommand=="function"&&(r=document.execCommand("copy")===!0)}catch{r=!1}try{a&&document.body.removeChild(n)}catch{}return kz(t),r}async function ap(e){if(!bz(e))return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}try{return _z(e)}catch{return!1}}const MR=e=>e&&e.type==="element"&&(e.tagName==="td"||e.tagName==="th");function LR(e,t){if(!e||e.type!=="element")return;if(e.tagName==="tr"){t.push(e);return}const n=e.children||[];for(let r=0;r<n.length;r++)LR(n[r],t)}function wz(e){let t=0,n=0;for(let o=0;o<e.length;o++)e.charAt(o)==="`"?(t+=1,t>n&&(n=t)):t=0;let r="";for(let o=0;o<=n;o++)r+="`";const a=e.charAt(0)==="`"||e.charAt(e.length-1)==="`"?" ":"";return r+a+e+a+r}function OR(e){if(!e)return"";if(e.type==="text")return e.value||"";const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=OR(t[r]);return n}function Fv(e,t){return e.properties&&e.properties[t]||""}function Sz(e,t){const n=Fv(e,"href");return n?`[${t}](${n})`:t}function Ez(e){const t=Fv(e,"src"),n=Fv(e,"alt");return t?``:""}const Nz={strong:["**","**"],em:["*","*"],del:["~~","~~"]};function Cz(e){if(!e)return"";if(e.type==="text")return(e.value||"").replace(/\\/g,"\\\\");if(e.type!=="element")return"";const t=e.tagName;if(t==="br")return" ";const n=DR(e);if(t==="code")return wz(OR(e));if(t==="a")return Sz(e,n);if(t==="img")return Ez(e);const r=Nz[t];return r?`${r[0]}${n}${r[1]}`:n}function DR(e){const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=Cz(t[r]);return n}function jz(e){return DR(e).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ").trim()}function Tz(e,t){const n=(e.children||[]).filter(MR),r=[];for(let a=0;a<t;a++){const o=n[a]&&n[a].properties&&n[a].properties.align;r.push(o==="center"?":---:":o==="right"?"---:":o==="left"?":---":"---")}return`| ${r.join(" | ")} |`}function Rz(e){if(!e||e.type!=="element"||e.tagName!=="table")return"";const t=[];if(LR(e,t),t.length===0)return"";const n=t.map(o=>(o.children||[]).filter(MR).map(jz));let r=0;for(let o=0;o<n.length;o++)n[o].length>r&&(r=n[o].length);if(r===0)return"";const a=n.map(o=>{const l=o.slice();for(;l.length<r;)l.push("");return`| ${l.join(" | ")} |`});return a.splice(1,0,Tz(t[0],r)),a.join(`
|
|
108
|
-
`)}const Az="bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5";function PR(e){if(!e)return null;var t=e.nodeType===1?e:e.parentElement;return!t||!t.closest?null:t.closest("[data-message-id]")}function Iz(e){if(typeof window>"u"||!window.getSelection)return"";var t=window.getSelection();if(!t||t.isCollapsed)return"";var n=String(t.toString());return n.trim()&&PR(t.anchorNode)===e?n:""}function Mz({node:e}){var[t,n]=y.useState(!1),r=y.useRef(null),a=y.useRef(!0);y.useEffect(function(){return a.current=!0,function(){a.current=!1,r.current&&clearTimeout(r.current)}},[]);var o=function(){ap(Rz(e)).then(function(l){!l||!a.current||(n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(function(){a.current&&n(!1)},2e3))})};return i.jsx("button",{type:"button",onMouseDown:function(l){l.preventDefault()},onClick:o,className:"px-2 py-0.5 rounded text-[10px] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500",title:t?"Copied!":"Copy table as Markdown","aria-label":t?"Copied!":"Copy table as Markdown",children:t?"Copied!":"Copy as Markdown"})}function T2(e){return{pre:function({node:t,children:n,...r}){if(y.isValidElement(n)){var a=n.type;if(a==="code"||typeof a=="string"&&a.toLowerCase()==="code"){var o=n.props||{},l=o.className||"",u=l.match(/language-(\S+)/),d=u?u[1]:"",f=bu(o.children);return i.jsx(Nf,{language:d,className:l,frameless:e,children:f})}}var p=bu(n);return p?i.jsx(Nf,{language:"",className:"",frameless:e,children:p}):i.jsx("pre",{...r,children:n})},code:function({node:t,className:n,children:r,...a}){if(n&&n.indexOf("language-")!==-1){var o=n.match(/language-(\S+)/),l=o?o[1]:"";return i.jsx(Nf,{language:l,className:n,frameless:e,children:bu(r)})}return i.jsx("code",{className:e?"px-1 py-0.5 rounded bg-gray-100 dark:bg-gray-700/50 text-sm font-mono":"px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-sm font-mono",...a,children:r})},a:function({node:t,children:n,href:r,...a}){return i.jsx("a",{href:r,...a,target:"_blank",rel:"noopener noreferrer",children:n})},table:function({node:t,children:n,...r}){return i.jsxs("div",{className:e?"my-3":"",children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsx("table",{className:e?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...r,children:n})}),i.jsx("div",{className:"flex justify-end mt-1",children:i.jsx(Mz,{node:t})})]})},th:function({node:t,children:n,...r}){return i.jsx("th",{className:e?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...r,children:n})},td:function({node:t,children:n,...r}){return i.jsx("td",{className:e?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...r,children:n})}}}function Lz({message:e,parts:t,streamingParts:n,user:r,searchQuery:a,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:p,onCancelQueued:g,hackerMode:m,mobileFrameless:x,hideThinking:v,isPrivate:k,isLast:_,isBusy:S,sessionID:E,questionIdMap:N,isCompactedOut:R,onQuoteAdd:T}){var{t:j}=rn(),I=e.role==="user",M=!I&&_&&!S?ez(t)!==null:!1,L=I&&e._queued===!0,A=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[O,F]=y.useState(!1),[Q,H]=y.useState(!1),[P,K]=y.useState(""),[W,Y]=y.useState(!1),ce=y.useRef(null),z=y.useRef(!0),G=y.useRef(null);y.useEffect(function(){var ke=G.current;!ke||!Q||(ke.style.height="auto",ke.style.height=Math.min(ke.scrollHeight,300)+"px")},[P,Q]),y.useEffect(function(){return z.current=!0,function(){z.current=!1,ce.current&&clearTimeout(ce.current)}},[]);var X=Lk(t,n,v),B=(t||[]).filter(function(ke){return ke.type==="tool"}),te=(t||[]).filter(function(ke){return ke.type==="file"&&ke.filename}),V=(t||[]).filter(function(ke){if(ke.type!=="image_url"||!ke.image_url)return!1;var Ce=ke.image_url.url||ke.image_url;if(typeof Ce!="string")return!1;if(Ce.startsWith("data:image/")){var Ye=Ce.indexOf(";"),xt=Ye>5?Ce.substring(5,Ye).toLowerCase():"",ie=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return ie.indexOf(xt)!==-1}if(Ce.startsWith("https://"))try{var Pe=new URL(Ce),$e=Pe.pathname.toLowerCase();return!$e.endsWith(".svg")&&!$e.endsWith(".svgz")}catch{return!1}return!1}),U=x&&!I,oe=y.useRef({current:0});oe.current={current:0};var ae=y.useRef(null);ae.current={searchQuery:a,matchCount:l,matchOffset:o,activeMatchIndex:u,registerMatchRef:d};var xe=y.useMemo(function(){return T2(U)},[U]),Se=y.useMemo(function(){if(!a)return null;var ke=xe,Ce=T2(U),Ye=function(xt){return function({children:ie,node:Pe,...$e}){var Tt=ae.current;return Tt.matchCount>0?i.jsx(xt,{...$e,children:Bv(ie,Tt.searchQuery,Tt.matchOffset,oe.current,Tt.activeMatchIndex,Tt.registerMatchRef)}):i.jsx(xt,{...$e,children:ie})}};return Ce.td=Ye(ke.td),Ce.th=Ye(ke.th),Ce.p=Ye("p"),Ce.li=Ye("li"),Ce.h1=Ye("h1"),Ce.h2=Ye("h2"),Ce.h3=Ye("h3"),Ce.h4=Ye("h4"),Ce.h5=Ye("h5"),Ce.h6=Ye("h6"),Ce.blockquote=Ye("blockquote"),Ce},[U,a,xe,oe,ae]);if(!I){var Xe=!!X,bt=V.length>0,at=B.length>0,yt=B.some(function(ke){if((ke.tool||ke.state&&ke.state.title||"")==="question")return!0;var Ce=ke.callID||ke.id||"";return!!(Ce&&N&&N[Ce])}),et=!m||yt,Ie=(t||[]).some(function(ke){return ke.type==="reasoning"&&ke.text}),Ge=!1;if(n)for(var tt=Object.keys(n),kt=0;kt<tt.length;kt++){var Kt=n[tt[kt]];if(Kt&&Kt.type==="reasoning"&&(Kt.text||Kt.delta)){Ge=!0;break}}var an=Ie||Ge,Vt=(t||[]).some(function(ke){return ke.type==="error"&&ke.text});if(!VB({hasText:Xe,hasImages:bt,hasTools:at,toolsVisibleHere:et,hasReasoning:an,hasError:Vt,isFrameless:x,hideThinking:v,finish:e.finish}))return null}var ze=Dz(e.time,j),De=e.isAutoInjected===!0,nt=e.isCompaction===!0,ft=e.isContinuation===!0,ue=nt&&!ft,be=I&&De&&!nt,qe=null,me="",pt="";if(be){var gt=String(X||""),wt=gt.split(`
|
|
109
|
-
`)[0]||"",ht=wt.indexOf("[session-mail from ")===0,$t=ht?gt.split(`
|
|
110
|
-
`).slice(1).join(`
|
|
111
|
-
`):gt;if(e.mailbox&&e.mailbox.senderSessionID)qe="mail",me=e.mailbox.senderSessionTitle||String(e.mailbox.senderSessionID).slice(0,10);else if(ht){var Wt=wt.slice(19),Je=Wt.indexOf(' — "'),zt=Wt,St="";Je!==-1&&(zt=Wt.slice(0,Je),St=Wt.slice(Je+4).replace('"]',"")),qe="mail",me=St||zt.replace(/\]$/,"").slice(0,10)}else e.injectedVia==="idle-injection"?qe="idle":e.injectedVia==="scheduled-injection"?qe="scheduled":qe="auto";pt=$t.replace(/\s+/g," ").trim(),pt.length>140&&(pt=pt.slice(0,139)+"…")}var Yt=function(){var ke=X||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(ke).then(function(){z.current&&(F(!0),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(function(){z.current&&F(!1)},2e3))}).catch(function(){z.current&&cn(ke)}):cn(ke)},cn=function(ke){var Ce=document.createElement("textarea");Ce.value=ke,Ce.style.position="fixed",Ce.style.opacity="0",document.body.appendChild(Ce),Ce.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(Ce)}z.current&&(F(!0),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(function(){z.current&&F(!1)},2e3))},xn=function(){K(X||""),H(!0)},Rn=function(){H(!1),K("")},re=function(){P.trim()&&(L&&g&&g(e.id),p&&p(P.trim())),H(!1),K("")},Te=function(ke){if(T){var Ce=PR(ke?ke.currentTarget:null),Ye=Ce?Iz(Ce):"";T({text:Ye||X||"",sourceMessageID:e.id,sourceRole:I?"user":"assistant",sourceTime:ze||"",fromCode:!1})}};if(qe&&!W)return i.jsxs("div",{className:"group flex items-center gap-2 px-1 py-1 min-w-0 cursor-pointer rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800/60 transition-colors","data-message-id":e.id,"data-message-role":I?"user":"assistant","data-message-time":ze||void 0,"data-injected-collapsed":"true",onClick:function(){Y(!0)},children:[i.jsxs("span",{className:"inline-flex items-center gap-1 shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 leading-none",children:[i.jsx("span",{"aria-hidden":"true",children:qe==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),qe==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),qe==="mail"&&me?i.jsx("span",{className:"shrink-0 max-w-[160px] truncate text-[11px] text-gray-500 dark:text-gray-400",children:me}):null,i.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-gray-600 dark:text-gray-300",children:pt||"…"}),i.jsx("button",{onMouseDown:function(ke){ke.preventDefault()},onClick:function(ke){ke.stopPropagation(),Yt()},className:"shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j(O?"chat.copied":"chat.copy_message"),title:j(O?"chat.copied":"chat.copy_message"),children:O?i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]});var rt=null;if(I){var Pt=ft?j("compaction.continuation_message_label")||"Compaction done. Please continue.":nt?j("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":X;if(a&&l>0&&!nt&&!ft)rt=Pz(X||"",a,o,u,d);else{var Be=xz(X||"");if(Be.quotes.length>0&&!nt&&!ft){var lt=Be.rest;rt=i.jsxs(y.Fragment,{children:[Be.quotes.map(function(ke,Ce){return i.jsxs("div",{"data-testid":"quoted-block",className:"border-l-4 pl-3 my-1 bg-white/10 rounded text-white/90 text-sm whitespace-pre-wrap break-words",children:[i.jsx("div",{className:"font-medium",children:ke.header}),i.jsx("div",{children:ke.body})]},"quote-"+Ce)}),lt?i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:lt}):null]})}else rt=i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Pt})}}return i.jsxs("div",{className:`group flex gap-3 ${I?"justify-end":"justify-start"} ${L?"opacity-60 italic":""}${R&&!ue?" opacity-60":""}`,"data-message-id":e.id,"data-message-role":I?"user":"assistant","data-message-time":ze||void 0,"data-compacted-out":R?"true":void 0,children:[!I&&!U&&i.jsx("div",{className:`shrink-0 w-7 h-7 rounded-lg flex items-center justify-center mt-1 ${k?"bg-emerald-600":"bg-primary-500"}`,title:k?"Private model (DLP)":void 0,children:k?i.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-7a2 2 0 00-2-2H6a2 2 0 00-2 2v7a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}):i.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),i.jsxs("div",{className:`flex flex-col min-w-0 ${U?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[i.jsx("div",{className:`min-w-0 overflow-hidden ${I?`${Az}${L&&!Q?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:U?"":`${k?"bg-emerald-50 dark:bg-emerald-950/40 ring-1 ring-emerald-500/30":"bg-gray-100 dark:bg-gray-800"} text-gray-900 dark:text-gray-100 rounded-2xl rounded-bl-md px-4 py-2.5`}`,...L&&!Q&&p&&g?{onClick:xn,title:j("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(ke){(ke.key==="Enter"||ke.key===" ")&&(ke.preventDefault(),xn())}}:{},children:I?Q?i.jsxs("div",{className:"space-y-2",children:[i.jsx("textarea",{ref:G,value:P,onChange:function(ke){K(ke.target.value)},className:"w-full bg-white/20 text-white placeholder-white/50 text-sm rounded-lg px-3 py-2 outline-hidden resize-none min-h-[60px] max-h-[300px] overflow-y-auto",rows:1,autoFocus:!0}),i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx("button",{onClick:Rn,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),i.jsx("button",{onClick:re,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):i.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[qe?i.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5 text-[11px] text-white/85",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 shrink-0 font-medium px-1.5 py-0.5 rounded-full bg-white/20 leading-none",children:[i.jsx("span",{"aria-hidden":"true",children:qe==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),qe==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),qe==="mail"&&me?i.jsx("span",{className:"max-w-[160px] truncate opacity-80",children:me}):null,i.jsx("button",{onClick:function(){Y(!1)},className:"p-0.5 rounded hover:bg-white/20 transition-colors focus:outline-hidden focus:ring-1 focus:ring-white/60","aria-label":"Collapse injected message",title:"Collapse",children:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})})]}):null,rt,te.length>0&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:te.map(function(ke,Ce){return i.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/15 border border-white/30 rounded-lg px-2 py-1 text-xs max-w-xs",title:ke.mime||"",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),i.jsx("span",{className:"truncate",children:ke.filename})]},ke.id||"file-"+Ce)})}),V.length>0&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:V.map(function(ke,Ce){var Ye=ke.image_url.url||ke.image_url;return i.jsx("a",{href:Ye,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Ye,alt:j("chat.attachment_with_index",{index:Ce+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ke.id||"img-"+Ce)})})]}):Oz(t,n,V,te,xe,Se,m,v,j,U,N,_,S,e.finish)}),M&&i.jsx(QB,{sessionId:E}),i.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${I?"justify-end":"justify-start"}`,children:[ze&&i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:ze}),De&&i.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 leading-none",children:j("chat.idle_injection_auto_badge")}),(!S||!_)&&(e.finish==="aborted"||e.finish==="interrupted")&&i.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400 leading-none",children:e.finish==="aborted"?j("chat.stopped_badge")||"Stopped":j("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&i.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-red-100 dark:bg-red-900/40 text-red-600 dark:text-red-400 leading-none",children:j("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&i.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full leading-none ${e.moeTopK<=4?"bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400":e.moeTopK<=6?"bg-amber-100 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400"}`,children:e.moeTopK<=4?"Fast":e.moeTopK<=6?"Balanced":"Quality"}),i.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto focus-within:opacity-100 focus-within:pointer-events-auto transition-opacity",children:[X&&i.jsx("button",{onMouseDown:function(ke){ke.preventDefault()},onClick:Yt,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j(O?"chat.copied":"chat.copy_message"),title:j(O?"chat.copied":"chat.copy_message"),children:O?i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),T&&!nt&&!ft&&i.jsx("button",{onClick:Te,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j("chat.quote_selection"),title:j("chat.quote_selection"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})})}),I&&!L&&!Q&&p&&i.jsx("button",{onClick:xn,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j("chat.edit_resend"),title:j("chat.edit_resend"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),I&&L&&!Q&&p&&g&&i.jsx("button",{onClick:xn,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j("chat.edit_resend"),title:j("chat.edit_resend"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),I&&L&&g&&i.jsx("button",{onClick:function(){g(e.id)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j("chat.cancel_queued"),title:j("chat.cancel_queued"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})}),!I&&f&&i.jsx("button",{onClick:f,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":j("chat.regenerate"),title:j("chat.regenerate"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]})]}),I&&i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center mt-1",children:i.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:A})})]})}function Oz(e,t,n,r,a,o,l,u,d,f,p,g,m,x){var v=(e||[]).slice();if(t){for(var k={},_=0;_<v.length;_++)k[v[_].id]=!0;for(var S=Object.keys(t),E=0;E<S.length;E++){var N=t[S[E]];(N.type==="text"||N.type==="reasoning")&&!k[N.id]&&v.push({id:N.id,type:N.type,text:N.text||N.delta||"",live:!0})}}var R=[],T="",j="",I=!1,M=0,L=0;function A(){T&&(R.push({type:"text",text:T,key:"text-"+M}),M+=1,T="")}function O(){j&&(R.push({type:"reasoning",text:j,key:"reasoning-"+L,live:I}),L+=1,j="",I=!1)}for(var F=0;F<v.length;F++){var Q=v[F];if(Q.type==="text"){O();var H=Q.text||"";T&&H&&!T.endsWith(`
|
|
112
|
-
`)&&(T+=`
|
|
113
|
-
`),T+=H}else if(Q.type==="reasoning"){A(),Q.live&&(I=!0);var P=Q.text||"";j&&P&&!j.endsWith(`
|
|
114
|
-
`)&&(j+=`
|
|
115
|
-
`),j+=P}else Q.type==="error"?(O(),A(),R.push({type:"error",text:Q.text||"",key:"error-"+(Q.id||F)})):Q.type==="tool"&&(O(),A(),R.push({type:"tool",part:Q,key:"tool-"+(Q.id||F)}))}if(O(),A(),r.length>0&&R.push({type:"files",parts:r,key:"files"}),n.length>0&&R.push({type:"images",parts:n,key:"images"}),R.length===0)return null;var K=[],W=[],Y="";function ce(){W.length>0&&(K.push(i.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:W},"accent-"+Y)),W=[])}for(var z=-1,G=R.length-1;G>=0;G--)if(R[G].type==="reasoning"){z=G;break}for(var X=0;X<R.length;X++){var B=R[X];if(B.type==="text"){ce();var te=o||a;K.push(i.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:i.jsx(lu,{remarkPlugins:[cu,uu],rehypePlugins:[uf],components:te,children:B.text})},B.key))}else if(B.type==="reasoning")if(f){if(ce(),u)continue;W.length===0&&(Y=B.key),W.push(i.jsx(WB,{text:B.text,isStreaming:B.live&&X===z&&g&&m},B.key))}else{if(ce(),u)continue;K.push(i.jsxs("div",{className:"my-2 p-3 rounded-lg bg-gray-100 dark:bg-gray-800 border-l-4 border-amber-500 dark:border-amber-400",children:[i.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),d("chat.thinking")]}),i.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:i.jsx(lu,{remarkPlugins:[cu,uu],rehypePlugins:[uf],components:a,children:B.text})})]},B.key))}else if(B.type==="error")ce(),x==="aborted"?K.push(i.jsxs("div",{className:"my-2 p-3 rounded-lg bg-orange-100 dark:bg-orange-900/40 border-l-4 border-orange-200 dark:border-orange-900",children:[i.jsxs("div",{className:"flex items-center gap-2 text-orange-600 dark:text-orange-400 text-xs font-medium uppercase tracking-wide",children:[i.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})]}),d("chat.stopped_notice")||"Stopped by user"]}),i.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-orange-600 dark:text-orange-400",children:i.jsx(lu,{remarkPlugins:[cu,uu],rehypePlugins:[uf],components:a,children:B.text})})]},B.key)):K.push(i.jsxs("div",{className:"my-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 dark:border-red-400",children:[i.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),d("chat.error_badge")||"Error"]}),i.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:i.jsx(lu,{remarkPlugins:[cu,uu],rehypePlugins:[uf],components:a,children:B.text})})]},B.key));else if(B.type==="tool"){var V=B.part.tool||B.part.state&&B.part.state.title||"",U=B.part.callID||B.part.id||"",oe=p&&U&&p[U]?p[U]:null,ae=V==="question"||!!oe;if(ae){ce();var xe=oe?oe.id:null;K.push(i.jsx("div",{className:"my-2",children:i.jsx(KB,{part:B.part,questionId:xe,questions:oe?oe.questions:null})},B.key))}else f&&!l?(W.length===0&&(Y=B.key),W.push(i.jsx($B,{part:B.part},B.key))):(ce(),K.push(i.jsx("div",{className:`my-2 ${l?"hidden":""}`,children:i.jsx(HB,{part:B.part})},B.key)))}else B.type==="files"?(ce(),K.push(i.jsx("div",{className:K.length>0?"mt-2":"",children:i.jsx("div",{className:"flex flex-wrap gap-2",children:B.parts.map(function(Se,Xe){return i.jsxs("div",{className:"inline-flex items-center gap-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm max-w-xs",title:Se.mime||"",children:[i.jsx("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),i.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:Se.filename})]},Se.id||"file-"+Xe)})})},B.key))):B.type==="images"&&K.push(i.jsx("div",{className:K.length>0?"mt-2":"",children:i.jsx("div",{className:"flex flex-wrap gap-2",children:B.parts.map(function(Se,Xe){var bt=Se.image_url.url||Se.image_url;return i.jsx("a",{href:bt,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:bt,alt:d("chat.attachment_with_index",{index:Xe+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},Se.id||"img-"+Xe)})})},B.key))}return ce(),K}function bu(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(bu).join(""):y.isValidElement(e)?bu(e.props.children):""}function Dz(e,t){if(!e)return"";var n=e.created||e.updated;if(!n)return"";var r=new Date(n);if(isNaN(r.getTime()))return"";var a=new Date,o=r.toDateString()===a.toDateString(),l=new Date(a);l.setDate(l.getDate()-1);var u=r.toDateString()===l.toDateString(),d=r.getHours(),f=r.getMinutes(),p=d>=12?"PM":"AM";d=d%12,d===0&&(d=12);var g=d+":"+(f<10?"0":"")+f+" "+p;if(o)return g;if(u)return t?t("chat.yesterday_time",{time:g}):"Yesterday "+g;var m=r.getMonth()+1,x=r.getDate();return m+"/"+x+" "+g}function Pz(e,t,n,r,a){if(!t||!e)return i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:e});for(var o=e.toLowerCase(),l=t.toLowerCase(),u=[],d=0,f=0;;){var p=o.indexOf(l,d);if(p===-1)break;p>d&&u.push(e.substring(d,p));var g=n+f,m=g===r;u.push(i.jsx("mark",{ref:function(x){a(g,x)},className:m?"bg-accent-400 text-gray-900 rounded-xs px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-xs px-0.5",children:e.substring(p,p+t.length)},"m-"+f)),f++,d=p+t.length}return d<e.length&&u.push(e.substring(d)),i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function Bv(e,t,n,r,a,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return i.jsx(y.Fragment,{children:Bv(k,t,n,r,a,o)},_)});if(typeof e=="string"){for(var l=e,u=l.toLowerCase(),d=t.toLowerCase(),f=[],p=0;;){var g=u.indexOf(d,p);if(g===-1)break;g>p&&f.push(l.substring(p,g));var m=n+r.current,x=m===a;f.push(i.jsx("mark",{ref:function(k){o(m,k)},className:x?"bg-accent-400 text-gray-900 rounded-xs px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-xs px-0.5",children:l.substring(g,g+t.length)},"m-"+r.current)),r.current++,p=g+t.length}return p<l.length&&f.push(l.substring(p)),f.length>0?f:l}if(y.isValidElement(e)){if(e.type==="code"||e.type===Nf)return e;if(e.props&&e.props.children!==void 0){var v=Bv(e.props.children,t,n,r,a,o);return y.cloneElement(e,void 0,v)}}return e}function Fz({sessionID:e,banners:t,hidden:n,onToggle:r}){var[a,o]=y.useState(0),[l,u]=y.useState(!1);if(y.useRef(null),y.useEffect(function(){o(0)},[e,t&&t.length,t&&t[0]&&t[0].timestamp]),!e||!t||t.length===0)return null;if(n)return i.jsx("button",{type:"button",onClick:r,className:"w-full text-center text-xs text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 py-1 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 transition-colors","aria-label":"Show banner",children:"▾ Show banner"});var d=t[a]||t[0],f=function(){o(function(g){return Math.min(t.length-1,g+1)})},p=function(){o(function(g){return Math.max(0,g-1)})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"sticky top-0 z-10 bg-white dark:bg-gray-900 group border-b border-gray-200 dark:border-gray-800",children:i.jsxs("div",{className:"relative w-full overflow-hidden cursor-zoom-in",style:{aspectRatio:"16 / 9",maxHeight:"20vh"},onClick:function(){u(!0)},title:d.prompt||"Session banner",children:[i.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?i.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent text-white text-xs px-3 py-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:i.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:function(g){g.stopPropagation(),f()},disabled:a>=t.length-1,className:"absolute left-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Older banner",children:"‹"}),i.jsx("button",{type:"button",onClick:function(g){g.stopPropagation(),p()},disabled:a<=0,className:"absolute right-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Newer banner",children:"›"}),i.jsx("div",{className:"absolute top-1 right-2 bg-black/40 text-white text-[10px] px-1.5 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:a+1+" / "+t.length})]}):null]})}),l?i.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-4 cursor-zoom-out",onClick:function(){u(!1)},children:[i.jsxs("div",{className:"max-w-5xl w-full",onClick:function(g){g.stopPropagation()},children:[i.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-auto rounded shadow-2xl",style:{aspectRatio:"16 / 9",objectFit:"cover"}}),d.prompt?i.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,i.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(a+1)+" of "+t.length:""]})]}),i.jsx("button",{type:"button",className:"absolute top-4 right-4 text-white text-2xl leading-none w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20",onClick:function(){u(!1)},"aria-label":"Close",children:"×"})]}):null]})}const Bz=y.forwardRef(function({messages:t,unloadedCompactedCount:n,onExpandCompactedHistory:r,hasOlderMessages:a,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:p,compactionResult:g,onSwitchToCompactedSession:m,onDismissCompactionResult:x,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:S,onRetry:E,onEditAndResend:N,onCancelQueued:R,hackerMode:T,mobileFrameless:j,hideThinking:I,sessionID:M,banners:L,bannerHidden:A,onToggleBanner:O,privateMessageIds:F,parentSessionID:Q,onViewParentSession:H,compactionPinned:P,onUnpinCompaction:K,questionIdMap:W,onQuoteAdd:Y},ce){const{t:z}=rn();var G=y.useRef(null),X=y.useRef(!0),B=y.useRef({}),te=y.useRef(null),V=y.useRef(null),[U,oe]=y.useState(!1),ae=y.useRef(-1),xe=y.useRef(0),Se=y.useRef(null),Xe=y.useRef(null),bt=y.useRef(t.length);bt.current=t.length;var[at,yt]=y.useState(!1),et=y.useRef({startIndex:0,endIndex:0}),Ie=y.useRef(null),Ge=y.useRef(!1),tt=y.useRef(0),kt=y.useRef(null);y.useEffect(function(){yt(!1),kt.current=null},[M]);var Kt=y.useCallback(function(){X.current=!0,V.current?V.current.scrollTop=V.current.scrollHeight:G.current&&G.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);y.useImperativeHandle(ce,function(){return{scrollToBottom:Kt,resetAutoScroll:function(){X.current=!0}}},[Kt]);var an=y.useCallback(function(Be,lt){lt?B.current[Be]=lt:delete B.current[Be]},[]),Vt=y.useRef({}),ze=y.useMemo(function(){if(!k)return{perMessage:{},total:0,_nextCache:{}};for(var Be=k.toLowerCase(),lt=0,ke={},Ce={},Ye=Vt.current,xt=0;xt<t.length;xt++){var ie=t[xt],Pe=tz(ie.parts,u[ie.info.id],I),$e=ie.info.role==="assistant",Tt=$e?nz(Pe):Pe,Ne=Tt.toLowerCase(),We=ie.info.id,Et=Ye[We],vn;Et&&Et.text===Ne&&Et.query===Be?vn=Et.count:vn=zz(Ne,Be),Ce[We]={text:Ne,query:Be,count:vn},vn>0&&(ke[ie.info.id]={offset:lt,count:vn,messageIndex:xt}),lt+=vn}return{perMessage:ke,total:lt,_nextCache:Ce}},[t,u,k,I]);y.useEffect(function(){Vt.current=ze._nextCache},[ze]);var De=y.useMemo(function(){return{perMessage:ze.perMessage,total:ze.total}},[ze]);y.useEffect(function(){S&&S(De.total)},[De.total,S]);var nt=y.useMemo(function(){for(var Be=0,lt=0;lt<t.length;lt++)t[lt].info.compactedOut===!0&&Be++;return Be},[t]),ft=y.useMemo(function(){return at||nt===0?t:t.filter(function(Be){return Be.info.compactedOut!==!0})},[t,at,nt]),ue=y.useRef(ft.length);ue.current=ft.length,y.useEffect(function(){if(!(!k||De.total===0||at||nt===0)){var Be=De.perMessage;for(var lt in Be)if(Be.hasOwnProperty(lt)&&Be[lt].messageIndex<nt){yt(!0);break}}},[k,De,at,nt]),y.useLayoutEffect(function(){if(Ie.current!=null&&G.current){var Be=Ie.current;if(Ie.current=null,Be<0||Be>=ft.length)return;var lt=requestAnimationFrame(function(){G.current&&G.current.scrollToIndex({index:Be,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(lt)}}},[ft]),y.useLayoutEffect(function(){var Be=kt.current;if(!(!Be||ft.length<=Be.count||!G.current)){kt.current=null;var lt=Be.index+(ft.length-Be.count),ke=requestAnimationFrame(function(){G.current&&G.current.scrollToIndex({index:lt,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(ke)}}},[ft]);var be=y.useCallback(function(){!l||o||(Ge.current=!0,kt.current={index:et.current.startIndex,count:ft.length},Promise.resolve(l()).then(function(Be){setTimeout(function(){var lt=kt.current;(!Be||Be.length===0||lt&&ue.current<=lt.count)&&(kt.current=null)},0)},function(){kt.current=null}))},[l,o,ft.length]),qe=y.useCallback(function(){if(Ge.current=!0,at){Ie.current=0,yt(!1);return}nt>0?(Ie.current=et.current.startIndex+nt,yt(!0)):n>0&&r&&(Ie.current=et.current.startIndex+n,yt(!0),r())},[at,nt,n,r]);y.useEffect(function(){var Be=ft.length>tt.current;if(tt.current=ft.length,!Be||!X.current||Ge.current){Ge.current=!1;return}var lt=setTimeout(function(){X.current&&V.current&&(V.current.scrollTop=V.current.scrollHeight)},150);return function(){clearTimeout(lt)}},[ft.length]),y.useEffect(function(){!X.current||k||V.current&&(V.current.scrollTop=V.current.scrollHeight)},[u,t,k]),y.useEffect(function(){var Be=Se.current!==M;Se.current=M,Be&&(X.current=!0,ae.current=-1,tt.current=0,xe.current=Date.now()+600,oe(!1));function lt(){X.current&&V.current&&(V.current.scrollTop=V.current.scrollHeight)}var ke=requestAnimationFrame(lt),Ce=setTimeout(lt,150),Ye=setTimeout(lt,450);return function(){cancelAnimationFrame(ke),clearTimeout(Ce),clearTimeout(Ye)}},[M,t]);var me=y.useCallback(function(){var Be=V.current;if(Be){var lt=Be.scrollTop,ke=lt+Be.clientHeight>=Be.scrollHeight-4;ke?X.current=!0:ae.current>=0&<<ae.current-8&&Date.now()>xe.current&&(X.current=!1),ae.current=lt,oe(!ke&&!X.current&&bt.current>0)}},[]),pt=y.useCallback(function(Be){!Be||Xe.current===Be||(Xe.current&&Xe.current.removeEventListener("scroll",me),Xe.current=Be,Be.addEventListener("scroll",me,{passive:!0}))},[me]);y.useEffect(function(){return function(){Xe.current&&Xe.current.removeEventListener("scroll",me)}},[me]);var gt=y.useMemo(function(){if(!k||De.total===0)return[];var Be=[],lt=De.perMessage;for(var ke in lt)lt.hasOwnProperty(ke)&&Be.push(lt[ke]);return Be.sort(function(Ce,Ye){return Ce.messageIndex-Ye.messageIndex}),Be},[k,De]);y.useEffect(function(){if(!(!k||De.total===0||_<0)){for(var Be=-1,lt=0;lt<gt.length;lt++){var ke=gt[lt];if(_>=ke.offset&&_<ke.offset+ke.count){Be=ke.messageIndex;break}}if(!(Be<0)){var Ce=at||nt===0?0:nt,Ye=Be-Ce;if(!(Ye<0)){G.current&&G.current.scrollToIndex({index:Ye,align:"center",behavior:"smooth"});var xt=requestAnimationFrame(function(){var ie=setTimeout(function(){var Pe=B.current[_];Pe&&Pe.scrollIntoView&&Pe.scrollIntoView({behavior:"smooth",block:"center"})},200);te.current=ie});return function(){cancelAnimationFrame(xt),te.current&&(clearTimeout(te.current),te.current=null)}}}}},[_,k,De.total,gt,at,nt]),y.useEffect(function(){B.current={}},[k]);for(var wt=-1,ht=ft.length-1;ht>=0;ht--)if(ft[ht].info.role==="assistant"){wt=ht;break}var $t=y.useCallback(function(Be){return k?!1:Be?f?"auto":"smooth":!1},[k,f]),Wt=y.useCallback(function(Be){Be&&(X.current=!0),oe(!Be&&!X.current&&bt.current>0)},[]),Je=y.useMemo(function(){return at&&nt>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[at,nt]),zt=y.useCallback(function(Be,lt){var ke=De.perMessage[lt.info.id]||null,Ce=Be===wt,Ye=lt.info.role==="user",xt=lt.info.compactedOut===!0,ie=at&&Be>0&&t[Be-1].info.compactedOut===!0,Pe=ie&&!xt;return i.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[Pe?i.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[i.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:z&&z("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),i.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,i.jsx(Lz,{isCompactedOut:xt,message:lt.info,parts:lt.parts,streamingParts:u[lt.info.id],user:v,searchQuery:k,matchOffset:ke?ke.offset:-1,matchCount:ke?ke.count:0,activeMatchIndex:_,registerMatchRef:an,isLast:Ce,isBusy:f,sessionID:M,onRetry:Ce&&!f&&!xt?E:void 0,onEditAndResend:Ye&&!f&&!xt&&!Uz(lt.parts)?N:void 0,onCancelQueued:xt?void 0:R,hackerMode:T,mobileFrameless:j,hideThinking:I,isPrivate:F&&F.has(lt.info.id),questionIdMap:W,onQuoteAdd:Y})]})},[De,wt,t,u,v,k,_,an,f,M,E,N,R,T,j,I,F,W,Y,at,z]),St=y.useMemo(function(){return i.jsxs(i.Fragment,{children:[f&&(j?!0:!qz(t,u,T,I))&&(j?i.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:i.jsx("svg",{className:"w-4 h-4 text-indigo-400 dark:text-indigo-300 shrink-0 animate-pulse",viewBox:"0 0 24 24",fill:"currentColor",role:"img","aria-label":z("chat.assistant_typing")||"Assistant is typing",children:i.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):i.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:i.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),i.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!j&&d&&d.toolCalls>0&&i.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:i.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),i.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-2 sm:px-4 py-3 min-w-0 max-w-[75%] sm:max-w-[320px]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:Hz(d.toolNames,z)}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:$z(d.toolArgBytes)})]}),i.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-accent-500 rounded-full animate-progress-indeterminate",style:{width:"40%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}})})]})]})]})},[f,j,t,u,d,T,I,z]),Yt=y.useMemo(function(){return function(){return i.jsxs(i.Fragment,{children:[i.jsx(Fz,{sessionID:M,banners:L,hidden:A,onToggle:O}),i.jsx(Vz,{sessionID:M,parentSessionID:Q,onViewParentSession:H,compactionPinned:P,onUnpinCompaction:K,t:z}),a?i.jsx("div",{className:"flex justify-center py-1.5",children:i.jsx("button",{type:"button",onClick:be,disabled:o,"data-testid":"load-older-messages",className:"px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors shadow-xs",children:o?z&&z("messages.loading_earlier")||"Loading earlier messages...":z&&z("messages.load_earlier")||"Load earlier messages"})}):null,nt>0||n>0?i.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:i.jsx("button",{type:"button",onClick:qe,"data-testid":"compaction-collapse-toggle",className:"pointer-events-auto px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 transition-colors shadow-xs",children:at&&nt>0?z&&z("compaction.hide_history")||"Hide messages before compaction":z&&z("compaction.show_history",{count:nt>0?nt:n})||"Conversation summarized — "+(nt>0?nt:n)+" earlier messages collapsed; summary below"})}):null]})}},[M,L,A,O,Q,H,P,K,z,a,o,be,nt,n,at,qe]),cn=y.useRef(St);cn.current=St;var xn=y.useRef(null);xn.current||(xn.current={version:0,listeners:new Set});var Rn=xn.current;y.useEffect(function(){Rn.version+=1,Rn.listeners.forEach(function(Be){Be()})},[St,Rn]);var re=y.useMemo(function(){return function(){return y.useSyncExternalStore(function(lt){return Rn.listeners.add(lt),function(){Rn.listeners.delete(lt)}},function(){return Rn.version}),cn.current}},[]),Te=y.useMemo(function(){return{Header:Yt,Footer:re}},[Yt,re]),rt=ft.length===0&&(nt>0||n>0),Pt=nt>0?nt:n;return rt?i.jsx("div",{className:"flex-1 relative overflow-hidden",children:i.jsx(Wz,{count:Pt,onExpand:qe,t:z})}):i.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[i.jsx(r5,{ref:G,scrollerRef:function(Be){V.current=Be,Be&&pt(Be)},data:ft,itemContent:zt,followOutput:$t,atBottomStateChange:Wt,rangeChanged:function(Be){et.current=Be},increaseViewportBy:Je,defaultItemHeight:120,computeItemKey:function(Be,lt){return lt.info.id},components:Te,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),U&&i.jsx("button",{onClick:Kt,"aria-label":z("chat.scroll_to_bottom"),className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow-lg flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-primary-500 transition-all",title:z("chat.scroll_to_bottom"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function zz(e,t){if(!t)return 0;for(var n=0,r=0;r=e.indexOf(t,r),r!==-1;)n++,r+=t.length;return n}function qz(e,t,n,r){var a=!n;for(var o of Object.keys(t)){var l=t[o];if(l){var u=Object.values(l).some(function(m){return m.type==="reasoning"&&r?!1:(m.type==="text"||m.type==="reasoning")&&(m.text||m.delta)});if(u)return!0}}for(var d=e.length-1;d>=0;d--){var f=e[d];if(f.info.role==="assistant"){var p=(f.parts||[]).some(function(m){return m.type==="reasoning"&&r?!1:(m.type==="text"||m.type==="reasoning")&&m.text}),g=(f.parts||[]).some(function(m){return m.type==="tool"});return p||a&&g}if(f.info.role==="user")break}return!1}function Uz(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function Hz(e,t){if(!e||e.length===0)return t?t("chat.tool_preparing"):"Preparing tool call";var n={write:t?t("chat.tool_write"):"Writing file",edit:t?t("chat.tool_edit"):"Editing file",read:t?t("chat.tool_read"):"Reading file",bash:t?t("chat.tool_bash"):"Running command",glob:t?t("chat.tool_glob"):"Searching files",grep:t?t("chat.tool_grep"):"Searching code"},r=e[0],a=n[r]||(t?t("chat.tool_preparing_name",{name:r}):"Preparing "+r);return e.length>1&&(a+=" +"+(e.length-1)),a}function $z(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function Wz({count:e,onExpand:t,t:n}){return i.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:i.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center mb-4",children:i.jsx("svg",{className:"w-6 h-6 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),i.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:n&&n("compaction.empty_title")||"This conversation was summarized"}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-5 leading-relaxed",children:n&&n("compaction.empty_body")||"Earlier messages are collapsed to save context. Show them to see the full history."}),i.jsx("button",{type:"button",onClick:t,"data-testid":"compaction-empty-expand",className:"px-4 py-2 rounded-lg text-xs font-medium bg-blue-500 text-white hover:bg-blue-600 focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors shadow-xs",children:n&&n("compaction.empty_action",{count:e})||"Show "+e+" earlier messages"})]})})}function Vz({sessionID:e,parentSessionID:t,onViewParentSession:n,compactionPinned:r,onUnpinCompaction:a,t:o}){var l="pave:compactionBannerDismissed:"+e,u=function(){try{return localStorage.getItem(l)==="1"}catch{return!1}},d=function(){try{localStorage.setItem(l,"1")}catch{}x(!0)},f=function(){n&&t&&n(t)},p=u(),g=y.useState(!p),m=g[0],x=g[1];return!t||m?null:i.jsx("div",{className:"px-2 sm:px-4 py-2 bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800/50",children:i.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2H7a2 2 0 00-2 2v2M9 11V7a3 3 0 016 0v4"})}),i.jsx("span",{className:"text-xs text-blue-700 dark:text-blue-300 flex-1 min-w-0",children:o&&o("compaction.banner_title")||"This session was compacted from a previous conversation."}),i.jsx("button",{type:"button",onClick:f,className:"text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline focus:outline-hidden focus:underline transition-colors whitespace-nowrap shrink-0",children:o&&o("compaction.view_original")||"View original"}),r?i.jsx("button",{type:"button",onClick:function(){a&&a(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-hidden focus:underline transition-colors whitespace-nowrap shrink-0",children:o&&o("chat.unpin_compacted")||"Unpin — go back to original"}):null,i.jsx("button",{type:"button",onClick:d,"aria-label":o&&o("compaction.dismiss")||"Dismiss",className:"text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-300 shrink-0 ml-1",children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const sp=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],FR=["text/plain","text/markdown","text/csv","application/json","application/xml","application/x-yaml","application/yaml","application/javascript","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.oasis.opendocument.spreadsheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.ms-excel","application/msword","application/vnd.ms-powerpoint","application/rtf","text/rtf"],BR=[...sp,...FR],zf=5,R2=Math.floor(4*1024*1024/1.34),A2=5*1024*1024,I2=6*1024*1024,M2=Math.floor(4*1024*1024/1.34),Gz=BR.join(",");function xg(e){return e?sp.indexOf(e.toLowerCase())!==-1:!1}var yg,L2;function Kz(){if(L2)return yg;L2=1;class e{constructor(n){n||(n={}),this._sampleRate=n.sampleRate||16e3,this._capacity=Math.max(1,Math.round((n.maxDuration||30)*this._sampleRate)),this._buffer=new Float32Array(this._capacity),this._start=0,this._length=0,this._totalAppended=0}get capacity(){return this._capacity}get length(){return this._length}get totalAppended(){return this._totalAppended}get sampleRate(){return this._sampleRate}append(n){if(!n||!(n instanceof Float32Array))throw new TypeError("append() requires a Float32Array argument");const r=n.length;if(r===0)return;if(this._totalAppended+=r,r>=this._capacity){const u=r-this._capacity;this._buffer.set(n.subarray(u,r)),this._start=0,this._length=this._capacity;return}const a=(this._start+this._length)%this._capacity,o=Math.min(r,this._capacity-a);this._buffer.set(n.subarray(0,o),a),o<r&&this._buffer.set(n.subarray(o,r),0);const l=this._length+r;if(l<=this._capacity)this._length=l;else{const u=l-this._capacity;this._start=(this._start+u)%this._capacity,this._length=this._capacity}}read(n,r){if(typeof n!="number"||n<0)throw new RangeError("read() offset must be >= 0, got "+n);if(typeof r!="number"||r<0)throw new RangeError("read() count must be >= 0, got "+r);if(n>=this._length||r===0)return new Float32Array(0);const a=Math.min(r,this._length-n),o=new Float32Array(a),l=(this._start+n)%this._capacity,u=Math.min(a,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<a&&o.set(this._buffer.subarray(0,a-u),u),o}trimBefore(n){(typeof n!="number"||n<0)&&(n=0),n>this._length&&(n=this._length),this._start=(this._start+n)%this._capacity,this._length-=n}clear(){this._start=0,this._length=0,this._totalAppended=0}}return yg={AudioRingBuffer:e},yg}var Yz=Kz(),bg,O2;function Qz(){if(O2)return bg;O2=1;class e{constructor(n){n||(n={}),this._sampleRate=n.sampleRate||16e3,this._chunkSamples=Math.round((n.chunkDuration||10)*this._sampleRate),this._overlapSamples=Math.round((n.overlapDuration||3)*this._sampleRate),this._minChunkSamples=Math.round((n.minChunkDuration||3)*this._sampleRate),this._maxInitialPrompt=n.maxInitialPrompt||200,this.reset()}get slotIndex(){return this._slotIndex}get pendingNewSamples(){return this._pendingNewSamples}get inflight(){return this._inflight}appendAndSchedule(n){if(this._inflight)return null;const r=n.totalAppended-this._lastSlotEndTotalAppended;this._pendingNewSamples=Math.max(0,r);const a=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<a?null:this._cutSlot(n)}reportResult(n){this._inflight&&(this._inflight=!1,this._prevText=n||"")}drain(n){if(this._inflight)return null;const r=n.totalAppended-this._lastSlotEndTotalAppended;return r<=0?null:this._cutSlot(n,r)}reset(){this._slotIndex=0,this._inflight=!1,this._pendingNewSamples=0,this._lastSlotEndTotalAppended=0,this._prevText="",this._drained=!1}clearPrevText(){this._prevText=""}_cutSlot(n,r){const a=this._slotIndex===0,o=n.totalAppended-n.length,l=a?0:Math.min(this._overlapSamples,Math.max(0,this._lastSlotEndTotalAppended-o)),u=r!=null?Math.min(r,n.totalAppended-this._lastSlotEndTotalAppended):Math.min(this._pendingNewSamples,n.totalAppended-this._lastSlotEndTotalAppended),d=l+u,f=Math.max(0,this._lastSlotEndTotalAppended-o-l),p=n.read(f,d);let g="";this._prevText.length>0&&(g=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio:p,overlapSamples:l,slotIndex:this._slotIndex,initialPrompt:g,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=u,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,m}}return bg={TranscriptionScheduler:e},bg}var Xz=Qz(),vg,D2;function Zz(){if(D2)return vg;D2=1;function e(n,r){const a=n.length,o=r.length;if(a===0)return o;if(o===0)return a;let l=new Array(o+1),u=new Array(o+1);for(let d=0;d<=o;d++)l[d]=d;for(let d=1;d<=a;d++){u[0]=d;for(let p=1;p<=o;p++){const g=n[d-1]===r[p-1]?0:1;u[p]=Math.min(u[p-1]+1,l[p]+1,l[p-1]+g)}const f=l;l=u,u=f}return l[o]}function t(n,r,a){if(!n)return r||"";if(!r)return"";const o=a&&a.maxOverlapChars||50,l=a&&typeof a.maxEditRatio=="number"?a.maxEditRatio:.2,u=Math.min(o,n.length,r.length);for(let d=u;d>=1;d--){const f=n.slice(-d),p=r.slice(0,d);if(e(f,p)/d<=l)return r.slice(d)}return r}return vg={dedupOverlap:t,levenshtein:e},vg}var Jz=Zz();const Tl=16e3;function ff(e,t,n,r){try{const a=localStorage.getItem(e);if(a==null||a==="")return t;const o=Number(a);return Number.isFinite(o)?Math.min(r,Math.max(n,o)):t}catch{return t}}const eq=2,tq=.6,nq=1,rq=200,P2=3,kg=2,iq=1e3,F2=.01,B2=800;function z2(e){if(!e||e.length===0)return 0;let t=0;for(let n=0;n<e.length;n++){const r=e[n];t+=r*r}return Math.sqrt(t/e.length)}function aq(e,t){const n=e.sampleRate,r=e.getChannelData(0);if(n===t)return new Float32Array(r);const a=n/t,o=Math.round(r.length/a),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*a,f=Math.floor(d),p=Math.min(f+1,r.length-1),g=d-f;l[u]=r[f]*(1-g)+r[p]*g}return l}function sq(e,t){const a=t*1*2,o=1*(16/8),l=e.length*o,u=new ArrayBuffer(44+l),d=new DataView(u);let f=0;for(let p=0;p<4;p++)d.setUint8(f++,"RIFF".charCodeAt(p));d.setUint32(f,36+l,!0),f+=4;for(let p=0;p<4;p++)d.setUint8(f++,"WAVE".charCodeAt(p));for(let p=0;p<4;p++)d.setUint8(f++,"fmt ".charCodeAt(p));d.setUint32(f,16,!0),f+=4,d.setUint16(f,1,!0),f+=2,d.setUint16(f,1,!0),f+=2,d.setUint32(f,t,!0),f+=4,d.setUint32(f,a,!0),f+=4,d.setUint16(f,o,!0),f+=2,d.setUint16(f,16,!0),f+=2;for(let p=0;p<4;p++)d.setUint8(f++,"data".charCodeAt(p));d.setUint32(f,l,!0),f+=4;for(let p=0;p<e.length;p++){const g=Math.max(-1,Math.min(1,e[p]));d.setInt16(f,g<0?g*32768:g*32767,!0),f+=2}return new Blob([u],{type:"audio/wav"})}function oq({onTranscript:e,onError:t,onAutoSubmit:n,language:r,model:a}){const[o,l]=y.useState("idle"),[u,d]=y.useState(0),[f,p]=y.useState(null),[g,m]=y.useState(null),[x,v]=y.useState(""),k=y.useRef(null),_=y.useRef(null),S=y.useRef(null),E=y.useRef(null),N=y.useRef(!1),R=y.useRef(null),T=y.useRef(null),j=y.useRef(null),I=y.useRef(null),M=y.useRef(null),L=y.useRef(null),A=y.useRef(0),O=y.useRef(!1),F=y.useRef(""),Q=y.useRef(!1),H=y.useRef(null),P=y.useRef(B2),K=y.useRef(null),W=y.useRef(!1),Y=y.useRef(""),ce=y.useRef(""),z=y.useRef("idle"),G=y.useCallback(ze=>{z.current=ze,l(ze)},[]),X=y.useRef(e),B=y.useRef(t),te=y.useRef(n),V=y.useRef(r),U=y.useRef(a);y.useEffect(()=>{X.current=e},[e]),y.useEffect(()=>{B.current=t},[t]),y.useEffect(()=>{te.current=n},[n]),y.useEffect(()=>{V.current=r},[r]),y.useEffect(()=>{U.current=a},[a]),y.useEffect(()=>{I.current&&(z.current==="recording"||z.current==="paused")&&I.current.clearPrevText()},[r]);const oe=y.useCallback(()=>M.current?Promise.resolve(M.current):(L.current||(L.current=hv().then(ze=>(M.current=ze,ze)).catch(()=>{const ze={mode:"auto",backendAvailable:!1};return M.current=ze,ze})),L.current),[]);y.useEffect(()=>{oe()},[oe]);const ae=y.useCallback(()=>{if(R.current&&(R.current.getTracks().forEach(ze=>ze.stop()),R.current=null),K.current){try{K.current.readyState===WebSocket.OPEN&&K.current.send("Done"),K.current.close()}catch{}K.current=null}W.current=!1},[]),xe=y.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),Se=y.useCallback(()=>{const ze=S.current,De=_.current,nt=E.current;if(ze){try{ze.disconnect()}catch{}ze.onaudioprocess=null,S.current=null}if(De){try{De.disconnect()}catch{}_.current=null}if(nt){try{nt.disconnect()}catch{}E.current=null}N.current=!1,ae(),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),xe(),j.current&&j.current.clear(),I.current&&I.current.reset(),A.current=0},[ae,xe]),Xe=y.useRef(null),bt=y.useRef(null),at=y.useRef(null),yt=y.useRef(null),et=y.useRef(null),Ie=y.useRef(null);Xe.current=function(De){const nt=De&&De.text||"";De&&De.chunkId;const ft=I.current,ue=De&&De._silent;ft&&ft.reportResult(nt);const be=Jz.dedupOverlap(F.current,nt);if(be){const qe=F.current+be;F.current=qe,v(qe),X.current&&X.current(be)}if(A.current=0,(ue||nt.trim()==="")&&F.current.trim()&&te.current&&te.current(),z.current==="draining"&&ft&&!ft.inflight){const qe=j.current,me=ft.drain(qe);me?yt.current(me):Ie.current();return}at.current()},bt.current=function(De){const nt=I.current;if(nt&&nt.reportResult(""),A.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",De,"("+A.current+"/"+P2+")"),A.current>=P2){Se(),G("idle"),B.current&&B.current("Voice transcription failed repeatedly. Please try again.");return}if(z.current==="draining"&&nt&&!nt.inflight){Ie.current();return}at.current()},at.current=function(){const De=I.current,nt=j.current;if(!De||!nt)return;const ft=z.current;if(ft!=="recording"&&ft!=="paused"&&ft!=="draining")return;const ue=De.appendAndSchedule(nt);if(ue){yt.current(ue);return}if((ft==="paused"||ft==="draining")&&!De.inflight){const be=De.drain(nt);be?yt.current(be):ft==="draining"&&Ie.current()}},yt.current=async function(De){const nt=z2(De.audio);if(nt<F2){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+nt.toFixed(6)+")"),Xe.current({text:"",chunkId:De.chunkId,_silent:!0});return}const ft=M.current||{mode:"auto",backendAvailable:!1},ue=ft.backendAvailable&&ft.mode!=="local-only",be=ft.mode!=="backend-only",qe=V.current,me=U.current;if(ue&&!O.current){const wt=sq(De.audio,Tl),ht={};De.initialPrompt&&(ht.initialPrompt=De.initialPrompt);let $t=null;for(let Wt=0;Wt<=kg;Wt++)try{const Je=await BL(wt,qe,me,ht);if(typeof Je.text=="string"){m("backend"),Xe.current({text:Je.text,chunkId:De.chunkId});return}}catch(Je){$t=Je;const zt=Je.status;if((zt===429||zt===503)&&Wt<kg){const St=iq*2**Wt;console.warn("[useContinuousVoiceInput] Backend "+zt+", retrying in "+St+"ms (attempt "+(Wt+1)+"/"+kg+")"),await new Promise(Yt=>{setTimeout(Yt,St)});continue}(zt===429||zt===503)&&(O.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!be){bt.current($t?$t.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",$t?$t.message:"unknown")}if(!be){bt.current("Backend transcription is not available and local mode is disabled.");return}const pt=et.current();m("local");const gt={type:"transcribe",audio:De.audio};qe&&(gt.language=qe),De.initialPrompt&&(gt.initialPrompt=De.initialPrompt),De.chunkId&&(gt.chunkId=De.chunkId),pt.postMessage(gt,[De.audio.buffer])},et.current=function(){if(k.current)return k.current;const De=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return De.onmessage=nt=>{const ft=nt.data;if(ft)switch(ft.type){case"loading":d(ft.progress||0),p(ft.file?ft.file.split("/").pop():null);break;case"ready":z.current==="loading"&&G("recording"),d(100),p(null);break;case"result":Xe.current(ft);break;case"error":bt.current(ft.error||"Transcription failed");break}},De.onerror=()=>{const nt=I.current;nt&&nt.reportResult(""),A.current+=1,xe();const ft=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});ft.onmessage=ue=>{const be=ue.data;if(be)switch(be.type){case"loading":d(be.progress||0),p(be.file?be.file.split("/").pop():null);break;case"ready":z.current==="loading"&&G("recording"),d(100),p(null),at.current();break;case"result":Xe.current(be);break;case"error":bt.current(be.error||"Transcription failed");break}},ft.onerror=()=>{ft.terminate(),k.current=null,Se(),G("idle"),F.current="",v(""),B.current&&B.current("Voice transcription worker crashed.")},k.current=ft},k.current=De,De},Ie.current=function(){const De=k.current;De&&De.postMessage({type:"unload"}),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),I.current&&I.current.reset(),j.current&&j.current.clear(),G("idle")};const Ge=y.useCallback(async()=>{if(z.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){B.current&&B.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){B.current&&B.current("Audio recording is not supported in this browser.");return}try{const ze=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:Tl,echoCancellation:!0,noiseSuppression:!0}});R.current=ze,M.current=null,L.current=null;const De=await oe(),nt=!!(De.streaming&&De.streaming.wsUrl),ft=!nt&&(De.mode==="local-only"||!De.backendAvailable&&De.mode!=="backend-only"),ue=window.AudioContext||window.webkitAudioContext;(!T.current||T.current.state==="closed")&&(T.current=new ue);const be=T.current;if(j.current=new Yz.AudioRingBuffer({maxDuration:30,sampleRate:Tl}),I.current=new Xz.TranscriptionScheduler({chunkDuration:ff("pave.asr.chunkDuration",eq,.5,30),overlapDuration:ff("pave.asr.overlapDuration",tq,0,10),minChunkDuration:ff("pave.asr.minChunkDuration",nq,.3,15),sampleRate:Tl,maxInitialPrompt:rq}),F.current="",v(""),A.current=0,O.current=!1,Q.current=!1,H.current=null,P.current=ff("pave.asr.vadSilenceMs",B2,200,5e3),Y.current="",ce.current="",W.current=nt,nt){const wt=(ht,$t)=>{if(!ht)return $t;if(!$t)return ht;const Wt=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test($t),Je=/\s$/.test(ht)||Wt?"":" ";return ht+Je+$t};try{const ht=new WebSocket(De.streaming.wsUrl);ht.binaryType="arraybuffer",K.current=ht,ht.onmessage=$t=>{let Wt="";try{Wt=typeof $t.data=="string"?$t.data:new TextDecoder().decode($t.data)}catch{return}if(Wt==="Done!")return;let Je="",zt=!1;try{const Yt=JSON.parse(Wt);Je=Yt&&typeof Yt.text=="string"?Yt.text:"",zt=!!(Yt&&Yt.is_final)}catch{Je=Wt}Je=(Je||"").trim();const St=wt(Y.current,Je);St&&St!==ce.current&&(ce.current=St,F.current=St,v(St),m("streaming"),X.current&&X.current(St,{mode:"snapshot",engine:De.streaming&&De.streaming.engine||"paraformer"})),zt&&Je&&(te.current?(Y.current="",ce.current="",F.current="",v(""),te.current()):Y.current=wt(Y.current,Je))},ht.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(ht){console.warn("[useContinuousVoiceInput] streaming connect failed:",ht),W.current=!1}}const qe=be.createMediaStreamSource(ze),pt=be.createScriptProcessor(4096,1,1),gt=be.createGain();gt.gain.value=0,qe.connect(pt),pt.connect(gt),gt.connect(be.destination),_.current=qe,S.current=pt,E.current=gt,N.current=!1,pt.onaudioprocess=wt=>{if(N.current)return;const ht=wt.inputBuffer,$t=ht.sampleRate,Wt=ht.getChannelData(0);let Je;if($t===Tl?Je=new Float32Array(Wt):Je=aq({sampleRate:$t,getChannelData:()=>Wt},Tl),Je.length===0)return;if(W.current&&K.current&&K.current.readyState===WebSocket.OPEN){const cn=new Float32Array(Je.length);cn.set(Je),K.current.send(cn.buffer);return}const zt=j.current;zt&&zt.append(Je);const St=z2(Je),Yt=performance.now();if(St>=F2)Q.current=!0,H.current=null;else if(Q.current){if(!H.current)H.current=Yt;else if(Yt-H.current>=P.current){Q.current=!1,H.current=null;const cn=I.current;if(cn&&!cn.inflight&&zt){const xn=cn.drain(zt);xn&&yt.current(xn)}}}at.current()},ft?(G("loading"),d(0),et.current().postMessage({type:"load"})):(G("recording"),d(100))}catch(ze){ae(),G("idle");const De=ze.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(ze.message||String(ze));B.current&&B.current(De)}}},[oe,ae]),tt=y.useCallback(()=>{const ze=z.current;if(ze==="loading"){Se(),xe(),G("idle");return}if(ze!=="recording"&&ze!=="paused")return;const De=S.current,nt=_.current,ft=E.current;if(De){try{De.disconnect()}catch{}De.onaudioprocess=null,S.current=null}if(nt){try{nt.disconnect()}catch{}_.current=null}if(ft){try{ft.disconnect()}catch{}E.current=null}ae(),G("draining"),setTimeout(()=>{const ue=I.current,be=j.current;if(!ue||!be){Ie.current();return}if(!ue.inflight){const qe=ue.drain(be);qe?yt.current(qe):Ie.current()}},0)},[ae,Se,xe]),kt=y.useCallback(()=>{z.current==="recording"&&(N.current=!0,G("paused"),at.current())},[]),Kt=y.useCallback(()=>{z.current==="paused"&&(N.current=!1,G("recording"))},[]),an=y.useCallback(()=>{z.current!=="idle"&&(Se(),xe(),F.current="",v(""),G("idle"))},[Se,xe]),Vt=y.useCallback(()=>{if(z.current!=="idle"){B.current&&B.current("Cannot clear cache while recording.");return}G("loading"),d(0),xe(),et.current().postMessage({type:"clearCache"})},[xe]);return y.useEffect(()=>()=>{Se(),xe()},[Se,xe]),{state:o,progress:u,downloadingFile:f,transcriptionSource:g,transcriptText:x,startRecording:Ge,stopRecording:tt,pauseRecording:kt,resumeRecording:Kt,cancelRecording:an,clearModelCache:Vt}}function lq({skills:e,builtins:t,filter:n,onSelect:r,visible:a,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=rn(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,n,e.length]),!a)return null;const g=(n||"").trim().toLowerCase();let m=[],x=!1;if(l){x=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>g?(_.name||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>g?(_.name||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>g?(_.skill||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g)||(_.commands||[]).some(S=>(S.name||"").toLowerCase().includes(g)||(S.description||"").toLowerCase().includes(g)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return i.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden z-50 flex flex-col",style:{maxHeight:"40vh"},children:[i.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400",role:"presentation",children:[x&&i.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 hover:text-gray-700 dark:hover:text-gray-200 transition-colors","aria-label":d("slashCommand.back"),children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),i.jsx("span",{className:"flex-1 text-right",children:x?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),i.jsx("div",{ref:p,className:"flex-1 min-h-0 overflow-y-auto",id:"slash-command-listbox",role:"listbox","aria-label":l?d("slashCommand.commands")+" — "+l:d("slashCommand.title"),children:m.length===0?i.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 dark:text-gray-500 text-center",children:d("slashCommand.noResults")}):m.map((v,k)=>{const _=k===o,S="slash-item-"+k;return i.jsx("div",{id:S,ref:_?f:null,role:"option","aria-selected":_,onClick:()=>{v.type==="skill"?r(v.skill,null):v.type==="builtin"?r("__builtin__",v.name):r(v.skill,v.name)},className:"flex items-center gap-3 px-3 py-2 cursor-pointer text-sm transition-colors "+(_?"bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"),children:v.type==="builtin"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:i.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"font-medium",children:["/",v.name]}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-xs font-medium text-gray-500 dark:text-gray-400",children:(v.skill||"?")[0].toUpperCase()}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&i.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),i.jsxs("div",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[v.commandCount," ",v.commandCount===1?d("slashCommand.command"):d("slashCommand.commands")]}),i.jsx("svg",{className:"w-4 h-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:i.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),i.jsxs("div",{className:"shrink-0 px-3 py-1.5 border-t border-gray-100 dark:border-gray-800 text-xs text-gray-400 dark:text-gray-500 flex gap-3",role:"presentation",children:[i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}function cq({quotes:e,onRemove:t,onClearAll:n}){var{t:r}=rn();function a(u){var d=u.sourceRole==="assistant"?r("chat.quoted_from_assistant"):r("chat.quoted_from_you");return u.sourceTime?d+" · "+u.sourceTime:d}function o(u){var d=typeof u.text=="string"?u.text:"";return d.replace(/\s+/g," ").trim()}function l(u){var d=typeof u.text=="string"?u.text:"";return d.slice(0-Pv.length)===Pv}return!Array.isArray(e)||e.length===0?null:i.jsxs("div",{"data-testid":"quote-composer",className:"mb-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r("chat.quote_selection")}),i.jsx("button",{type:"button",onClick:n,className:"text-[11px] text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-400",children:r("chat.quote_clear_all")})]}),e.map(function(u){return i.jsxs("div",{"data-testid":"quote-chip",className:"flex items-start gap-2 px-3 py-2 border-t border-gray-200 dark:border-gray-700 border-l-2 border-l-accent-400",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block text-[11px] font-medium text-gray-500 dark:text-gray-400 truncate",children:a(u)}),i.jsx("span",{className:"block text-xs text-gray-700 dark:text-gray-200 truncate",title:l(u)?r("chat.quote_truncated"):void 0,children:o(u)})]}),i.jsx("button",{type:"button",onClick:function(){t(u.qid)},"aria-label":r("chat.quote_remove"),className:"shrink-0 w-5 h-5 rounded-full text-gray-400 hover:text-red-500 hover:bg-gray-200 dark:hover:bg-gray-700 flex items-center justify-center",children:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},u.qid)})]})}const Cf=[{name:"btw",description:"By the way… — fork the current session and continue in a new one",takesArgs:!0},{name:"compact",description:"Compact the current session — summarize history into a new, shorter session",takesArgs:!1}];function uq(){return Cf.slice()}function dq(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Cf.length;n++)if(Cf[n].name===t)return Cf[n];return null}function fq(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("/"))return null;const n=t.match(/^\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/);if(!n)return null;const r=n[1].toLowerCase(),a=dq(r);if(!a)return null;const o=(n[2]||"").trim();return{name:r,args:o,builtin:a}}const pq=y.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:a,sessionId:o,queuedCount:l=0,onBuiltinCommand:u,pendingQuotes:d=[],onRemoveQuote:f,onClearQuotes:p},g){const{t:m}=rn(),[x,v]=y.useState(""),[k,_]=y.useState([]),[S,E]=y.useState(!1);y.useEffect(()=>{const ie=()=>E(!1);return window.addEventListener("pave:plan-execute",ie),()=>window.removeEventListener("pave:plan-execute",ie)},[]);const[N,R]=y.useState(null),[T,j]=y.useState([]),[I,M]=y.useState(""),[L,A]=y.useState(!1),O=y.useRef(null),F=y.useRef([]),[Q,H]=y.useState(-1),P="pave-asr-language",K=[{code:"auto",label:"Auto"},{code:"en",label:"English"},{code:"yue",label:"粵語"},{code:"zh",label:"普通話"},{code:"ja",label:"日本語"},{code:"ko",label:"한국어"},{code:"es",label:"Español"},{code:"fr",label:"Français"},{code:"de",label:"Deutsch"},{code:"fi",label:"Suomi"}],[W,Y]=y.useState(()=>{try{return localStorage.getItem(P)||"auto"}catch{return"auto"}}),[ce,z]=y.useState(!1),G=y.useRef(null),X=[{code:"whisper",label:"Whisper"},{code:"paraformer",label:"Paraformer"}],[B,te]=y.useState("whisper"),[V,U]=y.useState(!1),oe=y.useRef(null),ae=y.useRef(k),xe=y.useRef(null),Se=y.useRef(null),Xe=y.useRef(null),bt=y.useRef(o),at=y.useRef(x),yt=y.useRef(null),[et,Ie]=y.useState(!1),[Ge,tt]=y.useState(""),[kt,Kt]=y.useState([]),[an,Vt]=y.useState(0),[ze,De]=y.useState(null),nt=y.useRef({data:null,time:0}),ft=6e4,ue=y.useCallback(ie=>{R(ie),yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>R(null),5e3)},[]);y.useEffect(()=>()=>{yt.current&&clearTimeout(yt.current)},[]),y.useLayoutEffect(()=>{at.current=x},[x]),y.useLayoutEffect(()=>{bt.current=o,Xe.current&&(clearTimeout(Xe.current),Xe.current=null);let ie="";if(o)try{ie=localStorage.getItem(Xs+o)||""}catch{}return v(ie),at.current=ie,_(Pe=>(Pe.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview)}),[])),()=>{Xe.current&&(clearTimeout(Xe.current),Xe.current=null);const Pe=bt.current;if(Pe)try{at.current?localStorage.setItem(Xs+Pe,at.current):localStorage.removeItem(Xs+Pe)}catch{}}},[o]),y.useEffect(()=>{bt.current&&(Xe.current&&clearTimeout(Xe.current),Xe.current=setTimeout(()=>{try{x?localStorage.setItem(Xs+bt.current,x):localStorage.removeItem(Xs+bt.current)}catch{}},300))},[x]);const be=y.useCallback(async()=>{const ie=nt.current;if(ie.data&&Date.now()-ie.time<ft){Kt(ie.data);return}try{const Pe=await yL(),$e=Array.isArray(Pe)?Pe:[];nt.current={data:$e,time:Date.now()},Kt($e)}catch{Kt([])}},[]),qe=y.useMemo(()=>uq(),[]),me=y.useMemo(()=>{const ie=(Ge||"").trim().toLowerCase();if(ze){const Tt=kt.find(We=>We.skill===ze);return(Tt&&Tt.commands||[]).filter(We=>ie?(We.name||"").toLowerCase().includes(ie)||(We.description||"").toLowerCase().includes(ie):!0).map(We=>({type:"command",skill:ze,name:We.name}))}const Pe=qe.filter(Tt=>ie?(Tt.name||"").toLowerCase().includes(ie)||(Tt.description||"").toLowerCase().includes(ie):!0).map(Tt=>({type:"builtin",name:Tt.name})),$e=kt.filter(Tt=>ie?(Tt.skill||"").toLowerCase().includes(ie)||(Tt.description||"").toLowerCase().includes(ie)||(Tt.commands||[]).some(Ne=>(Ne.name||"").toLowerCase().includes(ie)||(Ne.description||"").toLowerCase().includes(ie)):!0).map(Tt=>({type:"skill",skill:Tt.skill}));return Pe.concat($e)},[Ge,ze,kt,qe]),pt=y.useCallback(()=>me.length,[me]),gt=y.useCallback(ie=>{if(v(ie),at.current=ie,ie.startsWith("/")){const Pe=ie.slice(1),$e=Pe.split(/\s/)[0]||"";if(!$e.includes("/")&&!$e.includes(".")){if(ze){const Tt=ze+" ";Pe.startsWith(Tt)?(tt(Pe.slice(Tt.length)),Vt(0)):(De(null),tt(Pe),Vt(0))}else tt(Pe),Vt(0);et||(be(),Ie(!0),Vt(0))}else Ie(!1),tt(""),De(null),Vt(0)}else Ie(!1),tt(""),De(null),Vt(0)},[et,ze,be]),wt=y.useCallback((ie,Pe)=>{var $e,Tt,Ne;if(ie==="__builtin__"&&Pe){v("/"+Pe+" "),Ie(!1),tt(""),De(null),Vt(0),($e=xe.current)==null||$e.focus();return}if(!Pe)De(ie),tt(""),Vt(0),v("/"+ie+" "),(Tt=xe.current)==null||Tt.focus();else{const We="/"+ie+" "+Pe+" ";v(We),Ie(!1),tt(""),De(null),Vt(0),(Ne=xe.current)==null||Ne.focus()}},[]),ht=y.useCallback(()=>{var ie;De(null),tt(""),Vt(0),v("/"),(ie=xe.current)==null||ie.focus()},[]),$t=y.useRef(""),Wt=y.useCallback((ie,Pe)=>{if(Pe&&Pe.mode==="snapshot"){const $e=$t.current||"",Tt=$e&&!$e.endsWith(" ")&&!$e.endsWith(`
|
|
116
|
-
`)?" ":"";v($e+Tt+(ie||""));return}v($e=>{const Tt=$e&&!$e.endsWith(" ")&&!$e.endsWith(`
|
|
117
|
-
`)?" ":"";return $e+Tt+ie})},[]),Je=y.useRef(null),zt=y.useCallback(()=>{$t.current="",setTimeout(()=>{Je.current&&Je.current()},50)},[]),{state:St,progress:Yt,downloadingFile:cn,startRecording:xn,stopRecording:Rn,resumeRecording:re,cancelRecording:Te}=oq({onTranscript:Wt,onError:ue,onAutoSubmit:zt,model:I||void 0,language:W&&W!=="auto"?W:void 0}),rt=y.useCallback(()=>(v(ie=>($t.current=ie||"",ie)),xn()),[xn]);y.useEffect(()=>{try{W&&localStorage.setItem(P,W)}catch{}},[W]),y.useEffect(()=>{if(!ce)return;const ie=Pe=>{G.current&&!G.current.contains(Pe.target)&&z(!1)};return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[ce]),y.useEffect(()=>{let ie=!1;return hv().then(Pe=>{ie||(Pe&&Array.isArray(Pe.models)&&Pe.models.length>0&&(j(Pe.models),M($e=>$e||Pe.models[0].name)),Pe&&(Pe.preferredEngine==="whisper"||Pe.preferredEngine==="paraformer")&&te(Pe.preferredEngine))}).catch(()=>{}),()=>{ie=!0}},[hv]),y.useEffect(()=>{if(!V)return;const ie=Pe=>{oe.current&&!oe.current.contains(Pe.target)&&U(!1)};return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[V]);const Pt=y.useCallback(ie=>{U(!1),te(Pe=>Pe===ie?Pe:(zL(ie).then(()=>{ie==="paraformer"&&ue("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{te(Pe),ue("Could not switch the speech engine — is the server reachable?")}),ie))},[ue]);y.useEffect(()=>{if(!L){H(-1);return}F.current.length=T.length;function ie($e){O.current&&!O.current.contains($e.target)&&A(!1)}function Pe($e){if($e.key==="Escape"){A(!1);return}$e.key!=="ArrowDown"&&$e.key!=="ArrowUp"&&$e.key!=="Home"&&$e.key!=="End"||($e.preventDefault(),H(Tt=>{const Ne=F.current.length;if(!Ne)return Tt;const We=typeof Tt=="number"?Tt:-1;let Et=We;return $e.key==="ArrowDown"?Et=We<Ne-1?We+1:0:$e.key==="ArrowUp"?Et=We>0?We-1:Ne-1:$e.key==="Home"?Et=0:$e.key==="End"&&(Et=Ne-1),F.current[Et]&&F.current[Et].focus(),Et}))}return document.addEventListener("mousedown",ie),document.addEventListener("keydown",Pe),()=>{document.removeEventListener("mousedown",ie),document.removeEventListener("keydown",Pe)}},[L,T.length]),y.useEffect(()=>{const ie=xe.current;ie&&(ie.style.height="auto",ie.style.height=Math.min(ie.scrollHeight,200)+"px")},[x]),y.useEffect(()=>{ae.current=k},[k]),y.useEffect(()=>{var ie;(ie=xe.current)==null||ie.focus()},[]),y.useImperativeHandle(g,()=>({focus:()=>{var ie;(ie=xe.current)==null||ie.focus()},setText:ie=>{v(typeof ie=="string"?ie:""),requestAnimationFrame(()=>{var Pe;return(Pe=xe.current)==null?void 0:Pe.focus()})}}),[]);const Be=async()=>{const ie=x.trim();var Pe=k.filter(function(We){return xg(We.type)}),$e=k.filter(function(We){return!xg(We.type)});const Tt=fq(ie);if(Tt&&typeof u=="function"){const We=bt.current;try{await u(Tt.name,Tt.args,{imageAttachments:Pe.length>0?Pe:void 0,fileAttachments:$e.length>0?$e:void 0})}catch{return}if(v(""),Ie(!1),tt(""),De(null),Vt(0),We)try{localStorage.removeItem(Xs+We)}catch{}k.forEach(function(Et){Et.preview&&URL.revokeObjectURL(Et.preview)}),_([]),xe.current&&(xe.current.style.height="auto");return}if(!ie&&Pe.length===0&&$e.length===0&&d.length===0)return;const Ne=bt.current;try{await t(ie,Pe.length>0?Pe:void 0,S?"plan":void 0,$e.length>0?$e:void 0)}catch{return}if(v(""),Ie(!1),tt(""),De(null),Vt(0),Ne)try{localStorage.removeItem(Xs+Ne)}catch{}k.forEach(function(We){We.preview&&URL.revokeObjectURL(We.preview)}),_([]),xe.current&&(xe.current.style.height="auto")};Je.current=Be;const lt=ie=>{if(et){const Pe=pt();if(ie.key==="ArrowDown"){Pe>0&&(ie.preventDefault(),Vt($e=>($e+1)%Pe));return}if(ie.key==="ArrowUp"){Pe>0&&(ie.preventDefault(),Vt($e=>($e-1+Pe)%Pe));return}if(ie.key==="Enter"||ie.key==="Tab"){if(Pe>0){ie.preventDefault();const $e=me[an];$e&&($e.type==="command"?wt($e.skill,$e.name):$e.type==="builtin"?wt("__builtin__",$e.name):wt($e.skill,null));return}if(ie.key==="Tab"){Ie(!1),tt(""),De(null),Vt(0);return}}if(ie.key==="Escape"){ie.preventDefault(),Ie(!1),tt(""),De(null),Vt(0);return}if(ie.key==="Backspace"&&ze){const $e=x.slice(1),Tt=ze+" ";if($e===Tt||$e===ze){ie.preventDefault(),ht();return}}}ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Be())},ke=ie=>{if(!a){var Pe=ie.clipboardData&&ie.clipboardData.items;if(Pe){for(var $e=[],Tt=0;Tt<Pe.length;Tt++){var Ne=(Pe[Tt].type||"").toLowerCase();if(sp.indexOf(Ne)!==-1){var We=Pe[Tt].getAsFile();We&&$e.push(We)}}if($e.length!==0){for(var Et=!1,vn=0;vn<Pe.length;vn++)if(Pe[vn].type&&Pe[vn].type.startsWith("text/")){Et=!0;break}Et||ie.preventDefault();var vr=$e.map(function(pn){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:pn,name:pn.name||"pasted-image.png",size:pn.size,type:pn.type,preview:null}});_(function(pn){var jn=zf-pn.length;if(jn<=0)return pn;for(var Fr=vr.slice(0,jn),pe=0;pe<Fr.length;pe++)Fr[pe].preview=URL.createObjectURL(Fr[pe].file);return pn.concat(Fr)})}}}},Ce=ie=>{const Pe=Array.from(ie.target.files||[]);if(Pe.length===0)return;const $e=Pe.filter(Ne=>BR.indexOf(Ne.type)!==-1);if($e.length===0){ie.target.value="";return}const Tt=$e.map(Ne=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Ne,name:Ne.name,size:Ne.size,type:Ne.type,preview:null}));_(Ne=>{var We=zf-Ne.length;if(We<=0)return Ne;for(var Et=Tt.slice(0,We),vn=0;vn<Et.length;vn++)Et[vn].preview=xg(Et[vn].file.type)?URL.createObjectURL(Et[vn].file):null;return[...Ne,...Et]}),ie.target.value=""},Ye=ie=>{_(Pe=>{const $e=Pe.find(Tt=>Tt.id===ie);return $e!=null&&$e.preview&&URL.revokeObjectURL($e.preview),Pe.filter(Tt=>Tt.id!==ie)})},xt=ie=>ie<1024?ie+" B":ie<1024*1024?(ie/1024).toFixed(1)+" KB":(ie/(1024*1024)).toFixed(1)+" MB";return y.useEffect(()=>()=>{ae.current.forEach(ie=>{ie.preview&&URL.revokeObjectURL(ie.preview)})},[]),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 px-2 sm:px-4 py-3",children:i.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[S&&i.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[i.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),i.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),i.jsx(cq,{quotes:d,onRemove:f,onClearAll:p}),k.length>0&&i.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:k.map(ie=>i.jsxs("div",{className:"relative group flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm",children:[ie.preview?i.jsx("img",{src:ie.preview,alt:ie.name,className:"w-10 h-10 rounded object-cover"}):i.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:ie.name}),i.jsx("p",{className:"text-xs text-gray-400",children:xt(ie.size)})]}),i.jsx("button",{onClick:()=>Ye(ie.id),"aria-label":`Remove attachment ${ie.name||""}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-gray-500 hover:bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},ie.id))}),i.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-end gap-1 sm:gap-2 bg-gray-100 dark:bg-gray-800 rounded-2xl px-3 py-2",children:[i.jsx(lq,{skills:kt,builtins:qe,filter:Ge,onSelect:wt,visible:et,selectedIndex:an,activeSkill:ze,onBack:ht}),i.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[i.jsx("button",{onClick:()=>{var ie;return(ie=Se.current)==null?void 0:ie.click()},disabled:a||r,className:"shrink-0 w-8 h-8 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 flex items-center justify-center transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",title:m("chat.attach_file"),"aria-label":m("chat.attach_file"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"})})}),i.jsx("input",{ref:Se,type:"file",multiple:!0,accept:Gz,onChange:Ce,className:"hidden"}),i.jsx("button",{onClick:St==="recording"?Rn:St==="paused"?re:St==="loading"?Te:rt,disabled:St==="draining"||(a||r)&&St!=="recording"&&St!=="loading"&&St!=="paused",className:"shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(St==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":St==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":St==="loading"||St==="draining"?"bg-gray-200 dark:bg-gray-700 text-gray-400 cursor-wait":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:St==="recording"?m("voice.stop_recording")||"Stop recording":St==="paused"?m("voice.resume_recording")||"Resume recording":St==="loading"?m("voice.loading_model"):St==="draining"?m("voice.processing")||"Processing remaining audio":m("voice.start_recording"),"aria-label":St==="recording"?m("voice.stop_recording")||"Stop recording":St==="paused"?m("voice.resume_recording")||"Resume recording":St==="loading"?m("voice.loading_model"):St==="draining"?m("voice.processing")||"Processing remaining audio":m("voice.start_recording"),children:St==="draining"?i.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):St==="loading"?i.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):St==="recording"?i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):St==="paused"?i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"6"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),St==="loading"&&i.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 bg-gray-800 dark:bg-gray-700 text-white text-xs px-2 py-1 rounded shadow-sm whitespace-nowrap flex items-center gap-2",children:[i.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${Yt}%`}})}),i.jsx("span",{children:cn?`${cn} ${Yt}%`:`${Yt}%`})]}),B==="whisper"&&i.jsxs("div",{className:"relative shrink-0",ref:G,children:[i.jsxs("button",{onClick:()=>z(ie=>!ie),disabled:St==="recording"||St==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition language","aria-label":"Select speech recognition language","aria-haspopup":"menu","aria-expanded":ce,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"})}),i.jsx("span",{className:"max-w-[80px] truncate",children:(K.find(ie=>ie.code===W)||K[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),ce&&i.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[180px] max-h-64 overflow-y-auto z-50",role:"menu","aria-label":"Speech recognition language",children:K.map(ie=>i.jsx("button",{role:"menuitemradio","aria-checked":ie.code===W,onClick:()=>{Y(ie.code),z(!1),ie.code==="yue"&&ue("Cantonese requires whisper-small or larger. If transcription is poor, this device may be using the tiny model (Safari, or older cached version).")},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(ie.code===W?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:ie.label},ie.code))})]}),i.jsxs("div",{className:"relative shrink-0",ref:oe,children:[i.jsxs("button",{onClick:()=>U(ie=>!ie),disabled:St==="recording"||St==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition engine","aria-label":"Select speech recognition engine","aria-haspopup":"menu","aria-expanded":V,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 010-5.304m5.304 0a3.75 3.75 0 010 5.304m-7.425 2.121a6.75 6.75 0 010-9.546m9.546 0a6.75 6.75 0 010 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),i.jsx("span",{className:"max-w-[90px] truncate",children:(X.find(ie=>ie.code===B)||X[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),V&&i.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[200px] z-50",role:"menu","aria-label":"Speech recognition engine",children:X.map(ie=>i.jsxs("button",{role:"menuitemradio","aria-checked":ie.code===B,onClick:()=>Pt(ie.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(ie.code===B?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[i.jsx("div",{children:ie.label}),i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:ie.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},ie.code))})]}),B==="whisper"&&T.length>1&&i.jsxs("div",{className:"relative shrink-0",ref:O,children:[i.jsxs("button",{onClick:()=>A(ie=>!ie),disabled:St==="recording"||St==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:m("voice.select_asr_model"),"aria-label":m("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":L,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),i.jsx("span",{className:"max-w-[80px] truncate",children:(T.find(ie=>ie.name===I)||T[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),L&&i.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[160px] z-50",role:"menu","aria-label":m("voice.select_asr_model"),children:T.map((ie,Pe)=>i.jsxs("button",{ref:$e=>{F.current[Pe]=$e},role:"menuitemradio","aria-checked":ie.name===I,tabIndex:Q===Pe?0:-1,onClick:()=>{M(ie.name),A(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(ie.name===I?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[ie.label,ie.type!=="openai"&&i.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",ie.type,")"]})]},`${ie.name}-${Pe}`))})]}),i.jsxs("button",{onClick:()=>E(ie=>!ie),disabled:a||r,className:"shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(S?"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 ring-1 ring-amber-300 dark:ring-amber-700":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:S?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":S?"Disable plan mode":"Enable plan mode","aria-pressed":S,children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),S?"Plan":""]})]}),i.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[i.jsx("textarea",{ref:xe,value:x,onChange:ie=>gt(ie.target.value),onKeyDown:lt,onPaste:ke,placeholder:m("chat.send_placeholder"),disabled:a,rows:1,role:et?"combobox":void 0,"aria-controls":et?"slash-command-listbox":void 0,"aria-activedescendant":et&&pt()>0?"slash-item-"+an:void 0,"aria-expanded":et||void 0,className:"flex-1 bg-transparent resize-none outline-hidden text-sm py-1.5 min-h-[32px] text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 max-h-[200px]"}),r&&i.jsx("button",{onClick:n,className:"shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:m("chat.stop_generating"),"aria-label":m("chat.stop_generating"),children:i.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),i.jsxs("button",{onClick:Be,disabled:!x.trim()&&k.length===0||a,className:"relative shrink-0 w-8 h-8 rounded-full bg-accent-400 hover:bg-accent-500 disabled:bg-gray-300 dark:disabled:bg-gray-600 flex items-center justify-center transition-colors",title:r?"Queue message (will send when current finishes)":m("chat.send_button"),"aria-label":r?"Queue message":m("chat.send_button"),"aria-disabled":!x.trim()&&k.length===0||a?"true":void 0,children:[i.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),l>0&&i.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-amber-500 text-white text-[10px] font-bold flex items-center justify-center ring-2 ring-white dark:ring-gray-800","aria-label":`${l} message${l===1?"":"s"} queued`,children:l})]})]})]}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:m("chat.send_hint")}),N&&i.jsxs("div",{role:"alert",className:"mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 text-sm rounded-lg flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),i.jsx("span",{children:N}),i.jsx("button",{onClick:()=>R(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":m("voice.dismiss_error"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})}),hq="px-4 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex items-center justify-center gap-2",gq="text-sm text-gray-500 dark:text-gray-400",mq="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",_g="w-4 h-4 text-gray-400 dark:text-gray-500",xq="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4",yq="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8",bq="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z";function q2({variant:e,label:t,childSessionId:n,onSwitchToChild:r}){let a=null,o=i.jsx("span",{className:gq,children:t});return e==="compacted"?(a=i.jsx("svg",{className:_g,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:xq})}),n&&(o=i.jsx("button",{onClick:r,className:mq,children:t}))):e==="archive"?a=i.jsx("svg",{className:_g,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:yq})}):e==="terminal"&&(a=i.jsx("svg",{className:_g,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:bq})})),i.jsxs("div",{className:hq,children:[a,o]})}function vq(e){e.cfaccess&&(window.location.href="/cdn-cgi/access/login/"+window.location.host)}function kq({enabled:e,tf:t}){return e?i.jsxs("button",{type:"button",onClick:()=>{window.location.href="/cdn-cgi/access/login/"+window.location.host},className:"flex items-center justify-center gap-3 w-full py-2.5 px-4 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 font-medium text-sm transition-colors",children:[i.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",fill:"#F6821F",children:[i.jsx("path",{d:"16.52 17.28c.17-.55.02-1.1-.4-1.48a1.8 1.8 0 0 0-1.28-.52l-7.7-.02a.32.32 0 0 1-.27-.15.3.3 0 0 1-.04-.28c.06-.13.18-.22.32-.23l7.86-.02c1.64-.07 3.1-1.35 3.4-3 .35-1.82-.72-3.46-2.42-3.83-.1 0-.2-.02-.3-.02h-.62c-.17 0-.3-.13-.33-.3a.33.33 0 0 1 .22-.36c.1-.04.2-.06.3-.06.2 0 .42-.02.63-.02 2.57 0 4.66 1.96 4.66 4.37 0 2.26-1.76 4.06-4.05 4.06z"}),i.jsx("path",{d:"M4.8 16.5a.4.4 0 0 1-.2-.24A3.62 3.62 0 0 1 6.4 12a.44.44 0 0 1 .24-.06h11.5c.13 0 .24.1.26.23.02.13-.06.25-.18.3l-.08.02H6.72c-1.1.07-1.94 1.06-1.92 2.25v.03c-.6-.15-1.02-.63-1.02-1.2 0-.2.05-.4.14-.58-.5.5-.76 1.18-.7 1.86.05.67.43 1.27 1.02 1.64h.56z"})]}),t("login.sign_in_with_cloudflare","Sign in with Cloudflare Access")]}):null}function _q({darkMode:e,onToggleTheme:t}){const{t:n}=rn(),r=(k,_)=>{const S=n(k);return S===k?_:S},[a,o]=y.useState(""),[l,u]=y.useState(""),[d,f]=y.useState(!1),[p,g]=y.useState(null),[m,x]=y.useState({google:!1,password:!1,cfaccess:!1});y.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("auth_error");k&&(g(decodeURIComponent(k)),window.history.replaceState({},"",window.location.pathname))},[]),y.useEffect(()=>{fetch(wr("/auth/status")).then(k=>k.json()).then(k=>{const _={google:!!(k.providers&&k.providers.google),password:!!(k.providers&&k.providers.password),cfaccess:!!(k.providers&&k.providers.cfaccess)};x(_),vq(_)}).catch(()=>{})},[]);const v=async k=>{k.preventDefault(),g(null),f(!0);try{const _=await fetch(wr("/auth/membership/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,password:l})}),S=await _.json().catch(()=>({}));if(!_.ok){g(S.error||"Login failed"),f(!1);return}window.location.reload()}catch(_){g("Connection error: "+_.message),f(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[i.jsx("div",{className:"flex justify-end p-4",children:i.jsx("button",{onClick:t,className:"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",title:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),children:e?i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}),i.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:i.jsxs("div",{className:"w-full max-w-sm",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:i.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),i.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-950 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-xs ring-1 ring-accent-400/20",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),p&&i.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border border-red-200 dark:border-red-800",children:p}),m.google&&i.jsxs("button",{type:"button",onClick:()=>{window.location.href=wr("/auth/google/start")},className:"flex items-center justify-center gap-3 w-full py-2.5 px-4 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 font-medium text-sm transition-colors",children:[i.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",children:[i.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.27-4.74 3.27-8.1z"}),i.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.99.66-2.26 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23z"}),i.jsx("path",{fill:"#FBBC05",d:"M5.84 14.1a6.6 6.6 0 0 1 0-4.2V7.06H2.18a11 11 0 0 0 0 9.88l3.66-2.84z"}),i.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"})]}),r("login.sign_in_with_google","Sign in with Google")]}),i.jsx(kq,{enabled:m.cfaccess,tf:r}),m.google&&m.password&&i.jsxs("div",{className:"flex items-center gap-3 my-4",children:[i.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),i.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),m.password&&i.jsxs("form",{onSubmit:v,className:"space-y-3 mb-4",children:[i.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:a,onChange:k=>o(k.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),i.jsx("input",{type:"password",placeholder:r("login.password_placeholder","Password"),value:l,onChange:k=>u(k.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),i.jsx("button",{type:"submit",disabled:d,className:"w-full py-2.5 px-4 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?r("login.signing_in","Signing in..."):n("login.sign_in")})]}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function wq({user:e,onLogout:t,onSkillManagement:n,onPricingSettings:r,onDlpSettings:a,onSettings:o,onBoard:l,onCapabilities:u}){const{t:d}=rn(),[f,p]=y.useState(!1),g=y.useRef(null);if(y.useEffect(()=>{if(!f)return;function x(v){g.current&&!g.current.contains(v.target)&&p(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[f]),!e)return null;const m=(e.name||e.email||"?").split(" ").map(x=>x[0]).join("").slice(0,2).toUpperCase();return i.jsxs("div",{className:"relative",ref:g,children:[i.jsxs("button",{onClick:()=>p(!f),className:"flex items-center gap-2 px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:e.email,"aria-label":e.name||e.email||d("user_menu.title"),children:[e.picture?i.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):i.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),i.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),i.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&i.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 py-1",children:[i.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&i.jsxs("button",{type:"button",onClick:()=>{p(!1),n()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),d("user_menu.skills")]}),l&&i.jsxs("button",{type:"button",onClick:()=>{p(!1),l()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),d("user_menu.board")]}),u&&i.jsxs("button",{type:"button",onClick:()=>{p(!1),u()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),d("user_menu.capabilities")]}),o&&i.jsxs("button",{onClick:()=>{p(!1),o()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[i.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&i.jsx("button",{onClick:()=>{p(!1),t()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:d("user_menu.sign_out")})]})]})}function Sq({toolParts:e}){const{t}=rn();return!e||e.length===0?i.jsxs("div",{className:"p-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):i.jsxs("div",{className:"p-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),i.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>i.jsx(Eq,{part:n},n.id))})]})}function Eq({part:e}){var a,o;const t=((a=e.state)==null?void 0:a.status)||"running",n=((o=e.state)==null?void 0:o.input)||{},r=Nq(e.tool,n);return i.jsxs("div",{className:"flex items-center gap-2 py-1",children:[i.jsxs("div",{className:"shrink-0",children:[t==="running"&&i.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&i.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&i.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),i.jsx("span",{className:`text-xs truncate ${t==="running"?"text-gray-800 dark:text-gray-200":t==="error"?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"}`,children:r})]})}function Nq(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+pf(t.filePath);case"Write":return"Writing "+pf(t.filePath);case"Edit":return"Editing "+pf(t.filePath);case"Bash":{const n=t.command||"";return U2(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+zv(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+zv(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return Cq(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+pf(t.filePath):t.command?U2(t.command):"Running "+e.toLowerCase()}}function pf(e){if(!e)return"file";const t=e.split("/"),n=t[t.length-1]||"file";return t.length<=2?n:t[t.length-2]+"/"+n}function U2(e){if(!e)return"Running command";const t=e.trim();if(/^(ls|dir)\b/i.test(t))return"Listing files";if(/^(cat|less|more)\b/i.test(t))return"Reading file contents";if(/^(mkdir)\b/i.test(t))return"Creating directory";if(/^(rm|del)\b/i.test(t))return"Removing files";if(/^(cp|copy)\b/i.test(t))return"Copying files";if(/^(mv|move|rename)\b/i.test(t))return"Moving files";if(/^(git\s+status)\b/i.test(t))return"Checking git status";if(/^(git\s+log)\b/i.test(t))return"Viewing git history";if(/^(git\s+diff)\b/i.test(t))return"Comparing changes";if(/^(git\s+add)\b/i.test(t))return"Staging changes";if(/^(git\s+commit)\b/i.test(t))return"Committing changes";if(/^(git\s+push)\b/i.test(t))return"Pushing to remote";if(/^(git\s+pull)\b/i.test(t))return"Pulling from remote";if(/^(git\s+clone)\b/i.test(t))return"Cloning repository";if(/^(git\s+checkout|git\s+switch)\b/i.test(t))return"Switching branches";if(/^(git\s+branch)\b/i.test(t))return"Managing branches";if(/^git\b/i.test(t))return"Running git command";if(/^(npm\s+install|npm\s+i|yarn\s+install|yarn\s+add|pnpm\s+install)\b/i.test(t))return"Installing dependencies";if(/^(npm\s+run\s+build|yarn\s+build|pnpm\s+build)\b/i.test(t))return"Building project";if(/^(npm\s+run\s+test|npm\s+test|yarn\s+test|jest|pytest|mocha)\b/i.test(t))return"Running tests";if(/^(npm\s+run\s+dev|npm\s+start|yarn\s+dev|yarn\s+start)\b/i.test(t))return"Starting dev server";if(/^(npm|yarn|pnpm)\b/i.test(t))return"Running package manager";if(/^(node|python|ruby|php|java)\b/i.test(t))return"Running script";if(/^(docker)\b/i.test(t))return"Running Docker command";if(/^(curl|wget)\b/i.test(t))return"Fetching URL";if(/^(chmod|chown)\b/i.test(t))return"Changing permissions";if(/^(find|locate)\b/i.test(t))return"Finding files";if(/^(grep|rg|ag)\b/i.test(t))return"Searching file contents";if(/^(sed|awk)\b/i.test(t))return"Processing text";if(/^(echo|printf)\b/i.test(t))return"Running command";if(/^(ssh|scp)\b/i.test(t))return"Connecting remotely";if(/^(ping|traceroute|nslookup|dig)\b/i.test(t))return"Checking network";if(/^(tar|zip|unzip|gzip)\b/i.test(t))return"Compressing/extracting files";const n=t.split(/\s+/)[0];return"Running "+zv(n,20)}function Cq(e,t){const n=(e||"").toLowerCase();return n.includes("gmail")||n.includes("email")?"Checking email":n.includes("gdrive")||n.includes("drive")?"Accessing Google Drive":n.includes("gcal")||n.includes("calendar")?"Checking calendar":n.includes("gtasks")||n.includes("tasks")?"Managing tasks":n.includes("discord")?"Using Discord":n.includes("whatsapp")?"Using WhatsApp":n.includes("wrike")?"Checking Wrike":n.includes("dropbox")?"Accessing Dropbox":n.includes("pandadoc")?"Working with PandaDoc":n.includes("freshbooks")?"Checking FreshBooks":n.includes("mailchimp")?"Using Mailchimp":n.includes("bamboohr")?"Checking BambooHR":e?"Using "+e:"Running skill"}function zv(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const qv=10,Uv=24,H2=2,jq=14,zR="pave-terminal-font-size";function Tq(){try{const e=localStorage.getItem(zR);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=qv&&t<=Uv)return t}}catch{}return jq}function Rq({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=rn();const o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[d,f]=y.useState(Tq),p=y.useCallback(()=>{f(k=>Math.max(qv,k-H2))},[]),g=y.useCallback(()=>{f(k=>Math.min(Uv,k+H2))},[]);y.useEffect(()=>{try{localStorage.setItem(zR,String(d))}catch{}},[d]);const m=r?{bg:"bg-gray-950",headerBg:"bg-gray-900",headerBorder:"border-gray-800",titleText:"text-gray-400",promptColor:"text-green-400",commandColor:"text-gray-200",outputColor:"text-green-300/70",waitingText:"text-gray-500",runningColor:"text-yellow-400",doneColor:"text-green-500",errorColor:"text-red-400",pendingColor:"text-blue-400"}:{bg:"bg-gray-100",headerBg:"bg-gray-200",headerBorder:"border-gray-300",titleText:"text-gray-600",promptColor:"text-green-600",commandColor:"text-gray-800",outputColor:"text-green-700/80",waitingText:"text-gray-500",runningColor:"text-yellow-600",doneColor:"text-green-600",errorColor:"text-red-600",pendingColor:"text-blue-600"},x=`px-1.5 py-0.5 text-xs font-mono rounded ${r?"bg-gray-600 text-gray-300 hover:bg-gray-500":"bg-gray-300 text-gray-700 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-default`;y.useEffect(()=>{o.current&&!t&&(o.current.scrollTop=o.current.scrollHeight)},[e,t]);const v=y.useCallback(()=>{const k=l.current;if(!k)return;const _=k.getContext("2d");if(!_)return;const S=()=>{const M=k.parentElement;if(M&&M.clientWidth>0&&M.clientHeight>0){k.width=M.clientWidth,k.height=M.clientHeight;return}const L=k.getBoundingClientRect();if(L.width>0&&L.height>0){k.width=L.width,k.height=L.height;return}k.width=0,k.height=0};S();const E=d;let N=Math.floor(k.width/E),R=new Array(N).fill(1);const T="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",j=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=E+"px monospace";for(let M=0;M<R.length;M++){const L=T.charAt(Math.floor(Math.random()*T.length));_.fillText(L,M*E,R[M]*E),R[M]*E>k.height&&Math.random()>.975&&(R[M]=0),R[M]++}u.current=requestAnimationFrame(j)},I=()=>{S(),N=Math.floor(k.width/E);const M=new Array(N).fill(0);for(let L=0;L<Math.min(R.length,M.length);L++)M[L]=R[L];R=M};return window.addEventListener("resize",I),u.current=requestAnimationFrame(j),()=>{window.removeEventListener("resize",I),u.current&&cancelAnimationFrame(u.current)}},[d]);return y.useEffect(()=>{let k;return t?k=v():u.current&&(cancelAnimationFrame(u.current),u.current=null),()=>{k&&k(),u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[t,v]),e&&e.some(k=>{var _;return(((_=k.state)==null?void 0:_.status)||"running")==="running"}),i.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[i.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} shrink-0`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),i.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:p,disabled:d<=qv,className:x,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),i.jsx("button",{type:"button",onClick:g,disabled:d>=Uv,className:x,"aria-label":a("terminal.increase_font"),title:a("terminal.increase_font"),children:"A+"})]})]}),i.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?i.jsxs(i.Fragment,{children:[i.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-3 py-2 max-h-32 overflow-y-auto",children:e.slice(-3).map(k=>i.jsx(Iq,{part:k},k.id))})]}):i.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?i.jsxs("div",{children:[i.jsxs("div",{className:m.promptColor,children:["$ ",i.jsx("span",{className:"terminal-cursor",children:"█"})]}),i.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):i.jsxs(i.Fragment,{children:[e.map(k=>i.jsx(Aq,{part:k,theme:m},k.id)),i.jsxs("div",{className:m.promptColor,children:["$ ",i.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function Aq({part:e,theme:t}){var{t:n}=rn();const{tool:r,state:a}=e;if(!a)return null;const o=a.status||"running",u=ip(r||a.title,a.input)||r||a.title||"unknown",d=a.output?qo(typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)):null;return i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:`${t.commandColor} break-all`,children:[i.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&i.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&i.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&i.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&i.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",a.error?qo(typeof a.error=="string"?a.error:a.error.message||n("common.error")):n("common.unknown_error")]}),o==="pending_confirmation"&&i.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function Iq({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",o=ip(t||n.title,n.input)||t||n.title||"unknown",l={running:"text-yellow-400",completed:"text-green-400",error:"text-red-400",pending_confirmation:"text-blue-400"},u={running:"RUN",completed:"OK",error:"ERR",pending_confirmation:"WAIT"};return i.jsxs("div",{className:"text-xs font-mono truncate",children:[i.jsxs("span",{className:l[r]||"text-gray-400",children:["[",u[r]||r,"]"]}),i.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function Pk(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wg,$2;function Mq(){if($2)return wg;$2=1;function e(){this.__data__=[],this.size=0}return wg=e,wg}var Sg,W2;function Kl(){if(W2)return Sg;W2=1;function e(t,n){return t===n||t!==t&&n!==n}return Sg=e,Sg}var Eg,V2;function op(){if(V2)return Eg;V2=1;var e=Kl();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Eg=t,Eg}var Ng,G2;function Lq(){if(G2)return Ng;G2=1;var e=op(),t=Array.prototype,n=t.splice;function r(a){var o=this.__data__,l=e(o,a);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():n.call(o,l,1),--this.size,!0}return Ng=r,Ng}var Cg,K2;function Oq(){if(K2)return Cg;K2=1;var e=op();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return Cg=t,Cg}var jg,Y2;function Dq(){if(Y2)return jg;Y2=1;var e=op();function t(n){return e(this.__data__,n)>-1}return jg=t,jg}var Tg,Q2;function Pq(){if(Q2)return Tg;Q2=1;var e=op();function t(n,r){var a=this.__data__,o=e(a,n);return o<0?(++this.size,a.push([n,r])):a[o][1]=r,this}return Tg=t,Tg}var Rg,X2;function lp(){if(X2)return Rg;X2=1;var e=Mq(),t=Lq(),n=Oq(),r=Dq(),a=Pq();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=a,Rg=o,Rg}var Ag,Z2;function Fq(){if(Z2)return Ag;Z2=1;var e=lp();function t(){this.__data__=new e,this.size=0}return Ag=t,Ag}var Ig,J2;function Bq(){if(J2)return Ig;J2=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Ig=e,Ig}var Mg,eS;function zq(){if(eS)return Mg;eS=1;function e(t){return this.__data__.get(t)}return Mg=e,Mg}var Lg,tS;function qq(){if(tS)return Lg;tS=1;function e(t){return this.__data__.has(t)}return Lg=e,Lg}var Og,nS;function qR(){if(nS)return Og;nS=1;var e=typeof Yd=="object"&&Yd&&Yd.Object===Object&&Yd;return Og=e,Og}var Dg,rS;function Fa(){if(rS)return Dg;rS=1;var e=qR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Dg=n,Dg}var Pg,iS;function Yl(){if(iS)return Pg;iS=1;var e=Fa(),t=e.Symbol;return Pg=t,Pg}var Fg,aS;function Uq(){if(aS)return Fg;aS=1;var e=Yl(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function o(l){var u=n.call(l,a),d=l[a];try{l[a]=void 0;var f=!0}catch{}var p=r.call(l);return f&&(u?l[a]=d:delete l[a]),p}return Fg=o,Fg}var Bg,sS;function Hq(){if(sS)return Bg;sS=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Bg=n,Bg}var zg,oS;function Ko(){if(oS)return zg;oS=1;var e=Yl(),t=Uq(),n=Hq(),r="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?a:r:o&&o in Object(u)?t(u):n(u)}return zg=l,zg}var qg,lS;function ya(){if(lS)return qg;lS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return qg=e,qg}var Ug,cS;function Bu(){if(cS)return Ug;cS=1;var e=Ko(),t=ya(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==a||d==n||d==o}return Ug=l,Ug}var Hg,uS;function $q(){if(uS)return Hg;uS=1;var e=Fa(),t=e["__core-js_shared__"];return Hg=t,Hg}var $g,dS;function Wq(){if(dS)return $g;dS=1;var e=$q(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return $g=n,$g}var Wg,fS;function UR(){if(fS)return Wg;fS=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Wg=n,Wg}var Vg,pS;function Vq(){if(pS)return Vg;pS=1;var e=Bu(),t=Wq(),n=ya(),r=UR(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp("^"+d.call(f).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(m){if(!n(m)||t(m))return!1;var x=e(m)?p:o;return x.test(r(m))}return Vg=g,Vg}var Gg,hS;function Gq(){if(hS)return Gg;hS=1;function e(t,n){return t==null?void 0:t[n]}return Gg=e,Gg}var Kg,gS;function Yo(){if(gS)return Kg;gS=1;var e=Vq(),t=Gq();function n(r,a){var o=t(r,a);return e(o)?o:void 0}return Kg=n,Kg}var Yg,mS;function Fk(){if(mS)return Yg;mS=1;var e=Yo(),t=Fa(),n=e(t,"Map");return Yg=n,Yg}var Qg,xS;function cp(){if(xS)return Qg;xS=1;var e=Yo(),t=e(Object,"create");return Qg=t,Qg}var Xg,yS;function Kq(){if(yS)return Xg;yS=1;var e=cp();function t(){this.__data__=e?e(null):{},this.size=0}return Xg=t,Xg}var Zg,bS;function Yq(){if(bS)return Zg;bS=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Zg=e,Zg}var Jg,vS;function Qq(){if(vS)return Jg;vS=1;var e=cp(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return r.call(l,o)?l[o]:void 0}return Jg=a,Jg}var em,kS;function Xq(){if(kS)return em;kS=1;var e=cp(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var o=this.__data__;return e?o[a]!==void 0:n.call(o,a)}return em=r,em}var tm,_S;function Zq(){if(_S)return tm;_S=1;var e=cp(),t="__lodash_hash_undefined__";function n(r,a){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&a===void 0?t:a,this}return tm=n,tm}var nm,wS;function Jq(){if(wS)return nm;wS=1;var e=Kq(),t=Yq(),n=Qq(),r=Xq(),a=Zq();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=a,nm=o,nm}var rm,SS;function eU(){if(SS)return rm;SS=1;var e=Jq(),t=lp(),n=Fk();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return rm=r,rm}var im,ES;function tU(){if(ES)return im;ES=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return im=e,im}var am,NS;function up(){if(NS)return am;NS=1;var e=tU();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return am=t,am}var sm,CS;function nU(){if(CS)return sm;CS=1;var e=up();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return sm=t,sm}var om,jS;function rU(){if(jS)return om;jS=1;var e=up();function t(n){return e(this,n).get(n)}return om=t,om}var lm,TS;function iU(){if(TS)return lm;TS=1;var e=up();function t(n){return e(this,n).has(n)}return lm=t,lm}var cm,RS;function aU(){if(RS)return cm;RS=1;var e=up();function t(n,r){var a=e(this,n),o=a.size;return a.set(n,r),this.size+=a.size==o?0:1,this}return cm=t,cm}var um,AS;function Bk(){if(AS)return um;AS=1;var e=eU(),t=nU(),n=rU(),r=iU(),a=aU();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=a,um=o,um}var dm,IS;function sU(){if(IS)return dm;IS=1;var e=lp(),t=Fk(),n=Bk(),r=200;function a(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([o,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(o,l),this.size=u.size,this}return dm=a,dm}var fm,MS;function dp(){if(MS)return fm;MS=1;var e=lp(),t=Fq(),n=Bq(),r=zq(),a=qq(),o=sU();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,fm=l,fm}var pm,LS;function zk(){if(LS)return pm;LS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return pm=e,pm}var hm,OS;function HR(){if(OS)return hm;OS=1;var e=Yo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return hm=t,hm}var gm,DS;function fp(){if(DS)return gm;DS=1;var e=HR();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return gm=t,gm}var mm,PS;function pp(){if(PS)return mm;PS=1;var e=fp(),t=Kl(),n=Object.prototype,r=n.hasOwnProperty;function a(o,l,u){var d=o[l];(!(r.call(o,l)&&t(d,u))||u===void 0&&!(l in o))&&e(o,l,u)}return mm=a,mm}var xm,FS;function zu(){if(FS)return xm;FS=1;var e=pp(),t=fp();function n(r,a,o,l){var u=!o;o||(o={});for(var d=-1,f=a.length;++d<f;){var p=a[d],g=l?l(o[p],r[p],p,o,r):void 0;g===void 0&&(g=r[p]),u?t(o,p,g):e(o,p,g)}return o}return xm=n,xm}var ym,BS;function oU(){if(BS)return ym;BS=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return ym=e,ym}var bm,zS;function Ja(){if(zS)return bm;zS=1;function e(t){return t!=null&&typeof t=="object"}return bm=e,bm}var vm,qS;function lU(){if(qS)return vm;qS=1;var e=Ko(),t=Ja(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return vm=r,vm}var km,US;function qu(){if(US)return km;US=1;var e=lU(),t=Ja(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!a.call(l,"callee")};return km=o,km}var _m,HS;function Ar(){if(HS)return _m;HS=1;var e=Array.isArray;return _m=e,_m}var du={exports:{}},wm,$S;function cU(){if($S)return wm;$S=1;function e(){return!1}return wm=e,wm}du.exports;var WS;function Ql(){return WS||(WS=1,(function(e,t){var n=Fa(),r=cU(),a=t&&!t.nodeType&&t,o=a&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===a,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(du,du.exports)),du.exports}var Sm,VS;function hp(){if(VS)return Sm;VS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var o=typeof r;return a=a??e,!!a&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return Sm=n,Sm}var Em,GS;function qk(){if(GS)return Em;GS=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Em=t,Em}var Nm,KS;function uU(){if(KS)return Nm;KS=1;var e=Ko(),t=qk(),n=Ja(),r="[object Arguments]",a="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",p="[object Number]",g="[object Object]",m="[object RegExp]",x="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",N="[object Float64Array]",R="[object Int8Array]",T="[object Int16Array]",j="[object Int32Array]",I="[object Uint8Array]",M="[object Uint8ClampedArray]",L="[object Uint16Array]",A="[object Uint32Array]",O={};O[E]=O[N]=O[R]=O[T]=O[j]=O[I]=O[M]=O[L]=O[A]=!0,O[r]=O[a]=O[_]=O[o]=O[S]=O[l]=O[u]=O[d]=O[f]=O[p]=O[g]=O[m]=O[x]=O[v]=O[k]=!1;function F(Q){return n(Q)&&t(Q.length)&&!!O[e(Q)]}return Nm=F,Nm}var Cm,YS;function gp(){if(YS)return Cm;YS=1;function e(t){return function(n){return t(n)}}return Cm=e,Cm}var fu={exports:{}};fu.exports;var QS;function Uk(){return QS||(QS=1,(function(e,t){var n=qR(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===r,l=o&&n.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(fu,fu.exports)),fu.exports}var jm,XS;function Uu(){if(XS)return jm;XS=1;var e=uU(),t=gp(),n=Uk(),r=n&&n.isTypedArray,a=r?t(r):e;return jm=a,jm}var Tm,ZS;function $R(){if(ZS)return Tm;ZS=1;var e=oU(),t=qu(),n=Ar(),r=Ql(),a=hp(),o=Uu(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var g=n(f),m=!g&&t(f),x=!g&&!m&&r(f),v=!g&&!m&&!x&&o(f),k=g||m||x||v,_=k?e(f.length,String):[],S=_.length;for(var E in f)(p||u.call(f,E))&&!(k&&(E=="length"||x&&(E=="offset"||E=="parent")||v&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||a(E,S)))&&_.push(E);return _}return Tm=d,Tm}var Rm,JS;function mp(){if(JS)return Rm;JS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return Rm=t,Rm}var Am,eE;function WR(){if(eE)return Am;eE=1;function e(t,n){return function(r){return t(n(r))}}return Am=e,Am}var Im,tE;function dU(){if(tE)return Im;tE=1;var e=WR(),t=e(Object.keys,Object);return Im=t,Im}var Mm,nE;function Hk(){if(nE)return Mm;nE=1;var e=mp(),t=dU(),n=Object.prototype,r=n.hasOwnProperty;function a(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))r.call(o,u)&&u!="constructor"&&l.push(u);return l}return Mm=a,Mm}var Lm,rE;function vs(){if(rE)return Lm;rE=1;var e=Bu(),t=qk();function n(r){return r!=null&&t(r.length)&&!e(r)}return Lm=n,Lm}var Om,iE;function io(){if(iE)return Om;iE=1;var e=$R(),t=Hk(),n=vs();function r(a){return n(a)?e(a):t(a)}return Om=r,Om}var Dm,aE;function fU(){if(aE)return Dm;aE=1;var e=zu(),t=io();function n(r,a){return r&&e(a,t(a),r)}return Dm=n,Dm}var Pm,sE;function pU(){if(sE)return Pm;sE=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Pm=e,Pm}var Fm,oE;function hU(){if(oE)return Fm;oE=1;var e=ya(),t=mp(),n=pU(),r=Object.prototype,a=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!a.call(l,f))||d.push(f);return d}return Fm=o,Fm}var Bm,lE;function Qo(){if(lE)return Bm;lE=1;var e=$R(),t=hU(),n=vs();function r(a){return n(a)?e(a,!0):t(a)}return Bm=r,Bm}var zm,cE;function gU(){if(cE)return zm;cE=1;var e=zu(),t=Qo();function n(r,a){return r&&e(a,t(a),r)}return zm=n,zm}var pu={exports:{}};pu.exports;var uE;function VR(){return uE||(uE=1,(function(e,t){var n=Fa(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===r,l=o?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,p){if(p)return f.slice();var g=f.length,m=u?u(g):new f.constructor(g);return f.copy(m),m}e.exports=d})(pu,pu.exports)),pu.exports}var qm,dE;function GR(){if(dE)return qm;dE=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return qm=e,qm}var Um,fE;function KR(){if(fE)return Um;fE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,o=0,l=[];++r<a;){var u=t[r];n(u,r,t)&&(l[o++]=u)}return l}return Um=e,Um}var Hm,pE;function YR(){if(pE)return Hm;pE=1;function e(){return[]}return Hm=e,Hm}var $m,hE;function $k(){if(hE)return $m;hE=1;var e=KR(),t=YR(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(u){return r.call(l,u)}))}:t;return $m=o,$m}var Wm,gE;function mU(){if(gE)return Wm;gE=1;var e=zu(),t=$k();function n(r,a){return e(r,t(r),a)}return Wm=n,Wm}var Vm,mE;function Wk(){if(mE)return Vm;mE=1;function e(t,n){for(var r=-1,a=n.length,o=t.length;++r<a;)t[o+r]=n[r];return t}return Vm=e,Vm}var Gm,xE;function xp(){if(xE)return Gm;xE=1;var e=WR(),t=e(Object.getPrototypeOf,Object);return Gm=t,Gm}var Km,yE;function QR(){if(yE)return Km;yE=1;var e=Wk(),t=xp(),n=$k(),r=YR(),a=Object.getOwnPropertySymbols,o=a?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return Km=o,Km}var Ym,bE;function xU(){if(bE)return Ym;bE=1;var e=zu(),t=QR();function n(r,a){return e(r,t(r),a)}return Ym=n,Ym}var Qm,vE;function XR(){if(vE)return Qm;vE=1;var e=Wk(),t=Ar();function n(r,a,o){var l=a(r);return t(r)?l:e(l,o(r))}return Qm=n,Qm}var Xm,kE;function ZR(){if(kE)return Xm;kE=1;var e=XR(),t=$k(),n=io();function r(a){return e(a,n,t)}return Xm=r,Xm}var Zm,_E;function yU(){if(_E)return Zm;_E=1;var e=XR(),t=QR(),n=Qo();function r(a){return e(a,n,t)}return Zm=r,Zm}var Jm,wE;function bU(){if(wE)return Jm;wE=1;var e=Yo(),t=Fa(),n=e(t,"DataView");return Jm=n,Jm}var e0,SE;function vU(){if(SE)return e0;SE=1;var e=Yo(),t=Fa(),n=e(t,"Promise");return e0=n,e0}var t0,EE;function JR(){if(EE)return t0;EE=1;var e=Yo(),t=Fa(),n=e(t,"Set");return t0=n,t0}var n0,NE;function kU(){if(NE)return n0;NE=1;var e=Yo(),t=Fa(),n=e(t,"WeakMap");return n0=n,n0}var r0,CE;function Xl(){if(CE)return r0;CE=1;var e=bU(),t=Fk(),n=vU(),r=JR(),a=kU(),o=Ko(),l=UR(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",g="[object WeakMap]",m="[object DataView]",x=l(e),v=l(t),k=l(n),_=l(r),S=l(a),E=o;return(e&&E(new e(new ArrayBuffer(1)))!=m||t&&E(new t)!=u||n&&E(n.resolve())!=f||r&&E(new r)!=p||a&&E(new a)!=g)&&(E=function(N){var R=o(N),T=R==d?N.constructor:void 0,j=T?l(T):"";if(j)switch(j){case x:return m;case v:return u;case k:return f;case _:return p;case S:return g}return R}),r0=E,r0}var i0,jE;function _U(){if(jE)return i0;jE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,o=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return i0=n,i0}var a0,TE;function eA(){if(TE)return a0;TE=1;var e=Fa(),t=e.Uint8Array;return a0=t,a0}var s0,RE;function Vk(){if(RE)return s0;RE=1;var e=eA();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return s0=t,s0}var o0,AE;function wU(){if(AE)return o0;AE=1;var e=Vk();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return o0=t,o0}var l0,IE;function SU(){if(IE)return l0;IE=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return l0=t,l0}var c0,ME;function EU(){if(ME)return c0;ME=1;var e=Yl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return c0=r,c0}var u0,LE;function tA(){if(LE)return u0;LE=1;var e=Vk();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return u0=t,u0}var d0,OE;function NU(){if(OE)return d0;OE=1;var e=Vk(),t=wU(),n=SU(),r=EU(),a=tA(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",g="[object String]",m="[object Symbol]",x="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",N="[object Int32Array]",R="[object Uint8Array]",T="[object Uint8ClampedArray]",j="[object Uint16Array]",I="[object Uint32Array]";function M(L,A,O){var F=L.constructor;switch(A){case x:return e(L);case o:case l:return new F(+L);case v:return t(L,O);case k:case _:case S:case E:case N:case R:case T:case j:case I:return a(L,O);case u:return new F;case d:case g:return new F(L);case f:return n(L);case p:return new F;case m:return r(L)}}return d0=M,d0}var f0,DE;function nA(){if(DE)return f0;DE=1;var e=ya(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var o=new r;return r.prototype=void 0,o}})();return f0=n,f0}var p0,PE;function rA(){if(PE)return p0;PE=1;var e=nA(),t=xp(),n=mp();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return p0=r,p0}var h0,FE;function CU(){if(FE)return h0;FE=1;var e=Xl(),t=Ja(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return h0=r,h0}var g0,BE;function jU(){if(BE)return g0;BE=1;var e=CU(),t=gp(),n=Uk(),r=n&&n.isMap,a=r?t(r):e;return g0=a,g0}var m0,zE;function TU(){if(zE)return m0;zE=1;var e=Xl(),t=Ja(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return m0=r,m0}var x0,qE;function RU(){if(qE)return x0;qE=1;var e=TU(),t=gp(),n=Uk(),r=n&&n.isSet,a=r?t(r):e;return x0=a,x0}var y0,UE;function iA(){if(UE)return y0;UE=1;var e=dp(),t=zk(),n=pp(),r=fU(),a=gU(),o=VR(),l=GR(),u=mU(),d=xU(),f=ZR(),p=yU(),g=Xl(),m=_U(),x=NU(),v=rA(),k=Ar(),_=Ql(),S=jU(),E=ya(),N=RU(),R=io(),T=Qo(),j=1,I=2,M=4,L="[object Arguments]",A="[object Array]",O="[object Boolean]",F="[object Date]",Q="[object Error]",H="[object Function]",P="[object GeneratorFunction]",K="[object Map]",W="[object Number]",Y="[object Object]",ce="[object RegExp]",z="[object Set]",G="[object String]",X="[object Symbol]",B="[object WeakMap]",te="[object ArrayBuffer]",V="[object DataView]",U="[object Float32Array]",oe="[object Float64Array]",ae="[object Int8Array]",xe="[object Int16Array]",Se="[object Int32Array]",Xe="[object Uint8Array]",bt="[object Uint8ClampedArray]",at="[object Uint16Array]",yt="[object Uint32Array]",et={};et[L]=et[A]=et[te]=et[V]=et[O]=et[F]=et[U]=et[oe]=et[ae]=et[xe]=et[Se]=et[K]=et[W]=et[Y]=et[ce]=et[z]=et[G]=et[X]=et[Xe]=et[bt]=et[at]=et[yt]=!0,et[Q]=et[H]=et[B]=!1;function Ie(Ge,tt,kt,Kt,an,Vt){var ze,De=tt&j,nt=tt&I,ft=tt&M;if(kt&&(ze=an?kt(Ge,Kt,an,Vt):kt(Ge)),ze!==void 0)return ze;if(!E(Ge))return Ge;var ue=k(Ge);if(ue){if(ze=m(Ge),!De)return l(Ge,ze)}else{var be=g(Ge),qe=be==H||be==P;if(_(Ge))return o(Ge,De);if(be==Y||be==L||qe&&!an){if(ze=nt||qe?{}:v(Ge),!De)return nt?d(Ge,a(ze,Ge)):u(Ge,r(ze,Ge))}else{if(!et[be])return an?Ge:{};ze=x(Ge,be,De)}}Vt||(Vt=new e);var me=Vt.get(Ge);if(me)return me;Vt.set(Ge,ze),N(Ge)?Ge.forEach(function(wt){ze.add(Ie(wt,tt,kt,wt,Ge,Vt))}):S(Ge)&&Ge.forEach(function(wt,ht){ze.set(ht,Ie(wt,tt,kt,ht,Ge,Vt))});var pt=ft?nt?p:f:nt?T:R,gt=ue?void 0:pt(Ge);return t(gt||Ge,function(wt,ht){gt&&(ht=wt,wt=Ge[ht]),n(ze,ht,Ie(wt,tt,kt,ht,Ge,Vt))}),ze}return y0=Ie,y0}var b0,HE;function AU(){if(HE)return b0;HE=1;var e=iA(),t=4;function n(r){return e(r,t)}return b0=n,b0}var v0,$E;function Gk(){if($E)return v0;$E=1;function e(t){return function(){return t}}return v0=e,v0}var k0,WE;function IU(){if(WE)return k0;WE=1;function e(t){return function(n,r,a){for(var o=-1,l=Object(n),u=a(n),d=u.length;d--;){var f=u[t?d:++o];if(r(l[f],f,l)===!1)break}return n}}return k0=e,k0}var _0,VE;function Kk(){if(VE)return _0;VE=1;var e=IU(),t=e();return _0=t,_0}var w0,GE;function Yk(){if(GE)return w0;GE=1;var e=Kk(),t=io();function n(r,a){return r&&e(r,a,t)}return w0=n,w0}var S0,KE;function MU(){if(KE)return S0;KE=1;var e=vs();function t(n,r){return function(a,o){if(a==null)return a;if(!e(a))return n(a,o);for(var l=a.length,u=r?l:-1,d=Object(a);(r?u--:++u<l)&&o(d[u],u,d)!==!1;);return a}}return S0=t,S0}var E0,YE;function yp(){if(YE)return E0;YE=1;var e=Yk(),t=MU(),n=t(e);return E0=n,E0}var N0,QE;function Xo(){if(QE)return N0;QE=1;function e(t){return t}return N0=e,N0}var C0,XE;function aA(){if(XE)return C0;XE=1;var e=Xo();function t(n){return typeof n=="function"?n:e}return C0=t,C0}var j0,ZE;function sA(){if(ZE)return j0;ZE=1;var e=zk(),t=yp(),n=aA(),r=Ar();function a(o,l){var u=r(o)?e:t;return u(o,n(l))}return j0=a,j0}var T0,JE;function oA(){return JE||(JE=1,T0=sA()),T0}var R0,eN;function LU(){if(eN)return R0;eN=1;var e=yp();function t(n,r){var a=[];return e(n,function(o,l,u){r(o,l,u)&&a.push(o)}),a}return R0=t,R0}var A0,tN;function OU(){if(tN)return A0;tN=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return A0=t,A0}var I0,nN;function DU(){if(nN)return I0;nN=1;function e(t){return this.__data__.has(t)}return I0=e,I0}var M0,rN;function lA(){if(rN)return M0;rN=1;var e=Bk(),t=OU(),n=DU();function r(a){var o=-1,l=a==null?0:a.length;for(this.__data__=new e;++o<l;)this.add(a[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,M0=r,M0}var L0,iN;function PU(){if(iN)return L0;iN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return L0=e,L0}var O0,aN;function cA(){if(aN)return O0;aN=1;function e(t,n){return t.has(n)}return O0=e,O0}var D0,sN;function uA(){if(sN)return D0;sN=1;var e=lA(),t=PU(),n=cA(),r=1,a=2;function o(l,u,d,f,p,g){var m=d&r,x=l.length,v=u.length;if(x!=v&&!(m&&v>x))return!1;var k=g.get(l),_=g.get(u);if(k&&_)return k==u&&_==l;var S=-1,E=!0,N=d&a?new e:void 0;for(g.set(l,u),g.set(u,l);++S<x;){var R=l[S],T=u[S];if(f)var j=m?f(T,R,S,u,l,g):f(R,T,S,l,u,g);if(j!==void 0){if(j)continue;E=!1;break}if(N){if(!t(u,function(I,M){if(!n(N,M)&&(R===I||p(R,I,d,f,g)))return N.push(M)})){E=!1;break}}else if(!(R===T||p(R,T,d,f,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return D0=o,D0}var P0,oN;function FU(){if(oN)return P0;oN=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,o){r[++n]=[o,a]}),r}return P0=e,P0}var F0,lN;function Qk(){if(lN)return F0;lN=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return F0=e,F0}var B0,cN;function BU(){if(cN)return B0;cN=1;var e=Yl(),t=eA(),n=Kl(),r=uA(),a=FU(),o=Qk(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",g="[object Map]",m="[object Number]",x="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",S="[object ArrayBuffer]",E="[object DataView]",N=e?e.prototype:void 0,R=N?N.valueOf:void 0;function T(j,I,M,L,A,O,F){switch(M){case E:if(j.byteLength!=I.byteLength||j.byteOffset!=I.byteOffset)return!1;j=j.buffer,I=I.buffer;case S:return!(j.byteLength!=I.byteLength||!O(new t(j),new t(I)));case d:case f:case m:return n(+j,+I);case p:return j.name==I.name&&j.message==I.message;case x:case k:return j==I+"";case g:var Q=a;case v:var H=L&l;if(Q||(Q=o),j.size!=I.size&&!H)return!1;var P=F.get(j);if(P)return P==I;L|=u,F.set(j,I);var K=r(Q(j),Q(I),L,A,O,F);return F.delete(j),K;case _:if(R)return R.call(j)==R.call(I)}return!1}return B0=T,B0}var z0,uN;function zU(){if(uN)return z0;uN=1;var e=ZR(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(o,l,u,d,f,p){var g=u&t,m=e(o),x=m.length,v=e(l),k=v.length;if(x!=k&&!g)return!1;for(var _=x;_--;){var S=m[_];if(!(g?S in l:r.call(l,S)))return!1}var E=p.get(o),N=p.get(l);if(E&&N)return E==l&&N==o;var R=!0;p.set(o,l),p.set(l,o);for(var T=g;++_<x;){S=m[_];var j=o[S],I=l[S];if(d)var M=g?d(I,j,S,l,o,p):d(j,I,S,o,l,p);if(!(M===void 0?j===I||f(j,I,u,d,p):M)){R=!1;break}T||(T=S=="constructor")}if(R&&!T){var L=o.constructor,A=l.constructor;L!=A&&"constructor"in o&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof A=="function"&&A instanceof A)&&(R=!1)}return p.delete(o),p.delete(l),R}return z0=a,z0}var q0,dN;function qU(){if(dN)return q0;dN=1;var e=dp(),t=uA(),n=BU(),r=zU(),a=Xl(),o=Ar(),l=Ql(),u=Uu(),d=1,f="[object Arguments]",p="[object Array]",g="[object Object]",m=Object.prototype,x=m.hasOwnProperty;function v(k,_,S,E,N,R){var T=o(k),j=o(_),I=T?p:a(k),M=j?p:a(_);I=I==f?g:I,M=M==f?g:M;var L=I==g,A=M==g,O=I==M;if(O&&l(k)){if(!l(_))return!1;T=!0,L=!1}if(O&&!L)return R||(R=new e),T||u(k)?t(k,_,S,E,N,R):n(k,_,I,S,E,N,R);if(!(S&d)){var F=L&&x.call(k,"__wrapped__"),Q=A&&x.call(_,"__wrapped__");if(F||Q){var H=F?k.value():k,P=Q?_.value():_;return R||(R=new e),N(H,P,S,E,R)}}return O?(R||(R=new e),r(k,_,S,E,N,R)):!1}return q0=v,q0}var U0,fN;function dA(){if(fN)return U0;fN=1;var e=qU(),t=Ja();function n(r,a,o,l,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,o,l,n,u)}return U0=n,U0}var H0,pN;function UU(){if(pN)return H0;pN=1;var e=dp(),t=dA(),n=1,r=2;function a(o,l,u,d){var f=u.length,p=f,g=!d;if(o==null)return!p;for(o=Object(o);f--;){var m=u[f];if(g&&m[2]?m[1]!==o[m[0]]:!(m[0]in o))return!1}for(;++f<p;){m=u[f];var x=m[0],v=o[x],k=m[1];if(g&&m[2]){if(v===void 0&&!(x in o))return!1}else{var _=new e;if(d)var S=d(v,k,x,o,l,_);if(!(S===void 0?t(k,v,n|r,d,_):S))return!1}}return!0}return H0=a,H0}var $0,hN;function fA(){if(hN)return $0;hN=1;var e=ya();function t(n){return n===n&&!e(n)}return $0=t,$0}var W0,gN;function HU(){if(gN)return W0;gN=1;var e=fA(),t=io();function n(r){for(var a=t(r),o=a.length;o--;){var l=a[o],u=r[l];a[o]=[l,u,e(u)]}return a}return W0=n,W0}var V0,mN;function pA(){if(mN)return V0;mN=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return V0=e,V0}var G0,xN;function $U(){if(xN)return G0;xN=1;var e=UU(),t=HU(),n=pA();function r(a){var o=t(a);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(l){return l===a||e(l,a,o)}}return G0=r,G0}var K0,yN;function Zl(){if(yN)return K0;yN=1;var e=Ko(),t=Ja(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return K0=r,K0}var Y0,bN;function Xk(){if(bN)return Y0;bN=1;var e=Ar(),t=Zl(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||l!=null&&o in Object(l)}return Y0=a,Y0}var Q0,vN;function WU(){if(vN)return Q0;vN=1;var e=Bk(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var o=function(){var l=arguments,u=a?a.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var f=r.apply(this,l);return o.cache=d.set(u,f)||d,f};return o.cache=new(n.Cache||e),o}return n.Cache=e,Q0=n,Q0}var X0,kN;function VU(){if(kN)return X0;kN=1;var e=WU(),t=500;function n(r){var a=e(r,function(l){return o.size===t&&o.clear(),l}),o=a.cache;return a}return X0=n,X0}var Z0,_N;function GU(){if(_N)return Z0;_N=1;var e=VU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var o=[];return a.charCodeAt(0)===46&&o.push(""),a.replace(t,function(l,u,d,f){o.push(d?f.replace(n,"$1"):u||l)}),o});return Z0=r,Z0}var J0,wN;function bp(){if(wN)return J0;wN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,o=Array(a);++r<a;)o[r]=n(t[r],r,t);return o}return J0=e,J0}var ex,SN;function KU(){if(SN)return ex;SN=1;var e=Yl(),t=bp(),n=Ar(),r=Zl(),a=e?e.prototype:void 0,o=a?a.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(r(u))return o?o.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return ex=l,ex}var tx,EN;function hA(){if(EN)return tx;EN=1;var e=KU();function t(n){return n==null?"":e(n)}return tx=t,tx}var nx,NN;function vp(){if(NN)return nx;NN=1;var e=Ar(),t=Xk(),n=GU(),r=hA();function a(o,l){return e(o)?o:t(o,l)?[o]:n(r(o))}return nx=a,nx}var rx,CN;function Hu(){if(CN)return rx;CN=1;var e=Zl();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return rx=t,rx}var ix,jN;function kp(){if(jN)return ix;jN=1;var e=vp(),t=Hu();function n(r,a){a=e(a,r);for(var o=0,l=a.length;r!=null&&o<l;)r=r[t(a[o++])];return o&&o==l?r:void 0}return ix=n,ix}var ax,TN;function YU(){if(TN)return ax;TN=1;var e=kp();function t(n,r,a){var o=n==null?void 0:e(n,r);return o===void 0?a:o}return ax=t,ax}var sx,RN;function QU(){if(RN)return sx;RN=1;function e(t,n){return t!=null&&n in Object(t)}return sx=e,sx}var ox,AN;function gA(){if(AN)return ox;AN=1;var e=vp(),t=qu(),n=Ar(),r=hp(),a=qk(),o=Hu();function l(u,d,f){d=e(d,u);for(var p=-1,g=d.length,m=!1;++p<g;){var x=o(d[p]);if(!(m=u!=null&&f(u,x)))break;u=u[x]}return m||++p!=g?m:(g=u==null?0:u.length,!!g&&a(g)&&r(x,g)&&(n(u)||t(u)))}return ox=l,ox}var lx,IN;function mA(){if(IN)return lx;IN=1;var e=QU(),t=gA();function n(r,a){return r!=null&&t(r,a,e)}return lx=n,lx}var cx,MN;function XU(){if(MN)return cx;MN=1;var e=dA(),t=YU(),n=mA(),r=Xk(),a=fA(),o=pA(),l=Hu(),u=1,d=2;function f(p,g){return r(p)&&a(g)?o(l(p),g):function(m){var x=t(m,p);return x===void 0&&x===g?n(m,p):e(g,x,u|d)}}return cx=f,cx}var ux,LN;function xA(){if(LN)return ux;LN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ux=e,ux}var dx,ON;function ZU(){if(ON)return dx;ON=1;var e=kp();function t(n){return function(r){return e(r,n)}}return dx=t,dx}var fx,DN;function JU(){if(DN)return fx;DN=1;var e=xA(),t=ZU(),n=Xk(),r=Hu();function a(o){return n(o)?e(r(o)):t(o)}return fx=a,fx}var px,PN;function ks(){if(PN)return px;PN=1;var e=$U(),t=XU(),n=Xo(),r=Ar(),a=JU();function o(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):a(l)}return px=o,px}var hx,FN;function yA(){if(FN)return hx;FN=1;var e=KR(),t=LU(),n=ks(),r=Ar();function a(o,l){var u=r(o)?e:t;return u(o,n(l,3))}return hx=a,hx}var gx,BN;function eH(){if(BN)return gx;BN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return gx=n,gx}var mx,zN;function bA(){if(zN)return mx;zN=1;var e=eH(),t=gA();function n(r,a){return r!=null&&t(r,a,e)}return mx=n,mx}var xx,qN;function tH(){if(qN)return xx;qN=1;var e=Hk(),t=Xl(),n=qu(),r=Ar(),a=vs(),o=Ql(),l=mp(),u=Uu(),d="[object Map]",f="[object Set]",p=Object.prototype,g=p.hasOwnProperty;function m(x){if(x==null)return!0;if(a(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||o(x)||u(x)||n(x)))return!x.length;var v=t(x);if(v==d||v==f)return!x.size;if(l(x))return!e(x).length;for(var k in x)if(g.call(x,k))return!1;return!0}return xx=m,xx}var yx,UN;function vA(){if(UN)return yx;UN=1;function e(t){return t===void 0}return yx=e,yx}var bx,HN;function kA(){if(HN)return bx;HN=1;var e=yp(),t=vs();function n(r,a){var o=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++o]=a(u,d,f)}),l}return bx=n,bx}var vx,$N;function _A(){if($N)return vx;$N=1;var e=bp(),t=ks(),n=kA(),r=Ar();function a(o,l){var u=r(o)?e:n;return u(o,t(l,3))}return vx=a,vx}var kx,WN;function nH(){if(WN)return kx;WN=1;function e(t,n,r,a){var o=-1,l=t==null?0:t.length;for(a&&l&&(r=t[++o]);++o<l;)r=n(r,t[o],o,t);return r}return kx=e,kx}var _x,VN;function rH(){if(VN)return _x;VN=1;function e(t,n,r,a,o){return o(t,function(l,u,d){r=a?(a=!1,l):n(r,l,u,d)}),r}return _x=e,_x}var wx,GN;function wA(){if(GN)return wx;GN=1;var e=nH(),t=yp(),n=ks(),r=rH(),a=Ar();function o(l,u,d){var f=a(l)?e:r,p=arguments.length<3;return f(l,n(u,4),d,p,t)}return wx=o,wx}var Sx,KN;function iH(){if(KN)return Sx;KN=1;var e=Ko(),t=Ar(),n=Ja(),r="[object String]";function a(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return Sx=a,Sx}var Ex,YN;function aH(){if(YN)return Ex;YN=1;var e=xA(),t=e("length");return Ex=t,Ex}var Nx,QN;function sH(){if(QN)return Nx;QN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+a+o+"]");function d(f){return u.test(f)}return Nx=d,Nx}var Cx,XN;function oH(){if(XN)return Cx;XN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+x+"(?:"+[p,g,m].join("|")+")"+k+v+")*",S=k+v+_,E="(?:"+[p+u+"?",u,g,m,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+E+S,"g");function R(T){for(var j=N.lastIndex=0;N.test(T);)++j;return j}return Cx=R,Cx}var jx,ZN;function lH(){if(ZN)return jx;ZN=1;var e=aH(),t=sH(),n=oH();function r(a){return t(a)?n(a):e(a)}return jx=r,jx}var Tx,JN;function cH(){if(JN)return Tx;JN=1;var e=Hk(),t=Xl(),n=vs(),r=iH(),a=lH(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?a(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return Tx=u,Tx}var Rx,eC;function uH(){if(eC)return Rx;eC=1;var e=zk(),t=nA(),n=Yk(),r=ks(),a=xp(),o=Ar(),l=Ql(),u=Bu(),d=ya(),f=Uu();function p(g,m,x){var v=o(g),k=v||l(g)||f(g);if(m=r(m,4),x==null){var _=g&&g.constructor;k?x=v?new _:[]:d(g)?x=u(_)?t(a(g)):{}:x={}}return(k?e:n)(g,function(S,E,N){return m(x,S,E,N)}),x}return Rx=p,Rx}var Ax,tC;function dH(){if(tC)return Ax;tC=1;var e=Yl(),t=qu(),n=Ar(),r=e?e.isConcatSpreadable:void 0;function a(o){return n(o)||t(o)||!!(r&&o&&o[r])}return Ax=a,Ax}var Ix,nC;function Zk(){if(nC)return Ix;nC=1;var e=Wk(),t=dH();function n(r,a,o,l,u){var d=-1,f=r.length;for(o||(o=t),u||(u=[]);++d<f;){var p=r[d];a>0&&o(p)?a>1?n(p,a-1,o,l,u):e(u,p):l||(u[u.length]=p)}return u}return Ix=n,Ix}var Mx,rC;function fH(){if(rC)return Mx;rC=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return Mx=e,Mx}var Lx,iC;function SA(){if(iC)return Lx;iC=1;var e=fH(),t=Math.max;function n(r,a,o){return a=t(a===void 0?r.length-1:a,0),function(){for(var l=arguments,u=-1,d=t(l.length-a,0),f=Array(d);++u<d;)f[u]=l[a+u];u=-1;for(var p=Array(a+1);++u<a;)p[u]=l[u];return p[a]=o(f),e(r,this,p)}}return Lx=n,Lx}var Ox,aC;function pH(){if(aC)return Ox;aC=1;var e=Gk(),t=HR(),n=Xo(),r=t?function(a,o){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return Ox=r,Ox}var Dx,sC;function hH(){if(sC)return Dx;sC=1;var e=800,t=16,n=Date.now;function r(a){var o=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return Dx=r,Dx}var Px,oC;function EA(){if(oC)return Px;oC=1;var e=pH(),t=hH(),n=t(e);return Px=n,Px}var Fx,lC;function _p(){if(lC)return Fx;lC=1;var e=Xo(),t=SA(),n=EA();function r(a,o){return n(t(a,o,e),a+"")}return Fx=r,Fx}var Bx,cC;function NA(){if(cC)return Bx;cC=1;function e(t,n,r,a){for(var o=t.length,l=r+(a?1:-1);a?l--:++l<o;)if(n(t[l],l,t))return l;return-1}return Bx=e,Bx}var zx,uC;function gH(){if(uC)return zx;uC=1;function e(t){return t!==t}return zx=e,zx}var qx,dC;function mH(){if(dC)return qx;dC=1;function e(t,n,r){for(var a=r-1,o=t.length;++a<o;)if(t[a]===n)return a;return-1}return qx=e,qx}var Ux,fC;function xH(){if(fC)return Ux;fC=1;var e=NA(),t=gH(),n=mH();function r(a,o,l){return o===o?n(a,o,l):e(a,t,l)}return Ux=r,Ux}var Hx,pC;function yH(){if(pC)return Hx;pC=1;var e=xH();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return Hx=t,Hx}var $x,hC;function bH(){if(hC)return $x;hC=1;function e(t,n,r){for(var a=-1,o=t==null?0:t.length;++a<o;)if(r(n,t[a]))return!0;return!1}return $x=e,$x}var Wx,gC;function vH(){if(gC)return Wx;gC=1;function e(){}return Wx=e,Wx}var Vx,mC;function kH(){if(mC)return Vx;mC=1;var e=JR(),t=vH(),n=Qk(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return Vx=a,Vx}var Gx,xC;function _H(){if(xC)return Gx;xC=1;var e=lA(),t=yH(),n=bH(),r=cA(),a=kH(),o=Qk(),l=200;function u(d,f,p){var g=-1,m=t,x=d.length,v=!0,k=[],_=k;if(p)v=!1,m=n;else if(x>=l){var S=f?null:a(d);if(S)return o(S);v=!1,m=r,_=new e}else _=f?[]:k;e:for(;++g<x;){var E=d[g],N=f?f(E):E;if(E=p||E!==0?E:0,v&&N===N){for(var R=_.length;R--;)if(_[R]===N)continue e;f&&_.push(N),k.push(E)}else m(_,N,p)||(_!==k&&_.push(N),k.push(E))}return k}return Gx=u,Gx}var Kx,yC;function CA(){if(yC)return Kx;yC=1;var e=vs(),t=Ja();function n(r){return t(r)&&e(r)}return Kx=n,Kx}var Yx,bC;function wH(){if(bC)return Yx;bC=1;var e=Zk(),t=_p(),n=_H(),r=CA(),a=t(function(o){return n(e(o,1,r,!0))});return Yx=a,Yx}var Qx,vC;function SH(){if(vC)return Qx;vC=1;var e=bp();function t(n,r){return e(r,function(a){return n[a]})}return Qx=t,Qx}var Xx,kC;function jA(){if(kC)return Xx;kC=1;var e=SH(),t=io();function n(r){return r==null?[]:e(r,t(r))}return Xx=n,Xx}var Zx,_C;function ba(){if(_C)return Zx;_C=1;var e;if(typeof Pk=="function")try{e={clone:AU(),constant:Gk(),each:oA(),filter:yA(),has:bA(),isArray:Ar(),isEmpty:tH(),isFunction:Bu(),isUndefined:vA(),keys:io(),map:_A(),reduce:wA(),size:cH(),transform:uH(),union:wH(),values:jA()}}catch{}return e||(e=window._),Zx=e,Zx}var Jx,wC;function Jk(){if(wC)return Jx;wC=1;var e=ba();Jx=a;var t="\0",n="\0",r="";function a(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(p){return this._label=p,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._in[g])})},a.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._out[g])})},a.prototype.setNodes=function(p,g){var m=arguments,x=this;return e.each(p,function(v){m.length>1?x.setNode(v,g):x.setNode(v)}),this},a.prototype.setNode=function(p,g){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=g),this):(this._nodes[p]=arguments.length>1?g:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=n,this._children[p]={},this._children[n][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},a.prototype.node=function(p){return this._nodes[p]},a.prototype.hasNode=function(p){return e.has(this._nodes,p)},a.prototype.removeNode=function(p){var g=this;if(e.has(this._nodes,p)){var m=function(x){g.removeEdge(g._edgeObjs[x])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(x){g.setParent(x)}),delete this._children[p]),e.each(e.keys(this._in[p]),m),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),m),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},a.prototype.setParent=function(p,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var m=g;!e.isUndefined(m);m=this.parent(m))if(m===p)throw new Error("Setting "+g+" as parent of "+p+" would create a cycle");this.setNode(g)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=g,this._children[g][p]=!0,this},a.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},a.prototype.parent=function(p){if(this._isCompound){var g=this._parent[p];if(g!==n)return g}},a.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var g=this._children[p];if(g)return e.keys(g)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},a.prototype.predecessors=function(p){var g=this._preds[p];if(g)return e.keys(g)},a.prototype.successors=function(p){var g=this._sucs[p];if(g)return e.keys(g)},a.prototype.neighbors=function(p){var g=this.predecessors(p);if(g)return e.union(g,this.successors(p))},a.prototype.isLeaf=function(p){var g;return this.isDirected()?g=this.successors(p):g=this.neighbors(p),g.length===0},a.prototype.filterNodes=function(p){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var m=this;e.each(this._nodes,function(k,_){p(_)&&g.setNode(_,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,m.edge(k))});var x={};function v(k){var _=m.parent(k);return _===void 0||g.hasNode(_)?(x[k]=_,_):_ in x?x[_]:v(_)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,v(k))}),g},a.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(p,g){var m=this,x=arguments;return e.reduce(p,function(v,k){return x.length>1?m.setEdge(v,k,g):m.setEdge(v,k),k}),this},a.prototype.setEdge=function(){var p,g,m,x,v=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(p=k.v,g=k.w,m=k.name,arguments.length===2&&(x=arguments[1],v=!0)):(p=k,g=arguments[1],m=arguments[3],arguments.length>2&&(x=arguments[2],v=!0)),p=""+p,g=""+g,e.isUndefined(m)||(m=""+m);var _=u(this._isDirected,p,g,m);if(e.has(this._edgeLabels,_))return v&&(this._edgeLabels[_]=x),this;if(!e.isUndefined(m)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(g),this._edgeLabels[_]=v?x:this._defaultEdgeLabelFn(p,g,m);var S=d(this._isDirected,p,g,m);return p=S.v,g=S.w,Object.freeze(S),this._edgeObjs[_]=S,o(this._preds[g],p),o(this._sucs[p],g),this._in[g][_]=S,this._out[p][_]=S,this._edgeCount++,this},a.prototype.edge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m);return this._edgeLabels[x]},a.prototype.hasEdge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m);return e.has(this._edgeLabels,x)},a.prototype.removeEdge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m),v=this._edgeObjs[x];return v&&(p=v.v,g=v.w,delete this._edgeLabels[x],delete this._edgeObjs[x],l(this._preds[g],p),l(this._sucs[p],g),delete this._in[g][x],delete this._out[p][x],this._edgeCount--),this},a.prototype.inEdges=function(p,g){var m=this._in[p];if(m){var x=e.values(m);return g?e.filter(x,function(v){return v.v===g}):x}},a.prototype.outEdges=function(p,g){var m=this._out[p];if(m){var x=e.values(m);return g?e.filter(x,function(v){return v.w===g}):x}},a.prototype.nodeEdges=function(p,g){var m=this.inEdges(p,g);if(m)return m.concat(this.outEdges(p,g))};function o(p,g){p[g]?p[g]++:p[g]=1}function l(p,g){--p[g]||delete p[g]}function u(p,g,m,x){var v=""+g,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}return v+r+k+r+(e.isUndefined(x)?t:x)}function d(p,g,m,x){var v=""+g,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}var S={v,w:k};return x&&(S.name=x),S}function f(p,g){return u(p,g.v,g.w,g.name)}return Jx}var ey,SC;function EH(){return SC||(SC=1,ey="2.1.8"),ey}var ty,EC;function NH(){return EC||(EC=1,ty={Graph:Jk(),version:EH()}),ty}var ny,NC;function CH(){if(NC)return ny;NC=1;var e=ba(),t=Jk();ny={write:n,read:o};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:a(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function r(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),p={v:u};return e.isUndefined(d)||(p.value=d),e.isUndefined(f)||(p.parent=f),p})}function a(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function o(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return ny}var ry,CC;function jH(){if(CC)return ry;CC=1;var e=ba();ry=t;function t(n){var r={},a=[],o;function l(u){e.has(r,u)||(r[u]=!0,o.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){o=[],l(u),o.length&&a.push(o)}),a}return ry}var iy,jC;function TA(){if(jC)return iy;jC=1;var e=ba();iy=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var o=this._arr,l=o.length;return a[n]=l,o.push({key:n,priority:r}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,o=a+1,l=n;a<r.length&&(l=r[a].priority<r[l].priority?a:l,o<r.length&&(l=r[o].priority<r[l].priority?o:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<a));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var a=this._arr,o=this._keyIndices,l=a[n],u=a[r];a[n]=u,a[r]=l,o[u.key]=n,o[l.key]=r},iy}var ay,TC;function RA(){if(TC)return ay;TC=1;var e=ba(),t=TA();ay=r;var n=e.constant(1);function r(o,l,u,d){return a(o,String(l),u||n,d||function(f){return o.outEdges(f)})}function a(o,l,u,d){var f={},p=new t,g,m,x=function(v){var k=v.v!==g?v.v:v.w,_=f[k],S=u(v),E=m.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+S);E<_.distance&&(_.distance=E,_.predecessor=g,p.decrease(k,E))};for(o.nodes().forEach(function(v){var k=v===l?0:Number.POSITIVE_INFINITY;f[v]={distance:k},p.add(v,k)});p.size()>0&&(g=p.removeMin(),m=f[g],m.distance!==Number.POSITIVE_INFINITY);)d(g).forEach(x);return f}return ay}var sy,RC;function TH(){if(RC)return sy;RC=1;var e=RA(),t=ba();sy=n;function n(r,a,o){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,a,o)},{})}return sy}var oy,AC;function AA(){if(AC)return oy;AC=1;var e=ba();oy=t;function t(n){var r=0,a=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:r,index:r++};if(a.push(d),n.successors(d).forEach(function(m){e.has(o,m)?o[m].onStack&&(f.lowlink=Math.min(f.lowlink,o[m].index)):(u(m),f.lowlink=Math.min(f.lowlink,o[m].lowlink))}),f.lowlink===f.index){var p=[],g;do g=a.pop(),o[g].onStack=!1,p.push(g);while(d!==g);l.push(p)}}return n.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return oy}var ly,IC;function RH(){if(IC)return ly;IC=1;var e=ba(),t=AA();ly=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return ly}var cy,MC;function AH(){if(MC)return cy;MC=1;var e=ba();cy=n;var t=e.constant(1);function n(a,o,l){return r(a,o||t,l||function(u){return a.outEdges(u)})}function r(a,o,l){var u={},d=a.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(p){f!==p&&(u[f][p]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(p){var g=p.v===f?p.w:p.v,m=o(p);u[f][g]={distance:m,predecessor:f}})}),d.forEach(function(f){var p=u[f];d.forEach(function(g){var m=u[g];d.forEach(function(x){var v=m[f],k=p[x],_=m[x],S=v.distance+k.distance;S<_.distance&&(_.distance=S,_.predecessor=k.predecessor)})})}),u}return cy}var uy,LC;function IA(){if(LC)return uy;LC=1;var e=ba();uy=t,t.CycleException=n;function t(r){var a={},o={},l=[];function u(d){if(e.has(o,d))throw new n;e.has(a,d)||(o[d]=!0,a[d]=!0,e.each(r.predecessors(d),u),delete o[d],l.push(d))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,uy}var dy,OC;function IH(){if(OC)return dy;OC=1;var e=IA();dy=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return dy}var fy,DC;function MA(){if(DC)return fy;DC=1;var e=ba();fy=t;function t(r,a,o){e.isArray(a)||(a=[a]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(a,function(f){if(!r.hasNode(f))throw new Error("Graph does not have node: "+f);n(r,f,o==="post",d,l,u)}),u}function n(r,a,o,l,u,d){e.has(l,a)||(l[a]=!0,o||d.push(a),e.each(u(a),function(f){n(r,f,o,l,u,d)}),o&&d.push(a))}return fy}var py,PC;function MH(){if(PC)return py;PC=1;var e=MA();py=t;function t(n,r){return e(n,r,"post")}return py}var hy,FC;function LH(){if(FC)return hy;FC=1;var e=MA();hy=t;function t(n,r){return e(n,r,"pre")}return hy}var gy,BC;function OH(){if(BC)return gy;BC=1;var e=ba(),t=Jk(),n=TA();gy=r;function r(a,o){var l=new t,u={},d=new n,f;function p(m){var x=m.v===f?m.w:m.v,v=d.priority(x);if(v!==void 0){var k=o(m);k<v&&(u[x]=f,d.decrease(x,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(a.nodes()[0],0);for(var g=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(f).forEach(p)}return l}return gy}var my,zC;function DH(){return zC||(zC=1,my={components:jH(),dijkstra:RA(),dijkstraAll:TH(),findCycles:RH(),floydWarshall:AH(),isAcyclic:IH(),postorder:MH(),preorder:LH(),prim:OH(),tarjan:AA(),topsort:IA()}),my}var xy,qC;function PH(){if(qC)return xy;qC=1;var e=NH();return xy={Graph:e.Graph,json:CH(),alg:DH(),version:e.version},xy}var yy,UC;function Da(){if(UC)return yy;UC=1;var e;if(typeof Pk=="function")try{e=PH()}catch{}return e||(e=window.graphlib),yy=e,yy}var by,HC;function FH(){if(HC)return by;HC=1;var e=iA(),t=1,n=4;function r(a){return e(a,t|n)}return by=r,by}var vy,$C;function wp(){if($C)return vy;$C=1;var e=Kl(),t=vs(),n=hp(),r=ya();function a(o,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],o):!1}return vy=a,vy}var ky,WC;function BH(){if(WC)return ky;WC=1;var e=_p(),t=Kl(),n=wp(),r=Qo(),a=Object.prototype,o=a.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,p=d.length,g=p>2?d[2]:void 0;for(g&&n(d[0],d[1],g)&&(p=1);++f<p;)for(var m=d[f],x=r(m),v=-1,k=x.length;++v<k;){var _=x[v],S=u[_];(S===void 0||t(S,a[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return ky=l,ky}var _y,VC;function zH(){if(VC)return _y;VC=1;var e=ks(),t=vs(),n=io();function r(a){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=n(o),l=function(g){return f(d[g],g,d)}}var p=a(o,l,u);return p>-1?d[f?o[p]:p]:void 0}}return _y=r,_y}var wy,GC;function qH(){if(GC)return wy;GC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return wy=t,wy}var Sy,KC;function UH(){if(KC)return Sy;KC=1;var e=qH(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Sy=n,Sy}var Ey,YC;function HH(){if(YC)return Ey;YC=1;var e=UH(),t=ya(),n=Zl(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var p=typeof f.valueOf=="function"?f.valueOf():f;f=t(p)?p+"":p}if(typeof f!="string")return f===0?f:+f;f=e(f);var g=o.test(f);return g||l.test(f)?u(f.slice(2),g?2:8):a.test(f)?r:+f}return Ey=d,Ey}var Ny,QC;function LA(){if(QC)return Ny;QC=1;var e=HH(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var o=a<0?-1:1;return o*n}return a===a?a:0}return Ny=r,Ny}var Cy,XC;function $H(){if(XC)return Cy;XC=1;var e=LA();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return Cy=t,Cy}var jy,ZC;function WH(){if(ZC)return jy;ZC=1;var e=NA(),t=ks(),n=$H(),r=Math.max;function a(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(o,t(l,3),f)}return jy=a,jy}var Ty,JC;function VH(){if(JC)return Ty;JC=1;var e=zH(),t=WH(),n=e(t);return Ty=n,Ty}var Ry,ej;function OA(){if(ej)return Ry;ej=1;var e=Zk();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Ry=t,Ry}var Ay,tj;function GH(){if(tj)return Ay;tj=1;var e=Kk(),t=aA(),n=Qo();function r(a,o){return a==null?a:e(a,t(o),n)}return Ay=r,Ay}var Iy,nj;function KH(){if(nj)return Iy;nj=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Iy=e,Iy}var My,rj;function YH(){if(rj)return My;rj=1;var e=fp(),t=Yk(),n=ks();function r(a,o){var l={};return o=n(o,3),t(a,function(u,d,f){e(l,d,o(u,d,f))}),l}return My=r,My}var Ly,ij;function e1(){if(ij)return Ly;ij=1;var e=Zl();function t(n,r,a){for(var o=-1,l=n.length;++o<l;){var u=n[o],d=r(u);if(d!=null&&(f===void 0?d===d&&!e(d):a(d,f)))var f=d,p=u}return p}return Ly=t,Ly}var Oy,aj;function QH(){if(aj)return Oy;aj=1;function e(t,n){return t>n}return Oy=e,Oy}var Dy,sj;function XH(){if(sj)return Dy;sj=1;var e=e1(),t=QH(),n=Xo();function r(a){return a&&a.length?e(a,n,t):void 0}return Dy=r,Dy}var Py,oj;function DA(){if(oj)return Py;oj=1;var e=fp(),t=Kl();function n(r,a,o){(o!==void 0&&!t(r[a],o)||o===void 0&&!(a in r))&&e(r,a,o)}return Py=n,Py}var Fy,lj;function ZH(){if(lj)return Fy;lj=1;var e=Ko(),t=xp(),n=Ja(),r="[object Object]",a=Function.prototype,o=Object.prototype,l=a.toString,u=o.hasOwnProperty,d=l.call(Object);function f(p){if(!n(p)||e(p)!=r)return!1;var g=t(p);if(g===null)return!0;var m=u.call(g,"constructor")&&g.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return Fy=f,Fy}var By,cj;function PA(){if(cj)return By;cj=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return By=e,By}var zy,uj;function JH(){if(uj)return zy;uj=1;var e=zu(),t=Qo();function n(r){return e(r,t(r))}return zy=n,zy}var qy,dj;function e$(){if(dj)return qy;dj=1;var e=DA(),t=VR(),n=tA(),r=GR(),a=rA(),o=qu(),l=Ar(),u=CA(),d=Ql(),f=Bu(),p=ya(),g=ZH(),m=Uu(),x=PA(),v=JH();function k(_,S,E,N,R,T,j){var I=x(_,E),M=x(S,E),L=j.get(M);if(L){e(_,E,L);return}var A=T?T(I,M,E+"",_,S,j):void 0,O=A===void 0;if(O){var F=l(M),Q=!F&&d(M),H=!F&&!Q&&m(M);A=M,F||Q||H?l(I)?A=I:u(I)?A=r(I):Q?(O=!1,A=t(M,!0)):H?(O=!1,A=n(M,!0)):A=[]:g(M)||o(M)?(A=I,o(I)?A=v(I):(!p(I)||f(I))&&(A=a(M))):O=!1}O&&(j.set(M,A),R(A,M,N,T,j),j.delete(M)),e(_,E,A)}return qy=k,qy}var Uy,fj;function t$(){if(fj)return Uy;fj=1;var e=dp(),t=DA(),n=Kk(),r=e$(),a=ya(),o=Qo(),l=PA();function u(d,f,p,g,m){d!==f&&n(f,function(x,v){if(m||(m=new e),a(x))r(d,f,v,p,u,g,m);else{var k=g?g(l(d,v),x,v+"",d,f,m):void 0;k===void 0&&(k=x),t(d,v,k)}},o)}return Uy=u,Uy}var Hy,pj;function n$(){if(pj)return Hy;pj=1;var e=_p(),t=wp();function n(r){return e(function(a,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,f=u>2?o[2]:void 0;for(d=r.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(o[0],o[1],f)&&(d=u<3?void 0:d,u=1),a=Object(a);++l<u;){var p=o[l];p&&r(a,p,l,d)}return a})}return Hy=n,Hy}var $y,hj;function r$(){if(hj)return $y;hj=1;var e=t$(),t=n$(),n=t(function(r,a,o){e(r,a,o)});return $y=n,$y}var Wy,gj;function FA(){if(gj)return Wy;gj=1;function e(t,n){return t<n}return Wy=e,Wy}var Vy,mj;function i$(){if(mj)return Vy;mj=1;var e=e1(),t=FA(),n=Xo();function r(a){return a&&a.length?e(a,n,t):void 0}return Vy=r,Vy}var Gy,xj;function a$(){if(xj)return Gy;xj=1;var e=e1(),t=ks(),n=FA();function r(a,o){return a&&a.length?e(a,t(o,2),n):void 0}return Gy=r,Gy}var Ky,yj;function s$(){if(yj)return Ky;yj=1;var e=Fa(),t=function(){return e.Date.now()};return Ky=t,Ky}var Yy,bj;function o$(){if(bj)return Yy;bj=1;var e=pp(),t=vp(),n=hp(),r=ya(),a=Hu();function o(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var p=-1,g=u.length,m=g-1,x=l;x!=null&&++p<g;){var v=a(u[p]),k=d;if(v==="__proto__"||v==="constructor"||v==="prototype")return l;if(p!=m){var _=x[v];k=f?f(_,v,x):void 0,k===void 0&&(k=r(_)?_:n(u[p+1])?[]:{})}e(x,v,k),x=x[v]}return l}return Yy=o,Yy}var Qy,vj;function l$(){if(vj)return Qy;vj=1;var e=kp(),t=o$(),n=vp();function r(a,o,l){for(var u=-1,d=o.length,f={};++u<d;){var p=o[u],g=e(a,p);l(g,p)&&t(f,n(p,a),g)}return f}return Qy=r,Qy}var Xy,kj;function c$(){if(kj)return Xy;kj=1;var e=l$(),t=mA();function n(r,a){return e(r,a,function(o,l){return t(r,l)})}return Xy=n,Xy}var Zy,_j;function u$(){if(_j)return Zy;_j=1;var e=OA(),t=SA(),n=EA();function r(a){return n(t(a,void 0,e),a+"")}return Zy=r,Zy}var Jy,wj;function d$(){if(wj)return Jy;wj=1;var e=c$(),t=u$(),n=t(function(r,a){return r==null?{}:e(r,a)});return Jy=n,Jy}var eb,Sj;function f$(){if(Sj)return eb;Sj=1;var e=Math.ceil,t=Math.max;function n(r,a,o,l){for(var u=-1,d=t(e((a-r)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=o;return f}return eb=n,eb}var tb,Ej;function p$(){if(Ej)return tb;Ej=1;var e=f$(),t=wp(),n=LA();function r(a){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=n(o),l===void 0?(l=o,o=0):l=n(l),u=u===void 0?o<l?1:-1:n(u),e(o,l,u,a)}}return tb=r,tb}var nb,Nj;function h$(){if(Nj)return nb;Nj=1;var e=p$(),t=e();return nb=t,nb}var rb,Cj;function g$(){if(Cj)return rb;Cj=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return rb=e,rb}var ib,jj;function m$(){if(jj)return ib;jj=1;var e=Zl();function t(n,r){if(n!==r){var a=n!==void 0,o=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,p=r===r,g=e(r);if(!f&&!g&&!u&&n>r||u&&d&&p&&!f&&!g||o&&d&&p||!a&&p||!l)return 1;if(!o&&!u&&!g&&n<r||g&&a&&l&&!o&&!u||f&&a&&l||!d&&l||!p)return-1}return 0}return ib=t,ib}var ab,Tj;function x$(){if(Tj)return ab;Tj=1;var e=m$();function t(n,r,a){for(var o=-1,l=n.criteria,u=r.criteria,d=l.length,f=a.length;++o<d;){var p=e(l[o],u[o]);if(p){if(o>=f)return p;var g=a[o];return p*(g=="desc"?-1:1)}}return n.index-r.index}return ab=t,ab}var sb,Rj;function y$(){if(Rj)return sb;Rj=1;var e=bp(),t=kp(),n=ks(),r=kA(),a=g$(),o=gp(),l=x$(),u=Xo(),d=Ar();function f(p,g,m){g.length?g=e(g,function(k){return d(k)?function(_){return t(_,k.length===1?k[0]:k)}:k}):g=[u];var x=-1;g=e(g,o(n));var v=r(p,function(k,_,S){var E=e(g,function(N){return N(k)});return{criteria:E,index:++x,value:k}});return a(v,function(k,_){return l(k,_,m)})}return sb=f,sb}var ob,Aj;function b$(){if(Aj)return ob;Aj=1;var e=Zk(),t=y$(),n=_p(),r=wp(),a=n(function(o,l){if(o==null)return[];var u=l.length;return u>1&&r(o,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return ob=a,ob}var lb,Ij;function v$(){if(Ij)return lb;Ij=1;var e=hA(),t=0;function n(r){var a=++t;return e(r)+a}return lb=n,lb}var cb,Mj;function k$(){if(Mj)return cb;Mj=1;function e(t,n,r){for(var a=-1,o=t.length,l=n.length,u={};++a<o;){var d=a<l?n[a]:void 0;r(u,t[a],d)}return u}return cb=e,cb}var ub,Lj;function _$(){if(Lj)return ub;Lj=1;var e=pp(),t=k$();function n(r,a){return t(r||[],a||[],e)}return ub=n,ub}var db,Oj;function dr(){if(Oj)return db;Oj=1;var e;if(typeof Pk=="function")try{e={cloneDeep:FH(),constant:Gk(),defaults:BH(),each:oA(),filter:yA(),find:VH(),flatten:OA(),forEach:sA(),forIn:GH(),has:bA(),isUndefined:vA(),last:KH(),map:_A(),mapValues:YH(),max:XH(),merge:r$(),min:i$(),minBy:a$(),now:s$(),pick:d$(),range:h$(),reduce:wA(),sortBy:b$(),uniqueId:v$(),values:jA(),zipObject:_$()}}catch{}return e||(e=window._),db=e,db}var fb,Dj;function w$(){if(Dj)return fb;Dj=1,fb=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,o=a._prev;o!==a;)r.push(JSON.stringify(o,n)),o=o._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return fb}var pb,Pj;function S$(){if(Pj)return pb;Pj=1;var e=dr(),t=Da().Graph,n=w$();pb=a;var r=e.constant(1);function a(f,p){if(f.nodeCount()<=1)return[];var g=u(f,p||r),m=o(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(m,function(x){return f.outEdges(x.v,x.w)}),!0)}function o(f,p,g){for(var m=[],x=p[p.length-1],v=p[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,p,g,k);for(;k=x.dequeue();)l(f,p,g,k);if(f.nodeCount()){for(var _=p.length-2;_>0;--_)if(k=p[_].dequeue(),k){m=m.concat(l(f,p,g,k,!0));break}}}return m}function l(f,p,g,m,x){var v=x?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),S=f.node(k.v);x&&v.push({v:k.v,w:k.w}),S.out-=_,d(p,g,S)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),S=k.w,E=f.node(S);E.in-=_,d(p,g,E)}),f.removeNode(m.v),v}function u(f,p){var g=new t,m=0,x=0;e.forEach(f.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var S=g.edge(_.v,_.w)||0,E=p(_),N=S+E;g.setEdge(_.v,_.w,N),x=Math.max(x,g.node(_.v).out+=E),m=Math.max(m,g.node(_.w).in+=E)});var v=e.range(x+m+3).map(function(){return new n}),k=m+1;return e.forEach(g.nodes(),function(_){d(v,k,g.node(_))}),{graph:g,buckets:v,zeroIdx:k}}function d(f,p,g){g.out?g.in?f[g.out-g.in+p].enqueue(g):f[f.length-1].enqueue(g):f[0].enqueue(g)}return pb}var hb,Fj;function E$(){if(Fj)return hb;Fj=1;var e=dr(),t=S$();hb={run:n,undo:a};function n(o){var l=o.graph().acyclicer==="greedy"?t(o,u(o)):r(o);e.forEach(l,function(d){var f=o.edge(d);o.removeEdge(d),f.forwardName=d.name,f.reversed=!0,o.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function r(o){var l=[],u={},d={};function f(p){e.has(d,p)||(d[p]=!0,u[p]=!0,e.forEach(o.outEdges(p),function(g){e.has(u,g.w)?l.push(g):f(g.w)}),delete u[p])}return e.forEach(o.nodes(),f),l}function a(o){e.forEach(o.edges(),function(l){var u=o.edge(l);if(u.reversed){o.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(l.w,l.v,u,d)}})}return hb}var gb,Bj;function Oi(){if(Bj)return gb;Bj=1;var e=dr(),t=Da().Graph;gb={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:g,maxRank:m,partition:x,time:v,notime:k};function n(_,S,E,N){var R;do R=e.uniqueId(N);while(_.hasNode(R));return E.dummy=S,_.setNode(R,E),R}function r(_){var S=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(E){S.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){var N=S.edge(E.v,E.w)||{weight:0,minlen:1},R=_.edge(E);S.setEdge(E.v,E.w,{weight:N.weight+R.weight,minlen:Math.max(N.minlen,R.minlen)})}),S}function a(_){var S=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(E){_.children(E).length||S.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){S.setEdge(E,_.edge(E))}),S}function o(_){var S=e.map(_.nodes(),function(E){var N={};return e.forEach(_.outEdges(E),function(R){N[R.w]=(N[R.w]||0)+_.edge(R).weight}),N});return e.zipObject(_.nodes(),S)}function l(_){var S=e.map(_.nodes(),function(E){var N={};return e.forEach(_.inEdges(E),function(R){N[R.v]=(N[R.v]||0)+_.edge(R).weight}),N});return e.zipObject(_.nodes(),S)}function u(_,S){var E=_.x,N=_.y,R=S.x-E,T=S.y-N,j=_.width/2,I=_.height/2;if(!R&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var M,L;return Math.abs(T)*j>Math.abs(R)*I?(T<0&&(I=-I),M=I*R/T,L=I):(R<0&&(j=-j),M=j,L=j*T/R),{x:E+M,y:N+L}}function d(_){var S=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(E){var N=_.node(E),R=N.rank;e.isUndefined(R)||(S[R][N.order]=E)}),S}function f(_){var S=e.min(e.map(_.nodes(),function(E){return _.node(E).rank}));e.forEach(_.nodes(),function(E){var N=_.node(E);e.has(N,"rank")&&(N.rank-=S)})}function p(_){var S=e.min(e.map(_.nodes(),function(T){return _.node(T).rank})),E=[];e.forEach(_.nodes(),function(T){var j=_.node(T).rank-S;E[j]||(E[j]=[]),E[j].push(T)});var N=0,R=_.graph().nodeRankFactor;e.forEach(E,function(T,j){e.isUndefined(T)&&j%R!==0?--N:N&&e.forEach(T,function(I){_.node(I).rank+=N})})}function g(_,S,E,N){var R={width:0,height:0};return arguments.length>=4&&(R.rank=E,R.order=N),n(_,"border",R,S)}function m(_){return e.max(e.map(_.nodes(),function(S){var E=_.node(S).rank;if(!e.isUndefined(E))return E}))}function x(_,S){var E={lhs:[],rhs:[]};return e.forEach(_,function(N){S(N)?E.lhs.push(N):E.rhs.push(N)}),E}function v(_,S){var E=e.now();try{return S()}finally{console.log(_+" time: "+(e.now()-E)+"ms")}}function k(_,S){return S()}return gb}var mb,zj;function N$(){if(zj)return mb;zj=1;var e=dr(),t=Oi();mb={run:n,undo:a};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(l){r(o,l)})}function r(o,l){var u=l.v,d=o.node(u).rank,f=l.w,p=o.node(f).rank,g=l.name,m=o.edge(l),x=m.labelRank;if(p!==d+1){o.removeEdge(l);var v,k,_;for(_=0,++d;d<p;++_,++d)m.points=[],k={width:0,height:0,edgeLabel:m,edgeObj:l,rank:d},v=t.addDummyNode(o,"edge",k,"_d"),d===x&&(k.width=m.width,k.height=m.height,k.dummy="edge-label",k.labelpos=m.labelpos),o.setEdge(u,v,{weight:m.weight},g),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},g)}}function a(o){e.forEach(o.graph().dummyChains,function(l){var u=o.node(l),d=u.edgeLabel,f;for(o.setEdge(u.edgeObj,d);u.dummy;)f=o.successors(l)[0],o.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=o.node(l)})}return mb}var xb,qj;function qf(){if(qj)return xb;qj=1;var e=dr();xb={longestPath:t,slack:n};function t(r){var a={};function o(l){var u=r.node(l);if(e.has(a,l))return u.rank;a[l]=!0;var d=e.min(e.map(r.outEdges(l),function(f){return o(f.w)-r.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(r.sources(),o)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return xb}var yb,Uj;function BA(){if(Uj)return yb;Uj=1;var e=dr(),t=Da().Graph,n=qf().slack;yb=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],p=u.nodeCount();d.setNode(f,{});for(var g,m;a(d,u)<p;)g=o(d,u),m=d.hasNode(g.v)?n(u,g):-n(u,g),l(d,u,m);return d}function a(u,d){function f(p){e.forEach(d.nodeEdges(p),function(g){var m=g.v,x=p===m?g.w:m;!u.hasNode(x)&&!n(d,g)&&(u.setNode(x,{}),u.setEdge(p,x,{}),f(x))})}return e.forEach(u.nodes(),f),u.nodeCount()}function o(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return n(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(p){d.node(p).rank+=f})}return yb}var bb,Hj;function C$(){if(Hj)return bb;Hj=1;var e=dr(),t=BA(),n=qf().slack,r=qf().longestPath,a=Da().alg.preorder,o=Da().alg.postorder,l=Oi().simplify;bb=u,u.initLowLimValues=g,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=k;function u(N){N=l(N),r(N);var R=t(N);g(R),d(R,N);for(var T,j;T=x(R);)j=v(R,N,T),k(R,N,T,j)}function d(N,R){var T=o(N,N.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(j){f(N,R,j)})}function f(N,R,T){var j=N.node(T),I=j.parent;N.edge(T,I).cutvalue=p(N,R,T)}function p(N,R,T){var j=N.node(T),I=j.parent,M=!0,L=R.edge(T,I),A=0;return L||(M=!1,L=R.edge(I,T)),A=L.weight,e.forEach(R.nodeEdges(T),function(O){var F=O.v===T,Q=F?O.w:O.v;if(Q!==I){var H=F===M,P=R.edge(O).weight;if(A+=H?P:-P,S(N,T,Q)){var K=N.edge(T,Q).cutvalue;A+=H?-K:K}}}),A}function g(N,R){arguments.length<2&&(R=N.nodes()[0]),m(N,{},1,R)}function m(N,R,T,j,I){var M=T,L=N.node(j);return R[j]=!0,e.forEach(N.neighbors(j),function(A){e.has(R,A)||(T=m(N,R,T,A,j))}),L.low=M,L.lim=T++,I?L.parent=I:delete L.parent,T}function x(N){return e.find(N.edges(),function(R){return N.edge(R).cutvalue<0})}function v(N,R,T){var j=T.v,I=T.w;R.hasEdge(j,I)||(j=T.w,I=T.v);var M=N.node(j),L=N.node(I),A=M,O=!1;M.lim>L.lim&&(A=L,O=!0);var F=e.filter(R.edges(),function(Q){return O===E(N,N.node(Q.v),A)&&O!==E(N,N.node(Q.w),A)});return e.minBy(F,function(Q){return n(R,Q)})}function k(N,R,T,j){var I=T.v,M=T.w;N.removeEdge(I,M),N.setEdge(j.v,j.w,{}),g(N),d(N,R),_(N,R)}function _(N,R){var T=e.find(N.nodes(),function(I){return!R.node(I).parent}),j=a(N,T);j=j.slice(1),e.forEach(j,function(I){var M=N.node(I).parent,L=R.edge(I,M),A=!1;L||(L=R.edge(M,I),A=!0),R.node(I).rank=R.node(M).rank+(A?L.minlen:-L.minlen)})}function S(N,R,T){return N.hasEdge(R,T)}function E(N,R,T){return T.low<=R.lim&&R.lim<=T.lim}return bb}var vb,$j;function j$(){if($j)return vb;$j=1;var e=qf(),t=e.longestPath,n=BA(),r=C$();vb=a;function a(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":o(d);break;default:u(d)}}var o=t;function l(d){t(d),n(d)}function u(d){r(d)}return vb}var kb,Wj;function T$(){if(Wj)return kb;Wj=1;var e=dr();kb=t;function t(a){var o=r(a);e.forEach(a.graph().dummyChains,function(l){for(var u=a.node(l),d=u.edgeObj,f=n(a,o,d.v,d.w),p=f.path,g=f.lca,m=0,x=p[m],v=!0;l!==d.w;){if(u=a.node(l),v){for(;(x=p[m])!==g&&a.node(x).maxRank<u.rank;)m++;x===g&&(v=!1)}if(!v){for(;m<p.length-1&&a.node(x=p[m+1]).minRank<=u.rank;)m++;x=p[m]}a.setParent(l,x),l=a.successors(l)[0]}})}function n(a,o,l,u){var d=[],f=[],p=Math.min(o[l].low,o[u].low),g=Math.max(o[l].lim,o[u].lim),m,x;m=l;do m=a.parent(m),d.push(m);while(m&&(o[m].low>p||g>o[m].lim));for(x=m,m=u;(m=a.parent(m))!==x;)f.push(m);return{path:d.concat(f.reverse()),lca:x}}function r(a){var o={},l=0;function u(d){var f=l;e.forEach(a.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(a.children(),u),o}return kb}var _b,Vj;function R$(){if(Vj)return _b;Vj=1;var e=dr(),t=Oi();_b={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=a(u),p=e.max(e.values(f))-1,g=2*p+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(x){u.edge(x).minlen*=g});var m=o(u)+1;e.forEach(u.children(),function(x){r(u,d,g,m,p,f,x)}),u.graph().nodeRankFactor=g}function r(u,d,f,p,g,m,x){var v=u.children(x);if(!v.length){x!==d&&u.setEdge(d,x,{weight:0,minlen:f});return}var k=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),S=u.node(x);u.setParent(k,x),S.borderTop=k,u.setParent(_,x),S.borderBottom=_,e.forEach(v,function(E){r(u,d,f,p,g,m,E);var N=u.node(E),R=N.borderTop?N.borderTop:E,T=N.borderBottom?N.borderBottom:E,j=N.borderTop?p:2*p,I=R!==T?1:g-m[x]+1;u.setEdge(k,R,{weight:j,minlen:I,nestingEdge:!0}),u.setEdge(T,_,{weight:j,minlen:I,nestingEdge:!0})}),u.parent(x)||u.setEdge(d,k,{weight:0,minlen:g+m[x]})}function a(u){var d={};function f(p,g){var m=u.children(p);m&&m.length&&e.forEach(m,function(x){f(x,g+1)}),d[p]=g}return e.forEach(u.children(),function(p){f(p,1)}),d}function o(u){return e.reduce(u.edges(),function(d,f){return d+u.edge(f).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(f){var p=u.edge(f);p.nestingEdge&&u.removeEdge(f)})}return _b}var wb,Gj;function A$(){if(Gj)return wb;Gj=1;var e=dr(),t=Oi();wb=n;function n(a){function o(l){var u=a.children(l),d=a.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,p=d.maxRank+1;f<p;++f)r(a,"borderLeft","_bl",l,d,f),r(a,"borderRight","_br",l,d,f)}}e.forEach(a.children(),o)}function r(a,o,l,u,d,f){var p={width:0,height:0,rank:f,borderType:o},g=d[o][f-1],m=t.addDummyNode(a,"border",p,l);d[o][f]=m,a.setParent(m,u),g&&a.setEdge(g,m,{weight:1})}return wb}var Sb,Kj;function I$(){if(Kj)return Sb;Kj=1;var e=dr();Sb={adjust:t,undo:n};function t(f){var p=f.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&r(f)}function n(f){var p=f.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&o(f),(p==="lr"||p==="rl")&&(u(f),r(f))}function r(f){e.forEach(f.nodes(),function(p){a(f.node(p))}),e.forEach(f.edges(),function(p){a(f.edge(p))})}function a(f){var p=f.width;f.width=f.height,f.height=p}function o(f){e.forEach(f.nodes(),function(p){l(f.node(p))}),e.forEach(f.edges(),function(p){var g=f.edge(p);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(p){d(f.node(p))}),e.forEach(f.edges(),function(p){var g=f.edge(p);e.forEach(g.points,d),e.has(g,"x")&&d(g)})}function d(f){var p=f.x;f.x=f.y,f.y=p}return Sb}var Eb,Yj;function M$(){if(Yj)return Eb;Yj=1;var e=dr();Eb=t;function t(n){var r={},a=e.filter(n.nodes(),function(f){return!n.children(f).length}),o=e.max(e.map(a,function(f){return n.node(f).rank})),l=e.map(e.range(o+1),function(){return[]});function u(f){if(!e.has(r,f)){r[f]=!0;var p=n.node(f);l[p.rank].push(f),e.forEach(n.successors(f),u)}}var d=e.sortBy(a,function(f){return n.node(f).rank});return e.forEach(d,u),l}return Eb}var Nb,Qj;function L$(){if(Qj)return Nb;Qj=1;var e=dr();Nb=t;function t(r,a){for(var o=0,l=1;l<a.length;++l)o+=n(r,a[l-1],a[l]);return o}function n(r,a,o){for(var l=e.zipObject(o,e.map(o,function(m,x){return x})),u=e.flatten(e.map(a,function(m){return e.sortBy(e.map(r.outEdges(m),function(x){return{pos:l[x.w],weight:r.edge(x).weight}}),"pos")}),!0),d=1;d<o.length;)d<<=1;var f=2*d-1;d-=1;var p=e.map(new Array(f),function(){return 0}),g=0;return e.forEach(u.forEach(function(m){var x=m.pos+d;p[x]+=m.weight;for(var v=0;x>0;)x%2&&(v+=p[x+1]),x=x-1>>1,p[x]+=m.weight;g+=m.weight*v})),g}return Nb}var Cb,Xj;function O$(){if(Xj)return Cb;Xj=1;var e=dr();Cb=t;function t(n,r){return e.map(r,function(a){var o=n.inEdges(a);if(o.length){var l=e.reduce(o,function(u,d){var f=n.edge(d),p=n.node(d.v);return{sum:u.sum+f.weight*p.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Cb}var jb,Zj;function D$(){if(Zj)return jb;Zj=1;var e=dr();jb=t;function t(a,o){var l={};e.forEach(a,function(d,f){var p=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(p.barycenter=d.barycenter,p.weight=d.weight)}),e.forEach(o.edges(),function(d){var f=l[d.v],p=l[d.w];!e.isUndefined(f)&&!e.isUndefined(p)&&(p.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(a){var o=[];function l(f){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(f.barycenter)||p.barycenter>=f.barycenter)&&r(f,p)}}function u(f){return function(p){p.in.push(f),--p.indegree===0&&a.push(p)}}for(;a.length;){var d=a.pop();o.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(o,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function r(a,o){var l=0,u=0;a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),a.vs=o.vs.concat(a.vs),a.barycenter=l/u,a.weight=u,a.i=Math.min(o.i,a.i),o.merged=!0}return jb}var Tb,Jj;function P$(){if(Jj)return Tb;Jj=1;var e=dr(),t=Oi();Tb=n;function n(o,l){var u=t.partition(o,function(k){return e.has(k,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(k){return-k.i}),p=[],g=0,m=0,x=0;d.sort(a(!!l)),x=r(p,f,x),e.forEach(d,function(k){x+=k.vs.length,p.push(k.vs),g+=k.barycenter*k.weight,m+=k.weight,x=r(p,f,x)});var v={vs:e.flatten(p,!0)};return m&&(v.barycenter=g/m,v.weight=m),v}function r(o,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),o.push(d.vs),u++;return u}function a(o){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:o?u.i-l.i:l.i-u.i}}return Tb}var Rb,eT;function F$(){if(eT)return Rb;eT=1;var e=dr(),t=O$(),n=D$(),r=P$();Rb=a;function a(u,d,f,p){var g=u.children(d),m=u.node(d),x=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};x&&(g=e.filter(g,function(T){return T!==x&&T!==v}));var _=t(u,g);e.forEach(_,function(T){if(u.children(T.v).length){var j=a(u,T.v,f,p);k[T.v]=j,e.has(j,"barycenter")&&l(T,j)}});var S=n(_,f);o(S,k);var E=r(S,p);if(x&&(E.vs=e.flatten([x,E.vs,v],!0),u.predecessors(x).length)){var N=u.node(u.predecessors(x)[0]),R=u.node(u.predecessors(v)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+N.order+R.order)/(E.weight+2),E.weight+=2}return E}function o(u,d){e.forEach(u,function(f){f.vs=e.flatten(f.vs.map(function(p){return d[p]?d[p].vs:p}),!0)})}function l(u,d){e.isUndefined(u.barycenter)?(u.barycenter=d.barycenter,u.weight=d.weight):(u.barycenter=(u.barycenter*u.weight+d.barycenter*d.weight)/(u.weight+d.weight),u.weight+=d.weight)}return Rb}var Ab,tT;function B$(){if(tT)return Ab;tT=1;var e=dr(),t=Da().Graph;Ab=n;function n(a,o,l){var u=r(a),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return a.node(f)});return e.forEach(a.nodes(),function(f){var p=a.node(f),g=a.parent(f);(p.rank===o||p.minRank<=o&&o<=p.maxRank)&&(d.setNode(f),d.setParent(f,g||u),e.forEach(a[l](f),function(m){var x=m.v===f?m.w:m.v,v=d.edge(x,f),k=e.isUndefined(v)?0:v.weight;d.setEdge(x,f,{weight:a.edge(m).weight+k})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),d}function r(a){for(var o;a.hasNode(o=e.uniqueId("_root")););return o}return Ab}var Ib,nT;function z$(){if(nT)return Ib;nT=1;var e=dr();Ib=t;function t(n,r,a){var o={},l;e.forEach(a,function(u){for(var d=n.parent(u),f,p;d;){if(f=n.parent(d),f?(p=o[f],o[f]=d):(p=l,l=d),p&&p!==d){r.setEdge(p,d);return}d=f}})}return Ib}var Mb,rT;function q$(){if(rT)return Mb;rT=1;var e=dr(),t=M$(),n=L$(),r=F$(),a=B$(),o=z$(),l=Da().Graph,u=Oi();Mb=d;function d(m){var x=u.maxRank(m),v=f(m,e.range(1,x+1),"inEdges"),k=f(m,e.range(x-1,-1,-1),"outEdges"),_=t(m);g(m,_);for(var S=Number.POSITIVE_INFINITY,E,N=0,R=0;R<4;++N,++R){p(N%2?v:k,N%4>=2),_=u.buildLayerMatrix(m);var T=n(m,_);T<S&&(R=0,E=e.cloneDeep(_),S=T)}g(m,E)}function f(m,x,v){return e.map(x,function(k){return a(m,k,v)})}function p(m,x){var v=new l;e.forEach(m,function(k){var _=k.graph().root,S=r(k,_,v,x);e.forEach(S.vs,function(E,N){k.node(E).order=N}),o(k,v,S.vs)})}function g(m,x){e.forEach(x,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return Mb}var Lb,iT;function U$(){if(iT)return Lb;iT=1;var e=dr(),t=Da().Graph,n=Oi();Lb={positionX:v,findType1Conflicts:r,findType2Conflicts:a,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:g,balance:x};function r(S,E){var N={};function R(T,j){var I=0,M=0,L=T.length,A=e.last(j);return e.forEach(j,function(O,F){var Q=o(S,O),H=Q?S.node(Q).order:L;(Q||O===A)&&(e.forEach(j.slice(M,F+1),function(P){e.forEach(S.predecessors(P),function(K){var W=S.node(K),Y=W.order;(Y<I||H<Y)&&!(W.dummy&&S.node(P).dummy)&&l(N,K,P)})}),M=F+1,I=H)}),j}return e.reduce(E,R),N}function a(S,E){var N={};function R(j,I,M,L,A){var O;e.forEach(e.range(I,M),function(F){O=j[F],S.node(O).dummy&&e.forEach(S.predecessors(O),function(Q){var H=S.node(Q);H.dummy&&(H.order<L||H.order>A)&&l(N,Q,O)})})}function T(j,I){var M=-1,L,A=0;return e.forEach(I,function(O,F){if(S.node(O).dummy==="border"){var Q=S.predecessors(O);Q.length&&(L=S.node(Q[0]).order,R(I,A,F,M,L),A=F,M=L)}R(I,A,I.length,L,j.length)}),I}return e.reduce(E,T),N}function o(S,E){if(S.node(E).dummy)return e.find(S.predecessors(E),function(N){return S.node(N).dummy})}function l(S,E,N){if(E>N){var R=E;E=N,N=R}var T=S[E];T||(S[E]=T={}),T[N]=!0}function u(S,E,N){if(E>N){var R=E;E=N,N=R}return e.has(S[E],N)}function d(S,E,N,R){var T={},j={},I={};return e.forEach(E,function(M){e.forEach(M,function(L,A){T[L]=L,j[L]=L,I[L]=A})}),e.forEach(E,function(M){var L=-1;e.forEach(M,function(A){var O=R(A);if(O.length){O=e.sortBy(O,function(K){return I[K]});for(var F=(O.length-1)/2,Q=Math.floor(F),H=Math.ceil(F);Q<=H;++Q){var P=O[Q];j[A]===A&&L<I[P]&&!u(N,A,P)&&(j[P]=A,j[A]=T[A]=T[P],L=I[P])}}})}),{root:T,align:j}}function f(S,E,N,R,T){var j={},I=p(S,E,N,T),M=T?"borderLeft":"borderRight";function L(F,Q){for(var H=I.nodes(),P=H.pop(),K={};P;)K[P]?F(P):(K[P]=!0,H.push(P),H=H.concat(Q(P))),P=H.pop()}function A(F){j[F]=I.inEdges(F).reduce(function(Q,H){return Math.max(Q,j[H.v]+I.edge(H))},0)}function O(F){var Q=I.outEdges(F).reduce(function(P,K){return Math.min(P,j[K.w]-I.edge(K))},Number.POSITIVE_INFINITY),H=S.node(F);Q!==Number.POSITIVE_INFINITY&&H.borderType!==M&&(j[F]=Math.max(j[F],Q))}return L(A,I.predecessors.bind(I)),L(O,I.successors.bind(I)),e.forEach(R,function(F){j[F]=j[N[F]]}),j}function p(S,E,N,R){var T=new t,j=S.graph(),I=k(j.nodesep,j.edgesep,R);return e.forEach(E,function(M){var L;e.forEach(M,function(A){var O=N[A];if(T.setNode(O),L){var F=N[L],Q=T.edge(F,O);T.setEdge(F,O,Math.max(I(S,A,L),Q||0))}L=A})}),T}function g(S,E){return e.minBy(e.values(E),function(N){var R=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(N,function(j,I){var M=_(S,I)/2;R=Math.max(j+M,R),T=Math.min(j-M,T)}),R-T})}function m(S,E){var N=e.values(E),R=e.min(N),T=e.max(N);e.forEach(["u","d"],function(j){e.forEach(["l","r"],function(I){var M=j+I,L=S[M],A;if(L!==E){var O=e.values(L);A=I==="l"?R-e.min(O):T-e.max(O),A&&(S[M]=e.mapValues(L,function(F){return F+A}))}})})}function x(S,E){return e.mapValues(S.ul,function(N,R){if(E)return S[E.toLowerCase()][R];var T=e.sortBy(e.map(S,R));return(T[1]+T[2])/2})}function v(S){var E=n.buildLayerMatrix(S),N=e.merge(r(S,E),a(S,E)),R={},T;e.forEach(["u","d"],function(I){T=I==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(M){M==="r"&&(T=e.map(T,function(F){return e.values(F).reverse()}));var L=(I==="u"?S.predecessors:S.successors).bind(S),A=d(S,T,N,L),O=f(S,T,A.root,A.align,M==="r");M==="r"&&(O=e.mapValues(O,function(F){return-F})),R[I+M]=O})});var j=g(S,R);return m(R,j),x(R,S.graph().align)}function k(S,E,N){return function(R,T,j){var I=R.node(T),M=R.node(j),L=0,A;if(L+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(L+=N?A:-A),A=0,L+=(I.dummy?E:S)/2,L+=(M.dummy?E:S)/2,L+=M.width/2,e.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":A=M.width/2;break;case"r":A=-M.width/2;break}return A&&(L+=N?A:-A),A=0,L}}function _(S,E){return S.node(E).width}return Lb}var Ob,aT;function H$(){if(aT)return Ob;aT=1;var e=dr(),t=Oi(),n=U$().positionX;Ob=r;function r(o){o=t.asNonCompoundGraph(o),a(o),e.forEach(n(o),function(l,u){o.node(u).x=l})}function a(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(f){var p=e.max(e.map(f,function(g){return o.node(g).height}));e.forEach(f,function(g){o.node(g).y=d+p/2}),d+=p+u})}return Ob}var Db,sT;function $$(){if(sT)return Db;sT=1;var e=dr(),t=E$(),n=N$(),r=j$(),a=Oi().normalizeRanks,o=T$(),l=Oi().removeEmptyRanks,u=R$(),d=A$(),f=I$(),p=q$(),g=H$(),m=Oi(),x=Da().Graph;Db=v;function v(te,V){var U=V&&V.debugTiming?m.time:m.notime;U("layout",function(){var oe=U(" buildLayoutGraph",function(){return L(te)});U(" runLayout",function(){k(oe,U)}),U(" updateInputGraph",function(){_(te,oe)})})}function k(te,V){V(" makeSpaceForEdgeLabels",function(){A(te)}),V(" removeSelfEdges",function(){ce(te)}),V(" acyclic",function(){t.run(te)}),V(" nestingGraph.run",function(){u.run(te)}),V(" rank",function(){r(m.asNonCompoundGraph(te))}),V(" injectEdgeLabelProxies",function(){O(te)}),V(" removeEmptyRanks",function(){l(te)}),V(" nestingGraph.cleanup",function(){u.cleanup(te)}),V(" normalizeRanks",function(){a(te)}),V(" assignRankMinMax",function(){F(te)}),V(" removeEdgeLabelProxies",function(){Q(te)}),V(" normalize.run",function(){n.run(te)}),V(" parentDummyChains",function(){o(te)}),V(" addBorderSegments",function(){d(te)}),V(" order",function(){p(te)}),V(" insertSelfEdges",function(){z(te)}),V(" adjustCoordinateSystem",function(){f.adjust(te)}),V(" position",function(){g(te)}),V(" positionSelfEdges",function(){G(te)}),V(" removeBorderNodes",function(){Y(te)}),V(" normalize.undo",function(){n.undo(te)}),V(" fixupEdgeLabelCoords",function(){K(te)}),V(" undoCoordinateSystem",function(){f.undo(te)}),V(" translateGraph",function(){H(te)}),V(" assignNodeIntersects",function(){P(te)}),V(" reversePoints",function(){W(te)}),V(" acyclic.undo",function(){t.undo(te)})}function _(te,V){e.forEach(te.nodes(),function(U){var oe=te.node(U),ae=V.node(U);oe&&(oe.x=ae.x,oe.y=ae.y,V.children(U).length&&(oe.width=ae.width,oe.height=ae.height))}),e.forEach(te.edges(),function(U){var oe=te.edge(U),ae=V.edge(U);oe.points=ae.points,e.has(ae,"x")&&(oe.x=ae.x,oe.y=ae.y)}),te.graph().width=V.graph().width,te.graph().height=V.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],R=["width","height"],T={width:0,height:0},j=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function L(te){var V=new x({multigraph:!0,compound:!0}),U=B(te.graph());return V.setGraph(e.merge({},E,X(U,S),e.pick(U,N))),e.forEach(te.nodes(),function(oe){var ae=B(te.node(oe));V.setNode(oe,e.defaults(X(ae,R),T)),V.setParent(oe,te.parent(oe))}),e.forEach(te.edges(),function(oe){var ae=B(te.edge(oe));V.setEdge(oe,e.merge({},I,X(ae,j),e.pick(ae,M)))}),V}function A(te){var V=te.graph();V.ranksep/=2,e.forEach(te.edges(),function(U){var oe=te.edge(U);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(V.rankdir==="TB"||V.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function O(te){e.forEach(te.edges(),function(V){var U=te.edge(V);if(U.width&&U.height){var oe=te.node(V.v),ae=te.node(V.w),xe={rank:(ae.rank-oe.rank)/2+oe.rank,e:V};m.addDummyNode(te,"edge-proxy",xe,"_ep")}})}function F(te){var V=0;e.forEach(te.nodes(),function(U){var oe=te.node(U);oe.borderTop&&(oe.minRank=te.node(oe.borderTop).rank,oe.maxRank=te.node(oe.borderBottom).rank,V=e.max(V,oe.maxRank))}),te.graph().maxRank=V}function Q(te){e.forEach(te.nodes(),function(V){var U=te.node(V);U.dummy==="edge-proxy"&&(te.edge(U.e).labelRank=U.rank,te.removeNode(V))})}function H(te){var V=Number.POSITIVE_INFINITY,U=0,oe=Number.POSITIVE_INFINITY,ae=0,xe=te.graph(),Se=xe.marginx||0,Xe=xe.marginy||0;function bt(at){var yt=at.x,et=at.y,Ie=at.width,Ge=at.height;V=Math.min(V,yt-Ie/2),U=Math.max(U,yt+Ie/2),oe=Math.min(oe,et-Ge/2),ae=Math.max(ae,et+Ge/2)}e.forEach(te.nodes(),function(at){bt(te.node(at))}),e.forEach(te.edges(),function(at){var yt=te.edge(at);e.has(yt,"x")&&bt(yt)}),V-=Se,oe-=Xe,e.forEach(te.nodes(),function(at){var yt=te.node(at);yt.x-=V,yt.y-=oe}),e.forEach(te.edges(),function(at){var yt=te.edge(at);e.forEach(yt.points,function(et){et.x-=V,et.y-=oe}),e.has(yt,"x")&&(yt.x-=V),e.has(yt,"y")&&(yt.y-=oe)}),xe.width=U-V+Se,xe.height=ae-oe+Xe}function P(te){e.forEach(te.edges(),function(V){var U=te.edge(V),oe=te.node(V.v),ae=te.node(V.w),xe,Se;U.points?(xe=U.points[0],Se=U.points[U.points.length-1]):(U.points=[],xe=ae,Se=oe),U.points.unshift(m.intersectRect(oe,xe)),U.points.push(m.intersectRect(ae,Se))})}function K(te){e.forEach(te.edges(),function(V){var U=te.edge(V);if(e.has(U,"x"))switch((U.labelpos==="l"||U.labelpos==="r")&&(U.width-=U.labeloffset),U.labelpos){case"l":U.x-=U.width/2+U.labeloffset;break;case"r":U.x+=U.width/2+U.labeloffset;break}})}function W(te){e.forEach(te.edges(),function(V){var U=te.edge(V);U.reversed&&U.points.reverse()})}function Y(te){e.forEach(te.nodes(),function(V){if(te.children(V).length){var U=te.node(V),oe=te.node(U.borderTop),ae=te.node(U.borderBottom),xe=te.node(e.last(U.borderLeft)),Se=te.node(e.last(U.borderRight));U.width=Math.abs(Se.x-xe.x),U.height=Math.abs(ae.y-oe.y),U.x=xe.x+U.width/2,U.y=oe.y+U.height/2}}),e.forEach(te.nodes(),function(V){te.node(V).dummy==="border"&&te.removeNode(V)})}function ce(te){e.forEach(te.edges(),function(V){if(V.v===V.w){var U=te.node(V.v);U.selfEdges||(U.selfEdges=[]),U.selfEdges.push({e:V,label:te.edge(V)}),te.removeEdge(V)}})}function z(te){var V=m.buildLayerMatrix(te);e.forEach(V,function(U){var oe=0;e.forEach(U,function(ae,xe){var Se=te.node(ae);Se.order=xe+oe,e.forEach(Se.selfEdges,function(Xe){m.addDummyNode(te,"selfedge",{width:Xe.label.width,height:Xe.label.height,rank:Se.rank,order:xe+ ++oe,e:Xe.e,label:Xe.label},"_se")}),delete Se.selfEdges})})}function G(te){e.forEach(te.nodes(),function(V){var U=te.node(V);if(U.dummy==="selfedge"){var oe=te.node(U.e.v),ae=oe.x+oe.width/2,xe=oe.y,Se=U.x-ae,Xe=oe.height/2;te.setEdge(U.e,U.label),te.removeNode(V),U.label.points=[{x:ae+2*Se/3,y:xe-Xe},{x:ae+5*Se/6,y:xe-Xe},{x:ae+Se,y:xe},{x:ae+5*Se/6,y:xe+Xe},{x:ae+2*Se/3,y:xe+Xe}],U.label.x=U.x,U.label.y=U.y}})}function X(te,V){return e.mapValues(e.pick(te,V),Number)}function B(te){var V={};return e.forEach(te,function(U,oe){V[oe.toLowerCase()]=U}),V}return Db}var Pb,oT;function W$(){if(oT)return Pb;oT=1;var e=dr(),t=Oi(),n=Da().Graph;Pb={debugOrdering:r};function r(a){var o=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(o,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(p,g){return l.setEdge(p,g,{style:"invis"}),g})}),l}return Pb}var Fb,lT;function V$(){return lT||(lT=1,Fb="0.8.5"),Fb}var Bb,cT;function G$(){return cT||(cT=1,Bb={graphlib:Da(),layout:$$(),debug:W$(),util:{time:Oi().time,notime:Oi().notime},version:V$()}),Bb}var K$=G$();const Uf=$o(K$),Y$={completed:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},in_progress:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},blocked:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},open:{fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"}},Q$={completed:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},in_progress:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},blocked:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},open:{fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"}};function X$(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function uT(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function Z$({todos:e,darkMode:t}){const n=Array.isArray(e)?e:[],[r,a]=y.useState(null),o=y.useRef(null),l=y.useRef(null),[u,d]=y.useState(400),[f,p]=y.useState(function(){if(typeof window<"u"){const F=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(F)&&F>.1)return F}return 1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(f))},[f]);const[g,m]=y.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",g?"true":"false")},[g]);const[x,v]=y.useState(function(){if(typeof window<"u"){const F=localStorage.getItem("pave-map-rankdir");if(F==="LR"||F==="TB")return F}return"TB"});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",x)},[x]);const k=y.useMemo(function(){if(g)return n;const F=n.filter(function(H){return H.status!=="completed"}),Q={};return F.forEach(function(H){Q[H.id]=!0}),F.map(function(H){if(!H.blockedBy||!H.blockedBy.length)return H;const P=H.blockedBy.filter(function(K){return Q[K]});return P.length===H.blockedBy.length?H:Object.assign({},H,{blockedBy:P})})},[n,g]);y.useEffect(function(){if(!o.current)return;function F(){o.current&&d(o.current.clientWidth||400)}F();const Q=new ResizeObserver(F);return Q.observe(o.current),function(){Q.disconnect()}},[]);const _=y.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const F=new Uf.graphlib.Graph;F.setGraph({rankdir:x,nodesep:24,ranksep:36,marginx:16,marginy:16}),F.setDefaultEdgeLabel(function(){return{}});const Q=180,H=56;k.forEach(function(W){F.setNode(String(W.id),{width:Q,height:H,todo:W})}),k.forEach(function(W){(W.blockedBy||[]).forEach(function(ce){F.hasNode(String(ce))&&F.setEdge(String(ce),String(W.id))})}),Uf.layout(F);const P=F.nodes().map(function(W){const Y=F.node(W);return{id:W,x:Y.x-Q/2,y:Y.y-H/2,w:Q,h:H,todo:Y.todo}}),K=F.edges().map(function(W){const Y=F.edge(W);return{from:W.v,to:W.w,points:Y.points}});return{nodes:P,edges:K,width:F.graph().width||Q+32,height:F.graph().height||H+32}},[k,x]),S=t?Q$:Y$;if(!k.length){const F=n.length-k.length;return i.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[i.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:i.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),F>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[F," completed ",F===1?"todo is":"todos are"," hidden."]}),i.jsx("button",{type:"button",onClick:function(){m(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:"Show completed"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:["Ask the agent to plan the work — todos created with the ",i.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function E(F){if(!F||F.length<2)return"";let Q="M "+F[0].x+" "+F[0].y;for(let H=1;H<F.length;H++)Q+=" L "+F[H].x+" "+F[H].y;return Q}const N=n.reduce(function(F,Q){const H=uT(Q);return F[H]=(F[H]||0)+1,F},{}),R=N.completed||0,T=Math.max(_.width,100),j=Math.max(_.height,100),M=(T>u-24?1:(u-24)/T)*f,L=T*M,A=j*M;function O(F){(F.ctrlKey||F.metaKey)&&(F.preventDefault(),p(function(Q){const H=F.deltaY<0?Q*1.1:Q/1.1;return Math.max(.25,Math.min(4,H))}))}return i.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[i.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{children:[n.length," total"]}),N.in_progress?i.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[N.in_progress," active"]}):null,R?i.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[R," done"]}):null,N.blocked?i.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[N.blocked," blocked"]}):null,i.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[i.jsx("button",{type:"button",onClick:function(){v(function(F){return F==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:x==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:x==="TB"?"↓":"→"}),i.jsx("button",{type:"button",onClick:function(){p(function(F){return Math.max(.25,F/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),i.jsxs("button",{type:"button",onClick:function(){p(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),i.jsx("button",{type:"button",onClick:function(){p(function(F){return Math.min(4,F*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),R>0?i.jsx("button",{type:"button",onClick:function(){m(function(F){return!F})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(g?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:g?"Hide completed todos":"Show completed todos",children:g?"hide done":"show done"}):null]})]}),i.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:O,children:i.jsxs("svg",{viewBox:"0 0 "+T+" "+j,width:L,height:A,style:{display:"block"},children:[i.jsx("defs",{children:i.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),_.edges.map(function(F,Q){return i.jsx("path",{d:E(F.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+Q)}),_.nodes.map(function(F){const Q=uT(F.todo),H=S[Q],P=Q==="in_progress",K=r===F.id;return i.jsxs("g",{transform:"translate("+F.x+","+F.y+")",onMouseEnter:function(){a(F.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[i.jsx("rect",{width:F.w,height:F.h,rx:6,ry:6,fill:H.fill,stroke:H.stroke,strokeWidth:P||K?2:1.25,children:P?i.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),P?i.jsx("circle",{cx:10,cy:10,r:3.5,fill:H.stroke,children:i.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,i.jsx("text",{x:F.w/2,y:F.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:H.label,children:"#"+F.todo.id}),i.jsx("text",{x:F.w/2,y:F.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:X$(F.todo.text,26)}),K&&F.todo.text&&F.todo.text.length>26?i.jsx("title",{children:F.todo.text}):null]},F.id)})]})})]})}const J$={bash:{fill:"#f1f5f9",stroke:"#64748b",label:"#334155"},read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},Read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},Edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},Write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},glob:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},grep:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},fetch:{fill:"#fce7f3",stroke:"#db2777",label:"#9d174d"},canvas:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},todo:{fill:"#e0f2fe",stroke:"#0ea5e9",label:"#0369a1"}},eW={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},tW={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},nW={bash:{fill:"#1e293b",stroke:"#94a3b8",label:"#e2e8f0"},read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},Read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},Edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},Write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},glob:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},grep:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},fetch:{fill:"#831843",stroke:"#f472b6",label:"#fbcfe8"},canvas:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},todo:{fill:"#0c4a6e",stroke:"#38bdf8",label:"#bae6fd"}},rW={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},iW={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},aW={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},sW={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},Ks={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function oW(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function lW(e,t){return e.kind==="thought"?t?sW:aW:e.status==="error"?t?iW:tW:(t?nW:J$)[e.tool]||(t?rW:eW)}function cW({graph:e,darkMode:t,onNodeClick:n}){const r=e&&Array.isArray(e.nodes)?e.nodes:[],a=e&&Array.isArray(e.edges)?e.edges:[],o=y.useRef(null),l=y.useRef(null),[u,d]=y.useState(null),[f,p]=y.useState(400),[g,m]=y.useState(function(){if(typeof window<"u"){const P=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(P)&&P>.1)return P}return 1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(g))},[g]);const[x,v]=y.useState(function(){if(typeof window<"u"){const P=localStorage.getItem("pave-toolmap-rankdir");if(P==="LR"||P==="TB")return P}return"TB"});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",x)},[x]);const[k,_]=y.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",k?"true":"false")},[k]);const[S,E]=y.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",S?"true":"false")},[S]);const N=y.useMemo(function(){let P=r;return k||(P=P.filter(function(K){return!K.hidden})),S||(P=P.filter(function(K){return K.kind!=="thought"})),P},[r,k,S]),R=y.useMemo(function(){const P={};return N.forEach(function(K){P[K.id]=!0}),a.filter(function(K){return P[K.from]&&P[K.to]})},[a,N]),T=y.useMemo(function(){if(!N.length)return{nodes:[],edges:[],width:0,height:0};const P=new Uf.graphlib.Graph;P.setGraph({rankdir:x,nodesep:18,ranksep:32,marginx:14,marginy:14}),P.setDefaultEdgeLabel(function(){return{}});const K=168,W=44,Y=240,ce=60;N.forEach(function(X){X.kind==="thought"?P.setNode(X.id,{width:Y,height:ce,node:X}):P.setNode(X.id,{width:K,height:W,node:X})}),R.forEach(function(X){P.hasNode(X.from)&&P.hasNode(X.to)&&P.setEdge(X.from,X.to,{kind:X.kind})}),Uf.layout(P);const z=P.nodes().map(function(X){const B=P.node(X);return{id:X,x:B.x-B.width/2,y:B.y-B.height/2,w:B.width,h:B.height,node:B.node}}),G=P.edges().map(function(X){const B=P.edge(X);return{from:X.v,to:X.w,points:B.points||[],kind:B.kind||"seq"}});return{nodes:z,edges:G,width:P.graph().width||K+28,height:P.graph().height||W+28}},[N,R,x]);y.useEffect(function(){if(!o.current)return;function P(){o.current&&p(o.current.clientWidth||400)}P();const K=new ResizeObserver(P);return K.observe(o.current),function(){K.disconnect()}},[]);const j=y.useMemo(function(){const P={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(K){if(K.kind==="thought"){P.thoughts++;return}P.total++,K.hidden&&P.hidden++,K.status==="error"?P.error++:K.status==="running"?P.running++:P.ok++}),P},[r]);if(!N.length)return i.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[i.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:i.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:"Tool invocations will appear here as a DAG showing data flow and file dependencies."}),j.hidden>0&&!k?i.jsxs("button",{type:"button",onClick:function(){_(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:["Show ",j.hidden," hidden"]}):null]});function I(P){if(!P||P.length<2)return"";let K="M "+P[0].x+" "+P[0].y;for(let W=1;W<P.length;W++)K+=" L "+P[W].x+" "+P[W].y;return K}const M=Math.max(T.width,100),L=Math.max(T.height,100),O=(M>f-24?1:(f-24)/M)*g,F=M*O,Q=L*O;function H(P){(P.ctrlKey||P.metaKey)&&(P.preventDefault(),m(function(K){const W=P.deltaY<0?K*1.1:K/1.1;return Math.max(.25,Math.min(4,W))}))}return i.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[i.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{children:[j.total," tools"]}),j.running?i.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[j.running," live"]}):null,j.error?i.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[j.error," err"]}):null,i.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[i.jsx("button",{type:"button",onClick:function(){v(function(P){return P==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:x==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:x==="TB"?"↓":"→"}),i.jsx("button",{type:"button",onClick:function(){m(function(P){return Math.max(.25,P/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),i.jsxs("button",{type:"button",onClick:function(){m(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(g*100),"%"]}),i.jsx("button",{type:"button",onClick:function(){m(function(P){return Math.min(4,P*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),j.hidden>0?i.jsx("button",{type:"button",onClick:function(){_(function(P){return!P})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(k?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:k?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:k?"hide bk":"show bk"}):null,j.thoughts>0?i.jsx("button",{type:"button",onClick:function(){E(function(P){return!P})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(S?"border-yellow-500 text-yellow-700 dark:text-yellow-300 bg-yellow-50 dark:bg-yellow-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:S?"Hide reasoning bubbles":"Show reasoning bubbles ("+j.thoughts+" thoughts)",children:S?"💭 "+j.thoughts:"💭 off"}):null]})]}),i.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:H,children:i.jsxs("svg",{viewBox:"0 0 "+M+" "+L,width:F,height:Q,style:{display:"block"},children:[i.jsxs("defs",{children:[i.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ks.data.dark:Ks.data.light})}),i.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ks.file.dark:Ks.file.light})}),i.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ks.seq.dark:Ks.seq.light})})]}),T.edges.map(function(P,K){const W=t?Ks[P.kind].dark:Ks[P.kind].light;return i.jsx("path",{d:I(P.points),fill:"none",stroke:W,strokeWidth:P.kind==="data"?1.75:P.kind==="file"?1.25:1,strokeDasharray:P.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+P.kind+")"},"e"+K)}),T.nodes.map(function(P){const K=P.node,W=lW(K,t),Y=K.status==="running",ce=u===P.id;if(K.kind==="thought"){const G=K.label||"",X=32,B=3,te=G.split(/\s+/),V=[];let U="";for(const oe of te){if(V.length===B-1&&(U+" "+oe).length>X){V.push(U);const ae=te.slice(te.indexOf(oe)).join(" ");V.push(ae.length>X?ae.slice(0,X-1)+"…":ae),U="";break}if(!U){U=oe;continue}if((U+" "+oe).length<=X?U=U+" "+oe:(V.push(U),U=oe),V.length>=B)break}return U&&V.length<B&&V.push(U),i.jsxs("g",{transform:"translate("+P.x+","+P.y+")",onMouseEnter:function(){d(P.id)},onMouseLeave:function(){d(null)},onClick:function(){n&&n(K)},style:{cursor:n?"pointer":"default"},children:[i.jsx("rect",{width:P.w,height:P.h,rx:P.h/2,ry:P.h/2,fill:W.fill,stroke:W.stroke,strokeWidth:ce?1.75:1,strokeDasharray:K.source==="reasoning"?void 0:"4,2"}),i.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:W.label,children:V.map(function(oe,ae){return i.jsx("tspan",{x:14,dy:ae===0?14:11,children:(ae===0?"💭 ":"")+oe},"ln"+ae)})}),i.jsx("title",{children:(K.source==="reasoning"?"[reasoning] ":"[thought] ")+(K.fullText||K.label)})]},P.id)}return i.jsxs("g",{transform:"translate("+P.x+","+P.y+")",onMouseEnter:function(){d(P.id)},onMouseLeave:function(){d(null)},onClick:function(){n&&n(K)},style:{cursor:n?"pointer":"default"},children:[i.jsx("rect",{width:P.w,height:P.h,rx:5,ry:5,fill:W.fill,stroke:W.stroke,strokeWidth:Y||ce?2:1.25,opacity:K.hidden?.55:1,children:Y?i.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),i.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:W.label,children:K.tool}),i.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:oW(K.label,22)}),i.jsx("title",{children:K.tool+" · "+K.label+(K.status==="error"?" · ERROR":K.status==="running"?" · RUNNING":"")}),Y?i.jsxs("g",{transform:"translate("+(P.w-9)+",9)",children:[i.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:W.stroke,strokeWidth:.75}),i.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[i.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},P.id)})]})})]})}/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */function dT(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uW(e){if(Array.isArray(e))return e}function dW(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,l,u=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(p){f=!0,a=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw a}}return u}}function fW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
118
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function pW(e,t){return uW(e)||dW(e,t)||hW(e,t)||fW()}function hW(e,t){if(e){if(typeof e=="string")return dT(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dT(e,t):void 0}}const zA=Object.entries,fT=Object.setPrototypeOf,gW=Object.isFrozen,qA=Object.getPrototypeOf,UA=Object.getOwnPropertyDescriptor;let Vr=Object.freeze,ei=Object.seal,Ol=Object.create,HA=typeof Reflect<"u"&&Reflect,Hv=HA.apply,$v=HA.construct;Vr||(Vr=function(t){return t});ei||(ei=function(t){return t});Hv||(Hv=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];return t.apply(n,a)});$v||($v=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const ps=ur(Array.prototype.forEach),mW=ur(Array.prototype.lastIndexOf),pT=ur(Array.prototype.pop),Jc=ur(Array.prototype.push),xW=ur(Array.prototype.slice),yW=ur(Array.prototype.splice),zl=Array.isArray,zb=$A(Set),qb=ur(Set.prototype.add),eu=ur(Set.prototype.has),Lo=ur(String.prototype.toLowerCase),Ub=ur(String.prototype.toString),hT=ur(String.prototype.match),tu=ur(String.prototype.replace),gT=ur(String.prototype.indexOf),bW=ur(String.prototype.trim),vW=ur(Number.prototype.toString),kW=ur(Boolean.prototype.toString),mT=typeof BigInt>"u"?null:ur(BigInt.prototype.toString),xT=typeof Symbol>"u"?null:ur(Symbol.prototype.toString),Mi=ur(Object.prototype.hasOwnProperty),nu=ur(Object.prototype.toString),Jr=ur(RegExp.prototype.test),hs=$A(TypeError);function ur(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return Hv(e,t,r)}}function $A(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return $v(e,n)}}function Dn(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Lo;if(fT&&fT(e,null),!zl(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const o=n(a);o!==a&&(gW(t)||(t[r]=o),a=o)}e[a]=!0}return e}function _W(e){for(let t=0;t<e.length;t++)Mi(e,t)||(e[t]=null);return e}function Yi(e){const t=Ol(null);for(const r of zA(e)){var n=pW(r,2);const a=n[0],o=n[1];Mi(e,a)&&(zl(o)?t[a]=_W(o):o&&typeof o=="object"&&o.constructor===Object?t[a]=Yi(o):t[a]=o)}return t}function wW(e){switch(typeof e){case"string":return e;case"number":return vW(e);case"boolean":return kW(e);case"bigint":return mT?mT(e):"0";case"symbol":return xT?xT(e):"Symbol()";case"undefined":return nu(e);case"function":case"object":{if(e===null)return nu(e);const t=e,n=ga(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:nu(r)}return nu(e)}default:return nu(e)}}function ga(e,t){for(;e!==null;){const r=UA(e,t);if(r){if(r.get)return ur(r.get);if(typeof r.value=="function")return ur(r.value)}e=qA(e)}function n(){return null}return n}function SW(e,t){for(;e!==null;){const n=UA(e,t);if(n)return n.get?ur(n.get):null;e=qA(e)}return null}function EW(e){try{return Jr(e,""),!0}catch{return!1}}const yT=Vr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Hb=Vr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$b=Vr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),NW=Vr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wb=Vr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),CW=Vr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bT=Vr(["#text"]),vT=Vr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Vb=Vr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),kT=Vr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hf=Vr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jW=ei(/{{[\w\W]*|^[\w\W]*}}/g),TW=ei(/<%[\w\W]*|^[\w\W]*%>/g),RW=ei(/\${[\w\W]*/g),AW=ei(/^data-[\-\w.\u00B7-\uFFFF]+$/),IW=ei(/^aria-[\-\w]+$/),_T=ei(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),MW=ei(/^(?:\w+script|data):/i),LW=ei(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),OW=ei(/^html$/i),DW=ei(/^[a-z][.\w]*(-[.\w]+)+$/i),Gb=ei(/<[/\w!]/g),wT=ei(/<[/\w]/g),PW=ei(/<\/no(script|embed|frames)/i),ST=ei(/\/>/i),Tr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},FW=Vr(Dn({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),BW=function(){return typeof window>"u"?null:window},zW=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ET=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ys=function(t,n,r,a){return Mi(t,n)&&zl(t[n])?Dn(a.base?Yi(a.base):{},t[n],a.transform):r},Kb=function(t,n,r){const a=Mi(t,n)?t[n]:void 0;return a&&typeof a=="object"?Yi(a):r()};function WA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:BW();const t=Fe=>WA(Fe);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==Tr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,l=e.Node,u=e.Element,d=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const f=e.DOMParser,p=e.trustedTypes,g=u.prototype,m=ga(g,"cloneNode"),x=ga(g,"remove"),v=ga(g,"removeAttributeNode"),k=ga(g,"nextSibling"),_=ga(g,"childNodes"),S=ga(g,"parentNode"),E=ga(g,"shadowRoot"),N=ga(g,"attributes"),R=l&&l.prototype?ga(l.prototype,"nodeType"):null,T=l&&l.prototype?ga(l.prototype,"nodeName"):null,j=l&&l.prototype?ga(l.prototype,"ownerDocument"):null,I=function($){return R?R($):$.nodeType},M=function($){return T?T($):$.nodeName},L=SW(g,"namespaceURI"),A=function($){return L?L($):$.namespaceURI};if(typeof o=="function"){const Fe=n.createElement("template");Fe.content&&Fe.content.ownerDocument&&(n=Fe.content.ownerDocument)}let O,F="",Q,H=!1,P=0;const K=function(){if(P>0)throw hs('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},W=function($){K(),P++;try{return O.createHTML($)}finally{P--}},Y=function($){K(),P++;try{return O.createScriptURL($)}finally{P--}},ce=function(){return H||(Q=zW(p,a),H=!0),Q},z=n,G=z.implementation,X=z.createNodeIterator,B=z.createDocumentFragment,te=z.getElementsByTagName,V=r.importNode;let U=ET();t.isSupported=typeof zA=="function"&&typeof S=="function"&&G&&G.createHTMLDocument!==void 0;const oe=jW,ae=TW,xe=RW,Se=AW,Xe=IW,bt=MW,at=LW,yt=DW;let et=_T,Ie=null;const Ge=Dn({},[...yT,...Hb,...$b,...Wb,...bT]);let tt=null;const kt=Dn({},[...vT,...Vb,...kT,...hf]);let Kt=Object.seal(Ol(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),an=null,Vt=null;const ze=Object.seal(Ol(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,nt=!0,ft=!1,ue=!0,be=!1,qe=!0,me=!1,pt=!1,gt=null,wt=null,ht=!1,$t=!1,Wt=!1,Je=!1,zt=!0,St=!1;const Yt="user-content-";let cn=!0,xn=!1,Rn=null,re={},Te=null;const rt=Dn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Pt=null;const Be=Dn({},["audio","video","img","source","image","track"]);let lt=null;const ke=Dn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",Ye="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let ie=xt,Pe=!1,$e=null;const Tt=Dn({},[Ce,Ye,xt],Ub),Ne=Vr(["mi","mo","mn","ms","mtext"]);let We=Dn({},Ne);const Et=Vr(["annotation-xml"]);let vn=Dn({},Et);const vr=Dn({},["title","style","font","a","script"]);let pn=null;const jn=["application/xhtml+xml","text/html"],Fr="text/html";let pe=null,Xn=null;const Br=n.createElement("form"),ki=function($){return $ instanceof RegExp||$ instanceof Function},Ji=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xn&&Xn===$)return;(!$||typeof $!="object")&&($={}),$=Yi($),pn=jn.indexOf($.PARSER_MEDIA_TYPE)===-1?Fr:$.PARSER_MEDIA_TYPE,pe=pn==="application/xhtml+xml"?Ub:Lo,Ie=Ys($,"ALLOWED_TAGS",Ge,{transform:pe}),tt=Ys($,"ALLOWED_ATTR",kt,{transform:pe}),$e=Ys($,"ALLOWED_NAMESPACES",Tt,{transform:Ub}),lt=Ys($,"ADD_URI_SAFE_ATTR",ke,{transform:pe,base:ke}),Pt=Ys($,"ADD_DATA_URI_TAGS",Be,{transform:pe,base:Be}),Te=Ys($,"FORBID_CONTENTS",rt,{transform:pe}),an=Ys($,"FORBID_TAGS",Yi({}),{transform:pe}),Vt=Ys($,"FORBID_ATTR",Yi({}),{transform:pe}),re=Mi($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?Yi($.USE_PROFILES):$.USE_PROFILES:!1,De=$.ALLOW_ARIA_ATTR!==!1,nt=$.ALLOW_DATA_ATTR!==!1,ft=$.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,be=$.SAFE_FOR_TEMPLATES||!1,qe=$.SAFE_FOR_XML!==!1,me=$.WHOLE_DOCUMENT||!1,$t=$.RETURN_DOM||!1,Wt=$.RETURN_DOM_FRAGMENT||!1,Je=$.RETURN_TRUSTED_TYPE||!1,ht=$.FORCE_BODY||!1,zt=$.SANITIZE_DOM!==!1,St=$.SANITIZE_NAMED_PROPS||!1,cn=$.KEEP_CONTENT!==!1,xn=$.IN_PLACE||!1,et=EW($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:_T,ie=typeof $.NAMESPACE=="string"?$.NAMESPACE:xt,We=Kb($,"MATHML_TEXT_INTEGRATION_POINTS",()=>Dn({},Ne)),vn=Kb($,"HTML_INTEGRATION_POINTS",()=>Dn({},Et));const de=Kb($,"CUSTOM_ELEMENT_HANDLING",()=>Ol(null));if(Kt=Ol(null),Mi(de,"tagNameCheck")&&ki(de.tagNameCheck)&&(Kt.tagNameCheck=de.tagNameCheck),Mi(de,"attributeNameCheck")&&ki(de.attributeNameCheck)&&(Kt.attributeNameCheck=de.attributeNameCheck),Mi(de,"allowCustomizedBuiltInElements")&&typeof de.allowCustomizedBuiltInElements=="boolean"&&(Kt.allowCustomizedBuiltInElements=de.allowCustomizedBuiltInElements),ei(Kt),be&&(nt=!1),Wt&&($t=!0),re&&(Ie=Dn({},bT),tt=Ol(null),re.html===!0&&(Dn(Ie,yT),Dn(tt,vT)),re.svg===!0&&(Dn(Ie,Hb),Dn(tt,Vb),Dn(tt,hf)),re.svgFilters===!0&&(Dn(Ie,$b),Dn(tt,Vb),Dn(tt,hf)),re.mathMl===!0&&(Dn(Ie,Wb),Dn(tt,kT),Dn(tt,hf))),ze.tagCheck=null,ze.attributeCheck=null,Mi($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?ze.tagCheck=$.ADD_TAGS:zl($.ADD_TAGS)&&(Ie===Ge&&(Ie=Yi(Ie)),Dn(Ie,$.ADD_TAGS,pe))),Mi($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?ze.attributeCheck=$.ADD_ATTR:zl($.ADD_ATTR)&&(tt===kt&&(tt=Yi(tt)),Dn(tt,$.ADD_ATTR,pe))),Mi($,"ADD_FORBID_CONTENTS")&&zl($.ADD_FORBID_CONTENTS)&&(Te===rt&&(Te=Yi(Te)),Dn(Te,$.ADD_FORBID_CONTENTS,pe)),cn&&(Ie["#text"]=!0),me&&Dn(Ie,["html","head","body"]),Ie.table&&(Dn(Ie,["tbody"]),delete an.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw hs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Me=O;O=$.TRUSTED_TYPES_POLICY;try{F=W("")}catch(Oe){throw O=Me,Oe}}else $.TRUSTED_TYPES_POLICY===null?(O=void 0,F=""):(O===void 0&&(O=ce()),O&&typeof F=="string"&&(F=W("")));Vr&&Vr($),Xn=$},Kn=Dn({},[...Hb,...$b,...NW]),_s=Dn({},[...Wb,...CW]),pi=function($,de,Me){return de.namespaceURI===xt?$==="svg":de.namespaceURI===Ce?$==="svg"&&(Me==="annotation-xml"||We[Me]):!!Kn[$]},ea=function($,de,Me){return de.namespaceURI===xt?$==="math":de.namespaceURI===Ye?$==="math"&&vn[Me]:!!_s[$]},Ba=function($,de,Me){return de.namespaceURI===Ye&&!vn[Me]||de.namespaceURI===Ce&&!We[Me]?!1:!_s[$]&&(vr[$]||!Kn[$])},je=function($){const de=A($),Me=Lo(M($)),Oe=S($);let Nt,Ht;return Oe&&I(Oe)===Tr.element?(Nt={namespaceURI:A(Oe)},Ht=Lo(M(Oe))):(Nt={namespaceURI:ie},Ht="template"),$e[de]?de===Ye?pi(Me,Nt,Ht):de===Ce?ea(Me,Nt,Ht):de===xt?Ba(Me,Nt,Ht):!!(pn==="application/xhtml+xml"&&$e[de]):!1},mt=function($){Jc(t.removed,{element:$});try{S($).removeChild($)}catch{if(x($),!S($))throw hs("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},It=function($,de,Me){try{v($,de)}catch{try{$.removeAttribute(Me)}catch{}}},gn=function($){Pi($);const de=_($);de&&ps(xW(de),Oe=>{try{x(Oe)}catch{}});const Me=I($)===Tr.element?N($):null;if(Me)for(let Oe=Me.length-1;Oe>=0;--Oe){const Nt=Me[Oe],Ht=Nt&&Nt.name;typeof Ht=="string"&&It($,Nt,Ht)}},Ln=function($,de,Me){if(!Me)try{Me=de.getAttributeNode($)}catch{Me=null}Jc(t.removed,{attribute:Me||null,from:de});try{Me?v(de,Me):de.removeAttribute($)}catch{try{de.removeAttribute($)}catch{}}if($==="is")if($t||Wt)try{mt(de)}catch{}else try{de.setAttribute($,"")}catch{}},Wn=function($){const de=N($);if(de)for(let Me=de.length-1;Me>=0;--Me){const Oe=de[Me],Nt=Oe&&Oe.name;typeof Nt!="string"||tt[pe(Nt)]||It($,Oe,Nt)}},Sr=function($,de){let Me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const Oe=[$];for(;Oe.length>0;){const Nt=Oe.pop();if(de(Nt)===!1)continue;if(Me&&I(Nt)===Tr.element){const Ue=E(Nt);ir(Ue)&&Oe.push(Ue)}const Ht=_(Nt);if(Ht)for(let Ue=Ht.length-1;Ue>=0;--Ue)Oe.push(Ht[Ue])}},Pi=function($){Sr($,de=>{I(de)===Tr.element&&Wn(de)})},ar=function($){const de=[];return Sr($,Me=>{de.push(Me)},!0),de},Er=function($,de){const Me=zb();ps(ar($),Oe=>{I(Oe)===Tr.element&&qb(Me,Oe)}),ps(de,Oe=>{I(Oe)===Tr.element&&!eu(Me,Oe)&&Wn(Oe)})},hi=function($,de){let Me=!1;return ps(t.removed,Oe=>{Oe.element&&(Me=Me||Oe.element===$,Pi(Oe.element))}),Er($,de),Me},ti=8,ni=function($,de){const Me=Rn;let Oe=null;const Nt=()=>(Oe||(Oe=zb(),ps(de,Ht=>{qb(Oe,Ht)})),Oe);for(let Ht=0;;Ht++){const Ue=ar($),fr=[$];let Yr=!1;if(ps(Ue,mr=>{I(mr)===Tr.documentFragment?Jc(fr,mr):!Yr&&!eu(Me,mr)&&(Yr=eu(Nt(),mr))}),!Yr)return;if(Ht>=ti)throw hs("the tree kept changing during in-place sanitization; refusing to return it");ps(fr,(mr,Cr)=>{va(mr,Cr>0,$,Nt())})}},va=function($,de,Me,Oe){const Nt=Gr($);let Ht;for(;Ht=Nt.nextNode();)!eu(Oe,Ht)||eu(Rn,Ht)||(de&&sn(U.uponSanitizeShadowNode,Ht,null),ut(Ht,Me),Fi(Ht,Me),ir(Ht.content)&&ts(Ht.content))},ta=function($){Rn&&qb(Rn,$)},ka=function($,de){return qe?$==="patchsrc"?!0:$==="for"&&de!=="label"&&de!=="output":!1},_a=function($){qe&&Sr($,de=>{const Me=I(de);if(Me===Tr.processingInstruction||Me===Tr.comment&&Jr(wT,de.data)){try{x(de)}catch{}return!1}if(Me===Tr.element){const Oe=de,Nt=pe(M(de));try{Oe.hasAttribute&&Oe.hasAttribute("patchsrc")&&Oe.removeAttribute("patchsrc"),Oe.hasAttribute&&Oe.hasAttribute("for")&&ka("for",Nt)&&Oe.removeAttribute("for")}catch{}}return!0})},gi=function($){let de=null,Me=null;if(ht)$="<remove></remove>"+$;else{const Ht=hT($,/^[\r\n\t ]+/);Me=Ht&&Ht[0]}pn==="application/xhtml+xml"&&ie===xt&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const Oe=O?W($):$;if(ie===xt)try{de=new f().parseFromString(Oe,pn)}catch{}if(!de||!de.documentElement){de=G.createDocument(ie,"template",null);try{de.documentElement.innerHTML=Pe?F:Oe}catch{}}const Nt=de.body||de.documentElement;return $&&Me&&Nt.insertBefore(n.createTextNode(Me),Nt.childNodes[0]||null),ie===xt?te.call(de,me?"html":"body")[0]:me?de.documentElement:Nt},Gr=function($){const de=j?j($):$.ownerDocument;return X.call(de||$,$,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Nr=function($){return $=tu($,oe," "),$=tu($,ae," "),$=tu($,xe," "),$},Kr=function($){var de;un($);const Me=(de=$.querySelectorAll)===null||de===void 0?void 0:de.call($,"template");Me&&ps(Me,Oe=>{ir(Oe.content)&&Kr(Oe.content)})},un=function($){$.normalize();const de=j?j($):$.ownerDocument,Me=X.call(de||$,$,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let Oe=Me.nextNode();for(;Oe;)Oe.data=Nr(Oe.data),Oe=Me.nextNode()},Ut=function($){const de=T?T($):null;return typeof de!="string"||pe(de)!=="form"?!1:typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||$.attributes!==N($)||typeof $.removeAttribute!="function"||typeof $.removeAttributeNode!="function"||typeof $.getAttributeNode!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function"||$.nodeType!==R($)||$.childNodes!==_($)},ir=function($){if(!R||typeof $!="object"||$===null)return!1;try{return R($)===Tr.documentFragment}catch{return!1}},Vn=function($){if(!R||typeof $!="object"||$===null)return!1;try{return typeof R($)=="number"}catch{return!1}};function sn(Fe,$,de){Fe.length!==0&&ps(Fe,Me=>{Me.call(t,$,de,Xn)})}const _i=function($,de){return!!(qe&&$.hasChildNodes()&&!Vn($.firstElementChild)&&Jr(Gb,$.textContent)&&Jr(Gb,$.innerHTML)||qe&&FW[de]&&I($)===Tr.element&&A($)===xt&&(Vn($.firstElementChild)||typeof $.textContent=="string"&&Jr(Gb,$.textContent))||$.nodeType===Tr.processingInstruction||qe&&$.nodeType===Tr.comment&&Jr(wT,$.data))},zr=function($,de){if($ instanceof RegExp)return Jr($,de);if($ instanceof Function){for(var Me=arguments.length,Oe=new Array(Me>2?Me-2:0),Nt=2;Nt<Me;Nt++)Oe[Nt-2]=arguments[Nt];return!!$(de,...Oe)}return!1},na=function($,de,Me){if(!an[de]&&In(de)&&zr(Kt.tagNameCheck,de))return!1;if(cn&&!Te[de]&&!Te[Lo(de)]){const Oe=S($),Nt=_($);if(Nt&&Oe){const Ht=Nt.length;for(let Ue=Ht-1;Ue>=0;--Ue){const fr=$===Me?m(Nt[Ue],!0):Nt[Ue];Oe.insertBefore(fr,k($))}}}return mt($),!0},ri=function($,de,Me,Oe){return $.length===0?de:de===Me||de===Oe?Yi(de):de},Qe=function($,de){return $===de||S($)!==null?!1:(xn&&Pi($),!0)},ut=function($,de){if(ta($),sn(U.beforeSanitizeElements,$,null),Qe($,de))return!0;if(Ut($))return mt($),!0;const Me=pe(M($));if(Ie=ri(U.uponSanitizeElement,Ie,Ge,gt),sn(U.uponSanitizeElement,$,{tagName:Me,allowedTags:Ie}),Qe($,de))return!0;if(_i($,Me))return mt($),!0;if(an[Me]||!(ze.tagCheck instanceof Function&&ze.tagCheck(Me))&&!Ie[Me]){const Oe=na($,Me,de);return Oe===!1&&(sn(U.afterSanitizeElements,$,null),Qe($,de))?!0:Oe}if(I($)===Tr.element&&!je($)||(Me==="noscript"||Me==="noembed"||Me==="noframes")&&Jr(PW,$.innerHTML))return mt($),!0;if(be&&$.nodeType===Tr.text){const Oe=Nr($.textContent);$.textContent!==Oe&&(Jc(t.removed,{element:$.cloneNode()}),$.textContent=Oe)}return sn(U.afterSanitizeElements,$,null),Qe($,de)},Gt=function($,de,Me){if(Vt[de]||ka(de,$)||zt&&(de==="id"||de==="name")&&(Me in n||Me in Br))return!1;const Oe=tt[de]||ze.attributeCheck instanceof Function&&ze.attributeCheck(de,$);return nt&&Jr(Se,de)||De&&Jr(Xe,de)?!0:Oe?lt[de]||Jr(et,tu(Me,at,""))||(de==="src"||de==="xlink:href"||de==="href")&&$!=="script"&&gT(Me,"data:")===0&&Pt[$]||ft&&!Jr(bt,tu(Me,at,""))?!0:!Me:In($)&&zr(Kt.tagNameCheck,$)&&zr(Kt.attributeNameCheck,de,$)||de==="is"&&Kt.allowCustomizedBuiltInElements&&zr(Kt.tagNameCheck,Me)},kn=Dn({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),In=function($){return!kn[Lo($)]&&Jr(yt,$)},Zn=function($,de,Me,Oe){if(O&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Me)switch(p.getAttributeType($,de)){case"TrustedHTML":return W(Oe);case"TrustedScriptURL":return Y(Oe)}return Oe},wi=function($,de,Me,Oe){try{return Me?$.setAttributeNS(Me,de,Oe):$.setAttribute(de,Oe),Ut($)?(mt($),!1):!0}catch{return Ln(de,$),!1}},es=function($,de){return qe&&Jr(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,de)?!0:Lo($)==="attributename"&&hT(de,"href")!==null},Fi=function($,de){if(sn(U.beforeSanitizeAttributes,$,null),Qe($,de))return;const Me=$.attributes;if(!Me||Ut($))return;tt=ri(U.uponSanitizeAttribute,tt,kt,wt);const Oe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tt,forceKeepAttr:void 0};let Nt=Me.length;const Ht=pe($.nodeName);for(;Nt--;){const Ue=Me[Nt],fr=Ue.name,Yr=Ue.namespaceURI,mr=Ue.value,Cr=pe(fr),ra=mr;let sr=fr==="value"?ra:bW(ra),za=!1;if(Oe.attrName=Cr,Oe.attrValue=sr,Oe.keepAttr=!0,Oe.forceKeepAttr=void 0,sn(U.uponSanitizeAttribute,$,Oe),sr=Oe.attrValue,St&&(Cr==="id"||Cr==="name")&&gT(sr,Yt)!==0&&(Ln(fr,$,Ue),sr=Yt+sr,za=!0),es(fr,sr)){Ln(fr,$,Ue);continue}if(!Oe.forceKeepAttr){if(!Oe.keepAttr){Ln(fr,$,Ue);continue}if(!ue&&Jr(ST,sr)){Ln(fr,$,Ue);continue}if(be&&(sr=Nr(sr)),!Gt(Ht,Cr,sr)){Ln(fr,$,Ue);continue}sr=Zn(Ht,Cr,Yr,sr),sr!==ra&&wi($,fr,Yr,sr)&&za&&pT(t.removed)}}sn(U.afterSanitizeAttributes,$,null),Qe($,de)},ts=function($){let de=null;const Me=Gr($);for(sn(U.beforeSanitizeShadowDOM,$,null);de=Me.nextNode();)if(sn(U.uponSanitizeShadowNode,de,null),ut(de,$),Fi(de,$),ir(de.content)&&ts(de.content),I(de)===Tr.element){const Oe=E(de);ir(Oe)&&(wa(Oe),ts(Oe))}be&&un($),sn(U.afterSanitizeShadowDOM,$,null)},wa=function($){const de=[{node:$,shadow:null}];for(;de.length>0;){const Me=de.pop();if(Me.shadow){ts(Me.shadow);continue}const Oe=Me.node,Nt=I(Oe)===Tr.element,Ht=_(Oe);if(Ht)for(let Ue=Ht.length-1;Ue>=0;--Ue)de.push({node:Ht[Ue],shadow:null});if(Nt){const Ue=T?T(Oe):null;if(typeof Ue=="string"&&pe(Ue)==="template"){const fr=Oe.content;ir(fr)&&de.push({node:fr,shadow:null})}}if(Nt){const Ue=E(Oe);ir(Ue)&&de.push({node:null,shadow:Ue},{node:Ue,shadow:null})}}};return t.sanitize=function(Fe){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},de=null,Me=null,Oe=null,Nt=null;if(Pe=!Fe,Pe&&(Fe="<!-->"),typeof Fe!="string"&&!Vn(Fe)&&(Fe=wW(Fe),typeof Fe!="string"))throw hs("dirty is not a string, aborting");if(!t.isSupported)return Fe;pt?(Ie=gt,tt=wt):Ji($),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(Ie=Yi(Ie)),U.uponSanitizeAttribute.length>0&&(tt=Yi(tt)),t.removed=[];const Ht=xn&&typeof Fe!="string"&&Vn(Fe);let Ue=[];const fr=Rn;if(Ht){_a(Fe);const Cr=M(Fe);if(typeof Cr=="string"){const ra=pe(Cr);if(!Ie[ra]||an[ra])throw gn(Fe),hs("root node is forbidden and cannot be sanitized in-place")}if(Ut(Fe))throw gn(Fe),hs("root node is clobbered and cannot be sanitized in-place");Ue=ar(Fe),Rn=zb()}else if(Vn(Fe))de=gi("<!---->"),Me=de.ownerDocument.importNode(Fe,!0),Me.nodeType===Tr.element&&Me.nodeName==="BODY"||Me.nodeName==="HTML"?de=Me:de.appendChild(Me),wa(de);else{if(!$t&&!be&&!me&&Fe.indexOf("<")===-1)return O&&Je?W(Fe):Fe;if(de=gi(Fe),!de)return $t?null:Je?F:""}de&&ht&&mt(de.firstChild);const Yr=Ht?Fe:de;try{Ht&&wa(Fe);const Cr=Gr(Yr);for(;Oe=Cr.nextNode();)ut(Oe,Yr),Fi(Oe,Yr),ir(Oe.content)&&ts(Oe.content);Ht&&ni(Fe,Ue)}catch(Cr){throw Ht&&(gn(Fe),hi(Fe,Ue)),Cr}finally{Rn=fr}if(Ht){if(hi(Fe,Ue))throw hs("a node selected for removal could not be safely returned; refusing to sanitize in place");return be&&Kr(Fe),Fe}if($t){if(be&&Kr(de),Wt)for(Nt=B.call(de.ownerDocument);de.firstChild;)Nt.appendChild(de.firstChild);else Nt=de;return(tt.shadowroot||tt.shadowrootmode)&&(Nt=V.call(r,Nt,!0)),Nt}let mr=me?de.outerHTML:de.innerHTML;return me&&Ie["!doctype"]&&de.ownerDocument&&de.ownerDocument.doctype&&de.ownerDocument.doctype.name&&Jr(OW,de.ownerDocument.doctype.name)&&(mr="<!DOCTYPE "+de.ownerDocument.doctype.name+`>
|
|
119
|
-
`+mr),be&&(mr=Nr(mr)),O&&Je?W(mr):mr},t.setConfig=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ji(Fe),pt=!0,gt=Ie,wt=tt},t.clearConfig=function(){Xn=null,pt=!1,gt=null,wt=null,O=Q,F=""},t.isValidAttribute=function(Fe,$,de){Xn||Ji({});const Me=pe(Fe),Oe=pe($);return typeof de=="string"&&(es($,de)||!ue&&Jr(ST,de))?!1:Gt(Me,Oe,de)},t.addHook=function(Fe,$){typeof $=="function"&&Mi(U,Fe)&&Jc(U[Fe],$)},t.removeHook=function(Fe,$){if(Mi(U,Fe)){if($!==void 0){const de=mW(U[Fe],$);return de===-1?void 0:yW(U[Fe],de,1)[0]}return pT(U[Fe])}},t.removeHooks=function(Fe){Mi(U,Fe)&&(U[Fe]=[])},t.removeAllHooks=function(){U=ET()},t}var qW=WA();let Yb=null;function UW(){return Yb||(Yb=g4(()=>import("./mermaid.core-5bZB2_Y2.js").then(e=>e.cb),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),Yb}function NT(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let CT=0;function HW(){return CT+=1,"pave-canvas-"+CT}function $W({source:e}){const t=y.useRef(null),n=y.useRef(HW()),[r,a]=y.useState(null),[o,l]=y.useState(NT());return y.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=NT();l(function(f){return f!==d?d:f})});return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){u.disconnect()}},[]),y.useEffect(function(){let u=!1;return a(null),UW().then(function(d){u||(d.initialize({startOnLoad:!1,securityLevel:"strict",theme:o?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),d.render(n.current,e).then(function(f){if(!u&&t.current){let p=f.svg;p=p.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),p=p.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),p=p.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),p=p.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=p}}).catch(function(f){u||a(f&&f.message||String(f))}))}).catch(function(d){u||a("Failed to load mermaid: "+(d&&d.message||String(d)))}),function(){u=!0}},[e,o]),r?i.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[i.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),i.jsx("pre",{className:"whitespace-pre-wrap",children:r}),i.jsxs("details",{className:"mt-2",children:[i.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),i.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):i.jsx("div",{ref:t,className:"mermaid-canvas w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-full [&>svg]:h-auto"})}function WW({source:e}){const t=y.useMemo(function(){return qW.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return i.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function VW({source:e}){return i.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function GW({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=i.jsx($W,{source:e.source}):e.type==="svg"?t=i.jsx(WW,{source:e.source}):e.type==="katex"?t=i.jsx(VW,{source:e.source}):t=i.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function jT({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,a]=y.useState(Math.max(0,n.length-1)),[o,l]=y.useState(1),[u,d]=y.useState(!1);y.useEffect(function(){a(function(_){return _>=n.length-2?Math.max(0,n.length-1):Math.min(_,Math.max(0,n.length-1))})},[n.length]),y.useEffect(function(){l(1)},[r]),y.useEffect(function(){if(!u)return;const _=S=>{S.key==="Escape"&&d(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[u]);const f=y.useCallback(()=>l(_=>Math.min(4,+(_+.25).toFixed(2))),[]),p=y.useCallback(()=>l(_=>Math.max(.5,+(_-.25).toFixed(2))),[]),g=y.useCallback(()=>l(1),[]);if(n.length===0)return i.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[i.jsx("svg",{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),i.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-xs",children:["Ask the agent to draw something here. It can use the ",i.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"canvas"})," tool to render Mermaid diagrams, SVG illustrations, or math."]})]});const m=Math.min(Math.max(0,r),n.length-1),x=n[m],v=i.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-b border-gray-200 dark:border-gray-700 text-xs",children:[n.length>1?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>a(Math.max(0,m-1)),disabled:m===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),i.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",n.length]}),i.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,m+1)),disabled:m===n.length-1,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Next canvas",children:"→"})]}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:p,disabled:o<=.5,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom out",children:"−"}),i.jsxs("button",{type:"button",onClick:g,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(o*100),"%"]}),i.jsx("button",{type:"button",onClick:f,disabled:o>=4,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom in",children:"+"}),i.jsx("button",{type:"button",onClick:()=>d(_=>!_),className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:u?"Exit fullscreen (Esc)":"Fullscreen",children:u?"⤢":"⛶"}),t?i.jsx("button",{type:"button",onClick:t,className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400",title:"Clear all canvases (hides them; messages preserved)",children:"✕"}):null]})]}),k=i.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[x.title?i.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:x.title}):null,i.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:i.jsx(GW,{canvas:x})}),x.caption?i.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:x.caption}):null]});return u?i.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):i.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function KW(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function YW(e,t){const n=KW(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}function QW(e){const{serverContextLimit:t,registryLimitMap:n={},limitModelID:r,effectiveActiveModel:a,modelLimits:o={},defaultLimit:l}=e||{};return t||n[r]||n[a]||o[r]||l}function TT(e,t,n,r){if(typeof t!="string"||!t)return;const a=t.includes("/")?t.split("/").pop():t,o=a&&a!==t?[t,a]:[t];for(let l=0;l<o.length;l+=1)(r||!Object.prototype.hasOwnProperty.call(e,o[l]))&&(e[o[l]]=n)}function XW(e){const t={};if(!Array.isArray(e))return t;for(let n=0;n<e.length;n+=1){const r=e[n],a=r&&r.limit?r.limit.context:null;typeof a!="number"||a<=0||(TT(t,r.key,a,!0),TT(t,r.target,a,!1))}return t}const ZW={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function JW(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function eV(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}function tV({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const nV=3,RT=4,rV=4,iV=1024;function aV(e){if(typeof e!="string"||e.length===0)return 0;let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=57343?(t+=4,n++):t+=3}return t}function AT(e){if(typeof e=="string")return e;if(e==null)return"";try{return JSON.stringify(e)}catch{return""}}function ru(e){return Math.ceil(aV(e)/nV)}function sV(e){if(!Array.isArray(e))return 0;let t=0;for(const n of e){if(!n)continue;const r=Array.isArray(n.parts)?n.parts:[];let a=0,o=!1;for(const l of r){if(!l)continue;const u=l.type;if(u==="text"||u==="error"||u==="file"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(a+=ru(d),o=!0)}else if(u==="reasoning"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(a+=ru(d),o=!0)}else if(u==="image_url"||l.image_url)a+=iV,o=!0;else if(u==="tool"){const d=l.state||{},f=typeof l.tool=="string"?l.tool:"";a+=rV+RT,f&&(a+=ru(f)),d.input!=null&&(a+=ru(AT(d.input))),d.output!=null&&(a+=ru(AT(d.output))),o=!0}}o&&(t+=a+RT)}return t}const oV={"claude-opus-4.5":2e5,"claude-opus-4.6":2e5,"claude-sonnet-4":2e5,"claude-sonnet-4.5":2e5,"claude-sonnet-4.6":2e5,"gpt-4o":128e3,"gpt-4.1":1047576,"gpt-4-turbo":128e3,"gpt-4":8192,o1:2e5,"o1-mini":128e3,o3:2e5,"o3-mini":2e5},lV=128e3;function gf(e){const[t,n]=y.useState(e),r=y.useRef(e),a=y.useRef(0),o=y.useRef(0);return y.useEffect(()=>{if(e===r.current)return;a.current=0,r.current=t;const l=400,u=t,d=e,f=p=>{a.current||(a.current=p);const g=p-a.current,m=Math.min(g/l,1),x=1-(1-m)**3;n(Math.round(u+(d-u)*x)),m<1?o.current=requestAnimationFrame(f):n(d)};return o.current=requestAnimationFrame(f),()=>cancelAnimationFrame(o.current)},[e]),t}function cV({messages:e,isBusy:t,isCompacting:n,activeModel:r,sessionModel:a,isPrivateMode:o,registryEntries:l}){var B,te;var{t:u}=rn();const d=e.filter(V=>{var U;return((U=V.info)==null?void 0:U.role)==="user"}).length,f=e.filter(V=>{var U;return((U=V.info)==null?void 0:U.role)==="assistant"}).length,p=y.useMemo(()=>sV(e),[e]);let g=0,m=0,x=0,v=null,k=null;for(let V=e.length-1;V>=0;V--){const U=e[V];if(((B=U.info)==null?void 0:B.role)==="assistant"&&((te=U.info)==null?void 0:te.mode)!=="compaction"){const oe=U.info.tokens;if(oe&&(oe.input||oe.output)){!v&&U.info.modelID&&(v=U.info.modelID),g=oe.lastInput??oe.input??0,m=oe.lastOutput??oe.output??0,x=oe.lastReasoning??oe.reasoning??0,U.info.contextLimit&&(k=U.info.contextLimit);break}}}const _=gf(p),S=gf(g),E=gf(m),N=gf(x),R=S+E+N,T=p>0||g+m+x>0;let j=r;typeof a=="string"&&a?j=a:a&&a.providerID&&a.modelID&&(j=a.providerID+"/"+a.modelID);let{modelID:I,activeModelID:M}=YW(j,v),L=null;if(o){I="privacy",M="privacy";let V=null;typeof a=="string"&&a?V=a.includes("/")?a.split("/").pop():a:a&&a.modelID&&(V=a.modelID),L=V||(r?String(r).split("/").pop():null)}else v&&M&&v!==M&&(L=v);const A=y.useMemo(()=>XW(l),[l]),F=QW({serverContextLimit:k,registryLimitMap:A,limitModelID:v||I,effectiveActiveModel:j,modelLimits:oV,defaultLimit:lV}),Q=Math.min(100,Math.round(_/F*100));let H="bg-green-500";Q>=90?H="bg-red-500":Q>=75?H="bg-orange-500":Q>=50&&(H="bg-yellow-500");const P="border-gray-200 dark:border-gray-800",K="text-gray-500 dark:text-gray-400",W="text-gray-500 dark:text-gray-400",Y="text-gray-700 dark:text-gray-300",ce="border-gray-100 dark:border-gray-800";return i.jsxs("div",{className:`p-4 border-t ${P}`,children:[i.jsx("p",{className:`text-xs ${K} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:u("token_usage.messages")}),i.jsx("span",{className:`text-xs font-medium ${Y}`,children:d+f})]}),I&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:u("token_usage.model")}),i.jsx("span",{className:`text-xs font-medium ${Y} truncate ml-2 max-w-[140px]`,children:IT(I)})]}),L&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:u("token_usage.originally")}),i.jsx("span",{className:`text-xs ${W} truncate ml-2 max-w-[140px]`,children:IT(L)})]}),(()=>{const V=tV({isBusy:t,isCompacting:n}),U=V==="compacting"?"bg-amber-400 animate-pulse":V==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",oe=u(V==="compacting"?"token_usage.compacting":V==="generating"?"token_usage.generating":"token_usage.idle");return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:u("token_usage.status")}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${U}`}),i.jsx("span",{className:`text-xs font-medium ${Y}`,children:oe})]})]})})(),T?i.jsx(i.Fragment,{children:i.jsxs("div",{className:`border-t ${ce} pt-2 mt-2`,children:[i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("span",{className:`text-xs ${W}`,title:"Conversation text measured in the browser (bytes ÷ 3 + per-entry envelopes). Excludes the system prompt and tool schemas, so it reads below the true wire.",children:["Context ",i.jsx("span",{className:"opacity-70",children:"est"})]}),i.jsxs("span",{className:`text-xs ${W}`,children:[Q,"% of ",(F/1e3).toFixed(0),"k"]})]}),i.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${H} transition-all duration-300`,style:{width:`${Q}%`}})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:"Input"}),i.jsx("span",{className:`text-xs font-medium ${Y} tabular-nums`,children:S.toLocaleString()})]}),i.jsxs("div",{className:"flex items-center justify-between mt-1",children:[i.jsx("span",{className:`text-xs ${W}`,children:"Output"}),i.jsx("span",{className:`text-xs font-medium ${Y} tabular-nums`,children:E.toLocaleString()})]}),x>0&&i.jsxs("div",{className:"flex items-center justify-between mt-1",children:[i.jsx("span",{className:`text-xs ${W}`,children:"Reasoning"}),i.jsx("span",{className:`text-xs font-medium ${Y} tabular-nums`,children:N.toLocaleString()})]}),i.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${ce}`,children:[i.jsxs("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",title:"Measured prompt_tokens recorded for the PREVIOUS request — a lower bound, not the current window size.",children:["Total ",i.jsx("span",{className:"opacity-70",children:"measured"})]}),i.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:R.toLocaleString()})]})]})}):i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${W}`,children:"Tokens"}),i.jsx("span",{className:`text-xs ${W}`,children:"--"})]})]})]})}function IT(e){return e?{"claude-opus-4.5":"Claude Opus 4.5","claude-opus-4.6":"Claude Opus 4.6","claude-sonnet-4":"Claude Sonnet 4","claude-sonnet-4.5":"Claude Sonnet 4.5","claude-sonnet-4.6":"Claude Sonnet 4.6","gpt-4o":"GPT-4o","gpt-4.1":"GPT-4.1","gpt-4-turbo":"GPT-4 Turbo","gpt-4":"GPT-4"}[e]||e:""}function uV({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:o}){const{t:l}=rn(),[u,d]=y.useState(!1),f=y.useRef(null),[p,g]=y.useState(-1),m=y.useRef([]);y.useEffect(()=>{if(!u)return;function E(N){f.current&&!f.current.contains(N.target)&&d(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),y.useEffect(()=>{if(!u)return;function E(N){if(N.key==="Escape"){d(!1);return}N.key!=="ArrowDown"&&N.key!=="ArrowUp"&&N.key!=="Home"&&N.key!=="End"||(N.preventDefault(),g(R=>{const T=m.current.length;if(!T)return R;const j=typeof R=="number"?R:-1;let I=j;return N.key==="ArrowDown"?I=j<T-1?j+1:0:N.key==="ArrowUp"?I=j>0?j-1:T-1:N.key==="Home"?I=0:N.key==="End"&&(I=T-1),m.current[I]&&m.current[I].focus(),I}))}return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[u]);const x=typeof e=="string"&&e.trim()?e.trim():null,v=x!=null,k=Array.isArray(n)?n:[],_=dV(x,t,k,l),S=y.useCallback(E=>{r(E===t||x&&x===E?null:E),d(!1)},[x,t,r]);return m.current.length=k.length,i.jsxs("div",{className:"relative",ref:f,children:[i.jsxs("button",{type:"button",onClick:()=>d(E=>!E),disabled:a,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(v||_?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(a?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:o||l("model_selector.title"),"aria-label":o||l("model_selector.title"),"aria-haspopup":"menu","aria-expanded":u,children:[o?i.jsxs("svg",{className:"w-3.5 h-3.5 shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 11c.667 0 2 .4 2 2v3a2 2 0 11-4 0v-3c0-1.6 1.333-2 2-2zM6 11V8a6 6 0 1112 0v3"}),i.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):i.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),i.jsx("span",{className:"max-w-[120px] truncate",children:_}),i.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&i.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",role:"menu","aria-label":l("model_selector.list_label"),children:[k.length===0&&i.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:l("model_selector.no_models")}),k.map((E,N)=>{const R=x===E.key,T=!!t&&(E.key===t||E.target===t||E.url===t),j=E.builtin?E.key:E.displayName||E.key;return i.jsxs("button",{type:"button",ref:I=>{m.current[N]=I},tabIndex:p===N?0:-1,role:"menuitemradio","aria-checked":R||!v&&T,onClick:()=>S(E.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(R||!v&&T?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[i.jsx("span",{className:"font-medium",children:j}),T&&i.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},E.key)})]})]})}function dV(e,t,n,r){return e?MT(e,n):t?MT(t,n):r("model_selector.default_label")}function fV(e,t){if(!e||!Array.isArray(t))return null;for(let n=0;n<t.length;n++){const r=t[n];if(r&&(r.key===e||r.target===e||r.url===e))return r}return null}function MT(e,t){if(!e)return"";const n=fV(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function pV(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,a=e.t,o=e.disabled,l=y.useState(!1),u=l[0],d=l[1],f=y.useState([]),p=f[0],g=f[1],m=y.useState(!1),x=m[0],v=m[1],k=y.useRef(null),_=t instanceof Array?new Set(t):new Set,S=y.useCallback(async function(){v(!0);try{var T=await Zv();g(T||[])}catch{}finally{v(!1)}},[]);y.useEffect(function(){S()},[S]),y.useEffect(function(){if(!u)return;function T(j){k.current&&!k.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",T),function(){document.removeEventListener("mousedown",T)}},[u]);var E=p.filter(function(T){return _.has(T.name)}).length,N=Math.max(0,p.length-E),R=E;return i.jsxs("div",{className:"relative",ref:k,children:[i.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(R>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(o?" opacity-50 cursor-not-allowed":""),title:a("skills.toggle_title"),"aria-label":a("skills.toggle_title"),children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),N>0&&i.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 text-[9px] font-bold flex items-center justify-center bg-primary-500 text-white rounded-full",children:N})]}),u&&i.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 max-h-80 overflow-y-auto",children:[i.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[i.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:a("skills.toggle_header")}),i.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:a("skills.toggle_hint")})]}),x?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?i.jsx("div",{className:"px-3 py-4 text-center",children:i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("skills.no_skills")})}):i.jsx("div",{className:"py-1",children:p.map(function(T){var j=_.has(T.name);return i.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:T.name}),i.jsx("button",{onClick:function(){n(T.name,j)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(j?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!j,children:i.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(j?"translate-x-1":"translate-x-5")})})]},T.name)})}),r&&i.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:i.jsx("button",{onClick:r,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:a("skills.reset_to_defaults")})})]})]})}function hV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875S10.5 3.089 10.5 4.125c0 .369.128.713.349 1.003.215.283.401.604.401.959V6a.75.75 0 01-.75.75H7.5a.75.75 0 00-.75.75v2.25c0 .414-.336.75-.75.75S5.25 10.164 5.25 9.75V9A2.25 2.25 0 003 11.25v.75a.75.75 0 00.75.75h2.25c.414 0 .75.336.75.75s-.336.75-.75.75H3.75a.75.75 0 00-.75.75v.75A2.25 2.25 0 005.25 18h1.5a.75.75 0 01.75.75v.75c0 .414.336.75.75.75h6a.75.75 0 00.75-.75v-.75a.75.75 0 01.75-.75h1.5A2.25 2.25 0 0019.5 15.75v-.75a.75.75 0 00-.75-.75h-2.25a.75.75 0 01-.75-.75c0-.414.336-.75.75-.75h2.25a.75.75 0 00.75-.75v-.75A2.25 2.25 0 0017.25 9h-3a.75.75 0 01-.75-.75V6.087z"})})}function gV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M20 18h-2V9.25L12 13 6 9.25V18H4V6h1.2l6.8 4.25L18.8 6H20m0-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})})}function mV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M7.71 3.5l-5.71 9.94 3.48 6.06h5.44L4.07 8.56 7.71 3.5zm1.42 0L15.84 15h-6.71L2.42 3.5h6.71zm.71 12h11.46l-3.48 6.06H6.36l3.48-6.06zm.71-1L16.84 3.5l5.71 9.94-3.48.06H10.55z"})})}function xV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function yV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function bV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M3 6l3.5 12h2l2.5-8 2.5 8h2L19 6h-2.5l-2.25 8L12 6h-2l-2.25 8L5.5 6H3z"})})}function vV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2H5zm11.293 6.707l-5.5 5.5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 111.414-1.414L10.086 13.1l4.793-4.793a1 1 0 111.414 1.4z"})})}function kV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function _V({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15.5v-5l-3 3v-4l3-3v-3l4 4-4 4v4z"})})}function wV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function SV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})}function EV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6 2l6 3.75L6 9.5.002 5.75 6 2zm12 0l6 3.75-6 3.75-5.998-3.75L18 2zM.002 13.25L6 9.5l6 3.75L6 17 .002 13.25zm17.998-3.75l6 3.75L18 17l-5.998-3.75L18 9.5zM6 18.25l6-3.75 6 3.75-6 3.75-6-3.75z"})})}function NV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function CV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}function jV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}const LT={gmail:gV,gdrive:mV,discord:xV,whatsapp:yV,wrike:bV,gtasks:vV,mailchimp:kV,bamboohr:_V,pandadoc:wV,exa:SV,dropbox:EV,freshbooks:NV,gcal:CV,docx2md:jV};function TV(e){return Object.prototype.hasOwnProperty.call(LT,e)?LT[e]:hV}const OT={gmail:"#EA4335",gdrive:"#4285F4",discord:"#5865F2",whatsapp:"#25D366",wrike:"#08CF65",gtasks:"#4285F4",mailchimp:"#FFE01B",bamboohr:"#73C41D",pandadoc:"#4ABB5A",exa:"#6366F1",dropbox:"#0061FF",freshbooks:"#00B7E3",gcal:"#4285F4",docx2md:"#6B7280"},RV=new Set(["current","available","error","unsupported"]);function AV(e){const t=e||{},n=RV.has(t.status)?t.status:t.error?"error":t.hasUpdate?"available":"current";return{status:n,hasUpdate:n==="available",latestVersion:t.latestVersion||null,currentVersion:t.currentVersion||null,error:t.error||null,repository:t.repository||null}}function IV(e){const t=Object.create(null);return(e||[]).forEach(n=>{!n||!n.name||(t[n.name]=AV(n))}),t}function MV(e){const t={available:0,current:0,error:0,unsupported:0};return Object.values(e||{}).forEach(n=>{n&&Object.prototype.hasOwnProperty.call(t,n.status)&&t[n.status]++}),t}function LV({installed:e,configured:t,t:n}){return e?t?i.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),n("skills.configured")]}):i.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),n("skills.needs_setup")]}):i.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:n("skills.not_installed")})}function OV({skill:e,onClose:t,onSaved:n}){var{t:r}=rn(),a=Iu(),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(null);y.useEffect(function(){var L=!1;async function A(){try{var O=await vL(e.name);if(L)return;_(O);for(var F=Object.create(null),Q=Object.keys(O.tokens||{}),H=0;H<Q.length;H++){var P=Q[H],K=O.tokens[P]||{},W=K.env||P;F[W]=""}l(F),d(!1)}catch(Y){L||(m(Y.message),d(!1))}}return A(),function(){L=!0}},[e.name]);var S=y.useMemo(function(){if(!k||!k.tokens)return null;if(k.oauth&&k.oauth.broker){var L=!!k.oauth.connected,A=k.oauth.provider||"";return{provider:A?A.charAt(0).toUpperCase()+A.slice(1):"OAuth",brokered:!0,canConnect:!L,refreshConfigured:L,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var O=Object.keys(k.tokens),F=0;F<O.length;F++){var Q=k.tokens[O[F]]||{};if(Q.description&&Q.description.includes("OAuth")){for(var H=null,P=null,K=null,W=Object.entries(k.tokens),Y=0;Y<W.length;Y++){var ce=W[Y][0];ce.includes("REFRESH_TOKEN")&&(H=ce),(ce.includes("CLIENT_ID")||ce.includes("APP_KEY"))&&(P=ce),(ce.includes("CLIENT_SECRET")||ce.includes("APP_SECRET"))&&(K=ce)}if(H&&P){var z=k.tokens[H]&&k.tokens[H].configured,G=k.tokens[P]&&k.tokens[P].configured,X=K&&k.tokens[K]&&k.tokens[K].configured,B="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?B="Google":e.name==="dropbox"?B="Dropbox":e.name==="freshbooks"&&(B="FreshBooks"),{provider:B,canConnect:G&&X&&!z,refreshConfigured:z,clientIdConfigured:G,clientSecretConfigured:X}}}}return null},[k,e.name]),E=y.useCallback(async function(){m(null),v(!0);try{if(S&&S.brokered){let V=function(){M.current&&(clearInterval(M.current),M.current=null)};var L=await TL(e.name),A=600,O=700,F=(window.screen.width-A)/2,Q=(window.screen.height-O)/2,H=window.open(L.authorizeUrl,"oauth_popup","width="+A+",height="+O+",left="+F+",top="+Q+",scrollbars=yes");if(!H){m("Popup blocked. Please allow popups or visit: "+L.authorizeUrl),v(!1);return}var P=L.flowId,K=0,W=0;M.current=setInterval(async function(){K+=1500;try{var U=await RL(e.name,P);if(U&&U.connected){V();try{H.close()}catch{}v(!1),n();return}}catch(oe){V(),m(oe.message),v(!1);return}if(H.closed&&(W||(W=K),K-W>9e3)){V(),v(!1),n();return}K>3e5&&(V(),v(!1),m("Connection timed out. Please try again."))},1500);return}var Y=await jL(e.name),ce=600,z=700,G=(window.screen.width-ce)/2,X=(window.screen.height-z)/2,B=window.open(Y.authorizeUrl,"oauth_popup","width="+ce+",height="+z+",left="+G+",top="+X+",scrollbars=yes");if(B)var te=setInterval(function(){B.closed&&(clearInterval(te),v(!1),n())},500);else m("Popup blocked. Please allow popups or visit: "+Y.authorizeUrl),v(!1)}catch(V){m(V.message),v(!1)}},[e.name,n,S]),N=y.useCallback(async function(){m(null),p(!0);try{for(var L=Object.create(null),A=Object.keys(o),O=0;O<A.length;O++){var F=A[O];o[F]&&o[F].trim()&&(L[F]=o[F].trim())}if(Object.keys(L).length===0){m(r("skills.enter_token")),p(!1);return}await SL(e.name,L),n()}catch(Q){m(Q.message)}finally{p(!1)}},[o,e.name,n,r]),R=y.useCallback(async function(){if(await a({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),p(!0);try{await EL(e.name),n()}catch(L){m(L.message)}finally{p(!1)}}},[e.name,n,a,r]),T=y.useCallback(function(L,A){l(function(O){var F=Object.assign(Object.create(null),O);return F[L]=A,F})},[]),j=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(L){var A=L[0],O=L[1],F=O&&O.env||A;return{name:A,env:F,description:O.description,configured:O.configured,maskedValue:O.maskedValue}}):[],I=y.useRef(null);y.useEffect(function(){function L(A){A.key==="Escape"&&t()}return document.addEventListener("keydown",L),I.current&&I.current.focus(),function(){document.removeEventListener("keydown",L)}},[t]);var M=y.useRef(null);return y.useEffect(function(){return function(){M.current&&(clearInterval(M.current),M.current=null)}},[]),i.jsx("div",{ref:I,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,role:"dialog","aria-modal":"true","aria-label":r("skills.configure_skill",{skill:e.name}),children:i.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(L){L.stopPropagation()},children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),i.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":r("skills.close_credential_editor"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&j.length>0&&i.jsx("div",{className:"space-y-3 mb-4",children:j.map(function(L){return i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[L.env,L.configured&&i.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:L.maskedValue}),")"]})]}),L.description&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:L.description}),i.jsx("input",{type:"password",placeholder:L.configured?r("skills.leave_blank"):r("skills.enter_value"),value:o[L.env]||"",onChange:function(A){T(L.env,A.target.value)},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})]},L.env)})}),!u&&S&&i.jsx("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700",children:S.canConnect?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:S.provider})}),i.jsx("button",{onClick:E,disabled:x||f,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg disabled:opacity-50 transition-colors",children:x?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),r("skills.oauth_connect",{provider:S.provider})]})})]}):S.refreshConfigured?i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),r("skills.oauth_connected",{provider:S.provider})]}),i.jsx("button",{onClick:R,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:r("skills.oauth_disconnect",{provider:S.provider})})]}):i.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:S.provider})})}),!u&&!g&&j.length===0&&!S&&i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),g&&i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:g}),!u&&j.length>0&&i.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[i.jsx("button",{onClick:R,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:r("skills.clear_all")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg",children:r("skills.cancel")}),i.jsx("button",{onClick:N,disabled:f,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 transition-colors",children:r(f?"skills.saving":"skills.save")})]})]})]})})}function DV({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:p}){var g=TV(e.name),m=Object.prototype.hasOwnProperty.call(OT,e.name)?OT[e.name]:"#6B7280",[x,v]=y.useState(!1),k=r===e.name,_=n&&n.status==="available",S=y.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),E=y.useCallback(function(){l&&l(e.name)},[e.name,l]);return i.jsxs("div",{className:"group relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md dark:hover:shadow-gray-800/50 transition-all flex flex-col",children:[i.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),i.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:m+"15"},children:i.jsx(g,{className:"w-5 h-5",style:{color:m}})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),i.jsx(LV,{installed:t,configured:t&&e.allTokensConfigured,t:p}),t&&_&&i.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400",children:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"v",n.latestVersion]}),t&&n&&n.status==="current"&&i.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:p("skills.up_to_date")}),t&&n&&n.status==="error"&&i.jsx("span",{title:n.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",children:p("skills.update_check_failed")}),t&&n&&n.status==="unsupported"&&i.jsx("span",{title:n.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:p("skills.update_unsupported")})]}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||p("skills.no_description")}),e.version&&i.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),i.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:function(){a(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:p("skills.configure")}),f&&i.jsxs("button",{onClick:function(){f(e.name,!d)},title:p("skills.default_for_new_sessions"),className:"px-2 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 "+(d?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/40":"text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800"),children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("skills.default")]}),_&&i.jsx("button",{onClick:E,disabled:k,className:"px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:k?i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),p("skills.updating")]}):p("skills.update")}),u&&i.jsx("button",{onClick:function(){u(e)},title:p("skills.uninstall"),className:"px-2 py-1.5 text-xs font-medium text-gray-400 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors","aria-label":p("skills.uninstall"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}):i.jsx("button",{onClick:S,disabled:x,className:"flex-1 px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:x?i.jsxs("span",{className:"flex items-center justify-center gap-1",children:[i.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),p("skills.installing")]}):p("skills.install")})})]})}function PV({onBack:e}){var{t}=rn(),[n,r]=y.useState([]),[a,o]=y.useState([]),[l,u]=y.useState(!0),[d,f]=y.useState(null),[p,g]=y.useState(null),[m,x]=y.useState("all"),[v,k]=y.useState(""),[_,S]=y.useState(!1),[E,N]=y.useState(Object.create(null)),[R,T]=y.useState(null),[j,I]=y.useState(!1),[M,L]=y.useState(Object.create(null)),A=Iu(),O=y.useCallback(async function(){u(!0),f(null),I(!1);try{var V=await Promise.allSettled([Zv(),bL(),w4()]),U=V[0].status==="fulfilled"?V[0].value:[],oe=V[1].status==="fulfilled"?V[1].value:[],ae=V[2].status==="fulfilled"?V[2].value.skillDefaults||{}:{};r(U),o(oe),L(ae);var xe=[];V[0].status==="rejected"&&xe.push(t("skills.load_installed_failed",{error:V[0].reason.message})),V[1].status==="rejected"&&xe.push(t("skills.load_marketplace_failed",{error:V[1].reason.message})),xe.length>0&&f(xe.join("; "))}catch(Se){f(Se.message)}finally{u(!1)}},[t]);y.useEffect(function(){O()},[O]);var F=[],Q=new Set(n.map(function(V){return V.name}));n.forEach(function(V){F.push(Object.assign({},V,{_installed:!0}))}),a.forEach(function(V){Q.has(V.name)||F.push(Object.assign({},V,{_installed:!1,allTokensConfigured:!1}))});var H=F;if(m==="installed"?H=F.filter(function(V){return V._installed}):m==="available"&&(H=F.filter(function(V){return!V._installed})),v){var P=v.toLowerCase();H=H.filter(function(V){return V.name&&V.name.toLowerCase().indexOf(P)!==-1||V.description&&V.description.toLowerCase().indexOf(P)!==-1||V.category&&V.category.toLowerCase().indexOf(P)!==-1})}var K=y.useCallback(async function(V){try{await kL(V.name),O()}catch(U){f(t("skills.install_failed",{error:U.message}))}},[O,t]),W=y.useCallback(function(V){g(V)},[]),Y=y.useCallback(async function(V){if(await A({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:V.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await NL(V.name),O()}catch(U){f(t("skills.uninstall_failed",{error:U.message}))}},[O,A,t]),ce=y.useCallback(function(){g(null),O()},[O]),z=y.useCallback(async function(V,U){L(function(ae){var xe=Object.assign({},ae);return U?xe[V]=!0:delete xe[V],xe});try{var oe={};oe[V]=U,await CL(oe)}catch(ae){L(function(xe){var Se=Object.assign({},xe);return U?delete Se[V]:Se[V]=!0,Se}),f(ae.message)}},[]),G=y.useCallback(async function(){S(!0),f(null);try{var V=await wL();N(IV(V.skills)),I(!0)}catch(U){f(U.message)}finally{S(!1)}},[]),X=y.useCallback(async function(V){T(V),f(null);try{var U=await _L(V);U.updated&&(N(function(oe){var ae=Object.assign(Object.create(null),oe);return ae[V]={status:"current",hasUpdate:!1,latestVersion:oe[V]?oe[V].latestVersion:null,currentVersion:oe[V]?oe[V].latestVersion:null,error:null},ae}),O())}catch(oe){f(t("skills.update_failed")+": "+oe.message)}finally{T(null)}},[O,t]),B=MV(E),te=B.available;return i.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[i.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":t("skills.back_to_chat"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:a.filter(function(V){return!Q.has(V.name)}).length})})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:G,disabled:_||l,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:_?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.checking_updates")]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.check_updates")]})}),te>0&&i.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded-full",children:t("skills.updates_available",{count:te})}),j&&B.error>0&&!_&&i.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 rounded-full",children:t("skills.update_check_failures",{count:B.error})}),j&&B.unsupported>0&&!_&&i.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded-full",children:t("skills.update_unsupported_count",{count:B.unsupported})}),j&&te===0&&B.error===0&&B.unsupported===0&&!_&&i.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full",children:t("skills.no_updates")}),i.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:["all","installed","available"].map(function(V){return i.jsx("button",{onClick:function(){x(V)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===V?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+V)},V)})})]})]}),i.jsx("div",{className:"shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:i.jsxs("div",{className:"relative",children:[i.jsx("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(V){k(V.target.value)},className:"w-full pl-10 pr-4 py-2 text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-900 dark:text-gray-100 placeholder-gray-400 outline-hidden focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&i.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&H.length===0&&i.jsx("div",{className:"text-center py-12",children:i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&H.length>0&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:H.map(function(V){return i.jsx(DV,{skill:V,installed:V._installed,updateInfo:E[V.name],updatingSkill:R,onConfigure:W,onInstall:K,onUpdate:X,onUninstall:V._installed?Y:null,skillDefaultEnabled:!!M[V.name],onToggleDefault:V._installed?z:null,t},V.name)})})]}),p&&i.jsx(OV,{skill:p,onClose:function(){g(null)},onSaved:ce})]})}var Wv=20;function t1(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function FV(e){var t={},n=[],r={};return(e||[]).forEach(function(a){a.parentId&&!r[a.parentId]?n.push(a):a.parentId?(t[a.parentId]=t[a.parentId]||[]).push(a):n.push(a),r[a.id]=!0}),{topLevel:n,childrenByParent:t}}function VA({post:e,childrenByParent:t,depth:n,onDelete:r,t:a}){var o=t[e.id]||[];return i.jsxs("div",{className:n>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[i.jsxs("div",{className:"py-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),i.jsx("span",{children:t1(e.createdAt)}),!e.deleted&&r&&i.jsx("button",{type:"button",onClick:function(){r(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:a("board.delete_post"),"aria-label":a("board.delete_post"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),e.deleted?i.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:a("board.post_deleted")}):i.jsx("p",{className:"mt-1 text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:e.content})]}),o.map(function(l){return i.jsx(VA,{post:l,childrenByParent:t,depth:n+1,onDelete:r,t:a},l.id)})]})}function BV({detail:e,searchQuery:t,onSearchQueryChange:n,onSearch:r,onClearSearch:a,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return i.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:e?d:u,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":f(e?"board.back_to_topics":"board.back_to_chat"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e?f("board.post_count",{count:(e.posts||[]).length}):f("board.read_only_hint")})]})]}),!e&&i.jsxs("form",{onSubmit:r,className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",value:t,onChange:function(p){n(p.target.value)},placeholder:f("board.search_placeholder"),className:"w-48 sm:w-64 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-hidden focus:ring-2 focus:ring-primary-500"}),i.jsx("button",{type:"submit",className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:f("board.search")}),o&&i.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:f("board.clear_search")})]}),e&&i.jsxs("button",{type:"button",onClick:function(){l(e.topic.id)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),f("board.delete_topic")]})]})}function zV({detail:e,onDeletePost:t,t:n}){var r=FV(e.posts);return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[i.jsxs("div",{className:"pb-3 mb-2 border-b border-gray-200 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),i.jsx("span",{children:t1(e.topic.createdAt)}),e.topic.category&&i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:e.topic.category})]}),r.topLevel.length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:n("board.no_posts")}):r.topLevel.map(function(a){return i.jsx(VA,{post:a,childrenByParent:r.childrenByParent,depth:0,onDelete:t,t:n},a.id)})]})}function qV({searchResults:e,onOpenTopic:t,t:n}){return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:n("board.search_results",{count:e.total})}),(e.matches||[]).length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:n("board.no_matches")}):e.matches.map(function(r,a){return i.jsxs("button",{type:"button",onClick:function(){t(r.topicId)},className:"w-full text-left px-3 py-2 mb-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:r.topicTitle}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:r.snippet})]},(r.postId||r.topicId)+":"+a)})]})}function UV({topics:e,offset:t,total:n,onOpenTopic:r,onPage:a,t:o}){var l=t-Wv,u=t+Wv,d=t>0,f=u<n;return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:o("board.no_topics")}):e.map(function(p){return i.jsxs("button",{type:"button",onClick:function(){r(p.id)},className:"w-full text-left px-3 py-2.5 mb-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p.title}),p.category&&i.jsx("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 text-xs",children:p.category})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[p.author," · ",t1(p.createdAt)," ·"," ",o("board.post_count",{count:p.postCount})]})]},p.id)}),(d||f)&&i.jsxs("div",{className:"flex items-center justify-between mt-4",children:[i.jsx("button",{type:"button",disabled:!d,onClick:function(){a(l)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.prev_page")}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("board.page_info",{from:t+1,to:Math.min(u,n),total:n})}),i.jsx("button",{type:"button",disabled:!f,onClick:function(){a(u)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.next_page")})]})]})}function HV({onBack:e}){var{t}=rn(),[n,r]=y.useState([]),[a,o]=y.useState(0),[l,u]=y.useState(0),[d,f]=y.useState(!0),[p,g]=y.useState(null),[m,x]=y.useState(null),[v,k]=y.useState(""),[_,S]=y.useState(null),E=y.useCallback(async function(A){f(!0),g(null);try{var O=await VL({limit:Wv,offset:A});r(O.topics||[]),o(O.total||0)}catch(F){g(F.message)}finally{f(!1)}},[]);y.useEffect(function(){E(0)},[E]);var N=y.useCallback(async function(A){f(!0),g(null),S(null);try{var O=await tw(A);x(O)}catch(F){g(F.message)}finally{f(!1)}},[]),R=y.useCallback(function(){x(null),E(l)},[E,l]),T=y.useCallback(async function(A){g(null);try{await KL(A),x(null),E(l)}catch(O){g(O.message)}},[E,l]),j=y.useCallback(async function(A){if(m){g(null);try{await YL(m.topic.id,A);var O=await tw(m.topic.id);x(O)}catch(F){g(F.message)}}},[m]),I=y.useCallback(async function(A){A.preventDefault();var O=v.trim();if(!O){S(null);return}f(!0),g(null);try{var F=await GL(O);S(F)}catch(Q){g(Q.message)}finally{f(!1)}},[v]),M=y.useCallback(function(){k(""),S(null)},[]),L=y.useCallback(function(A){u(A),E(A)},[E]);return i.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[i.jsx(BV,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:I,onClearSearch:M,hasSearchResults:!!_,onDeleteTopic:T,onBack:e,onCloseTopic:R,t}),i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[p&&i.jsx("div",{className:"mx-6 mt-4 px-3 py-2 text-sm text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded-lg",children:p}),d?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}):m?i.jsx(zV,{detail:m,onDeletePost:j,t}):_?i.jsx(qV,{searchResults:_,onOpenTopic:N,t}):i.jsx(UV,{topics:n,offset:l,total:a,onOpenTopic:N,onPage:L,t})]})]})}var DT={available:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",installed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300","update-available":"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300",pending_oauth:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300","needs-review":"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300",degraded:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"};function GA({status:e}){var t=DT[e]||DT.available;return i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium "+t,children:e})}function KA({kind:e}){var t=e==="skill";return i.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium "+(t?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300":"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-300"),children:e})}function $V({capability:e,onOpen:t}){return i.jsxs("button",{type:"button",onClick:()=>t(e),className:"text-left w-full p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-xs transition-all bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(KA,{kind:e.kind}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name})]}),i.jsx(GA,{status:e.status})]}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||""}),i.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.version&&i.jsxs("span",{children:["v",e.version]}),e.installedVersion&&e.installedVersion!==e.version&&i.jsxs("span",{children:["(installed v",e.installedVersion,")"]}),e.author&&i.jsx("span",{className:"truncate",children:e.author})]})]})}var Bo={LOADING:"loading",READY:"ready",MISSING:"missing"};function WV({capability:e,docs:t,docsState:n}){var{t:r}=rn();return e.kind!=="skill"?null:i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:r("capabilities.docs")}),n===Bo.MISSING&&i.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:r("capabilities.docs_missing")}),n===Bo.READY&&i.jsx("pre",{className:"text-xs whitespace-pre-wrap bg-gray-50 dark:bg-gray-800 rounded-lg p-3 max-h-96 overflow-y-auto text-gray-700 dark:text-gray-300",children:t.content}),n===Bo.LOADING&&i.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"…"})]})}function iu({label:e,value:t}){return t?i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:e}),i.jsx("dd",{className:"text-gray-900 dark:text-gray-100 break-all",children:t})]}):null}function VV({capability:e}){return i.jsxs("dl",{className:"grid grid-cols-2 gap-2 text-sm mb-4",children:[i.jsx(iu,{label:"Version",value:e.version}),i.jsx(iu,{label:"Author",value:e.author}),e.kind==="mcp"&&i.jsxs(i.Fragment,{children:[i.jsx(iu,{label:"URL",value:e.url}),i.jsx(iu,{label:"Auth",value:e.auth&&e.auth.type||"none"})]}),e.requiresMcps&&e.requiresMcps.length>0&&i.jsx(i.Fragment,{children:i.jsx(iu,{label:"Requires MCPs",value:e.requiresMcps.join(", ")})})]})}var er={IDLE:"idle",BUSY:"busy",ERROR:"error",DONE:"done"};function GV({capability:e,onInstalled:t}){var{t:n}=rn(),r=String(e.id||"").replace(/^mcp:/,""),[a,o]=y.useState(null),[l,u]=y.useState(er.IDLE),[d,f]=y.useState(null),[p,g]=y.useState(""),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=e.auth&&e.auth.type||"none",S=y.useCallback(function(){sL(r).then(function(P){o(P)}).catch(function(){o(null)})},[r]);y.useEffect(function(){S()},[S]);function E(P){u(er.BUSY),f(null),P().then(function(K){f(K&&K.message?K.message:n("capabilities.done")),u(er.DONE),S(),t&&t()}).catch(function(K){f(K&&K.message||"request failed"),u(er.ERROR)})}var N=a&&a.needsReview,R=N&&N.changedTools||[],T=a||e.status==="installed",j=_==="bearer",I=_==="oauth2",M=!!(a&&a.hasToken),L=y.useRef(null),[A,O]=y.useState(!1),F=!!(a&&(a.needsReconsent||a.refreshRejected||a.reconsentRequired));y.useEffect(function(){return function(){L.current&&(clearTimeout(L.current),L.current=null)}},[]);function Q(){u(er.BUSY),f(null),mL(r).then(function(P){u(er.IDLE),O(!0),f(n("capabilities.oauth_pending")),S(),typeof window<"u"&&window.open&&window.open(P.authorizeUrl,"_blank","noopener");var K=0,W=function(){K+=1,xL(r,P.state).then(function(Y){if(Y&&Y.pending){if(K>150){O(!1),u(er.ERROR),f(n("capabilities.oauth_pending"));return}L.current=setTimeout(W,2e3);return}O(!1),Y&&Y.connected?(u(er.DONE),f(n("capabilities.oauth_connected"))):Y&&Y.needsReconsent?(u(er.ERROR),f(n("capabilities.oauth_reconsent"))):(u(er.ERROR),f(Y&&Y.lastError||n("capabilities.oauth_reconsent"))),S(),t&&t()}).catch(function(){O(!1),u(er.ERROR),f(n("capabilities.oauth_reconsent"))})};L.current=setTimeout(W,2e3)}).catch(function(P){u(er.ERROR),f(P&&P.message||"request failed")})}var H="px-3 py-1.5 rounded text-sm font-medium transition-colors ";return i.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"mcp-runtime",children:[N&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-orange-50 dark:bg-orange-950 border border-orange-200 dark:border-orange-900",children:[i.jsx("p",{className:"text-sm font-medium text-orange-800 dark:text-orange-300 mb-1",children:n("capabilities.needs_review")}),N.reason&&i.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-2",children:N.reason}),R.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-1",children:n("capabilities.changed_tools")}),i.jsx("ul",{className:"text-xs font-mono text-orange-800 dark:text-orange-300 list-disc list-inside",children:R.map(function(P){return i.jsxs("li",{children:[P.name," (",P.change,")"]},P.name)})})]}),i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return dL(r)})},className:H+"bg-orange-600 hover:bg-orange-700 text-white disabled:opacity-50",children:n("capabilities.reapprove")})]}),I&&a&&(a.status==="pending_oauth"||F)&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-950 border border-yellow-200 dark:border-yellow-900","data-testid":"mcp-oauth-consent",children:[i.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1",children:n(F?"capabilities.oauth_reconsent":"capabilities.oauth_connect")}),(a.refreshRejected||a.reconsentRequired)&&i.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 mb-2",children:a.refreshRejected?a.refreshRejected.error:a.reconsentRequired.reason}),i.jsx("button",{type:"button",disabled:l===er.BUSY||A,onClick:Q,className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-oauth-connect",children:n("capabilities.oauth_connect")}),A&&i.jsx("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:n("capabilities.oauth_pending")})]}),a&&a.status==="error"&&a.lastError&&i.jsxs("div",{className:"mb-3 p-3 rounded-lg bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-900","data-testid":"mcp-error",children:[i.jsxs("p",{className:"text-sm text-red-700 dark:text-red-300",children:[n("capabilities.mcp_error"),": ",a.lastError]}),i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return fL(r)})},className:H+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50","data-testid":"mcp-refresh",children:n("capabilities.retry")})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[!T&&i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return aL(r)})},className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-install",children:n("capabilities.install")}),T&&i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return oL(r)})},className:H+"border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50","data-testid":"mcp-update",children:n("capabilities.update")}),T&&!v&&i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){k(!0)},className:H+"border border-red-300 dark:border-red-900 text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950 disabled:opacity-50","data-testid":"mcp-uninstall",children:n("capabilities.uninstall")}),T&&v&&i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return lL(r)}),k(!1)},className:H+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50",children:n("capabilities.uninstall_confirm")}),i.jsx("button",{type:"button",onClick:function(){k(!1)},className:H+"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",children:n("capabilities.cancel")})]})]}),j&&i.jsxs("div",{className:"mt-3","data-testid":"mcp-token",children:[i.jsxs("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:[e.auth&&e.auth.tokenLabel?e.auth.tokenLabel:n("capabilities.token_label"),M?" — "+n("capabilities.token_stored"):""]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"password",value:p,onChange:function(P){g(P.target.value),x(null)},placeholder:n("capabilities.token_placeholder"),className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-hidden focus:ring-1 focus:ring-blue-500 font-mono"}),i.jsx("button",{type:"button",disabled:l===er.BUSY||!p.trim(),onClick:function(){E(function(){return cL(r,p.trim()).then(function(){g("")})})},className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50",children:n("capabilities.token_save")}),M&&i.jsx("button",{type:"button",disabled:l===er.BUSY,onClick:function(){E(function(){return uL(r)})},className:H+"border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50",children:n("capabilities.token_clear")})]}),m&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:m}),i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:n("capabilities.token_note")})]}),a&&a.bridgedTools&&a.bridgedTools.length>0&&i.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:[n("capabilities.bridged"),": ",a.bridgedTools.length,a.deferredTools&&a.deferredTools.length>0?" · "+n("capabilities.deferred")+": "+a.deferredTools.length:""]}),d&&i.jsx("p",{className:"mt-2 text-xs "+(l===er.ERROR?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:d})]})}var KV={installed:"text-green-700 dark:text-green-400",pending_oauth:"text-yellow-700 dark:text-yellow-400",error:"text-red-700 dark:text-red-400",missing:"text-red-700 dark:text-red-400"};function YV({capability:e,onInstalled:t}){var{t:n}=rn(),r=String(e.id||"").replace(/^skill:/,""),[a,o]=y.useState(er.IDLE),[l,u]=y.useState(null),d=e.deps||[],f=e.requiresMcps||[],p=e.status==="installed"||e.status==="degraded"||e.status==="update-available",g=a===er.BUSY;function m(x){o(er.BUSY),u(null),x().then(function(v){u(v),o(er.DONE),t&&t()}).catch(function(v){u({error:v&&v.message||"request failed"}),o(er.ERROR)})}return!f.length&&!p?null:i.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"skill-composite",children:[f.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:n("capabilities.requires_mcps")}),i.jsx("ul",{className:"text-xs font-mono list-inside","data-testid":"skill-composite-deps",children:(d.length?d:f.map(function(x){return{id:"mcp:"+x,status:null}})).map(function(x){return i.jsxs("li",{className:x.status?KV[x.status]||"":"text-gray-500 dark:text-gray-400",children:[x.id,x.status?" — "+x.status:""]},x.id)})})]}),l&&!l.error&&l.deps&&l.deps.length>0&&i.jsxs("div",{className:"mb-2 p-2 rounded bg-green-50 dark:bg-green-950 border border-green-200 dark:border-green-900","data-testid":"skill-composite-result",children:[i.jsx("p",{className:"text-xs font-medium text-green-800 dark:text-green-300",children:n("capabilities.composite_installed",{name:l.name})}),i.jsx("ul",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 list-disc list-inside",children:l.deps.map(function(x){return i.jsxs("li",{children:[x.id," [",x.status,"]"]},x.id)})})]}),l&&l.error&&i.jsx("p",{className:"mb-2 text-xs text-red-600 dark:text-red-400","data-testid":"skill-composite-error",children:l.error}),i.jsxs("div",{className:"flex items-center gap-2",children:[!p&&i.jsx("button",{type:"button",disabled:g,onClick:function(){m(function(){return hL(r)})},className:PT(),"data-testid":"skill-install",children:n("capabilities.install")}),p&&i.jsx("button",{type:"button",disabled:g,onClick:function(){m(function(){return gL(r)})},className:PT(),"data-testid":"skill-uninstall",children:n("capabilities.uninstall")})]})]})}function PT(){return"px-3 py-1.5 rounded text-sm font-medium transition-colors bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50"}function QV({capability:e,onClose:t,onInstalled:n}){var{t:r}=rn(),[a,o]=y.useState(null),[l,u]=y.useState(Bo.LOADING);if(y.useEffect(function(){if(o(null),u(Bo.LOADING),!(!e||e.kind!=="skill")){var f=!1;return iL(e.id).then(function(p){f||(o(p),u(Bo.READY))}).catch(function(){f||u(Bo.MISSING)}),function(){f=!0}}},[e]),!e)return null;var d=e.kind==="collision";return i.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:t,children:i.jsxs("div",{className:"w-full max-w-xl h-full bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 overflow-y-auto p-6",onClick:function(f){f.stopPropagation()},children:[i.jsxs("div",{className:"flex items-start justify-between gap-2 mb-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[!d&&i.jsx(KA,{kind:e.kind}),i.jsx(GA,{status:e.status})]}),i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 font-mono",children:e.id})]}),i.jsx("button",{type:"button",onClick:t,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","aria-label":r("capabilities.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),d&&i.jsx("p",{className:"mb-4 text-sm text-red-700 dark:text-red-300",children:e.error}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-4",children:e.description||r("capabilities.no_description")}),i.jsx(VV,{capability:e}),!d&&e.kind==="mcp"&&i.jsx(GV,{capability:e,onInstalled:n}),!d&&e.kind==="skill"&&i.jsx(YV,{capability:e,onInstalled:n}),i.jsx(WV,{capability:e,docs:a,docsState:l})]})})}function XV(e,t,n){return e.filter(function(r){if(n!=="all"&&r.kind!==n)return!1;if(!t)return!0;var a=t.toLowerCase();return(r.name||"").toLowerCase().indexOf(a)!==-1||(r.displayName||"").toLowerCase().indexOf(a)!==-1||(r.description||"").toLowerCase().indexOf(a)!==-1})}function ZV({onAdded:e}){var{t}=rn(),[n,r]=y.useState(""),[a,o]=y.useState(!1),[l,u]=y.useState(null);function d(){var f=n.trim();!f||a||(o(!0),u(null),pL(f).then(function(p){o(!1),r(""),u({ok:!0,text:"added "+(p&&p.id||"")}),e()}).catch(function(p){o(!1),u({ok:!1,text:p&&p.message||"request failed"})}))}return i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900","data-testid":"custom-mcp-add",children:[i.jsx("input",{type:"url",value:n,onChange:function(f){r(f.target.value),u(null)},onKeyDown:function(f){f.key==="Enter"&&d()},placeholder:"https://mcp.example.com/mcp",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-hidden focus:ring-1 focus:ring-blue-500","data-testid":"custom-mcp-url"}),i.jsx("button",{type:"button",disabled:a||n.trim()==="",onClick:d,className:"px-3 py-1.5 rounded text-sm font-medium bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"custom-mcp-add-submit",children:t("capabilities.install")}),l&&i.jsx("span",{className:(l.ok?"text-green-700 dark:text-green-300 ":"text-red-700 dark:text-red-300 ")+"text-xs","data-testid":"custom-mcp-add-result",children:l.text})]})}function JV({warnings:e}){return e.length===0?null:i.jsx("div",{className:"px-4 py-2 bg-yellow-50 dark:bg-yellow-950 border-b border-yellow-200 dark:border-yellow-900",children:e.map(function(t,n){return i.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:t},n)})})}function eG({loading:e,error:t,filtered:n,onRetry:r,onOpen:a,t:o}){return e?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"…"}):t?i.jsxs("div",{className:"text-sm text-red-600 dark:text-red-400",children:[i.jsx("p",{children:t}),i.jsx("button",{type:"button",onClick:r,className:"mt-2 px-3 py-1 rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300",children:o("capabilities.retry")})]}):n.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o("capabilities.no_capabilities")}):i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(function(l){return i.jsx($V,{capability:l,onOpen:a},l.id)})})}function tG({onBack:e}){var{t}=rn(),[n,r]=y.useState(null),[a,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(""),[p,g]=y.useState("all"),[m,x]=y.useState(null),v=y.useCallback(function(){u(!0),rL().then(function(E){r(E),o(null),u(!1)}).catch(function(E){o(E&&E.message||"failed to load"),u(!1)})},[]);y.useEffect(function(){v()},[v]);var k=n&&n.capabilities||[],_=n&&n.warnings||[],S=XV(k,d,p);return i.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[i.jsx("button",{type:"button",onClick:e,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","aria-label":t("capabilities.back_to_chat"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),i.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("capabilities.title")}),i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",children:"experimental"})]}),i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[i.jsx("input",{type:"text",value:d,onChange:function(E){f(E.target.value)},placeholder:t("capabilities.search_placeholder"),className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-hidden focus:ring-1 focus:ring-blue-500"}),i.jsx("div",{className:"flex rounded-lg border border-gray-300 dark:border-gray-700 overflow-hidden",children:["all","skill","mcp"].map(function(E){return i.jsx("button",{type:"button",onClick:function(){g(E)},className:"px-3 py-1.5 text-sm "+(p===E?"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-medium":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),children:t("capabilities.filter_"+E)},E)})})]}),i.jsx(JV,{warnings:_}),i.jsx(ZV,{onAdded:v}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i.jsx(eG,{loading:l,error:a,filtered:S,onRetry:v,onOpen:x,t})}),i.jsx(QV,{capability:m,onClose:function(){x(null)},onInstalled:v})]})}const YA=["webhook"],QA=["existing","spawn"],XA=["json","yaml"],vu="••••••••";function ZA(e){if(!e||typeof e!="object")return"trigger form is missing";if(YA.indexOf(e.type)===-1)return'type must be "webhook" in Phase 1';if(QA.indexOf(e.targetMode)===-1)return'targetMode must be "existing" or "spawn"';const t=e.payloadFormat===void 0?"json":e.payloadFormat;return XA.indexOf(t)===-1?'payloadFormat must be "json" or "yaml"':e.targetMode==="existing"?nG(e):rG(e)}function nG(e){return e.sessionId?null:'targetMode "existing" needs a sessionId to deliver into'}function rG(e){return e.soul?e.model?null:'targetMode "spawn" needs a model to spawn with':'targetMode "spawn" needs a soul to spawn with'}function FT(e){return typeof e!="string"||e.length<=4?vu:e.slice(0,4)+vu}function iG(e){var t=String(e||"");if(!t)return"";var n=t.lastIndexOf("/");return n===-1?vu:t.slice(0,n+1)+vu}function BT(e){return ap(e)}function aG(){return{name:"",type:"webhook",targetMode:"existing",sessionId:"",soul:"",model:"",template:"",payloadFormat:"json"}}function sG({message:e,onDismiss:t,t:n}){return e?i.jsxs("div",{"data-testid":"trigger-error",className:"px-4 py-2 bg-red-50 dark:bg-red-950 border-b border-red-200 dark:border-red-900 flex items-start justify-between gap-3",children:[i.jsx("p",{className:"text-xs text-red-700 dark:text-red-300 break-all",children:e}),i.jsx("button",{type:"button",onClick:t,className:"text-xs text-red-600 dark:text-red-400 underline shrink-0",children:n("triggers.dismiss")})]}):null}function oG({trigger:e,revealed:t,onCopy:n,onReveal:r,t:a}){var o=t?e.webhookPath:iG(e.webhookPath);return i.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[i.jsx("code",{"data-testid":"trigger-webhook-url",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:o}),i.jsx("button",{type:"button","data-testid":"trigger-copy",onClick:function(){n(e)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400",children:a("triggers.copy")}),i.jsx("button",{type:"button","data-testid":"trigger-reveal",onClick:function(){r(e.id)},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400",children:a(t?"triggers.hide":"triggers.reveal")})]})}function lG({trigger:e,revealedPath:t,revealedApp:n,revealedVt:r,onCopy:a,onReveal:o,onEdit:l,onDelete:u,t:d}){return i.jsxs("div",{"data-testid":"trigger-row",className:"p-3 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name||e.id}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("button",{type:"button","data-testid":"trigger-edit",onClick:function(){l(e)},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400",children:d("triggers.edit")}),i.jsx("button",{type:"button","data-testid":"trigger-delete",onClick:function(){u(e)},className:"px-2 py-0.5 rounded text-xs text-red-600 dark:text-red-400",children:d("triggers.delete")})]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{"data-testid":"trigger-type",children:e.type}),i.jsx("span",{"data-testid":"trigger-target-mode",children:e.targetMode}),i.jsx("span",{className:"truncate",children:e.targetMode==="spawn"?e.soul:e.sessionId})]}),i.jsx(oG,{trigger:e,revealed:t,onCopy:a,onReveal:o,t:d}),i.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[i.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"appSecret"}),i.jsx("code",{"data-testid":"trigger-appsecret",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:e.appSecret?n?e.appSecret:FT(e.appSecret):"—"}),i.jsx("button",{type:"button","data-testid":"trigger-appsecret-copy",disabled:!e.appSecret,onClick:function(){BT(e.appSecret)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d("triggers.copy")}),i.jsx("button",{type:"button","data-testid":"trigger-appsecret-reveal",disabled:!e.appSecret,onClick:function(){o(e.id+":app")},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d(n?"triggers.hide":"triggers.reveal")})]}),i.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[i.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"verifyToken"}),i.jsx("code",{"data-testid":"trigger-verifytoken",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:e.verifyToken?r?e.verifyToken:FT(e.verifyToken):"—"}),i.jsx("button",{type:"button","data-testid":"trigger-verifytoken-copy",disabled:!e.verifyToken,onClick:function(){BT(e.verifyToken)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d("triggers.copy")}),i.jsx("button",{type:"button","data-testid":"trigger-verifytoken-reveal",disabled:!e.verifyToken,onClick:function(){o(e.id+":vt")},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d(r?"triggers.hide":"triggers.reveal")})]})]})}function mf({label:e,value:t,onChange:n,placeholder:r}){return i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:e}),i.jsx("input",{type:"text",value:t,onChange:function(a){n(a.target.value)},placeholder:r||"",className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"})]})}function cG({draft:e,error:t,onChange:n,onCancel:r,onSave:a,onDelete:o,t:l}){var u=ZA(e),d=e.targetMode==="spawn";return i.jsxs("div",{"data-testid":"trigger-form",className:"w-full sm:w-80 shrink-0 p-3 border-l border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:e.id?l("triggers.edit"):l("triggers.create")}),i.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-500 dark:text-gray-400 underline",children:l("triggers.cancel")})]}),t&&i.jsx("p",{"data-testid":"trigger-form-error",className:"text-xs text-red-600 dark:text-red-400 break-all",children:t}),i.jsx(mf,{label:l("triggers.name"),value:e.name,onChange:function(f){n({...e,name:f})}}),i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.type")}),i.jsx("select",{"data-testid":"trigger-type-select",value:e.type,onChange:function(f){n({...e,type:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:YA.map(function(f){return i.jsx("option",{value:f,children:f},f)})})]}),i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.target_mode")}),i.jsx("select",{"data-testid":"trigger-mode-select",value:e.targetMode,onChange:function(f){n({...e,targetMode:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:QA.map(function(f){return i.jsx("option",{value:f,children:l("triggers.target_"+f)},f)})})]}),d?i.jsxs("div",{className:"space-y-2",children:[i.jsx(mf,{label:l("triggers.soul"),value:e.soul,onChange:function(f){n({...e,soul:f})}}),i.jsx(mf,{label:l("triggers.model"),value:e.model,onChange:function(f){n({...e,model:f})}})]}):i.jsx(mf,{label:l("triggers.session_id"),value:e.sessionId,onChange:function(f){n({...e,sessionId:f})}}),i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.template")}),i.jsx("textarea",{"data-testid":"trigger-template",rows:4,placeholder:"{{from}} says {{text}}",value:e.template,onChange:function(f){n({...e,template:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 resize-y font-mono"})]}),e.template?null:i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format")}),i.jsx("select",{"data-testid":"trigger-format-select",value:e.payloadFormat,onChange:function(f){n({...e,payloadFormat:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:XA.map(function(f){return i.jsx("option",{value:f,children:f},f)})}),i.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format_help")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button","data-testid":"trigger-save",disabled:!!u,onClick:a,className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white disabled:opacity-50",children:l("triggers.save")}),e.id&&i.jsx("button",{type:"button","data-testid":"trigger-form-delete",onClick:function(){o(e)},className:"px-3 py-1.5 text-sm rounded text-red-600 dark:text-red-400",children:l("triggers.delete")})]})]})}function uG({onBack:e}){var{t}=rn(),[n,r]=y.useState([]),[a,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState({}),[p,g]=y.useState(null),m=y.useCallback(function(){u(!0),n3().then(function(E){r(E&&E.triggers||[]),o(null),u(!1)}).catch(function(E){r([]),o(E&&E.message||t("triggers.request_failed")),u(!1)})},[t]);y.useEffect(function(){m()},[m]);function x(E){ap(E.webhookPath).then(function(N){N||o(t("triggers.copy_failed"))})}function v(E){f(function(N){var R={...N};return R[E]=!N[E],R})}function k(E){o(null),g(E)}function _(){var E=ZA(p);if(E){o(E);return}var N={name:p.name,type:p.type,targetMode:p.targetMode,template:p.template||""};N.payloadFormat=p.payloadFormat||"json",p.targetMode==="existing"&&(N.sessionId=p.sessionId),p.targetMode==="spawn"&&(N.soul=p.soul,N.model=p.model);var R=p.id?i3(p.id,N):r3(N);R.then(function(){o(null),g(null),m()}).catch(function(T){o(T&&T.message||t("triggers.request_failed"))})}function S(E){a3(E.id).then(function(){o(null),p&&p.id===E.id&&g(null),m()}).catch(function(N){o(N&&N.message||t("triggers.request_failed"))})}return i.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[i.jsx("button",{type:"button",onClick:e,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","aria-label":t("triggers.back_to_chat"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),i.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("triggers.title")}),i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",children:t("triggers.experimental_tag")})]}),i.jsx(sG,{message:a,onDismiss:function(){o(null)},t}),i.jsxs("div",{className:"flex-1 flex min-h-0",children:[i.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-w-0",children:[l&&i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.loading")}),!l&&n.length===0&&i.jsx("p",{"data-testid":"trigger-empty",className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.empty")}),!l&&n.map(function(E){return i.jsx(lG,{trigger:E,revealedPath:!!d[E.id],revealedApp:!!d[E.id+":app"],revealedVt:!!d[E.id+":vt"],onCopy:x,onReveal:v,onEdit:k,onDelete:S,t},E.id)})]}),p&&i.jsx(cG,{draft:p,error:a,onChange:function(E){g(E),o(null)},onCancel:function(){g(null)},onSave:_,onDelete:S,t})]}),i.jsx("div",{className:"px-4 py-2 border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 flex items-center justify-between",children:i.jsx("button",{type:"button","data-testid":"trigger-create",onClick:function(){k(aG())},className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white",children:t("triggers.create")})})]})}var dG=["__proto__","constructor","prototype"],fG="Session expired. Please log in again.";function au(e){return e&&e.status===401?fG:e.message}function Qb(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function pG(e){return{displayName:e.displayName||"",spec:e.url||e.target||"",limit:e.limit?{context:e.limit.context||128e3,output:e.limit.output||8192}:{context:128e3,output:8192},cost:e.cost?{input:e.cost.input||0,output:e.cost.output||0}:{input:0,output:0}}}function JA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function zT(e){var t={limit:e.limit,cost:e.cost};e.displayName&&String(e.displayName).trim()!==""&&(t.displayName=String(e.displayName).trim());var n=e.spec?String(e.spec).trim():"";if(n){var r=JA(n);t[r]=n}return t}function qT(e){var t=e.name,n=e.config,r=e.setName,a=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function p(_){a(function(S){return Object.assign({},S,_)})}function g(_){a(function(S){return Object.assign({},S,{limit:Object.assign({},S.limit||{},_)})})}function m(_){a(function(S){return Object.assign({},S,{cost:Object.assign({},S.cost||{},_)})})}var x="w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",v="text-xs text-gray-500 dark:text-gray-400 block mb-0.5",k=JA(n.spec);return i.jsxs("div",{className:"p-3 rounded border border-primary-300 dark:border-primary-700 bg-primary-50/50 dark:bg-primary-900/20 space-y-2",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:v,children:f("settings.model_registry.name")}),i.jsx("input",{type:"text",value:t,onChange:function(_){r(_.target.value)},className:x+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsxs("label",{className:v,children:[f("settings.model_registry.spec"),k&&i.jsx("span",{className:"ml-2 text-[10px] px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300 uppercase tracking-wide",children:k==="url"?"URL":f("settings.model_registry.kind_alias")})]}),i.jsx("input",{type:"text",value:n.spec||"",onChange:function(_){p({spec:_.target.value})},className:x+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:v,children:f("settings.model_registry.displayName")}),i.jsx("input",{type:"text",value:n.displayName||"",onChange:function(_){p({displayName:_.target.value})},className:x,placeholder:f("settings.model_registry.displayName_placeholder")})]}),i.jsxs("details",{className:"col-span-2",children:[i.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.limit_context")}),i.jsx("input",{type:"number",value:n.limit?n.limit.context:128e3,onChange:function(_){g({context:parseInt(_.target.value,10)||128e3})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.limit_output")}),i.jsx("input",{type:"number",value:n.limit?n.limit.output:8192,onChange:function(_){g({output:parseInt(_.target.value,10)||8192})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.cost_input")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.input:0,onChange:function(_){m({input:parseFloat(_.target.value)||0})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.cost_output")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.output:0,onChange:function(_){m({output:parseFloat(_.target.value)||0})},className:x})]})]})]})]}),i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.jsx("button",{type:"button",onClick:o,disabled:u||!t||!t.trim(),className:"px-3 py-1 text-xs font-medium rounded bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-50 transition-colors",children:f(u?d?"settings.model_registry.adding":"settings.model_registry.saving":d?"settings.model_registry.add":"settings.model_registry.save")}),i.jsx("button",{type:"button",onClick:l,disabled:u,className:"px-3 py-1 text-xs font-medium rounded bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 disabled:opacity-50 transition-colors",children:f("settings.model_registry.cancel")})]})]})}function hG({value:e,onChange:t,t:n}){const[r,a]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(null),[f,p]=y.useState(!1),[g,m]=y.useState(""),[x,v]=y.useState(Qb()),[k,_]=y.useState(null),[S,E]=y.useState(!1),[N,R]=y.useState(null);y.useEffect(function(){var H=!1;return l(!0),fv().then(function(P){H||(a(P),l(!1))}).catch(function(P){H||(d(au(P)),l(!1))}),function(){H=!0}},[]);var T=y.useCallback(function(){l(!0),d(null),fv().then(function(H){a(H),l(!1)}).catch(function(H){d(au(H)),l(!1)})},[]);function j(H,P,K){var W=(H||"").trim();return W?dG.indexOf(W)!==-1?n("settings.model_registry.error_name_reserved",{name:W}):W!==K&&P.indexOf(W)!==-1?n("settings.model_registry.error_name_exists",{name:W}):null:n("settings.model_registry.error_name_required")}var I=y.useCallback(async function(){if(r){var H=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),P=j(g,H,null);if(P){R(P);return}E(!0),R(null);try{await nw(g.trim(),zT(x)),p(!1),m(""),v(Qb()),T(),t&&t(e)}catch(K){R(au(K))}finally{E(!1)}}},[g,x,r,t,e,T]),M=y.useCallback(async function(H){E(!0),R(null);try{await rw(H),T(),t&&t(e)}catch(P){R(au(P))}finally{E(!1)}},[t,e,T]),L=y.useCallback(async function(){if(!(!k||!r)){var H=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),P=j(k.name,H,k.originalName);if(P){R(P);return}E(!0),R(null);try{var K=k.name.trim(),W=zT(k.config);if(await nw(K,W),K!==k.originalName)try{await rw(k.originalName)}catch(Y){R(n("settings.model_registry.error_rename_cleanup",{error:Y.message}))}_(null),T(),t&&t(e)}catch(Y){R(au(Y))}finally{E(!1)}}},[k,r,t,e,T]);if(o)return i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[i.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),n("settings.model_registry.loading")]});if(u)return i.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:n("settings.model_registry.load_error",{error:u})});var A=r&&r.user?r.user:{},O=r&&r.builtin?r.builtin:{},F=Object.keys(A),Q=Object.keys(O);return i.jsxs("div",{className:"space-y-3",children:[N&&i.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded px-2 py-1",children:N}),Q.length>0&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2",children:n("settings.model_registry.builtin")}),i.jsx("div",{className:"space-y-1",children:Q.map(function(H){var P=O[H];return i.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-gray-50 dark:bg-gray-800/50 text-sm",children:[i.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:H}),P.provider&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:P.provider}),P.limit&&P.limit.context&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:P.limit.context/1e3})}),P.tier&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300",children:P.tier})]},H)})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("settings.model_registry.user")}),!f&&!k&&i.jsx("button",{type:"button",onClick:function(){p(!0),m(""),v(Qb()),R(null)},className:"text-xs px-2 py-1 rounded bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-900/50 transition-colors",children:n("settings.model_registry.add_model")})]}),F.length===0&&!f&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:n("settings.model_registry.no_user_models")}),i.jsxs("div",{className:"space-y-2",children:[F.map(function(H){var P=A[H];return k&&k.originalName===H?i.jsx(qT,{name:k.name,config:k.config,setName:function(K){_(function(W){return W&&Object.assign({},W,{name:K})})},setConfig:function(K){_(function(W){if(!W)return W;var Y=typeof K=="function"?K(W.config):K;return Object.assign({},W,{config:Y})})},onSave:L,onCancel:function(){_(null),R(null)},saving:S,isNew:!1,t:n},H):i.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:H}),P.displayName&&P.displayName!==H&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",P.displayName,")"]}),P.url&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",P.url]}),!P.url&&P.target&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",P.target]}),P.limit&&P.limit.context&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:P.limit.context/1e3})})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("button",{type:"button",onClick:function(){_({originalName:H,name:H,config:pG(P)}),p(!1),R(null)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",title:n("settings.model_registry.edit"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),i.jsx("button",{type:"button",onClick:function(){window.confirm(n("settings.model_registry.delete_confirm",{name:H}))&&M(H)},disabled:S,className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-gray-400 hover:text-red-600 dark:hover:text-red-400 transition-colors",title:n("settings.model_registry.delete"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},H)}),f&&i.jsx(qT,{name:g,config:x,setName:m,setConfig:function(H){v(function(P){return typeof H=="function"?H(P):H})},onSave:I,onCancel:function(){p(!1),R(null)},saving:S,isNew:!0,t:n})]})]})]})}function gG({setting:e,value:t,onChange:n,error:r,models:a,t:o}){const[l,u]=y.useState(!1),d=e.source==="env",f="block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(r?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+(d?" opacity-60 cursor-not-allowed":"")+" text-gray-900 dark:text-gray-100",p=e.type==="model-select"&&a&&a.length>0&&t&&!a.find(function(m){return m.id===t});if(y.useEffect(function(){e.type!=="model-select"||!a||a.length===0||t&&a.find(function(m){return m.id===t})&&u(!1)},[t,a,e.type]),e.type==="model-select"){if(!a||a.length===0)return i.jsxs("div",{children:[i.jsx("input",{type:"text",value:t,onChange:function(v){n(v.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.custom_model_placeholder"),className:f}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const m=l||p,x=eV(a);return i.jsxs("div",{children:[i.jsxs("select",{value:m?"__custom__":t,onChange:function(v){v.target.value==="__custom__"?u(!0):(u(!1),n(v.target.value))},disabled:d,className:f,children:[Object.entries(x).map(function(v){var k=v[0],_=v[1];return i.jsx("optgroup",{label:ZW[k]||k,children:_.map(function(S){return i.jsxs("option",{value:S.id,children:[S.name,JW(S.tier)]},S.id)})},k)}),i.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&i.jsx("input",{type:"text",value:t,onChange:function(v){n(v.target.value)},disabled:d,placeholder:o("settings.custom_model_placeholder"),className:f+" mt-2 font-mono"}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="boolean"){const m=typeof t=="string"?t.toLowerCase():String(t),x=m==="true"||m==="1";return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",role:"switch","aria-checked":x,"aria-label":e.label,disabled:d,onClick:function(){n(x?"false":"true")},className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(x?"bg-primary-600":"bg-gray-200 dark:bg-gray-600")+(d?" opacity-50 cursor-not-allowed":""),children:i.jsx("span",{"aria-hidden":"true",className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out "+(x?"translate-x-5":"translate-x-0")})}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(x?"settings.enabled":"settings.disabled")})]}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="select")return i.jsxs("div",{children:[i.jsx("select",{value:t,onChange:function(m){n(m.target.value)},disabled:d,className:f,children:(e.options||[]).map(function(m){var x=e.optionLabels&&e.optionLabels[m]||m;return i.jsx("option",{value:m,children:x},m)})}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="number")return i.jsxs("div",{children:[i.jsx("input",{type:"number",value:t,onChange:function(m){n(m.target.value)},disabled:d,min:e.min,max:e.max,placeholder:e.defaultValue||o("settings.not_set"),className:f}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="textarea")return i.jsxs("div",{children:[i.jsx("textarea",{value:t,onChange:function(m){n(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f+" resize-y min-h-[80px]",rows:4}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="object")return i.jsxs("div",{children:[i.jsx(hG,{value:t,onChange:n,t:o}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const g=e.type==="password"?"password":"text";return i.jsxs("div",{children:[i.jsx("input",{type:g,value:t,onChange:function(m){n(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f,autoComplete:e.type==="password"?"off":void 0}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}let Ra=null;function eI(){if(Ra&&Ra.state==="closed"&&(Ra=null),!Ra){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{Ra=new e}catch(t){throw Ra=null,t}}return Ra.state==="suspended"&&Ra.resume().catch(()=>{}),Ra}if(typeof document<"u"){const e=async()=>{let t;try{t=eI()}catch{return}if(!t){document.removeEventListener("click",e),document.removeEventListener("keydown",e);return}if(t.state==="suspended"){try{await t.resume()}catch{return}if(t.state!=="running")return}t.state==="running"&&(document.removeEventListener("click",e),document.removeEventListener("keydown",e)),t.state==="closed"&&(Ra=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function mG(){let e;try{e=eI()}catch{return}if(e)try{const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.value=800,r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.01,t+.1),n.connect(r),r.connect(e.destination),n.start(t),n.stop(t+.1);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),a.connect(o),o.connect(e.destination),a.start(t+.1),a.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),Ra=null}}function xG(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function yG(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const tI="pave-native-notifications";function $u(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function bG(){return $u()?Notification.permission:"unsupported"}function n1(){if(!$u()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(tI)==="true"}catch{return!1}}function vG(e){try{localStorage.setItem(tI,e?"true":"false")}catch{}}async function kG(){if(!$u())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function _G({title:e,body:t,tag:n,icon:r,onClick:a}){if(!$u()||Notification.permission!=="granted"||!n1())return null;try{const o=new Notification(e,{body:t||"",tag:n||"pave-"+Date.now(),icon:r||wr("/pave-logo-light.png"),silent:!1});return typeof a=="function"&&(o.onclick=function(){a(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const nI="pave-push-notifications",wG="/sw.js";function Sp(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function SG(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function EG(){try{return localStorage.getItem(nI)==="true"}catch{return!1}}function Hf(e){try{localStorage.setItem(nI,e?"true":"false")}catch{}}function Xb(){return typeof Notification>"u"?"unsupported":Notification.permission}async function NG(){if(!Sp())return null;try{return await navigator.serviceWorker.register(wr(wG),{scope:wr("/")})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function CG(){if(!Sp())return console.warn("[web-push] Not supported in this browser"),!1;const e=await NG();if(!e)return!1;if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return console.warn("[web-push] Notification permission denied"),!1;let t;try{const r=await fetch(wr("/api/push/vapid-public-key"),{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const a=await r.json();t=MG(a.publicKey)}catch(r){return console.error("[web-push] Failed to get VAPID key:",r.message),!1}let n=await e.pushManager.getSubscription();if(n){let r=!0;if(n.options&&n.options.applicationServerKey){const a=new Uint8Array(n.options.applicationServerKey);r=IG(a,t)}if(r)return await UT(n),Hf(!0),!0;console.log("[web-push] VAPID key changed, re-subscribing...");try{await n.unsubscribe()}catch{}}try{n=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})}catch(r){return console.error("[web-push] Push subscription failed:",r.message),!1}return await UT(n),Hf(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function jG(){if(!Sp())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch(wr("/api/push/unsubscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return Hf(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),Hf(!1),!1}}async function UT(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:HT(e.getKey("p256dh")),auth:HT(e.getKey("auth"))}},await fetch(wr("/api/push/subscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function TG(){const e=await fetch(wr("/api/push/test"),{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function RG(e){if(typeof document>"u"||typeof window>"u")return;function t(n){const r=typeof e=="function"?e():null,a=JSON.stringify({visible:n,activeSessionId:r});try{if(navigator.sendBeacon){const o=new Blob([a],{type:"application/json"});navigator.sendBeacon(wr("/api/visibility"),o);return}fetch(wr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:a}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function AG(e,t){if(typeof document>"u")return;const n=JSON.stringify({visible:e,activeSessionId:t});try{if(navigator.sendBeacon){const r=new Blob([n],{type:"application/json"});navigator.sendBeacon(wr("/api/visibility"),r);return}fetch(wr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:n}).catch(()=>{})}catch{}}function IG(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function MG(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4),r=atob(t+n),a=new Uint8Array(r.length);for(let o=0;o<r.length;o++)a[o]=r.charCodeAt(o);return a}function HT(e){if(!e)return"";const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const Wu="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function r1({t:e}){return i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function Ep({id:e,label:t,description:n,hints:r,checked:a,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return i.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:n}),r]}),u?i.jsx("button",{id:e,type:"button",role:"switch","aria-checked":a,onClick:o,disabled:l,className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 "+(a?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:i.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out "+(a?"translate-x-5":"translate-x-0")})}):i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function LG(){const{t:e,locale:t,setLocale:n,availableLocales:r}=rn();return i.jsxs("div",{className:Wu,children:[i.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),i.jsx("select",{id:"settings-language",value:t,onChange:function(a){n(a.target.value)},className:"block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500 text-gray-900 dark:text-gray-100",children:r.map(function(a){return i.jsxs("option",{value:a.code,children:[a.nativeName," (",a.name,")"]},a.code)})}),i.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function OG(){const{t:e}=rn(),[t,n]=y.useState(()=>xG()),r=y.useCallback(function(){const a=!t;n(a),yG(a),a&&mG()},[t]);return i.jsxs("div",{className:Wu,children:[i.jsx(Ep,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:i.jsx(r1,{t:e}),checked:t,onToggle:r}),i.jsx(DG,{}),i.jsx(PG,{})]})}function DG(){const{t:e}=rn(),[t]=y.useState(()=>$u()),[n,r]=y.useState(()=>bG()),[a,o]=y.useState(()=>n1()),l=y.useCallback(async function(){if(!t)return;if(!a&&Notification.permission!=="granted"){const d=await kG();if(r(d),d!=="granted")return}const u=!a;o(u),vG(u)},[a,t]);return i.jsx(Ep,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:i.jsxs(i.Fragment,{children:[n==="denied"&&i.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),n==="default"&&i.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),i.jsx(r1,{t:e})]}),checked:a,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function PG(){const[e]=y.useState(()=>Sp()),[t,n]=y.useState(()=>EG()),[r,a]=y.useState(()=>Xb()),[o,l]=y.useState(!1),u=y.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await jG(),n(!1)):(await CG()&&n(!0),a(Xb()))}catch(f){console.error("[settings] Web push toggle failed:",f.message)}finally{l(!1)}}},[t,e,o]),d=y.useCallback(async function(){if(!o){l(!0);try{const f=await TG();f.sent>0?alert("Test push sent! Check your device."):f.failed>0?alert("Push delivery failed ("+f.failed+" failed). Check server logs — the subscription may need to be renewed."):alert("No active push subscriptions. Make sure you enabled push and your device is registered.")}catch(f){alert("Test push failed: "+f.message)}finally{l(!1)}}},[o]);return i.jsx(Ep,{id:"settings-web-push",divided:!0,label:"Push Notifications (PWA)",description:"Server-delivered push when you switch away from the app. Works on iOS Safari (installed to Home Screen) and desktop browsers.",hints:i.jsxs(i.Fragment,{children:[e&&!SG()&&i.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:"Add to Home Screen / Dock for background push on iOS."}),r==="denied"&&i.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:"Notifications blocked by browser — enable in browser settings."}),t&&i.jsx("button",{type:"button",onClick:d,disabled:o,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:o?"Sending...":"Send test notification"})]}),checked:t,onToggle:u,disabled:o,supported:e,unsupportedText:"Not supported in this browser"})}function FG({mobileFrameless:e,onMobileFramelessChange:t}){const{t:n}=rn();return i.jsx("div",{className:Wu,children:i.jsx(Ep,{id:"settings-mobile-frameless",label:n("settings.mobile_frameless"),description:n("settings.mobile_frameless_desc"),hints:i.jsx(r1,{t:n}),checked:e,onToggle:()=>t(!e)})})}function BG({activeSessionId:e}){const{t}=rn(),[n,r]=y.useState(()=>Fl()||""),[a,o]=y.useState(()=>Fl()||""),[l,u]=y.useState(""),[d,f]=y.useState(null),[p,g]=y.useState(!1),[m,x]=y.useState(null);y.useEffect(function(){pv().then(function(S){u(S.home||"")}).catch(function(){})},[]);const v=y.useCallback(function(S){r(S),f(null),x(null)},[]),k=y.useCallback(async function(){const S=n.trim();if(!S){if(zh(null),o(""),r(""),f(null),x({type:"success",message:t("settings.working_dir_reset")}),e)try{await Ki(e,{directory:null})}catch(N){console.warn("[settings] failed to clear session directory:",N.message)}return}g(!0),f(null);const E=Fl();try{zh(S);const N=await pv();if(o(S),r(S),x({type:"success",message:t("settings.working_dir_updated",{path:N.cwd})}),e)try{await Ki(e,{directory:S})}catch(R){console.warn("[settings] failed to update session directory:",R.message)}}catch(N){zh(E),r(a),f(t("settings.working_dir_invalid",{error:N.message}))}finally{g(!1)}},[n,a,e,t]),_=n!==a;return i.jsxs("div",{className:Wu,children:[i.jsx("label",{htmlFor:"settings-working-dir",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("settings.working_dir")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{id:"settings-working-dir",type:"text",value:n,onChange:function(S){v(S.target.value)},placeholder:l||"~ (home directory)",className:"flex-1 block rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(d?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+" text-gray-900 dark:text-gray-100"}),i.jsx("button",{onClick:k,disabled:p||!_,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(_&&!p?"bg-primary-600 text-white hover:bg-primary-700":"bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed"),children:t(p?"settings.validating":"settings.apply")})]}),d&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&i.jsx("p",{className:"mt-2 text-xs "+(m.type==="success"?"text-green-600 dark:text-green-400":m.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400"),children:m.message}),a&&i.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:a})})]})}function zG(){const{t:e}=rn(),[t,n]=y.useState("checking"),[r,a]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(null),f=y.useCallback(function(m){a(m.currentVersion),l(m.latestVersion),m.error?(d(m.error),n("check-error")):m.updateAvailable?n("update-available"):n("no-updates")},[]),p=y.useCallback(async function(){n("checking"),d(null);try{const m=await $h();f(m)}catch(m){d(m.message),n("check-error")}},[f]),g=y.useCallback(async function(){n("updating"),d(null);try{await e3(),n("success");try{const m=await $h();a(m.currentVersion),l(m.latestVersion)}catch{}}catch(m){d(m.message),n("error")}},[]);return y.useEffect(function(){var m=!1;return n("checking"),(async function(){try{const v=await $h();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),n("check-error"))}})(),function(){m=!0}},[f]),i.jsx("div",{className:Wu,children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r||"--"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),i.jsx(qG,{t:e,updateStatus:t,updateError:u,latestVersion:o}),i.jsx(UG,{t:e,updateStatus:t,onCheckUpdates:p,onPerformUpdate:g})]})})}function qG({t:e,updateStatus:t,updateError:n,latestVersion:r}){return i.jsxs(i.Fragment,{children:[t==="update-available"&&i.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",r,")"]}),t==="no-updates"&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&i.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&n&&i.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",n]}),t==="error"&&n&&i.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",n]})]})}function UG({t:e,updateStatus:t,onCheckUpdates:n,onPerformUpdate:r}){const a=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return i.jsxs("div",{className:"flex gap-2 pt-1",children:[a&&i.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:e("settings.check_updates")}),t==="update-available"&&i.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors",children:e("settings.update_button")}),t==="updating"&&i.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.update_in_progress")}),t==="checking"&&i.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.checking_updates")})]})}function Vv(e){const t={};for(let n=0;n<e.length;n++)t[e[n].key]=e[n].value;return t}function HG(e,t){const n={};for(let r=0;r<e.length;r++){const a=e[r];a.source!=="env"&&t[a.key]!==a.value&&(n[a.key]=t[a.key])}return n}function $G(e,t,n){const r=Vv(e);for(let a=0;a<n.length;a++)t[n[a]]!==void 0&&(r[n[a]]=t[n[a]]);return r}function WG(e){const t={};for(let n=0;n<e.length;n++){const r=e[n].category;t[r]||(t[r]=[]),t[r].push(e[n])}return t}function VG(e,t){const n=[];for(let a=0;a<t.length;a++)e[t[a]]&&n.push(t[a]);const r=Object.keys(e);for(let a=0;a<r.length;a++)n.indexOf(r[a])<0&&n.push(r[a]);return n}const GG=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","Experimental Features","Developer"],$f={"AI Model & Provider":"settings.category.model","Prefill Fallback":"settings.category.prefillFallback",Models:"settings.category.models",Compaction:"settings.category.compaction","Tool Execution":"settings.category.tools","Rate Limiting":"settings.category.rate","Session Behavior":"settings.category.sessionBehavior",Display:"settings.category.display","Session Banner":"settings.category.sessionBanner",Marketplace:"settings.category.marketplace","System Prompts":"settings.category.systemPrompts","Experimental Features":"settings.category.experimental",Developer:"settings.category.developer"};function KG(){const{t:e}=rn(),[t,n]=y.useState([]),[r,a]=y.useState({}),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(null),k=y.useCallback(async()=>{try{d(!0),v(null);const j=(await S4()).settings||[];n(j),a(Vv(j)),l({}),m(null)}catch(T){v(T.message)}finally{d(!1)}},[]),_=y.useCallback((T,j)=>{a(I=>{const M={...I};return M[T]=j,M}),l(I=>{if(!I[T])return I;const{[T]:M,...L}=I;return L}),m(null)},[]),S=HG(t,r),E=Object.keys(S).length,N=y.useCallback(async()=>{p(!0),m(null);try{if(E===0){m({type:"info",message:e("settings.no_changes")});return}const T=await DL(S),j=Object.keys(T.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(S)}}))}catch{}if(j.length>0?(l(T.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),T.settings){const I=T.settings;n(I),a(M=>$G(I,M,j))}}catch(T){if(T&&T.status===401){m({type:"error",message:"Session expired. Please log in again."});return}m({type:"error",message:e("settings.save_failed",{error:T.message})})}finally{p(!1)}},[S,E,e]),R=y.useCallback(()=>{a(Vv(t)),l({}),m(null)},[t]);return{settings:t,formValues:r,errors:o,loading:u,saving:f,saveResult:g,setSaveResult:m,loadError:x,updates:S,changedCount:E,loadSettings:k,handleChange:_,handleSave:N,handleReset:R}}function YG(){return i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function QG({t:e,loadError:t,onRetry:n}){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[i.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),i.jsx("button",{onClick:n,className:"px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700",children:e("common.retry")})]})}const Gv="__dlp__",Kv="__pricing__",rI="Configure Data Loss Prevention rules, detectors, and audit policies.",iI="Configure per-model token pricing used for cost and usage tracking.",aI="__chat_language__",sI="__chat_notifications__",oI="__chat_appearance__",lI="__chat_workspace__",cI="__chat_version__",$T={[aI]:LG,[sI]:OG,[oI]:FG,[lI]:BG,[cI]:zG};function XG(e,t){return t?e.filter(function(n){return(n.key||"").toLowerCase().indexOf(t)>=0||(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function ZG(e,t){return t?e.filter(function(n){return(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function JG(e){const t={};if(!e)return t;for(let n=0;n<e.length;n++){const r=e[n].category;t[r]=(t[r]||0)+1}return t}function eK({t:e,search:t,onSearchChange:n,onBack:r,groups:a,activeGroup:o,matchCounts:l,searching:u,onSelect:d}){return i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("button",{onClick:r,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:e("settings.back"),"aria-label":e("settings.back"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),i.jsx("select",{value:o,onChange:function(f){d(f.target.value)},"aria-label":e("settings.v2.groups_aria"),className:"md:hidden shrink-0 max-w-[9rem] truncate border text-sm py-1.5 pl-2 pr-6 bg-[#ffffff] dark:bg-[#111827] border-[#d1d5db] dark:border-[#4b5563] text-[#111827] dark:text-[#f3f4f6]",children:a.map(function(f){const p=u?l[f.id]:null;return i.jsx("option",{value:f.id,children:p?f.label+" ("+p+")":f.label},f.id)})}),i.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[i.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),i.jsx("input",{id:"settings-v2-search",type:"text",value:t,onChange:function(f){n(f.target.value)},placeholder:e("settings.v2.search_placeholder"),"aria-label":e("settings.v2.search_placeholder"),className:"block w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 pl-9 pr-8 py-1.5 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:border-primary-500"}),t&&i.jsx("button",{type:"button",onClick:function(){n("")},title:e("settings.v2.search_clear"),"aria-label":e("settings.v2.search_clear"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function tK({t:e,groups:t,activeGroup:n,matchCounts:r,searching:a,onSelect:o}){return i.jsx("nav",{className:"hidden md:block w-52 shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto py-2","aria-label":e("settings.v2.groups_aria"),"data-testid":"settings-v2-groups",children:t.map(function(l){const u=!a&&l.id===n,d=a?r[l.id]:l.kind==="registry"?l.count:null,f=!a||r[l.id];return i.jsxs("button",{type:"button",onClick:function(){o(l.id)},"aria-current":u?"page":void 0,className:"w-full flex items-center justify-between gap-2 px-3 py-2 text-left text-sm transition-colors "+(u?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 font-medium border-r-2 border-primary-600":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800/60"),children:[i.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums shrink-0",children:d})]},l.id)})})}function nK({setting:e,formValue:t,error:n,models:r,t:a,onChange:o}){const l=e.source==="env";return i.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900","data-setting-key":e.key,children:[i.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&i.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 whitespace-nowrap",title:a("settings.env_override",{envVar:e.envVar}),children:a("settings.source_env")})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&i.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:a("settings.requires_restart")}),e.source==="env"&&i.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:a("settings.env_override",{envVar:e.envVar})}),i.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),i.jsx(gG,{setting:e,value:t!==void 0?t:"",onChange:o,error:n,models:r,t:a}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:a("settings.default_prefix",{value:e.defaultValue===""?a("settings.default_empty"):String(e.defaultValue)})})]})}function Zb({title:e,description:t,actionLabel:n,onOpen:r}){return i.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),i.jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:n})]})}function rK({t:e,changedCount:t,saving:n,saveResult:r,onSave:a,onReset:o}){const l=r?r.type==="success"?"text-green-600 dark:text-green-400":r.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400":"";return i.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 px-6 py-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-900/60",children:[i.jsx("span",{className:"text-xs "+(t>0?"text-amber-600 dark:text-amber-400 font-medium":"text-gray-400 dark:text-gray-500"),children:t>0?e("settings.v2.unsaved",{count:t}):""}),r&&i.jsx("span",{className:"text-xs "+l,children:r.message}),i.jsxs("div",{className:"ml-auto flex gap-2",children:[i.jsx("button",{type:"button",onClick:o,disabled:t===0||n,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e("settings.reset")}),i.jsx("button",{type:"button",onClick:a,disabled:t===0||n,className:"px-4 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(n?"settings.saving":"settings.save")})]})]})}function iK({t:e}){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[i.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),i.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function aK(e){const{q:t,matches:n,launcherMatches:r,orderedCategories:a,grouped:o,renderRegistryRow:l,activeGroup:u,t:d,onOpenDlpSettings:f,onOpenPricingSettings:p,activeSessionId:g,mobileFrameless:m,onMobileFramelessChange:x}=e;let v;if(t&&(!n||n.length===0)&&(!r||r.length===0))v=i.jsx(iK,{t:d});else if(t)v=i.jsxs("div",{className:"space-y-6",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d("settings.v2.search_results",{count:(n?n.length:0)+(r?r.length:0)})}),a.map(function(k){const _=n.filter(function(S){return S.category===k});return _.length===0?null:i.jsxs("section",{children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-2 sticky top-0 bg-gray-50 dark:bg-gray-950 py-1 z-10",children:$f[k]?d($f[k]):k}),i.jsx("div",{className:"space-y-3",children:_.map(l)})]},"search-"+k)}),(r||[]).map(function(k){return i.jsx(Zb,{title:k.label,description:k.description,actionLabel:d("settings.v2.open"),onOpen:k.onOpen},"search-launcher-"+k.id)})]});else if(u===Gv)v=i.jsx(Zb,{title:d("dlp.title"),description:rI,actionLabel:d("settings.v2.open"),onOpen:f});else if(u===Kv)v=i.jsx(Zb,{title:d("pricing.title"),description:iI,actionLabel:d("settings.v2.open"),onOpen:p});else if($T[u]){const k=$T[u];v=i.jsx("div",{className:"space-y-3",children:i.jsx(k,{activeSessionId:g,mobileFrameless:m,onMobileFramelessChange:x})})}else v=i.jsx("div",{className:"space-y-3",children:(o[u]||[]).map(l)});return v}function sK({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:a,onMobileFramelessChange:o}){const{t:l}=rn(),{settings:u,formValues:d,errors:f,loading:p,saving:g,saveResult:m,loadError:x,changedCount:v,loadSettings:k,handleChange:_,handleSave:S,handleReset:E}=KG(),N=u.filter(function(G){return!G.hidden}),[R,T]=y.useState([]),[j,I]=y.useState(""),[M,L]=y.useState(null);y.useEffect(()=>{k()},[k]),y.useEffect(()=>{L(function(G){return G||u[0]&&u[0].category||null})},[u]),y.useEffect(()=>{let G=!1;return t3().then(function(X){G||T(Array.isArray(X)?X:X&&X.models||[])}).catch(function(){G||T([])}),function(){G=!0}},[]);const A=WG(N),O=VG(A,GG),F=O.map(function(G){return{id:G,kind:"registry",label:$f[G]?l($f[G]):G,count:A[G].length}}).concat([{id:aI,kind:"chat",label:l("settings.category.language")},{id:sI,kind:"chat",label:l("settings.notifications")},{id:oI,kind:"chat",label:l("settings.appearance")},{id:lI,kind:"chat",label:l("settings.workspace")},{id:cI,kind:"chat",label:l("settings.version_title")},{id:Gv,kind:"launcher",label:l("dlp.title")},{id:Kv,kind:"launcher",label:l("pricing.title")}]),Q=j.trim().toLowerCase(),H=XG(N,Q),P=[{id:Gv,label:l("dlp.title"),description:rI,onOpen:t},{id:Kv,label:l("pricing.title"),description:iI,onOpen:n}],K=ZG(P,Q),W=JG(H),Y=y.useCallback(function(G){I(""),L(G)},[]),ce=function(G){return i.jsx(nK,{setting:G,formValue:d[G.key],error:f[G.key],models:R,t:l,onChange:function(X){_(G.key,X)}},G.key)};if(p)return i.jsx(YG,{});if(x)return i.jsx(QG,{t:l,loadError:x,onRetry:k});const z=aK({q:Q,matches:H,launcherMatches:K,orderedCategories:O,grouped:A,renderRegistryRow:ce,activeGroup:M,t:l,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:a,onMobileFramelessChange:o});return i.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[i.jsx(eK,{t:l,search:j,onSearchChange:I,onBack:e,groups:F,activeGroup:M,matchCounts:W,searching:!!Q,onSelect:Y}),i.jsxs("div",{className:"flex-1 flex min-h-0",children:[i.jsx(tK,{t:l,groups:F,activeGroup:M,matchCounts:W,searching:!!Q,onSelect:Y}),i.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[i.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:z}),i.jsx(rK,{t:l,changedCount:v,saving:g,saveResult:m,onSave:S,onReset:E})]})]})]})}function oK({modelName:e,rates:t,onChange:n,onDelete:r,isDefault:a,t:o}){return i.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-sm font-medium truncate ${a?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),a&&i.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded",children:o("pricing.fallback_badge")})]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.input,onChange:l=>n(e,"input",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.input_tokens")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.output,onChange:l=>n(e,"output",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.output_tokens")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.cached,onChange:l=>n(e,"cached",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.cached_tokens")})]}),!a&&i.jsx("button",{onClick:()=>r(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors",title:o("pricing.remove_model"),"aria-label":o("pricing.remove_model_aria",{modelName:e}),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),a&&i.jsx("div",{className:"w-6"})]})]})}function lK({onAdd:e,existingModels:t,t:n}){const[r,a]=y.useState(""),[o,l]=y.useState(5),[u,d]=y.useState(15),[f,p]=y.useState(2.5),[g,m]=y.useState(""),x=v=>{v.preventDefault(),m("");const k=r.trim().toLowerCase();if(!k){m(n("pricing.model_required"));return}if(t.includes(k)){m(n("pricing.model_exists"));return}if(k==="default"){m(n("pricing.default_exists"));return}e(k,{input:o,output:u,cached:f}),a(""),l(5),d(15),p(2.5)};return i.jsxs("form",{onSubmit:x,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("pricing.add_new_model")}),i.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[i.jsx("div",{className:"flex-1 min-w-[120px]",children:i.jsx("input",{type:"text",placeholder:n("pricing.add_model_placeholder"),value:r,onChange:v=>a(v.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_input")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:o,onChange:v=>l(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_output")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:u,onChange:v=>d(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_cache")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:f,onChange:v=>p(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),i.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded transition-colors",children:n("pricing.add")})]}),g&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:g})]})}function cK({onClose:e}){const{t}=rn(),n=Iu(),[r,a]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(!1),[f,p]=y.useState(null),[g,m]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{let T=!1;async function j(){try{const I=await QL();T||(a(I),l(!1))}catch(I){T||(p(I.message),l(!1))}}return j(),()=>{T=!0}},[]),y.useEffect(()=>{async function T(j){j.key==="Escape"&&(g?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",T),x.current&&x.current.focus(),()=>document.removeEventListener("keydown",T)},[e,g,n,t]);const v=y.useCallback((T,j,I)=>{a(M=>!M||!M.models?M:{...M,models:{...M.models,[T]:{...M.models[T],[j]:I}}}),m(!0)},[]),k=y.useCallback(async T=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:T}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(a(j=>{if(!j||!j.models)return j;const I={...j.models};return delete I[T],{...j,models:I}}),m(!0))},[n,t]),_=y.useCallback((T,j)=>{a(I=>I?{...I,models:{...I.models,[T]:j}}:{models:{[T]:j}}),m(!0)},[]),S=y.useCallback(async()=>{p(null),d(!0);try{await XL(r),m(!1),e()}catch(T){p(T.message)}finally{d(!1)}},[r,e]),E=y.useCallback(async()=>{if(await n({title:t("pricing.reset_title"),message:t("pricing.reset_confirm"),destructive:!0,confirmLabel:t("pricing.reset")})){p(null),d(!0);try{const T=await ZL();a(T.pricing),m(!1)}catch(T){p(T.message)}finally{d(!1)}}},[n,t]),N=y.useCallback(async()=>{g?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[g,e,n,t]),R=r!=null&&r.models?Object.entries(r.models).sort(([T],[j])=>T==="default"?1:j==="default"?-1:T.localeCompare(j)):[];return i.jsx("div",{ref:x,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:N,role:"dialog","aria-modal":"true","aria-label":t("pricing.title"),children:i.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:T=>T.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),i.jsx("button",{onClick:N,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&i.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&r&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[i.jsx("span",{children:t("pricing.configured_count",{count:R.length})}),i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),i.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[i.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),i.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),i.jsx("div",{className:"w-6"})]}),i.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:R.map(([T,j])=>i.jsx(oK,{modelName:T,rates:j,onChange:v,onDelete:k,isDefault:T==="default",t},T))})]}),i.jsx(lK,{onAdd:_,existingModels:R.map(([T])=>T),t})]})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:[i.jsx("button",{onClick:E,disabled:u,className:"px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("pricing.reset")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:N,disabled:u,className:"px-4 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("common.cancel")}),i.jsxs("button",{onClick:S,disabled:u||!g,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 dark:disabled:bg-gray-700 text-white rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:[u&&i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const uK=[{id:"email",label:"Email address",name:"email",regex:"\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b",severity:"medium"},{id:"credit_card",label:"Credit card number",name:"credit_card",regex:"\\b(?:\\d[ -]*?){13,19}\\b",severity:"high"},{id:"hk_phone",label:"HK phone number",name:"hk_phone",regex:"\\b[2-9]\\d{7}\\b",severity:"low"},{id:"intl_phone",label:"International phone",name:"intl_phone",regex:"\\+?\\d{1,3}[\\s-]?\\(?\\d{1,4}\\)?[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}\\b",severity:"low"},{id:"generic_api_key",label:"Generic API key",name:"generic_api_key",regex:"\\b(?:sk|pk|api[_-]?key)[_-][A-Za-z0-9]{20,}\\b",severity:"high"}],dK=["low","medium","high"];function fK({severity:e}){const t={high:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",medium:"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",low:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400"};return i.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function WT({name:e,regex:t,severity:n,enabled:r,builtin:a,onToggle:o,onRemove:l,t:u}){return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 border-b border-gray-100 dark:border-gray-800 last:border-b-0 group hover:bg-gray-50 dark:hover:bg-gray-800/40 transition-colors",children:[i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[i.jsx("input",{type:"checkbox",checked:r,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),i.jsx("div",{className:"w-8 h-4 bg-gray-200 peer-focus:outline-hidden peer-focus:ring-2 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-3 after:w-3 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),a&&i.jsx("span",{className:"px-1 py-0.5 text-[10px] bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded font-mono",children:"built-in"})]}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",title:t,children:t.length>60?t.slice(0,57)+"...":t})]}),i.jsx(fK,{severity:n}),!a&&i.jsx("button",{onClick:()=>l(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:u("dlp.remove_pattern"),"aria-label":u("dlp.remove_pattern_aria",{name:e}),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function pK({onAdd:e,existingNames:t,t:n}){const[r,a]=y.useState(""),[o,l]=y.useState(""),[u,d]=y.useState("medium"),[f,p]=y.useState(""),g=x=>{if(t.includes(x.name)){p(n("dlp.pattern_exists",{name:x.name}));return}a(x.name),l(x.regex),d(x.severity),p("")},m=x=>{if(x.preventDefault(),p(""),!r.trim()){p(n("dlp.name_required"));return}if(!o.trim()){p(n("dlp.regex_required"));return}if(t.includes(r.trim())){p(n("dlp.pattern_exists",{name:r.trim()}));return}try{new RegExp(o)}catch{p(n("dlp.invalid_regex"));return}e(r.trim(),o.trim(),u),a(""),l(""),d("medium")};return i.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("dlp.add_pattern")}),i.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:uK.map(x=>i.jsx("button",{onClick:()=>g(x),className:"px-2 py-0.5 text-xs bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded hover:bg-primary-50 dark:hover:bg-primary-900/30 text-gray-700 dark:text-gray-300 transition-colors",children:x.label},x.id))}),i.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[i.jsxs("div",{className:"flex-1 min-w-[140px]",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.pattern_name")}),i.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:r,onChange:x=>a(x.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),i.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.regex_pattern")}),i.jsx("input",{type:"text",placeholder:"e.g. \\b[A-Z]\\d{7}\\b",value:o,onChange:x=>l(x.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),i.jsxs("div",{className:"w-24",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.severity")}),i.jsx("select",{value:u,onChange:x=>d(x.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:dK.map(x=>i.jsx("option",{value:x,children:x},x))})]}),i.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm bg-primary-600 hover:bg-primary-700 text-white rounded transition-colors",children:n("dlp.add")})]}),f&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function hK({onClose:e}){const{t}=rn(),n=Iu(),[r,a]=y.useState(null),[o,l]=y.useState([]),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(!0),[S,E]=y.useState("ask"),[N,R]=y.useState([]),[T,j]=y.useState({}),[I,M]=y.useState("epm/privacy"),L=y.useRef(null);y.useEffect(()=>{let K=!1;async function W(){var Y;try{const ce=await UL();K||(l(ce.builtins||[]),_(ce.enabled!==!1),E(ce.defaultAction||"ask"),R(ce.disabledBuiltins||[]),j(ce.patterns||{}),M(((Y=ce.privateMode)==null?void 0:Y.rerouteModel)||"epm/privacy"),a(ce),d(!1))}catch(ce){K||(m(ce.message),d(!1))}}return W(),()=>{K=!0}},[]),y.useEffect(()=>{async function K(W){W.key==="Escape"&&(x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",K),L.current&&L.current.focus(),()=>document.removeEventListener("keydown",K)},[e,x,n,t]);const A=y.useCallback(K=>{R(W=>W.includes(K)?W.filter(Y=>Y!==K):[...W,K]),v(!0)},[]),O=y.useCallback((K,W,Y)=>{j(ce=>({...ce,[K]:{regex:W,severity:Y}})),v(!0)},[]),F=y.useCallback(K=>{j(W=>{const Y={...W};return delete Y[K],Y}),v(!0)},[]),Q=y.useCallback(async()=>{m(null),p(!0);try{const W=await HL({enabled:k,defaultAction:S,disabledBuiltins:N,privateMode:{rerouteModel:I},patterns:T});v(!1),a(W.policy),e()}catch(K){m(K.message)}finally{p(!1)}},[k,S,N,T,I,e]),H=y.useCallback(async()=>{x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[x,e,n,t]),P=[...o.map(K=>K.name),...Object.keys(T)];return i.jsx("div",{ref:L,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:H,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:i.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:K=>K.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),i.jsx("button",{onClick:H,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),g&&i.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:g})}),!u&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:k,onChange:K=>{_(K.target.checked),v(!0)},className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-hidden peer-focus:ring-4 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),i.jsxs("select",{value:S,onChange:K=>{E(K.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[i.jsx("option",{value:"ask",children:"Ask (show modal)"}),i.jsx("option",{value:"reroute",children:"Always reroute to private"}),i.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),i.jsx("input",{type:"text",value:I,onChange:K=>{M(K.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),i.jsxs("div",{className:"mb-4 mt-6",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:o.map(K=>i.jsx(WT,{name:K.name,regex:K.regex,severity:K.severity,enabled:!N.includes(K.name),builtin:!0,onToggle:A,onRemove:()=>{},t},K.name))})]}),i.jsxs("div",{className:"mb-4 mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.user_patterns_desc")}),Object.keys(T).length===0?i.jsx("div",{className:"text-sm text-gray-400 dark:text-gray-500 py-3 text-center border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:t("dlp.no_user_patterns")}):i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:Object.entries(T).map(([K,W])=>i.jsx(WT,{name:K,regex:W.regex,severity:W.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:F,t},K))})]}),i.jsx(pK,{onAdd:O,existingNames:P,t})]})]}),!u&&i.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[i.jsx("button",{onClick:H,className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:t("dlp.cancel")}),i.jsx("button",{onClick:Q,disabled:f||!x,className:"px-4 py-2 text-sm bg-primary-600 hover:bg-primary-700 disabled:bg-gray-300 dark:disabled:bg-gray-700 disabled:cursor-not-allowed text-white rounded-lg transition-colors",children:t(f?"dlp.saving":"dlp.save")})]})]})})}function gK(e,t){var n={grant:"permission.action_grant",revoke:"permission.action_revoke",clear:"permission.action_clear_all"},r={network:"permission.type_network","fs.read":"permission.type_file_read","fs.write":"permission.type_file_write","filesystem.read":"permission.type_file_read","filesystem.write":"permission.type_file_write",module:"permission.type_module",modules:"permission.type_module",require:"permission.type_module",system:"permission.type_system",command:"permission.type_system"};if(e.action==="clear")return t("permission.clear_all");var a=n[e.action]?t(n[e.action]):e.action,o=r[e.type]?t(r[e.type]):e.type;return t("permission.request_desc",{action:a,type:o,target:e.target||"*"})}function mK({request:e,onDismiss:t}){const{t:n}=rn(),[r,a]=y.useState(null),[o,l]=y.useState(null),u=y.useRef(!0),d=y.useRef(null);y.useEffect(()=>()=>{u.current=!1,d.current&&clearTimeout(d.current)},[]);const f=y.useCallback(v=>{v.includes("not found")||v.includes("expired")?l("Request expired"):v.includes("already")?l("Request already processed"):l(v),a("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),p=y.useCallback(async()=>{a("allow"),l(null);try{const v=await ZM(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to confirm";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to confirm";f(k)}},[e.id,t,f]),g=y.useCallback(async()=>{a("deny"),l(null);try{const v=await JM(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to deny";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to deny";f(k)}},[e.id,t,f]),m=e.action==="clear",x=e.action==="revoke";return i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 p-4 w-80 animate-slide-in",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${m?"bg-red-100 dark:bg-red-900/30":x?"bg-amber-100 dark:bg-amber-900/30":"bg-blue-100 dark:bg-blue-900/30"}`,children:i.jsx("svg",{className:`w-4 h-4 ${m?"text-red-600 dark:text-red-400":x?"text-amber-600 dark:text-amber-400":"text-blue-600 dark:text-blue-400"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),i.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:n("permission.title")})]}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:gK(e,n)}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:[n("permission.reason_prefix")," ",typeof e.reason=="string"&&e.reason.trim()?e.reason:n("permission.no_reason")]}),o&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:g,disabled:r!==null,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:n(r==="deny"?"permission.denying":"permission.deny")}),i.jsx("button",{onClick:p,disabled:r!==null,className:`px-3 py-1.5 text-sm font-medium rounded-md text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${m?"bg-red-600 hover:bg-red-700":x?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:n(r==="allow"?"permission.allowing":"permission.allow")})]})]})}function xK({requests:e,onDismiss:t}){return!e||e.length===0?null:i.jsx(i.Fragment,{children:e.map(n=>i.jsx(mK,{request:n,onDismiss:t},n.id))})}var yK="https://account.openpave.ai/dashboard";function bK({open:e,onClose:t,upgradeUrl:n}){var{t:r}=rn(),a=y.useRef(null),o=y.useRef(null),l=y.useRef(t),u=yK;if(typeof n=="string"&&n.length>0)try{var d=new URL(n),f=["account.openpave.ai"];d.protocol==="https:"&&f.indexOf(d.hostname)!==-1&&(u=d.href)}catch{}return y.useEffect(function(){l.current=t},[t]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function p(g){g.key==="Escape"&&(typeof g.preventDefault=="function"&&g.preventDefault(),typeof g.stopImmediatePropagation=="function"?g.stopImmediatePropagation():typeof g.stopPropagation=="function"&&g.stopPropagation(),l.current())}return document.addEventListener("keydown",p,!0),function(){document.removeEventListener("keydown",p,!0)}},[e]),y.useEffect(function(){if(!e||!a.current)return;function p(g){if(g.key==="Tab"){var m=a.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(m.length!==0){var x=m[0],v=m[m.length-1];g.shiftKey?document.activeElement===x&&(g.preventDefault(),v.focus()):document.activeElement===v&&(g.preventDefault(),x.focus())}}}return document.addEventListener("keydown",p),function(){document.removeEventListener("keydown",p)}},[e]),e?i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(p){p.target===p.currentTarget&&t()},children:i.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":r("credits.limit_reached"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-hidden transition-all duration-150",children:[i.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[i.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("credits.limit_reached")})]}),i.jsx("div",{className:"px-5 py-4",children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("credits.limit_message")})}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.jsx("button",{ref:o,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:r("credits.dismiss")}),i.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 text-white focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 inline-flex items-center gap-1.5",children:[r("credits.add_credits"),i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[i.jsx("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),i.jsx("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})}):null}function vK(e){if(e==null)return"";const t=Date.now()-e;if(t<=0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const a=Math.floor(r/60);if(a<24)return`${a}h ago`;const o=Math.floor(a/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function Jb(e,t){if(!e||!t)return!e;const n=String(e).toLowerCase(),r=String(t).toLowerCase();let a=0;for(let o=0;o<r.length&&a<n.length;o+=1)r[o]===n[a]&&(a+=1);return a===n.length}function kK(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function _K({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:a,sessions:o,busySessions:l={}}){const{t:u}=rn(),[d,f]=y.useState(""),[p,g]=y.useState(0),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=y.useRef(null),S=y.useRef(null),E=y.useRef(null),N=d?d.trim():"";y.useEffect(()=>{if(e){f(""),g(0),x(null),k(!1);const L=requestAnimationFrame(()=>{_.current&&_.current.focus()});return()=>cancelAnimationFrame(L)}},[e]),y.useEffect(()=>{let L=!1;const A=d?d.trim():"";if(E.current&&(clearTimeout(E.current),E.current=null),!e){x(null),k(!1);return}if(A.length<2){x(null),k(!1);return}return x(null),k(!0),E.current=setTimeout(()=>{Dl({q:A,limit:20}).then(O=>{if(L)return;const F=Array.isArray(O)?O:O.sessions||[];x(F),k(!1)}).catch(()=>{L||k(!1)})},300),()=>{L=!0,E.current&&(clearTimeout(E.current),E.current=null)}},[d,e]);const R=y.useCallback(L=>{if(!a)return L;const A=L.findIndex(Q=>Q.id===a);if(A<=0)return L;const O=L.slice(),[F]=O.splice(A,1);return O.unshift(F),O},[a]),T=y.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),j=y.useMemo(()=>{const L=o||[],A=!N||Jb(N,"new chat")||Jb(N,u("spotlight.new_chat")),O=H=>A&&r?a&&H.length>0&&H[0].id===a?[H[0],T,...H.slice(1)]:[T,...H]:H;if(!N)return O(R(L.slice(0,10)));const F=L.filter(H=>Jb(N,H.title||""));let Q;if(m){const H=new Set(F.map(K=>K.id)),P=m.filter(K=>!H.has(K.id));Q=F.concat(P).slice(0,20)}else Q=F.slice(0,20);return O(R(Q))},[N,o,m,R,T,r,u,a]);y.useEffect(()=>{g(0)},[N]),y.useEffect(()=>{g(L=>j.length===0?0:L>=j.length?j.length-1:L)},[j.length]),y.useEffect(()=>{if(!S.current)return;const L=S.current.querySelectorAll('[role="option"]');L[p]&&L[p].scrollIntoView({block:"nearest"})},[p,j.length]);const I=y.useCallback(L=>{if(L&&L.isAction&&L.actionType==="new-chat"){r&&r(),t();return}const A=typeof L=="string"?L:L==null?void 0:L.id;A&&n(A),t()},[n,r,t]),M=y.useCallback(L=>{L.key==="ArrowDown"?(L.preventDefault(),g(A=>j.length===0?0:(A+1)%j.length)):L.key==="ArrowUp"?(L.preventDefault(),g(A=>j.length===0?0:(A-1+j.length)%j.length)):L.key==="Enter"?(L.preventDefault(),j[p]&&I(j[p])):L.key==="Escape"&&(L.preventDefault(),t())},[j,p,I,t]);return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:i.jsxs("div",{className:"w-full max-w-lg mx-4 bg-white dark:bg-gray-900 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 overflow-hidden",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":u("spotlight.title"),children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.jsx("input",{ref:_,type:"text",className:"flex-1 bg-transparent text-gray-900 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-500 outline-hidden",placeholder:u("spotlight.placeholder"),value:d,onChange:L=>f(L.target.value),onKeyDown:M,"aria-label":u("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":j[p]?"spotlight-item-"+p:void 0,autoComplete:"off",spellCheck:"false"}),i.jsx("kbd",{className:"hidden sm:inline-block px-1.5 py-0.5 text-xs font-mono text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"})]}),i.jsxs("div",{id:"spotlight-results",ref:S,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!N&&j.length>0&&i.jsx("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider",children:u("spotlight.recent_sessions")}),j.map((L,A)=>{var O;return L.isAction&&L.actionType==="new-chat"?i.jsxs("div",{id:"spotlight-item-"+A,role:"option","aria-selected":A===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-800 ${A===p?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>I(L),children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"text-sm font-medium truncate",children:L.title})})]},L.id):i.jsxs("div",{id:"spotlight-item-"+A,role:"option","aria-selected":A===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${A===p?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>I(L),children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"text-sm font-medium truncate",children:L.title||u("spotlight.untitled")})}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l[L.id]&&i.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse",role:"status",title:u("sidebar.session_processing"),"aria-label":u("sidebar.session_processing")}),L.id===a&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-400 font-medium",children:u("spotlight.current")}),i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:kK(L)}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:vK((O=L.time)==null?void 0:O.updated)})]})]},L.id)}),N&&j.length===0&&!v&&i.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&j.length===0&&i.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),i.jsxs("div",{className:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 flex items-center gap-4 text-xs text-gray-400 dark:text-gray-500",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↑"}),i.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↓"}),u("spotlight.navigate")]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↵"}),u("spotlight.select")]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"}),u("spotlight.close")]})]})]})}):null}function wK(e){return typeof e=="string"&&e?e:e&&typeof e=="object"&&e.providerID&&e.modelID?e.providerID+"/"+e.modelID:""}function SK(e){var{t}=rn(),n=e.session,r=e.directory,[a,o]=y.useState(""),[l,u]=y.useState(null);function d(v,k){try{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(k).then(function(){o(v)},function(){})}catch{}}function f(){if(!(!n||!n.soul)){if(l&&l.content!==void 0){u(null);return}u({loading:!0}),AM(n.id).then(function(v){v&&typeof v.content=="string"?u(v):u({error:t("chat.session_info_soul_error")})},function(v){u({error:v&&v.message||t("chat.session_info_soul_error")})})}}if(!n&&!r)return null;var p=n?wK(n.model):"",g=n?n.idleInjection:null,m=g&&g.enabled?g:null,x=n&&n.scheduledInjections?n.scheduledInjections.length:0;return i.jsxs("div",{className:"mt-4 pt-3 border-t border-gray-700",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-gray-400 mb-2",children:t("chat.session_info_title")}),n&&i.jsxs("div",{children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_soul")}),n.soul?i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("button",{type:"button",onClick:function(){d("soul",n.soul)},className:"flex-1 min-w-0 text-left text-sm text-gray-200 font-mono bg-gray-900 px-2 py-1 rounded truncate hover:bg-gray-700 transition-colors",title:a==="soul"?t("chat.session_info_copied"):n.soul,children:n.soul}),i.jsx("button",{type:"button",onClick:f,className:"shrink-0 text-xs text-gray-400 hover:text-gray-200 px-1",children:t("chat.session_info_view_soul")})]}):i.jsx("div",{className:"text-sm text-gray-500",children:t("chat.session_info_soul_default")}),l&&l.loading&&i.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t("chat.session_info_soul_loading")}),l&&l.error&&i.jsx("div",{className:"text-xs text-gray-500 mt-1 font-mono",children:t("chat.session_info_soul_error")+": "+l.error}),l&&l.content!==void 0&&i.jsxs("div",{className:"mt-1",children:[i.jsx("div",{className:"text-xs text-gray-500 font-mono mb-0.5 truncate",title:l.path,children:l.path+" · "+l.size+" B"}),i.jsx("pre",{className:"max-h-40 overflow-y-auto bg-gray-900 rounded p-2 font-mono text-xs text-gray-300 whitespace-pre-wrap break-words",children:l.content})]})]}),n&&p&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_model")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:p}),n.modelUrl&&i.jsx("div",{className:"text-xs text-gray-500 font-mono mt-0.5 truncate",title:n.modelUrl,children:n.modelUrl})]}),n&&n.reasoning_effort&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_reasoning")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:n.reasoning_effort})]}),m&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_idle_injection")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:t("chat.session_info_idle_on")+(m.intervalMs?" · "+t("chat.session_info_idle_every",{s:Math.round(m.intervalMs/1e3)}):"")})]}),x>0&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_scheduled")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:x})]}),r&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_directory")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono truncate",title:r,children:r})]})]})}const i1="pave_recent_directories",EK=10;function VT(e,t){if(!e)return"";const n=e.replace(/\\/g,"/"),r=t?t.replace(/\\/g,"/"):"";if(r&&n.startsWith(r))return"~"+n.slice(r.length);const a=n.split("/").filter(Boolean);return a.length>4?".../"+a.slice(-2).join("/"):n}function a1(){try{const e=localStorage.getItem(i1);return e?JSON.parse(e):[]}catch{return[]}}function NK(e){try{let t=a1();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,EK),localStorage.setItem(i1,JSON.stringify(t)),t}catch{return[e]}}function CK(e){try{let t=a1();return t=t.filter(n=>n!==e),localStorage.setItem(i1,JSON.stringify(t)),t}catch{return[]}}function uI({className:e}){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:i.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function jK({isOpen:e,onClose:t,sessionId:n,session:r,currentDirectory:a,homeDir:o,onDirectoryChange:l}){var{t:u}=rn(),d=y.useRef(null),f=y.useRef(null),[p,g]=y.useState(a||""),[m,x]=y.useState("idle"),[v,k]=y.useState(null),[_,S]=y.useState([]),[E,N]=y.useState(!1),[R,T]=y.useState(!1),[j,I]=y.useState(null),M=y.useRef(null),L=y.useRef(0);y.useEffect(function(){e&&(S(a1()),g(a||""),x("idle"),k(null),I(null))},[e,a]),y.useEffect(function(){e&&d.current&&setTimeout(function(){d.current.focus(),d.current.select()},50)},[e]);var A=y.useCallback(function(Y){if(!Y||Y.trim()===""){x("idle"),k(null);return}M.current&&clearTimeout(M.current),x("checking"),L.current+=1;var ce=L.current;M.current=setTimeout(async function(){try{const z=await X_(Y.trim());if(ce!==L.current)return;k(z),z.exists&&z.isDirectory?x("valid"):z.exists?(x("error"),k({...z,error:u("chat.working_directory_invalid")})):x("not_found")}catch(z){if(ce!==L.current)return;x("error"),k({error:z.message})}},300)},[u]),O=y.useCallback(function(Y){var ce=Y.target.value;g(ce),I(null),A(ce)},[A]),F=y.useCallback(function(Y){g(Y),I(null),A(Y)},[A]),Q=y.useCallback(function(Y,ce){Y.stopPropagation(),S(CK(ce))},[]),H=y.useCallback(async function(){if(p.trim()){N(!0),I(null);try{const Y=await OL(p.trim());if(Y.success)try{const ce=await X_(Y.path);x("valid"),k(ce)}catch{x("valid"),k({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:Y.path})}}catch(Y){I(u("chat.working_directory_create_failed",{error:Y.message}))}finally{N(!1)}}},[p,u]),P=y.useCallback(async function(){if(!(!p.trim()||m!=="valid")){T(!0),I(null);try{const Y=(v==null?void 0:v.path)||p.trim();await Ki(n,{directory:Y}),S(NK(Y)),l&&l(Y),t()}catch(Y){I(Y.message)}finally{T(!1)}}},[p,m,v,n,l,t]);y.useEffect(function(){if(!e)return;function Y(ce){ce.key==="Escape"&&(ce.preventDefault(),ce.stopPropagation(),t())}return document.addEventListener("keydown",Y,!0),function(){document.removeEventListener("keydown",Y,!0)}},[e,t]),y.useEffect(function(){if(!e)return;function Y(ce){ce.key==="Enter"&&m==="valid"&&!R&&(ce.preventDefault(),P())}return document.addEventListener("keydown",Y),function(){document.removeEventListener("keydown",Y)}},[e,m,R,P]),y.useEffect(function(){return function(){M.current&&clearTimeout(M.current)}},[]);var K=y.useMemo(function(){return VT(a,o)},[a,o]);if(!e)return null;var W=null;return m==="checking"?W=i.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[i.jsx("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin mr-2"}),u("chat.working_directory_checking")]}):m==="valid"&&v?W=i.jsx("p",{className:"text-xs text-green-500 mt-1",children:v.hasAgentsMd?"✓ "+u("chat.working_directory_has_agents_md"):"✓ "+u("chat.working_directory_no_agents_md")}):m==="not_found"?W=i.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",u("chat.working_directory_not_found")]}):m==="error"&&(v!=null&&v.error)&&(W=i.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",v.error]})),i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(Y){Y.target===Y.currentTarget&&t()},children:i.jsxs("div",{ref:f,className:"bg-gray-800 rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"directory-modal-title",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(uI,{className:"w-5 h-5 text-gray-400"}),i.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:u("chat.working_directory")})]}),i.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":u("common.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_current")}),i.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:a,children:K||a||u("chat.working_directory_not_set")})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_new_path")}),i.jsx("input",{ref:d,id:"directory-input",type:"text",value:p,onChange:O,className:"w-full px-3 py-2 bg-gray-900 border border-gray-600 rounded text-gray-100 font-mono text-sm placeholder-gray-500 focus:outline-hidden focus:border-blue-500",placeholder:u("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"}),W]}),j&&i.jsx("p",{className:"text-sm text-red-500",children:j}),_.length>0&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:u("chat.working_directory_recent")}),i.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:_.map(function(Y){return i.jsxs("div",{onClick:function(){F(Y)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[i.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:Y,children:VT(Y,o)}),i.jsx("button",{onClick:function(ce){Q(ce,Y)},className:"text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity ml-2",title:u("chat.working_directory_remove_recent"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},Y)})})]}),i.jsx(SK,{session:r,directory:K||a||""})]}),i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[i.jsx("div",{children:m==="not_found"&&i.jsx("button",{onClick:H,disabled:E,className:"px-3 py-1.5 text-sm font-medium text-yellow-400 border border-yellow-500/50 rounded hover:bg-yellow-500/10 transition-colors disabled:opacity-50",children:E?"...":u("chat.working_directory_create")})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-300 hover:text-gray-100 transition-colors",children:u("chat.working_directory_cancel")}),i.jsx("button",{onClick:P,disabled:m!=="valid"||R,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:R?"...":u("chat.working_directory_change")})]})]})]})})}var gr={enabled:!1,message:"Continue working on your current task.",intervalMs:15e3,maxInjections:0,mode:"normal",waitMs:0,timeout:{enabled:!0,thresholdMs:3e4,cooldownMs:5e3}};function TK(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function xf(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function yf(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function Rl(e){var t=e.children;return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function RK(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,a=rn().t,o=y.useRef(null),l=y.useState(null);l[0];var u=l[1],d=y.useState(!0),f=d[0],p=d[1],g=y.useState(!1),m=g[0],x=g[1],v=y.useState(null),k=v[0],_=v[1],S=y.useState(null),E=S[0],N=S[1],R=y.useState(gr.enabled),T=R[0],j=R[1],I=y.useState(gr.message),M=I[0],L=I[1],A=y.useState(String(gr.intervalMs)),O=A[0],F=A[1],Q=y.useState(String(gr.maxInjections)),H=Q[0],P=Q[1],K=y.useState(gr.timeout.enabled),W=K[0],Y=K[1],ce=y.useState(String(gr.timeout.thresholdMs)),z=ce[0],G=ce[1],X=y.useState(String(gr.timeout.cooldownMs)),B=X[0],te=X[1],V=y.useState(gr.mode),U=V[0],oe=V[1],ae=y.useState(String(gr.waitMs)),xe=ae[0],Se=ae[1],Xe=y.useRef(null),bt=y.useState([]),at=bt[0],yt=bt[1],et=y.useState(!1),Ie=et[0],Ge=et[1],tt=y.useState(!1),kt=tt[0],Kt=tt[1],an=y.useState("9"),Vt=an[0],ze=an[1],De=y.useState("0"),nt=De[0],ft=De[1],ue=y.useState("AM"),be=ue[0],qe=ue[1],me=y.useState("weekdays"),pt=me[0],gt=me[1],wt=y.useState([1,2,3,4,5]),ht=wt[0],$t=wt[1],Wt=y.useState(""),Je=Wt[0],zt=Wt[1],St="";try{St=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}y.useEffect(function(){return function(){Xe.current&&clearTimeout(Xe.current)}},[]);var Yt=y.useCallback(function(){r&&(p(!0),_(null),_4(r).then(function(Ne){var We=Ne&&Ne.config?Ne.config:gr;u(We),j(We.enabled||!1),L(We.message||gr.message),F(xf(We.intervalMs!=null?We.intervalMs:gr.intervalMs)),P(TK(We.maxInjections!=null?We.maxInjections:gr.maxInjections)),Y(We.timeout?We.timeout.enabled:gr.timeout.enabled),G(xf(We.timeout&&We.timeout.thresholdMs!=null?We.timeout.thresholdMs:gr.timeout.thresholdMs)),te(xf(We.timeout&&We.timeout.cooldownMs!=null?We.timeout.cooldownMs:gr.timeout.cooldownMs)),oe(We.mode||gr.mode),Se(xf(We.waitMs!=null?We.waitMs:gr.waitMs))}).catch(function(Ne){_(Ne.message||"Failed to load config")}).finally(function(){p(!1)}))},[r]);y.useEffect(function(){t&&Yt()},[t,Yt]);var cn=y.useCallback(function(){r&&$M(r).then(function(Ne){yt(Ne&&Ne.schedules?Ne.schedules:[])}).catch(function(){yt([])})},[r]);y.useEffect(function(){t&&cn()},[t,cn]),y.useEffect(function(){if(!t)return;function Ne(We){We.key==="Escape"&&n()}return document.addEventListener("keydown",Ne),function(){document.removeEventListener("keydown",Ne)}},[t,n]);function xn(){if(r){x(!0),_(null),N(null);var Ne={enabled:T,message:M.trim()||gr.message,intervalMs:yf(O)||gr.intervalMs,maxInjections:parseInt(H,10)||0,mode:U||gr.mode,waitMs:yf(xe),timeout:{enabled:W,thresholdMs:yf(z)||gr.timeout.thresholdMs,cooldownMs:yf(B)||gr.timeout.cooldownMs}};UM(r,Ne).then(function(){u(Ne),N(a("chat.idle_injection_saved")),Xe.current&&clearTimeout(Xe.current),Xe.current=setTimeout(function(){N(null)},3e3)}).catch(function(We){_(We.message||"Failed to save")}).finally(function(){x(!1)})}}function Rn(){r&&(x(!0),_(null),N(null),HM(r).then(function(){j(!1),u(null)}).catch(function(Ne){_(Ne.message||"Failed to disable")}).finally(function(){x(!1)}))}function re(Ne,We){var Et=parseInt(Ne,10);return We==="PM"&&Et!==12&&(Et+=12),We==="AM"&&Et===12&&(Et=0),Et}function Te(Ne){return Ne===0?{h:12,ap:"AM"}:Ne<12?{h:Ne,ap:"AM"}:Ne===12?{h:12,ap:"PM"}:{h:Ne-12,ap:"PM"}}function rt(Ne,We){return Ne==="every_day"?[0,1,2,3,4,5,6]:Ne==="weekdays"?[1,2,3,4,5]:Ne==="weekends"?[0,6]:We.slice().sort()}function Pt(Ne){var We=Te(Ne.hour),Et=String(Ne.minute).padStart(2,"0");return We.h+":"+Et+" "+We.ap}function Be(Ne){var We=Ne.daysOfWeek||[],Et="";if(We.length===7)Et=a("scheduled_injection.repeat_every_day");else if(We.length===5&&We.indexOf(1)!==-1&&We.indexOf(5)!==-1)Et=a("scheduled_injection.repeat_weekdays");else if(We.length===2&&We.indexOf(0)!==-1&&We.indexOf(6)!==-1)Et=a("scheduled_injection.repeat_weekends");else{for(var vn=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],vr=[],pn=0;pn<7;pn++)We.indexOf(pn)!==-1&&vr.push(a("scheduled_injection."+vn[pn]));Et=vr.join(", ")}return Ne.timezone&&(Et+=" ("+Ne.timezone+")"),Et}function lt(){if(r){Kt(!0),_(null);var Ne={hour:re(Vt,be),minute:parseInt(nt,10),daysOfWeek:rt(pt,ht),timezone:St||null,message:Je.trim(),enabled:!0};WM(r,Ne).then(function(){Ge(!1),zt(""),cn()}).catch(function(We){_(We.message||a("scheduled_injection.error_generic"))}).finally(function(){Kt(!1)})}}function ke(Ne,We){r&&VM(r,Ne,{enabled:!We}).then(function(){cn()}).catch(function(Et){_(Et.message||"Failed to toggle schedule")})}function Ce(Ne){r&&GM(r,Ne).then(function(){cn()}).catch(function(We){_(We.message||"Failed to delete schedule")})}function Ye(Ne){var We=ht.indexOf(Ne);$t(We===-1?ht.concat([Ne]):ht.filter(function(Et){return Et!==Ne}))}if(!t)return null;var xt="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",ie="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 text-sm focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent",Pe="space-y-3",$e=function(Ne){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(Ne?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},Tt=function(Ne){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Ne?"translate-x-6":"translate-x-1")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),i.jsxs("aside",{ref:o,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":a("chat.idle_injection_title"),children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("chat.idle_injection_title")}),i.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":a("common.close"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):i.jsxs(i.Fragment,{children:[k&&i.jsx("div",{className:"px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm",children:k}),E&&i.jsx("div",{className:"px-3 py-2 rounded-lg bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 text-sm",children:E}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_toggle")}),i.jsx("button",{type:"button",onClick:function(){j(!T)},className:$e(T),"aria-pressed":T,"aria-label":a("chat.idle_injection_toggle"),children:i.jsx("span",{className:Tt(T)})})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-message",children:a("chat.idle_injection_message")}),i.jsx("textarea",{id:"ii-message",value:M,onChange:function(Ne){L(Ne.target.value)},className:ie+" resize-none",rows:3,placeholder:a("chat.idle_injection_message_placeholder"),disabled:!T})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-interval",children:a("chat.idle_injection_interval")}),i.jsx("input",{id:"ii-interval",type:"number",value:O,onChange:function(Ne){F(Ne.target.value)},className:ie,min:.5,step:.5,disabled:!T}),i.jsx(Rl,{children:a("chat.idle_injection_interval_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-max",children:a("chat.idle_injection_max")}),i.jsx("input",{id:"ii-max",type:"number",value:H,onChange:function(Ne){P(Ne.target.value)},className:ie,min:0,disabled:!T}),i.jsx(Rl,{children:a("chat.idle_injection_max_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-mode",children:a("chat.idle_injection_mode")}),i.jsxs("select",{id:"ii-mode",value:U,onChange:function(Ne){oe(Ne.target.value)},className:ie,disabled:!T,children:[i.jsx("option",{value:"urgent",children:a("chat.idle_injection_mode_urgent")}),i.jsx("option",{value:"normal",children:a("chat.idle_injection_mode_normal")}),i.jsx("option",{value:"idle",children:a("chat.idle_injection_mode_idle")})]}),i.jsx(Rl,{children:a("chat.idle_injection_mode_desc")})]}),U==="idle"&&i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-wait",children:a("chat.idle_injection_wait_ms")}),i.jsx("input",{id:"ii-wait",type:"number",value:xe,onChange:function(Ne){Se(Ne.target.value)},className:ie,min:0,step:.5,disabled:!T}),i.jsx(Rl,{children:a("chat.idle_injection_wait_ms_desc")})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_timeout_toggle")}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("chat.idle_injection_timeout_toggle_desc")})]}),i.jsx("button",{type:"button",onClick:function(){Y(!W)},className:$e(W),"aria-pressed":W,"aria-label":a("chat.idle_injection_timeout_toggle"),disabled:!T,children:i.jsx("span",{className:Tt(W)})})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-threshold",children:a("chat.idle_injection_timeout_threshold")}),i.jsx("input",{id:"ii-threshold",type:"number",value:z,onChange:function(Ne){G(Ne.target.value)},className:ie,min:1,step:.5,disabled:!T||!W}),i.jsx(Rl,{children:a("chat.idle_injection_timeout_threshold_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:xt,htmlFor:"ii-cooldown",children:a("chat.idle_injection_timeout_cooldown")}),i.jsx("input",{id:"ii-cooldown",type:"number",value:B,onChange:function(Ne){te(Ne.target.value)},className:ie,min:.5,step:.5,disabled:!T||!W}),i.jsx(Rl,{children:a("chat.idle_injection_timeout_cooldown_desc")})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),i.jsxs("div",{className:Pe,children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("scheduled_injection.title")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("scheduled_injection.subtitle")})]}),at.length===0&&!Ie&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("scheduled_injection.empty")}),at.map(function(Ne){return i.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(Ne.enabled?"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 opacity-60"),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:Pt(Ne)}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Be(Ne)})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:function(){ke(Ne.id,Ne.enabled)},className:$e(Ne.enabled),"aria-pressed":Ne.enabled,"aria-label":a("scheduled_injection.enabled"),children:i.jsx("span",{className:Tt(Ne.enabled)})}),i.jsx("button",{type:"button",onClick:function(){Ce(Ne.id)},className:"p-1 rounded text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors","aria-label":a("scheduled_injection.delete"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),Ne.message&&i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Ne.message,'"']})]},Ne.id)}),Ie?i.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-700 p-3 space-y-3 bg-gray-50 dark:bg-gray-900/50",children:[i.jsxs("div",{children:[i.jsx("label",{className:xt,children:a("scheduled_injection.time")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:Vt,onChange:function(Ne){ze(Ne.target.value)},className:ie+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Ne){return i.jsx("option",{value:String(Ne),children:Ne},Ne)})}),i.jsx("span",{className:"text-gray-500",children:":"}),i.jsxs("select",{value:nt,onChange:function(Ne){ft(Ne.target.value)},className:ie+" w-20",children:[i.jsx("option",{value:"0",children:"00"}),i.jsx("option",{value:"15",children:"15"}),i.jsx("option",{value:"30",children:"30"}),i.jsx("option",{value:"45",children:"45"})]}),i.jsxs("select",{value:be,onChange:function(Ne){qe(Ne.target.value)},className:ie+" w-20",children:[i.jsx("option",{value:"AM",children:"AM"}),i.jsx("option",{value:"PM",children:"PM"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:xt,children:a("scheduled_injection.repeat")}),i.jsxs("select",{value:pt,onChange:function(Ne){gt(Ne.target.value)},className:ie,children:[i.jsx("option",{value:"every_day",children:a("scheduled_injection.repeat_every_day")}),i.jsx("option",{value:"weekdays",children:a("scheduled_injection.repeat_weekdays")}),i.jsx("option",{value:"weekends",children:a("scheduled_injection.repeat_weekends")}),i.jsx("option",{value:"custom",children:a("scheduled_injection.repeat_custom")})]})]}),pt==="custom"&&i.jsx("div",{children:i.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{d:0,k:"day_sun"},{d:1,k:"day_mon"},{d:2,k:"day_tue"},{d:3,k:"day_wed"},{d:4,k:"day_thu"},{d:5,k:"day_fri"},{d:6,k:"day_sat"}].map(function(Ne){var We=ht.indexOf(Ne.d)!==-1;return i.jsx("button",{type:"button",onClick:function(){Ye(Ne.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(We?"bg-primary-600 text-white":"bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-300 dark:hover:bg-gray-700"),children:a("scheduled_injection."+Ne.k)},Ne.d)})})}),St&&i.jsxs("div",{children:[i.jsx("label",{className:xt,children:a("scheduled_injection.timezone")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:St})]}),i.jsxs("div",{children:[i.jsx("label",{className:xt,children:a("scheduled_injection.message")}),i.jsx("textarea",{value:Je,onChange:function(Ne){zt(Ne.target.value)},className:ie+" resize-none",rows:2,placeholder:a("scheduled_injection.message_placeholder")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:lt,disabled:kt||pt==="custom"&&ht.length===0,className:"flex-1 px-3 py-1.5 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(kt?"scheduled_injection.saving":"scheduled_injection.save")}),i.jsx("button",{type:"button",onClick:function(){Ge(!1)},disabled:kt,className:"px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:a("common.close")})]})]}):i.jsxs("button",{type:"button",onClick:function(){Ge(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",a("scheduled_injection.add")]})]})]})}),!f&&i.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("button",{onClick:xn,disabled:m,className:"flex-1 px-4 py-2 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),i.jsx("button",{onClick:Rn,disabled:m||!T,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(m?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function AK({items:e,sessionId:t,isReadOnly:n,onReorder:r,onCancelItem:a,onEditItem:o,t:l}){var[u,d]=y.useState(null),[f,p]=y.useState(null),g=y.useRef(0),m=y.useCallback(function(E,N){if(e[N]&&e[N].status==="dispatching"){E.preventDefault();return}d(N),E.dataTransfer.effectAllowed="move";try{E.dataTransfer.setData("text/plain",String(N))}catch{}},[e]),x=y.useCallback(function(E,N){E.preventDefault(),g.current++,e[N]&&e[N].status!=="dispatching"&&p(N)},[e]),v=y.useCallback(function(E,N){E.preventDefault(),E.dataTransfer.dropEffect="move"},[]),k=y.useCallback(function(){g.current--,g.current<=0&&(g.current=0,p(null))},[]),_=y.useCallback(function(E,N){if(E.preventDefault(),g.current=0,p(null),u===null||u===N){d(null);return}var R=e.slice(),T=R.splice(u,1)[0];R.splice(N,0,T),d(null);var j=R.filter(function(I){return I.status!=="dispatching"}).map(function(I){return I.id});r(j)},[u,e,r]),S=y.useCallback(function(){d(null),p(null),g.current=0},[]);return!e||e.length===0?null:i.jsxs("div",{className:"px-4 pt-2 pb-1 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex flex-col gap-1",children:[i.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[l("chat.queued")," (",e.length,")"]}),e.map(function(E,N){var R=E.status==="dispatching",T=u===N,j=f===N&&u!==N,I=!R&&!n;return i.jsxs("div",{draggable:I,onDragStart:I?function(M){m(M,N)}:void 0,onDragEnter:I?function(M){x(M,N)}:void 0,onDragOver:I?function(M){v(M,N)}:void 0,onDragLeave:I?k:void 0,onDrop:I?function(M){_(M,N)}:void 0,onDragEnd:I?S:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(R?"border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 opacity-50 ":"border-dashed border-gray-300 dark:border-gray-700 ")+(T?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(j?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(I?"cursor-grab active:cursor-grabbing ":""),children:[I&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-gray-400 dark:text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){o(E)},onKeyDown:function(M){(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),o(E))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[i.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:E.source||"queued"}),E.priority==="urgent"&&i.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-200",children:"urgent"}),i.jsx("span",{className:"truncate text-gray-700 dark:text-gray-300 group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:E.displayContent||E.text||""}),!R&&!n&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-gray-400 group-hover:text-accent-500 dark:text-gray-500 dark:group-hover:text-accent-400 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})]}),!R&&!n&&i.jsx("button",{type:"button",onClick:function(M){M.stopPropagation(),a(E.id)},className:"text-xs text-gray-500 hover:text-red-600 dark:hover:text-red-400 px-1",title:l("chat.cancel_queued"),"aria-label":l("chat.cancel_queued"),children:"×"})]},E.id)})]})}const GT="flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded-lg bg-gray-900 text-white shadow-lg hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-primary-500";function IK({rect:e,onQuote:t,onCopy:n,onDismiss:r,label:a,copyLabel:o}){if(y.useEffect(function(){if(!(!e||!r)){var f=function(p){p.key==="Escape"&&r()};return document.addEventListener("keydown",f),function(){document.removeEventListener("keydown",f)}}},[e,r]),!e)return null;var l=Math.max((e.top||0)-40,4),u=typeof window<"u"&&window.innerWidth<420,d=u?{position:"fixed",top:l,left:8,right:8,zIndex:60}:{position:"fixed",top:l,left:Math.max(e.left||0,8),zIndex:60};return Qv.createPortal(i.jsxs("div",{style:d,className:"flex items-center gap-1",children:[i.jsxs("button",{type:"button","data-testid":"quote-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:t,"aria-label":a,title:a,className:GT,children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})}),a]}),i.jsxs("button",{type:"button","data-testid":"copy-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:n,"aria-label":o,title:o,className:GT,children:[i.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),o]})]}),document.body)}function MK(e){if(!e||typeof e!="string")return[];const t=[],n=e.split(`
|
|
120
|
-
`);for(let r=0;r<n.length;r++){const a=n[r].trim();if(a)try{t.push(JSON.parse(a))}catch{}}return t.sort((r,a)=>(r.seq||0)-(a.seq||0)),t}function Au(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function Ul(e){if(!Au(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function LK(e){const t=[],n=new Map;let r=null,a=null;for(const u of e)switch(u.type){case"context":r=u;break;case"store_snapshot":a=u;break;case"request":{const d={seq:u.seq,ts:u.ts,provider:u.provider,model:u.model,url:u.url,headers:u.headers||{},body:u.body,params:u.params||{},sentEstTokens:u.estWireTokens,bodyBytes:u.bodyBytes,shrink:u.shrink||null,fingerprint:u.fingerprint||u.cache&&u.cache.fingerprint||null,cache:u.cache||null,chunks:[],response:null,context:null,store:null,bubbleMessageID:null,compaction:null,messageDrop:null};r&&(r.reqSeq==null||r.reqSeq===u.seq)&&(d.context=r,r=null),a&&(a.reqSeq==null||a.reqSeq===u.seq)&&(d.store=a,a=null),t.push(d),n.set(u.seq,d);break}case"chunk":{const d=n.get(u.reqSeq);d&&d.chunks.push(u);break}case"response_end":{const d=n.get(u.reqSeq);d&&(d.response=u);break}case"bubble_map":{const d=n.get(u.reqSeq);d&&(d.bubbleMessageID=u.messageID);break}case"compaction":{let d=null;for(const f of t)if(f.seq<=u.seq)d=f;else break;d&&(d.compaction=u);break}case"message_drop":{const d=n.get(u.reqSeq);d&&(d.messageDrop=u);break}}let o=null,l=null;for(const u of t){u.context?l=u.seq:u.contextFrom=l,u.chunks.sort((d,f)=>(d.seq||0)-(f.seq||0)),u.chunkCount=u.chunks.length,u.interArrivalGaps=[];for(let d=1;d<u.chunks.length;d++)u.interArrivalGaps.push((u.chunks[d].ts||0)-(u.chunks[d-1].ts||0));u.sentActualTokens=u.response&&u.response.usage?u.response.usage.prompt_tokens:null,u.storeTokens=u.store?u.store.storeTokens:null,u.storeMessages=u.store?u.store.storeMessages:null,u.trimmed=u.storeTokens!=null&&u.sentActualTokens!=null?Math.max(0,u.storeTokens-u.sentActualTokens):null,u.chunks.length>0&&u.ts!=null?u.ttftMs=(u.chunks[0].ts||0)-u.ts:u.response&&u.response.ttftMs!=null?u.ttftMs=u.response.ttftMs:u.ttftMs=null,u.totalMs=u.response?u.response.totalMs:null,u.status=u.response?u.response.status:null,u.finishReason=u.response?u.response.finishReason:null,u.paveContext=u.response&&u.response.paveContext||null,u.sentActualDelta=o!=null&&u.sentActualTokens!=null?u.sentActualTokens-o:null,u.sentActualTokens!=null&&(o=u.sentActualTokens),u.purpose=OK(u)}return t}function OK(e){if(e.status!=null&&e.status>=400)return"retry";const t=e.finishReason;return t==="tool_calls"?"tool-iteration":t==="length"?"length":"assistant"}function DK(e){const t=[];let n=null,r=null;for(const a of e)(n===null||r==="stop"||r==="error")&&(n={index:t.length,requests:[]},t.push(n)),n.requests.push(a),r=a.finishReason;return t}function PK(e){return e.map(t=>({seq:t.seq,ts:t.ts,storeTokens:t.storeTokens,sentEst:t.sentEstTokens,sentActual:t.sentActualTokens,trimmed:t.trimmed,tokReal:t.context?t.context.tokReal:null,threshold:t.context?t.context.threshold:null,usable:t.context?t.context.usable:null,limit:t.context?t.context.limit:null,needsCompaction:t.context?!!t.context.needsCompaction:!1,compactionMarker:!!t.compaction,dropMarker:!!t.messageDrop}))}function FK(e){return e.filter(t=>t.type==="compaction")}function BK(e){return e.filter(t=>t.type==="message_drop")}function zK(e,t){const n=f=>{const p=Array.isArray(f)?f.slice():[];return p.length&&p[0]&&p[0].role==="system"?p.slice(1):p},r=n(e),a=n(t),o=f=>{const p={};for(const g of f){const m=g&&g.role||"?";p[m]=(p[m]||0)+1}return p},l=o(r),u=o(a),d=[];for(const f of new Set([...Object.keys(l),...Object.keys(u)])){const p=l[f]||0,g=u[f]||0;p!==g&&d.push({role:f,before:p,after:g,delta:p-g})}return d.sort((f,p)=>p.delta-f.delta),{prevLen:r.length,currLen:a.length,roles:d}}function qK(e){const t=e&&e.raw;if(t==="[DONE]")return{parts:[{type:"done",piece:""}]};let n;try{n=JSON.parse(t)}catch{return{parts:[{type:"other",piece:""}]}}const r=[],a=n&&n.choices&&n.choices[0]&&n.choices[0].delta;if(a){const o=a.reasoning_content??a.reasoning??a.thinking;if(o!=null&&o!==""&&r.push({type:"reasoning",piece:o}),a.content!=null&&a.content!==""&&r.push({type:"text",piece:a.content}),a.tool_calls&&a.tool_calls.length){const u=(a.tool_calls[0]||{}).function||{};r.push({type:"tool",piece:(u.name?u.name+" ":"")+(u.arguments!=null?u.arguments:"")})}}return n&&n.usage&&r.push({type:"usage",piece:JSON.stringify(n.usage)}),r.length===0&&r.push({type:"other",piece:""}),{parts:r}}function KT(e){try{return JSON.stringify(e)}catch{return String(e)}}function YT(e){return e?e.reasoning_content!=null&&e.reasoning_content!==""?!0:Array.isArray(e.content)?e.content.some(t=>t&&t.type==="reasoning"&&t.text):!1:!1}function UK(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[],a=r.length&&r[0]&&r[0].role==="system"?r.slice(1):r.slice(),o=Math.max(n.length,a.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const p=f<n.length?n[f]:void 0,g=f<a.length?a[f]:void 0,m=p===void 0?void 0:KT(p),x=g===void 0?void 0:KT(g),v=m===void 0?null:m.length,k=x===void 0?null:x.length;v!=null&&(d=Math.max(d,v)),k!=null&&(d=Math.max(d,k));const _=m!==x;let S="unchanged";if(p===void 0)S="added";else if(g===void 0)S="dropped";else if(_){const E=p.role||g.role;k<v?E==="tool"?S="tool output stubbed":YT(p)&&!YT(g)?S="reasoning stripped":S="text capped":S="changed"}_&&u<0&&(u=f),l.push({i:f,role:(p||g||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:S})}return{rows:l,firstChanged:u,maxBytes:d}}function HK(e){const t=typeof e=="string"?MK(e):Array.isArray(e)?e:[],n=LK(t),r=DK(n),a=PK(n),o=FK(t),l=BK(t);return{events:t,requests:n,turns:r,timeline:a,compactions:o,messageDrops:l}}function jf(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const n=Ul(e);if(t&&n!=null&&t.has(n)){const r=t.get(n);try{return typeof r=="string"?r:JSON.stringify(r,null,2)}catch{return String(r)}}return`(large — spilled to ${e.$ref}, not fetched)`}try{return typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function $K(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function dI(e,t){const n=[];n.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&n.push(`url: ${e.url}`);const r=$K(e.params);if(r&&n.push(`params: ${r}`),n.push(`sent est: ${e.sentEstTokens??"?"} sent actual (prompt_tokens): ${e.sentActualTokens??"?"} store: ${e.storeTokens??"?"}`),n.push(`status: ${e.status??"?"} finishReason: ${e.finishReason??"?"} ttft: ${e.ttftMs??"?"}ms total: ${e.totalMs??"?"}ms`),e.paveContext&&n.push(`resolvedModel: ${e.paveContext.resolvedModel??"?"} contextFloor: ${e.paveContext.contextFloor??"?"}`),e.bubbleMessageID&&n.push(`bubble messageID: ${e.bubbleMessageID}`),n.push("REQUEST HEADERS (redacted):"),n.push(jf(e.headers,t)),n.push("REQUEST BODY (exact bytes sent):"),n.push(jf(e.body,t)),e.response){const a=e.response.assembled;n.push("RESPONSE (assembled):"),a&&typeof a=="object"&&a.$ref?n.push(jf(a,t)):a&&(a.reasoning&&n.push(`reasoning: ${a.reasoning}`),n.push(`text: ${a.text||""}`),a.tool_calls&&a.tool_calls.length&&n.push(`tool_calls: ${JSON.stringify(a.tool_calls)}`))}if(e.context){const a=e.context;n.push(`CONTEXT: limit=${a.limit} usable=${a.usable} margin=${a.margin} threshold=${a.threshold} tokReal=${a.tokReal} needsCompaction=${a.needsCompaction} source=${a.source??""} windowSource=${a.windowSource??a.epmWindowSignal??""}`)}if(e.compaction){const a=e.compaction,o=[`COMPACTION [${a.trigger}]`];a.deletedMessages!=null&&o.push(`deleted=${a.deletedMessages}`),a.summaryTokens!=null&&o.push(`summaryTok=${a.summaryTokens}`),a.before!=null&&o.push(`before=${a.before}`),a.after!=null&&o.push(`after=${a.after}`),typeof a.handoffFresh=="boolean"&&o.push(`handoffFresh=${a.handoffFresh}`),n.push(o.join(" "))}if(e.messageDrop){const a=e.messageDrop;n.push(`⚠ MESSAGE DROP wire ${a.wireBefore}→${a.wireAfter} (vs req #${a.prevSeq}, no compaction`+(a.storeMessages!=null?`, store intact=${a.storeMessages}`:"")+")")}return n.join(`
|
|
121
|
-
`)}function fI(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],n=e.ts;for(let r=0;r<e.chunks.length;r++){const a=e.chunks[r],o=r===0?n!=null?a.ts-n:0:a.ts-e.chunks[r-1].ts;t.push(`[+${o}ms]${a.kind?" ("+a.kind+")":""} ${a.raw}`)}return t.join(`
|
|
122
|
-
`)}function WK(e,t){if(!e.response)return`(no response captured for request #${e.seq})`;const n=e.response.assembled,r=[`--- Response for request #${e.seq} (status ${e.status}, ${e.finishReason}) ---`];return n&&typeof n=="object"&&n.$ref?r.push(jf(n,t)):n&&(n.reasoning&&r.push(`reasoning:
|
|
123
|
-
${n.reasoning}`),r.push(`text:
|
|
124
|
-
${n.text||""}`),n.tool_calls&&n.tool_calls.length&&r.push(`tool_calls:
|
|
125
|
-
${JSON.stringify(n.tool_calls,null,2)}`)),e.response.usage&&r.push(`usage: ${JSON.stringify(e.response.usage)}`),r.join(`
|
|
126
|
-
`)}function QT(e,t,n){const{requests:r,timeline:a,compactions:o,messageDrops:l}=e,u=[];u.push(`=== PAVE Inspector session ${t||""} ===`);const d=(l||[]).length;u.push(`requests: ${r.length} compactions: ${o.length}`+(d?` ⚠ message-drops: ${d}`:""));const f=r.find(p=>p.context);f&&f.context&&u.push(`context window: limit ${f.context.limit} / usable ${f.context.usable} / threshold ${f.context.threshold}`),u.push("");for(const p of r)u.push(dI(p,n)),p.chunkCount&&(u.push(`CHUNKS (${p.chunkCount}):`),u.push(fI(p))),u.push("");u.push("TIMELINE:"),u.push("seq store sent_est sent_actual threshold compaction");for(const p of a)u.push(`${p.seq} ${p.storeTokens??""} ${p.sentEst??""} ${p.sentActual??""} ${p.threshold??""} ${p.compactionMarker?"YES":""}`);return u.join(`
|
|
127
|
-
`)}function VK(e){const t=new Set;for(const n of e.requests||[])for(const r of[n.body,n.response&&n.response.assembled])if(r&&typeof r=="object"&&typeof r.$ref=="string"){const a=Ul(r);a!=null&&t.add(a)}return Array.from(t)}function Qs(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const bf=[{key:"storeTokens",label:"store (growing)",stroke:"#10b981",dash:null,desc:"Full persisted history — grows every response, drops at compaction."},{key:"sentEst",label:"sent (est)",stroke:"#f59e0b",dash:"4 3",desc:"Our estimateWireTokens of what is sent this request."},{key:"sentActual",label:"sent (actual)",stroke:"#0ea5e9",dash:null,desc:"Provider's actual prompt_tokens — what was really sent."},{key:"tokReal",label:"tokReal (decision)",stroke:"#f43f5e",dash:"5 2",desc:"The context-token count the compaction check compares against threshold."}],XT=[{key:"threshold",label:"threshold",stroke:"#eab308",desc:"Compact when tokReal exceeds this (= ⌊usable × margin⌋)."},{key:"usable",label:"usable",stroke:"#8b5cf6",desc:"Context window minus the output reserve."},{key:"limit",label:"limit",stroke:"#ef4444",desc:"Full context window (EPM floor or model default)."}];function GK({timeline:e,selectedSeq:t,onSelectSeq:n,height:r=240}){const[a,o]=y.useState(null),[l,u]=y.useState("data"),[d,f]=y.useState(!1),p=y.useRef(null),[g,m]=y.useState(720);y.useEffect(()=>{const I=p.current;if(!I||typeof ResizeObserver>"u")return;const M=new ResizeObserver(L=>{const A=L[0]&&L[0].contentRect&&L[0].contentRect.width;A&&A>0&&m(Math.round(A))});return M.observe(I),()=>M.disconnect()},[]);const x={top:16,right:116,bottom:34,left:56},v=Math.max(1,g-x.left-x.right),k=Math.max(1,r-x.top-x.bottom),_=Array.isArray(e)?e:[],S=y.useMemo(()=>{if(_.length===0)return 1;let I=0;for(const M of _){for(const L of bf)M[L.key]!=null&&(I=Math.max(I,M[L.key]));M.threshold!=null&&(I=Math.max(I,M.threshold)),l==="window"&&(M.usable!=null&&(I=Math.max(I,M.usable)),M.limit!=null&&(I=Math.max(I,M.limit)))}return Math.max(1,Math.ceil(I*1.12))},[_,l]);if(_.length===0)return i.jsx("div",{className:"h-40 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No requests captured for this session yet."});const E=I=>x.left+(_.length===1?v/2:I/(_.length-1)*v),N=I=>x.top+k-Math.min(I,S)/S*k,R=I=>{const M=[];let L=!1;return _.forEach((A,O)=>{if(A[I]==null){L=!1;return}M.push(`${L?"L":"M"} ${E(O).toFixed(1)} ${N(A[I]).toFixed(1)}`),L=!0}),M.join(" ")},T=()=>{const I=[];let M=[];const L=()=>{if(M.length){const A=M.map(F=>`${E(F).toFixed(1)} ${N(_[F].storeTokens).toFixed(1)}`),O=M.slice().reverse().map(F=>`${E(F).toFixed(1)} ${N(_[F].sentActual).toFixed(1)}`);I.push("M "+A.join(" L ")+" L "+O.join(" L ")+" Z")}M=[]};return _.forEach((A,O)=>{A.storeTokens!=null&&A.sentActual!=null&&A.storeTokens>A.sentActual?M.push(O):L()}),L(),I.join(" ")},j=[0,.25,.5,.75,1].map(I=>Math.round(S*I));return i.jsxs("div",{ref:p,className:"relative",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>f(I=>!I),className:"text-[11px] px-2 py-0.5 rounded transition-colors "+(d?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Show/hide the legend explaining every label",children:"legend"}),i.jsxs("button",{type:"button",onClick:()=>u(I=>I==="data"?"window":"data"),className:"text-[11px] px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Toggle Y scale between fit-to-data and the full context window",children:["scale: ",l==="data"?"fit data":"full window"]})]})]}),d&&i.jsxs("div",{className:"mb-2 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/60 p-2 text-[11px] space-y-1",children:[i.jsxs("div",{className:"pb-1 mb-1 border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-300",children:["The two message arrays: ",i.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",i.jsx("b",{children:"sent"})," = the per-request wire actually sent, rebuilt and trimmed each request — this is the one that fluctuates. (There is only one store; the fluctuating array is “sent”, not a second store.)"]}),bf.map(I=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 shrink-0",style:{background:I.stroke}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:I.label})," ",i.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",I.desc]})]})]},I.key)),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-xs shrink-0",style:{background:"#10b981",opacity:.25}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— shaded only where store > sent (net trim). sent (prompt_tokens) includes system + tools, so this is a conservative floor on what was trimmed."})]})]}),XT.map(I=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:I.stroke}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:I.label})," ",i.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",I.desc]})]})]},I.key)),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:"#d946ef"}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),i.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${g} ${r}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[j.map((I,M)=>{const L=N(I);return i.jsxs("g",{children:[i.jsx("line",{x1:x.left,y1:L,x2:g-x.right,y2:L,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),i.jsx("text",{x:x.left-6,y:L,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Qs(I)})]},"yt"+M)}),i.jsx("path",{d:T(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),XT.map(I=>{const M=_[_.length-1],L=M&&M[I.key];if(L==null||L>S)return null;const A=N(L);return i.jsxs("g",{children:[i.jsx("line",{x1:x.left,y1:A,x2:g-x.right,y2:A,stroke:I.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),i.jsxs("text",{x:g-x.right+4,y:A,dominantBaseline:"middle",className:"text-[9px]",fill:I.stroke,fillOpacity:.9,children:[I.label," ",Qs(L)]})]},"ref"+I.key)}),_.map((I,M)=>I.compactionMarker?i.jsxs("g",{children:[i.jsx("line",{x1:E(M),y1:x.top,x2:E(M),y2:x.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),i.jsx("text",{x:E(M),y:x.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+M):null),bf.map(I=>i.jsx("path",{d:R(I.key),fill:"none",stroke:I.stroke,strokeWidth:2,strokeDasharray:I.dash||void 0,strokeLinejoin:"round",strokeLinecap:"round"},I.key)),_.map((I,M)=>{const L=E(M),A=t!=null&&I.seq===t;return i.jsxs("g",{children:[bf.map(O=>I[O.key]!=null?i.jsx("circle",{cx:L,cy:N(I[O.key]),r:A?3.5:2.5,fill:O.stroke,stroke:"white",strokeWidth:A?1:.5,className:"dark:stroke-gray-950"},O.key):null),i.jsx("rect",{x:L-Math.max(6,v/_.length/2),y:x.top,width:Math.max(12,v/_.length),height:k,fill:A?"#0ea5e9":"transparent",fillOpacity:A?.06:0,className:"cursor-pointer",onMouseEnter:()=>o(M),onClick:()=>n&&n(I.seq)}),i.jsxs("text",{x:L,y:r-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",I.seq]})]},"pt"+M)}),a!=null&&_[a]&&(()=>{const I=_[a],M=E(a),L=158,A=106,O=Math.min(Math.max(M-L/2,x.left),g-x.right-L),F=x.top+4;return i.jsxs("g",{className:"pointer-events-none",children:[i.jsx("rect",{x:O,y:F,width:L,height:A,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),i.jsxs("text",{x:O+8,y:F+14,className:"text-[9px] font-semibold fill-white",children:["request #",I.seq,I.compactionMarker?" · compaction":""]}),i.jsxs("text",{x:O+8,y:F+28,className:"text-[9px] fill-emerald-300",children:["store: ",Qs(I.storeTokens)]}),i.jsxs("text",{x:O+8,y:F+40,className:"text-[9px] fill-amber-300",children:["sent est: ",Qs(I.sentEst)]}),i.jsxs("text",{x:O+8,y:F+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",Qs(I.sentActual)]}),i.jsxs("text",{x:O+8,y:F+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",Qs(I.tokReal)]}),i.jsxs("text",{x:O+8,y:F+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",Qs(I.threshold)]}),i.jsxs("text",{x:O+8,y:F+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",Qs(I.trimmed)]})]})})()]})]})}const ZT={assistant:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300","tool-iteration":"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",length:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",retry:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"};function ev(e){return e==null?"—":e.toLocaleString()}function KK({turns:e,selectedSeq:t,onSelect:n}){const[r,a]=y.useState(()=>new Set),o=y.useCallback(u=>{a(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=y.useMemo(()=>{const u=[];return(e||[]).forEach(d=>{u.push({kind:"group",turnIndex:d.index,count:d.requests.length}),r.has(d.index)||d.requests.forEach(f=>u.push({kind:"req",rec:f}))}),u},[e,r]);return!e||e.length===0?i.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):i.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[i.jsxs("div",{className:"shrink-0 px-3 py-1.5 text-[10px] leading-snug text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/40",children:[i.jsx("b",{className:"text-gray-600 dark:text-gray-300",children:"Turn"})," = one user prompt + every EPM request it triggers — the agent loop (assistant → tool call → tool result → next request) until a final answer, plus any retries and compaction injections. So one turn can be several requests."]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsx(r5,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const g=r.has(d.turnIndex);return i.jsxs("button",{type:"button",onClick:()=>o(d.turnIndex),className:"w-full flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors sticky top-0",children:[i.jsx("svg",{className:"w-3 h-3 transition-transform "+(g?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,i.jsxs("span",{className:"font-normal text-gray-400 dark:text-gray-500",children:["· ",d.count," req"]})]})}const f=d.rec,p=t!=null&&f.seq===t;return i.jsxs("button",{type:"button",onClick:()=>n(f.seq),className:"w-full text-left px-3 py-2 border-b border-gray-100 dark:border-gray-800/60 transition-colors "+(p?"bg-primary-50 dark:bg-primary-900/20 border-l-2 border-l-primary-500":"hover:bg-gray-50 dark:hover:bg-gray-900 border-l-2 border-l-transparent"),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 shrink-0",children:["#",f.seq]}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded shrink-0 "+(ZT[f.purpose]||ZT.assistant),children:f.purpose}),i.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&i.jsx("span",{className:"text-[9px] px-1 rounded bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/40 dark:text-fuchsia-300 shrink-0",title:"A compaction followed this request",children:"⤵ compact"}),f.messageDrop&&i.jsx("span",{className:"text-[9px] px-1 rounded bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 shrink-0 font-semibold",title:"Unexpected wire message drop (#1858 regression canary)",children:"⚠ drop"}),f.status!=null&&i.jsx("span",{className:"text-[10px] font-mono shrink-0 "+(f.status>=400?"text-red-500":"text-green-600 dark:text-green-400"),children:f.status})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 mt-1 pl-10 text-[10px] text-gray-400 dark:text-gray-500 font-mono",children:[i.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",ev(f.sentActualTokens)," tokens"]}),i.jsxs("span",{title:"growing part-store size",children:["store ",ev(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&i.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",ev(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&i.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function ku({text:e,getText:t,label:n="Copy",className:r="",title:a}){const[o,l]=y.useState(!1),[u,d]=y.useState(!1),f=y.useRef(null);y.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const p=y.useCallback(async g=>{g.stopPropagation();const m=typeof t=="function"?t():e;f.current&&clearTimeout(f.current);try{if(!navigator.clipboard)throw new Error("clipboard unavailable");await navigator.clipboard.writeText(m==null?"":String(m)),d(!1),l(!0),f.current=setTimeout(()=>l(!1),1500)}catch(x){console.error("Copy failed:",x),l(!1),d(!0),f.current=setTimeout(()=>d(!1),1800)}},[e,t]);return i.jsx("button",{type:"button",onMouseDown:function(g){g.preventDefault()},onClick:p,title:a||n,"aria-label":a||n,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-colors "+(o?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 ":u?"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 ":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 ")+r,children:u?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),n]})})}function YK(e,t){return e==="all"?!0:e==="none"?!1:t<1}function JT({name:e}){return e==null?null:typeof e=="number"?i.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):i.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function QK({value:e}){const[t,n]=y.useState(!1),r=JSON.stringify(e);return r.length<=200?i.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:r}):i.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?r:r.slice(0,200)+"…",i.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),n(o=>!o)},className:"ml-1 text-[10px] text-primary-500 dark:text-primary-400 hover:underline align-baseline",children:t?"less":`+${(r.length-200).toLocaleString()} more`})]})}function XK({value:e}){return e===null?i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?i.jsx(QK,{value:e}):typeof e=="number"?i.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?i.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):i.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function pI({data:e,name:t,depth:n=0,openMode:r="auto"}){const a=Array.isArray(e),o=e&&typeof e=="object"&&!a,[l,u]=y.useState(()=>YK(r,n)),d={paddingLeft:n*12+"px"};if(!o&&!a)return i.jsxs("div",{style:d,className:"leading-5 break-all",children:[i.jsx("span",{className:"inline-block w-3"}),i.jsx(JT,{name:t}),t!=null&&i.jsx("span",{className:"text-gray-400",children:": "}),i.jsx(XK,{value:e})]});const f=a?e.map((m,x)=>[x,m]):Object.entries(e),[p,g]=a?["[","]"]:["{","}"];return i.jsxs("div",{children:[i.jsxs("div",{style:d,className:"leading-5 cursor-pointer rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",onClick:()=>u(m=>!m),children:[i.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),i.jsx(JT,{name:t}),t!=null&&i.jsx("span",{className:"text-gray-400",children:": "}),i.jsxs("span",{className:"text-gray-400",children:[p,l?"":f.length?` … ${g}`:g]}),!l&&f.length>0&&i.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",a?"items":"keys"]})]}),l&&f.map(([m,x])=>i.jsx(pI,{data:x,name:m,depth:n+1,openMode:r},m)),l&&f.length>0&&i.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[i.jsx("span",{className:"inline-block w-3"}),g]})]})}function Oo({value:e,bytes:t,onResolveRef:n,label:r="JSON"}){const[a,o]=y.useState(null),[l,u]=y.useState(!1),[d,f]=y.useState(null),[p,g]=y.useState("all"),[m,x]=y.useState(0),[v,k]=y.useState(!1);y.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=a??e,S=Au(_),E=y.useCallback(async()=>{if(n){u(!0),f(null);try{const T=Ul(_),j=await n(T);o(j)}catch(T){f(T&&T.message?T.message:"Failed to fetch")}finally{u(!1)}}},[_,n]);if(_==null)return i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(S)return i.jsxs("div",{className:"text-xs",children:[i.jsx("button",{type:"button",onClick:E,disabled:l,className:"px-2 py-1 rounded border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:l?"Fetching…":`(large${t?" — "+t.toLocaleString()+" bytes":""}, click to fetch)`}),d&&i.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const N=typeof _=="string"?_:JSON.stringify(_,null,2),R=_&&typeof _=="object";return i.jsxs("div",{className:"relative group",children:[i.jsxs("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity z-10 flex items-center gap-1",children:[R&&i.jsx("button",{type:"button",onClick:()=>k(T=>!T),className:"text-[10px] px-1.5 py-0.5 rounded "+(v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Toggle the collapsible tree vs the original flat JSON",children:v?"tree":"raw"}),R&&!v&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>{g("all"),x(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Expand all",children:"expand"}),i.jsx("button",{type:"button",onClick:()=>{g("none"),x(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Collapse all",children:"collapse"})]}),i.jsx(ku,{getText:()=>N,label:"copy",title:`Copy ${r}`})]}),R&&!v?i.jsx("div",{className:"text-[11px] leading-relaxed font-mono bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto",children:i.jsx(pI,{data:_,openMode:p},`${p}-${m}`)}):i.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-words bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto text-gray-700 dark:text-gray-300",children:N})]})}const e4={user:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300",assistant:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",tool:"bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300",system:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"};function vf(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function ZK({rec:e,onResolveRef:t}){const[n,r]=y.useState("idle"),[a,o]=y.useState(null),[l,u]=y.useState(null),d=e.store&&e.store.messages,f=e.body,p=d===void 0,g=y.useCallback(async()=>{r("loading"),o(null);try{const N=Au(d)?await t(Ul(d)):d,R=Au(f)?await t(Ul(f)):f,T=Array.isArray(N)?N:N&&N.messages||[],j=R&&R.messages||[];u(UK(T,j)),r("ready")}catch(N){o(N&&N.message?N.message:"failed to load"),r("error")}},[d,f,t]);if(p)return i.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 italic",children:"The store array wasn't captured for this session — relaunch openpave (Inspector Mode is default-on) to record it, then this diff will show which messages trimming rewrote and where the cache prefix breaks."});if(n!=="ready")return i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:g,disabled:n==="loading",className:"text-[11px] px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:n==="loading"?"computing…":"Compute per-message trim diff"}),a&&i.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:a})]});const{rows:m,firstChanged:x,maxBytes:v}=l,k=x>=0,_=k?m[x]:null,S=k?x:m.length,E=k?m.length-x:0;return i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"rounded-lg border p-2 text-[11px] "+(k?"border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20":"border-emerald-300/60 dark:border-emerald-700/50 bg-emerald-50 dark:bg-emerald-900/20"),children:k?i.jsxs(i.Fragment,{children:[i.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",x]})," (",_.role," · ",_.tag,"). The first ",S," message",S===1?"":"s"," are byte-identical to the store (cache-eligible); the ",E," from #",x," on differ, so they're re-prefilled."]}):i.jsxs(i.Fragment,{children:[i.jsx("b",{className:"text-emerald-700 dark:text-emerald-300",children:"No message was trimmed"})," — every message is byte-identical to the store, so nothing here forces a cache miss."]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-sky-500"})," sent (post-trim)"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-fuchsia-400/50"})," trimmed off"]}),i.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),i.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(N=>{const R=k&&N.i===x,T=Math.round((N.beforeBytes||0)/v*100),j=Math.round((N.afterBytes||0)/v*100);return i.jsxs("div",{children:[R&&i.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[i.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),i.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),i.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),i.jsxs("div",{className:"flex items-center gap-2 rounded pl-1 "+(N.changed?"bg-fuchsia-50/60 dark:bg-fuchsia-900/10":k&&N.i<x?"bg-emerald-50/50 dark:bg-emerald-900/10":""),children:[i.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 shrink-0",children:["#",N.i]}),i.jsx("span",{className:"text-[9px] px-1 rounded shrink-0 w-14 text-center "+(e4[N.role]||e4.system),children:N.role}),i.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${vf(N.beforeBytes)} → sent ${vf(N.afterBytes)}`,children:[i.jsx("div",{className:"absolute inset-y-0 left-0 bg-gray-300 dark:bg-gray-600",style:{width:T+"%"}}),N.changed&&N.afterBytes!=null&&N.beforeBytes!=null&&N.afterBytes<N.beforeBytes&&i.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:j+"%",width:Math.max(0,T-j)+"%"}}),i.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:j+"%"}})]}),i.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 shrink-0",children:N.changed?`${vf(N.beforeBytes)}→${vf(N.afterBytes)}`:"cached"}),i.jsx("span",{className:"hidden sm:block w-28 text-[9px] text-gray-400 dark:text-gray-500 shrink-0 truncate",title:N.tag,children:N.changed?N.tag:""})]})]},N.i)}),m.length>300&&i.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:"Sizes are JSON bytes per message (a proxy for tokens). “store” = the pre-trim rendered history; “sent” = what actually went on the wire this request. The first changed message is where the prompt stops matching the cached prefix."})]})}const t4=4,JK=2.8,tv=e=>e==null?"—":e.toLocaleString();function nv({chars:e,ratio:t,ratioNote:n,tokens:r}){if(e==null)return null;const a=Math.ceil(e/t),o=r!=null?r-a:0;return i.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",tv(e)," chars ÷ ",t,"⌉",o?i.jsxs(i.Fragment,{children:[" + ",tv(o)]}):null," = ",i.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:tv(r)})," tok",i.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",n,o?" + structure/attachments":""]})]})}function rv({label:e,tokens:t,sub:n,calc:r,expanded:a,isOpen:o,onToggle:l}){return i.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-start gap-2 py-1 px-1 text-left rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",children:[i.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),i.jsxs("span",{className:"flex-1 min-w-0",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),i.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),n?i.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",n]}):null]}),r]})]}),o&&i.jsx("div",{className:"pb-2 pl-1",children:a})]})}function eY({rec:e,onResolveRef:t,overheadSystem:n,overheadTools:r,toolCount:a,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=Au(e.body),[p,g]=y.useState(()=>f?null:e.body),[m,x]=y.useState(()=>f?"idle":"ready"),[v,k]=y.useState(null),[_,S]=y.useState(null),E=y.useCallback(async()=>{if(!f){g(e.body),x("ready");return}x("loading"),k(null);try{const O=await t(Ul(e.body));g(O),x("ready")}catch(O){k(O&&O.message?O.message:"failed to load"),x("error")}},[f,e.body,t]),N=O=>{S(F=>F===O?null:O),m==="idle"&&E()},R=m==="ready",T=R&&p&&Array.isArray(p.messages)?p.messages:[],j=T.find(O=>O&&O.role==="system"),I=j?j.content:null,M=R&&p?p.tools:null,L=T.length?T[T.length-1]:null,A=(O,F)=>m==="loading"?i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?i.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",i.jsx("button",{type:"button",onClick:E,className:"underline hover:no-underline",children:"retry"})]}):O==null?i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):i.jsx(Oo,{value:O,onResolveRef:t,label:F});return i.jsxs("div",{className:"pt-1",children:[i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"how each figure is estimated (char-count ÷ ratio — no real tokenizer) · click to see the content:"}),i.jsx(rv,{label:"system prompt",tokens:n,calc:i.jsx(nv,{chars:l,ratio:t4,ratioNote:"natural language",tokens:n}),expanded:A(I,"system prompt"),isOpen:_==="system",onToggle:()=>N("system")}),i.jsx(rv,{label:"tool schemas",tokens:r,sub:a?`${a} tools`:"",calc:i.jsx(nv,{chars:u,ratio:JK,ratioNote:"JSON",tokens:r}),expanded:A(M,"tool schemas"),isOpen:_==="tools",onToggle:()=>N("tools")}),i.jsx(rv,{label:"new message",tokens:o,calc:i.jsx(nv,{chars:d,ratio:t4,ratioNote:"natural language",tokens:o}),expanded:A(L,"new message"),isOpen:_==="new",onToggle:()=>N("new")})]})}function tY({rec:e,prevRec:t,onSelectSeq:n}){const r=e&&e.messageDrop;if(!r)return null;const a=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(a)&&Array.isArray(o)?zK(a,o):null,d=t?i.jsxs("button",{type:"button",className:"underline underline-offset-2 hover:text-red-900 dark:hover:text-red-100",onClick:()=>n&&n(r.prevSeq),title:"Jump to the previous request",children:["request #",r.prevSeq]}):i.jsxs("span",{title:"That request is no longer in the capture",children:["request #",r.prevSeq]});return i.jsxs("div",{className:"mx-3 mt-2 rounded border border-red-300 bg-red-50 dark:border-red-800 dark:bg-red-950/40",children:[i.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[i.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",i.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),i.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",i.jsxs("b",{children:[r.wireBefore," → ",r.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",i.jsx("b",{children:"no compaction"}),r.storeMessages!=null&&i.jsxs(i.Fragment,{children:[" — store intact = ",i.jsx("b",{children:r.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),i.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?i.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(r.prevSeq),children:["raw request #",r.prevSeq]}):i.jsxs("span",{children:["request #",r.prevSeq," (evicted)"]})," · ",i.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?i.jsxs("div",{className:"px-3 py-1.5",children:[i.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:["Messages by role (#",r.prevSeq," → #",e.seq,")"]}),u.roles.map(f=>i.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[i.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),i.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&i.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),i.jsx("div",{className:"mt-1 text-[10px] text-red-500/70 dark:text-red-400/70",children:"Exact messages: open the raw arrays above (the wire carries no ids, so per-message identity can’t be shown here)."})]}):i.jsx("div",{className:"px-3 py-1.5 text-[10px] text-red-500/80 dark:text-red-400/80",children:"Wire bodies are large (spilled) — open the raw requests above to compare the message arrays."})]})}const nY=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function mn(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function Tn({label:e,children:t,highlight:n}){return i.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:e}),i.jsx("span",{className:"text-xs font-mono "+(n?"text-red-500 dark:text-red-400 font-semibold":"text-gray-700 dark:text-gray-200"),children:t==null||t===""?"—":t})]})}const Wf={reasoning:"text-amber-600 dark:text-amber-400",text:"text-sky-700 dark:text-sky-300",tool:"text-violet-600 dark:text-violet-400",usage:"text-emerald-600 dark:text-emerald-400",done:"text-gray-400 dark:text-gray-600",other:"text-gray-500 dark:text-gray-500"},n4={reasoning:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",text:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300",tool:"bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300",usage:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",done:"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600",other:"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"};function rY({raw:e,parts:t}){const n="break-all whitespace-pre-wrap min-w-0 flex-1",r=[];for(const l of t){let u="";if(l.piece!==""&&(l.type==="text"||l.type==="reasoning")?u=JSON.stringify(l.piece):l.type==="usage"&&l.piece&&(u=l.piece),!u)continue;const d=e.indexOf(u);d>=0&&r.push({start:d,end:d+u.length,type:l.type})}if(!r.length)return i.jsx("span",{className:n+" text-gray-600 dark:text-gray-400",children:e});r.sort((l,u)=>l.start-u.start);const a=[];let o=0;return r.forEach((l,u)=>{l.start<o||(l.start>o&&a.push(i.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),a.push(i.jsx("span",{className:"font-semibold "+(Wf[l.type]||Wf.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&a.push(i.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),i.jsx("span",{className:n,children:a})}function kf({n:e,name:t,sub:n,pct:r,trimmedPct:a,fill:o,dashed:l}){return i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"w-4 shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),n&&i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:n}),r!=null&&i.jsxs("div",{className:"h-2.5 w-full rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative "+(l?"ring-1 ring-inset ring-emerald-400/50":""),children:[a!=null&&i.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,a)+"%"}}),i.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,r)+"%"}})]})]})]})}function iv({label:e}){return i.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[i.jsx("span",{"aria-hidden":!0,children:"↓"}),i.jsx("span",{children:e})]})}function iY({rec:e,prevRec:t,onSelectSeq:n,onResolveRef:r,onJumpToMessage:a,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return i.jsx("div",{className:"h-full flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Select a request to inspect it."});const f=e.response,p=f?f.assembled:null,g=e.context,m=g&&g.limit!=null&&g.usable!=null?g.limit-g.usable:null,x=g&&g.threshold!=null&&g.tokReal!=null?g.threshold-g.tokReal:null,v=g?g.source==="estimate":!1,k=g&&(g.historicalEstimate!=null||g.lastPromptTokens!=null)&&g.newMessageTokens!=null,_=g?g.source==="actual"?g.lastPromptTokens:g.historicalEstimate:null,S=g&&g.historicalEstimate!=null&&g.staticOverhead!=null?g.historicalEstimate-g.staticOverhead:null;return i.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,i.jsx("span",{className:"ml-2 text-xs font-normal px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:e.purpose})]}),i.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx(ku,{getText:()=>dI(e),label:"request",title:"Copy this request (body + response + context)"}),f&&i.jsx(ku,{getText:()=>WK(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&i.jsx(ku,{getText:()=>fI(e),label:"chunks",title:"Copy all raw chunks"})]})]}),i.jsx(tY,{rec:e,prevRec:t,onSelectSeq:n}),i.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 shrink-0 border-b border-gray-200 dark:border-gray-800",children:nY.map(E=>i.jsx("button",{type:"button",onClick:()=>l(E),className:"px-2.5 py-1 text-xs font-medium rounded-t transition-colors "+(o===E?"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-100":"text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-900"),children:E},E))}),i.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx(Tn,{label:"fingerprint",children:e.fingerprint}),i.jsx(Tn,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&i.jsxs(Tn,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&i.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:"bubble msgID"}),a?i.jsx("button",{type:"button",onClick:()=>a(e.bubbleMessageID),className:"text-xs font-mono text-primary-600 dark:text-primary-400 hover:underline",title:"Jump to this message in the conversation",children:e.bubbleMessageID}):i.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),i.jsx(Oo,{value:e.params,label:"params"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),i.jsx(Oo,{value:e.headers,label:"headers"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),i.jsx(Oo,{value:e.body,bytes:e.bodyBytes,onResolveRef:r,label:"body"})]})]}),o==="Response"&&i.jsx("div",{className:"space-y-3",children:f?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),i.jsx(Tn,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&i.jsx(Tn,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&i.jsx(Tn,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?i.jsxs("div",{className:"mt-1",children:[i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),i.jsx(Oo,{value:f.headers,label:"response headers"})]}):i.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500 italic",children:"Full header set is captured on newer sessions — relaunch openpave to record it."})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),i.jsx(Tn,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&i.jsx(Tn,{label:"prompt_tokens",children:mn(f.usage.prompt_tokens)}),f.usage&&i.jsx(Tn,{label:"completion_tokens",children:mn(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&i.jsx(Tn,{label:"total_tokens",children:mn(f.usage.total_tokens)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),i.jsx(Oo,{value:p,onResolveRef:r,label:"assembled"})]})]}):i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-3 py-1.5 bg-white/95 dark:bg-gray-950/95 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{children:["TTFT: ",i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),i.jsxs("span",{children:["total: ",i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),i.jsxs("span",{children:["chunks: ",i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.chunkCount})]}),e.totalMs>0&&e.response&&e.response.usage&&e.response.usage.completion_tokens>0&&i.jsxs("span",{children:["throughput: ",i.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),i.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:u,onChange:E=>d(E.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):i.jsx("div",{className:"space-y-1",children:e.chunks.map((E,N)=>{const R=N===0?e.ts!=null?E.ts-e.ts:0:E.ts-e.chunks[N-1].ts,T=qK(E).parts,j=T.filter(I=>I.piece!=="");return i.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[i.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 shrink-0 text-right",children:["+",R,"ms"]}),i.jsx("span",{className:"w-[72px] shrink-0 flex flex-col items-start gap-0.5",children:T.map((I,M)=>i.jsx("span",{className:"px-1 rounded "+(n4[I.type]||n4.other),children:I.type},M))}),u?i.jsx(rY,{raw:E.raw,parts:T}):i.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:E.raw,children:j.length?j.map((I,M)=>i.jsx("span",{className:(M?"ml-1 ":"")+(Wf[I.type]||Wf.other),children:I.piece},M)):i.jsx("span",{className:"italic opacity-60 text-gray-500",children:E.raw})})]},E.seq)})}),!u&&e.chunks.length>0&&i.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",i.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",i.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",i.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",i.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&i.jsxs("div",{className:"space-y-3",children:[g?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rounded-lg border p-2.5 "+(g.needsCompaction?"border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900"),children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(g.needsCompaction?"bg-fuchsia-200 text-fuchsia-800 dark:bg-fuchsia-800/60 dark:text-fuchsia-200":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:g.needsCompaction?"TRIGGERED":"not triggered"}),i.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",i.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),i.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[i.jsxs("div",{children:["compact when ",i.jsx("b",{children:"tokReal > threshold"})," →"," ",i.jsxs("span",{className:g.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[mn(g.tokReal)," ",g.needsCompaction?">":"≤"," ",mn(g.threshold)]})]}),i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",mn(g.threshold)," − ",mn(g.tokReal)," = ",i.jsx("b",{className:x!=null&&x<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:mn(x)})]}),i.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",mn(g.usable)," × ",g.margin??"?","⌋ = ",mn(g.threshold)]}),i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",mn(g.limit)," − ",mn(m)," = ",mn(g.usable)]})]})]}),k&&i.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(v?"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:v?"ESTIMATE":"MEASURED"})]}),i.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[i.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",i.jsx("b",{children:mn(_)})," + ",i.jsx("b",{children:mn(g.newMessageTokens)})," = ",i.jsx("b",{children:mn(g.tokReal)})]}),v?i.jsxs(i.Fragment,{children:[S!=null&&i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",mn(S)," + ",mn(g.staticOverhead)," = ",mn(g.historicalEstimate)]}),(g.overheadSystem!=null||g.overheadTools!=null)&&i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",mn(g.overheadSystem)," + tool schemas ",mn(g.overheadTools),g.toolCount?` (${g.toolCount} tools)`:""," = ",mn(g.staticOverhead)]}),i.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",i.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",mn(g.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):i.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",i.jsx("code",{children:"prompt_tokens"})," (",mn(g.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),i.jsx("div",{className:"font-sans",children:i.jsx(eY,{rec:e,onResolveRef:r,overheadSystem:g.overheadSystem,overheadTools:g.overheadTools,toolCount:g.toolCount,newMessageTokens:g.newMessageTokens,overheadSystemChars:g.overheadSystemChars,overheadToolsChars:g.overheadToolsChars,newMessageChars:g.newMessageChars})})]})]}),i.jsxs("div",{children:[i.jsx(Tn,{label:"limit (window)",children:mn(g.limit)}),i.jsx(Tn,{label:"reserve (output)",children:mn(m)}),i.jsx(Tn,{label:"usable",children:mn(g.usable)}),i.jsx(Tn,{label:"margin",children:g.margin}),i.jsx(Tn,{label:"threshold",children:mn(g.threshold)}),i.jsx(Tn,{label:"tokReal",children:mn(g.tokReal)}),i.jsx(Tn,{label:"needsCompaction",highlight:!!g.needsCompaction,children:String(g.needsCompaction)}),i.jsx(Tn,{label:"source",children:g.source}),i.jsx(Tn,{label:"windowSource",children:g.windowSource||g.epmWindowSignal})]})]}):i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:["No compaction decision for this request. The check runs ",i.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&i.jsxs(i.Fragment,{children:[" The most recent decision was evaluated at ",i.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx(Tn,{label:"storeTokens",children:mn(e.storeTokens)}),i.jsx(Tn,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Persisted history (the store array) — full, pre-shrink · diff vs the Request-tab body (the sent wire) to see what was trimmed"}),i.jsx(Oo,{value:e.store.messages,onResolveRef:r,label:"store messages"})]})]}),e.compaction&&i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),i.jsx(Tn,{label:"trigger",children:e.compaction.trigger}),i.jsx(Tn,{label:"deleted",children:mn(e.compaction.deletedMessages)}),i.jsx(Tn,{label:"summary tok",children:mn(e.compaction.summaryTokens)}),i.jsx(Tn,{label:"before",children:mn(e.compaction.before)}),i.jsx(Tn,{label:"after",children:mn(e.compaction.after)}),i.jsx(Tn,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",i.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",i.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),i.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2",children:[i.jsx("b",{children:"sent est"})," counts the whole ",i.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",i.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",i.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",i.jsx("code",{children:"tools"})," body field, not a message). The missing tool schemas plus the byte÷3-vs-real-tokenizer gap are usually why it reads below ",i.jsx("b",{children:"sent actual"}),". ",i.jsx("b",{children:"sent actual"})," (",i.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",i.jsx("i",{children:"whole"})," request. Different heuristic again from the Context tab's tokReal (system ÷4, tools ÷2.8); the three don't agree by design."]}),i.jsx(Tn,{label:"sent est",children:mn(e.sentEstTokens)}),i.jsx(Tn,{label:"sent actual",children:mn(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&i.jsxs(i.Fragment,{children:[i.jsx(Tn,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),i.jsx(Tn,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx(Tn,{label:"store tokens",children:mn(e.storeTokens)}),i.jsx(Tn,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&i.jsxs(i.Fragment,{children:[i.jsx(Tn,{label:"completion_tokens",children:e.response.usage.completion_tokens}),i.jsx(Tn,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&i.jsx(Tn,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const E=e.trimmed,N=E!=null&&E>0,R=e.finishReason==="length",T=g?g.needsCompaction:null,j=e.storeTokens,I=e.sentActualTokens,M=Math.max(j||0,I||0,e.sentEstTokens||0,1),L=A=>Math.round((A||0)/M*100);return i.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The four layers a request passes through"}),i.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 p-2.5 space-y-1",children:[i.jsx(kf,{n:"1",name:"Durable store — on disk",sub:"every message ever (old ones flagged compactedOut) + the summary. This is what the web UI shows; not measured here (never shrinks)."}),i.jsx(iv,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),i.jsx(kf,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${mn(j)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:L(j),fill:"bg-emerald-500"}),i.jsx(iv,{label:"slice — shallow copy so trimming can't touch the original render"}),i.jsx(kf,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:L(j),fill:"bg-emerald-500/40",dashed:!0}),i.jsx(iv,{label:N?`trim — fit to budget (−${mn(E)} tok net)`:"trim — nothing net-trimmed this request"}),i.jsx(kf,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${mn(I)} tok actual · est ${mn(e.sentEstTokens)}`,pct:L(I),trimmedPct:N?L(j):null,fill:"bg-sky-500"})]}),N&&i.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[i.jsx("span",{className:"inline-block w-2.5 h-2 rounded-xs bg-fuchsia-400/25 align-middle mr-1"}),"shaded = trimmed off this request (store − sent)",R?" · finishReason=length: model hit the output limit":""]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[i.jsxs("li",{children:[i.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",i.jsx("code",{children:"compactedOut"})," + add a summary."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",i.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",i.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),i.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",i.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",i.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",i.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),i.jsxs("div",{className:"rounded-lg border border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20 p-2.5 text-[11px]",children:[i.jsx("b",{className:"text-amber-700 dark:text-amber-300",children:"Cache impact:"})," prefix / KV caching needs the prompt prefix to be byte-identical across requests. Trimming ",i.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",i.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",i.jsx("b",{children:"misses the cache"})," and pays a full prefill. Less trimming + a stable prefix = a higher cache-hit rate. The per-message diff below shows exactly where."]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Per-message trim diff — where the cache breaks"}),i.jsx(ZK,{rec:e,onResolveRef:r})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?i.jsxs("div",{className:"rounded-lg border border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20 p-2.5 font-mono text-[11px]",children:["A compaction ran here [",e.compaction.trigger,"] — store rewritten ",mn(e.compaction.before)," → ",mn(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):i.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",T!=null&&i.jsxs(i.Fragment,{children:[" Decision at build time: ",i.jsx("b",{className:T?"text-fuchsia-600 dark:text-fuchsia-400":"text-emerald-600 dark:text-emerald-400",children:T?"TRIGGERED":"not triggered"})," (see Context tab)."]})]}),i.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",i.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",i.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",i.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",i.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[i.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),i.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),i.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),i.jsx("tbody",{className:"align-top",children:[["acts on","the disposable wire copy — this one request","the persisted store — permanently"],["(1) the request","shrinks this request so it fits the window","future requests carry a summary instead of raw history"],["(2) the store array","untouched — full history stays on disk","rewritten: old messages → an LLM-written summary"],["on disk?","no — ephemeral","yes"],["lossy?","no — reversible; next request has the full store","yes — the detail is gone for good"],["uses the LLM?","no — mechanical string ops","yes — the model writes the summary"],["cost","~free, every request","a whole extra LLM turn, occasionally"],["when","while building the request — after any pre-emptive compaction, before send","BEFORE the request (pre-emptive, near threshold) or AFTER a 413 (reactive)"],["trigger","budget pressure when building; again, harder, on a 413","pre-emptive: tokReal > threshold at turn start · reactive: a 413 that trimming still can’t fit"]].map(([A,O,F])=>i.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:A}),i.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:O}),i.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:F})]},A))})]})})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),i.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400 mb-1",children:"Applied in order, checking after each rung whether the wire fits — stops as soon as it does. The newest message is always preserved."}),i.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[i.jsxs("li",{children:[i.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),i.jsxs("li",{children:[i.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),i.jsxs("li",{children:[i.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),i.jsxs("li",{children:[i.jsx("b",{className:"text-sky-600 dark:text-sky-400",children:"Recency-weighted text caps"})," — cap older text to 8192 / 2048 / 512 / 128 bytes going back; newest turn stays intact."]})]}),i.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500",children:"Per-rung detail for this request isn’t captured yet (would need a backend tap); the numbers above are inferred from store vs sent + finishReason + the compaction event."})]})]})})()]})]})}function aY(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const _u=(e,t,n)=>Math.min(n,Math.max(t,e)),r4=0,i4=560,a4=220,s4=200,o4=640,l4=300,Vf=520;function av(e,t,n,r){try{const a=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(a))return _u(a,n,r)}catch{}return t}function c4(){try{return Math.max(Vf,window.innerWidth)}catch{return 1600}}function u4(){try{return _u(Math.round(window.innerWidth*.9),Vf,1600)}catch{return 1200}}function sY({open:e,onClose:t,activeSessionId:n,activeSessionTitle:r,onJumpToMessage:a}){const[o,l]=y.useState([]),[u,d]=y.useState(null),[f,p]=y.useState(""),[g,m]=y.useState(!1),[x,v]=y.useState(null),[k,_]=y.useState(null),[S,E]=y.useState(()=>av("inspectorTimelineHeight",a4,r4,i4)),[N,R]=y.useState(()=>av("inspectorLedgerWidth",l4,s4,o4)),[T,j]=y.useState(()=>av("inspectorDrawerWidth",u4(),Vf,c4())),[I,M]=y.useState(!1),[L,A]=y.useState(0),[O,F]=y.useState("Request"),[Q,H]=y.useState(!1),P=y.useMemo(()=>f?HK(f):null,[f]);y.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(S))}catch{}},[S]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(N))}catch{}},[N]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(T))}catch{}},[T]);const K=y.useCallback(U=>{U.preventDefault();const oe=U.clientY,ae=S,xe=Xe=>E(_u(ae+(Xe.clientY-oe),r4,i4)),Se=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)},[S]),W=y.useCallback(U=>{U.preventDefault();const oe=U.clientX,ae=N,xe=Xe=>R(_u(ae+(Xe.clientX-oe),s4,o4)),Se=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)},[N]),Y=y.useCallback(U=>{U.preventDefault();const oe=U.clientX,ae=T,xe=Xe=>j(_u(ae+(oe-Xe.clientX),Vf,c4())),Se=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)},[T]),ce=y.useCallback(async()=>{if(P){M(!0);try{const U=new Map;await Promise.all(VK(P).map(async Xe=>{try{U.set(Xe,await Q_(u,Xe))}catch{}}));const oe=QT(P,u,U),ae=new Blob([oe],{type:"text/plain;charset=utf-8"}),xe=URL.createObjectURL(ae),Se=document.createElement("a");Se.href=xe,Se.download=`inspector-${u||"session"}.txt`,document.body.appendChild(Se),Se.click(),Se.remove(),setTimeout(()=>URL.revokeObjectURL(xe),2e3)}catch(U){v(U&&U.message?U.message:"Download failed")}finally{M(!1)}}},[P,u]),z=y.useCallback(async()=>{try{const U=await AL();l(Array.isArray(U)?U:[])}catch(U){v(U&&U.message?U.message:"Failed to list sessions")}},[]);y.useEffect(()=>{e&&z()},[e,n,z]),y.useEffect(()=>{e&&d(U=>n||(U&&o.some(oe=>oe.id===U)?U:o.length?o[0].id:null))},[e,n,o]),y.useEffect(()=>{if(!e||!u){p("");return}let U=!1;return m(!0),v(null),_(null),p(""),IL(u).then(oe=>{U||p(oe||"")}).catch(oe=>{U||(oe&&oe.status===404?p(""):v(oe&&oe.message?oe.message:"Failed to load events"))}).finally(()=>{U||m(!1)}),()=>{U=!0}},[e,u,L]);const G=y.useCallback(()=>{z(),A(U=>U+1)},[z]);y.useEffect(()=>{if(P&&P.requests.length&&k==null){const U=P.requests.find(oe=>oe.messageDrop);_((U||P.requests[0]).seq)}},[P,k]),y.useEffect(()=>{if(!e)return;const U=oe=>{oe.key==="Escape"&&t()};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[e,t]);const X=y.useCallback(U=>Q_(u,U),[u]),B=y.useCallback(async()=>{if(u&&window.confirm(`Purge inspector capture for session ${u}? This deletes the on-disk NDJSON and cannot be undone.`))try{await ML(u),p(""),d(null),await z()}catch(U){v(U&&U.message?U.message:"Failed to purge")}},[u,n,z]),te=y.useMemo(()=>P&&P.requests.find(U=>U.seq===k)||null,[P,k]),V=y.useMemo(()=>P&&te&&te.messageDrop&&P.requests.find(U=>U.seq===te.messageDrop.prevSeq)||null,[P,te]);return e?i.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[i.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),i.jsxs("div",{style:{width:T,maxWidth:"100vw"},className:"relative ml-auto h-full bg-white dark:bg-gray-950 shadow-2xl flex flex-col animate-[slideIn_.15s_ease-out] border-l border-gray-200 dark:border-gray-800",children:[i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:Y,onDoubleClick:()=>j(u4()),className:"group absolute left-0 top-0 h-full w-1.5 -ml-0.5 z-20 cursor-col-resize flex items-center justify-center",children:i.jsx("div",{className:"w-0.5 h-12 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),i.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 h-12 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"text-base shrink-0",children:"🦋"}),i.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 shrink-0",children:"Inspector"}),i.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 shrink-0",children:"debug"}),u&&i.jsxs("span",{className:"text-[11px] text-gray-500 dark:text-gray-400 truncate border-l border-gray-200 dark:border-gray-700 pl-2 min-w-0",title:u===n&&r?`${r} · ${u}`:u,children:[u===n&&r?r:u,u===n&&i.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxs("select",{value:u||"",onChange:U=>d(U.target.value||null),className:"max-w-[280px] text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-700 dark:text-gray-200",title:"Captured sessions (newest first)",children:[o.length===0&&!n&&i.jsx("option",{value:"",children:"(no captures)"}),n&&!o.some(U=>U.id===n)&&i.jsxs("option",{value:n,children:["● ",n.slice(0,12),"… · (current chat — no capture yet)"]}),o.map(U=>i.jsxs("option",{value:U.id,children:[U.id===n?"● ":"",U.id.slice(0,12),"… · ",U.events," ev · ",aY(U.bytes)]},U.id))]}),i.jsx("button",{type:"button",onClick:G,className:"p-1 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors shrink-0",title:"Reload — capture is replay, so re-fetch after sending a prompt","aria-label":"Reload capture",children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),P&&i.jsx(ku,{getText:()=>QT(P,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),P&&i.jsx("button",{type:"button",onClick:ce,disabled:I,className:"text-xs px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",title:"Download the whole session as one file — fetches every spilled body so the exact bytes are included",children:I?"preparing…":"download"}),i.jsx("button",{type:"button",onClick:B,disabled:!u,className:"text-xs px-2 py-1 rounded text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-40",title:"Delete this session's on-disk capture",children:"Purge"}),i.jsx("button",{type:"button",onClick:t,className:"p-1.5 rounded-lg text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:"Close (Esc)","aria-label":"Close inspector",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),i.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[g?i.jsx("div",{style:{height:S},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):x?i.jsx("div",{style:{height:S},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:x}):P?i.jsx(GK,{timeline:P.timeline,selectedSeq:k,onSelectSeq:_,height:S}):i.jsx("div",{style:{height:S},className:"flex items-center justify-center text-center px-4 text-sm text-gray-400 dark:text-gray-500",children:u?u===n?"No capture for this chat yet — send a prompt in it, then hit reload ↻.":"No capture for the selected session.":"No captures yet — send a prompt."}),i.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:K,onDoubleClick:()=>E(a4),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:i.jsx("div",{className:"h-1 w-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})})]}),i.jsxs("div",{className:"flex-1 flex min-h-0",children:[i.jsx("div",{style:{width:N},className:"shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:P?i.jsx(KK,{turns:P.turns,selectedSeq:k,onSelect:_}):i.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the turn list",title:"Drag to resize the turn list · double-click to reset",onPointerDown:W,onDoubleClick:()=>R(l4),className:"group w-1.5 shrink-0 cursor-col-resize flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:i.jsx("div",{className:"w-0.5 h-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),i.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:i.jsx(iY,{rec:te,prevRec:V,onSelectSeq:_,onResolveRef:X,onJumpToMessage:a,tab:O,onTabChange:F,showRaw:Q,onShowRawChange:H},te?te.seq:"none")})]})]}),i.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}const oY=8,lY=32;function cY({width:e,min:t,max:n,edge:r,onCommit:a,getPaneEl:o,ariaLabel:l,className:u}){const d=y.useRef(null),f=y.useRef(null),p=y.useRef(null),g=y.useRef(e);g.current=e,y.useEffect(()=>()=>{p.current&&p.current()},[]);const m=v=>{if(v.pointerType==="mouse"&&v.button!==0)return;v.preventDefault();const k=v.currentTarget,_=o?o():null,S=v.clientX,E=g.current;try{k.setPointerCapture(v.pointerId)}catch{}d.current=v.pointerId;const N=document.body.style.cursor,R=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let T=!1;const j=A=>{if(d.current!==null&&A.pointerId!==d.current)return;const O=r==="left"?S-A.clientX:A.clientX-S,F=P_(E+O,t,n);_&&(_.style.width=F+"px"),f.current=F},I=A=>{if(T)return;T=!0,window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",M),window.removeEventListener("lostpointercapture",M),document.body.style.cursor=N,document.body.style.userSelect=R;const O=d.current;if(d.current=null,O!==null)try{k.releasePointerCapture(O)}catch{}A&&f.current!==null?a(f.current):_&&(_.style.width=g.current+"px"),f.current=null,p.current=null},M=()=>I(!1),L=()=>I(!0);window.addEventListener("pointermove",j),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",M),window.addEventListener("lostpointercapture",M),p.current=()=>I(!1)},x=v=>{const k=v.shiftKey?lY:oY;let _=null;v.key==="ArrowLeft"?_=e+(r==="left"?k:-k):v.key==="ArrowRight"?_=e+(r==="right"?k:-k):v.key==="Home"?_=t:v.key==="End"&&(_=n),_!==null&&(v.preventDefault(),a(P_(_,t,n)))};return i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,tabIndex:0,onPointerDown:m,onKeyDown:x,className:`absolute top-0 bottom-0 w-1 cursor-ew-resize z-10 touch-none ${r==="left"?"left-0":"right-0"}${u?" "+u:""}`})}const d4={oryzo:"oryzo",apple:"apple",flip7:"flip7",questui:"questui",skylearn:"skylearn",editorial:"editorial",blok:"blok",signal:"signal",lens:"lens"};function uY(e,t){const n=typeof e=="string"?e.toLowerCase():"";return Object.prototype.hasOwnProperty.call(d4,n)?d4[n]:t?"oryzo":"default"}class dY{constructor(){this.eventSource=null,this.listeners=new Map,this.sessionId=null,this.reconnectTimeout=null,this.reconnectDelay=1e3,this.maxReconnectDelay=3e4,this.lastEventId=null,this.lastActivityAt=0,this.watchdogTimer=null,this.watchdogCheckMs=2e4,this.stalenessThresholdMs=35e3}_markActivity(){this.lastActivityAt=Date.now()}_startWatchdog(){this._stopWatchdog(),this._markActivity(),this.watchdogTimer=setInterval(()=>{if(this.eventSource&&Date.now()-this.lastActivityAt>this.stalenessThresholdMs){const t=this.eventSource;this._emit("error",{});try{t.close()}catch{}this.eventSource===t&&(this.eventSource=null),this._scheduleReconnect()}},this.watchdogCheckMs)}_stopWatchdog(){this.watchdogTimer&&(clearInterval(this.watchdogTimer),this.watchdogTimer=null)}connect(t){this.disconnect(),this.sessionId!==t&&(this.lastEventId=null),this.sessionId=t;const n=[];t&&n.push("sessionID="+encodeURIComponent(t)),this.lastEventId&&n.push("lastEventId="+encodeURIComponent(this.lastEventId));const r=wr("/global/event")+(n.length>0?"?"+n.join("&"):"");this.eventSource=new EventSource(r);const a=this.eventSource;a.onopen=()=>{this.eventSource===a&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},a.onmessage=o=>{if(this.eventSource===a){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},a.onerror=()=>{this.eventSource===a&&(this._emit("error",{}),a.close(),this.eventSource=null,this._scheduleReconnect())},this._startWatchdog()}disconnect(){this._stopWatchdog(),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&r.delete(n)}_emit(t,n){const r=this.listeners.get(t);if(r)for(const a of r)try{a(n)}catch{}}_scheduleReconnect(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.connect(this.sessionId)},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,this.maxReconnectDelay))}}const bn=new dY;function fY(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const O=localStorage.getItem("pave-theme");return O?O==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[n,r]=y.useState(!1),[a,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[p,g]=y.useState(!1),[m,x]=y.useState(!1),[v,k]=y.useState(!1),[_,S]=y.useState(!1),[E,N]=y.useState(!1),R=e||n;y.useEffect(()=>{const O=document.documentElement;O.classList.toggle("dark",R),O.classList.toggle("theme-oryzo",n),O.classList.toggle("theme-apple",a),O.classList.toggle("theme-flip7",l),O.classList.toggle("theme-questui",d),O.classList.toggle("theme-skylearn",p),O.classList.toggle("theme-editorial",m),O.classList.toggle("theme-blok",v),O.classList.toggle("theme-signal",_),O.classList.toggle("theme-lens",E),O.style.colorScheme=R?"dark":"light",localStorage.setItem("pave-theme",e?"dark":"light"),localStorage.setItem("pave-oryzo",n?"true":"false"),localStorage.setItem("pave-apple",a?"true":"false"),localStorage.setItem("pave-flip7",l?"true":"false"),localStorage.setItem("pave-questui",d?"true":"false"),localStorage.setItem("pave-skylearn",p?"true":"false"),localStorage.setItem("pave-editorial",m?"true":"false"),localStorage.setItem("pave-blok",v?"true":"false"),localStorage.setItem("pave-signal",_?"true":"false"),localStorage.setItem("pave-lens",E?"true":"false")},[R,e,n,a,l,d,p,E,m,v,_]);const[T,j]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1);y.useEffect(()=>{localStorage.setItem("pave-hacker",T?"true":"false")},[T]);const[I,M]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",I?"true":"false")},[I]);const[L,A]=y.useState(!1);return{darkMode:R,setDarkMode:t,oryzoMode:n,setOryzoMode:r,appleMode:a,setAppleMode:o,flip7Mode:l,setFlip7Mode:u,questuiMode:d,setQuestuiMode:f,skylearnMode:p,setSkylearnMode:g,editorialMode:m,setEditorialMode:x,blokMode:v,setBlokMode:k,signalMode:_,setSignalMode:S,lensMode:E,setLensMode:N,hackerMode:T,setHackerMode:j,matrixMode:L,setMatrixMode:A,mobileFrameless:I,setMobileFrameless:M}}const hI=200,gI=600,pY=288;function hY(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const r=localStorage.getItem("pave-terminal-width");if(r){const a=parseInt(r,10);if(!isNaN(a)&&a>=hI&&a<=gI)return a}}return pY}),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem("pave-terminal-width",String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{terminalWidth:e,setTerminalWidth:t}}const sv="pave-sidebar-width";function gY(){const[e,t]=y.useState(()=>typeof window>"u"?wu:gM(localStorage.getItem(sv))),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem(sv,String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem(sv,String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{sidebarWidth:e,setSidebarWidth:t}}function mY(e){const[t,n]=y.useState(()=>{if(typeof window<"u"){const u=localStorage.getItem("pave-right-pane-visible");return u===null?!0:u==="true"}return!0}),[r,a]=y.useState(""),o=y.useRef(t);o.current=t;const l=y.useCallback(()=>{const u=!o.current;n(u),a(e(u?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);return y.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",t?"true":"false")},[t]),{rightPaneVisible:t,toggleRightPane:l,rightPaneAnnouncement:r}}const mI="pave-banner-hidden";function xY(e){return e?e.getItem(mI)==="true":!1}function yY(e){return!e}function bY(e,t){if(!e)return!1;try{return e.setItem(mI,String(t)),!0}catch{return!1}}function vY(){const e=()=>typeof window<"u"?window.localStorage:null,[t,n]=y.useState(()=>xY(e())),r=y.useCallback(()=>{n(a=>{const o=yY(a);return bY(e(),o),o})},[]);return{bannerHidden:t,toggleBanner:r}}function kY(){const[e,t]=y.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");return y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",e)},[e]),{activityView:e,setActivityView:t}}const _Y=150;function wY(e){return e?e.nodeType===1?e:e.parentElement||null:null}function SY(e){const t=wY(e.anchorNode);return!t||!t.closest?null:t.closest("[data-message-id]")}function EY({enabled:e=!0,onQuoteAdd:t}={}){const[n,r]=y.useState(null),a=y.useRef(t);a.current=t;const o=y.useCallback(()=>{if(r(null),typeof window>"u"||!window.getSelection)return;const l=window.getSelection();l&&l.removeAllRanges&&l.removeAllRanges()},[]);return y.useEffect(()=>{if(!e||typeof window>"u"||!window.getSelection)return;let l=null;const u=()=>{const p=window.getSelection();if(!p||p.isCollapsed||p.rangeCount===0){r(null);return}const g=p.toString();if(!g||!g.trim()){r(null);return}const m=SY(p);if(!m){r(null);return}const x=p.getRangeAt(0).getBoundingClientRect();r({text:g,rect:{top:x.top,left:x.left,bottom:x.bottom,right:x.right,width:x.width,height:x.height},sourceMessageID:m.getAttribute("data-message-id"),sourceRole:m.getAttribute("data-message-role")||"assistant",sourceTime:m.getAttribute("data-message-time")||"",fromCode:yz(p)})},d=()=>{l&&clearTimeout(l),l=setTimeout(()=>{l=null,u()},_Y)},f=()=>r(null);return document.addEventListener("selectionchange",d),document.addEventListener("mouseup",d),document.addEventListener("touchend",d),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{l&&clearTimeout(l),document.removeEventListener("selectionchange",d),document.removeEventListener("mouseup",d),document.removeEventListener("touchend",d),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[e]),{selection:n,clearSelection:o}}const NY=["web","agent"],CY=["tui","acp"];function ov(e){return e?e.client?NY.indexOf(e.client)!==-1:CY.indexOf(e.source)===-1:!1}function jY(e){return!!(e&&(e.status||e.response&&e.response.status)===404)}function lv(e,t){return e.filter(n=>n&&n.id!==t)}function TY(e){return"Failed to load messages: "+(e&&e.message?e.message:String(e))}function RY(e,t,n){const r={...e};return n.length===0?delete r[t]:r[t]=n,r}function AY(e){return!!(e&&e.status===409)}function f4(e,t){return!!(e&&e.length>0||t&&t.length>0)}const p4=40;function IY(){var ko,jc,Tc;const{t:e}=rn(),{darkMode:t,setDarkMode:n,oryzoMode:r,setOryzoMode:a,appleMode:o,setAppleMode:l,flip7Mode:u,setFlip7Mode:d,questuiMode:f,setQuestuiMode:p,skylearnMode:g,setSkylearnMode:m,editorialMode:x,setEditorialMode:v,blokMode:k,setBlokMode:_,signalMode:S,setSignalMode:E,lensMode:N,setLensMode:R,hackerMode:T,setHackerMode:j,matrixMode:I,setMatrixMode:M,mobileFrameless:L,setMobileFrameless:A}=fY(),{activityView:O,setActivityView:F}=kY(),{terminalWidth:Q,setTerminalWidth:H}=hY(),{sidebarWidth:P,setSidebarWidth:K}=gY(),{rightPaneVisible:W,toggleRightPane:Y,rightPaneAnnouncement:ce}=mY(e),{bannerHidden:z,toggleBanner:G}=vY(),X="pave-active-session";function B(){try{return localStorage.getItem(X)||null}catch{return null}}function te(D){try{D?localStorage.setItem(X,D):localStorage.removeItem(X)}catch{}}function V(){try{localStorage.removeItem(X)}catch{}}const[,U]=y.useState(0),[oe,ae]=y.useState(!1),xe=y.useRef(null),Se=y.useRef(new Map),[Xe,bt]=y.useState(()=>new Set),[at,yt]=y.useState(()=>new Set),et=y.useRef(null),Ie=y.useRef("chat"),Ge=y.useRef(null),tt=y.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]);y.useEffect(()=>{const D=ee=>{if(!(ee instanceof HTMLElement))return!1;const se=ee.tagName;return!!(se==="INPUT"||se==="TEXTAREA"||ee.isContentEditable)},J=ee=>{if(ee.repeat)return;const se=typeof ee.key=="string"?ee.key.toLowerCase():"";if((tt?ee.metaKey:ee.ctrlKey)&&!ee.altKey&&!ee.shiftKey&&se==="k"){ee.preventDefault(),ae(_n=>!_n);return}if((tt?ee.metaKey:ee.ctrlKey)&&!ee.altKey&&!ee.shiftKey&&se==="b"){ee.preventDefault(),$e(_n=>!_n);return}const Ae=(tt?ee.metaKey:ee.ctrlKey)&&!ee.altKey&&!ee.shiftKey&&se==="j",_t=window.matchMedia("(min-width: 1024px)").matches,tn=Ie.current==="chat";if(Ae&&et.current&&_t&&tn){ee.preventDefault(),Y();return}if(D(ee.target))return;const Mn=ee.ctrlKey&&!ee.altKey&&!ee.metaKey&&se==="h",zn=ee.ctrlKey&&ee.shiftKey&&!ee.altKey&&!ee.metaKey&&se==="m";(Mn||zn)&&(ee.preventDefault(),j(_n=>!_n))};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[e,tt,Y,j]);const[kt,Kt]=y.useState(!0),[an,Vt]=y.useState(!1),[ze,De]=y.useState(null),[nt,ft]=y.useState(null),[ue,be]=y.useState("chat");Ie.current=ue;const[qe,me]=y.useState(!1),[pt,gt]=y.useState(!1),[wt,ht]=y.useState(!1),[$t,Wt]=y.useState(!1),[Je,zt]=y.useState([]),[St,Yt]=y.useState({}),cn=y.useRef(!1);y.useEffect(()=>{YM().then(async D=>{if(Vt(D.enabled),D.authenticated&&D.user){cn.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}De(D.user)}else D.enabled&&await Xv()}).catch(D=>{console.error("Failed to check auth status:",D)}).finally(()=>Kt(!1))},[]),y.useEffect(()=>(q_(({recovered:D,user:J})=>{if(D){let ee=-1;try{ee=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{ee=-1}if(ee>=0&&ee<1){let se=!1;try{sessionStorage.setItem("pave-restore-reloads",String(ee+1)),se=!0}catch{se=!1}if(se){window.location.reload();return}}if(J){cn.current=!0,De(J);return}}cn.current&&Ue("Session expired. Please log in again."),De(null)}),()=>q_(null)),[]),y.useEffect(()=>{an&&!ze&&bn.disconnect()},[ze,an]),y.useEffect(()=>{if(!ze)return;let D=!1;return JL().then(J=>{!D&&J&&J.currentVersion&&ft(J.currentVersion)}).catch(()=>{}),()=>{D=!0}},[ze]),y.useEffect(()=>{RG(()=>et.current)},[]);const xn=y.useCallback(async()=>{try{await QM()}catch(D){console.error("Logout failed:",D);return}De(null),window.location.reload()},[]),[Rn,re]=y.useState(null),[Te,rt]=y.useState(!1),[Pt,Be]=y.useState([]),[lt,ke]=y.useState([]),[Ce,Ye]=y.useState({}),xt=y.useRef(Ce);y.useEffect(()=>{xt.current=Ce},[Ce]);const ie=y.useRef({}),[Pe,$e]=y.useState(!0),[Tt,Ne]=y.useState(!1),We=y.useRef(!1),Et=y.useRef(null),vn=y.useRef(0);y.useEffect(function(){return function(){vn.current&&cancelAnimationFrame(vn.current)}},[]);const vr=y.useCallback(function(){vn.current&&cancelAnimationFrame(vn.current),vn.current=requestAnimationFrame(function(){vn.current=0,Et.current&&Et.current.scrollToBottom()})},[]),[pn,jn]=y.useState([]),Fr=y.useRef([]);Fr.current=pn;const[pe,Xn]=y.useState(null);et.current=pe,y.useEffect(()=>{te(pe)},[pe]),y.useEffect(()=>{pe&&AG(typeof document<"u"&&document.visibilityState==="visible",pe)},[pe]);const[Br,ki]=y.useState([]),Ji=y.useCallback(function(D){D&&ki(function(J){return cz(J,D.text)?J.concat([{qid:oz(),text:Ok(D.text),sourceMessageID:D.sourceMessageID||null,sourceRole:D.sourceRole==="user"?"user":"assistant",sourceTime:D.sourceTime||"",fromCode:D.fromCode===!0}]):J})},[]),Kn=y.useCallback(function(D){ki(function(J){return J.filter(function(ee){return ee.qid!==D})})},[]),_s=y.useCallback(function(){ki([])},[]),{selection:pi,clearSelection:ea}=EY({onQuoteAdd:Ji}),Ba=y.useCallback(function(){pi&&ap(pi.text)},[pi]);y.useEffect(function(){ki([])},[pe]);const je=y.useMemo(()=>pe&&pn.find(D=>D.id===pe)||null,[pe,pn]),[mt,It]=y.useState([]),[gn,Ln]=y.useState(0),[Wn,Sr]=y.useState(!1),[Pi,ar]=y.useState(null),[Er,hi]=y.useState(!1),ti=y.useRef(!1),[ni,va]=y.useState(!1),[ta,ka]=y.useState({}),_a=y.useRef(ta);_a.current=ta;const[gi,Gr]=y.useState({}),[Nr,Kr]=y.useState(null),[un,Ut]=y.useState(null),ir=y.useRef(null);y.useEffect(function(){return function(){ir.current&&clearTimeout(ir.current),Qe.current&&clearTimeout(Qe.current)}},[]);const[Vn,sn]=y.useState(null),[_i,zr]=y.useState(null),[na,ri]=y.useState(null),Qe=y.useRef(null),ut=y.useCallback((D,J)=>{if(D){const ee=!J&&!!_a.current[D];ee&&D===Ft.current&&(Ut(null),ir.current&&(clearTimeout(ir.current),ir.current=null)),ka(se=>{const he={...se},Re=!!se[D];if(J?he[D]=!0:delete he[D],Re&&!J&&ai.current&&ai.current[D]&&!bc.current.has(D)){const Ae=ai.current[D];if(Ae.length>0){const _t=Ae.shift();D===Ft.current&&yc(Ae.length),Promise.resolve().then(()=>{try{D===Ft.current&&Et.current&&Et.current.resetAutoScroll(),ml.current&&ml.current(D,_t.content,_t.imageAttachments,_t.agent,_t.displayContent,_t.queuedTempId,_t.fileAttachments),D===Ft.current&&Et.current&&(Et.current.resetAutoScroll(),vr())}catch(tn){console.error("[Queue] Drain dispatch failed:",tn)}})}}return he}),ee&&(bc.current.delete(D),Uh(D).then(se=>{const he=Array.isArray(se&&se.items)?se.items:[];Gr(Re=>{const Ae={...Re};if(he.length===0)if(Ae[D])delete Ae[D];else return Re;else Ae[D]=he;return Ae})}).catch(()=>{}))}D===Ft.current&&va(J)},[vr]),Gt=y.useCallback(D=>{const J={};Object.keys(D).forEach(se=>{D[se]&&D[se].type==="busy"&&(J[se]=!0)}),ka(se=>{const he={...se};return Object.keys(J).forEach(Re=>{he[Re]=!0}),Object.keys(D).forEach(Re=>{D[Re]&&D[Re].type!=="busy"&&delete he[Re]}),he});const ee=D[Ft.current];va(!!(ee&&ee.type==="busy"))},[]),[kn,In]=y.useState({}),Zn=y.useRef(null),wi=y.useRef(null),[es,Fi]=y.useState({}),[ts,wa]=y.useState({});y.useEffect(()=>{O==="map"&&pe&&Hh(pe).then(D=>{D&&Array.isArray(D.todos)&&wa(J=>({...J,[pe]:D.todos}))}).catch(()=>{})},[O,pe]);const[Fe,$]=y.useState({});y.useEffect(()=>{O==="tools"&&pe&&ew(pe).then(D=>{D&&$(J=>({...J,[pe]:D}))}).catch(()=>{})},[O,pe]);const[de,Me]=y.useState(null),[Oe,Nt]=y.useState(null),[Ht,Ue]=y.useState(null),[fr,Yr]=y.useState(!1),[mr,Cr]=y.useState(null),ra=50,[sr,za]=y.useState(!1),[Zo,Jo]=y.useState(0),qa=y.useRef(0),[el,tl]=y.useState(0),[ii,ws]=y.useState(()=>{try{return localStorage.getItem("pave-show-other-apps")!=="false"}catch{return!0}}),ao=y.useRef(ii),[so,Np]=y.useState(""),ns=y.useRef(""),[Jl,Ua]=y.useState(!0),[Ss,nl]=y.useState(!1),[rl,il]=y.useState(""),[oo,ia]=y.useState(0),[Bi,al]=y.useState(0),[Es,Ns]=y.useState(!1),ec=y.useRef(null),tc=y.useRef(null),[Cp,nc]=y.useState(!1),[jp,Tp]=y.useState(""),[rc,Vu]=y.useState(!1),[sl,Gu]=y.useState(null),[Ku,ol]=y.useState(!1),[ic,Yu]=y.useState({}),ac=y.useRef({}),[sc,Qu]=y.useState({}),oc=y.useRef({}),[lc,lo]=y.useState({}),Xu=y.useRef({}),co=y.useRef(new Set),rs=y.useRef(null);y.useEffect(()=>{ac.current=ic},[ic]),y.useEffect(()=>{oc.current=sc},[sc]),y.useEffect(()=>{if(!pe)return;const D=pn.find(J=>J.id===pe);D&&(D.moe_top_k!=null&&ac.current[pe]===void 0&&Yu(J=>J[pe]===void 0?{...J,[pe]:D.moe_top_k}:J),D.reasoning_effort&&oc.current[pe]===void 0&&Qu(J=>J[pe]===void 0?{...J,[pe]:D.reasoning_effort}:J))},[pe,pn]);const cc=ic[pe]??null,Zu=sc[pe]??"max",uc=lc[pe]??null,aa=y.useCallback((D,J)=>{Gu({text:D,type:J||"info"}),rs.current&&clearTimeout(rs.current),rs.current=setTimeout(()=>{Gu(null),rs.current=null},3e3)},[]);function Ju(D,J){return(Array.isArray(D==null?void 0:D.settings)?D.settings:[]).find(se=>se&&se.key===J)||null}const[dc,Rp]=y.useState(!1),[ll,ed]=y.useState(!1),[is,uo]=y.useState(!1),[fc,cl]=y.useState(!1),[An,td]=y.useState("default"),Cs=An==="oryzo",[xr,nd]=y.useState(!1);y.useEffect(()=>{const D=()=>{S4().then(J=>{const ee=Ae=>{const _t=Ju(J,Ae),tn=String(_t&&_t.value||"").toLowerCase();return tn==="true"||tn==="1"};Rp(ee("PAVE_EXPERIMENTAL_SESSION_BANNER")),ed(ee("PAVE_EXPERIMENTAL_AGENT_BOARD")),uo(ee("PAVE_CAPABILITIES_EXPERIMENTAL")),cl(ee("PAVE_EXPERIMENTAL_TRIGGERS"));const se=Ju(J,"PAVE_EXPERIMENTAL_THEME"),he=se&&String(se.value||"").toLowerCase(),Re=uY(he,ee("PAVE_EXPERIMENTAL_ORYZO_THEME"));td(Re),nd(!0)}).catch(J=>{console.error("[Experimental] Failed to load feature flags:",J.message)})};return D(),window.addEventListener("pave:settings-updated",D),()=>window.removeEventListener("pave:settings-updated",D)},[ue]),y.useEffect(()=>{!ll&&ue==="board"&&be("chat"),!is&&ue==="capabilities"&&be("chat"),!fc&&ue==="triggers"&&be("chat")},[ll,is,fc,ue]),y.useEffect(()=>{!Cs&&r&&a(!1)},[Cs,r,a]),y.useEffect(()=>{An!=="apple"&&o&&l(!1)},[An,o,l]),y.useEffect(()=>{An!=="flip7"&&u&&d(!1)},[An,u,d]),y.useEffect(()=>{An!=="questui"&&f&&p(!1)},[An,f,p]),y.useEffect(()=>{An!=="skylearn"&&g&&m(!1)},[An,g,m]),y.useEffect(()=>{An!=="editorial"&&x&&v(!1)},[An,x,v]),y.useEffect(()=>{An!=="blok"&&k&&_(!1)},[An,k,_]),y.useEffect(()=>{An!=="signal"&&S&&E(!1)},[An,S,E]),y.useEffect(()=>{An!=="lens"&&N&&R(!1)},[An,N,R]);const pc=y.useRef(!1);y.useEffect(()=>{xr&&Cs&&!pc.current&&(pc.current=!0,a(!0))},[xr,Cs]);const hc=y.useRef(!1);y.useEffect(()=>{xr&&An==="apple"&&!hc.current&&(hc.current=!0,l(!0))},[xr,An,l]);const rd=y.useRef(!1);y.useEffect(()=>{xr&&An==="flip7"&&!rd.current&&(rd.current=!0,d(!0))},[xr,An,d]);const id=y.useRef(!1);y.useEffect(()=>{xr&&An==="questui"&&!id.current&&(id.current=!0,p(!0))},[xr,An,p]);const ad=y.useRef(!1);y.useEffect(()=>{xr&&An==="skylearn"&&!ad.current&&(ad.current=!0,m(!0))},[xr,An,m]);const sd=y.useRef(!1);y.useEffect(()=>{xr&&An==="editorial"&&!sd.current&&(sd.current=!0,v(!0))},[xr,An,v]);const od=y.useRef(!1);y.useEffect(()=>{xr&&An==="blok"&&!od.current&&(od.current=!0,_(!0))},[xr,An,_]);const Si=y.useRef(!1);y.useEffect(()=>{xr&&An==="signal"&&!Si.current&&(Si.current=!0,E(!0))},[xr,An,E]);const js=y.useRef(!1);y.useEffect(()=>{xr&&An==="lens"&&!js.current&&(js.current=!0,R(!0))},[xr,An,R]),y.useEffect(()=>{const D=()=>{Y_().then(J=>{ht(!!(J&&J.inspector))}).catch(J=>{console.error("[Inspector] Failed to fetch config:",J.message)})};return window.addEventListener("pave:settings-updated",D),()=>window.removeEventListener("pave:settings-updated",D)},[]),y.useEffect(()=>{Es&&ec.current&&ec.current.focus()},[Es]),y.useEffect(()=>{const D=window.matchMedia("(min-width: 1024px)"),J=ee=>{ee.matches&&Ns(!1)};return D.addEventListener("change",J),()=>D.removeEventListener("change",J)},[]);function gc(){const D=ts[pe]||[],J=[];for(const Ae of mt||[])for(const _t of Ae.parts||[]){if(_t.type!=="tool")continue;const tn=_t.state&&_t.state.output;if(!tn)continue;let Mn=tn;if(typeof tn=="string")try{Mn=JSON.parse(tn)}catch{continue}Mn&&Mn.canvas&&Mn.canvas.type&&Mn.canvas.source&&J.push(Mn.canvas)}const ee=pe?`pave-canvas-cleared:${pe}`:null;let se=new Set;if(ee&&typeof window<"u")try{const Ae=localStorage.getItem(ee);Ae&&(se=new Set(JSON.parse(Ae)))}catch{}const he=J.filter(Ae=>!se.has(Ae.type+":"+Ae.source)),Re=()=>{if(!ee||typeof window>"u")return;const Ae=J.map(_t=>_t.type+":"+_t.source);try{localStorage.setItem(ee,JSON.stringify(Ae))}catch{}U(_t=>_t+1)};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:T?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-end gap-1 px-2 py-1 border-b border-gray-200 dark:border-gray-700 text-xs",children:[i.jsx("button",{type:"button",onClick:()=>F("map"),className:`px-2 py-0.5 rounded ${O==="map"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Strategy map (todos)","aria-label":"Strategy map view",children:"map"}),i.jsx("button",{type:"button",onClick:()=>F("tools"),className:`px-2 py-0.5 rounded ${O==="tools"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Tool-call DAG (execution)","aria-label":"Tool-call map view",children:"tools"}),i.jsxs("button",{type:"button",onClick:()=>F("canvas"),className:`px-2 py-0.5 rounded relative ${O==="canvas"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Canvas (diagrams & illustrations)","aria-label":"Canvas view",children:["canvas",he.length>0?i.jsxs("span",{className:"ml-1 opacity-70",children:["(",he.length,")"]}):null]}),i.jsx("button",{type:"button",onClick:()=>F("terminal"),className:`px-2 py-0.5 rounded ${O==="terminal"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Terminal","aria-label":"Terminal view",children:"terminal"})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:O==="map"?i.jsx(Z$,{todos:D,darkMode:t}):O==="tools"?i.jsx(cW,{graph:Fe[pe]||null,darkMode:t}):O==="canvas"?i.jsx(jT,{canvases:he,onClear:he.length?Re:null}):i.jsx(Rq,{toolParts:xl,matrixMode:I,onToggleMatrix:()=>M(Ae=>!Ae),darkMode:t})})]}):he.length>0?i.jsx(jT,{canvases:he,onClear:he.length?Re:null}):i.jsx(Sq,{toolParts:Ls})}),i.jsx(cV,{messages:mt,isBusy:ni,isCompacting:Nr!=null,activeModel:Rn,sessionModel:Ce[pe]||null,isPrivateMode:at.has(pe),registryEntries:lt})]})}y.useEffect(()=>{nl(!1),il(""),ia(0),al(0),Ns(!1)},[pe]),y.useEffect(()=>{if(!pe)return;let D=!1;return qL(pe).then(J=>{if(D||!J)return;const ee=pe;J.privateMode&&yt(se=>{if(se.has(ee))return se;const he=new Set(se);return he.add(ee),he}),Array.isArray(J.messageIds)&&J.messageIds.length&&bt(se=>{let he=!1;const Re=new Set(se);for(const Ae of J.messageIds)Re.has(Ae)||(Re.add(Ae),he=!0);return he?Re:se})}).catch(()=>{}),()=>{D=!0}},[pe]),y.useEffect(()=>{if(!pe){ol(!1);return}let D=!1;return _4(pe).then(J=>{if(D)return;const ee=J&&J.config?J.config:{};ol(!!ee.enabled)}).catch(()=>{}),()=>{D=!0}},[pe]),y.useEffect(()=>{if(!pe){rt(!1);return}const D=xt.current[pe]||Rn;if(!D){rt(!1);return}let J=!1;return LL(D).then(ee=>{J||rt(!!(ee&&ee.adaptiveQuality))}).catch(()=>{J||rt(!1)}),()=>{J=!0}},[pe,Rn,Ce]),y.useEffect(()=>{Bi>0&&oo>=Bi?ia(Bi-1):Bi===0&&oo!==0&&ia(0)},[Bi,oo]);const Ft=y.useRef(pe);y.useEffect(()=>{Ft.current=pe;const D=ai.current[pe];yc(D?D.length:0)},[pe]),y.useEffect(()=>{if(!pe)return;let D=!1;return Uh(pe).then(J=>{if(D)return;const ee=Array.isArray(J&&J.items)?J.items:[],se=pe;Gr(he=>{const Re={...he};if(ee.length===0)if(Re[se])delete Re[se];else return he;else Re[se]=ee;return Re})}).catch(J=>{console.warn("[queue] hydrate failed for",pe,J&&J.message)}),()=>{D=!0}},[pe]);const mc=y.useRef(O);y.useEffect(()=>{mc.current=O},[O]);const ai=y.useRef({}),[xc,yc]=y.useState(0),bc=y.useRef(new Set),zi=y.useCallback(D=>{if(D===Ft.current){const J=ai.current[D];yc(J?J.length:0)}},[]),vc=y.useCallback(D=>{if(!D)return;const J=Ft.current;if(!J)return;const ee=ai.current[J];Array.isArray(ee)&&ee.length>0&&(ai.current[J]=ee.filter(se=>se.queuedTempId!==D)),It(se=>se.filter(he=>he.info.id!==D)),zi(J)},[zi]),Ei=!an||!!ze;y.useEffect(()=>{!kt&&Ei&&(Ni(),qi(),Z_().then(D=>{Gt(D)}).catch(D=>{console.error("Failed to fetch session status:",D)}))},[kt,Ei]),y.useEffect(()=>{!kt&&Ei&&(Y_().then(D=>{D&&D.model&&re(D.model),ht(!!(D&&D.inspector))}).catch(D=>{console.error("Failed to fetch config:",D)}),KM().then(D=>{D&&Array.isArray(D.providers)&&Be(D.providers)}).catch(D=>{console.error("Failed to fetch providers:",D)}),fv().then(D=>{D&&Array.isArray(D.entries)&&ke(D.entries)}).catch(D=>{console.error("Failed to fetch model registry:",D)}),pv().then(D=>{D&&D.home&&Tp(D.home)}).catch(D=>{console.error("Failed to fetch path info:",D)}))},[kt,Ei]);const fo=y.useCallback(()=>{XM().then(D=>{const J=Array.isArray(D&&D.pending)?D.pending:[];zt(J)}).catch(D=>{console.error("Failed to fetch pending permissions:",D)})},[]);y.useEffect(()=>{!kt&&Ei&&fo()},[kt,Ei,fo]),y.useEffect(()=>{const ee=setInterval(()=>{zt(se=>{const he=Date.now(),Re=se.filter(Ae=>he-(Ae.timestamp||0)<3e5);return Re.length===se.length?se:Re})},3e4);return()=>clearInterval(ee)},[]);const Ni=y.useCallback(async D=>{try{const J=D&&D.includeArchived||We.current,ee=qa.current||0,se=Math.max(ra,ee),he=D&&typeof D.q=="string"?D.q:ns.current,Re=!!(he&&he.trim()),Ae=Date.now(),_t=await Dl({limit:se,offset:0,includeArchived:Re?!0:J,includeOtherApps:!1,q:he});if(_t&&_t.sessions){const tn=Array.isArray(_t.sessions)?_t.sessions:[];jn(z_({fetched:tn,current:Fr.current,prependsSince:Ae})),za(!!_t.hasMore),tl(typeof _t.total=="number"?_t.total:tn.length),Jo(tn.length),qa.current=tn.length}else{const tn=Array.isArray(_t)?_t:[];jn(z_({fetched:tn,current:Fr.current,prependsSince:Ae})),za(!1),tl(tn.length),Jo(tn.length),qa.current=tn.length}}catch(J){return console.error("Failed to load sessions:",J),!1}return!0},[]);function as(D,J){var ee=J&&J.time&&J.time.updated||0,se=D&&D.time&&D.time.updated||0;return ee-se}const Sa=200,Ts=y.useRef(Sa),[ld,po]=y.useState(!1),[ho,ss]=y.useState([]),cd=200,[ul,Rs]=y.useState([]),ud=y.useMemo(()=>{if(!(ho.length||ul.length))return pn;const J=Object.create(null),ee=[],se=pn.concat(ho,ul);for(let he=0;he<se.length;he++){const Re=se[he];!Re||!Re.id||J[Re.id]||(J[Re.id]=!0,ee.push(Re))}return ee.sort(as)},[pn,ho,ul]),sa=y.useCallback(async()=>{const D=ns.current,J=!!(D&&D.trim());if(!We.current&&!J){Rs([]);return}try{const ee=await Dl({limit:cd,offset:0,onlyArchived:!0,q:D}),se=ee&&ee.sessions?Array.isArray(ee.sessions)?ee.sessions:[]:Array.isArray(ee)?ee:[];Rs(se)}catch(ee){console.error("Failed to load archived sessions:",ee)}},[]),qi=y.useCallback(async()=>{const D=ns.current,J=!!(D&&D.trim());if(!ao.current&&!J){ss([]);return}try{const ee=await Dl({limit:Ts.current,offset:0,onlyOtherApps:!0,includeArchived:J?!0:We.current,q:D}),se=ee&&ee.sessions?Array.isArray(ee.sessions)?ee.sessions:[]:Array.isArray(ee)?ee:[];ss(se),po(!!(ee&&ee.hasMore))}catch(ee){console.warn("Failed to load other-app sessions:",ee),ss([]),po(!1)}},[]),kc=y.useCallback(async()=>{Ts.current+=Sa,await qi()},[qi]);y.useEffect(()=>{function D(){pe&&DM(pe).then(function(J){J&&J.sessionID&&(Ft.current=J.sessionID,Xn(J.sessionID),Ni())}).catch(function(J){console.error("Failed to create archive session:",J);const ee=(()=>{if(!J)return!1;if(J.status===404||J.response&&J.response.status===404)return!0;if(typeof J.message=="string"){const se=J.message.match(/^(\d{3})\s*:/);if(se&&parseInt(se[1],10)===404)return!0}return!1})();Ue(e(ee?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",D),()=>document.removeEventListener("navigateToArchiveSession",D)},[pe,Ni,e,Ue]);const Ap=async()=>{try{const D=ns.current,J=!!(D&&D.trim()),ee=await Dl({limit:ra,offset:Zo,includeArchived:J?!0:We.current,includeOtherApps:!1,q:D});if(ee&&ee.sessions){const se=Array.isArray(ee.sessions)?ee.sessions:[];jn(he=>{for(var Re={},Ae=0;Ae<he.length;Ae++)Re[he[Ae].id]=!0;for(var _t=[],tn=0;tn<se.length;tn++)Re[se[tn].id]||_t.push(se[tn]);return he.concat(_t)}),za(!!ee.hasMore),typeof ee.total=="number"&&tl(ee.total),Jo(he=>{var Re=he+se.length;return qa.current=Re,Re})}}catch(D){console.error("Failed to load more sessions:",D)}},Ui=async(D,J)=>{try{const ee=(J?J.fresh!==!1:!0)&&!ti.current,se=await W_(D,ee,ee?{limit:p4}:void 0),he=se&&!Array.isArray(se)&&Array.isArray(se.messages),Re=he?se.messages:se,Ae=he&&typeof se.compactedOutCount=="number"?se.compactedOutCount:0;return Ft.current!==D?null:Array.isArray(Re)?(Ln(ee?Ae:0),ee&&he?(Sr(se.hasMore===!0),ar(typeof se.nextCursor=="string"?se.nextCursor:null)):(Sr(!1),ar(null)),It(_t=>{const tn=Re.some(Le=>Le.info.mode==="compaction"),Mn=Array.isArray(_t)&&_t.some(Le=>Le.info&&Le.info.mode==="compaction");if(tn&&!Mn)return Re;const zn=new Set(Re.map(Le=>Le.info.id)),_n=Re.reduce(function(Le,He){return He&&He.info&&He.info.mode==="compaction"&&He.info.time&&typeof He.info.time.created=="number"?Math.max(Le,He.info.time.created):Le},-1/0),ye=_t.filter(Le=>Le.info.sessionID===D&&!zn.has(Le.info.id)&&!String(Le.info.id).startsWith("temp-")&&!(_n!==-1/0&&Le.info.time&&typeof Le.info.time.created=="number"&&Le.info.time.created<_n));if(ye.length===0)return Re;const Z=[];let fe=0,we=0;for(;fe<Re.length||we<ye.length;){const Le=Re[fe],He=ye[we],vt=Le&&Le.info.time&&typeof Le.info.time.created=="number"?Le.info.time.created:1/0,qt=He&&He.info.time&&typeof He.info.time.created=="number"?He.info.time.created:1/0;fe<Re.length&&(we>=ye.length||vt<=qt)?(Z.push(Le),fe++):(Z.push(He),we++)}return Z}),Re):(It([]),null)}catch(ee){return console.error("Failed to load messages:",ee),Ft.current===D&&(jY(ee)?(Ft.current=null,Xn(null),jn(se=>lv(se,D)),ss(se=>lv(se,D)),Rs(se=>lv(se,D))):Ue(TY(ee))),null}},go=y.useCallback(async D=>Ft.current!==D?null:(ti.current=!0,Ui(D,{fresh:!1})),[Ui]),Ip=async D=>{if(Er||!Wn||!Pi||ti.current||Ft.current!==D)return null;hi(!0);try{const J=await W_(D,!0,{limit:p4,before:Pi});if(Ft.current!==D)return null;if(!J||Array.isArray(J)||!Array.isArray(J.messages))throw new Error("Invalid paged message response");return Ln(typeof J.compactedOutCount=="number"?J.compactedOutCount:0),Sr(J.hasMore===!0),ar(typeof J.nextCursor=="string"?J.nextCursor:null),It(ee=>{const se=new Map;for(const he of J.messages.concat(ee))he&&he.info&&he.info.id&&se.set(he.info.id,he);return Array.from(se.values()).sort((he,Re)=>{const Ae=he.info.time.created-Re.info.time.created;return Ae!==0?Ae:he.info.id<Re.info.id?-1:he.info.id>Re.info.id?1:0})}),J.messages}catch(J){return Ft.current===D&&Ue("Failed to load earlier messages: "+(J&&J.message?J.message:String(J))),null}finally{Ft.current===D&&hi(!1)}};y.useEffect(()=>{if(!pe){It([]),Ln(0),Sr(!1),ar(null),hi(!1),ti.current=!1,In({}),Nt(null),Ua(!0);return}It([]),Ln(0),Sr(!1),ar(null),hi(!1),ti.current=!1,Nt(null),Ua(!1),Me(null),pe&&(J_(pe).then(ye=>{ye&&Array.isArray(ye.banners)&&Fi(Z=>({...Z,[pe]:ye.banners}))}).catch(()=>{}),Hh(pe).then(ye=>{ye&&Array.isArray(ye.todos)&&wa(Z=>({...Z,[pe]:ye.todos}))}).catch(()=>{})),bn.connect(pe);let D=!1,J=!1,ee=!1,se=!1;const he=pe,Re=ye=>{if(Ft.current!==he)return;const Z=new Map;if(Array.isArray(ye))for(const fe of ye){if(!fe||!fe.info||!fe.info.id||!Array.isArray(fe.parts))continue;const we=new Set;for(const Le of fe.parts)Le&&(Le.type==="text"||Le.type==="reasoning")&&we.add(Le.type);we.size>0&&Z.set(fe.info.id,we)}In(fe=>{const we=fe[he];if(!we||Object.keys(we).length===0)return fe;const Le={};let He=!1;for(const vt of Object.keys(we)){const qt=we[vt],Bt={};let Jt=!1;const En=Z.get(vt);for(const dn of Object.keys(qt)){const Hn=qt[dn];if(Hn._fromSnapshot){Bt[dn]=Hn,Jt=!0;continue}const Gn=Hn.type;if(En&&En.has(Gn)){He=!0;continue}Bt[dn]=qt[dn],Jt=!0}Jt?Le[vt]=Bt:He=!0}if(!He)return fe;if(Object.keys(Le).length===0){const vt={...fe};return delete vt[he],vt}return{...fe,[he]:Le}})},Ae=setTimeout(()=>{!D&&!J&&(J=!0,Ui(he).then(ye=>{ee=!0,Re(ye),se&&Ft.current===he&&Ui(he).then(Z=>{Re(Z)})}))},3e3),_t=80;function tn(){wi.current!=null&&(clearTimeout(wi.current),wi.current=null);const ye=Zn.current;ye&&(Zn.current=null,In(Z=>{let fe=Z;for(const we of Object.keys(ye)){const Le=ye[we],He={...fe[we]||{}};for(const vt of Object.keys(Le)){const qt=Le[vt],Bt={...He[vt]||{}};for(const Jt of Object.keys(qt)){const En=qt[Jt],dn=Bt[Jt];En.type==="text"||En.type==="reasoning"?Bt[Jt]={...En,text:((dn==null?void 0:dn.text)||"")+(En.delta||"")}:Bt[Jt]={...dn,...En}}He[vt]=Bt}fe={...fe,[we]:He}}return fe}))}function Mn(){wi.current==null&&(wi.current=setTimeout(tn,_t))}function zn(ye,Z,fe){Zn.current||(Zn.current={});const we=Zn.current;we[Z]||(we[Z]={});const Le=we[Z];Le[fe]||(Le[fe]={});const He=Le[fe],vt=He[ye.id];ye.type==="text"||ye.type==="reasoning"?He[ye.id]={...ye,delta:(vt&&vt.delta||"")+(ye.delta||"")}:He[ye.id]={...vt,...ye}}const _n=[bn.on("connected",()=>{D=!0,clearTimeout(Ae),Ua(!0),fo(),Z_().then(ye=>{Gt(ye)}).catch(()=>{}),Uh(he).then(ye=>{const Z=Array.isArray(ye&&ye.items)?ye.items:[];Gr(fe=>{const we={...fe};if(Z.length===0)if(we[he])delete we[he];else return fe;else we[he]=Z;return we})}).catch(()=>{}),Ui(he).then(ye=>{ee=!0,Re(ye),se&&Ft.current===he&&Ui(he).then(Z=>{Re(Z)})})}),bn.on("error",()=>{Ua(!1),!D&&!J&&(clearTimeout(Ae),J=!0,Ui(he).then(ye=>{ee=!0,Re(ye),se&&Ft.current===he&&Ui(he).then(Z=>{Re(Z)})}))}),bn.on("session.status",ye=>{var we;const Z=ye.properties||ye,fe=((we=Z.status)==null?void 0:we.type)==="busy";ut(Z.sessionID,fe)}),bn.on("message.part.delta",ye=>{const Z=(ye.properties||ye).part;if(!Z||!Z.sessionID)return;Se.current.has(Z.sessionID)&&Se.current.delete(Z.sessionID);const{sessionID:fe,messageID:we}=Z;zn(Z,fe,we),Mn()}),bn.on("streaming.snapshot",ye=>{const Z=ye.properties||ye,fe=Z.sessionID,we=Z.parts;!fe||!Array.isArray(we)||In(Le=>{const He={...Le[fe]||{}};for(const vt of we){const qt={...He[vt.messageID]||{}};qt[vt.id]={id:vt.id,type:vt.type,text:vt.text,sessionID:fe,messageID:vt.messageID,_fromSnapshot:!0},He[vt.messageID]=qt}return{...Le,[fe]:He}})}),bn.on("message.progress",ye=>{const Z=ye.properties||ye;Z.sessionID===Ft.current&&Nt({chunks:Z.chunks||0,textLength:Z.textLength||0,toolCalls:Z.toolCalls||0,toolArgBytes:Z.toolArgBytes||0,toolNames:Z.toolNames||[]})}),bn.on("message.part.updated",ye=>{const Z=(ye.properties||ye).part;if(Z){if(tn(),Z.type==="text"||Z.type==="reasoning"){const fe=Z.sessionID;In(we=>{const Le=we[fe];if(!Le)return we;const He=Le[Z.messageID];if(!He)return we;const vt={};var qt=!1;for(const Bt of Object.keys(He))He[Bt].type!==Z.type&&(vt[Bt]=He[Bt],qt=!0);if(!qt){const Bt={...Le};if(delete Bt[Z.messageID],Object.keys(Bt).length===0){const Jt={...we};return delete Jt[fe],Jt}return{...we,[fe]:Bt}}return{...we,[fe]:{...Le,[Z.messageID]:vt}}})}if(Z.sessionID===Ft.current){if(!ee){Z.sessionID===he&&(se=!0);return}(Z.type==="tool"||Z.type==="tool-use")&&mc.current==="tools"&&ew(Z.sessionID).then(fe=>{fe&&$(we=>({...we,[Z.sessionID]:fe}))}).catch(()=>{}),It(fe=>fe.map(we=>{if(we.info.id!==Z.messageID)return we;const Le=we.parts.findIndex(qt=>qt.id===Z.id);if(Le>=0)return{...we,parts:we.parts.map((qt,Bt)=>Bt===Le?Z:qt)};const He=we.parts.slice();let vt=He.length;for(let qt=He.length-1;qt>=0;qt--){if(He[qt].id<=Z.id){vt=qt+1;break}qt===0&&(vt=0)}return He.splice(vt,0,Z),{...we,parts:He}}))}}}),bn.on("message.updated",ye=>{const Z=(ye.properties||ye).info;if(!(!Z||Z.sessionID!==Ft.current)){if(tn(),!ee){Z.sessionID===he&&(se=!0);return}if(It(fe=>{const we=fe.findIndex(Bt=>Bt.info.id===Z.id);if(we>=0)return fe.map((Bt,Jt)=>Jt===we?{...Bt,info:Z}:Bt);if(Z.role==="user"){const Bt=fe.findIndex(Jt=>Jt.info.id&&Jt.info.id.startsWith("temp-")&&Jt.info.role==="user");if(Bt>=0)return fe.map((Jt,En)=>En===Bt?{info:Z,parts:[]}:Jt)}const Le={info:Z,parts:[]};if(!Z.time||typeof Z.time.created!="number")return[...fe,Le];const He=Z.time.created;let vt=fe.length;for(let Bt=fe.length-1;Bt>=0;Bt--){const Jt=fe[Bt].info.time;if(Jt&&typeof Jt.created=="number"&&Jt.created<=He){vt=Bt+1;break}Bt===0&&(vt=0)}const qt=fe.slice();return qt.splice(vt,0,Le),qt}),Z.compactedOut!==!0&&Z.finish){const fe=Z.sessionID;In(we=>{const Le=we[fe];if(!Le||!Le[Z.id])return we;const He={...Le};if(delete He[Z.id],Object.keys(He).length===0){const vt={...we};return delete vt[fe],vt}return{...we,[fe]:He}}),Nt(null),Z.finish!=="compacted"&&ut(fe,!1),Ui(Ft.current)}}}),bn.on("message.deleted",ye=>{const Z=ye.properties||ye,fe=Z.sessionID,we=Z.messageID;!fe||!we||fe===Ft.current&&(It(Le=>Le.filter(He=>He.info.id!==we)),In(Le=>{if(!Le[fe])return Le;const He=Le[fe];if(!He[we])return Le;const vt={...Le},qt={...He};return delete qt[we],vt[fe]=qt,vt}))}),bn.on("session.updated",ye=>{const Z=ye.properties||ye,fe=Z.info||Z,we=fe&&(fe.id||fe.sessionID)||Z.sessionID||Z.id;if(!we){Ni(),qi();return}const Le=fe&&fe.time&&typeof fe.time.updated=="number",He=vt=>{const Bt=!Fr.current.some(En=>En&&En.id===we)&&ov(vt),Jt=Bt?{...vt,prependedAt:Date.now()}:vt;Bt&&(Fr.current=[Jt].concat(Fr.current)),jn(En=>{var dn=!1,Hn=En.map(Gn=>Gn.id===we?(dn=!0,{...vt,ui:{...vt.ui,...Gn.ui}}):Gn);return!dn&&ov(vt)&&(Hn=[Jt].concat(Hn)),Hn.sort(as),Hn}),Rs(En=>{var dn=!1,Hn=En.map(Gn=>Gn.id!==we?Gn:(dn=!0,{...vt,ui:{...vt.ui,...Gn.ui}}));return dn?(Hn=Hn.filter(Gn=>Gn.archived),Hn.sort(as),Hn):En}),ov(vt)||ss(En=>{var dn=!1,Hn=En.map(Gn=>Gn.id!==we?Gn:(dn=!0,{...vt,ui:{...vt.ui,...Gn.ui}}));return dn?(Hn.sort(as),Hn):En})};Le?(He(fe),Ye(vt=>{let qt=vt;const Bt=fe.model;return typeof Bt=="string"&&Bt||Bt&&typeof Bt=="object"&&Bt.providerID&&Bt.modelID?qt={...vt,[we]:Bt}:vt[we]&&(qt={...vt},delete qt[we]),xt.current=qt,qt})):qh(we).then(vt=>{He(vt),Ye(qt=>{let Bt=qt;const Jt=vt&&vt.model;return typeof Jt=="string"&&Jt||Jt&&typeof Jt=="object"&&Jt.providerID&&Jt.modelID?Bt={...qt,[we]:Jt}:qt[we]&&(Bt={...qt},delete Bt[we]),xt.current=Bt,Bt})}).catch(vt=>{console.error("Failed to fetch updated session, falling back to full reload:",vt),Ni()})}),bn.on("session.deleted",ye=>{const Z=ye.properties||ye,fe=Z.info||Z,we=fe&&(fe.id||fe.sessionID)||Z.sessionID||Z.id;we&&(jn(Le=>Le.filter(He=>He.id!==we)),ss(Le=>Le.filter(He=>He.id!==we)),Rs(Le=>Le.filter(He=>He.id!==we)),Xn(Le=>Le===we?null:Le))}),bn.on("permission.request",ye=>{const Z=ye.properties||ye;Z.requestId&&zt(fe=>fe.some(we=>we.id===Z.requestId)?fe:[...fe,{id:Z.requestId,action:Z.action,type:Z.type,target:Z.target,reason:Z.reason,description:Z.description,timestamp:Date.now()}])}),bn.on("permission.confirmed",ye=>{const Z=ye.properties||ye;Z.requestId&&zt(fe=>fe.filter(we=>we.id!==Z.requestId))}),bn.on("permission.denied",ye=>{const Z=ye.properties||ye;Z.requestId&&zt(fe=>fe.filter(we=>we.id!==Z.requestId))}),bn.on("question.asked",ye=>{const Z=ye.properties||ye;if(!Z.id)return;const fe=Z.tool&&Z.tool.callID?Z.tool.callID:null;if(fe&&Yt(we=>({...we,[fe]:{id:Z.id,questions:Z.questions}})),n1()){const we=Z.questions&&Z.questions[0],Le=we?we.text:"A question needs your input.",He=Z.sessionID||null;_G({title:"PAVE — Question",body:Le.length>200?Le.slice(0,200)+"…":Le,tag:"pave-question-"+Z.id,onClick:He?function(){Sn(He),window.focus()}:function(){window.focus()}})}}),bn.on("question.replied",ye=>{const Z=ye.properties||ye;Z.requestId&&Yt(fe=>{var we={};for(var Le in fe)(!fe[Le]||fe[Le].id!==Z.requestId)&&(we[Le]=fe[Le]);return we})}),bn.on("question.rejected",ye=>{const Z=ye.properties||ye;Z.requestId&&Yt(fe=>{var we={};for(var Le in fe)(!fe[Le]||fe[Le].id!==Z.requestId)&&(we[Le]=fe[Le]);return we})}),bn.on("quality.hint",ye=>{const Z=ye.properties||ye;if(!Z.preset)return;const fe=Z.sessionID;fe&&(lo(we=>({...we,[fe]:Z})),Xu.current[fe]=Z)}),bn.on("dlp.cancelled",ye=>{const fe=(ye.properties||ye).sessionID;if(!fe)return;const we=Se.current.get(fe);we&&(we.tempId&&It(Le=>Le.filter(He=>He.info.id!==we.tempId)),fe===Ft.current&&xe.current&&typeof xe.current.setText=="function"&&xe.current.setText(we.text||""),Se.current.delete(fe)),ut(fe,!1)}),bn.on("dlp.private_message",ye=>{const Z=ye.properties||ye,fe=Z.sessionID,we=Z.messageID;!fe||!we||(bt(Le=>{if(Le.has(we))return Le;const He=new Set(Le);return He.add(we),He}),yt(Le=>{if(Le.has(fe))return Le;const He=new Set(Le);return He.add(fe),He}))}),bn.on("dlp.exited_private",ye=>{const fe=(ye.properties||ye).sessionID;fe&&yt(we=>{if(!we.has(fe))return we;const Le=new Set(we);return Le.delete(fe),Le})}),bn.on("session.error",ye=>{const Z=ye.properties||ye;if(Z.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",Z.source||""),Ue("Session expired. Please log in again."),De(null),Z.sessionID&&ut(Z.sessionID,!1);return}Z.sessionID&&ut(Z.sessionID,!1),Z.sessionID===Ft.current&&(Z.code==="insufficient_credits"?(Ue(null),Cr(Z.upgradeUrl||null),Yr(!0)):Ue(Z.error||"An error occurred"))}),bn.on("session.retry",ye=>{const Z=ye.properties||ye;Z.reason==="rate_limit"&&Z.sessionID===Ft.current&&(Ut({attempt:Z.attempt,maxRetries:Z.maxRetries,delayMs:Z.delayMs,elapsedMs:Z.elapsedMs||0,maxDurationMs:Z.maxDurationMs||0}),ir.current&&clearTimeout(ir.current),ir.current=setTimeout(()=>Ut(null),1e4))}),bn.on("session.compacting",ye=>{const Z=ye.properties||ye;Z.sessionID===Ft.current&&Kr(fe=>({...fe,currentTokens:Z.currentTokens??(fe==null?void 0:fe.currentTokens),threshold:Z.threshold??(fe==null?void 0:fe.threshold),reason:Z.reason??(fe==null?void 0:fe.reason),stage:Z.stage??(fe==null?void 0:fe.stage),elapsedMs:Z.elapsedMs??(fe==null?void 0:fe.elapsedMs),messageCount:Z.messageCount??(fe==null?void 0:fe.messageCount),chunks:Z.chunks??(fe==null?void 0:fe.chunks),textLength:Z.textLength??(fe==null?void 0:fe.textLength)}))}),bn.on("session.compacted",ye=>{const Z=ye.properties||ye,fe=Ft.current;if(Z.sessionID===fe){if(Kr(null),sn(null),Z.newSessionID&&Z.newSessionID!==fe&&!Z.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${fe} → ${Z.newSessionID}`),Z.newSession){mo(Z.newSession);const He=Z.newSession.model;(typeof He=="string"&&He||He&&typeof He=="object"&&He.providerID&&He.modelID)&&Ye(qt=>{const Bt={...qt,[Z.newSessionID]:He};return xt.current=Bt,Bt})}Ft.current=Z.newSessionID,Xn(Z.newSessionID),va(!0);return}if(Z.source==="server"){const He=Z.summary?Z.summary.substring(0,200)+(Z.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${Z.deletedMessages} messages replaced, ${Z.summaryTokens||"?"} summary tokens`),He&&console.log("[SERVER-COMPACT] Summary: "+He),sn({source:"server",deletedMessages:Z.deletedMessages||0,summaryTokens:Z.summaryTokens||0,summary:He})}const we=Z.inPlace===!0,Le=!!_a.current[fe];we&&Le?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(It([]),In(He=>{if(!He[fe])return He;const vt={...He};return delete vt[fe],vt}),Nt(null),Ui(fe).then(()=>{requestAnimationFrame(()=>{Et.current&&Ft.current===fe&&Et.current.scrollToBottom()})}))}}),bn.on("banner.updated",ye=>{const Z=ye.properties||ye;!Z||!Z.sessionID||(Fi(fe=>{const we=fe[Z.sessionID]||[];if(we.some(He=>He.timestamp===Z.timestamp))return fe;const Le=[{url:Z.url,timestamp:Z.timestamp,prompt:Z.prompt,createdAt:new Date(Z.timestamp).toISOString()},...we];return{...fe,[Z.sessionID]:Le}}),Z.sessionID===Ft.current&&Me(null))}),bn.on("banner.progress",ye=>{const Z=ye.properties||ye;if(!Z||Z.sessionID!==Ft.current)return;const fe=Z.stage||"working";let we=fe;fe==="queued"?we="Banner queued":fe==="summarizing"?we="Banner: summarizing…":fe==="rendering"?we=Z.line?"Banner: "+Z.line.substring(0,80):"Banner: rendering…":fe==="saved"?we="Banner saved":fe==="error"?we="Banner error: "+(Z.message||"unknown"):fe==="skipped"&&(we="Banner skipped: "+(Z.reason||"")),Me({stage:fe,label:we,ts:Date.now()}),fe==="saved"&&Z.sessionID&&J_(Z.sessionID).then(Le=>{Le&&Array.isArray(Le.banners)&&Fi(He=>({...He,[Z.sessionID]:Le.banners}))}).catch(()=>{})}),bn.on("todo.updated",ye=>{const Z=ye.properties||ye;!Z||!Z.sessionID||(Array.isArray(Z.todos)?wa(fe=>({...fe,[Z.sessionID]:Z.todos})):Hh(Z.sessionID).then(fe=>{fe&&Array.isArray(fe.todos)&&wa(we=>({...we,[Z.sessionID]:fe.todos}))}).catch(()=>{}))}),bn.on("queue.updated",ye=>{const Z=ye.properties||ye;if(!Z||!Z.sessionID)return;const fe=Array.isArray(Z.items)?Z.items:[];Gr(we=>RY(we,Z.sessionID,fe)),Z.change&&Z.change.kind==="drain"&&Z.sessionID===Ft.current&&Et.current&&(Et.current.resetAutoScroll(),vr())}),bn.on("idle-injection.enabled",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||(ol(!0),aa(e("chat.idle_injection_enabled_toast"),"success"))}),bn.on("idle-injection.disabled",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||(ol(!1),aa(e("chat.idle_injection_disabled_toast"),"info"))}),bn.on("idle-injection.fired",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||aa(e("chat.idle_injection_fired_toast"),"success")}),bn.on("idle-injection.timeout",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||aa(e("chat.idle_injection_timeout_toast"),"warning")}),bn.on("scheduled-injection.fired",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||aa(e("scheduled_injection.fired_toast"),"success")}),bn.on("scheduled-injection.added",()=>{}),bn.on("scheduled-injection.removed",()=>{}),bn.on("prefill.fallback",ye=>{const Z=ye.properties||ye;!Z||Z.sessionID!==he||(ri({originalModel:Z.originalModel,fallbackModel:Z.fallbackModel,reason:Z.reason||"prefill_too_large"}),Qe.current&&clearTimeout(Qe.current),Qe.current=setTimeout(()=>{ri(null),Qe.current=null},15e3))}),bn.on("auth.device_code",ye=>{const Z=ye.properties||ye;Z.user_code&&Z.verification_uri&&zr({verification_uri:Z.verification_uri,user_code:Z.user_code,expires_in:Z.expires_in||300})})];return()=>{clearTimeout(Ae),wi.current!=null&&(clearTimeout(wi.current),wi.current=null),tn(),Zn.current=null,rs.current&&clearTimeout(rs.current),Qe.current&&(clearTimeout(Qe.current),Qe.current=null),ri(null),_n.forEach(ye=>ye()),bn.disconnect()}},[pe]),y.useEffect(()=>{if(!pe)return;const D=setTimeout(()=>{var J;(J=xe.current)==null||J.focus()},50);return()=>{clearTimeout(D)}},[pe]);function mo(D){jn(J=>{for(var ee=0;ee<J.length;ee++)if(J[ee].id===D.id)return J.map(se=>se.id===D.id?D:se);return[D,...J]})}const dl=y.useCallback(async()=>{try{const D=await $_();mo(D),Ft.current=D.id,Xn(D.id)}catch(D){Ue("Failed to create session: "+D.message)}},[]);Ge.current=dl;const Sn=y.useCallback(async D=>{var J;if(D!==Ft.current){Ft.current=D,Xn(D),Ue(null),va(!!_a.current[D]),Kr(null);try{const ee=await qh(D);if(Ft.current!==D)return;((J=ee==null?void 0:ee.status)==null?void 0:J.type)==="busy"&&va(!0),jn(se=>{var tn;if(!ee)return se;const he=se.findIndex(Mn=>Mn.id===D),Re=((tn=ee.time)==null?void 0:tn.updated)||0;if(he>=0){const Mn=se[he],zn=se.filter(Z=>Z.id!==D),_n={...ee,ui:{...ee.ui,...Mn.ui}},ye=zn.findIndex(Z=>{var fe;return(((fe=Z.time)==null?void 0:fe.updated)||0)<=Re});return zn.splice(ye<0?zn.length:ye,0,_n),zn}const Ae=se.findIndex(Mn=>{var zn;return(((zn=Mn.time)==null?void 0:zn.updated)||0)<=Re}),_t=[...se];return _t.splice(Ae<0?_t.length:Ae,0,ee),_t}),Ye(se=>{if(ee&&ee.model)return{...se,[D]:ee.model};if(se[D]){const he={...se};return delete he[D],he}return se})}catch(ee){console.error("Failed to fetch session status for session",D,ee)}}},[]),_c=y.useCallback(async D=>{try{await OM(D),NM(D),jn(J=>J.filter(ee=>ee.id!==D)),pe===D&&(Ft.current=null,Xn(null))}catch(J){Ue("Failed to delete: "+J.message)}},[pe]),fl=y.useCallback(async()=>{try{await PM(),await Ni(),await qi(),Ft.current=null,Xn(D=>D&&null)}catch(D){Ue("Failed to delete sessions: "+D.message)}},[Ni]),xo=y.useCallback(async(D,J)=>{try{await Ki(D,{title:J}),jn(ee=>ee.map(se=>se.id===D?{...se,title:J}:se))}catch(ee){Ue("Failed to rename: "+ee.message)}},[]),dd=y.useCallback(async D=>{try{const J=await IM(D);J&&J.title&&jn(ee=>ee.map(se=>se.id===D?{...se,title:J.title}:se))}catch(J){Ue("Failed to regenerate title: "+J.message)}},[]),[pl,As]=y.useState(null),hl=y.useCallback(D=>{As(D)},[]),Is=y.useCallback(async(D,J)=>{try{await Ki(D,{pinned:J}),jn(ee=>ee.map(se=>se.id===D?{...se,pinned:J}:se))}catch(ee){Ue("Failed to pin: "+ee.message)}},[]),fd=y.useCallback(async D=>{const J=pn.find(se=>se.id===D);if(!J||!J.parentSessionID)return;const ee=J.parentSessionID;try{await zM(D),jn(se=>se.map(he=>he.id===D?{...he,compactionPinned:!1}:he)),Ft.current=ee,Xn(ee)}catch(se){Ue("Failed to unpin: "+se.message)}},[pn]),Mp=y.useCallback(async(D,J)=>{try{await Ki(D,{archived:J}),!We.current&&J?(jn(ee=>ee.filter(se=>se.id!==D)),pe===D&&(Ft.current=null,Xn(null))):jn(ee=>ee.map(se=>se.id===D?{...se,archived:J}:se))}catch(ee){Ue("Failed to archive: "+ee.message)}},[pe]),Lp=y.useCallback(async({readOnly:D=!1}={})=>{if(!pe)return;let J,ee,se;if(jn(he=>{var Ae;const Re=he.find(_t=>_t.id===pe);return J=((Ae=Re==null?void 0:Re.ui)==null?void 0:Ae.hideThinking)??!1,ee=!J,se=Re==null?void 0:Re.ui,he.map(_t=>_t.id===pe?{..._t,ui:{..._t.ui,hideThinking:ee}}:_t)}),!D)try{await Ki(pe,{ui:{...se,hideThinking:ee}})}catch(he){console.error("Failed to persist hideThinking:",he),jn(Re=>Re.map(Ae=>Ae.id===pe?{...Ae,ui:{...Ae.ui,hideThinking:J}}:Ae)),Ue("Failed to save thinking visibility preference"+(he!=null&&he.message?": "+he.message:""))}},[pe]),pd=y.useCallback(async()=>{if(!pe)return;let D,J;jn(ee=>{var he;const se=ee.find(Re=>Re.id===pe);return D=((he=se==null?void 0:se.ui)==null?void 0:he.chatInput)==="hidden",J=se==null?void 0:se.ui,ee.map(Re=>Re.id===pe?{...Re,ui:{...Re.ui,chatInput:D?void 0:"hidden"}}:Re)});try{const ee={...J};D?delete ee.chatInput:ee.chatInput="hidden",await Ki(pe,{ui:ee})}catch(ee){console.error("Failed to persist chatInput:",ee),jn(se=>se.map(he=>he.id===pe?{...he,ui:{...he.ui,chatInput:D?"hidden":void 0}}:he)),Ue("Failed to save chat input visibility"+(ee!=null&&ee.message?": "+ee.message:""))}},[pe]),yo=y.useCallback(async D=>{try{await PL(D)}catch(J){Ue("Export failed: "+J.message)}},[]),Ms=y.useCallback(async D=>{try{const J=await FL(D);J&&J.id&&(await Ni(),Sn(J.id))}catch(J){Ue("Import failed: "+J.message)}},[Ni,Sn]),gl=y.useRef(!1);y.useEffect(()=>{if(!gl.current&&!(!Ei||pn.length===0)){gl.current=!0;var D=null,J=!1;try{var ee=new URLSearchParams(window.location.search);D=ee.get("session"),J=!!D}catch{}if(D||(D=B()),!!D){if(pn.some(function(se){return se.id===D})){Sn(D);return}qh(D).then(function(se){se&&se.id?Sn(D):J||V()}).catch(function(){J||V()})}}},[Ei,pn,Sn]),y.useEffect(()=>{function D(J){var ee=J.data;!ee||ee.type!=="navigate-session"||ee.sessionId&&Sn(ee.sessionId)}return window.addEventListener("message",D),function(){window.removeEventListener("message",D)}},[Sn]),y.useEffect(()=>{function D(){try{var ee=indexedDB.open("pave-sw",1);ee.onupgradeneeded=function(){ee.result.createObjectStore("pave-pending-nav")},ee.onsuccess=function(){var se=ee.result;if(!se.objectStoreNames.contains("pave-pending-nav")){se.close();return}var he=se.transaction("pave-pending-nav","readwrite"),Re=he.objectStore("pave-pending-nav"),Ae=Re.get("sessionId");Ae.onsuccess=function(){var _t=Ae.result;Re.delete("sessionId"),_t&&_t!==Ft.current&&Sn(_t)},he.oncomplete=function(){se.close()},he.onerror=function(){se.close()}},ee.onerror=function(){}}catch{}}function J(){document.visibilityState==="visible"&&(D(),setTimeout(D,500),setTimeout(D,1500))}return document.addEventListener("visibilitychange",J),function(){document.removeEventListener("visibilitychange",J)}},[Sn]);const wc=y.useCallback(async D=>{if(!pe)return;const J=ie.current,ee=(J[pe]||0)+1;J[pe]=ee;const se=xt.current[pe];Ye(he=>{const Re={...he};return D?Re[pe]=D:delete Re[pe],xt.current=Re,Re});try{const he=await Ki(pe,{model:D||null});if(J[pe]!==ee)return;he&&(typeof he.model=="string"&&he.model||he.model&&typeof he.model=="object"&&he.model.providerID&&he.model.modelID)?Ye(Re=>{const Ae={...Re,[pe]:he.model};return xt.current=Ae,Ae}):D||Ye(Re=>{const Ae={...Re};return delete Ae[pe],xt.current=Ae,Ae})}catch(he){if(J[pe]!==ee)return;Ye(Re=>{const Ae={...Re};return se!==void 0?Ae[pe]=se:delete Ae[pe],xt.current=Ae,Ae}),console.error("[ModelChange] PATCH failed for session",pe,he),Ue("Failed to update session model: "+he.message)}},[pe]),Sc=y.useCallback(async function(D,J){if(pe){var ee=je&&je.disabledSkills||[],se;J?se=ee.filter(function(he){return he!==D}):se=ee.concat([D]),jn(function(he){return he.map(function(Re){return Re.id===pe?{...Re,disabledSkills:se}:Re})});try{await Ki(pe,{disabledSkills:se})}catch(he){jn(function(Re){return Re.map(function(Ae){return Ae.id===pe?{...Ae,disabledSkills:ee}:Ae})}),console.error("[SkillToggle] PATCH failed:",he)}}},[pe,je]),Ec=y.useCallback(async function(){if(pe)try{var D=await w4(),J=D.skillDefaults||{},ee=await Zv(),se=[];(ee||[]).forEach(function(he){J[he.name]||se.push(he.name)}),jn(function(he){return he.map(function(Re){return Re.id===pe?{...Re,disabledSkills:se}:Re})}),await Ki(pe,{disabledSkills:se})}catch(he){console.error("[SkillToggle] Reset to defaults failed:",he)}},[pe]),Op=y.useCallback(D=>{jn(J=>J.map(ee=>ee.id===pe?{...ee,directory:D}:ee)),nc(!1)},[pe]),hd=y.useCallback(async()=>{const D=!ao.current;ao.current=D,Ts.current=Sa,ws(D);try{localStorage.setItem("pave-show-other-apps",D?"true":"false")}catch{}await qi()},[]),bo=y.useRef(null),Dp=y.useCallback(D=>{const J=typeof D=="string"?D:"";Np(J),ns.current=J,bo.current&&clearTimeout(bo.current),bo.current=setTimeout(()=>{qa.current=0,Ts.current=Sa,Ni({q:J}),qi(),sa()},250)},[]);y.useEffect(()=>()=>{bo.current&&clearTimeout(bo.current)},[]);const Nc=y.useCallback(async()=>{const D=!We.current;We.current=D,await Ni({includeArchived:D})?(Ne(D),await Promise.all([sa(),qi()])):We.current=!D},[sa,qi]),Ci=y.useCallback(async(D,J,ee,se,he,Re,Ae)=>{const _t=D===Ft.current;Re&&_t&&It(qn=>qn.filter(Wi=>Wi.info.id!==Re));var tn=(ee?ee.length:0)+(Ae?Ae.length:0);if(tn>zf)throw Ue("Too many attachments. Maximum "+zf+" per message."),new Error("Too many attachments");var Mn=[],zn=0;if(ee&&ee.length>0){for(var _n=0;_n<ee.length;_n++){var ye=(ee[_n].file.type||"").toLowerCase();if(sp.indexOf(ye)===-1)throw Ue('Unsupported image type: "'+ee[_n].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(ee[_n].file.size>R2){var Z=Math.round(ee[_n].file.size/1024/1024*10)/10,fe=Math.round(R2/1024/1024*10)/10;throw Ue('Image "'+ee[_n].name+'" ('+Z+"MB) exceeds the "+fe+"MB size limit."),new Error("Image too large")}zn+=ee[_n].file.size}if(zn>M2){var we=Math.round(zn/1024/1024*10)/10,Le=Math.round(M2/1024/1024*10)/10;throw Ue("Combined image size ("+we+"MB) exceeds the "+Le+"MB total image limit."),new Error("Combined image size too large")}try{Mn=await Promise.all(ee.map(function(qn){return new Promise(function(Wi,Mr){var yr=new FileReader;yr.onload=function(){if(typeof yr.result!="string"){Mr(new Error("FileReader did not produce a data URL for: "+qn.name));return}Wi({type:"image_url",image_url:{url:yr.result}})},yr.onerror=function(){Mr(new Error("Failed to read file: "+qn.name))},yr.readAsDataURL(qn.file)})}))}catch(qn){throw Ue("Failed to read image: "+qn.message),qn}}var He=[],vt=0;if(Ae&&Ae.length>0){for(var qt=0;qt<Ae.length;qt++){var Bt=(Ae[qt].file.type||"").toLowerCase();if(FR.indexOf(Bt)===-1)throw Ue('Unsupported file type: "'+Ae[qt].name+'" ('+(Bt||"unknown")+")."),new Error("Unsupported file type");if(Ae[qt].file.size>A2){var Jt=Math.round(Ae[qt].file.size/1024/1024*10)/10,En=Math.round(A2/1024/1024*10)/10;throw Ue('File "'+Ae[qt].name+'" ('+Jt+"MB) exceeds the "+En+"MB size limit."),new Error("File too large")}vt+=Ae[qt].file.size}if(zn+vt>I2){var dn=Math.round((zn+vt)/1024/1024*10)/10,Hn=Math.round(I2/1024/1024*10)/10;throw Ue("Combined attachment size ("+dn+"MB) exceeds the "+Hn+"MB total limit."),new Error("Combined attachment size too large")}try{He=await Promise.all(Ae.map(function(qn){return new Promise(function(Wi,Mr){var yr=new FileReader;yr.onload=function(){if(typeof yr.result!="string"){Mr(new Error("FileReader did not produce a data URL for: "+qn.name));return}Wi({type:"file",mime:qn.file.type,filename:qn.name,url:yr.result})},yr.onerror=function(){Mr(new Error("Failed to read file: "+qn.name))},yr.readAsDataURL(qn.file)})}))}catch(qn){throw Ue("Failed to read file: "+qn.message),qn}}const Gn="temp-"+Date.now();for(var yl=[{id:Gn+"-text",type:"text",text:he}],Ds=0;Ds<Mn.length;Ds++)yl.push({id:Gn+"-img-"+Ds,type:"image_url",image_url:Mn[Ds].image_url});for(var ls=0;ls<He.length;ls++)yl.push({id:Gn+"-file-"+ls,type:"file",mime:He[ls].mime,filename:He[ls].filename});const gd={info:{id:Gn,sessionID:D,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:yl};It(qn=>_t?[...qn,gd]:qn),_t&&Et.current&&(Et.current.resetAutoScroll(),vr()),ut(D,!0),Se.current.set(D,{text:he,tempId:Gn});const _o=ac.current[D]??null,Rc=oc.current[D]??"max",Wa=_o===null&&!co.current.has(D),bl=Xu.current[D],md=Wa&&bl?bl.moe_topk||null:_o;try{var Ps=null;(Mn.length>0||He.length>0)&&(Ps=He.concat(Mn)),await V_(D,J,Ps,xt.current[D]||void 0,se,{moeTopK:md,reasoningEffort:Rc,adaptiveQuality:Wa})}catch(qn){if(AY(qn))if(f4(Mn,He)){const Mr=Gn;ai.current[D]||(ai.current[D]=[]),ai.current[D].push({content:J,imageAttachments:ee,fileAttachments:Ae,agent:se,displayContent:he,queuedTempId:Mr}),zi(D),ut(D,!1);return}else try{await G_(D,J,{displayContent:he,agent:se||void 0,model:xt.current[D]||void 0,moeTopK:md,reasoningEffort:Rc,adaptiveQuality:Wa}),It(Mr=>Mr.filter(yr=>yr.info.id!==Gn)),ut(D,!1);return}catch(Mr){throw Ue("Failed to queue message: "+Mr.message),ut(D,!1),It(yr=>yr.filter(xd=>xd.info.id!==Gn)),Mr}if(qn&&qn.reauthRequired){Ue("Session expired. Please log in again."),De(null),ut(D,!1),It(Wi=>Wi.filter(Mr=>Mr.info.id!==Gn));return}throw Ue("Failed to send: "+qn.message),ut(D,!1),It(Wi=>Wi.filter(Mr=>Mr.info.id!==Gn)),qn}},[zi,vr]),ml=y.useRef(Ci);y.useEffect(()=>{ml.current=Ci},[Ci]);const si=y.useCallback(async(D,J,ee,se)=>{Ue(null),Br.length>0&&(D=pz(Br,D));const he=D,Re=D.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Re){const _n=Re[1],ye=Re[2],Z=Re[3]||"",fe=Z||_n+" "+ye,we=(_n+"_"+ye).replace(/-/g,"_").slice(0,128);D="[SKILL_HINT: User explicitly requested "+_n+"."+ye+(Z?" with args: "+Z:"")+". Call the "+we+` tool with these parameters.]
|
|
128
|
-
|
|
129
|
-
`+fe}let Ae=Ft.current;if(!Ae)try{const _n=await $_();mo(_n),Ft.current=_n.id,Xn(_n.id),Ae=_n.id,await new Promise(ye=>setTimeout(ye,200))}catch(_n){throw Ue("Failed to create session: "+_n.message),_n}if(!!ta[Ae]){if(!f4(J,se)){try{await G_(Ae,D,{displayContent:he,agent:ee||void 0,model:xt.current[Ae]||void 0})}catch(we){Ue("Failed to queue message: "+we.message)}return}const ye="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Z=[{id:ye+"-text",type:"text",text:he}];if(J&&J.length>0)for(var tn=0;tn<J.length;tn++){var Mn=J[tn].preview||"";Z.push({id:ye+"-img-"+tn,type:"image_url",image_url:{url:Mn}})}if(se&&se.length>0)for(var zn=0;zn<se.length;zn++)Z.push({id:ye+"-file-"+zn,type:"file",mime:se[zn].file.type,filename:se[zn].name});const fe={info:{id:ye,sessionID:Ae,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Z};It(we=>[...we,fe]),Ae===Ft.current&&Et.current&&(Et.current.resetAutoScroll(),vr()),ai.current[Ae]||(ai.current[Ae]=[]),ai.current[Ae].push({content:D,imageAttachments:J,agent:ee,displayContent:he,queuedTempId:ye,fileAttachments:se}),zi(Ae),ki([]);return}await Ci(Ae,D,J,ee,he,null,se),ki([])},[ta,Ci,zi,vr,Br]);y.useEffect(()=>{const D=()=>{si(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",D),()=>window.removeEventListener("pave:plan-execute",D)},[si,e]);const oa=y.useCallback(async()=>{if(pe)try{const D=pe;bc.current.add(D),await qM(D),ut(D,!1),Nt(null)}catch(D){console.error("Abort failed:",D),Ue("Failed to stop: "+(D&&D.message?D.message:String(D)))}},[pe,ut]),vo=y.useCallback(async(D,J,ee)=>{if(Ue(null),D==="btw"){const se=Ft.current;if(!se){Ue("No active session to fork.");return}let he;try{he=await LM(se)}catch(Ae){throw Ue("Fork failed: "+(Ae&&Ae.message?Ae.message:String(Ae))),Ae}if(!he||!he.id)throw Ue("Fork failed: server returned no session id."),new Error("Fork returned no session");mo(he),Ft.current=he.id,Xn(he.id),await new Promise(Ae=>setTimeout(Ae,200));const Re=(J||"").trim();if(Re)try{await si(Re,ee&&ee.imageAttachments?ee.imageAttachments:void 0,void 0,ee&&ee.fileAttachments?ee.fileAttachments:void 0)}catch{}return}if(D==="compact"){const se=Ft.current;if(!se){Ue("No active session to compact.");return}Ue(null),Kr({reason:"manual",stage:"starting"}),sn(null),BM(se).then(he=>{if(!he||!he.success){Kr(null),Ue("Compaction failed: "+(he&&he.error||"unknown error"));return}Ui(se),Kr(null),sn(null)}).catch(he=>{Kr(null),he&&he.status===409?Ue("Cannot compact while the session is busy. Wait for the current response to finish."):Ue("Compaction failed: "+(he&&he.message?he.message:String(he)))});return}Ue("Unknown built-in command: /"+D)},[si]),Ea=y.useCallback(D=>{zt(J=>J.filter(ee=>ee.id!==D))},[]),Cc=y.useCallback(async()=>{for(var D=mt.length-1;D>=0;D--)if(mt[D].info.role==="user"){var J=mt[D].parts||[],ee=Lk(J,null),se=J.filter(function(Ae){return Ae.type==="image_url"&&Ae.image_url});if(ee.trim()||se.length>0)if(se.length>0){var he=pe;if(!he)break;ut(he,!0),Ue(null);try{var Re=se.map(function(Ae){return{type:"image_url",image_url:Ae.image_url}});await V_(he,ee.trim(),Re,xt.current[he]||void 0)}catch(Ae){Ue("Failed to retry: "+Ae.message),ut(he,!1)}}else try{await si(ee.trim())}catch(Ae){Ue("Failed to retry: "+Ae.message),ut(pe,!1)}break}},[mt,si,pe]),Pp=y.useCallback(async function(D){if(D&&D.trim()){Ue(null),Et.current&&Et.current.resetAutoScroll();try{await si(D.trim()),vr()}catch(J){Ue("Failed to resend: "+J.message),ut(pe,!1)}}},[si,vr]),Hi=y.useMemo(()=>je?je.source==="archive"||je._readOnly===!0:!1,[je]),$i=y.useMemo(()=>je?je._readOnly===!0&&je.source!=="tui"&&je.source!=="archive":!1,[je]),os=y.useMemo(()=>{if(!$i||!je||!pn)return null;for(const D of pn)if(D.parentSessionID===je.id)return D.id;return null},[$i,je,pn]),Ls=y.useMemo(()=>{var ee;let D=null;for(let se=mt.length-1;se>=0;se--)if(((ee=mt[se].info)==null?void 0:ee.role)==="assistant"){D=mt[se];break}if(!D)return[];const J=(D.parts||[]).filter(se=>se.type==="tool");return J.length===0?[]:!ni&&J.every(he=>{var Re,Ae;return((Re=he.state)==null?void 0:Re.status)==="completed"||((Ae=he.state)==null?void 0:Ae.status)==="error"})?[]:J},[mt,ni]),xl=y.useMemo(()=>{var J;const D=[];for(const ee of mt)if(((J=ee.info)==null?void 0:J.role)==="assistant"){const se=(ee.parts||[]).filter(he=>he.type==="tool");D.push(...se)}return D},[mt]),Ha=y.useRef(0),[Os,la]=y.useState(!1),Jn=y.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),Ha.current++,Ha.current===1){const J=D.dataTransfer;let ee=!1;J&&J.items&&J.items.length>0&&(ee=Array.from(J.items).some(se=>se.kind==="file")),ee&&la(!0)}},[]),Yn=y.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ha.current=Math.max(0,Ha.current-1),Ha.current===0&&la(!1)},[]),$a=y.useCallback(D=>{D.preventDefault(),D.stopPropagation()},[]),qr=y.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ha.current=0,la(!1);const J=D.dataTransfer&&D.dataTransfer.files;if(!J||J.length===0)return;const ee=J[0],se=ee.name.toLowerCase();if(!se.endsWith(".yaml")&&!se.endsWith(".yml")){Ue(e("import.invalid_file_type"));return}const he=10*1024*1024;if(ee.size>he){Ue(e("import.file_too_large"));return}const Re=new FileReader;Re.onload=Ae=>{const _t=Ae&&Ae.target?Ae.target.result:null;if(typeof _t!="string"){Ue(e("import.read_error"));return}Ms(_t)},Re.onerror=()=>{Ue(e("import.read_error"))},Re.readAsText(ee)},[Ms,Ue,e]);if(kt)return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:i.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!ze)return i.jsx(_q,{darkMode:t,onToggleTheme:()=>n(!t)});const Qr=je==null?void 0:je.title,ca=typeof Qr=="string"?Qr.trim():"",ua=((ko=je==null?void 0:je.ui)==null?void 0:ko.hideThinking)??!1,Ir=((jc=je==null?void 0:je.ui)==null?void 0:jc.chatInput)==="hidden";return i.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:Jn,onDragLeave:Yn,onDragOver:$a,onDrop:qr,children:[Os&&i.jsx("div",{className:"fixed inset-0 z-50 bg-primary-500/20 dark:bg-primary-400/20 border-4 border-dashed border-primary-500 dark:border-primary-400 flex items-center justify-center pointer-events-none",children:i.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:i.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),i.jsxs("header",{className:"flex items-center justify-between px-4 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:wr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-8"}),i.jsx("h1",{className:"sr-only",children:"PAVE"}),nt&&i.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",nt]})]}),ue==="chat"&&pe&&i.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:je&&je.title||e("sidebar.untitled"),children:je&&je.title||e("sidebar.untitled")}),i.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[i.jsx("button",{onClick:()=>be("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ue==="chat"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.chat_tab")}),i.jsx("button",{onClick:()=>be("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ue==="skills"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.skills_tab")}),i.jsx("button",{onClick:()=>be("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ue==="settings"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.settings_tab")}),fc&&i.jsx("button",{"data-testid":"nav-triggers-tab",onClick:()=>be("triggers"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ue==="triggers"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.triggers_tab")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[wt&&i.jsx("button",{onClick:()=>Wt(D=>!D),className:`p-1.5 rounded-lg transition-colors ${$t?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:"Inspector — replay EPM requests/responses & context internals","aria-label":"Inspector","aria-pressed":$t,children:i.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),i.jsx("button",{onClick:()=>j(!T),className:`p-1.5 rounded-lg transition-colors ${T?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(T?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(T?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),pe&&ue==="chat"&&i.jsx("button",{onClick:Y,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${W?"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400"}`,title:e("app.toggle_right_pane",{shortcut:tt?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:tt?"Cmd+J":"Ctrl+J"}),"aria-pressed":W,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})})}),i.jsx(uM,{darkMode:t,onToggle:()=>n(!t)}),ze&&i.jsx(wq,{user:ze,onLogout:xn,onSkillManagement:()=>be("skills"),onPricingSettings:()=>me(!0),onDlpSettings:()=>gt(!0),onSettings:()=>be("settings"),onBoard:ll?()=>be("board"):void 0,onCapabilities:is?()=>be("capabilities"):void 0})]})]}),ue==="skills"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(PV,{onBack:()=>be("chat")})}):ue==="board"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(HV,{onBack:()=>be("chat")})}):ue==="capabilities"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(tG,{onBack:()=>be("chat")})}):ue==="triggers"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(uG,{onBack:()=>be("chat")})}):ue==="settings"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(sK,{onBack:()=>be("chat"),onOpenDlpSettings:()=>gt(!0),onOpenPricingSettings:()=>me(!0),activeSessionId:pe,mobileFrameless:L,onMobileFramelessChange:A})}):i.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[i.jsx(SM,{sessions:ud,activeSessionId:pe,busySessions:ta,onSelectSession:D=>{Sn(D),window.innerWidth<768&&$e(!1)},onNewChat:dl,onDeleteSession:_c,onDeleteAllSessions:fl,onRenameSession:xo,onRegenerateTitle:dd,onPinSession:Is,onArchiveSession:Mp,onExportSession:yo,onSendToSession:hl,onImportSession:Ms,onImportError:D=>Ue(D),showArchived:Tt,onToggleShowArchived:Nc,isOpen:Pe,onClose:()=>$e(!1),onToggle:()=>$e(D=>!D),hasMoreSessions:sr,onLoadMoreSessions:Ap,showOtherApps:ii,onToggleShowOtherApps:hd,hasMoreOtherApps:ld,onLoadMoreOtherApps:kc,otherAppsCount:ho.length,search:so,onSearchChange:Dp,loadedCount:pn.length,totalCount:el,sidebarWidth:P,onSidebarWidthChange:K}),i.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:pe?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 px-3 py-1.5 border-b border-gray-100 dark:border-gray-800/50 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(uV,{sessionModel:at.has(pe)?"epm/privacy":Ce[pe]||null,activeModel:Rn,registryEntries:lt,onModelChange:wc,disabled:ni||at.has(pe),lockedReason:at.has(pe)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},pe),ca?i.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:ca,children:ca}):null,i.jsx("button",{onClick:()=>nc(!0),className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:e("chat.working_directory"),"aria-label":e("chat.working_directory"),disabled:Hi,children:i.jsx(uI,{className:"w-4 h-4"})}),i.jsx(pV,{sessionId:pe,disabledSkills:je?je.disabledSkills:[],onToggle:Sc,onResetToDefaults:Ec,t:e,disabled:Hi}),i.jsx("button",{onClick:()=>Vu(!0),className:`p-1.5 rounded-lg transition-colors ${Ku?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("chat.idle_injection_title"),"aria-label":e("chat.idle_injection_title"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),Te&&i.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.moe_tooltip"),children:[{val:null,label:"Auto"},{val:8,label:"Quality"},{val:6,label:"Balanced"},{val:4,label:"Fast"}].map(D=>{const J=cc===null&&uc&&!co.current.has(pe)&&uc.moe_topk===D.val,ee=cc===D.val;return i.jsx("button",{onClick:()=>{D.val===null?co.current.delete(pe):co.current.add(pe),Yu(se=>({...se,[pe]:D.val})),Ki(pe,{moe_top_k:D.val}).catch(()=>{})},disabled:Hi,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${ee?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":J?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 ring-1 ring-blue-400 dark:ring-blue-600":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:D.label},D.label)})}),i.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.reasoning_tooltip"),children:[{val:"max",label:e("chat.reasoning_max")},{val:"high",label:e("chat.reasoning_high")},{val:"off",label:e("chat.reasoning_off")}].map(D=>i.jsx("button",{onClick:()=>{Qu(J=>({...J,[pe]:D.val})),Ki(pe,{reasoning_effort:D.val}).catch(()=>{})},disabled:Hi,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${Zu===D.val?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:D.label},D.val))})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>Lp({readOnly:Hi}),className:`p-1.5 rounded-lg transition-colors ${ua?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-amber-500/10 text-amber-600 dark:text-amber-400"}`,title:e(ua?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(ua?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!ua,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),i.jsx("button",{onClick:()=>pd(),className:`p-1.5 rounded-lg transition-colors ${Ir?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-amber-500/10 text-amber-600 dark:text-amber-400"}`,title:e(Ir?"chat.show_chat_input":"chat.hide_chat_input"),"aria-label":e(Ir?"chat.show_chat_input":"chat.hide_chat_input"),"aria-pressed":!Ir,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"})})}),dc&&i.jsx("button",{onClick:async()=>{if(pe)try{await $L(pe),Ue("Banner generation queued (~2 min)"),setTimeout(()=>Ue(null),4e3)}catch(D){Ue(`Banner: ${D.message||D}`)}},disabled:!pe,className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Generate session banner now","aria-label":"Generate session banner now",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),dc&&i.jsx("button",{onClick:G,className:`p-1.5 rounded-lg transition-colors ${z?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}`,title:z?"Show banner":"Hide banner","aria-label":z?"Show banner":"Hide banner","aria-pressed":!z,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:z?i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"}):i.jsxs(i.Fragment,{children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})}),de?i.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${de.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":de.stage==="saved"?"text-green-600 dark:text-green-400 bg-green-500/10":"text-gray-500 dark:text-gray-400 bg-gray-500/10"}`,title:de.label,children:de.label}):null,i.jsx("button",{onClick:()=>Ns(D=>!D),className:`p-1.5 rounded-lg transition-colors lg:hidden ${Es?"bg-primary-500/10 text-primary-600 dark:text-primary-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("app.activities_panel"),"aria-label":e("app.activities_panel"),"aria-expanded":Es,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),i.jsx("button",{onClick:()=>yo(pe),className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:e("sidebar.export"),"aria-label":e("sidebar.export"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),i.jsx("button",{onClick:()=>{nl(D=>!D),Ss&&(il(""),ia(0),al(0))},className:`p-1.5 rounded-lg transition-colors ${Ss?"bg-primary-500/10 text-primary-600 dark:text-primary-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("app.search_messages"),"aria-label":e("app.search_messages"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),Ss&&i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 shrink-0",children:[i.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:rl,onChange:D=>{il(D.target.value),ia(0)},autoFocus:!0,className:"flex-1 bg-transparent text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-hidden"}),rl&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 shrink-0 tabular-nums",children:Bi>0?e("app.match_count",{current:oo+1,total:Bi}):e("app.no_matches")}),rl&&Bi>0&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>ia(D=>(D-1+Bi)%Bi),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.previous_match"),"aria-label":e("app.previous_match"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),i.jsx("button",{onClick:()=>ia(D=>(D+1)%Bi),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.next_match"),"aria-label":e("app.next_match"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),i.jsx("button",{onClick:()=>{nl(!1),il(""),ia(0),al(0)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.close_search"),"aria-label":e("app.close_search"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!Jl&&i.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),i.jsx("span",{children:e("app.reconnecting")})]}),Ht&&i.jsxs("div",{className:"px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border-b border-red-200 dark:border-red-800 flex items-center justify-between",children:[i.jsx("span",{children:Ht}),i.jsx("button",{onClick:()=>Ue(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),sl&&i.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${sl.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":sl.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800"}`,children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{children:sl.text})]}),_i&&i.jsx("div",{className:"px-4 py-3 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 text-sm border-b border-blue-200 dark:border-blue-800",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),i.jsxs("div",{className:"mt-1",children:[i.jsx("a",{href:_i.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:_i.verification_uri})," ","— ",i.jsx("span",{className:"font-mono font-bold text-base select-all",children:_i.user_code})]}),i.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),i.jsx("button",{onClick:()=>zr(null),className:"ml-2 text-blue-400 hover:text-blue-600 shrink-0","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),un&&i.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Server busy (429) — retry ",un.attempt,"/",un.maxRetries,un.maxDurationMs>0&&un.elapsedMs>0&&i.jsxs(i.Fragment,{children:[" (",Math.round(un.elapsedMs/1e3),"s / ",Math.round(un.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(un.delayMs/1e3),"s. Click Stop to cancel."]}),i.jsx("button",{onClick:()=>{Ut(null),ir.current&&(clearTimeout(ir.current),ir.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),na&&i.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M5 19h14a2 2 0 001.84-2.75L13.74 4a2 2 0 00-3.48 0L3.16 16.25A2 2 0 005 19z"})}),"Model fallback: ",na.fallbackModel," (local model unavailable)"]}),i.jsx("button",{onClick:()=>{ri(null),Qe.current&&(clearTimeout(Qe.current),Qe.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsx(Bz,{ref:Et,messages:mt,unloadedCompactedCount:gn,onExpandCompactedHistory:pe?()=>go(pe):void 0,hasOlderMessages:Wn,loadingOlderMessages:Er,onLoadOlderMessages:pe?()=>Ip(pe):void 0,streamingParts:kn[pe]||{},streamingProgress:Oe,isBusy:ni,compactingInfo:Nr,compactionResult:Vn,onSwitchToCompactedSession:D=>{Ft.current=D,Xn(D),sn(null)},onDismissCompactionResult:()=>sn(null),parentSessionID:je&&je.parentSessionID,compactionPinned:je&&je.compactionPinned,onUnpinCompaction:fd,onViewParentSession:D=>{Ft.current=D,Xn(D),jn(function(J){return J.map(function(ee){return ee.id===D?{...ee,_readOnly:!0}:ee})})},user:ze,searchQuery:rl,activeMatchIndex:oo,onTotalMatchesChange:al,onRetry:Hi?void 0:Cc,onEditAndResend:Hi?void 0:Pp,onCancelQueued:Hi?void 0:vc,hackerMode:T,mobileFrameless:L,hideThinking:ua,sessionID:pe,banners:(dc?es[pe]:null)||[],bannerHidden:z,onToggleBanner:G,privateMessageIds:Xe,questionIdMap:St,onQuoteAdd:Ji}),i.jsx(IK,{rect:pi&&pi.rect,label:e("chat.quote_selection"),copyLabel:e("chat.copy_selection"),onCopy:function(){Ba()},onQuote:function(){pi&&Ji(pi),ea()},onDismiss:ea}),(gi[pe]||[]).length>0&&i.jsx(AK,{items:gi[pe]||[],sessionId:pe,isReadOnly:Hi,onReorder:function(D){FM(pe,D).catch(function(J){Ue("Failed to reorder: "+J.message)})},onCancelItem:function(D){K_(pe,D).catch(function(J){Ue("Failed to cancel: "+J.message)})},onEditItem:function(D){if(!(D.status==="dispatching"||Hi)){K_(pe,D.id).catch(function(){});var J=D.displayContent||D.text||"";J&&xe.current&&typeof xe.current.setText=="function"&&xe.current.setText(J)}},t:e}),Hi?i.jsx(q2,{variant:$i?"compacted":je&&je.source==="archive"?"archive":"terminal",label:$i?e("chat.compacted_switch_to_new")||"Compacted — switch to new session":je&&je.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal"),childSessionId:$i?os:null,onSwitchToChild:()=>{Ft.current=os,Xn(os)}}):((Tc=je==null?void 0:je.ui)==null?void 0:Tc.chatInput)==="hidden"?i.jsx(q2,{variant:"monitor",label:e("chat.monitor_only")}):i.jsx(pq,{ref:xe,sessionId:pe,onSend:si,onBuiltinCommand:vo,onAbort:oa,isBusy:ni,pendingQuotes:Br,onRemoveQuote:Kn,onClearQuotes:_s,queuedCount:xc+(gi[pe]||[]).length})]}):i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[i.jsx("img",{src:wr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-16 mb-4"}),i.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),i.jsx("button",{onClick:dl,className:"py-2 px-6 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:e("app.new_chat")})]})}),pe&&i.jsxs("aside",{ref:tc,style:{width:Q},className:`border-l hidden ${W?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${T?t?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[i.jsx(cY,{width:Q,min:hI,max:gI,edge:"left",onCommit:H,getPaneEl:()=>tc.current,ariaLabel:e("app.resize_terminal"),className:T?t?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}),!Es&&gc()]}),Es&&pe&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>Ns(!1)}),i.jsxs("div",{id:"activities-panel-dialog",className:"fixed top-14 right-0 bottom-0 w-80 max-w-[85vw] bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800 z-40 lg:hidden flex flex-col shadow-xl",role:"dialog","aria-modal":"true","aria-labelledby":"activities-panel-heading",tabIndex:-1,onKeyDown:D=>{(D.key==="Escape"||D.key==="Esc")&&(D.stopPropagation(),Ns(!1))},ref:ec,children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),i.jsx("button",{onClick:()=>Ns(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors","aria-label":e("app.close_activities"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),gc()]})]})]}),qe&&i.jsx(cK,{onClose:()=>me(!1)}),pt&&i.jsx(hK,{onClose:()=>gt(!1)}),wt&&i.jsx(sY,{open:$t,onClose:()=>Wt(!1),activeSessionId:pe,activeSessionTitle:ca}),i.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:i.jsx(xK,{requests:Je,onDismiss:Ea})}),i.jsx(bK,{open:fr,onClose:()=>Yr(!1),upgradeUrl:mr}),i.jsx(o3,{open:pl!==null,onClose:()=>As(null),senderSessionID:pl}),i.jsx(jK,{isOpen:Cp,onClose:()=>nc(!1),sessionId:pe,currentDirectory:(je==null?void 0:je.directory)||"",homeDir:jp,onDirectoryChange:Op,session:je}),i.jsx(RK,{isOpen:rc,onClose:()=>Vu(!1),sessionId:pe}),i.jsx(_K,{isOpen:oe,onClose:()=>{ae(!1),setTimeout(()=>{var D;return(D=xe.current)==null?void 0:D.focus()},0)},onSelectSession:D=>{Sn(D)},onNewChat:()=>{typeof Ge.current=="function"&&Ge.current()},activeSessionId:pe,sessions:pn,busySessions:ta}),i.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ce})]})}const MY=cM();iM.createRoot(document.getElementById("root")).render(i.jsx(Lt.StrictMode,{children:i.jsx(lM,{initialLocale:MY,children:i.jsx(pM,{children:i.jsx(IY,{})})})}));export{g4 as _,$o as g,qW as p};
|