@cnrai/pave 0.11.119 → 0.11.120
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/web/assets/{abnfDiagram-VCTEODGH-Cy0FMT8v.js → abnfDiagram-VCTEODGH-CQun3ogE.js} +1 -1
- package/web/assets/architectureDiagram-5GKGNRK7-oVzTvsb3.js +36 -0
- package/web/assets/{blockDiagram-I7D4REHJ-BGB31XYl.js → blockDiagram-I7D4REHJ-CDZzuTZC.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-BaTB0qVN.js → c4Diagram-7LVT6UL2-Bm0ktuXG.js} +1 -1
- package/web/assets/channel-Bh7-m1e5.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-5VZx1LU6.js → chunk-2Q5K7J3B-CHcyUt1N.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-DuMaH8uD.js → chunk-5VM5RSS4-ClYGp-Qm.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-ggoWV0gJ.js → chunk-F27PBJKO-BQy_jioc.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-IIoMeeLm.js → chunk-IMKFNOWR-DG0JVHzQ.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-byKDbXzn.js → chunk-JWPE2WC7-g7KSFoMi.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-C6AQdNDO.js → chunk-POPQ4Y6H-ChMbm-k_.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-C-5cV70J.js → chunk-SVP7TREG-JNsMB-yr.js} +4 -4
- package/web/assets/{chunk-TICWLB2K-BONlrmZq.js → chunk-TICWLB2K--tiq0iAk.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-CrOrFLeE.js → chunk-XXDRQBXY-BpM1cyP1.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-vlrlRtwo.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-vlrlRtwo.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-CmljJJEJ.js → cose-bilkent-JH36ORCC-DNoCqFjg.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-7Qtt21YP.js → cynefin-OW5HDTMX-DXHBAtGJ.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-DxqZpyGR.js → cynefinDiagram-5FMLGOSQ-DFvR6u8N.js} +2 -2
- package/web/assets/d3-scale-4DPf7zan.js +1 -0
- package/web/assets/{dagre-GXQ25YYZ-BL7U9TXO.js → dagre-GXQ25YYZ-BtdtVnNL.js} +2 -2
- package/web/assets/{diagram-S7CK7UJ4-kq53HXrQ.js → diagram-S7CK7UJ4-DTBDTeWr.js} +4 -4
- package/web/assets/diagram-UQ7AKVKN-WsABo8v9.js +41 -0
- package/web/assets/{diagram-VSXAHHWV-Lt5a1Qri.js → diagram-VSXAHHWV-PfPn8q7Y.js} +3 -3
- package/web/assets/diagram-VX7I27RA-BgImaOA7.js +24 -0
- package/web/assets/{diagram-Z3DM3KII-Dhj1WGQr.js → diagram-Z3DM3KII-BhPC3EPH.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-DZmfK0ER.js → ebnfDiagram-PWID7BFC-MZXRKqfj.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-J8EphrWK.js → erDiagram-RLTQ6QDP-B0d0Nnu_.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-COyBJLfP.js → flowDiagram-HODETNUW-Cy4qmeb0.js} +4 -4
- package/web/assets/ganttDiagram-EL5Y4UJY-Djww1Rba.js +292 -0
- package/web/assets/{gitGraphDiagram-WWUBYQGX-BFMzAa8R.js → gitGraphDiagram-WWUBYQGX-8Tak7xqH.js} +1 -1
- package/web/assets/index-Bt1QpYqk.js +132 -0
- package/web/assets/index-DdEADc8n.css +10 -0
- package/web/assets/{infoDiagram-27XIBGKW-B0VZh3Cg.js → infoDiagram-27XIBGKW-DkaHqIdq.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-BELx0FR2.js → ishikawaDiagram-5VMMS53U-ay7785S2.js} +3 -3
- package/web/assets/{journeyDiagram-3NMN7TZE-CUAJIh2b.js → journeyDiagram-3NMN7TZE-Be1Bgc8E.js} +6 -6
- package/web/assets/{kanban-definition-UXKFOSKX-DovK08HT.js → kanban-definition-UXKFOSKX-Uv5UoCff.js} +7 -7
- package/web/assets/{layout-Bskhkyv5.js → layout-DVsJ-C6t.js} +1 -1
- package/web/assets/mermaid.core-CfJk9oqB.js +310 -0
- package/web/assets/{mindmap-definition-YA3MSWOX-C_8fi_h8.js → mindmap-definition-YA3MSWOX-CEjjKmq_.js} +4 -4
- package/web/assets/{pegDiagram-XKGWAZYB-DQgUieRG.js → pegDiagram-XKGWAZYB-CCbGN7im.js} +1 -1
- package/web/assets/pieDiagram-E7YTZNPT-DSbIEsvX.js +39 -0
- package/web/assets/{quadrantDiagram-AXDQQJYC-BUBV4AXR.js → quadrantDiagram-AXDQQJYC-NH55I-VQ.js} +2 -2
- package/web/assets/{railroadDiagram-O6MQD6OU-FOFi7cPV.js → railroadDiagram-O6MQD6OU-DrY5l5qz.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-DdhHxUze.js → requirementDiagram-BXWQKSXE-DnEzj3DN.js} +1 -1
- package/web/assets/sankeyDiagram-P5KCCOFB-Deb4JoPN.js +40 -0
- package/web/assets/{sequenceDiagram-WJ2MYXX4-DOUkp_Hw.js → sequenceDiagram-WJ2MYXX4-BilBA3A_.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-B-EXES5m.js → sizeCapture-INFHLROL-CT4uqGe1.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-DE0t8Vv8.js → stateDiagram-D77RDMKH-DMwGaAv4.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-Clsx447Y.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-FiGnHrZR.js → swimlanes-42K2YHIH-3uatewyx.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-Chk2E8QS.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-DqxypfQR.js → timeline-definition-24CTP7MA-Dj31t9Rm.js} +4 -4
- package/web/assets/{vennDiagram-4TSXK5OY-BDEA7Eeb.js → vennDiagram-4TSXK5OY-BoVPzNB_.js} +4 -4
- package/web/assets/{wardleyDiagram-VM6X3IG4-D_7_rEdL.js → wardleyDiagram-VM6X3IG4-BWMtHf0h.js} +3 -3
- package/web/assets/xychartDiagram-S5SC5T6Z-D8oU7JtR.js +7 -0
- package/web/assets/zh-TW-DDsaOGgA.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/arc-kJE6D1oE.js +0 -1
- package/web/assets/architectureDiagram-5GKGNRK7-K76ITJrD.js +0 -36
- package/web/assets/channel-ybnroZSU.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-DVpCWxGN.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-DVpCWxGN.js +0 -1
- package/web/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/web/assets/diagram-UQ7AKVKN-ChqT9cBv.js +0 -41
- package/web/assets/diagram-VX7I27RA-DLw6iF4f.js +0 -24
- package/web/assets/ganttDiagram-EL5Y4UJY-DTQCulp7.js +0 -292
- package/web/assets/index-BU4RL3Oc.js +0 -132
- package/web/assets/index-DvmXgMDn.css +0 -10
- package/web/assets/init-Gi6I4Gst.js +0 -1
- package/web/assets/linear-CyvGAyrR.js +0 -1
- package/web/assets/mermaid.core-CYiw0kXn.js +0 -310
- package/web/assets/ordinal-Cboi1Yqb.js +0 -1
- package/web/assets/pieDiagram-E7YTZNPT-Bmpmpxie.js +0 -39
- package/web/assets/sankeyDiagram-P5KCCOFB-6OaH9E7j.js +0 -40
- package/web/assets/stateDiagram-v2-MP3YSRHH-DDCRbnvH.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-CKmSn5Vi.js +0 -8
- package/web/assets/xychartDiagram-S5SC5T6Z-By-YodQ2.js +0 -7
- package/web/assets/zh-TW-BL_iUqM_.js +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)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(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Zd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qh={exports:{}},$c={},Xh={exports:{}},wn={};/**
|
|
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 Y_;function LM(){if(Y_)return wn;Y_=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=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"),h=Symbol.iterator;function m(Q){return Q===null||typeof Q!="object"?null:(Q=h&&Q[h]||Q["@@iterator"],typeof Q=="function"?Q:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(Q,J,F){this.props=Q,this.context=J,this.refs=k,this.updater=F||x}_.prototype.isReactComponent={},_.prototype.setState=function(Q,J){if(typeof Q!="object"&&typeof Q!="function"&&Q!=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,Q,J,"setState")},_.prototype.forceUpdate=function(Q){this.updater.enqueueForceUpdate(this,Q,"forceUpdate")};function w(){}w.prototype=_.prototype;function S(Q,J,F){this.props=Q,this.context=J,this.refs=k,this.updater=F||x}var N=S.prototype=new w;N.constructor=S,v(N,_.prototype),N.isPureReactComponent=!0;var j=Array.isArray,R=Object.prototype.hasOwnProperty,T={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function M(Q,J,F){var K,W={},H=null,se=null;if(J!=null)for(K in J.ref!==void 0&&(se=J.ref),J.key!==void 0&&(H=""+J.key),J)R.call(J,K)&&!I.hasOwnProperty(K)&&(W[K]=J[K]);var ie=arguments.length-2;if(ie===1)W.children=F;else if(1<ie){for(var ge=Array(ie),we=0;we<ie;we++)ge[we]=arguments[we+2];W.children=ge}if(Q&&Q.defaultProps)for(K in ie=Q.defaultProps,ie)W[K]===void 0&&(W[K]=ie[K]);return{$$typeof:e,type:Q,key:H,ref:se,props:W,_owner:T.current}}function L(Q,J){return{$$typeof:e,type:Q.type,key:J,ref:Q.ref,props:Q.props,_owner:Q._owner}}function A(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===e}function D(Q){var J={"=":"=0",":":"=2"};return"$"+Q.replace(/[=:]/g,function(F){return J[F]})}var $=/\/+/g;function ee(Q,J){return typeof Q=="object"&&Q!==null&&Q.key!=null?D(""+Q.key):J.toString(36)}function U(Q,J,F,K,W){var H=typeof Q;(H==="undefined"||H==="boolean")&&(Q=null);var se=!1;if(Q===null)se=!0;else switch(H){case"string":case"number":se=!0;break;case"object":switch(Q.$$typeof){case e:case t:se=!0}}if(se)return se=Q,W=W(se),Q=K===""?"."+ee(se,0):K,j(W)?(F="",Q!=null&&(F=Q.replace($,"$&/")+"/"),U(W,J,F,"",function(we){return we})):W!=null&&(A(W)&&(W=L(W,F+(!W.key||se&&se.key===W.key?"":(""+W.key).replace($,"$&/")+"/")+Q)),J.push(W)),1;if(se=0,K=K===""?".":K+":",j(Q))for(var ie=0;ie<Q.length;ie++){H=Q[ie];var ge=K+ee(H,ie);se+=U(H,J,F,ge,W)}else if(ge=m(Q),typeof ge=="function")for(Q=ge.call(Q),ie=0;!(H=Q.next()).done;)H=H.value,ge=K+ee(H,ie++),se+=U(H,J,F,ge,W);else if(H==="object")throw J=String(Q),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(Q).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.");return se}function G(Q,J,F){if(Q==null)return Q;var K=[],W=0;return U(Q,K,"","",function(H){return J.call(F,H,W++)}),K}function Z(Q){if(Q._status===-1){var J=Q._result;J=J(),J.then(function(F){(Q._status===0||Q._status===-1)&&(Q._status=1,Q._result=F)},function(F){(Q._status===0||Q._status===-1)&&(Q._status=2,Q._result=F)}),Q._status===-1&&(Q._status=0,Q._result=J)}if(Q._status===1)return Q._result.default;throw Q._result}var z={current:null},q={transition:null},ae={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:q,ReactCurrentOwner:T};function P(){throw Error("act(...) is not supported in production builds of React.")}return wn.Children={map:G,forEach:function(Q,J,F){G(Q,function(){J.apply(this,arguments)},F)},count:function(Q){var J=0;return G(Q,function(){J++}),J},toArray:function(Q){return G(Q,function(J){return J})||[]},only:function(Q){if(!A(Q))throw Error("React.Children.only expected to receive a single React element child.");return Q}},wn.Component=_,wn.Fragment=n,wn.Profiler=i,wn.PureComponent=S,wn.StrictMode=r,wn.Suspense=d,wn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,wn.act=P,wn.cloneElement=function(Q,J,F){if(Q==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+Q+".");var K=v({},Q.props),W=Q.key,H=Q.ref,se=Q._owner;if(J!=null){if(J.ref!==void 0&&(H=J.ref,se=T.current),J.key!==void 0&&(W=""+J.key),Q.type&&Q.type.defaultProps)var ie=Q.type.defaultProps;for(ge in J)R.call(J,ge)&&!I.hasOwnProperty(ge)&&(K[ge]=J[ge]===void 0&&ie!==void 0?ie[ge]:J[ge])}var ge=arguments.length-2;if(ge===1)K.children=F;else if(1<ge){ie=Array(ge);for(var we=0;we<ge;we++)ie[we]=arguments[we+2];K.children=ie}return{$$typeof:e,type:Q.type,key:W,ref:H,props:K,_owner:se}},wn.createContext=function(Q){return Q={$$typeof:l,_currentValue:Q,_currentValue2:Q,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},Q.Provider={$$typeof:o,_context:Q},Q.Consumer=Q},wn.createElement=M,wn.createFactory=function(Q){var J=M.bind(null,Q);return J.type=Q,J},wn.createRef=function(){return{current:null}},wn.forwardRef=function(Q){return{$$typeof:u,render:Q}},wn.isValidElement=A,wn.lazy=function(Q){return{$$typeof:p,_payload:{_status:-1,_result:Q},_init:Z}},wn.memo=function(Q,J){return{$$typeof:f,type:Q,compare:J===void 0?null:J}},wn.startTransition=function(Q){var J=q.transition;q.transition={};try{Q()}finally{q.transition=J}},wn.unstable_act=P,wn.useCallback=function(Q,J){return z.current.useCallback(Q,J)},wn.useContext=function(Q){return z.current.useContext(Q)},wn.useDebugValue=function(){},wn.useDeferredValue=function(Q){return z.current.useDeferredValue(Q)},wn.useEffect=function(Q,J){return z.current.useEffect(Q,J)},wn.useId=function(){return z.current.useId()},wn.useImperativeHandle=function(Q,J,F){return z.current.useImperativeHandle(Q,J,F)},wn.useInsertionEffect=function(Q,J){return z.current.useInsertionEffect(Q,J)},wn.useLayoutEffect=function(Q,J){return z.current.useLayoutEffect(Q,J)},wn.useMemo=function(Q,J){return z.current.useMemo(Q,J)},wn.useReducer=function(Q,J,F){return z.current.useReducer(Q,J,F)},wn.useRef=function(Q){return z.current.useRef(Q)},wn.useState=function(Q){return z.current.useState(Q)},wn.useSyncExternalStore=function(Q,J,F){return z.current.useSyncExternalStore(Q,J,F)},wn.useTransition=function(){return z.current.useTransition()},wn.version="18.3.1",wn}var Q_;function gk(){return Q_||(Q_=1,Xh.exports=LM()),Xh.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 X_;function OM(){if(X_)return $c;X_=1;var e=gk(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=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,h={},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)&&(h[p]=d[p]);if(u&&u.defaultProps)for(p in d=u.defaultProps,d)h[p]===void 0&&(h[p]=d[p]);return{$$typeof:t,type:u,key:m,ref:x,props:h,_owner:i.current}}return $c.Fragment=n,$c.jsx=l,$c.jsxs=l,$c}var Z_;function DM(){return Z_||(Z_=1,Qh.exports=OM()),Qh.exports}var a=DM(),y=gk();const Mt=Gl(y);var Jd={},Zh={exports:{}},Ii={},Jh={exports:{}},eg={};/**
|
|
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 J_;function PM(){return J_||(J_=1,(function(e){function t(q,ae){var P=q.length;q.push(ae);e:for(;0<P;){var Q=P-1>>>1,J=q[Q];if(0<i(J,ae))q[Q]=ae,q[P]=J,P=Q;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var ae=q[0],P=q.pop();if(P!==ae){q[0]=P;e:for(var Q=0,J=q.length,F=J>>>1;Q<F;){var K=2*(Q+1)-1,W=q[K],H=K+1,se=q[H];if(0>i(W,P))H<J&&0>i(se,W)?(q[Q]=se,q[H]=P,Q=H):(q[Q]=W,q[K]=P,Q=K);else if(H<J&&0>i(se,P))q[Q]=se,q[H]=P,Q=H;else break e}}return ae}function i(q,ae){var P=q.sortIndex-ae.sortIndex;return P!==0?P:q.id-ae.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,h=null,m=3,x=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=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(q){for(var ae=n(f);ae!==null;){if(ae.callback===null)r(f);else if(ae.startTime<=q)r(f),ae.sortIndex=ae.expirationTime,t(d,ae);else break;ae=n(f)}}function j(q){if(k=!1,N(q),!v)if(n(d)!==null)v=!0,Z(R);else{var ae=n(f);ae!==null&&z(j,ae.startTime-q)}}function R(q,ae){v=!1,k&&(k=!1,w(M),M=-1),x=!0;var P=m;try{for(N(ae),h=n(d);h!==null&&(!(h.expirationTime>ae)||q&&!D());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,m=h.priorityLevel;var J=Q(h.expirationTime<=ae);ae=e.unstable_now(),typeof J=="function"?h.callback=J:h===n(d)&&r(d),N(ae)}else r(d);h=n(d)}if(h!==null)var F=!0;else{var K=n(f);K!==null&&z(j,K.startTime-ae),F=!1}return F}finally{h=null,m=P,x=!1}}var T=!1,I=null,M=-1,L=5,A=-1;function D(){return!(e.unstable_now()-A<L)}function $(){if(I!==null){var q=e.unstable_now();A=q;var ae=!0;try{ae=I(!0,q)}finally{ae?ee():(T=!1,I=null)}}else T=!1}var ee;if(typeof S=="function")ee=function(){S($)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,G=U.port2;U.port1.onmessage=$,ee=function(){G.postMessage(null)}}else ee=function(){_($,0)};function Z(q){I=q,T||(T=!0,ee())}function z(q,ae){M=_(function(){q(e.unstable_now())},ae)}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(q){q.callback=null},e.unstable_continueExecution=function(){v||x||(v=!0,Z(R))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(q){switch(m){case 1:case 2:case 3:var ae=3;break;default:ae=m}var P=m;m=ae;try{return q()}finally{m=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,ae){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var P=m;m=q;try{return ae()}finally{m=P}},e.unstable_scheduleCallback=function(q,ae,P){var Q=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?Q+P:Q):P=Q,q){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=P+J,q={id:p++,callback:ae,priorityLevel:q,startTime:P,expirationTime:J,sortIndex:-1},P>Q?(q.sortIndex=P,t(f,q),n(d)===null&&q===n(f)&&(k?(w(M),M=-1):k=!0,z(j,P-Q))):(q.sortIndex=J,t(d,q),v||x||(v=!0,Z(R))),q},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(q){var ae=m;return function(){var P=m;m=ae;try{return q.apply(this,arguments)}finally{m=P}}}})(eg)),eg}var ew;function FM(){return ew||(ew=1,Jh.exports=PM()),Jh.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 tw;function BM(){if(tw)return Ii;tw=1;var e=gk(),t=FM();function n(s){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+s,g=1;g<arguments.length;g++)c+="&args[]="+encodeURIComponent(arguments[g]);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,i={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(i[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={},h={};function m(s){return d.call(h,s)?!0:d.call(p,s)?!1:f.test(s)?h[s]=!0:(p[s]=!0,!1)}function x(s,c,g,b){if(g!==null&&g.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return b?!1:g!==null?!g.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function v(s,c,g,b){if(c===null||typeof c>"u"||x(s,c,g,b))return!0;if(b)return!1;if(g!==null)switch(g.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,g,b,E,C,B){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=E,this.mustUseProperty=g,this.propertyName=s,this.type=c,this.sanitizeURL=C,this.removeEmptyString=B}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 w=/[\-:]([a-z])/g;function S(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(w,S);_[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(w,S);_[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(w,S);_[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,g,b){var E=_.hasOwnProperty(c)?_[c]:null;(E!==null?E.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,g,E,b)&&(g=null),b||E===null?m(c)&&(g===null?s.removeAttribute(c):s.setAttribute(c,""+g)):E.mustUseProperty?s[E.propertyName]=g===null?E.type===3?!1:"":g:(c=E.attributeName,b=E.attributeNamespace,g===null?s.removeAttribute(c):(E=E.type,g=E===3||E===4&&g===!0?"":""+g,b?s.setAttributeNS(b,c,g):s.setAttribute(c,g))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),T=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"),D=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),q=Symbol.iterator;function ae(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var P=Object.assign,Q;function J(s){if(Q===void 0)try{throw Error()}catch(g){var c=g.stack.trim().match(/\n( *(at )?)/);Q=c&&c[1]||""}return`
|
|
34
|
+
`+Q+s}var F=!1;function K(s,c){if(!s||F)return"";F=!0;var g=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(Se){var b=Se}Reflect.construct(s,[],c)}else{try{c.call()}catch(Se){b=Se}s.call(c.prototype)}else{try{throw Error()}catch(Se){b=Se}s()}}catch(Se){if(Se&&b&&typeof Se.stack=="string"){for(var E=Se.stack.split(`
|
|
35
|
+
`),C=b.stack.split(`
|
|
36
|
+
`),B=E.length-1,ne=C.length-1;1<=B&&0<=ne&&E[B]!==C[ne];)ne--;for(;1<=B&&0<=ne;B--,ne--)if(E[B]!==C[ne]){if(B!==1||ne!==1)do if(B--,ne--,0>ne||E[B]!==C[ne]){var ce=`
|
|
37
|
+
`+E[B].replace(" at new "," at ");return s.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",s.displayName)),ce}while(1<=B&&0<=ne);break}}}finally{F=!1,Error.prepareStackTrace=g}return(s=s?s.displayName||s.name:"")?J(s):""}function W(s){switch(s.tag){case 5:return J(s.type);case 16:return J("Lazy");case 13:return J("Suspense");case 19:return J("SuspenseList");case 0:case 2:case 15:return s=K(s.type,!1),s;case 11:return s=K(s.type.render,!1),s;case 1:return s=K(s.type,!0),s;default:return""}}function H(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 T:return"Portal";case L:return"Profiler";case M:return"StrictMode";case ee:return"Suspense";case U:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case D:return(s.displayName||"Context")+".Consumer";case A:return(s._context.displayName||"Context")+".Provider";case $:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case G:return c=s.displayName||null,c!==null?c:H(s.type)||"Memo";case Z:c=s._payload,s=s._init;try{return H(s(c))}catch{}}return null}function se(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 H(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 ie(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ge(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function we(s){var c=ge(s)?"checked":"value",g=Object.getOwnPropertyDescriptor(s.constructor.prototype,c),b=""+s[c];if(!s.hasOwnProperty(c)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var E=g.get,C=g.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return E.call(this)},set:function(B){b=""+B,C.call(this,B)}}),Object.defineProperty(s,c,{enumerable:g.enumerable}),{getValue:function(){return b},setValue:function(B){b=""+B},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function Ke(s){s._valueTracker||(s._valueTracker=we(s))}function xt(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var g=c.getValue(),b="";return s&&(b=ge(s)?s.checked?"true":"false":s.value),s=b,s!==g?(c.setValue(s),!0):!1}function et(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 vt(s,c){var g=c.checked;return P({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??s._wrapperState.initialChecked})}function lt(s,c){var g=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;g=ie(c.value!=null?c.value:g),s._wrapperState={initialChecked:b,initialValue:g,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function je(s,c){c=c.checked,c!=null&&N(s,"checked",c,!1)}function Oe(s,c){je(s,c);var g=ie(c.value),b=c.type;if(g!=null)b==="number"?(g===0&&s.value===""||s.value!=g)&&(s.value=""+g):s.value!==""+g&&(s.value=""+g);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}c.hasOwnProperty("value")?Ct(s,c.type,g):c.hasOwnProperty("defaultValue")&&Ct(s,c.type,ie(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function ft(s,c,g){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,g||c===s.value||(s.value=c),s.defaultValue=c}g=s.name,g!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,g!==""&&(s.name=g)}function Ct(s,c,g){(c!=="number"||et(s.ownerDocument)!==s)&&(g==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+g&&(s.defaultValue=""+g))}var rn=Array.isArray;function tn(s,c,g,b){if(s=s.options,c){c={};for(var E=0;E<g.length;E++)c["$"+g[E]]=!0;for(g=0;g<s.length;g++)E=c.hasOwnProperty("$"+s[g].value),s[g].selected!==E&&(s[g].selected=E),E&&b&&(s[g].defaultSelected=!0)}else{for(g=""+ie(g),c=null,E=0;E<s.length;E++){if(s[E].value===g){s[E].selected=!0,b&&(s[E].defaultSelected=!0);return}c!==null||s[E].disabled||(c=s[E])}c!==null&&(c.selected=!0)}}function un(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return P({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function mt(s,c){var g=c.value;if(g==null){if(g=c.children,c=c.defaultValue,g!=null){if(c!=null)throw Error(n(92));if(rn(g)){if(1<g.length)throw Error(n(93));g=g[0]}c=g}c==null&&(c=""),g=c}s._wrapperState={initialValue:ie(g)}}function $t(s,c){var g=ie(c.value),b=ie(c.defaultValue);g!=null&&(g=""+g,g!==s.value&&(s.value=g),c.defaultValue==null&&s.defaultValue!==g&&(s.defaultValue=g)),b!=null&&(s.defaultValue=""+b)}function nt(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function qe(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"?qe(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var me,Ue=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,g,b,E){MSApp.execUnsafeLocalFunction(function(){return s(c,g,b,E)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(me=me||document.createElement("div"),me.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=me.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function He(s,c){if(c){var g=s.firstChild;if(g&&g===s.lastChild&&g.nodeType===3){g.nodeValue=c;return}}s.textContent=c}var be={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},Ye=["Webkit","ms","Moz","O"];Object.keys(be).forEach(function(s){Ye.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),be[c]=be[s]})});function _t(s,c,g){return c==null||typeof c=="boolean"||c===""?"":g||typeof c!="number"||c===0||be.hasOwnProperty(s)&&be[s]?(""+c).trim():c+"px"}function jt(s,c){s=s.style;for(var g in c)if(c.hasOwnProperty(g)){var b=g.indexOf("--")===0,E=_t(g,c[g],b);g==="float"&&(g="cssFloat"),b?s.setProperty(g,E):s[g]=E}}var Wt=P({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 hn(s,c){if(c){if(Wt[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 xe(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 ke=null;function Ae(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Fe=null,yt=null,pt=null;function Ht(s){if(s=To(s)){if(typeof Fe!="function")throw Error(n(280));var c=s.stateNode;c&&(c=Ba(c),Fe(s.stateNode,s.type,c))}}function te(s){yt?pt?pt.push(s):pt=[s]:yt=s}function Ee(){if(yt){var s=yt,c=pt;if(pt=yt=null,Ht(s),c)for(s=0;s<c.length;s++)Ht(c[s])}}function Je(s,c){return s(c)}function Dt(){}var Pe=!1;function ze(s,c,g){if(Pe)return s(c,g);Pe=!0;try{return Je(s,c,g)}finally{Pe=!1,(yt!==null||pt!==null)&&(Dt(),Ee())}}function We(s,c){var g=s.stateNode;if(g===null)return null;var b=Ba(g);if(b===null)return null;g=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(g&&typeof g!="function")throw Error(n(231,c,typeof g));return g}var Qe=!1;if(u)try{var st={};Object.defineProperty(st,"passive",{get:function(){Qe=!0}}),window.addEventListener("test",st,st),window.removeEventListener("test",st,st)}catch{Qe=!1}function Ne(s,c,g,b,E,C,B,ne,ce){var Se=Array.prototype.slice.call(arguments,3);try{c.apply(g,Se)}catch(Ze){this.onError(Ze)}}var Ve=!1,oe=null,bn=!1,tr=null,Le={onError:function(s){Ve=!0,oe=s}};function kt(s,c,g,b,E,C,B,ne,ce){Ve=!1,oe=null,Ne.apply(Le,arguments)}function vn(s,c,g,b,E,C,B,ne,ce){if(kt.apply(this,arguments),Ve){if(Ve){var Se=oe;Ve=!1,oe=null}else throw Error(n(198));bn||(bn=!0,tr=Se)}}function ar(s){var c=s,g=s;if(s.alternate)for(;c.return;)c=c.return;else{s=c;do c=s,(c.flags&4098)!==0&&(g=c.return),s=c.return;while(s)}return c.tag===3?g: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 Rr(s){if(ar(s)!==s)throw Error(n(188))}function Ma(s){var c=s.alternate;if(!c){if(c=ar(s),c===null)throw Error(n(188));return c!==s?null:s}for(var g=s,b=c;;){var E=g.return;if(E===null)break;var C=E.alternate;if(C===null){if(b=E.return,b!==null){g=b;continue}break}if(E.child===C.child){for(C=E.child;C;){if(C===g)return Rr(E),s;if(C===b)return Rr(E),c;C=C.sibling}throw Error(n(188))}if(g.return!==b.return)g=E,b=C;else{for(var B=!1,ne=E.child;ne;){if(ne===g){B=!0,g=E,b=C;break}if(ne===b){B=!0,b=E,g=C;break}ne=ne.sibling}if(!B){for(ne=C.child;ne;){if(ne===g){B=!0,g=C,b=E;break}if(ne===b){B=!0,b=C,g=E;break}ne=ne.sibling}if(!B)throw Error(n(189))}}if(g.alternate!==b)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?s:c}function Gt(s){return s=Ma(s),s!==null?Tn(s):null}function Tn(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=Tn(s);if(c!==null)return c;s=s.sibling}return null}var Pr=t.unstable_scheduleCallback,Bn=t.unstable_cancelCallback,Bi=t.unstable_shouldYield,pa=t.unstable_requestPaint,$n=t.unstable_now,La=t.unstable_getCurrentPriorityLevel,ha=t.unstable_ImmediatePriority,ga=t.unstable_UserBlockingPriority,gi=t.unstable_NormalPriority,it=t.unstable_LowPriority,Et=t.unstable_IdlePriority,Vt=null,Pt=null;function zn(s){if(Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(Vt,s,void 0,(s.current.flags&128)===128)}catch{}}var Pn=Math.clz32?Math.clz32:hr,Gr=Math.log,ni=Math.LN2;function hr(s){return s>>>=0,s===0?32:31-(Gr(s)/ni|0)|0}var lr=64,zi=4194304;function mi(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 xi(s,c){var g=s.pendingLanes;if(g===0)return 0;var b=0,E=s.suspendedLanes,C=s.pingedLanes,B=g&268435455;if(B!==0){var ne=B&~E;ne!==0?b=mi(ne):(C&=B,C!==0&&(b=mi(C)))}else B=g&~E,B!==0?b=mi(B):C!==0&&(b=mi(C));if(b===0)return 0;if(c!==0&&c!==b&&(c&E)===0&&(E=b&-b,C=c&-c,E>=C||E===16&&(C&4194240)!==0))return c;if((b&4)!==0&&(b|=g&16),c=s.entangledLanes,c!==0)for(s=s.entanglements,c&=b;0<c;)g=31-Pn(c),E=1<<g,b|=s[g],c&=~E;return b}function Qi(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 ma(s,c){for(var g=s.suspendedLanes,b=s.pingedLanes,E=s.expirationTimes,C=s.pendingLanes;0<C;){var B=31-Pn(C),ne=1<<B,ce=E[B];ce===-1?((ne&g)===0||(ne&b)!==0)&&(E[B]=Qi(ne,c)):ce<=c&&(s.expiredLanes|=ne),C&=~ne}}function yi(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Ya(){var s=lr;return lr<<=1,(lr&4194240)===0&&(lr=64),s}function ri(s){for(var c=[],g=0;31>g;g++)c.push(s);return c}function ii(s,c,g){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-Pn(c),s[c]=g}function gr(s,c){var g=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<g;){var E=31-Pn(g),C=1<<E;c[E]=0,b[E]=-1,s[E]=-1,g&=~C}}function Xi(s,c){var g=s.entangledLanes|=c;for(s=s.entanglements;g;){var b=31-Pn(g),E=1<<b;E&c|s[b]&c&&(s[b]|=c),g&=~E}}var ln=0;function Ft(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ar,kn,dn,ai,wr,Zi=!1,Ei=[],at=null,gt=null,Nt=null,yn=new Map,Gn=new Map,Hn=[],Ji="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 si(s,c){switch(s){case"focusin":case"focusout":at=null;break;case"dragenter":case"dragleave":gt=null;break;case"mouseover":case"mouseout":Nt=null;break;case"pointerover":case"pointerout":yn.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(c.pointerId)}}function xa(s,c,g,b,E,C){return s===null||s.nativeEvent!==C?(s={blockedOn:c,domEventName:g,eventSystemFlags:b,nativeEvent:C,targetContainers:[E]},c!==null&&(c=To(c),c!==null&&kn(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,E!==null&&c.indexOf(E)===-1&&c.push(E),s)}function ya(s,c,g,b,E){switch(c){case"focusin":return at=xa(at,s,c,g,b,E),!0;case"dragenter":return gt=xa(gt,s,c,g,b,E),!0;case"mouseover":return Nt=xa(Nt,s,c,g,b,E),!0;case"pointerover":var C=E.pointerId;return yn.set(C,xa(yn.get(C)||null,s,c,g,b,E)),!0;case"gotpointercapture":return C=E.pointerId,Gn.set(C,xa(Gn.get(C)||null,s,c,g,b,E)),!0}return!1}function Ns(s){var c=us(s.target);if(c!==null){var g=ar(c);if(g!==null){if(c=g.tag,c===13){if(c=Vr(g),c!==null){s.blockedOn=c,wr(s.priority,function(){dn(g)});return}}else if(c===3&&g.stateNode.current.memoizedState.isDehydrated){s.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Be(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var g=Sr(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(g===null){g=s.nativeEvent;var b=new g.constructor(g.type,g);ke=b,g.target.dispatchEvent(b),ke=null}else return c=To(g),c!==null&&kn(c),s.blockedOn=g,!1;c.shift()}return!0}function V(s,c,g){Be(s)&&g.delete(c)}function de(){Zi=!1,at!==null&&Be(at)&&(at=null),gt!==null&&Be(gt)&&(gt=null),Nt!==null&&Be(Nt)&&(Nt=null),yn.forEach(V),Gn.forEach(V)}function Ie(s,c){s.blockedOn===c&&(s.blockedOn=null,Zi||(Zi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,de)))}function Me(s){function c(E){return Ie(E,s)}if(0<Ei.length){Ie(Ei[0],s);for(var g=1;g<Ei.length;g++){var b=Ei[g];b.blockedOn===s&&(b.blockedOn=null)}}for(at!==null&&Ie(at,s),gt!==null&&Ie(gt,s),Nt!==null&&Ie(Nt,s),yn.forEach(c),Gn.forEach(c),g=0;g<Hn.length;g++)b=Hn[g],b.blockedOn===s&&(b.blockedOn=null);for(;0<Hn.length&&(g=Hn[0],g.blockedOn===null);)Ns(g),g.blockedOn===null&&Hn.shift()}var It=j.ReactCurrentBatchConfig,Bt=!0;function fn(s,c,g,b){var E=ln,C=It.transition;It.transition=null;try{ln=1,oi(s,c,g,b)}finally{ln=E,It.transition=C}}function dt(s,c,g,b){var E=ln,C=It.transition;It.transition=null;try{ln=4,oi(s,c,g,b)}finally{ln=E,It.transition=C}}function oi(s,c,g,b){if(Bt){var E=Sr(s,c,g,b);if(E===null)wc(s,c,b,cr,g),si(s,b);else if(ya(E,s,c,g,b))b.stopPropagation();else if(si(s,b),c&4&&-1<Ji.indexOf(s)){for(;E!==null;){var C=To(E);if(C!==null&&Ar(C),C=Sr(s,c,g,b),C===null&&wc(s,c,b,cr,g),C===E)break;E=C}E!==null&&b.stopPropagation()}else wc(s,c,b,null,g)}}var cr=null;function Sr(s,c,g,b){if(cr=null,s=Ae(b),s=us(s),s!==null)if(c=ar(s),c===null)s=null;else if(g=c.tag,g===13){if(s=Vr(c),s!==null)return s;s=null}else if(g===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;s=null}else c!==s&&(s=null);return cr=s,null}function ba(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(La()){case ha:return 1;case ga:return 4;case gi:case it:return 16;case Et:return 536870912;default:return 16}default:return 16}}var er=null,Cs=null,js=null;function Zu(){if(js)return js;var s,c=Cs,g=c.length,b,E="value"in er?er.value:er.textContent,C=E.length;for(s=0;s<g&&c[s]===E[s];s++);var B=g-s;for(b=1;b<=B&&c[g-b]===E[C-b];b++);return js=E.slice(s,1<b?1-b:void 0)}function Ts(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 Oa(){return!0}function Ju(){return!1}function Kr(s){function c(g,b,E,C,B){this._reactName=g,this._targetInst=E,this.type=b,this.nativeEvent=C,this.target=B,this.currentTarget=null;for(var ne in s)s.hasOwnProperty(ne)&&(g=s[ne],this[ne]=g?g(C):C[ne]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?Oa:Ju,this.isPropagationStopped=Ju,this}return P(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Oa)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Oa)},persist:function(){},isPersistent:Oa}),c}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rc=Kr(Qa),Xa=P({},Qa,{view:0,detail:0}),Pp=Kr(Xa),ic,Za,go,Ja=P({},Xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:oc,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!==go&&(go&&s.type==="mousemove"?(ic=s.screenX-go.screenX,Za=s.screenY-go.screenY):Za=ic=0,go=s),ic)},movementY:function(s){return"movementY"in s?s.movementY:Za}}),ll=Kr(Ja),ac=P({},Ja,{dataTransfer:0}),cl=Kr(ac),ul=P({},Xa,{relatedTarget:0}),es=Kr(ul),Da=P({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),Ui=Kr(Da),dl=P({},Qa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Rs=Kr(dl),As=P({},Qa,{data:0}),fl=Kr(As),ed={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fp={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"},sc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bp(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=sc[s])?!!c[s]:!1}function oc(){return Bp}var zp=P({},Xa,{key:function(s){if(s.key){var c=ed[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=Ts(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Fp[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:oc,charCode:function(s){return s.type==="keypress"?Ts(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Ts(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),td=Kr(zp),pl=P({},Ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lc=Kr(pl),Up=P({},Xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:oc}),hl=Kr(Up),cc=P({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),nd=Kr(cc),uc=P({},Ja,{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}),dc=Kr(uc),rd=[9,13,27,32],mo=u&&"CompositionEvent"in window,xo=null;u&&"documentMode"in document&&(xo=document.documentMode);var qp=u&&"TextEvent"in window&&!xo,fc=u&&(!mo||xo&&8<xo&&11>=xo),yo=" ",ts=!1;function pc(s,c){switch(s){case"keyup":return rd.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function id(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ns=!1;function bo(s,c){switch(s){case"compositionend":return id(c);case"keypress":return c.which!==32?null:(ts=!0,yo);case"textInput":return s=c.data,s===yo&&ts?null:s;default:return null}}function ad(s,c){if(ns)return s==="compositionend"||!mo&&pc(s,c)?(s=Zu(),js=Cs=er=null,ns=!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 fc&&c.locale!=="ko"?null:c.data;default:return null}}var hc={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 sd(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!hc[s.type]:c==="textarea"}function gl(s,c,g,b){te(b),c=ml(c,"onChange"),0<c.length&&(g=new rc("onChange","change",null,g,b),s.push({event:g,listeners:c}))}var vo=null,rs=null;function Hp(s){xd(s,0)}function Is(s){var c=Br(s);if(xt(c))return s}function $p(s,c){if(s==="change")return c}var od=!1;if(u){var gc;if(u){var Sn="oninput"in document;if(!Sn){var ld=document.createElement("div");ld.setAttribute("oninput","return;"),Sn=typeof ld.oninput=="function"}gc=Sn}else gc=!1;od=gc&&(!document.documentMode||9<document.documentMode)}function ko(){vo&&(vo.detachEvent("onpropertychange",br),rs=vo=null)}function br(s){if(s.propertyName==="value"&&Is(rs)){var c=[];gl(c,rs,s,Ae(s)),ze(Hp,c)}}function Wp(s,c,g){s==="focusin"?(ko(),vo=c,rs=g,vo.attachEvent("onpropertychange",br)):s==="focusout"&&ko()}function cd(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Is(rs)}function ud(s,c){if(s==="click")return Is(c)}function dd(s,c){if(s==="input"||s==="change")return Is(c)}function fd(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var Ni=typeof Object.is=="function"?Object.is:fd;function Ms(s,c){if(Ni(s,c))return!0;if(typeof s!="object"||s===null||typeof c!="object"||c===null)return!1;var g=Object.keys(s),b=Object.keys(c);if(g.length!==b.length)return!1;for(b=0;b<g.length;b++){var E=g[b];if(!d.call(c,E)||!Ni(s[E],c[E]))return!1}return!0}function mc(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function xc(s,c){var g=mc(s);s=0;for(var b;g;){if(g.nodeType===3){if(b=s+g.textContent.length,s<=c&&b>=c)return{node:g,offset:c-s};s=b}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=mc(g)}}function yc(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?yc(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function bc(){for(var s=window,c=et();c instanceof s.HTMLIFrameElement;){try{var g=typeof c.contentWindow.location.href=="string"}catch{g=!1}if(g)s=c.contentWindow;else break;c=et(s.document)}return c}function zt(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 pd(s){var c=bc(),g=s.focusedElem,b=s.selectionRange;if(c!==g&&g&&g.ownerDocument&&yc(g.ownerDocument.documentElement,g)){if(b!==null&&zt(g)){if(c=b.start,s=b.end,s===void 0&&(s=c),"selectionStart"in g)g.selectionStart=c,g.selectionEnd=Math.min(s,g.value.length);else if(s=(c=g.ownerDocument||document)&&c.defaultView||window,s.getSelection){s=s.getSelection();var E=g.textContent.length,C=Math.min(b.start,E);b=b.end===void 0?C:Math.min(b.end,E),!s.extend&&C>b&&(E=b,b=C,C=E),E=xc(g,C);var B=xc(g,b);E&&B&&(s.rangeCount!==1||s.anchorNode!==E.node||s.anchorOffset!==E.offset||s.focusNode!==B.node||s.focusOffset!==B.offset)&&(c=c.createRange(),c.setStart(E.node,E.offset),s.removeAllRanges(),C>b?(s.addRange(c),s.extend(B.node,B.offset)):(c.setEnd(B.node,B.offset),s.addRange(c)))}}for(c=[],s=g;s=s.parentNode;)s.nodeType===1&&c.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<c.length;g++)s=c[g],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var bi=u&&"documentMode"in document&&11>=document.documentMode,Ls=null,_o=null,is=null,Pa=!1;function hd(s,c,g){var b=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Pa||Ls==null||Ls!==et(b)||(b=Ls,"selectionStart"in b&&zt(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}),is&&Ms(is,b)||(is=b,b=ml(_o,"onSelect"),0<b.length&&(c=new rc("onSelect","select",null,c,g),s.push({event:c,listeners:b}),c.target=Ls)))}function qi(s,c){var g={};return g[s.toLowerCase()]=c.toLowerCase(),g["Webkit"+s]="webkit"+c,g["Moz"+s]="moz"+c,g}var Fa={animationend:qi("Animation","AnimationEnd"),animationiteration:qi("Animation","AnimationIteration"),animationstart:qi("Animation","AnimationStart"),transitionend:qi("Transition","TransitionEnd")},vi={},wo={};u&&(wo=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function as(s){if(vi[s])return vi[s];if(!Fa[s])return s;var c=Fa[s],g;for(g in c)if(c.hasOwnProperty(g)&&g in wo)return vi[s]=c[g];return s}var So=as("animationend"),gd=as("animationiteration"),vc=as("animationstart"),Eo=as("transitionend"),ss=new Map,md="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 ea(s,c){ss.set(s,c),o(c,[s])}for(var os=0;os<md.length;os++){var kc=md[os],_c=kc.toLowerCase(),va=kc[0].toUpperCase()+kc.slice(1);ea(_c,"on"+va)}ea(So,"onAnimationEnd"),ea(gd,"onAnimationIteration"),ea(vc,"onAnimationStart"),ea("dblclick","onDoubleClick"),ea("focusin","onFocus"),ea("focusout","onBlur"),ea(Eo,"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 No="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(" "),Vp=new Set("cancel close invalid load scroll toggle".split(" ").concat(No));function Ci(s,c,g){var b=s.type||"unknown-event";s.currentTarget=g,vn(b,c,void 0,s),s.currentTarget=null}function xd(s,c){c=(c&4)!==0;for(var g=0;g<s.length;g++){var b=s[g],E=b.event;b=b.listeners;e:{var C=void 0;if(c)for(var B=b.length-1;0<=B;B--){var ne=b[B],ce=ne.instance,Se=ne.currentTarget;if(ne=ne.listener,ce!==C&&E.isPropagationStopped())break e;Ci(E,ne,Se),C=ce}else for(B=0;B<b.length;B++){if(ne=b[B],ce=ne.instance,Se=ne.currentTarget,ne=ne.listener,ce!==C&&E.isPropagationStopped())break e;Ci(E,ne,Se),C=ce}}}if(bn)throw s=tr,bn=!1,tr=null,s}function Kn(s,c){var g=c[Cc];g===void 0&&(g=c[Cc]=new Set);var b=s+"__bubble";g.has(b)||(yd(c,s,2,!1),g.add(b))}function Os(s,c,g){var b=0;c&&(b|=4),yd(g,s,b,c)}var Ds="_reactListening"+Math.random().toString(36).slice(2);function Fr(s){if(!s[Ds]){s[Ds]=!0,r.forEach(function(g){g!=="selectionchange"&&(Vp.has(g)||Os(g,!1,s),Os(g,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[Ds]||(c[Ds]=!0,Os("selectionchange",!1,c))}}function yd(s,c,g,b){switch(ba(c)){case 1:var E=fn;break;case 4:E=dt;break;default:E=oi}g=E.bind(null,c,g,s),E=void 0,!Qe||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(E=!0),b?E!==void 0?s.addEventListener(c,g,{capture:!0,passive:E}):s.addEventListener(c,g,!0):E!==void 0?s.addEventListener(c,g,{passive:E}):s.addEventListener(c,g,!1)}function wc(s,c,g,b,E){var C=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var B=b.tag;if(B===3||B===4){var ne=b.stateNode.containerInfo;if(ne===E||ne.nodeType===8&&ne.parentNode===E)break;if(B===4)for(B=b.return;B!==null;){var ce=B.tag;if((ce===3||ce===4)&&(ce=B.stateNode.containerInfo,ce===E||ce.nodeType===8&&ce.parentNode===E))return;B=B.return}for(;ne!==null;){if(B=us(ne),B===null)return;if(ce=B.tag,ce===5||ce===6){b=C=B;continue e}ne=ne.parentNode}}b=b.return}ze(function(){var Se=C,Ze=Ae(g),tt=[];e:{var Ge=ss.get(s);if(Ge!==void 0){var wt=rc,Lt=s;switch(s){case"keypress":if(Ts(g)===0)break e;case"keydown":case"keyup":wt=td;break;case"focusin":Lt="focus",wt=es;break;case"focusout":Lt="blur",wt=es;break;case"beforeblur":case"afterblur":wt=es;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":wt=ll;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":wt=cl;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":wt=hl;break;case So:case gd:case vc:wt=Ui;break;case Eo:wt=nd;break;case"scroll":wt=Pp;break;case"wheel":wt=dc;break;case"copy":case"cut":case"paste":wt=Rs;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":wt=lc}var Ot=(c&4)!==0,kr=!Ot&&s==="scroll",ve=Ot?Ge!==null?Ge+"Capture":null:Ge;Ot=[];for(var he=Se,_e;he!==null;){_e=he;var ut=_e.stateNode;if(_e.tag===5&&ut!==null&&(_e=ut,ve!==null&&(ut=We(he,ve),ut!=null&&Ot.push(Co(he,ut,_e)))),kr)break;he=he.return}0<Ot.length&&(Ge=new wt(Ge,Lt,null,g,Ze),tt.push({event:Ge,listeners:Ot}))}}if((c&7)===0){e:{if(Ge=s==="mouseover"||s==="pointerover",wt=s==="mouseout"||s==="pointerout",Ge&&g!==ke&&(Lt=g.relatedTarget||g.fromElement)&&(us(Lt)||Lt[Ir]))break e;if((wt||Ge)&&(Ge=Ze.window===Ze?Ze:(Ge=Ze.ownerDocument)?Ge.defaultView||Ge.parentWindow:window,wt?(Lt=g.relatedTarget||g.toElement,wt=Se,Lt=Lt?us(Lt):null,Lt!==null&&(kr=ar(Lt),Lt!==kr||Lt.tag!==5&&Lt.tag!==6)&&(Lt=null)):(wt=null,Lt=Se),wt!==Lt)){if(Ot=ll,ut="onMouseLeave",ve="onMouseEnter",he="mouse",(s==="pointerout"||s==="pointerover")&&(Ot=lc,ut="onPointerLeave",ve="onPointerEnter",he="pointer"),kr=wt==null?Ge:Br(wt),_e=Lt==null?Ge:Br(Lt),Ge=new Ot(ut,he+"leave",wt,g,Ze),Ge.target=kr,Ge.relatedTarget=_e,ut=null,us(Ze)===Se&&(Ot=new Ot(ve,he+"enter",Lt,g,Ze),Ot.target=_e,Ot.relatedTarget=kr,ut=Ot),kr=ut,wt&&Lt)t:{for(Ot=wt,ve=Lt,he=0,_e=Ot;_e;_e=ls(_e))he++;for(_e=0,ut=ve;ut;ut=ls(ut))_e++;for(;0<he-_e;)Ot=ls(Ot),he--;for(;0<_e-he;)ve=ls(ve),_e--;for(;he--;){if(Ot===ve||ve!==null&&Ot===ve.alternate)break t;Ot=ls(Ot),ve=ls(ve)}Ot=null}else Ot=null;wt!==null&&Sc(tt,Ge,wt,Ot,!1),Lt!==null&&kr!==null&&Sc(tt,kr,Lt,Ot,!0)}}e:{if(Ge=Se?Br(Se):window,wt=Ge.nodeName&&Ge.nodeName.toLowerCase(),wt==="select"||wt==="input"&&Ge.type==="file")var Ut=$p;else if(sd(Ge))if(od)Ut=dd;else{Ut=cd;var Yt=Wp}else(wt=Ge.nodeName)&&wt.toLowerCase()==="input"&&(Ge.type==="checkbox"||Ge.type==="radio")&&(Ut=ud);if(Ut&&(Ut=Ut(s,Se))){gl(tt,Ut,g,Ze);break e}Yt&&Yt(s,Ge,Se),s==="focusout"&&(Yt=Ge._wrapperState)&&Yt.controlled&&Ge.type==="number"&&Ct(Ge,"number",Ge.value)}switch(Yt=Se?Br(Se):window,s){case"focusin":(sd(Yt)||Yt.contentEditable==="true")&&(Ls=Yt,_o=Se,is=null);break;case"focusout":is=_o=Ls=null;break;case"mousedown":Pa=!0;break;case"contextmenu":case"mouseup":case"dragend":Pa=!1,hd(tt,g,Ze);break;case"selectionchange":if(bi)break;case"keydown":case"keyup":hd(tt,g,Ze)}var Qt;if(mo)e:{switch(s){case"compositionstart":var an="onCompositionStart";break e;case"compositionend":an="onCompositionEnd";break e;case"compositionupdate":an="onCompositionUpdate";break e}an=void 0}else ns?pc(s,g)&&(an="onCompositionEnd"):s==="keydown"&&g.keyCode===229&&(an="onCompositionStart");an&&(fc&&g.locale!=="ko"&&(ns||an!=="onCompositionStart"?an==="onCompositionEnd"&&ns&&(Qt=Zu()):(er=Ze,Cs="value"in er?er.value:er.textContent,ns=!0)),Yt=ml(Se,an),0<Yt.length&&(an=new fl(an,s,null,g,Ze),tt.push({event:an,listeners:Yt}),Qt?an.data=Qt:(Qt=id(g),Qt!==null&&(an.data=Qt)))),(Qt=qp?bo(s,g):ad(s,g))&&(Se=ml(Se,"onBeforeInput"),0<Se.length&&(Ze=new fl("onBeforeInput","beforeinput",null,g,Ze),tt.push({event:Ze,listeners:Se}),Ze.data=Qt))}xd(tt,c)})}function Co(s,c,g){return{instance:s,listener:c,currentTarget:g}}function ml(s,c){for(var g=c+"Capture",b=[];s!==null;){var E=s,C=E.stateNode;E.tag===5&&C!==null&&(E=C,C=We(s,g),C!=null&&b.unshift(Co(s,C,E)),C=We(s,c),C!=null&&b.push(Co(s,C,E))),s=s.return}return b}function ls(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Sc(s,c,g,b,E){for(var C=c._reactName,B=[];g!==null&&g!==b;){var ne=g,ce=ne.alternate,Se=ne.stateNode;if(ce!==null&&ce===b)break;ne.tag===5&&Se!==null&&(ne=Se,E?(ce=We(g,C),ce!=null&&B.unshift(Co(g,ce,ne))):E||(ce=We(g,C),ce!=null&&B.push(Co(g,ce,ne)))),g=g.return}B.length!==0&&s.push({event:c,listeners:B})}var Gp=/\r\n?/g,Kp=/\u0000|\uFFFD/g;function bd(s){return(typeof s=="string"?s:""+s).replace(Gp,`
|
|
38
|
+
`).replace(Kp,"")}function xl(s,c,g){if(c=bd(c),bd(s)!==c&&g)throw Error(n(425))}function yl(){}var Ec=null,bl=null;function jo(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 vl=typeof setTimeout=="function"?setTimeout:void 0,Yp=typeof clearTimeout=="function"?clearTimeout:void 0,vd=typeof Promise=="function"?Promise:void 0,Qp=typeof queueMicrotask=="function"?queueMicrotask:typeof vd<"u"?function(s){return vd.resolve(null).then(s).catch(Xp)}:vl;function Xp(s){setTimeout(function(){throw s})}function Nc(s,c){var g=c,b=0;do{var E=g.nextSibling;if(s.removeChild(g),E&&E.nodeType===8)if(g=E.data,g==="/$"){if(b===0){s.removeChild(E),Me(c);return}b--}else g!=="$"&&g!=="$?"&&g!=="$!"||b++;g=E}while(g);Me(c)}function ji(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 kd(s){s=s.previousSibling;for(var c=0;s;){if(s.nodeType===8){var g=s.data;if(g==="$"||g==="$!"||g==="$?"){if(c===0)return s;c--}else g==="/$"&&c++}s=s.previousSibling}return null}var Ps=Math.random().toString(36).slice(2),li="__reactFiber$"+Ps,cs="__reactProps$"+Ps,Ir="__reactContainer$"+Ps,Cc="__reactEvents$"+Ps,Zp="__reactListeners$"+Ps,Jp="__reactHandles$"+Ps;function us(s){var c=s[li];if(c)return c;for(var g=s.parentNode;g;){if(c=g[Ir]||g[li]){if(g=c.alternate,c.child!==null||g!==null&&g.child!==null)for(s=kd(s);s!==null;){if(g=s[li])return g;s=kd(s)}return c}s=g,g=s.parentNode}return null}function To(s){return s=s[li]||s[Ir],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Br(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Ba(s){return s[cs]||null}var Ro=[],Fs=-1;function za(s){return{current:s}}function Mn(s){0>Fs||(s.current=Ro[Fs],Ro[Fs]=null,Fs--)}function Wn(s,c){Fs++,Ro[Fs]=s.current,s.current=c}var ta={},zr=za(ta),ci=za(!1),ds=ta;function Bs(s,c){var g=s.type.contextTypes;if(!g)return ta;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var E={},C;for(C in g)E[C]=c[C];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=E),E}function Yr(s){return s=s.childContextTypes,s!=null}function fs(){Mn(ci),Mn(zr)}function zs(s,c,g){if(zr.current!==ta)throw Error(n(168));Wn(zr,c),Wn(ci,g)}function Ao(s,c,g){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return g;b=b.getChildContext();for(var E in b)if(!(E in c))throw Error(n(108,se(s)||"Unknown",E));return P({},g,b)}function Io(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ta,ds=zr.current,Wn(zr,s),Wn(ci,ci.current),!0}function jc(s,c,g){var b=s.stateNode;if(!b)throw Error(n(169));g?(s=Ao(s,c,ds),b.__reactInternalMemoizedMergedChildContext=s,Mn(ci),Mn(zr),Wn(zr,s)):Mn(ci),Wn(ci,g)}var na=null,O=!1,Y=!1;function re(s){na===null?na=[s]:na.push(s)}function le(s){O=!0,re(s)}function fe(){if(!Y&&na!==null){Y=!0;var s=0,c=ln;try{var g=na;for(ln=1;s<g.length;s++){var b=g[s];do b=b(!0);while(b!==null)}na=null,O=!1}catch(E){throw na!==null&&(na=na.slice(s+1)),Pr(ha,fe),E}finally{ln=c,Y=!1}}return null}var Re=[],Te=0,Tt=null,Jt=0,mn=[],En=0,Cn=null,ye=1,X="";function pe(s,c){Re[Te++]=Jt,Re[Te++]=Tt,Tt=s,Jt=c}function Ce(s,c,g){mn[En++]=ye,mn[En++]=X,mn[En++]=Cn,Cn=s;var b=ye;s=X;var E=32-Pn(b)-1;b&=~(1<<E),g+=1;var C=32-Pn(c)+E;if(30<C){var B=E-E%5;C=(b&(1<<B)-1).toString(32),b>>=B,E-=B,ye=1<<32-Pn(c)+E|g<<E|b,X=C+s}else ye=1<<C|g<<E|b,X=s}function De(s){s.return!==null&&(pe(s,1),Ce(s,1,0))}function Xe(s){for(;s===Tt;)Tt=Re[--Te],Re[Te]=null,Jt=Re[--Te],Re[Te]=null;for(;s===Cn;)Cn=mn[--En],mn[En]=null,X=mn[--En],mn[En]=null,ye=mn[--En],mn[En]=null}var ht=null,Rt=null,bt=!1,nn=null;function Yn(s,c){var g=sa(5,null,null,0);g.elementType="DELETED",g.stateNode=c,g.return=s,c=s.deletions,c===null?(s.deletions=[g],s.flags|=16):c.push(g)}function ur(s,c){switch(s.tag){case 5:var g=s.type;return c=c.nodeType!==1||g.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(s.stateNode=c,ht=s,Rt=ji(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,ht=s,Rt=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(g=Cn!==null?{id:ye,overflow:X}:null,s.memoizedState={dehydrated:c,treeContext:g,retryLane:1073741824},g=sa(18,null,null,0),g.stateNode=c,g.return=s,s.child=g,ht=s,Rt=null,!0):!1;default:return!1}}function mr(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Un(s){if(bt){var c=Rt;if(c){var g=c;if(!ur(s,c)){if(mr(s))throw Error(n(418));c=ji(g.nextSibling);var b=ht;c&&ur(s,c)?Yn(b,g):(s.flags=s.flags&-4097|2,bt=!1,ht=s)}}else{if(mr(s))throw Error(n(418));s.flags=s.flags&-4097|2,bt=!1,ht=s}}}function kl(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;ht=s}function ps(s){if(s!==ht)return!1;if(!bt)return kl(s),bt=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!jo(s.type,s.memoizedProps)),c&&(c=Rt)){if(mr(s))throw Us(),Error(n(418));for(;c;)Yn(s,c),c=ji(c.nextSibling)}if(kl(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 g=s.data;if(g==="/$"){if(c===0){Rt=ji(s.nextSibling);break e}c--}else g!=="$"&&g!=="$!"&&g!=="$?"||c++}s=s.nextSibling}Rt=null}}else Rt=ht?ji(s.stateNode.nextSibling):null;return!0}function Us(){for(var s=Rt;s;)s=ji(s.nextSibling)}function qs(){Rt=ht=null,bt=!1}function _l(s){nn===null?nn=[s]:nn.push(s)}var _d=j.ReactCurrentBatchConfig;function hs(s,c,g){if(s=g.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(g._owner){if(g=g._owner,g){if(g.tag!==1)throw Error(n(309));var b=g.stateNode}if(!b)throw Error(n(147,s));var E=b,C=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(B){var ne=E.refs;B===null?delete ne[C]:ne[C]=B},c._stringRef=C,c)}if(typeof s!="string")throw Error(n(284));if(!g._owner)throw Error(n(290,s))}return s}function Mo(s,c){throw s=Object.prototype.toString.call(c),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Tc(s){var c=s._init;return c(s._payload)}function Rc(s){function c(ve,he){if(s){var _e=ve.deletions;_e===null?(ve.deletions=[he],ve.flags|=16):_e.push(he)}}function g(ve,he){if(!s)return null;for(;he!==null;)c(ve,he),he=he.sibling;return null}function b(ve,he){for(ve=new Map;he!==null;)he.key!==null?ve.set(he.key,he):ve.set(he.index,he),he=he.sibling;return ve}function E(ve,he){return ve=Xs(ve,he),ve.index=0,ve.sibling=null,ve}function C(ve,he,_e){return ve.index=_e,s?(_e=ve.alternate,_e!==null?(_e=_e.index,_e<he?(ve.flags|=2,he):_e):(ve.flags|=2,he)):(ve.flags|=1048576,he)}function B(ve){return s&&ve.alternate===null&&(ve.flags|=2),ve}function ne(ve,he,_e,ut){return he===null||he.tag!==6?(he=$h(_e,ve.mode,ut),he.return=ve,he):(he=E(he,_e),he.return=ve,he)}function ce(ve,he,_e,ut){var Ut=_e.type;return Ut===I?Ze(ve,he,_e.props.children,ut,_e.key):he!==null&&(he.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===Z&&Tc(Ut)===he.type)?(ut=E(he,_e.props),ut.ref=hs(ve,he,_e),ut.return=ve,ut):(ut=$d(_e.type,_e.key,_e.props,null,ve.mode,ut),ut.ref=hs(ve,he,_e),ut.return=ve,ut)}function Se(ve,he,_e,ut){return he===null||he.tag!==4||he.stateNode.containerInfo!==_e.containerInfo||he.stateNode.implementation!==_e.implementation?(he=Wh(_e,ve.mode,ut),he.return=ve,he):(he=E(he,_e.children||[]),he.return=ve,he)}function Ze(ve,he,_e,ut,Ut){return he===null||he.tag!==7?(he=Uo(_e,ve.mode,ut,Ut),he.return=ve,he):(he=E(he,_e),he.return=ve,he)}function tt(ve,he,_e){if(typeof he=="string"&&he!==""||typeof he=="number")return he=$h(""+he,ve.mode,_e),he.return=ve,he;if(typeof he=="object"&&he!==null){switch(he.$$typeof){case R:return _e=$d(he.type,he.key,he.props,null,ve.mode,_e),_e.ref=hs(ve,null,he),_e.return=ve,_e;case T:return he=Wh(he,ve.mode,_e),he.return=ve,he;case Z:var ut=he._init;return tt(ve,ut(he._payload),_e)}if(rn(he)||ae(he))return he=Uo(he,ve.mode,_e,null),he.return=ve,he;Mo(ve,he)}return null}function Ge(ve,he,_e,ut){var Ut=he!==null?he.key:null;if(typeof _e=="string"&&_e!==""||typeof _e=="number")return Ut!==null?null:ne(ve,he,""+_e,ut);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case R:return _e.key===Ut?ce(ve,he,_e,ut):null;case T:return _e.key===Ut?Se(ve,he,_e,ut):null;case Z:return Ut=_e._init,Ge(ve,he,Ut(_e._payload),ut)}if(rn(_e)||ae(_e))return Ut!==null?null:Ze(ve,he,_e,ut,null);Mo(ve,_e)}return null}function wt(ve,he,_e,ut,Ut){if(typeof ut=="string"&&ut!==""||typeof ut=="number")return ve=ve.get(_e)||null,ne(he,ve,""+ut,Ut);if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case R:return ve=ve.get(ut.key===null?_e:ut.key)||null,ce(he,ve,ut,Ut);case T:return ve=ve.get(ut.key===null?_e:ut.key)||null,Se(he,ve,ut,Ut);case Z:var Yt=ut._init;return wt(ve,he,_e,Yt(ut._payload),Ut)}if(rn(ut)||ae(ut))return ve=ve.get(_e)||null,Ze(he,ve,ut,Ut,null);Mo(he,ut)}return null}function Lt(ve,he,_e,ut){for(var Ut=null,Yt=null,Qt=he,an=he=0,Hr=null;Qt!==null&&an<_e.length;an++){Qt.index>an?(Hr=Qt,Qt=null):Hr=Qt.sibling;var Ln=Ge(ve,Qt,_e[an],ut);if(Ln===null){Qt===null&&(Qt=Hr);break}s&&Qt&&Ln.alternate===null&&c(ve,Qt),he=C(Ln,he,an),Yt===null?Ut=Ln:Yt.sibling=Ln,Yt=Ln,Qt=Hr}if(an===_e.length)return g(ve,Qt),bt&&pe(ve,an),Ut;if(Qt===null){for(;an<_e.length;an++)Qt=tt(ve,_e[an],ut),Qt!==null&&(he=C(Qt,he,an),Yt===null?Ut=Qt:Yt.sibling=Qt,Yt=Qt);return bt&&pe(ve,an),Ut}for(Qt=b(ve,Qt);an<_e.length;an++)Hr=wt(Qt,ve,an,_e[an],ut),Hr!==null&&(s&&Hr.alternate!==null&&Qt.delete(Hr.key===null?an:Hr.key),he=C(Hr,he,an),Yt===null?Ut=Hr:Yt.sibling=Hr,Yt=Hr);return s&&Qt.forEach(function(Zs){return c(ve,Zs)}),bt&&pe(ve,an),Ut}function Ot(ve,he,_e,ut){var Ut=ae(_e);if(typeof Ut!="function")throw Error(n(150));if(_e=Ut.call(_e),_e==null)throw Error(n(151));for(var Yt=Ut=null,Qt=he,an=he=0,Hr=null,Ln=_e.next();Qt!==null&&!Ln.done;an++,Ln=_e.next()){Qt.index>an?(Hr=Qt,Qt=null):Hr=Qt.sibling;var Zs=Ge(ve,Qt,Ln.value,ut);if(Zs===null){Qt===null&&(Qt=Hr);break}s&&Qt&&Zs.alternate===null&&c(ve,Qt),he=C(Zs,he,an),Yt===null?Ut=Zs:Yt.sibling=Zs,Yt=Zs,Qt=Hr}if(Ln.done)return g(ve,Qt),bt&&pe(ve,an),Ut;if(Qt===null){for(;!Ln.done;an++,Ln=_e.next())Ln=tt(ve,Ln.value,ut),Ln!==null&&(he=C(Ln,he,an),Yt===null?Ut=Ln:Yt.sibling=Ln,Yt=Ln);return bt&&pe(ve,an),Ut}for(Qt=b(ve,Qt);!Ln.done;an++,Ln=_e.next())Ln=wt(Qt,ve,an,Ln.value,ut),Ln!==null&&(s&&Ln.alternate!==null&&Qt.delete(Ln.key===null?an:Ln.key),he=C(Ln,he,an),Yt===null?Ut=Ln:Yt.sibling=Ln,Yt=Ln);return s&&Qt.forEach(function(MM){return c(ve,MM)}),bt&&pe(ve,an),Ut}function kr(ve,he,_e,ut){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 R:e:{for(var Ut=_e.key,Yt=he;Yt!==null;){if(Yt.key===Ut){if(Ut=_e.type,Ut===I){if(Yt.tag===7){g(ve,Yt.sibling),he=E(Yt,_e.props.children),he.return=ve,ve=he;break e}}else if(Yt.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===Z&&Tc(Ut)===Yt.type){g(ve,Yt.sibling),he=E(Yt,_e.props),he.ref=hs(ve,Yt,_e),he.return=ve,ve=he;break e}g(ve,Yt);break}else c(ve,Yt);Yt=Yt.sibling}_e.type===I?(he=Uo(_e.props.children,ve.mode,ut,_e.key),he.return=ve,ve=he):(ut=$d(_e.type,_e.key,_e.props,null,ve.mode,ut),ut.ref=hs(ve,he,_e),ut.return=ve,ve=ut)}return B(ve);case T:e:{for(Yt=_e.key;he!==null;){if(he.key===Yt)if(he.tag===4&&he.stateNode.containerInfo===_e.containerInfo&&he.stateNode.implementation===_e.implementation){g(ve,he.sibling),he=E(he,_e.children||[]),he.return=ve,ve=he;break e}else{g(ve,he);break}else c(ve,he);he=he.sibling}he=Wh(_e,ve.mode,ut),he.return=ve,ve=he}return B(ve);case Z:return Yt=_e._init,kr(ve,he,Yt(_e._payload),ut)}if(rn(_e))return Lt(ve,he,_e,ut);if(ae(_e))return Ot(ve,he,_e,ut);Mo(ve,_e)}return typeof _e=="string"&&_e!==""||typeof _e=="number"?(_e=""+_e,he!==null&&he.tag===6?(g(ve,he.sibling),he=E(he,_e),he.return=ve,ve=he):(g(ve,he),he=$h(_e,ve.mode,ut),he.return=ve,ve=he),B(ve)):g(ve,he)}return kr}var Rn=Rc(!0),Hi=Rc(!1),vr=za(null),Er=null,Hs=null,eh=null;function th(){eh=Hs=Er=null}function nh(s){var c=vr.current;Mn(vr),s._currentValue=c}function rh(s,c,g){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===g)break;s=s.return}}function wl(s,c){Er=s,eh=Hs=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(Ti=!0),s.firstContext=null)}function ra(s){var c=s._currentValue;if(eh!==s)if(s={context:s,memoizedValue:c,next:null},Hs===null){if(Er===null)throw Error(n(308));Hs=s,Er.dependencies={lanes:0,firstContext:s}}else Hs=Hs.next=s;return c}var Lo=null;function ih(s){Lo===null?Lo=[s]:Lo.push(s)}function T1(s,c,g,b){var E=c.interleaved;return E===null?(g.next=g,ih(c)):(g.next=E.next,E.next=g),c.interleaved=g,gs(s,b)}function gs(s,c){s.lanes|=c;var g=s.alternate;for(g!==null&&(g.lanes|=c),g=s,s=s.return;s!==null;)s.childLanes|=c,g=s.alternate,g!==null&&(g.childLanes|=c),g=s,s=s.return;return g.tag===3?g.stateNode:null}var $s=!1;function ah(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function R1(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 ms(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function Ws(s,c,g){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(An&2)!==0){var E=b.pending;return E===null?c.next=c:(c.next=E.next,E.next=c),b.pending=c,gs(s,g)}return E=b.interleaved,E===null?(c.next=c,ih(b)):(c.next=E.next,E.next=c),b.interleaved=c,gs(s,g)}function wd(s,c,g){if(c=c.updateQueue,c!==null&&(c=c.shared,(g&4194240)!==0)){var b=c.lanes;b&=s.pendingLanes,g|=b,c.lanes=g,Xi(s,g)}}function A1(s,c){var g=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,g===b)){var E=null,C=null;if(g=g.firstBaseUpdate,g!==null){do{var B={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};C===null?E=C=B:C=C.next=B,g=g.next}while(g!==null);C===null?E=C=c:C=C.next=c}else E=C=c;g={baseState:b.baseState,firstBaseUpdate:E,lastBaseUpdate:C,shared:b.shared,effects:b.effects},s.updateQueue=g;return}s=g.lastBaseUpdate,s===null?g.firstBaseUpdate=c:s.next=c,g.lastBaseUpdate=c}function Sd(s,c,g,b){var E=s.updateQueue;$s=!1;var C=E.firstBaseUpdate,B=E.lastBaseUpdate,ne=E.shared.pending;if(ne!==null){E.shared.pending=null;var ce=ne,Se=ce.next;ce.next=null,B===null?C=Se:B.next=Se,B=ce;var Ze=s.alternate;Ze!==null&&(Ze=Ze.updateQueue,ne=Ze.lastBaseUpdate,ne!==B&&(ne===null?Ze.firstBaseUpdate=Se:ne.next=Se,Ze.lastBaseUpdate=ce))}if(C!==null){var tt=E.baseState;B=0,Ze=Se=ce=null,ne=C;do{var Ge=ne.lane,wt=ne.eventTime;if((b&Ge)===Ge){Ze!==null&&(Ze=Ze.next={eventTime:wt,lane:0,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null});e:{var Lt=s,Ot=ne;switch(Ge=c,wt=g,Ot.tag){case 1:if(Lt=Ot.payload,typeof Lt=="function"){tt=Lt.call(wt,tt,Ge);break e}tt=Lt;break e;case 3:Lt.flags=Lt.flags&-65537|128;case 0:if(Lt=Ot.payload,Ge=typeof Lt=="function"?Lt.call(wt,tt,Ge):Lt,Ge==null)break e;tt=P({},tt,Ge);break e;case 2:$s=!0}}ne.callback!==null&&ne.lane!==0&&(s.flags|=64,Ge=E.effects,Ge===null?E.effects=[ne]:Ge.push(ne))}else wt={eventTime:wt,lane:Ge,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null},Ze===null?(Se=Ze=wt,ce=tt):Ze=Ze.next=wt,B|=Ge;if(ne=ne.next,ne===null){if(ne=E.shared.pending,ne===null)break;Ge=ne,ne=Ge.next,Ge.next=null,E.lastBaseUpdate=Ge,E.shared.pending=null}}while(!0);if(Ze===null&&(ce=tt),E.baseState=ce,E.firstBaseUpdate=Se,E.lastBaseUpdate=Ze,c=E.shared.interleaved,c!==null){E=c;do B|=E.lane,E=E.next;while(E!==c)}else C===null&&(E.shared.lanes=0);Po|=B,s.lanes=B,s.memoizedState=tt}}function I1(s,c,g){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],E=b.callback;if(E!==null){if(b.callback=null,b=g,typeof E!="function")throw Error(n(191,E));E.call(b)}}}var Ac={},Ua=za(Ac),Ic=za(Ac),Mc=za(Ac);function Oo(s){if(s===Ac)throw Error(n(174));return s}function sh(s,c){switch(Wn(Mc,c),Wn(Ic,s),Wn(Ua,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)}Mn(Ua),Wn(Ua,c)}function Sl(){Mn(Ua),Mn(Ic),Mn(Mc)}function M1(s){Oo(Mc.current);var c=Oo(Ua.current),g=ue(c,s.type);c!==g&&(Wn(Ic,s),Wn(Ua,g))}function oh(s){Ic.current===s&&(Mn(Ua),Mn(Ic))}var dr=za(0);function Ed(s){for(var c=s;c!==null;){if(c.tag===13){var g=c.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||g.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 lh=[];function ch(){for(var s=0;s<lh.length;s++)lh[s]._workInProgressVersionPrimary=null;lh.length=0}var Nd=j.ReactCurrentDispatcher,uh=j.ReactCurrentBatchConfig,Do=0,fr=null,Mr=null,Ur=null,Cd=!1,Lc=!1,Oc=0,tM=0;function ui(){throw Error(n(321))}function dh(s,c){if(c===null)return!1;for(var g=0;g<c.length&&g<s.length;g++)if(!Ni(s[g],c[g]))return!1;return!0}function fh(s,c,g,b,E,C){if(Do=C,fr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Nd.current=s===null||s.memoizedState===null?aM:sM,s=g(b,E),Lc){C=0;do{if(Lc=!1,Oc=0,25<=C)throw Error(n(301));C+=1,Ur=Mr=null,c.updateQueue=null,Nd.current=oM,s=g(b,E)}while(Lc)}if(Nd.current=Rd,c=Mr!==null&&Mr.next!==null,Do=0,Ur=Mr=fr=null,Cd=!1,c)throw Error(n(300));return s}function ph(){var s=Oc!==0;return Oc=0,s}function qa(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?fr.memoizedState=Ur=s:Ur=Ur.next=s,Ur}function ia(){if(Mr===null){var s=fr.alternate;s=s!==null?s.memoizedState:null}else s=Mr.next;var c=Ur===null?fr.memoizedState:Ur.next;if(c!==null)Ur=c,Mr=s;else{if(s===null)throw Error(n(310));Mr=s,s={memoizedState:Mr.memoizedState,baseState:Mr.baseState,baseQueue:Mr.baseQueue,queue:Mr.queue,next:null},Ur===null?fr.memoizedState=Ur=s:Ur=Ur.next=s}return Ur}function Dc(s,c){return typeof c=="function"?c(s):c}function hh(s){var c=ia(),g=c.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=s;var b=Mr,E=b.baseQueue,C=g.pending;if(C!==null){if(E!==null){var B=E.next;E.next=C.next,C.next=B}b.baseQueue=E=C,g.pending=null}if(E!==null){C=E.next,b=b.baseState;var ne=B=null,ce=null,Se=C;do{var Ze=Se.lane;if((Do&Ze)===Ze)ce!==null&&(ce=ce.next={lane:0,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null}),b=Se.hasEagerState?Se.eagerState:s(b,Se.action);else{var tt={lane:Ze,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null};ce===null?(ne=ce=tt,B=b):ce=ce.next=tt,fr.lanes|=Ze,Po|=Ze}Se=Se.next}while(Se!==null&&Se!==C);ce===null?B=b:ce.next=ne,Ni(b,c.memoizedState)||(Ti=!0),c.memoizedState=b,c.baseState=B,c.baseQueue=ce,g.lastRenderedState=b}if(s=g.interleaved,s!==null){E=s;do C=E.lane,fr.lanes|=C,Po|=C,E=E.next;while(E!==s)}else E===null&&(g.lanes=0);return[c.memoizedState,g.dispatch]}function gh(s){var c=ia(),g=c.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=s;var b=g.dispatch,E=g.pending,C=c.memoizedState;if(E!==null){g.pending=null;var B=E=E.next;do C=s(C,B.action),B=B.next;while(B!==E);Ni(C,c.memoizedState)||(Ti=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),g.lastRenderedState=C}return[C,b]}function L1(){}function O1(s,c){var g=fr,b=ia(),E=c(),C=!Ni(b.memoizedState,E);if(C&&(b.memoizedState=E,Ti=!0),b=b.queue,mh(F1.bind(null,g,b,s),[s]),b.getSnapshot!==c||C||Ur!==null&&Ur.memoizedState.tag&1){if(g.flags|=2048,Pc(9,P1.bind(null,g,b,E,c),void 0,null),qr===null)throw Error(n(349));(Do&30)!==0||D1(g,c,E)}return E}function D1(s,c,g){s.flags|=16384,s={getSnapshot:c,value:g},c=fr.updateQueue,c===null?(c={lastEffect:null,stores:null},fr.updateQueue=c,c.stores=[s]):(g=c.stores,g===null?c.stores=[s]:g.push(s))}function P1(s,c,g,b){c.value=g,c.getSnapshot=b,B1(c)&&z1(s)}function F1(s,c,g){return g(function(){B1(c)&&z1(s)})}function B1(s){var c=s.getSnapshot;s=s.value;try{var g=c();return!Ni(s,g)}catch{return!0}}function z1(s){var c=gs(s,1);c!==null&&Sa(c,s,1,-1)}function U1(s){var c=qa();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=iM.bind(null,fr,s),[c.memoizedState,s]}function Pc(s,c,g,b){return s={tag:s,create:c,destroy:g,deps:b,next:null},c=fr.updateQueue,c===null?(c={lastEffect:null,stores:null},fr.updateQueue=c,c.lastEffect=s.next=s):(g=c.lastEffect,g===null?c.lastEffect=s.next=s:(b=g.next,g.next=s,s.next=b,c.lastEffect=s)),s}function q1(){return ia().memoizedState}function jd(s,c,g,b){var E=qa();fr.flags|=s,E.memoizedState=Pc(1|c,g,void 0,b===void 0?null:b)}function Td(s,c,g,b){var E=ia();b=b===void 0?null:b;var C=void 0;if(Mr!==null){var B=Mr.memoizedState;if(C=B.destroy,b!==null&&dh(b,B.deps)){E.memoizedState=Pc(c,g,C,b);return}}fr.flags|=s,E.memoizedState=Pc(1|c,g,C,b)}function H1(s,c){return jd(8390656,8,s,c)}function mh(s,c){return Td(2048,8,s,c)}function $1(s,c){return Td(4,2,s,c)}function W1(s,c){return Td(4,4,s,c)}function V1(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 G1(s,c,g){return g=g!=null?g.concat([s]):null,Td(4,4,V1.bind(null,c,s),g)}function xh(){}function K1(s,c){var g=ia();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&dh(c,b[1])?b[0]:(g.memoizedState=[s,c],s)}function Y1(s,c){var g=ia();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&dh(c,b[1])?b[0]:(s=s(),g.memoizedState=[s,c],s)}function Q1(s,c,g){return(Do&21)===0?(s.baseState&&(s.baseState=!1,Ti=!0),s.memoizedState=g):(Ni(g,c)||(g=Ya(),fr.lanes|=g,Po|=g,s.baseState=!0),c)}function nM(s,c){var g=ln;ln=g!==0&&4>g?g:4,s(!0);var b=uh.transition;uh.transition={};try{s(!1),c()}finally{ln=g,uh.transition=b}}function X1(){return ia().memoizedState}function rM(s,c,g){var b=Ys(s);if(g={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null},Z1(s))J1(c,g);else if(g=T1(s,c,g,b),g!==null){var E=_i();Sa(g,s,b,E),e_(g,c,b)}}function iM(s,c,g){var b=Ys(s),E={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null};if(Z1(s))J1(c,E);else{var C=s.alternate;if(s.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var B=c.lastRenderedState,ne=C(B,g);if(E.hasEagerState=!0,E.eagerState=ne,Ni(ne,B)){var ce=c.interleaved;ce===null?(E.next=E,ih(c)):(E.next=ce.next,ce.next=E),c.interleaved=E;return}}catch{}finally{}g=T1(s,c,E,b),g!==null&&(E=_i(),Sa(g,s,b,E),e_(g,c,b))}}function Z1(s){var c=s.alternate;return s===fr||c!==null&&c===fr}function J1(s,c){Lc=Cd=!0;var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}function e_(s,c,g){if((g&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,g|=b,c.lanes=g,Xi(s,g)}}var Rd={readContext:ra,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},aM={readContext:ra,useCallback:function(s,c){return qa().memoizedState=[s,c===void 0?null:c],s},useContext:ra,useEffect:H1,useImperativeHandle:function(s,c,g){return g=g!=null?g.concat([s]):null,jd(4194308,4,V1.bind(null,c,s),g)},useLayoutEffect:function(s,c){return jd(4194308,4,s,c)},useInsertionEffect:function(s,c){return jd(4,2,s,c)},useMemo:function(s,c){var g=qa();return c=c===void 0?null:c,s=s(),g.memoizedState=[s,c],s},useReducer:function(s,c,g){var b=qa();return c=g!==void 0?g(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=rM.bind(null,fr,s),[b.memoizedState,s]},useRef:function(s){var c=qa();return s={current:s},c.memoizedState=s},useState:U1,useDebugValue:xh,useDeferredValue:function(s){return qa().memoizedState=s},useTransition:function(){var s=U1(!1),c=s[0];return s=nM.bind(null,s[1]),qa().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,g){var b=fr,E=qa();if(bt){if(g===void 0)throw Error(n(407));g=g()}else{if(g=c(),qr===null)throw Error(n(349));(Do&30)!==0||D1(b,c,g)}E.memoizedState=g;var C={value:g,getSnapshot:c};return E.queue=C,H1(F1.bind(null,b,C,s),[s]),b.flags|=2048,Pc(9,P1.bind(null,b,C,g,c),void 0,null),g},useId:function(){var s=qa(),c=qr.identifierPrefix;if(bt){var g=X,b=ye;g=(b&~(1<<32-Pn(b)-1)).toString(32)+g,c=":"+c+"R"+g,g=Oc++,0<g&&(c+="H"+g.toString(32)),c+=":"}else g=tM++,c=":"+c+"r"+g.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},sM={readContext:ra,useCallback:K1,useContext:ra,useEffect:mh,useImperativeHandle:G1,useInsertionEffect:$1,useLayoutEffect:W1,useMemo:Y1,useReducer:hh,useRef:q1,useState:function(){return hh(Dc)},useDebugValue:xh,useDeferredValue:function(s){var c=ia();return Q1(c,Mr.memoizedState,s)},useTransition:function(){var s=hh(Dc)[0],c=ia().memoizedState;return[s,c]},useMutableSource:L1,useSyncExternalStore:O1,useId:X1,unstable_isNewReconciler:!1},oM={readContext:ra,useCallback:K1,useContext:ra,useEffect:mh,useImperativeHandle:G1,useInsertionEffect:$1,useLayoutEffect:W1,useMemo:Y1,useReducer:gh,useRef:q1,useState:function(){return gh(Dc)},useDebugValue:xh,useDeferredValue:function(s){var c=ia();return Mr===null?c.memoizedState=s:Q1(c,Mr.memoizedState,s)},useTransition:function(){var s=gh(Dc)[0],c=ia().memoizedState;return[s,c]},useMutableSource:L1,useSyncExternalStore:O1,useId:X1,unstable_isNewReconciler:!1};function ka(s,c){if(s&&s.defaultProps){c=P({},c),s=s.defaultProps;for(var g in s)c[g]===void 0&&(c[g]=s[g]);return c}return c}function yh(s,c,g,b){c=s.memoizedState,g=g(b,c),g=g==null?c:P({},c,g),s.memoizedState=g,s.lanes===0&&(s.updateQueue.baseState=g)}var Ad={isMounted:function(s){return(s=s._reactInternals)?ar(s)===s:!1},enqueueSetState:function(s,c,g){s=s._reactInternals;var b=_i(),E=Ys(s),C=ms(b,E);C.payload=c,g!=null&&(C.callback=g),c=Ws(s,C,E),c!==null&&(Sa(c,s,E,b),wd(c,s,E))},enqueueReplaceState:function(s,c,g){s=s._reactInternals;var b=_i(),E=Ys(s),C=ms(b,E);C.tag=1,C.payload=c,g!=null&&(C.callback=g),c=Ws(s,C,E),c!==null&&(Sa(c,s,E,b),wd(c,s,E))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var g=_i(),b=Ys(s),E=ms(g,b);E.tag=2,c!=null&&(E.callback=c),c=Ws(s,E,b),c!==null&&(Sa(c,s,b,g),wd(c,s,b))}};function t_(s,c,g,b,E,C,B){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,C,B):c.prototype&&c.prototype.isPureReactComponent?!Ms(g,b)||!Ms(E,C):!0}function n_(s,c,g){var b=!1,E=ta,C=c.contextType;return typeof C=="object"&&C!==null?C=ra(C):(E=Yr(c)?ds:zr.current,b=c.contextTypes,C=(b=b!=null)?Bs(s,E):ta),c=new c(g,C),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Ad,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=E,s.__reactInternalMemoizedMaskedChildContext=C),c}function r_(s,c,g,b){s=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(g,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(g,b),c.state!==s&&Ad.enqueueReplaceState(c,c.state,null)}function bh(s,c,g,b){var E=s.stateNode;E.props=g,E.state=s.memoizedState,E.refs={},ah(s);var C=c.contextType;typeof C=="object"&&C!==null?E.context=ra(C):(C=Yr(c)?ds:zr.current,E.context=Bs(s,C)),E.state=s.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(yh(s,c,C,g),E.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(c=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),c!==E.state&&Ad.enqueueReplaceState(E,E.state,null),Sd(s,g,E,b),E.state=s.memoizedState),typeof E.componentDidMount=="function"&&(s.flags|=4194308)}function El(s,c){try{var g="",b=c;do g+=W(b),b=b.return;while(b);var E=g}catch(C){E=`
|
|
39
|
+
Error generating stack: `+C.message+`
|
|
40
|
+
`+C.stack}return{value:s,source:c,stack:E,digest:null}}function vh(s,c,g){return{value:s,source:null,stack:g??null,digest:c??null}}function kh(s,c){try{console.error(c.value)}catch(g){setTimeout(function(){throw g})}}var lM=typeof WeakMap=="function"?WeakMap:Map;function i_(s,c,g){g=ms(-1,g),g.tag=3,g.payload={element:null};var b=c.value;return g.callback=function(){Fd||(Fd=!0,Dh=b),kh(s,c)},g}function a_(s,c,g){g=ms(-1,g),g.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var E=c.value;g.payload=function(){return b(E)},g.callback=function(){kh(s,c)}}var C=s.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(g.callback=function(){kh(s,c),typeof b!="function"&&(Gs===null?Gs=new Set([this]):Gs.add(this));var B=c.stack;this.componentDidCatch(c.value,{componentStack:B!==null?B:""})}),g}function s_(s,c,g){var b=s.pingCache;if(b===null){b=s.pingCache=new lM;var E=new Set;b.set(c,E)}else E=b.get(c),E===void 0&&(E=new Set,b.set(c,E));E.has(g)||(E.add(g),s=_M.bind(null,s,c,g),c.then(s,s))}function o_(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 l_(s,c,g,b,E){return(s.mode&1)===0?(s===c?s.flags|=65536:(s.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(c=ms(-1,1),c.tag=2,Ws(g,c,1))),g.lanes|=1),s):(s.flags|=65536,s.lanes=E,s)}var cM=j.ReactCurrentOwner,Ti=!1;function ki(s,c,g,b){c.child=s===null?Hi(c,null,g,b):Rn(c,s.child,g,b)}function c_(s,c,g,b,E){g=g.render;var C=c.ref;return wl(c,E),b=fh(s,c,g,b,C,E),g=ph(),s!==null&&!Ti?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~E,xs(s,c,E)):(bt&&g&&De(c),c.flags|=1,ki(s,c,b,E),c.child)}function u_(s,c,g,b,E){if(s===null){var C=g.type;return typeof C=="function"&&!Hh(C)&&C.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(c.tag=15,c.type=C,d_(s,c,C,b,E)):(s=$d(g.type,null,b,c,c.mode,E),s.ref=c.ref,s.return=c,c.child=s)}if(C=s.child,(s.lanes&E)===0){var B=C.memoizedProps;if(g=g.compare,g=g!==null?g:Ms,g(B,b)&&s.ref===c.ref)return xs(s,c,E)}return c.flags|=1,s=Xs(C,b),s.ref=c.ref,s.return=c,c.child=s}function d_(s,c,g,b,E){if(s!==null){var C=s.memoizedProps;if(Ms(C,b)&&s.ref===c.ref)if(Ti=!1,c.pendingProps=b=C,(s.lanes&E)!==0)(s.flags&131072)!==0&&(Ti=!0);else return c.lanes=s.lanes,xs(s,c,E)}return _h(s,c,g,b,E)}function f_(s,c,g){var b=c.pendingProps,E=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},Wn(Cl,$i),$i|=g;else{if((g&1073741824)===0)return s=C!==null?C.baseLanes|g:g,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,Wn(Cl,$i),$i|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=C!==null?C.baseLanes:g,Wn(Cl,$i),$i|=b}else C!==null?(b=C.baseLanes|g,c.memoizedState=null):b=g,Wn(Cl,$i),$i|=b;return ki(s,c,E,g),c.child}function p_(s,c){var g=c.ref;(s===null&&g!==null||s!==null&&s.ref!==g)&&(c.flags|=512,c.flags|=2097152)}function _h(s,c,g,b,E){var C=Yr(g)?ds:zr.current;return C=Bs(c,C),wl(c,E),g=fh(s,c,g,b,C,E),b=ph(),s!==null&&!Ti?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~E,xs(s,c,E)):(bt&&b&&De(c),c.flags|=1,ki(s,c,g,E),c.child)}function h_(s,c,g,b,E){if(Yr(g)){var C=!0;Io(c)}else C=!1;if(wl(c,E),c.stateNode===null)Md(s,c),n_(c,g,b),bh(c,g,b,E),b=!0;else if(s===null){var B=c.stateNode,ne=c.memoizedProps;B.props=ne;var ce=B.context,Se=g.contextType;typeof Se=="object"&&Se!==null?Se=ra(Se):(Se=Yr(g)?ds:zr.current,Se=Bs(c,Se));var Ze=g.getDerivedStateFromProps,tt=typeof Ze=="function"||typeof B.getSnapshotBeforeUpdate=="function";tt||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(ne!==b||ce!==Se)&&r_(c,B,b,Se),$s=!1;var Ge=c.memoizedState;B.state=Ge,Sd(c,b,B,E),ce=c.memoizedState,ne!==b||Ge!==ce||ci.current||$s?(typeof Ze=="function"&&(yh(c,g,Ze,b),ce=c.memoizedState),(ne=$s||t_(c,g,ne,b,Ge,ce,Se))?(tt||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(c.flags|=4194308)):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=ce),B.props=b,B.state=ce,B.context=Se,b=ne):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{B=c.stateNode,R1(s,c),ne=c.memoizedProps,Se=c.type===c.elementType?ne:ka(c.type,ne),B.props=Se,tt=c.pendingProps,Ge=B.context,ce=g.contextType,typeof ce=="object"&&ce!==null?ce=ra(ce):(ce=Yr(g)?ds:zr.current,ce=Bs(c,ce));var wt=g.getDerivedStateFromProps;(Ze=typeof wt=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(ne!==tt||Ge!==ce)&&r_(c,B,b,ce),$s=!1,Ge=c.memoizedState,B.state=Ge,Sd(c,b,B,E);var Lt=c.memoizedState;ne!==tt||Ge!==Lt||ci.current||$s?(typeof wt=="function"&&(yh(c,g,wt,b),Lt=c.memoizedState),(Se=$s||t_(c,g,Se,b,Ge,Lt,ce)||!1)?(Ze||typeof B.UNSAFE_componentWillUpdate!="function"&&typeof B.componentWillUpdate!="function"||(typeof B.componentWillUpdate=="function"&&B.componentWillUpdate(b,Lt,ce),typeof B.UNSAFE_componentWillUpdate=="function"&&B.UNSAFE_componentWillUpdate(b,Lt,ce)),typeof B.componentDidUpdate=="function"&&(c.flags|=4),typeof B.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof B.componentDidUpdate!="function"||ne===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||ne===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Lt),B.props=b,B.state=Lt,B.context=ce,b=Se):(typeof B.componentDidUpdate!="function"||ne===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||ne===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=1024),b=!1)}return wh(s,c,g,b,C,E)}function wh(s,c,g,b,E,C){p_(s,c);var B=(c.flags&128)!==0;if(!b&&!B)return E&&jc(c,g,!1),xs(s,c,C);b=c.stateNode,cM.current=c;var ne=B&&typeof g.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&B?(c.child=Rn(c,s.child,null,C),c.child=Rn(c,null,ne,C)):ki(s,c,ne,C),c.memoizedState=b.state,E&&jc(c,g,!0),c.child}function g_(s){var c=s.stateNode;c.pendingContext?zs(s,c.pendingContext,c.pendingContext!==c.context):c.context&&zs(s,c.context,!1),sh(s,c.containerInfo)}function m_(s,c,g,b,E){return qs(),_l(E),c.flags|=256,ki(s,c,g,b),c.child}var Sh={dehydrated:null,treeContext:null,retryLane:0};function Eh(s){return{baseLanes:s,cachePool:null,transitions:null}}function x_(s,c,g){var b=c.pendingProps,E=dr.current,C=!1,B=(c.flags&128)!==0,ne;if((ne=B)||(ne=s!==null&&s.memoizedState===null?!1:(E&2)!==0),ne?(C=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(E|=1),Wn(dr,E&1),s===null)return Un(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):(B=b.children,s=b.fallback,C?(b=c.mode,C=c.child,B={mode:"hidden",children:B},(b&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=B):C=Wd(B,b,0,null),s=Uo(s,b,g,null),C.return=c,s.return=c,C.sibling=s,c.child=C,c.child.memoizedState=Eh(g),c.memoizedState=Sh,s):Nh(c,B));if(E=s.memoizedState,E!==null&&(ne=E.dehydrated,ne!==null))return uM(s,c,B,b,ne,E,g);if(C){C=b.fallback,B=c.mode,E=s.child,ne=E.sibling;var ce={mode:"hidden",children:b.children};return(B&1)===0&&c.child!==E?(b=c.child,b.childLanes=0,b.pendingProps=ce,c.deletions=null):(b=Xs(E,ce),b.subtreeFlags=E.subtreeFlags&14680064),ne!==null?C=Xs(ne,C):(C=Uo(C,B,g,null),C.flags|=2),C.return=c,b.return=c,b.sibling=C,c.child=b,b=C,C=c.child,B=s.child.memoizedState,B=B===null?Eh(g):{baseLanes:B.baseLanes|g,cachePool:null,transitions:B.transitions},C.memoizedState=B,C.childLanes=s.childLanes&~g,c.memoizedState=Sh,b}return C=s.child,s=C.sibling,b=Xs(C,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=g),b.return=c,b.sibling=null,s!==null&&(g=c.deletions,g===null?(c.deletions=[s],c.flags|=16):g.push(s)),c.child=b,c.memoizedState=null,b}function Nh(s,c){return c=Wd({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function Id(s,c,g,b){return b!==null&&_l(b),Rn(c,s.child,null,g),s=Nh(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function uM(s,c,g,b,E,C,B){if(g)return c.flags&256?(c.flags&=-257,b=vh(Error(n(422))),Id(s,c,B,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(C=b.fallback,E=c.mode,b=Wd({mode:"visible",children:b.children},E,0,null),C=Uo(C,E,B,null),C.flags|=2,b.return=c,C.return=c,b.sibling=C,c.child=b,(c.mode&1)!==0&&Rn(c,s.child,null,B),c.child.memoizedState=Eh(B),c.memoizedState=Sh,C);if((c.mode&1)===0)return Id(s,c,B,null);if(E.data==="$!"){if(b=E.nextSibling&&E.nextSibling.dataset,b)var ne=b.dgst;return b=ne,C=Error(n(419)),b=vh(C,b,void 0),Id(s,c,B,b)}if(ne=(B&s.childLanes)!==0,Ti||ne){if(b=qr,b!==null){switch(B&-B){case 4:E=2;break;case 16:E=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:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(b.suspendedLanes|B))!==0?0:E,E!==0&&E!==C.retryLane&&(C.retryLane=E,gs(s,E),Sa(b,s,E,-1))}return qh(),b=vh(Error(n(421))),Id(s,c,B,b)}return E.data==="$?"?(c.flags|=128,c.child=s.child,c=wM.bind(null,s),E._reactRetry=c,null):(s=C.treeContext,Rt=ji(E.nextSibling),ht=c,bt=!0,nn=null,s!==null&&(mn[En++]=ye,mn[En++]=X,mn[En++]=Cn,ye=s.id,X=s.overflow,Cn=c),c=Nh(c,b.children),c.flags|=4096,c)}function y_(s,c,g){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),rh(s.return,c,g)}function Ch(s,c,g,b,E){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:g,tailMode:E}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=b,C.tail=g,C.tailMode=E)}function b_(s,c,g){var b=c.pendingProps,E=b.revealOrder,C=b.tail;if(ki(s,c,b.children,g),b=dr.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&&y_(s,g,c);else if(s.tag===19)y_(s,g,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(Wn(dr,b),(c.mode&1)===0)c.memoizedState=null;else switch(E){case"forwards":for(g=c.child,E=null;g!==null;)s=g.alternate,s!==null&&Ed(s)===null&&(E=g),g=g.sibling;g=E,g===null?(E=c.child,c.child=null):(E=g.sibling,g.sibling=null),Ch(c,!1,E,g,C);break;case"backwards":for(g=null,E=c.child,c.child=null;E!==null;){if(s=E.alternate,s!==null&&Ed(s)===null){c.child=E;break}s=E.sibling,E.sibling=g,g=E,E=s}Ch(c,!0,g,null,C);break;case"together":Ch(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Md(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function xs(s,c,g){if(s!==null&&(c.dependencies=s.dependencies),Po|=c.lanes,(g&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(n(153));if(c.child!==null){for(s=c.child,g=Xs(s,s.pendingProps),c.child=g,g.return=c;s.sibling!==null;)s=s.sibling,g=g.sibling=Xs(s,s.pendingProps),g.return=c;g.sibling=null}return c.child}function dM(s,c,g){switch(c.tag){case 3:g_(c),qs();break;case 5:M1(c);break;case 1:Yr(c.type)&&Io(c);break;case 4:sh(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,E=c.memoizedProps.value;Wn(vr,b._currentValue),b._currentValue=E;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(Wn(dr,dr.current&1),c.flags|=128,null):(g&c.child.childLanes)!==0?x_(s,c,g):(Wn(dr,dr.current&1),s=xs(s,c,g),s!==null?s.sibling:null);Wn(dr,dr.current&1);break;case 19:if(b=(g&c.childLanes)!==0,(s.flags&128)!==0){if(b)return b_(s,c,g);c.flags|=128}if(E=c.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Wn(dr,dr.current),b)break;return null;case 22:case 23:return c.lanes=0,f_(s,c,g)}return xs(s,c,g)}var v_,jh,k_,__;v_=function(s,c){for(var g=c.child;g!==null;){if(g.tag===5||g.tag===6)s.appendChild(g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===c)break;for(;g.sibling===null;){if(g.return===null||g.return===c)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},jh=function(){},k_=function(s,c,g,b){var E=s.memoizedProps;if(E!==b){s=c.stateNode,Oo(Ua.current);var C=null;switch(g){case"input":E=vt(s,E),b=vt(s,b),C=[];break;case"select":E=P({},E,{value:void 0}),b=P({},b,{value:void 0}),C=[];break;case"textarea":E=un(s,E),b=un(s,b),C=[];break;default:typeof E.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=yl)}hn(g,b);var B;g=null;for(Se in E)if(!b.hasOwnProperty(Se)&&E.hasOwnProperty(Se)&&E[Se]!=null)if(Se==="style"){var ne=E[Se];for(B in ne)ne.hasOwnProperty(B)&&(g||(g={}),g[B]="")}else Se!=="dangerouslySetInnerHTML"&&Se!=="children"&&Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&Se!=="autoFocus"&&(i.hasOwnProperty(Se)?C||(C=[]):(C=C||[]).push(Se,null));for(Se in b){var ce=b[Se];if(ne=E!=null?E[Se]:void 0,b.hasOwnProperty(Se)&&ce!==ne&&(ce!=null||ne!=null))if(Se==="style")if(ne){for(B in ne)!ne.hasOwnProperty(B)||ce&&ce.hasOwnProperty(B)||(g||(g={}),g[B]="");for(B in ce)ce.hasOwnProperty(B)&&ne[B]!==ce[B]&&(g||(g={}),g[B]=ce[B])}else g||(C||(C=[]),C.push(Se,g)),g=ce;else Se==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ne=ne?ne.__html:void 0,ce!=null&&ne!==ce&&(C=C||[]).push(Se,ce)):Se==="children"?typeof ce!="string"&&typeof ce!="number"||(C=C||[]).push(Se,""+ce):Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&(i.hasOwnProperty(Se)?(ce!=null&&Se==="onScroll"&&Kn("scroll",s),C||ne===ce||(C=[])):(C=C||[]).push(Se,ce))}g&&(C=C||[]).push("style",g);var Se=C;(c.updateQueue=Se)&&(c.flags|=4)}},__=function(s,c,g,b){g!==b&&(c.flags|=4)};function Fc(s,c){if(!bt)switch(s.tailMode){case"hidden":c=s.tail;for(var g=null;c!==null;)c.alternate!==null&&(g=c),c=c.sibling;g===null?s.tail=null:g.sibling=null;break;case"collapsed":g=s.tail;for(var b=null;g!==null;)g.alternate!==null&&(b=g),g=g.sibling;b===null?c||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function di(s){var c=s.alternate!==null&&s.alternate.child===s.child,g=0,b=0;if(c)for(var E=s.child;E!==null;)g|=E.lanes|E.childLanes,b|=E.subtreeFlags&14680064,b|=E.flags&14680064,E.return=s,E=E.sibling;else for(E=s.child;E!==null;)g|=E.lanes|E.childLanes,b|=E.subtreeFlags,b|=E.flags,E.return=s,E=E.sibling;return s.subtreeFlags|=b,s.childLanes=g,c}function fM(s,c,g){var b=c.pendingProps;switch(Xe(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return di(c),null;case 1:return Yr(c.type)&&fs(),di(c),null;case 3:return b=c.stateNode,Sl(),Mn(ci),Mn(zr),ch(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(ps(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,nn!==null&&(Bh(nn),nn=null))),jh(s,c),di(c),null;case 5:oh(c);var E=Oo(Mc.current);if(g=c.type,s!==null&&c.stateNode!=null)k_(s,c,g,b,E),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(n(166));return di(c),null}if(s=Oo(Ua.current),ps(c)){b=c.stateNode,g=c.type;var C=c.memoizedProps;switch(b[li]=c,b[cs]=C,s=(c.mode&1)!==0,g){case"dialog":Kn("cancel",b),Kn("close",b);break;case"iframe":case"object":case"embed":Kn("load",b);break;case"video":case"audio":for(E=0;E<No.length;E++)Kn(No[E],b);break;case"source":Kn("error",b);break;case"img":case"image":case"link":Kn("error",b),Kn("load",b);break;case"details":Kn("toggle",b);break;case"input":lt(b,C),Kn("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!C.multiple},Kn("invalid",b);break;case"textarea":mt(b,C),Kn("invalid",b)}hn(g,C),E=null;for(var B in C)if(C.hasOwnProperty(B)){var ne=C[B];B==="children"?typeof ne=="string"?b.textContent!==ne&&(C.suppressHydrationWarning!==!0&&xl(b.textContent,ne,s),E=["children",ne]):typeof ne=="number"&&b.textContent!==""+ne&&(C.suppressHydrationWarning!==!0&&xl(b.textContent,ne,s),E=["children",""+ne]):i.hasOwnProperty(B)&&ne!=null&&B==="onScroll"&&Kn("scroll",b)}switch(g){case"input":Ke(b),ft(b,C,!0);break;case"textarea":Ke(b),nt(b);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(b.onclick=yl)}b=E,c.updateQueue=b,b!==null&&(c.flags|=4)}else{B=E.nodeType===9?E:E.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=qe(g)),s==="http://www.w3.org/1999/xhtml"?g==="script"?(s=B.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=B.createElement(g,{is:b.is}):(s=B.createElement(g),g==="select"&&(B=s,b.multiple?B.multiple=!0:b.size&&(B.size=b.size))):s=B.createElementNS(s,g),s[li]=c,s[cs]=b,v_(s,c,!1,!1),c.stateNode=s;e:{switch(B=xe(g,b),g){case"dialog":Kn("cancel",s),Kn("close",s),E=b;break;case"iframe":case"object":case"embed":Kn("load",s),E=b;break;case"video":case"audio":for(E=0;E<No.length;E++)Kn(No[E],s);E=b;break;case"source":Kn("error",s),E=b;break;case"img":case"image":case"link":Kn("error",s),Kn("load",s),E=b;break;case"details":Kn("toggle",s),E=b;break;case"input":lt(s,b),E=vt(s,b),Kn("invalid",s);break;case"option":E=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},E=P({},b,{value:void 0}),Kn("invalid",s);break;case"textarea":mt(s,b),E=un(s,b),Kn("invalid",s);break;default:E=b}hn(g,E),ne=E;for(C in ne)if(ne.hasOwnProperty(C)){var ce=ne[C];C==="style"?jt(s,ce):C==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ce!=null&&Ue(s,ce)):C==="children"?typeof ce=="string"?(g!=="textarea"||ce!=="")&&He(s,ce):typeof ce=="number"&&He(s,""+ce):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(i.hasOwnProperty(C)?ce!=null&&C==="onScroll"&&Kn("scroll",s):ce!=null&&N(s,C,ce,B))}switch(g){case"input":Ke(s),ft(s,b,!1);break;case"textarea":Ke(s),nt(s);break;case"option":b.value!=null&&s.setAttribute("value",""+ie(b.value));break;case"select":s.multiple=!!b.multiple,C=b.value,C!=null?tn(s,!!b.multiple,C,!1):b.defaultValue!=null&&tn(s,!!b.multiple,b.defaultValue,!0);break;default:typeof E.onClick=="function"&&(s.onclick=yl)}switch(g){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 di(c),null;case 6:if(s&&c.stateNode!=null)__(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(g=Oo(Mc.current),Oo(Ua.current),ps(c)){if(b=c.stateNode,g=c.memoizedProps,b[li]=c,(C=b.nodeValue!==g)&&(s=ht,s!==null))switch(s.tag){case 3:xl(b.nodeValue,g,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&xl(b.nodeValue,g,(s.mode&1)!==0)}C&&(c.flags|=4)}else b=(g.nodeType===9?g:g.ownerDocument).createTextNode(b),b[li]=c,c.stateNode=b}return di(c),null;case 13:if(Mn(dr),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(bt&&Rt!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Us(),qs(),c.flags|=98560,C=!1;else if(C=ps(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[li]=c}else qs(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;di(c),C=!1}else nn!==null&&(Bh(nn),nn=null),C=!0;if(!C)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=g,c):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(c.child.flags|=8192,(c.mode&1)!==0&&(s===null||(dr.current&1)!==0?Lr===0&&(Lr=3):qh())),c.updateQueue!==null&&(c.flags|=4),di(c),null);case 4:return Sl(),jh(s,c),s===null&&Fr(c.stateNode.containerInfo),di(c),null;case 10:return nh(c.type._context),di(c),null;case 17:return Yr(c.type)&&fs(),di(c),null;case 19:if(Mn(dr),C=c.memoizedState,C===null)return di(c),null;if(b=(c.flags&128)!==0,B=C.rendering,B===null)if(b)Fc(C,!1);else{if(Lr!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(B=Ed(s),B!==null){for(c.flags|=128,Fc(C,!1),b=B.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=g,g=c.child;g!==null;)C=g,s=b,C.flags&=14680066,B=C.alternate,B===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=B.childLanes,C.lanes=B.lanes,C.child=B.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=B.memoizedProps,C.memoizedState=B.memoizedState,C.updateQueue=B.updateQueue,C.type=B.type,s=B.dependencies,C.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),g=g.sibling;return Wn(dr,dr.current&1|2),c.child}s=s.sibling}C.tail!==null&&$n()>jl&&(c.flags|=128,b=!0,Fc(C,!1),c.lanes=4194304)}else{if(!b)if(s=Ed(B),s!==null){if(c.flags|=128,b=!0,g=s.updateQueue,g!==null&&(c.updateQueue=g,c.flags|=4),Fc(C,!0),C.tail===null&&C.tailMode==="hidden"&&!B.alternate&&!bt)return di(c),null}else 2*$n()-C.renderingStartTime>jl&&g!==1073741824&&(c.flags|=128,b=!0,Fc(C,!1),c.lanes=4194304);C.isBackwards?(B.sibling=c.child,c.child=B):(g=C.last,g!==null?g.sibling=B:c.child=B,C.last=B)}return C.tail!==null?(c=C.tail,C.rendering=c,C.tail=c.sibling,C.renderingStartTime=$n(),c.sibling=null,g=dr.current,Wn(dr,b?g&1|2:g&1),c):(di(c),null);case 22:case 23:return Uh(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?($i&1073741824)!==0&&(di(c),c.subtreeFlags&6&&(c.flags|=8192)):di(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function pM(s,c){switch(Xe(c),c.tag){case 1:return Yr(c.type)&&fs(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return Sl(),Mn(ci),Mn(zr),ch(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return oh(c),null;case 13:if(Mn(dr),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(n(340));qs()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return Mn(dr),null;case 4:return Sl(),null;case 10:return nh(c.type._context),null;case 22:case 23:return Uh(),null;case 24:return null;default:return null}}var Ld=!1,fi=!1,hM=typeof WeakSet=="function"?WeakSet:Set,At=null;function Nl(s,c){var g=s.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(b){xr(s,c,b)}else g.current=null}function Th(s,c,g){try{g()}catch(b){xr(s,c,b)}}var w_=!1;function gM(s,c){if(Ec=Bt,s=bc(),zt(s)){if("selectionStart"in s)var g={start:s.selectionStart,end:s.selectionEnd};else e:{g=(g=s.ownerDocument)&&g.defaultView||window;var b=g.getSelection&&g.getSelection();if(b&&b.rangeCount!==0){g=b.anchorNode;var E=b.anchorOffset,C=b.focusNode;b=b.focusOffset;try{g.nodeType,C.nodeType}catch{g=null;break e}var B=0,ne=-1,ce=-1,Se=0,Ze=0,tt=s,Ge=null;t:for(;;){for(var wt;tt!==g||E!==0&&tt.nodeType!==3||(ne=B+E),tt!==C||b!==0&&tt.nodeType!==3||(ce=B+b),tt.nodeType===3&&(B+=tt.nodeValue.length),(wt=tt.firstChild)!==null;)Ge=tt,tt=wt;for(;;){if(tt===s)break t;if(Ge===g&&++Se===E&&(ne=B),Ge===C&&++Ze===b&&(ce=B),(wt=tt.nextSibling)!==null)break;tt=Ge,Ge=tt.parentNode}tt=wt}g=ne===-1||ce===-1?null:{start:ne,end:ce}}else g=null}g=g||{start:0,end:0}}else g=null;for(bl={focusedElem:s,selectionRange:g},Bt=!1,At=c;At!==null;)if(c=At,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,At=s;else for(;At!==null;){c=At;try{var Lt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Lt!==null){var Ot=Lt.memoizedProps,kr=Lt.memoizedState,ve=c.stateNode,he=ve.getSnapshotBeforeUpdate(c.elementType===c.type?Ot:ka(c.type,Ot),kr);ve.__reactInternalSnapshotBeforeUpdate=he}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(ut){xr(c,c.return,ut)}if(s=c.sibling,s!==null){s.return=c.return,At=s;break}At=c.return}return Lt=w_,w_=!1,Lt}function Bc(s,c,g){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var E=b=b.next;do{if((E.tag&s)===s){var C=E.destroy;E.destroy=void 0,C!==void 0&&Th(c,g,C)}E=E.next}while(E!==b)}}function Od(s,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var g=c=c.next;do{if((g.tag&s)===s){var b=g.create;g.destroy=b()}g=g.next}while(g!==c)}}function Rh(s){var c=s.ref;if(c!==null){var g=s.stateNode;switch(s.tag){case 5:s=g;break;default:s=g}typeof c=="function"?c(s):c.current=s}}function S_(s){var c=s.alternate;c!==null&&(s.alternate=null,S_(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[li],delete c[cs],delete c[Cc],delete c[Zp],delete c[Jp])),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 E_(s){return s.tag===5||s.tag===3||s.tag===4}function N_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||E_(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 Ah(s,c,g){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?g.nodeType===8?g.parentNode.insertBefore(s,c):g.insertBefore(s,c):(g.nodeType===8?(c=g.parentNode,c.insertBefore(s,g)):(c=g,c.appendChild(s)),g=g._reactRootContainer,g!=null||c.onclick!==null||(c.onclick=yl));else if(b!==4&&(s=s.child,s!==null))for(Ah(s,c,g),s=s.sibling;s!==null;)Ah(s,c,g),s=s.sibling}function Ih(s,c,g){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?g.insertBefore(s,c):g.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(Ih(s,c,g),s=s.sibling;s!==null;)Ih(s,c,g),s=s.sibling}var Qr=null,_a=!1;function Vs(s,c,g){for(g=g.child;g!==null;)C_(s,c,g),g=g.sibling}function C_(s,c,g){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(Vt,g)}catch{}switch(g.tag){case 5:fi||Nl(g,c);case 6:var b=Qr,E=_a;Qr=null,Vs(s,c,g),Qr=b,_a=E,Qr!==null&&(_a?(s=Qr,g=g.stateNode,s.nodeType===8?s.parentNode.removeChild(g):s.removeChild(g)):Qr.removeChild(g.stateNode));break;case 18:Qr!==null&&(_a?(s=Qr,g=g.stateNode,s.nodeType===8?Nc(s.parentNode,g):s.nodeType===1&&Nc(s,g),Me(s)):Nc(Qr,g.stateNode));break;case 4:b=Qr,E=_a,Qr=g.stateNode.containerInfo,_a=!0,Vs(s,c,g),Qr=b,_a=E;break;case 0:case 11:case 14:case 15:if(!fi&&(b=g.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){E=b=b.next;do{var C=E,B=C.destroy;C=C.tag,B!==void 0&&((C&2)!==0||(C&4)!==0)&&Th(g,c,B),E=E.next}while(E!==b)}Vs(s,c,g);break;case 1:if(!fi&&(Nl(g,c),b=g.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=g.memoizedProps,b.state=g.memoizedState,b.componentWillUnmount()}catch(ne){xr(g,c,ne)}Vs(s,c,g);break;case 21:Vs(s,c,g);break;case 22:g.mode&1?(fi=(b=fi)||g.memoizedState!==null,Vs(s,c,g),fi=b):Vs(s,c,g);break;default:Vs(s,c,g)}}function j_(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var g=s.stateNode;g===null&&(g=s.stateNode=new hM),c.forEach(function(b){var E=SM.bind(null,s,b);g.has(b)||(g.add(b),b.then(E,E))})}}function wa(s,c){var g=c.deletions;if(g!==null)for(var b=0;b<g.length;b++){var E=g[b];try{var C=s,B=c,ne=B;e:for(;ne!==null;){switch(ne.tag){case 5:Qr=ne.stateNode,_a=!1;break e;case 3:Qr=ne.stateNode.containerInfo,_a=!0;break e;case 4:Qr=ne.stateNode.containerInfo,_a=!0;break e}ne=ne.return}if(Qr===null)throw Error(n(160));C_(C,B,E),Qr=null,_a=!1;var ce=E.alternate;ce!==null&&(ce.return=null),E.return=null}catch(Se){xr(E,c,Se)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)T_(c,s),c=c.sibling}function T_(s,c){var g=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(wa(c,s),Ha(s),b&4){try{Bc(3,s,s.return),Od(3,s)}catch(Ot){xr(s,s.return,Ot)}try{Bc(5,s,s.return)}catch(Ot){xr(s,s.return,Ot)}}break;case 1:wa(c,s),Ha(s),b&512&&g!==null&&Nl(g,g.return);break;case 5:if(wa(c,s),Ha(s),b&512&&g!==null&&Nl(g,g.return),s.flags&32){var E=s.stateNode;try{He(E,"")}catch(Ot){xr(s,s.return,Ot)}}if(b&4&&(E=s.stateNode,E!=null)){var C=s.memoizedProps,B=g!==null?g.memoizedProps:C,ne=s.type,ce=s.updateQueue;if(s.updateQueue=null,ce!==null)try{ne==="input"&&C.type==="radio"&&C.name!=null&&je(E,C),xe(ne,B);var Se=xe(ne,C);for(B=0;B<ce.length;B+=2){var Ze=ce[B],tt=ce[B+1];Ze==="style"?jt(E,tt):Ze==="dangerouslySetInnerHTML"?Ue(E,tt):Ze==="children"?He(E,tt):N(E,Ze,tt,Se)}switch(ne){case"input":Oe(E,C);break;case"textarea":$t(E,C);break;case"select":var Ge=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!C.multiple;var wt=C.value;wt!=null?tn(E,!!C.multiple,wt,!1):Ge!==!!C.multiple&&(C.defaultValue!=null?tn(E,!!C.multiple,C.defaultValue,!0):tn(E,!!C.multiple,C.multiple?[]:"",!1))}E[cs]=C}catch(Ot){xr(s,s.return,Ot)}}break;case 6:if(wa(c,s),Ha(s),b&4){if(s.stateNode===null)throw Error(n(162));E=s.stateNode,C=s.memoizedProps;try{E.nodeValue=C}catch(Ot){xr(s,s.return,Ot)}}break;case 3:if(wa(c,s),Ha(s),b&4&&g!==null&&g.memoizedState.isDehydrated)try{Me(c.containerInfo)}catch(Ot){xr(s,s.return,Ot)}break;case 4:wa(c,s),Ha(s);break;case 13:wa(c,s),Ha(s),E=s.child,E.flags&8192&&(C=E.memoizedState!==null,E.stateNode.isHidden=C,!C||E.alternate!==null&&E.alternate.memoizedState!==null||(Oh=$n())),b&4&&j_(s);break;case 22:if(Ze=g!==null&&g.memoizedState!==null,s.mode&1?(fi=(Se=fi)||Ze,wa(c,s),fi=Se):wa(c,s),Ha(s),b&8192){if(Se=s.memoizedState!==null,(s.stateNode.isHidden=Se)&&!Ze&&(s.mode&1)!==0)for(At=s,Ze=s.child;Ze!==null;){for(tt=At=Ze;At!==null;){switch(Ge=At,wt=Ge.child,Ge.tag){case 0:case 11:case 14:case 15:Bc(4,Ge,Ge.return);break;case 1:Nl(Ge,Ge.return);var Lt=Ge.stateNode;if(typeof Lt.componentWillUnmount=="function"){b=Ge,g=Ge.return;try{c=b,Lt.props=c.memoizedProps,Lt.state=c.memoizedState,Lt.componentWillUnmount()}catch(Ot){xr(b,g,Ot)}}break;case 5:Nl(Ge,Ge.return);break;case 22:if(Ge.memoizedState!==null){I_(tt);continue}}wt!==null?(wt.return=Ge,At=wt):I_(tt)}Ze=Ze.sibling}e:for(Ze=null,tt=s;;){if(tt.tag===5){if(Ze===null){Ze=tt;try{E=tt.stateNode,Se?(C=E.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(ne=tt.stateNode,ce=tt.memoizedProps.style,B=ce!=null&&ce.hasOwnProperty("display")?ce.display:null,ne.style.display=_t("display",B))}catch(Ot){xr(s,s.return,Ot)}}}else if(tt.tag===6){if(Ze===null)try{tt.stateNode.nodeValue=Se?"":tt.memoizedProps}catch(Ot){xr(s,s.return,Ot)}}else if((tt.tag!==22&&tt.tag!==23||tt.memoizedState===null||tt===s)&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===s)break e;for(;tt.sibling===null;){if(tt.return===null||tt.return===s)break e;Ze===tt&&(Ze=null),tt=tt.return}Ze===tt&&(Ze=null),tt.sibling.return=tt.return,tt=tt.sibling}}break;case 19:wa(c,s),Ha(s),b&4&&j_(s);break;case 21:break;default:wa(c,s),Ha(s)}}function Ha(s){var c=s.flags;if(c&2){try{e:{for(var g=s.return;g!==null;){if(E_(g)){var b=g;break e}g=g.return}throw Error(n(160))}switch(b.tag){case 5:var E=b.stateNode;b.flags&32&&(He(E,""),b.flags&=-33);var C=N_(s);Ih(s,C,E);break;case 3:case 4:var B=b.stateNode.containerInfo,ne=N_(s);Ah(s,ne,B);break;default:throw Error(n(161))}}catch(ce){xr(s,s.return,ce)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function mM(s,c,g){At=s,R_(s)}function R_(s,c,g){for(var b=(s.mode&1)!==0;At!==null;){var E=At,C=E.child;if(E.tag===22&&b){var B=E.memoizedState!==null||Ld;if(!B){var ne=E.alternate,ce=ne!==null&&ne.memoizedState!==null||fi;ne=Ld;var Se=fi;if(Ld=B,(fi=ce)&&!Se)for(At=E;At!==null;)B=At,ce=B.child,B.tag===22&&B.memoizedState!==null?M_(E):ce!==null?(ce.return=B,At=ce):M_(E);for(;C!==null;)At=C,R_(C),C=C.sibling;At=E,Ld=ne,fi=Se}A_(s)}else(E.subtreeFlags&8772)!==0&&C!==null?(C.return=E,At=C):A_(s)}}function A_(s){for(;At!==null;){var c=At;if((c.flags&8772)!==0){var g=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:fi||Od(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!fi)if(g===null)b.componentDidMount();else{var E=c.elementType===c.type?g.memoizedProps:ka(c.type,g.memoizedProps);b.componentDidUpdate(E,g.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&I1(c,C,b);break;case 3:var B=c.updateQueue;if(B!==null){if(g=null,c.child!==null)switch(c.child.tag){case 5:g=c.child.stateNode;break;case 1:g=c.child.stateNode}I1(c,B,g)}break;case 5:var ne=c.stateNode;if(g===null&&c.flags&4){g=ne;var ce=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ce.autoFocus&&g.focus();break;case"img":ce.src&&(g.src=ce.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var Se=c.alternate;if(Se!==null){var Ze=Se.memoizedState;if(Ze!==null){var tt=Ze.dehydrated;tt!==null&&Me(tt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}fi||c.flags&512&&Rh(c)}catch(Ge){xr(c,c.return,Ge)}}if(c===s){At=null;break}if(g=c.sibling,g!==null){g.return=c.return,At=g;break}At=c.return}}function I_(s){for(;At!==null;){var c=At;if(c===s){At=null;break}var g=c.sibling;if(g!==null){g.return=c.return,At=g;break}At=c.return}}function M_(s){for(;At!==null;){var c=At;try{switch(c.tag){case 0:case 11:case 15:var g=c.return;try{Od(4,c)}catch(ce){xr(c,g,ce)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var E=c.return;try{b.componentDidMount()}catch(ce){xr(c,E,ce)}}var C=c.return;try{Rh(c)}catch(ce){xr(c,C,ce)}break;case 5:var B=c.return;try{Rh(c)}catch(ce){xr(c,B,ce)}}}catch(ce){xr(c,c.return,ce)}if(c===s){At=null;break}var ne=c.sibling;if(ne!==null){ne.return=c.return,At=ne;break}At=c.return}}var xM=Math.ceil,Dd=j.ReactCurrentDispatcher,Mh=j.ReactCurrentOwner,aa=j.ReactCurrentBatchConfig,An=0,qr=null,Nr=null,Xr=0,$i=0,Cl=za(0),Lr=0,zc=null,Po=0,Pd=0,Lh=0,Uc=null,Ri=null,Oh=0,jl=1/0,ys=null,Fd=!1,Dh=null,Gs=null,Bd=!1,Ks=null,zd=0,qc=0,Ph=null,Ud=-1,qd=0;function _i(){return(An&6)!==0?$n():Ud!==-1?Ud:Ud=$n()}function Ys(s){return(s.mode&1)===0?1:(An&2)!==0&&Xr!==0?Xr&-Xr:_d.transition!==null?(qd===0&&(qd=Ya()),qd):(s=ln,s!==0||(s=window.event,s=s===void 0?16:ba(s.type)),s)}function Sa(s,c,g,b){if(50<qc)throw qc=0,Ph=null,Error(n(185));ii(s,g,b),((An&2)===0||s!==qr)&&(s===qr&&((An&2)===0&&(Pd|=g),Lr===4&&Qs(s,Xr)),Ai(s,b),g===1&&An===0&&(c.mode&1)===0&&(jl=$n()+500,O&&fe()))}function Ai(s,c){var g=s.callbackNode;ma(s,c);var b=xi(s,s===qr?Xr:0);if(b===0)g!==null&&Bn(g),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(g!=null&&Bn(g),c===1)s.tag===0?le(O_.bind(null,s)):re(O_.bind(null,s)),Qp(function(){(An&6)===0&&fe()}),g=null;else{switch(Ft(b)){case 1:g=ha;break;case 4:g=ga;break;case 16:g=gi;break;case 536870912:g=Et;break;default:g=gi}g=H_(g,L_.bind(null,s))}s.callbackPriority=c,s.callbackNode=g}}function L_(s,c){if(Ud=-1,qd=0,(An&6)!==0)throw Error(n(327));var g=s.callbackNode;if(Tl()&&s.callbackNode!==g)return null;var b=xi(s,s===qr?Xr:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=Hd(s,b);else{c=b;var E=An;An|=2;var C=P_();(qr!==s||Xr!==c)&&(ys=null,jl=$n()+500,Bo(s,c));do try{vM();break}catch(ne){D_(s,ne)}while(!0);th(),Dd.current=C,An=E,Nr!==null?c=0:(qr=null,Xr=0,c=Lr)}if(c!==0){if(c===2&&(E=yi(s),E!==0&&(b=E,c=Fh(s,E))),c===1)throw g=zc,Bo(s,0),Qs(s,b),Ai(s,$n()),g;if(c===6)Qs(s,b);else{if(E=s.current.alternate,(b&30)===0&&!yM(E)&&(c=Hd(s,b),c===2&&(C=yi(s),C!==0&&(b=C,c=Fh(s,C))),c===1))throw g=zc,Bo(s,0),Qs(s,b),Ai(s,$n()),g;switch(s.finishedWork=E,s.finishedLanes=b,c){case 0:case 1:throw Error(n(345));case 2:zo(s,Ri,ys);break;case 3:if(Qs(s,b),(b&130023424)===b&&(c=Oh+500-$n(),10<c)){if(xi(s,0)!==0)break;if(E=s.suspendedLanes,(E&b)!==b){_i(),s.pingedLanes|=s.suspendedLanes&E;break}s.timeoutHandle=vl(zo.bind(null,s,Ri,ys),c);break}zo(s,Ri,ys);break;case 4:if(Qs(s,b),(b&4194240)===b)break;for(c=s.eventTimes,E=-1;0<b;){var B=31-Pn(b);C=1<<B,B=c[B],B>E&&(E=B),b&=~C}if(b=E,b=$n()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*xM(b/1960))-b,10<b){s.timeoutHandle=vl(zo.bind(null,s,Ri,ys),b);break}zo(s,Ri,ys);break;case 5:zo(s,Ri,ys);break;default:throw Error(n(329))}}}return Ai(s,$n()),s.callbackNode===g?L_.bind(null,s):null}function Fh(s,c){var g=Uc;return s.current.memoizedState.isDehydrated&&(Bo(s,c).flags|=256),s=Hd(s,c),s!==2&&(c=Ri,Ri=g,c!==null&&Bh(c)),s}function Bh(s){Ri===null?Ri=s:Ri.push.apply(Ri,s)}function yM(s){for(var c=s;;){if(c.flags&16384){var g=c.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var b=0;b<g.length;b++){var E=g[b],C=E.getSnapshot;E=E.value;try{if(!Ni(C(),E))return!1}catch{return!1}}}if(g=c.child,c.subtreeFlags&16384&&g!==null)g.return=c,c=g;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 Qs(s,c){for(c&=~Lh,c&=~Pd,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var g=31-Pn(c),b=1<<g;s[g]=-1,c&=~b}}function O_(s){if((An&6)!==0)throw Error(n(327));Tl();var c=xi(s,0);if((c&1)===0)return Ai(s,$n()),null;var g=Hd(s,c);if(s.tag!==0&&g===2){var b=yi(s);b!==0&&(c=b,g=Fh(s,b))}if(g===1)throw g=zc,Bo(s,0),Qs(s,c),Ai(s,$n()),g;if(g===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,zo(s,Ri,ys),Ai(s,$n()),null}function zh(s,c){var g=An;An|=1;try{return s(c)}finally{An=g,An===0&&(jl=$n()+500,O&&fe())}}function Fo(s){Ks!==null&&Ks.tag===0&&(An&6)===0&&Tl();var c=An;An|=1;var g=aa.transition,b=ln;try{if(aa.transition=null,ln=1,s)return s()}finally{ln=b,aa.transition=g,An=c,(An&6)===0&&fe()}}function Uh(){$i=Cl.current,Mn(Cl)}function Bo(s,c){s.finishedWork=null,s.finishedLanes=0;var g=s.timeoutHandle;if(g!==-1&&(s.timeoutHandle=-1,Yp(g)),Nr!==null)for(g=Nr.return;g!==null;){var b=g;switch(Xe(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&fs();break;case 3:Sl(),Mn(ci),Mn(zr),ch();break;case 5:oh(b);break;case 4:Sl();break;case 13:Mn(dr);break;case 19:Mn(dr);break;case 10:nh(b.type._context);break;case 22:case 23:Uh()}g=g.return}if(qr=s,Nr=s=Xs(s.current,null),Xr=$i=c,Lr=0,zc=null,Lh=Pd=Po=0,Ri=Uc=null,Lo!==null){for(c=0;c<Lo.length;c++)if(g=Lo[c],b=g.interleaved,b!==null){g.interleaved=null;var E=b.next,C=g.pending;if(C!==null){var B=C.next;C.next=E,b.next=B}g.pending=b}Lo=null}return s}function D_(s,c){do{var g=Nr;try{if(th(),Nd.current=Rd,Cd){for(var b=fr.memoizedState;b!==null;){var E=b.queue;E!==null&&(E.pending=null),b=b.next}Cd=!1}if(Do=0,Ur=Mr=fr=null,Lc=!1,Oc=0,Mh.current=null,g===null||g.return===null){Lr=1,zc=c,Nr=null;break}e:{var C=s,B=g.return,ne=g,ce=c;if(c=Xr,ne.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Se=ce,Ze=ne,tt=Ze.tag;if((Ze.mode&1)===0&&(tt===0||tt===11||tt===15)){var Ge=Ze.alternate;Ge?(Ze.updateQueue=Ge.updateQueue,Ze.memoizedState=Ge.memoizedState,Ze.lanes=Ge.lanes):(Ze.updateQueue=null,Ze.memoizedState=null)}var wt=o_(B);if(wt!==null){wt.flags&=-257,l_(wt,B,ne,C,c),wt.mode&1&&s_(C,Se,c),c=wt,ce=Se;var Lt=c.updateQueue;if(Lt===null){var Ot=new Set;Ot.add(ce),c.updateQueue=Ot}else Lt.add(ce);break e}else{if((c&1)===0){s_(C,Se,c),qh();break e}ce=Error(n(426))}}else if(bt&&ne.mode&1){var kr=o_(B);if(kr!==null){(kr.flags&65536)===0&&(kr.flags|=256),l_(kr,B,ne,C,c),_l(El(ce,ne));break e}}C=ce=El(ce,ne),Lr!==4&&(Lr=2),Uc===null?Uc=[C]:Uc.push(C),C=B;do{switch(C.tag){case 3:C.flags|=65536,c&=-c,C.lanes|=c;var ve=i_(C,ce,c);A1(C,ve);break e;case 1:ne=ce;var he=C.type,_e=C.stateNode;if((C.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||_e!==null&&typeof _e.componentDidCatch=="function"&&(Gs===null||!Gs.has(_e)))){C.flags|=65536,c&=-c,C.lanes|=c;var ut=a_(C,ne,c);A1(C,ut);break e}}C=C.return}while(C!==null)}B_(g)}catch(Ut){c=Ut,Nr===g&&g!==null&&(Nr=g=g.return);continue}break}while(!0)}function P_(){var s=Dd.current;return Dd.current=Rd,s===null?Rd:s}function qh(){(Lr===0||Lr===3||Lr===2)&&(Lr=4),qr===null||(Po&268435455)===0&&(Pd&268435455)===0||Qs(qr,Xr)}function Hd(s,c){var g=An;An|=2;var b=P_();(qr!==s||Xr!==c)&&(ys=null,Bo(s,c));do try{bM();break}catch(E){D_(s,E)}while(!0);if(th(),An=g,Dd.current=b,Nr!==null)throw Error(n(261));return qr=null,Xr=0,Lr}function bM(){for(;Nr!==null;)F_(Nr)}function vM(){for(;Nr!==null&&!Bi();)F_(Nr)}function F_(s){var c=q_(s.alternate,s,$i);s.memoizedProps=s.pendingProps,c===null?B_(s):Nr=c,Mh.current=null}function B_(s){var c=s;do{var g=c.alternate;if(s=c.return,(c.flags&32768)===0){if(g=fM(g,c,$i),g!==null){Nr=g;return}}else{if(g=pM(g,c),g!==null){g.flags&=32767,Nr=g;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Lr=6,Nr=null;return}}if(c=c.sibling,c!==null){Nr=c;return}Nr=c=s}while(c!==null);Lr===0&&(Lr=5)}function zo(s,c,g){var b=ln,E=aa.transition;try{aa.transition=null,ln=1,kM(s,c,g,b)}finally{aa.transition=E,ln=b}return null}function kM(s,c,g,b){do Tl();while(Ks!==null);if((An&6)!==0)throw Error(n(327));g=s.finishedWork;var E=s.finishedLanes;if(g===null)return null;if(s.finishedWork=null,s.finishedLanes=0,g===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var C=g.lanes|g.childLanes;if(gr(s,C),s===qr&&(Nr=qr=null,Xr=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||Bd||(Bd=!0,H_(gi,function(){return Tl(),null})),C=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||C){C=aa.transition,aa.transition=null;var B=ln;ln=1;var ne=An;An|=4,Mh.current=null,gM(s,g),T_(g,s),pd(bl),Bt=!!Ec,bl=Ec=null,s.current=g,mM(g),pa(),An=ne,ln=B,aa.transition=C}else s.current=g;if(Bd&&(Bd=!1,Ks=s,zd=E),C=s.pendingLanes,C===0&&(Gs=null),zn(g.stateNode),Ai(s,$n()),c!==null)for(b=s.onRecoverableError,g=0;g<c.length;g++)E=c[g],b(E.value,{componentStack:E.stack,digest:E.digest});if(Fd)throw Fd=!1,s=Dh,Dh=null,s;return(zd&1)!==0&&s.tag!==0&&Tl(),C=s.pendingLanes,(C&1)!==0?s===Ph?qc++:(qc=0,Ph=s):qc=0,fe(),null}function Tl(){if(Ks!==null){var s=Ft(zd),c=aa.transition,g=ln;try{if(aa.transition=null,ln=16>s?16:s,Ks===null)var b=!1;else{if(s=Ks,Ks=null,zd=0,(An&6)!==0)throw Error(n(331));var E=An;for(An|=4,At=s.current;At!==null;){var C=At,B=C.child;if((At.flags&16)!==0){var ne=C.deletions;if(ne!==null){for(var ce=0;ce<ne.length;ce++){var Se=ne[ce];for(At=Se;At!==null;){var Ze=At;switch(Ze.tag){case 0:case 11:case 15:Bc(8,Ze,C)}var tt=Ze.child;if(tt!==null)tt.return=Ze,At=tt;else for(;At!==null;){Ze=At;var Ge=Ze.sibling,wt=Ze.return;if(S_(Ze),Ze===Se){At=null;break}if(Ge!==null){Ge.return=wt,At=Ge;break}At=wt}}}var Lt=C.alternate;if(Lt!==null){var Ot=Lt.child;if(Ot!==null){Lt.child=null;do{var kr=Ot.sibling;Ot.sibling=null,Ot=kr}while(Ot!==null)}}At=C}}if((C.subtreeFlags&2064)!==0&&B!==null)B.return=C,At=B;else e:for(;At!==null;){if(C=At,(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,At=ve;break e}At=C.return}}var he=s.current;for(At=he;At!==null;){B=At;var _e=B.child;if((B.subtreeFlags&2064)!==0&&_e!==null)_e.return=B,At=_e;else e:for(B=he;At!==null;){if(ne=At,(ne.flags&2048)!==0)try{switch(ne.tag){case 0:case 11:case 15:Od(9,ne)}}catch(Ut){xr(ne,ne.return,Ut)}if(ne===B){At=null;break e}var ut=ne.sibling;if(ut!==null){ut.return=ne.return,At=ut;break e}At=ne.return}}if(An=E,fe(),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(Vt,s)}catch{}b=!0}return b}finally{ln=g,aa.transition=c}}return!1}function z_(s,c,g){c=El(g,c),c=i_(s,c,1),s=Ws(s,c,1),c=_i(),s!==null&&(ii(s,1,c),Ai(s,c))}function xr(s,c,g){if(s.tag===3)z_(s,s,g);else for(;c!==null;){if(c.tag===3){z_(c,s,g);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Gs===null||!Gs.has(b))){s=El(g,s),s=a_(c,s,1),c=Ws(c,s,1),s=_i(),c!==null&&(ii(c,1,s),Ai(c,s));break}}c=c.return}}function _M(s,c,g){var b=s.pingCache;b!==null&&b.delete(c),c=_i(),s.pingedLanes|=s.suspendedLanes&g,qr===s&&(Xr&g)===g&&(Lr===4||Lr===3&&(Xr&130023424)===Xr&&500>$n()-Oh?Bo(s,0):Lh|=g),Ai(s,c)}function U_(s,c){c===0&&((s.mode&1)===0?c=1:(c=zi,zi<<=1,(zi&130023424)===0&&(zi=4194304)));var g=_i();s=gs(s,c),s!==null&&(ii(s,c,g),Ai(s,g))}function wM(s){var c=s.memoizedState,g=0;c!==null&&(g=c.retryLane),U_(s,g)}function SM(s,c){var g=0;switch(s.tag){case 13:var b=s.stateNode,E=s.memoizedState;E!==null&&(g=E.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(n(314))}b!==null&&b.delete(c),U_(s,g)}var q_;q_=function(s,c,g){if(s!==null)if(s.memoizedProps!==c.pendingProps||ci.current)Ti=!0;else{if((s.lanes&g)===0&&(c.flags&128)===0)return Ti=!1,dM(s,c,g);Ti=(s.flags&131072)!==0}else Ti=!1,bt&&(c.flags&1048576)!==0&&Ce(c,Jt,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;Md(s,c),s=c.pendingProps;var E=Bs(c,zr.current);wl(c,g),E=fh(null,c,b,s,E,g);var C=ph();return c.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Yr(b)?(C=!0,Io(c)):C=!1,c.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,ah(c),E.updater=Ad,c.stateNode=E,E._reactInternals=c,bh(c,b,s,g),c=wh(null,c,b,!0,C,g)):(c.tag=0,bt&&C&&De(c),ki(null,c,E,g),c=c.child),c;case 16:b=c.elementType;e:{switch(Md(s,c),s=c.pendingProps,E=b._init,b=E(b._payload),c.type=b,E=c.tag=NM(b),s=ka(b,s),E){case 0:c=_h(null,c,b,s,g);break e;case 1:c=h_(null,c,b,s,g);break e;case 11:c=c_(null,c,b,s,g);break e;case 14:c=u_(null,c,b,ka(b.type,s),g);break e}throw Error(n(306,b,""))}return c;case 0:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:ka(b,E),_h(s,c,b,E,g);case 1:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:ka(b,E),h_(s,c,b,E,g);case 3:e:{if(g_(c),s===null)throw Error(n(387));b=c.pendingProps,C=c.memoizedState,E=C.element,R1(s,c),Sd(c,b,null,g);var B=c.memoizedState;if(b=B.element,C.isDehydrated)if(C={element:b,isDehydrated:!1,cache:B.cache,pendingSuspenseBoundaries:B.pendingSuspenseBoundaries,transitions:B.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){E=El(Error(n(423)),c),c=m_(s,c,b,g,E);break e}else if(b!==E){E=El(Error(n(424)),c),c=m_(s,c,b,g,E);break e}else for(Rt=ji(c.stateNode.containerInfo.firstChild),ht=c,bt=!0,nn=null,g=Hi(c,null,b,g),c.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(qs(),b===E){c=xs(s,c,g);break e}ki(s,c,b,g)}c=c.child}return c;case 5:return M1(c),s===null&&Un(c),b=c.type,E=c.pendingProps,C=s!==null?s.memoizedProps:null,B=E.children,jo(b,E)?B=null:C!==null&&jo(b,C)&&(c.flags|=32),p_(s,c),ki(s,c,B,g),c.child;case 6:return s===null&&Un(c),null;case 13:return x_(s,c,g);case 4:return sh(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=Rn(c,null,b,g):ki(s,c,b,g),c.child;case 11:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:ka(b,E),c_(s,c,b,E,g);case 7:return ki(s,c,c.pendingProps,g),c.child;case 8:return ki(s,c,c.pendingProps.children,g),c.child;case 12:return ki(s,c,c.pendingProps.children,g),c.child;case 10:e:{if(b=c.type._context,E=c.pendingProps,C=c.memoizedProps,B=E.value,Wn(vr,b._currentValue),b._currentValue=B,C!==null)if(Ni(C.value,B)){if(C.children===E.children&&!ci.current){c=xs(s,c,g);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var ne=C.dependencies;if(ne!==null){B=C.child;for(var ce=ne.firstContext;ce!==null;){if(ce.context===b){if(C.tag===1){ce=ms(-1,g&-g),ce.tag=2;var Se=C.updateQueue;if(Se!==null){Se=Se.shared;var Ze=Se.pending;Ze===null?ce.next=ce:(ce.next=Ze.next,Ze.next=ce),Se.pending=ce}}C.lanes|=g,ce=C.alternate,ce!==null&&(ce.lanes|=g),rh(C.return,g,c),ne.lanes|=g;break}ce=ce.next}}else if(C.tag===10)B=C.type===c.type?null:C.child;else if(C.tag===18){if(B=C.return,B===null)throw Error(n(341));B.lanes|=g,ne=B.alternate,ne!==null&&(ne.lanes|=g),rh(B,g,c),B=C.sibling}else B=C.child;if(B!==null)B.return=C;else for(B=C;B!==null;){if(B===c){B=null;break}if(C=B.sibling,C!==null){C.return=B.return,B=C;break}B=B.return}C=B}ki(s,c,E.children,g),c=c.child}return c;case 9:return E=c.type,b=c.pendingProps.children,wl(c,g),E=ra(E),b=b(E),c.flags|=1,ki(s,c,b,g),c.child;case 14:return b=c.type,E=ka(b,c.pendingProps),E=ka(b.type,E),u_(s,c,b,E,g);case 15:return d_(s,c,c.type,c.pendingProps,g);case 17:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:ka(b,E),Md(s,c),c.tag=1,Yr(b)?(s=!0,Io(c)):s=!1,wl(c,g),n_(c,b,E),bh(c,b,E,g),wh(null,c,b,!0,s,g);case 19:return b_(s,c,g);case 22:return f_(s,c,g)}throw Error(n(156,c.tag))};function H_(s,c){return Pr(s,c)}function EM(s,c,g,b){this.tag=s,this.key=g,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 sa(s,c,g,b){return new EM(s,c,g,b)}function Hh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function NM(s){if(typeof s=="function")return Hh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===$)return 11;if(s===G)return 14}return 2}function Xs(s,c){var g=s.alternate;return g===null?(g=sa(s.tag,c,s.key,s.mode),g.elementType=s.elementType,g.type=s.type,g.stateNode=s.stateNode,g.alternate=s,s.alternate=g):(g.pendingProps=c,g.type=s.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=s.flags&14680064,g.childLanes=s.childLanes,g.lanes=s.lanes,g.child=s.child,g.memoizedProps=s.memoizedProps,g.memoizedState=s.memoizedState,g.updateQueue=s.updateQueue,c=s.dependencies,g.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},g.sibling=s.sibling,g.index=s.index,g.ref=s.ref,g}function $d(s,c,g,b,E,C){var B=2;if(b=s,typeof s=="function")Hh(s)&&(B=1);else if(typeof s=="string")B=5;else e:switch(s){case I:return Uo(g.children,E,C,c);case M:B=8,E|=8;break;case L:return s=sa(12,g,c,E|2),s.elementType=L,s.lanes=C,s;case ee:return s=sa(13,g,c,E),s.elementType=ee,s.lanes=C,s;case U:return s=sa(19,g,c,E),s.elementType=U,s.lanes=C,s;case z:return Wd(g,E,C,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case A:B=10;break e;case D:B=9;break e;case $:B=11;break e;case G:B=14;break e;case Z:B=16,b=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return c=sa(B,g,c,E),c.elementType=s,c.type=b,c.lanes=C,c}function Uo(s,c,g,b){return s=sa(7,s,b,c),s.lanes=g,s}function Wd(s,c,g,b){return s=sa(22,s,b,c),s.elementType=z,s.lanes=g,s.stateNode={isHidden:!1},s}function $h(s,c,g){return s=sa(6,s,null,c),s.lanes=g,s}function Wh(s,c,g){return c=sa(4,s.children!==null?s.children:[],s.key,c),c.lanes=g,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function CM(s,c,g,b,E){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=ri(0),this.expirationTimes=ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.identifierPrefix=b,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Vh(s,c,g,b,E,C,B,ne,ce){return s=new CM(s,c,g,ne,ce),c===1?(c=1,C===!0&&(c|=8)):c=0,C=sa(3,null,null,c),s.current=C,C.stateNode=s,C.memoizedState={element:b,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},ah(C),s}function jM(s,c,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:b==null?null:""+b,children:s,containerInfo:c,implementation:g}}function $_(s){if(!s)return ta;s=s._reactInternals;e:{if(ar(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(Yr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(s.tag===1){var g=s.type;if(Yr(g))return Ao(s,g,c)}return c}function W_(s,c,g,b,E,C,B,ne,ce){return s=Vh(g,b,!0,s,E,C,B,ne,ce),s.context=$_(null),g=s.current,b=_i(),E=Ys(g),C=ms(b,E),C.callback=c??null,Ws(g,C,E),s.current.lanes=E,ii(s,E,b),Ai(s,b),s}function Vd(s,c,g,b){var E=c.current,C=_i(),B=Ys(E);return g=$_(g),c.context===null?c.context=g:c.pendingContext=g,c=ms(C,B),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=Ws(E,c,B),s!==null&&(Sa(s,E,B,C),wd(s,E,B)),B}function Gd(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 V_(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var g=s.retryLane;s.retryLane=g!==0&&g<c?g:c}}function Gh(s,c){V_(s,c),(s=s.alternate)&&V_(s,c)}function TM(){return null}var G_=typeof reportError=="function"?reportError:function(s){console.error(s)};function Kh(s){this._internalRoot=s}Kd.prototype.render=Kh.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(n(409));Vd(s,c,null,null)},Kd.prototype.unmount=Kh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;Fo(function(){Vd(null,s,null,null)}),c[Ir]=null}};function Kd(s){this._internalRoot=s}Kd.prototype.unstable_scheduleHydration=function(s){if(s){var c=ai();s={blockedOn:null,target:s,priority:c};for(var g=0;g<Hn.length&&c!==0&&c<Hn[g].priority;g++);Hn.splice(g,0,s),g===0&&Ns(s)}};function Yh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Yd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function K_(){}function RM(s,c,g,b,E){if(E){if(typeof b=="function"){var C=b;b=function(){var Se=Gd(B);C.call(Se)}}var B=W_(c,b,s,0,null,!1,!1,"",K_);return s._reactRootContainer=B,s[Ir]=B.current,Fr(s.nodeType===8?s.parentNode:s),Fo(),B}for(;E=s.lastChild;)s.removeChild(E);if(typeof b=="function"){var ne=b;b=function(){var Se=Gd(ce);ne.call(Se)}}var ce=Vh(s,0,!1,null,null,!1,!1,"",K_);return s._reactRootContainer=ce,s[Ir]=ce.current,Fr(s.nodeType===8?s.parentNode:s),Fo(function(){Vd(c,ce,g,b)}),ce}function Qd(s,c,g,b,E){var C=g._reactRootContainer;if(C){var B=C;if(typeof E=="function"){var ne=E;E=function(){var ce=Gd(B);ne.call(ce)}}Vd(c,B,s,E)}else B=RM(g,c,s,E,b);return Gd(B)}Ar=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var g=mi(c.pendingLanes);g!==0&&(Xi(c,g|1),Ai(c,$n()),(An&6)===0&&(jl=$n()+500,fe()))}break;case 13:Fo(function(){var b=gs(s,1);if(b!==null){var E=_i();Sa(b,s,1,E)}}),Gh(s,1)}},kn=function(s){if(s.tag===13){var c=gs(s,134217728);if(c!==null){var g=_i();Sa(c,s,134217728,g)}Gh(s,134217728)}},dn=function(s){if(s.tag===13){var c=Ys(s),g=gs(s,c);if(g!==null){var b=_i();Sa(g,s,c,b)}Gh(s,c)}},ai=function(){return ln},wr=function(s,c){var g=ln;try{return ln=s,c()}finally{ln=g}},Fe=function(s,c,g){switch(c){case"input":if(Oe(s,g),c=g.name,g.type==="radio"&&c!=null){for(g=s;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<g.length;c++){var b=g[c];if(b!==s&&b.form===s.form){var E=Ba(b);if(!E)throw Error(n(90));xt(b),Oe(b,E)}}}break;case"textarea":$t(s,g);break;case"select":c=g.value,c!=null&&tn(s,!!g.multiple,c,!1)}},Je=zh,Dt=Fo;var AM={usingClientEntryPoint:!1,Events:[To,Br,Ba,te,Ee,zh]},Hc={findFiberByHostInstance:us,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},IM={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:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Gt(s),s===null?null:s.stateNode},findFiberByHostInstance:Hc.findFiberByHostInstance||TM,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 Xd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xd.isDisabled&&Xd.supportsFiber)try{Vt=Xd.inject(IM),Pt=Xd}catch{}}return Ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AM,Ii.createPortal=function(s,c){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yh(c))throw Error(n(200));return jM(s,c,null,g)},Ii.createRoot=function(s,c){if(!Yh(s))throw Error(n(299));var g=!1,b="",E=G_;return c!=null&&(c.unstable_strictMode===!0&&(g=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(E=c.onRecoverableError)),c=Vh(s,1,!1,null,null,g,!1,b,E),s[Ir]=c.current,Fr(s.nodeType===8?s.parentNode:s),new Kh(c)},Ii.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=Gt(c),s=s===null?null:s.stateNode,s},Ii.flushSync=function(s){return Fo(s)},Ii.hydrate=function(s,c,g){if(!Yd(c))throw Error(n(200));return Qd(null,s,c,!0,g)},Ii.hydrateRoot=function(s,c,g){if(!Yh(s))throw Error(n(405));var b=g!=null&&g.hydratedSources||null,E=!1,C="",B=G_;if(g!=null&&(g.unstable_strictMode===!0&&(E=!0),g.identifierPrefix!==void 0&&(C=g.identifierPrefix),g.onRecoverableError!==void 0&&(B=g.onRecoverableError)),c=W_(c,null,s,1,g??null,E,!1,C,B),s[Ir]=c.current,Fr(s),b)for(s=0;s<b.length;s++)g=b[s],E=g._getVersion,E=E(g._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[g,E]:c.mutableSourceEagerHydrationData.push(g,E);return new Kd(c)},Ii.render=function(s,c,g){if(!Yd(c))throw Error(n(200));return Qd(null,s,c,!1,g)},Ii.unmountComponentAtNode=function(s){if(!Yd(s))throw Error(n(40));return s._reactRootContainer?(Fo(function(){Qd(null,null,s,!1,function(){s._reactRootContainer=null,s[Ir]=null})}),!0):!1},Ii.unstable_batchedUpdates=zh,Ii.unstable_renderSubtreeIntoContainer=function(s,c,g,b){if(!Yd(g))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return Qd(s,c,g,!1,b)},Ii.version="18.3.1-next-f1338f8080-20240426",Ii}var nw;function GR(){if(nw)return Zh.exports;nw=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(),Zh.exports=BM(),Zh.exports}var rw;function zM(){if(rw)return Jd;rw=1;var e=GR();return Jd.createRoot=e.createRoot,Jd.hydrateRoot=e.hydrateRoot,Jd}var UM=zM();const qM=Gl(UM),HM="modulepreload",$M=function(e){return"/"+e},iw={},KR=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};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"));i=l(n.map(f=>{if(f=$M(f),f in iw)return;iw[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":HM,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 i.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},_s={"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.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.requester":"From: {session}","permission.summary_multi":"{count} requests across {sessions} sessions","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.voice":"Voice","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.experimental.blurb":"Settings in this group are experimental. They can change or disappear in a future release.","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.mcp_toggle_header":"MCP servers","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","voice.engine":"Speech recognition engine","voice.engine_description":"Whisper is the default engine. Paraformer streams live.","voice.engine_whisper_hint":"Batch - all languages (default)","voice.engine_paraformer_hint":"Live streaming - Chinese / Cantonese / English","voice.engine_switch_failed":"Could not switch the speech engine","voice.paraformer_starting":"Paraformer is starting. First use downloads about 1 GB.","voice.language":"Speech recognition language","voice.language_description":"Force a language instead of relying on auto-detection.","voice.model":"Speech recognition model","voice.model_description":"The model Whisper transcribes with.","voice.whisper_only":"Applies to Whisper only.","voice.cantonese_note":"Cantonese needs whisper-small or a larger model.","voice.next_recording_note":"A change applies to the next recording.","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."},io={en:_s},WM={"zh-TW":()=>KR(()=>import("./zh-TW-DDsaOGgA.js"),[])},Fl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function aw(e){if(io[e])return io[e];const t=WM[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),_s;try{const n=await t();return io[e]=n.default||n,io[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),_s}}function YR(e,t,n){let r=e[t];return r===void 0&&e!==_s&&(r=_s[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(i,o)=>{const l=n[o];return l!==void 0?String(l):i}):r}const QR=y.createContext(null);function VM({initialLocale:e="en",children:t}){const r=Fl.map(m=>m.code).includes(e)?e:"en",[i,o]=y.useState(r),[l,u]=y.useState(io[r]||_s),d=y.useRef(0);y.useEffect(()=>{let m=!1;if(r!=="en"&&!io[r]){const x=++d.current;aw(r).then(v=>{if(m||d.current!==x)return;const k=v===_s&&r!=="en"?"en":r;io[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 aw(m);if(d.current!==x)return;const k=v===_s&&m!=="en"?"en":m;io[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),p=y.useCallback((m,x)=>YR(l,m,x),[l]),h=y.useMemo(()=>({t:p,locale:i,setLocale:f,availableLocales:Fl}),[p,i,f]);return a.jsx(QR.Provider,{value:h,children:t})}function Zt(){const e=y.useContext(QR);return e||{t:(t,n)=>YR(_s,t,n),locale:"en",setLocale:()=>{},availableLocales:Fl}}function GM(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Fl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Fl.find(i=>i.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=Fl.find(i=>i.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function KM({darkMode:e,onToggle:t}){const{t:n}=Zt();return a.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?a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 mk=GR();const YM=Gl(mk);function QM({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=Zt(),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 w=_[0],S=_[_.length-1];k.shiftKey?document.activeElement===w&&(k.preventDefault(),S.focus()):document.activeElement===S&&(k.preventDefault(),w.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var h=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 a.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:a.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:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),a.jsx("div",{className:"px-5 py-4",children:a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i})}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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}),a.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:h})]})]})})}const XR=y.createContext(null);function XM({children:e}){var{t}=Zt(),n=y.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},i=y.useState(r),o=i[0],l=i[1],u=y.useCallback(function(p){n.current&&(n.current(!1),n.current=null);var h=p||{};return new Promise(function(m){n.current=m,l({open:!0,title:h.title||t("confirm_dialog.confirm"),message:h.message||"",confirmLabel:h.confirmLabel||"",cancelLabel:h.cancelLabel||"",destructive:h.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 a.jsxs(XR.Provider,{value:u,children:[e,a.jsx(QM,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function Du(){var e=y.useContext(XR);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const ep=180,Nu=256,ZR=480,ZM=360;function JR(e){const n=(Number.isFinite(e)?e:1280)-ZM;return Math.min(ZR,Math.max(ep,n))}function Tv(e,t){const n=JR(t),r=Number.isFinite(e)?e:Nu;return Math.min(n,Math.max(ep,Math.round(r)))}function JM(e){if(e==null||e==="")return Nu;const t=parseInt(e,10);return!Number.isFinite(t)||t<ep||t>ZR?Nu:t}function sw(e,t,n){const r=Number.isFinite(e)?e:t;return Math.min(n,Math.max(t,Math.round(r)))}const eL=8,tL=32;function nL({effectiveWidth:e,effectiveMaxWidth:t,minWidth:n=ep,onCommit:r,getPaneEl:i}){const{t:o}=Zt(),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=i?i():null,k=m.clientX,_=f.current;try{x.setPointerCapture(m.pointerId)}catch{}l.current=m.pointerId;const w=document.body.style.cursor,S=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let N=!1;const j=M=>{if(l.current!==null&&M.pointerId!==l.current)return;const L=Tv(_+(M.clientX-k),window.innerWidth);v&&v.style.setProperty("--pave-sidebar-w",L+"px"),u.current=L},R=M=>{if(N)return;N=!0,window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",T),window.removeEventListener("lostpointercapture",T),document.body.style.cursor=w,document.body.style.userSelect=S;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},T=()=>R(!1),I=()=>R(!0);window.addEventListener("pointermove",j),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",T),window.addEventListener("lostpointercapture",T),d.current=()=>R(!1)},h=m=>{const x=m.shiftKey?tL:eL;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(Tv(v,window.innerWidth)))};return a.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:h,className:"hidden md:block absolute right-0 top-0 bottom-0 w-2 z-10 cursor-ew-resize touch-none select-none group",children:a.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 rL(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const i=new Date(r);if(i.setDate(i.getDate()-1),n>=i)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 iL(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=rL(u.time&&u.time.updated?u.time.updated:0);n[d].push(u)}const i=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<i.length;l++){const u=i[l];n[u].length>0&&o.push({key:u,label:r[u],sessions:n[u]})}return o}function aL(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 i=Math.floor(r/60);if(i<24)return t("sidebar.age_hours",{n:i});const o=Math.floor(i/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function ow(e){return e.source==="archive"||e._readOnly}const sL={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 qo({name:e,className:t}){return a.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:sL[e]})})}function lw({className:e,filled:t}){return a.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:a.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 tg=216,ef=8,oL=500,cw=10,uw=750;function lL({anchor:e,items:t,label:n,onClose:r}){const i=y.useRef(null),[o,l]=y.useState(null);y.useEffect(()=>{const d=i.current;if(!d)return;const f=d.offsetHeight;let p=e.align==="right"?e.x-tg:e.x;p=Math.max(ef,Math.min(p,window.innerWidth-tg-ef));let h=e.y;h+f>window.innerHeight-ef&&(h=Math.max(ef,e.flipY-f)),l({left:p,top:h})},[e]),y.useEffect(()=>{if(!o||!i.current)return;const d=i.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),y.useEffect(()=>{function d(p){i.current&&!i.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(i.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const p=f.indexOf(document.activeElement),h=d.key==="ArrowDown"?(p+1)%f.length:(p-1+f.length)%f.length;f[h].focus()};return mk.createPortal(a.jsx("div",{ref:i,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:tg,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?a.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):a.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:[a.jsx("span",{className:"shrink-0 opacity-70",children:d.icon}),a.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&a.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function cL({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:i,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:p,onExportSession:h,onSendToSession:m,onImportSession:x,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:w,onClose:S,onToggle:N,hasMoreSessions:j,onLoadMoreSessions:R,showOtherApps:T,onToggleShowOtherApps:I,hasMoreOtherApps:M,onLoadMoreOtherApps:L,otherAppsCount:A,search:D,onSearchChange:$,loadedCount:ee,totalCount:U,sidebarWidth:G=Nu,onSidebarWidthChange:Z}){const{t:z}=Zt(),q=Du(),[ae,P]=y.useState(D||"");y.useEffect(()=>{typeof D=="string"&&D!==ae&&P(D)},[D]);const Q=be=>{P(be),$&&$(be)},[J,F]=y.useState(null),[K,W]=y.useState(""),[H,se]=y.useState(null),ie=y.useRef(null),ge=y.useRef({timer:null,firedAt:0,x:0,y:0});y.useEffect(()=>()=>{ge.current.timer&&clearTimeout(ge.current.timer)},[]);const we=y.useRef(null),[Ke,xt]=y.useState(()=>typeof window<"u"?window.innerWidth:1280);y.useEffect(()=>{let be=0;const Ye=()=>{be||(be=requestAnimationFrame(()=>{be=0,xt(window.innerWidth)}))};return window.addEventListener("resize",Ye),()=>{window.removeEventListener("resize",Ye),be&&cancelAnimationFrame(be)}},[]);const et=Tv(G,Ke),vt=JR(Ke);y.useLayoutEffect(()=>{we.current&&we.current.style.setProperty("--pave-sidebar-w",et+"px")},[et]);const lt=y.useCallback(()=>we.current,[]),je=y.useCallback(()=>{const be=ie.current;ie.current=null,se(null),be&&be.isConnected&&be.focus()},[]),Oe=(be,Ye,_t)=>{ie.current=_t||null,se({id:be.id,anchor:Ye})},ft=ae?e.filter(function(be){return(be.title||z("sidebar.untitled")).toLowerCase().includes(ae.toLowerCase())}):e,{pinnedSessions:Ct,regularSessions:rn,archivedSessions:tn}=y.useMemo(()=>{const be=[],Ye=[],_t=[];for(let jt=0;jt<ft.length;jt++){const Wt=ft[jt];Wt.archived?_t.push(Wt):Wt.pinned?be.push(Wt):Ye.push(Wt)}return{pinnedSessions:be,regularSessions:Ye,archivedSessions:_t}},[ft]),un=y.useMemo(()=>iL(rn,z),[rn,z]),mt=be=>{F(be.id),W(be.title||"")},$t=be=>{K.trim()&&u(be,K.trim()),F(null),W("")},nt=async be=>{!be.archived&&!await q({title:z("sidebar.archive"),message:z("sidebar.confirmArchive"),confirmLabel:z("sidebar.archive")})||p(be.id,!be.archived)},qe=async be=>{await q({title:z("sidebar.delete_title"),message:z("sidebar.delete_confirm"),destructive:!0,confirmLabel:z("sidebar.delete")})&&o(be.id)},ue=be=>{if(ow(be))return[];const Ye=[{key:"rename",label:z("sidebar.rename"),hint:"F2",icon:a.jsx(qo,{name:"rename",className:"w-4 h-4"}),onSelect:()=>mt(be)}];d&&Ye.push({key:"regenerate",label:z("sidebar.regenerate_title"),icon:a.jsx(qo,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(be.id)}),h&&Ye.push({key:"export",label:z("sidebar.export"),icon:a.jsx(qo,{name:"export",className:"w-4 h-4"}),onSelect:()=>h(be.id)}),m&&Ye.push({key:"send-to-session",label:z("sidebar.send_to_session"),icon:a.jsx(qo,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(be.id)});const _t=[];return f&&(!be.archived||be.pinned)&&_t.push({key:"pin",label:be.pinned?z("sidebar.unpin"):z("sidebar.pin"),icon:a.jsx(lw,{className:"w-4 h-4",filled:be.pinned}),onSelect:()=>f(be.id,!be.pinned)}),p&&_t.push({key:"archive",label:be.archived?z("sidebar.unarchive"):z("sidebar.archive"),icon:a.jsx(qo,{name:be.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>nt(be)}),_t.length>0&&(Ye.push({key:"sep-state",separator:!0}),Ye.push(..._t)),Ye.push({key:"sep-danger",separator:!0}),Ye.push({key:"delete",label:z("sidebar.delete"),hint:"Del",danger:!0,icon:a.jsx(qo,{name:"delete",className:"w-4 h-4"}),onSelect:()=>qe(be)}),Ye},me=y.useMemo(()=>H&&e.find(be=>be.id===H.id)||null,[H,e]);y.useEffect(()=>{H&&!me&&je()},[H,me,je]);const Ue=(be,Ye)=>{const _t=Ye&&Ye.dimmed,jt=ow(be),Wt=!!(H&&H.id===be.id),hn=!jt,xe=(ke,Ae)=>Oe(be,ke,Ae);return a.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer select-none text-sm mb-0.5 transition-colors ${be.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":_t?"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:()=>{if(ge.current.firedAt&&Date.now()-ge.current.firedAt<uw){ge.current.firedAt=0;return}r(be.id)},onContextMenu:ke=>{!hn||J===be.id||(ke.preventDefault(),!(ge.current.firedAt&&Date.now()-ge.current.firedAt<uw)&&xe({x:ke.clientX,y:ke.clientY,flipY:ke.clientY,align:"left"},ke.currentTarget))},onTouchStart:ke=>{if(!hn||J===be.id||ke.touches.length!==1)return;const Ae=ke.touches[0],Fe=ke.currentTarget;ge.current.x=Ae.clientX,ge.current.y=Ae.clientY,ge.current.timer=setTimeout(()=>{ge.current.timer=null,ge.current.firedAt=Date.now(),xe({x:Ae.clientX,y:Ae.clientY,flipY:Ae.clientY,align:"left"},Fe)},oL)},onTouchMove:ke=>{if(!ge.current.timer)return;const Ae=ke.touches[0],Fe=Ae.clientX-ge.current.x,yt=Ae.clientY-ge.current.y;Fe*Fe+yt*yt>cw*cw&&(clearTimeout(ge.current.timer),ge.current.timer=null)},onTouchEnd:()=>{ge.current.timer&&(clearTimeout(ge.current.timer),ge.current.timer=null)},onTouchCancel:()=>{ge.current.timer&&(clearTimeout(ge.current.timer),ge.current.timer=null)},onKeyDown:ke=>{if(ke.currentTarget===ke.target){if(ke.key==="Enter"||ke.key===" "){ke.preventDefault(),r(be.id);return}if(hn){if(ke.key==="F2")ke.preventDefault(),mt(be);else if(ke.key==="Delete")ke.preventDefault(),qe(be);else if(ke.key==="ContextMenu"){ke.preventDefault();const Ae=ke.currentTarget.getBoundingClientRect();xe({x:Ae.right,y:Ae.bottom,flipY:Ae.top,align:"right"},ke.currentTarget)}}}},children:J===be.id?a.jsx("input",{autoFocus:!0,value:K,onChange:ke=>W(ke.target.value),onBlur:()=>$t(be.id),onKeyDown:ke=>{ke.key==="Enter"?(ke.preventDefault(),ke.stopPropagation(),ke.currentTarget.blur()):ke.key==="Escape"?(ke.stopPropagation(),F(null)):ke.key===" "&&ke.stopPropagation()},onClick:ke=>ke.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-hidden"}):a.jsxs(a.Fragment,{children:[be.pinned&&a.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",role:"img",title:z("sidebar.icon_pinned"),"aria-label":z("sidebar.icon_pinned"),children:a.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"})}),be.source==="archive"&&a.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:z("sidebar.icon_archive"),"aria-label":z("sidebar.icon_archive"),children:a.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"})}),be.compactedAt&&be.source!=="archive"&&a.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:z("sidebar.icon_compacted"),"aria-label":z("sidebar.icon_compacted"),children:a.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[be.id]&&a.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse shrink-0",role:"status",title:z("sidebar.session_processing"),"aria-label":z("sidebar.session_processing")}),a.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${_t?"italic":""}`,"data-menu-open":Wt?"true":"false",children:[a.jsx("span",{className:"truncate min-w-0",children:be.title||z("sidebar.untitled")}),be.archived&&a.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 shrink-0",children:["(",z("sidebar.archived"),")"]})]}),a.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[a.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${Wt?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:aL(be.time&&be.time.updated,z)}),a.jsxs("div",{className:`items-center gap-0.5 ${Wt?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!be.archived||be.pinned)&&a.jsx("button",{onClick:ke=>{ke.stopPropagation(),f(be.id,!be.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:be.pinned?z("sidebar.unpin"):z("sidebar.pin"),"aria-label":be.pinned?z("sidebar.unpin"):z("sidebar.pin"),children:a.jsx(lw,{className:`w-4 h-4 ${be.pinned?"text-amber-500":""}`,filled:be.pinned})}),hn&&a.jsx("button",{onClick:ke=>{ke.stopPropagation();const Ae=ke.currentTarget.getBoundingClientRect();xe({x:Ae.right,y:Ae.bottom+4,flipY:Ae.top-4,align:"right"},ke.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${Wt?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":z("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":Wt,children:a.jsx(qo,{name:"more",className:"w-4 h-4"})})]})]})]})},be.id)},He=be=>a.jsx("div",{className:"px-2 pt-3 pb-1",children:a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:be})});return a.jsxs(a.Fragment,{children:[w&&a.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:S}),!w&&a.jsx("div",{className:"shrink-0 w-10 hidden md:flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:a.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:z("sidebar.show"),"aria-label":z("sidebar.show"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsxs("aside",{ref:we,className:`
|
|
41
|
+
${w?"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
|
+
${w?"md:flex":"md:hidden"}
|
|
48
|
+
`,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:z("sidebar.conversations")}),a.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:z("sidebar.hide"),"aria-label":z("sidebar.hide"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),a.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[a.jsx("button",{onClick:i,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:z("app.new_chat")}),x&&a.jsx("button",{onClick:()=>{const be=document.createElement("input");be.type="file",be.accept=".yaml,.yml",be.onchange=Ye=>{const _t=Ye&&Ye.target&&Ye.target.files,jt=_t&&_t[0];if(jt){const Wt=jt.name.toLowerCase();if(!Wt.endsWith(".yaml")&&!Wt.endsWith(".yml")){v&&v(z("import.invalid_file_type"));return}const hn=10*1024*1024;if(jt.size>hn){v&&v(z("import.file_too_large"));return}const xe=new FileReader;xe.onload=ke=>{const Ae=ke&&ke.target?ke.target.result:null;if(typeof Ae!="string"){v&&v(z("import.read_error"));return}x(Ae)},xe.onerror=()=>{v&&v(z("import.read_error"))},xe.readAsText(jt)}},be.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:z("sidebar.import"),"aria-label":z("sidebar.import"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]}),a.jsx("div",{className:"px-3 pb-2",children:a.jsx("input",{type:"text",placeholder:z("sidebar.search_placeholder"),value:ae,onChange:be=>Q(be.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"})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[Ct.length===0&&un.every(be=>be.sessions.length===0)&&(!k||tn.length===0)&&a.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:z(ae?"sidebar.no_matches":"sidebar.no_conversations")}),Ct.length>0&&a.jsxs(a.Fragment,{children:[He(z("sidebar.pinned")),Ct.map(be=>Ue(be))]}),un.map(be=>a.jsxs("div",{children:[(Ct.length>0||un.length>1)&&He(be.label),be.sessions.map(Ye=>Ue(Ye))]},be.key)),k&&tn.length>0&&a.jsxs(a.Fragment,{children:[He(z("sidebar.archived")),tn.map(be=>Ue(be,{dimmed:!0}))]}),(j||M)&&(R||L)&&a.jsx("div",{className:"pt-2 pb-1 px-1",children:a.jsxs("button",{onClick:()=>{j&&R&&R(),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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof U=="number"&&U>0&&typeof ee=="number"?z("sidebar.load_more_count",{loaded:ee+(A||0),total:U+(A||0)}):z("sidebar.load_more")]})}),!j&&!M&&typeof U=="number"&&U>0&&a.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:ae?z("sidebar.search_result_count",{total:U+(A||0)}):z("sidebar.all_loaded_count",{total:U+(A||0)})}),I&&a.jsx("div",{className:"pt-2 pb-1 px-1",children:a.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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),z(T?"sidebar.hide_other_apps":"sidebar.show_other_apps")]})}),_&&a.jsx("div",{className:"pt-2 pb-1 px-1",children:a.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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?a.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"}):a.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"})}),z(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),ft.some(function(be){return be.source!=="legacy"&&!be._readOnly})&&l&&a.jsx("div",{className:"pt-3 pb-2 px-1",children:a.jsxs("button",{onClick:async()=>{await q({title:z("sidebar.delete_all_title"),message:z("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:z("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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),z("sidebar.delete_all")]})})]}),Z&&a.jsx(nL,{effectiveWidth:et,effectiveMaxWidth:vt,onCommit:Z,getPaneEl:lt})]}),H&&me&&a.jsx(lL,{anchor:H.anchor,items:ue(me),label:z("sidebar.more_actions"),onClose:je})]})}const ro="pave-draft-";function uL(e){return ro+e}function dL(e){if(e)try{localStorage.removeItem(uL(e))}catch{}}function fL(e){const t=new Set;return e.forEach(n=>{n&&n.id&&t.add(n.id)}),t}function pL(e,t,n){return!e||!e.id||t.has(e.id)?!1:Number.isFinite(e.prependedAt)&&e.prependedAt>=n}function dw({fetched:e,current:t,prependsSince:n}={}){const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[],o=typeof n=="number"?n:1/0,l=fL(r),u=i.filter(d=>pL(d,l,o));return u.length===0?r:u.concat(r)}function Rv(e){const t={};for(let n=0;n<e.length;n++)t[e[n].key]=e[n].value;return t}function hL(e,t){const n={};for(let r=0;r<e.length;r++){const i=e[r];i.source!=="env"&&t[i.key]!==i.value&&(n[i.key]=t[i.key])}return n}function gL(e,t,n){const r=Rv(e);for(let i=0;i<n.length;i++)t[n[i]]!==void 0&&(r[n[i]]=t[n[i]]);return r}function mL(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 xL(e,t){const n=[];for(let i=0;i<t.length;i++)e[t[i]]&&n.push(t[i]);const r=Object.keys(e);for(let i=0;i<r.length;i++)n.indexOf(r[i])<0&&n.push(r[i]);return n}const yL=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","Experimental Features","Developer"],Lf={"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"};let e4=!1;function bL(e){e4=e===!0}function ng(){return e4}function vL(){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 yr(e){const t=vL(),n=typeof e=="string"?e:"";return t?n?t+(n.charAt(0)==="/"?n:"/"+n):t:n}const fw="/.pave/files/",kL=200,_L=/^[a-z][a-z0-9+.-]*:/i,wL=["txt","md","markdown","log","tsv","js","mjs","cjs","jsx","ts","tsx","css","scss","xml","yml","yaml","toml","ini","conf","sh","bash","zsh","py","rb","go","rs","java","kt","c","h","cc","cpp","swift","sql","diff","patch","env","csv","tsv","json"],SL=["png","jpg","jpeg","gif","webp","avif","bmp","ico","apng"],EL=["json","csv","tsv"],NL=["html","htm","svg","xhtml","js","mjs","cjs","jsx"];function CL(e){return e.split(/[\\/]/)}function jL(e){const t=e.split(/[\\/]/).pop()||"",n=t.lastIndexOf(".");return n<=0||n===t.length-1?"":t.slice(n+1).toLowerCase()}function t4(e){const t={candidate:!1,reason:"not-a-path",rel:null,name:"",type:"other",viewable:!1};try{if(typeof e!="string")return{...t,reason:"not-a-string"};const n=e.trim();if(!n)return{...t,reason:"empty"};if(n.charAt(0)==="#")return{...t,reason:"fragment"};if(_L.test(n))return{...t,reason:"scheme"};let r;try{r=decodeURIComponent(n)}catch{return{...t,reason:"malformed-escape"}}let i=r;const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o));const l=i.indexOf("?");if(l!==-1&&(i=i.slice(0,l)),!i.trim())return{...t,reason:"empty"};let u=i;const d=u.lastIndexOf(fw);if(d!==-1?u=u.slice(d+fw.length):u.startsWith("~/.pave/files/")&&(u=u.slice(14)),u.charAt(0)==="/"||u.charAt(0)==="~")return{...t,reason:"absolute"};if(/^[a-z]:[\\/]/i.test(u))return{...t,reason:"absolute"};const f=CL(u);if(f.indexOf("..")!==-1)return{...t,reason:"escape"};if(u=f.filter(x=>x!=="."&&x!=="").join("/"),!u)return{...t,reason:"empty"};const p=jL(u);let h="other";SL.indexOf(p)!==-1?h="image":EL.indexOf(p)!==-1?h="data":wL.indexOf(p)!==-1&&(h="text");const m=h!=="other"&&NL.indexOf(p)===-1;return{candidate:!0,reason:"relative-path",rel:u,name:u.split("/").pop(),type:h,viewable:m}}catch{return{...t,reason:"error"}}}function n4(e,t){return!!(e&&e.candidate===!0&&t===!0)}function TL(e,t){const n=Math.floor(t),r=new Set,i=[];let o=[];for(const l of Array.isArray(e)?e:[])typeof l!="string"||!l||r.has(l)||(r.add(l),o.push(l),o.length===n&&(i.push(o),o=[]));return o.length&&i.push(o),i}function r4(e){if(typeof e!="number"||!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10?Math.round(n):Math.round(n*10)/10} ${t[r]}`}const ua=yr(""),Av="pave-working-directory";function Bl(){if(typeof window>"u")return null;try{return localStorage.getItem(Av)||null}catch{return null}}function rg(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(Av):localStorage.setItem(Av,e)}catch{}}const i4="web";let Iv=null;function pw(e){Iv=e}let Wc=null,hw=0;function xk(){return Wc||(Date.now()<hw?Promise.resolve(!1):(Wc=(async()=>{let e=!1,t=null;try{const n=await fetch(`${ua}/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{hw=Date.now()+5e3,Wc=null}try{Iv&&Iv({recovered:e,user:t})}catch{}return e})(),Wc))}function gw(e){return typeof e=="string"&&e.indexOf("/auth/")===0}let su=null,Vc=null;async function RL(){return su||(Vc||(Vc=fetch(`${ua}/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 rt(e,t={}){const n=Bl(),r={"Content-Type":"application/json","X-PAVE-Client":i4,...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:i,...o}=t,l=(o.method||"GET").toUpperCase(),u=o.csrf===!0;if(delete o.csrf,(l!=="GET"||u)&&!gw(e)){const f=await RL();f&&(r["X-CSRF-Token"]=f)}const d=await fetch(`${ua}${e}`,{...o,headers:r});if(!d.ok){d.status===401&&!gw(e)&&(su=null,xk());let f=null;try{const h=await d.text();try{f=JSON.parse(h)}catch{f=null}if(!f){const m=new Error(`${d.status}: ${h||d.statusText}`);throw m.status=d.status,m}}catch(h){if(h.message)throw h.status===void 0&&(h.status=d.status),h;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 Pl(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 rt(r)}function mw(e){return rt("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function ig(e){return rt(`/session/${e}`)}function AL(e){return rt(`/session/${e}/soul`)}function Li(e,t){return rt(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function IL(e){return rt(`/session/${e}/regenerate-title`,{method:"POST"})}function ML(e,{senderSessionID:t,text:n}){return rt(`/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:n})})}function LL(e){return rt(`/session/${e}/fork`,{method:"POST"})}function OL(e){return rt(`/session/${e}`,{method:"DELETE"})}function DL(e){return rt(`/session/${e}/archive/session`,{method:"POST"})}function PL(){return rt("/session",{method:"DELETE"})}function xw(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 i=r.toString();return rt(`/session/${e}/message${i?"?"+i:""}`)}function yw(e,t,n,r,i,o){const l={content:t,async:!0};return n&&n.length>0&&(l.parts=n),r&&(l.model=r),i&&(l.agent=i),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),rt(`/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function ag(e){return rt(`/session/${e}/queue`)}function bw(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),rt(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function vw(e,t){return rt(`/session/${e}/queue/${t}`,{method:"DELETE"})}function FL(e,t){return rt(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function BL(e){return rt(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function zL(e){return rt(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function UL(e){return rt(`/session/${e}/abort`,{method:"POST"})}function a4(e){return rt(`/session/${e}/idle-injection`)}function qL(e,t){return rt(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function HL(e){return rt(`/session/${e}/idle-injection`,{method:"DELETE"})}function $L(e){return rt(`/session/${e}/scheduled-injections`)}function WL(e,t){return rt(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function VL(e,t,n){return rt(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function GL(e,t){return rt(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function KL(){return rt("/config/providers")}function Mv(){return rt("/api/models/registry")}function YL(){return rt("/auth/status")}function QL(){return rt("/auth/logout",{method:"POST"})}function XL(){return rt("/api/permissions/pending")}function ZL(e){return rt(`/api/permissions/confirm/${e}`,{method:"POST"})}function JL(e){return rt(`/api/permissions/deny/${e}`,{method:"POST"})}function eO(){return rt("/api/questions/pending")}function tO(e,t){return rt(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function nO(e){return rt(`/api/questions/${e}/reject`,{method:"POST"})}function yk(){return rt("/skills")}function s4(){return rt("/capabilities")}function rO(){return s4().then(e=>(e&&e.capabilities||[]).filter(n=>n.kind==="mcp"&&n.status==="installed").map(n=>({id:n.name,displayName:n.displayName||n.name})))}function iO(e){return rt(`/capabilities/${encodeURIComponent(e)}/docs`)}function aO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/install`,{method:"POST"})}function sO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/status`)}function oO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/update`,{method:"POST"})}function lO(e,t){return rt(`/capabilities/mcp/${encodeURIComponent(e)}`,{method:"DELETE"})}function cO(e,t,n){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify({access:t,refresh:void 0})})}function uO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function dO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/review`,{method:"POST"})}function fO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/refresh`,{method:"POST"})}function pO(e){return rt("/capabilities/mcp/custom/add",{method:"POST",body:JSON.stringify({url:e})})}function hO(e){return rt(`/capabilities/skill/${encodeURIComponent(e)}/install`,{method:"POST"})}function gO(e){return rt(`/capabilities/skill/${encodeURIComponent(e)}`,{method:"DELETE"})}function mO(e){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function xO(e,t){return rt(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/result${t?`?state=${encodeURIComponent(t)}`:""}`,{csrf:!0})}function yO(){return rt("/skills/commands")}function bO(){return rt("/skills/registry")}function vO(e){return rt(`/skills/${encodeURIComponent(e)}`)}function kO(e){return rt(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function _O(e){return rt(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function wO(){return rt("/skills/check-updates")}function SO(e,t){return rt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function EO(e){return rt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function NO(e){return rt(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function o4(){return rt("/api/skill-defaults")}function CO(e){return rt("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function jO(e){return rt(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function TO(e){return rt(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function RO(e,t){return rt(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function kw(){return rt("/config")}function AO(){return rt("/inspector/sessions")}async function IO(e){const t=Bl(),n={"X-PAVE-Client":i4};t&&(n["x-opencode-directory"]=t);const r=await fetch(`${ua}/inspector/session/${encodeURIComponent(e)}/events`,{headers:n});if(!r.ok){const i=new Error(`${r.status}: ${r.statusText}`);throw i.status=r.status,i}return r.text()}function _w(e,t){return rt(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function MO(e){return rt(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function LO(e){const t=e?"?model="+encodeURIComponent(e):"";return rt("/config/adaptive-quality"+t)}function Lv(){return rt("/path")}function ww(e){return rt("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function OO(e){return rt("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function l4(){return rt("/settings")}function DO(e){return rt("/settings",{method:"PUT",body:JSON.stringify(e)})}async function PO(e){const t=await fetch(ua+"/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",i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(i),o.parentNode&&o.parentNode.removeChild(o)},0)}function FO(e){return rt("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function BO(e,t,n,r){const i=Bl(),o={};i&&(o["x-opencode-directory"]=i),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=ua+"/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 h=null;if(p)try{h=JSON.parse(p)}catch{}if(!f.ok){const m=new Error(h&&h.error||"Transcription failed (HTTP "+f.status+")");throw m.status=f.status,m.code=h&&h.code,m.fallback=h&&h.fallback,m}if(!h){const m=new Error("Invalid response from transcription endpoint");throw m.code="invalid_response",m.fallback=!0,m}return h}let Il=null,ou=0;function Of(){const e=Date.now();return Il&&e<ou||(Il=rt("/api/transcribe/config").then(t=>(ou=Date.now()+5e3,t)).catch(t=>{throw Il=null,ou=0,t}),ou=1/0),Il}function zO(e){return Il=null,ou=0,rt("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function Sw(){return rt("/session/status")}function UO(e){return rt(`/session/${encodeURIComponent(e)}/dlp/status`)}function qO(){return rt("/api/dlp/policy")}function HO(e){return rt("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Ew(e){const t=await fetch(`${ua}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function $O(e){return(await fetch(`${ua}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function sg(e){try{const t=await fetch(`${ua}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function WO(e){const t=await fetch(`${ua}/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 Nw(e){try{const t=await fetch(`${ua}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function VO(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 rt(`/api/board/topics${n?`?${n}`:""}`)}function Cw(e){return rt(`/api/board/topic/${encodeURIComponent(e)}`)}function GO(e){return rt(`/api/board/search?q=${encodeURIComponent(e)}`)}function KO(e){return rt(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function YO(e,t){return rt(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}const oo=yr("");async function lo(e,t={}){const n=await fetch(e,{credentials:"include",...t});return n.status===401&&await xk()?fetch(e,{credentials:"include",...t}):n}function Pu(e,t){const n=new Error(t);return n.status=e.status,n}async function QO(){const e=await lo(oo+"/api/pricing");if(!e.ok)throw Pu(e,"Failed to fetch pricing: "+e.statusText);return e.json()}async function XO(e){const t=await lo(oo+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw Pu(t,n.error||"Failed to update pricing")}return t.json()}async function ZO(){const e=await lo(oo+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw Pu(e,t.error||"Failed to reset pricing")}return e.json()}async function og(){const e=await lo(oo+"/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 JO(){const e=await lo(oo+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function e3(){const e=await lo(oo+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),i=r.error||r.message||r.output||e.statusText;throw i?i.indexOf(n)===0||i===n?new Error(i):new Error(n+": "+i):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 jw(e,t){return rt("/api/models/registry",{method:"PUT",body:JSON.stringify({name:e,...t})})}async function Tw(e){const t=await lo(oo+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw Pu(t,n.error||"Failed to delete model: "+t.statusText)}return t.json()}async function t3(){const e=await lo(oo+"/api/models");if(!e.ok)throw Pu(e,"Failed to fetch models: "+e.statusText);return e.json()}function n3(){return rt("/api/trigger")}function r3(e){return rt("/api/trigger",{method:"POST",body:JSON.stringify(e)})}function i3(e,t){return rt(`/api/trigger/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}function a3(e){return rt(`/api/trigger/${encodeURIComponent(e)}`,{method:"DELETE"})}function s3(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.parentNode&&r.parentNode.removeChild(r)},0)}async function c4(e){const t={},n=TL(e,kL);for(const r of n)for(const i of r)t[i]={exists:!1,size:0};for(const r of n){let i=null;try{i=await rt("/api/files/stat",{method:"POST",body:JSON.stringify({paths:r})})}catch{continue}const o=i&&Array.isArray(i.files)?i.files:[];for(const l of o)!l||typeof l.path!="string"||Object.prototype.hasOwnProperty.call(t,l.path)&&(t[l.path]={exists:l.exists===!0,size:typeof l.size=="number"&&Number.isFinite(l.size)?l.size:0})}return t}async function u4(e){if(typeof e!="string"||!e){const r=new Error("400: no path to download");throw r.status=400,r}const t=await fetch(`${ua}/api/files/file?path=${encodeURIComponent(e)}`,{credentials:"include"});if(t.status!==200){const r=await t.json().catch(()=>({})),i=t.status===202,o=r&&(r.error||r.message),l=new Error(`${t.status}: ${o||(i?"The download needs your answer first.":"Download failed")}`);throw l.status=t.status,l.body=r,l.dlpQuestion=i,l}const n=await t.blob();return{blob:n,filename:e.split("/").pop()||e,size:typeof n.size=="number"?n.size:0}}async function d4(e,t){const n=await u4(e);return s3(n.blob,t||n.filename),{size:n.size}}function o3(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function l3({open:e,onClose:t,senderSessionID:n}){var{t:r}=Zt(),i=y.useRef(null),o=y.useRef(null),l=y.useState([]),u=l[0],d=l[1],f=y.useState(""),p=f[0],h=f[1],m=y.useState(""),x=m[0],v=m[1],k=y.useState(!1),_=k[0],w=k[1],S=y.useState(""),N=S[0],j=S[1],R=y.useState(!1),T=R[0],I=R[1];y.useEffect(function(){if(e){var A=!1;return j(""),I(!1),v(""),Pl({includeOtherApps:!0,limit:100}).then(function(D){if(!A){var $=Array.isArray(D)?D:D&&D.sessions||[],ee=$.filter(function(U){return U&&U.id!==n});d(ee),h(ee.length?ee[0].id:"")}}).catch(function(D){A||j(D&&D.message?D.message:String(D))}),function(){A=!0}}},[e,n]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function A(D){D.key==="Escape"&&(typeof D.preventDefault=="function"&&D.preventDefault(),typeof D.stopImmediatePropagation=="function"?D.stopImmediatePropagation():typeof D.stopPropagation=="function"&&D.stopPropagation(),t())}return document.addEventListener("keydown",A,!0),function(){document.removeEventListener("keydown",A,!0)}},[e,t]);var M=y.useCallback(function(){!p||!x.trim()||_||(w(!0),j(""),ML(p,{senderSessionID:n,text:x}).then(function(){w(!1),I(!0)}).catch(function(A){w(!1),j(A&&A.message?A.message:String(A))}))},[p,x,_,n]);if(!e)return null;var L=!!p&&!!x.trim()&&!_;return a.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:a.jsxs("div",{ref:i,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:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("send_to_session.title")})}),a.jsxs("div",{className:"px-5 py-4 space-y-3",children:[T?a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("send_to_session.queued")}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.target_label"),a.jsx("select",{value:p,onChange:function(A){h(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 a.jsx("option",{value:A.id,children:(A.title||A.id)+" — "+o3(A)},A.id)})})]}),u.length===0?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("send_to_session.no_targets")}):null,a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.message_label"),a.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"})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("send_to_session.delivery_note")})]}),N?a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:N}):null]}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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(T?"send_to_session.close":"send_to_session.cancel")}),T?null:a.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 tp=0,co=1,Kl=2,f4=4;function Rw(e){return()=>e}function c3(e){e()}function p4(e,t){return n=>e(t(n))}function Aw(e,t){return()=>e(t)}function u3(e,t){return n=>e(t,n)}function bk(e){return e!==void 0}function d3(...e){return()=>{e.map(c3)}}function Yl(){}function np(e,t){return t(e),e}function f3(e,t){return t(e)}function ir(...e){return e}function Fn(e,t){return e(co,t)}function cn(e,t){e(tp,t)}function vk(e){e(Kl)}function Zn(e){return e(f4)}function qt(e,t){return Fn(e,u3(t,tp))}function Ca(e,t){const n=e(co,r=>{n(),t(r)});return n}function Iw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function h4(e,t){return e===t}function rr(e=h4){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Kt(e){return t=>n=>{e(n)&&t(n)}}function St(e){return t=>p4(t,e)}function Gi(e){return t=>()=>{t(e)}}function $e(e,...t){const n=p3(...t);return((r,i)=>{switch(r){case Kl:vk(e);return;case co:return Fn(e,n(i))}})}function Na(e,t){return n=>r=>{n(t=e(t,r))}}function Jo(e){return t=>n=>{e>0?e--:t(n)}}function ks(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function gn(...e){const t=Array.from({length:e.length});let n=0,r=null;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Fn(o,d=>{const f=n;n|=u,t[l]=d,f!==i&&n===i&&r&&(r(),r=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};n===i?u():r=u}}function p3(...e){return t=>e.reduceRight(f3,t)}function h3(e){let t,n;const r=()=>t==null?void 0:t();return function(i,o){switch(i){case co:return o?n===o?void 0:(r(),n=o,t=Fn(e,o),t):(r(),Yl);case Kl:r(),n=null;return}}}function ct(e){let t=e;const n=Nn();return((r,i)=>{switch(r){case tp:t=i;break;case co:{i(t);break}case f4:return t}return n(r,i)})}function $r(e,t){return np(ct(t),n=>qt(e,n))}function Nn(){const e=[];return((t,n)=>{switch(t){case tp:e.slice().forEach(r=>{r(n)});return;case Kl:e.splice(0);return;case co:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Yi(e){return np(Nn(),t=>qt(e,t))}const g3={singleton:!0};function Dn(e,t=[],n=g3){const{singleton:r}=n;return{constructor:e,dependencies:t,id:m3(),singleton:r}}const m3=()=>Symbol("id");function x3(e){const t=new Map,n=({constructor:r,dependencies:i,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=r(i.map(d=>n(d)));return l&&t.set(o,u),u};return n(e)}function _r(...e){const t=Nn(),n=Array.from({length:e.length});let r=0;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Fn(o,d=>{n[l]=d,r|=u,r===i&&cn(t,n)})}),function(o,l){switch(o){case Kl:{vk(t);return}case co:return r===i&&l(n),Fn(t,l)}}}function en(e,t=h4){return $e(e,rr(t))}function Df(...e){return function(t,n){switch(t){case Kl:return;case co:return d3(...e.map(r=>Fn(r,n)))}}}const Dr={DEBUG:0,INFO:1,WARN:2,ERROR:3},y3={[Dr.DEBUG]:"debug",[Dr.ERROR]:"error",[Dr.INFO]:"log",[Dr.WARN]:"warn"},b3=()=>typeof globalThis>"u"?window:globalThis,uo=Dn(()=>{const e=ct(Dr.ERROR);return{log:ct((t,n,r=Dr.INFO)=>{const i=b3().VIRTUOSO_LOG_LEVEL??Zn(e);r>=i&&console[y3[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function v3(e){return"self"in e?e.document.documentElement:e}function g4(e){const t=v3(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function Go(e,t){return g4(e)?-t:t}function Mw(e,t){return g4(e)?-t:t}function tl(e,t,n){return kk(e,t,n).callbackRef}function kk(e,t,n){const r=Mt.useRef(null);let i=l=>{};const o=Mt.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 i=l=>{l&&t?(o==null||o.observe(l),r.current=l):(r.current&&(o==null||o.unobserve(r.current)),r.current=null)},{callbackRef:i,ref:r}}function k3(e,t,n,r,i,o,l,u,d){const f=Mt.useCallback(p=>{var S;const h=_3(p.children,t,u?"offsetWidth":"offsetHeight",i);let m=p.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const x=((S=m.lastElementChild)==null?void 0:S.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,w=l?u?Go(l,l.scrollLeft):l.scrollTop:x?u?Go(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?Go(m,m.scrollLeft):m.scrollTop;r({scrollHeight:k,scrollTop:Math.max(w,0),viewportHeight:_}),o==null||o(u?Lw("column-gap",getComputedStyle(p).columnGap,i):Lw("row-gap",getComputedStyle(p).rowGap,i)),h!==null&&e(h)},[e,t,i,o,l,r,u]);return kk(f,n,d)}function _3(e,t,n,r){const i=e.length;if(i===0)return null;const o=[];for(let l=0;l<i;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},Dr.ERROR),p===f)continue;const h=o[o.length-1];o.length===0||h.size!==p||h.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,Dr.WARN),t==="normal"?0:parseInt(t??"0",10)}const _k=typeof document>"u"?Mt.useEffect:Mt.useLayoutEffect;function m4(e,t,n){const r=Mt.useRef(null),i=Mt.useCallback(d=>{if(!(d!=null&&d.offsetParent))return;const f=d.getBoundingClientRect(),p=f.width;let h,m;if(t){const x=t.getBoundingClientRect(),v=f.top-x.top;m=x.height-Math.max(0,v),h=v+t.scrollTop}else{const x=l.current.ownerDocument.defaultView;m=x.innerHeight-Math.max(0,f.top),h=f.top+x.scrollY}r.current={listHeight:f.height,offsetTop:h,visibleHeight:m,visibleWidth:p},e(r.current)},[e,t]),{callbackRef:o,ref:l}=kk(i,!0,n),u=Mt.useCallback(()=>{i(l.current)},[i,l]);return Mt.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 Si=Dn(()=>{const e=Nn(),t=Nn(),n=ct(0),r=Nn(),i=Nn(),o=ct(0),l=Nn(),u=Nn(),d=ct(0),f=ct(0),p=ct(0),h=ct(0),m=Nn(),x=Nn(),v=ct(!1),k=ct(!1),_=ct(!1);return qt($e(e,St(({scrollTop:w})=>w)),t),qt($e(e,St(({scrollHeight:w})=>w)),u),qt(t,o),{deviation:n,deviationCommitted:r,fixedFooterHeight:p,fixedHeaderHeight:f,footerHeight:h,headerHeight:d,horizontalDirection:k,scrollBy:x,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:i,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),Cu={lvl:0};function x4(e,t){const n=e.length;if(n===0)return[];let{index:r,value:i}=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:i}),r=u,i=d}return o.push({end:1/0,start:r,value:i}),o}function qn(e){return e===Cu}function ju(e,t){if(!qn(e))return t===e.k?e.v:t<e.k?ju(e.l,t):ju(e.r,t)}function Ra(e,t,n="k"){if(qn(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Ra(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Ra(e.l,t,n)}function Di(e,t,n){return qn(e)?v4(t,n,1):t===e.k?Or(e,{k:t,v:n}):t<e.k?Ow(Or(e,{l:Di(e.l,t,n)})):Ow(Or(e,{r:Di(e.r,t,n)}))}function Ko(){return Cu}function zl(e,t,n){if(qn(e))return[];const r=Ra(e,t)[0];return w3(Dv(e,r,n))}function Ov(e,t){if(qn(e))return Cu;const{k:n,l:r,r:i}=e;if(t===n){if(qn(r))return i;if(qn(i))return r;const[o,l]=b4(r);return Cf(Or(e,{k:o,l:y4(r),v:l}))}return t<n?Cf(Or(e,{l:Ov(r,t)})):Cf(Or(e,{r:Ov(i,t)}))}function Yo(e){return qn(e)?[]:[...Yo(e.l),{k:e.k,v:e.v},...Yo(e.r)]}function Dv(e,t,n){if(qn(e))return[];const{k:r,l:i,r:o,v:l}=e;let u=[];return r>t&&(u=u.concat(Dv(i,t,n))),r>=t&&r<=n&&u.push({k:r,v:l}),r<=n&&(u=u.concat(Dv(o,t,n))),u}function Cf(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(lg(t))return k4(Or(e,{lvl:n-1}));if(!qn(t)&&!qn(t.r))return Or(t.r,{l:Or(t,{r:t.r.l}),lvl:n,r:Or(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(lg(e))return Pv(Or(e,{lvl:n-1}));if(!qn(r)&&!qn(r.l)){const i=r.l,o=lg(i)?r.lvl-1:r.lvl;return Or(i,{l:Or(e,{lvl:n-1,r:i.l}),lvl:i.lvl+1,r:Pv(Or(r,{l:i.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Or(e,t){return v4(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 y4(e){return qn(e.r)?e.l:Cf(Or(e,{r:y4(e.r)}))}function lg(e){return qn(e)||e.lvl>e.r.lvl}function b4(e){return qn(e.r)?[e.k,e.v]:b4(e.r)}function v4(e,t,n,r=Cu,i=Cu){return{k:e,l:r,lvl:n,r:i,v:t}}function Ow(e){return Pv(k4(e))}function k4(e){const{l:t}=e;return!qn(t)&&t.lvl===e.lvl?Or(t,{r:Or(e,{l:t.r})}):e}function Pv(e){const{lvl:t,r:n}=e;return!qn(n)&&!qn(n.r)&&n.lvl===t&&n.r.lvl===t?Or(n,{l:Or(e,{r:n.l}),lvl:t+1}):e}function w3(e){return x4(e,({k:t,v:n})=>({index:t,value:n}))}function _4(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Wl(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const wk=Dn(()=>({recalcInProgress:ct(!1)}),[],{singleton:!0});function w4(e,t,n){return e[Pf(e,t,n)]}function Pf(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),l=e[o],u=n(l,t);if(u===0)return o;if(u===-1){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function S3(e,t,n,r){const i=Pf(e,t,r),o=Pf(e,n,r,i);return e.slice(i,o+1)}function ao(e,t){return Math.round(e.getBoundingClientRect()[t])}function rp(e){return!qn(e.groupOffsetTree)}function Sk({index:e},t){return t===e?0:t<e?-1:1}function Dw(){return{groupIndices:[],groupOffsetTree:Ko(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ko()}}function E3(e,t){let n=qn(e)?0:1/0;for(const r of t){const{endIndex:i,size:o,startIndex:l}=r;if(n=Math.min(n,l),qn(e)){e=Di(e,0,o);continue}const u=zl(e,l-1,i+1);if(u.some(I3(r)))continue;let d=!1,f=!1;for(const{end:p,start:h,value:m}of u)d?(i>=h||o===m)&&(e=Ov(e,h)):(f=m!==o,d=!0),p>i&&i>=h&&m!==o&&(e=Di(e,i+1,m));f&&(e=Di(e,l,o))}return[e,n]}function N3(e){return e.groupIndex!==void 0}function C3({offset:e},t){return t===e?0:t<e?-1:1}function Tu(e,t,n){if(t.length===0)return 0;const{index:r,offset:i,size:o}=w4(t,e,Sk),l=e-r,u=o*l+(l-1)*n+i;return u>0?u+n:u}function S4(e,t){if(!rp(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function E4(e,t,n){if(N3(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let i=S4(r,t);return i=Math.max(0,Math.min(n,i)),i}function j3(e,t,n,r=0){return r>0&&(t=Math.max(t,w4(e,r,Sk).offset)),x4(S3(e,t,n,C3),A3)}function T3(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,Dr.DEBUG);const o=e.sizeTree;let l=o,u=0;if(n.length>0&&qn(o)&&t.length===2){const m=t[0].size,x=t[1].size;l=n.reduce((v,k)=>Di(Di(v,k,m),k+1,x),l)}else[l,u]=E3(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h}=Fv(e.offsetTree,u,l,i);return{groupIndices:n,groupOffsetTree:n.reduce((m,x)=>Di(m,x,Tu(x,h,i)),Ko()),lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h,sizeTree:l}}function R3(e){return Yo(e).map(({k:t,v:n},r,i)=>{const o=i[r+1];return{endIndex:o===void 0?1/0:o.k-1,size:n,startIndex:t}})}function Pw(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 Fv(e,t,n,r){let i=e,o=0,l=0,u=0,d=0;if(t===0)i=[];else{d=Pf(i,t-1,Sk),u=i[d].offset;const f=Ra(n,t-1);o=f[0],l=f[1],i.length&&i[d].size===Ra(n,t)[1]&&(d-=1),i=i.slice(0,d+1)}for(const{start:f,value:p}of zl(n,t,1/0)){const h=f-o,m=h*l+u+h*r;i.push({index:f,offset:m,size:p}),o=f,u=m,l=p}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:i}}function A3(e){return{index:e.index,value:e}}function I3(e){const{endIndex:t,size:n,startIndex:r}=e;return i=>i.start===r&&(i.end===t||i.end===1/0)&&i.value===n}const M3={offsetHeight:"height",offsetWidth:"width"},Va=Dn(([{log:e},{recalcInProgress:t}])=>{const n=Nn(),r=Nn(),i=$r(r,0),o=Nn(),l=Nn(),u=ct(0),d=ct([]),f=ct(void 0),p=ct(void 0),h=ct(void 0),m=ct(void 0),x=ct((M,L)=>ao(M,M3[L])),v=ct(void 0),k=ct(0),_=Dw(),w=Nn(),S=$r($e(Df(n,w),gn(d,e,k),Na((M,[L,...A])=>{if(L===null){const[D]=A;return{...Dw(),groupIndices:D,groupOffsetTree:D.reduce(($,ee,U)=>Di($,ee,U),Ko())}}return T3(M,[L,...A])},_),rr()),_),N=$r($e(d,rr(),Na((M,L)=>({current:L,prev:M.current}),{current:[],prev:[]}),St(({prev:M})=>M)),[]);qt($e(d,Kt(M=>M.length>0),gn(S,k),St(([M,L,A])=>{const D=M.reduce(($,ee,U)=>Di($,ee,Tu(ee,L.offsetTree,A)||U),Ko());return{...L,groupIndices:M,groupOffsetTree:D}})),S),qt($e(r,gn(S),Kt(([M,{lastIndex:L}])=>M<L),St(([M,{lastIndex:L,lastSize:A}])=>[{endIndex:L,size:A,startIndex:M}])),n),qt(f,p);const j=$r($e(f,St(M=>M===void 0)),!0);qt($e(p,Kt(M=>M!==void 0&&qn(Zn(S).sizeTree)),St(M=>{const L=Zn(h),A=Zn(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),qt($e(m,Kt(M=>M!==void 0&&M.length>0&&qn(Zn(S).sizeTree)),St(M=>{const L=[];let A=M[0],D=0;for(let $=1;$<M.length;$++){const ee=M[$];ee!==A&&(L.push({endIndex:$-1,size:A,startIndex:D}),A=ee,D=$)}return L.push({endIndex:M.length-1,size:A,startIndex:D}),L})),n),qt($e(d,gn(h,p),Kt(([,M,L])=>M!==void 0&&L!==void 0),St(([M,L,A])=>{const D=[];for(let $=0;$<M.length;$++){const ee=M[$],U=M[$+1];D.push({startIndex:ee,endIndex:ee,size:L}),U!==void 0&&D.push({startIndex:ee+1,endIndex:U-1,size:A})}return D})),n);const R=Yi($e(n,gn(S),Na(({sizes:M},[L,A])=>({changed:A!==M,sizes:A}),{changed:!1,sizes:_}),St(M=>M.changed)));Fn($e(u,Na((M,L)=>({diff:M.prev-L,prev:L}),{diff:0,prev:0}),St(M=>M.diff)),M=>{const{groupIndices:L}=Zn(S);if(M>0)cn(t,!0),cn(o,M+Pw(M,L));else if(M<0){const A=Zn(N);A.length>0&&(M-=Pw(-M,A)),cn(l,M)}}),Fn($e(u,gn(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},Dr.ERROR)});const T=Yi(o);qt($e(o,gn(S),St(([M,L])=>{const A=L.groupIndices.length>0,D=[],$=L.lastSize;if(A){const ee=ju(L.sizeTree,0);let U=0,G=0;for(;U<M;){const z=L.groupIndices[G],q=L.groupIndices.length===G+1?1/0:L.groupIndices[G+1]-z-1;D.push({endIndex:z,size:ee,startIndex:z}),D.push({endIndex:z+1+q-1,size:$,startIndex:z+1}),G++,U+=q+1}const Z=Yo(L.sizeTree);return U!==M&&Z.shift(),Z.reduce((z,{k:q,v:ae})=>{let P=z.ranges;return z.prevSize!==0&&(P=[...z.ranges,{endIndex:q+M-1,size:z.prevSize,startIndex:z.prevIndex}]),{prevIndex:q+M,prevSize:ae,ranges:P}},{prevIndex:M,prevSize:0,ranges:D}).ranges}return Yo(L.sizeTree).reduce((ee,{k:U,v:G})=>({prevIndex:U+M,prevSize:G,ranges:[...ee.ranges,{endIndex:U+M-1,size:ee.prevSize,startIndex:ee.prevIndex}]}),{prevIndex:0,prevSize:$,ranges:[]}).ranges})),n);const I=Yi($e(l,gn(S,k),St(([M,{offsetTree:L},A])=>{const D=-M;return Tu(D,L,A)})));return qt($e(l,gn(S,k),St(([M,L,A])=>{if(L.groupIndices.length>0){if(qn(L.sizeTree))return L;let $=Ko();const ee=Zn(N);let U=0,G=0,Z=0;for(;U<-M;){Z=ee[G];const z=ee[G+1]-Z-1;G++,U+=z+1}if($=Yo(L.sizeTree).reduce((z,{k:q,v:ae})=>Di(z,Math.max(0,q+M),ae),$),U!==-M){const z=ju(L.sizeTree,Z);$=Di($,0,z);const q=Ra(L.sizeTree,-M+1)[1];$=Di($,1,q)}return{...L,sizeTree:$,...Fv(L.offsetTree,0,$,A)}}const D=Yo(L.sizeTree).reduce(($,{k:ee,v:U})=>Di($,Math.max(0,ee+M),U),Ko());return{...L,sizeTree:D,...Fv(L.offsetTree,0,D,A)}})),S),{beforeUnshiftWith:T,data:v,defaultItemSize:p,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:h,gap:k,groupIndices:d,heightEstimates:m,itemSize:x,listRefresh:R,resetSizes:w,shiftWith:l,shiftWithOffset:I,sizeRanges:n,sizes:S,statefulTotalCount:i,totalCount:r,trackItemSizes:j,unshiftWith:o}},ir(uo,wk),{singleton:!0});function L3(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const N4=Dn(([{groupIndices:e,resetSizes:t,sizeRanges:n,sizes:r,statefulTotalCount:i,totalCount:o,trackItemSizes:l},{headerHeight:u,scrollTop:d}])=>{const f=Nn(),p=Nn(),h=Yi($e(f,St(L3))),m=$r($e(n,gn(i,e),Kt(([,x,v])=>x>v.length),Gi(!0)),!1);return qt($e(h,Na(([,x],v)=>[x,v],[{groupIndices:[],totalCount:0},{groupIndices:[],totalCount:0}]),gn(r,l,m),Kt(([[x,v],{sizeTree:k},_,w])=>{const S=x.groupIndices.length>0&&x.totalCount===x.groupIndices.length,N=v.totalCount>v.groupIndices.length;return _&&!w&&S&&N&&!qn(k)}),Gi(null)),t),qt($e(h,St(x=>x.totalCount)),o),qt($e(h,St(x=>x.groupIndices)),e),qt($e(_r(d,r,u),Kt(([x,v])=>rp(v)),St(([x,v,k])=>Ra(v.groupOffsetTree,Math.max(x-k,0),"v")[0]),rr(),St(x=>[x])),p),{groupCounts:f,topItemsIndexes:p}},ir(Va,Si)),fo=Dn(([{log:e}])=>{const t=ct(!1),n=Yi($e(t,Kt(r=>r),rr()));return Fn(t,r=>{r&&Zn(e)("props updated",{},Dr.DEBUG)}),{didMount:n,propsReady:t}},ir(uo),{singleton:!0}),O3=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function C4(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!O3)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const Fu=Dn(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:p,viewportHeight:h},{log:m}])=>{const x=Nn(),v=Nn(),k=ct(0);let _=null,w=null,S=null;function N(){_!==null&&(_(),_=null),S!==null&&(S(),S=null),w&&(clearTimeout(w),w=null),cn(d,!1)}return qt($e(x,gn(n,h,r,k,u,l,m),gn(e,o,i),St(([[j,R,T,I,M,L,A,D],$,ee,U])=>{const G=C4(j),{align:Z,behavior:z,offset:q}=G,ae=I-1,P=E4(G,R,ae);let Q=Tu(P,R.offsetTree,$)+L;Z==="end"?(Q+=ee+Ra(R.sizeTree,P)[1]-T+U,P===ae&&(Q+=A)):Z==="center"?Q+=(ee+Ra(R.sizeTree,P)[1]-T+U)/2:Q-=M,q!==void 0&&q!==0&&(Q+=q);const J=F=>{N(),F?(D("retrying to scroll to",{location:j},Dr.DEBUG),cn(x,j)):(cn(v,!0),D("list did not change, scroll successful",{},Dr.DEBUG))};if(N(),z==="smooth"){let F=!1;S=Fn(t,K=>{F=F||K}),_=Ca(p,()=>{J(F)})}else _=Ca($e(t,D3(150)),J);return w=setTimeout(()=>{N()},1200),cn(d,!0),D("scrolling from index to",{behavior:z,index:P,top:Q},Dr.DEBUG),{behavior:z,top:Q}})),f),{scrollTargetReached:v,scrollToIndex:x,topListHeight:k}},ir(Va,Si,uo),{singleton:!0});function D3(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function Ek(e,t){e===0?t():requestAnimationFrame(()=>{Ek(e-1,t)})}function Nk(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 Bu=Dn(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:l}])=>{const u=ct(!0),d=ct(0),f=ct(!0);return qt($e(l,gn(d),Kt(([p,h])=>!Bv(h)),Gi(!1)),u),qt($e(l,gn(d),Kt(([p,h])=>!Bv(h)),Gi(!1)),f),Fn($e(_r(t,l),gn(u,n,e,f),Kt(([[,p],h,{sizeTree:m},x,v])=>p&&(!qn(m)||bk(x))&&!h&&!v),gn(d)),([,p])=>{if(p===void 0){cn(u,!0),cn(f,!0);return}Ca(i,()=>{cn(f,!0)}),Ek(4,()=>{Ca(r,()=>{cn(u,!0)}),cn(o,p)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},ir(Va,Si,Fu,fo),{singleton:!0});function j4(e,t){return Math.abs(e-t)<1.01}const Ru="up",mu="down",P3="none",F3={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},B3=0,zu=Dn(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const l=ct(!1),u=ct(!0),d=Nn(),f=Nn(),p=ct(4),h=ct(B3),m=$r($e(Df($e(en(i),Jo(1),Gi(!0)),$e(en(i),Jo(1),Gi(!1),Iw(100))),rr()),!1),x=$r($e(Df($e(n,Gi(!0)),$e(n,Gi(!1),Iw(200))),rr()),!1);qt($e(_r(en(i),en(h)),St(([S,N])=>S<=N),rr()),u),qt($e(u,ks(50)),f);const v=Yi($e(_r(r,en(o),en(t),en(e),en(p)),Na((S,[{scrollHeight:N,scrollTop:j},R,T,I,M])=>{const L=j+R-N>-M,A={scrollHeight:N,scrollTop:j,viewportHeight:R};if(L){let $,ee;return j>S.state.scrollTop?($="SCROLLED_DOWN",ee=S.state.scrollTop-j):($="SIZE_DECREASED",ee=S.state.scrollTop-j||S.scrollTopDelta),{atBottom:!0,atBottomBecause:$,scrollTopDelta:ee,state:A}}let D;return A.scrollHeight>S.state.scrollHeight?D="SIZE_INCREASED":R<S.state.viewportHeight?D="VIEWPORT_HEIGHT_DECREASING":j<S.state.scrollTop?D="SCROLLING_UPWARDS":D="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:D,state:A}},F3),rr((S,N)=>S!==void 0&&S.atBottom===N.atBottom))),k=$r($e(r,Na((S,{scrollHeight:N,scrollTop:j,viewportHeight:R})=>{if(!j4(S.scrollHeight,N)){const T=N-(j+R)<1;return S.scrollTop!==j&&T?{changed:!0,jump:S.scrollTop-j,scrollHeight:N,scrollTop:j}:{changed:!0,jump:0,scrollHeight:N,scrollTop:j}}return{changed:!1,jump:0,scrollHeight:N,scrollTop:j}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Kt(S=>S.changed),St(S=>S.jump)),0);qt($e(v,St(S=>S.atBottom)),l),qt($e(l,ks(50)),d);const _=ct(mu);qt($e(r,St(({scrollTop:S})=>S),rr(),Na((S,N)=>Zn(x)?{direction:S.direction,prevScrollTop:N}:{direction:N<S.prevScrollTop?Ru:mu,prevScrollTop:N},{direction:mu,prevScrollTop:0}),St(S=>S.direction)),_),qt($e(r,ks(50),Gi(P3)),_);const w=ct(0);return qt($e(m,Kt(S=>!S),Gi(0)),w),qt($e(i,ks(100),gn(m),Kt(([S,N])=>N),Na(([S,N],[j])=>[N,j],[0,0]),St(([S,N])=>N-S)),w),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:p,atTopStateChange:f,atTopThreshold:h,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:w}},ir(Si)),Au="top",Iu="bottom",Fw="none";function Bw(e,t,n){return typeof e=="number"?n===Ru&&t===Au||n===mu&&t===Iu?e:0:n===Ru?t===Au?e.main:e.reverse:t===Iu?e.main:e.reverse}function zw(e,t){return typeof e=="number"?e:e[t]??0}const Ck=Dn(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Nn(),l=ct(0),u=ct(0),d=ct(0),f=$r($e(_r(en(r),en(i),en(n),en(o,Wl),en(d),en(l),en(t),en(e),en(u)),St(([p,h,m,[x,v],k,_,w,S,N])=>{const j=p-S,R=_+w,T=Math.max(m-j,0);let I=Fw;const M=zw(N,Au),L=zw(N,Iu);return x-=S,x+=m+w,v+=m+w,v-=S,x>p+R-M&&(I=Ru),v<p-T+h+L&&(I=mu),I!==Fw?[Math.max(j-m-Bw(k,Au,I)-M,0),j-T-w+h+Bw(k,Iu,I)+L]:null}),Kt(p=>p!==null),rr(Wl)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},ir(Si),{singleton:!0});function z3(e,t,n,r){if(rp(t)){const i=r-t.groupIndices.length;if(i<=0)return[{index:t.groupIndices[0],offset:0,size:0}];const o=S4(Math.min(e,i-1),t);return[{index:Ra(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 cg={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function jf(e,t,n,r,i,o){const{lastIndex:l,lastOffset:u,lastSize:d}=i;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 h=n-l,m=u+h*d+(h-1)*r,x=f,v=m-p;return{bottom:p,firstItemIndex:o,items:Uw(e,i,o),offsetBottom:v,offsetTop:f,top:x,topItems:Uw(t,i,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:n}}function T4(e,t,n,r,i,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=Nk(t,d?f:u),h=d?Math.max(0,Math.min(u,f-p)):u,m=Array.from({length:h}).map((x,v)=>({data:o==null?void 0:o[v+p],index:v+p,offset:0,size:0}));return jf(m,[],h,i,n,r)}function Uw(e,t,n){if(e.length===0)return[];if(!rp(t))return e.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const r=e[0].index,i=e[e.length-1].index,o=[],l=zl(t.groupOffsetTree,r,i);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 qw(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const nl=Dn(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:p},{topListHeight:h},m,{didMount:x},{recalcInProgress:v}])=>{const k=ct([]),_=ct(0),w=$r($e(r,Kt(({sizeTree:M})=>!qn(M)),Gi(!0)),!1),S=Nn(),N=ct(0);qt(o.topItemsIndexes,k);const j=$r($e(_r(x,v,en(d,Wl),en(i),en(r),en(f),p,en(k),en(t),en(n),en(N),e,en(_)),Kt(([M,L,,A,,,,,,,,D])=>{const $=D!==void 0&&D.length!==A;return M&&!L&&!$}),St(([,,[M,L],A,D,$,ee,U,G,Z,z,q,ae])=>{var we,Ke;const P=D,{offsetTree:Q,sizeTree:J}=P;if(A===0)return{...cg,totalCount:A};if(M===0&&L===0)return ae===0?{...cg,totalCount:A}:T4(ae,$,D,G,Z,q);if(qn(J))return ae>0&&!Zn(w)?null:jf(z3(Nk($,A),P,q,A),[],A,Z,P,G);const F=[];if(U.length>0){const xt=U[0],et=U[U.length-1];let vt=0;for(const lt of zl(J,xt,et)){const je=lt.value,Oe=Math.max(lt.start,xt),ft=Math.min(lt.end,et);for(let Ct=Oe;Ct<=ft;Ct++)F.push({data:q==null?void 0:q[Ct],index:Ct,offset:vt,size:je}),vt+=je}}if(!ee)return jf([],F,A,Z,P,G);const K=U.length>0?U[U.length-1]+1:0,W=j3(Q,M,L,K);if(W.length===0)return null;const H=A-1,se=np([],xt=>{for(const et of W){const vt=et.value;let lt=vt.offset,je=et.start;const Oe=vt.size;if(vt.offset<M){je+=Math.floor((M-vt.offset+Z)/(Oe+Z));const Ct=je-et.start;lt+=Ct*Oe+Ct*Z}je<K&&(lt+=(K-je)*Oe,je=K);const ft=Math.min(et.end,H);for(let Ct=je;Ct<=ft&&!(lt>=L);Ct++)xt.push({data:q==null?void 0:q[Ct],index:Ct,offset:lt,size:Oe}),lt+=Oe+Z}}),ie=qw(z,Au),ge=qw(z,Iu);if(se.length>0&&(ie>0||ge>0)){const xt=se[0],et=se[se.length-1];if(ie>0&&xt.index>K){const vt=Math.min(ie,xt.index-K),lt=[];let je=xt.offset;for(let Oe=xt.index-1;Oe>=xt.index-vt;Oe--){const ft=((we=zl(J,Oe,Oe)[0])==null?void 0:we.value)??xt.size;je-=ft+Z,lt.unshift({data:q==null?void 0:q[Oe],index:Oe,offset:je,size:ft})}se.unshift(...lt)}if(ge>0&&et.index<H){const vt=Math.min(ge,H-et.index);let lt=et.offset+et.size+Z;for(let je=et.index+1;je<=et.index+vt;je++){const Oe=((Ke=zl(J,je,je)[0])==null?void 0:Ke.value)??et.size;se.push({data:q==null?void 0:q[je],index:je,offset:lt,size:Oe}),lt+=Oe+Z}}}return jf(se,F,A,Z,P,G)}),Kt(M=>M!==null),rr()),cg);qt($e(e,Kt(bk),St(M=>M==null?void 0:M.length)),i),qt($e(j,St(M=>M.topListHeight)),h),qt(h,u),qt($e(j,St(M=>[M.top,M.bottom])),l),qt($e(j,St(M=>M.items)),S);const R=Yi($e(j,Kt(({items:M})=>M.length>0),gn(i,e),Kt(([{items:M},L])=>M[M.length-1].originalIndex===L-1),St(([{items:M},L,A])=>{const D=M[M.length-1],$=D.type==="group"?D.index+1:(D.groupIndex??-1)+1;return[L-1-$,A]}),rr(Wl),Kt(([M])=>M>=0),St(([M])=>M))),T=Yi($e(j,ks(200),Kt(({items:M,topItems:L})=>M.length>0&&M[0].originalIndex===L.length),St(({items:M})=>M[0].index),rr())),I=Yi($e(j,Kt(({items:M})=>M.length>0),St(({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}}),rr(_4)));return{endReached:R,initialItemCount:_,itemsRendered:S,listState:j,minOverscanItemCount:N,rangeChanged:I,startReached:T,topItemsIndexes:k,...m}},ir(Va,N4,Ck,Bu,Fu,zu,fo,wk),{singleton:!0}),R4=Dn(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Nn(),l=$r($e(_r(n,e,r,t,i),St(([u,d,f,p,h])=>u+d+f+p+h.offsetBottom+h.bottom)),0);return qt(en(l),o),{totalListHeight:l,totalListHeightChanged:o}},ir(Si,nl),{singleton:!0}),U3=Dn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ct(!1),r=$r($e(_r(n,e,t),Kt(([i])=>i),St(([,i,o])=>Math.max(0,i-o)),ks(0),rr()),0);return{alignToBottom:n,paddingTopAddition:r}},ir(Si,R4),{singleton:!0}),A4=Dn(()=>({context:ct(null)})),q3=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:l})=>t<l?{...i,align:n??"start",...r===void 0?{}:{behavior:r}}:e>o?{...i,align:n??"end",...r===void 0?{}:{behavior:r}}:null,I4=Dn(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const p=Nn();return qt($e(p,gn(t,d,n,o,i,r,u),gn(e),St(([[h,m,x,v,k,_,w,S],N])=>{const{calculateViewLocation:j=q3,done:R,...T}=h,I=E4(h,m,v-1),M=Tu(I,m.offsetTree,N)+k+_,L=M+Ra(m.sizeTree,I)[1],A=S+_,D=S+x-w,$=j({itemBottom:L,itemTop:M,locationParams:T,viewportBottom:D,viewportTop:A});return $===null?R==null||R():R&&Ca($e(l,Kt(ee=>!ee),Jo(Zn(l)?1:2)),R),$}),Kt(h=>h!==null)),f),{scrollIntoView:p}},ir(Va,Si,Fu,nl,uo),{singleton:!0});function Hw(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const H3=(e,t)=>typeof e=="function"?Hw(e(t)):t&&Hw(e),$3=Dn(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:p},{scrollingInProgress:h},{context:m},{scrollIntoView:x}])=>{const v=ct(!1),k=Nn();let _=null;function w(R){cn(l,{align:"end",behavior:R,index:"LAST"})}Fn($e(_r($e(en(t),Jo(1)),d),gn(en(v),o,u,h),St(([[R,T],I,M,L,A])=>{let D=T&&L,$="auto";return D&&($=H3(I,M||A),D=D&&$!==!1),{followOutputBehavior:$,shouldFollow:D,totalCount:R}}),Kt(({shouldFollow:R})=>R)),({followOutputBehavior:R,totalCount:T})=>{_!==null&&(_(),_=null),Zn(n)===void 0?_=Ca(e,()=>{Zn(p)("following output to ",{totalCount:T},Dr.DEBUG),w(R),_=null}):requestAnimationFrame(()=>{Zn(p)("following output to ",{totalCount:T},Dr.DEBUG),w(R)})});function S(R){const T=Ca(i,I=>{R&&!I.atBottom&&I.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(Zn(p)("scrolling to bottom due to increased size",{},Dr.DEBUG),w("auto"))});setTimeout(T,100)}Fn($e(_r(en(v),t,f),Kt(([R,,T])=>R!==!1&&T),Na(({value:R},[,T])=>({refreshed:R===T,value:T}),{refreshed:!1,value:0}),Kt(({refreshed:R})=>R),gn(v,t)),([,R])=>{Zn(u)&&S(R!==!1)}),Fn(k,()=>{S(Zn(v)!==!1)}),Fn(_r(en(v),i),([R,T])=>{R!==!1&&!T.atBottom&&T.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const N=ct(null),j=Nn();return qt(Df($e(en(r),St(R=>(R==null?void 0:R.length)??0)),$e(en(t))),j),Fn($e(_r($e(j,Jo(1)),d),gn(en(N),u,h,m),St(([[R,T],I,M,L,A])=>T&&M&&(I==null?void 0:I({context:A,totalCount:R,scrollingInProgress:L}))),Kt(R=>!!R),ks(0)),R=>{_!==null&&(_(),_=null),Zn(n)===void 0?_=Ca(e,()=>{Zn(p)("scrolling into view",{}),cn(x,R),_=null}):requestAnimationFrame(()=>{Zn(p)("scrolling into view",{}),cn(x,R)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:N}},ir(Va,zu,Fu,Bu,fo,uo,Si,A4,I4)),W3=Dn(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:l},{didMount:u}])=>(qt($e(u,gn(o),Kt(([,d])=>d!==0),gn(i,r,t,n,e),St(([[,d],f,p,h,m,x])=>T4(d,f,p,h,m,x))),l),{}),ir(Va,Bu,nl,fo),{singleton:!0}),V3=Dn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ct(0);return Fn($e(e,gn(r),Kt(([,i])=>i!==0),St(([,i])=>({top:i}))),i=>{Ca($e(n,Jo(1),Kt(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{cn(t,i)})})}),{initialScrollTop:r}},ir(fo,Si,nl),{singleton:!0}),M4=Dn(([{scrollVelocity:e}])=>{const t=ct(!1),n=Nn(),r=ct(!1);return qt($e(e,gn(r,t,n),Kt(([i,o])=>o!==!1&&o!==void 0),St(([i,o,l,u])=>{const{enter:d,exit:f}=o;if(l){if(f(i,u))return!1}else if(d(i,u))return!0;return l}),rr()),t),Fn($e(_r(t,e,n),gn(r)),([[i,o,l],u])=>{i&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ir(zu),{singleton:!0}),jk=Dn(([{scrollContainerState:e,scrollTo:t}])=>{const n=Nn(),r=Nn(),i=Nn(),o=ct(!1),l=ct(void 0);return qt($e(_r(n,r),St(([{scrollTop:u,viewportHeight:d},{offsetTop:f,listHeight:p}])=>({scrollHeight:p,scrollTop:Math.max(0,u-f),viewportHeight:d}))),e),qt($e(t,gn(r),St(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),i),{customScrollParent:l,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},ir(Si)),G3=Dn(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=Nn(),p=ct(void 0),h=ct(null),m=ct(null);return qt(u,h),qt(d,m),Fn($e(f,gn(t,r,l,h,m,n)),([x,v,k,_,w,S,N])=>{const j=R3(v.sizeTree);_&&w!==null&&S!==null&&(k=w.scrollTop-S.offsetTop),k-=N,x({ranges:j,scrollTop:k})}),qt($e(p,Kt(bk),St(K3)),i),qt($e(o,gn(p),Kt(([,x])=>x!==void 0),rr(),St(([,x])=>x.ranges)),e),{getState:f,restoreStateFrom:p}},ir(Va,Si,Bu,fo,jk));function K3(e){return{align:"start",index:0,offset:e.scrollTop}}const Y3=Dn(([{topItemsIndexes:e}])=>{const t=ct(0);return qt($e(t,Kt(n=>n>=0),St(n=>Array.from({length:n}).map((r,i)=>i))),e),{topItemCount:t}},ir(nl));function L4(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Q3=L4(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),X3=Dn(([{deviation:e,deviationCommitted:t,scrollBy:n,scrollingInProgress:r,scrollTop:i},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:p,gap:h,shiftWithOffset:m,sizes:x},{log:v},{recalcInProgress:k}])=>{const _=Yi($e(f,gn(u),Na(([,j,R,T],[{bottom:I,items:M,offsetBottom:L,totalCount:A},D])=>{const $=I+L;let ee=0;return R===A&&j.length>0&&M.length>0&&(M[0].originalIndex===0&&j[0].originalIndex===0||(ee=$-T,ee!==0&&(ee+=D))),[ee,M,A,$]},[0,[],0,0]),Kt(([j])=>j!==0),gn(i,d,r,o,v,k),Kt(([,j,R,T,,,I])=>!I&&!T&&j!==0&&R===Ru),St(([[j],,,,,R])=>(R("Upward scrolling compensation",{amount:j},Dr.DEBUG),j))));function w(j){j>0?(cn(n,{behavior:"auto",top:-j}),cn(e,0)):(cn(e,0),cn(n,{behavior:"auto",top:-j}))}Fn($e(_,gn(e,l)),([j,R,T])=>{T&&Q3()?cn(e,R-j):w(-j)}),Fn($e(_r($r(l,!1),e,k),Kt(([j,R,T])=>!j&&!T&&R!==0),St(([j,R])=>R),ks(1)),w),qt($e(m,St(j=>({top:-j}))),n);let S=null;function N(){if(S===null)return;const{offset:j}=S;S=null,cn(n,{top:j}),requestAnimationFrame(()=>{cn(e,0),cn(k,!1)})}return Fn(t,j=>{S===null||!S.acknowledgeable||j===S.offset&&N()}),Fn($e(p,gn(x,h),St(([j,{groupIndices:R,lastSize:T,sizeTree:I},M])=>{function L(U){return U*(T+M)}if(R.length===0)return L(j);let A=0;const D=ju(I,0);let $=0,ee=0;for(;$<j;){$++,A+=D;let U=R.length===ee+1?1/0:R[ee+1]-R[ee]-1;$+U>j&&(A-=D,U=j-$+1),$+=U,A+=L(U),ee++}return A})),j=>{S={acknowledgeable:Zn(e)!==j,offset:j},cn(e,j),requestAnimationFrame(N)}),{deviation:e}},ir(Si,zu,nl,Va,uo,wk)),Z3=Dn(([e,t,n,r,i,o,l,u,d,f,p])=>({...e,...t,...n,...r,...i,...o,...l,...u,...d,...f,...p}),ir(Ck,W3,fo,M4,R4,V3,U3,jk,I4,uo,A4)),O4=Dn(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:p,statefulTotalCount:h,totalCount:m,trackItemSizes:x},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},w,S,N,j,{scrollToIndex:R},T,{topItemCount:I},{groupCounts:M},L])=>{const{listState:A,minOverscanItemCount:D,topItemsIndexes:$,rangeChanged:ee,...U}=j;return qt(ee,L.scrollSeekRangeChanged),qt($e(_r(L.windowViewportRect,w.headerHeight,w.fixedHeaderHeight),St(([G,Z,z])=>Math.max(Z+z+1,G.visibleHeight))),w.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:M,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:I,topItemsIndexes:$,totalCount:m,...N,groupIndices:l,itemSize:d,listState:A,minOverscanItemCount:D,scrollToIndex:R,statefulTotalCount:h,trackItemSizes:x,rangeChanged:ee,...U,...L,...w,sizes:p,...S}},ir(Va,Bu,Si,G3,$3,nl,Fu,X3,Y3,N4,Z3));function J3(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const l in t)Object.hasOwn(r,l)||(n[l]=t[l]);return n}const tf=typeof document>"u"?Mt.useEffect:Mt.useLayoutEffect;function D4(e,t,n){const r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Mt.createContext({});function d(_,w){_.propsReady!==void 0&&cn(_.propsReady,!1);for(const S of r){const N=_[t.required[S]];cn(N,w[S])}for(const S of i)if(S in w){const N=_[t.optional[S]];cn(N,w[S])}_.propsReady!==void 0&&cn(_.propsReady,!0)}function f(_){return o.reduce((w,S)=>(w[S]=N=>{const j=_[t.methods[S]];cn(j,N)},w),{})}function p(_){return l.reduce((w,S)=>(w[S]=h3(_[t.events[S]]),w),{})}const h=Mt.forwardRef(function(_,w){const{children:S,...N}=_,[j]=Mt.useState(()=>np(x3(e),I=>{d(I,N)})),[R]=Mt.useState(Aw(p,j));tf(()=>{for(const I of l)I in N&&Fn(R[I],N[I]);return()=>{Object.values(R).map(vk)}},[N,R,j]),tf(()=>{d(j,N)}),Mt.useImperativeHandle(w,Rw(f(j)));const T=n;return a.jsx(u.Provider,{value:j,children:n===void 0?S:a.jsx(T,{...J3([...r,...i,...l],N),children:S})})}),m=_=>{const w=Mt.useContext(u);return Mt.useCallback(S=>{cn(w[_],S)},[w,_])},x=_=>{const w=Mt.useContext(u)[_],S=Mt.useCallback(N=>Fn(w,N),[w]);return Mt.useSyncExternalStore(S,()=>Zn(w),()=>Zn(w))},v=_=>{const w=Mt.useContext(u)[_],[S,N]=Mt.useState(Aw(Zn,w));return tf(()=>Fn(w,j=>{j!==S&&N(Rw(j))}),[w,S]),S},k=parseInt(Mt.version,10)>=18?x:v;return{Component:h,useEmitter:(_,w)=>{const S=Mt.useContext(u)[_];tf(()=>Fn(S,w),[w,S])},useEmitterValue:k,usePublisher:m}}const Tk=Mt.createContext(void 0),P4=Mt.createContext(void 0),ug="-webkit-sticky",$w="sticky",Rk=L4(()=>{if(typeof document>"u")return $w;const e=document.createElement("div");return e.style.position=ug,e.style.position===ug?ug:$w});function dg(e){return"self"in e}function eD(e){return"body"in e}function F4(e,t,n,r=Yl,i,o){const l=Mt.useRef(null),u=Mt.useRef(null),d=Mt.useRef(null),f=Mt.useCallback(h=>{let m,x,v;const k=h.target;if(eD(k)||dg(k)){const w=dg(k)?k:k.defaultView;v=o===!0?Go(w,w.scrollX):w.scrollY,m=o===!0?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,x=o===!0?w.innerWidth:w.innerHeight}else v=o===!0?Go(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})};h.suppressFlushSync===!0?_():YM.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]);Mt.useEffect(()=>{const h=i??l.current;return r(i??l.current),f({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",f,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",f)}},[l,f,n,r,i]);function p(h){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const x=h.behavior==="smooth";let v,k,_;dg(m)?(k=Math.max(ao(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?Go(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=ao(m,o===!0?"width":"height"),_=o===!0?Go(m,m.scrollLeft):m.scrollTop);const w=k-v;if(h.top===void 0){m.scrollTo(h);return}const S=Math.ceil(Math.max(Math.min(w,h.top),0));if(h.top=S,j4(v,k)||S===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),x&&t(!0);return}x?(u.current=S,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,u.current=null,t(!0)},1e3)):u.current=null,o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},left:Mw(m,S)}),m.scrollTo(h)}return{scrollByCallback:Mt.useCallback(h=>{o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:Mw(l.current,h.top)}}),l.current.scrollBy(h)},[o]),scrollerRef:l,scrollToCallback:p}}function Ak(e){return e}const tD=Dn(()=>{const e=ct(u=>`Item ${u}`),t=ct(u=>`Group ${u}`),n=ct({}),r=ct(Ak),i=ct("div"),o=ct(Yl),l=(u,d=null)=>$r($e(n,St(f=>f[u]),rr()),d);return{components:n,computeItemKey:r,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:i,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),nD=Dn(([e,t])=>({...e,...t}),ir(O4,tD)),rD=({height:e})=>a.jsx("div",{style:{height:e}}),iD={overflowAnchor:"none",position:Rk(),zIndex:1},B4={overflowAnchor:"none"},aD={...B4,display:"inline-block",height:"100%"},Ww=Mt.memo(function({showTopList:e=!1}){const t=sn("listState"),n=Ki("sizeRanges"),r=sn("useWindowScroll"),i=sn("customScrollParent"),o=Ki("windowScrollContainerState"),l=Ki("scrollContainerState"),u=i||r?o:l,d=sn("itemContent"),f=sn("context"),p=sn("groupContent"),h=sn("trackItemSizes"),m=sn("itemSize"),x=sn("log"),v=Ki("gap"),k=sn("horizontalDirection"),{callbackRef:_}=k3(n,m,h,e?Yl:u,x,v,i,k,sn("skipAnimationFrameInResizeObserver")),[w,S]=Mt.useState(0);Mk("deviation",G=>{w!==G&&S(G)});const N=Ki("deviationCommitted");_k(()=>{N(w)},[w,N]);const j=sn("EmptyPlaceholder"),R=sn("ScrollSeekPlaceholder")??rD,T=sn("ListComponent"),I=sn("ItemComponent"),M=sn("GroupComponent"),L=sn("computeItemKey"),A=sn("isSeeking"),D=sn("groupIndices").length>0,$=sn("alignToBottom"),ee=sn("initialItemFinalLocationReached"),U=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:w===0?$?"auto":0:w,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:w===0?$?"auto":0:w,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...ee?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&j!==null&&j!==void 0?a.jsx(j,{...pi(j,f)}):a.jsx(T,{...pi(T,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:U,children:(e?t.topItems:t.items).map(G=>{const Z=G.originalIndex,z=L(Z+t.firstItemIndex,G.data,f);return A?y.createElement(R,{...pi(R,f),height:G.size,index:G.index,key:z,type:G.type||"item",...G.type==="group"?{}:{groupIndex:G.groupIndex}}):G.type==="group"?y.createElement(M,{...pi(M,f),"data-index":Z,"data-item-index":G.index,"data-known-size":G.size,key:z,style:iD},p(G.index,f)):y.createElement(I,{...pi(I,f),...cD(I,G.data),"data-index":Z,"data-item-group-index":G.groupIndex,"data-item-index":G.index,"data-known-size":G.size,key:z,style:k?aD:B4},D?d(G.index,G.groupIndex,G.data,f):d(G.index,G.data,f))})})}),sD={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},oD={outline:"none",overflowX:"auto",position:"relative"},Ik=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),z4=(e,t,n=0)=>({...Ik(e),position:t?"relative":"absolute",top:t?-n:0}),lD={position:Rk(),top:0,width:"100%",zIndex:1};function pi(e,t){if(typeof e!="string")return{context:t}}function cD(e,t){return{item:typeof e=="string"?void 0:t}}const uD=Mt.memo(function(){const e=sn("HeaderComponent"),t=Ki("headerHeight"),n=sn("HeaderFooterTag"),r=tl(Mt.useMemo(()=>o=>{t(ao(o,"height"))},[t]),!0,sn("skipAnimationFrameInResizeObserver")),i=sn("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...pi(e,i)})}):null}),dD=Mt.memo(function(){const e=sn("FooterComponent"),t=Ki("footerHeight"),n=sn("HeaderFooterTag"),r=tl(Mt.useMemo(()=>o=>{t(ao(o,"height"))},[t]),!0,sn("skipAnimationFrameInResizeObserver")),i=sn("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...pi(e,i)})}):null});function U4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Mt.memo(function({children:r,style:i,context:o,...l}){const u=n("scrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("scrollerRef"),h=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:x,scrollToCallback:v}=F4(u,f,d,p,void 0,h),k=Mt.useContext(Tk),_=Mt.useRef(0),w=Mt.useCallback(N=>{_.current=N},[]);e("totalListHeight",w);const S=Mt.useCallback(N=>{if(!k||N.top===void 0)return;const j=Math.max(_.current,k.viewportHeight),R=Math.ceil(Math.max(Math.min(j-k.viewportHeight,N.top),0));u({scrollHeight:j,scrollTop:R,viewportHeight:k.viewportHeight}),N.behavior==="smooth"&&f(!0)},[k,u,f]);return e("scrollTo",k?S:v),e("scrollBy",m),a.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...h?oD:sD,...i},tabIndex:0,...l,...pi(d,o),children:r})})}function q4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Mt.memo(function({children:r,style:i,context:o,...l}){const u=n("windowScrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("totalListHeight"),h=t("deviation"),m=t("customScrollParent"),x=Mt.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:w}=F4(u,f,d,v,m);return _k(()=>{var S;return _.current=m??((S=x.current)==null?void 0:S.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",w),e("scrollBy",k),a.jsx(d,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...p===0?void 0:{height:p+h}},...l,...pi(d,o),children:r})})}const fD=({children:e})=>{const t=Mt.useContext(Tk),n=Ki("viewportHeight"),r=Ki("fixedItemHeight"),i=sn("alignToBottom"),o=sn("horizontalDirection"),l=Mt.useMemo(()=>p4(n,d=>ao(d,o?"width":"height")),[n,o]),u=tl(l,!0,sn("skipAnimationFrameInResizeObserver"));return Mt.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),a.jsx("div",{"data-viewport-type":"element",ref:u,style:Ik(i),children:e})},pD=({children:e})=>{const t=Mt.useContext(Tk),n=Ki("windowViewportRect"),r=Ki("fixedItemHeight"),i=sn("customScrollParent"),o=sn("useWindowScroll"),l=sn("topListHeight"),u=m4(n,i,sn("skipAnimationFrameInResizeObserver")),d=sn("alignToBottom");return Mt.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),a.jsx("div",{"data-viewport-type":"window",ref:u,style:z4(d,o,l),children:e})},hD=({children:e})=>{const t=sn("TopItemListComponent")??"div",n=sn("headerHeight"),r={...lD,marginTop:`${n}px`},i=sn("context");return a.jsx(t,{style:r,...pi(t,i),children:e})},gD=Mt.memo(function(e){const t=sn("useWindowScroll"),n=sn("topItemsIndexes").length>0,r=sn("customScrollParent"),i=sn("context");return a.jsxs(r||t?yD:xD,{...e,context:i,children:[n&&a.jsx(hD,{children:a.jsx(Ww,{showTopList:!0})}),a.jsxs(r||t?pD:fD,{children:[a.jsx(uD,{}),a.jsx(Ww,{}),a.jsx(dD,{})]})]})}),{Component:mD,useEmitter:Mk,useEmitterValue:sn,usePublisher:Ki}=D4(nD,{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"}},gD),xD=U4({useEmitter:Mk,useEmitterValue:sn,usePublisher:Ki}),yD=q4({useEmitter:Mk,useEmitterValue:sn,usePublisher:Ki}),H4=mD,bD=Dn(()=>{const e=ct(f=>a.jsxs("td",{children:["Item $",f]})),t=ct(null),n=ct(f=>a.jsxs("td",{colSpan:1e3,children:["Group ",f]})),r=ct(null),i=ct(null),o=ct({}),l=ct(Ak),u=ct(Yl),d=(f,p=null)=>$r($e(o,St(h=>h[f]),rr()),p);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:i,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")}});ir(O4,bD);Rk();const Vw={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},vD={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Gw,floor:Ff,max:xu,min:fg,round:Kw}=Math;function Yw(e,t,n){return Array.from({length:t-e+1}).map((r,i)=>({data:n===null?null:n[i+e],index:i+e}))}function kD(e){return{...vD,items:e}}function nf(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function _D(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const wD=Dn(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:p,viewportHeight:h},m,x,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:w,windowScrollContainerState:S,windowScrollTo:N,windowViewportRect:j},R])=>{const T=ct(0),I=ct(0),M=ct(Vw),L=ct({height:0,width:0}),A=ct({height:0,width:0}),D=Nn(),$=Nn(),ee=ct(0),U=ct(null),G=ct({column:0,row:0}),Z=Nn(),z=Nn(),q=ct(!1),ae=ct(0),P=ct(!0),Q=ct(!1),J=ct(!1);Fn($e(v,gn(ae),Kt(([ie,ge])=>!Bv(ge))),()=>{cn(P,!1)}),Fn($e(_r(v,P,A,L,ae,Q),Kt(([ie,ge,we,Ke,,xt])=>ie&&!ge&&we.height!==0&&Ke.height!==0&&!xt)),([,,,,ie])=>{if(ie===void 0){cn(P,!0);return}cn(Q,!0),Ek(1,()=>{cn(D,ie)}),Ca($e(f),()=>{cn(t,[0,0]),cn(P,!0)})}),qt($e(z,Kt(ie=>ie!=null&&ie.scrollTop>0),Gi(0)),I),Fn($e(v,gn(z),Kt(([,ie])=>ie!=null)),([,ie])=>{ie&&(cn(L,ie.viewport),cn(A,ie.item),cn(G,ie.gap),ie.scrollTop>0&&(cn(q,!0),Ca($e(f,Jo(1)),ge=>{cn(q,!1)}),cn(d,{top:ie.scrollTop})))}),qt($e(L,St(({height:ie})=>ie)),h),qt($e(_r(en(L,nf),en(A,nf),en(G,(ie,ge)=>ie!==void 0&&ie.column===ge.column&&ie.row===ge.row),en(f)),St(([ie,ge,we,Ke])=>({gap:we,item:ge,scrollTop:Ke,viewport:ie}))),Z),qt($e(_r(en(T),r,en(G,_D),en(A,nf),en(L,nf),en(U),en(I),en(q),en(P),en(ae)),Kt(([,,,,,,,ie])=>!ie),St(([ie,[ge,we],Ke,xt,et,vt,lt,,je,Oe])=>{const{column:ft,row:Ct}=Ke,{height:rn,width:tn}=xt,{width:un}=et;if(lt===0&&(ie===0||un===0))return Vw;if(tn===0){const be=Nk(Oe,ie),Ye=be+Math.max(lt-1,0);return kD(Yw(be,Ye,vt))}const mt=$4(un,tn,ft);let $t,nt;je?ge===0&&we===0&<>0?($t=0,nt=lt-1):($t=mt*Ff((ge+Ct)/(rn+Ct)),nt=mt*Gw((we+Ct)/(rn+Ct))-1,nt=fg(ie-1,xu(nt,mt-1)),$t=fg(nt,xu(0,$t))):($t=0,nt=-1);const qe=Yw($t,nt,vt),{bottom:ue,top:me}=Qw(et,Ke,xt,qe),Ue=Gw(ie/mt),He=Ue*rn+(Ue-1)*Ct-ue;return{bottom:ue,itemHeight:rn,items:qe,itemWidth:tn,offsetBottom:He,offsetTop:me,top:me}})),M),qt($e(U,Kt(ie=>ie!==null),St(ie=>ie.length)),T),qt($e(_r(L,A,M,G),Kt(([ie,ge,{items:we}])=>we.length>0&&ge.height!==0&&ie.height!==0),St(([ie,ge,{items:we},Ke])=>{const{bottom:xt,top:et}=Qw(ie,Ke,ge,we);return[et,xt]}),rr(Wl)),t);const F=ct(!1);qt($e(f,gn(F),St(([ie,ge])=>ge||ie!==0)),F);const K=Yi($e(_r(M,T),Kt(([{items:ie},ge])=>{const we=Zn(U);return ie.length>0&&(we===null||we.length===ge)}),gn(F),Kt(([[ie,ge],we])=>{const Ke=ie.items[ie.items.length-1].index===ge-1;return(we||ie.bottom>0&&ie.itemHeight>0&&ie.offsetBottom===0&&ie.items.length===ge)&&Ke}),St(([[,ie]])=>[ie-1,Zn(U)]),rr(Wl),St(([ie])=>ie))),W=Yi($e(en(M),Kt(({items:ie})=>ie.length>0&&ie[0].index===0),Gi(0),rr())),H=Yi($e(en(M),gn(q),Kt(([{items:ie},ge])=>ie.length>0&&!ge),St(([{items:ie}])=>({endIndex:ie[ie.length-1].index,startIndex:ie[0].index})),rr(_4),ks(0)));qt(H,x.scrollSeekRangeChanged),qt($e(D,gn(L,A,T,G),St(([ie,ge,we,Ke,xt])=>{const et=C4(ie),{align:vt,behavior:lt,offset:je}=et;let Oe=et.index;Oe==="LAST"&&(Oe=Ke-1),Oe=xu(0,fg(Ke-1,Oe));let ft=zv(ge,xt,we,Oe);return vt==="end"?ft=Kw(ft-ge.height+we.height):vt==="center"&&(ft=Kw(ft-ge.height/2+we.height/2)),je!==void 0&&je!==0&&(ft+=je),{behavior:lt,top:ft}})),d);const se=$r($e(M,St(ie=>ie.offsetBottom+ie.bottom)),0);return qt($e(j,St(ie=>({height:ie.visibleHeight,width:ie.visibleWidth}))),L),{customScrollParent:_,data:U,deviation:ee,footerHeight:i,gap:G,headerHeight:o,increaseViewportBy:e,initialItemCount:I,itemDimensions:A,overscan:n,restoreStateFrom:z,scrollBy:l,scrollContainerState:u,scrollHeight:$,scrollTo:d,scrollToIndex:D,scrollTop:f,smoothScrollTargetReached:p,totalCount:T,useWindowScroll:w,viewportDimensions:L,windowScrollContainerState:S,windowScrollTo:N,windowViewportRect:j,...x,gridState:M,horizontalDirection:J,initialTopMostItemIndex:ae,totalListHeight:se,...m,endReached:K,propsReady:k,rangeChanged:H,startReached:W,stateChanged:Z,stateRestoreInProgress:q,...R}},ir(Ck,Si,zu,M4,fo,jk,uo));function $4(e,t,n){return xu(1,Ff((e+n)/(Ff(t)+n)))}function Qw(e,t,n,r){const{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};const o=zv(e,t,n,r[0].index);return{bottom:zv(e,t,n,r[r.length-1].index)+i,top:o}}function zv(e,t,n,r){const i=$4(e.width,n.width,t.column),o=Ff(r/i),l=o*n.height+xu(0,o-1)*t.row;return l>0?l+t.row:l}const SD=Dn(()=>{const e=ct(h=>`Item ${h}`),t=ct({}),n=ct(null),r=ct("virtuoso-grid-item"),i=ct("virtuoso-grid-list"),o=ct(Ak),l=ct("div"),u=ct(Yl),d=(h,m=null)=>$r($e(t,St(x=>x[h]),rr()),m),f=ct(!1),p=ct(!1);return qt(en(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:i,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:p,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),ED=Dn(([e,t])=>({...e,...t}),ir(wD,SD)),ND=Mt.memo(function(){const e=nr("gridState"),t=nr("listClassName"),n=nr("itemClassName"),r=nr("itemContent"),i=nr("computeItemKey"),o=nr("isSeeking"),l=ca("scrollHeight"),u=nr("ItemComponent"),d=nr("ListComponent"),f=nr("ScrollSeekPlaceholder"),p=nr("context"),h=ca("itemDimensions"),m=ca("gap"),x=nr("log"),v=nr("stateRestoreInProgress"),k=ca("reportReadyState"),_=tl(Mt.useMemo(()=>w=>{const S=w.parentElement.parentElement.scrollHeight;l(S);const N=w.firstChild;if(N!==null){const{height:j,width:R}=N.getBoundingClientRect();h({height:j,width:R})}m({column:Xw("column-gap",getComputedStyle(w).columnGap,x),row:Xw("row-gap",getComputedStyle(w).rowGap,x)})},[l,h,m,x]),!0,!1);return _k(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:a.jsx(d,{className:t,ref:_,...pi(d,p),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(w=>{const S=i(w.index,w.data,p);return o?a.jsx(f,{...pi(f,p),height:e.itemHeight,index:w.index,width:e.itemWidth},S):y.createElement(u,{...pi(u,p),className:n,"data-index":w.index,key:S},r(w.index,w.data,p))})})}),CD=Mt.memo(function(){const e=nr("HeaderComponent"),t=ca("headerHeight"),n=nr("headerFooterTag"),r=tl(Mt.useMemo(()=>o=>{t(ao(o,"height"))},[t]),!0,!1),i=nr("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...pi(e,i)})}):null}),jD=Mt.memo(function(){const e=nr("FooterComponent"),t=ca("footerHeight"),n=nr("headerFooterTag"),r=tl(Mt.useMemo(()=>o=>{t(ao(o,"height"))},[t]),!0,!1),i=nr("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...pi(e,i)})}):null}),TD=({children:e})=>{const t=Mt.useContext(P4),n=ca("itemDimensions"),r=ca("viewportDimensions"),i=tl(Mt.useMemo(()=>o=>{r(o.getBoundingClientRect())},[r]),!0,!1);return Mt.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),a.jsx("div",{ref:i,style:Ik(!1),children:e})},RD=({children:e})=>{const t=Mt.useContext(P4),n=ca("windowViewportRect"),r=ca("itemDimensions"),i=nr("customScrollParent"),o=nr("useWindowScroll"),l=m4(n,i,!1);return Mt.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),a.jsx("div",{ref:l,style:z4(!1,o),children:e})},AD=Mt.memo(function({...e}){const t=nr("useWindowScroll"),n=nr("customScrollParent"),r=n||t?MD:ID,i=n||t?RD:TD,o=nr("context");return a.jsx(r,{...e,...pi(r,o),children:a.jsxs(i,{children:[a.jsx(CD,{}),a.jsx(ND,{}),a.jsx(jD,{})]})})}),{useEmitter:W4,useEmitterValue:nr,usePublisher:ca}=D4(ED,{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"}},AD),ID=U4({useEmitter:W4,useEmitterValue:nr,usePublisher:ca}),MD=q4({useEmitter:W4,useEmitterValue:nr,usePublisher:ca});function Xw(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Dr.WARN),t==="normal"?0:parseInt(t??"0",10)}function LD(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OD=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DD=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PD={};function Zw(e,t){return(PD.jsx?DD:OD).test(e)}const FD=/[ \t\n\f\r]/g;function BD(e){return typeof e=="object"?e.type==="text"?Jw(e.value):!1:Jw(e)}function Jw(e){return e.replace(FD,"")===""}class Uu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Uu.prototype.normal={};Uu.prototype.property={};Uu.prototype.space=void 0;function V4(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Uu(n,r,t)}function Uv(e){return e.toLowerCase()}class Fi{constructor(t,n){this.attribute=n,this.property=t}}Fi.prototype.attribute="";Fi.prototype.booleanish=!1;Fi.prototype.boolean=!1;Fi.prototype.commaOrSpaceSeparated=!1;Fi.prototype.commaSeparated=!1;Fi.prototype.defined=!1;Fi.prototype.mustUseProperty=!1;Fi.prototype.number=!1;Fi.prototype.overloadedBoolean=!1;Fi.prototype.property="";Fi.prototype.spaceSeparated=!1;Fi.prototype.space=void 0;let zD=0;const on=rl(),jr=rl(),qv=rl(),ot=rl(),Xn=rl(),Xo=rl(),Wi=rl();function rl(){return 2**++zD}const Hv=Object.freeze(Object.defineProperty({__proto__:null,boolean:on,booleanish:jr,commaOrSpaceSeparated:Wi,commaSeparated:Xo,number:ot,overloadedBoolean:qv,spaceSeparated:Xn},Symbol.toStringTag,{value:"Module"})),pg=Object.keys(Hv);class Lk extends Fi{constructor(t,n,r,i){let o=-1;if(super(t,n),e2(this,"space",i),typeof r=="number")for(;++o<pg.length;){const l=pg[o];e2(this,pg[o],(r&Hv[l])===Hv[l])}}}Lk.prototype.defined=!0;function e2(e,t,n){n&&(e[t]=n)}function Ql(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Lk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Uv(r)]=r,n[Uv(o.attribute)]=r}return new Uu(t,n,e.space)}const G4=Ql({properties:{ariaActiveDescendant:null,ariaAtomic:jr,ariaAutoComplete:null,ariaBusy:jr,ariaChecked:jr,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:Xn,ariaCurrent:null,ariaDescribedBy:Xn,ariaDetails:null,ariaDisabled:jr,ariaDropEffect:Xn,ariaErrorMessage:null,ariaExpanded:jr,ariaFlowTo:Xn,ariaGrabbed:jr,ariaHasPopup:null,ariaHidden:jr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xn,ariaLevel:ot,ariaLive:null,ariaModal:jr,ariaMultiLine:jr,ariaMultiSelectable:jr,ariaOrientation:null,ariaOwns:Xn,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:jr,ariaReadOnly:jr,ariaRelevant:null,ariaRequired:jr,ariaRoleDescription:Xn,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:jr,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 K4(e,t){return t in e?e[t]:t}function Y4(e,t){return K4(e,t.toLowerCase())}const UD=Ql({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xo,acceptCharset:Xn,accessKey:Xn,action:null,allow:null,allowFullScreen:on,allowPaymentRequest:on,allowUserMedia:on,alpha:on,alt:null,as:null,async:on,autoCapitalize:null,autoComplete:Xn,autoFocus:on,autoPlay:on,blocking:Xn,capture:null,charSet:null,checked:on,cite:null,className:Xn,closedBy:null,colorSpace:null,cols:ot,colSpan:ot,command:null,commandFor:null,content:null,contentEditable:jr,controls:on,controlsList:Xn,coords:ot|Xo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:on,defer:on,dir:null,dirName:null,disabled:on,download:qv,draggable:jr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:on,formTarget:null,headers:Xn,height:ot,hidden:qv,high:ot,href:null,hrefLang:null,htmlFor:Xn,httpEquiv:Xn,id:null,imageSizes:null,imageSrcSet:null,inert:on,inputMode:null,integrity:null,is:null,isMap:on,itemId:null,itemProp:Xn,itemRef:Xn,itemScope:on,itemType:Xn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:on,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:on,muted:on,name:null,nonce:null,noModule:on,noValidate:on,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:on,optimum:ot,pattern:null,ping:Xn,placeholder:null,playsInline:on,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:on,referrerPolicy:null,rel:Xn,required:on,reversed:on,rows:ot,rowSpan:ot,sandbox:Xn,scope:null,scoped:on,seamless:on,selected:on,shadowRootClonable:on,shadowRootCustomElementRegistry:on,shadowRootDelegatesFocus:on,shadowRootMode:null,shadowRootSerializable:on,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:jr,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:on,useMap:null,value:jr,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xn,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:on,declare:on,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:on,noHref:on,noShade:on,noWrap:on,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:jr,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:on,disablePictureInPicture:on,disableRemotePlayback:on,exportParts:Xo,part:Xn,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:Y4}),qD=Ql({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:Wi,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:Xn,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:on,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:Xo,g2:Xo,glyphName:Xo,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:Wi,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:Xn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wi,rev:Wi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wi,requiredFeatures:Wi,requiredFonts:Wi,requiredFormats:Wi,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:Wi,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:Wi,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:Wi,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:K4}),Q4=Ql({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()}}),X4=Ql({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Y4}),Z4=Ql({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),HD={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"},$D=/[A-Z]/g,t2=/-[a-z]/g,WD=/^data[-\w.:]+$/i;function VD(e,t){const n=Uv(t);let r=t,i=Fi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&WD.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(t2,KD);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!t2.test(o)){let l=o.replace($D,GD);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Lk}return new i(r,t)}function GD(e){return"-"+e.toLowerCase()}function KD(e){return e.charAt(1).toUpperCase()}const YD=V4([G4,UD,Q4,X4,Z4],"html"),Ok=V4([G4,qD,Q4,X4,Z4],"svg");function QD(e){return e.join(" ").trim()}var n2=/\/\*(?:[^*]|\*(?!\/))*\*\//g,XD=/\n/g,ZD=/^\s*/,JD=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,eP=/^:\s*/,tP=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,nP=/^[;\s]*/,rP=`
|
|
49
|
+
`,r2="/",i2="*",Gc="",iP="comment",aP="declaration";function sP(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(v){var k=v.match(XD);k&&(n+=k.length);var _=v.lastIndexOf(rP);r=~_?v.length-_:r+v.length}function o(){var v={line:n,column:r};return function(k){return k.position=new l(v),f(),k}}function l(v){this.start=v,this.end={line:n,column:r},this.source=t.source}l.prototype.content=e;function u(v){var k=new Error(t.source+":"+n+":"+r+": "+v);if(k.reason=v,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function d(v){var k=v.exec(e);if(k){var _=k[0];return i(_),e=e.slice(_.length),k}}function f(){d(ZD)}function p(v){for(var k;k=h();)v.push(k);return v}function h(){var v=o();if(!(r2!=e.charAt(0)||i2!=e.charAt(1))){for(var k=2;Gc!=e.charAt(k)&&(i2!=e.charAt(k)||r2!=e.charAt(k+1));)++k;if(k+=2,Gc===e.charAt(k-1))return u("End of comment missing");var _=e.slice(2,k-2);return r+=2,i(_),e=e.slice(k),r+=2,v({type:iP,comment:_})}}function m(){var v=o(),k=d(JD);if(k){if(h(),!d(eP))return u("property missing ':'");var _=d(tP),w=v({type:aP,property:k[0].replace(n2,Gc).trim(),value:_?_[0].replace(n2,Gc).trim():Gc});return d(nP),w}}function x(){var v=[];p(v);for(var k;k=m();)v.push(k),p(v);return v}return f(),x()}function oP(e,t){let n=null;if(!e||typeof e!="string")return n;const r=sP(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:l,value:u}=o;i?t(l,u,o):u&&(n=n??{},n[l]=u)}),n}const J4=eA("end"),Dk=eA("start");function eA(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 lP(e){const t=Dk(e),n=J4(e);if(t&&n)return{start:t,end:n}}function yu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?a2(e.position):"start"in e||"end"in e?a2(e):"line"in e||"column"in e?$v(e):""}function $v(e){return s2(e&&e.line)+":"+s2(e&&e.column)}function a2(e){return $v(e&&e.start)+"-"+$v(e&&e.end)}function s2(e){return e&&typeof e=="number"?e:1}class hi extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",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"?i=t:!o.cause&&t&&(l=!0,i=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=i,this.line=u?u.line:void 0,this.name=yu(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}}hi.prototype.file="";hi.prototype.name="";hi.prototype.reason="";hi.prototype.message="";hi.prototype.stack="";hi.prototype.column=void 0;hi.prototype.line=void 0;hi.prototype.ancestors=void 0;hi.prototype.cause=void 0;hi.prototype.fatal=void 0;hi.prototype.place=void 0;hi.prototype.ruleId=void 0;hi.prototype.source=void 0;const Pk={}.hasOwnProperty,cP=new Map,uP=/[A-Z]/g,dP=/-([a-z])/g,fP=new Set(["table","tbody","thead","tfoot","tr"]),pP=new Set(["td","th"]),tA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hP(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=_P(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=kP(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ok:YD,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=nA(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function nA(e,t,n){if(t.type==="element")return gP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yP(e,t,n);if(t.type==="mdxjsEsm")return xP(e,t);if(t.type==="root")return bP(e,t,n);if(t.type==="text")return vP(e,t)}function gP(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ok,e.schema=i),e.ancestors.push(t);const o=iA(e,t.tagName,!1),l=wP(e,t);let u=Bk(e,t);return fP.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!BD(d):!0})),rA(e,l,o,t),Fk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function mP(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)}Mu(e,t.position)}function xP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Mu(e,t.position)}function yP(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Ok,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:iA(e,t.name,!0),l=SP(e,t),u=Bk(e,t);return rA(e,l,o,t),Fk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function bP(e,t,n){const r={};return Fk(r,Bk(e,t)),e.create(t,e.Fragment,r,n)}function vP(e,t){return t.value}function rA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Fk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function kP(e,t,n){return r;function r(i,o,l,u){const f=Array.isArray(l.children)?n:t;return u?f(o,l,u):f(o,l)}}function _P(e,t){return n;function n(r,i,o,l){const u=Array.isArray(o.children),d=Dk(r);return t(i,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function wP(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Pk.call(t.properties,i)){const o=EP(e,i,t.properties[i]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&pP.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 SP(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 Mu(e,t.position);else{const{name:i}=r;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 Mu(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Bk(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:cP;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=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const u=nA(e,o,l);u!==void 0&&n.push(u)}return n}function EP(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=VD(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?LD(n):QD(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:CP(n):NP(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?HD[r.property]||r.property:r.attribute,n]}function NP(e,t){const n={};try{oP(t,function(r,i){if(r&&i){let o=r;o.slice(0,2)!=="--"&&(o=o.toLowerCase(),e.stylePropertyNameCase==="dom"&&(o.slice(0,4)==="-ms-"&&(o=o.slice(1)),o=o.replace(dP,RP))),n[o]=i}})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,o=new hi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=tA+"#cannot-parse-style-attribute",o}return n}function iA(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const u=Zw(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=Zw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Pk.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Mu(e)}function Mu(e,t){const n=new hi("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=tA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function CP(e){const t={};let n;for(n in e)Pk.call(e,n)&&(t[jP(n)]=e[n]);return t}function jP(e){if(e.slice(0,2)==="--")return e;let t=e.replace(uP,TP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function TP(e){return"-"+e.toLowerCase()}function RP(e,t){return t.toUpperCase()}const hg={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"]},AP={};function ip(e,t){const n=AP,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return aA(e,r,i)}function aA(e,t,n){if(IP(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 o2(e.children,t,n)}return Array.isArray(e)?o2(e,t,n):""}function o2(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=aA(e[i],t,n);return r.join("")}function IP(e){return!!(e&&typeof e=="object")}const l2=document.createElement("i");function zk(e){const t="&"+e+";";l2.innerHTML=t;const n=l2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ja(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i: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 la(e,t){return e.length>0?(ja(e,e.length,0,t),e):t}const c2={}.hasOwnProperty;function sA(e){const t={};let n=-1;for(;++n<e.length;)MP(t,e[n]);return t}function MP(e,t){let n;for(n in t){const i=(c2.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){c2.call(i,l)||(i[l]=[]);const u=o[l];LP(i[l],Array.isArray(u)?u:u?[u]:[])}}}function LP(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ja(e,0,0,r)}function oA(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 Ta(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jr=po(/[A-Za-z]/),ei=po(/[\dA-Za-z]/),OP=po(/[#-'*+\--9=?A-Z^-~]/);function Bf(e){return e!==null&&(e<32||e===127)}const Wv=po(/\d/),DP=po(/[\dA-Fa-f]/),lA=po(/[!-/:-@[-`{-~]/);function Xt(e){return e!==null&&e<-2}function Jn(e){return e!==null&&(e<0||e===32)}function _n(e){return e===-2||e===-1||e===32}const ap=po(new RegExp("\\p{P}|\\p{S}","u")),el=po(/\s/);function po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Xl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ei(e.charCodeAt(n+1))&&ei(e.charCodeAt(n+2)))i=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),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function On(e,t,n,r){const i=r?r-1:1/0;let o=0;return l;function l(d){return _n(d)?(e.enter(n),u(d)):t(d)}function u(d){return _n(d)&&o++<i?(e.consume(d),u):(e.exit(n),t(d))}}function cA(e,t,n,r,i,o){let l=0;return u;function u(p){return _n(p)?(e.enter(r),d(p)):f(p)}function d(p){return _n(p)&&l<o?(e.consume(p),l++,d):(e.exit(r),f(p))}function f(p){return l>=i?t(p):n(p)}}const PP={tokenize:FP};function FP(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),On(e,t,"linePrefix")}function i(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 Xt(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}let zf=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){u2(this,t,n,r,!1)}addBefore(t,n,r){u2(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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0,this.index.clear()}};function u2(e,t,n,r,i){if(n===0&&r.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,i?(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 BP={tokenize:zP},d2={tokenize:UP};function zP(e){const t=this,n=[];let r=0,i,o,l;return u;function u(N){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,d,f)(N)}return f(N)}function d(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const j=t.events.length;let R=j,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){T=t.events[R][1].end;break}w(r);let I=j;for(;I<t.events.length;)t.events[I][1].end={...T},I++;const M=new zf;return M.add(R+1,0,t.events.slice(j)),M.add(j,I-j,[]),M.consume(t.events),f(N)}return u(N)}function f(N){if(r===n.length){if(!i)return m(N);if(i.currentConstruct&&i.currentConstruct.concrete)return v(N);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(d2,p,h)(N)}function p(N){return i&&S(),w(r),m(N)}function h(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(d2,x,v)(N)}function x(N){return r++,n.push([t.currentConstruct,t.containerState]),m(N)}function v(N){if(N===null){i&&S(),w(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(N)}function k(N){if(N===null){_(e.exit("chunkFlow"),!0),w(0),e.consume(N);return}return Xt(N)?(e.consume(N),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(N),k)}function _(N,j){const R=t.sliceStream(N);if(j&&R.push(null),N.previous=o,o&&(o.next=N),o=N,i.defineSkip(N.start),i.write(R),t.parser.lazy[N.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<l&&(!i.events[T][1].end||i.events[T][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(w(r),T=I;T<t.events.length;)t.events[T][1].end={...A},T++;const D=new zf;D.add(M+1,0,t.events.slice(I)),D.add(I,T-I,[]),D.consume(t.events)}}function w(N){let j=n.length;for(;j-- >N;){const R=n[j];t.containerState=R[1],R[0].exit.call(t,e)}n.length=N}function S(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function UP(e,t,n){return On(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function so(e){if(e===null||Jn(e)||el(e))return 1;if(ap(e))return 2}function sp(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Vv={name:"attention",resolveAll:qP,tokenize:HP};function qP(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 i=n;for(;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,l={...e[i][1].end},u={...e[n][1].start};f2(l,-o),f2(u,o);const d={type:o>1?"strongSequence":"emphasisSequence",start:l,end:{...e[i][1].end}},f={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:u},p={type:o>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},h={type:o>1?"strong":"emphasis",start:{...d.start},end:{...f.end}};e[i][1].end={...d.start},e[n][1].start={...f.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=la(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),r=la(r,[["enter",h,t],["enter",d,t],["exit",d,t],["enter",p,t]]),r=la(r,sp(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=la(r,[["exit",p,t],["enter",f,t],["exit",f,t],["exit",h,t]]);let m=0;e[n][1].end.offset-e[n][1].start.offset&&(m=2,r=la(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),ja(e,i-1,n-i+3,r),n=i+r.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HP(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=so(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=so(d),h=!p||p===2&&i||n.includes(d)&&d!==42&&d!==95,m=!i||i===2&&p||n.includes(r)&&r!==42&&r!==95;return f._open=!!(o===42?h:h&&(i||!m)),f._close=!!(o===42?m:m&&(p||!h)),t(d)}}function f2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const $P={name:"autolink",tokenize:WP};function WP(e,t,n){let r=0;return i;function i(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return Jr(x)?(e.consume(x),l):x===64?n(x):f(x)}function l(x){return x===43||x===45||x===46||ei(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||ei(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||Bf(x)?n(x):(e.consume(x),d)}function f(x){return x===64?(e.consume(x),p):OP(x)?(e.consume(x),f):n(x)}function p(x){return ei(x)?h(x):n(x)}function h(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||ei(x))&&r++<63){const v=x===45?m:h;return e.consume(x),v}return n(x)}}const qu={partial:!0,tokenize:VP};function VP(e,t,n){return r;function r(o){return _n(o)?On(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Xt(o)?t(o):n(o)}}const uA={continuation:{tokenize:KP},exit:YP,name:"blockQuote",tokenize:GP};function GP(e,t,n){const r=this;return i;function i(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 _n(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function KP(e,t,n){const r=this;return i;function i(l){return _n(l)?On(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(uA,t,n)(l)}}function YP(e){e.exit("blockQuote")}const dA={name:"characterEscape",tokenize:QP};function QP(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return lA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const fA={name:"characterReference",tokenize:XP};function XP(e,t,n){const r=this;let i=0,o,l;return u;function u(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=ei,p(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=DP,p):(e.enter("characterReferenceValue"),o=7,l=Wv,p(h))}function p(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return l===ei&&!zk(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<o?(e.consume(h),p):n(h)}}const Gv={partial:!0,tokenize:ZP};function ZP(e,t,n){const r=this;return i;function i(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 p2={concrete:!0,name:"codeFenced",tokenize:JP};function JP(e,t,n){const r=this,i={partial:!0,tokenize:R};let o=0,l=0,u;return d;function d(T){return f(T)}function f(T){const I=r.events[r.events.length-1];return o=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,u=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===u?(l++,e.consume(T),p):l<3?n(T):(e.exit("codeFencedFenceSequence"),_n(T)?On(e,h,"whitespace")(T):h(T))}function h(T){return T===null||Xt(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Gv,k,j)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||Xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):_n(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),On(e,x,"whitespace")(T)):T===96&&T===u?n(T):(e.consume(T),m)}function x(T){return T===null||Xt(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===null||Xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===u?n(T):(e.consume(T),v)}function k(T){return e.attempt(i,j,_)(T)}function _(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),w}function w(T){return o>0&&_n(T)?On(e,S,"linePrefix",o+1)(T):S(T)}function S(T){return T===null||Xt(T)?e.check(Gv,k,j)(T):(e.enter("codeFlowValue"),N(T))}function N(T){return T===null||Xt(T)?(e.exit("codeFlowValue"),S(T)):(e.consume(T),N)}function j(T){return e.exit("codeFenced"),t(T)}function R(T,I,M){let L=0;return A;function A(G){return T.enter("lineEnding"),T.consume(G),T.exit("lineEnding"),D}function D(G){return T.enter("codeFencedFence"),_n(G)?On(T,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):$(G)}function $(G){return G===u?(T.enter("codeFencedFenceSequence"),ee(G)):M(G)}function ee(G){return G===u?(L++,T.consume(G),ee):L>=l?(T.exit("codeFencedFenceSequence"),_n(G)?On(T,U,"whitespace")(G):U(G)):M(G)}function U(G){return G===null||Xt(G)?(T.exit("codeFencedFence"),I(G)):M(G)}}}const gg={name:"codeIndented",tokenize:t6},e6={partial:!0,tokenize:n6};function t6(e,t,n){return r;function r(u){return e.enter("codeIndented"),cA(e,i,n,"linePrefix",4,4)(u)}function i(u){return u===null?l(u):Xt(u)?e.attempt(e6,i,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Xt(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function n6(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Xt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):cA(e,t,o,"linePrefix",4,4)(l)}function o(l){return Xt(l)?i(l):n(l)}}const r6={name:"codeText",previous:a6,resolve:i6,tokenize:s6};function i6(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function a6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function s6(e,t,n){let r=0,i,o;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),u(h)}function u(h){return h===96?(e.consume(h),r++,u):(e.exit("codeTextSequence"),d(h))}function d(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(o=e.enter("codeTextSequence"),i=0,p(h)):Xt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||Xt(h)?(e.exit("codeTextData"),d(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class o6{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 i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Kc(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),Kc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kc(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);Kc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kc(this.left,n.reverse())}}}function Kc(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 pA(e){const t={};let n=-1,r,i,o,l,u,d,f;const p=new o6(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,l6(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=p.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},u=p.slice(i,n),u.unshift(r),p.splice(i,n-i+1,u))}}return ja(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function l6(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=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,h,m=-1,x=n,v=0,k=0;const _=[k];for(;x;){for(;e.get(++i)[1]!==x;);o.push(i),x._tokenizer||(p=r.sliceStream(x),x.next||p.push(null),h&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=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 w=u.slice(_[m],_[m+1]),S=o.pop();d.push([S,S+w.length-1]),e.splice(S,2,w)}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 c6={resolve:d6,tokenize:f6},u6={partial:!0,tokenize:p6};function d6(e){return pA(e),e}function f6(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?o(u):Xt(u)?e.check(u6,l,o)(u):(e.consume(u),i)}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,i}}function p6(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),On(e,o,"linePrefix")}function o(l){if(l===null||Xt(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 hA(e,t,n,r,i,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return h;function h(w){return w===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(w),e.exit(o),m):w===null||w===32||w===41||Bf(w)?n(w):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(w))}function m(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===62?(e.exit("chunkString"),e.exit(u),m(w)):w===null||w===60||Xt(w)?n(w):(e.consume(w),w===92?v:x)}function v(w){return w===60||w===62||w===92?(e.consume(w),x):x(w)}function k(w){return!p&&(w===null||w===41||Jn(w))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(w)):p<f&&w===40?(e.consume(w),p++,k):w===41?(e.consume(w),p--,k):w===null||w===32||w===40||Bf(w)?n(w):(e.consume(w),w===92?_:k)}function _(w){return w===40||w===41||w===92?(e.consume(w),k):k(w)}}function gA(e,t,n,r,i,o){const l=this;let u=0,d;return f;function f(x){return e.enter(r),e.enter(i),e.consume(x),e.exit(i),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(i),e.consume(x),e.exit(i),e.exit(r),t):Xt(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||x===91||x===93||Xt(x)||u++>999?(e.exit("chunkString"),p(x)):(e.consume(x),d||(d=!_n(x)),x===92?m:h)}function m(x){return x===91||x===92||x===93?(e.consume(x),u++,h):h(x)}}function mA(e,t,n,r,i,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),l=m===40?41:m,d):n(m)}function d(m){return m===l?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?n(m):Xt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),On(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===l||m===null||Xt(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?h:p)}function h(m){return m===l||m===92?(e.consume(m),p):p(m)}}function bu(e,t){let n;return r;function r(i){return Xt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):_n(i)?On(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const h6={name:"definition",tokenize:m6},g6={partial:!0,tokenize:x6};function m6(e,t,n){const r=this;let i;return o;function o(x){return e.enter("definition"),l(x)}function l(x){return gA.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function u(x){return i=Ta(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 Jn(x)?bu(e,f)(x):f(x)}function f(x){return hA(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(g6,h,h)(x)}function h(x){return _n(x)?On(e,m,"whitespace")(x):m(x)}function m(x){return x===null||Xt(x)?(e.exit("definition"),r.parser.defined.push(i),t(x)):n(x)}}function x6(e,t,n){return r;function r(u){return Jn(u)?bu(e,i)(u):n(u)}function i(u){return mA(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return _n(u)?On(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Xt(u)?t(u):n(u)}}const y6={name:"hardBreakEscape",tokenize:b6};function b6(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Xt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const v6={name:"headingAtx",resolve:k6,tokenize:_6};function k6(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 i={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"};ja(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])}return e}function _6(e,t,n){let r=0;return i;function i(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||Jn(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Xt(p)?(e.exit("atxHeading"),t(p)):_n(p)?On(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||Jn(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const xA=["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"],Kv=["pre","script","style","textarea"],w6={concrete:!0,name:"htmlFlow",resolveTo:E6,tokenize:N6},S6={partial:!0,tokenize:C6};function E6(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 N6(e,t,n){const r=this;let i,o,l,u,d;return f;function f(F){return p(F)}function p(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),h}function h(F){return F===33?(e.consume(F),m):F===47?(e.consume(F),o=!0,k):F===63?(e.consume(F),i=3,r.interrupt?t:P):Jr(F)?(e.consume(F),l=String.fromCharCode(F),_):n(F)}function m(F){return F===45?(e.consume(F),i=2,x):F===91?(e.consume(F),i=5,u=0,v):Jr(F)?(e.consume(F),i=4,r.interrupt?t:P):n(F)}function x(F){return F===45?(e.consume(F),r.interrupt?t:P):n(F)}function v(F){const K="CDATA[";return F===K.charCodeAt(u++)?(e.consume(F),u===K.length?r.interrupt?t:$:v):n(F)}function k(F){return Jr(F)?(e.consume(F),l=String.fromCharCode(F),_):n(F)}function _(F){if(F===null||F===47||F===62||Jn(F)){const K=F===47,W=l.toLowerCase();return!K&&!o&&Kv.includes(W)?(i=1,r.interrupt?t(F):$(F)):xA.includes(l.toLowerCase())?(i=6,K?(e.consume(F),w):r.interrupt?t(F):$(F)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):o?S(F):N(F))}return F===45||ei(F)?(e.consume(F),l+=String.fromCharCode(F),_):n(F)}function w(F){return F===62?(e.consume(F),r.interrupt?t:$):n(F)}function S(F){return _n(F)?(e.consume(F),S):A(F)}function N(F){return F===47?(e.consume(F),A):F===58||F===95||Jr(F)?(e.consume(F),j):_n(F)?(e.consume(F),N):A(F)}function j(F){return F===45||F===46||F===58||F===95||ei(F)?(e.consume(F),j):R(F)}function R(F){return F===61?(e.consume(F),T):_n(F)?(e.consume(F),R):N(F)}function T(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),d=F,I):_n(F)?(e.consume(F),T):M(F)}function I(F){return F===d?(e.consume(F),d=null,L):F===null||Xt(F)?n(F):(e.consume(F),I)}function M(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Jn(F)?R(F):(e.consume(F),M)}function L(F){return F===47||F===62||_n(F)?N(F):n(F)}function A(F){return F===62?(e.consume(F),D):n(F)}function D(F){return F===null||Xt(F)?$(F):_n(F)?(e.consume(F),D):n(F)}function $(F){return F===45&&i===2?(e.consume(F),Z):F===60&&i===1?(e.consume(F),z):F===62&&i===4?(e.consume(F),Q):F===63&&i===3?(e.consume(F),P):F===93&&i===5?(e.consume(F),ae):Xt(F)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(S6,J,ee)(F)):F===null||Xt(F)?(e.exit("htmlFlowData"),ee(F)):(e.consume(F),$)}function ee(F){return e.check(Gv,U,J)(F)}function U(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),G}function G(F){return F===null||Xt(F)?ee(F):(e.enter("htmlFlowData"),$(F))}function Z(F){return F===45?(e.consume(F),P):$(F)}function z(F){return F===47?(e.consume(F),l="",q):$(F)}function q(F){if(F===62){const K=l.toLowerCase();return Kv.includes(K)?(e.consume(F),Q):$(F)}return Jr(F)&&l.length<8?(e.consume(F),l+=String.fromCharCode(F),q):$(F)}function ae(F){return F===93?(e.consume(F),P):$(F)}function P(F){return F===62?(e.consume(F),Q):F===45&&i===2?(e.consume(F),P):$(F)}function Q(F){return F===null||Xt(F)?(e.exit("htmlFlowData"),J(F)):(e.consume(F),Q)}function J(F){return e.exit("htmlFlow"),t(F)}}function C6(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(qu,t,n)}}const j6={name:"htmlText",tokenize:T6};function T6(e,t,n){const r=this;let i,o,l;return u;function u(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),d}function d(P){return P===33?(e.consume(P),f):P===47?(e.consume(P),R):P===63?(e.consume(P),N):Jr(P)?(e.consume(P),M):n(P)}function f(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),o=0,v):Jr(P)?(e.consume(P),S):n(P)}function p(P){return P===45?(e.consume(P),x):n(P)}function h(P){return P===null?n(P):P===45?(e.consume(P),m):Xt(P)?(l=h,z(P)):(e.consume(P),h)}function m(P){return P===45?(e.consume(P),x):h(P)}function x(P){return P===62?Z(P):P===45?m(P):h(P)}function v(P){const Q="CDATA[";return P===Q.charCodeAt(o++)?(e.consume(P),o===Q.length?k:v):n(P)}function k(P){return P===null?n(P):P===93?(e.consume(P),_):Xt(P)?(l=k,z(P)):(e.consume(P),k)}function _(P){return P===93?(e.consume(P),w):k(P)}function w(P){return P===62?Z(P):P===93?(e.consume(P),w):k(P)}function S(P){return P===null||P===62?Z(P):Xt(P)?(l=S,z(P)):(e.consume(P),S)}function N(P){return P===null?n(P):P===63?(e.consume(P),j):Xt(P)?(l=N,z(P)):(e.consume(P),N)}function j(P){return P===62?Z(P):N(P)}function R(P){return Jr(P)?(e.consume(P),T):n(P)}function T(P){return P===45||ei(P)?(e.consume(P),T):I(P)}function I(P){return Xt(P)?(l=I,z(P)):_n(P)?(e.consume(P),I):Z(P)}function M(P){return P===45||ei(P)?(e.consume(P),M):P===47||P===62||Jn(P)?L(P):n(P)}function L(P){return P===47?(e.consume(P),Z):P===58||P===95||Jr(P)?(e.consume(P),A):Xt(P)?(l=L,z(P)):_n(P)?(e.consume(P),L):Z(P)}function A(P){return P===45||P===46||P===58||P===95||ei(P)?(e.consume(P),A):D(P)}function D(P){return P===61?(e.consume(P),$):Xt(P)?(l=D,z(P)):_n(P)?(e.consume(P),D):L(P)}function $(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),i=P,ee):Xt(P)?(l=$,z(P)):_n(P)?(e.consume(P),$):(e.consume(P),U)}function ee(P){return P===i?(e.consume(P),i=void 0,G):P===null?n(P):Xt(P)?(l=ee,z(P)):(e.consume(P),ee)}function U(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||Jn(P)?L(P):(e.consume(P),U)}function G(P){return P===47||P===62||Jn(P)?L(P):n(P)}function Z(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function z(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),q}function q(P){return _n(P)?On(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):ae(P)}function ae(P){return e.enter("htmlTextData"),l(P)}}const Uk={name:"labelEnd",resolveAll:M6,resolveTo:L6,tokenize:O6},R6={tokenize:D6},A6={tokenize:P6},I6={tokenize:F6};function M6(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ja(e,0,e.length,n),e}function L6(e,t){let n=e.length,r=0,i,o,l;for(;n--;){const p=e[n][1];if(i){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&&(i=n,p.type!=="labelLink")){r=2;break}}else p.type==="labelEnd"&&(o=n)}const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=la(l,e.slice(i+1,i+r+3)),l=la(l,[["enter",f,t]]),l=la(l,sp(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=la(l,[["exit",f,t],e[o-2],e[o-1],["exit",d,t]]),l=la(l,e.slice(o+1)),l=la(l,[["exit",u,t]]),ja(e,i,e.length,l),e}function O6(e,t,n){const r=this,i=r._labelStarts;let o,l;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();o=i[i.length-1]}return u;function u(m){return o?o._inactive?h(m):(l=r.parser.defined.includes(Ta(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(R6,p,l?p:h)(m):m===91?e.attempt(A6,p,l?f:h)(m):l?p(m):h(m)}function f(m){return e.attempt(I6,p,h)(m)}function p(m){return i.pop(),t(m)}function h(m){return o._balanced=!0,n(m)}}function D6(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Jn(h)?bu(e,o)(h):o(h)}function o(h){return h===41?p(h):hA(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return Jn(h)?bu(e,d)(h):p(h)}function u(h){return n(h)}function d(h){return h===34||h===39||h===40?mA(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return Jn(h)?bu(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function P6(e,t,n){const r=this;return i;function i(u){return gA.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(Ta(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function F6(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const B6={name:"labelStartImage",resolveAll:Uk.resolveAll,tokenize:z6};function z6(e,t,n){const r=this;let i;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"),i=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(i),t(d))}}const U6={name:"labelStartLink",resolveAll:Uk.resolveAll,tokenize:q6};function q6(e,t,n){const r=this;let i;return o;function o(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),i=e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(u))}}const mg={name:"lineEnding",tokenize:H6};function H6(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),On(e,t,"linePrefix")}}const Tf={name:"thematicBreak",tokenize:$6};function $6(e,t,n){let r=0,i;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return i=f,u(f)}function u(f){return f===i?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Xt(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===i?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),_n(f)?On(e,u,"whitespace")(f):u(f))}}const Mi={continuation:{tokenize:K6},exit:Q6,name:"list",tokenize:G6},W6={partial:!0,tokenize:X6},V6={partial:!0,tokenize:Y6};function G6(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[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:Wv(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(Tf,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 Wv(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(qu,r.interrupt?n:p,e.attempt(W6,m,h))}function p(x){return r.containerState.initialBlankLine=!0,o++,m(x)}function h(x){return _n(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 K6(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(qu,i,o);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,On(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!_n(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(V6,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,On(e,e.attempt(Mi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function Y6(e,t,n){const r=this;return On(e,i,"listItemIndent",r.containerState.size+1);function i(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 Q6(e){e.exit(this.containerState.type)}function X6(e,t,n){const r=this;return On(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!_n(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const h2={name:"setextUnderline",resolveTo:Z6,tokenize:J6};function Z6(e,t){const n=new zf;let r=e.length,i,o,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=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[i][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[i][1],t]]),e[i][1].end={...e[l][1].end}):e[i][1]=u,n.add(e.length,0,[["exit",u,t]]),n.consume(e),e}function J6(e,t,n){const r=this;let i;return o;function o(f){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),_n(f)?On(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Xt(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const e7={tokenize:t7};function t7(e){const t=this,n=e.attempt(qu,r,e.attempt(this.parser.constructs.flowInitial,i,On(e,e.attempt(this.parser.constructs.flow,i,e.attempt(c6,i)),"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 i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const n7={resolveAll:bA()},r7=yA("string"),i7=yA("text");function yA(e){return{resolveAll:bA(e==="text"?a7:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,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 h=i[p];let m=-1;if(h)for(;++m<h.length;){const x=h[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function bA(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function a7(e,t){const n=new zf;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],o=t.sliceStream(i);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:i.start._bufferIndex+u,_index:i.start._index+l,line:i.end.line,column:i.end.column-d,offset:i.end.offset-d},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):n.add(r,0,[["enter",p,t],["exit",p,t]])}r++}return n.consume(e),e}const s7={42:Mi,43:Mi,45:Mi,48:Mi,49:Mi,50:Mi,51:Mi,52:Mi,53:Mi,54:Mi,55:Mi,56:Mi,57:Mi,62:uA},o7={91:h6},l7={[-2]:gg,[-1]:gg,32:gg},c7={35:v6,42:Tf,45:[h2,Tf],60:w6,61:h2,95:Tf,96:p2,126:p2},u7={38:fA,92:dA},d7={[-5]:mg,[-4]:mg,[-3]:mg,33:B6,38:fA,42:Vv,60:[$P,j6],91:U6,92:[y6,dA],93:Uk,95:Vv,96:r6},f7={null:[Vv,n7]},p7={null:[42,95]},h7={null:[]},g7=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:p7,contentInitial:o7,disable:h7,document:s7,flow:c7,flowInitial:l7,insideSpan:f7,string:u7,text:d7},Symbol.toStringTag,{value:"Module"}));function m7(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 i={},o=[];let l=[],u=[];const d={attempt:I(R),check:I(T),consume:S,enter:N,exit:j,interrupt:I(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:x,write:h};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function h(D){return l=la(l,D),_(),l[l.length-1]!==null?[]:(M(t,0),f.events=sp(o,f.events,f),f.events)}function m(D,$){return y7(x(D),$)}function x(D){return x7(l,D)}function v(){const{_bufferIndex:D,_index:$,line:ee,column:U,offset:G}=r;return{_bufferIndex:D,_index:$,line:ee,column:U,offset:G}}function k(D){i[D.line]=D.column,A()}function _(){for(;r._index<l.length;){const D=l[r._index];if(typeof D=="string"){const $=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<D.length;)w(D.charCodeAt(r._bufferIndex))}else w(D)}}function w(D){p=p(D)}function S(D){Xt(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,A()):D!==-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=D}function N(D,$){const ee=$||{};return ee.type=D,ee.start=v(),f.events.push(["enter",ee,f]),u.push(ee),ee}function j(D){const $=u.pop();return $.end=v(),f.events.push(["exit",$,f]),$}function R(D,$){M(D,$.from)}function T(D,$){$.restore()}function I(D,$){return ee;function ee(U,G,Z){let z,q,ae,P;return Array.isArray(U)?J(U):"tokenize"in U?J([U]):Q(U);function Q(H){return se;function se(ie){const ge=ie!==null&&H[ie],we=ie!==null&&H.null,Ke=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(we)?we:we?[we]:[]];return J(Ke)(ie)}}function J(H){return z=H,q=0,H.length===0?Z:F(H[q])}function F(H){return se;function se(ie){return P=L(),ae=H,H.partial||(f.currentConstruct=H),H.name&&f.parser.constructs.disable.null.includes(H.name)?W():H.tokenize.call($?Object.assign(Object.create(f),$):f,d,K,W)(ie)}}function K(H){return D(ae,P),G}function W(H){return P.restore(),++q<z.length?F(z[q]):Z}}}function M(D,$){D.resolveAll&&!o.includes(D)&&o.push(D),D.resolve&&ja(f.events,$,f.events.length-$,D.resolve(f.events.slice($),f)),D.resolveTo&&(f.events=D.resolveTo(f.events,f))}function L(){const D=v(),$=f.previous,ee=f.currentConstruct,U=f.events.length,G=Array.from(u);return{from:U,restore:Z};function Z(){r=D,f.previous=$,f.currentConstruct=ee,f.events.length=U,u=G,A()}}function A(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function x7(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function y7(e,t){let n=-1;const r=[];let i;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&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function b7(e){const r={constructs:sA([g7,...(e||{}).extensions||[]]),content:i(PP),defined:[],document:i(BP),flow:i(e7),lazy:{},string:i(r7),text:i(i7)};return r;function i(o){return l;function l(u){return m7(r,o,u)}}}function v7(e){for(;!pA(e););return e}const g2=/[\0\t\n\r]/g;function k7(){let e=1,t="",n=!0,r;return i;function i(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;){g2.lastIndex=f;const p=g2.exec(o),h=p&&p.index!==void 0?p.index:o.length,m=o.charCodeAt(h);if(!p){t=o.slice(f);break}if(m===10&&f===h&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),f<h&&(d.push(o.slice(f,h)),e+=h-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=h+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const _7=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function w7(e){return e.replace(_7,S7)}function S7(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return oA(n.slice(o?2:1),o?16:10)}return zk(n)||e}const vA={}.hasOwnProperty;function E7(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),N7(n)(v7(b7(n).document().write(k7()(e,t,!0))))}function N7(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(rn),autolinkProtocol:A,autolinkEmail:A,atxHeading:l(je),blockQuote:l(Ke),characterEscape:A,characterReference:A,codeFenced:l(xt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(xt,u),codeText:l(et,u),codeTextData:A,data:A,codeFlowValue:A,definition:l(vt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(lt),hardBreakEscape:l(Oe),hardBreakTrailing:l(Oe),htmlFlow:l(ft,u),htmlFlowData:A,htmlText:l(ft,u),htmlTextData:A,image:l(Ct),label:u,link:l(rn),listItem:l(un),listItemValue:x,listOrdered:l(tn,m),listUnordered:l(tn),paragraph:l(mt),reference:K,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(je),strong:l($t),thematicBreak:l(qe)},exit:{atxHeading:f(),atxHeadingSequence:T,autolink:f(),autolinkEmail:we,autolinkProtocol:ge,blockQuote:f(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:se,characterReference:ie,codeFenced:f(w),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:f(S),codeText:f(Z),codeTextData:D,data:D,definition:f(),definitionDestinationString:R,definitionLabelString:N,definitionTitleString:j,emphasis:f(),hardBreakEscape:f(ee),hardBreakTrailing:f(ee),htmlFlow:f(U),htmlFlowData:D,htmlText:f(G),htmlTextData:D,image:f(q),label:P,labelText:ae,lineEnding:$,link:f(z),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:W,resourceDestinationString:Q,resourceTitleString:J,resource:F,setextHeading:f(L),setextHeadingLineSequence:M,setextHeadingText:I,strong:f(),thematicBreak:f()}};kA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let me={type:"root",children:[],position:void 0};const Ue={stack:[me],tokenStack:[],config:t,enter:d,exit:p,buffer:u,resume:h,data:n},He=[],be=[];let Ye=-1;for(;++Ye<ue.length;)if(be.push(ue[Ye]),ue[Ye][1].type==="listOrdered"||ue[Ye][1].type==="listUnordered")if(ue[Ye][0]==="enter")He.push(be.length-1);else{const _t=He.pop();o(be,_t)}for(ue=be,Ye=-1;++Ye<ue.length;){const _t=t[ue[Ye][0]];ue[Ye][0]==="enter"&&t.beforeEnter.length>0&&i(t.beforeEnter,{...Ue,sliceSerialize:ue[Ye][2].sliceSerialize},ue[Ye][1]),vA.call(_t,ue[Ye][1].type)&&_t[ue[Ye][1].type].call({...Ue,sliceSerialize:ue[Ye][2].sliceSerialize},ue[Ye][1]),ue[Ye][0]==="exit"&&t.afterExit.length>0&&i(t.afterExit,{...Ue,sliceSerialize:ue[Ye][2].sliceSerialize},ue[Ye][1])}if(Ue.tokenStack.length>0){const _t=Ue.tokenStack[Ue.tokenStack.length-1];(_t[1]||m2).call(Ue,void 0,_t[0])}for(me.position={start:Js(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Js(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<t.transforms.length;)me=t.transforms[Ye](me)||me;return me}function i(ue,me,Ue){let He=-1;for(;++He<ue.length;)ue[He].call(me,Ue)}function o(ue,me){const Ue=ue.length-1;let He=me-1,be=-1,Ye=!1,_t,jt,Wt,hn;const xe=[];for(;++He<=Ue;){const Fe=ue[He];switch(Fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Fe[0]==="enter"?be++:be--,hn=void 0;break}case"lineEndingBlank":{Fe[0]==="enter"&&(_t&&!hn&&!be&&!Wt&&(Wt=He),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!be&&Fe[0]==="enter"&&Fe[1].type==="listItemPrefix"||be===-1&&Fe[0]==="exit"&&(Fe[1].type==="listUnordered"||Fe[1].type==="listOrdered")){if(_t){let yt=He;for(jt=void 0;yt--;){const pt=ue[yt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;jt&&(ue[jt][1].type="lineEndingBlank",Ye=!0),pt[1].type="lineEnding",jt=yt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}Wt&&(!jt||Wt<jt)&&(_t._spread=!0),_t.end=Object.assign({},jt?ue[jt][1].start:Fe[1].end),xe.push({at:jt||He,event:["exit",_t,Fe[2]]})}if(Fe[1].type==="listItemPrefix"){const yt={type:"listItem",_spread:!1,start:Object.assign({},Fe[1].start),end:void 0};_t=yt,xe.push({at:He,event:["enter",yt,Fe[2]]}),Wt=void 0,hn=!0}}}const ke=ue.splice(me);let Ae=0;for(He=-1;++He<ke.length;){for(;Ae<xe.length&&xe[Ae].at===me+He;)ue.push(xe[Ae++].event);ue.push(ke[He])}ue[me][1]._spread=Ye}function l(ue,me){return Ue;function Ue(He){d.call(this,ue(He),He),me&&me.call(this,He)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(ue,me,Ue){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([me,Ue||void 0]),ue.position={start:Js(me.start),end:void 0}}function f(ue){return me;function me(Ue){ue&&ue.call(this,Ue),p.call(this,Ue)}}function p(ue,me){const Ue=this.stack.pop(),He=this.tokenStack.pop();if(!He)throw new Error("Cannot close `"+ue.type+"` ("+yu({start:ue.start,end:ue.end})+"): it’s not open");He[0].type!==ue.type&&(me?me.call(this,ue,He[0]):(He[1]||m2).call(this,ue,He[0])),Ue.position.end=Js(ue.end)}function h(){return ip(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.lang=ue}function k(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.meta=ue}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.value=ue.replace(/(\r?\n|\r)$/g,"")}function N(ue){const me=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=me,Ue.identifier=Ta(this.sliceSerialize(ue)).toLowerCase()}function j(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.title=ue}function R(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.url=ue}function T(ue){const me=this.stack[this.stack.length-1];if(!me.depth){const Ue=this.sliceSerialize(ue).length;me.depth=Ue}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function M(ue){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function A(ue){const Ue=this.stack[this.stack.length-1].children;let He=Ue[Ue.length-1];(!He||He.type!=="text")&&(He=nt(),He.position={start:Js(ue.start),end:void 0},Ue.push(He)),this.stack.push(He)}function D(ue){const me=this.stack.pop();me.value+=this.sliceSerialize(ue),me.position.end=Js(ue.end)}function $(ue){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=me.children[me.children.length-1];Ue.position.end=Js(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(A.call(this,ue),D.call(this,ue))}function ee(){this.data.atHardBreak=!0}function U(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.value=ue}function G(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.value=ue}function Z(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.value=ue}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=me,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function q(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=me,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ae(ue){const me=this.sliceSerialize(ue),Ue=this.stack[this.stack.length-2];Ue.label=w7(me),Ue.identifier=Ta(me).toLowerCase()}function P(){const ue=this.stack[this.stack.length-1],me=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const He=ue.children;Ue.children=He}else Ue.alt=me}function Q(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.url=ue}function J(){const ue=this.resume(),me=this.stack[this.stack.length-1];me.title=ue}function F(){this.data.inReference=void 0}function K(){this.data.referenceType="collapsed"}function W(ue){const me=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=me,Ue.identifier=Ta(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function H(ue){this.data.characterReferenceType=ue.type}function se(ue){const me=this.sliceSerialize(ue),Ue=this.data.characterReferenceType;let He;Ue?(He=oA(me,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=zk(me);const be=this.stack[this.stack.length-1];be.value+=He}function ie(ue){const me=this.stack.pop();me.position.end=Js(ue.end)}function ge(ue){D.call(this,ue);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ue)}function we(ue){D.call(this,ue);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ue)}function Ke(){return{type:"blockquote",children:[],position:void 0}}function xt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function et(){return{type:"inlineCode",value:"",position:void 0}}function vt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function lt(){return{type:"emphasis",children:[],position:void 0}}function je(){return{type:"heading",depth:0,children:[],position:void 0}}function Oe(){return{type:"break",position:void 0}}function ft(){return{type:"html",value:"",position:void 0}}function Ct(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function rn(){return{type:"link",title:null,url:"",children:[],position:void 0}}function tn(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[],position:void 0}}function un(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[],position:void 0}}function mt(){return{type:"paragraph",children:[],position:void 0}}function $t(){return{type:"strong",children:[],position:void 0}}function nt(){return{type:"text",value:"",position:void 0}}function qe(){return{type:"thematicBreak",position:void 0}}}function Js(e){return{line:e.line,column:e.column,offset:e.offset}}function kA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?kA(e,r):C7(e,r)}}function C7(e,t){let n;for(n in t)if(vA.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 m2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yu({start:t.start,end:t.end})+") is still open")}function j7(e){const t=this;t.parser=n;function n(r){return E7(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function T7(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 R7(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
+
`}]}function A7(e,t){const n=t.value?t.value+`
|
|
53
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[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 I7(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M7(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L7(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Xl(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-"+i,id:n+"fnref-"+i+(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 O7(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 D7(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _A(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 i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function P7(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _A(e,t);const i={src:Xl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function F7(e,t){const n={src:Xl(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 B7(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 z7(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _A(e,t);const i={href:Xl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function U7(e,t){const n={href:Xl(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 q7(e,t,n){const r=e.all(t),i=n?H7(n):wA(t),o={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.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];(i||u!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
54
|
+
`}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(i||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 H7(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=wA(n[r])}return t}function wA(e){const t=e.spread;return t??e.children.length>1}function $7(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];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 W7(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V7(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function G7(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K7(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Dk(t.children[1]),d=J4(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Y7(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 h=t.children[d],m={},x=l?l[d]:void 0;x&&(m.align=x);let v={type:"element",tagName:o,properties:m,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,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 Q7(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const x2=9,y2=32;function X7(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(b2(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(b2(t.slice(i),i>0,!1)),o.join("")}function b2(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===x2||o===y2;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===x2||o===y2;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Z7(e,t){const n={type:"text",value:X7(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function J7(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const e8={blockquote:T7,break:R7,code:A7,delete:I7,emphasis:M7,footnoteReference:L7,heading:O7,html:D7,imageReference:P7,image:F7,inlineCode:B7,linkReference:z7,link:U7,listItem:q7,list:$7,paragraph:W7,root:V7,strong:G7,table:K7,tableCell:Q7,tableRow:Y7,text:Z7,thematicBreak:J7,toml:rf,yaml:rf,definition:rf,footnoteDefinition:rf};function rf(){}const SA=-1,op=0,vu=1,Uf=2,qk=3,Hk=4,$k=5,Wk=6,EA=7,NA=8,{defineProperty:t8}=Object,CA=typeof self=="object"?self:globalThis,v2=(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 CA[e](t)},n8=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case op:case SA:return n(l,i);case vu:{const u=n([],i);for(const d of l)u.push(r(d));return u}case Uf:{const u=n({},i);for(const[d,f]of l){const p=r(d),h=r(f);p==="__proto__"?t8(u,p,{value:h,configurable:!0,enumerable:!0,writable:!0}):u[p]=h}return u}case qk:return n(new Date(l),i);case Hk:{const{source:u,flags:d}=l;return n(new RegExp(u,d),i)}case $k:{const u=n(new Map,i);for(const[d,f]of l)u.set(r(d),r(f));return u}case Wk:{const u=n(new Set,i);for(const d of l)u.add(r(d));return u}case EA:{const{name:u,message:d}=l;return n(typeof CA[u]=="function"?v2(u,d):new Error(d),i)}case NA:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);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(v2(o,l),i)};return r},k2=e=>n8(new Map,e)(0),$o="",{toString:r8}={},{keys:i8,is:a8}=Object,Yc=e=>{const t=typeof e;if(t!=="object"||!e)return[op,t];const n=r8.call(e).slice(8,-1);switch(n){case"Array":return[vu,$o];case"Object":return[Uf,$o];case"Date":return[qk,$o];case"RegExp":return[Hk,$o];case"Map":return[$k,$o];case"Set":return[Wk,$o];case"DataView":return[vu,n]}return n.includes("Array")?[vu,n]:e instanceof Error?[EA,e.name||"Error"]:[Uf,n]},af=([e,t])=>e===op&&(t==="function"||t==="symbol"),s8=(e,t,n,r)=>{const i=(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]=Yc(l);switch(u){case op:{let p=l;switch(d){case"bigint":u=NA,p=l.toString();break;case"number":if(!l&&a8(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 i([SA],l)}return i([u,p],l)}case vu:{if(d){let m=l;return d==="DataView"?m=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(m=new Uint8Array(l)),i([d,[...m]],l)}const p=[],h=i([u,p],l);for(const m of l)p.push(o(m));return h}case Uf:{if(d)switch(d){case"BigInt":return i([d,l.toString()],l);case"Boolean":case"Number":case"String":return i([d,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const p=[],h=i([u,p],l);for(const m of i8(l))(e||!af(Yc(l[m])))&&p.push([o(m),o(l[m])]);return h}case qk:return i([u,isNaN(l.getTime())?$o:l.toISOString()],l);case Hk:{const{source:p,flags:h}=l;return i([u,{source:p,flags:h}],l)}case $k:{const p=[],h=i([u,p],l);for(const[m,x]of l)(e||!(af(Yc(m))||af(Yc(x))))&&p.push([o(m),o(x)]);return h}case Wk:{const p=[],h=i([u,p],l);for(const m of l)(e||!af(Yc(m)))&&p.push(o(m));return h}}const{message:f}=l;return i([u,{name:d,message:f}],l)};return o},_2=(e,{json:t,lossy:n}={})=>{const r=[];return s8(!(t||n),!!t,new Map,r)(e),r},qf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?k2(_2(e,t)):structuredClone(e):(e,t)=>k2(_2(e,t));function o8(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 l8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function c8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||o8,r=e.options.footnoteBackLabel||l8,i=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),h=String(f.identifier).toUpperCase(),m=Xl(h.toLowerCase());let x=0;const v=[],k=e.footnoteCounts.get(h);for(;k!==void 0&&++x<=k;){v.length>0&&v.push({type:"text",value:" "});let S=typeof n=="string"?n:n(d,x);typeof S=="string"&&(S={type:"text",value:S}),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(S)?S:[S]})}const _=p[p.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const S=_.children[_.children.length-1];S&&S.type==="text"?S.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...v)}else p.push(...v);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(p,!0)};e.patch(f,w),u.push(w)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...qf(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
56
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
57
|
+
`}]}}const lp=(function(e){if(e==null)return p8;if(typeof e=="function")return cp(e);if(typeof e=="object")return Array.isArray(e)?u8(e):d8(e);if(typeof e=="string")return f8(e);throw new Error("Expected function, string, or object as test")});function u8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lp(e[n]);return cp(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function d8(e){const t=e;return cp(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function f8(e){return cp(t);function t(n){return n&&n.type===e}}function cp(e){return t;function t(n,r,i){return!!(h8(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function p8(){return!0}function h8(e){return e!==null&&typeof e=="object"&&"type"in e}const jA=[],g8=!0,ku=!1,Yv="skip";function Qv(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,o,l,u,d;if(typeof n=="function"||n&&typeof n=="object"?(o=t,l=n,r&&(i=!1)):(l=t,n&&(i=!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=lp(o),p=i?1:-1;h(e,void 0,[])();function h(m,x,v){const k=m&&typeof m=="object"?m:{};if(typeof k.type=="string"){const w=typeof k.tagName=="string"?k.tagName:typeof k.name=="string"?k.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return _;function _(){const w=!o||f(m,x,v[v.length-1]||void 0);let S=jA;if(u&&w&&(S=w2(u(m,v,x)),S[0]===ku))return S;if("children"in m&&m.children){const N=m;if(N.children&&S[0]!==Yv){let j=(i?-1:N.children.length)+p;const R=[...v,N];for(;j>-1&&j<N.children.length;){const T=N.children[j],I=h(T,j,R)();if(I[0]===ku)return I;j=typeof I[1]=="number"?I[1]:j+p}}}if(d&&w){const N=w2(d(m,v,x));if(N[0]===Yv)throw new Error("Unexpected value `"+N[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(N[0]===ku||typeof N[1]=="number")return N}return S}}}function w2(e){return Array.isArray(e)?e:typeof e=="number"?[g8,e]:e==null?jA:[e]}function Hu(e,t,n,r){let i,o,l;typeof n=="function"||n&&typeof n=="object"?(i=t,o=n,l=r):(o=t,l=n),typeof o=="function"?Qv(e,i,Xv(o),l):Qv(e,i,m8(o),l)}function m8(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?Xv(e.enter):e.enter,exit:typeof e.exit=="function"?Xv(e.exit):e.exit}}function Xv(e){return t;function t(n,r,i){return e(n,i,r[r.length-1])}}const Zv={}.hasOwnProperty,x8={};function y8(e,t){const n=t||x8,r=new Map,i=new Map,o=new Map,l={...e8,...n.handlers},u={all:f,applyData:v8,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:n,patch:b8,wrap:_8};return Hu(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:i,m=String(p.identifier).toUpperCase();h.has(m)||h.set(m,p)}}),u;function d(p,h){const m=p.type,x=u.handlers[m];if(Zv.call(u.handlers,m)&&x)return x(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in p){const{children:k,..._}=p,w=qf(_);return w.children=u.all(p),w}return qf(p)}return(u.options.unknownHandler||k8)(u,p,h)}function f(p){const h=[];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=S2(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=S2(k.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function b8(e,t){e.position&&(t.position=lP(e))}function v8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=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,qf(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function k8(e,t){const n=t.data||{},r="value"in t&&!(Zv.call(n,"hProperties")||Zv.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 _8(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 S2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function E2(e,t){const n=y8(e,t),r=n.one(e,void 0),i=c8(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
61
|
+
`},i),o}function w8(e,t){return e&&"run"in e?async function(n,r){const i=E2(n,{file:r,...t});await e.run(i,r)}:function(n,r){return E2(n,{file:r,...e||t})}}function N2(e){if(e)throw e}var xg,C2;function S8(){if(C2)return xg;C2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=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"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!h)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 xg=function d(){var f,p,h,m,x,v,k=arguments[0],_=1,w=arguments.length,S=!1;for(typeof k=="boolean"&&(S=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<w;++_)if(f=arguments[_],f!=null)for(p in f)h=u(k,p),m=u(f,p),k!==m&&(S&&m&&(o(m)||(x=i(m)))?(x?(x=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},l(k,{name:p,newValue:d(S,v,m)})):typeof m<"u"&&l(k,{name:p,newValue:m}));return k},xg}var E8=S8();const yg=Gl(E8);function Jv(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 N8(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...i);function u(d,...f){const p=e[++o];let h=-1;if(d){l(d);return}for(;++h<i.length;)(f[h]===null||f[h]===void 0)&&(f[h]=i[h]);i=f,p?C8(p,u)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function C8(e,t){let n;return r;function r(...l){const u=e.length>l.length;let d;u&&l.push(i);try{d=e.apply(this,l)}catch(f){const p=f;if(u&&n)throw p;return i(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(l,...u){n||(n=!0,t(l,...u))}function o(l){i(null,l)}}const Wa={basename:j8,dirname:T8,extname:R8,join:A8,sep:"/"};function j8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');$u(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else l<0&&(o=!0,l=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function T8(e){if($u(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 R8(e){$u(e);let t=e.length,n=-1,r=0,i=-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?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function A8(...e){let t=-1,n;for(;++t<e.length;)$u(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":I8(n)}function I8(e){$u(e);const t=e.codePointAt(0)===47;let n=M8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function M8(e,t){let n="",r=0,i=-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(!(i===l-1||o===1))if(i!==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("/")),i=l,o=0;continue}}else if(n.length>0){n="",r=0,i=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,o=0}else u===46&&o>-1?o++:o=-1}return n}function $u(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const L8={cwd:O8};function O8(){return"/"}function ek(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function D8(e){if(typeof e=="string")e=new URL(e);else if(!ek(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 P8(e)}function P8(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const bg=["history","path","basename","stem","extname","dirname"];class TA{constructor(t){let n;t?ek(t)?n={path:t}:typeof t=="string"||F8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":L8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<bg.length;){const o=bg[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)bg.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Wa.basename(this.path):void 0}set basename(t){kg(t,"basename"),vg(t,"basename"),this.path=Wa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wa.dirname(this.path):void 0}set dirname(t){j2(this.basename,"dirname"),this.path=Wa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wa.extname(this.path):void 0}set extname(t){if(vg(t,"extname"),j2(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=Wa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ek(t)&&(t=D8(t)),kg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wa.basename(this.path,this.extname):void 0}set stem(t){kg(t,"stem"),vg(t,"stem"),this.path=Wa.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new hi(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function vg(e,t){if(e&&e.includes(Wa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wa.sep+"`")}function kg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function j2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function F8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const B8=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),z8={}.hasOwnProperty;class Vk extends B8{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=N8()}copy(){const t=new Vk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(yg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Sg("data",this.frozen),this.namespace[t]=n,this):z8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Sg("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=sf(t),r=this.parser||this.Parser;return _g("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_g("process",this.parser||this.Parser),wg("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,l){const u=sf(t),d=r.parse(u);r.run(d,u,function(p,h,m){if(p||!h||!m)return f(p);const x=h,v=r.stringify(x,m);H8(v)?m.value=v:m.result=v,f(p,m)});function f(p,h){p||!h?l(p):o?o(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),_g("processSync",this.parser||this.Parser),wg("processSync",this.compiler||this.Compiler),this.process(t,i),R2("processSync","process",n),r;function i(o,l){n=!0,N2(o),r=l}}run(t,n,r){T2(t),this.freeze();const i=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=sf(n);i.run(t,d,f);function f(p,h,m){const x=h||t;p?u(p):l?l(x):r(void 0,x,m)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),R2("runSync","run",r),i;function o(l,u){N2(l),i=u,r=!0}}stringify(t,n){this.freeze();const r=sf(n),i=this.compiler||this.Compiler;return wg("stringify",i),T2(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Sg("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,...h]=f;d(p,h)}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&&(i.settings=yg(!0,i.settings,f.settings))}function u(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const h=f[p];o(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===f){m=h;break}if(m===-1)r.push([f,...p]);else if(p.length>0){let[x,...v]=p;const k=r[m][1];Jv(k)&&Jv(x)&&(x=yg(!0,k,x)),r[m]=[f,x,...v]}}}}const U8=new Vk().freeze();function _g(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Sg(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 T2(e){if(!Jv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function R2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sf(e){return q8(e)?e:new TA(e)}function q8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H8(e){return typeof e=="string"||$8(e)}function $8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",A2=[],I2={allowDangerousHtml:!0},V8=/^(https?|ircs?|mailto|xmpp)$/i,G8=[{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=K8(e),n=Y8(e);return Q8(t.runSync(t.parse(n),n),e)}function K8(e){const t=e.rehypePlugins||A2,n=e.remarkPlugins||A2,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...I2}:I2;return U8().use(j7).use(n).use(w8,r).use(t)}function Y8(e){const t=e.children||"",n=new TA;return typeof t=="string"&&(n.value=t),n}function Q8(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||X8;for(const p of G8)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+W8+p.id,void 0);return Hu(e,f),hP(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function f(p,h,m){if(p.type==="raw"&&m&&typeof h=="number")return l?m.children.splice(h,1):m.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let x;for(x in hg)if(Object.hasOwn(hg,x)&&Object.hasOwn(p.properties,x)){const v=p.properties[x],k=hg[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 h=="number"&&(x=!r(p,h,m)),x&&m&&typeof h=="number")return u&&p.children?m.children.splice(h,1,...p.children):m.children.splice(h,1),h}}}function X8(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||V8.test(e.slice(0,t))?e:""}function M2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Z8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function J8(e,t,n){const i=lp((n||{}).ignore||[]),o=e9(t);let l=-1;for(;++l<o.length;)Qv(e,u);function u(f,p,h){if(f.type==="text"&&typeof h=="number")return d(f,p,h);if(i(f,h,p[p.length-1]))return Yv}function d(f,p,h){const m=p[p.length-1],x=o[l][0],v=o[l][1];let k=0,_=!1,w=[];x.lastIndex=0;let S=x.exec(f.value);for(;S;){const j=S.index,R={index:S.index,input:S.input,stack:[...p,f]};let T=v(...S,R);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1)x.lastIndex=j+1;else{if(k!==j&&N({type:"text",value:f.value.slice(k,j)}),Array.isArray(T))for(const I of T)N(I);else T&&N(T);k=j+S[0].length,_=!0}if(!x.global)break;S=x.exec(f.value)}return _?(k<f.value.length&&N({type:"text",value:f.value.slice(k)}),m.children.splice(h,1,...w)):w=[f],h+w.length;function N(j){const R=w[w.length-1];R&&R.type==="text"&&j.type==="text"?R.value+=j.value:w.push(j)}}}function e9(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 i=n[r];t.push([t9(i[0]),n9(i[1])])}return t}function t9(e){return typeof e=="string"?new RegExp(Z8(e),"g"):e}function n9(e){return typeof e=="function"?e:function(){return e}}const Eg="phrasing",Ng=["autolink","link","image","label"];function r9(){return{transforms:[u9],enter:{literalAutolink:a9,literalAutolinkEmail:Cg,literalAutolinkHttp:Cg,literalAutolinkWww:Cg},exit:{literalAutolink:c9,literalAutolinkEmail:l9,literalAutolinkHttp:s9,literalAutolinkWww:o9}}}function i9(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Eg,notInConstruct:Ng},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Eg,notInConstruct:Ng},{character:":",before:"[ps]",after:"\\/",inConstruct:Eg,notInConstruct:Ng}]}}function a9(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Cg(e){this.config.enter.autolinkProtocol.call(this,e)}function s9(e){this.config.exit.autolinkProtocol.call(this,e)}function o9(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 l9(e){this.config.exit.autolinkEmail.call(this,e)}function c9(e){this.exit(e)}function u9(e){J8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,d9],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),f9]],{ignore:["link","linkReference"]})}function d9(e,t,n,r,i){let o="";if(!RA(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!p9(n)))return!1;const l=h9(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 f9(e,t,n,r){return!RA(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function p9(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 h9(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 i=M2(e,"(");let o=M2(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function RA(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||el(n)||ap(n))&&(!t||n!==47)}AA.peek=w9;function g9(){this.buffer()}function m9(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function x9(){this.buffer()}function y9(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function b9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ta(this.sliceSerialize(e)).toLowerCase(),n.label=t}function v9(e){this.exit(e)}function k9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ta(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _9(e){this.exit(e)}function w9(){return"["}function AA(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=i.move("]"),o}function S9(){return{enter:{gfmFootnoteCallString:g9,gfmFootnoteCall:m9,gfmFootnoteDefinitionLabelString:x9,gfmFootnoteDefinition:y9},exit:{gfmFootnoteCallString:b9,gfmFootnoteCall:v9,gfmFootnoteDefinitionLabelString:k9,gfmFootnoteDefinition:_9}}}function E9(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:AA},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,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?IA:N9))),f(),d}}function N9(e,t,n){return t===0?e:IA(e,t,n)}function IA(e,t,n){return(n?"":" ")+e}const C9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gk.attention=I9;Gk.peek=M9;function j9(){return{canContainEols:["delete"],enter:{strikethrough:R9},exit:{strikethrough:A9}}}function T9(){return{handlers:{delete:Gk},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:C9}]}}function R9(e){this.enter({type:"delete",children:[],position:void 0},e)}function A9(e){this.exit(e)}function Gk(e,t,n,r){const i=n.createTracker(r),o=n.stack.includes("strikethrough")?"~":"~~",l=n.enter("strikethrough");let u=i.move(o);return u+=n.containerPhrasing(e,{...i.current(),before:u,after:"~"}),u+=i.move(o),l(),u}function I9(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function M9(){return"~"}function L9(e){return e.length}function O9(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||L9,o=[],l=[],u=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],_=[];let w=-1;for(e[p].length>f&&(f=e[p].length);++w<e[p].length;){const S=D9(e[p][w]);if(n.alignDelimiters!==!1){const N=i(S);_[w]=N,(d[w]===void 0||N>d[w])&&(d[w]=N)}k.push(S)}l[p]=k,u[p]=_}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<f;)o[h]=L2(r[h]);else{const k=L2(r);for(;++h<f;)o[h]=k}h=-1;const m=[],x=[];for(;++h<f;){const k=o[h];let _="",w="";k===99?(_=":",w=":"):k===108?_=":":k===114&&(w=":");let S=n.alignDelimiters===!1?1:Math.max(1,d[h]-_.length-w.length);const N=_+"-".repeat(S)+w;n.alignDelimiters!==!1&&(S=_.length+S+w.length,S>d[h]&&(d[h]=S),x[h]=S),m[h]=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],w=n.fillRows===!1?Math.max(1,l[p===1?0:p].length):f;h=-1;const S=[];for(;++h<w;){const N=k[h]||"";let j="",R="";if(n.alignDelimiters!==!1){const T=d[h]-(_[h]||0),I=o[h];if(I===114)j=" ".repeat(T);else if(I===99){const M=T/2;T%2?(j=" ".repeat(M+.5),R=" ".repeat(M-.5)):(j=" ".repeat(M),R=j)}else R=" ".repeat(T)}n.delimiterStart!==!1&&!h&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||h)&&S.push(" "),n.alignDelimiters!==!1&&S.push(j),S.push(N),n.alignDelimiters!==!1&&S.push(R),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||h!==w-1)&&S.push("|")}v.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return v.join(`
|
|
63
|
+
`)}function D9(e){return e==null?"":String(e)}function L2(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 P9=lp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function F9(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),B9);return i(),l}function B9(e,t,n){return">"+(n?"":" ")+e}function z9(e,t){return O2(e,t.inConstruct,!0)&&!O2(e,t.notInConstruct,!1)}function O2(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 D2(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){const o=n.unsafe[i];if(o.character===`
|
|
64
|
+
`&&!o.before&&!o.after&&z9(n.stack,o))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
65
|
+
`}function U9(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}function q9(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 H9(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 $9(e,t,n,r){const i=H9(n),o=e.value||"";if(q9(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(o,W9);return h(),m}const l=n.createTracker(r),u=i.repeat(Math.max(U9(o,i)+1,3)),d=n.enter("codeFenced"),f=i==="`"?"GraveAccent":"Tilde";let p=l.move(u);if(e.lang){const h=n.enter(`codeFencedLang${f}`);p+=l.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${f}`);p+=l.move(" "),p+=l.move(n.safe(e.meta,{before:p,after:`
|
|
66
|
+
`,encode:["`"],...l.current()})),h()}return p+=l.move(`
|
|
67
|
+
`),o&&(p+=l.move(o+`
|
|
68
|
+
`)),p+=l.move(u),d(),p}function W9(e,t,n){return(n?"":" ")+e}function Kk(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 V9(e,t,n,r){const i=Kk(n),o=i==='"'?"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(" "+i),f+=d.move(n.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),l(),f}function G9(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Hf(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Ul(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function MA(e){return"&#x"+e.toString(16).toUpperCase()+";"}function P2(e,t,n){const r=so(e),i=so(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function K9(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const u=e.charCodeAt(2);return u===45?2:u===91?5:Jr(u)?4:void 0}if(t===63)return 3;const n=t===47,r=n?2:1;let i=r,o=e.charCodeAt(i);if(!Jr(o))return;for(;o===45||ei(o);)o=e.charCodeAt(++i);const l=e.slice(r,i).toLowerCase();return!n&&o!==47&&Kv.includes(l)?1:xA.includes(l)?6:7}const Y9=new Map([["*",!1],["_",!0]]);function Q9(e,t,n){const r=new Set;for(const o of e){const l=n.get(o);if(l&&o.attention&&t.some(u=>u.attention===o.attention))for(const u of l.tokens)r.add(u.attention)}const i=[];for(const o of e)o.attention&&r.delete(o.attention)&&i.push(o.attention);return i.reverse(),i}function LA(e,t,n){const r=[],i=new Map,o=new Map;let l=0;for(;l<e.length;){if(!e[l].attention){l++;continue}const u=e[l].value.charAt(0),d=Y9.get(u);let f=l+1;for(;f<e.length&&e[f].attention&&e[f].value.charAt(0)===u;)f++;const p=l?e[l-1].value:t,h=so(p.charCodeAt(p.length-1)),m=so((f<e.length?e[f].value:n).charCodeAt(0)),x=!m||m===2&&!!h,v=!h||h===2&&!!m,k={tokens:e.slice(l,f),markers:[],start:0,end:0,open:d?x&&(!!h||!v):x,close:d?v&&(!!m||!x):v,split:d!==void 0};for(const _ of k.tokens){i.set(_,[...k.tokens]),o.set(_,k);let w=_.value.length;for(;w--;)k.markers.push(_)}k.end=k.markers.length,r.push(k),l=f}for(Z9(r,i),l=-1;++l<e.length;){const u=i.get(e[l]);if(u)return{attention:Q9(e,u,o),index:l}}}function of(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?Hf(n.value):Ul(n.value),i=MA(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let o=n.value.slice(0,n.value.length-r.length),l=0;for(;o.charCodeAt(o.length-1-l)===92;)l++;l%2&&(o+="\\"),n.value=o+i}}function X9(e,t,n,r,i){for(const o of n.attention){const l=t.get(o)||o.sequences[0];for(const u of o.sequences){if(u===l)continue;const d=new Map(t);d.set(o,u);const f=Qk(e,d,r,i),p=LA(f,r,i);if(!p||p.index>n.index)return{chosen:d,mistake:p,tokens:f}}}}function Z9(e,t){const n=new Map;for(const r of e){const i=r.tokens[0].value.charAt(0);let o=n.get(i);o||(o=[],n.set(i,o));let l=r.close?o.length:0;for(;l--&&r.start<r.end;){const u=o[l],d=u.end-u.start,f=r.end-r.start;if(r.split?(u.close||r.open)&&f%3&&!((d+f)%3):d!==u.markers.length||d!==f)continue;const p=r.split?d>1&&f>1?2:1:f,h=u.markers.slice(u.end-p,u.end),m=r.markers.slice(r.start,r.start+p),x=h[0],v=m[0];if(x===h[p-1]&&x.value.length===p&&v===m[p-1]&&v.value.length===p&&x.attention===v.attention)t.delete(x),t.delete(v);else{const k=[...new Set([...h,...m])];for(const _ of k){const w=t.get(_);w&&w.push(...k)}}u.end-=p,r.start+=p,u.start===u.end&&o.splice(l,1),l=o.length}r.open&&r.start<r.end&&o.push(r)}}function J9(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const i of n)if(!Number.isSafeInteger(i)||i<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as size, expected positive integer");const r=[];for(const i of t){if(i.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!lA(i.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(const o of n)r.push(i.repeat(o))}return r}function eF(e,t,n){const r=t.indexStack,i=e.children||[],o=[];let l=-1,u=n.before;r.push(-1);let d=t.createTracker(n);for(;++l<i.length;){const f=i[l];let p;if(r[r.length-1]=l,l+1<i.length){let x=t.handle.handlers[i[l+1].type];x&&x.peek&&(x=x.peek),p=x?Hf(x(i[l+1],e,t,{before:"",after:"",...d.current()})):""}else p=n.after;const h=o[o.length-1];typeof h=="string"&&(u==="\r"||u===`
|
|
70
|
+
`)&&f.type==="html"&&K9(f.value)!==7&&(o[o.length-1]=h.replace(/(\r?\n|\r)$/," "),u=" ",d=t.createTracker(n),d.move(up(o,n.before,n.after)));const m=t.handle.handlers[f.type];if(m&&m.attention){const x=Yk(f,m.attention,t,d);o.push(x),u=Ul(x.sequences[0])}else{const x=t.handle(f,e,t,{...d.current(),after:p,before:u});if(!x)continue;d.move(x),o.push(x),u=Ul(x)}}return r.pop(),o}function Yk(e,t,n,r){const{construct:i,markers:o,sizes:l}=t(e,n),u=J9(e.type,o,l),d=u[0],f=n.enter(i);r.move(d);const p=eF(e,n,{...r.current(),before:d,after:d});return r.move(up(p,d,d)),r.move(d),f(),{children:p,sequences:u}}function Qk(e,t,n,r){const i=[];let o,l=Ul(n),u=-1;for(;++u<e.length;){const d=e[u];if(typeof d=="string"){const N={value:d,attention:void 0};o&&o===Hf(d)&&of([N],!0),o=void 0,i.push(N),N.value&&(l=Ul(N.value));continue}const f=t.get(d)||d.sequences[0],p=f.charAt(0),h=e[u+1],m=l,x=Hf(h===void 0?r:typeof h=="string"?h:t.get(h)||h.sequences[0]),v=Qk(d.children,t,f,f),k=v.length>0?v[0].value:"",_=P2(m.charCodeAt(m.length-1),k.charCodeAt(0),p);_.inside&&of(v,!0);const w=v.length>0?Ul(v[v.length-1].value):"",S=P2(x.charCodeAt(0),w.charCodeAt(w.length-1),p);S.inside&&of(v,!1),_.outside&&m!==`
|
|
71
|
+
`&&m!=="\r"&&of(i,!1),S.outside&&(o=x),i.push({value:f,attention:d},...v,{value:f,attention:d}),l=f.charAt(f.length-1)}return i}function up(e,t,n){let r=new Map;const i=Qk(e,r,t,n);let o=i,l=LA(o,t,n);for(;l;){const d=X9(e,r,l,t,n);if(!d){o=i;break}r=d.chosen,o=d.tokens,l=d.mistake}let u="";for(const d of o)u+=d.value;return u}Xk.attention=OA;Xk.peek=tF;function Xk(e,t,n,r){const i=n.enter("phrasing"),o=Yk(e,OA,n,n.createTracker(r)),l=up([o],r.before,r.after);return i(),l}function OA(e,t){return{construct:"emphasis",markers:G9(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function tF(e,t,n){return n.options.emphasis||"*"}function nF(e,t){let n=!1;return Hu(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ku}),!!((!e.depth||e.depth<3)&&ip(e)&&(t.options.setext||n))}function rF(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(nF(e,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
72
|
+
`,after:`
|
|
73
|
+
`});return m(),h(),x+`
|
|
74
|
+
`+(i===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
75
|
+
`))+1))}const l="#".repeat(i),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(l+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
|
|
76
|
+
`,...o.current()});const p=f.charCodeAt(0);return(p===9||p===32)&&(f=MA(p)+f.slice(1)),f=f?l+" "+f:l,n.options.closeAtx&&(f+=" "+l),d(),u(),f}DA.peek=iF;function DA(e){return e.value||""}function iF(){return"<"}PA.peek=aF;function PA(e,t,n,r){const i=Kk(n),o=i==='"'?"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(" "+i),f+=d.move(n.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),f+=d.move(")"),l(),f}function aF(){return"!"}FA.peek=sF;function FA(e,t,n,r){const i=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 h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function sF(){return"!"}BA.peek=oF;function BA(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";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 i+r+i}function oF(){return"`"}function zA(e,t){const n=ip(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))}UA.peek=lF;function UA(e,t,n,r){const i=Kk(n),o=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);if(zA(e,n)){const v=n.stack;n.stack=v.filter(function(w){return w!=="phrasing"});const k=n.enter("autolink");let _=l.move("<");return _+=l.move(n.containerPhrasing(e,{before:_,after:">",...l.current()})),_+=l.move(">"),k(),n.stack=v,_}const u=n.enter("link");let d=n.enter("label"),f=l.move("[");const p=n.containerPhrasing(e,{before:f,after:"](",...l.current()});f+=l.move(p),d(),f+=l.move("](");const h=/[\0- \u007F]/.test(e.url),m=r.before.charAt(r.before.length-1);let x=e.title||void 0;if(!x&&!h&&(m===`
|
|
77
|
+
`||m==="\r")){let v=0;for(;v<p.length&&p.charCodeAt(v)!==93;)v+=p.charCodeAt(v)===92?2:1;p.charCodeAt(v+1)===58&&(x="")}return!e.url&&typeof x=="string"||h?(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:typeof x=="string"?" ":")",...l.current()}))),d(),typeof x=="string"&&(d=n.enter(`title${o}`),f+=l.move(" "+i),f+=l.move(n.safe(x,{before:f,after:i,...l.current()})),f+=l.move(i),d()),f+=l.move(")"),u(),f}function lF(e,t,n){return zA(e,n)?"<":"["}qA.peek=cF;function qA(e,t,n,r){const i=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 h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function cF(){return"["}function Zk(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 uF(e){const t=Zk(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 dF(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 HA(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 fF(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?dF(n):Zk(n);const u=e.ordered?l==="."?")":".":uF(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),HA(n)===l&&p){let h=-1;for(;++h<e.children.length;){const m=e.children[h];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,i(),f}function pF(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 hF(e,t,n,r){const i=pF(n);let o=n.bulletCurrent||Zk(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;(i==="tab"||i==="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(h,m,x){return m?(x?"":" ".repeat(l))+h:(x?o:o+" ".repeat(l-o.length))+h}}function gF(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l}function mF(e,t,n,r){if(!e.children.some(function(u){return P9(u)}))return n.containerFlow(e,r);const o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),l}function xF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Jk.attention=$A;Jk.peek=yF;function Jk(e,t,n,r){const i=n.enter("phrasing"),o=Yk(e,$A,n,n.createTracker(r)),l=up([o],r.before,r.after);return i(),l}function $A(e,t){return{construct:"strong",markers:xF(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function yF(e,t,n){return n.options.strong||"*"}function bF(e,t,n,r){const i=t?t.children:[],o=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[o+1],beforeNode:i[o-1]})}function vF(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 kF(e,t,n){const r=(HA(n)+(n.options.ruleSpaces?" ":"")).repeat(vF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const WA={blockquote:F9,break:D2,code:$9,definition:V9,emphasis:Xk,hardBreak:D2,heading:rF,html:DA,image:PA,imageReference:FA,inlineCode:BA,link:UA,linkReference:qA,list:fF,listItem:hF,paragraph:gF,root:mF,strong:Jk,text:bF,thematicBreak:kF};function _F(){return{enter:{table:wF,tableData:F2,tableHeader:F2,tableRow:EF},exit:{codeText:NF,table:SF,tableData:jg,tableHeader:jg,tableRow:jg}}}function wF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[],position:void 0},e),this.data.inTable=!0}function SF(e){this.exit(e),this.data.inTable=void 0}function EF(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function jg(e){this.exit(e)}function F2(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function NF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,CF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function CF(e,t){return t==="|"?t:e}function jF(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:i}=t,o=n?" ":"|";return{handlers:{inlineCode:m,table:l,tableCell:d,tableRow:u},join:[TF],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
78
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function l(x,v,k,_){const w=p(x,k,_),S=w[0];if(S){let N=x.align?x.align.length:0,j=-1;if(!N)for(;++j<w.length;)w[j].length>N&&(N=w[j].length);for(;S.length<N;)S.push("")}return f(w,x.align)}function u(x,v,k,_){const w=h(x,k,_),S=f([w]);return S.slice(0,S.indexOf(`
|
|
79
|
+
`))}function d(x,v,k,_){const w=k.enter("tableCell"),S=k.enter("phrasing"),N=k.containerPhrasing(x,{..._,before:o,after:o});return S(),w(),N}function f(x,v){return O9(x,{align:v,alignDelimiters:r,fillRows:!1,padding:n,stringLength:i})}function p(x,v,k){const{children:_}=x;let w=-1;const S=[],N=v.enter("table");for(;++w<_.length;)S[w]=h(_[w],v,k);return N(),S}function h(x,v,k){const{children:_}=x;let w=-1;const S=[],N=v.enter("tableRow");for(;++w<_.length;)S[w]=d(_[w],x,v,k);return N(),S}function m(x,v,k){const _=WA.inlineCode(x,v,k);if(!k.stack.includes("tableCell"))return _;const w=[];let S=0,N=_.indexOf("|");for(;N!==-1;){let j=N;for(;j>S&&_.charCodeAt(j-1)===92;)j--;w.push(_.slice(S,N)),(N-j)%2===0&&w.push("\\"),S=N,N=_.indexOf("|",N+1)}return w.push(_.slice(S)),w.join("")}}function TF(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&RF(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function RF(e,t){let n=!1;return Hu(e,function(r){if(r.type==="break"||"value"in r&&/\r?\n|\r/.test(r.value))return n=!0,ku}),!!((!e.depth||e.depth<3)&&ip(e)&&(t.options.setext||n))}function AF(){return{exit:{taskListCheckValueChecked:B2,taskListCheckValueUnchecked:B2,paragraph:MF}}}function IF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:LF}}}function B2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function MF(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 i=t.children;let o=-1,l;for(;++o<i.length;){const u=i[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 LF(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(l);let d=WA.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 OF(){return[r9(),S9(),j9(),_F(),AF()]}function DF(e){return{extensions:[i9(),E9(e),T9(),jF(e),IF()]}}const PF={tokenize:HF,partial:!0},VA={tokenize:$F,partial:!0},GA={tokenize:WF,partial:!0},KA={tokenize:VF,partial:!0},FF={tokenize:GF,partial:!0},YA={name:"wwwAutolink",tokenize:UF,previous:XA},QA={name:"protocolAutolink",tokenize:qF,previous:ZA},ws={name:"emailAutolink",tokenize:zF,previous:JA},Ga={};function BF(){return{text:Ga}}let Ho=48;for(;Ho<123;)Ga[Ho]=ws,Ho++,Ho===58?Ho=65:Ho===91&&(Ho=97);Ga[43]=ws;Ga[45]=ws;Ga[46]=ws;Ga[95]=ws;Ga[72]=[ws,QA];Ga[104]=[ws,QA];Ga[87]=[ws,YA];Ga[119]=[ws,YA];function zF(e,t,n){const r=this;let i,o;return l;function l(h){return!tk(h)||!JA.call(r,r.previous)||e1(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return tk(h)?(e.consume(h),u):h===64?(e.consume(h),d):n(h)}function d(h){return h===46?e.check(FF,p,f)(h):h===45||h===95||ei(h)?(o=!0,e.consume(h),d):p(h)}function f(h){return e.consume(h),i=!0,d}function p(h){return o&&i&&Jr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function UF(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!XA.call(r,r.previous)||e1(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(PF,e.attempt(VA,e.attempt(GA,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function qF(e,t,n){const r=this;let i="",o=!1;return l;function l(h){return(h===72||h===104)&&ZA.call(r,r.previous)&&!e1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Jr(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),d}return n(h)}function d(h){return h===47?(e.consume(h),o?f:(o=!0,d)):n(h)}function f(h){return h===null||Bf(h)||Jn(h)||el(h)||ap(h)?n(h):e.attempt(VA,e.attempt(GA,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function HF(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function $F(e,t,n){let r,i,o;return l;function l(f){return f===46||f===95?e.check(KA,d,u)(f):f===null||Jn(f)||el(f)||f!==45&&ap(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?r=!0:(i=r,r=void 0),e.consume(f),l}function d(f){return i||r||!o?n(f):t(f)}}function WF(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):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(KA,t,o)(l):l===null||Jn(l)||el(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function VF(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),i):u===60||u===null||Jn(u)||el(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||Jn(u)||el(u)?t(u):r(u)}function o(u){return Jr(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):Jr(u)?(e.consume(u),l):n(u)}}function GF(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return ei(o)?n(o):t(o)}}function XA(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Jn(e)}function ZA(e){return!Jr(e)}function JA(e){return!(e===47||tk(e))}function tk(e){return e===43||e===45||e===46||e===95||ei(e)}function e1(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 KF={tokenize:nB,partial:!0};function YF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JF,continuation:{tokenize:eB},exit:tB}},text:{91:{name:"gfmFootnoteCall",tokenize:ZF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QF,resolveTo:XF}}}}function QF(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const d=r.events[i][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=Ta(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 XF(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.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",i,t],["exit",i,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 ZF(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),d}function d(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(h){if(o>999||h===93&&!l||h===null||h===91||Jn(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(Ta(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Jn(h)||(l=!0),o++,e.consume(h),h===92?p:f}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function JF(e,t,n){const r=this,i=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||Jn(v))return n(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Ta(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Jn(v)||(u=!0),l++,e.consume(v),v===92?h:p}function h(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"),i.includes(o)||i.push(o),On(e,x,"gfmFootnoteDefinitionWhitespace")):n(v)}function x(v){return t(v)}}function eB(e,t,n){return e.check(qu,t,e.attempt(KF,t,n))}function tB(e){e.exit("gfmFootnoteDefinition")}function nB(e,t,n){const r=this;return On(e,i,"gfmFootnoteDefinitionIndent",5);function i(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 rB(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(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)},h={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",h,u]],x=u.parser.constructs.insideSpan.null;x&&ja(m,m.length,0,sp(x,l.slice(f+1,d),u)),ja(m,m.length,0,[["exit",h,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",p,u]]),ja(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 h=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=so(f);if(v===126)return h>1?d(v):(l.consume(v),h++,x);if(h<2&&!n)return d(v);const _=l.exit("strikethroughSequenceTemporary"),w=so(v);return _._open=!w||w===2&&!!k,_._close=!k||k===2&&!!w,u(v)}}}class iB{constructor(){this.map=[],this.index=new Map}add(t,n,r){aB(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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0,this.index.clear()}}function aB(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const o=[t,n,r];e.map.push(o),e.index.set(t,o)}function sB(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function oB(){return{flow:{null:{name:"table",tokenize:lB,resolveAll:cB}}}}function lB(e,t,n){const r=this;let i=0,o=0,l;return u;function u(A){let D=r.events.length-1;for(;D>-1;){const{type:U}=r.events[D][1];if(U==="lineEnding"||U==="linePrefix")D--;else break}const $=D>-1?r.events[D][1].type:null,ee=$==="tableHead"||$==="tableRow"?T:d;return ee===T&&r.parser.lazy[r.now().line]?n(A):ee(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):Xt(A)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),x):n(A):_n(A)?On(e,p,"whitespace")(A):(o+=1,l&&(l=!1,i+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),h(A)))}function h(A){return A===null||A===124||Jn(A)?(e.exit("data"),p(A)):(e.consume(A),A===92?m:h)}function m(A){return A===92||A===124?(e.consume(A),h):h(A)}function x(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),l=!1,_n(A)?On(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):R(A)}function k(A){return _n(A)?On(e,_,"whitespace")(A):_(A)}function _(A){return A===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),w):A===45?(o+=1,w(A)):A===null||Xt(A)?j(A):R(A)}function w(A){return A===45?(e.enter("tableDelimiterFiller"),S(A)):R(A)}function S(A){return A===45?(e.consume(A),S):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 _n(A)?On(e,j,"whitespace")(A):j(A)}function j(A){return A===124?v(A):A===null||Xt(A)?!l||i!==o?R(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):R(A)}function R(A){return n(A)}function T(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||Xt(A)?(e.exit("tableRow"),t(A)):_n(A)?On(e,I,"whitespace")(A):(e.enter("data"),M(A))}function M(A){return A===null||A===124||Jn(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 cB(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,p,h;const m=new iB;for(;++n<e.length;){const x=e[n],v=x[1];x[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&(z2(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,h=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]])),i=v.type==="tableDelimiterRow"?2:p?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],h=lf(m,t,o,i,void 0,h),o=[0,0,0,0]),l[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],h=lf(m,t,o,i,void 0,h)),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],h=lf(m,t,o,i,n,h)):l[1]!==0&&(h=lf(m,t,l,i,n,h)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=n)}for(d!==0&&z2(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=sB(t.events,n))}return e}function lf(e,t,n,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},Ml(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=Ml(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=Ml(t.events,n[2]),p=Ml(t.events,n[3]),h={type:u,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,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",h,t]])}return i!==void 0&&(o.end=Object.assign({},Ml(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function z2(e,t,n,r,i){const o=[],l=Ml(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Ml(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const uB={name:"tasklistCheck",tokenize:fB};function dB(){return{text:{91:uB}}}function fB(e,t,n){const r=this;return i;function i(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 Jn(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 Xt(d)?t(d):_n(d)?e.check({tokenize:pB},t,n)(d):n(d)}}function pB(e,t,n){return On(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function hB(e){return sA([BF(),YF(),rB(e),oB(),dB()])}const gB={};function cu(e){const t=this,n=e||gB,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(hB(n)),o.push(OF()),l.push(DF(n))}const U2=/\n/g,q2=/[\t ]+/g,mB=/^[\t\n\f\r ]+$/,H2=new Set(["caption","col","colgroup","tbody","td","tfoot","th","thead","tr"]),xB=new Set(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title"]),e5=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 yB(e,t){const n=t||{},r="children"in e?e.children:[];let i=!1,o=!1;e.type==="element"&&(i=e5.has(e.tagName),o=e.tagName==="table"||dp(e));const l=r5(e,{whitespace:n.whitespace||"normal"}),u=[];(e.type==="text"||e.type==="comment")&&rk(u,n5(e,{breakAfter:!0,breakBefore:!0}));let d=-1;for(;++d<r.length;){const h=r[d+1],m=h?h.type==="element"&&h.tagName==="br":i,x=d?void 0:i;rk(u,t5(r[d],d,e,{breakAfter:m,breakBefore:x,rowAfter:o?i5(e,d,void 0):void 0,whitespace:l}))}const f=[];let p;for(d=-1;++d<u.length;){const h=u[d];typeof h=="number"?p!==void 0&&h>p&&(p=h):h&&(p!==void 0&&p>-1&&f.push(`
|
|
80
|
+
`.repeat(p)||" "),p=-1,f.push(h))}return f.join("")}function t5(e,t,n,r){if(e.type==="element")return bB(e,t,n,r);if(e.type==="text"){if(mB.test(e.value)&&n.type==="element"&&(n.tagName==="table"||n.tagName==="tr"||dp(n))){const i=n.children[t-1],o=n.children[t+1];if((!i||i.type==="element"&&H2.has(i.tagName))&&(!o||o.type==="element"&&H2.has(o.tagName)))return[]}return r.whitespace==="normal"?n5(e,r):vB(e)}return[]}function bB(e,t,n,r){var h,m;const i=r5(e,r),o=e.children||[],l=e.tagName==="table"||dp(e);let u=-1;const d=[];if(xB.has(e.tagName)||(h=e.properties)!=null&&h.hidden||e.tagName==="dialog"&&!((m=e.properties)!=null&&m.open))return d;let f,p;for(e.tagName==="br"||$f(e)&&(r.rowAfter||nk(n,t,$f))?p=`
|
|
81
|
+
`:e.tagName==="p"?(f=2,p=2):e5.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;rk(d,t5(o[u],u,e,{breakAfter:v,breakBefore:k,rowAfter:l?i5(e,u,r.rowAfter):void 0,whitespace:i}))}return $2(e)&&nk(n,t,$2)&&d.push(" "),f&&d.unshift(f),p&&d.push(p),d}function n5(e,t){const n=String(e.value),r=[],i=[];let o=0;for(;o<=n.length;){U2.lastIndex=o;const d=U2.exec(n),f=d&&"index"in d?d.index:n.length;r.push(kB(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?(i.push(r[l]),u=void 0):r[l]?(typeof u=="number"&&i.push(u),i.push(r[l]),u=0):(l===0||l===r.length-1)&&i.push(0);return i}function vB(e){return[String(e.value)]}function kB(e,t,n){const r=[];let i=0,o;for(;i<e.length;){q2.lastIndex=i;const l=q2.exec(e);o=l?l.index:e.length,!i&&!o&&l&&!t&&r.push(""),i!==o&&r.push(e.slice(i,o)),i=l?o+l[0].length:o}return i!==o&&!n&&r.push(""),r.join(" ")}function r5(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 i5(e,t,n){return e.type==="element"&&e.tagName==="table"?nk(e,t,_B):n}function nk(e,t,n){for(;++t<e.children.length;){const r=e.children[t];if(r.type==="element"&&n(r))return!0}return!1}function rk(e,t){let n=-1;for(;++n<t.length;)e.push(t[n])}function $2(e){return e.tagName==="td"||e.tagName==="th"}function dp(e){return e.tagName==="tbody"||e.tagName==="tfoot"||e.tagName==="thead"}function _B(e){if($f(e))return!0;if(dp(e)){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n.type==="element"&&$f(n))return!0}}return!1}function $f(e){return e.tagName==="tr"}function wB(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(i)+"[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},h={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(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+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"],w=["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"],j={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},R={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[R,h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:T.concat([{begin:/\(/,end:/\)/,keywords:j,contains:T.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:j,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:j,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,M,R,T,[h,{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:j,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function SB(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=wB(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 EB(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 i={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,i]};i.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},h={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"],w={match:/(\/[a-z._-]+)+/},S=["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"],j=["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"],R=["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:[...S,...N,"set","shopt",...j,...R]},contains:[x,e.SHEBANG(),v,h,o,l,w,u,d,f,p,n]}}function NB(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="("+r+"|"+t.optional(i)+"[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},h={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(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+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"},w=[h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:w.concat([{begin:/\(/,end:/\)/,keywords:_,contains:w.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,h]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(S,N,w,[h,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:h,strings:f,keywords:_}}}function CB(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(i)+"[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},h={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(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+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"],w=["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"],j={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},R={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[R,h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:T.concat([{begin:/\(/,end:/\)/,keywords:j,contains:T.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:j,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:j,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,M,R,T,[h,{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:j,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function jB(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"],i=["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:i.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:'""'}]},h=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,h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const w={variants:[f,k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},N=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",j={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"}},w,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},u,S,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,S,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,S],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[w,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},j]}}const TB=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_-]*/}}),RB=["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"],AB=["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"],IB=[...RB,...AB],MB=["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(),LB=["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(),OB=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),DB=["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 PB(e){const t=e.regex,n=TB(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="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:":("+LB.join("|")+")"},{begin:":(:)?("+OB.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+DB.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:i,attribute:MB.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+IB.join("|")+")\\b"}]}}function FB(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 BB(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 zB(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 UB(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 i={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,i,l,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,p=/'[^']*'/,h=t.either(d,f,p),m=t.concat(h,"(\\s*\\.\\s*",h,")*",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,i,l,n]}}]}}var Ll="[0-9](_*[0-9])*",cf=`\\.(${Ll})`,uf="[0-9a-fA-F](_*[0-9a-fA-F])*",W2={className:"number",variants:[{begin:`(\\b(${Ll})((${cf})|\\.)?|(${cf}))[eE][+-]?(${Ll})[fFdD]?\\b`},{begin:`\\b(${Ll})((${cf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${cf})[fFdD]?\\b`},{begin:`\\b(${Ll})[fFdD]\\b`},{begin:`\\b0[xX]((${uf})\\.?|(${uf})?\\.(${uf}))[pP][+-]?(${Ll})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${uf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function a5(e,t,n){return n===-1?"":e.replace(t,r=>a5(e,t,n-1))}function qB(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+a5("(?:<"+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,W2,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},W2,f]}}const V2="[A-Za-z$_][0-9A-Za-z$_]*",HB=["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"],$B=["true","false","null","undefined","NaN","Infinity"],s5=["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"],o5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],WB=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],VB=[].concat(l5,s5,o5);function GB(e){const t=e.regex,n=(q,{after:ae})=>{const P="</"+q[0].slice(1);return q.input.indexOf(P,ae)!==-1},r=V2,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(q,ae)=>{const P=q[0].length+q.index,Q=q.input[P];if(Q==="<"||Q===","){ae.ignoreMatch();return}Q===">"&&(n(q,{after:P})||ae.ignoreMatch());let J;const F=q.input.substring(P);if(J=F.match(/^\s*=/)){ae.ignoreMatch();return}if((J=F.match(/^\s+extends\s+/))&&J.index===0){ae.ignoreMatch();return}}},u={$pattern:V2,keyword:HB,literal:$B,built_in:VB,"variable.language":WB},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={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]},S={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+/},h];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const j=[].concat(S,m.contains),R=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:R},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:{_:[...s5,...o5]}},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:[T],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(q){return t.concat("(?!",q.join("|"),")")}const ee={match:t.concat(/\b/,$([...l5,"super","import","await"].map(q=>`${q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Z="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(Z)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:R,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,_,S,{match:/\$\d+/},h,M,{scope:"attr",match:r+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:Z,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:R}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.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:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},ee,D,I,G,{match:/\$[(.]/}]}}const KB="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",YB={scope:"number",match:KB,relevance:0};function QB(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={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,i,YB,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ol="[0-9](_*[0-9])*",df=`\\.(${Ol})`,ff="[0-9a-fA-F](_*[0-9a-fA-F])*",XB={className:"number",variants:[{begin:`(\\b(${Ol})((${df})|\\.)?|(${df}))[eE][+-]?(${Ol})[fFdD]?\\b`},{begin:`\\b(${Ol})((${df})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${df})[fFdD]?\\b`},{begin:`\\b(${Ol})[fFdD]\\b`},{begin:`\\b0[xX]((${ff})\\.?|(${ff})?\\.(${ff}))[pP][+-]?(${Ol})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ff})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ZB(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+"@"},i={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,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.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=XB,p=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=h;return m.variants[1].contains=[h],h.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:[h,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:`
|
|
82
|
+
`},f]}}const JB=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_-]*/}}),ez=["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"],tz=["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"],nz=[...ez,...tz],rz=["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(),c5=["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(),u5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),iz=["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(),az=c5.concat(u5).sort().reverse();function sz(e){const t=JB(e),n=az,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",l=[],u=[],d=function(N){return{className:"string",begin:"~?"+N+".*?"+N}},f=function(N,j,R){return{className:N,begin:j,relevance:R}},p={$pattern:/[a-z-]+/,keyword:r,attribute:rz.join(" ")},h={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,h,f("variable","@@?"+i,10),f("variable","@\\{"+i+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\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("+iz.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:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},w={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","@\\{"+i+"\\}"),{begin:"\\b("+nz.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:":("+c5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+u5.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},S={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[w]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,S,v,w,x,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function oz(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.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:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function lz(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]},i={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,i,o,l]}}function cz(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={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}]},h=e.inherit(f,{contains:[]}),m=e.inherit(p,{contains:[]});f.contains.push(m),p.contains.push(h);let x=[n,d];return[f,p,h,m].forEach(w=>{w.contains=w.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:"$"},i,r,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function uz(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 dz(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},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],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,w="\\1")=>{const S=w==="\\1"?w:t.concat(w,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,S,/(?:\\.|[^\\\/])*?/,w,r)},x=(k,_,w)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,w,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(...h,{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(...h,{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:i,contains:v}}function fz(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),i=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)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(U,G)=>{G.data._beginMatch=U[1]||U[2]},"on:end":(U,G)=>{G.data._beginMatch!==U[1]&&G.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),x=`[
|
|
83
|
+
]`,v={scope:"string",variants:[p,f,h,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"],w=["__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"],S=["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"],j={keyword:w,literal:(U=>{const G=[];return U.forEach(Z=>{G.push(Z),Z.toLowerCase()===Z?G.push(Z.toUpperCase()):G.push(Z.toLowerCase())}),G})(_),built_in:S},R=U=>U.map(G=>G.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(x,"+"),t.concat("(?!",R(S).join("\\b|"),"\\b)"),i],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:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/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:j,contains:[L,l,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,T]},D={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",R(w).join("\\b|"),"|",R(S).join("\\b|"),"\\b)"),r,t.concat(x,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(D);const $=[L,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,T],ee={begin:t.concat(/#\[\s*\\?/,t.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:j,contains:[ee,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,D,M,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{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:j,contains:["self",ee,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 pz(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 hz(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function gz(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},h={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}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,h,e.HASH_COMMENT_MODE]}]};return f.contains=[h,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"},h,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[w]},{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,w,h]}]}}function mz(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function xz(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,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:[i,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:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function yz(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]+/),i=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},h={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}]},T=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:l},{relevance:0,match:[i,/\.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:[h,{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=T,k.contains=T;const A=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:T}}];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(T)}}function bz(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,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 vz=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_-]*/}}),kz=["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"],_z=["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"],wz=[...kz,..._z],Sz=["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(),Ez=["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(),Nz=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Cz=["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 jz(e){const t=vz(e),n=Nz,r=Ez,i="@[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("+wz.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("+Cz.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:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:Sz.join(" ")},contains:[{begin:i,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 Tz(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Rz(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={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"],h=["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(R=>!p.includes(R)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:t.concat(/\b/,t.either(...x),/\s*\(/),relevance:0,keywords:{built_in:x}};function S(R){return t.concat(/\b/,t.either(...R.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const N={scope:"keyword",match:S(m),relevance:0};function j(R,{exceptions:T,when:I}={}){const M=I;return T=T||[],R.map(L=>L.match(/\|\d+$/)||T.includes(L)?L:M(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:j(v,{when:R=>R.length<3}),literal:o,type:u,built_in:h},contains:[{scope:"type",match:S(l)},N,w,k,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,_]}}function d5(e){return e?typeof e=="string"?e:e.source:null}function Qc(e){return Vn("(?=",e,")")}function Vn(...e){return e.map(n=>d5(n)).join("")}function Az(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function wi(...e){return"("+(Az(e).capture?"":"?:")+e.map(r=>d5(r)).join("|")+")"}const t1=e=>Vn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Iz=["Protocol","Type"].map(t1),G2=["init","self"].map(t1),Mz=["Any","Self"],Tg=["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"],K2=["false","nil","true"],Lz=["assignment","associativity","higherThan","left","lowerThan","none","right"],Oz=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Y2=["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"],f5=wi(/[/=\-+!*%<>&|^~?]/,/[\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]/),p5=wi(f5,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Rg=Vn(f5,p5,"*"),h5=wi(/[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]/),Wf=wi(h5,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),$a=Vn(h5,Wf,"*"),pf=Vn(/[A-Z]/,Wf,"*"),Dz=["attached","autoclosure",Vn(/convention\(/,wi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Vn(/objc\(/,$a,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Pz=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Fz(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,wi(...Iz,...G2)],className:{2:"keyword"}},o={match:Vn(/\./,wi(...Tg)),relevance:0},l=Tg.filter(je=>typeof je=="string").concat(["_|0"]),u=Tg.filter(je=>typeof je!="string").concat(Mz).map(t1),d={variants:[{className:"keyword",match:wi(...u,...G2)}]},f={$pattern:wi(/\b\w+/,/#\w+/),keyword:l.concat(Oz),literal:K2},p=[i,o,d],h={match:Vn(/\./,wi(...Y2)),relevance:0},m={className:"built_in",match:Vn(/\b/,wi(...Y2),/(?=\()/)},x=[h,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:Rg},{match:`\\.(\\.|${p5})+`}]},_=[v,k],w="([0-9]_*)+",S="([0-9a-fA-F]_*)+",N={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${S})(\\.(${S}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},j=(je="")=>({className:"subst",variants:[{match:Vn(/\\/,je,/[0\\tnr"']/)},{match:Vn(/\\/,je,/u\{[0-9a-fA-F]{1,8}\}/)}]}),R=(je="")=>({className:"subst",match:Vn(/\\/,je,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(je="")=>({className:"subst",label:"interpol",begin:Vn(/\\/,je,/\(/),end:/\)/}),I=(je="")=>({begin:Vn(je,/"""/),end:Vn(/"""/,je),contains:[j(je),R(je),T(je)]}),M=(je="")=>({begin:Vn(je,/"/),end:Vn(/"/,je),contains:[j(je),T(je)]}),L={className:"string",variants:[I(),I("#"),I("##"),I("###"),M(),M("#"),M("##"),M("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],D={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},$=je=>{const Oe=Vn(je,/\//),ft=Vn(/\//,je);return{begin:Oe,end:ft,contains:[...A,{scope:"comment",begin:`#(?!.*${ft})`,end:/$/}]}},ee={scope:"regexp",variants:[$("###"),$("##"),$("#"),D]},U={match:Vn(/`/,$a,/`/)},G={className:"variable",match:/\$\d+/},Z={className:"variable",match:`\\$${Wf}+`},z=[U,G,Z],q={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Pz,contains:[..._,N,L]}]}},ae={scope:"keyword",match:Vn(/@/,wi(...Dz),Qc(wi(/\(/,/\s+/)))},P={scope:"meta",match:Vn(/@/,$a)},Q=[q,ae,P],J={match:Qc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Vn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Wf,"+")},{className:"type",match:pf,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Vn(/\s+&\s+/,Qc(pf)),relevance:0}]},F={begin:/</,end:/>/,keywords:f,contains:[...r,...p,...Q,v,J]};J.contains.push(F);const K={match:Vn($a,/\s*:/),keywords:"_|0",relevance:0},W={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",K,...r,ee,...p,...x,..._,N,L,...z,...Q,J]},H={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,J]},se={begin:wi(Qc(Vn($a,/\s*:/)),Qc(Vn($a,/\s+/,$a,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:$a}]},ie={begin:/\(/,end:/\)/,keywords:f,contains:[se,...r,...p,..._,N,L,...Q,J,W],endsParent:!0,illegal:/["']/},ge={match:[/(func|macro)/,/\s+/,wi(U.match,$a,Rg)],className:{1:"keyword",3:"title.function"},contains:[H,ie,t],illegal:[/\[/,/%/]},we={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[H,ie,t],illegal:/\[|%/},Ke={match:[/operator/,/\s+/,Rg],className:{1:"keyword",3:"title"}},xt={begin:[/precedencegroup/,/\s+/,pf],className:{1:"keyword",3:"title"},contains:[J],keywords:[...Lz,...K2],end:/}/},et={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},vt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},lt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,$a,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[H,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:pf},...p],relevance:0}]};for(const je of L.variants){const Oe=je.contains.find(Ct=>Ct.label==="interpol");Oe.keywords=f;const ft=[...p,...x,..._,N,L,...z];Oe.contains=[...ft,{begin:/\(/,end:/\)/,contains:["self",...ft]}]}return{name:"Swift",keywords:f,contains:[...r,ge,we,et,vt,lt,Ke,xt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ee,...p,...x,..._,N,L,...z,...Q,J,W]}}const Vf="[A-Za-z$_][0-9A-Za-z$_]*",g5=["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"],m5=["true","false","null","undefined","NaN","Infinity"],x5=["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"],y5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],b5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],v5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],k5=[].concat(b5,x5,y5);function Bz(e){const t=e.regex,n=(q,{after:ae})=>{const P="</"+q[0].slice(1);return q.input.indexOf(P,ae)!==-1},r=Vf,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(q,ae)=>{const P=q[0].length+q.index,Q=q.input[P];if(Q==="<"||Q===","){ae.ignoreMatch();return}Q===">"&&(n(q,{after:P})||ae.ignoreMatch());let J;const F=q.input.substring(P);if(J=F.match(/^\s*=/)){ae.ignoreMatch();return}if((J=F.match(/^\s+extends\s+/))&&J.index===0){ae.ignoreMatch();return}}},u={$pattern:Vf,keyword:g5,literal:m5,built_in:k5,"variable.language":v5},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={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]},S={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+/},h];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const j=[].concat(S,m.contains),R=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(j)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:R},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:{_:[...x5,...y5]}},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:[T],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(q){return t.concat("(?!",q.join("|"),")")}const ee={match:t.concat(/\b/,$([...b5,"super","import","await"].map(q=>`${q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},Z="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(Z)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:R,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,_,S,{match:/\$\d+/},h,M,{scope:"attr",match:r+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:Z,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:R}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.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:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},ee,D,I,G,{match:/\$[(.]/}]}}function zz(e){const t=e.regex,n=Bz(e),r=Vf,i=["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:i},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:Vf,keyword:g5.concat(d),literal:m5,built_in:k5.concat(i),"variable.language":v5},p={className:"meta",begin:"@"+r},h=(k,_,w)=>{const S=k.contains.findIndex(N=>N.label===_);if(S===-1)throw new Error("can not find mode to replace");k.contains.splice(S,1,w)};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]),h(n,"shebang",e.SHEBANG()),h(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 Uz(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\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,i),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,i),/ +/,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+:/},h=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,h,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 qz(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"],i={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,i,e.QUOTE_STRING_MODE,d,f,u]}}function Hz(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,i={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:[i]},{begin:/'/,end:/'/,contains:[i]},{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},i,{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 $z(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]|$)/}]},i={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,i]},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],w=[..._];return w.pop(),w.push(u),x.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const Wz={arduino:SB,bash:EB,c:NB,cpp:CB,csharp:jB,css:PB,diff:FB,go:BB,graphql:zB,ini:UB,java:qB,javascript:GB,json:QB,kotlin:ZB,less:sz,lua:oz,makefile:lz,markdown:cz,objectivec:uz,perl:dz,php:fz,"php-template":pz,plaintext:hz,python:gz,"python-repl":mz,r:xz,ruby:yz,rust:bz,scss:jz,shell:Tz,sql:Rz,swift:Fz,typescript:zz,vbnet:Uz,wasm:qz,xml:Hz,yaml:$z};var Ag,Q2;function Vz(){if(Q2)return Ag;Q2=1;function e(te){return te instanceof Map?te.clear=te.delete=te.set=function(){throw new Error("map is read-only")}:te instanceof Set&&(te.add=te.clear=te.delete=function(){throw new Error("set is read-only")}),Object.freeze(te),Object.getOwnPropertyNames(te).forEach(Ee=>{const Je=te[Ee],Dt=typeof Je;(Dt==="object"||Dt==="function")&&!Object.isFrozen(Je)&&e(Je)}),te}class t{constructor(Ee){Ee.data===void 0&&(Ee.data={}),this.data=Ee.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(te){return te.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(te,...Ee){const Je=Object.create(null);for(const Dt in te)Je[Dt]=te[Dt];return Ee.forEach(function(Dt){for(const Pe in Dt)Je[Pe]=Dt[Pe]}),Je}const i="</span>",o=te=>!!te.scope,l=(te,{prefix:Ee})=>{if(te.startsWith("language:"))return te.replace("language:","language-");if(te.includes(".")){const Je=te.split(".");return[`${Ee}${Je.shift()}`,...Je.map((Dt,Pe)=>`${Dt}${"_".repeat(Pe+1)}`)].join(" ")}return`${Ee}${te}`};class u{constructor(Ee,Je){this.buffer="",this.classPrefix=Je.classPrefix,Ee.walk(this)}addText(Ee){this.buffer+=n(Ee)}openNode(Ee){if(!o(Ee))return;const Je=l(Ee.scope,{prefix:this.classPrefix});this.span(Je)}closeNode(Ee){o(Ee)&&(this.buffer+=i)}value(){return this.buffer}span(Ee){this.buffer+=`<span class="${Ee}">`}}const d=(te={})=>{const Ee={children:[]};return Object.assign(Ee,te),Ee};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(Ee){this.top.children.push(Ee)}openNode(Ee){const Je=d({scope:Ee});this.add(Je),this.stack.push(Je)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Ee){return this.constructor._walk(Ee,this.rootNode)}static _walk(Ee,Je){return typeof Je=="string"?Ee.addText(Je):Je.children&&(Ee.openNode(Je),Je.children.forEach(Dt=>this._walk(Ee,Dt)),Ee.closeNode(Je)),Ee}static _collapse(Ee){typeof Ee!="string"&&Ee.children&&(Ee.children.every(Je=>typeof Je=="string")?Ee.children=[Ee.children.join("")]:Ee.children.forEach(Je=>{f._collapse(Je)}))}}class p extends f{constructor(Ee){super(),this.options=Ee}addText(Ee){Ee!==""&&this.add(Ee)}startScope(Ee){this.openNode(Ee)}endScope(){this.closeNode()}__addSublanguage(Ee,Je){const Dt=Ee.root;Je&&(Dt.scope=`language:${Je}`),this.add(Dt)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function h(te){return te?typeof te=="string"?te:te.source:null}function m(te){return k("(?=",te,")")}function x(te){return k("(?:",te,")*")}function v(te){return k("(?:",te,")?")}function k(...te){return te.map(Je=>h(Je)).join("")}function _(te){const Ee=te[te.length-1];return typeof Ee=="object"&&Ee.constructor===Object?(te.splice(te.length-1,1),Ee):{}}function w(...te){return"("+(_(te).capture?"":"?:")+te.map(Dt=>h(Dt)).join("|")+")"}function S(te){return new RegExp(te.toString()+"|").exec("").length-1}function N(te,Ee){const Je=te&&te.exec(Ee);return Je&&Je.index===0}const j=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function R(te,{joinWith:Ee}){let Je=0;return te.map(Dt=>{Je+=1;const Pe=Je;let ze=h(Dt),We="";for(;ze.length>0;){const Qe=j.exec(ze);if(!Qe){We+=ze;break}We+=ze.substring(0,Qe.index),ze=ze.substring(Qe.index+Qe[0].length),Qe[0][0]==="\\"&&Qe[1]?We+="\\"+String(Number(Qe[1])+Pe):(We+=Qe[0],Qe[0]==="("&&Je++)}return We}).map(Dt=>`(${Dt})`).join(Ee)}const T=/\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+)?)",D="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ee=(te={})=>{const Ee=/^#![ ]*\//;return te.binary&&(te.begin=k(Ee,/.*\b/,te.binary,/\b.*/)),r({scope:"meta",begin:Ee,end:/$/,relevance:0,"on:begin":(Je,Dt)=>{Je.index!==0&&Dt.ignoreMatch()}},te)},U={begin:"\\\\[\\s\\S]",relevance:0},G={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},Z={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},z={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/},q=function(te,Ee,Je={}){const Dt=r({scope:"comment",begin:te,end:Ee,contains:[]},Je);Dt.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 Pe=w("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 Dt.contains.push({begin:k(/[ ]+/,"(",Pe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Dt},ae=q("//","$"),P=q("/\\*","\\*/"),Q=q("#","$"),J={scope:"number",begin:L,relevance:0},F={scope:"number",begin:A,relevance:0},K={scope:"number",begin:D,relevance:0},W={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},H={scope:"title",begin:I,relevance:0},se={scope:"title",begin:M,relevance:0},ie={begin:"\\.\\s*"+M,relevance:0};var we=Object.freeze({__proto__:null,APOS_STRING_MODE:G,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:K,BINARY_NUMBER_RE:D,COMMENT:q,C_BLOCK_COMMENT_MODE:P,C_LINE_COMMENT_MODE:ae,C_NUMBER_MODE:F,C_NUMBER_RE:A,END_SAME_AS_BEGIN:function(te){return Object.assign(te,{"on:begin":(Ee,Je)=>{Je.data._beginMatch=Ee[1]},"on:end":(Ee,Je)=>{Je.data._beginMatch!==Ee[1]&&Je.ignoreMatch()}})},HASH_COMMENT_MODE:Q,IDENT_RE:I,MATCH_NOTHING_RE:T,METHOD_GUARD:ie,NUMBER_MODE:J,NUMBER_RE:L,PHRASAL_WORDS_MODE:z,QUOTE_STRING_MODE:Z,REGEXP_MODE:W,RE_STARTERS_RE:$,SHEBANG:ee,TITLE_MODE:H,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:se});function Ke(te,Ee){te.input[te.index-1]==="."&&Ee.ignoreMatch()}function xt(te,Ee){te.className!==void 0&&(te.scope=te.className,delete te.className)}function et(te,Ee){Ee&&te.beginKeywords&&(te.begin="\\b("+te.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",te.__beforeBegin=Ke,te.keywords=te.keywords||te.beginKeywords,delete te.beginKeywords,te.relevance===void 0&&(te.relevance=0))}function vt(te,Ee){Array.isArray(te.illegal)&&(te.illegal=w(...te.illegal))}function lt(te,Ee){if(te.match){if(te.begin||te.end)throw new Error("begin & end are not supported with match");te.begin=te.match,delete te.match}}function je(te,Ee){te.relevance===void 0&&(te.relevance=1)}const Oe=(te,Ee)=>{if(!te.beforeMatch)return;if(te.starts)throw new Error("beforeMatch cannot be used with starts");const Je=Object.assign({},te);Object.keys(te).forEach(Dt=>{delete te[Dt]}),te.keywords=Je.keywords,te.begin=k(Je.beforeMatch,m(Je.begin)),te.starts={relevance:0,contains:[Object.assign(Je,{endsParent:!0})]},te.relevance=0,delete Je.beforeMatch},ft=["of","and","for","in","not","or","if","then","parent","list","value"],Ct="keyword";function rn(te,Ee,Je=Ct){const Dt=Object.create(null);return typeof te=="string"?Pe(Je,te.split(" ")):Array.isArray(te)?Pe(Je,te):Object.keys(te).forEach(function(ze){Object.assign(Dt,rn(te[ze],Ee,ze))}),Dt;function Pe(ze,We){Ee&&(We=We.map(Qe=>Qe.toLowerCase())),We.forEach(function(Qe){const st=Qe.split("|");Dt[st[0]]=[ze,tn(st[0],st[1])]})}}function tn(te,Ee){return Ee?Number(Ee):un(te)?0:1}function un(te){return ft.includes(te.toLowerCase())}const mt={},$t=te=>{console.error(te)},nt=(te,...Ee)=>{console.log(`WARN: ${te}`,...Ee)},qe=(te,Ee)=>{mt[`${te}/${Ee}`]||(console.log(`Deprecated as of ${te}. ${Ee}`),mt[`${te}/${Ee}`]=!0)},ue=new Error;function me(te,Ee,{key:Je}){let Dt=0;const Pe=te[Je],ze={},We={};for(let Qe=1;Qe<=Ee.length;Qe++)We[Qe+Dt]=Pe[Qe],ze[Qe+Dt]=!0,Dt+=S(Ee[Qe-1]);te[Je]=We,te[Je]._emit=ze,te[Je]._multi=!0}function Ue(te){if(Array.isArray(te.begin)){if(te.skip||te.excludeBegin||te.returnBegin)throw $t("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ue;if(typeof te.beginScope!="object"||te.beginScope===null)throw $t("beginScope must be object"),ue;me(te,te.begin,{key:"beginScope"}),te.begin=R(te.begin,{joinWith:""})}}function He(te){if(Array.isArray(te.end)){if(te.skip||te.excludeEnd||te.returnEnd)throw $t("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ue;if(typeof te.endScope!="object"||te.endScope===null)throw $t("endScope must be object"),ue;me(te,te.end,{key:"endScope"}),te.end=R(te.end,{joinWith:""})}}function be(te){te.scope&&typeof te.scope=="object"&&te.scope!==null&&(te.beginScope=te.scope,delete te.scope)}function Ye(te){be(te),typeof te.beginScope=="string"&&(te.beginScope={_wrap:te.beginScope}),typeof te.endScope=="string"&&(te.endScope={_wrap:te.endScope}),Ue(te),He(te)}function _t(te){function Ee(We,Qe){return new RegExp(h(We),"m"+(te.case_insensitive?"i":"")+(te.unicodeRegex?"u":"")+(Qe?"g":""))}class Je{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Qe,st){st.position=this.position++,this.matchIndexes[this.matchAt]=st,this.regexes.push([st,Qe]),this.matchAt+=S(Qe)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Qe=this.regexes.map(st=>st[1]);this.matcherRe=Ee(R(Qe,{joinWith:"|"}),!0),this.lastIndex=0}exec(Qe){this.matcherRe.lastIndex=this.lastIndex;const st=this.matcherRe.exec(Qe);if(!st)return null;const Ne=st.findIndex((oe,bn)=>bn>0&&oe!==void 0),Ve=this.matchIndexes[Ne];return st.splice(0,Ne),Object.assign(st,Ve)}}class Dt{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Qe){if(this.multiRegexes[Qe])return this.multiRegexes[Qe];const st=new Je;return this.rules.slice(Qe).forEach(([Ne,Ve])=>st.addRule(Ne,Ve)),st.compile(),this.multiRegexes[Qe]=st,st}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Qe,st){this.rules.push([Qe,st]),st.type==="begin"&&this.count++}exec(Qe){const st=this.getMatcher(this.regexIndex);st.lastIndex=this.lastIndex;let Ne=st.exec(Qe);if(this.resumingScanAtSamePosition()&&!(Ne&&Ne.index===this.lastIndex)){const Ve=this.getMatcher(0);Ve.lastIndex=this.lastIndex+1,Ne=Ve.exec(Qe)}return Ne&&(this.regexIndex+=Ne.position+1,this.regexIndex===this.count&&this.considerAll()),Ne}}function Pe(We){const Qe=new Dt;return We.contains.forEach(st=>Qe.addRule(st.begin,{rule:st,type:"begin"})),We.terminatorEnd&&Qe.addRule(We.terminatorEnd,{type:"end"}),We.illegal&&Qe.addRule(We.illegal,{type:"illegal"}),Qe}function ze(We,Qe){const st=We;if(We.isCompiled)return st;[xt,lt,Ye,Oe].forEach(Ve=>Ve(We,Qe)),te.compilerExtensions.forEach(Ve=>Ve(We,Qe)),We.__beforeBegin=null,[et,vt,je].forEach(Ve=>Ve(We,Qe)),We.isCompiled=!0;let Ne=null;return typeof We.keywords=="object"&&We.keywords.$pattern&&(We.keywords=Object.assign({},We.keywords),Ne=We.keywords.$pattern,delete We.keywords.$pattern),Ne=Ne||/\w+/,We.keywords&&(We.keywords=rn(We.keywords,te.case_insensitive)),st.keywordPatternRe=Ee(Ne,!0),Qe&&(We.begin||(We.begin=/\B|\b/),st.beginRe=Ee(st.begin),!We.end&&!We.endsWithParent&&(We.end=/\B|\b/),We.end&&(st.endRe=Ee(st.end)),st.terminatorEnd=h(st.end)||"",We.endsWithParent&&Qe.terminatorEnd&&(st.terminatorEnd+=(We.end?"|":"")+Qe.terminatorEnd)),We.illegal&&(st.illegalRe=Ee(We.illegal)),We.contains||(We.contains=[]),We.contains=[].concat(...We.contains.map(function(Ve){return Wt(Ve==="self"?We:Ve)})),We.contains.forEach(function(Ve){ze(Ve,st)}),We.starts&&ze(We.starts,Qe),st.matcher=Pe(st),st}if(te.compilerExtensions||(te.compilerExtensions=[]),te.contains&&te.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return te.classNameAliases=r(te.classNameAliases||{}),ze(te)}function jt(te){return te?te.endsWithParent||jt(te.starts):!1}function Wt(te){return te.variants&&!te.cachedVariants&&(te.cachedVariants=te.variants.map(function(Ee){return r(te,{variants:null},Ee)})),te.cachedVariants?te.cachedVariants:jt(te)?r(te,{starts:te.starts?r(te.starts):null}):Object.isFrozen(te)?r(te):te}var hn="11.11.2";class xe extends Error{constructor(Ee,Je){super(Ee),this.name="HTMLInjectionError",this.html=Je}}const ke=n,Ae=r,Fe=Symbol("nomatch"),yt=7,pt=function(te){const Ee=Object.create(null),Je=Object.create(null),Dt=[];let Pe=!0;const ze="Could not find the language '{}', did you forget to load/include a language module?",We={disableAutodetect:!0,name:"Plain text",contains:[]};let Qe={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function st(it){return Qe.noHighlightRe.test(it)}function Ne(it){let Et=it.className+" ";Et+=it.parentNode?it.parentNode.className:"";const Vt=Qe.languageDetectRe.exec(Et);if(Vt){const Pt=Bn(Vt[1]);return Pt||(nt(ze.replace("{}",Vt[1])),nt("Falling back to no-highlight mode for this block.",it)),Pt?Vt[1]:"no-highlight"}return Et.split(/\s+/).find(Pt=>st(Pt)||Bn(Pt))}function Ve(it,Et,Vt){let Pt="",zn="";typeof Et=="object"?(Pt=it,Vt=Et.ignoreIllegals,zn=Et.language):(qe("10.7.0","highlight(lang, code, ...args) has been deprecated."),qe("10.7.0",`Please use highlight(code, options) instead.
|
|
84
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),zn=it,Pt=Et),Vt===void 0&&(Vt=!0);const Pn={code:Pt,language:zn};ga("before:highlight",Pn);const Gr=Pn.result?Pn.result:oe(Pn.language,Pn.code,Vt);return Gr.code=Pn.code,ga("after:highlight",Gr),Gr}function oe(it,Et,Vt,Pt){const zn=Object.create(null);function Pn(at,gt){return at.keywords[gt]}function Gr(){if(!Ft.keywords){kn.addText(dn);return}let at=0;Ft.keywordPatternRe.lastIndex=0;let gt=Ft.keywordPatternRe.exec(dn),Nt="";for(;gt;){Nt+=dn.substring(at,gt.index);const yn=gr.case_insensitive?gt[0].toLowerCase():gt[0],Gn=Pn(Ft,yn);if(Gn){const[Hn,Ji]=Gn;if(kn.addText(Nt),Nt="",zn[yn]=(zn[yn]||0)+1,zn[yn]<=yt&&(ai+=Ji),Hn.startsWith("_"))Nt+=gt[0];else{const si=gr.classNameAliases[Hn]||Hn;lr(gt[0],si)}}else Nt+=gt[0];at=Ft.keywordPatternRe.lastIndex,gt=Ft.keywordPatternRe.exec(dn)}Nt+=dn.substring(at),kn.addText(Nt)}function ni(){if(dn==="")return;let at=null;if(typeof Ft.subLanguage=="string"){if(!Ee[Ft.subLanguage]){kn.addText(dn);return}at=oe(Ft.subLanguage,dn,!0,Ar[Ft.subLanguage]),Ar[Ft.subLanguage]=at._top}else at=tr(dn,Ft.subLanguage.length?Ft.subLanguage:null);Ft.relevance>0&&(ai+=at.relevance),kn.__addSublanguage(at._emitter,at.language)}function hr(){Ft.subLanguage!=null?ni():Gr(),dn=""}function lr(at,gt){at!==""&&(kn.startScope(gt),kn.addText(at),kn.endScope())}function zi(at,gt){let Nt=1;const yn=gt.length-1;for(;Nt<=yn;){if(!at._emit[Nt]){Nt++;continue}const Gn=gr.classNameAliases[at[Nt]]||at[Nt],Hn=gt[Nt];Gn?lr(Hn,Gn):(dn=Hn,Gr(),dn=""),Nt++}}function mi(at,gt){return at.scope&&typeof at.scope=="string"&&kn.openNode(gr.classNameAliases[at.scope]||at.scope),at.beginScope&&(at.beginScope._wrap?(lr(dn,gr.classNameAliases[at.beginScope._wrap]||at.beginScope._wrap),dn=""):at.beginScope._multi&&(zi(at.beginScope,gt),dn="")),Ft=Object.create(at,{parent:{value:Ft}}),Ft}function xi(at,gt,Nt){let yn=N(at.endRe,Nt);if(yn){if(at["on:end"]){const Gn=new t(at);at["on:end"](gt,Gn),Gn.isMatchIgnored&&(yn=!1)}if(yn){for(;at.endsParent&&at.parent;)at=at.parent;return at}}if(at.endsWithParent)return xi(at.parent,gt,Nt)}function Qi(at){return Ft.matcher.regexIndex===0?(dn+=at[0],1):(Ei=!0,0)}function ma(at){const gt=at[0],Nt=at.rule,yn=new t(Nt),Gn=[Nt.__beforeBegin,Nt["on:begin"]];for(const Hn of Gn)if(Hn&&(Hn(at,yn),yn.isMatchIgnored))return Qi(gt);return Nt.skip?dn+=gt:(Nt.excludeBegin&&(dn+=gt),hr(),!Nt.returnBegin&&!Nt.excludeBegin&&(dn=gt)),mi(Nt,at),Nt.returnBegin?0:gt.length}function yi(at){const gt=at[0],Nt=Et.substring(at.index),yn=xi(Ft,at,Nt);if(!yn)return Fe;const Gn=Ft;Ft.endScope&&Ft.endScope._wrap?(hr(),lr(gt,Ft.endScope._wrap)):Ft.endScope&&Ft.endScope._multi?(hr(),zi(Ft.endScope,at)):Gn.skip?dn+=gt:(Gn.returnEnd||Gn.excludeEnd||(dn+=gt),hr(),Gn.excludeEnd&&(dn=gt));do Ft.scope&&kn.closeNode(),!Ft.skip&&!Ft.subLanguage&&(ai+=Ft.relevance),Ft=Ft.parent;while(Ft!==yn.parent);return yn.starts&&mi(yn.starts,at),Gn.returnEnd?0:gt.length}function Ya(){const at=[];for(let gt=Ft;gt!==gr;gt=gt.parent)gt.scope&&at.unshift(gt.scope);at.forEach(gt=>kn.openNode(gt))}let ri={};function ii(at,gt){const Nt=gt&>[0];if(dn+=at,Nt==null)return hr(),0;if(ri.type==="begin"&>.type==="end"&&ri.index===gt.index&&Nt===""){if(dn+=Et.slice(gt.index,gt.index+1),!Pe){const yn=new Error(`0 width match regex (${it})`);throw yn.languageName=it,yn.badRule=ri.rule,yn}return 1}if(ri=gt,gt.type==="begin")return ma(gt);if(gt.type==="illegal"&&!Vt){const yn=new Error('Illegal lexeme "'+Nt+'" for mode "'+(Ft.scope||"<unnamed>")+'"');throw yn.mode=Ft,yn}else if(gt.type==="end"){const yn=yi(gt);if(yn!==Fe)return yn}if(gt.type==="illegal"&&Nt==="")return gt.index===Et.length||(dn+=`
|
|
85
|
+
`),1;if(Zi>1e5&&Zi>gt.index*3)throw new Error("potential infinite loop, way more iterations than matches");return dn+=Nt,Nt.length}const gr=Bn(it);if(!gr)throw $t(ze.replace("{}",it)),new Error('Unknown language: "'+it+'"');const Xi=_t(gr);let ln="",Ft=Pt||Xi;const Ar={},kn=new Qe.__emitter(Qe);Ya();let dn="",ai=0,wr=0,Zi=0,Ei=!1;try{if(gr.__emitTokens)gr.__emitTokens(Et,kn);else{for(Ft.matcher.considerAll();;){Zi++,Ei?Ei=!1:Ft.matcher.considerAll(),Ft.matcher.lastIndex=wr;const at=Ft.matcher.exec(Et);if(!at)break;const gt=Et.substring(wr,at.index),Nt=ii(gt,at);wr=at.index+Nt}ii(Et.substring(wr))}return kn.finalize(),ln=kn.toHTML(),{language:it,value:ln,relevance:ai,illegal:!1,_emitter:kn,_top:Ft}}catch(at){if(at.message&&at.message.includes("Illegal"))return{language:it,value:ke(Et),illegal:!0,relevance:0,_illegalBy:{message:at.message,index:wr,context:Et.slice(wr-100,wr+100),mode:at.mode,resultSoFar:ln},_emitter:kn};if(Pe)return{language:it,value:ke(Et),illegal:!1,relevance:0,errorRaised:at,_emitter:kn,_top:Ft};throw at}}function bn(it){const Et={value:ke(it),illegal:!1,relevance:0,_top:We,_emitter:new Qe.__emitter(Qe)};return Et._emitter.addText(it),Et}function tr(it,Et){Et=Et||Qe.languages||Object.keys(Ee);const Vt=bn(it),Pt=Et.filter(Bn).filter(pa).map(hr=>oe(hr,it,!1));Pt.unshift(Vt);const zn=Pt.sort((hr,lr)=>{if(hr.relevance!==lr.relevance)return lr.relevance-hr.relevance;if(hr.language&&lr.language){if(Bn(hr.language).supersetOf===lr.language)return 1;if(Bn(lr.language).supersetOf===hr.language)return-1}return 0}),[Pn,Gr]=zn,ni=Pn;return ni.secondBest=Gr,ni}function Le(it,Et,Vt){const Pt=Et&&Je[Et]||Vt;it.classList.add("hljs"),it.classList.add(`language-${Pt}`)}function kt(it){let Et=null;const Vt=Ne(it);if(st(Vt))return;if(ga("before:highlightElement",{el:it,language:Vt}),it.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",it);return}if(it.children.length>0&&(Qe.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(it)),Qe.throwUnescapedHTML))throw new xe("One of your code blocks includes unescaped HTML.",it.innerHTML);Et=it;const Pt=Et.textContent,zn=Vt?Ve(Pt,{language:Vt,ignoreIllegals:!0}):tr(Pt);it.innerHTML=zn.value,it.dataset.highlighted="yes",Le(it,Vt,zn.language),it.result={language:zn.language,re:zn.relevance,relevance:zn.relevance},zn.secondBest&&(it.secondBest={language:zn.secondBest.language,relevance:zn.secondBest.relevance}),ga("after:highlightElement",{el:it,result:zn,text:Pt})}function vn(it){Qe=Ae(Qe,it)}const ar=()=>{Ma(),qe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Vr(){Ma(),qe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Rr=!1;function Ma(){function it(){Ma()}if(document.readyState==="loading"){Rr||window.addEventListener("DOMContentLoaded",it,!1),Rr=!0;return}document.querySelectorAll(Qe.cssSelector).forEach(kt)}function Gt(it,Et){let Vt=null;try{Vt=Et(te)}catch(Pt){if($t("Language definition for '{}' could not be registered.".replace("{}",it)),Pe)$t(Pt);else throw Pt;Vt=We}Vt.name||(Vt.name=it),Ee[it]=Vt,Vt.rawDefinition=Et.bind(null,te),Vt.aliases&&Bi(Vt.aliases,{languageName:it})}function Tn(it){delete Ee[it];for(const Et of Object.keys(Je))Je[Et]===it&&delete Je[Et]}function Pr(){return Object.keys(Ee)}function Bn(it){return it=(it||"").toLowerCase(),Ee[it]||Ee[Je[it]]}function Bi(it,{languageName:Et}){typeof it=="string"&&(it=[it]),it.forEach(Vt=>{Je[Vt.toLowerCase()]=Et})}function pa(it){const Et=Bn(it);return Et&&!Et.disableAutodetect}function $n(it){it["before:highlightBlock"]&&!it["before:highlightElement"]&&(it["before:highlightElement"]=Et=>{it["before:highlightBlock"](Object.assign({block:Et.el},Et))}),it["after:highlightBlock"]&&!it["after:highlightElement"]&&(it["after:highlightElement"]=Et=>{it["after:highlightBlock"](Object.assign({block:Et.el},Et))})}function La(it){$n(it),Dt.push(it)}function ha(it){const Et=Dt.indexOf(it);Et!==-1&&Dt.splice(Et,1)}function ga(it,Et){const Vt=it;Dt.forEach(function(Pt){Pt[Vt]&&Pt[Vt](Et)})}function gi(it){return qe("10.7.0","highlightBlock will be removed entirely in v12.0"),qe("10.7.0","Please use highlightElement now."),kt(it)}Object.assign(te,{highlight:Ve,highlightAuto:tr,highlightAll:Ma,highlightElement:kt,highlightBlock:gi,configure:vn,initHighlighting:ar,initHighlightingOnLoad:Vr,registerLanguage:Gt,unregisterLanguage:Tn,listLanguages:Pr,getLanguage:Bn,registerAliases:Bi,autoDetection:pa,inherit:Ae,addPlugin:La,removePlugin:ha}),te.debugMode=function(){Pe=!1},te.safeMode=function(){Pe=!0},te.versionString=hn,te.regex={concat:k,lookahead:m,either:w,optional:v,anyNumberOfTimes:x};for(const it in we)typeof we[it]=="object"&&e(we[it]);return Object.assign(te,we),te},Ht=pt({});return Ht.newInstance=()=>pt({}),Ag=Ht,Ht.HighlightJS=Ht,Ht.default=Ht,Ag}var Gz=Vz();const Kz=Gl(Gz),X2={},Yz="hljs-";function Qz(e){const t=Kz.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:l,registered:u};function n(d,f,p){const h=p||X2,m=typeof h.prefix=="string"?h.prefix:Yz;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:Xz,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 h=(f||X2).subset||i();let m=-1,x=0,v;for(;++m<h.length;){const k=h[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 i(){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 h=d[p];t.registerAliases(typeof h=="string"?h:[...h],{languageName:p})}}}function u(d){return!!t.getLanguage(d)}}class Xz{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],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(l,u){return u?l+"_".repeat(u):n.options.classPrefix+l}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Zz={};function hf(e){const t=e||Zz,n=t.aliases,r=t.detect||!1,i=t.languages||Wz,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=Qz(i);if(n&&f.registerAlias(n),l){const p=l.indexOf("-");d=p===-1?l:l.slice(0,p)}return function(p,h){Hu(p,"element",function(m,x,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=Jz(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 _=yB(m,{whitespace:"pre"});let w;try{w=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(S){const N=S;if(k&&/Unknown language/.test(N.message)){h.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&&w.data&&w.data.language&&m.properties.className.push("language-"+w.data.language),w.children.length>0&&(m.children=w.children)})}}function Jz(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const i=String(t[n]);if(i==="no-highlight"||i==="nohighlight")return!1;!r&&i.slice(0,5)==="lang-"&&(r=i.slice(5)),!r&&i.slice(0,9)==="language-"&&(r=i.slice(9))}return r}function uu(){function e(t){const n=new Set(["strong","emphasis","delete"]);function r(i){if(i.children)for(let o=0;o<i.children.length;o++){const l=i.children[o];if(n.has(l.type)){if(o>0){const f=i.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
|
|
86
|
+
`)&&(f.value+=" "):(i.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<i.children.length?i.children[u]:null;d&&(d.type==="text"?d.value&&/^[a-zA-Z0-9]/.test(d.value)&&!d.value.startsWith(" ")&&!d.value.startsWith(`
|
|
87
|
+
`)&&(d.value=" "+d.value):n.has(d.type)&&i.children.splice(u,0,{type:"text",value:" "}))}r(l)}}return r(t),t}return e}function du(){const e=/<!--[\s\S]*?-->/g;function t(r){if(!(!r||typeof r!="object"||!Array.isArray(r.children))&&!(r.type==="code"||r.type==="inlineCode"))for(let i=r.children.length-1;i>=0;i--){const o=r.children[i];if(!(!o||typeof o!="object")){if(o.type==="html"&&typeof o.value=="string"){const l=o.value.replace(e,"");l.trim()===""?r.children.splice(i,1):o.value=l;continue}t(o)}}}function n(r){return t(r),r}return n}function Rf({children:e,language:t,className:n,frameless:r,...i}){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?a.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[a.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?a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:a.jsx("code",{className:d||void 0,children:e})})]}):a.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:[a.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:[a.jsx("span",{children:t||"code"}),a.jsx("button",{onMouseDown:function(p){p.preventDefault()},onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"]})})]}),a.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:a.jsx("code",{className:d||void 0,children:e})})]})}function fp(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[i,o]of Object.entries(n))if(!(o==null||o===""))if(typeof o=="boolean")o&&r.push(`--${i}`);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(`--${i} "${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(`--${i} "${u}"`)}return r.length>0?`${e} ${r.join(" ")}`:e||""}}catch{return""}}function Zo(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function eU(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 tU(e,t){if(!e||!t)return null;const n=String(e).toLowerCase();if(n!=="write"&&n!=="edit")return null;const r=t.filePath;return typeof r!="string"||!r.trim()?null:r}function nU({filePath:e}){const[t,n]=y.useState(null),[r,i]=y.useState(""),[o,l]=y.useState(!1),u=y.useMemo(()=>t4(e),[e]);if(y.useEffect(()=>{if(!u.candidate)return;let p=!0;return c4([u.rel]).then(h=>{p&&n(h[u.rel]||{exists:!1,size:0})}).catch(()=>{p&&n({exists:!1,size:0})}),()=>{p=!1}},[u]),!n4(u,!!(t&&t.exists)))return null;const d=()=>{l(!0),i(""),d4(u.rel,u.name).catch(p=>{i(p&&p.dlpQuestion&&p.body&&(p.body.question||p.body.error)||p&&p.message||"Download failed.")}).finally(()=>l(!1))},f=r4(t.size);return a.jsxs("div",{className:"mt-2 flex items-center gap-2 flex-wrap text-xs opacity-80",children:[a.jsxs("button",{type:"button",onClick:d,disabled:o,className:"inline-flex items-center gap-1 cursor-pointer hover:opacity-100 font-mono select-none",children:[a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5 5 5-5M12 15V3"})}),a.jsxs("span",{children:["Download ",u.name,f?` · ${f}`:""]})]}),r&&a.jsx("span",{className:"opacity-80 break-words",children:r})]})}function rU({part:e}){const{t}=Zt(),{tool:n,state:r}=e,[i,o]=y.useState(!1);if(!r)return null;const l=r.status||"running",u=r.title||n||t("tool.tool"),d=fp(n||u,r.input),f=r.input&&r.input._purpose?r.input._purpose:null,p=l==="completed"?eU(r.output):null,h=l==="completed"?tU(n,r.input):null,m=!f||i,x={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"},v={running:a.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:a.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:a.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:a.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 a.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${x[l]||x.running}`,children:[a.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!i):void 0,children:[v[l]||v.running,f?a.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):a.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&a.jsx("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${i?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m&&d&&!p&&a.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:[a.jsx("span",{className:"text-green-400 select-none",children:"$ "}),a.jsx("span",{className:"text-gray-100",children:d})]}),h?a.jsx(nU,{filePath:h}):null,p?a.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[a.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),a.jsxs("span",{children:[p.type==="mermaid"?"Mermaid diagram":p.type==="svg"?"SVG illustration":"Math",p.title?a.jsxs(a.Fragment,{children:[": ",a.jsx("span",{className:"font-medium",children:p.title})]}):null," rendered → see ",a.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):r.output&&l==="completed"&&m&&a.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:Zo((typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,600)).slice(0,500)}),r.error&&m&&a.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:Zo(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function iU({part:e}){const{tool:t,state:n}=e,[r,i]=y.useState(!1);if(!n)return null;const o=n.status||"running",l=n.title||t||"Tool",u=fp(t||l,n.input),d=n.input&&n.input._purpose?n.input._purpose:null,f=!d||r;return a.jsxs("div",{className:"py-1",children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>i(!r):void 0,children:[o==="running"&&a.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&a.jsx("svg",{className:"w-3 h-3 text-blue-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx("span",{className:"font-medium truncate flex-1",children:d}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-medium truncate",children:l}),u&&a.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&a.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),n.output&&o==="completed"&&f&&a.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:Zo(typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)).slice(0,500)}),n.error&&f&&a.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:Zo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)}),n.error&&!f&&a.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:Zo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function aU({text:e,isStreaming:t}){const{t:n}=Zt(),[r,i]=y.useState(!1),o=e&&e.trim().length>0,l=t&&!r?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return a.jsxs("div",{className:"py-1",children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>i(!r):void 0,children:[t?a.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:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:`font-medium shrink-0 ${l?"":"flex-1"}`,children:n("chat.thinking")}),l&&a.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&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),r&&o&&a.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:a.jsx(lu,{remarkPlugins:[cu,uu,du],children:e})})]})}function sU(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 Ig=2500,gf=5,Xc=new Map;function oU(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function lU({part:e,questionId:t,questions:n}){const{t:r}=Zt(),{state:i}=e,o=i&&i.status||"running",l=i&&i.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=(i&&i.error||"").replace(/^Error:\s*/,""),h=i&&i.output||"",[m,x]=y.useState({}),[v,k]=y.useState({}),[_,w]=y.useState(null),[S,N]=y.useState(null),[j,R]=y.useState(t),[T,I]=y.useState(0),[M,L]=y.useState(()=>{const J=e.callID||e.id,F=J&&Xc.get(J);return!!(F&&F.attempts>=gf)}),A=y.useRef(!0),D=y.useRef(null),$=y.useRef(null);y.useEffect(()=>{t&&R(t)},[t]);const ee=e.callID||e.id||null;y.useEffect(()=>{if(!i||d||f||j||!ee)return;let J=Xc.get(ee);J||(J={attempts:0,lastAt:0},Xc.set(ee,J)),$.current=J;let F=!1,K=null;const W=()=>{if(!(F||!A.current)){if(J.attempts>=gf){L(!0);return}K=setTimeout(H,Ig)}},H=()=>{F||!A.current||J.attempts>=gf||(J.attempts+=1,J.lastAt=Date.now(),eO().then(se=>{if(F||!A.current)return;const ie=Array.isArray(se&&se.pending)?se.pending:[];for(var ge=0;ge<ie.length;ge++){var we=ie[ge],Ke=we.tool&&we.tool.callID?we.tool.callID:null;if(Ke===ee&&we.id){Xc.delete(ee),L(!1),R(we.id);return}}W()}).catch(()=>{W()}))};if(J.attempts<gf){const se=Date.now()-J.lastAt;J.attempts===0||se>=Ig?H():K=setTimeout(H,Ig-se)}return()=>{F=!0,K&&clearTimeout(K)}},[i,d,f,j,ee,T]);const U=y.useCallback(()=>{ee&&Xc.delete(ee),L(!1),I(J=>J+1)},[ee]);y.useEffect(()=>()=>{A.current=!1},[]),y.useEffect(()=>{!d&&D.current&&(D.current.focus(),D.current.scrollIntoView({behavior:"smooth",block:"center"}))},[d]);const G=J=>{var F,K;return(((F=m[J])==null?void 0:F.length)??0)>0||(((K=v[J])==null?void 0:K.trim().length)??0)>0},Z=u.every((J,F)=>G(F)),z=(J,F,K)=>{x(W=>{const H=W[J]??[];return K?{...W,[J]:H.includes(F)?H.filter(se=>se!==F):[...H,F]}:{...W,[J]:H.includes(F)?[]:[F]}})},q=y.useCallback(async()=>{if(!Z||!j)return;const J=u.map((F,K)=>{var se;const W=m[K]??[],H=(se=v[K])==null?void 0:se.trim();return H?[...W,H]:W});w("reply"),N(null);try{const F=await tO(j,J);if(!A.current)return;F&&F.success===!1&&(N(F.error||"Failed to reply"),w(null))}catch(F){if(!A.current)return;N(F.message||"Failed to reply"),w(null)}},[j,u,m,v,Z]),ae=y.useCallback(async()=>{if(j){w("reject"),N(null);try{const J=await nO(j);if(!A.current)return;J&&J.success===!1&&(N(J.error||"Failed to dismiss"),w(null))}catch(J){if(!A.current)return;N(J.message||"Failed to dismiss"),w(null)}}},[j]);if(!i)return null;const P=J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),q())};if(d)return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.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:a.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"})}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),u.map((J,F)=>a.jsxs("div",{className:F>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:J.text}),h&&a.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:cU(h,F,u.length)})]},F))]});if(f)return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.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:a.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"})}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",children:r("question.title")}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]}),a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:r("question.error")}),p&&a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:p})]});let Q=!1;return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.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:a.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"})}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")})]}),u.map((J,F)=>{const K=Array.isArray(J.options)?J.options:[],W=K.length>0,H=J.multiple===!0,se=J.custom!==!1,ie=m[F]??[],ge=se&&!Q;return ge&&(Q=!0),a.jsxs("div",{className:F>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(J.header||H)&&a.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[J.header&&a.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:J.header}),H&&a.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:r("question.select_all")})]}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:J.text}),W&&a.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:K.map((we,Ke)=>{const xt=oU(we),et=ie.includes(xt);return a.jsx("button",{onClick:()=>z(F,xt,H),disabled:_!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${et?"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":et,children:xt},Ke)})}),se&&a.jsx("input",{ref:ge?D:void 0,type:"text",value:v[F]??"",onChange:we=>k(Ke=>({...Ke,[F]:we.target.value})),onKeyDown:P,disabled:_!==null,placeholder:r(W?"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"})]},F)}),S&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:S}),!j&&!d&&!M&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:r("question.reconnecting")||"Reconnecting…"}),!j&&!d&&M&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:r("question.resolve_failed")||"Could not reach the question service."}),a.jsx("button",{onClick:U,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"})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[a.jsx("button",{onClick:ae,disabled:_!==null||!j,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")}),a.jsx("button",{onClick:q,disabled:_!==null||!Z||!j,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 cU(e,t,n){if(n===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const r=e.split(`
|
|
88
|
+
`),i=`[${t+1}] `;for(const o of r)if(o.startsWith(i))return o.slice(i.length);return e}function uU({sessionId:e}){const{t}=Zt(),[n,r]=y.useState(null),[i,o]=y.useState(!1),[l,u]=y.useState(null),[d,f]=y.useState(!1),[p,h]=y.useState(null),m=y.useRef(null),x=n!==null;y.useEffect(()=>{if(!i)return;const S=N=>{N.key==="Escape"&&(N.stopPropagation(),o(!1))};return window.addEventListener("keydown",S),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",S)},[i]);const v=async()=>{if(!(x||!e)){o(!0),f(!0),h(null);try{const{content:S}=await WO(e);u(typeof S=="string"?S:"")}catch(S){console.error("Failed to load PLAN.md:",S),h(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{x||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{x||r("dismissed")},w="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 a.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:[a.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("button",{type:"button",onClick:v,disabled:x||d||!e,className:w+" 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")}),a.jsx("button",{type:"button",onClick:k,disabled:x,className:w+" 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")}),a.jsx("button",{type:"button",onClick:_,disabled:x,className:w+" 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&&a.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(n==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:a.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:S=>S.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),a.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?a.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):p?a.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:p}):a.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 dU="plan.md";function fU(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function pU(e){return typeof e!="string"||!e?!1:fU(e).toLowerCase()===dU}function hU(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||{};pU(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function n1(e,t,n=!1){if(t){const r=Object.values(t).filter(i=>i.type==="reasoning"&&n?!1:i.type==="text"||i.type==="reasoning"||i.type==="error").map(i=>i.text||i.delta||"").join(`
|
|
89
|
+
|
|
90
|
+
`);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(`
|
|
91
|
+
|
|
92
|
+
`)}function gU(e,t,n){const r=n1(e,t,n);if(!e||e.length===0)return r;const i=[];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 h=Object.keys(f).filter(m=>m!=="_purpose");if(h.length>0){const m={};for(let x=0;x<h.length;x++)m[h[x]]=f[h[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&&i.push(p.join(`
|
|
93
|
+
`))}return i.length===0?r:r+`
|
|
94
|
+
|
|
95
|
+
`+i.join(`
|
|
96
|
+
|
|
97
|
+
`)}function mU(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
|
|
98
|
+
`),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
|
|
99
|
+
`),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
|
|
100
|
+
`),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=t.replace(/<!--[\s\S]*?-->/g," "),t}const xU=5,yU=2e3,bU=6e3,ik="… [truncated]",vU=/^\*\*Quoted from (assistant|you)(?:, (.+?))?:\*\*$/,_5="```text",w5="```";let Z2=0;function kU(){return Z2+=1,"q-"+Date.now()+"-"+Z2}function r1(e,t=yU){if(typeof e!="string")return"";const n=e.replace(/\r\n?/g,`
|
|
101
|
+
`).replace(/^\n+/,"").replace(/\s+$/,"");return n.length<=t?n:n.slice(0,t)+ik}function _U(e){return e.reduce((t,n)=>n&&typeof n.text=="string"?t+n.text.length:t,0)}function wU(e,t){const n=Array.isArray(e)?e:[];if(n.length>=xU)return!1;const r=r1(t);return r?_U(n)+r.length<=bU:!1}function SU(e,t){const n=e==="assistant"?"Quoted from assistant":"Quoted from you",r=typeof t=="string"?t.trim():"";return r?n+", "+r+":":n+":"}function EU(e){return e?"> "+e:">"}function J2(e,t){for(const n of t.split(`
|
|
102
|
+
`))e.push(EU(n))}function NU(e){const t=e||{},n=["> **"+SU(t.sourceRole,t.sourceTime)+"**"],r=r1(t.text);return t.fromCode===!0?(n.push("> "+_5),J2(n,r),n.push("> "+w5)):J2(n,r),n.join(`
|
|
103
|
+
`)}function CU(e,t){if(!Array.isArray(e)||e.length===0)return t;const n=String(t||"").trim(),r=e.map(i=>NU(i)).join(`
|
|
104
|
+
|
|
105
|
+
`);return n?r+`
|
|
106
|
+
|
|
107
|
+
`+n:r}function i1(e){return typeof e!="string"||e.charAt(0)!==">"?null:e.charAt(1)===" "?e.slice(2):e.slice(1)}function S5(e){if(e===null)return null;const t=vU.exec(e.trim());return t?t[0].slice(2,-2):null}function jU(e,t){const n=[];let r=t;for(;r<e.length;){const u=i1(e[r]);if(u===null)break;n.push(u),r+=1}const i=n[n.length-1],o=n.length>=2&&n[0]===_5&&i===w5;return{body:(o?n.slice(1,-1):n).join(`
|
|
108
|
+
`),fromCode:o,next:r}}function TU(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=S5(i1(e[n]));if(i===null)break;const o=jU(e,n+1);t.push({header:i,body:o.body,fromCode:o.fromCode}),n=o.next,r=n,e[n]===""&&(n+=1)}return{quotes:t,end:r}}function RU(e,t){return t>=e.length?"":e.slice(t).join(`
|
|
109
|
+
`).replace(/^\n+/,"")}function AU(e){if(typeof e!="string"||e==="")return{quotes:[],rest:""};const t=e.split(`
|
|
110
|
+
`);if(S5(i1(t[0]))===null)return{quotes:[],rest:e};const n=TU(t);return{quotes:n.quotes,rest:RU(t,n.end)}}function IU(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 MU(e){return typeof e=="string"&&e.trim()!==""}function LU(){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 OU(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 DU(e){let t=null;try{t=LU()}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,i=!1;try{document.body.appendChild(n),i=!0,n.select(),typeof document.execCommand=="function"&&(r=document.execCommand("copy")===!0)}catch{r=!1}try{i&&document.body.removeChild(n)}catch{}return OU(t),r}async function pp(e){if(!MU(e))return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}try{return DU(e)}catch{return!1}}const E5=e=>e&&e.type==="element"&&(e.tagName==="td"||e.tagName==="th");function N5(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++)N5(n[r],t)}function PU(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 i=e.charAt(0)==="`"||e.charAt(e.length-1)==="`"?" ":"";return r+i+e+i+r}function C5(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+=C5(t[r]);return n}function ak(e,t){return e.properties&&e.properties[t]||""}function FU(e,t){const n=ak(e,"href");return n?`[${t}](${n})`:t}function BU(e){const t=ak(e,"src"),n=ak(e,"alt");return t?``:""}const zU={strong:["**","**"],em:["*","*"],del:["~~","~~"]};function UU(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=j5(e);if(t==="code")return PU(C5(e));if(t==="a")return FU(e,n);if(t==="img")return BU(e);const r=zU[t];return r?`${r[0]}${n}${r[1]}`:n}function j5(e){const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=UU(t[r]);return n}function qU(e){return j5(e).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ").trim()}function HU(e,t){const n=(e.children||[]).filter(E5),r=[];for(let i=0;i<t;i++){const o=n[i]&&n[i].properties&&n[i].properties.align;r.push(o==="center"?":---:":o==="right"?"---:":o==="left"?":---":"---")}return`| ${r.join(" | ")} |`}function $U(e){if(!e||e.type!=="element"||e.tagName!=="table")return"";const t=[];if(N5(e,t),t.length===0)return"";const n=t.map(o=>(o.children||[]).filter(E5).map(qU));let r=0;for(let o=0;o<n.length;o++)n[o].length>r&&(r=n[o].length);if(r===0)return"";const i=n.map(o=>{const l=o.slice();for(;l.length<r;)l.push("");return`| ${l.join(" | ")} |`});return i.splice(1,0,HU(t[0],r)),i.join(`
|
|
111
|
+
`)}const WU="bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5";function T5(e){if(!e)return null;var t=e.nodeType===1?e:e.parentElement;return!t||!t.closest?null:t.closest("[data-message-id]")}function VU(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()&&T5(t.anchorNode)===e?n:""}function GU({node:e}){var[t,n]=y.useState(!1),r=y.useRef(null),i=y.useRef(!0);y.useEffect(function(){return i.current=!0,function(){i.current=!1,r.current&&clearTimeout(r.current)}},[]);var o=function(){pp($U(e)).then(function(l){!l||!i.current||(n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(function(){i.current&&n(!1)},2e3))})};return a.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 KU({descriptor:e,plain:t}){const n=e,[r,i]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(""),[f,p]=y.useState(!1);y.useEffect(()=>{if(!n.candidate)return;let _=!0;return c4([n.rel]).then(w=>{_&&i(w[n.rel]||{exists:!1,size:0})}).catch(()=>{_&&i({exists:!1,size:0})}),()=>{_=!1}},[n]),y.useEffect(()=>{if(!o||!o.url)return;const _=o.url;return()=>{URL.revokeObjectURL(_)}},[o]);const h=_=>{if(_&&_.dlpQuestion){const w=_.body&&(_.body.question||_.body.error);d(w||"The download needs your answer before the file exists.")}else d(_&&_.message||"Download failed.")},m=_=>{_.preventDefault(),p(!0),d(""),d4(n.rel,n.name).catch(h).finally(()=>p(!1))},x=async _=>{if(_.preventDefault(),o){l(null);return}p(!0),d("");try{const w=await u4(n.rel);if(n.type==="image")l({kind:"image",url:URL.createObjectURL(w.blob)});else{const S=await w.blob.text();l({kind:"text",text:S.slice(0,2e5)})}}catch(w){h(w)}finally{p(!1)}};if(!n4(n,!!(r&&r.exists)))return t;const v=r4(r.size),k=y.cloneElement(t,{href:yr("/api/files/file?path="+encodeURIComponent(n.rel)),onClick:m});return a.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1 align-baseline",children:[k,a.jsxs("button",{type:"button",onClick:m,disabled:f,className:"inline-flex items-center gap-1 align-baseline cursor-pointer opacity-70 hover:opacity-100 font-mono text-xs select-none",children:[a.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5 5 5-5M12 15V3"})}),a.jsxs("span",{children:["Download",v?` · ${v}`:""]})]}),n.viewable&&a.jsx("button",{type:"button",onClick:x,disabled:f,className:"inline-flex items-center align-baseline cursor-pointer opacity-70 hover:opacity-100 font-mono text-xs select-none",children:o?"Hide preview":"Preview"}),u&&a.jsx("span",{className:"w-full text-xs opacity-70 break-words",children:u}),o&&o.kind==="image"&&a.jsx("span",{className:"w-full block my-1 max-w-full",children:a.jsx("img",{src:o.url,alt:n.name,className:"block max-w-full max-h-64 object-contain"})}),o&&o.kind==="text"&&a.jsx("span",{className:"w-full block my-1 max-w-full font-mono text-xs whitespace-pre-wrap break-words overflow-y-auto max-h-64",children:o.text})]})}function eS(e){return{pre:function({node:t,children:n,...r}){if(y.isValidElement(n)){var i=n.type;if(i==="code"||typeof i=="string"&&i.toLowerCase()==="code"){var o=n.props||{},l=o.className||"",u=l.match(/language-(\S+)/),d=u?u[1]:"",f=_u(o.children);return a.jsx(Rf,{language:d,className:l,frameless:e,children:f})}}var p=_u(n);return p?a.jsx(Rf,{language:"",className:"",frameless:e,children:p}):a.jsx("pre",{...r,children:n})},code:function({node:t,className:n,children:r,...i}){if(n&&n.indexOf("language-")!==-1){var o=n.match(/language-(\S+)/),l=o?o[1]:"";return a.jsx(Rf,{language:l,className:n,frameless:e,children:_u(r)})}return a.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",...i,children:r})},a:function({node:t,children:n,href:r,...i}){const o=a.jsx("a",{href:r,...i,target:"_blank",rel:"noopener noreferrer",children:n}),l=t4(r);return l.candidate?a.jsx(KU,{descriptor:l,plain:o}):o},table:function({node:t,children:n,...r}){return a.jsxs("div",{className:e?"my-3":"",children:[a.jsx("div",{className:"overflow-x-auto",children:a.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})}),a.jsx("div",{className:"flex justify-end mt-1",children:a.jsx(GU,{node:t})})]})},th:function({node:t,children:n,...r}){return a.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 a.jsx("td",{className:e?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...r,children:n})}}}function YU({message:e,parts:t,streamingParts:n,user:r,searchQuery:i,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:p,onCancelQueued:h,hideToolBubbles:m,mobileFrameless:x,hideThinking:v,isPrivate:k,isLast:_,isBusy:w,sessionID:S,questionIdMap:N,isCompactedOut:j,onQuoteAdd:R}){var{t:T}=Zt(),I=e.role==="user",M=!I&&_&&!w?hU(t)!==null:!1,[L,A]=y.useState(!1);y.useEffect(function(){M&&ng()&&A(!0)},[M,ng()]);var D=M&&(L||ng()),$=I&&e._queued===!0,ee=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[U,G]=y.useState(!1),[Z,z]=y.useState(!1),[q,ae]=y.useState(""),[P,Q]=y.useState(!1),J=y.useRef(null),F=y.useRef(!0),K=y.useRef(null);y.useEffect(function(){var Ne=K.current;!Ne||!Z||(Ne.style.height="auto",Ne.style.height=Math.min(Ne.scrollHeight,300)+"px")},[q,Z]),y.useEffect(function(){return F.current=!0,function(){F.current=!1,J.current&&clearTimeout(J.current)}},[]);var W=n1(t,n,v),H=(t||[]).filter(function(Ne){return Ne.type==="tool"}),se=(t||[]).filter(function(Ne){return Ne.type==="file"&&Ne.filename}),ie=(t||[]).filter(function(Ne){if(Ne.type!=="image_url"||!Ne.image_url)return!1;var Ve=Ne.image_url.url||Ne.image_url;if(typeof Ve!="string")return!1;if(Ve.startsWith("data:image/")){var oe=Ve.indexOf(";"),bn=oe>5?Ve.substring(5,oe).toLowerCase():"",tr=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return tr.indexOf(bn)!==-1}if(Ve.startsWith("https://"))try{var Le=new URL(Ve),kt=Le.pathname.toLowerCase();return!kt.endsWith(".svg")&&!kt.endsWith(".svgz")}catch{return!1}return!1}),ge=x&&!I,we=y.useRef({current:0});we.current={current:0};var Ke=y.useRef(null);Ke.current={searchQuery:i,matchCount:l,matchOffset:o,activeMatchIndex:u,registerMatchRef:d};var xt=y.useMemo(function(){return eS(ge)},[ge]),et=y.useMemo(function(){if(!i)return null;var Ne=xt,Ve=eS(ge),oe=function(bn){return function({children:tr,node:Le,...kt}){var vn=Ke.current;return vn.matchCount>0?a.jsx(bn,{...kt,children:sk(tr,vn.searchQuery,vn.matchOffset,we.current,vn.activeMatchIndex,vn.registerMatchRef)}):a.jsx(bn,{...kt,children:tr})}};return Ve.td=oe(Ne.td),Ve.th=oe(Ne.th),Ve.p=oe("p"),Ve.li=oe("li"),Ve.h1=oe("h1"),Ve.h2=oe("h2"),Ve.h3=oe("h3"),Ve.h4=oe("h4"),Ve.h5=oe("h5"),Ve.h6=oe("h6"),Ve.blockquote=oe("blockquote"),Ve},[ge,i,xt,we,Ke]);if(!I){var vt=!!W,lt=ie.length>0,je=H.length>0,Oe=H.some(function(Ne){if((Ne.tool||Ne.state&&Ne.state.title||"")==="question")return!0;var Ve=Ne.callID||Ne.id||"";return!!(Ve&&N&&N[Ve])}),ft=!m||Oe,Ct=(t||[]).some(function(Ne){return Ne.type==="reasoning"&&Ne.text}),rn=!1;if(n)for(var tn=Object.keys(n),un=0;un<tn.length;un++){var mt=n[tn[un]];if(mt&&mt.type==="reasoning"&&(mt.text||mt.delta)){rn=!0;break}}var $t=Ct||rn,nt=(t||[]).some(function(Ne){return Ne.type==="error"&&Ne.text});if(!sU({hasText:vt,hasImages:lt,hasTools:je,toolsVisibleHere:ft,hasReasoning:$t,hasError:nt,isFrameless:x,hideThinking:v,finish:e.finish}))return null}var qe=XU(e.time,T),ue=e.isAutoInjected===!0,me=e.isCompaction===!0,Ue=e.isContinuation===!0,He=me&&!Ue,be=I&&ue&&!me,Ye=null,_t="",jt="";if(be){var Wt=String(W||""),hn=Wt.split(`
|
|
112
|
+
`)[0]||"",xe=hn.indexOf("[session-mail from ")===0,ke=xe?Wt.split(`
|
|
113
|
+
`).slice(1).join(`
|
|
114
|
+
`):Wt;if(e.mailbox&&e.mailbox.senderSessionID)Ye="mail",_t=e.mailbox.senderSessionTitle||String(e.mailbox.senderSessionID).slice(0,10);else if(xe){var Ae=hn.slice(19),Fe=Ae.indexOf(' — "'),yt=Ae,pt="";Fe!==-1&&(yt=Ae.slice(0,Fe),pt=Ae.slice(Fe+4).replace('"]',"")),Ye="mail",_t=pt||yt.replace(/\]$/,"").slice(0,10)}else e.injectedVia==="idle-injection"?Ye="idle":e.injectedVia==="scheduled-injection"?Ye="scheduled":Ye="auto";jt=ke.replace(/\s+/g," ").trim(),jt.length>140&&(jt=jt.slice(0,139)+"…")}var Ht=function(){var Ne=W||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(Ne).then(function(){F.current&&(G(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(function(){F.current&&G(!1)},2e3))}).catch(function(){F.current&&te(Ne)}):te(Ne)},te=function(Ne){var Ve=document.createElement("textarea");Ve.value=Ne,Ve.style.position="fixed",Ve.style.opacity="0",document.body.appendChild(Ve),Ve.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(Ve)}F.current&&(G(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(function(){F.current&&G(!1)},2e3))},Ee=function(){ae(W||""),z(!0)},Je=function(){z(!1),ae("")},Dt=function(){q.trim()&&($&&h&&h(e.id),p&&p(q.trim())),z(!1),ae("")},Pe=function(Ne){if(R){var Ve=T5(Ne?Ne.currentTarget:null),oe=Ve?VU(Ve):"";R({text:oe||W||"",sourceMessageID:e.id,sourceRole:I?"user":"assistant",sourceTime:qe||"",fromCode:!1})}};if(Ye&&!P)return a.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":qe||void 0,"data-injected-collapsed":"true",onClick:function(){Q(!0)},children:[a.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:[a.jsx("span",{"aria-hidden":"true",children:Ye==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),Ye==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),Ye==="mail"&&_t?a.jsx("span",{className:"shrink-0 max-w-[160px] truncate text-[11px] text-gray-500 dark:text-gray-400",children:_t}):null,a.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-gray-600 dark:text-gray-300",children:jt||"…"}),a.jsx("button",{onMouseDown:function(Ne){Ne.preventDefault()},onClick:function(Ne){Ne.stopPropagation(),Ht()},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":T(U?"chat.copied":"chat.copy_message"),title:T(U?"chat.copied":"chat.copy_message"),children:U?a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.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 ze=null;if(I){var We=Ue?T("compaction.continuation_message_label")||"Compaction done. Please continue.":me?T("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":W;if(i&&l>0&&!me&&!Ue)ze=ZU(W||"",i,o,u,d);else{var Qe=AU(W||"");if(Qe.quotes.length>0&&!me&&!Ue){var st=Qe.rest;ze=a.jsxs(y.Fragment,{children:[Qe.quotes.map(function(Ne,Ve){return a.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:[a.jsx("div",{className:"font-medium",children:Ne.header}),a.jsx("div",{children:Ne.body})]},"quote-"+Ve)}),st?a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:st}):null]})}else ze=a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:We})}}return a.jsxs("div",{className:`group flex gap-3 ${I?"justify-end":"justify-start"} ${$?"opacity-60 italic":""}${j&&!He?" opacity-60":""}`,"data-message-id":e.id,"data-message-role":I?"user":"assistant","data-message-time":qe||void 0,"data-compacted-out":j?"true":void 0,children:[!I&&!ge&&a.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?a.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:a.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"})}):a.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),a.jsxs("div",{className:`flex flex-col min-w-0 ${ge?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[a.jsx("div",{className:`min-w-0 overflow-hidden ${I?`${WU}${$&&!Z?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:ge?"":`${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`}`,...$&&!Z&&p&&h?{onClick:Ee,title:T("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(Ne){(Ne.key==="Enter"||Ne.key===" ")&&(Ne.preventDefault(),Ee())}}:{},children:I?Z?a.jsxs("div",{className:"space-y-2",children:[a.jsx("textarea",{ref:K,value:q,onChange:function(Ne){ae(Ne.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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:Je,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),a.jsx("button",{onClick:Dt,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):a.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[Ye?a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5 text-[11px] text-white/85",children:[a.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:[a.jsx("span",{"aria-hidden":"true",children:Ye==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),Ye==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),Ye==="mail"&&_t?a.jsx("span",{className:"max-w-[160px] truncate opacity-80",children:_t}):null,a.jsx("button",{onClick:function(){Q(!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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})})]}):null,ze,se.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:se.map(function(Ne,Ve){return a.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:Ne.mime||"",children:[a.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:a.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"})}),a.jsx("span",{className:"truncate",children:Ne.filename})]},Ne.id||"file-"+Ve)})}),ie.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:ie.map(function(Ne,Ve){var oe=Ne.image_url.url||Ne.image_url;return a.jsx("a",{href:oe,target:"_blank",rel:"noopener noreferrer",children:a.jsx("img",{src:oe,alt:T("chat.attachment_with_index",{index:Ve+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},Ne.id||"img-"+Ve)})})]}):QU(t,n,ie,se,xt,et,m,v,T,ge,N,_,w,e.finish)}),D&&a.jsx(uU,{sessionId:S}),a.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${I?"justify-end":"justify-start"}`,children:[qe&&a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:qe}),ue&&a.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:T("chat.idle_injection_auto_badge")}),(!w||!_)&&(e.finish==="aborted"||e.finish==="interrupted")&&a.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"?T("chat.stopped_badge")||"Stopped":T("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&a.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:T("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&a.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"}),a.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:[W&&a.jsx("button",{onMouseDown:function(Ne){Ne.preventDefault()},onClick:Ht,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":T(U?"chat.copied":"chat.copy_message"),title:T(U?"chat.copied":"chat.copy_message"),children:U?a.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),R&&!me&&!Ue&&a.jsx("button",{onClick:Pe,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":T("chat.quote_selection"),title:T("chat.quote_selection"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})})}),I&&!$&&!Z&&p&&a.jsx("button",{onClick:Ee,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":T("chat.edit_resend"),title:T("chat.edit_resend"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&$&&!Z&&p&&h&&a.jsx("button",{onClick:Ee,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":T("chat.edit_resend"),title:T("chat.edit_resend"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&$&&h&&a.jsx("button",{onClick:function(){h(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":T("chat.cancel_queued"),title:T("chat.cancel_queued"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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":T("chat.regenerate"),title:T("chat.regenerate"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:a.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:ee})})]})}function QU(e,t,n,r,i,o,l,u,d,f,p,h,m,x){var v=(e||[]).slice();if(t){for(var k={},_=0;_<v.length;_++)k[v[_].id]=!0;for(var w=Object.keys(t),S=0;S<w.length;S++){var N=t[w[S]];(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 j=[],R="",T="",I=!1,M=0,L=0;function A(){R&&(j.push({type:"text",text:R,key:"text-"+M}),M+=1,R="")}function D(){T&&(j.push({type:"reasoning",text:T,key:"reasoning-"+L,live:I}),L+=1,T="",I=!1)}for(var $=0;$<v.length;$++){var ee=v[$];if(ee.type==="text"){D();var U=ee.text||"";R&&U&&!R.endsWith(`
|
|
115
|
+
`)&&(R+=`
|
|
116
|
+
`),R+=U}else if(ee.type==="reasoning"){A(),ee.live&&(I=!0);var G=ee.text||"";T&&G&&!T.endsWith(`
|
|
117
|
+
`)&&(T+=`
|
|
118
|
+
`),T+=G}else ee.type==="error"?(D(),A(),j.push({type:"error",text:ee.text||"",key:"error-"+(ee.id||$)})):ee.type==="tool"&&(D(),A(),j.push({type:"tool",part:ee,key:"tool-"+(ee.id||$)}))}if(D(),A(),r.length>0&&j.push({type:"files",parts:r,key:"files"}),n.length>0&&j.push({type:"images",parts:n,key:"images"}),j.length===0)return null;var Z=[],z=[],q="";function ae(){z.length>0&&(Z.push(a.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:z},"accent-"+q)),z=[])}for(var P=-1,Q=j.length-1;Q>=0;Q--)if(j[Q].type==="reasoning"){P=Q;break}for(var J=0;J<j.length;J++){var F=j[J];if(F.type==="text"){ae();var K=o||i;Z.push(a.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:a.jsx(lu,{remarkPlugins:[cu,uu,du],rehypePlugins:[hf],components:K,children:F.text})},F.key))}else if(F.type==="reasoning")if(f){if(ae(),u)continue;z.length===0&&(q=F.key),z.push(a.jsx(aU,{text:F.text,isStreaming:F.live&&J===P&&h&&m},F.key))}else{if(ae(),u)continue;Z.push(a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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")]}),a.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:a.jsx(lu,{remarkPlugins:[cu,uu,du],rehypePlugins:[hf],components:i,children:F.text})})]},F.key))}else if(F.type==="error")ae(),x==="aborted"?Z.push(a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-orange-600 dark:text-orange-400 text-xs font-medium uppercase tracking-wide",children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),a.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"]}),a.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-orange-600 dark:text-orange-400",children:a.jsx(lu,{remarkPlugins:[cu,uu,du],rehypePlugins:[hf],components:i,children:F.text})})]},F.key)):Z.push(a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.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"]}),a.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:a.jsx(lu,{remarkPlugins:[cu,uu,du],rehypePlugins:[hf],components:i,children:F.text})})]},F.key));else if(F.type==="tool"){var W=F.part.tool||F.part.state&&F.part.state.title||"",H=F.part.callID||F.part.id||"",se=p&&H&&p[H]?p[H]:null,ie=W==="question"||!!se;if(ie){ae();var ge=se?se.id:null;Z.push(a.jsx("div",{className:"my-2",children:a.jsx(lU,{part:F.part,questionId:ge,questions:se?se.questions:null})},F.key))}else f&&!l?(z.length===0&&(q=F.key),z.push(a.jsx(iU,{part:F.part},F.key))):(ae(),Z.push(a.jsx("div",{className:`my-2 ${l?"hidden":""}`,children:a.jsx(rU,{part:F.part})},F.key)))}else F.type==="files"?(ae(),Z.push(a.jsx("div",{className:Z.length>0?"mt-2":"",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:F.parts.map(function(we,Ke){return a.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:we.mime||"",children:[a.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:a.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"})}),a.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:we.filename})]},we.id||"file-"+Ke)})})},F.key))):F.type==="images"&&Z.push(a.jsx("div",{className:Z.length>0?"mt-2":"",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:F.parts.map(function(we,Ke){var xt=we.image_url.url||we.image_url;return a.jsx("a",{href:xt,target:"_blank",rel:"noopener noreferrer",children:a.jsx("img",{src:xt,alt:d("chat.attachment_with_index",{index:Ke+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},we.id||"img-"+Ke)})})},F.key))}return ae(),Z}function _u(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(_u).join(""):y.isValidElement(e)?_u(e.props.children):""}function XU(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 i=new Date,o=r.toDateString()===i.toDateString(),l=new Date(i);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 h=d+":"+(f<10?"0":"")+f+" "+p;if(o)return h;if(u)return t?t("chat.yesterday_time",{time:h}):"Yesterday "+h;var m=r.getMonth()+1,x=r.getDate();return m+"/"+x+" "+h}function ZU(e,t,n,r,i){if(!t||!e)return a.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 h=n+f,m=h===r;u.push(a.jsx("mark",{ref:function(x){i(h,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)),a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function sk(e,t,n,r,i,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return a.jsx(y.Fragment,{children:sk(k,t,n,r,i,o)},_)});if(typeof e=="string"){for(var l=e,u=l.toLowerCase(),d=t.toLowerCase(),f=[],p=0;;){var h=u.indexOf(d,p);if(h===-1)break;h>p&&f.push(l.substring(p,h));var m=n+r.current,x=m===i;f.push(a.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(h,h+t.length)},"m-"+r.current)),r.current++,p=h+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===Rf)return e;if(e.props&&e.props.children!==void 0){var v=sk(e.props.children,t,n,r,i,o);return y.cloneElement(e,void 0,v)}}return e}function JU({sessionID:e,banners:t,hidden:n,onToggle:r}){var[i,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 a.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[i]||t[0],f=function(){o(function(h){return Math.min(t.length-1,h+1)})},p=function(){o(function(h){return Math.max(0,h-1)})};return a.jsxs(a.Fragment,{children:[a.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:a.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:[a.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?a.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:a.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),f()},disabled:i>=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:"‹"}),a.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),p()},disabled:i<=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:"›"}),a.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:i+1+" / "+t.length})]}):null]})}),l?a.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:[a.jsxs("div",{className:"max-w-5xl w-full",onClick:function(h){h.stopPropagation()},children:[a.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?a.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,a.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(i+1)+" of "+t.length:""]})]}),a.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 eq=y.forwardRef(function({messages:t,unloadedCompactedCount:n,onExpandCompactedHistory:r,hasOlderMessages:i,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:p,compactionResult:h,onSwitchToCompactedSession:m,onDismissCompactionResult:x,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:w,onRetry:S,onEditAndResend:N,onCancelQueued:j,hideToolBubbles:R,mobileFrameless:T,hideThinking:I,sessionID:M,banners:L,bannerHidden:A,onToggleBanner:D,privateMessageIds:$,parentSessionID:ee,onViewParentSession:U,compactionPinned:G,onUnpinCompaction:Z,questionIdMap:z,onQuoteAdd:q},ae){const{t:P}=Zt();var Q=y.useRef(null),J=y.useRef(!0),F=y.useRef({}),K=y.useRef(null),W=y.useRef(null),[H,se]=y.useState(!1),ie=y.useRef(-1),ge=y.useRef(0),we=y.useRef(null),Ke=y.useRef(null),xt=y.useRef(t.length);xt.current=t.length;var[et,vt]=y.useState(!1),lt=y.useRef({startIndex:0,endIndex:0}),je=y.useRef(null),Oe=y.useRef(!1),ft=y.useRef(0),Ct=y.useRef(null);y.useEffect(function(){vt(!1),Ct.current=null},[M]);var rn=y.useCallback(function(){J.current=!0,W.current?W.current.scrollTop=W.current.scrollHeight:Q.current&&Q.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);y.useImperativeHandle(ae,function(){return{scrollToBottom:rn,resetAutoScroll:function(){J.current=!0}}},[rn]);var tn=y.useCallback(function(Pe,ze){ze?F.current[Pe]=ze:delete F.current[Pe]},[]),un=y.useRef({}),mt=y.useMemo(function(){if(!k)return{perMessage:{},total:0,_nextCache:{}};for(var Pe=k.toLowerCase(),ze=0,We={},Qe={},st=un.current,Ne=0;Ne<t.length;Ne++){var Ve=t[Ne],oe=gU(Ve.parts,u[Ve.info.id],I),bn=Ve.info.role==="assistant",tr=bn?mU(oe):oe,Le=tr.toLowerCase(),kt=Ve.info.id,vn=st[kt],ar;vn&&vn.text===Le&&vn.query===Pe?ar=vn.count:ar=tq(Le,Pe),Qe[kt]={text:Le,query:Pe,count:ar},ar>0&&(We[Ve.info.id]={offset:ze,count:ar,messageIndex:Ne}),ze+=ar}return{perMessage:We,total:ze,_nextCache:Qe}},[t,u,k,I]);y.useEffect(function(){un.current=mt._nextCache},[mt]);var $t=y.useMemo(function(){return{perMessage:mt.perMessage,total:mt.total}},[mt]);y.useEffect(function(){w&&w($t.total)},[$t.total,w]);var nt=y.useMemo(function(){for(var Pe=0,ze=0;ze<t.length;ze++)t[ze].info.compactedOut===!0&&Pe++;return Pe},[t]),qe=y.useMemo(function(){return et||nt===0?t:t.filter(function(Pe){return Pe.info.compactedOut!==!0})},[t,et,nt]),ue=y.useRef(qe.length);ue.current=qe.length,y.useEffect(function(){if(!(!k||$t.total===0||et||nt===0)){var Pe=$t.perMessage;for(var ze in Pe)if(Pe.hasOwnProperty(ze)&&Pe[ze].messageIndex<nt){vt(!0);break}}},[k,$t,et,nt]),y.useLayoutEffect(function(){if(je.current!=null&&Q.current){var Pe=je.current;if(je.current=null,Pe<0||Pe>=qe.length)return;var ze=requestAnimationFrame(function(){Q.current&&Q.current.scrollToIndex({index:Pe,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(ze)}}},[qe]),y.useLayoutEffect(function(){var Pe=Ct.current;if(!(!Pe||qe.length<=Pe.count||!Q.current)){Ct.current=null;var ze=Pe.index+(qe.length-Pe.count),We=requestAnimationFrame(function(){Q.current&&Q.current.scrollToIndex({index:ze,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(We)}}},[qe]);var me=y.useCallback(function(){!l||o||(Oe.current=!0,Ct.current={index:lt.current.startIndex,count:qe.length},Promise.resolve(l()).then(function(Pe){setTimeout(function(){var ze=Ct.current;(!Pe||Pe.length===0||ze&&ue.current<=ze.count)&&(Ct.current=null)},0)},function(){Ct.current=null}))},[l,o,qe.length]),Ue=y.useCallback(function(){if(Oe.current=!0,et){je.current=0,vt(!1);return}nt>0?(je.current=lt.current.startIndex+nt,vt(!0)):n>0&&r&&(je.current=lt.current.startIndex+n,vt(!0),r())},[et,nt,n,r]);y.useEffect(function(){var Pe=qe.length>ft.current;if(ft.current=qe.length,!Pe||!J.current||Oe.current){Oe.current=!1;return}var ze=setTimeout(function(){J.current&&W.current&&(W.current.scrollTop=W.current.scrollHeight)},150);return function(){clearTimeout(ze)}},[qe.length]),y.useEffect(function(){!J.current||k||W.current&&(W.current.scrollTop=W.current.scrollHeight)},[u,t,k]),y.useEffect(function(){var Pe=we.current!==M;we.current=M,Pe&&(J.current=!0,ie.current=-1,ft.current=0,ge.current=Date.now()+600,se(!1));function ze(){J.current&&W.current&&(W.current.scrollTop=W.current.scrollHeight)}var We=requestAnimationFrame(ze),Qe=setTimeout(ze,150),st=setTimeout(ze,450);return function(){cancelAnimationFrame(We),clearTimeout(Qe),clearTimeout(st)}},[M,t]);var He=y.useCallback(function(){var Pe=W.current;if(Pe){var ze=Pe.scrollTop,We=ze+Pe.clientHeight>=Pe.scrollHeight-4;We?J.current=!0:ie.current>=0&&ze<ie.current-8&&Date.now()>ge.current&&(J.current=!1),ie.current=ze,se(!We&&!J.current&&xt.current>0)}},[]),be=y.useCallback(function(Pe){!Pe||Ke.current===Pe||(Ke.current&&Ke.current.removeEventListener("scroll",He),Ke.current=Pe,Pe.addEventListener("scroll",He,{passive:!0}))},[He]);y.useEffect(function(){return function(){Ke.current&&Ke.current.removeEventListener("scroll",He)}},[He]);var Ye=y.useMemo(function(){if(!k||$t.total===0)return[];var Pe=[],ze=$t.perMessage;for(var We in ze)ze.hasOwnProperty(We)&&Pe.push(ze[We]);return Pe.sort(function(Qe,st){return Qe.messageIndex-st.messageIndex}),Pe},[k,$t]);y.useEffect(function(){if(!(!k||$t.total===0||_<0)){for(var Pe=-1,ze=0;ze<Ye.length;ze++){var We=Ye[ze];if(_>=We.offset&&_<We.offset+We.count){Pe=We.messageIndex;break}}if(!(Pe<0)){var Qe=et||nt===0?0:nt,st=Pe-Qe;if(!(st<0)){Q.current&&Q.current.scrollToIndex({index:st,align:"center",behavior:"smooth"});var Ne=requestAnimationFrame(function(){var Ve=setTimeout(function(){var oe=F.current[_];oe&&oe.scrollIntoView&&oe.scrollIntoView({behavior:"smooth",block:"center"})},200);K.current=Ve});return function(){cancelAnimationFrame(Ne),K.current&&(clearTimeout(K.current),K.current=null)}}}}},[_,k,$t.total,Ye,et,nt]),y.useEffect(function(){F.current={}},[k]);for(var _t=-1,jt=qe.length-1;jt>=0;jt--)if(qe[jt].info.role==="assistant"){_t=jt;break}var Wt=y.useCallback(function(Pe){return k?!1:Pe?f?"auto":"smooth":!1},[k,f]),hn=y.useCallback(function(Pe){Pe&&(J.current=!0),se(!Pe&&!J.current&&xt.current>0)},[]),xe=y.useMemo(function(){return et&&nt>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[et,nt]),ke=y.useCallback(function(Pe,ze){var We=$t.perMessage[ze.info.id]||null,Qe=Pe===_t,st=ze.info.role==="user",Ne=ze.info.compactedOut===!0,Ve=et&&Pe>0&&t[Pe-1].info.compactedOut===!0,oe=Ve&&!Ne;return a.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[oe?a.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[a.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:P&&P("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),a.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,a.jsx(YU,{isCompactedOut:Ne,message:ze.info,parts:ze.parts,streamingParts:u[ze.info.id],user:v,searchQuery:k,matchOffset:We?We.offset:-1,matchCount:We?We.count:0,activeMatchIndex:_,registerMatchRef:tn,isLast:Qe,isBusy:f,sessionID:M,onRetry:Qe&&!f&&!Ne?S:void 0,onEditAndResend:st&&!f&&!Ne&&!rq(ze.parts)?N:void 0,onCancelQueued:Ne?void 0:j,hideToolBubbles:R,mobileFrameless:T,hideThinking:I,isPrivate:$&&$.has(ze.info.id),questionIdMap:z,onQuoteAdd:q})]})},[$t,_t,t,u,v,k,_,tn,f,M,S,N,j,R,T,I,$,z,q,et,P]),Ae=y.useMemo(function(){return a.jsxs(a.Fragment,{children:[f&&(T?!0:!nq(t,u,R,I))&&(T?a.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:a.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":P("chat.assistant_typing")||"Assistant is typing",children:a.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):a.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:[a.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:a.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),a.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!T&&d&&d.toolCalls>0&&a.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:[a.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:a.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.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"})]})}),a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:iq(d.toolNames,P)}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:aq(d.toolArgBytes)})]}),a.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:a.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,T,t,u,d,R,I,P]),Fe=y.useMemo(function(){return function(){return a.jsxs(a.Fragment,{children:[a.jsx(JU,{sessionID:M,banners:L,hidden:A,onToggle:D}),a.jsx(oq,{sessionID:M,parentSessionID:ee,onViewParentSession:U,compactionPinned:G,onUnpinCompaction:Z,t:P}),i?a.jsx("div",{className:"flex justify-center py-1.5",children:a.jsx("button",{type:"button",onClick:me,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?P&&P("messages.loading_earlier")||"Loading earlier messages...":P&&P("messages.load_earlier")||"Load earlier messages"})}):null,nt>0||n>0?a.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:a.jsx("button",{type:"button",onClick:Ue,"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:et&&nt>0?P&&P("compaction.hide_history")||"Hide messages before compaction":P&&P("compaction.show_history",{count:nt>0?nt:n})||"Conversation summarized — "+(nt>0?nt:n)+" earlier messages collapsed; summary below"})}):null]})}},[M,L,A,D,ee,U,G,Z,P,i,o,me,nt,n,et,Ue]),yt=y.useRef(Ae);yt.current=Ae;var pt=y.useRef(null);pt.current||(pt.current={version:0,listeners:new Set});var Ht=pt.current;y.useEffect(function(){Ht.version+=1,Ht.listeners.forEach(function(Pe){Pe()})},[Ae,Ht]);var te=y.useMemo(function(){return function(){return y.useSyncExternalStore(function(ze){return Ht.listeners.add(ze),function(){Ht.listeners.delete(ze)}},function(){return Ht.version}),yt.current}},[]),Ee=y.useMemo(function(){return{Header:Fe,Footer:te}},[Fe,te]),Je=qe.length===0&&(nt>0||n>0),Dt=nt>0?nt:n;return Je?a.jsx("div",{className:"flex-1 relative overflow-hidden",children:a.jsx(sq,{count:Dt,onExpand:Ue,t:P})}):a.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[a.jsx(H4,{ref:Q,scrollerRef:function(Pe){W.current=Pe,Pe&&be(Pe)},data:qe,itemContent:ke,followOutput:Wt,atBottomStateChange:hn,rangeChanged:function(Pe){lt.current=Pe},increaseViewportBy:xe,defaultItemHeight:120,computeItemKey:function(Pe,ze){return ze.info.id},components:Ee,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),H&&a.jsx("button",{onClick:rn,"aria-label":P("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:P("chat.scroll_to_bottom"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function tq(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 nq(e,t,n,r){var i=!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}),h=(f.parts||[]).some(function(m){return m.type==="tool"});return p||i&&h}if(f.info.role==="user")break}return!1}function rq(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function iq(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],i=n[r]||(t?t("chat.tool_preparing_name",{name:r}):"Preparing "+r);return e.length>1&&(i+=" +"+(e.length-1)),i}function aq(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function sq({count:e,onExpand:t,t:n}){return a.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:a.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[a.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:a.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:a.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"})})}),a.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"}),a.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."}),a.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 oq({sessionID:e,parentSessionID:t,onViewParentSession:n,compactionPinned:r,onUnpinCompaction:i,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(),h=y.useState(!p),m=h[0],x=h[1];return!t||m?null:a.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:a.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[a.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:a.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"})}),a.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."}),a.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?a.jsx("button",{type:"button",onClick:function(){i&&i(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,a.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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const hp=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],R5=["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"],A5=[...hp,...R5],Gf=5,tS=Math.floor(4*1024*1024/1.34),nS=5*1024*1024,rS=6*1024*1024,iS=Math.floor(4*1024*1024/1.34),lq=A5.join(",");function Mg(e){return e?hp.indexOf(e.toLowerCase())!==-1:!1}var Lg,aS;function cq(){if(aS)return Lg;aS=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 i=(this._start+this._length)%this._capacity,o=Math.min(r,this._capacity-i);this._buffer.set(n.subarray(0,o),i),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 i=Math.min(r,this._length-n),o=new Float32Array(i),l=(this._start+n)%this._capacity,u=Math.min(i,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<i&&o.set(this._buffer.subarray(0,i-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 Lg={AudioRingBuffer:e},Lg}var uq=cq(),Og,sS;function dq(){if(sS)return Og;sS=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 i=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<i?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 i=this._slotIndex===0,o=n.totalAppended-n.length,l=i?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 h="";this._prevText.length>0&&(h=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio:p,overlapSamples:l,slotIndex:this._slotIndex,initialPrompt:h,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=u,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,m}}return Og={TranscriptionScheduler:e},Og}var fq=dq(),Dg,oS;function pq(){if(oS)return Dg;oS=1;function e(n,r){const i=n.length,o=r.length;if(i===0)return o;if(o===0)return i;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<=i;d++){u[0]=d;for(let p=1;p<=o;p++){const h=n[d-1]===r[p-1]?0:1;u[p]=Math.min(u[p-1]+1,l[p]+1,l[p-1]+h)}const f=l;l=u,u=f}return l[o]}function t(n,r,i){if(!n)return r||"";if(!r)return"";const o=i&&i.maxOverlapChars||50,l=i&&typeof i.maxEditRatio=="number"?i.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 Dg={dedupOverlap:t,levenshtein:e},Dg}var hq=pq(),Pg,lS;function gq(){if(lS)return Pg;lS=1;function e(n){return!!n&&n.isLocalWhisper===!0&&n.whisperUrlValid===!0}function t(n){const r=n||{},i=r.mode||"auto";return r.streaming&&r.streaming.wsUrl?{kind:"streaming",whisperUrlDefault:!1,backend:!1,local:!1,eagerWorker:!1,reportWorkerCrash:!1}:i==="local-only"?{kind:"local",whisperUrlDefault:!1,backend:!1,local:!0,eagerWorker:!0,reportWorkerCrash:!0}:i==="backend-only"?{kind:"backend",whisperUrlDefault:!1,backend:!0,local:!1,eagerWorker:!1,reportWorkerCrash:!1}:e(r)?{kind:"whisper-url",whisperUrlDefault:!0,backend:!0,local:!0,eagerWorker:!1,reportWorkerCrash:!1}:r.backendAvailable?{kind:"backend",whisperUrlDefault:!1,backend:!0,local:!0,eagerWorker:!1,reportWorkerCrash:!1}:{kind:"local",whisperUrlDefault:!1,backend:!1,local:!0,eagerWorker:!0,reportWorkerCrash:!0}}return Pg={selectTranscriptionPath:t},Pg}var cS=gq();const Rl=16e3;function mf(e,t,n,r){try{const i=localStorage.getItem(e);if(i==null||i==="")return t;const o=Number(i);return Number.isFinite(o)?Math.min(r,Math.max(n,o)):t}catch{return t}}const mq=2,xq=.6,yq=1,bq=200,uS=3,Fg=2,vq=1e3,dS=.01,fS=800;function pS(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 kq(e,t){const n=e.sampleRate,r=e.getChannelData(0);if(n===t)return new Float32Array(r);const i=n/t,o=Math.round(r.length/i),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*i,f=Math.floor(d),p=Math.min(f+1,r.length-1),h=d-f;l[u]=r[f]*(1-h)+r[p]*h}return l}function _q(e,t){const i=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,i,!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 h=Math.max(-1,Math.min(1,e[p]));d.setInt16(f,h<0?h*32768:h*32767,!0),f+=2}return new Blob([u],{type:"audio/wav"})}function wq({onTranscript:e,onError:t,onAutoSubmit:n,language:r,model:i}){const[o,l]=y.useState("idle"),[u,d]=y.useState(0),[f,p]=y.useState(null),[h,m]=y.useState(null),[x,v]=y.useState(""),k=y.useRef(null),_=y.useRef(null),w=y.useRef(null),S=y.useRef(null),N=y.useRef(!1),j=y.useRef(null),R=y.useRef(null),T=y.useRef(null),I=y.useRef(null),M=y.useRef(null),L=y.useRef(null),A=y.useRef(0),D=y.useRef(!1),$=y.useRef(""),ee=y.useRef(!1),U=y.useRef(null),G=y.useRef(fS),Z=y.useRef(null),z=y.useRef(!1),q=y.useRef(""),ae=y.useRef(""),P=y.useRef("idle"),Q=y.useCallback(nt=>{P.current=nt,l(nt)},[]),J=y.useRef(e),F=y.useRef(t),K=y.useRef(n),W=y.useRef({language:r,model:i}),H=y.useRef({language:r,model:i}),se=y.useRef(null),ie=y.useRef(null);y.useEffect(()=>{J.current=e},[e]),y.useEffect(()=>{F.current=t},[t]),y.useEffect(()=>{K.current=n},[n]),y.useEffect(()=>{W.current={language:r,model:i}},[r,i]),y.useEffect(()=>{I.current&&(P.current==="recording"||P.current==="paused")&&I.current.clearPrevText()},[r]);const ge=y.useCallback(()=>M.current?Promise.resolve(M.current):(L.current||(L.current=Of().then(nt=>(M.current=nt,nt)).catch(()=>{const nt={mode:"auto",backendAvailable:!1};return M.current=nt,nt})),L.current),[]);y.useEffect(()=>{ge()},[ge]);const we=y.useCallback(()=>{if(j.current&&(j.current.getTracks().forEach(nt=>nt.stop()),j.current=null),Z.current){try{Z.current.readyState===WebSocket.OPEN&&Z.current.send("Done"),Z.current.close()}catch{}Z.current=null}z.current=!1},[]),Ke=y.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),xt=y.useCallback(()=>{const nt=w.current,qe=_.current,ue=S.current;if(nt){try{nt.disconnect()}catch{}nt.onaudioprocess=null,w.current=null}if(qe){try{qe.disconnect()}catch{}_.current=null}if(ue){try{ue.disconnect()}catch{}S.current=null}N.current=!1,we(),R.current&&R.current.state!=="closed"&&(R.current.close().catch(()=>{}),R.current=null),Ke(),T.current&&T.current.clear(),I.current&&I.current.reset(),A.current=0},[we,Ke]),et=y.useRef(null),vt=y.useRef(null),lt=y.useRef(null),je=y.useRef(null),Oe=y.useRef(null),ft=y.useRef(null);et.current=function(qe){const ue=qe&&qe.text||"";qe&&qe.chunkId;const me=I.current,Ue=qe&&qe._silent;me&&me.reportResult(ue);const He=hq.dedupOverlap($.current,ue);if(He){const be=$.current+He;$.current=be,v(be),J.current&&J.current(He)}if(A.current=0,(Ue||ue.trim()==="")&&$.current.trim()&&K.current&&K.current(),P.current==="draining"&&me&&!me.inflight){const be=T.current,Ye=me.drain(be);Ye?je.current(Ye):ft.current();return}lt.current()},vt.current=function(qe){const ue=I.current;if(ue&&ue.reportResult(""),A.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",qe,"("+A.current+"/"+uS+")"),A.current>=uS){xt(),Q("idle"),F.current&&F.current("Voice transcription failed repeatedly. Please try again.");return}if(P.current==="draining"&&ue&&!ue.inflight){ft.current();return}lt.current()},lt.current=function(){const qe=I.current,ue=T.current;if(!qe||!ue)return;const me=P.current;if(me!=="recording"&&me!=="paused"&&me!=="draining")return;const Ue=qe.appendAndSchedule(ue);if(Ue){je.current(Ue);return}if((me==="paused"||me==="draining")&&!qe.inflight){const He=qe.drain(ue);He?je.current(He):me==="draining"&&ft.current()}},je.current=async function(qe){const ue=pS(qe.audio);if(ue<dS){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+ue.toFixed(6)+")"),et.current({text:"",chunkId:qe.chunkId,_silent:!0});return}const me=M.current||{mode:"auto",backendAvailable:!1},Ue=cS.selectTranscriptionPath(me);se.current=Ue;const He=(me.backendAvailable||Ue.whisperUrlDefault)&&me.mode!=="local-only",be=me.mode!=="backend-only",Ye=H.current.language,_t=H.current.model;if(He&&!D.current){const hn=_q(qe.audio,Rl),xe={};qe.initialPrompt&&(xe.initialPrompt=qe.initialPrompt);let ke=null;for(let Ae=0;Ae<=Fg;Ae++)try{const Fe=await BO(hn,Ye,_t,xe);if(typeof Fe.text=="string"){m("backend"),et.current({text:Fe.text,chunkId:qe.chunkId});return}}catch(Fe){ie.current=Fe&&Fe.message?Fe.message:String(Fe),ke=Fe;const yt=Fe.status;if((yt===429||yt===503)&&Ae<Fg){const pt=vq*2**Ae;console.warn("[useContinuousVoiceInput] Backend "+yt+", retrying in "+pt+"ms (attempt "+(Ae+1)+"/"+Fg+")"),await new Promise(Ht=>{setTimeout(Ht,pt)});continue}(yt===429||yt===503)&&(D.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!be){vt.current(ke?ke.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",ke?ke.message:"unknown")}if(!be){vt.current("Backend transcription is not available and local mode is disabled.");return}const jt=Oe.current();m("local");const Wt={type:"transcribe",audio:qe.audio};Ye&&(Wt.language=Ye),qe.initialPrompt&&(Wt.initialPrompt=qe.initialPrompt),qe.chunkId&&(Wt.chunkId=qe.chunkId),jt.postMessage(Wt,[qe.audio.buffer])},Oe.current=function(){if(k.current)return k.current;const qe=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return qe.onmessage=ue=>{const me=ue.data;if(me)switch(me.type){case"loading":d(me.progress||0),p(me.file?me.file.split("/").pop():null);break;case"ready":P.current==="loading"&&Q("recording"),d(100),p(null);break;case"result":et.current(me);break;case"error":vt.current(me.error||"Transcription failed");break}},qe.onerror=()=>{const ue=I.current;ue&&ue.reportResult(""),A.current+=1,Ke();const me=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});me.onmessage=Ue=>{const He=Ue.data;if(He)switch(He.type){case"loading":d(He.progress||0),p(He.file?He.file.split("/").pop():null);break;case"ready":P.current==="loading"&&Q("recording"),d(100),p(null),lt.current();break;case"result":et.current(He);break;case"error":vt.current(He.error||"Transcription failed");break}},me.onerror=()=>{if(me.terminate(),k.current=null,xt(),Q("idle"),$.current="",v(""),F.current){const Ue=se.current;Ue&&Ue.reportWorkerCrash===!1&&ie.current?F.current("Voice transcription failed: "+ie.current):F.current("Voice transcription worker crashed.")}},k.current=me},k.current=qe,qe},ft.current=function(){const qe=k.current;qe&&qe.postMessage({type:"unload"}),R.current&&R.current.state!=="closed"&&(R.current.close().catch(()=>{}),R.current=null),I.current&&I.current.reset(),T.current&&T.current.clear(),Q("idle")};const Ct=y.useCallback(async()=>{if(P.current==="idle"){if(H.current={...W.current},!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){F.current&&F.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){F.current&&F.current("Audio recording is not supported in this browser.");return}try{const nt=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:Rl,echoCancellation:!0,noiseSuppression:!0}});j.current=nt,M.current=null,L.current=null;const qe=await ge(),ue=cS.selectTranscriptionPath(qe);se.current=ue;const me=!!(qe.streaming&&qe.streaming.wsUrl),Ue=!me&&(qe.mode==="local-only"||!qe.backendAvailable&&!ue.whisperUrlDefault&&qe.mode!=="backend-only"),He=window.AudioContext||window.webkitAudioContext;(!R.current||R.current.state==="closed")&&(R.current=new He);const be=R.current;if(T.current=new uq.AudioRingBuffer({maxDuration:30,sampleRate:Rl}),I.current=new fq.TranscriptionScheduler({chunkDuration:mf("pave.asr.chunkDuration",mq,.5,30),overlapDuration:mf("pave.asr.overlapDuration",xq,0,10),minChunkDuration:mf("pave.asr.minChunkDuration",yq,.3,15),sampleRate:Rl,maxInitialPrompt:bq}),$.current="",v(""),A.current=0,D.current=!1,ee.current=!1,U.current=null,G.current=mf("pave.asr.vadSilenceMs",fS,200,5e3),q.current="",ae.current="",z.current=me,me){const hn=(xe,ke)=>{if(!xe)return ke;if(!ke)return xe;const Ae=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(ke),Fe=/\s$/.test(xe)||Ae?"":" ";return xe+Fe+ke};try{const xe=new WebSocket(qe.streaming.wsUrl);xe.binaryType="arraybuffer",Z.current=xe,xe.onmessage=ke=>{let Ae="";try{Ae=typeof ke.data=="string"?ke.data:new TextDecoder().decode(ke.data)}catch{return}if(Ae==="Done!")return;let Fe="",yt=!1;try{const Ht=JSON.parse(Ae);Fe=Ht&&typeof Ht.text=="string"?Ht.text:"",yt=!!(Ht&&Ht.is_final)}catch{Fe=Ae}Fe=(Fe||"").trim();const pt=hn(q.current,Fe);pt&&pt!==ae.current&&(ae.current=pt,$.current=pt,v(pt),m("streaming"),J.current&&J.current(pt,{mode:"snapshot",engine:qe.streaming&&qe.streaming.engine||"paraformer"})),yt&&Fe&&(K.current?(q.current="",ae.current="",$.current="",v(""),K.current()):q.current=hn(q.current,Fe))},xe.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(xe){console.warn("[useContinuousVoiceInput] streaming connect failed:",xe),z.current=!1}}const Ye=be.createMediaStreamSource(nt),jt=be.createScriptProcessor(4096,1,1),Wt=be.createGain();Wt.gain.value=0,Ye.connect(jt),jt.connect(Wt),Wt.connect(be.destination),_.current=Ye,w.current=jt,S.current=Wt,N.current=!1,jt.onaudioprocess=hn=>{if(N.current)return;const xe=hn.inputBuffer,ke=xe.sampleRate,Ae=xe.getChannelData(0);let Fe;if(ke===Rl?Fe=new Float32Array(Ae):Fe=kq({sampleRate:ke,getChannelData:()=>Ae},Rl),Fe.length===0)return;if(z.current&&Z.current&&Z.current.readyState===WebSocket.OPEN){const te=new Float32Array(Fe.length);te.set(Fe),Z.current.send(te.buffer);return}const yt=T.current;yt&&yt.append(Fe);const pt=pS(Fe),Ht=performance.now();if(pt>=dS)ee.current=!0,U.current=null;else if(ee.current){if(!U.current)U.current=Ht;else if(Ht-U.current>=G.current){ee.current=!1,U.current=null;const te=I.current;if(te&&!te.inflight&&yt){const Ee=te.drain(yt);Ee&&je.current(Ee)}}}lt.current()},Ue?(Q("loading"),d(0),Oe.current().postMessage({type:"load"})):(Q("recording"),d(100))}catch(nt){we(),Q("idle");const qe=nt.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(nt.message||String(nt));F.current&&F.current(qe)}}},[ge,we]),rn=y.useCallback(()=>{const nt=P.current;if(nt==="loading"){xt(),Ke(),Q("idle");return}if(nt!=="recording"&&nt!=="paused")return;const qe=w.current,ue=_.current,me=S.current;if(qe){try{qe.disconnect()}catch{}qe.onaudioprocess=null,w.current=null}if(ue){try{ue.disconnect()}catch{}_.current=null}if(me){try{me.disconnect()}catch{}S.current=null}we(),Q("draining"),setTimeout(()=>{const Ue=I.current,He=T.current;if(!Ue||!He){ft.current();return}if(!Ue.inflight){const be=Ue.drain(He);be?je.current(be):ft.current()}},0)},[we,xt,Ke]),tn=y.useCallback(()=>{P.current==="recording"&&(N.current=!0,Q("paused"),lt.current())},[]),un=y.useCallback(()=>{P.current==="paused"&&(N.current=!1,Q("recording"))},[]),mt=y.useCallback(()=>{P.current!=="idle"&&(xt(),Ke(),$.current="",v(""),Q("idle"))},[xt,Ke]),$t=y.useCallback(()=>{if(P.current!=="idle"){F.current&&F.current("Cannot clear cache while recording.");return}Q("loading"),d(0),Ke(),Oe.current().postMessage({type:"clearCache"})},[Ke]);return y.useEffect(()=>()=>{xt(),Ke()},[xt,Ke]),{state:o,progress:u,downloadingFile:f,transcriptionSource:h,transcriptText:x,startRecording:Ct,stopRecording:rn,pauseRecording:tn,resumeRecording:un,cancelRecording:mt,clearModelCache:$t}}function Sq({skills:e,builtins:t,filter:n,onSelect:r,visible:i,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=Zt(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,n,e.length]),!i)return null;const h=(n||"").trim().toLowerCase();let m=[],x=!1;if(l){x=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>h?(_.skill||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h)||(_.commands||[]).some(w=>(w.name||"").toLowerCase().includes(h)||(w.description||"").toLowerCase().includes(h)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return a.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:[a.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&&a.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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),a.jsx("span",{className:"flex-1 text-right",children:x?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),a.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?a.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,w="slash-item-"+k;return a.jsx("div",{id:w,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"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"font-medium",children:["/",v.name]}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?a.jsxs(a.Fragment,{children:[a.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()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&a.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),a.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")]}),a.jsx("svg",{className:"w-4 h-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:a.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:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),a.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:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}function Eq({quotes:e,onRemove:t,onClearAll:n}){var{t:r}=Zt();function i(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-ik.length)===ik}return!Array.isArray(e)||e.length===0?null:a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r("chat.quote_selection")}),a.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 a.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:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[11px] font-medium text-gray-500 dark:text-gray-400 truncate",children:i(u)}),a.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)})]}),a.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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},u.qid)})]})}const Af=[{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 Nq(){return Af.slice()}function Cq(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Af.length;n++)if(Af[n].name===t)return Af[n];return null}function jq(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(),i=Cq(r);if(!i)return null;const o=(n[2]||"").trim();return{name:r,args:o,builtin:i}}const Tq=y.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:i,sessionId:o,queuedCount:l=0,onBuiltinCommand:u,pendingQuotes:d=[],onRemoveQuote:f,onClearQuotes:p,planModeEnabled:h=!1},m){const{t:x}=Zt(),[v,k]=y.useState(""),[_,w]=y.useState([]),[S,N]=y.useState(!1);y.useEffect(()=>{const xe=()=>N(!1);return window.addEventListener("pave:plan-execute",xe),()=>window.removeEventListener("pave:plan-execute",xe)},[]),y.useEffect(()=>{h||N(!1)},[h]);const[j,R]=y.useState(null),T="pave-asr-language",I="pave-asr-model",M=(xe,ke)=>{try{return localStorage.getItem(xe)||ke}catch{return ke}},[L]=y.useState(()=>M(T,"auto")),[A,D]=y.useState(()=>M(I,"")),$=y.useRef(_),ee=y.useRef(null),U=y.useRef(null),G=y.useRef(null),Z=y.useRef(o),z=y.useRef(v),q=y.useRef(null),[ae,P]=y.useState(!1),[Q,J]=y.useState(""),[F,K]=y.useState([]),[W,H]=y.useState(0),[se,ie]=y.useState(null),ge=y.useRef({data:null,time:0}),we=6e4,Ke=y.useCallback(xe=>{R(xe),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>R(null),5e3)},[]);y.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]),y.useLayoutEffect(()=>{z.current=v},[v]),y.useLayoutEffect(()=>{Z.current=o,G.current&&(clearTimeout(G.current),G.current=null);let xe="";if(o)try{xe=localStorage.getItem(ro+o)||""}catch{}return k(xe),z.current=xe,w(ke=>(ke.forEach(Ae=>{Ae.preview&&URL.revokeObjectURL(Ae.preview)}),[])),()=>{G.current&&(clearTimeout(G.current),G.current=null);const ke=Z.current;if(ke)try{z.current?localStorage.setItem(ro+ke,z.current):localStorage.removeItem(ro+ke)}catch{}}},[o]),y.useEffect(()=>{Z.current&&(G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{try{v?localStorage.setItem(ro+Z.current,v):localStorage.removeItem(ro+Z.current)}catch{}},300))},[v]);const xt=y.useCallback(async()=>{const xe=ge.current;if(xe.data&&Date.now()-xe.time<we){K(xe.data);return}try{const ke=await yO(),Ae=Array.isArray(ke)?ke:[];ge.current={data:Ae,time:Date.now()},K(Ae)}catch{K([])}},[]),et=y.useMemo(()=>Nq(),[]),vt=y.useMemo(()=>{const xe=(Q||"").trim().toLowerCase();if(se){const Fe=F.find(pt=>pt.skill===se);return(Fe&&Fe.commands||[]).filter(pt=>xe?(pt.name||"").toLowerCase().includes(xe)||(pt.description||"").toLowerCase().includes(xe):!0).map(pt=>({type:"command",skill:se,name:pt.name}))}const ke=et.filter(Fe=>xe?(Fe.name||"").toLowerCase().includes(xe)||(Fe.description||"").toLowerCase().includes(xe):!0).map(Fe=>({type:"builtin",name:Fe.name})),Ae=F.filter(Fe=>xe?(Fe.skill||"").toLowerCase().includes(xe)||(Fe.description||"").toLowerCase().includes(xe)||(Fe.commands||[]).some(yt=>(yt.name||"").toLowerCase().includes(xe)||(yt.description||"").toLowerCase().includes(xe)):!0).map(Fe=>({type:"skill",skill:Fe.skill}));return ke.concat(Ae)},[Q,se,F,et]),lt=y.useCallback(()=>vt.length,[vt]),je=y.useCallback(xe=>{if(k(xe),z.current=xe,xe.startsWith("/")){const ke=xe.slice(1),Ae=ke.split(/\s/)[0]||"";if(!Ae.includes("/")&&!Ae.includes(".")){if(se){const Fe=se+" ";ke.startsWith(Fe)?(J(ke.slice(Fe.length)),H(0)):(ie(null),J(ke),H(0))}else J(ke),H(0);ae||(xt(),P(!0),H(0))}else P(!1),J(""),ie(null),H(0)}else P(!1),J(""),ie(null),H(0)},[ae,se,xt]),Oe=y.useCallback((xe,ke)=>{var Ae,Fe,yt;if(xe==="__builtin__"&&ke){k("/"+ke+" "),P(!1),J(""),ie(null),H(0),(Ae=ee.current)==null||Ae.focus();return}if(!ke)ie(xe),J(""),H(0),k("/"+xe+" "),(Fe=ee.current)==null||Fe.focus();else{const pt="/"+xe+" "+ke+" ";k(pt),P(!1),J(""),ie(null),H(0),(yt=ee.current)==null||yt.focus()}},[]),ft=y.useCallback(()=>{var xe;ie(null),J(""),H(0),k("/"),(xe=ee.current)==null||xe.focus()},[]),Ct=y.useRef(""),rn=y.useCallback((xe,ke)=>{if(ke&&ke.mode==="snapshot"){const Ae=Ct.current||"",Fe=Ae&&!Ae.endsWith(" ")&&!Ae.endsWith(`
|
|
119
|
+
`)?" ":"";k(Ae+Fe+(xe||""));return}k(Ae=>{const Fe=Ae&&!Ae.endsWith(" ")&&!Ae.endsWith(`
|
|
120
|
+
`)?" ":"";return Ae+Fe+xe})},[]),tn=y.useRef(null),un=y.useCallback(()=>{Ct.current="",setTimeout(()=>{tn.current&&tn.current()},50)},[]),{state:mt,progress:$t,downloadingFile:nt,startRecording:qe,stopRecording:ue,resumeRecording:me,cancelRecording:Ue}=wq({onTranscript:rn,onError:Ke,onAutoSubmit:un,model:A||void 0,language:L&&L!=="auto"?L:void 0}),He=y.useCallback(()=>(k(xe=>(Ct.current=xe||"",xe)),qe()),[qe]);y.useEffect(()=>{try{A&&localStorage.setItem(I,A)}catch{}},[A]),y.useEffect(()=>{let xe=!1;return Of().then(ke=>{xe||ke&&Array.isArray(ke.models)&&ke.models.length>0&&D(Ae=>Ae||ke.models[0].name)}).catch(()=>{}),()=>{xe=!0}},[Of]),y.useEffect(()=>{const xe=ee.current;xe&&(xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px")},[v]),y.useEffect(()=>{$.current=_},[_]),y.useEffect(()=>{var xe;(xe=ee.current)==null||xe.focus()},[]),y.useImperativeHandle(m,()=>({focus:()=>{var xe;(xe=ee.current)==null||xe.focus()},setText:xe=>{k(typeof xe=="string"?xe:""),requestAnimationFrame(()=>{var ke;return(ke=ee.current)==null?void 0:ke.focus()})}}),[]);const be=async()=>{const xe=v.trim();var ke=_.filter(function(pt){return Mg(pt.type)}),Ae=_.filter(function(pt){return!Mg(pt.type)});const Fe=jq(xe);if(Fe&&typeof u=="function"){const pt=Z.current;try{await u(Fe.name,Fe.args,{imageAttachments:ke.length>0?ke:void 0,fileAttachments:Ae.length>0?Ae:void 0})}catch{return}if(k(""),P(!1),J(""),ie(null),H(0),pt)try{localStorage.removeItem(ro+pt)}catch{}_.forEach(function(Ht){Ht.preview&&URL.revokeObjectURL(Ht.preview)}),w([]),ee.current&&(ee.current.style.height="auto");return}if(!xe&&ke.length===0&&Ae.length===0&&d.length===0)return;const yt=Z.current;try{await t(xe,ke.length>0?ke:void 0,S&&h?"plan":void 0,Ae.length>0?Ae:void 0)}catch{return}if(k(""),P(!1),J(""),ie(null),H(0),yt)try{localStorage.removeItem(ro+yt)}catch{}_.forEach(function(pt){pt.preview&&URL.revokeObjectURL(pt.preview)}),w([]),ee.current&&(ee.current.style.height="auto")};tn.current=be;const Ye=xe=>{if(ae){const ke=lt();if(xe.key==="ArrowDown"){ke>0&&(xe.preventDefault(),H(Ae=>(Ae+1)%ke));return}if(xe.key==="ArrowUp"){ke>0&&(xe.preventDefault(),H(Ae=>(Ae-1+ke)%ke));return}if(xe.key==="Enter"||xe.key==="Tab"){if(ke>0){xe.preventDefault();const Ae=vt[W];Ae&&(Ae.type==="command"?Oe(Ae.skill,Ae.name):Ae.type==="builtin"?Oe("__builtin__",Ae.name):Oe(Ae.skill,null));return}if(xe.key==="Tab"){P(!1),J(""),ie(null),H(0);return}}if(xe.key==="Escape"){xe.preventDefault(),P(!1),J(""),ie(null),H(0);return}if(xe.key==="Backspace"&&se){const Ae=v.slice(1),Fe=se+" ";if(Ae===Fe||Ae===se){xe.preventDefault(),ft();return}}}xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),be())},_t=xe=>{if(!i){var ke=xe.clipboardData&&xe.clipboardData.items;if(ke){for(var Ae=[],Fe=0;Fe<ke.length;Fe++){var yt=(ke[Fe].type||"").toLowerCase();if(hp.indexOf(yt)!==-1){var pt=ke[Fe].getAsFile();pt&&Ae.push(pt)}}if(Ae.length!==0){for(var Ht=!1,te=0;te<ke.length;te++)if(ke[te].type&&ke[te].type.startsWith("text/")){Ht=!0;break}Ht||xe.preventDefault();var Ee=Ae.map(function(Je){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Je,name:Je.name||"pasted-image.png",size:Je.size,type:Je.type,preview:null}});w(function(Je){var Dt=Gf-Je.length;if(Dt<=0)return Je;for(var Pe=Ee.slice(0,Dt),ze=0;ze<Pe.length;ze++)Pe[ze].preview=URL.createObjectURL(Pe[ze].file);return Je.concat(Pe)})}}}},jt=xe=>{const ke=Array.from(xe.target.files||[]);if(ke.length===0)return;const Ae=ke.filter(yt=>A5.indexOf(yt.type)!==-1);if(Ae.length===0){xe.target.value="";return}const Fe=Ae.map(yt=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:yt,name:yt.name,size:yt.size,type:yt.type,preview:null}));w(yt=>{var pt=Gf-yt.length;if(pt<=0)return yt;for(var Ht=Fe.slice(0,pt),te=0;te<Ht.length;te++)Ht[te].preview=Mg(Ht[te].file.type)?URL.createObjectURL(Ht[te].file):null;return[...yt,...Ht]}),xe.target.value=""},Wt=xe=>{w(ke=>{const Ae=ke.find(Fe=>Fe.id===xe);return Ae!=null&&Ae.preview&&URL.revokeObjectURL(Ae.preview),ke.filter(Fe=>Fe.id!==xe)})},hn=xe=>xe<1024?xe+" B":xe<1024*1024?(xe/1024).toFixed(1)+" KB":(xe/(1024*1024)).toFixed(1)+" MB";return y.useEffect(()=>()=>{$.current.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview)})},[]),a.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:a.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[h&&S&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),a.jsx(Eq,{quotes:d,onRemove:f,onClearAll:p}),_.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:_.map(xe=>a.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:[xe.preview?a.jsx("img",{src:xe.preview,alt:xe.name,className:"w-10 h-10 rounded object-cover"}):a.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:xe.name}),a.jsx("p",{className:"text-xs text-gray-400",children:hn(xe.size)})]}),a.jsx("button",{onClick:()=>Wt(xe.id),"aria-label":`Remove attachment ${xe.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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},xe.id))}),a.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:[a.jsx(Sq,{skills:F,builtins:et,filter:Q,onSelect:Oe,visible:ae,selectedIndex:W,activeSkill:se,onBack:ft}),a.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[a.jsx("button",{onClick:()=>{var xe;return(xe=U.current)==null?void 0:xe.click()},disabled:i||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:x("chat.attach_file"),"aria-label":x("chat.attach_file"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),a.jsx("input",{ref:U,type:"file",multiple:!0,accept:lq,onChange:jt,className:"hidden"}),a.jsx("button",{onClick:mt==="recording"?ue:mt==="paused"?me:mt==="loading"?Ue:He,disabled:mt==="draining"||(i||r)&&mt!=="recording"&&mt!=="loading"&&mt!=="paused",className:"shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(mt==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":mt==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":mt==="loading"||mt==="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:mt==="recording"?x("voice.stop_recording")||"Stop recording":mt==="paused"?x("voice.resume_recording")||"Resume recording":mt==="loading"?x("voice.loading_model"):mt==="draining"?x("voice.processing")||"Processing remaining audio":x("voice.start_recording"),"aria-label":mt==="recording"?x("voice.stop_recording")||"Stop recording":mt==="paused"?x("voice.resume_recording")||"Resume recording":mt==="loading"?x("voice.loading_model"):mt==="draining"?x("voice.processing")||"Processing remaining audio":x("voice.start_recording"),children:mt==="draining"?a.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):mt==="loading"?a.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):mt==="recording"?a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):mt==="paused"?a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("circle",{cx:"12",cy:"12",r:"6"})}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),mt==="loading"&&a.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:[a.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${$t}%`}})}),a.jsx("span",{children:nt?`${nt} ${$t}%`:`${$t}%`})]}),h&&a.jsxs("button",{onClick:()=>N(xe=>!xe),disabled:i||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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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":""]})]}),a.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[a.jsx("textarea",{ref:ee,value:v,onChange:xe=>je(xe.target.value),onKeyDown:Ye,onPaste:_t,placeholder:x("chat.send_placeholder"),disabled:i,rows:1,role:ae?"combobox":void 0,"aria-controls":ae?"slash-command-listbox":void 0,"aria-activedescendant":ae&<()>0?"slash-item-"+W:void 0,"aria-expanded":ae||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&&a.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:x("chat.stop_generating"),"aria-label":x("chat.stop_generating"),children:a.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),a.jsxs("button",{onClick:be,disabled:!v.trim()&&_.length===0||i,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)":x("chat.send_button"),"aria-label":r?"Queue message":x("chat.send_button"),"aria-disabled":!v.trim()&&_.length===0||i?"true":void 0,children:[a.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),l>0&&a.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})]})]})]}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:x("chat.send_hint")}),j&&a.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:j}),a.jsx("button",{onClick:()=>R(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":x("voice.dismiss_error"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})}),Rq="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",Aq="text-sm text-gray-500 dark:text-gray-400",Iq="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",Bg="w-4 h-4 text-gray-400 dark:text-gray-500",Mq="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4",Lq="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8",Oq="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 hS({variant:e,label:t,childSessionId:n,onSwitchToChild:r}){let i=null,o=a.jsx("span",{className:Aq,children:t});return e==="compacted"?(i=a.jsx("svg",{className:Bg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Mq})}),n&&(o=a.jsx("button",{onClick:r,className:Iq,children:t}))):e==="archive"?i=a.jsx("svg",{className:Bg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Lq})}):e==="terminal"&&(i=a.jsx("svg",{className:Bg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Oq})})),a.jsxs("div",{className:Rq,children:[i,o]})}function Dq(e){e.cfaccess&&(window.location.href="/cdn-cgi/access/login/"+window.location.host)}function Pq({enabled:e,tf:t}){return e?a.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:[a.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",fill:"#F6821F",children:[a.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"}),a.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 Fq({darkMode:e,onToggleTheme:t}){const{t:n}=Zt(),r=(k,_)=>{const w=n(k);return w===k?_:w},[i,o]=y.useState(""),[l,u]=y.useState(""),[d,f]=y.useState(!1),[p,h]=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&&(h(decodeURIComponent(k)),window.history.replaceState({},"",window.location.pathname))},[]),y.useEffect(()=>{fetch(yr("/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(_),Dq(_)}).catch(()=>{})},[]);const v=async k=>{k.preventDefault(),h(null),f(!0);try{const _=await fetch(yr("/auth/membership/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:l})}),w=await _.json().catch(()=>({}));if(!_.ok){h(w.error||"Login failed"),f(!1);return}window.location.reload()}catch(_){h("Connection error: "+_.message),f(!1)}};return a.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.jsx("div",{className:"flex justify-end p-4",children:a.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?a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:a.jsxs("div",{className:"w-full max-w-sm",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:a.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),a.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:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),p&&a.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&&a.jsxs("button",{type:"button",onClick:()=>{window.location.href=yr("/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:[a.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.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"}),a.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"}),a.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"}),a.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")]}),a.jsx(Pq,{enabled:m.cfaccess,tf:r}),m.google&&m.password&&a.jsxs("div",{className:"flex items-center gap-3 my-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),m.password&&a.jsxs("form",{onSubmit:v,className:"space-y-3 mb-4",children:[a.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:i,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"}),a.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"}),a.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")})]}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function Bq({user:e,onLogout:t,onSkillManagement:n,onPricingSettings:r,onDlpSettings:i,onSettings:o,onBoard:l,onCapabilities:u}){const{t:d}=Zt(),[f,p]=y.useState(!1),h=y.useRef(null);if(y.useEffect(()=>{if(!f)return;function x(v){h.current&&!h.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 a.jsxs("div",{className:"relative",ref:h,children:[a.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?a.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):a.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),a.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&a.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 zq({toolParts:e}){const{t}=Zt();return!e||e.length===0?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):a.jsxs("div",{className:"p-4",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),a.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>a.jsx(Uq,{part:n},n.id))})]})}function Uq({part:e}){var i,o;const t=((i=e.state)==null?void 0:i.status)||"running",n=((o=e.state)==null?void 0:o.input)||{},r=qq(e.tool,n);return a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[a.jsxs("div",{className:"shrink-0",children:[t==="running"&&a.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&a.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&a.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),a.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 qq(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+xf(t.filePath);case"Write":return"Writing "+xf(t.filePath);case"Edit":return"Editing "+xf(t.filePath);case"Bash":{const n=t.command||"";return gS(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+ok(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+ok(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return Hq(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+xf(t.filePath):t.command?gS(t.command):"Running "+e.toLowerCase()}}function xf(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 gS(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 "+ok(n,20)}function Hq(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 ok(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const lk=10,ck=24,mS=2,$q=14,I5="pave-terminal-font-size";function Wq(){try{const e=localStorage.getItem(I5);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=lk&&t<=ck)return t}}catch{}return $q}function Vq({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:i}=Zt();const o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[d,f]=y.useState(Wq),p=y.useCallback(()=>{f(k=>Math.max(lk,k-mS))},[]),h=y.useCallback(()=>{f(k=>Math.min(ck,k+mS))},[]);y.useEffect(()=>{try{localStorage.setItem(I5,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 w=()=>{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};w();const S=d;let N=Math.floor(k.width/S),j=new Array(N).fill(1);const R="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",T=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=S+"px monospace";for(let M=0;M<j.length;M++){const L=R.charAt(Math.floor(Math.random()*R.length));_.fillText(L,M*S,j[M]*S),j[M]*S>k.height&&Math.random()>.975&&(j[M]=0),j[M]++}u.current=requestAnimationFrame(T)},I=()=>{w(),N=Math.floor(k.width/S);const M=new Array(N).fill(0);for(let L=0;L<Math.min(j.length,M.length);L++)M[L]=j[L];j=M};return window.addEventListener("resize",I),u.current=requestAnimationFrame(T),()=>{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"}),a.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[a.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} shrink-0`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),a.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:p,disabled:d<=lk,className:x,"aria-label":i("terminal.decrease_font"),title:i("terminal.decrease_font"),children:"A-"}),a.jsx("button",{type:"button",onClick:h,disabled:d>=ck,className:x,"aria-label":i("terminal.increase_font"),title:i("terminal.increase_font"),children:"A+"})]})]}),a.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&a.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=>a.jsx(Kq,{part:k},k.id))})]}):a.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?a.jsxs("div",{children:[a.jsxs("div",{className:m.promptColor,children:["$ ",a.jsx("span",{className:"terminal-cursor",children:"█"})]}),a.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):a.jsxs(a.Fragment,{children:[e.map(k=>a.jsx(Gq,{part:k,theme:m},k.id)),a.jsxs("div",{className:m.promptColor,children:["$ ",a.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function Gq({part:e,theme:t}){var{t:n}=Zt();const{tool:r,state:i}=e;if(!i)return null;const o=i.status||"running",u=fp(r||i.title,i.input)||r||i.title||"unknown",d=i.output?Zo(typeof i.output=="string"?i.output:JSON.stringify(i.output,null,2)):null;return a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:`${t.commandColor} break-all`,children:[a.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&a.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&a.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&a.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&a.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",i.error?Zo(typeof i.error=="string"?i.error:i.error.message||n("common.error")):n("common.unknown_error")]}),o==="pending_confirmation"&&a.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function Kq({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",o=fp(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 a.jsxs("div",{className:"text-xs font-mono truncate",children:[a.jsxs("span",{className:l[r]||"text-gray-400",children:["[",u[r]||r,"]"]}),a.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function a1(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 zg,xS;function Yq(){if(xS)return zg;xS=1;function e(){this.__data__=[],this.size=0}return zg=e,zg}var Ug,yS;function Zl(){if(yS)return Ug;yS=1;function e(t,n){return t===n||t!==t&&n!==n}return Ug=e,Ug}var qg,bS;function gp(){if(bS)return qg;bS=1;var e=Zl();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return qg=t,qg}var Hg,vS;function Qq(){if(vS)return Hg;vS=1;var e=gp(),t=Array.prototype,n=t.splice;function r(i){var o=this.__data__,l=e(o,i);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():n.call(o,l,1),--this.size,!0}return Hg=r,Hg}var $g,kS;function Xq(){if(kS)return $g;kS=1;var e=gp();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return $g=t,$g}var Wg,_S;function Zq(){if(_S)return Wg;_S=1;var e=gp();function t(n){return e(this.__data__,n)>-1}return Wg=t,Wg}var Vg,wS;function Jq(){if(wS)return Vg;wS=1;var e=gp();function t(n,r){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return Vg=t,Vg}var Gg,SS;function mp(){if(SS)return Gg;SS=1;var e=Yq(),t=Qq(),n=Xq(),r=Zq(),i=Jq();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=i,Gg=o,Gg}var Kg,ES;function eH(){if(ES)return Kg;ES=1;var e=mp();function t(){this.__data__=new e,this.size=0}return Kg=t,Kg}var Yg,NS;function tH(){if(NS)return Yg;NS=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Yg=e,Yg}var Qg,CS;function nH(){if(CS)return Qg;CS=1;function e(t){return this.__data__.get(t)}return Qg=e,Qg}var Xg,jS;function rH(){if(jS)return Xg;jS=1;function e(t){return this.__data__.has(t)}return Xg=e,Xg}var Zg,TS;function M5(){if(TS)return Zg;TS=1;var e=typeof Zd=="object"&&Zd&&Zd.Object===Object&&Zd;return Zg=e,Zg}var Jg,RS;function Ia(){if(RS)return Jg;RS=1;var e=M5(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Jg=n,Jg}var em,AS;function Jl(){if(AS)return em;AS=1;var e=Ia(),t=e.Symbol;return em=t,em}var tm,IS;function iH(){if(IS)return tm;IS=1;var e=Jl(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(l){var u=n.call(l,i),d=l[i];try{l[i]=void 0;var f=!0}catch{}var p=r.call(l);return f&&(u?l[i]=d:delete l[i]),p}return tm=o,tm}var nm,MS;function aH(){if(MS)return nm;MS=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return nm=n,nm}var rm,LS;function il(){if(LS)return rm;LS=1;var e=Jl(),t=iH(),n=aH(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:r:o&&o in Object(u)?t(u):n(u)}return rm=l,rm}var im,OS;function da(){if(OS)return im;OS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return im=e,im}var am,DS;function Wu(){if(DS)return am;DS=1;var e=il(),t=da(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==i||d==n||d==o}return am=l,am}var sm,PS;function sH(){if(PS)return sm;PS=1;var e=Ia(),t=e["__core-js_shared__"];return sm=t,sm}var om,FS;function oH(){if(FS)return om;FS=1;var e=sH(),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 om=n,om}var lm,BS;function L5(){if(BS)return lm;BS=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 lm=n,lm}var cm,zS;function lH(){if(zS)return cm;zS=1;var e=Wu(),t=oH(),n=da(),r=L5(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(m){if(!n(m)||t(m))return!1;var x=e(m)?p:o;return x.test(r(m))}return cm=h,cm}var um,US;function cH(){if(US)return um;US=1;function e(t,n){return t==null?void 0:t[n]}return um=e,um}var dm,qS;function al(){if(qS)return dm;qS=1;var e=lH(),t=cH();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return dm=n,dm}var fm,HS;function s1(){if(HS)return fm;HS=1;var e=al(),t=Ia(),n=e(t,"Map");return fm=n,fm}var pm,$S;function xp(){if($S)return pm;$S=1;var e=al(),t=e(Object,"create");return pm=t,pm}var hm,WS;function uH(){if(WS)return hm;WS=1;var e=xp();function t(){this.__data__=e?e(null):{},this.size=0}return hm=t,hm}var gm,VS;function dH(){if(VS)return gm;VS=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return gm=e,gm}var mm,GS;function fH(){if(GS)return mm;GS=1;var e=xp(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(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 mm=i,mm}var xm,KS;function pH(){if(KS)return xm;KS=1;var e=xp(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return xm=r,xm}var ym,YS;function hH(){if(YS)return ym;YS=1;var e=xp(),t="__lodash_hash_undefined__";function n(r,i){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&i===void 0?t:i,this}return ym=n,ym}var bm,QS;function gH(){if(QS)return bm;QS=1;var e=uH(),t=dH(),n=fH(),r=pH(),i=hH();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=i,bm=o,bm}var vm,XS;function mH(){if(XS)return vm;XS=1;var e=gH(),t=mp(),n=s1();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return vm=r,vm}var km,ZS;function xH(){if(ZS)return km;ZS=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return km=e,km}var _m,JS;function yp(){if(JS)return _m;JS=1;var e=xH();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return _m=t,_m}var wm,eE;function yH(){if(eE)return wm;eE=1;var e=yp();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return wm=t,wm}var Sm,tE;function bH(){if(tE)return Sm;tE=1;var e=yp();function t(n){return e(this,n).get(n)}return Sm=t,Sm}var Em,nE;function vH(){if(nE)return Em;nE=1;var e=yp();function t(n){return e(this,n).has(n)}return Em=t,Em}var Nm,rE;function kH(){if(rE)return Nm;rE=1;var e=yp();function t(n,r){var i=e(this,n),o=i.size;return i.set(n,r),this.size+=i.size==o?0:1,this}return Nm=t,Nm}var Cm,iE;function o1(){if(iE)return Cm;iE=1;var e=mH(),t=yH(),n=bH(),r=vH(),i=kH();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=i,Cm=o,Cm}var jm,aE;function _H(){if(aE)return jm;aE=1;var e=mp(),t=s1(),n=o1(),r=200;function i(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 jm=i,jm}var Tm,sE;function bp(){if(sE)return Tm;sE=1;var e=mp(),t=eH(),n=tH(),r=nH(),i=rH(),o=_H();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=i,l.prototype.set=o,Tm=l,Tm}var Rm,oE;function l1(){if(oE)return Rm;oE=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i&&n(t[r],r,t)!==!1;);return t}return Rm=e,Rm}var Am,lE;function O5(){if(lE)return Am;lE=1;var e=al(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Am=t,Am}var Im,cE;function vp(){if(cE)return Im;cE=1;var e=O5();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return Im=t,Im}var Mm,uE;function kp(){if(uE)return Mm;uE=1;var e=vp(),t=Zl(),n=Object.prototype,r=n.hasOwnProperty;function i(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=i,Mm}var Lm,dE;function Vu(){if(dE)return Lm;dE=1;var e=kp(),t=vp();function n(r,i,o,l){var u=!o;o||(o={});for(var d=-1,f=i.length;++d<f;){var p=i[d],h=l?l(o[p],r[p],p,o,r):void 0;h===void 0&&(h=r[p]),u?t(o,p,h):e(o,p,h)}return o}return Lm=n,Lm}var Om,fE;function wH(){if(fE)return Om;fE=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return Om=e,Om}var Dm,pE;function Ka(){if(pE)return Dm;pE=1;function e(t){return t!=null&&typeof t=="object"}return Dm=e,Dm}var Pm,hE;function SH(){if(hE)return Pm;hE=1;var e=il(),t=Ka(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return Pm=r,Pm}var Fm,gE;function Gu(){if(gE)return Fm;gE=1;var e=SH(),t=Ka(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!i.call(l,"callee")};return Fm=o,Fm}var Bm,mE;function Tr(){if(mE)return Bm;mE=1;var e=Array.isArray;return Bm=e,Bm}var fu={exports:{}},zm,xE;function EH(){if(xE)return zm;xE=1;function e(){return!1}return zm=e,zm}fu.exports;var yE;function ec(){return yE||(yE=1,(function(e,t){var n=Ia(),r=EH(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(fu,fu.exports)),fu.exports}var Um,bE;function _p(){if(bE)return Um;bE=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var o=typeof r;return i=i??e,!!i&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return Um=n,Um}var qm,vE;function c1(){if(vE)return qm;vE=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return qm=t,qm}var Hm,kE;function NH(){if(kE)return Hm;kE=1;var e=il(),t=c1(),n=Ka(),r="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",p="[object Number]",h="[object Object]",m="[object RegExp]",x="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",N="[object Float64Array]",j="[object Int8Array]",R="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",M="[object Uint8ClampedArray]",L="[object Uint16Array]",A="[object Uint32Array]",D={};D[S]=D[N]=D[j]=D[R]=D[T]=D[I]=D[M]=D[L]=D[A]=!0,D[r]=D[i]=D[_]=D[o]=D[w]=D[l]=D[u]=D[d]=D[f]=D[p]=D[h]=D[m]=D[x]=D[v]=D[k]=!1;function $(ee){return n(ee)&&t(ee.length)&&!!D[e(ee)]}return Hm=$,Hm}var $m,_E;function wp(){if(_E)return $m;_E=1;function e(t){return function(n){return t(n)}}return $m=e,$m}var pu={exports:{}};pu.exports;var wE;function u1(){return wE||(wE=1,(function(e,t){var n=M5(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,l=o&&n.process,u=(function(){try{var d=i&&i.require&&i.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(pu,pu.exports)),pu.exports}var Wm,SE;function Ku(){if(SE)return Wm;SE=1;var e=NH(),t=wp(),n=u1(),r=n&&n.isTypedArray,i=r?t(r):e;return Wm=i,Wm}var Vm,EE;function D5(){if(EE)return Vm;EE=1;var e=wH(),t=Gu(),n=Tr(),r=ec(),i=_p(),o=Ku(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var h=n(f),m=!h&&t(f),x=!h&&!m&&r(f),v=!h&&!m&&!x&&o(f),k=h||m||x||v,_=k?e(f.length,String):[],w=_.length;for(var S in f)(p||u.call(f,S))&&!(k&&(S=="length"||x&&(S=="offset"||S=="parent")||v&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||i(S,w)))&&_.push(S);return _}return Vm=d,Vm}var Gm,NE;function Sp(){if(NE)return Gm;NE=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return Gm=t,Gm}var Km,CE;function P5(){if(CE)return Km;CE=1;function e(t,n){return function(r){return t(n(r))}}return Km=e,Km}var Ym,jE;function CH(){if(jE)return Ym;jE=1;var e=P5(),t=e(Object.keys,Object);return Ym=t,Ym}var Qm,TE;function d1(){if(TE)return Qm;TE=1;var e=Sp(),t=CH(),n=Object.prototype,r=n.hasOwnProperty;function i(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 Qm=i,Qm}var Xm,RE;function Ss(){if(RE)return Xm;RE=1;var e=Wu(),t=c1();function n(r){return r!=null&&t(r.length)&&!e(r)}return Xm=n,Xm}var Zm,AE;function ho(){if(AE)return Zm;AE=1;var e=D5(),t=d1(),n=Ss();function r(i){return n(i)?e(i):t(i)}return Zm=r,Zm}var Jm,IE;function jH(){if(IE)return Jm;IE=1;var e=Vu(),t=ho();function n(r,i){return r&&e(i,t(i),r)}return Jm=n,Jm}var e0,ME;function TH(){if(ME)return e0;ME=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return e0=e,e0}var t0,LE;function RH(){if(LE)return t0;LE=1;var e=da(),t=Sp(),n=TH(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!i.call(l,f))||d.push(f);return d}return t0=o,t0}var n0,OE;function sl(){if(OE)return n0;OE=1;var e=D5(),t=RH(),n=Ss();function r(i){return n(i)?e(i,!0):t(i)}return n0=r,n0}var r0,DE;function AH(){if(DE)return r0;DE=1;var e=Vu(),t=sl();function n(r,i){return r&&e(i,t(i),r)}return r0=n,r0}var hu={exports:{}};hu.exports;var PE;function F5(){return PE||(PE=1,(function(e,t){var n=Ia(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,l=o?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,p){if(p)return f.slice();var h=f.length,m=u?u(h):new f.constructor(h);return f.copy(m),m}e.exports=d})(hu,hu.exports)),hu.exports}var i0,FE;function B5(){if(FE)return i0;FE=1;function e(t,n){var r=-1,i=t.length;for(n||(n=Array(i));++r<i;)n[r]=t[r];return n}return i0=e,i0}var a0,BE;function z5(){if(BE)return a0;BE=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=0,l=[];++r<i;){var u=t[r];n(u,r,t)&&(l[o++]=u)}return l}return a0=e,a0}var s0,zE;function U5(){if(zE)return s0;zE=1;function e(){return[]}return s0=e,s0}var o0,UE;function f1(){if(UE)return o0;UE=1;var e=z5(),t=U5(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return r.call(l,u)}))}:t;return o0=o,o0}var l0,qE;function IH(){if(qE)return l0;qE=1;var e=Vu(),t=f1();function n(r,i){return e(r,t(r),i)}return l0=n,l0}var c0,HE;function p1(){if(HE)return c0;HE=1;function e(t,n){for(var r=-1,i=n.length,o=t.length;++r<i;)t[o+r]=n[r];return t}return c0=e,c0}var u0,$E;function Ep(){if($E)return u0;$E=1;var e=P5(),t=e(Object.getPrototypeOf,Object);return u0=t,u0}var d0,WE;function q5(){if(WE)return d0;WE=1;var e=p1(),t=Ep(),n=f1(),r=U5(),i=Object.getOwnPropertySymbols,o=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return d0=o,d0}var f0,VE;function MH(){if(VE)return f0;VE=1;var e=Vu(),t=q5();function n(r,i){return e(r,t(r),i)}return f0=n,f0}var p0,GE;function H5(){if(GE)return p0;GE=1;var e=p1(),t=Tr();function n(r,i,o){var l=i(r);return t(r)?l:e(l,o(r))}return p0=n,p0}var h0,KE;function $5(){if(KE)return h0;KE=1;var e=H5(),t=f1(),n=ho();function r(i){return e(i,n,t)}return h0=r,h0}var g0,YE;function LH(){if(YE)return g0;YE=1;var e=H5(),t=q5(),n=sl();function r(i){return e(i,n,t)}return g0=r,g0}var m0,QE;function OH(){if(QE)return m0;QE=1;var e=al(),t=Ia(),n=e(t,"DataView");return m0=n,m0}var x0,XE;function DH(){if(XE)return x0;XE=1;var e=al(),t=Ia(),n=e(t,"Promise");return x0=n,x0}var y0,ZE;function W5(){if(ZE)return y0;ZE=1;var e=al(),t=Ia(),n=e(t,"Set");return y0=n,y0}var b0,JE;function PH(){if(JE)return b0;JE=1;var e=al(),t=Ia(),n=e(t,"WeakMap");return b0=n,b0}var v0,eN;function tc(){if(eN)return v0;eN=1;var e=OH(),t=s1(),n=DH(),r=W5(),i=PH(),o=il(),l=L5(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",h="[object WeakMap]",m="[object DataView]",x=l(e),v=l(t),k=l(n),_=l(r),w=l(i),S=o;return(e&&S(new e(new ArrayBuffer(1)))!=m||t&&S(new t)!=u||n&&S(n.resolve())!=f||r&&S(new r)!=p||i&&S(new i)!=h)&&(S=function(N){var j=o(N),R=j==d?N.constructor:void 0,T=R?l(R):"";if(T)switch(T){case x:return m;case v:return u;case k:return f;case _:return p;case w:return h}return j}),v0=S,v0}var k0,tN;function FH(){if(tN)return k0;tN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var i=r.length,o=new r.constructor(i);return i&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return k0=n,k0}var _0,nN;function V5(){if(nN)return _0;nN=1;var e=Ia(),t=e.Uint8Array;return _0=t,_0}var w0,rN;function h1(){if(rN)return w0;rN=1;var e=V5();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return w0=t,w0}var S0,iN;function BH(){if(iN)return S0;iN=1;var e=h1();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return S0=t,S0}var E0,aN;function zH(){if(aN)return E0;aN=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return E0=t,E0}var N0,sN;function UH(){if(sN)return N0;sN=1;var e=Jl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(i){return n?Object(n.call(i)):{}}return N0=r,N0}var C0,oN;function G5(){if(oN)return C0;oN=1;var e=h1();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return C0=t,C0}var j0,lN;function qH(){if(lN)return j0;lN=1;var e=h1(),t=BH(),n=zH(),r=UH(),i=G5(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",h="[object String]",m="[object Symbol]",x="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",w="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",R="[object Uint8ClampedArray]",T="[object Uint16Array]",I="[object Uint32Array]";function M(L,A,D){var $=L.constructor;switch(A){case x:return e(L);case o:case l:return new $(+L);case v:return t(L,D);case k:case _:case w:case S:case N:case j:case R:case T:case I:return i(L,D);case u:return new $;case d:case h:return new $(L);case f:return n(L);case p:return new $;case m:return r(L)}}return j0=M,j0}var T0,cN;function K5(){if(cN)return T0;cN=1;var e=da(),t=Object.create,n=(function(){function r(){}return function(i){if(!e(i))return{};if(t)return t(i);r.prototype=i;var o=new r;return r.prototype=void 0,o}})();return T0=n,T0}var R0,uN;function Y5(){if(uN)return R0;uN=1;var e=K5(),t=Ep(),n=Sp();function r(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return R0=r,R0}var A0,dN;function HH(){if(dN)return A0;dN=1;var e=tc(),t=Ka(),n="[object Map]";function r(i){return t(i)&&e(i)==n}return A0=r,A0}var I0,fN;function $H(){if(fN)return I0;fN=1;var e=HH(),t=wp(),n=u1(),r=n&&n.isMap,i=r?t(r):e;return I0=i,I0}var M0,pN;function WH(){if(pN)return M0;pN=1;var e=tc(),t=Ka(),n="[object Set]";function r(i){return t(i)&&e(i)==n}return M0=r,M0}var L0,hN;function VH(){if(hN)return L0;hN=1;var e=WH(),t=wp(),n=u1(),r=n&&n.isSet,i=r?t(r):e;return L0=i,L0}var O0,gN;function Q5(){if(gN)return O0;gN=1;var e=bp(),t=l1(),n=kp(),r=jH(),i=AH(),o=F5(),l=B5(),u=IH(),d=MH(),f=$5(),p=LH(),h=tc(),m=FH(),x=qH(),v=Y5(),k=Tr(),_=ec(),w=$H(),S=da(),N=VH(),j=ho(),R=sl(),T=1,I=2,M=4,L="[object Arguments]",A="[object Array]",D="[object Boolean]",$="[object Date]",ee="[object Error]",U="[object Function]",G="[object GeneratorFunction]",Z="[object Map]",z="[object Number]",q="[object Object]",ae="[object RegExp]",P="[object Set]",Q="[object String]",J="[object Symbol]",F="[object WeakMap]",K="[object ArrayBuffer]",W="[object DataView]",H="[object Float32Array]",se="[object Float64Array]",ie="[object Int8Array]",ge="[object Int16Array]",we="[object Int32Array]",Ke="[object Uint8Array]",xt="[object Uint8ClampedArray]",et="[object Uint16Array]",vt="[object Uint32Array]",lt={};lt[L]=lt[A]=lt[K]=lt[W]=lt[D]=lt[$]=lt[H]=lt[se]=lt[ie]=lt[ge]=lt[we]=lt[Z]=lt[z]=lt[q]=lt[ae]=lt[P]=lt[Q]=lt[J]=lt[Ke]=lt[xt]=lt[et]=lt[vt]=!0,lt[ee]=lt[U]=lt[F]=!1;function je(Oe,ft,Ct,rn,tn,un){var mt,$t=ft&T,nt=ft&I,qe=ft&M;if(Ct&&(mt=tn?Ct(Oe,rn,tn,un):Ct(Oe)),mt!==void 0)return mt;if(!S(Oe))return Oe;var ue=k(Oe);if(ue){if(mt=m(Oe),!$t)return l(Oe,mt)}else{var me=h(Oe),Ue=me==U||me==G;if(_(Oe))return o(Oe,$t);if(me==q||me==L||Ue&&!tn){if(mt=nt||Ue?{}:v(Oe),!$t)return nt?d(Oe,i(mt,Oe)):u(Oe,r(mt,Oe))}else{if(!lt[me])return tn?Oe:{};mt=x(Oe,me,$t)}}un||(un=new e);var He=un.get(Oe);if(He)return He;un.set(Oe,mt),N(Oe)?Oe.forEach(function(_t){mt.add(je(_t,ft,Ct,_t,Oe,un))}):w(Oe)&&Oe.forEach(function(_t,jt){mt.set(jt,je(_t,ft,Ct,jt,Oe,un))});var be=qe?nt?p:f:nt?R:j,Ye=ue?void 0:be(Oe);return t(Ye||Oe,function(_t,jt){Ye&&(jt=_t,_t=Oe[jt]),n(mt,jt,je(_t,ft,Ct,jt,Oe,un))}),mt}return O0=je,O0}var D0,mN;function GH(){if(mN)return D0;mN=1;var e=Q5(),t=4;function n(r){return e(r,t)}return D0=n,D0}var P0,xN;function g1(){if(xN)return P0;xN=1;function e(t){return function(){return t}}return P0=e,P0}var F0,yN;function KH(){if(yN)return F0;yN=1;function e(t){return function(n,r,i){for(var o=-1,l=Object(n),u=i(n),d=u.length;d--;){var f=u[t?d:++o];if(r(l[f],f,l)===!1)break}return n}}return F0=e,F0}var B0,bN;function m1(){if(bN)return B0;bN=1;var e=KH(),t=e();return B0=t,B0}var z0,vN;function x1(){if(vN)return z0;vN=1;var e=m1(),t=ho();function n(r,i){return r&&e(r,i,t)}return z0=n,z0}var U0,kN;function YH(){if(kN)return U0;kN=1;var e=Ss();function t(n,r){return function(i,o){if(i==null)return i;if(!e(i))return n(i,o);for(var l=i.length,u=r?l:-1,d=Object(i);(r?u--:++u<l)&&o(d[u],u,d)!==!1;);return i}}return U0=t,U0}var q0,_N;function Np(){if(_N)return q0;_N=1;var e=x1(),t=YH(),n=t(e);return q0=n,q0}var H0,wN;function ol(){if(wN)return H0;wN=1;function e(t){return t}return H0=e,H0}var $0,SN;function X5(){if(SN)return $0;SN=1;var e=ol();function t(n){return typeof n=="function"?n:e}return $0=t,$0}var W0,EN;function Z5(){if(EN)return W0;EN=1;var e=l1(),t=Np(),n=X5(),r=Tr();function i(o,l){var u=r(o)?e:t;return u(o,n(l))}return W0=i,W0}var V0,NN;function J5(){return NN||(NN=1,V0=Z5()),V0}var G0,CN;function QH(){if(CN)return G0;CN=1;var e=Np();function t(n,r){var i=[];return e(n,function(o,l,u){r(o,l,u)&&i.push(o)}),i}return G0=t,G0}var K0,jN;function XH(){if(jN)return K0;jN=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return K0=t,K0}var Y0,TN;function ZH(){if(TN)return Y0;TN=1;function e(t){return this.__data__.has(t)}return Y0=e,Y0}var Q0,RN;function eI(){if(RN)return Q0;RN=1;var e=o1(),t=XH(),n=ZH();function r(i){var o=-1,l=i==null?0:i.length;for(this.__data__=new e;++o<l;)this.add(i[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Q0=r,Q0}var X0,AN;function JH(){if(AN)return X0;AN=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return X0=e,X0}var Z0,IN;function tI(){if(IN)return Z0;IN=1;function e(t,n){return t.has(n)}return Z0=e,Z0}var J0,MN;function nI(){if(MN)return J0;MN=1;var e=eI(),t=JH(),n=tI(),r=1,i=2;function o(l,u,d,f,p,h){var m=d&r,x=l.length,v=u.length;if(x!=v&&!(m&&v>x))return!1;var k=h.get(l),_=h.get(u);if(k&&_)return k==u&&_==l;var w=-1,S=!0,N=d&i?new e:void 0;for(h.set(l,u),h.set(u,l);++w<x;){var j=l[w],R=u[w];if(f)var T=m?f(R,j,w,u,l,h):f(j,R,w,l,u,h);if(T!==void 0){if(T)continue;S=!1;break}if(N){if(!t(u,function(I,M){if(!n(N,M)&&(j===I||p(j,I,d,f,h)))return N.push(M)})){S=!1;break}}else if(!(j===R||p(j,R,d,f,h))){S=!1;break}}return h.delete(l),h.delete(u),S}return J0=o,J0}var ex,LN;function e$(){if(LN)return ex;LN=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,o){r[++n]=[o,i]}),r}return ex=e,ex}var tx,ON;function y1(){if(ON)return tx;ON=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return tx=e,tx}var nx,DN;function t$(){if(DN)return nx;DN=1;var e=Jl(),t=V5(),n=Zl(),r=nI(),i=e$(),o=y1(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Map]",m="[object Number]",x="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",N=e?e.prototype:void 0,j=N?N.valueOf:void 0;function R(T,I,M,L,A,D,$){switch(M){case S:if(T.byteLength!=I.byteLength||T.byteOffset!=I.byteOffset)return!1;T=T.buffer,I=I.buffer;case w:return!(T.byteLength!=I.byteLength||!D(new t(T),new t(I)));case d:case f:case m:return n(+T,+I);case p:return T.name==I.name&&T.message==I.message;case x:case k:return T==I+"";case h:var ee=i;case v:var U=L&l;if(ee||(ee=o),T.size!=I.size&&!U)return!1;var G=$.get(T);if(G)return G==I;L|=u,$.set(T,I);var Z=r(ee(T),ee(I),L,A,D,$);return $.delete(T),Z;case _:if(j)return j.call(T)==j.call(I)}return!1}return nx=R,nx}var rx,PN;function n$(){if(PN)return rx;PN=1;var e=$5(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(o,l,u,d,f,p){var h=u&t,m=e(o),x=m.length,v=e(l),k=v.length;if(x!=k&&!h)return!1;for(var _=x;_--;){var w=m[_];if(!(h?w in l:r.call(l,w)))return!1}var S=p.get(o),N=p.get(l);if(S&&N)return S==l&&N==o;var j=!0;p.set(o,l),p.set(l,o);for(var R=h;++_<x;){w=m[_];var T=o[w],I=l[w];if(d)var M=h?d(I,T,w,l,o,p):d(T,I,w,o,l,p);if(!(M===void 0?T===I||f(T,I,u,d,p):M)){j=!1;break}R||(R=w=="constructor")}if(j&&!R){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)&&(j=!1)}return p.delete(o),p.delete(l),j}return rx=i,rx}var ix,FN;function r$(){if(FN)return ix;FN=1;var e=bp(),t=nI(),n=t$(),r=n$(),i=tc(),o=Tr(),l=ec(),u=Ku(),d=1,f="[object Arguments]",p="[object Array]",h="[object Object]",m=Object.prototype,x=m.hasOwnProperty;function v(k,_,w,S,N,j){var R=o(k),T=o(_),I=R?p:i(k),M=T?p:i(_);I=I==f?h:I,M=M==f?h:M;var L=I==h,A=M==h,D=I==M;if(D&&l(k)){if(!l(_))return!1;R=!0,L=!1}if(D&&!L)return j||(j=new e),R||u(k)?t(k,_,w,S,N,j):n(k,_,I,w,S,N,j);if(!(w&d)){var $=L&&x.call(k,"__wrapped__"),ee=A&&x.call(_,"__wrapped__");if($||ee){var U=$?k.value():k,G=ee?_.value():_;return j||(j=new e),N(U,G,w,S,j)}}return D?(j||(j=new e),r(k,_,w,S,N,j)):!1}return ix=v,ix}var ax,BN;function rI(){if(BN)return ax;BN=1;var e=r$(),t=Ka();function n(r,i,o,l,u){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,o,l,n,u)}return ax=n,ax}var sx,zN;function i$(){if(zN)return sx;zN=1;var e=bp(),t=rI(),n=1,r=2;function i(o,l,u,d){var f=u.length,p=f,h=!d;if(o==null)return!p;for(o=Object(o);f--;){var m=u[f];if(h&&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(h&&m[2]){if(v===void 0&&!(x in o))return!1}else{var _=new e;if(d)var w=d(v,k,x,o,l,_);if(!(w===void 0?t(k,v,n|r,d,_):w))return!1}}return!0}return sx=i,sx}var ox,UN;function iI(){if(UN)return ox;UN=1;var e=da();function t(n){return n===n&&!e(n)}return ox=t,ox}var lx,qN;function a$(){if(qN)return lx;qN=1;var e=iI(),t=ho();function n(r){for(var i=t(r),o=i.length;o--;){var l=i[o],u=r[l];i[o]=[l,u,e(u)]}return i}return lx=n,lx}var cx,HN;function aI(){if(HN)return cx;HN=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return cx=e,cx}var ux,$N;function s$(){if($N)return ux;$N=1;var e=i$(),t=a$(),n=aI();function r(i){var o=t(i);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(l){return l===i||e(l,i,o)}}return ux=r,ux}var dx,WN;function nc(){if(WN)return dx;WN=1;var e=il(),t=Ka(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return dx=r,dx}var fx,VN;function b1(){if(VN)return fx;VN=1;var e=Tr(),t=nc(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(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 fx=i,fx}var px,GN;function o$(){if(GN)return px;GN=1;var e=o1(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var l=arguments,u=i?i.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,px=n,px}var hx,KN;function l$(){if(KN)return hx;KN=1;var e=o$(),t=500;function n(r){var i=e(r,function(l){return o.size===t&&o.clear(),l}),o=i.cache;return i}return hx=n,hx}var gx,YN;function c$(){if(YN)return gx;YN=1;var e=l$(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(l,u,d,f){o.push(d?f.replace(n,"$1"):u||l)}),o});return gx=r,gx}var mx,QN;function Cp(){if(QN)return mx;QN=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=Array(i);++r<i;)o[r]=n(t[r],r,t);return o}return mx=e,mx}var xx,XN;function u$(){if(XN)return xx;XN=1;var e=Jl(),t=Cp(),n=Tr(),r=nc(),i=e?e.prototype:void 0,o=i?i.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 xx=l,xx}var yx,ZN;function sI(){if(ZN)return yx;ZN=1;var e=u$();function t(n){return n==null?"":e(n)}return yx=t,yx}var bx,JN;function jp(){if(JN)return bx;JN=1;var e=Tr(),t=b1(),n=c$(),r=sI();function i(o,l){return e(o)?o:t(o,l)?[o]:n(r(o))}return bx=i,bx}var vx,eC;function Yu(){if(eC)return vx;eC=1;var e=nc();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return vx=t,vx}var kx,tC;function Tp(){if(tC)return kx;tC=1;var e=jp(),t=Yu();function n(r,i){i=e(i,r);for(var o=0,l=i.length;r!=null&&o<l;)r=r[t(i[o++])];return o&&o==l?r:void 0}return kx=n,kx}var _x,nC;function d$(){if(nC)return _x;nC=1;var e=Tp();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return _x=t,_x}var wx,rC;function f$(){if(rC)return wx;rC=1;function e(t,n){return t!=null&&n in Object(t)}return wx=e,wx}var Sx,iC;function oI(){if(iC)return Sx;iC=1;var e=jp(),t=Gu(),n=Tr(),r=_p(),i=c1(),o=Yu();function l(u,d,f){d=e(d,u);for(var p=-1,h=d.length,m=!1;++p<h;){var x=o(d[p]);if(!(m=u!=null&&f(u,x)))break;u=u[x]}return m||++p!=h?m:(h=u==null?0:u.length,!!h&&i(h)&&r(x,h)&&(n(u)||t(u)))}return Sx=l,Sx}var Ex,aC;function lI(){if(aC)return Ex;aC=1;var e=f$(),t=oI();function n(r,i){return r!=null&&t(r,i,e)}return Ex=n,Ex}var Nx,sC;function p$(){if(sC)return Nx;sC=1;var e=rI(),t=d$(),n=lI(),r=b1(),i=iI(),o=aI(),l=Yu(),u=1,d=2;function f(p,h){return r(p)&&i(h)?o(l(p),h):function(m){var x=t(m,p);return x===void 0&&x===h?n(m,p):e(h,x,u|d)}}return Nx=f,Nx}var Cx,oC;function cI(){if(oC)return Cx;oC=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Cx=e,Cx}var jx,lC;function h$(){if(lC)return jx;lC=1;var e=Tp();function t(n){return function(r){return e(r,n)}}return jx=t,jx}var Tx,cC;function g$(){if(cC)return Tx;cC=1;var e=cI(),t=h$(),n=b1(),r=Yu();function i(o){return n(o)?e(r(o)):t(o)}return Tx=i,Tx}var Rx,uC;function Es(){if(uC)return Rx;uC=1;var e=s$(),t=p$(),n=ol(),r=Tr(),i=g$();function o(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):i(l)}return Rx=o,Rx}var Ax,dC;function uI(){if(dC)return Ax;dC=1;var e=z5(),t=QH(),n=Es(),r=Tr();function i(o,l){var u=r(o)?e:t;return u(o,n(l,3))}return Ax=i,Ax}var Ix,fC;function m$(){if(fC)return Ix;fC=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,i){return r!=null&&t.call(r,i)}return Ix=n,Ix}var Mx,pC;function dI(){if(pC)return Mx;pC=1;var e=m$(),t=oI();function n(r,i){return r!=null&&t(r,i,e)}return Mx=n,Mx}var Lx,hC;function x$(){if(hC)return Lx;hC=1;var e=d1(),t=tc(),n=Gu(),r=Tr(),i=Ss(),o=ec(),l=Sp(),u=Ku(),d="[object Map]",f="[object Set]",p=Object.prototype,h=p.hasOwnProperty;function m(x){if(x==null)return!0;if(i(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(h.call(x,k))return!1;return!0}return Lx=m,Lx}var Ox,gC;function fI(){if(gC)return Ox;gC=1;function e(t){return t===void 0}return Ox=e,Ox}var Dx,mC;function pI(){if(mC)return Dx;mC=1;var e=Np(),t=Ss();function n(r,i){var o=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++o]=i(u,d,f)}),l}return Dx=n,Dx}var Px,xC;function hI(){if(xC)return Px;xC=1;var e=Cp(),t=Es(),n=pI(),r=Tr();function i(o,l){var u=r(o)?e:n;return u(o,t(l,3))}return Px=i,Px}var Fx,yC;function y$(){if(yC)return Fx;yC=1;function e(t,n,r,i){var o=-1,l=t==null?0:t.length;for(i&&l&&(r=t[++o]);++o<l;)r=n(r,t[o],o,t);return r}return Fx=e,Fx}var Bx,bC;function b$(){if(bC)return Bx;bC=1;function e(t,n,r,i,o){return o(t,function(l,u,d){r=i?(i=!1,l):n(r,l,u,d)}),r}return Bx=e,Bx}var zx,vC;function gI(){if(vC)return zx;vC=1;var e=y$(),t=Np(),n=Es(),r=b$(),i=Tr();function o(l,u,d){var f=i(l)?e:r,p=arguments.length<3;return f(l,n(u,4),d,p,t)}return zx=o,zx}var Ux,kC;function v$(){if(kC)return Ux;kC=1;var e=il(),t=Tr(),n=Ka(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return Ux=i,Ux}var qx,_C;function k$(){if(_C)return qx;_C=1;var e=cI(),t=e("length");return qx=t,qx}var Hx,wC;function _$(){if(wC)return Hx;wC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+o+"]");function d(f){return u.test(f)}return Hx=d,Hx}var $x,SC;function w$(){if(SC)return $x;SC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+x+"(?:"+[p,h,m].join("|")+")"+k+v+")*",w=k+v+_,S="(?:"+[p+u+"?",u,h,m,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+S+w,"g");function j(R){for(var T=N.lastIndex=0;N.test(R);)++T;return T}return $x=j,$x}var Wx,EC;function S$(){if(EC)return Wx;EC=1;var e=k$(),t=_$(),n=w$();function r(i){return t(i)?n(i):e(i)}return Wx=r,Wx}var Vx,NC;function E$(){if(NC)return Vx;NC=1;var e=d1(),t=tc(),n=Ss(),r=v$(),i=S$(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?i(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return Vx=u,Vx}var Gx,CC;function N$(){if(CC)return Gx;CC=1;var e=l1(),t=K5(),n=x1(),r=Es(),i=Ep(),o=Tr(),l=ec(),u=Wu(),d=da(),f=Ku();function p(h,m,x){var v=o(h),k=v||l(h)||f(h);if(m=r(m,4),x==null){var _=h&&h.constructor;k?x=v?new _:[]:d(h)?x=u(_)?t(i(h)):{}:x={}}return(k?e:n)(h,function(w,S,N){return m(x,w,S,N)}),x}return Gx=p,Gx}var Kx,jC;function C$(){if(jC)return Kx;jC=1;var e=Jl(),t=Gu(),n=Tr(),r=e?e.isConcatSpreadable:void 0;function i(o){return n(o)||t(o)||!!(r&&o&&o[r])}return Kx=i,Kx}var Yx,TC;function v1(){if(TC)return Yx;TC=1;var e=p1(),t=C$();function n(r,i,o,l,u){var d=-1,f=r.length;for(o||(o=t),u||(u=[]);++d<f;){var p=r[d];i>0&&o(p)?i>1?n(p,i-1,o,l,u):e(u,p):l||(u[u.length]=p)}return u}return Yx=n,Yx}var Qx,RC;function j$(){if(RC)return Qx;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 Qx=e,Qx}var Xx,AC;function mI(){if(AC)return Xx;AC=1;var e=j$(),t=Math.max;function n(r,i,o){return i=t(i===void 0?r.length-1:i,0),function(){for(var l=arguments,u=-1,d=t(l.length-i,0),f=Array(d);++u<d;)f[u]=l[i+u];u=-1;for(var p=Array(i+1);++u<i;)p[u]=l[u];return p[i]=o(f),e(r,this,p)}}return Xx=n,Xx}var Zx,IC;function T$(){if(IC)return Zx;IC=1;var e=g1(),t=O5(),n=ol(),r=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return Zx=r,Zx}var Jx,MC;function R$(){if(MC)return Jx;MC=1;var e=800,t=16,n=Date.now;function r(i){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 i.apply(void 0,arguments)}}return Jx=r,Jx}var ey,LC;function xI(){if(LC)return ey;LC=1;var e=T$(),t=R$(),n=t(e);return ey=n,ey}var ty,OC;function Rp(){if(OC)return ty;OC=1;var e=ol(),t=mI(),n=xI();function r(i,o){return n(t(i,o,e),i+"")}return ty=r,ty}var ny,DC;function yI(){if(DC)return ny;DC=1;function e(t,n,r,i){for(var o=t.length,l=r+(i?1:-1);i?l--:++l<o;)if(n(t[l],l,t))return l;return-1}return ny=e,ny}var ry,PC;function A$(){if(PC)return ry;PC=1;function e(t){return t!==t}return ry=e,ry}var iy,FC;function I$(){if(FC)return iy;FC=1;function e(t,n,r){for(var i=r-1,o=t.length;++i<o;)if(t[i]===n)return i;return-1}return iy=e,iy}var ay,BC;function M$(){if(BC)return ay;BC=1;var e=yI(),t=A$(),n=I$();function r(i,o,l){return o===o?n(i,o,l):e(i,t,l)}return ay=r,ay}var sy,zC;function L$(){if(zC)return sy;zC=1;var e=M$();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return sy=t,sy}var oy,UC;function O$(){if(UC)return oy;UC=1;function e(t,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(n,t[i]))return!0;return!1}return oy=e,oy}var ly,qC;function D$(){if(qC)return ly;qC=1;function e(){}return ly=e,ly}var cy,HC;function P$(){if(HC)return cy;HC=1;var e=W5(),t=D$(),n=y1(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return cy=i,cy}var uy,$C;function F$(){if($C)return uy;$C=1;var e=eI(),t=L$(),n=O$(),r=tI(),i=P$(),o=y1(),l=200;function u(d,f,p){var h=-1,m=t,x=d.length,v=!0,k=[],_=k;if(p)v=!1,m=n;else if(x>=l){var w=f?null:i(d);if(w)return o(w);v=!1,m=r,_=new e}else _=f?[]:k;e:for(;++h<x;){var S=d[h],N=f?f(S):S;if(S=p||S!==0?S:0,v&&N===N){for(var j=_.length;j--;)if(_[j]===N)continue e;f&&_.push(N),k.push(S)}else m(_,N,p)||(_!==k&&_.push(N),k.push(S))}return k}return uy=u,uy}var dy,WC;function bI(){if(WC)return dy;WC=1;var e=Ss(),t=Ka();function n(r){return t(r)&&e(r)}return dy=n,dy}var fy,VC;function B$(){if(VC)return fy;VC=1;var e=v1(),t=Rp(),n=F$(),r=bI(),i=t(function(o){return n(e(o,1,r,!0))});return fy=i,fy}var py,GC;function z$(){if(GC)return py;GC=1;var e=Cp();function t(n,r){return e(r,function(i){return n[i]})}return py=t,py}var hy,KC;function vI(){if(KC)return hy;KC=1;var e=z$(),t=ho();function n(r){return r==null?[]:e(r,t(r))}return hy=n,hy}var gy,YC;function fa(){if(YC)return gy;YC=1;var e;if(typeof a1=="function")try{e={clone:GH(),constant:g1(),each:J5(),filter:uI(),has:dI(),isArray:Tr(),isEmpty:x$(),isFunction:Wu(),isUndefined:fI(),keys:ho(),map:hI(),reduce:gI(),size:E$(),transform:N$(),union:B$(),values:vI()}}catch{}return e||(e=window._),gy=e,gy}var my,QC;function k1(){if(QC)return my;QC=1;var e=fa();my=i;var t="\0",n="\0",r="";function i(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={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(p){return this._label=p,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(h){return e.isEmpty(p._in[h])})},i.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(h){return e.isEmpty(p._out[h])})},i.prototype.setNodes=function(p,h){var m=arguments,x=this;return e.each(p,function(v){m.length>1?x.setNode(v,h):x.setNode(v)}),this},i.prototype.setNode=function(p,h){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=h),this):(this._nodes[p]=arguments.length>1?h: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)},i.prototype.node=function(p){return this._nodes[p]},i.prototype.hasNode=function(p){return e.has(this._nodes,p)},i.prototype.removeNode=function(p){var h=this;if(e.has(this._nodes,p)){var m=function(x){h.removeEdge(h._edgeObjs[x])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(x){h.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},i.prototype.setParent=function(p,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(h))h=n;else{h+="";for(var m=h;!e.isUndefined(m);m=this.parent(m))if(m===p)throw new Error("Setting "+h+" as parent of "+p+" would create a cycle");this.setNode(h)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=h,this._children[h][p]=!0,this},i.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},i.prototype.parent=function(p){if(this._isCompound){var h=this._parent[p];if(h!==n)return h}},i.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var h=this._children[p];if(h)return e.keys(h)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},i.prototype.predecessors=function(p){var h=this._preds[p];if(h)return e.keys(h)},i.prototype.successors=function(p){var h=this._sucs[p];if(h)return e.keys(h)},i.prototype.neighbors=function(p){var h=this.predecessors(p);if(h)return e.union(h,this.successors(p))},i.prototype.isLeaf=function(p){var h;return this.isDirected()?h=this.successors(p):h=this.neighbors(p),h.length===0},i.prototype.filterNodes=function(p){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var m=this;e.each(this._nodes,function(k,_){p(_)&&h.setNode(_,k)}),e.each(this._edgeObjs,function(k){h.hasNode(k.v)&&h.hasNode(k.w)&&h.setEdge(k,m.edge(k))});var x={};function v(k){var _=m.parent(k);return _===void 0||h.hasNode(_)?(x[k]=_,_):_ in x?x[_]:v(_)}return this._isCompound&&e.each(h.nodes(),function(k){h.setParent(k,v(k))}),h},i.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(p,h){var m=this,x=arguments;return e.reduce(p,function(v,k){return x.length>1?m.setEdge(v,k,h):m.setEdge(v,k),k}),this},i.prototype.setEdge=function(){var p,h,m,x,v=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(p=k.v,h=k.w,m=k.name,arguments.length===2&&(x=arguments[1],v=!0)):(p=k,h=arguments[1],m=arguments[3],arguments.length>2&&(x=arguments[2],v=!0)),p=""+p,h=""+h,e.isUndefined(m)||(m=""+m);var _=u(this._isDirected,p,h,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(h),this._edgeLabels[_]=v?x:this._defaultEdgeLabelFn(p,h,m);var w=d(this._isDirected,p,h,m);return p=w.v,h=w.w,Object.freeze(w),this._edgeObjs[_]=w,o(this._preds[h],p),o(this._sucs[p],h),this._in[h][_]=w,this._out[p][_]=w,this._edgeCount++,this},i.prototype.edge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return this._edgeLabels[x]},i.prototype.hasEdge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return e.has(this._edgeLabels,x)},i.prototype.removeEdge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m),v=this._edgeObjs[x];return v&&(p=v.v,h=v.w,delete this._edgeLabels[x],delete this._edgeObjs[x],l(this._preds[h],p),l(this._sucs[p],h),delete this._in[h][x],delete this._out[p][x],this._edgeCount--),this},i.prototype.inEdges=function(p,h){var m=this._in[p];if(m){var x=e.values(m);return h?e.filter(x,function(v){return v.v===h}):x}},i.prototype.outEdges=function(p,h){var m=this._out[p];if(m){var x=e.values(m);return h?e.filter(x,function(v){return v.w===h}):x}},i.prototype.nodeEdges=function(p,h){var m=this.inEdges(p,h);if(m)return m.concat(this.outEdges(p,h))};function o(p,h){p[h]?p[h]++:p[h]=1}function l(p,h){--p[h]||delete p[h]}function u(p,h,m,x){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}return v+r+k+r+(e.isUndefined(x)?t:x)}function d(p,h,m,x){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}var w={v,w:k};return x&&(w.name=x),w}function f(p,h){return u(p,h.v,h.w,h.name)}return my}var xy,XC;function U$(){return XC||(XC=1,xy="2.1.8"),xy}var yy,ZC;function q$(){return ZC||(ZC=1,yy={Graph:k1(),version:U$()}),yy}var by,JC;function H$(){if(JC)return by;JC=1;var e=fa(),t=k1();by={write:n,read:o};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:i(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 i(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 by}var vy,ej;function $$(){if(ej)return vy;ej=1;var e=fa();vy=t;function t(n){var r={},i=[],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&&i.push(o)}),i}return vy}var ky,tj;function kI(){if(tj)return ky;tj=1;var e=fa();ky=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 i=this._keyIndices;if(n=String(n),!e.has(i,n)){var o=this._arr,l=o.length;return i[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 i=this._keyIndices[n];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)},t.prototype._heapify=function(n){var r=this._arr,i=2*n,o=i+1,l=n;i<r.length&&(l=r[i].priority<r[l].priority?i: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,i=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<i));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var i=this._arr,o=this._keyIndices,l=i[n],u=i[r];i[n]=u,i[r]=l,o[u.key]=n,o[l.key]=r},ky}var _y,nj;function _I(){if(nj)return _y;nj=1;var e=fa(),t=kI();_y=r;var n=e.constant(1);function r(o,l,u,d){return i(o,String(l),u||n,d||function(f){return o.outEdges(f)})}function i(o,l,u,d){var f={},p=new t,h,m,x=function(v){var k=v.v!==h?v.v:v.w,_=f[k],w=u(v),S=m.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+w);S<_.distance&&(_.distance=S,_.predecessor=h,p.decrease(k,S))};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&&(h=p.removeMin(),m=f[h],m.distance!==Number.POSITIVE_INFINITY);)d(h).forEach(x);return f}return _y}var wy,rj;function W$(){if(rj)return wy;rj=1;var e=_I(),t=fa();wy=n;function n(r,i,o){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,i,o)},{})}return wy}var Sy,ij;function wI(){if(ij)return Sy;ij=1;var e=fa();Sy=t;function t(n){var r=0,i=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:r,index:r++};if(i.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=[],h;do h=i.pop(),o[h].onStack=!1,p.push(h);while(d!==h);l.push(p)}}return n.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return Sy}var Ey,aj;function V$(){if(aj)return Ey;aj=1;var e=fa(),t=wI();Ey=n;function n(r){return e.filter(t(r),function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return Ey}var Ny,sj;function G$(){if(sj)return Ny;sj=1;var e=fa();Ny=n;var t=e.constant(1);function n(i,o,l){return r(i,o||t,l||function(u){return i.outEdges(u)})}function r(i,o,l){var u={},d=i.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 h=p.v===f?p.w:p.v,m=o(p);u[f][h]={distance:m,predecessor:f}})}),d.forEach(function(f){var p=u[f];d.forEach(function(h){var m=u[h];d.forEach(function(x){var v=m[f],k=p[x],_=m[x],w=v.distance+k.distance;w<_.distance&&(_.distance=w,_.predecessor=k.predecessor)})})}),u}return Ny}var Cy,oj;function SI(){if(oj)return Cy;oj=1;var e=fa();Cy=t,t.CycleException=n;function t(r){var i={},o={},l=[];function u(d){if(e.has(o,d))throw new n;e.has(i,d)||(o[d]=!0,i[d]=!0,e.each(r.predecessors(d),u),delete o[d],l.push(d))}if(e.each(r.sinks(),u),e.size(i)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Cy}var jy,lj;function K$(){if(lj)return jy;lj=1;var e=SI();jy=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return jy}var Ty,cj;function EI(){if(cj)return Ty;cj=1;var e=fa();Ty=t;function t(r,i,o){e.isArray(i)||(i=[i]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(i,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,i,o,l,u,d){e.has(l,i)||(l[i]=!0,o||d.push(i),e.each(u(i),function(f){n(r,f,o,l,u,d)}),o&&d.push(i))}return Ty}var Ry,uj;function Y$(){if(uj)return Ry;uj=1;var e=EI();Ry=t;function t(n,r){return e(n,r,"post")}return Ry}var Ay,dj;function Q$(){if(dj)return Ay;dj=1;var e=EI();Ay=t;function t(n,r){return e(n,r,"pre")}return Ay}var Iy,fj;function X$(){if(fj)return Iy;fj=1;var e=fa(),t=k1(),n=kI();Iy=r;function r(i,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(i.nodeCount()===0)return l;e.each(i.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(i.nodes()[0],0);for(var h=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(f).forEach(p)}return l}return Iy}var My,pj;function Z$(){return pj||(pj=1,My={components:$$(),dijkstra:_I(),dijkstraAll:W$(),findCycles:V$(),floydWarshall:G$(),isAcyclic:K$(),postorder:Y$(),preorder:Q$(),prim:X$(),tarjan:wI(),topsort:SI()}),My}var Ly,hj;function J$(){if(hj)return Ly;hj=1;var e=q$();return Ly={Graph:e.Graph,json:H$(),alg:Z$(),version:e.version},Ly}var Oy,gj;function Aa(){if(gj)return Oy;gj=1;var e;if(typeof a1=="function")try{e=J$()}catch{}return e||(e=window.graphlib),Oy=e,Oy}var Dy,mj;function eW(){if(mj)return Dy;mj=1;var e=Q5(),t=1,n=4;function r(i){return e(i,t|n)}return Dy=r,Dy}var Py,xj;function Ap(){if(xj)return Py;xj=1;var e=Zl(),t=Ss(),n=_p(),r=da();function i(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 Py=i,Py}var Fy,yj;function tW(){if(yj)return Fy;yj=1;var e=Rp(),t=Zl(),n=Ap(),r=sl(),i=Object.prototype,o=i.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,p=d.length,h=p>2?d[2]:void 0;for(h&&n(d[0],d[1],h)&&(p=1);++f<p;)for(var m=d[f],x=r(m),v=-1,k=x.length;++v<k;){var _=x[v],w=u[_];(w===void 0||t(w,i[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return Fy=l,Fy}var By,bj;function nW(){if(bj)return By;bj=1;var e=Es(),t=Ss(),n=ho();function r(i){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=n(o),l=function(h){return f(d[h],h,d)}}var p=i(o,l,u);return p>-1?d[f?o[p]:p]:void 0}}return By=r,By}var zy,vj;function rW(){if(vj)return zy;vj=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return zy=t,zy}var Uy,kj;function iW(){if(kj)return Uy;kj=1;var e=rW(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Uy=n,Uy}var qy,_j;function aW(){if(_j)return qy;_j=1;var e=iW(),t=da(),n=nc(),r=NaN,i=/^[-+]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 h=o.test(f);return h||l.test(f)?u(f.slice(2),h?2:8):i.test(f)?r:+f}return qy=d,qy}var Hy,wj;function NI(){if(wj)return Hy;wj=1;var e=aW(),t=1/0,n=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*n}return i===i?i:0}return Hy=r,Hy}var $y,Sj;function sW(){if(Sj)return $y;Sj=1;var e=NI();function t(n){var r=e(n),i=r%1;return r===r?i?r-i:r:0}return $y=t,$y}var Wy,Ej;function oW(){if(Ej)return Wy;Ej=1;var e=yI(),t=Es(),n=sW(),r=Math.max;function i(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 Wy=i,Wy}var Vy,Nj;function lW(){if(Nj)return Vy;Nj=1;var e=nW(),t=oW(),n=e(t);return Vy=n,Vy}var Gy,Cj;function CI(){if(Cj)return Gy;Cj=1;var e=v1();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Gy=t,Gy}var Ky,jj;function cW(){if(jj)return Ky;jj=1;var e=m1(),t=X5(),n=sl();function r(i,o){return i==null?i:e(i,t(o),n)}return Ky=r,Ky}var Yy,Tj;function uW(){if(Tj)return Yy;Tj=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Yy=e,Yy}var Qy,Rj;function dW(){if(Rj)return Qy;Rj=1;var e=vp(),t=x1(),n=Es();function r(i,o){var l={};return o=n(o,3),t(i,function(u,d,f){e(l,d,o(u,d,f))}),l}return Qy=r,Qy}var Xy,Aj;function _1(){if(Aj)return Xy;Aj=1;var e=nc();function t(n,r,i){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):i(d,f)))var f=d,p=u}return p}return Xy=t,Xy}var Zy,Ij;function fW(){if(Ij)return Zy;Ij=1;function e(t,n){return t>n}return Zy=e,Zy}var Jy,Mj;function pW(){if(Mj)return Jy;Mj=1;var e=_1(),t=fW(),n=ol();function r(i){return i&&i.length?e(i,n,t):void 0}return Jy=r,Jy}var eb,Lj;function jI(){if(Lj)return eb;Lj=1;var e=vp(),t=Zl();function n(r,i,o){(o!==void 0&&!t(r[i],o)||o===void 0&&!(i in r))&&e(r,i,o)}return eb=n,eb}var tb,Oj;function hW(){if(Oj)return tb;Oj=1;var e=il(),t=Ep(),n=Ka(),r="[object Object]",i=Function.prototype,o=Object.prototype,l=i.toString,u=o.hasOwnProperty,d=l.call(Object);function f(p){if(!n(p)||e(p)!=r)return!1;var h=t(p);if(h===null)return!0;var m=u.call(h,"constructor")&&h.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return tb=f,tb}var nb,Dj;function TI(){if(Dj)return nb;Dj=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return nb=e,nb}var rb,Pj;function gW(){if(Pj)return rb;Pj=1;var e=Vu(),t=sl();function n(r){return e(r,t(r))}return rb=n,rb}var ib,Fj;function mW(){if(Fj)return ib;Fj=1;var e=jI(),t=F5(),n=G5(),r=B5(),i=Y5(),o=Gu(),l=Tr(),u=bI(),d=ec(),f=Wu(),p=da(),h=hW(),m=Ku(),x=TI(),v=gW();function k(_,w,S,N,j,R,T){var I=x(_,S),M=x(w,S),L=T.get(M);if(L){e(_,S,L);return}var A=R?R(I,M,S+"",_,w,T):void 0,D=A===void 0;if(D){var $=l(M),ee=!$&&d(M),U=!$&&!ee&&m(M);A=M,$||ee||U?l(I)?A=I:u(I)?A=r(I):ee?(D=!1,A=t(M,!0)):U?(D=!1,A=n(M,!0)):A=[]:h(M)||o(M)?(A=I,o(I)?A=v(I):(!p(I)||f(I))&&(A=i(M))):D=!1}D&&(T.set(M,A),j(A,M,N,R,T),T.delete(M)),e(_,S,A)}return ib=k,ib}var ab,Bj;function xW(){if(Bj)return ab;Bj=1;var e=bp(),t=jI(),n=m1(),r=mW(),i=da(),o=sl(),l=TI();function u(d,f,p,h,m){d!==f&&n(f,function(x,v){if(m||(m=new e),i(x))r(d,f,v,p,u,h,m);else{var k=h?h(l(d,v),x,v+"",d,f,m):void 0;k===void 0&&(k=x),t(d,v,k)}},o)}return ab=u,ab}var sb,zj;function yW(){if(zj)return sb;zj=1;var e=Rp(),t=Ap();function n(r){return e(function(i,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),i=Object(i);++l<u;){var p=o[l];p&&r(i,p,l,d)}return i})}return sb=n,sb}var ob,Uj;function bW(){if(Uj)return ob;Uj=1;var e=xW(),t=yW(),n=t(function(r,i,o){e(r,i,o)});return ob=n,ob}var lb,qj;function RI(){if(qj)return lb;qj=1;function e(t,n){return t<n}return lb=e,lb}var cb,Hj;function vW(){if(Hj)return cb;Hj=1;var e=_1(),t=RI(),n=ol();function r(i){return i&&i.length?e(i,n,t):void 0}return cb=r,cb}var ub,$j;function kW(){if($j)return ub;$j=1;var e=_1(),t=Es(),n=RI();function r(i,o){return i&&i.length?e(i,t(o,2),n):void 0}return ub=r,ub}var db,Wj;function _W(){if(Wj)return db;Wj=1;var e=Ia(),t=function(){return e.Date.now()};return db=t,db}var fb,Vj;function wW(){if(Vj)return fb;Vj=1;var e=kp(),t=jp(),n=_p(),r=da(),i=Yu();function o(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var p=-1,h=u.length,m=h-1,x=l;x!=null&&++p<h;){var v=i(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 fb=o,fb}var pb,Gj;function SW(){if(Gj)return pb;Gj=1;var e=Tp(),t=wW(),n=jp();function r(i,o,l){for(var u=-1,d=o.length,f={};++u<d;){var p=o[u],h=e(i,p);l(h,p)&&t(f,n(p,i),h)}return f}return pb=r,pb}var hb,Kj;function EW(){if(Kj)return hb;Kj=1;var e=SW(),t=lI();function n(r,i){return e(r,i,function(o,l){return t(r,l)})}return hb=n,hb}var gb,Yj;function NW(){if(Yj)return gb;Yj=1;var e=CI(),t=mI(),n=xI();function r(i){return n(t(i,void 0,e),i+"")}return gb=r,gb}var mb,Qj;function CW(){if(Qj)return mb;Qj=1;var e=EW(),t=NW(),n=t(function(r,i){return r==null?{}:e(r,i)});return mb=n,mb}var xb,Xj;function jW(){if(Xj)return xb;Xj=1;var e=Math.ceil,t=Math.max;function n(r,i,o,l){for(var u=-1,d=t(e((i-r)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=o;return f}return xb=n,xb}var yb,Zj;function TW(){if(Zj)return yb;Zj=1;var e=jW(),t=Ap(),n=NI();function r(i){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,i)}}return yb=r,yb}var bb,Jj;function RW(){if(Jj)return bb;Jj=1;var e=TW(),t=e();return bb=t,bb}var vb,eT;function AW(){if(eT)return vb;eT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return vb=e,vb}var kb,tT;function IW(){if(tT)return kb;tT=1;var e=nc();function t(n,r){if(n!==r){var i=n!==void 0,o=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,p=r===r,h=e(r);if(!f&&!h&&!u&&n>r||u&&d&&p&&!f&&!h||o&&d&&p||!i&&p||!l)return 1;if(!o&&!u&&!h&&n<r||h&&i&&l&&!o&&!u||f&&i&&l||!d&&l||!p)return-1}return 0}return kb=t,kb}var _b,nT;function MW(){if(nT)return _b;nT=1;var e=IW();function t(n,r,i){for(var o=-1,l=n.criteria,u=r.criteria,d=l.length,f=i.length;++o<d;){var p=e(l[o],u[o]);if(p){if(o>=f)return p;var h=i[o];return p*(h=="desc"?-1:1)}}return n.index-r.index}return _b=t,_b}var wb,rT;function LW(){if(rT)return wb;rT=1;var e=Cp(),t=Tp(),n=Es(),r=pI(),i=AW(),o=wp(),l=MW(),u=ol(),d=Tr();function f(p,h,m){h.length?h=e(h,function(k){return d(k)?function(_){return t(_,k.length===1?k[0]:k)}:k}):h=[u];var x=-1;h=e(h,o(n));var v=r(p,function(k,_,w){var S=e(h,function(N){return N(k)});return{criteria:S,index:++x,value:k}});return i(v,function(k,_){return l(k,_,m)})}return wb=f,wb}var Sb,iT;function OW(){if(iT)return Sb;iT=1;var e=v1(),t=LW(),n=Rp(),r=Ap(),i=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 Sb=i,Sb}var Eb,aT;function DW(){if(aT)return Eb;aT=1;var e=sI(),t=0;function n(r){var i=++t;return e(r)+i}return Eb=n,Eb}var Nb,sT;function PW(){if(sT)return Nb;sT=1;function e(t,n,r){for(var i=-1,o=t.length,l=n.length,u={};++i<o;){var d=i<l?n[i]:void 0;r(u,t[i],d)}return u}return Nb=e,Nb}var Cb,oT;function FW(){if(oT)return Cb;oT=1;var e=kp(),t=PW();function n(r,i){return t(r||[],i||[],e)}return Cb=n,Cb}var jb,lT;function or(){if(lT)return jb;lT=1;var e;if(typeof a1=="function")try{e={cloneDeep:eW(),constant:g1(),defaults:tW(),each:J5(),filter:uI(),find:lW(),flatten:CI(),forEach:Z5(),forIn:cW(),has:dI(),isUndefined:fI(),last:uW(),map:hI(),mapValues:dW(),max:pW(),merge:bW(),min:vW(),minBy:kW(),now:_W(),pick:CW(),range:RW(),reduce:gI(),sortBy:OW(),uniqueId:DW(),values:vI(),zipObject:FW()}}catch{}return e||(e=window._),jb=e,jb}var Tb,cT;function BW(){if(cT)return Tb;cT=1,Tb=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,i=r._prev;if(i!==r)return t(i),i},e.prototype.enqueue=function(r){var i=this._sentinel;r._prev&&r._next&&t(r),r._next=i._next,i._next._prev=r,i._next=r,r._prev=i},e.prototype.toString=function(){for(var r=[],i=this._sentinel,o=i._prev;o!==i;)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,i){if(r!=="_next"&&r!=="_prev")return i}return Tb}var Rb,uT;function zW(){if(uT)return Rb;uT=1;var e=or(),t=Aa().Graph,n=BW();Rb=i;var r=e.constant(1);function i(f,p){if(f.nodeCount()<=1)return[];var h=u(f,p||r),m=o(h.graph,h.buckets,h.zeroIdx);return e.flatten(e.map(m,function(x){return f.outEdges(x.v,x.w)}),!0)}function o(f,p,h){for(var m=[],x=p[p.length-1],v=p[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,p,h,k);for(;k=x.dequeue();)l(f,p,h,k);if(f.nodeCount()){for(var _=p.length-2;_>0;--_)if(k=p[_].dequeue(),k){m=m.concat(l(f,p,h,k,!0));break}}}return m}function l(f,p,h,m,x){var v=x?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),w=f.node(k.v);x&&v.push({v:k.v,w:k.w}),w.out-=_,d(p,h,w)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),w=k.w,S=f.node(w);S.in-=_,d(p,h,S)}),f.removeNode(m.v),v}function u(f,p){var h=new t,m=0,x=0;e.forEach(f.nodes(),function(_){h.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var w=h.edge(_.v,_.w)||0,S=p(_),N=w+S;h.setEdge(_.v,_.w,N),x=Math.max(x,h.node(_.v).out+=S),m=Math.max(m,h.node(_.w).in+=S)});var v=e.range(x+m+3).map(function(){return new n}),k=m+1;return e.forEach(h.nodes(),function(_){d(v,k,h.node(_))}),{graph:h,buckets:v,zeroIdx:k}}function d(f,p,h){h.out?h.in?f[h.out-h.in+p].enqueue(h):f[f.length-1].enqueue(h):f[0].enqueue(h)}return Rb}var Ab,dT;function UW(){if(dT)return Ab;dT=1;var e=or(),t=zW();Ab={run:n,undo:i};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(h){e.has(u,h.w)?l.push(h):f(h.w)}),delete u[p])}return e.forEach(o.nodes(),f),l}function i(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 Ab}var Ib,fT;function Pi(){if(fT)return Ib;fT=1;var e=or(),t=Aa().Graph;Ib={addDummyNode:n,simplify:r,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:h,maxRank:m,partition:x,time:v,notime:k};function n(_,w,S,N){var j;do j=e.uniqueId(N);while(_.hasNode(j));return S.dummy=w,_.setNode(j,S),j}function r(_){var w=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(S){w.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){var N=w.edge(S.v,S.w)||{weight:0,minlen:1},j=_.edge(S);w.setEdge(S.v,S.w,{weight:N.weight+j.weight,minlen:Math.max(N.minlen,j.minlen)})}),w}function i(_){var w=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(S){_.children(S).length||w.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){w.setEdge(S,_.edge(S))}),w}function o(_){var w=e.map(_.nodes(),function(S){var N={};return e.forEach(_.outEdges(S),function(j){N[j.w]=(N[j.w]||0)+_.edge(j).weight}),N});return e.zipObject(_.nodes(),w)}function l(_){var w=e.map(_.nodes(),function(S){var N={};return e.forEach(_.inEdges(S),function(j){N[j.v]=(N[j.v]||0)+_.edge(j).weight}),N});return e.zipObject(_.nodes(),w)}function u(_,w){var S=_.x,N=_.y,j=w.x-S,R=w.y-N,T=_.width/2,I=_.height/2;if(!j&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var M,L;return Math.abs(R)*T>Math.abs(j)*I?(R<0&&(I=-I),M=I*j/R,L=I):(j<0&&(T=-T),M=T,L=T*R/j),{x:S+M,y:N+L}}function d(_){var w=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(S){var N=_.node(S),j=N.rank;e.isUndefined(j)||(w[j][N.order]=S)}),w}function f(_){var w=e.min(e.map(_.nodes(),function(S){return _.node(S).rank}));e.forEach(_.nodes(),function(S){var N=_.node(S);e.has(N,"rank")&&(N.rank-=w)})}function p(_){var w=e.min(e.map(_.nodes(),function(R){return _.node(R).rank})),S=[];e.forEach(_.nodes(),function(R){var T=_.node(R).rank-w;S[T]||(S[T]=[]),S[T].push(R)});var N=0,j=_.graph().nodeRankFactor;e.forEach(S,function(R,T){e.isUndefined(R)&&T%j!==0?--N:N&&e.forEach(R,function(I){_.node(I).rank+=N})})}function h(_,w,S,N){var j={width:0,height:0};return arguments.length>=4&&(j.rank=S,j.order=N),n(_,"border",j,w)}function m(_){return e.max(e.map(_.nodes(),function(w){var S=_.node(w).rank;if(!e.isUndefined(S))return S}))}function x(_,w){var S={lhs:[],rhs:[]};return e.forEach(_,function(N){w(N)?S.lhs.push(N):S.rhs.push(N)}),S}function v(_,w){var S=e.now();try{return w()}finally{console.log(_+" time: "+(e.now()-S)+"ms")}}function k(_,w){return w()}return Ib}var Mb,pT;function qW(){if(pT)return Mb;pT=1;var e=or(),t=Pi();Mb={run:n,undo:i};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,h=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},h),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},h)}}function i(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 Lb,hT;function Kf(){if(hT)return Lb;hT=1;var e=or();Lb={longestPath:t,slack:n};function t(r){var i={};function o(l){var u=r.node(l);if(e.has(i,l))return u.rank;i[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,i){return r.node(i.w).rank-r.node(i.v).rank-r.edge(i).minlen}return Lb}var Ob,gT;function AI(){if(gT)return Ob;gT=1;var e=or(),t=Aa().Graph,n=Kf().slack;Ob=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],p=u.nodeCount();d.setNode(f,{});for(var h,m;i(d,u)<p;)h=o(d,u),m=d.hasNode(h.v)?n(u,h):-n(u,h),l(d,u,m);return d}function i(u,d){function f(p){e.forEach(d.nodeEdges(p),function(h){var m=h.v,x=p===m?h.w:m;!u.hasNode(x)&&!n(d,h)&&(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 Ob}var Db,mT;function HW(){if(mT)return Db;mT=1;var e=or(),t=AI(),n=Kf().slack,r=Kf().longestPath,i=Aa().alg.preorder,o=Aa().alg.postorder,l=Pi().simplify;Db=u,u.initLowLimValues=h,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=k;function u(N){N=l(N),r(N);var j=t(N);h(j),d(j,N);for(var R,T;R=x(j);)T=v(j,N,R),k(j,N,R,T)}function d(N,j){var R=o(N,N.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(T){f(N,j,T)})}function f(N,j,R){var T=N.node(R),I=T.parent;N.edge(R,I).cutvalue=p(N,j,R)}function p(N,j,R){var T=N.node(R),I=T.parent,M=!0,L=j.edge(R,I),A=0;return L||(M=!1,L=j.edge(I,R)),A=L.weight,e.forEach(j.nodeEdges(R),function(D){var $=D.v===R,ee=$?D.w:D.v;if(ee!==I){var U=$===M,G=j.edge(D).weight;if(A+=U?G:-G,w(N,R,ee)){var Z=N.edge(R,ee).cutvalue;A+=U?-Z:Z}}}),A}function h(N,j){arguments.length<2&&(j=N.nodes()[0]),m(N,{},1,j)}function m(N,j,R,T,I){var M=R,L=N.node(T);return j[T]=!0,e.forEach(N.neighbors(T),function(A){e.has(j,A)||(R=m(N,j,R,A,T))}),L.low=M,L.lim=R++,I?L.parent=I:delete L.parent,R}function x(N){return e.find(N.edges(),function(j){return N.edge(j).cutvalue<0})}function v(N,j,R){var T=R.v,I=R.w;j.hasEdge(T,I)||(T=R.w,I=R.v);var M=N.node(T),L=N.node(I),A=M,D=!1;M.lim>L.lim&&(A=L,D=!0);var $=e.filter(j.edges(),function(ee){return D===S(N,N.node(ee.v),A)&&D!==S(N,N.node(ee.w),A)});return e.minBy($,function(ee){return n(j,ee)})}function k(N,j,R,T){var I=R.v,M=R.w;N.removeEdge(I,M),N.setEdge(T.v,T.w,{}),h(N),d(N,j),_(N,j)}function _(N,j){var R=e.find(N.nodes(),function(I){return!j.node(I).parent}),T=i(N,R);T=T.slice(1),e.forEach(T,function(I){var M=N.node(I).parent,L=j.edge(I,M),A=!1;L||(L=j.edge(M,I),A=!0),j.node(I).rank=j.node(M).rank+(A?L.minlen:-L.minlen)})}function w(N,j,R){return N.hasEdge(j,R)}function S(N,j,R){return R.low<=j.lim&&j.lim<=R.lim}return Db}var Pb,xT;function $W(){if(xT)return Pb;xT=1;var e=Kf(),t=e.longestPath,n=AI(),r=HW();Pb=i;function i(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 Pb}var Fb,yT;function WW(){if(yT)return Fb;yT=1;var e=or();Fb=t;function t(i){var o=r(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),d=u.edgeObj,f=n(i,o,d.v,d.w),p=f.path,h=f.lca,m=0,x=p[m],v=!0;l!==d.w;){if(u=i.node(l),v){for(;(x=p[m])!==h&&i.node(x).maxRank<u.rank;)m++;x===h&&(v=!1)}if(!v){for(;m<p.length-1&&i.node(x=p[m+1]).minRank<=u.rank;)m++;x=p[m]}i.setParent(l,x),l=i.successors(l)[0]}})}function n(i,o,l,u){var d=[],f=[],p=Math.min(o[l].low,o[u].low),h=Math.max(o[l].lim,o[u].lim),m,x;m=l;do m=i.parent(m),d.push(m);while(m&&(o[m].low>p||h>o[m].lim));for(x=m,m=u;(m=i.parent(m))!==x;)f.push(m);return{path:d.concat(f.reverse()),lca:x}}function r(i){var o={},l=0;function u(d){var f=l;e.forEach(i.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(i.children(),u),o}return Fb}var Bb,bT;function VW(){if(bT)return Bb;bT=1;var e=or(),t=Pi();Bb={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=i(u),p=e.max(e.values(f))-1,h=2*p+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(x){u.edge(x).minlen*=h});var m=o(u)+1;e.forEach(u.children(),function(x){r(u,d,h,m,p,f,x)}),u.graph().nodeRankFactor=h}function r(u,d,f,p,h,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"),w=u.node(x);u.setParent(k,x),w.borderTop=k,u.setParent(_,x),w.borderBottom=_,e.forEach(v,function(S){r(u,d,f,p,h,m,S);var N=u.node(S),j=N.borderTop?N.borderTop:S,R=N.borderBottom?N.borderBottom:S,T=N.borderTop?p:2*p,I=j!==R?1:h-m[x]+1;u.setEdge(k,j,{weight:T,minlen:I,nestingEdge:!0}),u.setEdge(R,_,{weight:T,minlen:I,nestingEdge:!0})}),u.parent(x)||u.setEdge(d,k,{weight:0,minlen:h+m[x]})}function i(u){var d={};function f(p,h){var m=u.children(p);m&&m.length&&e.forEach(m,function(x){f(x,h+1)}),d[p]=h}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 Bb}var zb,vT;function GW(){if(vT)return zb;vT=1;var e=or(),t=Pi();zb=n;function n(i){function o(l){var u=i.children(l),d=i.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(i,"borderLeft","_bl",l,d,f),r(i,"borderRight","_br",l,d,f)}}e.forEach(i.children(),o)}function r(i,o,l,u,d,f){var p={width:0,height:0,rank:f,borderType:o},h=d[o][f-1],m=t.addDummyNode(i,"border",p,l);d[o][f]=m,i.setParent(m,u),h&&i.setEdge(h,m,{weight:1})}return zb}var Ub,kT;function KW(){if(kT)return Ub;kT=1;var e=or();Ub={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){i(f.node(p))}),e.forEach(f.edges(),function(p){i(f.edge(p))})}function i(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 h=f.edge(p);e.forEach(h.points,l),e.has(h,"y")&&l(h)})}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 h=f.edge(p);e.forEach(h.points,d),e.has(h,"x")&&d(h)})}function d(f){var p=f.x;f.x=f.y,f.y=p}return Ub}var qb,_T;function YW(){if(_T)return qb;_T=1;var e=or();qb=t;function t(n){var r={},i=e.filter(n.nodes(),function(f){return!n.children(f).length}),o=e.max(e.map(i,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(i,function(f){return n.node(f).rank});return e.forEach(d,u),l}return qb}var Hb,wT;function QW(){if(wT)return Hb;wT=1;var e=or();Hb=t;function t(r,i){for(var o=0,l=1;l<i.length;++l)o+=n(r,i[l-1],i[l]);return o}function n(r,i,o){for(var l=e.zipObject(o,e.map(o,function(m,x){return x})),u=e.flatten(e.map(i,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}),h=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;h+=m.weight*v})),h}return Hb}var $b,ST;function XW(){if(ST)return $b;ST=1;var e=or();$b=t;function t(n,r){return e.map(r,function(i){var o=n.inEdges(i);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:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return $b}var Wb,ET;function ZW(){if(ET)return Wb;ET=1;var e=or();Wb=t;function t(i,o){var l={};e.forEach(i,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(i){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&&i.push(p)}}for(;i.length;){var d=i.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(i,o){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(o.i,i.i),o.merged=!0}return Wb}var Vb,NT;function JW(){if(NT)return Vb;NT=1;var e=or(),t=Pi();Vb=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=[],h=0,m=0,x=0;d.sort(i(!!l)),x=r(p,f,x),e.forEach(d,function(k){x+=k.vs.length,p.push(k.vs),h+=k.barycenter*k.weight,m+=k.weight,x=r(p,f,x)});var v={vs:e.flatten(p,!0)};return m&&(v.barycenter=h/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 i(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 Vb}var Gb,CT;function eV(){if(CT)return Gb;CT=1;var e=or(),t=XW(),n=ZW(),r=JW();Gb=i;function i(u,d,f,p){var h=u.children(d),m=u.node(d),x=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};x&&(h=e.filter(h,function(R){return R!==x&&R!==v}));var _=t(u,h);e.forEach(_,function(R){if(u.children(R.v).length){var T=i(u,R.v,f,p);k[R.v]=T,e.has(T,"barycenter")&&l(R,T)}});var w=n(_,f);o(w,k);var S=r(w,p);if(x&&(S.vs=e.flatten([x,S.vs,v],!0),u.predecessors(x).length)){var N=u.node(u.predecessors(x)[0]),j=u.node(u.predecessors(v)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+N.order+j.order)/(S.weight+2),S.weight+=2}return S}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 Gb}var Kb,jT;function tV(){if(jT)return Kb;jT=1;var e=or(),t=Aa().Graph;Kb=n;function n(i,o,l){var u=r(i),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return i.node(f)});return e.forEach(i.nodes(),function(f){var p=i.node(f),h=i.parent(f);(p.rank===o||p.minRank<=o&&o<=p.maxRank)&&(d.setNode(f),d.setParent(f,h||u),e.forEach(i[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:i.edge(m).weight+k})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),d}function r(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return Kb}var Yb,TT;function nV(){if(TT)return Yb;TT=1;var e=or();Yb=t;function t(n,r,i){var o={},l;e.forEach(i,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 Yb}var Qb,RT;function rV(){if(RT)return Qb;RT=1;var e=or(),t=YW(),n=QW(),r=eV(),i=tV(),o=nV(),l=Aa().Graph,u=Pi();Qb=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);h(m,_);for(var w=Number.POSITIVE_INFINITY,S,N=0,j=0;j<4;++N,++j){p(N%2?v:k,N%4>=2),_=u.buildLayerMatrix(m);var R=n(m,_);R<w&&(j=0,S=e.cloneDeep(_),w=R)}h(m,S)}function f(m,x,v){return e.map(x,function(k){return i(m,k,v)})}function p(m,x){var v=new l;e.forEach(m,function(k){var _=k.graph().root,w=r(k,_,v,x);e.forEach(w.vs,function(S,N){k.node(S).order=N}),o(k,v,w.vs)})}function h(m,x){e.forEach(x,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return Qb}var Xb,AT;function iV(){if(AT)return Xb;AT=1;var e=or(),t=Aa().Graph,n=Pi();Xb={positionX:v,findType1Conflicts:r,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:h,balance:x};function r(w,S){var N={};function j(R,T){var I=0,M=0,L=R.length,A=e.last(T);return e.forEach(T,function(D,$){var ee=o(w,D),U=ee?w.node(ee).order:L;(ee||D===A)&&(e.forEach(T.slice(M,$+1),function(G){e.forEach(w.predecessors(G),function(Z){var z=w.node(Z),q=z.order;(q<I||U<q)&&!(z.dummy&&w.node(G).dummy)&&l(N,Z,G)})}),M=$+1,I=U)}),T}return e.reduce(S,j),N}function i(w,S){var N={};function j(T,I,M,L,A){var D;e.forEach(e.range(I,M),function($){D=T[$],w.node(D).dummy&&e.forEach(w.predecessors(D),function(ee){var U=w.node(ee);U.dummy&&(U.order<L||U.order>A)&&l(N,ee,D)})})}function R(T,I){var M=-1,L,A=0;return e.forEach(I,function(D,$){if(w.node(D).dummy==="border"){var ee=w.predecessors(D);ee.length&&(L=w.node(ee[0]).order,j(I,A,$,M,L),A=$,M=L)}j(I,A,I.length,L,T.length)}),I}return e.reduce(S,R),N}function o(w,S){if(w.node(S).dummy)return e.find(w.predecessors(S),function(N){return w.node(N).dummy})}function l(w,S,N){if(S>N){var j=S;S=N,N=j}var R=w[S];R||(w[S]=R={}),R[N]=!0}function u(w,S,N){if(S>N){var j=S;S=N,N=j}return e.has(w[S],N)}function d(w,S,N,j){var R={},T={},I={};return e.forEach(S,function(M){e.forEach(M,function(L,A){R[L]=L,T[L]=L,I[L]=A})}),e.forEach(S,function(M){var L=-1;e.forEach(M,function(A){var D=j(A);if(D.length){D=e.sortBy(D,function(Z){return I[Z]});for(var $=(D.length-1)/2,ee=Math.floor($),U=Math.ceil($);ee<=U;++ee){var G=D[ee];T[A]===A&&L<I[G]&&!u(N,A,G)&&(T[G]=A,T[A]=R[A]=R[G],L=I[G])}}})}),{root:R,align:T}}function f(w,S,N,j,R){var T={},I=p(w,S,N,R),M=R?"borderLeft":"borderRight";function L($,ee){for(var U=I.nodes(),G=U.pop(),Z={};G;)Z[G]?$(G):(Z[G]=!0,U.push(G),U=U.concat(ee(G))),G=U.pop()}function A($){T[$]=I.inEdges($).reduce(function(ee,U){return Math.max(ee,T[U.v]+I.edge(U))},0)}function D($){var ee=I.outEdges($).reduce(function(G,Z){return Math.min(G,T[Z.w]-I.edge(Z))},Number.POSITIVE_INFINITY),U=w.node($);ee!==Number.POSITIVE_INFINITY&&U.borderType!==M&&(T[$]=Math.max(T[$],ee))}return L(A,I.predecessors.bind(I)),L(D,I.successors.bind(I)),e.forEach(j,function($){T[$]=T[N[$]]}),T}function p(w,S,N,j){var R=new t,T=w.graph(),I=k(T.nodesep,T.edgesep,j);return e.forEach(S,function(M){var L;e.forEach(M,function(A){var D=N[A];if(R.setNode(D),L){var $=N[L],ee=R.edge($,D);R.setEdge($,D,Math.max(I(w,A,L),ee||0))}L=A})}),R}function h(w,S){return e.minBy(e.values(S),function(N){var j=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(N,function(T,I){var M=_(w,I)/2;j=Math.max(T+M,j),R=Math.min(T-M,R)}),j-R})}function m(w,S){var N=e.values(S),j=e.min(N),R=e.max(N);e.forEach(["u","d"],function(T){e.forEach(["l","r"],function(I){var M=T+I,L=w[M],A;if(L!==S){var D=e.values(L);A=I==="l"?j-e.min(D):R-e.max(D),A&&(w[M]=e.mapValues(L,function($){return $+A}))}})})}function x(w,S){return e.mapValues(w.ul,function(N,j){if(S)return w[S.toLowerCase()][j];var R=e.sortBy(e.map(w,j));return(R[1]+R[2])/2})}function v(w){var S=n.buildLayerMatrix(w),N=e.merge(r(w,S),i(w,S)),j={},R;e.forEach(["u","d"],function(I){R=I==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(M){M==="r"&&(R=e.map(R,function($){return e.values($).reverse()}));var L=(I==="u"?w.predecessors:w.successors).bind(w),A=d(w,R,N,L),D=f(w,R,A.root,A.align,M==="r");M==="r"&&(D=e.mapValues(D,function($){return-$})),j[I+M]=D})});var T=h(w,j);return m(j,T),x(j,w.graph().align)}function k(w,S,N){return function(j,R,T){var I=j.node(R),M=j.node(T),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?S:w)/2,L+=(M.dummy?S:w)/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 _(w,S){return w.node(S).width}return Xb}var Zb,IT;function aV(){if(IT)return Zb;IT=1;var e=or(),t=Pi(),n=iV().positionX;Zb=r;function r(o){o=t.asNonCompoundGraph(o),i(o),e.forEach(n(o),function(l,u){o.node(u).x=l})}function i(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(h){return o.node(h).height}));e.forEach(f,function(h){o.node(h).y=d+p/2}),d+=p+u})}return Zb}var Jb,MT;function sV(){if(MT)return Jb;MT=1;var e=or(),t=UW(),n=qW(),r=$W(),i=Pi().normalizeRanks,o=WW(),l=Pi().removeEmptyRanks,u=VW(),d=GW(),f=KW(),p=rV(),h=aV(),m=Pi(),x=Aa().Graph;Jb=v;function v(K,W){var H=W&&W.debugTiming?m.time:m.notime;H("layout",function(){var se=H(" buildLayoutGraph",function(){return L(K)});H(" runLayout",function(){k(se,H)}),H(" updateInputGraph",function(){_(K,se)})})}function k(K,W){W(" makeSpaceForEdgeLabels",function(){A(K)}),W(" removeSelfEdges",function(){ae(K)}),W(" acyclic",function(){t.run(K)}),W(" nestingGraph.run",function(){u.run(K)}),W(" rank",function(){r(m.asNonCompoundGraph(K))}),W(" injectEdgeLabelProxies",function(){D(K)}),W(" removeEmptyRanks",function(){l(K)}),W(" nestingGraph.cleanup",function(){u.cleanup(K)}),W(" normalizeRanks",function(){i(K)}),W(" assignRankMinMax",function(){$(K)}),W(" removeEdgeLabelProxies",function(){ee(K)}),W(" normalize.run",function(){n.run(K)}),W(" parentDummyChains",function(){o(K)}),W(" addBorderSegments",function(){d(K)}),W(" order",function(){p(K)}),W(" insertSelfEdges",function(){P(K)}),W(" adjustCoordinateSystem",function(){f.adjust(K)}),W(" position",function(){h(K)}),W(" positionSelfEdges",function(){Q(K)}),W(" removeBorderNodes",function(){q(K)}),W(" normalize.undo",function(){n.undo(K)}),W(" fixupEdgeLabelCoords",function(){Z(K)}),W(" undoCoordinateSystem",function(){f.undo(K)}),W(" translateGraph",function(){U(K)}),W(" assignNodeIntersects",function(){G(K)}),W(" reversePoints",function(){z(K)}),W(" acyclic.undo",function(){t.undo(K)})}function _(K,W){e.forEach(K.nodes(),function(H){var se=K.node(H),ie=W.node(H);se&&(se.x=ie.x,se.y=ie.y,W.children(H).length&&(se.width=ie.width,se.height=ie.height))}),e.forEach(K.edges(),function(H){var se=K.edge(H),ie=W.edge(H);se.points=ie.points,e.has(ie,"x")&&(se.x=ie.x,se.y=ie.y)}),K.graph().width=W.graph().width,K.graph().height=W.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],j=["width","height"],R={width:0,height:0},T=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function L(K){var W=new x({multigraph:!0,compound:!0}),H=F(K.graph());return W.setGraph(e.merge({},S,J(H,w),e.pick(H,N))),e.forEach(K.nodes(),function(se){var ie=F(K.node(se));W.setNode(se,e.defaults(J(ie,j),R)),W.setParent(se,K.parent(se))}),e.forEach(K.edges(),function(se){var ie=F(K.edge(se));W.setEdge(se,e.merge({},I,J(ie,T),e.pick(ie,M)))}),W}function A(K){var W=K.graph();W.ranksep/=2,e.forEach(K.edges(),function(H){var se=K.edge(H);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function D(K){e.forEach(K.edges(),function(W){var H=K.edge(W);if(H.width&&H.height){var se=K.node(W.v),ie=K.node(W.w),ge={rank:(ie.rank-se.rank)/2+se.rank,e:W};m.addDummyNode(K,"edge-proxy",ge,"_ep")}})}function $(K){var W=0;e.forEach(K.nodes(),function(H){var se=K.node(H);se.borderTop&&(se.minRank=K.node(se.borderTop).rank,se.maxRank=K.node(se.borderBottom).rank,W=e.max(W,se.maxRank))}),K.graph().maxRank=W}function ee(K){e.forEach(K.nodes(),function(W){var H=K.node(W);H.dummy==="edge-proxy"&&(K.edge(H.e).labelRank=H.rank,K.removeNode(W))})}function U(K){var W=Number.POSITIVE_INFINITY,H=0,se=Number.POSITIVE_INFINITY,ie=0,ge=K.graph(),we=ge.marginx||0,Ke=ge.marginy||0;function xt(et){var vt=et.x,lt=et.y,je=et.width,Oe=et.height;W=Math.min(W,vt-je/2),H=Math.max(H,vt+je/2),se=Math.min(se,lt-Oe/2),ie=Math.max(ie,lt+Oe/2)}e.forEach(K.nodes(),function(et){xt(K.node(et))}),e.forEach(K.edges(),function(et){var vt=K.edge(et);e.has(vt,"x")&&xt(vt)}),W-=we,se-=Ke,e.forEach(K.nodes(),function(et){var vt=K.node(et);vt.x-=W,vt.y-=se}),e.forEach(K.edges(),function(et){var vt=K.edge(et);e.forEach(vt.points,function(lt){lt.x-=W,lt.y-=se}),e.has(vt,"x")&&(vt.x-=W),e.has(vt,"y")&&(vt.y-=se)}),ge.width=H-W+we,ge.height=ie-se+Ke}function G(K){e.forEach(K.edges(),function(W){var H=K.edge(W),se=K.node(W.v),ie=K.node(W.w),ge,we;H.points?(ge=H.points[0],we=H.points[H.points.length-1]):(H.points=[],ge=ie,we=se),H.points.unshift(m.intersectRect(se,ge)),H.points.push(m.intersectRect(ie,we))})}function Z(K){e.forEach(K.edges(),function(W){var H=K.edge(W);if(e.has(H,"x"))switch((H.labelpos==="l"||H.labelpos==="r")&&(H.width-=H.labeloffset),H.labelpos){case"l":H.x-=H.width/2+H.labeloffset;break;case"r":H.x+=H.width/2+H.labeloffset;break}})}function z(K){e.forEach(K.edges(),function(W){var H=K.edge(W);H.reversed&&H.points.reverse()})}function q(K){e.forEach(K.nodes(),function(W){if(K.children(W).length){var H=K.node(W),se=K.node(H.borderTop),ie=K.node(H.borderBottom),ge=K.node(e.last(H.borderLeft)),we=K.node(e.last(H.borderRight));H.width=Math.abs(we.x-ge.x),H.height=Math.abs(ie.y-se.y),H.x=ge.x+H.width/2,H.y=se.y+H.height/2}}),e.forEach(K.nodes(),function(W){K.node(W).dummy==="border"&&K.removeNode(W)})}function ae(K){e.forEach(K.edges(),function(W){if(W.v===W.w){var H=K.node(W.v);H.selfEdges||(H.selfEdges=[]),H.selfEdges.push({e:W,label:K.edge(W)}),K.removeEdge(W)}})}function P(K){var W=m.buildLayerMatrix(K);e.forEach(W,function(H){var se=0;e.forEach(H,function(ie,ge){var we=K.node(ie);we.order=ge+se,e.forEach(we.selfEdges,function(Ke){m.addDummyNode(K,"selfedge",{width:Ke.label.width,height:Ke.label.height,rank:we.rank,order:ge+ ++se,e:Ke.e,label:Ke.label},"_se")}),delete we.selfEdges})})}function Q(K){e.forEach(K.nodes(),function(W){var H=K.node(W);if(H.dummy==="selfedge"){var se=K.node(H.e.v),ie=se.x+se.width/2,ge=se.y,we=H.x-ie,Ke=se.height/2;K.setEdge(H.e,H.label),K.removeNode(W),H.label.points=[{x:ie+2*we/3,y:ge-Ke},{x:ie+5*we/6,y:ge-Ke},{x:ie+we,y:ge},{x:ie+5*we/6,y:ge+Ke},{x:ie+2*we/3,y:ge+Ke}],H.label.x=H.x,H.label.y=H.y}})}function J(K,W){return e.mapValues(e.pick(K,W),Number)}function F(K){var W={};return e.forEach(K,function(H,se){W[se.toLowerCase()]=H}),W}return Jb}var ev,LT;function oV(){if(LT)return ev;LT=1;var e=or(),t=Pi(),n=Aa().Graph;ev={debugOrdering:r};function r(i){var o=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.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,h){return l.setEdge(p,h,{style:"invis"}),h})}),l}return ev}var tv,OT;function lV(){return OT||(OT=1,tv="0.8.5"),tv}var nv,DT;function cV(){return DT||(DT=1,nv={graphlib:Aa(),layout:sV(),debug:oV(),util:{time:Pi().time,notime:Pi().notime},version:lV()}),nv}var uV=cV();const Yf=Gl(uV),dV={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"}},fV={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 pV(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function PT(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function hV({todos:e,darkMode:t,displayLayout:n,setLayoutField:r}){const i=Array.isArray(e)?e:[],[o,l]=y.useState(null),u=y.useRef(null),d=y.useRef(null),[f,p]=y.useState(400),[h,m]=y.useState(function(){const U=Number(n&&n.mapZoom);return Number.isFinite(U)&&U>.1?U:1});y.useEffect(function(){r&&(n&&n.mapZoom===h||r("mapZoom",h))},[h,n,r]);const[x,v]=y.useState(function(){return!(n&&n.mapShowCompleted===!1)});y.useEffect(function(){r&&(n&&n.mapShowCompleted===x||r("mapShowCompleted",x))},[x,n,r]);const[k,_]=y.useState(function(){return(n&&n.mapRankdir)==="LR"?"LR":"TB"});y.useEffect(function(){r&&(n&&n.mapRankdir===k||r("mapRankdir",k))},[k,n,r]);const w=y.useMemo(function(){if(x)return i;const U=i.filter(function(Z){return Z.status!=="completed"}),G={};return U.forEach(function(Z){G[Z.id]=!0}),U.map(function(Z){if(!Z.blockedBy||!Z.blockedBy.length)return Z;const z=Z.blockedBy.filter(function(q){return G[q]});return z.length===Z.blockedBy.length?Z:Object.assign({},Z,{blockedBy:z})})},[i,x]);y.useEffect(function(){if(!u.current)return;function U(){u.current&&p(u.current.clientWidth||400)}U();const G=new ResizeObserver(U);return G.observe(u.current),function(){G.disconnect()}},[]);const S=y.useMemo(function(){if(!w.length)return{nodes:[],edges:[],width:0,height:0};const U=new Yf.graphlib.Graph;U.setGraph({rankdir:k,nodesep:24,ranksep:36,marginx:16,marginy:16}),U.setDefaultEdgeLabel(function(){return{}});const G=180,Z=56;w.forEach(function(ae){U.setNode(String(ae.id),{width:G,height:Z,todo:ae})}),w.forEach(function(ae){(ae.blockedBy||[]).forEach(function(Q){U.hasNode(String(Q))&&U.setEdge(String(Q),String(ae.id))})}),Yf.layout(U);const z=U.nodes().map(function(ae){const P=U.node(ae);return{id:ae,x:P.x-G/2,y:P.y-Z/2,w:G,h:Z,todo:P.todo}}),q=U.edges().map(function(ae){const P=U.edge(ae);return{from:ae.v,to:ae.w,points:P.points}});return{nodes:z,edges:q,width:U.graph().width||G+32,height:U.graph().height||Z+32}},[w,k]),N=t?fV:dV;if(!w.length){const U=i.length-w.length;return a.jsxs("div",{ref:u,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[a.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:a.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),U>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[U," completed ",U===1?"todo is":"todos are"," hidden."]}),a.jsx("button",{type:"button",onClick:function(){v(!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"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),a.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 ",a.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function j(U){if(!U||U.length<2)return"";let G="M "+U[0].x+" "+U[0].y;for(let Z=1;Z<U.length;Z++)G+=" L "+U[Z].x+" "+U[Z].y;return G}const R=i.reduce(function(U,G){const Z=PT(G);return U[Z]=(U[Z]||0)+1,U},{}),T=R.completed||0,I=Math.max(S.width,100),M=Math.max(S.height,100),A=(I>f-24?1:(f-24)/I)*h,D=I*A,$=M*A;function ee(U){(U.ctrlKey||U.metaKey)&&(U.preventDefault(),m(function(G){const Z=U.deltaY<0?G*1.1:G/1.1;return Math.max(.25,Math.min(4,Z))}))}return a.jsxs("div",{ref:u,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[a.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{children:[i.length," total"]}),R.in_progress?a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[R.in_progress," active"]}):null,T?a.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[T," done"]}):null,R.blocked?a.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[R.blocked," blocked"]}):null,a.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[a.jsx("button",{type:"button",onClick:function(){_(function(U){return U==="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:k==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:k==="TB"?"↓":"→"}),a.jsx("button",{type:"button",onClick:function(){m(function(U){return Math.max(.25,U/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:"−"}),a.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(h*100),"%"]}),a.jsx("button",{type:"button",onClick:function(){m(function(U){return Math.min(4,U*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:"+"})]}),T>0?a.jsx("button",{type:"button",onClick:function(){v(function(U){return!U})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(x?"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:x?"Hide completed todos":"Show completed todos",children:x?"hide done":"show done"}):null]})]}),a.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:ee,children:a.jsxs("svg",{viewBox:"0 0 "+I+" "+M,width:D,height:$,style:{display:"block"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),S.edges.map(function(U,G){return a.jsx("path",{d:j(U.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+G)}),S.nodes.map(function(U){const G=PT(U.todo),Z=N[G],z=G==="in_progress",q=o===U.id;return a.jsxs("g",{transform:"translate("+U.x+","+U.y+")",onMouseEnter:function(){l(U.id)},onMouseLeave:function(){l(null)},style:{cursor:"pointer"},children:[a.jsx("rect",{width:U.w,height:U.h,rx:6,ry:6,fill:Z.fill,stroke:Z.stroke,strokeWidth:z||q?2:1.25,children:z?a.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),z?a.jsx("circle",{cx:10,cy:10,r:3.5,fill:Z.stroke,children:a.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,a.jsx("text",{x:U.w/2,y:U.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:Z.label,children:"#"+U.todo.id}),a.jsx("text",{x:U.w/2,y:U.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:pV(U.todo.text,26)}),q&&U.todo.text&&U.todo.text.length>26?a.jsx("title",{children:U.todo.text}):null]},U.id)})]})})]})}const gV={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"}},mV={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},xV={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},yV={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"}},bV={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},vV={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},kV={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},_V={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},eo={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function wV(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function SV(e,t){return e.kind==="thought"?t?_V:kV:e.status==="error"?t?vV:xV:(t?yV:gV)[e.tool]||(t?bV:mV)}function EV({graph:e,darkMode:t,onNodeClick:n,displayLayout:r,setLayoutField:i}){const o=e&&Array.isArray(e.nodes)?e.nodes:[],l=e&&Array.isArray(e.edges)?e.edges:[],u=y.useRef(null),d=y.useRef(null),[f,p]=y.useState(null),[h,m]=y.useState(400),[x,v]=y.useState(function(){const z=Number(r&&r.toolmapZoom);return Number.isFinite(z)&&z>.1?z:1});y.useEffect(function(){i&&(r&&r.toolmapZoom===x||i("toolmapZoom",x))},[x,r,i]);const[k,_]=y.useState(function(){return(r&&r.toolmapRankdir)==="LR"?"LR":"TB"});y.useEffect(function(){i&&(r&&r.toolmapRankdir===k||i("toolmapRankdir",k))},[k,r,i]);const[w,S]=y.useState(function(){return!!(r&&r.toolmapShowHidden)});y.useEffect(function(){i&&(r&&r.toolmapShowHidden===w||i("toolmapShowHidden",w))},[w,r,i]);const[N,j]=y.useState(function(){return!!(r&&r.toolmapShowThoughts)});y.useEffect(function(){i&&(r&&r.toolmapShowThoughts===N||i("toolmapShowThoughts",N))},[N,r,i]);const R=y.useMemo(function(){let z=o;return w||(z=z.filter(function(q){return!q.hidden})),N||(z=z.filter(function(q){return q.kind!=="thought"})),z},[o,w,N]),T=y.useMemo(function(){const z={};return R.forEach(function(q){z[q.id]=!0}),l.filter(function(q){return z[q.from]&&z[q.to]})},[l,R]),I=y.useMemo(function(){if(!R.length)return{nodes:[],edges:[],width:0,height:0};const z=new Yf.graphlib.Graph;z.setGraph({rankdir:k,nodesep:18,ranksep:32,marginx:14,marginy:14}),z.setDefaultEdgeLabel(function(){return{}});const q=168,ae=44,P=240,Q=60;R.forEach(function(K){K.kind==="thought"?z.setNode(K.id,{width:P,height:Q,node:K}):z.setNode(K.id,{width:q,height:ae,node:K})}),T.forEach(function(K){z.hasNode(K.from)&&z.hasNode(K.to)&&z.setEdge(K.from,K.to,{kind:K.kind})}),Yf.layout(z);const J=z.nodes().map(function(K){const W=z.node(K);return{id:K,x:W.x-W.width/2,y:W.y-W.height/2,w:W.width,h:W.height,node:W.node}}),F=z.edges().map(function(K){const W=z.edge(K);return{from:K.v,to:K.w,points:W.points||[],kind:W.kind||"seq"}});return{nodes:J,edges:F,width:z.graph().width||q+28,height:z.graph().height||ae+28}},[R,T,k]);y.useEffect(function(){if(!u.current)return;function z(){u.current&&m(u.current.clientWidth||400)}z();const q=new ResizeObserver(z);return q.observe(u.current),function(){q.disconnect()}},[]);const M=y.useMemo(function(){const z={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return o.forEach(function(q){if(q.kind==="thought"){z.thoughts++;return}z.total++,q.hidden&&z.hidden++,q.status==="error"?z.error++:q.status==="running"?z.running++:z.ok++}),z},[o]);if(!R.length)return a.jsxs("div",{ref:u,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[a.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:a.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),a.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."}),M.hidden>0&&!w?a.jsxs("button",{type:"button",onClick:function(){S(!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 ",M.hidden," hidden"]}):null]});function L(z){if(!z||z.length<2)return"";let q="M "+z[0].x+" "+z[0].y;for(let ae=1;ae<z.length;ae++)q+=" L "+z[ae].x+" "+z[ae].y;return q}const A=Math.max(I.width,100),D=Math.max(I.height,100),ee=(A>h-24?1:(h-24)/A)*x,U=A*ee,G=D*ee;function Z(z){(z.ctrlKey||z.metaKey)&&(z.preventDefault(),v(function(q){const ae=z.deltaY<0?q*1.1:q/1.1;return Math.max(.25,Math.min(4,ae))}))}return a.jsxs("div",{ref:u,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[a.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{children:[M.total," tools"]}),M.running?a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[M.running," live"]}):null,M.error?a.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[M.error," err"]}):null,a.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[a.jsx("button",{type:"button",onClick:function(){_(function(z){return z==="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:k==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:k==="TB"?"↓":"→"}),a.jsx("button",{type:"button",onClick:function(){v(function(z){return Math.max(.25,z/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:"−"}),a.jsxs("button",{type:"button",onClick:function(){v(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(x*100),"%"]}),a.jsx("button",{type:"button",onClick:function(){v(function(z){return Math.min(4,z*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:"+"})]}),M.hidden>0?a.jsx("button",{type:"button",onClick:function(){S(function(z){return!z})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(w?"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:w?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:w?"hide bk":"show bk"}):null,M.thoughts>0?a.jsx("button",{type:"button",onClick:function(){j(function(z){return!z})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(N?"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:N?"Hide reasoning bubbles":"Show reasoning bubbles ("+M.thoughts+" thoughts)",children:N?"💭 "+M.thoughts:"💭 off"}):null]})]}),a.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:Z,children:a.jsxs("svg",{viewBox:"0 0 "+A+" "+D,width:U,height:G,style:{display:"block"},children:[a.jsxs("defs",{children:[a.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?eo.data.dark:eo.data.light})}),a.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?eo.file.dark:eo.file.light})}),a.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?eo.seq.dark:eo.seq.light})})]}),I.edges.map(function(z,q){const ae=t?eo[z.kind].dark:eo[z.kind].light;return a.jsx("path",{d:L(z.points),fill:"none",stroke:ae,strokeWidth:z.kind==="data"?1.75:z.kind==="file"?1.25:1,strokeDasharray:z.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+z.kind+")"},"e"+q)}),I.nodes.map(function(z){const q=z.node,ae=SV(q,t),P=q.status==="running",Q=f===z.id;if(q.kind==="thought"){const F=q.label||"",K=32,W=3,H=F.split(/\s+/),se=[];let ie="";for(const ge of H){if(se.length===W-1&&(ie+" "+ge).length>K){se.push(ie);const we=H.slice(H.indexOf(ge)).join(" ");se.push(we.length>K?we.slice(0,K-1)+"…":we),ie="";break}if(!ie){ie=ge;continue}if((ie+" "+ge).length<=K?ie=ie+" "+ge:(se.push(ie),ie=ge),se.length>=W)break}return ie&&se.length<W&&se.push(ie),a.jsxs("g",{transform:"translate("+z.x+","+z.y+")",onMouseEnter:function(){p(z.id)},onMouseLeave:function(){p(null)},onClick:function(){n&&n(q)},style:{cursor:n?"pointer":"default"},children:[a.jsx("rect",{width:z.w,height:z.h,rx:z.h/2,ry:z.h/2,fill:ae.fill,stroke:ae.stroke,strokeWidth:Q?1.75:1,strokeDasharray:q.source==="reasoning"?void 0:"4,2"}),a.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:ae.label,children:se.map(function(ge,we){return a.jsx("tspan",{x:14,dy:we===0?14:11,children:(we===0?"💭 ":"")+ge},"ln"+we)})}),a.jsx("title",{children:(q.source==="reasoning"?"[reasoning] ":"[thought] ")+(q.fullText||q.label)})]},z.id)}return a.jsxs("g",{transform:"translate("+z.x+","+z.y+")",onMouseEnter:function(){p(z.id)},onMouseLeave:function(){p(null)},onClick:function(){n&&n(q)},style:{cursor:n?"pointer":"default"},children:[a.jsx("rect",{width:z.w,height:z.h,rx:5,ry:5,fill:ae.fill,stroke:ae.stroke,strokeWidth:P||Q?2:1.25,opacity:q.hidden?.55:1,children:P?a.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),a.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:ae.label,children:q.tool}),a.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:wV(q.label,22)}),a.jsx("title",{children:q.tool+" · "+q.label+(q.status==="error"?" · ERROR":q.status==="running"?" · RUNNING":"")}),P?a.jsxs("g",{transform:"translate("+(z.w-9)+",9)",children:[a.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:ae.stroke,strokeWidth:.75}),a.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[a.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),a.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},z.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 FT(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 NV(e){if(Array.isArray(e))return e}function CV(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,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,i=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw i}}return u}}function jV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
121
|
+
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 TV(e,t){return NV(e)||CV(e,t)||RV(e,t)||jV()}function RV(e,t){if(e){if(typeof e=="string")return FT(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)?FT(e,t):void 0}}const II=Object.entries,BT=Object.setPrototypeOf,AV=Object.isFrozen,MI=Object.getPrototypeOf,LI=Object.getOwnPropertyDescriptor;let Wr=Object.freeze,ti=Object.seal,Dl=Object.create,OI=typeof Reflect<"u"&&Reflect,uk=OI.apply,dk=OI.construct;Wr||(Wr=function(t){return t});ti||(ti=function(t){return t});uk||(uk=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return t.apply(n,i)});dk||(dk=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new t(...r)});const bs=sr(Array.prototype.forEach),IV=sr(Array.prototype.lastIndexOf),zT=sr(Array.prototype.pop),Zc=sr(Array.prototype.push),MV=sr(Array.prototype.slice),LV=sr(Array.prototype.splice),ql=Array.isArray,rv=DI(Set),iv=sr(Set.prototype.add),Jc=sr(Set.prototype.has),Wo=sr(String.prototype.toLowerCase),av=sr(String.prototype.toString),UT=sr(String.prototype.match),eu=sr(String.prototype.replace),qT=sr(String.prototype.indexOf),OV=sr(String.prototype.trim),DV=sr(Number.prototype.toString),PV=sr(Boolean.prototype.toString),HT=typeof BigInt>"u"?null:sr(BigInt.prototype.toString),$T=typeof Symbol>"u"?null:sr(Symbol.prototype.toString),Oi=sr(Object.prototype.hasOwnProperty),tu=sr(Object.prototype.toString),Zr=sr(RegExp.prototype.test),vs=DI(TypeError);function sr(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return uk(e,t,r)}}function DI(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return dk(e,n)}}function In(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wo;if(BT&&BT(e,null),!ql(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const o=n(i);o!==i&&(AV(t)||(t[r]=o),i=o)}e[i]=!0}return e}function FV(e){for(let t=0;t<e.length;t++)Oi(e,t)||(e[t]=null);return e}function Vi(e){const t=Dl(null);for(const r of II(e)){var n=TV(r,2);const i=n[0],o=n[1];Oi(e,i)&&(ql(o)?t[i]=FV(o):o&&typeof o=="object"&&o.constructor===Object?t[i]=Vi(o):t[i]=o)}return t}function BV(e){switch(typeof e){case"string":return e;case"number":return DV(e);case"boolean":return PV(e);case"bigint":return HT?HT(e):"0";case"symbol":return $T?$T(e):"Symbol()";case"undefined":return tu(e);case"function":case"object":{if(e===null)return tu(e);const t=e,n=oa(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:tu(r)}return tu(e)}default:return tu(e)}}function oa(e,t){for(;e!==null;){const r=LI(e,t);if(r){if(r.get)return sr(r.get);if(typeof r.value=="function")return sr(r.value)}e=MI(e)}function n(){return null}return n}function zV(e,t){for(;e!==null;){const n=LI(e,t);if(n)return n.get?sr(n.get):null;e=MI(e)}return null}function UV(e){try{return Zr(e,""),!0}catch{return!1}}const WT=Wr(["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"]),sv=Wr(["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"]),ov=Wr(["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"]),qV=Wr(["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"]),lv=Wr(["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"]),HV=Wr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),VT=Wr(["#text"]),GT=Wr(["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"]),cv=Wr(["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=Wr(["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"]),yf=Wr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$V=ti(/{{[\w\W]*|^[\w\W]*}}/g),WV=ti(/<%[\w\W]*|^[\w\W]*%>/g),VV=ti(/\${[\w\W]*/g),GV=ti(/^data-[\-\w.\u00B7-\uFFFF]+$/),KV=ti(/^aria-[\-\w]+$/),YT=ti(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),YV=ti(/^(?:\w+script|data):/i),QV=ti(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),XV=ti(/^html$/i),ZV=ti(/^[a-z][.\w]*(-[.\w]+)+$/i),uv=ti(/<[/\w!]/g),QT=ti(/<[/\w]/g),JV=ti(/<\/no(script|embed|frames)/i),XT=ti(/\/>/i),Cr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},eG=Wr(In({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),tG=function(){return typeof window>"u"?null:window},nG=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));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}},ZT=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},to=function(t,n,r,i){return Oi(t,n)&&ql(t[n])?In(i.base?Vi(i.base):{},t[n],i.transform):r},dv=function(t,n,r){const i=Oi(t,n)?t[n]:void 0;return i&&typeof i=="object"?Vi(i):r()};function PI(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tG();const t=Be=>PI(Be);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,i=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,h=u.prototype,m=oa(h,"cloneNode"),x=oa(h,"remove"),v=oa(h,"removeAttributeNode"),k=oa(h,"nextSibling"),_=oa(h,"childNodes"),w=oa(h,"parentNode"),S=oa(h,"shadowRoot"),N=oa(h,"attributes"),j=l&&l.prototype?oa(l.prototype,"nodeType"):null,R=l&&l.prototype?oa(l.prototype,"nodeName"):null,T=l&&l.prototype?oa(l.prototype,"ownerDocument"):null,I=function(V){return j?j(V):V.nodeType},M=function(V){return R?R(V):V.nodeName},L=zV(h,"namespaceURI"),A=function(V){return L?L(V):V.namespaceURI};if(typeof o=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let D,$="",ee,U=!1,G=0;const Z=function(){if(G>0)throw vs('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.')},z=function(V){Z(),G++;try{return D.createHTML(V)}finally{G--}},q=function(V){Z(),G++;try{return D.createScriptURL(V)}finally{G--}},ae=function(){return U||(ee=nG(p,i),U=!0),ee},P=n,Q=P.implementation,J=P.createNodeIterator,F=P.createDocumentFragment,K=P.getElementsByTagName,W=r.importNode;let H=ZT();t.isSupported=typeof II=="function"&&typeof w=="function"&&Q&&Q.createHTMLDocument!==void 0;const se=$V,ie=WV,ge=VV,we=GV,Ke=KV,xt=YV,et=QV,vt=ZV;let lt=YT,je=null;const Oe=In({},[...WT,...sv,...ov,...lv,...VT]);let ft=null;const Ct=In({},[...GT,...cv,...KT,...yf]);let rn=Object.seal(Dl(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}})),tn=null,un=null;const mt=Object.seal(Dl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $t=!0,nt=!0,qe=!1,ue=!0,me=!1,Ue=!0,He=!1,be=!1,Ye=null,_t=null,jt=!1,Wt=!1,hn=!1,xe=!1,ke=!0,Ae=!1;const Fe="user-content-";let yt=!0,pt=!1,Ht=null,te={},Ee=null;const Je=In({},["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 Dt=null;const Pe=In({},["audio","video","img","source","image","track"]);let ze=null;const We=In({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qe="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",Ne="http://www.w3.org/1999/xhtml";let Ve=Ne,oe=!1,bn=null;const tr=In({},[Qe,st,Ne],av),Le=Wr(["mi","mo","mn","ms","mtext"]);let kt=In({},Le);const vn=Wr(["annotation-xml"]);let ar=In({},vn);const Vr=In({},["title","style","font","a","script"]);let Rr=null;const Ma=["application/xhtml+xml","text/html"],Gt="text/html";let Tn=null,Pr=null;const Bn=n.createElement("form"),Bi=function(V){return V instanceof RegExp||V instanceof Function},pa=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Pr&&Pr===V)return;(!V||typeof V!="object")&&(V={}),V=Vi(V),Rr=Ma.indexOf(V.PARSER_MEDIA_TYPE)===-1?Gt:V.PARSER_MEDIA_TYPE,Tn=Rr==="application/xhtml+xml"?av:Wo,je=to(V,"ALLOWED_TAGS",Oe,{transform:Tn}),ft=to(V,"ALLOWED_ATTR",Ct,{transform:Tn}),bn=to(V,"ALLOWED_NAMESPACES",tr,{transform:av}),ze=to(V,"ADD_URI_SAFE_ATTR",We,{transform:Tn,base:We}),Dt=to(V,"ADD_DATA_URI_TAGS",Pe,{transform:Tn,base:Pe}),Ee=to(V,"FORBID_CONTENTS",Je,{transform:Tn}),tn=to(V,"FORBID_TAGS",Vi({}),{transform:Tn}),un=to(V,"FORBID_ATTR",Vi({}),{transform:Tn}),te=Oi(V,"USE_PROFILES")?V.USE_PROFILES&&typeof V.USE_PROFILES=="object"?Vi(V.USE_PROFILES):V.USE_PROFILES:!1,$t=V.ALLOW_ARIA_ATTR!==!1,nt=V.ALLOW_DATA_ATTR!==!1,qe=V.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=V.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=V.SAFE_FOR_TEMPLATES||!1,Ue=V.SAFE_FOR_XML!==!1,He=V.WHOLE_DOCUMENT||!1,Wt=V.RETURN_DOM||!1,hn=V.RETURN_DOM_FRAGMENT||!1,xe=V.RETURN_TRUSTED_TYPE||!1,jt=V.FORCE_BODY||!1,ke=V.SANITIZE_DOM!==!1,Ae=V.SANITIZE_NAMED_PROPS||!1,yt=V.KEEP_CONTENT!==!1,pt=V.IN_PLACE||!1,lt=UV(V.ALLOWED_URI_REGEXP)?V.ALLOWED_URI_REGEXP:YT,Ve=typeof V.NAMESPACE=="string"?V.NAMESPACE:Ne,kt=dv(V,"MATHML_TEXT_INTEGRATION_POINTS",()=>In({},Le)),ar=dv(V,"HTML_INTEGRATION_POINTS",()=>In({},vn));const de=dv(V,"CUSTOM_ELEMENT_HANDLING",()=>Dl(null));if(rn=Dl(null),Oi(de,"tagNameCheck")&&Bi(de.tagNameCheck)&&(rn.tagNameCheck=de.tagNameCheck),Oi(de,"attributeNameCheck")&&Bi(de.attributeNameCheck)&&(rn.attributeNameCheck=de.attributeNameCheck),Oi(de,"allowCustomizedBuiltInElements")&&typeof de.allowCustomizedBuiltInElements=="boolean"&&(rn.allowCustomizedBuiltInElements=de.allowCustomizedBuiltInElements),ti(rn),me&&(nt=!1),hn&&(Wt=!0),te&&(je=In({},VT),ft=Dl(null),te.html===!0&&(In(je,WT),In(ft,GT)),te.svg===!0&&(In(je,sv),In(ft,cv),In(ft,yf)),te.svgFilters===!0&&(In(je,ov),In(ft,cv),In(ft,yf)),te.mathMl===!0&&(In(je,lv),In(ft,KT),In(ft,yf))),mt.tagCheck=null,mt.attributeCheck=null,Oi(V,"ADD_TAGS")&&(typeof V.ADD_TAGS=="function"?mt.tagCheck=V.ADD_TAGS:ql(V.ADD_TAGS)&&(je===Oe&&(je=Vi(je)),In(je,V.ADD_TAGS,Tn))),Oi(V,"ADD_ATTR")&&(typeof V.ADD_ATTR=="function"?mt.attributeCheck=V.ADD_ATTR:ql(V.ADD_ATTR)&&(ft===Ct&&(ft=Vi(ft)),In(ft,V.ADD_ATTR,Tn))),Oi(V,"ADD_FORBID_CONTENTS")&&ql(V.ADD_FORBID_CONTENTS)&&(Ee===Je&&(Ee=Vi(Ee)),In(Ee,V.ADD_FORBID_CONTENTS,Tn)),yt&&(je["#text"]=!0),He&&In(je,["html","head","body"]),je.table&&(In(je,["tbody"]),delete tn.tbody),V.TRUSTED_TYPES_POLICY){if(typeof V.TRUSTED_TYPES_POLICY.createHTML!="function")throw vs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof V.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ie=D;D=V.TRUSTED_TYPES_POLICY;try{$=z("")}catch(Me){throw D=Ie,Me}}else V.TRUSTED_TYPES_POLICY===null?(D=void 0,$=""):(D===void 0&&(D=ae()),D&&typeof $=="string"&&($=z("")));Wr&&Wr(V),Pr=V},$n=In({},[...sv,...ov,...qV]),La=In({},[...lv,...HV]),ha=function(V,de,Ie){return de.namespaceURI===Ne?V==="svg":de.namespaceURI===Qe?V==="svg"&&(Ie==="annotation-xml"||kt[Ie]):!!$n[V]},ga=function(V,de,Ie){return de.namespaceURI===Ne?V==="math":de.namespaceURI===st?V==="math"&&ar[Ie]:!!La[V]},gi=function(V,de,Ie){return de.namespaceURI===st&&!ar[Ie]||de.namespaceURI===Qe&&!kt[Ie]?!1:!La[V]&&(Vr[V]||!$n[V])},it=function(V){const de=A(V),Ie=Wo(M(V)),Me=w(V);let It,Bt;return Me&&I(Me)===Cr.element?(It={namespaceURI:A(Me)},Bt=Wo(M(Me))):(It={namespaceURI:Ve},Bt="template"),bn[de]?de===st?ha(Ie,It,Bt):de===Qe?ga(Ie,It,Bt):de===Ne?gi(Ie,It,Bt):!!(Rr==="application/xhtml+xml"&&bn[de]):!1},Et=function(V){Zc(t.removed,{element:V});try{w(V).removeChild(V)}catch{if(x(V),!w(V))throw vs("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Vt=function(V,de,Ie){try{v(V,de)}catch{try{V.removeAttribute(Ie)}catch{}}},Pt=function(V){ni(V);const de=_(V);de&&bs(MV(de),Me=>{try{x(Me)}catch{}});const Ie=I(V)===Cr.element?N(V):null;if(Ie)for(let Me=Ie.length-1;Me>=0;--Me){const It=Ie[Me],Bt=It&&It.name;typeof Bt=="string"&&Vt(V,It,Bt)}},zn=function(V,de,Ie){if(!Ie)try{Ie=de.getAttributeNode(V)}catch{Ie=null}Zc(t.removed,{attribute:Ie||null,from:de});try{Ie?v(de,Ie):de.removeAttribute(V)}catch{try{de.removeAttribute(V)}catch{}}if(V==="is")if(Wt||hn)try{Et(de)}catch{}else try{de.setAttribute(V,"")}catch{}},Pn=function(V){const de=N(V);if(de)for(let Ie=de.length-1;Ie>=0;--Ie){const Me=de[Ie],It=Me&&Me.name;typeof It!="string"||ft[Tn(It)]||Vt(V,Me,It)}},Gr=function(V,de){let Ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const Me=[V];for(;Me.length>0;){const It=Me.pop();if(de(It)===!1)continue;if(Ie&&I(It)===Cr.element){const fn=S(It);Ar(fn)&&Me.push(fn)}const Bt=_(It);if(Bt)for(let fn=Bt.length-1;fn>=0;--fn)Me.push(Bt[fn])}},ni=function(V){Gr(V,de=>{I(de)===Cr.element&&Pn(de)})},hr=function(V){const de=[];return Gr(V,Ie=>{de.push(Ie)},!0),de},lr=function(V,de){const Ie=rv();bs(hr(V),Me=>{I(Me)===Cr.element&&iv(Ie,Me)}),bs(de,Me=>{I(Me)===Cr.element&&!Jc(Ie,Me)&&Pn(Me)})},zi=function(V,de){let Ie=!1;return bs(t.removed,Me=>{Me.element&&(Ie=Ie||Me.element===V,ni(Me.element))}),lr(V,de),Ie},mi=8,xi=function(V,de){const Ie=Ht;let Me=null;const It=()=>(Me||(Me=rv(),bs(de,Bt=>{iv(Me,Bt)})),Me);for(let Bt=0;;Bt++){const fn=hr(V),dt=[V];let oi=!1;if(bs(fn,cr=>{I(cr)===Cr.documentFragment?Zc(dt,cr):!oi&&!Jc(Ie,cr)&&(oi=Jc(It(),cr))}),!oi)return;if(Bt>=mi)throw vs("the tree kept changing during in-place sanitization; refusing to return it");bs(dt,(cr,Sr)=>{Qi(cr,Sr>0,V,It())})}},Qi=function(V,de,Ie,Me){const It=ii(V);let Bt;for(;Bt=It.nextNode();)!Jc(Me,Bt)||Jc(Ht,Bt)||(de&&dn(H.uponSanitizeShadowNode,Bt,null),gt(Bt,Ie),xa(Bt,Ie),Ar(Bt.content)&&ya(Bt.content))},ma=function(V){Ht&&iv(Ht,V)},yi=function(V,de){return Ue?V==="patchsrc"?!0:V==="for"&&de!=="label"&&de!=="output":!1},Ya=function(V){Ue&&Gr(V,de=>{const Ie=I(de);if(Ie===Cr.processingInstruction||Ie===Cr.comment&&Zr(QT,de.data)){try{x(de)}catch{}return!1}if(Ie===Cr.element){const Me=de,It=Tn(M(de));try{Me.hasAttribute&&Me.hasAttribute("patchsrc")&&Me.removeAttribute("patchsrc"),Me.hasAttribute&&Me.hasAttribute("for")&&yi("for",It)&&Me.removeAttribute("for")}catch{}}return!0})},ri=function(V){let de=null,Ie=null;if(jt)V="<remove></remove>"+V;else{const Bt=UT(V,/^[\r\n\t ]+/);Ie=Bt&&Bt[0]}Rr==="application/xhtml+xml"&&Ve===Ne&&(V='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+V+"</body></html>");const Me=D?z(V):V;if(Ve===Ne)try{de=new f().parseFromString(Me,Rr)}catch{}if(!de||!de.documentElement){de=Q.createDocument(Ve,"template",null);try{de.documentElement.innerHTML=oe?$:Me}catch{}}const It=de.body||de.documentElement;return V&&Ie&&It.insertBefore(n.createTextNode(Ie),It.childNodes[0]||null),Ve===Ne?K.call(de,He?"html":"body")[0]:He?de.documentElement:It},ii=function(V){const de=T?T(V):V.ownerDocument;return J.call(de||V,V,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},gr=function(V){return V=eu(V,se," "),V=eu(V,ie," "),V=eu(V,ge," "),V},Xi=function(V){var de;ln(V);const Ie=(de=V.querySelectorAll)===null||de===void 0?void 0:de.call(V,"template");Ie&&bs(Ie,Me=>{Ar(Me.content)&&Xi(Me.content)})},ln=function(V){V.normalize();const de=T?T(V):V.ownerDocument,Ie=J.call(de||V,V,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let Me=Ie.nextNode();for(;Me;)Me.data=gr(Me.data),Me=Ie.nextNode()},Ft=function(V){const de=R?R(V):null;return typeof de!="string"||Tn(de)!=="form"?!1:typeof V.nodeName!="string"||typeof V.textContent!="string"||typeof V.removeChild!="function"||V.attributes!==N(V)||typeof V.removeAttribute!="function"||typeof V.removeAttributeNode!="function"||typeof V.getAttributeNode!="function"||typeof V.setAttribute!="function"||typeof V.namespaceURI!="string"||typeof V.insertBefore!="function"||typeof V.hasChildNodes!="function"||V.nodeType!==j(V)||V.childNodes!==_(V)},Ar=function(V){if(!j||typeof V!="object"||V===null)return!1;try{return j(V)===Cr.documentFragment}catch{return!1}},kn=function(V){if(!j||typeof V!="object"||V===null)return!1;try{return typeof j(V)=="number"}catch{return!1}};function dn(Be,V,de){Be.length!==0&&bs(Be,Ie=>{Ie.call(t,V,de,Pr)})}const ai=function(V,de){return!!(Ue&&V.hasChildNodes()&&!kn(V.firstElementChild)&&Zr(uv,V.textContent)&&Zr(uv,V.innerHTML)||Ue&&eG[de]&&I(V)===Cr.element&&A(V)===Ne&&(kn(V.firstElementChild)||typeof V.textContent=="string"&&Zr(uv,V.textContent))||V.nodeType===Cr.processingInstruction||Ue&&V.nodeType===Cr.comment&&Zr(QT,V.data))},wr=function(V,de){if(V instanceof RegExp)return Zr(V,de);if(V instanceof Function){for(var Ie=arguments.length,Me=new Array(Ie>2?Ie-2:0),It=2;It<Ie;It++)Me[It-2]=arguments[It];return!!V(de,...Me)}return!1},Zi=function(V,de,Ie){if(!tn[de]&&Gn(de)&&wr(rn.tagNameCheck,de))return!1;if(yt&&!Ee[de]&&!Ee[Wo(de)]){const Me=w(V),It=_(V);if(It&&Me){const Bt=It.length;for(let fn=Bt-1;fn>=0;--fn){const dt=V===Ie?m(It[fn],!0):It[fn];Me.insertBefore(dt,k(V))}}}return Et(V),!0},Ei=function(V,de,Ie,Me){return V.length===0?de:de===Ie||de===Me?Vi(de):de},at=function(V,de){return V===de||w(V)!==null?!1:(pt&&ni(V),!0)},gt=function(V,de){if(ma(V),dn(H.beforeSanitizeElements,V,null),at(V,de))return!0;if(Ft(V))return Et(V),!0;const Ie=Tn(M(V));if(je=Ei(H.uponSanitizeElement,je,Oe,Ye),dn(H.uponSanitizeElement,V,{tagName:Ie,allowedTags:je}),at(V,de))return!0;if(ai(V,Ie))return Et(V),!0;if(tn[Ie]||!(mt.tagCheck instanceof Function&&mt.tagCheck(Ie))&&!je[Ie]){const Me=Zi(V,Ie,de);return Me===!1&&(dn(H.afterSanitizeElements,V,null),at(V,de))?!0:Me}if(I(V)===Cr.element&&!it(V)||(Ie==="noscript"||Ie==="noembed"||Ie==="noframes")&&Zr(JV,V.innerHTML))return Et(V),!0;if(me&&V.nodeType===Cr.text){const Me=gr(V.textContent);V.textContent!==Me&&(Zc(t.removed,{element:V.cloneNode()}),V.textContent=Me)}return dn(H.afterSanitizeElements,V,null),at(V,de)},Nt=function(V,de,Ie){if(un[de]||yi(de,V)||ke&&(de==="id"||de==="name")&&(Ie in n||Ie in Bn))return!1;const Me=ft[de]||mt.attributeCheck instanceof Function&&mt.attributeCheck(de,V);return nt&&Zr(we,de)||$t&&Zr(Ke,de)?!0:Me?ze[de]||Zr(lt,eu(Ie,et,""))||(de==="src"||de==="xlink:href"||de==="href")&&V!=="script"&&qT(Ie,"data:")===0&&Dt[V]||qe&&!Zr(xt,eu(Ie,et,""))?!0:!Ie:Gn(V)&&wr(rn.tagNameCheck,V)&&wr(rn.attributeNameCheck,de,V)||de==="is"&&rn.allowCustomizedBuiltInElements&&wr(rn.tagNameCheck,Ie)},yn=In({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Gn=function(V){return!yn[Wo(V)]&&Zr(vt,V)},Hn=function(V,de,Ie,Me){if(D&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Ie)switch(p.getAttributeType(V,de)){case"TrustedHTML":return z(Me);case"TrustedScriptURL":return q(Me)}return Me},Ji=function(V,de,Ie,Me){try{return Ie?V.setAttributeNS(Ie,de,Me):V.setAttribute(de,Me),Ft(V)?(Et(V),!1):!0}catch{return zn(de,V),!1}},si=function(V,de){return Ue&&Zr(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,de)?!0:Wo(V)==="attributename"&&UT(de,"href")!==null},xa=function(V,de){if(dn(H.beforeSanitizeAttributes,V,null),at(V,de))return;const Ie=V.attributes;if(!Ie||Ft(V))return;ft=Ei(H.uponSanitizeAttribute,ft,Ct,_t);const Me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ft,forceKeepAttr:void 0};let It=Ie.length;const Bt=Tn(V.nodeName);for(;It--;){const fn=Ie[It],dt=fn.name,oi=fn.namespaceURI,cr=fn.value,Sr=Tn(dt),ba=cr;let er=dt==="value"?ba:OV(ba),Cs=!1;if(Me.attrName=Sr,Me.attrValue=er,Me.keepAttr=!0,Me.forceKeepAttr=void 0,dn(H.uponSanitizeAttribute,V,Me),er=Me.attrValue,Ae&&(Sr==="id"||Sr==="name")&&qT(er,Fe)!==0&&(zn(dt,V,fn),er=Fe+er,Cs=!0),si(dt,er)){zn(dt,V,fn);continue}if(!Me.forceKeepAttr){if(!Me.keepAttr){zn(dt,V,fn);continue}if(!ue&&Zr(XT,er)){zn(dt,V,fn);continue}if(me&&(er=gr(er)),!Nt(Bt,Sr,er)){zn(dt,V,fn);continue}er=Hn(Bt,Sr,oi,er),er!==ba&&Ji(V,dt,oi,er)&&Cs&&zT(t.removed)}}dn(H.afterSanitizeAttributes,V,null),at(V,de)},ya=function(V){let de=null;const Ie=ii(V);for(dn(H.beforeSanitizeShadowDOM,V,null);de=Ie.nextNode();)if(dn(H.uponSanitizeShadowNode,de,null),gt(de,V),xa(de,V),Ar(de.content)&&ya(de.content),I(de)===Cr.element){const Me=S(de);Ar(Me)&&(Ns(Me),ya(Me))}me&&ln(V),dn(H.afterSanitizeShadowDOM,V,null)},Ns=function(V){const de=[{node:V,shadow:null}];for(;de.length>0;){const Ie=de.pop();if(Ie.shadow){ya(Ie.shadow);continue}const Me=Ie.node,It=I(Me)===Cr.element,Bt=_(Me);if(Bt)for(let fn=Bt.length-1;fn>=0;--fn)de.push({node:Bt[fn],shadow:null});if(It){const fn=R?R(Me):null;if(typeof fn=="string"&&Tn(fn)==="template"){const dt=Me.content;Ar(dt)&&de.push({node:dt,shadow:null})}}if(It){const fn=S(Me);Ar(fn)&&de.push({node:null,shadow:fn},{node:fn,shadow:null})}}};return t.sanitize=function(Be){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},de=null,Ie=null,Me=null,It=null;if(oe=!Be,oe&&(Be="<!-->"),typeof Be!="string"&&!kn(Be)&&(Be=BV(Be),typeof Be!="string"))throw vs("dirty is not a string, aborting");if(!t.isSupported)return Be;be?(je=Ye,ft=_t):pa(V),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(je=Vi(je)),H.uponSanitizeAttribute.length>0&&(ft=Vi(ft)),t.removed=[];const Bt=pt&&typeof Be!="string"&&kn(Be);let fn=[];const dt=Ht;if(Bt){Ya(Be);const Sr=M(Be);if(typeof Sr=="string"){const ba=Tn(Sr);if(!je[ba]||tn[ba])throw Pt(Be),vs("root node is forbidden and cannot be sanitized in-place")}if(Ft(Be))throw Pt(Be),vs("root node is clobbered and cannot be sanitized in-place");fn=hr(Be),Ht=rv()}else if(kn(Be))de=ri("<!---->"),Ie=de.ownerDocument.importNode(Be,!0),Ie.nodeType===Cr.element&&Ie.nodeName==="BODY"||Ie.nodeName==="HTML"?de=Ie:de.appendChild(Ie),Ns(de);else{if(!Wt&&!me&&!He&&Be.indexOf("<")===-1)return D&&xe?z(Be):Be;if(de=ri(Be),!de)return Wt?null:xe?$:""}de&&jt&&Et(de.firstChild);const oi=Bt?Be:de;try{Bt&&Ns(Be);const Sr=ii(oi);for(;Me=Sr.nextNode();)gt(Me,oi),xa(Me,oi),Ar(Me.content)&&ya(Me.content);Bt&&xi(Be,fn)}catch(Sr){throw Bt&&(Pt(Be),zi(Be,fn)),Sr}finally{Ht=dt}if(Bt){if(zi(Be,fn))throw vs("a node selected for removal could not be safely returned; refusing to sanitize in place");return me&&Xi(Be),Be}if(Wt){if(me&&Xi(de),hn)for(It=F.call(de.ownerDocument);de.firstChild;)It.appendChild(de.firstChild);else It=de;return(ft.shadowroot||ft.shadowrootmode)&&(It=W.call(r,It,!0)),It}let cr=He?de.outerHTML:de.innerHTML;return He&&je["!doctype"]&&de.ownerDocument&&de.ownerDocument.doctype&&de.ownerDocument.doctype.name&&Zr(XV,de.ownerDocument.doctype.name)&&(cr="<!DOCTYPE "+de.ownerDocument.doctype.name+`>
|
|
122
|
+
`+cr),me&&(cr=gr(cr)),D&&xe?z(cr):cr},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pa(Be),be=!0,Ye=je,_t=ft},t.clearConfig=function(){Pr=null,be=!1,Ye=null,_t=null,D=ee,$=""},t.isValidAttribute=function(Be,V,de){Pr||pa({});const Ie=Tn(Be),Me=Tn(V);return typeof de=="string"&&(si(V,de)||!ue&&Zr(XT,de))?!1:Nt(Ie,Me,de)},t.addHook=function(Be,V){typeof V=="function"&&Oi(H,Be)&&Zc(H[Be],V)},t.removeHook=function(Be,V){if(Oi(H,Be)){if(V!==void 0){const de=IV(H[Be],V);return de===-1?void 0:LV(H[Be],de,1)[0]}return zT(H[Be])}},t.removeHooks=function(Be){Oi(H,Be)&&(H[Be]=[])},t.removeAllHooks=function(){H=ZT()},t}var rG=PI();let fv=null;function iG(){return fv||(fv=KR(()=>import("./mermaid.core-CfJk9oqB.js").then(e=>e.bN),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),fv}function JT(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let eR=0;function aG(){return eR+=1,"pave-canvas-"+eR}function sG({source:e}){const t=y.useRef(null),n=y.useRef(aG()),[r,i]=y.useState(null),[o,l]=y.useState(JT());return y.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=JT();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 i(null),iG().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||i(f&&f.message||String(f))}))}).catch(function(d){u||i("Failed to load mermaid: "+(d&&d.message||String(d)))}),function(){u=!0}},[e,o]),r?a.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[a.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),a.jsx("pre",{className:"whitespace-pre-wrap",children:r}),a.jsxs("details",{className:"mt-2",children:[a.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),a.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):a.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 oG({source:e}){const t=y.useMemo(function(){return rG.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return a.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function lG({source:e}){return a.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function cG({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=a.jsx(sG,{source:e.source}):e.type==="svg"?t=a.jsx(oG,{source:e.source}):e.type==="katex"?t=a.jsx(lG,{source:e.source}):t=a.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),a.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function uG({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,i]=y.useState(Math.max(0,n.length-1)),[o,l]=y.useState(1),[u,d]=y.useState(!1);y.useEffect(function(){i(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 _=w=>{w.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))),[]),h=y.useCallback(()=>l(1),[]);if(n.length===0)return a.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[a.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:a.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"})}),a.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 ",a.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=a.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?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>i(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:"←"}),a.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",n.length]}),a.jsx("button",{type:"button",onClick:()=>i(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:"→"})]}):a.jsx("div",{}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.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:"−"}),a.jsxs("button",{type:"button",onClick:h,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),"%"]}),a.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:"+"}),a.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?a.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=a.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[x.title?a.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:x.title}):null,a.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:a.jsx(cG,{canvas:x})}),x.caption?a.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:x.caption}):null]});return u?a.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):a.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function dG(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function fG(e,t){const n=dG(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}function pG(e){const{serverContextLimit:t,registryLimitMap:n={},limitModelID:r,effectiveActiveModel:i,modelLimits:o={},defaultLimit:l}=e||{};return t||n[r]||n[i]||o[r]||l}function tR(e,t,n,r){if(typeof t!="string"||!t)return;const i=t.includes("/")?t.split("/").pop():t,o=i&&i!==t?[t,i]:[t];for(let l=0;l<o.length;l+=1)(r||!Object.prototype.hasOwnProperty.call(e,o[l]))&&(e[o[l]]=n)}function hG(e){const t={};if(!Array.isArray(e))return t;for(let n=0;n<e.length;n+=1){const r=e[n],i=r&&r.limit?r.limit.context:null;typeof i!="number"||i<=0||(tR(t,r.key,i,!0),tR(t,r.target,i,!1))}return t}const gG={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function mG(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function xG(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}function yG({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const bG=3,nR=4,vG=4,kG=1024;function _G(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 rR(e){if(typeof e=="string")return e;if(e==null)return"";try{return JSON.stringify(e)}catch{return""}}function nu(e){return Math.ceil(_G(e)/bG)}function wG(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 i=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&&(i+=nu(d),o=!0)}else if(u==="reasoning"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(i+=nu(d),o=!0)}else if(u==="image_url"||l.image_url)i+=kG,o=!0;else if(u==="tool"){const d=l.state||{},f=typeof l.tool=="string"?l.tool:"";i+=vG+nR,f&&(i+=nu(f)),d.input!=null&&(i+=nu(rR(d.input))),d.output!=null&&(i+=nu(rR(d.output))),o=!0}}o&&(t+=i+nR)}return t}const SG={"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},EG=128e3;function bf(e){const[t,n]=y.useState(e),r=y.useRef(e),i=y.useRef(0),o=y.useRef(0);return y.useEffect(()=>{if(e===r.current)return;i.current=0,r.current=t;const l=400,u=t,d=e,f=p=>{i.current||(i.current=p);const h=p-i.current,m=Math.min(h/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 NG({messages:e,isBusy:t,isCompacting:n,activeModel:r,sessionModel:i,isPrivateMode:o,registryEntries:l}){var F,K;var{t:u}=Zt();const d=e.filter(W=>{var H;return((H=W.info)==null?void 0:H.role)==="user"}).length,f=e.filter(W=>{var H;return((H=W.info)==null?void 0:H.role)==="assistant"}).length,p=y.useMemo(()=>wG(e),[e]);let h=0,m=0,x=0,v=null,k=null;for(let W=e.length-1;W>=0;W--){const H=e[W];if(((F=H.info)==null?void 0:F.role)==="assistant"&&((K=H.info)==null?void 0:K.mode)!=="compaction"){const se=H.info.tokens;if(se&&(se.input||se.output)){!v&&H.info.modelID&&(v=H.info.modelID),h=se.lastInput??se.input??0,m=se.lastOutput??se.output??0,x=se.lastReasoning??se.reasoning??0,H.info.contextLimit&&(k=H.info.contextLimit);break}}}const _=bf(p),w=bf(h),S=bf(m),N=bf(x),j=w+S+N,R=p>0||h+m+x>0;let T=r;typeof i=="string"&&i?T=i:i&&i.providerID&&i.modelID&&(T=i.providerID+"/"+i.modelID);let{modelID:I,activeModelID:M}=fG(T,v),L=null;if(o){I="privacy",M="privacy";let W=null;typeof i=="string"&&i?W=i.includes("/")?i.split("/").pop():i:i&&i.modelID&&(W=i.modelID),L=W||(r?String(r).split("/").pop():null)}else v&&M&&v!==M&&(L=v);const A=y.useMemo(()=>hG(l),[l]),$=pG({serverContextLimit:k,registryLimitMap:A,limitModelID:v||I,effectiveActiveModel:T,modelLimits:SG,defaultLimit:EG}),ee=Math.min(100,Math.round(_/$*100));let U="bg-green-500";ee>=90?U="bg-red-500":ee>=75?U="bg-orange-500":ee>=50&&(U="bg-yellow-500");const G="border-gray-200 dark:border-gray-800",Z="text-gray-500 dark:text-gray-400",z="text-gray-500 dark:text-gray-400",q="text-gray-700 dark:text-gray-300",ae="border-gray-100 dark:border-gray-800";return a.jsxs("div",{className:`p-4 border-t ${G}`,children:[a.jsx("p",{className:`text-xs ${Z} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:u("token_usage.messages")}),a.jsx("span",{className:`text-xs font-medium ${q}`,children:d+f})]}),I&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:u("token_usage.model")}),a.jsx("span",{className:`text-xs font-medium ${q} truncate ml-2 max-w-[140px]`,children:iR(I)})]}),L&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:u("token_usage.originally")}),a.jsx("span",{className:`text-xs ${z} truncate ml-2 max-w-[140px]`,children:iR(L)})]}),(()=>{const W=yG({isBusy:t,isCompacting:n}),H=W==="compacting"?"bg-amber-400 animate-pulse":W==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",se=u(W==="compacting"?"token_usage.compacting":W==="generating"?"token_usage.generating":"token_usage.idle");return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:u("token_usage.status")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${H}`}),a.jsx("span",{className:`text-xs font-medium ${q}`,children:se})]})]})})(),R?a.jsx(a.Fragment,{children:a.jsxs("div",{className:`border-t ${ae} pt-2 mt-2`,children:[a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:`text-xs ${z}`,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 ",a.jsx("span",{className:"opacity-70",children:"est"})]}),a.jsxs("span",{className:`text-xs ${z}`,children:[ee,"% of ",($/1e3).toFixed(0),"k"]})]}),a.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full ${U} transition-all duration-300`,style:{width:`${ee}%`}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:"Input"}),a.jsx("span",{className:`text-xs font-medium ${q} tabular-nums`,children:w.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsx("span",{className:`text-xs ${z}`,children:"Output"}),a.jsx("span",{className:`text-xs font-medium ${q} tabular-nums`,children:S.toLocaleString()})]}),x>0&&a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsx("span",{className:`text-xs ${z}`,children:"Reasoning"}),a.jsx("span",{className:`text-xs font-medium ${q} tabular-nums`,children:N.toLocaleString()})]}),a.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${ae}`,children:[a.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 ",a.jsx("span",{className:"opacity-70",children:"measured"})]}),a.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:j.toLocaleString()})]})]})}):a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${z}`,children:"Tokens"}),a.jsx("span",{className:`text-xs ${z}`,children:"--"})]})]})]})}function iR(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 CG({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:i,lockedReason:o}){const{t:l}=Zt(),[u,d]=y.useState(!1),f=y.useRef(null),[p,h]=y.useState(-1),m=y.useRef([]);y.useEffect(()=>{if(!u)return;function S(N){f.current&&!f.current.contains(N.target)&&d(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u]),y.useEffect(()=>{if(!u)return;function S(N){if(N.key==="Escape"){d(!1);return}N.key!=="ArrowDown"&&N.key!=="ArrowUp"&&N.key!=="Home"&&N.key!=="End"||(N.preventDefault(),h(j=>{const R=m.current.length;if(!R)return j;const T=typeof j=="number"?j:-1;let I=T;return N.key==="ArrowDown"?I=T<R-1?T+1:0:N.key==="ArrowUp"?I=T>0?T-1:R-1:N.key==="Home"?I=0:N.key==="End"&&(I=R-1),m.current[I]&&m.current[I].focus(),I}))}return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const x=typeof e=="string"&&e.trim()?e.trim():null,v=x!=null,k=Array.isArray(n)?n:[],_=jG(x,t,k,l),w=y.useCallback(S=>{r(S===t||x&&x===S?null:S),d(!1)},[x,t,r]);return m.current.length=k.length,a.jsxs("div",{className:"relative",ref:f,children:[a.jsxs("button",{type:"button",onClick:()=>d(S=>!S),disabled:i,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")+(i?" 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?a.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:[a.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"}),a.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{className:"max-w-[120px] truncate",children:_}),a.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&a.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&&a.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:l("model_selector.no_models")}),k.map((S,N)=>{const j=x===S.key,R=!!t&&(S.key===t||S.target===t||S.url===t),T=S.builtin?S.key:S.displayName||S.key;return a.jsxs("button",{type:"button",ref:I=>{m.current[N]=I},tabIndex:p===N?0:-1,role:"menuitemradio","aria-checked":j||!v&&R,onClick:()=>w(S.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(j||!v&&R?"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:[a.jsx("span",{className:"font-medium",children:T}),R&&a.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},S.key)})]})]})}function jG(e,t,n,r){return e?aR(e,n):t?aR(t,n):r("model_selector.default_label")}function TG(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 aR(e,t){if(!e)return"";const n=TG(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function RG(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,i=e.t,o=e.disabled,l=y.useState(!1),u=l[0],d=l[1],f=y.useState([]),p=f[0],h=f[1],m=y.useState(!1),x=m[0],v=m[1],k=y.useState([]),_=k[0],w=k[1],S=y.useRef(null),N=t instanceof Array?new Set(t):new Set,j=y.useCallback(async function(){v(!0);try{var L=await yk();h(L||[])}catch{}finally{v(!1)}},[]),R=y.useCallback(async function(){try{var L=await rO();w(L||[])}catch{w([])}},[]);y.useEffect(function(){j(),R()},[j,R]),y.useEffect(function(){if(!u)return;function L(A){S.current&&!S.current.contains(A.target)&&d(!1)}return document.addEventListener("mousedown",L),function(){document.removeEventListener("mousedown",L)}},[u]);var T=p.filter(function(L){return N.has(L.name)}).length,I=Math.max(0,p.length-T),M=T;return a.jsxs("div",{className:"relative",ref:S,children:[a.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(M>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:i("skills.toggle_title"),"aria-label":i("skills.toggle_title"),children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),I>0&&a.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:I})]}),u&&a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.toggle_header")}),a.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:i("skills.toggle_hint")})]}),x?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:i("skills.no_skills")})}):a.jsx("div",{className:"py-1",children:p.map(function(L){var A=N.has(L.name);return a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[a.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:L.name}),a.jsx("button",{onClick:function(){n(L.name,A)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(A?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!A,children:a.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(A?"translate-x-1":"translate-x-5")})})]},L.name)})}),_.length>0&&a.jsxs("div",{className:"py-1 border-t border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"px-3 pb-1 text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.mcp_toggle_header")}),_.map(function(L){var A="mcp:"+L.id,D=N.has(A);return a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[a.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:L.displayName||L.id}),a.jsx("button",{onClick:function(){n("mcp:"+L.id,D)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(D?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!D,children:a.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(D?"translate-x-1":"translate-x-5")})})]},A)})]}),r&&a.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:a.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:i("skills.reset_to_defaults")})})]})]})}function AG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 IG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 MG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 LG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 OG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 DG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 PG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 FG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function BG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 zG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 UG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:a.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 qG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 HG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:a.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 $G({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 WG({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 sR={gmail:IG,gdrive:MG,discord:LG,whatsapp:OG,wrike:DG,gtasks:PG,mailchimp:FG,bamboohr:BG,pandadoc:zG,exa:UG,dropbox:qG,freshbooks:HG,gcal:$G,docx2md:WG};function VG(e){return Object.prototype.hasOwnProperty.call(sR,e)?sR[e]:AG}const oR={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"},GG=new Set(["current","available","error","unsupported"]);function KG(e){const t=e||{},n=GG.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 YG(e){const t=Object.create(null);return(e||[]).forEach(n=>{!n||!n.name||(t[n.name]=KG(n))}),t}function QG(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 XG({installed:e,configured:t,t:n}){return e?t?a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:a.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")]}):a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:a.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")]}):a.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 ZG({skill:e,onClose:t,onSaved:n}){var{t:r}=Zt(),i=Du(),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(null);y.useEffect(function(){var L=!1;async function A(){try{var D=await vO(e.name);if(L)return;_(D);for(var $=Object.create(null),ee=Object.keys(D.tokens||{}),U=0;U<ee.length;U++){var G=ee[U],Z=D.tokens[G]||{},z=Z.env||G;$[z]=""}l($),d(!1)}catch(q){L||(m(q.message),d(!1))}}return A(),function(){L=!0}},[e.name]);var w=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 D=Object.keys(k.tokens),$=0;$<D.length;$++){var ee=k.tokens[D[$]]||{};if(ee.description&&ee.description.includes("OAuth")){for(var U=null,G=null,Z=null,z=Object.entries(k.tokens),q=0;q<z.length;q++){var ae=z[q][0];ae.includes("REFRESH_TOKEN")&&(U=ae),(ae.includes("CLIENT_ID")||ae.includes("APP_KEY"))&&(G=ae),(ae.includes("CLIENT_SECRET")||ae.includes("APP_SECRET"))&&(Z=ae)}if(U&&G){var P=k.tokens[U]&&k.tokens[U].configured,Q=k.tokens[G]&&k.tokens[G].configured,J=Z&&k.tokens[Z]&&k.tokens[Z].configured,F="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?F="Google":e.name==="dropbox"?F="Dropbox":e.name==="freshbooks"&&(F="FreshBooks"),{provider:F,canConnect:Q&&J&&!P,refreshConfigured:P,clientIdConfigured:Q,clientSecretConfigured:J}}}}return null},[k,e.name]),S=y.useCallback(async function(){m(null),v(!0);try{if(w&&w.brokered){let W=function(){M.current&&(clearInterval(M.current),M.current=null)};var L=await TO(e.name),A=600,D=700,$=(window.screen.width-A)/2,ee=(window.screen.height-D)/2,U=window.open(L.authorizeUrl,"oauth_popup","width="+A+",height="+D+",left="+$+",top="+ee+",scrollbars=yes");if(!U){m("Popup blocked. Please allow popups or visit: "+L.authorizeUrl),v(!1);return}var G=L.flowId,Z=0,z=0;M.current=setInterval(async function(){Z+=1500;try{var H=await RO(e.name,G);if(H&&H.connected){W();try{U.close()}catch{}v(!1),n();return}}catch(se){W(),m(se.message),v(!1);return}if(U.closed&&(z||(z=Z),Z-z>9e3)){W(),v(!1),n();return}Z>3e5&&(W(),v(!1),m("Connection timed out. Please try again."))},1500);return}var q=await jO(e.name),ae=600,P=700,Q=(window.screen.width-ae)/2,J=(window.screen.height-P)/2,F=window.open(q.authorizeUrl,"oauth_popup","width="+ae+",height="+P+",left="+Q+",top="+J+",scrollbars=yes");if(F)var K=setInterval(function(){F.closed&&(clearInterval(K),v(!1),n())},500);else m("Popup blocked. Please allow popups or visit: "+q.authorizeUrl),v(!1)}catch(W){m(W.message),v(!1)}},[e.name,n,w]),N=y.useCallback(async function(){m(null),p(!0);try{for(var L=Object.create(null),A=Object.keys(o),D=0;D<A.length;D++){var $=A[D];o[$]&&o[$].trim()&&(L[$]=o[$].trim())}if(Object.keys(L).length===0){m(r("skills.enter_token")),p(!1);return}await SO(e.name,L),n()}catch(ee){m(ee.message)}finally{p(!1)}},[o,e.name,n,r]),j=y.useCallback(async function(){if(await i({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),p(!0);try{await EO(e.name),n()}catch(L){m(L.message)}finally{p(!1)}}},[e.name,n,i,r]),R=y.useCallback(function(L,A){l(function(D){var $=Object.assign(Object.create(null),D);return $[L]=A,$})},[]),T=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(L){var A=L[0],D=L[1],$=D&&D.env||A;return{name:A,env:$,description:D.description,configured:D.configured,maskedValue:D.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)}},[]),a.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:a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&T.length>0&&a.jsx("div",{className:"space-y-3 mb-4",children:T.map(function(L){return a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[L.env,L.configured&&a.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:L.maskedValue}),")"]})]}),L.description&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:L.description}),a.jsx("input",{type:"password",placeholder:L.configured?r("skills.leave_blank"):r("skills.enter_value"),value:o[L.env]||"",onChange:function(A){R(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&&w&&a.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:w.canConnect?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:w.provider})}),a.jsx("button",{onClick:S,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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:w.provider})]})})]}):w.refreshConfigured?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.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:w.provider})]}),a.jsx("button",{onClick:j,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:w.provider})})]}):a.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:w.provider})})}),!u&&!h&&T.length===0&&!w&&a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),h&&a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:h}),!u&&T.length>0&&a.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("button",{onClick:j,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")}),a.jsxs("div",{className:"flex gap-2",children:[a.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")}),a.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 JG({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:i,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:p}){var h=VG(e.name),m=Object.prototype.hasOwnProperty.call(oR,e.name)?oR[e.name]:"#6B7280",[x,v]=y.useState(!1),k=r===e.name,_=n&&n.status==="available",w=y.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),S=y.useCallback(function(){l&&l(e.name)},[e.name,l]);return a.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:[a.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),a.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:m+"15"},children:a.jsx(h,{className:"w-5 h-5",style:{color:m}})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),a.jsx(XG,{installed:t,configured:t&&e.allTokensConfigured,t:p}),t&&_&&a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"&&a.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"&&a.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"&&a.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")})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||p("skills.no_description")}),e.version&&a.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),a.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:function(){i(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&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("skills.default")]}),_&&a.jsx("button",{onClick:S,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?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]}):a.jsx("button",{onClick:w,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?a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 eK({onBack:e}){var{t}=Zt(),[n,r]=y.useState([]),[i,o]=y.useState([]),[l,u]=y.useState(!0),[d,f]=y.useState(null),[p,h]=y.useState(null),[m,x]=y.useState("all"),[v,k]=y.useState(""),[_,w]=y.useState(!1),[S,N]=y.useState(Object.create(null)),[j,R]=y.useState(null),[T,I]=y.useState(!1),[M,L]=y.useState(Object.create(null)),A=Du(),D=y.useCallback(async function(){u(!0),f(null),I(!1);try{var W=await Promise.allSettled([yk(),bO(),o4()]),H=W[0].status==="fulfilled"?W[0].value:[],se=W[1].status==="fulfilled"?W[1].value:[],ie=W[2].status==="fulfilled"?W[2].value.skillDefaults||{}:{};r(H),o(se),L(ie);var ge=[];W[0].status==="rejected"&&ge.push(t("skills.load_installed_failed",{error:W[0].reason.message})),W[1].status==="rejected"&&ge.push(t("skills.load_marketplace_failed",{error:W[1].reason.message})),ge.length>0&&f(ge.join("; "))}catch(we){f(we.message)}finally{u(!1)}},[t]);y.useEffect(function(){D()},[D]);var $=[],ee=new Set(n.map(function(W){return W.name}));n.forEach(function(W){$.push(Object.assign({},W,{_installed:!0}))}),i.forEach(function(W){ee.has(W.name)||$.push(Object.assign({},W,{_installed:!1,allTokensConfigured:!1}))});var U=$;if(m==="installed"?U=$.filter(function(W){return W._installed}):m==="available"&&(U=$.filter(function(W){return!W._installed})),v){var G=v.toLowerCase();U=U.filter(function(W){return W.name&&W.name.toLowerCase().indexOf(G)!==-1||W.description&&W.description.toLowerCase().indexOf(G)!==-1||W.category&&W.category.toLowerCase().indexOf(G)!==-1})}var Z=y.useCallback(async function(W){try{await kO(W.name),D()}catch(H){f(t("skills.install_failed",{error:H.message}))}},[D,t]),z=y.useCallback(function(W){h(W)},[]),q=y.useCallback(async function(W){if(await A({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:W.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await NO(W.name),D()}catch(H){f(t("skills.uninstall_failed",{error:H.message}))}},[D,A,t]),ae=y.useCallback(function(){h(null),D()},[D]),P=y.useCallback(async function(W,H){L(function(ie){var ge=Object.assign({},ie);return H?ge[W]=!0:delete ge[W],ge});try{var se={};se[W]=H,await CO(se)}catch(ie){L(function(ge){var we=Object.assign({},ge);return H?delete we[W]:we[W]=!0,we}),f(ie.message)}},[]),Q=y.useCallback(async function(){w(!0),f(null);try{var W=await wO();N(YG(W.skills)),I(!0)}catch(H){f(H.message)}finally{w(!1)}},[]),J=y.useCallback(async function(W){R(W),f(null);try{var H=await _O(W);H.updated&&(N(function(se){var ie=Object.assign(Object.create(null),se);return ie[W]={status:"current",hasUpdate:!1,latestVersion:se[W]?se[W].latestVersion:null,currentVersion:se[W]?se[W].latestVersion:null,error:null},ie}),D())}catch(se){f(t("skills.update_failed")+": "+se.message)}finally{R(null)}},[D,t]),F=QG(S),K=F.available;return a.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:i.filter(function(W){return!ee.has(W.name)}).length})})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:Q,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:_?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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")]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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")]})}),K>0&&a.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:K})}),T&&F.error>0&&!_&&a.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:F.error})}),T&&F.unsupported>0&&!_&&a.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:F.unsupported})}),T&&K===0&&F.error===0&&F.unsupported===0&&!_&&a.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")}),a.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(W){return a.jsx("button",{onClick:function(){x(W)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===W?"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_"+W)},W)})})]})]}),a.jsx("div",{className:"shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:a.jsxs("div",{className:"relative",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(W){k(W.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"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&U.length===0&&a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&U.length>0&&a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:U.map(function(W){return a.jsx(JG,{skill:W,installed:W._installed,updateInfo:S[W.name],updatingSkill:j,onConfigure:z,onInstall:Z,onUpdate:J,onUninstall:W._installed?q:null,skillDefaultEnabled:!!M[W.name],onToggleDefault:W._installed?P:null,t},W.name)})})]}),p&&a.jsx(ZG,{skill:p,onClose:function(){h(null)},onSaved:ae})]})}var fk=20;function w1(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function tK(e){var t={},n=[],r={};return(e||[]).forEach(function(i){i.parentId&&!r[i.parentId]?n.push(i):i.parentId?(t[i.parentId]=t[i.parentId]||[]).push(i):n.push(i),r[i.id]=!0}),{topLevel:n,childrenByParent:t}}function FI({post:e,childrenByParent:t,depth:n,onDelete:r,t:i}){var o=t[e.id]||[];return a.jsxs("div",{className:n>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[a.jsxs("div",{className:"py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),a.jsx("span",{children:w1(e.createdAt)}),!e.deleted&&r&&a.jsx("button",{type:"button",onClick:function(){r(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:i("board.delete_post"),"aria-label":i("board.delete_post"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:i("board.post_deleted")}):a.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 a.jsx(FI,{post:l,childrenByParent:t,depth:n+1,onDelete:r,t:i},l.id)})]})}function nK({detail:e,searchQuery:t,onSearchQueryChange:n,onSearch:r,onClearSearch:i,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),a.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&&a.jsxs("form",{onSubmit:r,className:"flex items-center gap-2",children:[a.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"}),a.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&&a.jsx("button",{type:"button",onClick:i,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&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 rK({detail:e,onDeletePost:t,t:n}){var r=tK(e.posts);return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[a.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:[a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),a.jsx("span",{children:w1(e.topic.createdAt)}),e.topic.category&&a.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?a.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(i){return a.jsx(FI,{post:i,childrenByParent:r.childrenByParent,depth:0,onDelete:t,t:n},i.id)})]})}function iK({searchResults:e,onOpenTopic:t,t:n}){return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[a.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?a.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,i){return a.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:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:r.topicTitle}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:r.snippet})]},(r.postId||r.topicId)+":"+i)})]})}function aK({topics:e,offset:t,total:n,onOpenTopic:r,onPage:i,t:o}){var l=t-fk,u=t+fk,d=t>0,f=u<n;return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?a.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 a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p.title}),p.category&&a.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})]}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[p.author," · ",w1(p.createdAt)," ·"," ",o("board.post_count",{count:p.postCount})]})]},p.id)}),(d||f)&&a.jsxs("div",{className:"flex items-center justify-between mt-4",children:[a.jsx("button",{type:"button",disabled:!d,onClick:function(){i(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")}),a.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})}),a.jsx("button",{type:"button",disabled:!f,onClick:function(){i(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 sK({onBack:e}){var{t}=Zt(),[n,r]=y.useState([]),[i,o]=y.useState(0),[l,u]=y.useState(0),[d,f]=y.useState(!0),[p,h]=y.useState(null),[m,x]=y.useState(null),[v,k]=y.useState(""),[_,w]=y.useState(null),S=y.useCallback(async function(A){f(!0),h(null);try{var D=await VO({limit:fk,offset:A});r(D.topics||[]),o(D.total||0)}catch($){h($.message)}finally{f(!1)}},[]);y.useEffect(function(){S(0)},[S]);var N=y.useCallback(async function(A){f(!0),h(null),w(null);try{var D=await Cw(A);x(D)}catch($){h($.message)}finally{f(!1)}},[]),j=y.useCallback(function(){x(null),S(l)},[S,l]),R=y.useCallback(async function(A){h(null);try{await KO(A),x(null),S(l)}catch(D){h(D.message)}},[S,l]),T=y.useCallback(async function(A){if(m){h(null);try{await YO(m.topic.id,A);var D=await Cw(m.topic.id);x(D)}catch($){h($.message)}}},[m]),I=y.useCallback(async function(A){A.preventDefault();var D=v.trim();if(!D){w(null);return}f(!0),h(null);try{var $=await GO(D);w($)}catch(ee){h(ee.message)}finally{f(!1)}},[v]),M=y.useCallback(function(){k(""),w(null)},[]),L=y.useCallback(function(A){u(A),S(A)},[S]);return a.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[a.jsx(nK,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:I,onClearSearch:M,hasSearchResults:!!_,onDeleteTopic:R,onBack:e,onCloseTopic:j,t}),a.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[p&&a.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?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx(rK,{detail:m,onDeletePost:T,t}):_?a.jsx(iK,{searchResults:_,onOpenTopic:N,t}):a.jsx(aK,{topics:n,offset:l,total:i,onOpenTopic:N,onPage:L,t})]})]})}var lR={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 BI({status:e}){var t=lR[e]||lR.available;return a.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium "+t,children:e})}function zI({kind:e}){var t=e==="skill";return a.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 oK({capability:e,onOpen:t}){return a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(zI,{kind:e.kind}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name})]}),a.jsx(BI,{status:e.status})]}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||""}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.version&&a.jsxs("span",{children:["v",e.version]}),e.installedVersion&&e.installedVersion!==e.version&&a.jsxs("span",{children:["(installed v",e.installedVersion,")"]}),e.author&&a.jsx("span",{className:"truncate",children:e.author})]})]})}var Qo={LOADING:"loading",READY:"ready",MISSING:"missing"};function lK({capability:e,docs:t,docsState:n}){var{t:r}=Zt();return e.kind!=="skill"?null:a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:r("capabilities.docs")}),n===Qo.MISSING&&a.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:r("capabilities.docs_missing")}),n===Qo.READY&&a.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===Qo.LOADING&&a.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"…"})]})}function ru({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:e}),a.jsx("dd",{className:"text-gray-900 dark:text-gray-100 break-all",children:t})]}):null}function cK({capability:e}){return a.jsxs("dl",{className:"grid grid-cols-2 gap-2 text-sm mb-4",children:[a.jsx(ru,{label:"Version",value:e.version}),a.jsx(ru,{label:"Author",value:e.author}),e.kind==="mcp"&&a.jsxs(a.Fragment,{children:[a.jsx(ru,{label:"URL",value:e.url}),a.jsx(ru,{label:"Auth",value:e.auth&&e.auth.type||"none"})]}),e.requiresMcps&&e.requiresMcps.length>0&&a.jsx(a.Fragment,{children:a.jsx(ru,{label:"Requires MCPs",value:e.requiresMcps.join(", ")})})]})}var Qn={IDLE:"idle",BUSY:"busy",ERROR:"error",DONE:"done"};function uK({capability:e,onInstalled:t}){var{t:n}=Zt(),r=String(e.id||"").replace(/^mcp:/,""),[i,o]=y.useState(null),[l,u]=y.useState(Qn.IDLE),[d,f]=y.useState(null),[p,h]=y.useState(""),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=e.auth&&e.auth.type||"none",w=y.useCallback(function(){sO(r).then(function(G){o(G)}).catch(function(){o(null)})},[r]);y.useEffect(function(){w()},[w]);function S(G){u(Qn.BUSY),f(null),G().then(function(Z){f(Z&&Z.message?Z.message:n("capabilities.done")),u(Qn.DONE),w(),t&&t()}).catch(function(Z){f(Z&&Z.message||"request failed"),u(Qn.ERROR)})}var N=i&&i.needsReview,j=N&&N.changedTools||[],R=i||e.status==="installed",T=_==="bearer",I=_==="oauth2",M=!!(i&&i.hasToken),L=y.useRef(null),[A,D]=y.useState(!1),$=!!(i&&(i.needsReconsent||i.refreshRejected||i.reconsentRequired));y.useEffect(function(){return function(){L.current&&(clearTimeout(L.current),L.current=null)}},[]);function ee(){u(Qn.BUSY),f(null),mO(r).then(function(G){u(Qn.IDLE),D(!0),f(n("capabilities.oauth_pending")),w(),typeof window<"u"&&window.open&&window.open(G.authorizeUrl,"_blank","noopener");var Z=0,z=function(){Z+=1,xO(r,G.state).then(function(q){if(q&&q.pending){if(Z>150){D(!1),u(Qn.ERROR),f(n("capabilities.oauth_pending"));return}L.current=setTimeout(z,2e3);return}D(!1),q&&q.connected?(u(Qn.DONE),f(n("capabilities.oauth_connected"))):q&&q.needsReconsent?(u(Qn.ERROR),f(n("capabilities.oauth_reconsent"))):(u(Qn.ERROR),f(q&&q.lastError||n("capabilities.oauth_reconsent"))),w(),t&&t()}).catch(function(){D(!1),u(Qn.ERROR),f(n("capabilities.oauth_reconsent"))})};L.current=setTimeout(z,2e3)}).catch(function(G){u(Qn.ERROR),f(G&&G.message||"request failed")})}var U="px-3 py-1.5 rounded text-sm font-medium transition-colors ";return a.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"mcp-runtime",children:[N&&a.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:[a.jsx("p",{className:"text-sm font-medium text-orange-800 dark:text-orange-300 mb-1",children:n("capabilities.needs_review")}),N.reason&&a.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-2",children:N.reason}),j.length>0&&a.jsxs("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-1",children:n("capabilities.changed_tools")}),a.jsx("ul",{className:"text-xs font-mono text-orange-800 dark:text-orange-300 list-disc list-inside",children:j.map(function(G){return a.jsxs("li",{children:[G.name," (",G.change,")"]},G.name)})})]}),a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return dO(r)})},className:U+"bg-orange-600 hover:bg-orange-700 text-white disabled:opacity-50",children:n("capabilities.reapprove")})]}),I&&i&&(i.status==="pending_oauth"||$)&&a.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:[a.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1",children:n($?"capabilities.oauth_reconsent":"capabilities.oauth_connect")}),(i.refreshRejected||i.reconsentRequired)&&a.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 mb-2",children:i.refreshRejected?i.refreshRejected.error:i.reconsentRequired.reason}),a.jsx("button",{type:"button",disabled:l===Qn.BUSY||A,onClick:ee,className:U+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-oauth-connect",children:n("capabilities.oauth_connect")}),A&&a.jsx("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:n("capabilities.oauth_pending")})]}),i&&i.status==="error"&&i.lastError&&a.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:[a.jsxs("p",{className:"text-sm text-red-700 dark:text-red-300",children:[n("capabilities.mcp_error"),": ",i.lastError]}),a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return fO(r)})},className:U+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50","data-testid":"mcp-refresh",children:n("capabilities.retry")})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[!R&&a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return aO(r)})},className:U+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-install",children:n("capabilities.install")}),R&&a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return oO(r)})},className:U+"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")}),R&&!v&&a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){k(!0)},className:U+"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")}),R&&v&&a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return lO(r)}),k(!1)},className:U+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50",children:n("capabilities.uninstall_confirm")}),a.jsx("button",{type:"button",onClick:function(){k(!1)},className:U+"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",children:n("capabilities.cancel")})]})]}),T&&a.jsxs("div",{className:"mt-3","data-testid":"mcp-token",children:[a.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"):""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"password",value:p,onChange:function(G){h(G.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"}),a.jsx("button",{type:"button",disabled:l===Qn.BUSY||!p.trim(),onClick:function(){S(function(){return cO(r,p.trim()).then(function(){h("")})})},className:U+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50",children:n("capabilities.token_save")}),M&&a.jsx("button",{type:"button",disabled:l===Qn.BUSY,onClick:function(){S(function(){return uO(r)})},className:U+"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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:m}),a.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:n("capabilities.token_note")})]}),i&&i.bridgedTools&&i.bridgedTools.length>0&&a.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:[n("capabilities.bridged"),": ",i.bridgedTools.length,i.deferredTools&&i.deferredTools.length>0?" · "+n("capabilities.deferred")+": "+i.deferredTools.length:""]}),d&&a.jsx("p",{className:"mt-2 text-xs "+(l===Qn.ERROR?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:d})]})}var dK={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 fK({capability:e,onInstalled:t}){var{t:n}=Zt(),r=String(e.id||"").replace(/^skill:/,""),[i,o]=y.useState(Qn.IDLE),[l,u]=y.useState(null),d=e.deps||[],f=e.requiresMcps||[],p=e.status==="installed"||e.status==="degraded"||e.status==="update-available",h=i===Qn.BUSY;function m(x){o(Qn.BUSY),u(null),x().then(function(v){u(v),o(Qn.DONE),t&&t()}).catch(function(v){u({error:v&&v.message||"request failed"}),o(Qn.ERROR)})}return!f.length&&!p?null:a.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"skill-composite",children:[f.length>0&&a.jsxs("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:n("capabilities.requires_mcps")}),a.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 a.jsxs("li",{className:x.status?dK[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&&a.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:[a.jsx("p",{className:"text-xs font-medium text-green-800 dark:text-green-300",children:n("capabilities.composite_installed",{name:l.name})}),a.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 a.jsxs("li",{children:[x.id," [",x.status,"]"]},x.id)})})]}),l&&l.error&&a.jsx("p",{className:"mb-2 text-xs text-red-600 dark:text-red-400","data-testid":"skill-composite-error",children:l.error}),a.jsxs("div",{className:"flex items-center gap-2",children:[!p&&a.jsx("button",{type:"button",disabled:h,onClick:function(){m(function(){return hO(r)})},className:cR(),"data-testid":"skill-install",children:n("capabilities.install")}),p&&a.jsx("button",{type:"button",disabled:h,onClick:function(){m(function(){return gO(r)})},className:cR(),"data-testid":"skill-uninstall",children:n("capabilities.uninstall")})]})]})}function cR(){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 pK({capability:e,onClose:t,onInstalled:n}){var{t:r}=Zt(),[i,o]=y.useState(null),[l,u]=y.useState(Qo.LOADING);if(y.useEffect(function(){if(o(null),u(Qo.LOADING),!(!e||e.kind!=="skill")){var f=!1;return iO(e.id).then(function(p){f||(o(p),u(Qo.READY))}).catch(function(){f||u(Qo.MISSING)}),function(){f=!0}}},[e]),!e)return null;var d=e.kind==="collision";return a.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:t,children:a.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:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[!d&&a.jsx(zI,{kind:e.kind}),a.jsx(BI,{status:e.status})]}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 font-mono",children:e.id})]}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),d&&a.jsx("p",{className:"mb-4 text-sm text-red-700 dark:text-red-300",children:e.error}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-4",children:e.description||r("capabilities.no_description")}),a.jsx(cK,{capability:e}),!d&&e.kind==="mcp"&&a.jsx(uK,{capability:e,onInstalled:n}),!d&&e.kind==="skill"&&a.jsx(fK,{capability:e,onInstalled:n}),a.jsx(lK,{capability:e,docs:i,docsState:l})]})})}function hK(e,t,n){return e.filter(function(r){if(n!=="all"&&r.kind!==n)return!1;if(!t)return!0;var i=t.toLowerCase();return(r.name||"").toLowerCase().indexOf(i)!==-1||(r.displayName||"").toLowerCase().indexOf(i)!==-1||(r.description||"").toLowerCase().indexOf(i)!==-1})}function gK({onAdded:e}){var{t}=Zt(),[n,r]=y.useState(""),[i,o]=y.useState(!1),[l,u]=y.useState(null);function d(){var f=n.trim();!f||i||(o(!0),u(null),pO(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 a.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:[a.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"}),a.jsx("button",{type:"button",disabled:i||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&&a.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 mK({warnings:e}){return e.length===0?null:a.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 a.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:t},n)})})}function xK({loading:e,error:t,filtered:n,onRetry:r,onOpen:i,t:o}){return e?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"…"}):t?a.jsxs("div",{className:"text-sm text-red-600 dark:text-red-400",children:[a.jsx("p",{children:t}),a.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?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o("capabilities.no_capabilities")}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(function(l){return a.jsx(oK,{capability:l,onOpen:i},l.id)})})}function yK({onBack:e}){var{t}=Zt(),[n,r]=y.useState(null),[i,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(""),[p,h]=y.useState("all"),[m,x]=y.useState(null),v=y.useCallback(function(){u(!0),s4().then(function(S){r(S),o(null),u(!1)}).catch(function(S){o(S&&S.message||"failed to load"),u(!1)})},[]);y.useEffect(function(){v()},[v]);var k=n&&n.capabilities||[],_=n&&n.warnings||[],w=hK(k,d,p);return a.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.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:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),a.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("capabilities.title")}),a.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"})]}),a.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:[a.jsx("input",{type:"text",value:d,onChange:function(S){f(S.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"}),a.jsx("div",{className:"flex rounded-lg border border-gray-300 dark:border-gray-700 overflow-hidden",children:["all","skill","mcp"].map(function(S){return a.jsx("button",{type:"button",onClick:function(){h(S)},className:"px-3 py-1.5 text-sm "+(p===S?"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_"+S)},S)})})]}),a.jsx(mK,{warnings:_}),a.jsx(gK,{onAdded:v}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a.jsx(xK,{loading:l,error:i,filtered:w,onRetry:v,onOpen:x,t})}),a.jsx(pK,{capability:m,onClose:function(){x(null)},onInstalled:v})]})}const UI=["webhook"],qI=["existing","spawn"],HI=["json","yaml"],wu="••••••••";function $I(e){if(!e||typeof e!="object")return"trigger form is missing";if(UI.indexOf(e.type)===-1)return'type must be "webhook" in Phase 1';if(qI.indexOf(e.targetMode)===-1)return'targetMode must be "existing" or "spawn"';const t=e.payloadFormat===void 0?"json":e.payloadFormat;return HI.indexOf(t)===-1?'payloadFormat must be "json" or "yaml"':e.targetMode==="existing"?bK(e):vK(e)}function bK(e){return e.sessionId?null:'targetMode "existing" needs a sessionId to deliver into'}function vK(e){return e.soul?e.model?null:'targetMode "spawn" needs a model to spawn with':'targetMode "spawn" needs a soul to spawn with'}function uR(e){return typeof e!="string"||e.length<=4?wu:e.slice(0,4)+wu}function kK(e){var t=String(e||"");if(!t)return"";var n=t.lastIndexOf("/");return n===-1?wu:t.slice(0,n+1)+wu}function dR(e){return pp(e)}function _K(){return{name:"",type:"webhook",targetMode:"existing",sessionId:"",soul:"",model:"",template:"",payloadFormat:"json"}}function wK({message:e,onDismiss:t,t:n}){return e?a.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:[a.jsx("p",{className:"text-xs text-red-700 dark:text-red-300 break-all",children:e}),a.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 SK({trigger:e,revealed:t,onCopy:n,onReveal:r,t:i}){var o=t?e.webhookPath:kK(e.webhookPath);return a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{"data-testid":"trigger-webhook-url",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:o}),a.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:i("triggers.copy")}),a.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:i(t?"triggers.hide":"triggers.reveal")})]})}function EK({trigger:e,revealedPath:t,revealedApp:n,revealedVt:r,onCopy:i,onReveal:o,onEdit:l,onDelete:u,t:d}){return a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name||e.id}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.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")}),a.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")})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{"data-testid":"trigger-type",children:e.type}),a.jsx("span",{"data-testid":"trigger-target-mode",children:e.targetMode}),a.jsx("span",{className:"truncate",children:e.targetMode==="spawn"?e.soul:e.sessionId})]}),a.jsx(SK,{trigger:e,revealed:t,onCopy:i,onReveal:o,t:d}),a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"appSecret"}),a.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:uR(e.appSecret):"—"}),a.jsx("button",{type:"button","data-testid":"trigger-appsecret-copy",disabled:!e.appSecret,onClick:function(){dR(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")}),a.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")})]}),a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"verifyToken"}),a.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:uR(e.verifyToken):"—"}),a.jsx("button",{type:"button","data-testid":"trigger-verifytoken-copy",disabled:!e.verifyToken,onClick:function(){dR(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")}),a.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 vf({label:e,value:t,onChange:n,placeholder:r}){return a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:e}),a.jsx("input",{type:"text",value:t,onChange:function(i){n(i.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 NK({draft:e,error:t,onChange:n,onCancel:r,onSave:i,onDelete:o,t:l}){var u=$I(e),d=e.targetMode==="spawn";return a.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:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:e.id?l("triggers.edit"):l("triggers.create")}),a.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-500 dark:text-gray-400 underline",children:l("triggers.cancel")})]}),t&&a.jsx("p",{"data-testid":"trigger-form-error",className:"text-xs text-red-600 dark:text-red-400 break-all",children:t}),a.jsx(vf,{label:l("triggers.name"),value:e.name,onChange:function(f){n({...e,name:f})}}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.type")}),a.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:UI.map(function(f){return a.jsx("option",{value:f,children:f},f)})})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.target_mode")}),a.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:qI.map(function(f){return a.jsx("option",{value:f,children:l("triggers.target_"+f)},f)})})]}),d?a.jsxs("div",{className:"space-y-2",children:[a.jsx(vf,{label:l("triggers.soul"),value:e.soul,onChange:function(f){n({...e,soul:f})}}),a.jsx(vf,{label:l("triggers.model"),value:e.model,onChange:function(f){n({...e,model:f})}})]}):a.jsx(vf,{label:l("triggers.session_id"),value:e.sessionId,onChange:function(f){n({...e,sessionId:f})}}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.template")}),a.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:a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format")}),a.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:HI.map(function(f){return a.jsx("option",{value:f,children:f},f)})}),a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format_help")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button","data-testid":"trigger-save",disabled:!!u,onClick:i,className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white disabled:opacity-50",children:l("triggers.save")}),e.id&&a.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 CK({onBack:e}){var{t}=Zt(),[n,r]=y.useState([]),[i,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState({}),[p,h]=y.useState(null),m=y.useCallback(function(){u(!0),n3().then(function(S){r(S&&S.triggers||[]),o(null),u(!1)}).catch(function(S){r([]),o(S&&S.message||t("triggers.request_failed")),u(!1)})},[t]);y.useEffect(function(){m()},[m]);function x(S){pp(S.webhookPath).then(function(N){N||o(t("triggers.copy_failed"))})}function v(S){f(function(N){var j={...N};return j[S]=!N[S],j})}function k(S){o(null),h(S)}function _(){var S=$I(p);if(S){o(S);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 j=p.id?i3(p.id,N):r3(N);j.then(function(){o(null),h(null),m()}).catch(function(R){o(R&&R.message||t("triggers.request_failed"))})}function w(S){a3(S.id).then(function(){o(null),p&&p.id===S.id&&h(null),m()}).catch(function(N){o(N&&N.message||t("triggers.request_failed"))})}return a.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.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:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),a.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("triggers.title")}),a.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")})]}),a.jsx(wK,{message:i,onDismiss:function(){o(null)},t}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-w-0",children:[l&&a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.loading")}),!l&&n.length===0&&a.jsx("p",{"data-testid":"trigger-empty",className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.empty")}),!l&&n.map(function(S){return a.jsx(EK,{trigger:S,revealedPath:!!d[S.id],revealedApp:!!d[S.id+":app"],revealedVt:!!d[S.id+":vt"],onCopy:x,onReveal:v,onEdit:k,onDelete:w,t},S.id)})]}),p&&a.jsx(NK,{draft:p,error:i,onChange:function(S){h(S),o(null)},onCancel:function(){h(null)},onSave:_,onDelete:w,t})]}),a.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:a.jsx("button",{type:"button","data-testid":"trigger-create",onClick:function(){k(_K())},className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white",children:t("triggers.create")})})]})}var jK=["__proto__","constructor","prototype"],TK="Session expired. Please log in again.";function iu(e){return e&&e.status===401?TK:e.message}function pv(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function RK(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 WI(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function fR(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=WI(n);t[r]=n}return t}function pR(e){var t=e.name,n=e.config,r=e.setName,i=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function p(_){i(function(w){return Object.assign({},w,_)})}function h(_){i(function(w){return Object.assign({},w,{limit:Object.assign({},w.limit||{},_)})})}function m(_){i(function(w){return Object.assign({},w,{cost:Object.assign({},w.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=WI(n.spec);return a.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:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:v,children:f("settings.model_registry.name")}),a.jsx("input",{type:"text",value:t,onChange:function(_){r(_.target.value)},className:x+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsxs("label",{className:v,children:[f("settings.model_registry.spec"),k&&a.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")})]}),a.jsx("input",{type:"text",value:n.spec||"",onChange:function(_){p({spec:_.target.value})},className:x+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:v,children:f("settings.model_registry.displayName")}),a.jsx("input",{type:"text",value:n.displayName||"",onChange:function(_){p({displayName:_.target.value})},className:x,placeholder:f("settings.model_registry.displayName_placeholder")})]}),a.jsxs("details",{className:"col-span-2",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:f("settings.model_registry.limit_context")}),a.jsx("input",{type:"number",value:n.limit?n.limit.context:128e3,onChange:function(_){h({context:parseInt(_.target.value,10)||128e3})},className:x})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:f("settings.model_registry.limit_output")}),a.jsx("input",{type:"number",value:n.limit?n.limit.output:8192,onChange:function(_){h({output:parseInt(_.target.value,10)||8192})},className:x})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:f("settings.model_registry.cost_input")}),a.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})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:f("settings.model_registry.cost_output")}),a.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})]})]})]})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.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")}),a.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 AK({value:e,onChange:t,t:n}){const[r,i]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(null),[f,p]=y.useState(!1),[h,m]=y.useState(""),[x,v]=y.useState(pv()),[k,_]=y.useState(null),[w,S]=y.useState(!1),[N,j]=y.useState(null);y.useEffect(function(){var U=!1;return l(!0),Mv().then(function(G){U||(i(G),l(!1))}).catch(function(G){U||(d(iu(G)),l(!1))}),function(){U=!0}},[]);var R=y.useCallback(function(){l(!0),d(null),Mv().then(function(U){i(U),l(!1)}).catch(function(U){d(iu(U)),l(!1)})},[]);function T(U,G,Z){var z=(U||"").trim();return z?jK.indexOf(z)!==-1?n("settings.model_registry.error_name_reserved",{name:z}):z!==Z&&G.indexOf(z)!==-1?n("settings.model_registry.error_name_exists",{name:z}):null:n("settings.model_registry.error_name_required")}var I=y.useCallback(async function(){if(r){var U=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),G=T(h,U,null);if(G){j(G);return}S(!0),j(null);try{await jw(h.trim(),fR(x)),p(!1),m(""),v(pv()),R(),t&&t(e)}catch(Z){j(iu(Z))}finally{S(!1)}}},[h,x,r,t,e,R]),M=y.useCallback(async function(U){S(!0),j(null);try{await Tw(U),R(),t&&t(e)}catch(G){j(iu(G))}finally{S(!1)}},[t,e,R]),L=y.useCallback(async function(){if(!(!k||!r)){var U=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),G=T(k.name,U,k.originalName);if(G){j(G);return}S(!0),j(null);try{var Z=k.name.trim(),z=fR(k.config);if(await jw(Z,z),Z!==k.originalName)try{await Tw(k.originalName)}catch(q){j(n("settings.model_registry.error_rename_cleanup",{error:q.message}))}_(null),R(),t&&t(e)}catch(q){j(iu(q))}finally{S(!1)}}},[k,r,t,e,R]);if(o)return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[a.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 a.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:{},D=r&&r.builtin?r.builtin:{},$=Object.keys(A),ee=Object.keys(D);return a.jsxs("div",{className:"space-y-3",children:[N&&a.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}),ee.length>0&&a.jsxs("div",{children:[a.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")}),a.jsx("div",{className:"space-y-1",children:ee.map(function(U){var G=D[U];return a.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:[a.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:U}),G.provider&&a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:G.provider}),G.limit&&G.limit.context&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:G.limit.context/1e3})}),G.tier&&a.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:G.tier})]},U)})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.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&&a.jsx("button",{type:"button",onClick:function(){p(!0),m(""),v(pv()),j(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")})]}),$.length===0&&!f&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:n("settings.model_registry.no_user_models")}),a.jsxs("div",{className:"space-y-2",children:[$.map(function(U){var G=A[U];return k&&k.originalName===U?a.jsx(pR,{name:k.name,config:k.config,setName:function(Z){_(function(z){return z&&Object.assign({},z,{name:Z})})},setConfig:function(Z){_(function(z){if(!z)return z;var q=typeof Z=="function"?Z(z.config):Z;return Object.assign({},z,{config:q})})},onSave:L,onCancel:function(){_(null),j(null)},saving:w,isNew:!1,t:n},U):a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:U}),G.displayName&&G.displayName!==U&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",G.displayName,")"]}),G.url&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",G.url]}),!G.url&&G.target&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",G.target]}),G.limit&&G.limit.context&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:G.limit.context/1e3})})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("button",{type:"button",onClick:function(){_({originalName:U,name:U,config:RK(G)}),p(!1),j(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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{type:"button",onClick:function(){window.confirm(n("settings.model_registry.delete_confirm",{name:U}))&&M(U)},disabled:w,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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]})]},U)}),f&&a.jsx(pR,{name:h,config:x,setName:m,setConfig:function(U){v(function(G){return typeof U=="function"?U(G):U})},onSave:I,onCancel:function(){p(!1),j(null)},saving:w,isNew:!0,t:n})]})]})]})}function IK({setting:e,value:t,onChange:n,error:r,models:i,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"&&i&&i.length>0&&t&&!i.find(function(m){return m.id===t});if(y.useEffect(function(){e.type!=="model-select"||!i||i.length===0||t&&i.find(function(m){return m.id===t})&&u(!1)},[t,i,e.type]),e.type==="model-select"){if(!i||i.length===0)return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const m=l||p,x=xG(i);return a.jsxs("div",{children:[a.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 a.jsx("optgroup",{label:gG[k]||k,children:_.map(function(w){return a.jsxs("option",{value:w.id,children:[w.name,mG(w.tier)]},w.id)})},k)}),a.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&a.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&&a.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 a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.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")})}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(x?"settings.enabled":"settings.disabled")})]}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="select")return a.jsxs("div",{children:[a.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 a.jsx("option",{value:m,children:x},m)})}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="number")return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="textarea")return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="object")return a.jsxs("div",{children:[a.jsx(AK,{value:t,onChange:n,t:o}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const h=e.type==="password"?"password":"text";return a.jsxs("div",{children:[a.jsx("input",{type:h,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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}let Ea=null;function VI(){if(Ea&&Ea.state==="closed"&&(Ea=null),!Ea){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{Ea=new e}catch(t){throw Ea=null,t}}return Ea.state==="suspended"&&Ea.resume().catch(()=>{}),Ea}if(typeof document<"u"){const e=async()=>{let t;try{t=VI()}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"&&(Ea=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function MK(){let e;try{e=VI()}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 i=e.createOscillator(),o=e.createGain();i.type="sine",i.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),i.connect(o),o.connect(e.destination),i.start(t+.1),i.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),Ea=null}}function LK(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function OK(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const GI="pave-native-notifications";function Qu(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function DK(){return Qu()?Notification.permission:"unsupported"}function S1(){if(!Qu()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(GI)==="true"}catch{return!1}}function PK(e){try{localStorage.setItem(GI,e?"true":"false")}catch{}}async function FK(){if(!Qu())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function BK({title:e,body:t,tag:n,icon:r,onClick:i}){if(!Qu()||Notification.permission!=="granted"||!S1())return null;try{const o=new Notification(e,{body:t||"",tag:n||"pave-"+Date.now(),icon:r||yr("/pave-logo-light.png"),silent:!1});return typeof i=="function"&&(o.onclick=function(){i(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const KI="pave-push-notifications",zK="/sw.js";function Ip(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function UK(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function qK(){try{return localStorage.getItem(KI)==="true"}catch{return!1}}function Qf(e){try{localStorage.setItem(KI,e?"true":"false")}catch{}}function hv(){return typeof Notification>"u"?"unsupported":Notification.permission}async function HK(){if(!Ip())return null;try{return await navigator.serviceWorker.register(yr(zK),{scope:yr("/")})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function $K(){if(!Ip())return console.warn("[web-push] Not supported in this browser"),!1;const e=await HK();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(yr("/api/push/vapid-public-key"),{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const i=await r.json();t=QK(i.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 i=new Uint8Array(n.options.applicationServerKey);r=YK(i,t)}if(r)return await hR(n),Qf(!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 hR(n),Qf(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function WK(){if(!Ip())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch(yr("/api/push/unsubscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return Qf(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),Qf(!1),!1}}async function hR(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:gR(e.getKey("p256dh")),auth:gR(e.getKey("auth"))}},await fetch(yr("/api/push/subscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function VK(){const e=await fetch(yr("/api/push/test"),{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function GK(e){if(typeof document>"u"||typeof window>"u")return;function t(n){const r=typeof e=="function"?e():null,i=JSON.stringify({visible:n,activeSessionId:r});try{if(navigator.sendBeacon){const o=new Blob([i],{type:"application/json"});navigator.sendBeacon(yr("/api/visibility"),o);return}fetch(yr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:i}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function KK(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(yr("/api/visibility"),r);return}fetch(yr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:n}).catch(()=>{})}catch{}}function YK(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 QK(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4),r=atob(t+n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}function gR(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 Xu="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function E1({t:e}){return a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function Mp({id:e,label:t,description:n,hints:r,checked:i,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return a.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:n}),r]}),u?a.jsx("button",{id:e,type:"button",role:"switch","aria-checked":i,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 "+(i?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:a.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 "+(i?"translate-x-5":"translate-x-0")})}):a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function XK(){const{t:e,locale:t,setLocale:n,availableLocales:r}=Zt();return a.jsxs("div",{className:Xu,children:[a.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),a.jsx("select",{id:"settings-language",value:t,onChange:function(i){n(i.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(i){return a.jsxs("option",{value:i.code,children:[i.nativeName," (",i.name,")"]},i.code)})}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function ZK(){const{t:e}=Zt(),[t,n]=y.useState(()=>LK()),r=y.useCallback(function(){const i=!t;n(i),OK(i),i&&MK()},[t]);return a.jsxs("div",{className:Xu,children:[a.jsx(Mp,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:a.jsx(E1,{t:e}),checked:t,onToggle:r}),a.jsx(JK,{}),a.jsx(eY,{})]})}function JK(){const{t:e}=Zt(),[t]=y.useState(()=>Qu()),[n,r]=y.useState(()=>DK()),[i,o]=y.useState(()=>S1()),l=y.useCallback(async function(){if(!t)return;if(!i&&Notification.permission!=="granted"){const d=await FK();if(r(d),d!=="granted")return}const u=!i;o(u),PK(u)},[i,t]);return a.jsx(Mp,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:a.jsxs(a.Fragment,{children:[n==="denied"&&a.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),n==="default"&&a.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),a.jsx(E1,{t:e})]}),checked:i,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function eY(){const[e]=y.useState(()=>Ip()),[t,n]=y.useState(()=>qK()),[r,i]=y.useState(()=>hv()),[o,l]=y.useState(!1),u=y.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await WK(),n(!1)):(await $K()&&n(!0),i(hv()))}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 VK();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 a.jsx(Mp,{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:a.jsxs(a.Fragment,{children:[e&&!UK()&&a.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"&&a.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&&a.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 tY({mobileFrameless:e,onMobileFramelessChange:t}){const{t:n}=Zt();return a.jsx("div",{className:Xu,children:a.jsx(Mp,{id:"settings-mobile-frameless",label:n("settings.mobile_frameless"),description:n("settings.mobile_frameless_desc"),hints:a.jsx(E1,{t:n}),checked:e,onToggle:()=>t(!e)})})}function nY({activeSessionId:e}){const{t}=Zt(),[n,r]=y.useState(()=>Bl()||""),[i,o]=y.useState(()=>Bl()||""),[l,u]=y.useState(""),[d,f]=y.useState(null),[p,h]=y.useState(!1),[m,x]=y.useState(null);y.useEffect(function(){Lv().then(function(w){u(w.home||"")}).catch(function(){})},[]);const v=y.useCallback(function(w){r(w),f(null),x(null)},[]),k=y.useCallback(async function(){const w=n.trim();if(!w){if(rg(null),o(""),r(""),f(null),x({type:"success",message:t("settings.working_dir_reset")}),e)try{await Li(e,{directory:null})}catch(N){console.warn("[settings] failed to clear session directory:",N.message)}return}h(!0),f(null);const S=Bl();try{rg(w);const N=await Lv();if(o(w),r(w),x({type:"success",message:t("settings.working_dir_updated",{path:N.cwd})}),e)try{await Li(e,{directory:w})}catch(j){console.warn("[settings] failed to update session directory:",j.message)}}catch(N){rg(S),r(i),f(t("settings.working_dir_invalid",{error:N.message}))}finally{h(!1)}},[n,i,e,t]),_=n!==i;return a.jsxs("div",{className:Xu,children:[a.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")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{id:"settings-working-dir",type:"text",value:n,onChange:function(w){v(w.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"}),a.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&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&a.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}),i&&a.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:i})})]})}function rY(){const{t:e}=Zt(),[t,n]=y.useState("checking"),[r,i]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(null),f=y.useCallback(function(m){i(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 og();f(m)}catch(m){d(m.message),n("check-error")}},[f]),h=y.useCallback(async function(){n("updating"),d(null);try{await e3(),n("success");try{const m=await og();i(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 og();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),n("check-error"))}})(),function(){m=!0}},[f]),a.jsx("div",{className:Xu,children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r||"--"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),a.jsx(iY,{t:e,updateStatus:t,updateError:u,latestVersion:o}),a.jsx(aY,{t:e,updateStatus:t,onCheckUpdates:p,onPerformUpdate:h})]})})}function iY({t:e,updateStatus:t,updateError:n,latestVersion:r}){return a.jsxs(a.Fragment,{children:[t==="update-available"&&a.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",r,")"]}),t==="no-updates"&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&n&&a.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",n]}),t==="error"&&n&&a.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",n]})]})}function aY({t:e,updateStatus:t,onCheckUpdates:n,onPerformUpdate:r}){const i=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return a.jsxs("div",{className:"flex gap-2 pt-1",children:[i&&a.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"&&a.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"&&a.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"&&a.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")})]})}const gv="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",mR="pave-asr-language",mv="pave-asr-model",sY=[{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"}],xR=[{code:"whisper",label:"Whisper",hintKey:"voice.engine_whisper_hint"},{code:"paraformer",label:"Paraformer",hintKey:"voice.engine_paraformer_hint"}];function xv(e,t){try{return localStorage.getItem(e)||t}catch{return t}}function yR(e,t){try{localStorage.setItem(e,t)}catch{}}function yv({id:e,label:t,description:n,value:r,options:i,note:o,onValueChange:l,disabled:u}){return a.jsxs("div",{children:[a.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 mb-2",children:n}),a.jsx("select",{id:e,value:r,disabled:u,onChange:function(d){l(d.target.value)},className:"w-full sm:w-64 px-2 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm text-gray-900 dark:text-gray-100 disabled:opacity-50",children:i.map(function(d){return a.jsx("option",{value:d.code,children:d.label},d.code)})}),o?a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:o}):null]})}function oY(){const{t:e}=Zt(),[t,n]=y.useState("whisper"),[r,i]=y.useState(function(){return xv(mR,"auto")}),[o,l]=y.useState(function(){return xv(mv,"")}),[u,d]=y.useState([]),[f,p]=y.useState(!1),[h,m]=y.useState(""),[x,v]=y.useState("");y.useEffect(function(){let S=!1;return Of().then(function(N){S||!N||(Array.isArray(N.models)&&N.models.length>0&&(d(N.models),l(function(j){const R=j||xv(mv,"");return N.models.some(function(I){return I.name===R})?R:N.models[0].name})),(N.preferredEngine==="whisper"||N.preferredEngine==="paraformer")&&n(N.preferredEngine))}).catch(function(){}),function(){S=!0}},[]),y.useEffect(function(){r&&yR(mR,r)},[r]),y.useEffect(function(){o&&yR(mv,o)},[o]);const k=y.useRef(t);y.useEffect(function(){k.current=t},[t]);const _=y.useCallback(function(S){const N=k.current;m(""),v(""),N!==S&&(n(S),p(!0),zO(S).then(function(){S==="paraformer"&&v(e("voice.paraformer_starting"))}).catch(function(j){n(N),m(j&&j.message?String(j.message):String(j))}).finally(function(){p(!1)}))},[e]),w=xR.filter(function(S){return S.code===t})[0];return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:gv,children:[a.jsx(yv,{id:"settings-voice-engine",label:e("voice.engine"),description:e("voice.engine_description"),value:t,disabled:f,options:xR,onValueChange:_,note:w?e(w.hintKey):null}),x?a.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300 mt-3","data-testid":"voice-engine-notice",children:x}):null,h?a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3",role:"alert","data-testid":"voice-engine-error",children:e("voice.engine_switch_failed")+": "+h}):null]}),a.jsxs("div",{className:gv,children:[a.jsx(yv,{id:"settings-voice-language",disabled:t!=="whisper",label:e("voice.language"),description:e("voice.language_description"),value:r,options:sY,onValueChange:i,note:e("voice.whisper_only")}),r==="yue"?a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-3","data-testid":"voice-cantonese-note",children:e("voice.cantonese_note")}):null]}),a.jsxs("div",{className:gv,children:[a.jsx(yv,{id:"settings-voice-model",label:e("voice.model"),description:e("voice.model_description"),value:o,disabled:u.length===0||t!=="whisper",options:u.map(function(S){return{code:S.name,label:S.label||S.name}}),onValueChange:l,note:e("voice.whisper_only")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-3",children:e("voice.next_recording_note")})]})]})}function lY(){const{t:e}=Zt(),[t,n]=y.useState([]),[r,i]=y.useState({}),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(null),k=y.useCallback(async()=>{try{d(!0),v(null);const T=(await l4()).settings||[];n(T),i(Rv(T)),l({}),m(null)}catch(R){v(R.message)}finally{d(!1)}},[]),_=y.useCallback((R,T)=>{i(I=>{const M={...I};return M[R]=T,M}),l(I=>{if(!I[R])return I;const{[R]:M,...L}=I;return L}),m(null)},[]),w=hL(t,r),S=Object.keys(w).length,N=y.useCallback(async()=>{p(!0),m(null);try{if(S===0){m({type:"info",message:e("settings.no_changes")});return}const R=await DO(w),T=Object.keys(R.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(w)}}))}catch{}if(T.length>0?(l(R.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),R.settings){const I=R.settings;n(I),i(M=>gL(I,M,T))}}catch(R){if(R&&R.status===401){m({type:"error",message:"Session expired. Please log in again."});return}m({type:"error",message:e("settings.save_failed",{error:R.message})})}finally{p(!1)}},[w,S,e]),j=y.useCallback(()=>{i(Rv(t)),l({}),m(null)},[t]);return{settings:t,formValues:r,errors:o,loading:u,saving:f,saveResult:h,setSaveResult:m,loadError:x,updates:w,changedCount:S,loadSettings:k,handleChange:_,handleSave:N,handleReset:j}}function cY(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function uY({t:e,loadError:t,onRetry:n}){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[a.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),a.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 pk="__dlp__",hk="__pricing__",YI="Configure Data Loss Prevention rules, detectors, and audit policies.",QI="Configure per-model token pricing used for cost and usage tracking.",Lp="__chat_language__",Lu="__chat_notifications__",Op="__chat_appearance__",Dp="__chat_workspace__",Hl="__chat_version__",$l="__chat_voice__",dY=[{groupId:Lp,labelKey:"settings.language",descriptionKey:"settings.language_description"},{groupId:Lu,labelKey:"settings.notification_sound",descriptionKey:"settings.notification_sound_desc"},{groupId:Lu,labelKey:"settings.native_notifications",descriptionKey:"settings.native_notifications_desc"},{groupId:Op,labelKey:"settings.mobile_frameless",descriptionKey:"settings.mobile_frameless_desc"},{groupId:Dp,labelKey:"settings.working_dir",descriptionKey:"settings.working_dir_desc"},{groupId:Hl,labelKey:"settings.current_version",descriptionKey:null},{groupId:Hl,labelKey:"settings.latest_version",descriptionKey:null},{groupId:Hl,labelKey:"settings.check_updates",descriptionKey:null},{groupId:$l,labelKey:"voice.engine",descriptionKey:"voice.engine_description"},{groupId:$l,labelKey:"voice.language",descriptionKey:"voice.language_description"},{groupId:$l,labelKey:"voice.model",descriptionKey:"voice.model_description"}],fY=[{id:Lp,headerKey:"settings.category.language"},{id:Lu,headerKey:"settings.notifications"},{id:Op,headerKey:"settings.appearance"},{id:Dp,headerKey:"settings.workspace"},{id:Hl,headerKey:"settings.version_title"},{id:$l,headerKey:"settings.category.voice"}],bR={[Lp]:XK,[Lu]:ZK,[Op]:tY,[Dp]:nY,[Hl]:rY,[$l]:oY};function pY(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 hY(e,t){return t?e.filter(function(n){return(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function gY(e,t){return t?e.filter(function(n){return(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function mY(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 xY(e){const t={};if(!e)return t;for(let n=0;n<e.length;n++){const r=e[n].groupId;t[r]=(t[r]||0)+1}return t}function yY({t:e,search:t,onSearchChange:n,onBack:r,groups:i,activeGroup:o,matchCounts:l,searching:u,onSelect:d}){return a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),a.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:i.map(function(f){const p=u?l[f.id]:null;return a.jsx("option",{value:f.id,children:p?f.label+" ("+p+")":f.label},f.id)})}),a.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[a.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:a.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"})}),a.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&&a.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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function bY({t:e,groups:t,activeGroup:n,matchCounts:r,searching:i,onSelect:o}){return a.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=!i&&l.id===n,d=i?r[l.id]:l.kind==="registry"?l.count:null,f=!i||r[l.id];return a.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:[a.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums shrink-0",children:d})]},l.id)})})}function vY({setting:e,formValue:t,error:n,models:r,t:i,onChange:o}){const l=e.source==="env";return a.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:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&a.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:i("settings.env_override",{envVar:e.envVar}),children:i("settings.source_env")})]}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&a.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:i("settings.requires_restart")}),e.source==="env"&&a.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:i("settings.env_override",{envVar:e.envVar})}),a.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),a.jsx(IK,{setting:e,value:t!==void 0?t:"",onChange:o,error:n,models:r,t:i}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&a.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:i("settings.default_prefix",{value:e.defaultValue===""?i("settings.default_empty"):String(e.defaultValue)})})]})}function If({title:e,description:t,actionLabel:n,onOpen:r}){return a.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),a.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 kY({t:e,headerKey:t,hits:n,onSelectGroup:r}){return a.jsxs("section",{children:[a.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:e(t)}),a.jsx("div",{className:"space-y-3",children:n.map(function(i){return a.jsx(If,{title:i.label,description:i.description,actionLabel:e("settings.v2.open"),onOpen:function(){r(i.groupId)}},"search-chat-"+i.groupId+"-"+i.labelKey)})})]})}function _Y({t:e,changedCount:t,saving:n,saveResult:r,onSave:i,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 a.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:[a.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&&a.jsx("span",{className:"text-xs "+l,children:r.message}),a.jsxs("div",{className:"ml-auto flex gap-2",children:[a.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")}),a.jsx("button",{type:"button",onClick:i,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 wY({t:e}){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[a.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})}),a.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function SY(e){const{q:t,matches:n,launcherMatches:r,chatMatches:i,orderedCategories:o,grouped:l,renderRegistryRow:u,activeGroup:d,t:f,onSelectChatGroup:p,onOpenDlpSettings:h,onOpenPricingSettings:m,activeSessionId:x,mobileFrameless:v,onMobileFramelessChange:k}=e;let _;if(t&&(!n||n.length===0)&&(!r||r.length===0)&&(!i||i.length===0))_=a.jsx(wY,{t:f});else if(t)_=a.jsxs("div",{className:"space-y-6",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f("settings.v2.search_results",{count:(n?n.length:0)+(r?r.length:0)+(i?i.length:0)})}),o.map(function(w){const S=n.filter(function(N){return N.category===w});return S.length===0?null:a.jsxs("section",{children:[a.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:Lf[w]?f(Lf[w]):w}),a.jsx("div",{className:"space-y-3",children:S.map(u)})]},"search-"+w)}),fY.map(function(w){const S=(i||[]).filter(function(N){return N.groupId===w.id});return S.length===0?null:a.jsx(kY,{t:f,headerKey:w.headerKey,hits:S,onSelectGroup:p},"search-chat-"+w.id)}),(r||[]).map(function(w){return a.jsx(If,{title:w.label,description:w.description,actionLabel:f("settings.v2.open"),onOpen:w.onOpen},"search-launcher-"+w.id)})]});else if(d===pk)_=a.jsx(If,{title:f("dlp.title"),description:YI,actionLabel:f("settings.v2.open"),onOpen:h});else if(d===hk)_=a.jsx(If,{title:f("pricing.title"),description:QI,actionLabel:f("settings.v2.open"),onOpen:m});else if(bR[d]){const w=bR[d];_=a.jsx("div",{className:"space-y-3",children:a.jsx(w,{activeSessionId:x,mobileFrameless:v,onMobileFramelessChange:k})})}else _=a.jsxs("div",{className:"space-y-3",children:[d==="Experimental Features"&&a.jsx("p",{className:"text-xs opacity-70",children:f("settings.category.experimental.blurb")}),(l[d]||[]).map(u)]});return _}function EY({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:i,onMobileFramelessChange:o}){const{t:l}=Zt(),{settings:u,formValues:d,errors:f,loading:p,saving:h,saveResult:m,loadError:x,changedCount:v,loadSettings:k,handleChange:_,handleSave:w,handleReset:S}=lY(),N=u.filter(function(K){return!K.hidden}),[j,R]=y.useState([]),[T,I]=y.useState(""),[M,L]=y.useState(null);y.useEffect(()=>{k()},[k]),y.useEffect(()=>{L(function(K){return K||u[0]&&u[0].category||null})},[u]),y.useEffect(()=>{let K=!1;return t3().then(function(W){K||R(Array.isArray(W)?W:W&&W.models||[])}).catch(function(){K||R([])}),function(){K=!0}},[]);const A=mL(N),D=xL(A,yL),$=D.map(function(K){return{id:K,kind:"registry",label:Lf[K]?l(Lf[K]):K,count:A[K].length}}).concat([{id:Lp,kind:"chat",label:l("settings.category.language")},{id:Lu,kind:"chat",label:l("settings.notifications")},{id:Op,kind:"chat",label:l("settings.appearance")},{id:Dp,kind:"chat",label:l("settings.workspace")},{id:Hl,kind:"chat",label:l("settings.version_title")},{id:$l,kind:"chat",label:l("settings.category.voice")},{id:pk,kind:"launcher",label:l("dlp.title")},{id:hk,kind:"launcher",label:l("pricing.title")}]),ee=T.trim().toLowerCase(),U=pY(N,ee),G=[{id:pk,label:l("dlp.title"),description:YI,onOpen:t},{id:hk,label:l("pricing.title"),description:QI,onOpen:n}],Z=hY(G,ee),z=dY.map(function(K){return{groupId:K.groupId,labelKey:K.labelKey,label:l(K.labelKey),description:K.descriptionKey?l(K.descriptionKey):""}}),q=gY(z,ee),ae=xY(q),P={...mY(U),...ae},Q=y.useCallback(function(K){I(""),L(K)},[]),J=function(K){return a.jsx(vY,{setting:K,formValue:d[K.key],error:f[K.key],models:j,t:l,onChange:function(W){_(K.key,W)}},K.key)};if(p)return a.jsx(cY,{});if(x)return a.jsx(uY,{t:l,loadError:x,onRetry:k});const F=SY({q:ee,matches:U,launcherMatches:Z,chatMatches:q,orderedCategories:D,grouped:A,renderRegistryRow:J,activeGroup:M,t:l,onOpenDlpSettings:t,onOpenPricingSettings:n,onSelectChatGroup:Q,activeSessionId:r,mobileFrameless:i,onMobileFramelessChange:o});return a.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[a.jsx(yY,{t:l,search:T,onSearchChange:I,onBack:e,groups:$,activeGroup:M,matchCounts:P,searching:!!ee,onSelect:Q}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx(bY,{t:l,groups:$,activeGroup:M,matchCounts:P,searching:!!ee,onSelect:Q}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:F}),a.jsx(_Y,{t:l,changedCount:v,saving:h,saveResult:m,onSave:w,onReset:S})]})]})]})}function NY({modelName:e,rates:t,onChange:n,onDelete:r,isDefault:i,t:o}){return a.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`text-sm font-medium truncate ${i?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),i&&a.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")})]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),a.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")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),a.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")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),a.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")})]}),!i&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),i&&a.jsx("div",{className:"w-6"})]})]})}function CY({onAdd:e,existingModels:t,t:n}){const[r,i]=y.useState(""),[o,l]=y.useState(5),[u,d]=y.useState(15),[f,p]=y.useState(2.5),[h,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}),i(""),l(5),d(15),p(2.5)};return a.jsxs("form",{onSubmit:x,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("pricing.add_new_model")}),a.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[a.jsx("div",{className:"flex-1 min-w-[120px]",children:a.jsx("input",{type:"text",placeholder:n("pricing.add_model_placeholder"),value:r,onChange:v=>i(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"})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_input")}),a.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"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_output")}),a.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"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_cache")}),a.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"})]}),a.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")})]}),h&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:h})]})}function jY({onClose:e}){const{t}=Zt(),n=Du(),[r,i]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(!1),[f,p]=y.useState(null),[h,m]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{let R=!1;async function T(){try{const I=await QO();R||(i(I),l(!1))}catch(I){R||(p(I.message),l(!1))}}return T(),()=>{R=!0}},[]),y.useEffect(()=>{async function R(T){T.key==="Escape"&&(h?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",R),x.current&&x.current.focus(),()=>document.removeEventListener("keydown",R)},[e,h,n,t]);const v=y.useCallback((R,T,I)=>{i(M=>!M||!M.models?M:{...M,models:{...M.models,[R]:{...M.models[R],[T]:I}}}),m(!0)},[]),k=y.useCallback(async R=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:R}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(i(T=>{if(!T||!T.models)return T;const I={...T.models};return delete I[R],{...T,models:I}}),m(!0))},[n,t]),_=y.useCallback((R,T)=>{i(I=>I?{...I,models:{...I.models,[R]:T}}:{models:{[R]:T}}),m(!0)},[]),w=y.useCallback(async()=>{p(null),d(!0);try{await XO(r),m(!1),e()}catch(R){p(R.message)}finally{d(!1)}},[r,e]),S=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 R=await ZO();i(R.pricing),m(!1)}catch(R){p(R.message)}finally{d(!1)}}},[n,t]),N=y.useCallback(async()=>{h?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[h,e,n,t]),j=r!=null&&r.models?Object.entries(r.models).sort(([R],[T])=>R==="default"?1:T==="default"?-1:R.localeCompare(T)):[];return a.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:a.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:R=>R.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&r&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[a.jsx("span",{children:t("pricing.configured_count",{count:j.length})}),a.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),a.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[a.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:[a.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),a.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),a.jsx("div",{className:"w-6"})]}),a.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:j.map(([R,T])=>a.jsx(NY,{modelName:R,rates:T,onChange:v,onDelete:k,isDefault:R==="default",t},R))})]}),a.jsx(CY,{onAdd:_,existingModels:j.map(([R])=>R),t})]})]}),a.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:[a.jsx("button",{onClick:S,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")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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")}),a.jsxs("button",{onClick:w,disabled:u||!h,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&&a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const TY=[{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"}],RY=["low","medium","high"];function AY({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 a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function vR({name:e,regex:t,severity:n,enabled:r,builtin:i,onToggle:o,onRemove:l,t:u}){return a.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:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[a.jsx("input",{type:"checkbox",checked:r,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),a.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"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),i&&a.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"})]}),a.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})]}),a.jsx(AY,{severity:n}),!i&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function IY({onAdd:e,existingNames:t,t:n}){const[r,i]=y.useState(""),[o,l]=y.useState(""),[u,d]=y.useState("medium"),[f,p]=y.useState(""),h=x=>{if(t.includes(x.name)){p(n("dlp.pattern_exists",{name:x.name}));return}i(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),i(""),l(""),d("medium")};return a.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("dlp.add_pattern")}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:TY.map(x=>a.jsx("button",{onClick:()=>h(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))}),a.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.pattern_name")}),a.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:r,onChange:x=>i(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"})]}),a.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.regex_pattern")}),a.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"})]}),a.jsxs("div",{className:"w-24",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.severity")}),a.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:RY.map(x=>a.jsx("option",{value:x,children:x},x))})]}),a.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&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function MY({onClose:e}){const{t}=Zt(),n=Du(),[r,i]=y.useState(null),[o,l]=y.useState([]),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(!0),[w,S]=y.useState("ask"),[N,j]=y.useState([]),[R,T]=y.useState({}),[I,M]=y.useState("epm/privacy"),L=y.useRef(null);y.useEffect(()=>{let Z=!1;async function z(){var q;try{const ae=await qO();Z||(l(ae.builtins||[]),_(ae.enabled!==!1),S(ae.defaultAction||"ask"),j(ae.disabledBuiltins||[]),T(ae.patterns||{}),M(((q=ae.privateMode)==null?void 0:q.rerouteModel)||"epm/privacy"),i(ae),d(!1))}catch(ae){Z||(m(ae.message),d(!1))}}return z(),()=>{Z=!0}},[]),y.useEffect(()=>{async function Z(z){z.key==="Escape"&&(x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",Z),L.current&&L.current.focus(),()=>document.removeEventListener("keydown",Z)},[e,x,n,t]);const A=y.useCallback(Z=>{j(z=>z.includes(Z)?z.filter(q=>q!==Z):[...z,Z]),v(!0)},[]),D=y.useCallback((Z,z,q)=>{T(ae=>({...ae,[Z]:{regex:z,severity:q}})),v(!0)},[]),$=y.useCallback(Z=>{T(z=>{const q={...z};return delete q[Z],q}),v(!0)},[]),ee=y.useCallback(async()=>{m(null),p(!0);try{const z=await HO({enabled:k,defaultAction:w,disabledBuiltins:N,privateMode:{rerouteModel:I},patterns:R});v(!1),i(z.policy),e()}catch(Z){m(Z.message)}finally{p(!1)}},[k,w,N,R,I,e]),U=y.useCallback(async()=>{x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[x,e,n,t]),G=[...o.map(Z=>Z.name),...Object.keys(R)];return a.jsx("div",{ref:L,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:U,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:a.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:Z=>Z.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),a.jsx("button",{onClick:U,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),h&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),!u&&a.jsxs(a.Fragment,{children:[a.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:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:k,onChange:Z=>{_(Z.target.checked),v(!0)},className:"sr-only peer"}),a.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"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),a.jsxs("select",{value:w,onChange:Z=>{S(Z.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:[a.jsx("option",{value:"ask",children:"Ask (show modal)"}),a.jsx("option",{value:"reroute",children:"Always reroute to private"}),a.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),a.jsx("input",{type:"text",value:I,onChange:Z=>{M(Z.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"})]}),a.jsxs("div",{className:"mb-4 mt-6",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),a.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(Z=>a.jsx(vR,{name:Z.name,regex:Z.regex,severity:Z.severity,enabled:!N.includes(Z.name),builtin:!0,onToggle:A,onRemove:()=>{},t},Z.name))})]}),a.jsxs("div",{className:"mb-4 mt-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.user_patterns_desc")}),Object.keys(R).length===0?a.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")}):a.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(R).map(([Z,z])=>a.jsx(vR,{name:Z,regex:z.regex,severity:z.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:$,t},Z))})]}),a.jsx(IY,{onAdd:D,existingNames:G,t})]})]}),!u&&a.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[a.jsx("button",{onClick:U,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")}),a.jsx("button",{onClick:ee,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 LY(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 i=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:i,type:o,target:e.target||"*"})}function OY(e,t){var n=e.sessionTitle||e.sessionID;return n?t("permission.requester",{session:n}):null}function DY({requests:e}){const{t}=Zt(),n=new Set(e.map(r=>r.sessionID||r.sessionTitle||"")).size;return n<2?null:a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:t("permission.summary_multi",{count:e.length,sessions:n})})}function PY({request:e,onDismiss:t}){const{t:n}=Zt(),[r,i]=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(k=>{k.includes("not found")||k.includes("expired")?l("Request expired"):k.includes("already")?l("Request already processed"):l(k),i("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),p=y.useCallback(async()=>{i("allow"),l(null);try{const k=await ZL(e.id);if(!u.current)return;if(k&&k.success===!1){const _=k.error||k.message||"Failed to confirm";f(_);return}t(e.id)}catch(k){if(!u.current)return;const _=k.message||"Failed to confirm";f(_)}},[e.id,t,f]),h=y.useCallback(async()=>{i("deny"),l(null);try{const k=await JL(e.id);if(!u.current)return;if(k&&k.success===!1){const _=k.error||k.message||"Failed to deny";f(_);return}t(e.id)}catch(k){if(!u.current)return;const _=k.message||"Failed to deny";f(_)}},[e.id,t,f]),m=e.action==="clear",x=e.action==="revoke",v=OY(e,n);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.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:a.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:a.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"})})}),a.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:n("permission.title")})]}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:LY(e,n)}),v&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:v}),a.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&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:h,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")}),a.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 FY({requests:e,onDismiss:t}){return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(DY,{requests:e}),e.map(n=>a.jsx(PY,{request:n,onDismiss:t},n.id))]})}var BY="https://account.openpave.ai/dashboard";function zY({open:e,onClose:t,upgradeUrl:n}){var{t:r}=Zt(),i=y.useRef(null),o=y.useRef(null),l=y.useRef(t),u=BY;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(h){h.key==="Escape"&&(typeof h.preventDefault=="function"&&h.preventDefault(),typeof h.stopImmediatePropagation=="function"?h.stopImmediatePropagation():typeof h.stopPropagation=="function"&&h.stopPropagation(),l.current())}return document.addEventListener("keydown",p,!0),function(){document.removeEventListener("keydown",p,!0)}},[e]),y.useEffect(function(){if(!e||!i.current)return;function p(h){if(h.key==="Tab"){var m=i.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(m.length!==0){var x=m[0],v=m[m.length-1];h.shiftKey?document.activeElement===x&&(h.preventDefault(),v.focus()):document.activeElement===v&&(h.preventDefault(),x.focus())}}}return document.addEventListener("keydown",p),function(){document.removeEventListener("keydown",p)}},[e]),e?a.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:a.jsxs("div",{ref:i,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:[a.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("credits.limit_reached")})]}),a.jsx("div",{className:"px-5 py-4",children:a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("credits.limit_message")})}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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")}),a.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"),a.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:[a.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"}),a.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 UY(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 i=Math.floor(r/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function bv(e,t){if(!e||!t)return!e;const n=String(e).toLowerCase(),r=String(t).toLowerCase();let i=0;for(let o=0;o<r.length&&i<n.length;o+=1)r[o]===n[i]&&(i+=1);return i===n.length}function qY(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function HY({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:i,sessions:o,busySessions:l={}}){const{t:u}=Zt(),[d,f]=y.useState(""),[p,h]=y.useState(0),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=y.useRef(null),w=y.useRef(null),S=y.useRef(null),N=d?d.trim():"";y.useEffect(()=>{if(e){f(""),h(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(S.current&&(clearTimeout(S.current),S.current=null),!e){x(null),k(!1);return}if(A.length<2){x(null),k(!1);return}return x(null),k(!0),S.current=setTimeout(()=>{Pl({q:A,limit:20}).then(D=>{if(L)return;const $=Array.isArray(D)?D:D.sessions||[];x($),k(!1)}).catch(()=>{L||k(!1)})},300),()=>{L=!0,S.current&&(clearTimeout(S.current),S.current=null)}},[d,e]);const j=y.useCallback(L=>{if(!i)return L;const A=L.findIndex(ee=>ee.id===i);if(A<=0)return L;const D=L.slice(),[$]=D.splice(A,1);return D.unshift($),D},[i]),R=y.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),T=y.useMemo(()=>{const L=o||[],A=!N||bv(N,"new chat")||bv(N,u("spotlight.new_chat")),D=U=>A&&r?i&&U.length>0&&U[0].id===i?[U[0],R,...U.slice(1)]:[R,...U]:U;if(!N)return D(j(L.slice(0,10)));const $=L.filter(U=>bv(N,U.title||""));let ee;if(m){const U=new Set($.map(Z=>Z.id)),G=m.filter(Z=>!U.has(Z.id));ee=$.concat(G).slice(0,20)}else ee=$.slice(0,20);return D(j(ee))},[N,o,m,j,R,r,u,i]);y.useEffect(()=>{h(0)},[N]),y.useEffect(()=>{h(L=>T.length===0?0:L>=T.length?T.length-1:L)},[T.length]),y.useEffect(()=>{if(!w.current)return;const L=w.current.querySelectorAll('[role="option"]');L[p]&&L[p].scrollIntoView({block:"nearest"})},[p,T.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(),h(A=>T.length===0?0:(A+1)%T.length)):L.key==="ArrowUp"?(L.preventDefault(),h(A=>T.length===0?0:(A-1+T.length)%T.length)):L.key==="Enter"?(L.preventDefault(),T[p]&&I(T[p])):L.key==="Escape"&&(L.preventDefault(),t())},[T,p,I,t]);return e?a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:a.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:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.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":T[p]?"spotlight-item-"+p:void 0,autoComplete:"off",spellCheck:"false"}),a.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"})]}),a.jsxs("div",{id:"spotlight-results",ref:w,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!N&&T.length>0&&a.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")}),T.map((L,A)=>{var D;return L.isAction&&L.actionType==="new-chat"?a.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:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm font-medium truncate",children:L.title})})]},L.id):a.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:[a.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:a.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"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm font-medium truncate",children:L.title||u("spotlight.untitled")})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l[L.id]&&a.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===i&&a.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")}),a.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:qY(L)}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:UY((D=L.time)==null?void 0:D.updated)})]})]},L.id)}),N&&T.length===0&&!v&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&T.length===0&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),a.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:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.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:"↑"}),a.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")]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.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")]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.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 $Y(e){return typeof e=="string"&&e?e:e&&typeof e=="object"&&e.providerID&&e.modelID?e.providerID+"/"+e.modelID:""}function WY(e){var{t}=Zt(),n=e.session,r=e.directory,[i,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}),AL(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?$Y(n.model):"",h=n?n.idleInjection:null,m=h&&h.enabled?h:null,x=n&&n.scheduledInjections?n.scheduledInjections.length:0;return a.jsxs("div",{className:"mt-4 pt-3 border-t border-gray-700",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-gray-400 mb-2",children:t("chat.session_info_title")}),n&&a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_soul")}),n.soul?a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.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:i==="soul"?t("chat.session_info_copied"):n.soul,children:n.soul}),a.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")})]}):a.jsx("div",{className:"text-sm text-gray-500",children:t("chat.session_info_soul_default")}),l&&l.loading&&a.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t("chat.session_info_soul_loading")}),l&&l.error&&a.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&&a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"text-xs text-gray-500 font-mono mb-0.5 truncate",title:l.path,children:l.path+" · "+l.size+" B"}),a.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&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_model")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:p}),n.modelUrl&&a.jsx("div",{className:"text-xs text-gray-500 font-mono mt-0.5 truncate",title:n.modelUrl,children:n.modelUrl})]}),n&&n.reasoning_effort&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_reasoning")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:n.reasoning_effort})]}),m&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_idle_injection")}),a.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&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_scheduled")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:x})]}),r&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_directory")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono truncate",title:r,children:r})]})]})}const N1="pave_recent_directories",VY=10;function kR(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 i=n.split("/").filter(Boolean);return i.length>4?".../"+i.slice(-2).join("/"):n}function C1(){try{const e=localStorage.getItem(N1);return e?JSON.parse(e):[]}catch{return[]}}function GY(e){try{let t=C1();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,VY),localStorage.setItem(N1,JSON.stringify(t)),t}catch{return[e]}}function KY(e){try{let t=C1();return t=t.filter(n=>n!==e),localStorage.setItem(N1,JSON.stringify(t)),t}catch{return[]}}function XI({className:e}){return a.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:a.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 YY({isOpen:e,onClose:t,sessionId:n,session:r,currentDirectory:i,homeDir:o,onDirectoryChange:l}){var{t:u}=Zt(),d=y.useRef(null),f=y.useRef(null),[p,h]=y.useState(i||""),[m,x]=y.useState("idle"),[v,k]=y.useState(null),[_,w]=y.useState([]),[S,N]=y.useState(!1),[j,R]=y.useState(!1),[T,I]=y.useState(null),M=y.useRef(null),L=y.useRef(0);y.useEffect(function(){e&&(w(C1()),h(i||""),x("idle"),k(null),I(null))},[e,i]),y.useEffect(function(){e&&d.current&&setTimeout(function(){d.current.focus(),d.current.select()},50)},[e]);var A=y.useCallback(function(q){if(!q||q.trim()===""){x("idle"),k(null);return}M.current&&clearTimeout(M.current),x("checking"),L.current+=1;var ae=L.current;M.current=setTimeout(async function(){try{const P=await ww(q.trim());if(ae!==L.current)return;k(P),P.exists&&P.isDirectory?x("valid"):P.exists?(x("error"),k({...P,error:u("chat.working_directory_invalid")})):x("not_found")}catch(P){if(ae!==L.current)return;x("error"),k({error:P.message})}},300)},[u]),D=y.useCallback(function(q){var ae=q.target.value;h(ae),I(null),A(ae)},[A]),$=y.useCallback(function(q){h(q),I(null),A(q)},[A]),ee=y.useCallback(function(q,ae){q.stopPropagation(),w(KY(ae))},[]),U=y.useCallback(async function(){if(p.trim()){N(!0),I(null);try{const q=await OO(p.trim());if(q.success)try{const ae=await ww(q.path);x("valid"),k(ae)}catch{x("valid"),k({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:q.path})}}catch(q){I(u("chat.working_directory_create_failed",{error:q.message}))}finally{N(!1)}}},[p,u]),G=y.useCallback(async function(){if(!(!p.trim()||m!=="valid")){R(!0),I(null);try{const q=(v==null?void 0:v.path)||p.trim();await Li(n,{directory:q}),w(GY(q)),l&&l(q),t()}catch(q){I(q.message)}finally{R(!1)}}},[p,m,v,n,l,t]);y.useEffect(function(){if(!e)return;function q(ae){ae.key==="Escape"&&(ae.preventDefault(),ae.stopPropagation(),t())}return document.addEventListener("keydown",q,!0),function(){document.removeEventListener("keydown",q,!0)}},[e,t]),y.useEffect(function(){if(!e)return;function q(ae){ae.key==="Enter"&&m==="valid"&&!j&&(ae.preventDefault(),G())}return document.addEventListener("keydown",q),function(){document.removeEventListener("keydown",q)}},[e,m,j,G]),y.useEffect(function(){return function(){M.current&&clearTimeout(M.current)}},[]);var Z=y.useMemo(function(){return kR(i,o)},[i,o]);if(!e)return null;var z=null;return m==="checking"?z=a.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[a.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?z=a.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"?z=a.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",u("chat.working_directory_not_found")]}):m==="error"&&(v!=null&&v.error)&&(z=a.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",v.error]})),a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(q){q.target===q.currentTarget&&t()},children:a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(XI,{className:"w-5 h-5 text-gray-400"}),a.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:u("chat.working_directory")})]}),a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":u("common.close"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_current")}),a.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:i,children:Z||i||u("chat.working_directory_not_set")})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_new_path")}),a.jsx("input",{ref:d,id:"directory-input",type:"text",value:p,onChange:D,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"}),z]}),T&&a.jsx("p",{className:"text-sm text-red-500",children:T}),_.length>0&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:u("chat.working_directory_recent")}),a.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:_.map(function(q){return a.jsxs("div",{onClick:function(){$(q)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[a.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:q,children:kR(q,o)}),a.jsx("button",{onClick:function(ae){ee(ae,q)},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:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},q)})})]}),a.jsx(WY,{session:r,directory:Z||i||""})]}),a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[a.jsx("div",{children:m==="not_found"&&a.jsx("button",{onClick:U,disabled:S,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:S?"...":u("chat.working_directory_create")})}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.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")}),a.jsx("button",{onClick:G,disabled:m!=="valid"||j,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:j?"...":u("chat.working_directory_change")})]})]})]})})}var pr={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 QY(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function kf(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function _f(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function Al(e){var t=e.children;return a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function XY(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,i=Zt().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],h=y.useState(!1),m=h[0],x=h[1],v=y.useState(null),k=v[0],_=v[1],w=y.useState(null),S=w[0],N=w[1],j=y.useState(pr.enabled),R=j[0],T=j[1],I=y.useState(pr.message),M=I[0],L=I[1],A=y.useState(String(pr.intervalMs)),D=A[0],$=A[1],ee=y.useState(String(pr.maxInjections)),U=ee[0],G=ee[1],Z=y.useState(pr.timeout.enabled),z=Z[0],q=Z[1],ae=y.useState(String(pr.timeout.thresholdMs)),P=ae[0],Q=ae[1],J=y.useState(String(pr.timeout.cooldownMs)),F=J[0],K=J[1],W=y.useState(pr.mode),H=W[0],se=W[1],ie=y.useState(String(pr.waitMs)),ge=ie[0],we=ie[1],Ke=y.useRef(null),xt=y.useState([]),et=xt[0],vt=xt[1],lt=y.useState(!1),je=lt[0],Oe=lt[1],ft=y.useState(!1),Ct=ft[0],rn=ft[1],tn=y.useState("9"),un=tn[0],mt=tn[1],$t=y.useState("0"),nt=$t[0],qe=$t[1],ue=y.useState("AM"),me=ue[0],Ue=ue[1],He=y.useState("weekdays"),be=He[0],Ye=He[1],_t=y.useState([1,2,3,4,5]),jt=_t[0],Wt=_t[1],hn=y.useState(""),xe=hn[0],ke=hn[1],Ae="";try{Ae=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}y.useEffect(function(){return function(){Ke.current&&clearTimeout(Ke.current)}},[]);var Fe=y.useCallback(function(){r&&(p(!0),_(null),a4(r).then(function(Le){var kt=Le&&Le.config?Le.config:pr;u(kt),T(kt.enabled||!1),L(kt.message||pr.message),$(kf(kt.intervalMs!=null?kt.intervalMs:pr.intervalMs)),G(QY(kt.maxInjections!=null?kt.maxInjections:pr.maxInjections)),q(kt.timeout?kt.timeout.enabled:pr.timeout.enabled),Q(kf(kt.timeout&&kt.timeout.thresholdMs!=null?kt.timeout.thresholdMs:pr.timeout.thresholdMs)),K(kf(kt.timeout&&kt.timeout.cooldownMs!=null?kt.timeout.cooldownMs:pr.timeout.cooldownMs)),se(kt.mode||pr.mode),we(kf(kt.waitMs!=null?kt.waitMs:pr.waitMs))}).catch(function(Le){_(Le.message||"Failed to load config")}).finally(function(){p(!1)}))},[r]);y.useEffect(function(){t&&Fe()},[t,Fe]);var yt=y.useCallback(function(){r&&$L(r).then(function(Le){vt(Le&&Le.schedules?Le.schedules:[])}).catch(function(){vt([])})},[r]);y.useEffect(function(){t&&yt()},[t,yt]),y.useEffect(function(){if(!t)return;function Le(kt){kt.key==="Escape"&&n()}return document.addEventListener("keydown",Le),function(){document.removeEventListener("keydown",Le)}},[t,n]);function pt(){if(r){x(!0),_(null),N(null);var Le={enabled:R,message:M.trim()||pr.message,intervalMs:_f(D)||pr.intervalMs,maxInjections:parseInt(U,10)||0,mode:H||pr.mode,waitMs:_f(ge),timeout:{enabled:z,thresholdMs:_f(P)||pr.timeout.thresholdMs,cooldownMs:_f(F)||pr.timeout.cooldownMs}};qL(r,Le).then(function(){u(Le),N(i("chat.idle_injection_saved")),Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(function(){N(null)},3e3)}).catch(function(kt){_(kt.message||"Failed to save")}).finally(function(){x(!1)})}}function Ht(){r&&(x(!0),_(null),N(null),HL(r).then(function(){T(!1),u(null)}).catch(function(Le){_(Le.message||"Failed to disable")}).finally(function(){x(!1)}))}function te(Le,kt){var vn=parseInt(Le,10);return kt==="PM"&&vn!==12&&(vn+=12),kt==="AM"&&vn===12&&(vn=0),vn}function Ee(Le){return Le===0?{h:12,ap:"AM"}:Le<12?{h:Le,ap:"AM"}:Le===12?{h:12,ap:"PM"}:{h:Le-12,ap:"PM"}}function Je(Le,kt){return Le==="every_day"?[0,1,2,3,4,5,6]:Le==="weekdays"?[1,2,3,4,5]:Le==="weekends"?[0,6]:kt.slice().sort()}function Dt(Le){var kt=Ee(Le.hour),vn=String(Le.minute).padStart(2,"0");return kt.h+":"+vn+" "+kt.ap}function Pe(Le){var kt=Le.daysOfWeek||[],vn="";if(kt.length===7)vn=i("scheduled_injection.repeat_every_day");else if(kt.length===5&&kt.indexOf(1)!==-1&&kt.indexOf(5)!==-1)vn=i("scheduled_injection.repeat_weekdays");else if(kt.length===2&&kt.indexOf(0)!==-1&&kt.indexOf(6)!==-1)vn=i("scheduled_injection.repeat_weekends");else{for(var ar=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],Vr=[],Rr=0;Rr<7;Rr++)kt.indexOf(Rr)!==-1&&Vr.push(i("scheduled_injection."+ar[Rr]));vn=Vr.join(", ")}return Le.timezone&&(vn+=" ("+Le.timezone+")"),vn}function ze(){if(r){rn(!0),_(null);var Le={hour:te(un,me),minute:parseInt(nt,10),daysOfWeek:Je(be,jt),timezone:Ae||null,message:xe.trim(),enabled:!0};WL(r,Le).then(function(){Oe(!1),ke(""),yt()}).catch(function(kt){_(kt.message||i("scheduled_injection.error_generic"))}).finally(function(){rn(!1)})}}function We(Le,kt){r&&VL(r,Le,{enabled:!kt}).then(function(){yt()}).catch(function(vn){_(vn.message||"Failed to toggle schedule")})}function Qe(Le){r&&GL(r,Le).then(function(){yt()}).catch(function(kt){_(kt.message||"Failed to delete schedule")})}function st(Le){var kt=jt.indexOf(Le);Wt(kt===-1?jt.concat([Le]):jt.filter(function(vn){return vn!==Le}))}if(!t)return null;var Ne="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",Ve="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",oe="space-y-3",bn=function(Le){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(Le?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},tr=function(Le){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Le?"translate-x-6":"translate-x-1")};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),a.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":i("chat.idle_injection_title"),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("chat.idle_injection_title")}),a.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":i("common.close"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):a.jsxs(a.Fragment,{children:[k&&a.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}),S&&a.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:S}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_toggle")}),a.jsx("button",{type:"button",onClick:function(){T(!R)},className:bn(R),"aria-pressed":R,"aria-label":i("chat.idle_injection_toggle"),children:a.jsx("span",{className:tr(R)})})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-message",children:i("chat.idle_injection_message")}),a.jsx("textarea",{id:"ii-message",value:M,onChange:function(Le){L(Le.target.value)},className:Ve+" resize-none",rows:3,placeholder:i("chat.idle_injection_message_placeholder"),disabled:!R})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-interval",children:i("chat.idle_injection_interval")}),a.jsx("input",{id:"ii-interval",type:"number",value:D,onChange:function(Le){$(Le.target.value)},className:Ve,min:.5,step:.5,disabled:!R}),a.jsx(Al,{children:i("chat.idle_injection_interval_desc")})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-max",children:i("chat.idle_injection_max")}),a.jsx("input",{id:"ii-max",type:"number",value:U,onChange:function(Le){G(Le.target.value)},className:Ve,min:0,disabled:!R}),a.jsx(Al,{children:i("chat.idle_injection_max_desc")})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-mode",children:i("chat.idle_injection_mode")}),a.jsxs("select",{id:"ii-mode",value:H,onChange:function(Le){se(Le.target.value)},className:Ve,disabled:!R,children:[a.jsx("option",{value:"urgent",children:i("chat.idle_injection_mode_urgent")}),a.jsx("option",{value:"normal",children:i("chat.idle_injection_mode_normal")}),a.jsx("option",{value:"idle",children:i("chat.idle_injection_mode_idle")})]}),a.jsx(Al,{children:i("chat.idle_injection_mode_desc")})]}),H==="idle"&&a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-wait",children:i("chat.idle_injection_wait_ms")}),a.jsx("input",{id:"ii-wait",type:"number",value:ge,onChange:function(Le){we(Le.target.value)},className:Ve,min:0,step:.5,disabled:!R}),a.jsx(Al,{children:i("chat.idle_injection_wait_ms_desc")})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_timeout_toggle")}),a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("chat.idle_injection_timeout_toggle_desc")})]}),a.jsx("button",{type:"button",onClick:function(){q(!z)},className:bn(z),"aria-pressed":z,"aria-label":i("chat.idle_injection_timeout_toggle"),disabled:!R,children:a.jsx("span",{className:tr(z)})})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-threshold",children:i("chat.idle_injection_timeout_threshold")}),a.jsx("input",{id:"ii-threshold",type:"number",value:P,onChange:function(Le){Q(Le.target.value)},className:Ve,min:1,step:.5,disabled:!R||!z}),a.jsx(Al,{children:i("chat.idle_injection_timeout_threshold_desc")})]}),a.jsxs("div",{className:oe,children:[a.jsx("label",{className:Ne,htmlFor:"ii-cooldown",children:i("chat.idle_injection_timeout_cooldown")}),a.jsx("input",{id:"ii-cooldown",type:"number",value:F,onChange:function(Le){K(Le.target.value)},className:Ve,min:.5,step:.5,disabled:!R||!z}),a.jsx(Al,{children:i("chat.idle_injection_timeout_cooldown_desc")})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),a.jsxs("div",{className:oe,children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("scheduled_injection.title")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("scheduled_injection.subtitle")})]}),et.length===0&&!je&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:i("scheduled_injection.empty")}),et.map(function(Le){return a.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(Le.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:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:Dt(Le)}),a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Pe(Le)})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:function(){We(Le.id,Le.enabled)},className:bn(Le.enabled),"aria-pressed":Le.enabled,"aria-label":i("scheduled_injection.enabled"),children:a.jsx("span",{className:tr(Le.enabled)})}),a.jsx("button",{type:"button",onClick:function(){Qe(Le.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":i("scheduled_injection.delete"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]})]}),Le.message&&a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Le.message,'"']})]},Le.id)}),je?a.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:[a.jsxs("div",{children:[a.jsx("label",{className:Ne,children:i("scheduled_injection.time")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("select",{value:un,onChange:function(Le){mt(Le.target.value)},className:Ve+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Le){return a.jsx("option",{value:String(Le),children:Le},Le)})}),a.jsx("span",{className:"text-gray-500",children:":"}),a.jsxs("select",{value:nt,onChange:function(Le){qe(Le.target.value)},className:Ve+" w-20",children:[a.jsx("option",{value:"0",children:"00"}),a.jsx("option",{value:"15",children:"15"}),a.jsx("option",{value:"30",children:"30"}),a.jsx("option",{value:"45",children:"45"})]}),a.jsxs("select",{value:me,onChange:function(Le){Ue(Le.target.value)},className:Ve+" w-20",children:[a.jsx("option",{value:"AM",children:"AM"}),a.jsx("option",{value:"PM",children:"PM"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Ne,children:i("scheduled_injection.repeat")}),a.jsxs("select",{value:be,onChange:function(Le){Ye(Le.target.value)},className:Ve,children:[a.jsx("option",{value:"every_day",children:i("scheduled_injection.repeat_every_day")}),a.jsx("option",{value:"weekdays",children:i("scheduled_injection.repeat_weekdays")}),a.jsx("option",{value:"weekends",children:i("scheduled_injection.repeat_weekends")}),a.jsx("option",{value:"custom",children:i("scheduled_injection.repeat_custom")})]})]}),be==="custom"&&a.jsx("div",{children:a.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(Le){var kt=jt.indexOf(Le.d)!==-1;return a.jsx("button",{type:"button",onClick:function(){st(Le.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(kt?"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:i("scheduled_injection."+Le.k)},Le.d)})})}),Ae&&a.jsxs("div",{children:[a.jsx("label",{className:Ne,children:i("scheduled_injection.timezone")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ae})]}),a.jsxs("div",{children:[a.jsx("label",{className:Ne,children:i("scheduled_injection.message")}),a.jsx("textarea",{value:xe,onChange:function(Le){ke(Le.target.value)},className:Ve+" resize-none",rows:2,placeholder:i("scheduled_injection.message_placeholder")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:ze,disabled:Ct||be==="custom"&&jt.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:i(Ct?"scheduled_injection.saving":"scheduled_injection.save")}),a.jsx("button",{type:"button",onClick:function(){Oe(!1)},disabled:Ct,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:i("common.close")})]})]}):a.jsxs("button",{type:"button",onClick:function(){Oe(!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:["+ ",i("scheduled_injection.add")]})]})]})}),!f&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("button",{onClick:pt,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:i(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),a.jsx("button",{onClick:Ht,disabled:m||!R,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:i(m?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function ZY({items:e,sessionId:t,isReadOnly:n,onReorder:r,onCancelItem:i,onEditItem:o,t:l}){var[u,d]=y.useState(null),[f,p]=y.useState(null),h=y.useRef(0),m=y.useCallback(function(S,N){if(e[N]&&e[N].status==="dispatching"){S.preventDefault();return}d(N),S.dataTransfer.effectAllowed="move";try{S.dataTransfer.setData("text/plain",String(N))}catch{}},[e]),x=y.useCallback(function(S,N){S.preventDefault(),h.current++,e[N]&&e[N].status!=="dispatching"&&p(N)},[e]),v=y.useCallback(function(S,N){S.preventDefault(),S.dataTransfer.dropEffect="move"},[]),k=y.useCallback(function(){h.current--,h.current<=0&&(h.current=0,p(null))},[]),_=y.useCallback(function(S,N){if(S.preventDefault(),h.current=0,p(null),u===null||u===N){d(null);return}var j=e.slice(),R=j.splice(u,1)[0];j.splice(N,0,R),d(null);var T=j.filter(function(I){return I.status!=="dispatching"}).map(function(I){return I.id});r(T)},[u,e,r]),w=y.useCallback(function(){d(null),p(null),h.current=0},[]);return!e||e.length===0?null:a.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:[a.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[l("chat.queued")," (",e.length,")"]}),e.map(function(S,N){var j=S.status==="dispatching",R=u===N,T=f===N&&u!==N,I=!j&&!n;return a.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?w:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(j?"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 ")+(R?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(T?"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&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){o(S)},onKeyDown:function(M){(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),o(S))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[a.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:S.source||"queued"}),S.priority==="urgent"&&a.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"}),a.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:S.displayContent||S.text||""}),!j&&!n&&a.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:a.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"})})]}),!j&&!n&&a.jsx("button",{type:"button",onClick:function(M){M.stopPropagation(),i(S.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:"×"})]},S.id)})]})}const _R="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 JY({rect:e,onQuote:t,onCopy:n,onDismiss:r,label:i,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 mk.createPortal(a.jsxs("div",{style:d,className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button","data-testid":"quote-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:t,"aria-label":i,title:i,className:_R,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})}),i]}),a.jsxs("button",{type:"button","data-testid":"copy-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:n,"aria-label":o,title:o,className:_R,children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.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 eQ(e){if(!e||typeof e!="string")return[];const t=[],n=e.split(`
|
|
123
|
+
`);for(let r=0;r<n.length;r++){const i=n[r].trim();if(i)try{t.push(JSON.parse(i))}catch{}}return t.sort((r,i)=>(r.seq||0)-(i.seq||0)),t}function Ou(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function Vl(e){if(!Ou(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function tQ(e){const t=[],n=new Map;let r=null,i=null;for(const u of e)switch(u.type){case"context":r=u;break;case"store_snapshot":i=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),i&&(i.reqSeq==null||i.reqSeq===u.seq)&&(d.store=i,i=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=nQ(u)}return t}function nQ(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 rQ(e){const t=[];let n=null,r=null;for(const i of e)(n===null||r==="stop"||r==="error")&&(n={index:t.length,requests:[]},t.push(n)),n.requests.push(i),r=i.finishReason;return t}function iQ(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 aQ(e){return e.filter(t=>t.type==="compaction")}function sQ(e){return e.filter(t=>t.type==="message_drop")}function oQ(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),i=n(t),o=f=>{const p={};for(const h of f){const m=h&&h.role||"?";p[m]=(p[m]||0)+1}return p},l=o(r),u=o(i),d=[];for(const f of new Set([...Object.keys(l),...Object.keys(u)])){const p=l[f]||0,h=u[f]||0;p!==h&&d.push({role:f,before:p,after:h,delta:p-h})}return d.sort((f,p)=>p.delta-f.delta),{prevLen:r.length,currLen:i.length,roles:d}}function lQ(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=[],i=n&&n.choices&&n.choices[0]&&n.choices[0].delta;if(i){const o=i.reasoning_content??i.reasoning??i.thinking;if(o!=null&&o!==""&&r.push({type:"reasoning",piece:o}),i.content!=null&&i.content!==""&&r.push({type:"text",piece:i.content}),i.tool_calls&&i.tool_calls.length){const u=(i.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 wR(e){try{return JSON.stringify(e)}catch{return String(e)}}function SR(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 cQ(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[],i=r.length&&r[0]&&r[0].role==="system"?r.slice(1):r.slice(),o=Math.max(n.length,i.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const p=f<n.length?n[f]:void 0,h=f<i.length?i[f]:void 0,m=p===void 0?void 0:wR(p),x=h===void 0?void 0:wR(h),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 w="unchanged";if(p===void 0)w="added";else if(h===void 0)w="dropped";else if(_){const S=p.role||h.role;k<v?S==="tool"?w="tool output stubbed":SR(p)&&!SR(h)?w="reasoning stripped":w="text capped":w="changed"}_&&u<0&&(u=f),l.push({i:f,role:(p||h||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:w})}return{rows:l,firstChanged:u,maxBytes:d}}function uQ(e){const t=typeof e=="string"?eQ(e):Array.isArray(e)?e:[],n=tQ(t),r=rQ(n),i=iQ(n),o=aQ(t),l=sQ(t);return{events:t,requests:n,turns:r,timeline:i,compactions:o,messageDrops:l}}function Mf(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const n=Vl(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 dQ(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function ZI(e,t){const n=[];n.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&n.push(`url: ${e.url}`);const r=dQ(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(Mf(e.headers,t)),n.push("REQUEST BODY (exact bytes sent):"),n.push(Mf(e.body,t)),e.response){const i=e.response.assembled;n.push("RESPONSE (assembled):"),i&&typeof i=="object"&&i.$ref?n.push(Mf(i,t)):i&&(i.reasoning&&n.push(`reasoning: ${i.reasoning}`),n.push(`text: ${i.text||""}`),i.tool_calls&&i.tool_calls.length&&n.push(`tool_calls: ${JSON.stringify(i.tool_calls)}`))}if(e.context){const i=e.context;n.push(`CONTEXT: limit=${i.limit} usable=${i.usable} margin=${i.margin} threshold=${i.threshold} tokReal=${i.tokReal} needsCompaction=${i.needsCompaction} source=${i.source??""} windowSource=${i.windowSource??i.epmWindowSignal??""}`)}if(e.compaction){const i=e.compaction,o=[`COMPACTION [${i.trigger}]`];i.deletedMessages!=null&&o.push(`deleted=${i.deletedMessages}`),i.summaryTokens!=null&&o.push(`summaryTok=${i.summaryTokens}`),i.before!=null&&o.push(`before=${i.before}`),i.after!=null&&o.push(`after=${i.after}`),typeof i.handoffFresh=="boolean"&&o.push(`handoffFresh=${i.handoffFresh}`),n.push(o.join(" "))}if(e.messageDrop){const i=e.messageDrop;n.push(`⚠ MESSAGE DROP wire ${i.wireBefore}→${i.wireAfter} (vs req #${i.prevSeq}, no compaction`+(i.storeMessages!=null?`, store intact=${i.storeMessages}`:"")+")")}return n.join(`
|
|
124
|
+
`)}function JI(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],n=e.ts;for(let r=0;r<e.chunks.length;r++){const i=e.chunks[r],o=r===0?n!=null?i.ts-n:0:i.ts-e.chunks[r-1].ts;t.push(`[+${o}ms]${i.kind?" ("+i.kind+")":""} ${i.raw}`)}return t.join(`
|
|
125
|
+
`)}function fQ(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(Mf(n,t)):n&&(n.reasoning&&r.push(`reasoning:
|
|
126
|
+
${n.reasoning}`),r.push(`text:
|
|
127
|
+
${n.text||""}`),n.tool_calls&&n.tool_calls.length&&r.push(`tool_calls:
|
|
128
|
+
${JSON.stringify(n.tool_calls,null,2)}`)),e.response.usage&&r.push(`usage: ${JSON.stringify(e.response.usage)}`),r.join(`
|
|
129
|
+
`)}function ER(e,t,n){const{requests:r,timeline:i,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(ZI(p,n)),p.chunkCount&&(u.push(`CHUNKS (${p.chunkCount}):`),u.push(JI(p))),u.push("");u.push("TIMELINE:"),u.push("seq store sent_est sent_actual threshold compaction");for(const p of i)u.push(`${p.seq} ${p.storeTokens??""} ${p.sentEst??""} ${p.sentActual??""} ${p.threshold??""} ${p.compactionMarker?"YES":""}`);return u.join(`
|
|
130
|
+
`)}function pQ(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 i=Vl(r);i!=null&&t.add(i)}return Array.from(t)}function no(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const wf=[{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."}],NR=[{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 hQ({timeline:e,selectedSeq:t,onSelectSeq:n,height:r=240}){const[i,o]=y.useState(null),[l,u]=y.useState("data"),[d,f]=y.useState(!1),p=y.useRef(null),[h,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,h-x.left-x.right),k=Math.max(1,r-x.top-x.bottom),_=Array.isArray(e)?e:[],w=y.useMemo(()=>{if(_.length===0)return 1;let I=0;for(const M of _){for(const L of wf)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 a.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 S=I=>x.left+(_.length===1?v/2:I/(_.length-1)*v),N=I=>x.top+k-Math.min(I,w)/w*k,j=I=>{const M=[];let L=!1;return _.forEach((A,D)=>{if(A[I]==null){L=!1;return}M.push(`${L?"L":"M"} ${S(D).toFixed(1)} ${N(A[I]).toFixed(1)}`),L=!0}),M.join(" ")},R=()=>{const I=[];let M=[];const L=()=>{if(M.length){const A=M.map($=>`${S($).toFixed(1)} ${N(_[$].storeTokens).toFixed(1)}`),D=M.slice().reverse().map($=>`${S($).toFixed(1)} ${N(_[$].sentActual).toFixed(1)}`);I.push("M "+A.join(" L ")+" L "+D.join(" L ")+" Z")}M=[]};return _.forEach((A,D)=>{A.storeTokens!=null&&A.sentActual!=null&&A.storeTokens>A.sentActual?M.push(D):L()}),L(),I.join(" ")},T=[0,.25,.5,.75,1].map(I=>Math.round(w*I));return a.jsxs("div",{ref:p,className:"relative",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.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"}),a.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&&a.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:[a.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: ",a.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",a.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.)"]}),wf.map(I=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 shrink-0",style:{background:I.stroke}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:I.label})," ",a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",I.desc]})]})]},I.key)),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-xs shrink-0",style:{background:"#10b981",opacity:.25}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",a.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."})]})]}),NR.map(I=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:I.stroke}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:I.label})," ",a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",I.desc]})]})]},I.key)),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:"#d946ef"}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",a.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),a.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${h} ${r}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[T.map((I,M)=>{const L=N(I);return a.jsxs("g",{children:[a.jsx("line",{x1:x.left,y1:L,x2:h-x.right,y2:L,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),a.jsx("text",{x:x.left-6,y:L,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:no(I)})]},"yt"+M)}),a.jsx("path",{d:R(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),NR.map(I=>{const M=_[_.length-1],L=M&&M[I.key];if(L==null||L>w)return null;const A=N(L);return a.jsxs("g",{children:[a.jsx("line",{x1:x.left,y1:A,x2:h-x.right,y2:A,stroke:I.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),a.jsxs("text",{x:h-x.right+4,y:A,dominantBaseline:"middle",className:"text-[9px]",fill:I.stroke,fillOpacity:.9,children:[I.label," ",no(L)]})]},"ref"+I.key)}),_.map((I,M)=>I.compactionMarker?a.jsxs("g",{children:[a.jsx("line",{x1:S(M),y1:x.top,x2:S(M),y2:x.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),a.jsx("text",{x:S(M),y:x.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+M):null),wf.map(I=>a.jsx("path",{d:j(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=S(M),A=t!=null&&I.seq===t;return a.jsxs("g",{children:[wf.map(D=>I[D.key]!=null?a.jsx("circle",{cx:L,cy:N(I[D.key]),r:A?3.5:2.5,fill:D.stroke,stroke:"white",strokeWidth:A?1:.5,className:"dark:stroke-gray-950"},D.key):null),a.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)}),a.jsxs("text",{x:L,y:r-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",I.seq]})]},"pt"+M)}),i!=null&&_[i]&&(()=>{const I=_[i],M=S(i),L=158,A=106,D=Math.min(Math.max(M-L/2,x.left),h-x.right-L),$=x.top+4;return a.jsxs("g",{className:"pointer-events-none",children:[a.jsx("rect",{x:D,y:$,width:L,height:A,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),a.jsxs("text",{x:D+8,y:$+14,className:"text-[9px] font-semibold fill-white",children:["request #",I.seq,I.compactionMarker?" · compaction":""]}),a.jsxs("text",{x:D+8,y:$+28,className:"text-[9px] fill-emerald-300",children:["store: ",no(I.storeTokens)]}),a.jsxs("text",{x:D+8,y:$+40,className:"text-[9px] fill-amber-300",children:["sent est: ",no(I.sentEst)]}),a.jsxs("text",{x:D+8,y:$+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",no(I.sentActual)]}),a.jsxs("text",{x:D+8,y:$+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",no(I.tokReal)]}),a.jsxs("text",{x:D+8,y:$+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",no(I.threshold)]}),a.jsxs("text",{x:D+8,y:$+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",no(I.trimmed)]})]})})()]})]})}const CR={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 vv(e){return e==null?"—":e.toLocaleString()}function gQ({turns:e,selectedSeq:t,onSelect:n}){const[r,i]=y.useState(()=>new Set),o=y.useCallback(u=>{i(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?a.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.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:[a.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."]}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(H4,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const h=r.has(d.turnIndex);return a.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:[a.jsx("svg",{className:"w-3 h-3 transition-transform "+(h?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,a.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 a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 shrink-0",children:["#",f.seq]}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded shrink-0 "+(CR[f.purpose]||CR.assistant),children:f.purpose}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&a.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&&a.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&&a.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})]}),a.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:[a.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",vv(f.sentActualTokens)," tokens"]}),a.jsxs("span",{title:"growing part-store size",children:["store ",vv(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&a.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",vv(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&a.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function Su({text:e,getText:t,label:n="Copy",className:r="",title:i}){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 h=>{h.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 a.jsx("button",{type:"button",onMouseDown:function(h){h.preventDefault()},onClick:p,title:i||n,"aria-label":i||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?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 mQ(e,t){return e==="all"?!0:e==="none"?!1:t<1}function jR({name:e}){return e==null?null:typeof e=="number"?a.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):a.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function xQ({value:e}){const[t,n]=y.useState(!1),r=JSON.stringify(e);return r.length<=200?a.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:r}):a.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?r:r.slice(0,200)+"…",a.jsx("button",{type:"button",onClick:i=>{i.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 yQ({value:e}){return e===null?a.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?a.jsx(xQ,{value:e}):typeof e=="number"?a.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?a.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):a.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function eM({data:e,name:t,depth:n=0,openMode:r="auto"}){const i=Array.isArray(e),o=e&&typeof e=="object"&&!i,[l,u]=y.useState(()=>mQ(r,n)),d={paddingLeft:n*12+"px"};if(!o&&!i)return a.jsxs("div",{style:d,className:"leading-5 break-all",children:[a.jsx("span",{className:"inline-block w-3"}),a.jsx(jR,{name:t}),t!=null&&a.jsx("span",{className:"text-gray-400",children:": "}),a.jsx(yQ,{value:e})]});const f=i?e.map((m,x)=>[x,m]):Object.entries(e),[p,h]=i?["[","]"]:["{","}"];return a.jsxs("div",{children:[a.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:[a.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),a.jsx(jR,{name:t}),t!=null&&a.jsx("span",{className:"text-gray-400",children:": "}),a.jsxs("span",{className:"text-gray-400",children:[p,l?"":f.length?` … ${h}`:h]}),!l&&f.length>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",i?"items":"keys"]})]}),l&&f.map(([m,x])=>a.jsx(eM,{data:x,name:m,depth:n+1,openMode:r},m)),l&&f.length>0&&a.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[a.jsx("span",{className:"inline-block w-3"}),h]})]})}function Vo({value:e,bytes:t,onResolveRef:n,label:r="JSON"}){const[i,o]=y.useState(null),[l,u]=y.useState(!1),[d,f]=y.useState(null),[p,h]=y.useState("all"),[m,x]=y.useState(0),[v,k]=y.useState(!1);y.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=i??e,w=Ou(_),S=y.useCallback(async()=>{if(n){u(!0),f(null);try{const R=Vl(_),T=await n(R);o(T)}catch(R){f(R&&R.message?R.message:"Failed to fetch")}finally{u(!1)}}},[_,n]);if(_==null)return a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(w)return a.jsxs("div",{className:"text-xs",children:[a.jsx("button",{type:"button",onClick:S,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&&a.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const N=typeof _=="string"?_:JSON.stringify(_,null,2),j=_&&typeof _=="object";return a.jsxs("div",{className:"relative group",children:[a.jsxs("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity z-10 flex items-center gap-1",children:[j&&a.jsx("button",{type:"button",onClick:()=>k(R=>!R),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"}),j&&!v&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>{h("all"),x(R=>R+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"}),a.jsx("button",{type:"button",onClick:()=>{h("none"),x(R=>R+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"})]}),a.jsx(Su,{getText:()=>N,label:"copy",title:`Copy ${r}`})]}),j&&!v?a.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:a.jsx(eM,{data:_,openMode:p},`${p}-${m}`)}):a.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 TR={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 Sf(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function bQ({rec:e,onResolveRef:t}){const[n,r]=y.useState("idle"),[i,o]=y.useState(null),[l,u]=y.useState(null),d=e.store&&e.store.messages,f=e.body,p=d===void 0,h=y.useCallback(async()=>{r("loading"),o(null);try{const N=Ou(d)?await t(Vl(d)):d,j=Ou(f)?await t(Vl(f)):f,R=Array.isArray(N)?N:N&&N.messages||[],T=j&&j.messages||[];u(cQ(R,T)),r("ready")}catch(N){o(N&&N.message?N.message:"failed to load"),r("error")}},[d,f,t]);if(p)return a.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 a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:h,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"}),i&&a.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:i})]});const{rows:m,firstChanged:x,maxBytes:v}=l,k=x>=0,_=k?m[x]:null,w=k?x:m.length,S=k?m.length-x:0;return a.jsxs("div",{className:"space-y-2",children:[a.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?a.jsxs(a.Fragment,{children:[a.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",x]})," (",_.role," · ",_.tag,"). The first ",w," message",w===1?"":"s"," are byte-identical to the store (cache-eligible); the ",S," from #",x," on differ, so they're re-prefilled."]}):a.jsxs(a.Fragment,{children:[a.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."]})}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-sky-500"})," sent (post-trim)"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-fuchsia-400/50"})," trimmed off"]}),a.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),a.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(N=>{const j=k&&N.i===x,R=Math.round((N.beforeBytes||0)/v*100),T=Math.round((N.afterBytes||0)/v*100);return a.jsxs("div",{children:[j&&a.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[a.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),a.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),a.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),a.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:[a.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 shrink-0",children:["#",N.i]}),a.jsx("span",{className:"text-[9px] px-1 rounded shrink-0 w-14 text-center "+(TR[N.role]||TR.system),children:N.role}),a.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${Sf(N.beforeBytes)} → sent ${Sf(N.afterBytes)}`,children:[a.jsx("div",{className:"absolute inset-y-0 left-0 bg-gray-300 dark:bg-gray-600",style:{width:R+"%"}}),N.changed&&N.afterBytes!=null&&N.beforeBytes!=null&&N.afterBytes<N.beforeBytes&&a.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:T+"%",width:Math.max(0,R-T)+"%"}}),a.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:T+"%"}})]}),a.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 shrink-0",children:N.changed?`${Sf(N.beforeBytes)}→${Sf(N.afterBytes)}`:"cached"}),a.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&&a.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),a.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 RR=4,vQ=2.8,kv=e=>e==null?"—":e.toLocaleString();function _v({chars:e,ratio:t,ratioNote:n,tokens:r}){if(e==null)return null;const i=Math.ceil(e/t),o=r!=null?r-i:0;return a.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",kv(e)," chars ÷ ",t,"⌉",o?a.jsxs(a.Fragment,{children:[" + ",kv(o)]}):null," = ",a.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:kv(r)})," tok",a.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",n,o?" + structure/attachments":""]})]})}function wv({label:e,tokens:t,sub:n,calc:r,expanded:i,isOpen:o,onToggle:l}){return a.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[a.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:[a.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),a.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),n?a.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",n]}):null]}),r]})]}),o&&a.jsx("div",{className:"pb-2 pl-1",children:i})]})}function kQ({rec:e,onResolveRef:t,overheadSystem:n,overheadTools:r,toolCount:i,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=Ou(e.body),[p,h]=y.useState(()=>f?null:e.body),[m,x]=y.useState(()=>f?"idle":"ready"),[v,k]=y.useState(null),[_,w]=y.useState(null),S=y.useCallback(async()=>{if(!f){h(e.body),x("ready");return}x("loading"),k(null);try{const D=await t(Vl(e.body));h(D),x("ready")}catch(D){k(D&&D.message?D.message:"failed to load"),x("error")}},[f,e.body,t]),N=D=>{w($=>$===D?null:D),m==="idle"&&S()},j=m==="ready",R=j&&p&&Array.isArray(p.messages)?p.messages:[],T=R.find(D=>D&&D.role==="system"),I=T?T.content:null,M=j&&p?p.tools:null,L=R.length?R[R.length-1]:null,A=(D,$)=>m==="loading"?a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?a.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",a.jsx("button",{type:"button",onClick:S,className:"underline hover:no-underline",children:"retry"})]}):D==null?a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):a.jsx(Vo,{value:D,onResolveRef:t,label:$});return a.jsxs("div",{className:"pt-1",children:[a.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:"}),a.jsx(wv,{label:"system prompt",tokens:n,calc:a.jsx(_v,{chars:l,ratio:RR,ratioNote:"natural language",tokens:n}),expanded:A(I,"system prompt"),isOpen:_==="system",onToggle:()=>N("system")}),a.jsx(wv,{label:"tool schemas",tokens:r,sub:i?`${i} tools`:"",calc:a.jsx(_v,{chars:u,ratio:vQ,ratioNote:"JSON",tokens:r}),expanded:A(M,"tool schemas"),isOpen:_==="tools",onToggle:()=>N("tools")}),a.jsx(wv,{label:"new message",tokens:o,calc:a.jsx(_v,{chars:d,ratio:RR,ratioNote:"natural language",tokens:o}),expanded:A(L,"new message"),isOpen:_==="new",onToggle:()=>N("new")})]})}function _Q({rec:e,prevRec:t,onSelectSeq:n}){const r=e&&e.messageDrop;if(!r)return null;const i=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(i)&&Array.isArray(o)?oQ(i,o):null,d=t?a.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]}):a.jsxs("span",{title:"That request is no longer in the capture",children:["request #",r.prevSeq]});return a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[a.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",a.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",a.jsxs("b",{children:[r.wireBefore," → ",r.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",a.jsx("b",{children:"no compaction"}),r.storeMessages!=null&&a.jsxs(a.Fragment,{children:[" — store intact = ",a.jsx("b",{children:r.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),a.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?a.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(r.prevSeq),children:["raw request #",r.prevSeq]}):a.jsxs("span",{children:["request #",r.prevSeq," (evicted)"]})," · ",a.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?a.jsxs("div",{className:"px-3 py-1.5",children:[a.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=>a.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[a.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),a.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&a.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),a.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)."})]}):a.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 wQ=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function pn(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function jn({label:e,children:t,highlight:n}){return a.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:e}),a.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 Xf={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"},AR={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 SQ({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 a.jsx("span",{className:n+" text-gray-600 dark:text-gray-400",children:e});r.sort((l,u)=>l.start-u.start);const i=[];let o=0;return r.forEach((l,u)=>{l.start<o||(l.start>o&&i.push(a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),i.push(a.jsx("span",{className:"font-semibold "+(Xf[l.type]||Xf.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&i.push(a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),a.jsx("span",{className:n,children:i})}function Ef({n:e,name:t,sub:n,pct:r,trimmedPct:i,fill:o,dashed:l}){return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-4 shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),n&&a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:n}),r!=null&&a.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:[i!=null&&a.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,i)+"%"}}),a.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,r)+"%"}})]})]})]})}function Sv({label:e}){return a.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[a.jsx("span",{"aria-hidden":!0,children:"↓"}),a.jsx("span",{children:e})]})}function EQ({rec:e,prevRec:t,onSelectSeq:n,onResolveRef:r,onJumpToMessage:i,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return a.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,h=e.context,m=h&&h.limit!=null&&h.usable!=null?h.limit-h.usable:null,x=h&&h.threshold!=null&&h.tokReal!=null?h.threshold-h.tokReal:null,v=h?h.source==="estimate":!1,k=h&&(h.historicalEstimate!=null||h.lastPromptTokens!=null)&&h.newMessageTokens!=null,_=h?h.source==="actual"?h.lastPromptTokens:h.historicalEstimate:null,w=h&&h.historicalEstimate!=null&&h.staticOverhead!=null?h.historicalEstimate-h.staticOverhead:null;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,a.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})]}),a.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Su,{getText:()=>ZI(e),label:"request",title:"Copy this request (body + response + context)"}),f&&a.jsx(Su,{getText:()=>fQ(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&a.jsx(Su,{getText:()=>JI(e),label:"chunks",title:"Copy all raw chunks"})]})]}),a.jsx(_Q,{rec:e,prevRec:t,onSelectSeq:n}),a.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 shrink-0 border-b border-gray-200 dark:border-gray-800",children:wQ.map(S=>a.jsx("button",{type:"button",onClick:()=>l(S),className:"px-2.5 py-1 text-xs font-medium rounded-t transition-colors "+(o===S?"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:S},S))}),a.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(jn,{label:"fingerprint",children:e.fingerprint}),a.jsx(jn,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&a.jsxs(jn,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&a.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:"bubble msgID"}),i?a.jsx("button",{type:"button",onClick:()=>i(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}):a.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),a.jsx(Vo,{value:e.params,label:"params"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),a.jsx(Vo,{value:e.headers,label:"headers"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),a.jsx(Vo,{value:e.body,bytes:e.bodyBytes,onResolveRef:r,label:"body"})]})]}),o==="Response"&&a.jsx("div",{className:"space-y-3",children:f?a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),a.jsx(jn,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&a.jsx(jn,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&a.jsx(jn,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),a.jsx(Vo,{value:f.headers,label:"response headers"})]}):a.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."})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),a.jsx(jn,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&a.jsx(jn,{label:"prompt_tokens",children:pn(f.usage.prompt_tokens)}),f.usage&&a.jsx(jn,{label:"completion_tokens",children:pn(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&a.jsx(jn,{label:"total_tokens",children:pn(f.usage.total_tokens)})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),a.jsx(Vo,{value:p,onResolveRef:r,label:"assembled"})]})]}):a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&a.jsxs("div",{className:"space-y-2",children:[a.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:[a.jsxs("span",{children:["TTFT: ",a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),a.jsxs("span",{children:["total: ",a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),a.jsxs("span",{children:["chunks: ",a.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&&a.jsxs("span",{children:["throughput: ",a.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),a.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:u,onChange:S=>d(S.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):a.jsx("div",{className:"space-y-1",children:e.chunks.map((S,N)=>{const j=N===0?e.ts!=null?S.ts-e.ts:0:S.ts-e.chunks[N-1].ts,R=lQ(S).parts,T=R.filter(I=>I.piece!=="");return a.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[a.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 shrink-0 text-right",children:["+",j,"ms"]}),a.jsx("span",{className:"w-[72px] shrink-0 flex flex-col items-start gap-0.5",children:R.map((I,M)=>a.jsx("span",{className:"px-1 rounded "+(AR[I.type]||AR.other),children:I.type},M))}),u?a.jsx(SQ,{raw:S.raw,parts:R}):a.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:S.raw,children:T.length?T.map((I,M)=>a.jsx("span",{className:(M?"ml-1 ":"")+(Xf[I.type]||Xf.other),children:I.piece},M)):a.jsx("span",{className:"italic opacity-60 text-gray-500",children:S.raw})})]},S.seq)})}),!u&&e.chunks.length>0&&a.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",a.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",a.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",a.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",a.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&a.jsxs("div",{className:"space-y-3",children:[h?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-lg border p-2.5 "+(h.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(h.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:h.needsCompaction?"TRIGGERED":"not triggered"}),a.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",a.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),a.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[a.jsxs("div",{children:["compact when ",a.jsx("b",{children:"tokReal > threshold"})," →"," ",a.jsxs("span",{className:h.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[pn(h.tokReal)," ",h.needsCompaction?">":"≤"," ",pn(h.threshold)]})]}),a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",pn(h.threshold)," − ",pn(h.tokReal)," = ",a.jsx("b",{className:x!=null&&x<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:pn(x)})]}),a.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",pn(h.usable)," × ",h.margin??"?","⌋ = ",pn(h.threshold)]}),a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",pn(h.limit)," − ",pn(m)," = ",pn(h.usable)]})]})]}),k&&a.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),a.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"})]}),a.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[a.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",a.jsx("b",{children:pn(_)})," + ",a.jsx("b",{children:pn(h.newMessageTokens)})," = ",a.jsx("b",{children:pn(h.tokReal)})]}),v?a.jsxs(a.Fragment,{children:[w!=null&&a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",pn(w)," + ",pn(h.staticOverhead)," = ",pn(h.historicalEstimate)]}),(h.overheadSystem!=null||h.overheadTools!=null)&&a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",pn(h.overheadSystem)," + tool schemas ",pn(h.overheadTools),h.toolCount?` (${h.toolCount} tools)`:""," = ",pn(h.staticOverhead)]}),a.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",a.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",pn(h.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):a.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",a.jsx("code",{children:"prompt_tokens"})," (",pn(h.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),a.jsx("div",{className:"font-sans",children:a.jsx(kQ,{rec:e,onResolveRef:r,overheadSystem:h.overheadSystem,overheadTools:h.overheadTools,toolCount:h.toolCount,newMessageTokens:h.newMessageTokens,overheadSystemChars:h.overheadSystemChars,overheadToolsChars:h.overheadToolsChars,newMessageChars:h.newMessageChars})})]})]}),a.jsxs("div",{children:[a.jsx(jn,{label:"limit (window)",children:pn(h.limit)}),a.jsx(jn,{label:"reserve (output)",children:pn(m)}),a.jsx(jn,{label:"usable",children:pn(h.usable)}),a.jsx(jn,{label:"margin",children:h.margin}),a.jsx(jn,{label:"threshold",children:pn(h.threshold)}),a.jsx(jn,{label:"tokReal",children:pn(h.tokReal)}),a.jsx(jn,{label:"needsCompaction",highlight:!!h.needsCompaction,children:String(h.needsCompaction)}),a.jsx(jn,{label:"source",children:h.source}),a.jsx(jn,{label:"windowSource",children:h.windowSource||h.epmWindowSignal})]})]}):a.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 ",a.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&a.jsxs(a.Fragment,{children:[" The most recent decision was evaluated at ",a.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx(jn,{label:"storeTokens",children:pn(e.storeTokens)}),a.jsx(jn,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&a.jsxs("div",{className:"mt-2",children:[a.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"}),a.jsx(Vo,{value:e.store.messages,onResolveRef:r,label:"store messages"})]})]}),e.compaction&&a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),a.jsx(jn,{label:"trigger",children:e.compaction.trigger}),a.jsx(jn,{label:"deleted",children:pn(e.compaction.deletedMessages)}),a.jsx(jn,{label:"summary tok",children:pn(e.compaction.summaryTokens)}),a.jsx(jn,{label:"before",children:pn(e.compaction.before)}),a.jsx(jn,{label:"after",children:pn(e.compaction.after)}),a.jsx(jn,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",a.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",a.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),a.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:[a.jsx("b",{children:"sent est"})," counts the whole ",a.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",a.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",a.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",a.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 ",a.jsx("b",{children:"sent actual"}),". ",a.jsx("b",{children:"sent actual"})," (",a.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",a.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."]}),a.jsx(jn,{label:"sent est",children:pn(e.sentEstTokens)}),a.jsx(jn,{label:"sent actual",children:pn(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&a.jsxs(a.Fragment,{children:[a.jsx(jn,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),a.jsx(jn,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx(jn,{label:"store tokens",children:pn(e.storeTokens)}),a.jsx(jn,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&a.jsxs(a.Fragment,{children:[a.jsx(jn,{label:"completion_tokens",children:e.response.usage.completion_tokens}),a.jsx(jn,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&a.jsx(jn,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const S=e.trimmed,N=S!=null&&S>0,j=e.finishReason==="length",R=h?h.needsCompaction:null,T=e.storeTokens,I=e.sentActualTokens,M=Math.max(T||0,I||0,e.sentEstTokens||0,1),L=A=>Math.round((A||0)/M*100);return a.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[a.jsxs("div",{children:[a.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"}),a.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:[a.jsx(Ef,{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)."}),a.jsx(Sv,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),a.jsx(Ef,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${pn(T)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:L(T),fill:"bg-emerald-500"}),a.jsx(Sv,{label:"slice — shallow copy so trimming can't touch the original render"}),a.jsx(Ef,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:L(T),fill:"bg-emerald-500/40",dashed:!0}),a.jsx(Sv,{label:N?`trim — fit to budget (−${pn(S)} tok net)`:"trim — nothing net-trimmed this request"}),a.jsx(Ef,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${pn(I)} tok actual · est ${pn(e.sentEstTokens)}`,pct:L(I),trimmedPct:N?L(T):null,fill:"bg-sky-500"})]}),N&&a.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[a.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)",j?" · finishReason=length: model hit the output limit":""]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[a.jsxs("li",{children:[a.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",a.jsx("code",{children:"compactedOut"})," + add a summary."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",a.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",a.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),a.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",a.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",a.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",a.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),a.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:[a.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 ",a.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",a.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",a.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."]}),a.jsxs("div",{children:[a.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"}),a.jsx(bQ,{rec:e,onResolveRef:r})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?a.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 ",pn(e.compaction.before)," → ",pn(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):a.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",R!=null&&a.jsxs(a.Fragment,{children:[" Decision at build time: ",a.jsx("b",{className:R?"text-fuchsia-600 dark:text-fuchsia-400":"text-emerald-600 dark:text-emerald-400",children:R?"TRIGGERED":"not triggered"})," (see Context tab)."]})]}),a.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",a.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",a.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",a.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",a.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[a.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),a.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),a.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),a.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,D,$])=>a.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[a.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:A}),a.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:D}),a.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:$})]},A))})]})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),a.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."}),a.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[a.jsxs("li",{children:[a.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),a.jsxs("li",{children:[a.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),a.jsxs("li",{children:[a.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),a.jsxs("li",{children:[a.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."]})]}),a.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 NQ(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const Eu=(e,t,n)=>Math.min(n,Math.max(t,e)),IR=0,MR=560,LR=220,OR=200,DR=640,PR=300,Zf=520;function Ev(e,t,n,r){try{const i=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(i))return Eu(i,n,r)}catch{}return t}function FR(){try{return Math.max(Zf,window.innerWidth)}catch{return 1600}}function BR(){try{return Eu(Math.round(window.innerWidth*.9),Zf,1600)}catch{return 1200}}function CQ({open:e,onClose:t,activeSessionId:n,activeSessionTitle:r,onJumpToMessage:i}){const[o,l]=y.useState([]),[u,d]=y.useState(null),[f,p]=y.useState(""),[h,m]=y.useState(!1),[x,v]=y.useState(null),[k,_]=y.useState(null),[w,S]=y.useState(()=>Ev("inspectorTimelineHeight",LR,IR,MR)),[N,j]=y.useState(()=>Ev("inspectorLedgerWidth",PR,OR,DR)),[R,T]=y.useState(()=>Ev("inspectorDrawerWidth",BR(),Zf,FR())),[I,M]=y.useState(!1),[L,A]=y.useState(0),[D,$]=y.useState("Request"),[ee,U]=y.useState(!1),G=y.useMemo(()=>f?uQ(f):null,[f]);y.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(w))}catch{}},[w]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(N))}catch{}},[N]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(R))}catch{}},[R]);const Z=y.useCallback(H=>{H.preventDefault();const se=H.clientY,ie=w,ge=Ke=>S(Eu(ie+(Ke.clientY-se),IR,MR)),we=()=>{window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",we),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ge),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",we)},[w]),z=y.useCallback(H=>{H.preventDefault();const se=H.clientX,ie=N,ge=Ke=>j(Eu(ie+(Ke.clientX-se),OR,DR)),we=()=>{window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",we),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ge),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",we)},[N]),q=y.useCallback(H=>{H.preventDefault();const se=H.clientX,ie=R,ge=Ke=>T(Eu(ie+(se-Ke.clientX),Zf,FR())),we=()=>{window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",we),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ge),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",we)},[R]),ae=y.useCallback(async()=>{if(G){M(!0);try{const H=new Map;await Promise.all(pQ(G).map(async Ke=>{try{H.set(Ke,await _w(u,Ke))}catch{}}));const se=ER(G,u,H),ie=new Blob([se],{type:"text/plain;charset=utf-8"}),ge=URL.createObjectURL(ie),we=document.createElement("a");we.href=ge,we.download=`inspector-${u||"session"}.txt`,document.body.appendChild(we),we.click(),we.remove(),setTimeout(()=>URL.revokeObjectURL(ge),2e3)}catch(H){v(H&&H.message?H.message:"Download failed")}finally{M(!1)}}},[G,u]),P=y.useCallback(async()=>{try{const H=await AO();l(Array.isArray(H)?H:[])}catch(H){v(H&&H.message?H.message:"Failed to list sessions")}},[]);y.useEffect(()=>{e&&P()},[e,n,P]),y.useEffect(()=>{e&&d(H=>n||(H&&o.some(se=>se.id===H)?H:o.length?o[0].id:null))},[e,n,o]),y.useEffect(()=>{if(!e||!u){p("");return}let H=!1;return m(!0),v(null),_(null),p(""),IO(u).then(se=>{H||p(se||"")}).catch(se=>{H||(se&&se.status===404?p(""):v(se&&se.message?se.message:"Failed to load events"))}).finally(()=>{H||m(!1)}),()=>{H=!0}},[e,u,L]);const Q=y.useCallback(()=>{P(),A(H=>H+1)},[P]);y.useEffect(()=>{if(G&&G.requests.length&&k==null){const H=G.requests.find(se=>se.messageDrop);_((H||G.requests[0]).seq)}},[G,k]),y.useEffect(()=>{if(!e)return;const H=se=>{se.key==="Escape"&&t()};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[e,t]);const J=y.useCallback(H=>_w(u,H),[u]),F=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 MO(u),p(""),d(null),await P()}catch(H){v(H&&H.message?H.message:"Failed to purge")}},[u,n,P]),K=y.useMemo(()=>G&&G.requests.find(H=>H.seq===k)||null,[G,k]),W=y.useMemo(()=>G&&K&&K.messageDrop&&G.requests.find(H=>H.seq===K.messageDrop.prevSeq)||null,[G,K]);return e?a.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[a.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),a.jsxs("div",{style:{width:R,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:[a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:q,onDoubleClick:()=>T(BR()),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:a.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"})}),a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-base shrink-0",children:"🦋"}),a.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 shrink-0",children:"Inspector"}),a.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&&a.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&&a.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsxs("select",{value:u||"",onChange:H=>d(H.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&&a.jsx("option",{value:"",children:"(no captures)"}),n&&!o.some(H=>H.id===n)&&a.jsxs("option",{value:n,children:["● ",n.slice(0,12),"… · (current chat — no capture yet)"]}),o.map(H=>a.jsxs("option",{value:H.id,children:[H.id===n?"● ":"",H.id.slice(0,12),"… · ",H.events," ev · ",NQ(H.bytes)]},H.id))]}),a.jsx("button",{type:"button",onClick:Q,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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),G&&a.jsx(Su,{getText:()=>ER(G,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),G&&a.jsx("button",{type:"button",onClick:ae,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"}),a.jsx("button",{type:"button",onClick:F,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"}),a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),a.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[h?a.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):x?a.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:x}):G?a.jsx(hQ,{timeline:G.timeline,selectedSeq:k,onSelectSeq:_,height:w}):a.jsx("div",{style:{height:w},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."}),a.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:Z,onDoubleClick:()=>S(LR),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:a.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"})})]}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx("div",{style:{width:N},className:"shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:G?a.jsx(gQ,{turns:G.turns,selectedSeq:k,onSelect:_}):a.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),a.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:z,onDoubleClick:()=>j(PR),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:a.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"})}),a.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:a.jsx(EQ,{rec:K,prevRec:W,onSelectSeq:_,onResolveRef:J,onJumpToMessage:i,tab:D,onTabChange:$,showRaw:ee,onShowRawChange:U},K?K.seq:"none")})]})]}),a.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}const jQ=8,TQ=32;function RQ({width:e,min:t,max:n,edge:r,onCommit:i,getPaneEl:o,ariaLabel:l,className:u}){const d=y.useRef(null),f=y.useRef(null),p=y.useRef(null),h=y.useRef(e);h.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,w=v.clientX,S=h.current;try{k.setPointerCapture(v.pointerId)}catch{}d.current=v.pointerId;const N=document.body.style.cursor,j=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let R=!1;const T=A=>{if(d.current!==null&&A.pointerId!==d.current)return;const D=r==="left"?w-A.clientX:A.clientX-w,$=sw(S+D,t,n);_&&(_.style.width=$+"px"),f.current=$},I=A=>{if(R)return;R=!0,window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",M),window.removeEventListener("lostpointercapture",M),document.body.style.cursor=N,document.body.style.userSelect=j;const D=d.current;if(d.current=null,D!==null)try{k.releasePointerCapture(D)}catch{}A&&f.current!==null?i(f.current):_&&(_.style.width=h.current+"px"),f.current=null,p.current=null},M=()=>I(!1),L=()=>I(!0);window.addEventListener("pointermove",T),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",M),window.addEventListener("lostpointercapture",M),p.current=()=>I(!1)},x=v=>{const k=v.shiftKey?TQ:jQ;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(),i(sw(_,t,n)))};return a.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 zR={oryzo:"oryzo",apple:"apple",flip7:"flip7",questui:"questui",skylearn:"skylearn",editorial:"editorial",blok:"blok",signal:"signal",lens:"lens"};function AQ(e,t){const n=typeof e=="string"?e.toLowerCase():"";return Object.prototype.hasOwnProperty.call(zR,n)?zR[n]:t?"oryzo":"default"}class IQ{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=yr("/global/event")+(n.length>0?"?"+n.join("&"):"");this.eventSource=new EventSource(r);const i=this.eventSource;i.onopen=()=>{this.eventSource===i&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},i.onmessage=o=>{if(this.eventSource===i){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},i.onerror=()=>{this.eventSource===i&&(this._emit("error",{}),i.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 i of r)try{i(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 xn=new IQ;function MQ(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const L=localStorage.getItem("pave-theme");return L?L==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[n,r]=y.useState(!1),[i,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[p,h]=y.useState(!1),[m,x]=y.useState(!1),[v,k]=y.useState(!1),[_,w]=y.useState(!1),[S,N]=y.useState(!1),j=e||n;y.useEffect(()=>{const L=document.documentElement;L.classList.toggle("dark",j),L.classList.toggle("theme-oryzo",n),L.classList.toggle("theme-apple",i),L.classList.toggle("theme-flip7",l),L.classList.toggle("theme-questui",d),L.classList.toggle("theme-skylearn",p),L.classList.toggle("theme-editorial",m),L.classList.toggle("theme-blok",v),L.classList.toggle("theme-signal",_),L.classList.toggle("theme-lens",S),L.style.colorScheme=j?"dark":"light",localStorage.setItem("pave-theme",e?"dark":"light"),localStorage.setItem("pave-oryzo",n?"true":"false"),localStorage.setItem("pave-apple",i?"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",S?"true":"false")},[j,e,n,i,l,d,p,S,m,v,_]);const[R,T]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",R?"true":"false")},[R]);const[I,M]=y.useState(!1);return{darkMode:j,setDarkMode:t,oryzoMode:n,setOryzoMode:r,appleMode:i,setAppleMode:o,flip7Mode:l,setFlip7Mode:u,questuiMode:d,setQuestuiMode:f,skylearnMode:p,setSkylearnMode:h,editorialMode:m,setEditorialMode:x,blokMode:v,setBlokMode:k,signalMode:_,setSignalMode:w,lensMode:S,setLensMode:N,matrixMode:I,setMatrixMode:M,mobileFrameless:R,setMobileFrameless:T}}const Jf=200,j1=600;function LQ(e,t){const n=Number(e&&e.terminalWidth),r=Number.isFinite(n)?Math.min(j1,Math.max(Jf,n)):Jf,i=y.useCallback(o=>{const l=typeof o=="function"?o(r):o;t&&t("terminalWidth",l)},[t,r]);return{terminalWidth:r,setTerminalWidth:i}}const Nv="pave-sidebar-width";function OQ(){const[e,t]=y.useState(()=>typeof window>"u"?Nu:JM(localStorage.getItem(Nv))),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem(Nv,String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem(Nv,String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{sidebarWidth:e,setSidebarWidth:t}}function DQ(e,t,n){const[r,i]=y.useState(()=>t?t.paneVisible!==!1:!0),[o,l]=y.useState(""),u=y.useRef(r);u.current=r;const d=t?t.paneVisible!==!1:!0;y.useEffect(()=>{i(d)},[d]);const f=y.useCallback(h=>{const m=!!h;u.current!==m&&(u.current=m,i(m),n&&n("paneVisible",m))},[n]),p=y.useCallback(()=>{const h=!u.current;f(h),l(e(h?"app.right_pane_shown":"app.right_pane_hidden"))},[e,f]);return{rightPaneVisible:r,setRightPaneVisible:f,toggleRightPane:p,rightPaneAnnouncement:o}}const PQ="pave-banner-hidden";function FQ(e){return e?e.getItem(PQ)==="true":!1}function BQ(e){return!e}function zQ(e,t){const n=()=>typeof window<"u"?window.localStorage:null,[r,i]=y.useState(()=>e?e.bannerHidden===!0:FQ(n())),o=y.useRef(r);o.current=r;const l=e?e.bannerHidden===!0:!1;y.useEffect(()=>{i(l)},[l]);const u=y.useCallback(()=>{const d=BQ(o.current);o.current=d,i(d),t&&t("bannerHidden",d)},[t]);return{bannerHidden:r,toggleBanner:u}}function UQ(e,t){const[n,r]=y.useState(()=>e&&e.paneTab||"map"),i=e&&e.paneTab||"map";y.useEffect(()=>{r(i)},[i]);const o=y.useCallback(l=>{r(l),t&&t("paneTab",l)},[t]);return{paneTab:n,setPaneTab:o}}const qQ=["activities","map","tools","canvas","terminal"],gu={paneVisible:!0,paneTab:"map",terminalWidth:288,bannerHidden:!1,mapShowCompleted:!0,toolmapShowHidden:!1,toolmapShowThoughts:!1},HQ=400,UR="pave-hacker";let qR=!1;const Nf={};function $Q(e){return qQ.indexOf(e)!==-1}function au(e,t){try{const n=localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function HR(e){try{const t=parseFloat(localStorage.getItem(e));if(Number.isFinite(t)&&t>.1)return t}catch{}}function $R(e){try{const t=localStorage.getItem(e);if(t==="LR"||t==="TB")return t}catch{}}function WQ(){if(typeof window>"u")return{};const e={},t=au("pave-right-pane-visible",null);t!==null&&(e.paneVisible=t);try{const l=localStorage.getItem("pave-activity-view");$Q(l)&&(e.paneTab=l)}catch{}try{const l=parseInt(localStorage.getItem("pave-terminal-width"),10);Number.isFinite(l)&&l>=Jf&&l<=j1&&(e.terminalWidth=l)}catch{}e.bannerHidden=au("pave-banner-hidden",gu.bannerHidden);const n=HR("pave-map-zoom");n!==void 0&&(e.mapZoom=n);const r=$R("pave-map-rankdir");r!==void 0&&(e.mapRankdir=r),e.mapShowCompleted=au("pave-map-show-completed",gu.mapShowCompleted);const i=HR("pave-toolmap-zoom");i!==void 0&&(e.toolmapZoom=i);const o=$R("pave-toolmap-rankdir");if(o!==void 0&&(e.toolmapRankdir=o),e.toolmapShowHidden=au("pave-toolmap-show-hidden",gu.toolmapShowHidden),e.toolmapShowThoughts=au("pave-toolmap-show-thoughts",gu.toolmapShowThoughts),!qR){qR=!0;try{localStorage.getItem(UR)==="true"&&(e.paneTab="terminal"),localStorage.removeItem(UR)}catch{}}return e}function VQ(e,t,n){const[r,i]=y.useState(Nf),o=t&&t.ui&&t.ui.displayLayout||null,l=y.useRef(t);l.current=t;const u=y.useRef(null),d=y.useRef(void 0);o?(u.current=null,d.current=void 0):d.current!==e&&(d.current=e,u.current=WQ());const f=o?Nf:u.current||Nf,p=y.useMemo(()=>({...gu,...f,...o||{},...r}),[f,o,r]),h=y.useRef(p),m=y.useRef(null),x=y.useRef(null);m.current?m.current.sessionId===e&&(m.current.ui=t&&t.ui||{}):h.current=p;const v=y.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null)},[]),k=y.useCallback(()=>{v();const j=m.current;if(m.current=null,!j||!j.sessionId)return;const{sessionId:R,layout:T}=j;let I=j.ui||{};n(M=>{const L=M.find(A=>A.id===R);return L?(I=L.ui||{},M.map(A=>A.id===R?{...A,ui:{...I,displayLayout:T}}:A)):M}),Li(R,{ui:{...I,displayLayout:T}}).catch(M=>{console.error("Failed to persist displayLayout:",M)})},[v,n]),_=y.useRef(k);_.current=k;const w=y.useCallback(()=>{if(!m.current){v();return}_.current()},[v]),S=y.useCallback((j,R)=>{const T={...h.current,[j]:R};h.current=T,i(M=>({...M,[j]:R}));const I=l.current;m.current={sessionId:e,layout:T,ui:I&&I.ui||{}},v(),x.current=setTimeout(()=>_.current(),HQ)},[e,v]),N=y.useRef(e);return y.useEffect(()=>{if(N.current===e)return;const j=N.current;N.current=e,m.current&&m.current.sessionId===j?_.current():(m.current=null,v()),i(R=>Object.keys(R).length===0?R:Nf)},[e,v]),y.useEffect(()=>{if(typeof window>"u")return;const j=()=>_.current();return window.addEventListener("beforeunload",j),()=>{window.removeEventListener("beforeunload",j),j()}},[]),{displayLayout:p,setLayoutField:S,flushLayout:w}}const GQ=150;function KQ(e){return e?e.nodeType===1?e:e.parentElement||null:null}function YQ(e){const t=KQ(e.anchorNode);return!t||!t.closest?null:t.closest("[data-message-id]")}function QQ({enabled:e=!0,onQuoteAdd:t}={}){const[n,r]=y.useState(null),i=y.useRef(t);i.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 h=p.toString();if(!h||!h.trim()){r(null);return}const m=YQ(p);if(!m){r(null);return}const x=p.getRangeAt(0).getBoundingClientRect();r({text:h,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:IU(p)})},d=()=>{l&&clearTimeout(l),l=setTimeout(()=>{l=null,u()},GQ)},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 XQ=["web","agent"],ZQ=["tui","acp"];function Cv(e){return e?e.client?XQ.indexOf(e.client)!==-1:ZQ.indexOf(e.source)===-1:!1}function JQ(e){return!!(e&&(e.status||e.response&&e.response.status)===404)}function jv(e,t){return e.filter(n=>n&&n.id!==t)}function eX(e){return"Failed to load messages: "+(e&&e.message?e.message:String(e))}function tX(e,t,n){const r={...e};return n.length===0?delete r[t]:r[t]=n,r}function nX(e){return!!(e&&e.status===409)}function WR(e,t){return!!(e&&e.length>0||t&&t.length>0)}const VR=40;function rX(){var Io,jc,na;const{t:e}=Zt(),{darkMode:t,setDarkMode:n,oryzoMode:r,setOryzoMode:i,appleMode:o,setAppleMode:l,flip7Mode:u,setFlip7Mode:d,questuiMode:f,setQuestuiMode:p,skylearnMode:h,setSkylearnMode:m,editorialMode:x,setEditorialMode:v,blokMode:k,setBlokMode:_,signalMode:w,setSignalMode:S,lensMode:N,setLensMode:j,matrixMode:R,setMatrixMode:T,mobileFrameless:I,setMobileFrameless:M}=MQ(),{sidebarWidth:L,setSidebarWidth:A}=OQ(),D="pave-active-session";function $(){try{return localStorage.getItem(D)||null}catch{return null}}function ee(O){try{O?localStorage.setItem(D,O):localStorage.removeItem(D)}catch{}}function U(){try{localStorage.removeItem(D)}catch{}}const[,G]=y.useState(0),[Z,z]=y.useState(!1),q=y.useRef(null),ae=y.useRef(new Map),[P,Q]=y.useState(()=>new Set),[J,F]=y.useState(()=>new Set),K=y.useRef(null),W=y.useRef("chat"),H=y.useRef(null),se=y.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]),[ie,ge]=y.useState(!0),[we,Ke]=y.useState(!1),[xt,et]=y.useState(null),[vt,lt]=y.useState(null),[je,Oe]=y.useState("chat");W.current=je;const[ft,Ct]=y.useState(!1),[rn,tn]=y.useState(!1),[un,mt]=y.useState(!1),[$t,nt]=y.useState(!1),[qe,ue]=y.useState([]),[me,Ue]=y.useState({}),He=y.useRef(!1);y.useEffect(()=>{YL().then(async O=>{if(Ke(O.enabled),O.authenticated&&O.user){He.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}et(O.user)}else O.enabled&&await xk()}).catch(O=>{console.error("Failed to check auth status:",O)}).finally(()=>ge(!1))},[]),y.useEffect(()=>(pw(({recovered:O,user:Y})=>{if(O){let re=-1;try{re=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{re=-1}if(re>=0&&re<1){let le=!1;try{sessionStorage.setItem("pave-restore-reloads",String(re+1)),le=!0}catch{le=!1}if(le){window.location.reload();return}}if(Y){He.current=!0,et(Y);return}}He.current&&dt("Session expired. Please log in again."),et(null)}),()=>pw(null)),[]),y.useEffect(()=>{we&&!xt&&xn.disconnect()},[xt,we]),y.useEffect(()=>{if(!xt)return;let O=!1;return JO().then(Y=>{!O&&Y&&Y.currentVersion&<(Y.currentVersion)}).catch(()=>{}),()=>{O=!0}},[xt]),y.useEffect(()=>{GK(()=>K.current)},[]);const be=y.useCallback(async()=>{try{await QL()}catch(O){console.error("Logout failed:",O);return}et(null),window.location.reload()},[]),[Ye,_t]=y.useState(null),[jt,Wt]=y.useState(!1),[hn,xe]=y.useState([]),[ke,Ae]=y.useState([]),[Fe,yt]=y.useState({}),pt=y.useRef(Fe);y.useEffect(()=>{pt.current=Fe},[Fe]);const Ht=y.useRef({}),[te,Ee]=y.useState(()=>window.matchMedia("(min-width: 768px)").matches),[Je,Dt]=y.useState(!1),Pe=y.useRef(!1),ze=y.useRef(null),We=y.useRef(0);y.useEffect(function(){return function(){We.current&&cancelAnimationFrame(We.current)}},[]);const Qe=y.useCallback(function(){We.current&&cancelAnimationFrame(We.current),We.current=requestAnimationFrame(function(){We.current=0,ze.current&&ze.current.scrollToBottom()})},[]),[st,Ne]=y.useState([]),Ve=y.useRef([]);Ve.current=st;const[oe,bn]=y.useState(null);K.current=oe,y.useEffect(()=>{ee(oe)},[oe]),y.useEffect(()=>{oe&&KK(typeof document<"u"&&document.visibilityState==="visible",oe)},[oe]);const[tr,Le]=y.useState([]),kt=y.useCallback(function(O){O&&Le(function(Y){return wU(Y,O.text)?Y.concat([{qid:kU(),text:r1(O.text),sourceMessageID:O.sourceMessageID||null,sourceRole:O.sourceRole==="user"?"user":"assistant",sourceTime:O.sourceTime||"",fromCode:O.fromCode===!0}]):Y})},[]),vn=y.useCallback(function(O){Le(function(Y){return Y.filter(function(re){return re.qid!==O})})},[]),ar=y.useCallback(function(){Le([])},[]),{selection:Vr,clearSelection:Rr}=QQ({onQuoteAdd:kt}),Ma=y.useCallback(function(){Vr&&pp(Vr.text)},[Vr]);y.useEffect(function(){Le([])},[oe]);const Gt=y.useMemo(()=>oe&&st.find(O=>O.id===oe)||null,[oe,st]),{displayLayout:Tn,setLayoutField:Pr}=VQ(oe,Gt,Ne),{paneTab:Bn,setPaneTab:Bi}=UQ(Tn,Pr),{terminalWidth:pa,setTerminalWidth:$n}=LQ(Tn,Pr),{rightPaneVisible:La,toggleRightPane:ha,rightPaneAnnouncement:ga}=DQ(e,Tn,Pr),{bannerHidden:gi,toggleBanner:it}=zQ(Tn,Pr),Et=Tn.paneVisible&&Tn.paneTab==="terminal";y.useEffect(()=>{const O=Y=>{if(Y.repeat)return;const re=typeof Y.key=="string"?Y.key.toLowerCase():"";if((se?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&re==="k"){Y.preventDefault(),z(Jt=>!Jt);return}if((se?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&re==="b"){Y.preventDefault(),Ee(Jt=>!Jt);return}const Re=(se?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&re==="j",Te=window.matchMedia("(min-width: 1024px)").matches,Tt=W.current==="chat";Re&&K.current&&Te&&Tt&&(Y.preventDefault(),ha())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[e,se,ha]);const[Vt,Pt]=y.useState([]),[zn,Pn]=y.useState(0),[Gr,ni]=y.useState(!1),[hr,lr]=y.useState(null),[zi,mi]=y.useState(!1),xi=y.useRef(!1),[Qi,ma]=y.useState(!1),[yi,Ya]=y.useState({}),ri=y.useRef(yi);ri.current=yi;const[ii,gr]=y.useState({}),[Xi,ln]=y.useState(null),[Ft,Ar]=y.useState(null),kn=y.useRef(null);y.useEffect(function(){return function(){kn.current&&clearTimeout(kn.current),gt.current&&clearTimeout(gt.current)}},[]);const[dn,ai]=y.useState(null),[wr,Zi]=y.useState(null),[Ei,at]=y.useState(null),gt=y.useRef(null),Nt=y.useCallback((O,Y)=>{if(O){const re=!Y&&!!ri.current[O];re&&O===zt.current&&(Ar(null),kn.current&&(clearTimeout(kn.current),kn.current=null)),Ya(le=>{const fe={...le},Re=!!le[O];if(Y?fe[O]=!0:delete fe[O],Re&&!Y&&bi.current&&bi.current[O]&&!is.current.has(O)){const Te=bi.current[O];if(Te.length>0){const Tt=Te.shift();O===zt.current&&_o(Te.length),Promise.resolve().then(()=>{try{O===zt.current&&ze.current&&ze.current.resetAutoScroll(),cs.current&&cs.current(O,Tt.content,Tt.imageAttachments,Tt.agent,Tt.displayContent,Tt.queuedTempId,Tt.fileAttachments),O===zt.current&&ze.current&&(ze.current.resetAutoScroll(),Qe())}catch(Jt){console.error("[Queue] Drain dispatch failed:",Jt)}})}}return fe}),re&&(is.current.delete(O),ag(O).then(le=>{const fe=Array.isArray(le&&le.items)?le.items:[];gr(Re=>{const Te={...Re};if(fe.length===0)if(Te[O])delete Te[O];else return Re;else Te[O]=fe;return Te})}).catch(()=>{}))}O===zt.current&&ma(Y)},[Qe]),yn=y.useCallback(O=>{const Y={};Object.keys(O).forEach(le=>{O[le]&&O[le].type==="busy"&&(Y[le]=!0)}),Ya(le=>{const fe={...le};return Object.keys(Y).forEach(Re=>{fe[Re]=!0}),Object.keys(O).forEach(Re=>{O[Re]&&O[Re].type!=="busy"&&delete fe[Re]}),fe});const re=O[zt.current];ma(!!(re&&re.type==="busy"))},[]),[Gn,Hn]=y.useState({}),Ji=y.useRef(null),si=y.useRef(null),[xa,ya]=y.useState({}),[Ns,Be]=y.useState({});y.useEffect(()=>{Bn==="map"&&oe&&sg(oe).then(O=>{O&&Array.isArray(O.todos)&&Be(Y=>({...Y,[oe]:O.todos}))}).catch(()=>{})},[Bn,oe]);const[V,de]=y.useState({});y.useEffect(()=>{Bn==="tools"&&oe&&Nw(oe).then(O=>{O&&de(Y=>({...Y,[oe]:O}))}).catch(()=>{})},[Bn,oe]);const[Ie,Me]=y.useState(null),[It,Bt]=y.useState(null),[fn,dt]=y.useState(null),[oi,cr]=y.useState(!1),[Sr,ba]=y.useState(null),er=50,[Cs,js]=y.useState(!1),[Zu,Ts]=y.useState(0),Oa=y.useRef(0),[Ju,Kr]=y.useState(0),[Qa,rc]=y.useState(()=>{try{return localStorage.getItem("pave-show-other-apps")!=="false"}catch{return!0}}),Xa=y.useRef(Qa),[Pp,ic]=y.useState(""),Za=y.useRef(""),[go,Ja]=y.useState(!0),[ll,ac]=y.useState(!1),[cl,ul]=y.useState(""),[es,Da]=y.useState(0),[Ui,dl]=y.useState(0),[Rs,As]=y.useState(!1),fl=y.useRef(null),ed=y.useRef(null),[Fp,sc]=y.useState(!1),[Bp,oc]=y.useState(""),[zp,td]=y.useState(!1),[pl,lc]=y.useState(null),[Up,hl]=y.useState(!1),[cc,nd]=y.useState({}),uc=y.useRef({}),[dc,rd]=y.useState({}),mo=y.useRef({}),[xo,qp]=y.useState({}),fc=y.useRef({}),yo=y.useRef(new Set),ts=y.useRef(null);y.useEffect(()=>{uc.current=cc},[cc]),y.useEffect(()=>{mo.current=dc},[dc]),y.useEffect(()=>{if(!oe)return;const O=st.find(Y=>Y.id===oe);O&&(O.moe_top_k!=null&&uc.current[oe]===void 0&&nd(Y=>Y[oe]===void 0?{...Y,[oe]:O.moe_top_k}:Y),O.reasoning_effort&&mo.current[oe]===void 0&&rd(Y=>Y[oe]===void 0?{...Y,[oe]:O.reasoning_effort}:Y))},[oe,st]);const pc=cc[oe]??null,id=dc[oe]??"max",ns=xo[oe]??null,bo=y.useCallback((O,Y)=>{lc({text:O,type:Y||"info"}),ts.current&&clearTimeout(ts.current),ts.current=setTimeout(()=>{lc(null),ts.current=null},3e3)},[]);function ad(O,Y){return(Array.isArray(O==null?void 0:O.settings)?O.settings:[]).find(le=>le&&le.key===Y)||null}const[hc,sd]=y.useState(!1),[gl,vo]=y.useState(!1),[rs,Hp]=y.useState(!1),[Is,$p]=y.useState(!1),[od,gc]=y.useState(!1),[Sn,ld]=y.useState("default"),ko=Sn==="oryzo",[br,Wp]=y.useState(!1);y.useEffect(()=>{const O=()=>{l4().then(Y=>{const re=Tt=>{const Jt=ad(Y,Tt),mn=String(Jt&&Jt.value||"").toLowerCase();return mn==="true"||mn==="1"};sd(re("PAVE_EXPERIMENTAL_SESSION_BANNER")),vo(re("PAVE_EXPERIMENTAL_AGENT_BOARD")),Hp(re("PAVE_CAPABILITIES_EXPERIMENTAL")),$p(re("PAVE_EXPERIMENTAL_TRIGGERS"));const le=re("PAVE_EXPERIMENTAL_PLAN_MODE");gc(le),bL(le);const fe=ad(Y,"PAVE_EXPERIMENTAL_THEME"),Re=fe&&String(fe.value||"").toLowerCase(),Te=AQ(Re,re("PAVE_EXPERIMENTAL_ORYZO_THEME"));ld(Te),Wp(!0)}).catch(Y=>{console.error("[Experimental] Failed to load feature flags:",Y.message)})};return O(),window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[je]),y.useEffect(()=>{!gl&&je==="board"&&Oe("chat"),!rs&&je==="capabilities"&&Oe("chat"),!Is&&je==="triggers"&&Oe("chat")},[gl,rs,Is,je]),y.useEffect(()=>{!ko&&r&&i(!1)},[ko,r,i]),y.useEffect(()=>{Sn!=="apple"&&o&&l(!1)},[Sn,o,l]),y.useEffect(()=>{Sn!=="flip7"&&u&&d(!1)},[Sn,u,d]),y.useEffect(()=>{Sn!=="questui"&&f&&p(!1)},[Sn,f,p]),y.useEffect(()=>{Sn!=="skylearn"&&h&&m(!1)},[Sn,h,m]),y.useEffect(()=>{Sn!=="editorial"&&x&&v(!1)},[Sn,x,v]),y.useEffect(()=>{Sn!=="blok"&&k&&_(!1)},[Sn,k,_]),y.useEffect(()=>{Sn!=="signal"&&w&&S(!1)},[Sn,w,S]),y.useEffect(()=>{Sn!=="lens"&&N&&j(!1)},[Sn,N,j]);const cd=y.useRef(!1);y.useEffect(()=>{br&&ko&&!cd.current&&(cd.current=!0,i(!0))},[br,ko]);const ud=y.useRef(!1);y.useEffect(()=>{br&&Sn==="apple"&&!ud.current&&(ud.current=!0,l(!0))},[br,Sn,l]);const dd=y.useRef(!1);y.useEffect(()=>{br&&Sn==="flip7"&&!dd.current&&(dd.current=!0,d(!0))},[br,Sn,d]);const fd=y.useRef(!1);y.useEffect(()=>{br&&Sn==="questui"&&!fd.current&&(fd.current=!0,p(!0))},[br,Sn,p]);const Ni=y.useRef(!1);y.useEffect(()=>{br&&Sn==="skylearn"&&!Ni.current&&(Ni.current=!0,m(!0))},[br,Sn,m]);const Ms=y.useRef(!1);y.useEffect(()=>{br&&Sn==="editorial"&&!Ms.current&&(Ms.current=!0,v(!0))},[br,Sn,v]);const mc=y.useRef(!1);y.useEffect(()=>{br&&Sn==="blok"&&!mc.current&&(mc.current=!0,_(!0))},[br,Sn,_]);const xc=y.useRef(!1);y.useEffect(()=>{br&&Sn==="signal"&&!xc.current&&(xc.current=!0,S(!0))},[br,Sn,S]);const yc=y.useRef(!1);y.useEffect(()=>{br&&Sn==="lens"&&!yc.current&&(yc.current=!0,j(!0))},[br,Sn,j]),y.useEffect(()=>{const O=()=>{kw().then(Y=>{mt(!!(Y&&Y.inspector))}).catch(Y=>{console.error("[Inspector] Failed to fetch config:",Y.message)})};return window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[]),y.useEffect(()=>{Rs&&fl.current&&fl.current.focus()},[Rs]),y.useEffect(()=>{const O=window.matchMedia("(min-width: 1024px)"),Y=re=>{re.matches&&As(!1)};return O.addEventListener("change",Y),()=>O.removeEventListener("change",Y)},[]);function bc(){const O=Ns[oe]||[],Y=[];for(const Te of Vt||[])for(const Tt of Te.parts||[]){if(Tt.type!=="tool")continue;const Jt=Tt.state&&Tt.state.output;if(!Jt)continue;let mn=Jt;if(typeof Jt=="string")try{mn=JSON.parse(Jt)}catch{continue}mn&&mn.canvas&&mn.canvas.type&&mn.canvas.source&&Y.push(mn.canvas)}const re=oe?`pave-canvas-cleared:${oe}`:null;let le=new Set;if(re&&typeof window<"u")try{const Te=localStorage.getItem(re);Te&&(le=new Set(JSON.parse(Te)))}catch{}const fe=Y.filter(Te=>!le.has(Te.type+":"+Te.source)),Re=()=>{if(!re||typeof window>"u")return;const Te=Y.map(Tt=>Tt.type+":"+Tt.source);try{localStorage.setItem(re,JSON.stringify(Te))}catch{}G(Tt=>Tt+1)};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:a.jsxs(a.Fragment,{children:[a.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:[a.jsx("button",{type:"button",onClick:()=>Bi("activities"),className:`px-2 py-0.5 rounded ${Bn==="activities"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Task progress (current turn)","aria-label":"Task progress view",children:"activities"}),a.jsx("button",{type:"button",onClick:()=>Bi("map"),className:`px-2 py-0.5 rounded ${Bn==="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"}),a.jsx("button",{type:"button",onClick:()=>Bi("tools"),className:`px-2 py-0.5 rounded ${Bn==="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"}),a.jsxs("button",{type:"button",onClick:()=>Bi("canvas"),className:`px-2 py-0.5 rounded relative ${Bn==="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",fe.length>0?a.jsxs("span",{className:"ml-1 opacity-70",children:["(",fe.length,")"]}):null]}),a.jsx("button",{type:"button",onClick:()=>Bi("terminal"),className:`px-2 py-0.5 rounded ${Bn==="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"})]}),a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:Bn==="activities"?a.jsx(zq,{toolParts:Fs}):Bn==="map"?a.jsx(hV,{todos:O,darkMode:t,displayLayout:Tn,setLayoutField:Pr}):Bn==="tools"?a.jsx(EV,{graph:V[oe]||null,darkMode:t,displayLayout:Tn,setLayoutField:Pr}):Bn==="canvas"?a.jsx(uG,{canvases:fe,onClear:fe.length?Re:null}):a.jsx(Vq,{toolParts:za,matrixMode:R,onToggleMatrix:()=>T(Te=>!Te),darkMode:t})})]})}),a.jsx(NG,{messages:Vt,isBusy:Qi,isCompacting:Xi!=null,activeModel:Ye,sessionModel:Fe[oe]||null,isPrivateMode:J.has(oe),registryEntries:ke})]})}y.useEffect(()=>{ac(!1),ul(""),Da(0),dl(0),As(!1)},[oe]),y.useEffect(()=>{if(!oe)return;let O=!1;return UO(oe).then(Y=>{if(O||!Y)return;const re=oe;Y.privateMode&&F(le=>{if(le.has(re))return le;const fe=new Set(le);return fe.add(re),fe}),Array.isArray(Y.messageIds)&&Y.messageIds.length&&Q(le=>{let fe=!1;const Re=new Set(le);for(const Te of Y.messageIds)Re.has(Te)||(Re.add(Te),fe=!0);return fe?Re:le})}).catch(()=>{}),()=>{O=!0}},[oe]),y.useEffect(()=>{if(!oe){hl(!1);return}let O=!1;return a4(oe).then(Y=>{if(O)return;const re=Y&&Y.config?Y.config:{};hl(!!re.enabled)}).catch(()=>{}),()=>{O=!0}},[oe]),y.useEffect(()=>{if(!oe){Wt(!1);return}const O=pt.current[oe]||Ye;if(!O){Wt(!1);return}let Y=!1;return LO(O).then(re=>{Y||Wt(!!(re&&re.adaptiveQuality))}).catch(()=>{Y||Wt(!1)}),()=>{Y=!0}},[oe,Ye,Fe]),y.useEffect(()=>{Ui>0&&es>=Ui?Da(Ui-1):Ui===0&&es!==0&&Da(0)},[Ui,es]);const zt=y.useRef(oe);y.useEffect(()=>{zt.current=oe;const O=bi.current[oe];_o(O?O.length:0)},[oe]),y.useEffect(()=>{if(!oe)return;let O=!1;return ag(oe).then(Y=>{if(O)return;const re=Array.isArray(Y&&Y.items)?Y.items:[],le=oe;gr(fe=>{const Re={...fe};if(re.length===0)if(Re[le])delete Re[le];else return fe;else Re[le]=re;return Re})}).catch(Y=>{console.warn("[queue] hydrate failed for",oe,Y&&Y.message)}),()=>{O=!0}},[oe]);const pd=y.useRef(Bn);y.useEffect(()=>{pd.current=Bn},[Bn]);const bi=y.useRef({}),[Ls,_o]=y.useState(0),is=y.useRef(new Set),Pa=y.useCallback(O=>{if(O===zt.current){const Y=bi.current[O];_o(Y?Y.length:0)}},[]),hd=y.useCallback(O=>{if(!O)return;const Y=zt.current;if(!Y)return;const re=bi.current[Y];Array.isArray(re)&&re.length>0&&(bi.current[Y]=re.filter(le=>le.queuedTempId!==O)),Pt(le=>le.filter(fe=>fe.info.id!==O)),Pa(Y)},[Pa]),qi=!we||!!xt;y.useEffect(()=>{!ie&&qi&&(vi(),va(),Sw().then(O=>{yn(O)}).catch(O=>{console.error("Failed to fetch session status:",O)}))},[ie,qi]),y.useEffect(()=>{!ie&&qi&&(kw().then(O=>{O&&O.model&&_t(O.model),mt(!!(O&&O.inspector))}).catch(O=>{console.error("Failed to fetch config:",O)}),KL().then(O=>{O&&Array.isArray(O.providers)&&xe(O.providers)}).catch(O=>{console.error("Failed to fetch providers:",O)}),Mv().then(O=>{O&&Array.isArray(O.entries)&&Ae(O.entries)}).catch(O=>{console.error("Failed to fetch model registry:",O)}),Lv().then(O=>{O&&O.home&&oc(O.home)}).catch(O=>{console.error("Failed to fetch path info:",O)}))},[ie,qi]);const Fa=y.useCallback(()=>{XL().then(O=>{const Y=Array.isArray(O&&O.pending)?O.pending:[];ue(Y)}).catch(O=>{console.error("Failed to fetch pending permissions:",O)})},[]);y.useEffect(()=>{!ie&&qi&&Fa()},[ie,qi,Fa]),y.useEffect(()=>{const re=setInterval(()=>{ue(le=>{const fe=Date.now(),Re=le.filter(Te=>fe-(Te.timestamp||0)<3e5);return Re.length===le.length?le:Re})},3e4);return()=>clearInterval(re)},[]);const vi=y.useCallback(async O=>{try{const Y=O&&O.includeArchived||Pe.current,re=Oa.current||0,le=Math.max(er,re),fe=O&&typeof O.q=="string"?O.q:Za.current,Re=!!(fe&&fe.trim()),Te=Date.now(),Tt=await Pl({limit:le,offset:0,includeArchived:Re?!0:Y,includeOtherApps:!1,q:fe});if(Tt&&Tt.sessions){const Jt=Array.isArray(Tt.sessions)?Tt.sessions:[];Ne(dw({fetched:Jt,current:Ve.current,prependsSince:Te})),js(!!Tt.hasMore),Kr(typeof Tt.total=="number"?Tt.total:Jt.length),Ts(Jt.length),Oa.current=Jt.length}else{const Jt=Array.isArray(Tt)?Tt:[];Ne(dw({fetched:Jt,current:Ve.current,prependsSince:Te})),js(!1),Kr(Jt.length),Ts(Jt.length),Oa.current=Jt.length}}catch(Y){return console.error("Failed to load sessions:",Y),!1}return!0},[]);function wo(O,Y){var re=Y&&Y.time&&Y.time.updated||0,le=O&&O.time&&O.time.updated||0;return re-le}const as=200,So=y.useRef(as),[gd,vc]=y.useState(!1),[Eo,ss]=y.useState([]),md=200,[ea,os]=y.useState([]),kc=y.useMemo(()=>{if(!(Eo.length||ea.length))return st;const Y=Object.create(null),re=[],le=st.concat(Eo,ea);for(let fe=0;fe<le.length;fe++){const Re=le[fe];!Re||!Re.id||Y[Re.id]||(Y[Re.id]=!0,re.push(Re))}return re.sort(wo)},[st,Eo,ea]),_c=y.useCallback(async()=>{const O=Za.current,Y=!!(O&&O.trim());if(!Pe.current&&!Y){os([]);return}try{const re=await Pl({limit:md,offset:0,onlyArchived:!0,q:O}),le=re&&re.sessions?Array.isArray(re.sessions)?re.sessions:[]:Array.isArray(re)?re:[];os(le)}catch(re){console.error("Failed to load archived sessions:",re)}},[]),va=y.useCallback(async()=>{const O=Za.current,Y=!!(O&&O.trim());if(!Xa.current&&!Y){ss([]);return}try{const re=await Pl({limit:So.current,offset:0,onlyOtherApps:!0,includeArchived:Y?!0:Pe.current,q:O}),le=re&&re.sessions?Array.isArray(re.sessions)?re.sessions:[]:Array.isArray(re)?re:[];ss(le),vc(!!(re&&re.hasMore))}catch(re){console.warn("Failed to load other-app sessions:",re),ss([]),vc(!1)}},[]),No=y.useCallback(async()=>{So.current+=as,await va()},[va]);y.useEffect(()=>{function O(){oe&&DL(oe).then(function(Y){Y&&Y.sessionID&&(zt.current=Y.sessionID,bn(Y.sessionID),vi())}).catch(function(Y){console.error("Failed to create archive session:",Y);const re=(()=>{if(!Y)return!1;if(Y.status===404||Y.response&&Y.response.status===404)return!0;if(typeof Y.message=="string"){const le=Y.message.match(/^(\d{3})\s*:/);if(le&&parseInt(le[1],10)===404)return!0}return!1})();dt(e(re?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",O),()=>document.removeEventListener("navigateToArchiveSession",O)},[oe,vi,e,dt]);const Vp=async()=>{try{const O=Za.current,Y=!!(O&&O.trim()),re=await Pl({limit:er,offset:Zu,includeArchived:Y?!0:Pe.current,includeOtherApps:!1,q:O});if(re&&re.sessions){const le=Array.isArray(re.sessions)?re.sessions:[];Ne(fe=>{for(var Re={},Te=0;Te<fe.length;Te++)Re[fe[Te].id]=!0;for(var Tt=[],Jt=0;Jt<le.length;Jt++)Re[le[Jt].id]||Tt.push(le[Jt]);return fe.concat(Tt)}),js(!!re.hasMore),typeof re.total=="number"&&Kr(re.total),Ts(fe=>{var Re=fe+le.length;return Oa.current=Re,Re})}}catch(O){console.error("Failed to load more sessions:",O)}},Ci=async(O,Y)=>{try{const re=(Y?Y.fresh!==!1:!0)&&!xi.current,le=await xw(O,re,re?{limit:VR}:void 0),fe=le&&!Array.isArray(le)&&Array.isArray(le.messages),Re=fe?le.messages:le,Te=fe&&typeof le.compactedOutCount=="number"?le.compactedOutCount:0;return zt.current!==O?null:Array.isArray(Re)?(Pn(re?Te:0),re&&fe?(ni(le.hasMore===!0),lr(typeof le.nextCursor=="string"?le.nextCursor:null)):(ni(!1),lr(null)),Pt(Tt=>{const Jt=Re.some(De=>De.info.mode==="compaction"),mn=Array.isArray(Tt)&&Tt.some(De=>De.info&&De.info.mode==="compaction");if(Jt&&!mn)return Re;const En=new Set(Re.map(De=>De.info.id)),Cn=Re.reduce(function(De,Xe){return Xe&&Xe.info&&Xe.info.mode==="compaction"&&Xe.info.time&&typeof Xe.info.time.created=="number"?Math.max(De,Xe.info.time.created):De},-1/0),ye=Tt.filter(De=>De.info.sessionID===O&&!En.has(De.info.id)&&!String(De.info.id).startsWith("temp-")&&!(Cn!==-1/0&&De.info.time&&typeof De.info.time.created=="number"&&De.info.time.created<Cn));if(ye.length===0)return Re;const X=[];let pe=0,Ce=0;for(;pe<Re.length||Ce<ye.length;){const De=Re[pe],Xe=ye[Ce],ht=De&&De.info.time&&typeof De.info.time.created=="number"?De.info.time.created:1/0,Rt=Xe&&Xe.info.time&&typeof Xe.info.time.created=="number"?Xe.info.time.created:1/0;pe<Re.length&&(Ce>=ye.length||ht<=Rt)?(X.push(De),pe++):(X.push(Xe),Ce++)}return X}),Re):(Pt([]),null)}catch(re){return console.error("Failed to load messages:",re),zt.current===O&&(JQ(re)?(zt.current=null,bn(null),Ne(le=>jv(le,O)),ss(le=>jv(le,O)),os(le=>jv(le,O))):dt(eX(re))),null}},xd=y.useCallback(async O=>zt.current!==O?null:(xi.current=!0,Ci(O,{fresh:!1})),[Ci]),Kn=async O=>{if(zi||!Gr||!hr||xi.current||zt.current!==O)return null;mi(!0);try{const Y=await xw(O,!0,{limit:VR,before:hr});if(zt.current!==O)return null;if(!Y||Array.isArray(Y)||!Array.isArray(Y.messages))throw new Error("Invalid paged message response");return Pn(typeof Y.compactedOutCount=="number"?Y.compactedOutCount:0),ni(Y.hasMore===!0),lr(typeof Y.nextCursor=="string"?Y.nextCursor:null),Pt(re=>{const le=new Map;for(const fe of Y.messages.concat(re))fe&&fe.info&&fe.info.id&&le.set(fe.info.id,fe);return Array.from(le.values()).sort((fe,Re)=>{const Te=fe.info.time.created-Re.info.time.created;return Te!==0?Te:fe.info.id<Re.info.id?-1:fe.info.id>Re.info.id?1:0})}),Y.messages}catch(Y){return zt.current===O&&dt("Failed to load earlier messages: "+(Y&&Y.message?Y.message:String(Y))),null}finally{zt.current===O&&mi(!1)}};y.useEffect(()=>{if(!oe){Pt([]),Pn(0),ni(!1),lr(null),mi(!1),xi.current=!1,Hn({}),Bt(null),Ja(!0);return}Pt([]),Pn(0),ni(!1),lr(null),mi(!1),xi.current=!1,Bt(null),Ja(!1),Me(null),oe&&(Ew(oe).then(ye=>{ye&&Array.isArray(ye.banners)&&ya(X=>({...X,[oe]:ye.banners}))}).catch(()=>{}),sg(oe).then(ye=>{ye&&Array.isArray(ye.todos)&&Be(X=>({...X,[oe]:ye.todos}))}).catch(()=>{})),xn.connect(oe);let O=!1,Y=!1,re=!1,le=!1;const fe=oe,Re=ye=>{if(zt.current!==fe)return;const X=new Map;if(Array.isArray(ye))for(const pe of ye){if(!pe||!pe.info||!pe.info.id||!Array.isArray(pe.parts))continue;const Ce=new Set;for(const De of pe.parts)De&&(De.type==="text"||De.type==="reasoning")&&Ce.add(De.type);Ce.size>0&&X.set(pe.info.id,Ce)}Hn(pe=>{const Ce=pe[fe];if(!Ce||Object.keys(Ce).length===0)return pe;const De={};let Xe=!1;for(const ht of Object.keys(Ce)){const Rt=Ce[ht],bt={};let nn=!1;const Yn=X.get(ht);for(const ur of Object.keys(Rt)){const mr=Rt[ur];if(mr._fromSnapshot){bt[ur]=mr,nn=!0;continue}const Un=mr.type;if(Yn&&Yn.has(Un)){Xe=!0;continue}bt[ur]=Rt[ur],nn=!0}nn?De[ht]=bt:Xe=!0}if(!Xe)return pe;if(Object.keys(De).length===0){const ht={...pe};return delete ht[fe],ht}return{...pe,[fe]:De}})},Te=setTimeout(()=>{!O&&!Y&&(Y=!0,Ci(fe).then(ye=>{re=!0,Re(ye),le&&zt.current===fe&&Ci(fe).then(X=>{Re(X)})}))},3e3),Tt=80;function Jt(){si.current!=null&&(clearTimeout(si.current),si.current=null);const ye=Ji.current;ye&&(Ji.current=null,Hn(X=>{let pe=X;for(const Ce of Object.keys(ye)){const De=ye[Ce],Xe={...pe[Ce]||{}};for(const ht of Object.keys(De)){const Rt=De[ht],bt={...Xe[ht]||{}};for(const nn of Object.keys(Rt)){const Yn=Rt[nn],ur=bt[nn];Yn.type==="text"||Yn.type==="reasoning"?bt[nn]={...Yn,text:((ur==null?void 0:ur.text)||"")+(Yn.delta||"")}:bt[nn]={...ur,...Yn}}Xe[ht]=bt}pe={...pe,[Ce]:Xe}}return pe}))}function mn(){si.current==null&&(si.current=setTimeout(Jt,Tt))}function En(ye,X,pe){Ji.current||(Ji.current={});const Ce=Ji.current;Ce[X]||(Ce[X]={});const De=Ce[X];De[pe]||(De[pe]={});const Xe=De[pe],ht=Xe[ye.id];ye.type==="text"||ye.type==="reasoning"?Xe[ye.id]={...ye,delta:(ht&&ht.delta||"")+(ye.delta||"")}:Xe[ye.id]={...ht,...ye}}const Cn=[xn.on("connected",()=>{O=!0,clearTimeout(Te),Ja(!0),Fa(),Sw().then(ye=>{yn(ye)}).catch(()=>{}),ag(fe).then(ye=>{const X=Array.isArray(ye&&ye.items)?ye.items:[];gr(pe=>{const Ce={...pe};if(X.length===0)if(Ce[fe])delete Ce[fe];else return pe;else Ce[fe]=X;return Ce})}).catch(()=>{}),Ci(fe).then(ye=>{re=!0,Re(ye),le&&zt.current===fe&&Ci(fe).then(X=>{Re(X)})})}),xn.on("error",()=>{Ja(!1),!O&&!Y&&(clearTimeout(Te),Y=!0,Ci(fe).then(ye=>{re=!0,Re(ye),le&&zt.current===fe&&Ci(fe).then(X=>{Re(X)})}))}),xn.on("session.status",ye=>{var Ce;const X=ye.properties||ye,pe=((Ce=X.status)==null?void 0:Ce.type)==="busy";Nt(X.sessionID,pe)}),xn.on("message.part.delta",ye=>{const X=(ye.properties||ye).part;if(!X||!X.sessionID)return;ae.current.has(X.sessionID)&&ae.current.delete(X.sessionID);const{sessionID:pe,messageID:Ce}=X;En(X,pe,Ce),mn()}),xn.on("streaming.snapshot",ye=>{const X=ye.properties||ye,pe=X.sessionID,Ce=X.parts;!pe||!Array.isArray(Ce)||Hn(De=>{const Xe={...De[pe]||{}};for(const ht of Ce){const Rt={...Xe[ht.messageID]||{}};Rt[ht.id]={id:ht.id,type:ht.type,text:ht.text,sessionID:pe,messageID:ht.messageID,_fromSnapshot:!0},Xe[ht.messageID]=Rt}return{...De,[pe]:Xe}})}),xn.on("message.progress",ye=>{const X=ye.properties||ye;X.sessionID===zt.current&&Bt({chunks:X.chunks||0,textLength:X.textLength||0,toolCalls:X.toolCalls||0,toolArgBytes:X.toolArgBytes||0,toolNames:X.toolNames||[]})}),xn.on("message.part.updated",ye=>{const X=(ye.properties||ye).part;if(X){if(Jt(),X.type==="text"||X.type==="reasoning"){const pe=X.sessionID;Hn(Ce=>{const De=Ce[pe];if(!De)return Ce;const Xe=De[X.messageID];if(!Xe)return Ce;const ht={};var Rt=!1;for(const bt of Object.keys(Xe))Xe[bt].type!==X.type&&(ht[bt]=Xe[bt],Rt=!0);if(!Rt){const bt={...De};if(delete bt[X.messageID],Object.keys(bt).length===0){const nn={...Ce};return delete nn[pe],nn}return{...Ce,[pe]:bt}}return{...Ce,[pe]:{...De,[X.messageID]:ht}}})}if(X.sessionID===zt.current){if(!re){X.sessionID===fe&&(le=!0);return}(X.type==="tool"||X.type==="tool-use")&&pd.current==="tools"&&Nw(X.sessionID).then(pe=>{pe&&de(Ce=>({...Ce,[X.sessionID]:pe}))}).catch(()=>{}),Pt(pe=>pe.map(Ce=>{if(Ce.info.id!==X.messageID)return Ce;const De=Ce.parts.findIndex(Rt=>Rt.id===X.id);if(De>=0)return{...Ce,parts:Ce.parts.map((Rt,bt)=>bt===De?X:Rt)};const Xe=Ce.parts.slice();let ht=Xe.length;for(let Rt=Xe.length-1;Rt>=0;Rt--){if(Xe[Rt].id<=X.id){ht=Rt+1;break}Rt===0&&(ht=0)}return Xe.splice(ht,0,X),{...Ce,parts:Xe}}))}}}),xn.on("message.updated",ye=>{const X=(ye.properties||ye).info;if(!(!X||X.sessionID!==zt.current)){if(Jt(),!re){X.sessionID===fe&&(le=!0);return}if(Pt(pe=>{const Ce=pe.findIndex(bt=>bt.info.id===X.id);if(Ce>=0)return pe.map((bt,nn)=>nn===Ce?{...bt,info:X}:bt);if(X.role==="user"){const bt=pe.findIndex(nn=>nn.info.id&&nn.info.id.startsWith("temp-")&&nn.info.role==="user");if(bt>=0)return pe.map((nn,Yn)=>Yn===bt?{info:X,parts:[]}:nn)}const De={info:X,parts:[]};if(!X.time||typeof X.time.created!="number")return[...pe,De];const Xe=X.time.created;let ht=pe.length;for(let bt=pe.length-1;bt>=0;bt--){const nn=pe[bt].info.time;if(nn&&typeof nn.created=="number"&&nn.created<=Xe){ht=bt+1;break}bt===0&&(ht=0)}const Rt=pe.slice();return Rt.splice(ht,0,De),Rt}),X.compactedOut!==!0&&X.finish){const pe=X.sessionID;Hn(Ce=>{const De=Ce[pe];if(!De||!De[X.id])return Ce;const Xe={...De};if(delete Xe[X.id],Object.keys(Xe).length===0){const ht={...Ce};return delete ht[pe],ht}return{...Ce,[pe]:Xe}}),Bt(null),X.finish!=="compacted"&&Nt(pe,!1),Ci(zt.current)}}}),xn.on("message.deleted",ye=>{const X=ye.properties||ye,pe=X.sessionID,Ce=X.messageID;!pe||!Ce||pe===zt.current&&(Pt(De=>De.filter(Xe=>Xe.info.id!==Ce)),Hn(De=>{if(!De[pe])return De;const Xe=De[pe];if(!Xe[Ce])return De;const ht={...De},Rt={...Xe};return delete Rt[Ce],ht[pe]=Rt,ht}))}),xn.on("session.updated",ye=>{const X=ye.properties||ye,pe=X.info||X,Ce=pe&&(pe.id||pe.sessionID)||X.sessionID||X.id;if(!Ce){vi(),va();return}const De=pe&&pe.time&&typeof pe.time.updated=="number",Xe=ht=>{const bt=!Ve.current.some(Yn=>Yn&&Yn.id===Ce)&&Cv(ht),nn=bt?{...ht,prependedAt:Date.now()}:ht;bt&&(Ve.current=[nn].concat(Ve.current)),Ne(Yn=>{var ur=!1,mr=Yn.map(Un=>Un.id===Ce?(ur=!0,{...ht,ui:{...ht.ui,...Un.ui}}):Un);return!ur&&Cv(ht)&&(mr=[nn].concat(mr)),mr.sort(wo),mr}),os(Yn=>{var ur=!1,mr=Yn.map(Un=>Un.id!==Ce?Un:(ur=!0,{...ht,ui:{...ht.ui,...Un.ui}}));return ur?(mr=mr.filter(Un=>Un.archived),mr.sort(wo),mr):Yn}),Cv(ht)||ss(Yn=>{var ur=!1,mr=Yn.map(Un=>Un.id!==Ce?Un:(ur=!0,{...ht,ui:{...ht.ui,...Un.ui}}));return ur?(mr.sort(wo),mr):Yn})};De?(Xe(pe),yt(ht=>{let Rt=ht;const bt=pe.model;return typeof bt=="string"&&bt||bt&&typeof bt=="object"&&bt.providerID&&bt.modelID?Rt={...ht,[Ce]:bt}:ht[Ce]&&(Rt={...ht},delete Rt[Ce]),pt.current=Rt,Rt})):ig(Ce).then(ht=>{Xe(ht),yt(Rt=>{let bt=Rt;const nn=ht&&ht.model;return typeof nn=="string"&&nn||nn&&typeof nn=="object"&&nn.providerID&&nn.modelID?bt={...Rt,[Ce]:nn}:Rt[Ce]&&(bt={...Rt},delete bt[Ce]),pt.current=bt,bt})}).catch(ht=>{console.error("Failed to fetch updated session, falling back to full reload:",ht),vi()})}),xn.on("session.deleted",ye=>{const X=ye.properties||ye,pe=X.info||X,Ce=pe&&(pe.id||pe.sessionID)||X.sessionID||X.id;Ce&&(Ne(De=>De.filter(Xe=>Xe.id!==Ce)),ss(De=>De.filter(Xe=>Xe.id!==Ce)),os(De=>De.filter(Xe=>Xe.id!==Ce)),bn(De=>De===Ce?null:De))}),xn.on("permission.request",ye=>{const X=ye.properties||ye;X.requestId&&ue(pe=>pe.some(Ce=>Ce.id===X.requestId)?pe:[...pe,{id:X.requestId,action:X.action,type:X.type,target:X.target,reason:X.reason,description:X.description,timestamp:Date.now()}])}),xn.on("permission.confirmed",ye=>{const X=ye.properties||ye;X.requestId&&ue(pe=>pe.filter(Ce=>Ce.id!==X.requestId))}),xn.on("permission.denied",ye=>{const X=ye.properties||ye;X.requestId&&ue(pe=>pe.filter(Ce=>Ce.id!==X.requestId))}),xn.on("question.asked",ye=>{const X=ye.properties||ye;if(!X.id)return;const pe=X.tool&&X.tool.callID?X.tool.callID:null;if(pe&&Ue(Ce=>({...Ce,[pe]:{id:X.id,questions:X.questions}})),S1()){const Ce=X.questions&&X.questions[0],De=Ce?Ce.text:"A question needs your input.",Xe=X.sessionID||null;BK({title:"PAVE — Question",body:De.length>200?De.slice(0,200)+"…":De,tag:"pave-question-"+X.id,onClick:Xe?function(){Fr(Xe),window.focus()}:function(){window.focus()}})}}),xn.on("question.replied",ye=>{const X=ye.properties||ye;X.requestId&&Ue(pe=>{var Ce={};for(var De in pe)(!pe[De]||pe[De].id!==X.requestId)&&(Ce[De]=pe[De]);return Ce})}),xn.on("question.rejected",ye=>{const X=ye.properties||ye;X.requestId&&Ue(pe=>{var Ce={};for(var De in pe)(!pe[De]||pe[De].id!==X.requestId)&&(Ce[De]=pe[De]);return Ce})}),xn.on("quality.hint",ye=>{const X=ye.properties||ye;if(!X.preset)return;const pe=X.sessionID;pe&&(qp(Ce=>({...Ce,[pe]:X})),fc.current[pe]=X)}),xn.on("dlp.cancelled",ye=>{const pe=(ye.properties||ye).sessionID;if(!pe)return;const Ce=ae.current.get(pe);Ce&&(Ce.tempId&&Pt(De=>De.filter(Xe=>Xe.info.id!==Ce.tempId)),pe===zt.current&&q.current&&typeof q.current.setText=="function"&&q.current.setText(Ce.text||""),ae.current.delete(pe)),Nt(pe,!1)}),xn.on("dlp.private_message",ye=>{const X=ye.properties||ye,pe=X.sessionID,Ce=X.messageID;!pe||!Ce||(Q(De=>{if(De.has(Ce))return De;const Xe=new Set(De);return Xe.add(Ce),Xe}),F(De=>{if(De.has(pe))return De;const Xe=new Set(De);return Xe.add(pe),Xe}))}),xn.on("dlp.exited_private",ye=>{const pe=(ye.properties||ye).sessionID;pe&&F(Ce=>{if(!Ce.has(pe))return Ce;const De=new Set(Ce);return De.delete(pe),De})}),xn.on("session.error",ye=>{const X=ye.properties||ye;if(X.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",X.source||""),dt("Session expired. Please log in again."),et(null),X.sessionID&&Nt(X.sessionID,!1);return}X.sessionID&&Nt(X.sessionID,!1),X.sessionID===zt.current&&(X.code==="insufficient_credits"?(dt(null),ba(X.upgradeUrl||null),cr(!0)):dt(X.error||"An error occurred"))}),xn.on("session.retry",ye=>{const X=ye.properties||ye;X.reason==="rate_limit"&&X.sessionID===zt.current&&(Ar({attempt:X.attempt,maxRetries:X.maxRetries,delayMs:X.delayMs,elapsedMs:X.elapsedMs||0,maxDurationMs:X.maxDurationMs||0}),kn.current&&clearTimeout(kn.current),kn.current=setTimeout(()=>Ar(null),1e4))}),xn.on("session.compacting",ye=>{const X=ye.properties||ye;X.sessionID===zt.current&&ln(pe=>({...pe,currentTokens:X.currentTokens??(pe==null?void 0:pe.currentTokens),threshold:X.threshold??(pe==null?void 0:pe.threshold),reason:X.reason??(pe==null?void 0:pe.reason),stage:X.stage??(pe==null?void 0:pe.stage),elapsedMs:X.elapsedMs??(pe==null?void 0:pe.elapsedMs),messageCount:X.messageCount??(pe==null?void 0:pe.messageCount),chunks:X.chunks??(pe==null?void 0:pe.chunks),textLength:X.textLength??(pe==null?void 0:pe.textLength)}))}),xn.on("session.compacted",ye=>{const X=ye.properties||ye,pe=zt.current;if(X.sessionID===pe){if(ln(null),ai(null),X.newSessionID&&X.newSessionID!==pe&&!X.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${pe} → ${X.newSessionID}`),X.newSession){Os(X.newSession);const Xe=X.newSession.model;(typeof Xe=="string"&&Xe||Xe&&typeof Xe=="object"&&Xe.providerID&&Xe.modelID)&&yt(Rt=>{const bt={...Rt,[X.newSessionID]:Xe};return pt.current=bt,bt})}zt.current=X.newSessionID,bn(X.newSessionID),ma(!0);return}if(X.source==="server"){const Xe=X.summary?X.summary.substring(0,200)+(X.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${X.deletedMessages} messages replaced, ${X.summaryTokens||"?"} summary tokens`),Xe&&console.log("[SERVER-COMPACT] Summary: "+Xe),ai({source:"server",deletedMessages:X.deletedMessages||0,summaryTokens:X.summaryTokens||0,summary:Xe})}const Ce=X.inPlace===!0,De=!!ri.current[pe];Ce&&De?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(Pt([]),Hn(Xe=>{if(!Xe[pe])return Xe;const ht={...Xe};return delete ht[pe],ht}),Bt(null),Ci(pe).then(()=>{requestAnimationFrame(()=>{ze.current&&zt.current===pe&&ze.current.scrollToBottom()})}))}}),xn.on("banner.updated",ye=>{const X=ye.properties||ye;!X||!X.sessionID||(ya(pe=>{const Ce=pe[X.sessionID]||[];if(Ce.some(Xe=>Xe.timestamp===X.timestamp))return pe;const De=[{url:X.url,timestamp:X.timestamp,prompt:X.prompt,createdAt:new Date(X.timestamp).toISOString()},...Ce];return{...pe,[X.sessionID]:De}}),X.sessionID===zt.current&&Me(null))}),xn.on("banner.progress",ye=>{const X=ye.properties||ye;if(!X||X.sessionID!==zt.current)return;const pe=X.stage||"working";let Ce=pe;pe==="queued"?Ce="Banner queued":pe==="summarizing"?Ce="Banner: summarizing…":pe==="rendering"?Ce=X.line?"Banner: "+X.line.substring(0,80):"Banner: rendering…":pe==="saved"?Ce="Banner saved":pe==="error"?Ce="Banner error: "+(X.message||"unknown"):pe==="skipped"&&(Ce="Banner skipped: "+(X.reason||"")),Me({stage:pe,label:Ce,ts:Date.now()}),pe==="saved"&&X.sessionID&&Ew(X.sessionID).then(De=>{De&&Array.isArray(De.banners)&&ya(Xe=>({...Xe,[X.sessionID]:De.banners}))}).catch(()=>{})}),xn.on("todo.updated",ye=>{const X=ye.properties||ye;!X||!X.sessionID||(Array.isArray(X.todos)?Be(pe=>({...pe,[X.sessionID]:X.todos})):sg(X.sessionID).then(pe=>{pe&&Array.isArray(pe.todos)&&Be(Ce=>({...Ce,[X.sessionID]:pe.todos}))}).catch(()=>{}))}),xn.on("queue.updated",ye=>{const X=ye.properties||ye;if(!X||!X.sessionID)return;const pe=Array.isArray(X.items)?X.items:[];gr(Ce=>tX(Ce,X.sessionID,pe)),X.change&&X.change.kind==="drain"&&X.sessionID===zt.current&&ze.current&&(ze.current.resetAutoScroll(),Qe())}),xn.on("idle-injection.enabled",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||(hl(!0),bo(e("chat.idle_injection_enabled_toast"),"success"))}),xn.on("idle-injection.disabled",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||(hl(!1),bo(e("chat.idle_injection_disabled_toast"),"info"))}),xn.on("idle-injection.fired",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||bo(e("chat.idle_injection_fired_toast"),"success")}),xn.on("idle-injection.timeout",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||bo(e("chat.idle_injection_timeout_toast"),"warning")}),xn.on("scheduled-injection.fired",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||bo(e("scheduled_injection.fired_toast"),"success")}),xn.on("scheduled-injection.added",()=>{}),xn.on("scheduled-injection.removed",()=>{}),xn.on("prefill.fallback",ye=>{const X=ye.properties||ye;!X||X.sessionID!==fe||(at({originalModel:X.originalModel,fallbackModel:X.fallbackModel,reason:X.reason||"prefill_too_large"}),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>{at(null),gt.current=null},15e3))}),xn.on("auth.device_code",ye=>{const X=ye.properties||ye;X.user_code&&X.verification_uri&&Zi({verification_uri:X.verification_uri,user_code:X.user_code,expires_in:X.expires_in||300})})];return()=>{clearTimeout(Te),si.current!=null&&(clearTimeout(si.current),si.current=null),Jt(),Ji.current=null,ts.current&&clearTimeout(ts.current),gt.current&&(clearTimeout(gt.current),gt.current=null),at(null),Cn.forEach(ye=>ye()),xn.disconnect()}},[oe]),y.useEffect(()=>{if(!oe)return;const O=setTimeout(()=>{var Y;(Y=q.current)==null||Y.focus()},50);return()=>{clearTimeout(O)}},[oe]);function Os(O){Ne(Y=>{for(var re=0;re<Y.length;re++)if(Y[re].id===O.id)return Y.map(le=>le.id===O.id?O:le);return[O,...Y]})}const Ds=y.useCallback(async()=>{try{const O=await mw();Os(O),zt.current=O.id,bn(O.id)}catch(O){dt("Failed to create session: "+O.message)}},[]);H.current=Ds;const Fr=y.useCallback(async O=>{var Y;if(O!==zt.current){zt.current=O,bn(O),dt(null),ma(!!ri.current[O]),ln(null);try{const re=await ig(O);if(zt.current!==O)return;((Y=re==null?void 0:re.status)==null?void 0:Y.type)==="busy"&&ma(!0),Ne(le=>{var Jt;if(!re)return le;const fe=le.findIndex(mn=>mn.id===O),Re=((Jt=re.time)==null?void 0:Jt.updated)||0;if(fe>=0){const mn=le[fe],En=le.filter(X=>X.id!==O),Cn={...re,ui:{...re.ui,...mn.ui}},ye=En.findIndex(X=>{var pe;return(((pe=X.time)==null?void 0:pe.updated)||0)<=Re});return En.splice(ye<0?En.length:ye,0,Cn),En}const Te=le.findIndex(mn=>{var En;return(((En=mn.time)==null?void 0:En.updated)||0)<=Re}),Tt=[...le];return Tt.splice(Te<0?Tt.length:Te,0,re),Tt}),yt(le=>{if(re&&re.model)return{...le,[O]:re.model};if(le[O]){const fe={...le};return delete fe[O],fe}return le})}catch(re){console.error("Failed to fetch session status for session",O,re)}}},[]),yd=y.useCallback(async O=>{try{await OL(O),dL(O),Ne(Y=>Y.filter(re=>re.id!==O)),oe===O&&(zt.current=null,bn(null))}catch(Y){dt("Failed to delete: "+Y.message)}},[oe]),wc=y.useCallback(async()=>{try{await PL(),await vi(),await va(),zt.current=null,bn(O=>O&&null)}catch(O){dt("Failed to delete sessions: "+O.message)}},[vi]),Co=y.useCallback(async(O,Y)=>{try{await Li(O,{title:Y}),Ne(re=>re.map(le=>le.id===O?{...le,title:Y}:le))}catch(re){dt("Failed to rename: "+re.message)}},[]),ml=y.useCallback(async O=>{try{const Y=await IL(O);Y&&Y.title&&Ne(re=>re.map(le=>le.id===O?{...le,title:Y.title}:le))}catch(Y){dt("Failed to regenerate title: "+Y.message)}},[]),[ls,Sc]=y.useState(null),Gp=y.useCallback(O=>{Sc(O)},[]),Kp=y.useCallback(async(O,Y)=>{try{await Li(O,{pinned:Y}),Ne(re=>re.map(le=>le.id===O?{...le,pinned:Y}:le))}catch(re){dt("Failed to pin: "+re.message)}},[]),bd=y.useCallback(async O=>{const Y=st.find(le=>le.id===O);if(!Y||!Y.parentSessionID)return;const re=Y.parentSessionID;try{await zL(O),Ne(le=>le.map(fe=>fe.id===O?{...fe,compactionPinned:!1}:fe)),zt.current=re,bn(re)}catch(le){dt("Failed to unpin: "+le.message)}},[st]),xl=y.useCallback(async(O,Y)=>{try{await Li(O,{archived:Y}),!Pe.current&&Y?(Ne(re=>re.filter(le=>le.id!==O)),oe===O&&(zt.current=null,bn(null))):Ne(re=>re.map(le=>le.id===O?{...le,archived:Y}:le))}catch(re){dt("Failed to archive: "+re.message)}},[oe]),yl=y.useCallback(async({readOnly:O=!1}={})=>{if(!oe)return;let Y,re,le;if(Ne(fe=>{var Te;const Re=fe.find(Tt=>Tt.id===oe);return Y=((Te=Re==null?void 0:Re.ui)==null?void 0:Te.hideThinking)??!1,re=!Y,le=Re==null?void 0:Re.ui,fe.map(Tt=>Tt.id===oe?{...Tt,ui:{...Tt.ui,hideThinking:re}}:Tt)}),!O)try{await Li(oe,{ui:{...le,hideThinking:re}})}catch(fe){console.error("Failed to persist hideThinking:",fe),Ne(Re=>Re.map(Te=>Te.id===oe?{...Te,ui:{...Te.ui,hideThinking:Y}}:Te)),dt("Failed to save thinking visibility preference"+(fe!=null&&fe.message?": "+fe.message:""))}},[oe]),Ec=y.useCallback(async()=>{if(!oe)return;let O,Y;Ne(re=>{var fe;const le=re.find(Re=>Re.id===oe);return O=((fe=le==null?void 0:le.ui)==null?void 0:fe.chatInput)==="hidden",Y=le==null?void 0:le.ui,re.map(Re=>Re.id===oe?{...Re,ui:{...Re.ui,chatInput:O?void 0:"hidden"}}:Re)});try{const re={...Y};O?delete re.chatInput:re.chatInput="hidden",await Li(oe,{ui:re})}catch(re){console.error("Failed to persist chatInput:",re),Ne(le=>le.map(fe=>fe.id===oe?{...fe,ui:{...fe.ui,chatInput:O?"hidden":void 0}}:fe)),dt("Failed to save chat input visibility"+(re!=null&&re.message?": "+re.message:""))}},[oe]),bl=y.useCallback(async O=>{try{await PO(O)}catch(Y){dt("Export failed: "+Y.message)}},[]),jo=y.useCallback(async O=>{try{const Y=await FO(O);Y&&Y.id&&(await vi(),Fr(Y.id))}catch(Y){dt("Import failed: "+Y.message)}},[vi,Fr]),vl=y.useRef(!1);y.useEffect(()=>{if(!vl.current&&!(!qi||st.length===0)){vl.current=!0;var O=null,Y=!1;try{var re=new URLSearchParams(window.location.search);O=re.get("session"),Y=!!O}catch{}if(O||(O=$()),!!O){if(st.some(function(le){return le.id===O})){Fr(O);return}ig(O).then(function(le){le&&le.id?Fr(O):Y||U()}).catch(function(){Y||U()})}}},[qi,st,Fr]),y.useEffect(()=>{function O(Y){var re=Y.data;!re||re.type!=="navigate-session"||re.sessionId&&Fr(re.sessionId)}return window.addEventListener("message",O),function(){window.removeEventListener("message",O)}},[Fr]),y.useEffect(()=>{function O(){try{var re=indexedDB.open("pave-sw",1);re.onupgradeneeded=function(){re.result.createObjectStore("pave-pending-nav")},re.onsuccess=function(){var le=re.result;if(!le.objectStoreNames.contains("pave-pending-nav")){le.close();return}var fe=le.transaction("pave-pending-nav","readwrite"),Re=fe.objectStore("pave-pending-nav"),Te=Re.get("sessionId");Te.onsuccess=function(){var Tt=Te.result;Re.delete("sessionId"),Tt&&Tt!==zt.current&&Fr(Tt)},fe.oncomplete=function(){le.close()},fe.onerror=function(){le.close()}},re.onerror=function(){}}catch{}}function Y(){document.visibilityState==="visible"&&(O(),setTimeout(O,500),setTimeout(O,1500))}return document.addEventListener("visibilitychange",Y),function(){document.removeEventListener("visibilitychange",Y)}},[Fr]);const Yp=y.useCallback(async O=>{if(!oe)return;const Y=Ht.current,re=(Y[oe]||0)+1;Y[oe]=re;const le=pt.current[oe];yt(fe=>{const Re={...fe};return O?Re[oe]=O:delete Re[oe],pt.current=Re,Re});try{const fe=await Li(oe,{model:O||null});if(Y[oe]!==re)return;fe&&(typeof fe.model=="string"&&fe.model||fe.model&&typeof fe.model=="object"&&fe.model.providerID&&fe.model.modelID)?yt(Re=>{const Te={...Re,[oe]:fe.model};return pt.current=Te,Te}):O||yt(Re=>{const Te={...Re};return delete Te[oe],pt.current=Te,Te})}catch(fe){if(Y[oe]!==re)return;yt(Re=>{const Te={...Re};return le!==void 0?Te[oe]=le:delete Te[oe],pt.current=Te,Te}),console.error("[ModelChange] PATCH failed for session",oe,fe),dt("Failed to update session model: "+fe.message)}},[oe]),vd=y.useCallback(async function(O,Y){if(oe){var re=Gt&&Gt.disabledSkills||[],le;Y?le=re.filter(function(fe){return fe!==O}):le=re.concat([O]),Ne(function(fe){return fe.map(function(Re){return Re.id===oe?{...Re,disabledSkills:le}:Re})});try{await Li(oe,{disabledSkills:le})}catch(fe){Ne(function(Re){return Re.map(function(Te){return Te.id===oe?{...Te,disabledSkills:re}:Te})}),console.error("[SkillToggle] PATCH failed:",fe)}}},[oe,Gt]),Qp=y.useCallback(async function(){if(oe)try{var O=await o4(),Y=O.skillDefaults||{},re=await yk(),le=[];(re||[]).forEach(function(fe){Y[fe.name]||le.push(fe.name)}),Ne(function(fe){return fe.map(function(Re){return Re.id===oe?{...Re,disabledSkills:le}:Re})}),await Li(oe,{disabledSkills:le})}catch(fe){console.error("[SkillToggle] Reset to defaults failed:",fe)}},[oe]),Xp=y.useCallback(O=>{Ne(Y=>Y.map(re=>re.id===oe?{...re,directory:O}:re)),sc(!1)},[oe]),Nc=y.useCallback(async()=>{const O=!Xa.current;Xa.current=O,So.current=as,rc(O);try{localStorage.setItem("pave-show-other-apps",O?"true":"false")}catch{}await va()},[]),ji=y.useRef(null),kd=y.useCallback(O=>{const Y=typeof O=="string"?O:"";ic(Y),Za.current=Y,ji.current&&clearTimeout(ji.current),ji.current=setTimeout(()=>{Oa.current=0,So.current=as,vi({q:Y}),va(),_c()},250)},[]);y.useEffect(()=>()=>{ji.current&&clearTimeout(ji.current)},[]);const Ps=y.useCallback(async()=>{const O=!Pe.current;Pe.current=O,await vi({includeArchived:O})?(Dt(O),await Promise.all([_c(),va()])):Pe.current=!O},[_c,va]),li=y.useCallback(async(O,Y,re,le,fe,Re,Te)=>{const Tt=O===zt.current;Re&&Tt&&Pt(Rn=>Rn.filter(Hi=>Hi.info.id!==Re));var Jt=(re?re.length:0)+(Te?Te.length:0);if(Jt>Gf)throw dt("Too many attachments. Maximum "+Gf+" per message."),new Error("Too many attachments");var mn=[],En=0;if(re&&re.length>0){for(var Cn=0;Cn<re.length;Cn++){var ye=(re[Cn].file.type||"").toLowerCase();if(hp.indexOf(ye)===-1)throw dt('Unsupported image type: "'+re[Cn].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(re[Cn].file.size>tS){var X=Math.round(re[Cn].file.size/1024/1024*10)/10,pe=Math.round(tS/1024/1024*10)/10;throw dt('Image "'+re[Cn].name+'" ('+X+"MB) exceeds the "+pe+"MB size limit."),new Error("Image too large")}En+=re[Cn].file.size}if(En>iS){var Ce=Math.round(En/1024/1024*10)/10,De=Math.round(iS/1024/1024*10)/10;throw dt("Combined image size ("+Ce+"MB) exceeds the "+De+"MB total image limit."),new Error("Combined image size too large")}try{mn=await Promise.all(re.map(function(Rn){return new Promise(function(Hi,vr){var Er=new FileReader;Er.onload=function(){if(typeof Er.result!="string"){vr(new Error("FileReader did not produce a data URL for: "+Rn.name));return}Hi({type:"image_url",image_url:{url:Er.result}})},Er.onerror=function(){vr(new Error("Failed to read file: "+Rn.name))},Er.readAsDataURL(Rn.file)})}))}catch(Rn){throw dt("Failed to read image: "+Rn.message),Rn}}var Xe=[],ht=0;if(Te&&Te.length>0){for(var Rt=0;Rt<Te.length;Rt++){var bt=(Te[Rt].file.type||"").toLowerCase();if(R5.indexOf(bt)===-1)throw dt('Unsupported file type: "'+Te[Rt].name+'" ('+(bt||"unknown")+")."),new Error("Unsupported file type");if(Te[Rt].file.size>nS){var nn=Math.round(Te[Rt].file.size/1024/1024*10)/10,Yn=Math.round(nS/1024/1024*10)/10;throw dt('File "'+Te[Rt].name+'" ('+nn+"MB) exceeds the "+Yn+"MB size limit."),new Error("File too large")}ht+=Te[Rt].file.size}if(En+ht>rS){var ur=Math.round((En+ht)/1024/1024*10)/10,mr=Math.round(rS/1024/1024*10)/10;throw dt("Combined attachment size ("+ur+"MB) exceeds the "+mr+"MB total limit."),new Error("Combined attachment size too large")}try{Xe=await Promise.all(Te.map(function(Rn){return new Promise(function(Hi,vr){var Er=new FileReader;Er.onload=function(){if(typeof Er.result!="string"){vr(new Error("FileReader did not produce a data URL for: "+Rn.name));return}Hi({type:"file",mime:Rn.file.type,filename:Rn.name,url:Er.result})},Er.onerror=function(){vr(new Error("Failed to read file: "+Rn.name))},Er.readAsDataURL(Rn.file)})}))}catch(Rn){throw dt("Failed to read file: "+Rn.message),Rn}}const Un="temp-"+Date.now();for(var kl=[{id:Un+"-text",type:"text",text:fe}],ps=0;ps<mn.length;ps++)kl.push({id:Un+"-img-"+ps,type:"image_url",image_url:mn[ps].image_url});for(var Us=0;Us<Xe.length;Us++)kl.push({id:Un+"-file-"+Us,type:"file",mime:Xe[Us].mime,filename:Xe[Us].filename});const qs={info:{id:Un,sessionID:O,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:kl};Pt(Rn=>Tt?[...Rn,qs]:Rn),Tt&&ze.current&&(ze.current.resetAutoScroll(),Qe()),Nt(O,!0),ae.current.set(O,{text:fe,tempId:Un});const _l=uc.current[O]??null,_d=mo.current[O]??"max",hs=_l===null&&!yo.current.has(O),Mo=fc.current[O],Tc=hs&&Mo?Mo.moe_topk||null:_l;try{var Rc=null;(mn.length>0||Xe.length>0)&&(Rc=Xe.concat(mn)),await yw(O,Y,Rc,pt.current[O]||void 0,le,{moeTopK:Tc,reasoningEffort:_d,adaptiveQuality:hs})}catch(Rn){if(nX(Rn))if(WR(mn,Xe)){const vr=Un;bi.current[O]||(bi.current[O]=[]),bi.current[O].push({content:Y,imageAttachments:re,fileAttachments:Te,agent:le,displayContent:fe,queuedTempId:vr}),Pa(O),Nt(O,!1);return}else try{await bw(O,Y,{displayContent:fe,agent:le||void 0,model:pt.current[O]||void 0,moeTopK:Tc,reasoningEffort:_d,adaptiveQuality:hs}),Pt(vr=>vr.filter(Er=>Er.info.id!==Un)),Nt(O,!1);return}catch(vr){throw dt("Failed to queue message: "+vr.message),Nt(O,!1),Pt(Er=>Er.filter(Hs=>Hs.info.id!==Un)),vr}if(Rn&&Rn.reauthRequired){dt("Session expired. Please log in again."),et(null),Nt(O,!1),Pt(Hi=>Hi.filter(vr=>vr.info.id!==Un));return}throw dt("Failed to send: "+Rn.message),Nt(O,!1),Pt(Hi=>Hi.filter(vr=>vr.info.id!==Un)),Rn}},[Pa,Qe]),cs=y.useRef(li);y.useEffect(()=>{cs.current=li},[li]);const Ir=y.useCallback(async(O,Y,re,le)=>{dt(null),tr.length>0&&(O=CU(tr,O));const fe=O,Re=O.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Re){const Cn=Re[1],ye=Re[2],X=Re[3]||"",pe=X||Cn+" "+ye,Ce=(Cn+"_"+ye).replace(/-/g,"_").slice(0,128);O="[SKILL_HINT: User explicitly requested "+Cn+"."+ye+(X?" with args: "+X:"")+". Call the "+Ce+` tool with these parameters.]
|
|
131
|
+
|
|
132
|
+
`+pe}let Te=zt.current;if(!Te)try{const Cn=await mw();Os(Cn),zt.current=Cn.id,bn(Cn.id),Te=Cn.id,await new Promise(ye=>setTimeout(ye,200))}catch(Cn){throw dt("Failed to create session: "+Cn.message),Cn}if(!!yi[Te]){if(!WR(Y,le)){try{await bw(Te,O,{displayContent:fe,agent:re||void 0,model:pt.current[Te]||void 0})}catch(Ce){dt("Failed to queue message: "+Ce.message)}return}const ye="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),X=[{id:ye+"-text",type:"text",text:fe}];if(Y&&Y.length>0)for(var Jt=0;Jt<Y.length;Jt++){var mn=Y[Jt].preview||"";X.push({id:ye+"-img-"+Jt,type:"image_url",image_url:{url:mn}})}if(le&&le.length>0)for(var En=0;En<le.length;En++)X.push({id:ye+"-file-"+En,type:"file",mime:le[En].file.type,filename:le[En].name});const pe={info:{id:ye,sessionID:Te,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:X};Pt(Ce=>[...Ce,pe]),Te===zt.current&&ze.current&&(ze.current.resetAutoScroll(),Qe()),bi.current[Te]||(bi.current[Te]=[]),bi.current[Te].push({content:O,imageAttachments:Y,agent:re,displayContent:fe,queuedTempId:ye,fileAttachments:le}),Pa(Te),Le([]);return}await li(Te,O,Y,re,fe,null,le),Le([])},[yi,li,Pa,Qe,tr]);y.useEffect(()=>{const O=()=>{Ir(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",O),()=>window.removeEventListener("pave:plan-execute",O)},[Ir,e]);const Cc=y.useCallback(async()=>{if(oe)try{const O=oe;is.current.add(O),await UL(O),Nt(O,!1),Bt(null)}catch(O){console.error("Abort failed:",O),dt("Failed to stop: "+(O&&O.message?O.message:String(O)))}},[oe,Nt]),Zp=y.useCallback(async(O,Y,re)=>{if(dt(null),O==="btw"){const le=zt.current;if(!le){dt("No active session to fork.");return}let fe;try{fe=await LL(le)}catch(Te){throw dt("Fork failed: "+(Te&&Te.message?Te.message:String(Te))),Te}if(!fe||!fe.id)throw dt("Fork failed: server returned no session id."),new Error("Fork returned no session");Os(fe),zt.current=fe.id,bn(fe.id),await new Promise(Te=>setTimeout(Te,200));const Re=(Y||"").trim();if(Re)try{await Ir(Re,re&&re.imageAttachments?re.imageAttachments:void 0,void 0,re&&re.fileAttachments?re.fileAttachments:void 0)}catch{}return}if(O==="compact"){const le=zt.current;if(!le){dt("No active session to compact.");return}dt(null),ln({reason:"manual",stage:"starting"}),ai(null),BL(le).then(fe=>{if(!fe||!fe.success){ln(null),dt("Compaction failed: "+(fe&&fe.error||"unknown error"));return}Ci(le),ln(null),ai(null)}).catch(fe=>{ln(null),fe&&fe.status===409?dt("Cannot compact while the session is busy. Wait for the current response to finish."):dt("Compaction failed: "+(fe&&fe.message?fe.message:String(fe)))});return}dt("Unknown built-in command: /"+O)},[Ir]),Jp=y.useCallback(O=>{ue(Y=>Y.filter(re=>re.id!==O))},[]),us=y.useCallback(async()=>{for(var O=Vt.length-1;O>=0;O--)if(Vt[O].info.role==="user"){var Y=Vt[O].parts||[],re=n1(Y,null),le=Y.filter(function(Te){return Te.type==="image_url"&&Te.image_url});if(re.trim()||le.length>0)if(le.length>0){var fe=oe;if(!fe)break;Nt(fe,!0),dt(null);try{var Re=le.map(function(Te){return{type:"image_url",image_url:Te.image_url}});await yw(fe,re.trim(),Re,pt.current[fe]||void 0)}catch(Te){dt("Failed to retry: "+Te.message),Nt(fe,!1)}}else try{await Ir(re.trim())}catch(Te){dt("Failed to retry: "+Te.message),Nt(oe,!1)}break}},[Vt,Ir,oe]),To=y.useCallback(async function(O){if(O&&O.trim()){dt(null),ze.current&&ze.current.resetAutoScroll();try{await Ir(O.trim()),Qe()}catch(Y){dt("Failed to resend: "+Y.message),Nt(oe,!1)}}},[Ir,Qe]),Br=y.useMemo(()=>Gt?Gt.source==="archive"||Gt._readOnly===!0:!1,[Gt]),Ba=y.useMemo(()=>Gt?Gt._readOnly===!0&&Gt.source!=="tui"&&Gt.source!=="archive":!1,[Gt]),Ro=y.useMemo(()=>{if(!Ba||!Gt||!st)return null;for(const O of st)if(O.parentSessionID===Gt.id)return O.id;return null},[Ba,Gt,st]),Fs=y.useMemo(()=>{var re;let O=null;for(let le=Vt.length-1;le>=0;le--)if(((re=Vt[le].info)==null?void 0:re.role)==="assistant"){O=Vt[le];break}if(!O)return[];const Y=(O.parts||[]).filter(le=>le.type==="tool");return Y.length===0?[]:!Qi&&Y.every(fe=>{var Re,Te;return((Re=fe.state)==null?void 0:Re.status)==="completed"||((Te=fe.state)==null?void 0:Te.status)==="error"})?[]:Y},[Vt,Qi]),za=y.useMemo(()=>{var Y;const O=[];for(const re of Vt)if(((Y=re.info)==null?void 0:Y.role)==="assistant"){const le=(re.parts||[]).filter(fe=>fe.type==="tool");O.push(...le)}return O},[Vt]),Mn=y.useRef(0),[Wn,ta]=y.useState(!1),zr=y.useCallback(O=>{if(O.preventDefault(),O.stopPropagation(),Mn.current++,Mn.current===1){const Y=O.dataTransfer;let re=!1;Y&&Y.items&&Y.items.length>0&&(re=Array.from(Y.items).some(le=>le.kind==="file")),re&&ta(!0)}},[]),ci=y.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Mn.current=Math.max(0,Mn.current-1),Mn.current===0&&ta(!1)},[]),ds=y.useCallback(O=>{O.preventDefault(),O.stopPropagation()},[]),Bs=y.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Mn.current=0,ta(!1);const Y=O.dataTransfer&&O.dataTransfer.files;if(!Y||Y.length===0)return;const re=Y[0],le=re.name.toLowerCase();if(!le.endsWith(".yaml")&&!le.endsWith(".yml")){dt(e("import.invalid_file_type"));return}const fe=10*1024*1024;if(re.size>fe){dt(e("import.file_too_large"));return}const Re=new FileReader;Re.onload=Te=>{const Tt=Te&&Te.target?Te.target.result:null;if(typeof Tt!="string"){dt(e("import.read_error"));return}jo(Tt)},Re.onerror=()=>{dt(e("import.read_error"))},Re.readAsText(re)},[jo,dt,e]);if(ie)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:a.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!xt)return a.jsx(Fq,{darkMode:t,onToggleTheme:()=>n(!t)});const Yr=Gt==null?void 0:Gt.title,fs=typeof Yr=="string"?Yr.trim():"",zs=((Io=Gt==null?void 0:Gt.ui)==null?void 0:Io.hideThinking)??!1,Ao=((jc=Gt==null?void 0:Gt.ui)==null?void 0:jc.chatInput)==="hidden";return a.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:zr,onDragLeave:ci,onDragOver:ds,onDrop:Bs,children:[Wn&&a.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:a.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:a.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),a.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:[a.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("img",{src:yr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-8"}),a.jsx("h1",{className:"sr-only",children:"PAVE"}),vt&&a.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",vt]})]}),a.jsx("button",{type:"button",onClick:()=>Ee(O=>!O),className:"md:hidden 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:e(te?"sidebar.hide":"sidebar.show"),"aria-label":e(te?"sidebar.hide":"sidebar.show"),"aria-expanded":te,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}),je==="chat"&&oe&&a.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:Gt&&Gt.title||e("sidebar.untitled"),children:Gt&&Gt.title||e("sidebar.untitled")}),a.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[a.jsx("button",{onClick:()=>Oe("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${je==="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")}),a.jsx("button",{onClick:()=>Oe("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${je==="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")}),a.jsx("button",{onClick:()=>Oe("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${je==="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")}),Is&&a.jsx("button",{"data-testid":"nav-triggers-tab",onClick:()=>Oe("triggers"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${je==="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")})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[un&&a.jsx("button",{onClick:()=>nt(O=>!O),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:a.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),oe&&je==="chat"&&a.jsx("button",{onClick:ha,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${La?"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:se?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:se?"Cmd+J":"Ctrl+J"}),"aria-pressed":La,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx(KM,{darkMode:t,onToggle:()=>n(!t)}),xt&&a.jsx(Bq,{user:xt,onLogout:be,onSkillManagement:()=>Oe("skills"),onPricingSettings:()=>Ct(!0),onDlpSettings:()=>tn(!0),onSettings:()=>Oe("settings"),onBoard:gl?()=>Oe("board"):void 0,onCapabilities:rs?()=>Oe("capabilities"):void 0})]})]}),je==="skills"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(eK,{onBack:()=>Oe("chat")})}):je==="board"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(sK,{onBack:()=>Oe("chat")})}):je==="capabilities"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(yK,{onBack:()=>Oe("chat")})}):je==="triggers"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(CK,{onBack:()=>Oe("chat")})}):je==="settings"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(EY,{onBack:()=>Oe("chat"),onOpenDlpSettings:()=>tn(!0),onOpenPricingSettings:()=>Ct(!0),activeSessionId:oe,mobileFrameless:I,onMobileFramelessChange:M})}):a.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[a.jsx(cL,{sessions:kc,activeSessionId:oe,busySessions:yi,onSelectSession:O=>{Fr(O),window.innerWidth<768&&Ee(!1)},onNewChat:Ds,onDeleteSession:yd,onDeleteAllSessions:wc,onRenameSession:Co,onRegenerateTitle:ml,onPinSession:Kp,onArchiveSession:xl,onExportSession:bl,onSendToSession:Gp,onImportSession:jo,onImportError:O=>dt(O),showArchived:Je,onToggleShowArchived:Ps,isOpen:te,onClose:()=>Ee(!1),onToggle:()=>Ee(O=>!O),hasMoreSessions:Cs,onLoadMoreSessions:Vp,showOtherApps:Qa,onToggleShowOtherApps:Nc,hasMoreOtherApps:gd,onLoadMoreOtherApps:No,otherAppsCount:Eo.length,search:Pp,onSearchChange:kd,loadedCount:st.length,totalCount:Ju,sidebarWidth:L,onSidebarWidthChange:A}),a.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:oe?a.jsxs(a.Fragment,{children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(CG,{sessionModel:J.has(oe)?"epm/privacy":Fe[oe]||null,activeModel:Ye,registryEntries:ke,onModelChange:Yp,disabled:Qi||J.has(oe),lockedReason:J.has(oe)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},oe),fs?a.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:fs,children:fs}):null,a.jsx("button",{onClick:()=>sc(!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:Br,children:a.jsx(XI,{className:"w-4 h-4"})}),a.jsx(RG,{sessionId:oe,disabledSkills:Gt?Gt.disabledSkills:[],onToggle:vd,onResetToDefaults:Qp,t:e,disabled:Br}),a.jsx("button",{onClick:()=>td(!0),className:`p-1.5 rounded-lg transition-colors ${Up?"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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),jt&&a.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(O=>{const Y=pc===null&&ns&&!yo.current.has(oe)&&ns.moe_topk===O.val,re=pc===O.val;return a.jsx("button",{onClick:()=>{O.val===null?yo.current.delete(oe):yo.current.add(oe),nd(le=>({...le,[oe]:O.val})),Li(oe,{moe_top_k:O.val}).catch(()=>{})},disabled:Br,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${re?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":Y?"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:O.label},O.label)})}),a.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(O=>a.jsx("button",{onClick:()=>{rd(Y=>({...Y,[oe]:O.val})),Li(oe,{reasoning_effort:O.val}).catch(()=>{})},disabled:Br,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${id===O.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:O.label},O.val))})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>yl({readOnly:Br}),className:`p-1.5 rounded-lg transition-colors ${zs?"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(zs?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(zs?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!zs,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>Ec(),className:`p-1.5 rounded-lg transition-colors ${Ao?"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(Ao?"chat.show_chat_input":"chat.hide_chat_input"),"aria-label":e(Ao?"chat.show_chat_input":"chat.hide_chat_input"),"aria-pressed":!Ao,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),hc&&a.jsx("button",{onClick:async()=>{if(oe)try{await $O(oe),dt("Banner generation queued (~2 min)"),setTimeout(()=>dt(null),4e3)}catch(O){dt(`Banner: ${O.message||O}`)}},disabled:!oe,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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),hc&&a.jsx("button",{onClick:it,className:`p-1.5 rounded-lg transition-colors ${gi?"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:gi?"Show banner":"Hide banner","aria-label":gi?"Show banner":"Hide banner","aria-pressed":!gi,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:gi?a.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"}):a.jsxs(a.Fragment,{children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.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"})]})})}),Ie?a.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Ie.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Ie.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:Ie.label,children:Ie.label}):null,a.jsx("button",{onClick:()=>As(O=>!O),className:`p-1.5 rounded-lg transition-colors lg:hidden ${Rs?"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":Rs,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>bl(oe),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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>{ac(O=>!O),ll&&(ul(""),Da(0),dl(0))},className:`p-1.5 rounded-lg transition-colors ${ll?"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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),ll&&a.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:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:cl,onChange:O=>{ul(O.target.value),Da(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"}),cl&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 shrink-0 tabular-nums",children:Ui>0?e("app.match_count",{current:es+1,total:Ui}):e("app.no_matches")}),cl&&Ui>0&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>Da(O=>(O-1+Ui)%Ui),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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),a.jsx("button",{onClick:()=>Da(O=>(O+1)%Ui),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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:()=>{ac(!1),ul(""),Da(0),dl(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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!go&&a.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:e("app.reconnecting")})]}),fn&&a.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:[a.jsx("span",{children:fn}),a.jsx("button",{onClick:()=>dt(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),pl&&a.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${pl.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":pl.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{children:pl.text})]}),wr&&a.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:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),a.jsxs("div",{className:"mt-1",children:[a.jsx("a",{href:wr.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:wr.verification_uri})," ","— ",a.jsx("span",{className:"font-mono font-bold text-base select-all",children:wr.user_code})]}),a.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),a.jsx("button",{onClick:()=>Zi(null),className:"ml-2 text-blue-400 hover:text-blue-600 shrink-0","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),Ft&&a.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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 ",Ft.attempt,"/",Ft.maxRetries,Ft.maxDurationMs>0&&Ft.elapsedMs>0&&a.jsxs(a.Fragment,{children:[" (",Math.round(Ft.elapsedMs/1e3),"s / ",Math.round(Ft.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(Ft.delayMs/1e3),"s. Click Stop to cancel."]}),a.jsx("button",{onClick:()=>{Ar(null),kn.current&&(clearTimeout(kn.current),kn.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ei&&a.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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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: ",Ei.fallbackModel," (local model unavailable)"]}),a.jsx("button",{onClick:()=>{at(null),gt.current&&(clearTimeout(gt.current),gt.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(eq,{ref:ze,messages:Vt,unloadedCompactedCount:zn,onExpandCompactedHistory:oe?()=>xd(oe):void 0,hasOlderMessages:Gr,loadingOlderMessages:zi,onLoadOlderMessages:oe?()=>Kn(oe):void 0,streamingParts:Gn[oe]||{},streamingProgress:It,isBusy:Qi,compactingInfo:Xi,compactionResult:dn,onSwitchToCompactedSession:O=>{zt.current=O,bn(O),ai(null)},onDismissCompactionResult:()=>ai(null),parentSessionID:Gt&&Gt.parentSessionID,compactionPinned:Gt&&Gt.compactionPinned,onUnpinCompaction:bd,onViewParentSession:O=>{zt.current=O,bn(O),Ne(function(Y){return Y.map(function(re){return re.id===O?{...re,_readOnly:!0}:re})})},user:xt,searchQuery:cl,activeMatchIndex:es,onTotalMatchesChange:dl,onRetry:Br?void 0:us,onEditAndResend:Br?void 0:To,onCancelQueued:Br?void 0:hd,hideToolBubbles:Et,mobileFrameless:I,hideThinking:zs,sessionID:oe,banners:(hc?xa[oe]:null)||[],bannerHidden:gi,onToggleBanner:it,privateMessageIds:P,questionIdMap:me,onQuoteAdd:kt}),a.jsx(JY,{rect:Vr&&Vr.rect,label:e("chat.quote_selection"),copyLabel:e("chat.copy_selection"),onCopy:function(){Ma()},onQuote:function(){Vr&&kt(Vr),Rr()},onDismiss:Rr}),(ii[oe]||[]).length>0&&a.jsx(ZY,{items:ii[oe]||[],sessionId:oe,isReadOnly:Br,onReorder:function(O){FL(oe,O).catch(function(Y){dt("Failed to reorder: "+Y.message)})},onCancelItem:function(O){vw(oe,O).catch(function(Y){dt("Failed to cancel: "+Y.message)})},onEditItem:function(O){if(!(O.status==="dispatching"||Br)){vw(oe,O.id).catch(function(){});var Y=O.displayContent||O.text||"";Y&&q.current&&typeof q.current.setText=="function"&&q.current.setText(Y)}},t:e}),Br?a.jsx(hS,{variant:Ba?"compacted":Gt&&Gt.source==="archive"?"archive":"terminal",label:Ba?e("chat.compacted_switch_to_new")||"Compacted — switch to new session":Gt&&Gt.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal"),childSessionId:Ba?Ro:null,onSwitchToChild:()=>{zt.current=Ro,bn(Ro)}}):((na=Gt==null?void 0:Gt.ui)==null?void 0:na.chatInput)==="hidden"?a.jsx(hS,{variant:"monitor",label:e("chat.monitor_only")}):a.jsx(Tq,{ref:q,sessionId:oe,onSend:Ir,onBuiltinCommand:Zp,onAbort:Cc,isBusy:Qi,pendingQuotes:tr,onRemoveQuote:vn,onClearQuotes:ar,queuedCount:Ls+(ii[oe]||[]).length,planModeEnabled:od})]}):a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[a.jsx("img",{src:yr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-16 mb-4"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),a.jsx("button",{onClick:Ds,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")})]})}),oe&&a.jsxs("aside",{ref:ed,style:{width:pa},className:`border-l hidden ${La?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-800`,children:[a.jsx(RQ,{width:pa,min:Jf,max:j1,edge:"left",onCommit:$n,getPaneEl:()=>ed.current,ariaLabel:e("app.resize_terminal"),className:"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"}),!Rs&&bc()]}),Rs&&oe&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>As(!1)}),a.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:O=>{(O.key==="Escape"||O.key==="Esc")&&(O.stopPropagation(),As(!1))},ref:fl,children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),a.jsx("button",{onClick:()=>As(!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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),bc()]})]})]}),ft&&a.jsx(jY,{onClose:()=>Ct(!1)}),rn&&a.jsx(MY,{onClose:()=>tn(!1)}),un&&a.jsx(CQ,{open:$t,onClose:()=>nt(!1),activeSessionId:oe,activeSessionTitle:fs}),a.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:a.jsx(FY,{requests:qe,onDismiss:Jp})}),a.jsx(zY,{open:oi,onClose:()=>cr(!1),upgradeUrl:Sr}),a.jsx(l3,{open:ls!==null,onClose:()=>Sc(null),senderSessionID:ls}),a.jsx(YY,{isOpen:Fp,onClose:()=>sc(!1),sessionId:oe,currentDirectory:(Gt==null?void 0:Gt.directory)||"",homeDir:Bp,onDirectoryChange:Xp,session:Gt}),a.jsx(XY,{isOpen:zp,onClose:()=>td(!1),sessionId:oe}),a.jsx(HY,{isOpen:Z,onClose:()=>{z(!1),setTimeout(()=>{var O;return(O=q.current)==null?void 0:O.focus()},0)},onSelectSession:O=>{Fr(O)},onNewChat:()=>{typeof H.current=="function"&&H.current()},activeSessionId:oe,sessions:st,busySessions:yi}),a.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ga})]})}const iX=GM();qM.createRoot(document.getElementById("root")).render(a.jsx(Mt.StrictMode,{children:a.jsx(VM,{initialLocale:iX,children:a.jsx(XM,{children:a.jsx(rX,{})})})}));export{KR as _,Gl as g,rG as p};
|