@cnrai/pave 0.11.75 → 0.11.77
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 +2 -2
- package/sandbox/SandboxRunner.js +1 -1
- package/sandbox/permission.js +1 -1
- package/web/assets/{abnfDiagram-N423BO3Z-lrbCxeIq.js → abnfDiagram-N423BO3Z-DNaZFbnQ.js} +1 -1
- package/web/assets/{arc-WeOya9OS.js → arc-BBjnZAjs.js} +1 -1
- package/web/assets/{architectureDiagram-T3A2C74G-BW35m1mc.js → architectureDiagram-T3A2C74G-CRqHj6Ck.js} +1 -1
- package/web/assets/{blockDiagram-VBNYF7ZC-BQjEPCWo.js → blockDiagram-VBNYF7ZC-BGymdfZe.js} +1 -1
- package/web/assets/{c4Diagram-5PPSVZJV-AnBEO1VP.js → c4Diagram-5PPSVZJV-DHm1U-vQ.js} +1 -1
- package/web/assets/channel-CzlEDRcP.js +1 -0
- package/web/assets/{chunk-2GRJ4B5K-BOhrpN3g.js → chunk-2GRJ4B5K-CYRSqRZj.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-C9ZAnfaL.js → chunk-2Q5K7J3B-Cnc9JyYe.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-r_qHF1Xp.js → chunk-5RXB4S5H-Dk8yyxBX.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-CxiGiUPn.js → chunk-5VM5RSS4-CUxUltN5.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-b2nq5Lk6.js → chunk-6Q2QTUOP-D_XAzpG5.js} +1 -1
- package/web/assets/{chunk-GF5L2VYU-B-me927H.js → chunk-GF5L2VYU-BygLhC0b.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-C8qzad5g.js → chunk-JWPE2WC7-Daf2PmiF.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-BkIlWgz1.js → chunk-KBJHAD2P-Dacfg8Vm.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-BkjF1Eup.js → chunk-RYQCIY6F-CTqPiw-E.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-kzilkm84.js → chunk-XXDRQBXY-BcdL-i6k.js} +1 -1
- package/web/assets/classDiagram-JCYQIIEL-DVilfxdw.js +1 -0
- package/web/assets/classDiagram-v2-OCEON4UE-DVilfxdw.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-B1cfOg4Z.js → cose-bilkent-JH36ORCC-CvG-qT7o.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-9CNtsnOQ.js → cynefin-VYW2F7L2-BL1D6Zap.js} +1 -1
- package/web/assets/{cynefinDiagram-MW4NZA55-Dh59dwt5.js → cynefinDiagram-MW4NZA55-MfeGrxw5.js} +1 -1
- package/web/assets/cytoscape.esm-Dz9tvMTw.js +331 -0
- package/web/assets/{dagre-VZM6K2ZE-CsbdXBp0.js → dagre-VZM6K2ZE-CPj1vSJ1.js} +1 -1
- package/web/assets/{diagram-7IWD3JNH-Auw3SNRR.js → diagram-7IWD3JNH-PuLn-9zm.js} +1 -1
- package/web/assets/{diagram-B4RE2ZJO-CPdAJzCM.js → diagram-B4RE2ZJO-CkIZwq5c.js} +1 -1
- package/web/assets/{diagram-LBJQPF4R-DibTO6h8.js → diagram-LBJQPF4R-DoqMV830.js} +1 -1
- package/web/assets/{diagram-Q27KOJAE-BDPGYyDz.js → diagram-Q27KOJAE-mo3Qhf-E.js} +1 -1
- package/web/assets/{diagram-UB23O5K3-qbu_rb1X.js → diagram-UB23O5K3-OkIIheXv.js} +1 -1
- package/web/assets/{ebnfDiagram-BXEA7PRR-CfaXih1G.js → ebnfDiagram-BXEA7PRR-BtrnFNZ5.js} +1 -1
- package/web/assets/{erDiagram-JOGREHBK-Cq8zoS2R.js → erDiagram-JOGREHBK-Do2qkPJ6.js} +1 -1
- package/web/assets/{flowDiagram-UKHOOZJN-C3HYbejV.js → flowDiagram-UKHOOZJN-CO05QYxY.js} +1 -1
- package/web/assets/{ganttDiagram-PKOTCBZU-ClkeLBH2.js → ganttDiagram-PKOTCBZU-CsDUxXgM.js} +1 -1
- package/web/assets/{gitGraphDiagram-DS77QQ5N-BML0qgt5.js → gitGraphDiagram-DS77QQ5N-D_JRbJnn.js} +1 -1
- package/web/assets/index-DqSR1Tzn.js +122 -0
- package/web/assets/{infoDiagram-6WML65LV-_oTa6J3U.js → infoDiagram-6WML65LV-Bm51MVeD.js} +1 -1
- package/web/assets/{ishikawaDiagram-WSZJBQD7-DHLvkJnA.js → ishikawaDiagram-WSZJBQD7-hC73dV6-.js} +1 -1
- package/web/assets/{journeyDiagram-NVQOT4AX-CagqE6Zi.js → journeyDiagram-NVQOT4AX-SrvvbJRK.js} +1 -1
- package/web/assets/{kanban-definition-27J2QSJJ-BO08yCXe.js → kanban-definition-27J2QSJJ-NkVpEBib.js} +1 -1
- package/web/assets/{linear-pbF_-XZV.js → linear-DuFTppiB.js} +1 -1
- package/web/assets/{mermaid.core-D_mctH75.js → mermaid.core-Csqy-TMM.js} +4 -4
- package/web/assets/{mindmap-definition-FAOFIHXS-CT_Fa4qB.js → mindmap-definition-FAOFIHXS-u_GH4Qfd.js} +1 -1
- package/web/assets/{pegDiagram-VL7TDLO6-CqBe5Mzn.js → pegDiagram-VL7TDLO6-BhGIjN6A.js} +1 -1
- package/web/assets/{pieDiagram-7S7Q4E2Y-CFMfSfxk.js → pieDiagram-7S7Q4E2Y-B_M8PUaK.js} +1 -1
- package/web/assets/{quadrantDiagram-CIZ2JOQS-C5z627LA.js → quadrantDiagram-CIZ2JOQS-DSirVekl.js} +1 -1
- package/web/assets/{railroadDiagram-AXF67PYL-C4B3veao.js → railroadDiagram-AXF67PYL-Dy2zbnOk.js} +1 -1
- package/web/assets/{requirementDiagram-LRYGKXZP-BINEux-N.js → requirementDiagram-LRYGKXZP-BOm79sUC.js} +1 -1
- package/web/assets/{sankeyDiagram-W5VNT64P-Dr-MpB6V.js → sankeyDiagram-W5VNT64P-CKvdTJMK.js} +1 -1
- package/web/assets/{sequenceDiagram-SI44F4Z6-QHQSjNuP.js → sequenceDiagram-SI44F4Z6-DMu0TdCJ.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-qFPgYNQw.js → sizeCapture-X5ZJPWSS-bAw6BW35.js} +1 -1
- package/web/assets/{stateDiagram-OKZ733FA-BsSaiwWT.js → stateDiagram-OKZ733FA-BY7brHbI.js} +1 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-DQllBEYE.js +1 -0
- package/web/assets/{swimlanes-SLNWSIFB-DVMdapPL.js → swimlanes-SLNWSIFB-DxITDC19.js} +2 -2
- package/web/assets/swimlanesDiagram-ULZ7WXOC-BEysfC0G.js +8 -0
- package/web/assets/{timeline-definition-Z64GVDOM-Xe5LUaoU.js → timeline-definition-Z64GVDOM-BmlqIPEF.js} +1 -1
- package/web/assets/{vennDiagram-T6HMQDX7-CYtKW9nj.js → vennDiagram-T6HMQDX7-BZTPZCF_.js} +1 -1
- package/web/assets/{wardleyDiagram-T6FBY63Y-BlILyKsK.js → wardleyDiagram-T6FBY63Y-iNVTU5LZ.js} +1 -1
- package/web/assets/{xychartDiagram-ELKLHX3M-DAKFU68H.js → xychartDiagram-ELKLHX3M-bmAoBhux.js} +1 -1
- package/web/assets/{zh-TW-CJN4iDCH.js → zh-TW-B9YR1mTH.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/channel-Cc2g6cj2.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-EMYjdswO.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-EMYjdswO.js +0 -1
- package/web/assets/cytoscape.esm-CUqq0XTU.js +0 -331
- package/web/assets/index-CE7eCSFC.js +0 -122
- package/web/assets/stateDiagram-v2-UEYNNEHI-5LjYXxYy.js +0 -1
- package/web/assets/swimlanesDiagram-ULZ7WXOC-CZizv_du.js +0 -8
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function No(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gj={exports:{}},Ud={},pj={exports:{}},Tt={};/**
|
|
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 uc=Symbol.for("react.element"),wM=Symbol.for("react.portal"),EM=Symbol.for("react.fragment"),SM=Symbol.for("react.strict_mode"),NM=Symbol.for("react.profiler"),CM=Symbol.for("react.provider"),jM=Symbol.for("react.context"),TM=Symbol.for("react.forward_ref"),RM=Symbol.for("react.suspense"),AM=Symbol.for("react.memo"),IM=Symbol.for("react.lazy"),uk=Symbol.iterator;function MM(e){return e===null||typeof e!="object"?null:(e=uk&&e[uk]||e["@@iterator"],typeof e=="function"?e:null)}var hj={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mj=Object.assign,xj={};function Co(e,t,n){this.props=e,this.context=t,this.refs=xj,this.updater=n||hj}Co.prototype.isReactComponent={};Co.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Co.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function yj(){}yj.prototype=Co.prototype;function qb(e,t,n){this.props=e,this.context=t,this.refs=xj,this.updater=n||hj}var Wb=qb.prototype=new yj;Wb.constructor=qb;mj(Wb,Co.prototype);Wb.isPureReactComponent=!0;var dk=Array.isArray,bj=Object.prototype.hasOwnProperty,Vb={current:null},vj={key:!0,ref:!0,__self:!0,__source:!0};function kj(e,t,n){var r,a={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)bj.call(t,r)&&!vj.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:uc,type:e,key:i,ref:s,props:a,_owner:Vb.current}}function LM(e,t){return{$$typeof:uc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Gb(e){return typeof e=="object"&&e!==null&&e.$$typeof===uc}function OM(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var fk=/\/+/g;function ag(e,t){return typeof e=="object"&&e!==null&&e.key!=null?OM(""+e.key):t.toString(36)}function Ou(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case uc:case wM:s=!0}}if(s)return s=e,a=a(s),e=r===""?"."+ag(s,0):r,dk(a)?(n="",e!=null&&(n=e.replace(fk,"$&/")+"/"),Ou(a,t,n,"",function(u){return u})):a!=null&&(Gb(a)&&(a=LM(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(fk,"$&/")+"/")+e)),t.push(a)),1;if(s=0,r=r===""?".":r+":",dk(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+ag(i,l);s+=Ou(i,t,n,c,a)}else if(c=MM(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+ag(i,l++),s+=Ou(i,t,n,c,a);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Gc(e,t,n){if(e==null)return e;var r=[],a=0;return Ou(e,r,"","",function(i){return t.call(n,i,a++)}),r}function DM(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var or={current:null},Du={transition:null},PM={ReactCurrentDispatcher:or,ReactCurrentBatchConfig:Du,ReactCurrentOwner:Vb};function _j(){throw Error("act(...) is not supported in production builds of React.")}Tt.Children={map:Gc,forEach:function(e,t,n){Gc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gc(e,function(){t++}),t},toArray:function(e){return Gc(e,function(t){return t})||[]},only:function(e){if(!Gb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Tt.Component=Co;Tt.Fragment=EM;Tt.Profiler=NM;Tt.PureComponent=qb;Tt.StrictMode=SM;Tt.Suspense=RM;Tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=PM;Tt.act=_j;Tt.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=mj({},e.props),a=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Vb.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)bj.call(t,c)&&!vj.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:uc,type:e.type,key:a,ref:i,props:r,_owner:s}};Tt.createContext=function(e){return e={$$typeof:jM,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:CM,_context:e},e.Consumer=e};Tt.createElement=kj;Tt.createFactory=function(e){var t=kj.bind(null,e);return t.type=e,t};Tt.createRef=function(){return{current:null}};Tt.forwardRef=function(e){return{$$typeof:TM,render:e}};Tt.isValidElement=Gb;Tt.lazy=function(e){return{$$typeof:IM,_payload:{_status:-1,_result:e},_init:DM}};Tt.memo=function(e,t){return{$$typeof:AM,type:e,compare:t===void 0?null:t}};Tt.startTransition=function(e){var t=Du.transition;Du.transition={};try{e()}finally{Du.transition=t}};Tt.unstable_act=_j;Tt.useCallback=function(e,t){return or.current.useCallback(e,t)};Tt.useContext=function(e){return or.current.useContext(e)};Tt.useDebugValue=function(){};Tt.useDeferredValue=function(e){return or.current.useDeferredValue(e)};Tt.useEffect=function(e,t){return or.current.useEffect(e,t)};Tt.useId=function(){return or.current.useId()};Tt.useImperativeHandle=function(e,t,n){return or.current.useImperativeHandle(e,t,n)};Tt.useInsertionEffect=function(e,t){return or.current.useInsertionEffect(e,t)};Tt.useLayoutEffect=function(e,t){return or.current.useLayoutEffect(e,t)};Tt.useMemo=function(e,t){return or.current.useMemo(e,t)};Tt.useReducer=function(e,t,n){return or.current.useReducer(e,t,n)};Tt.useRef=function(e){return or.current.useRef(e)};Tt.useState=function(e){return or.current.useState(e)};Tt.useSyncExternalStore=function(e,t,n){return or.current.useSyncExternalStore(e,t,n)};Tt.useTransition=function(){return or.current.useTransition()};Tt.version="18.3.1";pj.exports=Tt;var h=pj.exports;const nt=No(h);/**
|
|
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 FM=h,BM=Symbol.for("react.element"),zM=Symbol.for("react.fragment"),UM=Object.prototype.hasOwnProperty,$M=FM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,HM={key:!0,ref:!0,__self:!0,__source:!0};function wj(e,t,n){var r,a={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)UM.call(t,r)&&!HM.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:BM,type:e,key:i,ref:s,props:a,_owner:$M.current}}Ud.Fragment=zM;Ud.jsx=wj;Ud.jsxs=wj;gj.exports=Ud;var o=gj.exports,fy={},Ej={exports:{}},Mr={},Sj={exports:{}},Nj={};/**
|
|
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
|
-
*/(function(e){function t($,Z){var R=$.length;$.push(Z);e:for(;0<R;){var Y=R-1>>>1,V=$[Y];if(0<a(V,Z))$[Y]=Z,$[R]=V,R=Y;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var Z=$[0],R=$.pop();if(R!==Z){$[0]=R;e:for(var Y=0,V=$.length,A=V>>>1;Y<A;){var H=2*(Y+1)-1,ce=$[H],ee=H+1,Me=$[ee];if(0>a(ce,R))ee<V&&0>a(Me,ce)?($[Y]=Me,$[ee]=R,Y=ee):($[Y]=ce,$[H]=R,Y=H);else if(ee<V&&0>a(Me,R))$[Y]=Me,$[ee]=R,Y=ee;else break e}}return Z}function a($,Z){var R=$.sortIndex-Z.sortIndex;return R!==0?R:$.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,g=3,p=!1,m=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k($){for(var Z=n(u);Z!==null;){if(Z.callback===null)r(u);else if(Z.startTime<=$)r(u),Z.sortIndex=Z.expirationTime,t(c,Z);else break;Z=n(u)}}function N($){if(y=!1,k($),!m)if(n(c)!==null)m=!0,T(_);else{var Z=n(u);Z!==null&&L(N,Z.startTime-$)}}function _($,Z){m=!1,y&&(y=!1,x(S),S=-1),p=!0;var R=g;try{for(k(Z),f=n(c);f!==null&&(!(f.expirationTime>Z)||$&&!F());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,g=f.priorityLevel;var V=Y(f.expirationTime<=Z);Z=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),k(Z)}else r(c);f=n(c)}if(f!==null)var A=!0;else{var H=n(u);H!==null&&L(N,H.startTime-Z),A=!1}return A}finally{f=null,g=R,p=!1}}var w=!1,E=null,S=-1,M=5,j=-1;function F(){return!(e.unstable_now()-j<M)}function P(){if(E!==null){var $=e.unstable_now();j=$;var Z=!0;try{Z=E(!0,$)}finally{Z?W():(w=!1,E=null)}}else w=!1}var W;if(typeof b=="function")W=function(){b(P)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,I=O.port2;O.port1.onmessage=P,W=function(){I.postMessage(null)}}else W=function(){v(P,0)};function T($){E=$,w||(w=!0,W())}function L($,Z){S=v(function(){$(e.unstable_now())},Z)}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($){$.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,T(_))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(g){case 1:case 2:case 3:var Z=3;break;default:Z=g}var R=g;g=Z;try{return $()}finally{g=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,Z){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var R=g;g=$;try{return Z()}finally{g=R}},e.unstable_scheduleCallback=function($,Z,R){var Y=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?Y+R:Y):R=Y,$){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=R+V,$={id:d++,callback:Z,priorityLevel:$,startTime:R,expirationTime:V,sortIndex:-1},R>Y?($.sortIndex=R,t(u,$),n(c)===null&&$===n(u)&&(y?(x(S),S=-1):y=!0,L(N,R-Y))):($.sortIndex=V,t(c,$),m||p||(m=!0,T(_))),$},e.unstable_shouldYield=F,e.unstable_wrapCallback=function($){var Z=g;return function(){var R=g;g=Z;try{return $.apply(this,arguments)}finally{g=R}}}})(Nj);Sj.exports=Nj;var qM=Sj.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 WM=h,Ir=qM;function Pe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Cj=new Set,Ml={};function ms(e,t){xo(e,t),xo(e+"Capture",t)}function xo(e,t){for(Ml[e]=t,e=0;e<t.length;e++)Cj.add(t[e])}var qa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gy=Object.prototype.hasOwnProperty,VM=/^[: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]*$/,gk={},pk={};function GM(e){return gy.call(pk,e)?!0:gy.call(gk,e)?!1:VM.test(e)?pk[e]=!0:(gk[e]=!0,!1)}function KM(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function YM(e,t,n,r){if(t===null||typeof t>"u"||KM(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function lr(e,t,n,r,a,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Un={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Un[e]=new lr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Un[t]=new lr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Un[e]=new lr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Un[e]=new lr(e,2,!1,e,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(e){Un[e]=new lr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Un[e]=new lr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Un[e]=new lr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Un[e]=new lr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Un[e]=new lr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Kb=/[\-:]([a-z])/g;function Yb(e){return e[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(e){var t=e.replace(Kb,Yb);Un[t]=new lr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Kb,Yb);Un[t]=new lr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Kb,Yb);Un[t]=new lr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Un[e]=new lr(e,1,!1,e.toLowerCase(),null,!1,!1)});Un.xlinkHref=new lr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Un[e]=new lr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Xb(e,t,n,r){var a=Un.hasOwnProperty(t)?Un[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(YM(t,n,a,r)&&(n=null),r||a===null?GM(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ya=WM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Kc=Symbol.for("react.element"),Ys=Symbol.for("react.portal"),Xs=Symbol.for("react.fragment"),Qb=Symbol.for("react.strict_mode"),py=Symbol.for("react.profiler"),jj=Symbol.for("react.provider"),Tj=Symbol.for("react.context"),Zb=Symbol.for("react.forward_ref"),hy=Symbol.for("react.suspense"),my=Symbol.for("react.suspense_list"),Jb=Symbol.for("react.memo"),ui=Symbol.for("react.lazy"),Rj=Symbol.for("react.offscreen"),hk=Symbol.iterator;function Wo(e){return e===null||typeof e!="object"?null:(e=hk&&e[hk]||e["@@iterator"],typeof e=="function"?e:null)}var pn=Object.assign,ig;function il(e){if(ig===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ig=t&&t[1]||""}return`
|
|
34
|
-
`+ig+e}var sg=!1;function og(e,t){if(!e||sg)return"";sg=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),s=a.length-1,l=i.length-1;1<=s&&0<=l&&a[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(a[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||a[s]!==i[l]){var c=`
|
|
37
|
-
`+a[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=s&&0<=l);break}}}finally{sg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?il(e):""}function XM(e){switch(e.tag){case 5:return il(e.type);case 16:return il("Lazy");case 13:return il("Suspense");case 19:return il("SuspenseList");case 0:case 2:case 15:return e=og(e.type,!1),e;case 11:return e=og(e.type.render,!1),e;case 1:return e=og(e.type,!0),e;default:return""}}function xy(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Xs:return"Fragment";case Ys:return"Portal";case py:return"Profiler";case Qb:return"StrictMode";case hy:return"Suspense";case my:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Tj:return(e.displayName||"Context")+".Consumer";case jj:return(e._context.displayName||"Context")+".Provider";case Zb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Jb:return t=e.displayName||null,t!==null?t:xy(e.type)||"Memo";case ui:t=e._payload,e=e._init;try{return xy(e(t))}catch{}}return null}function QM(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xy(t);case 8:return t===Qb?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ri(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Aj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ZM(e){var t=Aj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yc(e){e._valueTracker||(e._valueTracker=ZM(e))}function Ij(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Aj(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ed(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yy(e,t){var n=t.checked;return pn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ri(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Mj(e,t){t=t.checked,t!=null&&Xb(e,"checked",t,!1)}function by(e,t){Mj(e,t);var n=Ri(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?vy(e,t.type,n):t.hasOwnProperty("defaultValue")&&vy(e,t.type,Ri(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function vy(e,t,n){(t!=="number"||ed(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sl=Array.isArray;function oo(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ri(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function ky(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Pe(91));return pn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function yk(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Pe(92));if(sl(n)){if(1<n.length)throw Error(Pe(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ri(n)}}function Lj(e,t){var n=Ri(t.value),r=Ri(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function bk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Oj(e){switch(e){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 _y(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Oj(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Xc,Dj=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Xc=Xc||document.createElement("div"),Xc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Xc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ll(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xl={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},JM=["Webkit","ms","Moz","O"];Object.keys(xl).forEach(function(e){JM.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xl[t]=xl[e]})});function Pj(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xl.hasOwnProperty(e)&&xl[e]?(""+t).trim():t+"px"}function Fj(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=Pj(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var eL=pn({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 wy(e,t){if(t){if(eL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Pe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Pe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Pe(62))}}function Ey(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Sy=null;function ev(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ny=null,lo=null,co=null;function vk(e){if(e=gc(e)){if(typeof Ny!="function")throw Error(Pe(280));var t=e.stateNode;t&&(t=Vd(t),Ny(e.stateNode,e.type,t))}}function Bj(e){lo?co?co.push(e):co=[e]:lo=e}function zj(){if(lo){var e=lo,t=co;if(co=lo=null,vk(e),t)for(e=0;e<t.length;e++)vk(t[e])}}function Uj(e,t){return e(t)}function $j(){}var lg=!1;function Hj(e,t,n){if(lg)return e(t,n);lg=!0;try{return Uj(e,t,n)}finally{lg=!1,(lo!==null||co!==null)&&($j(),zj())}}function Ol(e,t){var n=e.stateNode;if(n===null)return null;var r=Vd(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Pe(231,t,typeof n));return n}var Cy=!1;if(qa)try{var Vo={};Object.defineProperty(Vo,"passive",{get:function(){Cy=!0}}),window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{Cy=!1}function tL(e,t,n,r,a,i,s,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var yl=!1,td=null,nd=!1,jy=null,nL={onError:function(e){yl=!0,td=e}};function rL(e,t,n,r,a,i,s,l,c){yl=!1,td=null,tL.apply(nL,arguments)}function aL(e,t,n,r,a,i,s,l,c){if(rL.apply(this,arguments),yl){if(yl){var u=td;yl=!1,td=null}else throw Error(Pe(198));nd||(nd=!0,jy=u)}}function xs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function qj(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function kk(e){if(xs(e)!==e)throw Error(Pe(188))}function iL(e){var t=e.alternate;if(!t){if(t=xs(e),t===null)throw Error(Pe(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return kk(a),e;if(i===r)return kk(a),t;i=i.sibling}throw Error(Pe(188))}if(n.return!==r.return)n=a,r=i;else{for(var s=!1,l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s)throw Error(Pe(189))}}if(n.alternate!==r)throw Error(Pe(190))}if(n.tag!==3)throw Error(Pe(188));return n.stateNode.current===n?e:t}function Wj(e){return e=iL(e),e!==null?Vj(e):null}function Vj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Vj(e);if(t!==null)return t;e=e.sibling}return null}var Gj=Ir.unstable_scheduleCallback,_k=Ir.unstable_cancelCallback,sL=Ir.unstable_shouldYield,oL=Ir.unstable_requestPaint,bn=Ir.unstable_now,lL=Ir.unstable_getCurrentPriorityLevel,tv=Ir.unstable_ImmediatePriority,Kj=Ir.unstable_UserBlockingPriority,rd=Ir.unstable_NormalPriority,cL=Ir.unstable_LowPriority,Yj=Ir.unstable_IdlePriority,$d=null,_a=null;function uL(e){if(_a&&typeof _a.onCommitFiberRoot=="function")try{_a.onCommitFiberRoot($d,e,void 0,(e.current.flags&128)===128)}catch{}}var ra=Math.clz32?Math.clz32:gL,dL=Math.log,fL=Math.LN2;function gL(e){return e>>>=0,e===0?32:31-(dL(e)/fL|0)|0}var Qc=64,Zc=4194304;function ol(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ad(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~a;l!==0?r=ol(l):(i&=s,i!==0&&(r=ol(i)))}else s=n&~a,s!==0?r=ol(s):i!==0&&(r=ol(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ra(t),a=1<<n,r|=e[n],t&=~a;return r}function pL(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 hL(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-ra(i),l=1<<s,c=a[s];c===-1?(!(l&n)||l&r)&&(a[s]=pL(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Ty(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Xj(){var e=Qc;return Qc<<=1,!(Qc&4194240)&&(Qc=64),e}function cg(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ra(t),e[t]=n}function mL(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-ra(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function nv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ra(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var Ht=0;function Qj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Zj,rv,Jj,eT,tT,Ry=!1,Jc=[],ki=null,_i=null,wi=null,Dl=new Map,Pl=new Map,fi=[],xL="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 wk(e,t){switch(e){case"focusin":case"focusout":ki=null;break;case"dragenter":case"dragleave":_i=null;break;case"mouseover":case"mouseout":wi=null;break;case"pointerover":case"pointerout":Dl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pl.delete(t.pointerId)}}function Go(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=gc(t),t!==null&&rv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function yL(e,t,n,r,a){switch(t){case"focusin":return ki=Go(ki,e,t,n,r,a),!0;case"dragenter":return _i=Go(_i,e,t,n,r,a),!0;case"mouseover":return wi=Go(wi,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Dl.set(i,Go(Dl.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Pl.set(i,Go(Pl.get(i)||null,e,t,n,r,a)),!0}return!1}function nT(e){var t=Zi(e.target);if(t!==null){var n=xs(t);if(n!==null){if(t=n.tag,t===13){if(t=qj(n),t!==null){e.blockedOn=t,tT(e.priority,function(){Jj(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Pu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ay(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Sy=r,n.target.dispatchEvent(r),Sy=null}else return t=gc(n),t!==null&&rv(t),e.blockedOn=n,!1;t.shift()}return!0}function Ek(e,t,n){Pu(e)&&n.delete(t)}function bL(){Ry=!1,ki!==null&&Pu(ki)&&(ki=null),_i!==null&&Pu(_i)&&(_i=null),wi!==null&&Pu(wi)&&(wi=null),Dl.forEach(Ek),Pl.forEach(Ek)}function Ko(e,t){e.blockedOn===t&&(e.blockedOn=null,Ry||(Ry=!0,Ir.unstable_scheduleCallback(Ir.unstable_NormalPriority,bL)))}function Fl(e){function t(a){return Ko(a,e)}if(0<Jc.length){Ko(Jc[0],e);for(var n=1;n<Jc.length;n++){var r=Jc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ki!==null&&Ko(ki,e),_i!==null&&Ko(_i,e),wi!==null&&Ko(wi,e),Dl.forEach(t),Pl.forEach(t),n=0;n<fi.length;n++)r=fi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<fi.length&&(n=fi[0],n.blockedOn===null);)nT(n),n.blockedOn===null&&fi.shift()}var uo=Ya.ReactCurrentBatchConfig,id=!0;function vL(e,t,n,r){var a=Ht,i=uo.transition;uo.transition=null;try{Ht=1,av(e,t,n,r)}finally{Ht=a,uo.transition=i}}function kL(e,t,n,r){var a=Ht,i=uo.transition;uo.transition=null;try{Ht=4,av(e,t,n,r)}finally{Ht=a,uo.transition=i}}function av(e,t,n,r){if(id){var a=Ay(e,t,n,r);if(a===null)bg(e,t,r,sd,n),wk(e,r);else if(yL(a,e,t,n,r))r.stopPropagation();else if(wk(e,r),t&4&&-1<xL.indexOf(e)){for(;a!==null;){var i=gc(a);if(i!==null&&Zj(i),i=Ay(e,t,n,r),i===null&&bg(e,t,r,sd,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else bg(e,t,r,null,n)}}var sd=null;function Ay(e,t,n,r){if(sd=null,e=ev(r),e=Zi(e),e!==null)if(t=xs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=qj(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return sd=e,null}function rT(e){switch(e){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(lL()){case tv:return 1;case Kj:return 4;case rd:case cL:return 16;case Yj:return 536870912;default:return 16}default:return 16}}var xi=null,iv=null,Fu=null;function aT(){if(Fu)return Fu;var e,t=iv,n=t.length,r,a="value"in xi?xi.value:xi.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===a[i-r];r++);return Fu=a.slice(e,1<r?1-r:void 0)}function Bu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function eu(){return!0}function Sk(){return!1}function Lr(e){function t(n,r,a,i,s){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?eu:Sk,this.isPropagationStopped=Sk,this}return pn(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),t}var jo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sv=Lr(jo),fc=pn({},jo,{view:0,detail:0}),_L=Lr(fc),ug,dg,Yo,Hd=pn({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ov,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Yo&&(Yo&&e.type==="mousemove"?(ug=e.screenX-Yo.screenX,dg=e.screenY-Yo.screenY):dg=ug=0,Yo=e),ug)},movementY:function(e){return"movementY"in e?e.movementY:dg}}),Nk=Lr(Hd),wL=pn({},Hd,{dataTransfer:0}),EL=Lr(wL),SL=pn({},fc,{relatedTarget:0}),fg=Lr(SL),NL=pn({},jo,{animationName:0,elapsedTime:0,pseudoElement:0}),CL=Lr(NL),jL=pn({},jo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),TL=Lr(jL),RL=pn({},jo,{data:0}),Ck=Lr(RL),AL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IL={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"},ML={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ML[e])?!!t[e]:!1}function ov(){return LL}var OL=pn({},fc,{key:function(e){if(e.key){var t=AL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?IL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ov,charCode:function(e){return e.type==="keypress"?Bu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),DL=Lr(OL),PL=pn({},Hd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jk=Lr(PL),FL=pn({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ov}),BL=Lr(FL),zL=pn({},jo,{propertyName:0,elapsedTime:0,pseudoElement:0}),UL=Lr(zL),$L=pn({},Hd,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),HL=Lr($L),qL=[9,13,27,32],lv=qa&&"CompositionEvent"in window,bl=null;qa&&"documentMode"in document&&(bl=document.documentMode);var WL=qa&&"TextEvent"in window&&!bl,iT=qa&&(!lv||bl&&8<bl&&11>=bl),Tk=" ",Rk=!1;function sT(e,t){switch(e){case"keyup":return qL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function oT(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qs=!1;function VL(e,t){switch(e){case"compositionend":return oT(t);case"keypress":return t.which!==32?null:(Rk=!0,Tk);case"textInput":return e=t.data,e===Tk&&Rk?null:e;default:return null}}function GL(e,t){if(Qs)return e==="compositionend"||!lv&&sT(e,t)?(e=aT(),Fu=iv=xi=null,Qs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return iT&&t.locale!=="ko"?null:t.data;default:return null}}var KL={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 Ak(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!KL[e.type]:t==="textarea"}function lT(e,t,n,r){Bj(r),t=od(t,"onChange"),0<t.length&&(n=new sv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vl=null,Bl=null;function YL(e){bT(e,0)}function qd(e){var t=eo(e);if(Ij(t))return e}function XL(e,t){if(e==="change")return t}var cT=!1;if(qa){var gg;if(qa){var pg="oninput"in document;if(!pg){var Ik=document.createElement("div");Ik.setAttribute("oninput","return;"),pg=typeof Ik.oninput=="function"}gg=pg}else gg=!1;cT=gg&&(!document.documentMode||9<document.documentMode)}function Mk(){vl&&(vl.detachEvent("onpropertychange",uT),Bl=vl=null)}function uT(e){if(e.propertyName==="value"&&qd(Bl)){var t=[];lT(t,Bl,e,ev(e)),Hj(YL,t)}}function QL(e,t,n){e==="focusin"?(Mk(),vl=t,Bl=n,vl.attachEvent("onpropertychange",uT)):e==="focusout"&&Mk()}function ZL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return qd(Bl)}function JL(e,t){if(e==="click")return qd(t)}function eO(e,t){if(e==="input"||e==="change")return qd(t)}function tO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oa=typeof Object.is=="function"?Object.is:tO;function zl(e,t){if(oa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!gy.call(t,a)||!oa(e[a],t[a]))return!1}return!0}function Lk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ok(e,t){var n=Lk(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Lk(n)}}function dT(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dT(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fT(){for(var e=window,t=ed();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ed(e.document)}return t}function cv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function nO(e){var t=fT(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dT(n.ownerDocument.documentElement,n)){if(r!==null&&cv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=Ok(n,i);var s=Ok(n,r);a&&s&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var rO=qa&&"documentMode"in document&&11>=document.documentMode,Zs=null,Iy=null,kl=null,My=!1;function Dk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;My||Zs==null||Zs!==ed(r)||(r=Zs,"selectionStart"in r&&cv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kl&&zl(kl,r)||(kl=r,r=od(Iy,"onSelect"),0<r.length&&(t=new sv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Zs)))}function tu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Js={animationend:tu("Animation","AnimationEnd"),animationiteration:tu("Animation","AnimationIteration"),animationstart:tu("Animation","AnimationStart"),transitionend:tu("Transition","TransitionEnd")},hg={},gT={};qa&&(gT=document.createElement("div").style,"AnimationEvent"in window||(delete Js.animationend.animation,delete Js.animationiteration.animation,delete Js.animationstart.animation),"TransitionEvent"in window||delete Js.transitionend.transition);function Wd(e){if(hg[e])return hg[e];if(!Js[e])return e;var t=Js[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in gT)return hg[e]=t[n];return e}var pT=Wd("animationend"),hT=Wd("animationiteration"),mT=Wd("animationstart"),xT=Wd("transitionend"),yT=new Map,Pk="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 Li(e,t){yT.set(e,t),ms(t,[e])}for(var mg=0;mg<Pk.length;mg++){var xg=Pk[mg],aO=xg.toLowerCase(),iO=xg[0].toUpperCase()+xg.slice(1);Li(aO,"on"+iO)}Li(pT,"onAnimationEnd");Li(hT,"onAnimationIteration");Li(mT,"onAnimationStart");Li("dblclick","onDoubleClick");Li("focusin","onFocus");Li("focusout","onBlur");Li(xT,"onTransitionEnd");xo("onMouseEnter",["mouseout","mouseover"]);xo("onMouseLeave",["mouseout","mouseover"]);xo("onPointerEnter",["pointerout","pointerover"]);xo("onPointerLeave",["pointerout","pointerover"]);ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ms("onBeforeInput",["compositionend","keypress","textInput","paste"]);ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ll="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(" "),sO=new Set("cancel close invalid load scroll toggle".split(" ").concat(ll));function Fk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,aL(r,t,void 0,e),e.currentTarget=null}function bT(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;Fk(a,l,u),i=c}else for(s=0;s<r.length;s++){if(l=r[s],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;Fk(a,l,u),i=c}}}if(nd)throw e=jy,nd=!1,jy=null,e}function Jt(e,t){var n=t[Fy];n===void 0&&(n=t[Fy]=new Set);var r=e+"__bubble";n.has(r)||(vT(t,e,2,!1),n.add(r))}function yg(e,t,n){var r=0;t&&(r|=4),vT(n,e,r,t)}var nu="_reactListening"+Math.random().toString(36).slice(2);function Ul(e){if(!e[nu]){e[nu]=!0,Cj.forEach(function(n){n!=="selectionchange"&&(sO.has(n)||yg(n,!1,e),yg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nu]||(t[nu]=!0,yg("selectionchange",!1,t))}}function vT(e,t,n,r){switch(rT(t)){case 1:var a=vL;break;case 4:a=kL;break;default:a=av}n=a.bind(null,t,n,e),a=void 0,!Cy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function bg(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(s===4)for(s=r.return;s!==null;){var c=s.tag;if((c===3||c===4)&&(c=s.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;s=s.return}for(;l!==null;){if(s=Zi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}Hj(function(){var u=i,d=ev(n),f=[];e:{var g=yT.get(e);if(g!==void 0){var p=sv,m=e;switch(e){case"keypress":if(Bu(n)===0)break e;case"keydown":case"keyup":p=DL;break;case"focusin":m="focus",p=fg;break;case"focusout":m="blur",p=fg;break;case"beforeblur":case"afterblur":p=fg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Nk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=EL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=BL;break;case pT:case hT:case mT:p=CL;break;case xT:p=UL;break;case"scroll":p=_L;break;case"wheel":p=HL;break;case"copy":case"cut":case"paste":p=TL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=jk}var y=(t&4)!==0,v=!y&&e==="scroll",x=y?g!==null?g+"Capture":null:g;y=[];for(var b=u,k;b!==null;){k=b;var N=k.stateNode;if(k.tag===5&&N!==null&&(k=N,x!==null&&(N=Ol(b,x),N!=null&&y.push($l(b,N,k)))),v)break;b=b.return}0<y.length&&(g=new p(g,m,null,n,d),f.push({event:g,listeners:y}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",g&&n!==Sy&&(m=n.relatedTarget||n.fromElement)&&(Zi(m)||m[Wa]))break e;if((p||g)&&(g=d.window===d?d:(g=d.ownerDocument)?g.defaultView||g.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Zi(m):null,m!==null&&(v=xs(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(y=Nk,N="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=jk,N="onPointerLeave",x="onPointerEnter",b="pointer"),v=p==null?g:eo(p),k=m==null?g:eo(m),g=new y(N,b+"leave",p,n,d),g.target=v,g.relatedTarget=k,N=null,Zi(d)===u&&(y=new y(x,b+"enter",m,n,d),y.target=k,y.relatedTarget=v,N=y),v=N,p&&m)t:{for(y=p,x=m,b=0,k=y;k;k=Ps(k))b++;for(k=0,N=x;N;N=Ps(N))k++;for(;0<b-k;)y=Ps(y),b--;for(;0<k-b;)x=Ps(x),k--;for(;b--;){if(y===x||x!==null&&y===x.alternate)break t;y=Ps(y),x=Ps(x)}y=null}else y=null;p!==null&&Bk(f,g,p,y,!1),m!==null&&v!==null&&Bk(f,v,m,y,!0)}}e:{if(g=u?eo(u):window,p=g.nodeName&&g.nodeName.toLowerCase(),p==="select"||p==="input"&&g.type==="file")var _=XL;else if(Ak(g))if(cT)_=eO;else{_=ZL;var w=QL}else(p=g.nodeName)&&p.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(_=JL);if(_&&(_=_(e,u))){lT(f,_,n,d);break e}w&&w(e,g,u),e==="focusout"&&(w=g._wrapperState)&&w.controlled&&g.type==="number"&&vy(g,"number",g.value)}switch(w=u?eo(u):window,e){case"focusin":(Ak(w)||w.contentEditable==="true")&&(Zs=w,Iy=u,kl=null);break;case"focusout":kl=Iy=Zs=null;break;case"mousedown":My=!0;break;case"contextmenu":case"mouseup":case"dragend":My=!1,Dk(f,n,d);break;case"selectionchange":if(rO)break;case"keydown":case"keyup":Dk(f,n,d)}var E;if(lv)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else Qs?sT(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(iT&&n.locale!=="ko"&&(Qs||S!=="onCompositionStart"?S==="onCompositionEnd"&&Qs&&(E=aT()):(xi=d,iv="value"in xi?xi.value:xi.textContent,Qs=!0)),w=od(u,S),0<w.length&&(S=new Ck(S,e,null,n,d),f.push({event:S,listeners:w}),E?S.data=E:(E=oT(n),E!==null&&(S.data=E)))),(E=WL?VL(e,n):GL(e,n))&&(u=od(u,"onBeforeInput"),0<u.length&&(d=new Ck("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=E))}bT(f,t)})}function $l(e,t,n){return{instance:e,listener:t,currentTarget:n}}function od(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Ol(e,n),i!=null&&r.unshift($l(e,i,a)),i=Ol(e,t),i!=null&&r.push($l(e,i,a))),e=e.return}return r}function Ps(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bk(e,t,n,r,a){for(var i=t._reactName,s=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,a?(c=Ol(n,i),c!=null&&s.unshift($l(n,c,l))):a||(c=Ol(n,i),c!=null&&s.push($l(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var oO=/\r\n?/g,lO=/\u0000|\uFFFD/g;function zk(e){return(typeof e=="string"?e:""+e).replace(oO,`
|
|
38
|
-
`).replace(lO,"")}function ru(e,t,n){if(t=zk(t),zk(e)!==t&&n)throw Error(Pe(425))}function ld(){}var Ly=null,Oy=null;function Dy(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Py=typeof setTimeout=="function"?setTimeout:void 0,cO=typeof clearTimeout=="function"?clearTimeout:void 0,Uk=typeof Promise=="function"?Promise:void 0,uO=typeof queueMicrotask=="function"?queueMicrotask:typeof Uk<"u"?function(e){return Uk.resolve(null).then(e).catch(dO)}:Py;function dO(e){setTimeout(function(){throw e})}function vg(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Fl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Fl(t)}function Ei(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function $k(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var To=Math.random().toString(36).slice(2),ba="__reactFiber$"+To,Hl="__reactProps$"+To,Wa="__reactContainer$"+To,Fy="__reactEvents$"+To,fO="__reactListeners$"+To,gO="__reactHandles$"+To;function Zi(e){var t=e[ba];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wa]||n[ba]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$k(e);e!==null;){if(n=e[ba])return n;e=$k(e)}return t}e=n,n=e.parentNode}return null}function gc(e){return e=e[ba]||e[Wa],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function eo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Pe(33))}function Vd(e){return e[Hl]||null}var By=[],to=-1;function Oi(e){return{current:e}}function nn(e){0>to||(e.current=By[to],By[to]=null,to--)}function Zt(e,t){to++,By[to]=e.current,e.current=t}var Ai={},Zn=Oi(Ai),hr=Oi(!1),cs=Ai;function yo(e,t){var n=e.type.contextTypes;if(!n)return Ai;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function mr(e){return e=e.childContextTypes,e!=null}function cd(){nn(hr),nn(Zn)}function Hk(e,t,n){if(Zn.current!==Ai)throw Error(Pe(168));Zt(Zn,t),Zt(hr,n)}function kT(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(Pe(108,QM(e)||"Unknown",a));return pn({},n,r)}function ud(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ai,cs=Zn.current,Zt(Zn,e),Zt(hr,hr.current),!0}function qk(e,t,n){var r=e.stateNode;if(!r)throw Error(Pe(169));n?(e=kT(e,t,cs),r.__reactInternalMemoizedMergedChildContext=e,nn(hr),nn(Zn),Zt(Zn,e)):nn(hr),Zt(hr,n)}var Da=null,Gd=!1,kg=!1;function _T(e){Da===null?Da=[e]:Da.push(e)}function pO(e){Gd=!0,_T(e)}function Di(){if(!kg&&Da!==null){kg=!0;var e=0,t=Ht;try{var n=Da;for(Ht=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Da=null,Gd=!1}catch(a){throw Da!==null&&(Da=Da.slice(e+1)),Gj(tv,Di),a}finally{Ht=t,kg=!1}}return null}var no=[],ro=0,dd=null,fd=0,Pr=[],Fr=0,us=null,Pa=1,Fa="";function Ki(e,t){no[ro++]=fd,no[ro++]=dd,dd=e,fd=t}function wT(e,t,n){Pr[Fr++]=Pa,Pr[Fr++]=Fa,Pr[Fr++]=us,us=e;var r=Pa;e=Fa;var a=32-ra(r)-1;r&=~(1<<a),n+=1;var i=32-ra(t)+a;if(30<i){var s=a-a%5;i=(r&(1<<s)-1).toString(32),r>>=s,a-=s,Pa=1<<32-ra(t)+a|n<<a|r,Fa=i+e}else Pa=1<<i|n<<a|r,Fa=e}function uv(e){e.return!==null&&(Ki(e,1),wT(e,1,0))}function dv(e){for(;e===dd;)dd=no[--ro],no[ro]=null,fd=no[--ro],no[ro]=null;for(;e===us;)us=Pr[--Fr],Pr[Fr]=null,Fa=Pr[--Fr],Pr[Fr]=null,Pa=Pr[--Fr],Pr[Fr]=null}var Tr=null,jr=null,on=!1,na=null;function ET(e,t){var n=zr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Wk(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Tr=e,jr=Ei(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tr=e,jr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=us!==null?{id:Pa,overflow:Fa}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=zr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tr=e,jr=null,!0):!1;default:return!1}}function zy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Uy(e){if(on){var t=jr;if(t){var n=t;if(!Wk(e,t)){if(zy(e))throw Error(Pe(418));t=Ei(n.nextSibling);var r=Tr;t&&Wk(e,t)?ET(r,n):(e.flags=e.flags&-4097|2,on=!1,Tr=e)}}else{if(zy(e))throw Error(Pe(418));e.flags=e.flags&-4097|2,on=!1,Tr=e}}}function Vk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tr=e}function au(e){if(e!==Tr)return!1;if(!on)return Vk(e),on=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Dy(e.type,e.memoizedProps)),t&&(t=jr)){if(zy(e))throw ST(),Error(Pe(418));for(;t;)ET(e,t),t=Ei(t.nextSibling)}if(Vk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Pe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){jr=Ei(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}jr=null}}else jr=Tr?Ei(e.stateNode.nextSibling):null;return!0}function ST(){for(var e=jr;e;)e=Ei(e.nextSibling)}function bo(){jr=Tr=null,on=!1}function fv(e){na===null?na=[e]:na.push(e)}var hO=Ya.ReactCurrentBatchConfig;function Xo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Pe(309));var r=n.stateNode}if(!r)throw Error(Pe(147,e));var a=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=a.refs;s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(Pe(284));if(!n._owner)throw Error(Pe(290,e))}return e}function iu(e,t){throw e=Object.prototype.toString.call(t),Error(Pe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Gk(e){var t=e._init;return t(e._payload)}function NT(e){function t(x,b){if(e){var k=x.deletions;k===null?(x.deletions=[b],x.flags|=16):k.push(b)}}function n(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function r(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function a(x,b){return x=ji(x,b),x.index=0,x.sibling=null,x}function i(x,b,k){return x.index=k,e?(k=x.alternate,k!==null?(k=k.index,k<b?(x.flags|=2,b):k):(x.flags|=2,b)):(x.flags|=1048576,b)}function s(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,b,k,N){return b===null||b.tag!==6?(b=jg(k,x.mode,N),b.return=x,b):(b=a(b,k),b.return=x,b)}function c(x,b,k,N){var _=k.type;return _===Xs?d(x,b,k.props.children,N,k.key):b!==null&&(b.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===ui&&Gk(_)===b.type)?(N=a(b,k.props),N.ref=Xo(x,b,k),N.return=x,N):(N=Vu(k.type,k.key,k.props,null,x.mode,N),N.ref=Xo(x,b,k),N.return=x,N)}function u(x,b,k,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==k.containerInfo||b.stateNode.implementation!==k.implementation?(b=Tg(k,x.mode,N),b.return=x,b):(b=a(b,k.children||[]),b.return=x,b)}function d(x,b,k,N,_){return b===null||b.tag!==7?(b=is(k,x.mode,N,_),b.return=x,b):(b=a(b,k),b.return=x,b)}function f(x,b,k){if(typeof b=="string"&&b!==""||typeof b=="number")return b=jg(""+b,x.mode,k),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Kc:return k=Vu(b.type,b.key,b.props,null,x.mode,k),k.ref=Xo(x,null,b),k.return=x,k;case Ys:return b=Tg(b,x.mode,k),b.return=x,b;case ui:var N=b._init;return f(x,N(b._payload),k)}if(sl(b)||Wo(b))return b=is(b,x.mode,k,null),b.return=x,b;iu(x,b)}return null}function g(x,b,k,N){var _=b!==null?b.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return _!==null?null:l(x,b,""+k,N);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Kc:return k.key===_?c(x,b,k,N):null;case Ys:return k.key===_?u(x,b,k,N):null;case ui:return _=k._init,g(x,b,_(k._payload),N)}if(sl(k)||Wo(k))return _!==null?null:d(x,b,k,N,null);iu(x,k)}return null}function p(x,b,k,N,_){if(typeof N=="string"&&N!==""||typeof N=="number")return x=x.get(k)||null,l(b,x,""+N,_);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Kc:return x=x.get(N.key===null?k:N.key)||null,c(b,x,N,_);case Ys:return x=x.get(N.key===null?k:N.key)||null,u(b,x,N,_);case ui:var w=N._init;return p(x,b,k,w(N._payload),_)}if(sl(N)||Wo(N))return x=x.get(k)||null,d(b,x,N,_,null);iu(b,N)}return null}function m(x,b,k,N){for(var _=null,w=null,E=b,S=b=0,M=null;E!==null&&S<k.length;S++){E.index>S?(M=E,E=null):M=E.sibling;var j=g(x,E,k[S],N);if(j===null){E===null&&(E=M);break}e&&E&&j.alternate===null&&t(x,E),b=i(j,b,S),w===null?_=j:w.sibling=j,w=j,E=M}if(S===k.length)return n(x,E),on&&Ki(x,S),_;if(E===null){for(;S<k.length;S++)E=f(x,k[S],N),E!==null&&(b=i(E,b,S),w===null?_=E:w.sibling=E,w=E);return on&&Ki(x,S),_}for(E=r(x,E);S<k.length;S++)M=p(E,x,S,k[S],N),M!==null&&(e&&M.alternate!==null&&E.delete(M.key===null?S:M.key),b=i(M,b,S),w===null?_=M:w.sibling=M,w=M);return e&&E.forEach(function(F){return t(x,F)}),on&&Ki(x,S),_}function y(x,b,k,N){var _=Wo(k);if(typeof _!="function")throw Error(Pe(150));if(k=_.call(k),k==null)throw Error(Pe(151));for(var w=_=null,E=b,S=b=0,M=null,j=k.next();E!==null&&!j.done;S++,j=k.next()){E.index>S?(M=E,E=null):M=E.sibling;var F=g(x,E,j.value,N);if(F===null){E===null&&(E=M);break}e&&E&&F.alternate===null&&t(x,E),b=i(F,b,S),w===null?_=F:w.sibling=F,w=F,E=M}if(j.done)return n(x,E),on&&Ki(x,S),_;if(E===null){for(;!j.done;S++,j=k.next())j=f(x,j.value,N),j!==null&&(b=i(j,b,S),w===null?_=j:w.sibling=j,w=j);return on&&Ki(x,S),_}for(E=r(x,E);!j.done;S++,j=k.next())j=p(E,x,S,j.value,N),j!==null&&(e&&j.alternate!==null&&E.delete(j.key===null?S:j.key),b=i(j,b,S),w===null?_=j:w.sibling=j,w=j);return e&&E.forEach(function(P){return t(x,P)}),on&&Ki(x,S),_}function v(x,b,k,N){if(typeof k=="object"&&k!==null&&k.type===Xs&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Kc:e:{for(var _=k.key,w=b;w!==null;){if(w.key===_){if(_=k.type,_===Xs){if(w.tag===7){n(x,w.sibling),b=a(w,k.props.children),b.return=x,x=b;break e}}else if(w.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===ui&&Gk(_)===w.type){n(x,w.sibling),b=a(w,k.props),b.ref=Xo(x,w,k),b.return=x,x=b;break e}n(x,w);break}else t(x,w);w=w.sibling}k.type===Xs?(b=is(k.props.children,x.mode,N,k.key),b.return=x,x=b):(N=Vu(k.type,k.key,k.props,null,x.mode,N),N.ref=Xo(x,b,k),N.return=x,x=N)}return s(x);case Ys:e:{for(w=k.key;b!==null;){if(b.key===w)if(b.tag===4&&b.stateNode.containerInfo===k.containerInfo&&b.stateNode.implementation===k.implementation){n(x,b.sibling),b=a(b,k.children||[]),b.return=x,x=b;break e}else{n(x,b);break}else t(x,b);b=b.sibling}b=Tg(k,x.mode,N),b.return=x,x=b}return s(x);case ui:return w=k._init,v(x,b,w(k._payload),N)}if(sl(k))return m(x,b,k,N);if(Wo(k))return y(x,b,k,N);iu(x,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,b!==null&&b.tag===6?(n(x,b.sibling),b=a(b,k),b.return=x,x=b):(n(x,b),b=jg(k,x.mode,N),b.return=x,x=b),s(x)):n(x,b)}return v}var vo=NT(!0),CT=NT(!1),gd=Oi(null),pd=null,ao=null,gv=null;function pv(){gv=ao=pd=null}function hv(e){var t=gd.current;nn(gd),e._currentValue=t}function $y(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fo(e,t){pd=e,gv=ao=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function qr(e){var t=e._currentValue;if(gv!==e)if(e={context:e,memoizedValue:t,next:null},ao===null){if(pd===null)throw Error(Pe(308));ao=e,pd.dependencies={lanes:0,firstContext:e}}else ao=ao.next=e;return t}var Ji=null;function mv(e){Ji===null?Ji=[e]:Ji.push(e)}function jT(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,mv(t)):(n.next=a.next,a.next=n),t.interleaved=n,Va(e,r)}function Va(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var di=!1;function xv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function TT(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function $a(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Si(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ft&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Va(e,n)}return a=r.interleaved,a===null?(t.next=t,mv(r)):(t.next=a.next,a.next=t),r.interleaved=t,Va(e,n)}function zu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nv(e,n)}}function Kk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function hd(e,t,n,r){var a=e.updateQueue;di=!1;var i=a.firstBaseUpdate,s=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?i=u:s.next=u,s=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=a.baseState;s=0,d=u=c=null,l=i;do{var g=l.lane,p=l.eventTime;if((r&g)===g){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,y=l;switch(g=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,g);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,g=typeof m=="function"?m.call(p,f,g):m,g==null)break e;f=pn({},f,g);break e;case 2:di=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=a.effects,g===null?a.effects=[l]:g.push(l))}else p={eventTime:p,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,s|=g;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;g=l,l=g.next,g.next=null,a.lastBaseUpdate=g,a.shared.pending=null}}while(!0);if(d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,t=a.shared.interleaved,t!==null){a=t;do s|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);fs|=s,e.lanes=s,e.memoizedState=f}}function Yk(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(Pe(191,a));a.call(r)}}}var pc={},wa=Oi(pc),ql=Oi(pc),Wl=Oi(pc);function es(e){if(e===pc)throw Error(Pe(174));return e}function yv(e,t){switch(Zt(Wl,t),Zt(ql,e),Zt(wa,pc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_y(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_y(t,e)}nn(wa),Zt(wa,t)}function ko(){nn(wa),nn(ql),nn(Wl)}function RT(e){es(Wl.current);var t=es(wa.current),n=_y(t,e.type);t!==n&&(Zt(ql,e),Zt(wa,n))}function bv(e){ql.current===e&&(nn(wa),nn(ql))}var fn=Oi(0);function md(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _g=[];function vv(){for(var e=0;e<_g.length;e++)_g[e]._workInProgressVersionPrimary=null;_g.length=0}var Uu=Ya.ReactCurrentDispatcher,wg=Ya.ReactCurrentBatchConfig,ds=0,gn=null,Nn=null,Mn=null,xd=!1,_l=!1,Vl=0,mO=0;function Wn(){throw Error(Pe(321))}function kv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!oa(e[n],t[n]))return!1;return!0}function _v(e,t,n,r,a,i){if(ds=i,gn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Uu.current=e===null||e.memoizedState===null?vO:kO,e=n(r,a),_l){i=0;do{if(_l=!1,Vl=0,25<=i)throw Error(Pe(301));i+=1,Mn=Nn=null,t.updateQueue=null,Uu.current=_O,e=n(r,a)}while(_l)}if(Uu.current=yd,t=Nn!==null&&Nn.next!==null,ds=0,Mn=Nn=gn=null,xd=!1,t)throw Error(Pe(300));return e}function wv(){var e=Vl!==0;return Vl=0,e}function ma(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?gn.memoizedState=Mn=e:Mn=Mn.next=e,Mn}function Wr(){if(Nn===null){var e=gn.alternate;e=e!==null?e.memoizedState:null}else e=Nn.next;var t=Mn===null?gn.memoizedState:Mn.next;if(t!==null)Mn=t,Nn=e;else{if(e===null)throw Error(Pe(310));Nn=e,e={memoizedState:Nn.memoizedState,baseState:Nn.baseState,baseQueue:Nn.baseQueue,queue:Nn.queue,next:null},Mn===null?gn.memoizedState=Mn=e:Mn=Mn.next=e}return Mn}function Gl(e,t){return typeof t=="function"?t(e):t}function Eg(e){var t=Wr(),n=t.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=e;var r=Nn,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var s=a.next;a.next=i.next,i.next=s}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var l=s=null,c=null,u=i;do{var d=u.lane;if((ds&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,s=r):c=c.next=f,gn.lanes|=d,fs|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,oa(r,t.memoizedState)||(pr=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do i=a.lane,gn.lanes|=i,fs|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Sg(e){var t=Wr(),n=t.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do i=e(i,s.action),s=s.next;while(s!==a);oa(i,t.memoizedState)||(pr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function AT(){}function IT(e,t){var n=gn,r=Wr(),a=t(),i=!oa(r.memoizedState,a);if(i&&(r.memoizedState=a,pr=!0),r=r.queue,Ev(OT.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Mn!==null&&Mn.memoizedState.tag&1){if(n.flags|=2048,Kl(9,LT.bind(null,n,r,a,t),void 0,null),Ln===null)throw Error(Pe(349));ds&30||MT(n,t,a)}return a}function MT(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=gn.updateQueue,t===null?(t={lastEffect:null,stores:null},gn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function LT(e,t,n,r){t.value=n,t.getSnapshot=r,DT(t)&&PT(e)}function OT(e,t,n){return n(function(){DT(t)&&PT(e)})}function DT(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!oa(e,n)}catch{return!0}}function PT(e){var t=Va(e,1);t!==null&&aa(t,e,1,-1)}function Xk(e){var t=ma();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gl,lastRenderedState:e},t.queue=e,e=e.dispatch=bO.bind(null,gn,e),[t.memoizedState,e]}function Kl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=gn.updateQueue,t===null?(t={lastEffect:null,stores:null},gn.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function FT(){return Wr().memoizedState}function $u(e,t,n,r){var a=ma();gn.flags|=e,a.memoizedState=Kl(1|t,n,void 0,r===void 0?null:r)}function Kd(e,t,n,r){var a=Wr();r=r===void 0?null:r;var i=void 0;if(Nn!==null){var s=Nn.memoizedState;if(i=s.destroy,r!==null&&kv(r,s.deps)){a.memoizedState=Kl(t,n,i,r);return}}gn.flags|=e,a.memoizedState=Kl(1|t,n,i,r)}function Qk(e,t){return $u(8390656,8,e,t)}function Ev(e,t){return Kd(2048,8,e,t)}function BT(e,t){return Kd(4,2,e,t)}function zT(e,t){return Kd(4,4,e,t)}function UT(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $T(e,t,n){return n=n!=null?n.concat([e]):null,Kd(4,4,UT.bind(null,t,e),n)}function Sv(){}function HT(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function qT(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function WT(e,t,n){return ds&21?(oa(n,t)||(n=Xj(),gn.lanes|=n,fs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=n)}function xO(e,t){var n=Ht;Ht=n!==0&&4>n?n:4,e(!0);var r=wg.transition;wg.transition={};try{e(!1),t()}finally{Ht=n,wg.transition=r}}function VT(){return Wr().memoizedState}function yO(e,t,n){var r=Ci(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},GT(e))KT(t,n);else if(n=jT(e,t,n,r),n!==null){var a=sr();aa(n,e,r,a),YT(n,t,r)}}function bO(e,t,n){var r=Ci(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(GT(e))KT(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(a.hasEagerState=!0,a.eagerState=l,oa(l,s)){var c=t.interleaved;c===null?(a.next=a,mv(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=jT(e,t,a,r),n!==null&&(a=sr(),aa(n,e,r,a),YT(n,t,r))}}function GT(e){var t=e.alternate;return e===gn||t!==null&&t===gn}function KT(e,t){_l=xd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function YT(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nv(e,n)}}var yd={readContext:qr,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useInsertionEffect:Wn,useLayoutEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useMutableSource:Wn,useSyncExternalStore:Wn,useId:Wn,unstable_isNewReconciler:!1},vO={readContext:qr,useCallback:function(e,t){return ma().memoizedState=[e,t===void 0?null:t],e},useContext:qr,useEffect:Qk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$u(4194308,4,UT.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $u(4194308,4,e,t)},useInsertionEffect:function(e,t){return $u(4,2,e,t)},useMemo:function(e,t){var n=ma();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ma();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=yO.bind(null,gn,e),[r.memoizedState,e]},useRef:function(e){var t=ma();return e={current:e},t.memoizedState=e},useState:Xk,useDebugValue:Sv,useDeferredValue:function(e){return ma().memoizedState=e},useTransition:function(){var e=Xk(!1),t=e[0];return e=xO.bind(null,e[1]),ma().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=gn,a=ma();if(on){if(n===void 0)throw Error(Pe(407));n=n()}else{if(n=t(),Ln===null)throw Error(Pe(349));ds&30||MT(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,Qk(OT.bind(null,r,i,e),[e]),r.flags|=2048,Kl(9,LT.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ma(),t=Ln.identifierPrefix;if(on){var n=Fa,r=Pa;n=(r&~(1<<32-ra(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Vl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=mO++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},kO={readContext:qr,useCallback:HT,useContext:qr,useEffect:Ev,useImperativeHandle:$T,useInsertionEffect:BT,useLayoutEffect:zT,useMemo:qT,useReducer:Eg,useRef:FT,useState:function(){return Eg(Gl)},useDebugValue:Sv,useDeferredValue:function(e){var t=Wr();return WT(t,Nn.memoizedState,e)},useTransition:function(){var e=Eg(Gl)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:AT,useSyncExternalStore:IT,useId:VT,unstable_isNewReconciler:!1},_O={readContext:qr,useCallback:HT,useContext:qr,useEffect:Ev,useImperativeHandle:$T,useInsertionEffect:BT,useLayoutEffect:zT,useMemo:qT,useReducer:Sg,useRef:FT,useState:function(){return Sg(Gl)},useDebugValue:Sv,useDeferredValue:function(e){var t=Wr();return Nn===null?t.memoizedState=e:WT(t,Nn.memoizedState,e)},useTransition:function(){var e=Sg(Gl)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:AT,useSyncExternalStore:IT,useId:VT,unstable_isNewReconciler:!1};function ea(e,t){if(e&&e.defaultProps){t=pn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Hy(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Yd={isMounted:function(e){return(e=e._reactInternals)?xs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=sr(),a=Ci(e),i=$a(r,a);i.payload=t,n!=null&&(i.callback=n),t=Si(e,i,a),t!==null&&(aa(t,e,a,r),zu(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=sr(),a=Ci(e),i=$a(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Si(e,i,a),t!==null&&(aa(t,e,a,r),zu(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=sr(),r=Ci(e),a=$a(n,r);a.tag=2,t!=null&&(a.callback=t),t=Si(e,a,r),t!==null&&(aa(t,e,r,n),zu(t,e,r))}};function Zk(e,t,n,r,a,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!zl(n,r)||!zl(a,i):!0}function XT(e,t,n){var r=!1,a=Ai,i=t.contextType;return typeof i=="object"&&i!==null?i=qr(i):(a=mr(t)?cs:Zn.current,r=t.contextTypes,i=(r=r!=null)?yo(e,a):Ai),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Yd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function Jk(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Yd.enqueueReplaceState(t,t.state,null)}function qy(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},xv(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=qr(i):(i=mr(t)?cs:Zn.current,a.context=yo(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Hy(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&Yd.enqueueReplaceState(a,a.state,null),hd(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function _o(e,t){try{var n="",r=t;do n+=XM(r),r=r.return;while(r);var a=n}catch(i){a=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:a,digest:null}}function Ng(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Wy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var wO=typeof WeakMap=="function"?WeakMap:Map;function QT(e,t,n){n=$a(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vd||(vd=!0,tb=r),Wy(e,t)},n}function ZT(e,t,n){n=$a(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Wy(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Wy(e,t),typeof r!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function e_(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new wO;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=PO.bind(null,e,t,n),t.then(e,e))}function t_(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function n_(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=$a(-1,1),t.tag=2,Si(n,t,1))),n.lanes|=1),e)}var EO=Ya.ReactCurrentOwner,pr=!1;function ar(e,t,n,r){t.child=e===null?CT(t,null,n,r):vo(t,e.child,n,r)}function r_(e,t,n,r,a){n=n.render;var i=t.ref;return fo(t,a),r=_v(e,t,n,r,i,a),n=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Ga(e,t,a)):(on&&n&&uv(t),t.flags|=1,ar(e,t,r,a),t.child)}function a_(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!Mv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,JT(e,t,i,r,a)):(e=Vu(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:zl,n(s,r)&&e.ref===t.ref)return Ga(e,t,a)}return t.flags|=1,e=ji(i,r),e.ref=t.ref,e.return=t,t.child=e}function JT(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(zl(i,r)&&e.ref===t.ref)if(pr=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,Ga(e,t,a)}return Vy(e,t,n,r,a)}function e5(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Zt(so,Sr),Sr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Zt(so,Sr),Sr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Zt(so,Sr),Sr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Zt(so,Sr),Sr|=r;return ar(e,t,a,n),t.child}function t5(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vy(e,t,n,r,a){var i=mr(n)?cs:Zn.current;return i=yo(t,i),fo(t,a),n=_v(e,t,n,r,i,a),r=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Ga(e,t,a)):(on&&r&&uv(t),t.flags|=1,ar(e,t,n,a),t.child)}function i_(e,t,n,r,a){if(mr(n)){var i=!0;ud(t)}else i=!1;if(fo(t,a),t.stateNode===null)Hu(e,t),XT(t,n,r),qy(t,n,r,a),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=qr(u):(u=mr(n)?cs:Zn.current,u=yo(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Jk(t,s,r,u),di=!1;var g=t.memoizedState;s.state=g,hd(t,r,s,a),c=t.memoizedState,l!==r||g!==c||hr.current||di?(typeof d=="function"&&(Hy(t,n,d,r),c=t.memoizedState),(l=di||Zk(t,n,l,r,g,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,TT(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ea(t.type,l),s.props=u,f=t.pendingProps,g=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=qr(c):(c=mr(n)?cs:Zn.current,c=yo(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||g!==c)&&Jk(t,s,r,c),di=!1,g=t.memoizedState,s.state=g,hd(t,r,s,a);var m=t.memoizedState;l!==f||g!==m||hr.current||di?(typeof p=="function"&&(Hy(t,n,p,r),m=t.memoizedState),(u=di||Zk(t,n,u,r,g,m,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Gy(e,t,n,r,i,a)}function Gy(e,t,n,r,a,i){t5(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return a&&qk(t,n,!1),Ga(e,t,i);r=t.stateNode,EO.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=vo(t,e.child,null,i),t.child=vo(t,null,l,i)):ar(e,t,l,i),t.memoizedState=r.state,a&&qk(t,n,!0),t.child}function n5(e){var t=e.stateNode;t.pendingContext?Hk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hk(e,t.context,!1),yv(e,t.containerInfo)}function s_(e,t,n,r,a){return bo(),fv(a),t.flags|=256,ar(e,t,n,r),t.child}var Ky={dehydrated:null,treeContext:null,retryLane:0};function Yy(e){return{baseLanes:e,cachePool:null,transitions:null}}function r5(e,t,n){var r=t.pendingProps,a=fn.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Zt(fn,a&1),e===null)return Uy(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Zd(s,r,0,null),e=is(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Yy(n),t.memoizedState=Ky,e):Nv(t,s));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return SO(e,t,s,r,l,a,n);if(i){i=r.fallback,s=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ji(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=ji(l,i):(i=is(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Yy(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Ky,r}return i=e.child,e=i.sibling,r=ji(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Nv(e,t){return t=Zd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function su(e,t,n,r){return r!==null&&fv(r),vo(t,e.child,null,n),e=Nv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function SO(e,t,n,r,a,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Ng(Error(Pe(422))),su(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Zd({mode:"visible",children:r.children},a,0,null),i=is(i,a,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&vo(t,e.child,null,s),t.child.memoizedState=Yy(s),t.memoizedState=Ky,i);if(!(t.mode&1))return su(e,t,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Pe(419)),r=Ng(i,r,void 0),su(e,t,s,r)}if(l=(s&e.childLanes)!==0,pr||l){if(r=Ln,r!==null){switch(s&-s){case 4:a=2;break;case 16:a=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:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|s)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,Va(e,a),aa(r,e,a,-1))}return Iv(),r=Ng(Error(Pe(421))),su(e,t,s,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=FO.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,jr=Ei(a.nextSibling),Tr=t,on=!0,na=null,e!==null&&(Pr[Fr++]=Pa,Pr[Fr++]=Fa,Pr[Fr++]=us,Pa=e.id,Fa=e.overflow,us=t),t=Nv(t,r.children),t.flags|=4096,t)}function o_(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$y(e.return,t,n)}function Cg(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function a5(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(ar(e,t,r.children,n),r=fn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&o_(e,n,t);else if(e.tag===19)o_(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Zt(fn,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&md(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Cg(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&md(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Cg(t,!0,n,null,i);break;case"together":Cg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ga(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Pe(153));if(t.child!==null){for(e=t.child,n=ji(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ji(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function NO(e,t,n){switch(t.tag){case 3:n5(t),bo();break;case 5:RT(t);break;case 1:mr(t.type)&&ud(t);break;case 4:yv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Zt(gd,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Zt(fn,fn.current&1),t.flags|=128,null):n&t.child.childLanes?r5(e,t,n):(Zt(fn,fn.current&1),e=Ga(e,t,n),e!==null?e.sibling:null);Zt(fn,fn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return a5(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Zt(fn,fn.current),r)break;return null;case 22:case 23:return t.lanes=0,e5(e,t,n)}return Ga(e,t,n)}var i5,Xy,s5,o5;i5=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Xy=function(){};s5=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,es(wa.current);var i=null;switch(n){case"input":a=yy(e,a),r=yy(e,r),i=[];break;case"select":a=pn({},a,{value:void 0}),r=pn({},r,{value:void 0}),i=[];break;case"textarea":a=ky(e,a),r=ky(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ld)}wy(n,r);var s;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ml.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ml.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Jt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};o5=function(e,t,n,r){n!==r&&(t.flags|=4)};function Qo(e,t){if(!on)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Vn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function CO(e,t,n){var r=t.pendingProps;switch(dv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vn(t),null;case 1:return mr(t.type)&&cd(),Vn(t),null;case 3:return r=t.stateNode,ko(),nn(hr),nn(Zn),vv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(au(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,na!==null&&(ab(na),na=null))),Xy(e,t),Vn(t),null;case 5:bv(t);var a=es(Wl.current);if(n=t.type,e!==null&&t.stateNode!=null)s5(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Pe(166));return Vn(t),null}if(e=es(wa.current),au(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ba]=t,r[Hl]=i,e=(t.mode&1)!==0,n){case"dialog":Jt("cancel",r),Jt("close",r);break;case"iframe":case"object":case"embed":Jt("load",r);break;case"video":case"audio":for(a=0;a<ll.length;a++)Jt(ll[a],r);break;case"source":Jt("error",r);break;case"img":case"image":case"link":Jt("error",r),Jt("load",r);break;case"details":Jt("toggle",r);break;case"input":mk(r,i),Jt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Jt("invalid",r);break;case"textarea":yk(r,i),Jt("invalid",r)}wy(n,i),a=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",""+l]):Ml.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&Jt("scroll",r)}switch(n){case"input":Yc(r),xk(r,i,!0);break;case"textarea":Yc(r),bk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ld)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Oj(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ba]=t,e[Hl]=r,i5(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ey(n,r),n){case"dialog":Jt("cancel",e),Jt("close",e),a=r;break;case"iframe":case"object":case"embed":Jt("load",e),a=r;break;case"video":case"audio":for(a=0;a<ll.length;a++)Jt(ll[a],e);a=r;break;case"source":Jt("error",e),a=r;break;case"img":case"image":case"link":Jt("error",e),Jt("load",e),a=r;break;case"details":Jt("toggle",e),a=r;break;case"input":mk(e,r),a=yy(e,r),Jt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=pn({},r,{value:void 0}),Jt("invalid",e);break;case"textarea":yk(e,r),a=ky(e,r),Jt("invalid",e);break;default:a=r}wy(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Fj(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Dj(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ll(e,c):typeof c=="number"&&Ll(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ml.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Jt("scroll",e):c!=null&&Xb(e,i,c,s))}switch(n){case"input":Yc(e),xk(e,r,!1);break;case"textarea":Yc(e),bk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ri(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?oo(e,!!r.multiple,i,!1):r.defaultValue!=null&&oo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=ld)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Vn(t),null;case 6:if(e&&t.stateNode!=null)o5(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Pe(166));if(n=es(Wl.current),es(wa.current),au(t)){if(r=t.stateNode,n=t.memoizedProps,r[ba]=t,(i=r.nodeValue!==n)&&(e=Tr,e!==null))switch(e.tag){case 3:ru(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ru(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ba]=t,t.stateNode=r}return Vn(t),null;case 13:if(nn(fn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(on&&jr!==null&&t.mode&1&&!(t.flags&128))ST(),bo(),t.flags|=98560,i=!1;else if(i=au(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Pe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Pe(317));i[ba]=t}else bo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vn(t),i=!1}else na!==null&&(ab(na),na=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||fn.current&1?jn===0&&(jn=3):Iv())),t.updateQueue!==null&&(t.flags|=4),Vn(t),null);case 4:return ko(),Xy(e,t),e===null&&Ul(t.stateNode.containerInfo),Vn(t),null;case 10:return hv(t.type._context),Vn(t),null;case 17:return mr(t.type)&&cd(),Vn(t),null;case 19:if(nn(fn),i=t.memoizedState,i===null)return Vn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Qo(i,!1);else{if(jn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=md(e),s!==null){for(t.flags|=128,Qo(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Zt(fn,fn.current&1|2),t.child}e=e.sibling}i.tail!==null&&bn()>wo&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304)}else{if(!r)if(e=md(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!on)return Vn(t),null}else 2*bn()-i.renderingStartTime>wo&&n!==1073741824&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=bn(),t.sibling=null,n=fn.current,Zt(fn,r?n&1|2:n&1),t):(Vn(t),null);case 22:case 23:return Av(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Sr&1073741824&&(Vn(t),t.subtreeFlags&6&&(t.flags|=8192)):Vn(t),null;case 24:return null;case 25:return null}throw Error(Pe(156,t.tag))}function jO(e,t){switch(dv(t),t.tag){case 1:return mr(t.type)&&cd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ko(),nn(hr),nn(Zn),vv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bv(t),null;case 13:if(nn(fn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Pe(340));bo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return nn(fn),null;case 4:return ko(),null;case 10:return hv(t.type._context),null;case 22:case 23:return Av(),null;case 24:return null;default:return null}}var ou=!1,Kn=!1,TO=typeof WeakSet=="function"?WeakSet:Set,Je=null;function io(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yn(e,t,r)}else n.current=null}function Qy(e,t,n){try{n()}catch(r){yn(e,t,r)}}var l_=!1;function RO(e,t){if(Ly=id,e=fT(),cv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(l=s+a),f!==i||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)g=f,f=p;for(;;){if(f===e)break t;if(g===n&&++u===a&&(l=s),g===i&&++d===r&&(c=s),(p=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oy={focusedElem:e,selectionRange:n},id=!1,Je=t;Je!==null;)if(t=Je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Je=e;else for(;Je!==null;){t=Je;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,v=m.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:ea(t.type,y),v);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(N){yn(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Je=e;break}Je=t.return}return m=l_,l_=!1,m}function wl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&Qy(t,n,i)}a=a.next}while(a!==r)}}function Xd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Zy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function l5(e){var t=e.alternate;t!==null&&(e.alternate=null,l5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ba],delete t[Hl],delete t[Fy],delete t[fO],delete t[gO])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function c5(e){return e.tag===5||e.tag===3||e.tag===4}function c_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||c5(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jy(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ld));else if(r!==4&&(e=e.child,e!==null))for(Jy(e,t,n),e=e.sibling;e!==null;)Jy(e,t,n),e=e.sibling}function eb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(eb(e,t,n),e=e.sibling;e!==null;)eb(e,t,n),e=e.sibling}var Fn=null,ta=!1;function ii(e,t,n){for(n=n.child;n!==null;)u5(e,t,n),n=n.sibling}function u5(e,t,n){if(_a&&typeof _a.onCommitFiberUnmount=="function")try{_a.onCommitFiberUnmount($d,n)}catch{}switch(n.tag){case 5:Kn||io(n,t);case 6:var r=Fn,a=ta;Fn=null,ii(e,t,n),Fn=r,ta=a,Fn!==null&&(ta?(e=Fn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Fn.removeChild(n.stateNode));break;case 18:Fn!==null&&(ta?(e=Fn,n=n.stateNode,e.nodeType===8?vg(e.parentNode,n):e.nodeType===1&&vg(e,n),Fl(e)):vg(Fn,n.stateNode));break;case 4:r=Fn,a=ta,Fn=n.stateNode.containerInfo,ta=!0,ii(e,t,n),Fn=r,ta=a;break;case 0:case 11:case 14:case 15:if(!Kn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Qy(n,t,s),a=a.next}while(a!==r)}ii(e,t,n);break;case 1:if(!Kn&&(io(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){yn(n,t,l)}ii(e,t,n);break;case 21:ii(e,t,n);break;case 22:n.mode&1?(Kn=(r=Kn)||n.memoizedState!==null,ii(e,t,n),Kn=r):ii(e,t,n);break;default:ii(e,t,n)}}function u_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TO),t.forEach(function(r){var a=BO.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Qr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:Fn=l.stateNode,ta=!1;break e;case 3:Fn=l.stateNode.containerInfo,ta=!0;break e;case 4:Fn=l.stateNode.containerInfo,ta=!0;break e}l=l.return}if(Fn===null)throw Error(Pe(160));u5(i,s,a),Fn=null,ta=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){yn(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)d5(t,e),t=t.sibling}function d5(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Qr(t,e),pa(e),r&4){try{wl(3,e,e.return),Xd(3,e)}catch(y){yn(e,e.return,y)}try{wl(5,e,e.return)}catch(y){yn(e,e.return,y)}}break;case 1:Qr(t,e),pa(e),r&512&&n!==null&&io(n,n.return);break;case 5:if(Qr(t,e),pa(e),r&512&&n!==null&&io(n,n.return),e.flags&32){var a=e.stateNode;try{Ll(a,"")}catch(y){yn(e,e.return,y)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Mj(a,i),Ey(l,s);var u=Ey(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?Fj(a,f):d==="dangerouslySetInnerHTML"?Dj(a,f):d==="children"?Ll(a,f):Xb(a,d,f,u)}switch(l){case"input":by(a,i);break;case"textarea":Lj(a,i);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?oo(a,!!i.multiple,p,!1):g!==!!i.multiple&&(i.defaultValue!=null?oo(a,!!i.multiple,i.defaultValue,!0):oo(a,!!i.multiple,i.multiple?[]:"",!1))}a[Hl]=i}catch(y){yn(e,e.return,y)}}break;case 6:if(Qr(t,e),pa(e),r&4){if(e.stateNode===null)throw Error(Pe(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){yn(e,e.return,y)}}break;case 3:if(Qr(t,e),pa(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fl(t.containerInfo)}catch(y){yn(e,e.return,y)}break;case 4:Qr(t,e),pa(e);break;case 13:Qr(t,e),pa(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(Tv=bn())),r&4&&u_(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Kn=(u=Kn)||d,Qr(t,e),Kn=u):Qr(t,e),pa(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Je=e,d=e.child;d!==null;){for(f=Je=d;Je!==null;){switch(g=Je,p=g.child,g.tag){case 0:case 11:case 14:case 15:wl(4,g,g.return);break;case 1:io(g,g.return);var m=g.stateNode;if(typeof m.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){yn(r,n,y)}}break;case 5:io(g,g.return);break;case 22:if(g.memoizedState!==null){f_(f);continue}}p!==null?(p.return=g,Je=p):f_(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,s=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Pj("display",s))}catch(y){yn(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){yn(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Qr(t,e),pa(e),r&4&&u_(e);break;case 21:break;default:Qr(t,e),pa(e)}}function pa(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(c5(n)){var r=n;break e}n=n.return}throw Error(Pe(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ll(a,""),r.flags&=-33);var i=c_(e);eb(e,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,l=c_(e);Jy(e,l,s);break;default:throw Error(Pe(161))}}catch(c){yn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function AO(e,t,n){Je=e,f5(e)}function f5(e,t,n){for(var r=(e.mode&1)!==0;Je!==null;){var a=Je,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||ou;if(!s){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Kn;l=ou;var u=Kn;if(ou=s,(Kn=c)&&!u)for(Je=a;Je!==null;)s=Je,c=s.child,s.tag===22&&s.memoizedState!==null?g_(a):c!==null?(c.return=s,Je=c):g_(a);for(;i!==null;)Je=i,f5(i),i=i.sibling;Je=a,ou=l,Kn=u}d_(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,Je=i):d_(e)}}function d_(e){for(;Je!==null;){var t=Je;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Kn||Xd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Kn)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ea(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Yk(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Yk(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Fl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Pe(163))}Kn||t.flags&512&&Zy(t)}catch(g){yn(t,t.return,g)}}if(t===e){Je=null;break}if(n=t.sibling,n!==null){n.return=t.return,Je=n;break}Je=t.return}}function f_(e){for(;Je!==null;){var t=Je;if(t===e){Je=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Je=n;break}Je=t.return}}function g_(e){for(;Je!==null;){var t=Je;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Xd(4,t)}catch(c){yn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){yn(t,a,c)}}var i=t.return;try{Zy(t)}catch(c){yn(t,i,c)}break;case 5:var s=t.return;try{Zy(t)}catch(c){yn(t,s,c)}}}catch(c){yn(t,t.return,c)}if(t===e){Je=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Je=l;break}Je=t.return}}var IO=Math.ceil,bd=Ya.ReactCurrentDispatcher,Cv=Ya.ReactCurrentOwner,Hr=Ya.ReactCurrentBatchConfig,Ft=0,Ln=null,kn=null,zn=0,Sr=0,so=Oi(0),jn=0,Yl=null,fs=0,Qd=0,jv=0,El=null,gr=null,Tv=0,wo=1/0,Oa=null,vd=!1,tb=null,Ni=null,lu=!1,yi=null,kd=0,Sl=0,nb=null,qu=-1,Wu=0;function sr(){return Ft&6?bn():qu!==-1?qu:qu=bn()}function Ci(e){return e.mode&1?Ft&2&&zn!==0?zn&-zn:hO.transition!==null?(Wu===0&&(Wu=Xj()),Wu):(e=Ht,e!==0||(e=window.event,e=e===void 0?16:rT(e.type)),e):1}function aa(e,t,n,r){if(50<Sl)throw Sl=0,nb=null,Error(Pe(185));dc(e,n,r),(!(Ft&2)||e!==Ln)&&(e===Ln&&(!(Ft&2)&&(Qd|=n),jn===4&&gi(e,zn)),xr(e,r),n===1&&Ft===0&&!(t.mode&1)&&(wo=bn()+500,Gd&&Di()))}function xr(e,t){var n=e.callbackNode;hL(e,t);var r=ad(e,e===Ln?zn:0);if(r===0)n!==null&&_k(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_k(n),t===1)e.tag===0?pO(p_.bind(null,e)):_T(p_.bind(null,e)),uO(function(){!(Ft&6)&&Di()}),n=null;else{switch(Qj(r)){case 1:n=tv;break;case 4:n=Kj;break;case 16:n=rd;break;case 536870912:n=Yj;break;default:n=rd}n=v5(n,g5.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function g5(e,t){if(qu=-1,Wu=0,Ft&6)throw Error(Pe(327));var n=e.callbackNode;if(go()&&e.callbackNode!==n)return null;var r=ad(e,e===Ln?zn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=_d(e,r);else{t=r;var a=Ft;Ft|=2;var i=h5();(Ln!==e||zn!==t)&&(Oa=null,wo=bn()+500,as(e,t));do try{OO();break}catch(l){p5(e,l)}while(!0);pv(),bd.current=i,Ft=a,kn!==null?t=0:(Ln=null,zn=0,t=jn)}if(t!==0){if(t===2&&(a=Ty(e),a!==0&&(r=a,t=rb(e,a))),t===1)throw n=Yl,as(e,0),gi(e,r),xr(e,bn()),n;if(t===6)gi(e,r);else{if(a=e.current.alternate,!(r&30)&&!MO(a)&&(t=_d(e,r),t===2&&(i=Ty(e),i!==0&&(r=i,t=rb(e,i))),t===1))throw n=Yl,as(e,0),gi(e,r),xr(e,bn()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Pe(345));case 2:Yi(e,gr,Oa);break;case 3:if(gi(e,r),(r&130023424)===r&&(t=Tv+500-bn(),10<t)){if(ad(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){sr(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Py(Yi.bind(null,e,gr,Oa),t);break}Yi(e,gr,Oa);break;case 4:if(gi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var s=31-ra(r);i=1<<s,s=t[s],s>a&&(a=s),r&=~i}if(r=a,r=bn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*IO(r/1960))-r,10<r){e.timeoutHandle=Py(Yi.bind(null,e,gr,Oa),r);break}Yi(e,gr,Oa);break;case 5:Yi(e,gr,Oa);break;default:throw Error(Pe(329))}}}return xr(e,bn()),e.callbackNode===n?g5.bind(null,e):null}function rb(e,t){var n=El;return e.current.memoizedState.isDehydrated&&(as(e,t).flags|=256),e=_d(e,t),e!==2&&(t=gr,gr=n,t!==null&&ab(t)),e}function ab(e){gr===null?gr=e:gr.push.apply(gr,e)}function MO(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!oa(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gi(e,t){for(t&=~jv,t&=~Qd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ra(t),r=1<<n;e[n]=-1,t&=~r}}function p_(e){if(Ft&6)throw Error(Pe(327));go();var t=ad(e,0);if(!(t&1))return xr(e,bn()),null;var n=_d(e,t);if(e.tag!==0&&n===2){var r=Ty(e);r!==0&&(t=r,n=rb(e,r))}if(n===1)throw n=Yl,as(e,0),gi(e,t),xr(e,bn()),n;if(n===6)throw Error(Pe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Yi(e,gr,Oa),xr(e,bn()),null}function Rv(e,t){var n=Ft;Ft|=1;try{return e(t)}finally{Ft=n,Ft===0&&(wo=bn()+500,Gd&&Di())}}function gs(e){yi!==null&&yi.tag===0&&!(Ft&6)&&go();var t=Ft;Ft|=1;var n=Hr.transition,r=Ht;try{if(Hr.transition=null,Ht=1,e)return e()}finally{Ht=r,Hr.transition=n,Ft=t,!(Ft&6)&&Di()}}function Av(){Sr=so.current,nn(so)}function as(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,cO(n)),kn!==null)for(n=kn.return;n!==null;){var r=n;switch(dv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&cd();break;case 3:ko(),nn(hr),nn(Zn),vv();break;case 5:bv(r);break;case 4:ko();break;case 13:nn(fn);break;case 19:nn(fn);break;case 10:hv(r.type._context);break;case 22:case 23:Av()}n=n.return}if(Ln=e,kn=e=ji(e.current,null),zn=Sr=t,jn=0,Yl=null,jv=Qd=fs=0,gr=El=null,Ji!==null){for(t=0;t<Ji.length;t++)if(n=Ji[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=a,r.next=s}n.pending=r}Ji=null}return e}function p5(e,t){do{var n=kn;try{if(pv(),Uu.current=yd,xd){for(var r=gn.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}xd=!1}if(ds=0,Mn=Nn=gn=null,_l=!1,Vl=0,Cv.current=null,n===null||n.return===null){jn=1,Yl=t,kn=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=zn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=t_(s);if(p!==null){p.flags&=-257,n_(p,s,l,i,t),p.mode&1&&e_(i,u,t),t=p,c=u;var m=t.updateQueue;if(m===null){var y=new Set;y.add(c),t.updateQueue=y}else m.add(c);break e}else{if(!(t&1)){e_(i,u,t),Iv();break e}c=Error(Pe(426))}}else if(on&&l.mode&1){var v=t_(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),n_(v,s,l,i,t),fv(_o(c,l));break e}}i=c=_o(c,l),jn!==4&&(jn=2),El===null?El=[i]:El.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=QT(i,c,t);Kk(i,x);break e;case 1:l=c;var b=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ni===null||!Ni.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=ZT(i,l,t);Kk(i,N);break e}}i=i.return}while(i!==null)}x5(n)}catch(_){t=_,kn===n&&n!==null&&(kn=n=n.return);continue}break}while(!0)}function h5(){var e=bd.current;return bd.current=yd,e===null?yd:e}function Iv(){(jn===0||jn===3||jn===2)&&(jn=4),Ln===null||!(fs&268435455)&&!(Qd&268435455)||gi(Ln,zn)}function _d(e,t){var n=Ft;Ft|=2;var r=h5();(Ln!==e||zn!==t)&&(Oa=null,as(e,t));do try{LO();break}catch(a){p5(e,a)}while(!0);if(pv(),Ft=n,bd.current=r,kn!==null)throw Error(Pe(261));return Ln=null,zn=0,jn}function LO(){for(;kn!==null;)m5(kn)}function OO(){for(;kn!==null&&!sL();)m5(kn)}function m5(e){var t=b5(e.alternate,e,Sr);e.memoizedProps=e.pendingProps,t===null?x5(e):kn=t,Cv.current=null}function x5(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=jO(n,t),n!==null){n.flags&=32767,kn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{jn=6,kn=null;return}}else if(n=CO(n,t,Sr),n!==null){kn=n;return}if(t=t.sibling,t!==null){kn=t;return}kn=t=e}while(t!==null);jn===0&&(jn=5)}function Yi(e,t,n){var r=Ht,a=Hr.transition;try{Hr.transition=null,Ht=1,DO(e,t,n,r)}finally{Hr.transition=a,Ht=r}return null}function DO(e,t,n,r){do go();while(yi!==null);if(Ft&6)throw Error(Pe(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Pe(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(mL(e,i),e===Ln&&(kn=Ln=null,zn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lu||(lu=!0,v5(rd,function(){return go(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hr.transition,Hr.transition=null;var s=Ht;Ht=1;var l=Ft;Ft|=4,Cv.current=null,RO(e,n),d5(n,e),nO(Oy),id=!!Ly,Oy=Ly=null,e.current=n,AO(n),oL(),Ft=l,Ht=s,Hr.transition=i}else e.current=n;if(lu&&(lu=!1,yi=e,kd=a),i=e.pendingLanes,i===0&&(Ni=null),uL(n.stateNode),xr(e,bn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(vd)throw vd=!1,e=tb,tb=null,e;return kd&1&&e.tag!==0&&go(),i=e.pendingLanes,i&1?e===nb?Sl++:(Sl=0,nb=e):Sl=0,Di(),null}function go(){if(yi!==null){var e=Qj(kd),t=Hr.transition,n=Ht;try{if(Hr.transition=null,Ht=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,kd=0,Ft&6)throw Error(Pe(331));var a=Ft;for(Ft|=4,Je=e.current;Je!==null;){var i=Je,s=i.child;if(Je.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Je=u;Je!==null;){var d=Je;switch(d.tag){case 0:case 11:case 15:wl(8,d,i)}var f=d.child;if(f!==null)f.return=d,Je=f;else for(;Je!==null;){d=Je;var g=d.sibling,p=d.return;if(l5(d),d===u){Je=null;break}if(g!==null){g.return=p,Je=g;break}Je=p}}}var m=i.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var v=y.sibling;y.sibling=null,y=v}while(y!==null)}}Je=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Je=s;else e:for(;Je!==null;){if(i=Je,i.flags&2048)switch(i.tag){case 0:case 11:case 15:wl(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,Je=x;break e}Je=i.return}}var b=e.current;for(Je=b;Je!==null;){s=Je;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,Je=k;else e:for(s=b;Je!==null;){if(l=Je,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Xd(9,l)}}catch(_){yn(l,l.return,_)}if(l===s){Je=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Je=N;break e}Je=l.return}}if(Ft=a,Di(),_a&&typeof _a.onPostCommitFiberRoot=="function")try{_a.onPostCommitFiberRoot($d,e)}catch{}r=!0}return r}finally{Ht=n,Hr.transition=t}}return!1}function h_(e,t,n){t=_o(n,t),t=QT(e,t,1),e=Si(e,t,1),t=sr(),e!==null&&(dc(e,1,t),xr(e,t))}function yn(e,t,n){if(e.tag===3)h_(e,e,n);else for(;t!==null;){if(t.tag===3){h_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ni===null||!Ni.has(r))){e=_o(n,e),e=ZT(t,e,1),t=Si(t,e,1),e=sr(),t!==null&&(dc(t,1,e),xr(t,e));break}}t=t.return}}function PO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=sr(),e.pingedLanes|=e.suspendedLanes&n,Ln===e&&(zn&n)===n&&(jn===4||jn===3&&(zn&130023424)===zn&&500>bn()-Tv?as(e,0):jv|=n),xr(e,t)}function y5(e,t){t===0&&(e.mode&1?(t=Zc,Zc<<=1,!(Zc&130023424)&&(Zc=4194304)):t=1);var n=sr();e=Va(e,t),e!==null&&(dc(e,t,n),xr(e,n))}function FO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),y5(e,n)}function BO(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Pe(314))}r!==null&&r.delete(t),y5(e,n)}var b5;b5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||hr.current)pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pr=!1,NO(e,t,n);pr=!!(e.flags&131072)}else pr=!1,on&&t.flags&1048576&&wT(t,fd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hu(e,t),e=t.pendingProps;var a=yo(t,Zn.current);fo(t,n),a=_v(null,t,r,e,a,n);var i=wv();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mr(r)?(i=!0,ud(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,xv(t),a.updater=Yd,t.stateNode=a,a._reactInternals=t,qy(t,r,e,n),t=Gy(null,t,r,!0,i,n)):(t.tag=0,on&&i&&uv(t),ar(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hu(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=UO(r),e=ea(r,e),a){case 0:t=Vy(null,t,r,e,n);break e;case 1:t=i_(null,t,r,e,n);break e;case 11:t=r_(null,t,r,e,n);break e;case 14:t=a_(null,t,r,ea(r.type,e),n);break e}throw Error(Pe(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Vy(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),i_(e,t,r,a,n);case 3:e:{if(n5(t),e===null)throw Error(Pe(387));r=t.pendingProps,i=t.memoizedState,a=i.element,TT(e,t),hd(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=_o(Error(Pe(423)),t),t=s_(e,t,r,n,a);break e}else if(r!==a){a=_o(Error(Pe(424)),t),t=s_(e,t,r,n,a);break e}else for(jr=Ei(t.stateNode.containerInfo.firstChild),Tr=t,on=!0,na=null,n=CT(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bo(),r===a){t=Ga(e,t,n);break e}ar(e,t,r,n)}t=t.child}return t;case 5:return RT(t),e===null&&Uy(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,Dy(r,a)?s=null:i!==null&&Dy(r,i)&&(t.flags|=32),t5(e,t),ar(e,t,s,n),t.child;case 6:return e===null&&Uy(t),null;case 13:return r5(e,t,n);case 4:return yv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vo(t,null,r,n):ar(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),r_(e,t,r,a,n);case 7:return ar(e,t,t.pendingProps,n),t.child;case 8:return ar(e,t,t.pendingProps.children,n),t.child;case 12:return ar(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,s=a.value,Zt(gd,r._currentValue),r._currentValue=s,i!==null)if(oa(i.value,s)){if(i.children===a.children&&!hr.current){t=Ga(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=$a(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),$y(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Pe(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),$y(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}ar(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,fo(t,n),a=qr(a),r=r(a),t.flags|=1,ar(e,t,r,n),t.child;case 14:return r=t.type,a=ea(r,t.pendingProps),a=ea(r.type,a),a_(e,t,r,a,n);case 15:return JT(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Hu(e,t),t.tag=1,mr(r)?(e=!0,ud(t)):e=!1,fo(t,n),XT(t,r,a),qy(t,r,a,n),Gy(null,t,r,!0,e,n);case 19:return a5(e,t,n);case 22:return e5(e,t,n)}throw Error(Pe(156,t.tag))};function v5(e,t){return Gj(e,t)}function zO(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zr(e,t,n,r){return new zO(e,t,n,r)}function Mv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function UO(e){if(typeof e=="function")return Mv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Zb)return 11;if(e===Jb)return 14}return 2}function ji(e,t){var n=e.alternate;return n===null?(n=zr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Vu(e,t,n,r,a,i){var s=2;if(r=e,typeof e=="function")Mv(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xs:return is(n.children,a,i,t);case Qb:s=8,a|=8;break;case py:return e=zr(12,n,t,a|2),e.elementType=py,e.lanes=i,e;case hy:return e=zr(13,n,t,a),e.elementType=hy,e.lanes=i,e;case my:return e=zr(19,n,t,a),e.elementType=my,e.lanes=i,e;case Rj:return Zd(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case jj:s=10;break e;case Tj:s=9;break e;case Zb:s=11;break e;case Jb:s=14;break e;case ui:s=16,r=null;break e}throw Error(Pe(130,e==null?e:typeof e,""))}return t=zr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function is(e,t,n,r){return e=zr(7,e,r,t),e.lanes=n,e}function Zd(e,t,n,r){return e=zr(22,e,r,t),e.elementType=Rj,e.lanes=n,e.stateNode={isHidden:!1},e}function jg(e,t,n){return e=zr(6,e,null,t),e.lanes=n,e}function Tg(e,t,n){return t=zr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $O(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cg(0),this.expirationTimes=cg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cg(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,a,i,s,l,c){return e=new $O(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xv(i),e}function HO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ys,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function k5(e){if(!e)return Ai;e=e._reactInternals;e:{if(xs(e)!==e||e.tag!==1)throw Error(Pe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Pe(171))}if(e.tag===1){var n=e.type;if(mr(n))return kT(e,n,t)}return t}function _5(e,t,n,r,a,i,s,l,c){return e=Lv(n,r,!0,e,a,i,s,l,c),e.context=k5(null),n=e.current,r=sr(),a=Ci(n),i=$a(r,a),i.callback=t??null,Si(n,i,a),e.current.lanes=a,dc(e,a,r),xr(e,r),e}function Jd(e,t,n,r){var a=t.current,i=sr(),s=Ci(a);return n=k5(n),t.context===null?t.context=n:t.pendingContext=n,t=$a(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Si(a,t,s),e!==null&&(aa(e,a,s,i),zu(e,a,s)),s}function wd(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function m_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ov(e,t){m_(e,t),(e=e.alternate)&&m_(e,t)}function qO(){return null}var w5=typeof reportError=="function"?reportError:function(e){console.error(e)};function Dv(e){this._internalRoot=e}ef.prototype.render=Dv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Pe(409));Jd(e,t,null,null)};ef.prototype.unmount=Dv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gs(function(){Jd(null,e,null,null)}),t[Wa]=null}};function ef(e){this._internalRoot=e}ef.prototype.unstable_scheduleHydration=function(e){if(e){var t=eT();e={blockedOn:null,target:e,priority:t};for(var n=0;n<fi.length&&t!==0&&t<fi[n].priority;n++);fi.splice(n,0,e),n===0&&nT(e)}};function Pv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function tf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function x_(){}function WO(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=wd(s);i.call(u)}}var s=_5(t,r,e,0,null,!1,!1,"",x_);return e._reactRootContainer=s,e[Wa]=s.current,Ul(e.nodeType===8?e.parentNode:e),gs(),s}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=wd(c);l.call(u)}}var c=Lv(e,0,!1,null,null,!1,!1,"",x_);return e._reactRootContainer=c,e[Wa]=c.current,Ul(e.nodeType===8?e.parentNode:e),gs(function(){Jd(t,c,n,r)}),c}function nf(e,t,n,r,a){var i=n._reactRootContainer;if(i){var s=i;if(typeof a=="function"){var l=a;a=function(){var c=wd(s);l.call(c)}}Jd(t,s,e,a)}else s=WO(n,t,e,a,r);return wd(s)}Zj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ol(t.pendingLanes);n!==0&&(nv(t,n|1),xr(t,bn()),!(Ft&6)&&(wo=bn()+500,Di()))}break;case 13:gs(function(){var r=Va(e,1);if(r!==null){var a=sr();aa(r,e,1,a)}}),Ov(e,1)}};rv=function(e){if(e.tag===13){var t=Va(e,134217728);if(t!==null){var n=sr();aa(t,e,134217728,n)}Ov(e,134217728)}};Jj=function(e){if(e.tag===13){var t=Ci(e),n=Va(e,t);if(n!==null){var r=sr();aa(n,e,t,r)}Ov(e,t)}};eT=function(){return Ht};tT=function(e,t){var n=Ht;try{return Ht=e,t()}finally{Ht=n}};Ny=function(e,t,n){switch(t){case"input":if(by(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=Vd(r);if(!a)throw Error(Pe(90));Ij(r),by(r,a)}}}break;case"textarea":Lj(e,n);break;case"select":t=n.value,t!=null&&oo(e,!!n.multiple,t,!1)}};Uj=Rv;$j=gs;var VO={usingClientEntryPoint:!1,Events:[gc,eo,Vd,Bj,zj,Rv]},Zo={findFiberByHostInstance:Zi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GO={bundleType:Zo.bundleType,version:Zo.version,rendererPackageName:Zo.rendererPackageName,rendererConfig:Zo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ya.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Wj(e),e===null?null:e.stateNode},findFiberByHostInstance:Zo.findFiberByHostInstance||qO,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 cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{$d=cu.inject(GO),_a=cu}catch{}}Mr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=VO;Mr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pv(t))throw Error(Pe(200));return HO(e,t,null,n)};Mr.createRoot=function(e,t){if(!Pv(e))throw Error(Pe(299));var n=!1,r="",a=w5;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=Lv(e,1,!1,null,null,n,!1,r,a),e[Wa]=t.current,Ul(e.nodeType===8?e.parentNode:e),new Dv(t)};Mr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Pe(188)):(e=Object.keys(e).join(","),Error(Pe(268,e)));return e=Wj(t),e=e===null?null:e.stateNode,e};Mr.flushSync=function(e){return gs(e)};Mr.hydrate=function(e,t,n){if(!tf(t))throw Error(Pe(200));return nf(null,e,t,!0,n)};Mr.hydrateRoot=function(e,t,n){if(!Pv(e))throw Error(Pe(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=w5;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=_5(t,null,e,1,n??null,a,!1,i,s),e[Wa]=t.current,Ul(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new ef(t)};Mr.render=function(e,t,n){if(!tf(t))throw Error(Pe(200));return nf(null,e,t,!1,n)};Mr.unmountComponentAtNode=function(e){if(!tf(e))throw Error(Pe(40));return e._reactRootContainer?(gs(function(){nf(null,null,e,!1,function(){e._reactRootContainer=null,e[Wa]=null})}),!0):!1};Mr.unstable_batchedUpdates=Rv;Mr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!tf(n))throw Error(Pe(200));if(e==null||e._reactInternals===void 0)throw Error(Pe(38));return nf(e,t,n,!1,r)};Mr.version="18.3.1-next-f1338f8080-20240426";function E5(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(E5)}catch(e){console.error(e)}}E5(),Ej.exports=Mr;var Fv=Ej.exports;const KO=No(Fv);var y_=Fv;fy.createRoot=y_.createRoot,fy.hydrateRoot=y_.hydrateRoot;const YO="modulepreload",XO=function(e){return"/"+e},b_={},S5=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=Promise.allSettled(n.map(c=>{if(c=XO(c),c in b_)return;b_[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":YO,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((g,p)=>{f.addEventListener("load",g),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return a.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Ha={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.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.thinking":"Thinking","chat.whatsapp_enabled":"WhatsApp mode enabled - assistant replies will be sent to WhatsApp","chat.whatsapp_disabled":"Enable WhatsApp two-way mode","chat.whatsapp_no_chatid":"Set PAVE_WHATSAPP_CHAT_ID in Settings before enabling WhatsApp routing","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","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.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.","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_locally":"Sign in locally","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.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.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.whatsapp":"WhatsApp","settings.category.lmstudio":"LM Studio","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.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.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.regenerate_title":"Regenerate Title","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.terminal":"Terminal","sidebar.studio":"PAVE Studio","sidebar.acp":"Connected editor","sidebar.legacy_sessions":"Older sessions","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.other":"Other","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.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_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.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.builtin_tools":"Built-in Tools","skills.agent_comm":"Agent Communication","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.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.pricing":"Token Pricing","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","model_selector.lmstudio_loading":"Loading LM Studio models...","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.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Show {count} messages before compaction","compaction.hide_history":"Hide messages before compaction","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.privacy_dlp":"Privacy & DLP"},bi={en:Ha},QO={"zh-TW":()=>S5(()=>import("./zh-TW-CJN4iDCH.js"),[])},po=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function v_(e){if(bi[e])return bi[e];const t=QO[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),Ha;try{const n=await t();return bi[e]=n.default||n,bi[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),Ha}}function N5(e,t,n){let r=e[t];return r===void 0&&e!==Ha&&(r=Ha[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(a,i)=>{const s=n[i];return s!==void 0?String(s):a}):r}const C5=h.createContext(null);function ZO({initialLocale:e="en",children:t}){const r=po.map(g=>g.code).includes(e)?e:"en",[a,i]=h.useState(r),[s,l]=h.useState(bi[r]||Ha),c=h.useRef(0);h.useEffect(()=>{let g=!1;if(r!=="en"&&!bi[r]){const p=++c.current;v_(r).then(m=>{if(g||c.current!==p)return;const y=m===Ha&&r!=="en"?"en":r;bi[y]=m,l(m),y!==r&&i(y)})}return()=>{g=!0,c.current+=1}},[]);const u=h.useCallback(async g=>{const p=++c.current,m=await v_(g);if(c.current!==p)return;const y=m===Ha&&g!=="en"?"en":g;bi[y]=m,l(m),i(y);try{localStorage.setItem("pave-locale",y)}catch{}},[]),d=h.useCallback((g,p)=>N5(s,g,p),[s]),f=h.useMemo(()=>({t:d,locale:a,setLocale:u,availableLocales:po}),[d,a,u]);return o.jsx(C5.Provider,{value:f,children:t})}function Rt(){const e=h.useContext(C5);return e||{t:(t,n)=>N5(Ha,t,n),locale:"en",setLocale:()=>{},availableLocales:po}}function JO(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&po.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=po.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=po.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function eD({darkMode:e,onToggle:t}){const{t:n}=Rt();return o.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?o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})}function tD({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:i,cancelLabel:s,destructive:l}){var{t:c}=Rt(),u=h.useRef(null),d=h.useRef(null);if(h.useEffect(function(){e&&d.current&&d.current.focus()},[e]),h.useEffect(function(){if(!e)return;function m(y){y.key==="Escape"&&(typeof y.preventDefault=="function"&&y.preventDefault(),typeof y.stopImmediatePropagation=="function"?y.stopImmediatePropagation():typeof y.stopPropagation=="function"&&y.stopPropagation(),t())}return document.addEventListener("keydown",m,!0),function(){document.removeEventListener("keydown",m,!0)}},[e,t]),h.useEffect(function(){if(!e||!u.current)return;function m(y){if(y.key==="Tab"){var v=u.current.querySelectorAll("button:not([disabled])");if(v.length!==0){var x=v[0],b=v[v.length-1];y.shiftKey?document.activeElement===x&&(y.preventDefault(),b.focus()):document.activeElement===b&&(y.preventDefault(),x.focus())}}}return document.addEventListener("keydown",m),function(){document.removeEventListener("keydown",m)}},[e]),!e)return null;var f=i||c("confirm_dialog.confirm"),g=s||c("confirm_dialog.cancel"),p=l?"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 o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(m){m.target===m.currentTarget&&t()},children:o.jsxs("div",{ref:u,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-none transition-all duration-150",children:[o.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:o.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),o.jsx("div",{className:"px-5 py-4",children:o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a})}),o.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[o.jsx("button",{ref:d,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-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:g}),o.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 "+p,children:f})]})]})})}var j5=h.createContext(null);function nD({children:e}){var{t}=Rt(),n=h.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},a=h.useState(r),i=a[0],s=a[1],l=h.useCallback(function(d){n.current&&(n.current(!1),n.current=null);var f=d||{};return new Promise(function(g){n.current=g,s({open:!0,title:f.title||t("confirm_dialog.confirm"),message:f.message||"",confirmLabel:f.confirmLabel||"",cancelLabel:f.cancelLabel||"",destructive:f.destructive||!1})})},[t]),c=h.useCallback(function(){s(r),n.current&&(n.current(!1),n.current=null)},[]),u=h.useCallback(function(){s(r),n.current&&(n.current(!0),n.current=null)},[]);return o.jsxs(j5.Provider,{value:l,children:[e,o.jsx(tD,{open:i.open,onClose:c,onConfirm:u,title:i.title,message:i.message,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,destructive:i.destructive})]})}function hc(){var e=h.useContext(j5);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const rD="web",Gu="LEGACY",aD=["tui","acp"],iD={tui:"sidebar.terminal",studio:"sidebar.studio",acp:"sidebar.acp"};function T5(e){return e?e.client?e.client===rD:aD.indexOf(e.source)===-1:!1}function sD(e,t){if(e===Gu)return t("sidebar.legacy_sessions");const n=iD[e];if(n){const r=t(n);if(r&&r!==n)return r}return e.charAt(0).toUpperCase()+e.slice(1)}function oD(e,t){const n=[],r=Object.create(null),a=Array.isArray(e)?e:[];for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;if(T5(c)){n.push(c);continue}const u=c.client||Gu;r[u]||(r[u]=[]),r[u].push(c)}const i=Object.keys(r).sort((l,c)=>l===Gu?1:c===Gu?-1:l.localeCompare(c)),s=[];for(let l=0;l<i.length;l++)s.push({key:i[l],label:sD(i[l],t),sessions:r[i[l]]});return{own:n,groups:s}}function lD(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const a=new Date(r);if(a.setDate(a.getDate()-1),n>=a)return"yesterday";const i=new Date(r);if(i.setDate(i.getDate()-i.getDay()),n>=i)return"thisWeek";const s=new Date(t.getFullYear(),t.getMonth(),1);return n>=s?"thisMonth":"older"}function cD(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 s=0;s<e.length;s++){const l=e[s],c=lD(l.time&&l.time.updated?l.time.updated:0);n[c].push(l)}const a=["today","yesterday","thisWeek","thisMonth","older"],i=[];for(let s=0;s<a.length;s++){const l=a[s];n[l].length>0&&i.push({key:l,label:r[l],sessions:n[l]})}return i}const Jo="\0__other__";function uD(e,t){const n=Object.create(null);for(let i=0;i<e.length;i++){const s=e[i];let l;if(s.directory&&typeof s.directory=="string"&&s.directory.trim()){const u=s.directory.replace(/[\\/]+$/,"").split(/[\\/]/);l=u[u.length-1]||Jo}else l=Jo;n[l]||(n[l]=[]),n[l].push(s)}const r=Object.keys(n).sort(function(i,s){return i===Jo?1:s===Jo?-1:i.localeCompare(s)}),a=[];for(let i=0;i<r.length;i++){const s=r[i];n[s].sort(function(c,u){const d=c.time&&c.time.updated||0;return(u.time&&u.time.updated||0)-d});const l=s===Jo?t("sidebar.other"):s;a.push({key:s,label:l,sessions:n[s]})}return a}function dD(e,t){if(!e)return"";const n=Date.now()-e;if(n<60*1e3)return t("sidebar.age_now");const r=Math.floor(n/(60*1e3));if(r<60)return t("sidebar.age_minutes",{n:r});const a=Math.floor(r/60);if(a<24)return t("sidebar.age_hours",{n:a});const i=Math.floor(a/24);return i<7?t("sidebar.age_days",{n:i}):t("sidebar.age_weeks",{n:Math.floor(i/7)})}function k_(e){return e.source==="legacy"||e.source==="archive"||e._readOnly}const fD={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"};function Fs({name:e,className:t}){return o.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:fD[e]})})}function __({className:e,filled:t}){return o.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:o.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 Rg=216,uu=8;function gD({anchor:e,items:t,label:n,onClose:r}){const a=h.useRef(null),[i,s]=h.useState(null);h.useEffect(()=>{const c=a.current;if(!c)return;const u=c.offsetHeight;let d=e.align==="right"?e.x-Rg:e.x;d=Math.max(uu,Math.min(d,window.innerWidth-Rg-uu));let f=e.y;f+u>window.innerHeight-uu&&(f=Math.max(uu,e.flipY-u)),s({left:d,top:f})},[e]),h.useEffect(()=>{if(!i||!a.current)return;const c=a.current.querySelector("[data-menuitem]");c&&c.focus()},[i]),h.useEffect(()=>{function c(d){a.current&&!a.current.contains(d.target)&&r()}function u(d){d.key==="Escape"&&(d.stopPropagation(),r())}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u,!0),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u,!0),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[r]);const l=c=>{if(c.key!=="ArrowDown"&&c.key!=="ArrowUp")return;c.preventDefault();const u=Array.from(a.current.querySelectorAll("[data-menuitem]"));if(u.length===0)return;const d=u.indexOf(document.activeElement),f=c.key==="ArrowDown"?(d+1)%u.length:(d-1+u.length)%u.length;u[f].focus()};return Fv.createPortal(o.jsx("div",{ref:a,role:"menu","aria-label":n,onKeyDown:l,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:Rg,left:i?i.left:0,top:i?i.top:0,visibility:i?"visible":"hidden"},children:t.map(c=>c.separator?o.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},c.key):o.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{r(),c.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${c.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:[o.jsx("span",{className:"flex-shrink-0 opacity-70",children:c.icon}),o.jsx("span",{className:"flex-1 truncate",children:c.label}),c.hint&&o.jsx("span",{className:"flex-shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:c.hint})]},c.key))}),document.body)}function pD({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:a,onDeleteSession:i,onDeleteAllSessions:s,onRenameSession:l,onRegenerateTitle:c,onPinSession:u,onArchiveSession:d,onExportSession:f,onImportSession:g,onImportError:p,showArchived:m,onToggleShowArchived:y,isOpen:v,onClose:x,onToggle:b,hasMoreSessions:k,onLoadMoreSessions:N}){const{t:_}=Rt(),w=hc(),[E,S]=h.useState(""),[M,j]=h.useState(null),[F,P]=h.useState(""),[W,O]=h.useState({}),[I,T]=h.useState(null),L=h.useRef(null),$=h.useCallback(()=>{const K=L.current;L.current=null,T(null),K&&K.isConnected&&K.focus()},[]),Z=(K,we,Te)=>{L.current=Te||null,T({id:K.id,anchor:we})},R=K=>!!W[K]||!!E,Y=K=>O(we=>({...we,[K]:!we[K]})),{own:V,groups:A}=h.useMemo(()=>oD(e,_),[e,_]),H=E?V.filter(function(K){return(K.title||_("sidebar.untitled")).toLowerCase().includes(E.toLowerCase())}):V,ce=h.useMemo(()=>{const K=E.toLowerCase(),we=[];for(let Te=0;Te<A.length;Te++){const ge=A[Te],xe=E?ge.sessions.filter(function(he){return(he.title||_("sidebar.untitled")).toLowerCase().includes(K)}):ge.sessions;xe.length>0&&we.push({...ge,sessions:xe,projectGroups:uD(xe,_)})}return we},[A,E,_]),{pinnedSessions:ee,regularSessions:Me,archivedSessions:X}=h.useMemo(()=>{const K=[],we=[],Te=[];for(let ge=0;ge<H.length;ge++){const xe=H[ge];xe.archived?Te.push(xe):xe.pinned?K.push(xe):we.push(xe)}return{pinnedSessions:K,regularSessions:we,archivedSessions:Te}},[H]),ye=h.useMemo(()=>cD(Me,_),[Me,_]),Oe=K=>{j(K.id),P(K.title||"")},Ee=K=>{F.trim()&&l(K,F.trim()),j(null),P("")},de=async K=>{!K.archived&&!await w({title:_("sidebar.archive"),message:_("sidebar.confirmArchive"),confirmLabel:_("sidebar.archive")})||d(K.id,!K.archived)},Se=async K=>{await w({title:_("sidebar.delete_title"),message:_("sidebar.delete_confirm"),destructive:!0,confirmLabel:_("sidebar.delete")})&&i(K.id)},Ae=K=>{if(k_(K))return[];const we=[{key:"rename",label:_("sidebar.rename"),hint:"F2",icon:o.jsx(Fs,{name:"rename",className:"w-4 h-4"}),onSelect:()=>Oe(K)}];c&&we.push({key:"regenerate",label:_("sidebar.regenerate_title"),icon:o.jsx(Fs,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>c(K.id)}),f&&we.push({key:"export",label:_("sidebar.export"),icon:o.jsx(Fs,{name:"export",className:"w-4 h-4"}),onSelect:()=>f(K.id)});const Te=[];return u&&(!K.archived||K.pinned)&&Te.push({key:"pin",label:K.pinned?_("sidebar.unpin"):_("sidebar.pin"),icon:o.jsx(__,{className:"w-4 h-4",filled:K.pinned}),onSelect:()=>u(K.id,!K.pinned)}),d&&Te.push({key:"archive",label:K.archived?_("sidebar.unarchive"):_("sidebar.archive"),icon:o.jsx(Fs,{name:K.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>de(K)}),Te.length>0&&(we.push({key:"sep-state",separator:!0}),we.push(...Te)),we.push({key:"sep-danger",separator:!0}),we.push({key:"delete",label:_("sidebar.delete"),hint:"Del",danger:!0,icon:o.jsx(Fs,{name:"delete",className:"w-4 h-4"}),onSelect:()=>Se(K)}),we},me=h.useMemo(()=>I&&e.find(K=>K.id===I.id)||null,[I,e]);h.useEffect(()=>{I&&!me&&$()},[I,me,$]);const ve=(K,we)=>{const Te=we&&we.dimmed,ge=k_(K),xe=!!(I&&I.id===K.id),he=!ge,fe=(pe,U)=>Z(K,pe,U);return o.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${K.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":Te?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>r(K.id),onContextMenu:pe=>{!he||M===K.id||(pe.preventDefault(),fe({x:pe.clientX,y:pe.clientY,flipY:pe.clientY,align:"left"},pe.currentTarget))},onKeyDown:pe=>{if(pe.currentTarget===pe.target){if(pe.key==="Enter"||pe.key===" "){pe.preventDefault(),r(K.id);return}if(he){if(pe.key==="F2")pe.preventDefault(),Oe(K);else if(pe.key==="Delete")pe.preventDefault(),Se(K);else if(pe.key==="ContextMenu"){pe.preventDefault();const U=pe.currentTarget.getBoundingClientRect();fe({x:U.right,y:U.bottom,flipY:U.top,align:"right"},pe.currentTarget)}}}},children:M===K.id?o.jsx("input",{autoFocus:!0,value:F,onChange:pe=>P(pe.target.value),onBlur:()=>Ee(K.id),onKeyDown:pe=>{pe.key==="Enter"?(pe.preventDefault(),pe.stopPropagation(),pe.currentTarget.blur()):pe.key==="Escape"?(pe.stopPropagation(),j(null)):pe.key===" "&&pe.stopPropagation()},onClick:pe=>pe.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):o.jsxs(o.Fragment,{children:[K.pinned&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",children:o.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"})}),K.source==="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),K.compactedAt&&K.source!=="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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[K.id]&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:_("sidebar.session_processing"),"aria-label":_("sidebar.session_processing")}),o.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${Te?"italic":""}`,"data-menu-open":xe?"true":"false",children:[o.jsx("span",{className:"truncate min-w-0",children:K.title||_("sidebar.untitled")}),K.archived&&o.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",_("sidebar.archived"),")"]})]}),o.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[o.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${xe?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:dD(K.time&&K.time.updated,_)}),o.jsxs("div",{className:`items-center gap-0.5 ${xe?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[u&&(!K.archived||K.pinned)&&o.jsx("button",{onClick:pe=>{pe.stopPropagation(),u(K.id,!K.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:K.pinned?_("sidebar.unpin"):_("sidebar.pin"),"aria-label":K.pinned?_("sidebar.unpin"):_("sidebar.pin"),children:o.jsx(__,{className:`w-4 h-4 ${K.pinned?"text-amber-500":""}`,filled:K.pinned})}),he&&o.jsx("button",{onClick:pe=>{pe.stopPropagation();const U=pe.currentTarget.getBoundingClientRect();fe({x:U.right,y:U.bottom+4,flipY:U.top-4,align:"right"},pe.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${xe?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":_("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":xe,children:o.jsx(Fs,{name:"more",className:"w-4 h-4"})})]})]})]})},K.id)},De=K=>o.jsx("div",{className:"px-2 pt-3 pb-1",children:o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:K})});return o.jsxs(o.Fragment,{children:[v&&o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:x}),!v&&o.jsx("div",{className:"flex-shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:o.jsx("button",{onClick:b,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:_("sidebar.show"),"aria-label":_("sidebar.show"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),o.jsxs("aside",{className:`
|
|
41
|
-
${v?"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 border-r border-gray-200 dark:border-gray-800
|
|
46
|
-
bg-gray-50 dark:bg-gray-900 flex flex-col
|
|
47
|
-
${v?"md:flex":"md:hidden"}
|
|
48
|
-
`,children:[o.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:_("sidebar.conversations")}),o.jsx("button",{onClick:b,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:_("sidebar.hide"),"aria-label":_("sidebar.hide"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),o.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[o.jsx("button",{onClick:a,className:"flex-1 py-2 px-4 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:_("app.new_chat")}),g&&o.jsx("button",{onClick:()=>{const K=document.createElement("input");K.type="file",K.accept=".yaml,.yml",K.onchange=we=>{const Te=we&&we.target&&we.target.files,ge=Te&&Te[0];if(ge){const xe=ge.name.toLowerCase();if(!xe.endsWith(".yaml")&&!xe.endsWith(".yml")){p&&p(_("import.invalid_file_type"));return}const he=10*1024*1024;if(ge.size>he){p&&p(_("import.file_too_large"));return}const fe=new FileReader;fe.onload=pe=>{const U=pe&&pe.target?pe.target.result:null;if(typeof U!="string"){p&&p(_("import.read_error"));return}g(U)},fe.onerror=()=>{p&&p(_("import.read_error"))},fe.readAsText(ge)}},K.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:_("sidebar.import"),"aria-label":_("sidebar.import"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]}),o.jsx("div",{className:"px-3 pb-2",children:o.jsx("input",{type:"text",placeholder:_("sidebar.search_placeholder"),value:E,onChange:K=>S(K.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-none focus:ring-2 focus:ring-primary-500/30"})}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[ee.length===0&&ye.every(K=>K.sessions.length===0)&&(!m||X.length===0)&&ce.length===0&&o.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:_(E?"sidebar.no_matches":"sidebar.no_conversations")}),ee.length>0&&o.jsxs(o.Fragment,{children:[De(_("sidebar.pinned")),ee.map(K=>ve(K))]}),ye.map(K=>o.jsxs("div",{children:[(ee.length>0||ye.length>1)&&De(K.label),K.sessions.map(we=>ve(we))]},K.key)),m&&X.length>0&&o.jsxs(o.Fragment,{children:[De(_("sidebar.archived")),X.map(K=>ve(K,{dimmed:!0}))]}),ce.map(K=>{const we=R(K.key);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"w-full flex items-center gap-1.5 px-2 pt-4 pb-1 rounded-lg transition-colors hover:bg-gray-200 dark:hover:bg-gray-800 cursor-pointer disabled:cursor-default disabled:hover:bg-transparent disabled:opacity-80",onClick:()=>{E||Y(K.key)},"aria-expanded":we,disabled:!!E,children:[o.jsx("svg",{className:`w-3 h-3 text-gray-400 dark:text-gray-500 transition-transform duration-200 ${we?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),o.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 uppercase tracking-wide font-medium",children:K.label}),o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",K.sessions.length,")"]})]}),we&&K.projectGroups.map(Te=>o.jsxs("div",{className:"mb-1",children:[o.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 mt-1",children:[o.jsx("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 font-medium truncate",children:Te.label})]}),Te.sessions.map(ge=>o.jsxs("div",{role:"button",tabIndex:0,className:`flex items-center gap-1.5 px-2 pl-5 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${ge.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>r(ge.id),onKeyDown:xe=>{xe.currentTarget===xe.target&&(xe.key==="Enter"||xe.key===" ")&&(xe.preventDefault(),r(ge.id))},children:[o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3"})}),o.jsx("span",{className:"flex-1 truncate",children:ge.title||_("sidebar.untitled")})]},ge.id))]},Te.key))]},K.key)}),k&&!E&&N&&o.jsx("div",{className:"pt-2 pb-1 px-1",children:o.jsxs("button",{onClick:N,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:[o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),_("sidebar.load_more")]})}),y&&o.jsx("div",{className:"pt-2 pb-1 px-1",children:o.jsxs("button",{onClick:y,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:[o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m?o.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"}):o.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"})}),_(m?"sidebar.hide_archived":"sidebar.show_archived")]})}),H.some(function(K){return K.source!=="legacy"&&!K._readOnly})&&s&&o.jsx("div",{className:"pt-3 pb-2 px-1",children:o.jsxs("button",{onClick:async()=>{await w({title:_("sidebar.delete_all_title"),message:_("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:_("sidebar.delete_all")})&&s()},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:[o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),_("sidebar.delete_all")]})})]})]}),I&&me&&o.jsx(gD,{anchor:I.anchor,items:Ae(me),label:_("sidebar.more_actions"),onClose:$})]})}const rf=0,Pi=1,Ro=2,R5=4;function w_(e){return()=>e}function hD(e){e()}function A5(e,t){return n=>e(t(n))}function E_(e,t){return()=>e(t)}function mD(e,t){return n=>e(t,n)}function Bv(e){return e!==void 0}function xD(...e){return()=>{e.map(hD)}}function Ao(){}function af(e,t){return t(e),e}function yD(e,t){return t(e)}function rn(...e){return e}function Ut(e,t){return e(Pi,t)}function vt(e,t){e(rf,t)}function zv(e){e(Ro)}function sn(e){return e(R5)}function rt(e,t){return Ut(e,mD(t,rf))}function ia(e,t){const n=e(Pi,r=>{n(),t(r)});return n}function S_(e){let t,n;return r=>a=>{t=a,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function I5(e,t){return e===t}function tn(e=I5){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ft(e){return t=>n=>{e(n)&&t(n)}}function Ke(e){return t=>A5(t,e)}function ya(e){return t=>()=>{t(e)}}function Le(e,...t){const n=bD(...t);return(r,a)=>{switch(r){case Ro:zv(e);return;case Pi:return Ut(e,n(a))}}}function va(e,t){return n=>r=>{n(t=e(t,r))}}function ps(e){return t=>n=>{e>0?e--:t(n)}}function Ba(e){let t=null,n;return r=>a=>{t=a,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function St(...e){const t=Array.from({length:e.length});let n=0,r=null;const a=2**e.length-1;return e.forEach((i,s)=>{const l=2**s;Ut(i,c=>{const u=n;n|=l,t[s]=c,u!==a&&n===a&&r&&(r(),r=null)})}),i=>s=>{const l=()=>{i([s].concat(t))};n===a?l():r=l}}function bD(...e){return t=>e.reduceRight(yD,t)}function vD(e){let t,n;const r=()=>t==null?void 0:t();return function(a,i){switch(a){case Pi:return i?n===i?void 0:(r(),n=i,t=Ut(e,i),t):(r(),Ao);case Ro:r(),n=null;return}}}function ze(e){let t=e;const n=At();return(r,a)=>{switch(r){case rf:t=a;break;case Pi:{a(t);break}case R5:return t}return n(r,a)}}function Xn(e,t){return af(ze(t),n=>rt(e,n))}function At(){const e=[];return(t,n)=>{switch(t){case rf:e.slice().forEach(r=>{r(n)});return;case Ro:e.splice(0);return;case Pi:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}}}function Rr(e){return af(At(),t=>rt(e,t))}const kD={singleton:!0};function Bt(e,t=[],n=kD){const{singleton:r}=n;return{constructor:e,dependencies:t,id:_D(),singleton:r}}const _D=()=>Symbol("id");function wD(e){const t=new Map,n=({constructor:r,dependencies:a,id:i,singleton:s})=>{if(s&&t.has(i))return t.get(i);const l=r(a.map(c=>n(c)));return s&&t.set(i,l),l};return n(e)}function _n(...e){const t=At(),n=Array.from({length:e.length});let r=0;const a=2**e.length-1;return e.forEach((i,s)=>{const l=2**s;Ut(i,c=>{n[s]=c,r|=l,r===a&&vt(t,n)})}),function(i,s){switch(i){case Ro:{zv(t);return}case Pi:return r===a&&s(n),Ut(t,s)}}}function dt(e,t=I5){return Le(e,tn(t))}function ib(...e){return function(t,n){switch(t){case Ro:return;case Pi:return xD(...e.map(r=>Ut(r,n)))}}}const Tn={DEBUG:0,INFO:1,WARN:2,ERROR:3},ED={[Tn.DEBUG]:"debug",[Tn.ERROR]:"error",[Tn.INFO]:"log",[Tn.WARN]:"warn"},SD=()=>typeof globalThis>"u"?window:globalThis,Fi=Bt(()=>{const e=ze(Tn.ERROR);return{log:ze((t,n,r=Tn.INFO)=>{const a=SD().VIRTUOSO_LOG_LEVEL??sn(e);r>=a&&console[ED[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function ND(e){return"self"in e?e.document.documentElement:e}function M5(e){const t=ND(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function ts(e,t){return M5(e)?-t:t}function N_(e,t){return M5(e)?-t:t}function ys(e,t,n){return Uv(e,t,n).callbackRef}function Uv(e,t,n){const r=nt.useRef(null);let a=s=>{};const i=nt.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(s=>{const l=()=>{const c=s[0].target;c.offsetParent!==null&&e(c)};n?l():requestAnimationFrame(l)}):null,[e,n]);return a=s=>{s&&t?(i==null||i.observe(s),r.current=s):(r.current&&(i==null||i.unobserve(r.current)),r.current=null)},{callbackRef:a,ref:r}}function CD(e,t,n,r,a,i,s,l,c){const u=nt.useCallback(d=>{var b;const f=jD(d.children,t,l?"offsetWidth":"offsetHeight",a);let g=d.parentElement;for(;g.dataset.virtuosoScroller===void 0;)g=g.parentElement;const p=((b=g.lastElementChild)==null?void 0:b.dataset.viewportType)==="window";let m;p&&(m=g.ownerDocument.defaultView);const y=s?l?s.scrollWidth:s.scrollHeight:p?l?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight:l?g.scrollWidth:g.scrollHeight,v=s?l?s.offsetWidth:s.offsetHeight:p?l?m.innerWidth:m.innerHeight:l?g.offsetWidth:g.offsetHeight,x=s?l?ts(s,s.scrollLeft):s.scrollTop:p?l?ts(m,m.scrollX||m.document.documentElement.scrollLeft):m.scrollY||m.document.documentElement.scrollTop:l?ts(g,g.scrollLeft):g.scrollTop;r({scrollHeight:y,scrollTop:Math.max(x,0),viewportHeight:v}),i==null||i(l?C_("column-gap",getComputedStyle(d).columnGap,a):C_("row-gap",getComputedStyle(d).rowGap,a)),f!==null&&e(f)},[e,t,a,i,s,r,l]);return Uv(u,n,c)}function jD(e,t,n,r){const a=e.length;if(a===0)return null;const i=[];for(let s=0;s<a;s++){const l=e.item(s);if(l.dataset.index===void 0)continue;const c=parseInt(l.dataset.index,10),u=parseFloat(l.dataset.knownSize),d=t(l,n);if(d===0&&r("Zero-sized element, this should not happen",{child:l},Tn.ERROR),d===u)continue;const f=i[i.length-1];i.length===0||f.size!==d||f.endIndex!==c-1?i.push({endIndex:c,size:d,startIndex:c}):i[i.length-1].endIndex++}return i}function C_(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Tn.WARN),t==="normal"?0:parseInt(t??"0",10)}function L5(e,t,n){const r=nt.useRef(null),a=nt.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const u=c.getBoundingClientRect(),d=u.width;let f,g;if(t){const p=t.getBoundingClientRect(),m=u.top-p.top;g=p.height-Math.max(0,m),f=m+t.scrollTop}else{const p=s.current.ownerDocument.defaultView;g=p.innerHeight-Math.max(0,u.top),f=u.top+p.scrollY}r.current={listHeight:u.height,offsetTop:f,visibleHeight:g,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:i,ref:s}=Uv(a,!0,n),l=nt.useCallback(()=>{a(s.current)},[a,s]);return nt.useEffect(()=>{var u;if(t){t.addEventListener("scroll",l);const d=new ResizeObserver(()=>{requestAnimationFrame(l)});return d.observe(t),()=>{t.removeEventListener("scroll",l),d.unobserve(t)}}const c=(u=s.current)==null?void 0:u.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",l),c==null||c.addEventListener("resize",l),()=>{c==null||c.removeEventListener("scroll",l),c==null||c.removeEventListener("resize",l)}},[l,t,s]),i}const cr=Bt(()=>{const e=At(),t=At(),n=ze(0),r=At(),a=ze(0),i=At(),s=At(),l=ze(0),c=ze(0),u=ze(0),d=ze(0),f=At(),g=At(),p=ze(!1),m=ze(!1),y=ze(!1);return rt(Le(e,Ke(({scrollTop:v})=>v)),t),rt(Le(e,Ke(({scrollHeight:v})=>v)),s),rt(t,a),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:c,footerHeight:d,headerHeight:l,horizontalDirection:m,scrollBy:g,scrollContainerState:e,scrollHeight:s,scrollingInProgress:p,scrollTo:f,scrollTop:t,skipAnimationFrameInResizeObserver:y,smoothScrollTargetReached:r,statefulScrollTop:a,viewportHeight:i}},[],{singleton:!0}),Xl={lvl:0};function O5(e,t){const n=e.length;if(n===0)return[];let{index:r,value:a}=t(e[0]);const i=[];for(let s=1;s<n;s++){const{index:l,value:c}=t(e[s]);i.push({end:l-1,start:r,value:a}),r=l,a=c}return i.push({end:1/0,start:r,value:a}),i}function Wt(e){return e===Xl}function Ql(e,t){if(!Wt(e))return t===e.k?e.v:t<e.k?Ql(e.l,t):Ql(e.r,t)}function la(e,t,n="k"){if(Wt(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=la(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return la(e.l,t,n)}function Cr(e,t,n){return Wt(e)?F5(t,n,1):t===e.k?Cn(e,{k:t,v:n}):t<e.k?j_(Cn(e,{l:Cr(e.l,t,n)})):j_(Cn(e,{r:Cr(e.r,t,n)}))}function ho(){return Xl}function mo(e,t,n){if(Wt(e))return[];const r=la(e,t)[0];return TD(ob(e,r,n))}function sb(e,t){if(Wt(e))return Xl;const{k:n,l:r,r:a}=e;if(t===n){if(Wt(r))return a;if(Wt(a))return r;const[i,s]=P5(r);return Ku(Cn(e,{k:i,l:D5(r),v:s}))}return t<n?Ku(Cn(e,{l:sb(r,t)})):Ku(Cn(e,{r:sb(a,t)}))}function ns(e){return Wt(e)?[]:[...ns(e.l),{k:e.k,v:e.v},...ns(e.r)]}function ob(e,t,n){if(Wt(e))return[];const{k:r,l:a,r:i,v:s}=e;let l=[];return r>t&&(l=l.concat(ob(a,t,n))),r>=t&&r<=n&&l.push({k:r,v:s}),r<=n&&(l=l.concat(ob(i,t,n))),l}function Ku(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(Ag(t))return B5(Cn(e,{lvl:n-1}));if(!Wt(t)&&!Wt(t.r))return Cn(t.r,{l:Cn(t,{r:t.r.l}),lvl:n,r:Cn(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Ag(e))return lb(Cn(e,{lvl:n-1}));if(!Wt(r)&&!Wt(r.l)){const a=r.l,i=Ag(a)?r.lvl-1:r.lvl;return Cn(a,{l:Cn(e,{lvl:n-1,r:a.l}),lvl:a.lvl+1,r:lb(Cn(r,{l:a.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function Cn(e,t){return F5(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 D5(e){return Wt(e.r)?e.l:Ku(Cn(e,{r:D5(e.r)}))}function Ag(e){return Wt(e)||e.lvl>e.r.lvl}function P5(e){return Wt(e.r)?[e.k,e.v]:P5(e.r)}function F5(e,t,n,r=Xl,a=Xl){return{k:e,l:r,lvl:n,r:a,v:t}}function j_(e){return lb(B5(e))}function B5(e){const{l:t}=e;return!Wt(t)&&t.lvl===e.lvl?Cn(t,{r:Cn(e,{l:t.r})}):e}function lb(e){const{lvl:t,r:n}=e;return!Wt(n)&&!Wt(n.r)&&n.lvl===t&&n.r.lvl===t?Cn(n,{l:Cn(e,{r:n.l}),lvl:t+1}):e}function TD(e){return O5(e,({k:t,v:n})=>({index:t,value:n}))}function z5(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Zl(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const $v=Bt(()=>({recalcInProgress:ze(!1)}),[],{singleton:!0});function U5(e,t,n){return e[Ed(e,t,n)]}function Ed(e,t,n,r=0){let a=e.length-1;for(;r<=a;){const i=Math.floor((r+a)/2),s=e[i],l=n(s,t);if(l===0)return i;if(l===-1){if(a-r<2)return i-1;a=i-1}else{if(a===r)return i;r=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function RD(e,t,n,r){const a=Ed(e,t,r),i=Ed(e,n,r,a);return e.slice(a,i+1)}function Ii(e,t){return Math.round(e.getBoundingClientRect()[t])}function sf(e){return!Wt(e.groupOffsetTree)}function Hv({index:e},t){return t===e?0:t<e?-1:1}function AD(){return{groupIndices:[],groupOffsetTree:ho(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ho()}}function ID(e,t){let n=Wt(e)?0:1/0;for(const r of t){const{endIndex:a,size:i,startIndex:s}=r;if(n=Math.min(n,s),Wt(e)){e=Cr(e,0,i);continue}const l=mo(e,s-1,a+1);if(l.some(BD(r)))continue;let c=!1,u=!1;for(const{end:d,start:f,value:g}of l)c?(a>=f||i===g)&&(e=sb(e,f)):(u=g!==i,c=!0),d>a&&a>=f&&g!==i&&(e=Cr(e,a+1,g));u&&(e=Cr(e,s,i))}return[e,n]}function MD(e){return e.groupIndex!==void 0}function LD({offset:e},t){return t===e?0:t<e?-1:1}function Jl(e,t,n){if(t.length===0)return 0;const{index:r,offset:a,size:i}=U5(t,e,Hv),s=e-r,l=i*s+(s-1)*n+a;return l>0?l+n:l}function $5(e,t){if(!sf(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function H5(e,t,n){if(MD(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let a=$5(r,t);return a=Math.max(0,Math.min(n,a)),a}function OD(e,t,n,r=0){return r>0&&(t=Math.max(t,U5(e,r,Hv).offset)),O5(RD(e,t,n,LD),FD)}function DD(e,[t,n,r,a]){t.length>0&&r("received item sizes",t,Tn.DEBUG);const i=e.sizeTree;let s=i,l=0;if(n.length>0&&Wt(i)&&t.length===2){const g=t[0].size,p=t[1].size;s=n.reduce((m,y)=>Cr(Cr(m,y,g),y+1,p),s)}else[s,l]=ID(s,t);if(s===i)return e;const{lastIndex:c,lastOffset:u,lastSize:d,offsetTree:f}=cb(e.offsetTree,l,s,a);return{groupIndices:n,groupOffsetTree:n.reduce((g,p)=>Cr(g,p,Jl(p,f,a)),ho()),lastIndex:c,lastOffset:u,lastSize:d,offsetTree:f,sizeTree:s}}function PD(e){return ns(e).map(({k:t,v:n},r,a)=>{const i=a[r+1];return{endIndex:i===void 0?1/0:i.k-1,size:n,startIndex:t}})}function T_(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 cb(e,t,n,r){let a=e,i=0,s=0,l=0,c=0;if(t===0)a=[];else{c=Ed(a,t-1,Hv),l=a[c].offset;const u=la(n,t-1);i=u[0],s=u[1],a.length&&a[c].size===la(n,t)[1]&&(c-=1),a=a.slice(0,c+1)}for(const{start:u,value:d}of mo(n,t,1/0)){const f=u-i,g=f*s+l+f*r;a.push({index:u,offset:g,size:d}),i=u,l=g,s=d}return{lastIndex:i,lastOffset:l,lastSize:s,offsetTree:a}}function FD(e){return{index:e.index,value:e}}function BD(e){const{endIndex:t,size:n,startIndex:r}=e;return a=>a.start===r&&(a.end===t||a.end===1/0)&&a.value===n}const zD={offsetHeight:"height",offsetWidth:"width"},Ea=Bt(([{log:e},{recalcInProgress:t}])=>{const n=At(),r=At(),a=Xn(r,0),i=At(),s=At(),l=ze(0),c=ze([]),u=ze(void 0),d=ze(void 0),f=ze(void 0),g=ze(void 0),p=ze((E,S)=>Ii(E,zD[S])),m=ze(void 0),y=ze(0),v=AD(),x=Xn(Le(n,St(c,e,y),va(DD,v),tn()),v),b=Xn(Le(c,tn(),va((E,S)=>({current:S,prev:E.current}),{current:[],prev:[]}),Ke(({prev:E})=>E)),[]);rt(Le(c,ft(E=>E.length>0),St(x,y),Ke(([E,S,M])=>{const j=E.reduce((F,P,W)=>Cr(F,P,Jl(P,S.offsetTree,M)||W),ho());return{...S,groupIndices:E,groupOffsetTree:j}})),x),rt(Le(r,St(x),ft(([E,{lastIndex:S}])=>E<S),Ke(([E,{lastIndex:S,lastSize:M}])=>[{endIndex:S,size:M,startIndex:E}])),n),rt(u,d);const k=Xn(Le(u,Ke(E=>E===void 0)),!0);rt(Le(d,ft(E=>E!==void 0&&Wt(sn(x).sizeTree)),Ke(E=>{const S=sn(f),M=sn(c).length>0;return S!==void 0&&S!==0?M?[{endIndex:0,size:S,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),n),rt(Le(g,ft(E=>E!==void 0&&E.length>0&&Wt(sn(x).sizeTree)),Ke(E=>{const S=[];let M=E[0],j=0;for(let F=1;F<E.length;F++){const P=E[F];P!==M&&(S.push({endIndex:F-1,size:M,startIndex:j}),M=P,j=F)}return S.push({endIndex:E.length-1,size:M,startIndex:j}),S})),n),rt(Le(c,St(f,d),ft(([,E,S])=>E!==void 0&&S!==void 0),Ke(([E,S,M])=>{const j=[];for(let F=0;F<E.length;F++){const P=E[F],W=E[F+1];j.push({startIndex:P,endIndex:P,size:S}),W!==void 0&&j.push({startIndex:P+1,endIndex:W-1,size:M})}return j})),n);const N=Rr(Le(n,St(x),va(({sizes:E},[S,M])=>({changed:M!==E,sizes:M}),{changed:!1,sizes:v}),Ke(E=>E.changed)));Ut(Le(l,va((E,S)=>({diff:E.prev-S,prev:S}),{diff:0,prev:0}),Ke(E=>E.diff)),E=>{const{groupIndices:S}=sn(x);if(E>0)vt(t,!0),vt(i,E+T_(E,S));else if(E<0){const M=sn(b);M.length>0&&(E-=T_(-E,M)),vt(s,E)}}),Ut(Le(l,St(e)),([E,S])=>{E<0&&S("`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:l},Tn.ERROR)});const _=Rr(i);rt(Le(i,St(x),Ke(([E,S])=>{const M=S.groupIndices.length>0,j=[],F=S.lastSize;if(M){const P=Ql(S.sizeTree,0);let W=0,O=0;for(;W<E;){const T=S.groupIndices[O],L=S.groupIndices.length===O+1?1/0:S.groupIndices[O+1]-T-1;j.push({endIndex:T,size:P,startIndex:T}),j.push({endIndex:T+1+L-1,size:F,startIndex:T+1}),O++,W+=L+1}const I=ns(S.sizeTree);return W!==E&&I.shift(),I.reduce((T,{k:L,v:$})=>{let Z=T.ranges;return T.prevSize!==0&&(Z=[...T.ranges,{endIndex:L+E-1,size:T.prevSize,startIndex:T.prevIndex}]),{prevIndex:L+E,prevSize:$,ranges:Z}},{prevIndex:E,prevSize:0,ranges:j}).ranges}return ns(S.sizeTree).reduce((P,{k:W,v:O})=>({prevIndex:W+E,prevSize:O,ranges:[...P.ranges,{endIndex:W+E-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:F,ranges:[]}).ranges})),n);const w=Rr(Le(s,St(x,y),Ke(([E,{offsetTree:S},M])=>{const j=-E;return Jl(j,S,M)})));return rt(Le(s,St(x,y),Ke(([E,S,M])=>{if(S.groupIndices.length>0){if(Wt(S.sizeTree))return S;let F=ho();const P=sn(b);let W=0,O=0,I=0;for(;W<-E;){I=P[O];const T=P[O+1]-I-1;O++,W+=T+1}if(F=ns(S.sizeTree).reduce((T,{k:L,v:$})=>Cr(T,Math.max(0,L+E),$),F),W!==-E){const T=Ql(S.sizeTree,I);F=Cr(F,0,T);const L=la(S.sizeTree,-E+1)[1];F=Cr(F,1,L)}return{...S,sizeTree:F,...cb(S.offsetTree,0,F,M)}}const j=ns(S.sizeTree).reduce((F,{k:P,v:W})=>Cr(F,Math.max(0,P+E),W),ho());return{...S,sizeTree:j,...cb(S.offsetTree,0,j,M)}})),x),{beforeUnshiftWith:_,data:m,defaultItemSize:d,firstItemIndex:l,fixedItemSize:u,fixedGroupSize:f,gap:y,groupIndices:c,heightEstimates:g,itemSize:p,listRefresh:N,shiftWith:s,shiftWithOffset:w,sizeRanges:n,sizes:x,statefulTotalCount:a,totalCount:r,trackItemSizes:k,unshiftWith:i}},rn(Fi,$v),{singleton:!0});function UD(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const q5=Bt(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:a}])=>{const i=At(),s=At(),l=Rr(Le(i,Ke(UD)));return rt(Le(l,Ke(c=>c.totalCount)),n),rt(Le(l,Ke(c=>c.groupIndices)),e),rt(Le(_n(a,t,r),ft(([c,u])=>sf(u)),Ke(([c,u,d])=>la(u.groupOffsetTree,Math.max(c-d,0),"v")[0]),tn(),Ke(c=>[c])),s),{groupCounts:i,topItemsIndexes:s}},rn(Ea,cr)),Bi=Bt(([{log:e}])=>{const t=ze(!1),n=Rr(Le(t,ft(r=>r),tn()));return Ut(t,r=>{r&&sn(e)("props updated",{},Tn.DEBUG)}),{didMount:n,propsReady:t}},rn(Fi),{singleton:!0}),$D=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function W5(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!$D)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const mc=Bt(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:i,footerHeight:s,headerHeight:l,scrollingInProgress:c,scrollTo:u,smoothScrollTargetReached:d,viewportHeight:f},{log:g}])=>{const p=At(),m=At(),y=ze(0);let v=null,x=null,b=null;function k(){v!==null&&(v(),v=null),b!==null&&(b(),b=null),x&&(clearTimeout(x),x=null),vt(c,!1)}return rt(Le(p,St(n,f,r,y,l,s,g),St(e,i,a),Ke(([[N,_,w,E,S,M,j,F],P,W,O])=>{const I=W5(N),{align:T,behavior:L,offset:$}=I,Z=E-1,R=H5(I,_,Z);let Y=Jl(R,_.offsetTree,P)+M;T==="end"?(Y+=W+la(_.sizeTree,R)[1]-w+O,R===Z&&(Y+=j)):T==="center"?Y+=(W+la(_.sizeTree,R)[1]-w+O)/2:Y-=S,$!==void 0&&$!==0&&(Y+=$);const V=A=>{k(),A?(F("retrying to scroll to",{location:N},Tn.DEBUG),vt(p,N)):(vt(m,!0),F("list did not change, scroll successful",{},Tn.DEBUG))};if(k(),L==="smooth"){let A=!1;b=Ut(t,H=>{A=A||H}),v=ia(d,()=>{V(A)})}else v=ia(Le(t,HD(150)),V);return x=setTimeout(()=>{k()},1200),vt(c,!0),F("scrolling from index to",{behavior:L,index:R,top:Y},Tn.DEBUG),{behavior:L,top:Y}})),u),{scrollTargetReached:m,scrollToIndex:p,topListHeight:y}},rn(Ea,cr,Fi),{singleton:!0});function HD(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function qv(e,t){e===0?t():requestAnimationFrame(()=>{qv(e-1,t)})}function Wv(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 ub(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 xc=Bt(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:a,scrollToIndex:i},{didMount:s}])=>{const l=ze(!0),c=ze(0),u=ze(!0);return rt(Le(s,St(c),ft(([d,f])=>!ub(f)),ya(!1)),l),rt(Le(s,St(c),ft(([d,f])=>!ub(f)),ya(!1)),u),Ut(Le(_n(t,s),St(l,n,e,u),ft(([[,d],f,{sizeTree:g},p,m])=>d&&(!Wt(g)||Bv(p))&&!f&&!m),St(c)),([,d])=>{if(d===void 0){vt(l,!0),vt(u,!0);return}ia(a,()=>{vt(u,!0)}),qv(4,()=>{ia(r,()=>{vt(l,!0)}),vt(i,d)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:c,scrolledToInitialItem:l}},rn(Ea,cr,mc,Bi),{singleton:!0});function V5(e,t){return Math.abs(e-t)<1.01}const ec="up",Nl="down",qD="none",WD={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},VD=0,yc=Bt(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:a,viewportHeight:i}])=>{const s=ze(!1),l=ze(!0),c=At(),u=At(),d=ze(4),f=ze(VD),g=Xn(Le(ib(Le(dt(a),ps(1),ya(!0)),Le(dt(a),ps(1),ya(!1),S_(100))),tn()),!1),p=Xn(Le(ib(Le(n,ya(!0)),Le(n,ya(!1),S_(200))),tn()),!1);rt(Le(_n(dt(a),dt(f)),Ke(([b,k])=>b<=k),tn()),l),rt(Le(l,Ba(50)),u);const m=Rr(Le(_n(r,dt(i),dt(t),dt(e),dt(d)),va((b,[{scrollHeight:k,scrollTop:N},_,w,E,S])=>{const M=N+_-k>-S,j={scrollHeight:k,scrollTop:N,viewportHeight:_};if(M){let P,W;return N>b.state.scrollTop?(P="SCROLLED_DOWN",W=b.state.scrollTop-N):(P="SIZE_DECREASED",W=b.state.scrollTop-N||b.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:W,state:j}}let F;return j.scrollHeight>b.state.scrollHeight?F="SIZE_INCREASED":_<b.state.viewportHeight?F="VIEWPORT_HEIGHT_DECREASING":N<b.state.scrollTop?F="SCROLLING_UPWARDS":F="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:F,state:j}},WD),tn((b,k)=>b!==void 0&&b.atBottom===k.atBottom))),y=Xn(Le(r,va((b,{scrollHeight:k,scrollTop:N,viewportHeight:_})=>{if(!V5(b.scrollHeight,k)){const w=k-(N+_)<1;return b.scrollTop!==N&&w?{changed:!0,jump:b.scrollTop-N,scrollHeight:k,scrollTop:N}:{changed:!0,jump:0,scrollHeight:k,scrollTop:N}}return{changed:!1,jump:0,scrollHeight:k,scrollTop:N}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ft(b=>b.changed),Ke(b=>b.jump)),0);rt(Le(m,Ke(b=>b.atBottom)),s),rt(Le(s,Ba(50)),c);const v=ze(Nl);rt(Le(r,Ke(({scrollTop:b})=>b),tn(),va((b,k)=>sn(p)?{direction:b.direction,prevScrollTop:k}:{direction:k<b.prevScrollTop?ec:Nl,prevScrollTop:k},{direction:Nl,prevScrollTop:0}),Ke(b=>b.direction)),v),rt(Le(r,Ba(50),ya(qD)),v);const x=ze(0);return rt(Le(g,ft(b=>!b),ya(0)),x),rt(Le(a,Ba(100),St(g),ft(([b,k])=>k),va(([b,k],[N])=>[k,N],[0,0]),Ke(([b,k])=>k-b)),x),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:d,atTopStateChange:u,atTopThreshold:f,isAtBottom:s,isAtTop:l,isScrolling:g,lastJumpDueToItemResize:y,scrollDirection:v,scrollVelocity:x}},rn(cr)),tc="top",nc="bottom",R_="none";function A_(e,t,n){return typeof e=="number"?n===ec&&t===tc||n===Nl&&t===nc?e:0:n===ec?t===tc?e.main:e.reverse:t===nc?e.main:e.reverse}function I_(e,t){return typeof e=="number"?e:e[t]??0}const Vv=Bt(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:a}])=>{const i=At(),s=ze(0),l=ze(0),c=ze(0),u=Xn(Le(_n(dt(r),dt(a),dt(n),dt(i,Zl),dt(c),dt(s),dt(t),dt(e),dt(l)),Ke(([d,f,g,[p,m],y,v,x,b,k])=>{const N=d-b,_=v+x,w=Math.max(g-N,0);let E=R_;const S=I_(k,tc),M=I_(k,nc);return p-=b,p+=g+x,m+=g+x,m-=b,p>d+_-S&&(E=ec),m<d-w+f+M&&(E=Nl),E!==R_?[Math.max(N-g-A_(y,tc,E)-S,0),N-w-x+f+A_(y,nc,E)+M]:null}),ft(d=>d!==null),tn(Zl)),[0,0]);return{increaseViewportBy:l,listBoundary:i,overscan:c,topListHeight:s,visibleRange:u}},rn(cr),{singleton:!0});function GD(e,t,n){if(sf(t)){const r=$5(e,t);return[{index:la(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Ig={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Yu(e,t,n,r,a,i){const{lastIndex:s,lastOffset:l,lastSize:c}=a;let u=0,d=0;if(e.length>0){u=e[0].offset;const y=e[e.length-1];d=y.offset+y.size}const f=n-s,g=l+f*c+(f-1)*r,p=u,m=g-d;return{bottom:d,firstItemIndex:i,items:M_(e,a,i),offsetBottom:m,offsetTop:u,top:p,topItems:M_(t,a,i),topListHeight:t.reduce((y,v)=>v.size+y,0),totalCount:n}}function G5(e,t,n,r,a,i){let s=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-s>=e)break;s++}const l=e+s,c=Wv(t,l),u=Array.from({length:l}).map((d,f)=>({data:i[f+c],index:f+c,offset:0,size:0}));return Yu(u,[],l,a,n,r)}function M_(e,t,n){if(e.length===0)return[];if(!sf(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,a=e[e.length-1].index,i=[],s=mo(t.groupOffsetTree,r,a);let l,c=0;for(const u of e){(!l||l.end<u.index)&&(l=s.shift(),c=t.groupIndices.indexOf(l.start));let d;u.index===l.start?d={index:c,type:"group"}:d={groupIndex:c,index:u.index-(c+1)+n},i.push({...d,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return i}function L_(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const bs=Bt(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:a},i,{listBoundary:s,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:u,scrolledToInitialItem:d},{topListHeight:f},g,{didMount:p},{recalcInProgress:m}])=>{const y=ze([]),v=ze(0),x=At(),b=ze(0);rt(i.topItemsIndexes,y);const k=Xn(Le(_n(p,m,dt(c,Zl),dt(a),dt(r),dt(u),d,dt(y),dt(t),dt(n),dt(b),e),ft(([E,S,,M,,,,,,,,j])=>{const F=j!==void 0&&j.length!==M;return E&&!S&&!F}),Ke(([,,[E,S],M,j,F,P,W,O,I,T,L])=>{var ye,Oe;const $=j,{offsetTree:Z,sizeTree:R}=$,Y=sn(v);if(M===0)return{...Ig,totalCount:M};if(E===0&&S===0)return Y===0?{...Ig,totalCount:M}:G5(Y,F,j,O,I,L||[]);if(Wt(R))return Y>0?null:Yu(GD(Wv(F,M),$,L),[],M,I,$,O);const V=[];if(W.length>0){const Ee=W[0],de=W[W.length-1];let Se=0;for(const Ae of mo(R,Ee,de)){const me=Ae.value,ve=Math.max(Ae.start,Ee),De=Math.min(Ae.end,de);for(let K=ve;K<=De;K++)V.push({data:L==null?void 0:L[K],index:K,offset:Se,size:me}),Se+=me}}if(!P)return Yu([],V,M,I,$,O);const A=W.length>0?W[W.length-1]+1:0,H=OD(Z,E,S,A);if(H.length===0)return null;const ce=M-1,ee=af([],Ee=>{for(const de of H){const Se=de.value;let Ae=Se.offset,me=de.start;const ve=Se.size;if(Se.offset<E){me+=Math.floor((E-Se.offset+I)/(ve+I));const K=me-de.start;Ae+=K*ve+K*I}me<A&&(Ae+=(A-me)*ve,me=A);const De=Math.min(de.end,ce);for(let K=me;K<=De&&!(Ae>=S);K++)Ee.push({data:L==null?void 0:L[K],index:K,offset:Ae,size:ve}),Ae+=ve+I}}),Me=L_(T,tc),X=L_(T,nc);if(ee.length>0&&(Me>0||X>0)){const Ee=ee[0],de=ee[ee.length-1];if(Me>0&&Ee.index>A){const Se=Math.min(Me,Ee.index-A),Ae=[];let me=Ee.offset;for(let ve=Ee.index-1;ve>=Ee.index-Se;ve--){const De=((ye=mo(R,ve,ve)[0])==null?void 0:ye.value)??Ee.size;me-=De+I,Ae.unshift({data:L==null?void 0:L[ve],index:ve,offset:me,size:De})}ee.unshift(...Ae)}if(X>0&&de.index<ce){const Se=Math.min(X,ce-de.index);let Ae=de.offset+de.size+I;for(let me=de.index+1;me<=de.index+Se;me++){const ve=((Oe=mo(R,me,me)[0])==null?void 0:Oe.value)??de.size;ee.push({data:L==null?void 0:L[me],index:me,offset:Ae,size:ve}),Ae+=ve+I}}}return Yu(ee,V,M,I,$,O)}),ft(E=>E!==null),tn()),Ig);rt(Le(e,ft(Bv),Ke(E=>E==null?void 0:E.length)),a),rt(Le(k,Ke(E=>E.topListHeight)),f),rt(f,l),rt(Le(k,Ke(E=>[E.top,E.bottom])),s),rt(Le(k,Ke(E=>E.items)),x);const N=Rr(Le(k,ft(({items:E})=>E.length>0),St(a,e),ft(([{items:E},S])=>E[E.length-1].originalIndex===S-1),Ke(([,E,S])=>[E-1,S]),tn(Zl),Ke(([E])=>E))),_=Rr(Le(k,Ba(200),ft(({items:E,topItems:S})=>E.length>0&&E[0].originalIndex===S.length),Ke(({items:E})=>E[0].index),tn())),w=Rr(Le(k,ft(({items:E})=>E.length>0),Ke(({items:E})=>{let S=0,M=E.length-1;for(;E[S].type==="group"&&S<M;)S++;for(;E[M].type==="group"&&M>S;)M--;return{endIndex:E[M].index,startIndex:E[S].index}}),tn(z5)));return{endReached:N,initialItemCount:v,itemsRendered:x,listState:k,minOverscanItemCount:b,rangeChanged:w,startReached:_,topItemsIndexes:y,...g}},rn(Ea,q5,Vv,xc,mc,yc,Bi,$v),{singleton:!0}),K5=Bt(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:a}])=>{const i=At(),s=Xn(Le(_n(n,e,r,t,a),Ke(([l,c,u,d,f])=>l+c+u+d+f.offsetBottom+f.bottom)),0);return rt(dt(s),i),{totalListHeight:s,totalListHeightChanged:i}},rn(cr,bs),{singleton:!0}),KD=Bt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ze(!1),r=Xn(Le(_n(n,e,t),ft(([a])=>a),Ke(([,a,i])=>Math.max(0,a-i)),Ba(0),tn()),0);return{alignToBottom:n,paddingTopAddition:r}},rn(cr,K5),{singleton:!0}),Y5=Bt(()=>({context:ze(null)})),YD=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...a},viewportBottom:i,viewportTop:s})=>t<s?{...a,align:n??"start",...r===void 0?{}:{behavior:r}}:e>i?{...a,align:n??"end",...r===void 0?{}:{behavior:r}}:null,X5=Bt(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:a,headerHeight:i,scrollingInProgress:s,scrollTop:l,viewportHeight:c},{scrollToIndex:u}])=>{const d=At();return rt(Le(d,St(t,c,n,i,a,r,l),St(e),Ke(([[f,g,p,m,y,v,x,b],k])=>{const{calculateViewLocation:N=YD,done:_,...w}=f,E=H5(f,g,m-1),S=Jl(E,g.offsetTree,k)+y+v,M=S+la(g.sizeTree,E)[1],j=b+v,F=b+p-x,P=N({itemBottom:M,itemTop:S,locationParams:w,viewportBottom:F,viewportTop:j});return P===null?_==null||_():_&&ia(Le(s,ft(W=>!W),ps(sn(s)?1:2)),_),P}),ft(f=>f!==null)),u),{scrollIntoView:d}},rn(Ea,cr,mc,bs,Fi),{singleton:!0});function O_(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const XD=(e,t)=>typeof e=="function"?O_(e(t)):t&&O_(e),QD=Bt(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:a,isAtBottom:i},{scrollToIndex:s},{scrolledToInitialItem:l},{didMount:c,propsReady:u},{log:d},{scrollingInProgress:f},{context:g},{scrollIntoView:p}])=>{const m=ze(!1),y=At();let v=null;function x(_){vt(s,{align:"end",behavior:_,index:"LAST"})}Ut(Le(_n(Le(dt(t),ps(1)),c),St(dt(m),i,l,f),Ke(([[_,w],E,S,M,j])=>{let F=w&&M,P="auto";return F&&(P=XD(E,S||j),F=F&&P!==!1),{followOutputBehavior:P,shouldFollow:F,totalCount:_}}),ft(({shouldFollow:_})=>_)),({followOutputBehavior:_,totalCount:w})=>{v!==null&&(v(),v=null),sn(n)===void 0?v=ia(e,()=>{sn(d)("following output to ",{totalCount:w},Tn.DEBUG),x(_),v=null}):requestAnimationFrame(()=>{sn(d)("following output to ",{totalCount:w},Tn.DEBUG),x(_)})});function b(_){const w=ia(a,E=>{_&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&v===null&&(sn(d)("scrolling to bottom due to increased size",{},Tn.DEBUG),x("auto"))});setTimeout(w,100)}Ut(Le(_n(dt(m),t,u),ft(([_,,w])=>_!==!1&&w),va(({value:_},[,w])=>({refreshed:_===w,value:w}),{refreshed:!1,value:0}),ft(({refreshed:_})=>_),St(m,t)),([,_])=>{sn(l)&&b(_!==!1)}),Ut(y,()=>{b(sn(m)!==!1)}),Ut(_n(dt(m),a),([_,w])=>{_!==!1&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")});const k=ze(null),N=At();return rt(ib(Le(dt(r),Ke(_=>(_==null?void 0:_.length)??0)),Le(dt(t))),N),Ut(Le(_n(Le(N,ps(1)),c),St(dt(k),l,f,g),Ke(([[_,w],E,S,M,j])=>w&&S&&(E==null?void 0:E({context:j,totalCount:_,scrollingInProgress:M}))),ft(_=>!!_),Ba(0)),_=>{v!==null&&(v(),v=null),sn(n)===void 0?v=ia(e,()=>{sn(d)("scrolling into view",{}),vt(p,_),v=null}):requestAnimationFrame(()=>{sn(d)("scrolling into view",{}),vt(p,_)})}),{autoscrollToBottom:y,followOutput:m,scrollIntoViewOnChange:k}},rn(Ea,yc,mc,xc,Bi,Fi,cr,Y5,X5)),ZD=Bt(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:a},{initialItemCount:i,listState:s},{didMount:l}])=>(rt(Le(l,St(i),ft(([,c])=>c!==0),St(a,r,t,n,e),Ke(([[,c],u,d,f,g,p=[]])=>G5(c,u,d,f,g,p))),s),{}),rn(Ea,xc,bs,Bi),{singleton:!0}),JD=Bt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ze(0);return Ut(Le(e,St(r),ft(([,a])=>a!==0),Ke(([,a])=>({top:a}))),a=>{ia(Le(n,ps(1),ft(i=>i.items.length>1)),()=>{requestAnimationFrame(()=>{vt(t,a)})})}),{initialScrollTop:r}},rn(Bi,cr,bs),{singleton:!0}),Q5=Bt(([{scrollVelocity:e}])=>{const t=ze(!1),n=At(),r=ze(!1);return rt(Le(e,St(r,t,n),ft(([a,i])=>i!==!1&&i!==void 0),Ke(([a,i,s,l])=>{const{enter:c,exit:u}=i;if(s){if(u(a,l))return!1}else if(c(a,l))return!0;return s}),tn()),t),Ut(Le(_n(t,e,n),St(r)),([[a,i,s],l])=>{a&&l!==!1&&l!==void 0&&l.change&&l.change(i,s)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},rn(yc),{singleton:!0}),Gv=Bt(([{scrollContainerState:e,scrollTo:t}])=>{const n=At(),r=At(),a=At(),i=ze(!1),s=ze(void 0);return rt(Le(_n(n,r),Ke(([{scrollTop:l,viewportHeight:c},{offsetTop:u,listHeight:d}])=>({scrollHeight:d,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),rt(Le(t,St(r),Ke(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),a),{customScrollParent:s,useWindowScroll:i,windowScrollContainerState:n,windowScrollTo:a,windowViewportRect:r}},rn(cr)),eP=Bt(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:a},{didMount:i},{useWindowScroll:s,windowScrollContainerState:l,windowViewportRect:c}])=>{const u=At(),d=ze(void 0),f=ze(null),g=ze(null);return rt(l,f),rt(c,g),Ut(Le(u,St(t,r,s,f,g,n)),([p,m,y,v,x,b,k])=>{const N=PD(m.sizeTree);v&&x!==null&&b!==null&&(y=x.scrollTop-b.offsetTop),y-=k,p({ranges:N,scrollTop:y})}),rt(Le(d,ft(Bv),Ke(tP)),a),rt(Le(i,St(d),ft(([,p])=>p!==void 0),tn(),Ke(([,p])=>p.ranges)),e),{getState:u,restoreStateFrom:d}},rn(Ea,cr,xc,Bi,Gv));function tP(e){return{align:"start",index:0,offset:e.scrollTop}}const nP=Bt(([{topItemsIndexes:e}])=>{const t=ze(0);return rt(Le(t,ft(n=>n>=0),Ke(n=>Array.from({length:n}).map((r,a)=>a))),e),{topItemCount:t}},rn(bs));function Z5(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const rP=Z5(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),aP=Bt(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:a,isScrolling:i,lastJumpDueToItemResize:s,scrollDirection:l},{listState:c},{beforeUnshiftWith:u,gap:d,shiftWithOffset:f,sizes:g},{log:p},{recalcInProgress:m}])=>{const y=Rr(Le(c,St(s),va(([,x,b,k],[{bottom:N,items:_,offsetBottom:w,totalCount:E},S])=>{const M=N+w;let j=0;return b===E&&x.length>0&&_.length>0&&(_[0].originalIndex===0&&x[0].originalIndex===0||(j=M-k,j!==0&&(j+=S))),[j,_,E,M]},[0,[],0,0]),ft(([x])=>x!==0),St(r,l,n,a,p,m),ft(([,x,b,k,,,N])=>!N&&!k&&x!==0&&b===ec),Ke(([[x],,,,,b])=>(b("Upward scrolling compensation",{amount:x},Tn.DEBUG),x))));function v(x){x>0?(vt(t,{behavior:"auto",top:-x}),vt(e,0)):(vt(e,0),vt(t,{behavior:"auto",top:-x}))}return Ut(Le(y,St(e,i)),([x,b,k])=>{k&&rP()?vt(e,b-x):v(-x)}),Ut(Le(_n(Xn(i,!1),e,m),ft(([x,b,k])=>!x&&!k&&b!==0),Ke(([x,b])=>b),Ba(1)),v),rt(Le(f,Ke(x=>({top:-x}))),t),Ut(Le(u,St(g,d),Ke(([x,{groupIndices:b,lastSize:k,sizeTree:N},_])=>{function w(F){return F*(k+_)}if(b.length===0)return w(x);let E=0;const S=Ql(N,0);let M=0,j=0;for(;M<x;){M++,E+=S;let F=b.length===j+1?1/0:b[j+1]-b[j]-1;M+F>x&&(E-=S,F=x-M+1),M+=F,E+=w(F),j++}return E})),x=>{vt(e,x),requestAnimationFrame(()=>{vt(t,{top:x}),requestAnimationFrame(()=>{vt(e,0),vt(m,!1)})})}),{deviation:e}},rn(cr,yc,bs,Ea,Fi,$v)),iP=Bt(([e,t,n,r,a,i,s,l,c,u,d])=>({...e,...t,...n,...r,...a,...i,...s,...l,...c,...u,...d}),rn(Vv,ZD,Bi,Q5,K5,JD,KD,Gv,X5,Fi,Y5)),J5=Bt(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:a,gap:i,groupIndices:s,heightEstimates:l,itemSize:c,sizeRanges:u,sizes:d,statefulTotalCount:f,totalCount:g,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:y,scrolledToInitialItem:v},x,b,k,N,{scrollToIndex:_},w,{topItemCount:E},{groupCounts:S},M])=>{const{listState:j,minOverscanItemCount:F,topItemsIndexes:P,rangeChanged:W,...O}=N;return rt(W,M.scrollSeekRangeChanged),rt(Le(M.windowViewportRect,Ke(I=>I.visibleHeight)),x.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:a,gap:i,groupCounts:S,heightEstimates:l,initialItemFinalLocationReached:m,initialTopMostItemIndex:y,scrolledToInitialItem:v,sizeRanges:u,topItemCount:E,topItemsIndexes:P,totalCount:g,...k,groupIndices:s,itemSize:c,listState:j,minOverscanItemCount:F,scrollToIndex:_,statefulTotalCount:f,trackItemSizes:p,rangeChanged:W,...O,...M,...x,sizes:d,...b}},rn(Ea,xc,cr,eP,QD,bs,mc,aP,nP,q5,iP));function sP(e,t){const n={},r={};let a=0;const i=e.length;for(;a<i;)r[e[a]]=1,a+=1;for(const s in t)Object.hasOwn(r,s)||(n[s]=t[s]);return n}const du=typeof document>"u"?nt.useEffect:nt.useLayoutEffect;function eR(e,t,n){const r=Object.keys(t.required||{}),a=Object.keys(t.optional||{}),i=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),l=nt.createContext({});function c(v,x){v.propsReady!==void 0&&vt(v.propsReady,!1);for(const b of r){const k=v[t.required[b]];vt(k,x[b])}for(const b of a)if(b in x){const k=v[t.optional[b]];vt(k,x[b])}v.propsReady!==void 0&&vt(v.propsReady,!0)}function u(v){return i.reduce((x,b)=>(x[b]=k=>{const N=v[t.methods[b]];vt(N,k)},x),{})}function d(v){return s.reduce((x,b)=>(x[b]=vD(v[t.events[b]]),x),{})}const f=nt.forwardRef(function(v,x){const{children:b,...k}=v,[N]=nt.useState(()=>af(wD(e),E=>{c(E,k)})),[_]=nt.useState(E_(d,N));du(()=>{for(const E of s)E in k&&Ut(_[E],k[E]);return()=>{Object.values(_).map(zv)}},[k,_,N]),du(()=>{c(N,k)}),nt.useImperativeHandle(x,w_(u(N)));const w=n;return o.jsx(l.Provider,{value:N,children:n===void 0?b:o.jsx(w,{...sP([...r,...a,...s],k),children:b})})}),g=v=>{const x=nt.useContext(l);return nt.useCallback(b=>{vt(x[v],b)},[x,v])},p=v=>{const x=nt.useContext(l)[v],b=nt.useCallback(k=>Ut(x,k),[x]);return nt.useSyncExternalStore(b,()=>sn(x),()=>sn(x))},m=v=>{const x=nt.useContext(l)[v],[b,k]=nt.useState(E_(sn,x));return du(()=>Ut(x,N=>{N!==b&&k(w_(N))}),[x,b]),b},y=parseInt(nt.version,10)>=18?p:m;return{Component:f,useEmitter:(v,x)=>{const b=nt.useContext(l)[v];du(()=>Ut(b,x),[x,b])},useEmitterValue:y,usePublisher:g}}const tR=nt.createContext(void 0),nR=nt.createContext(void 0),Mg="-webkit-sticky",D_="sticky",Kv=Z5(()=>{if(typeof document>"u")return D_;const e=document.createElement("div");return e.style.position=Mg,e.style.position===Mg?Mg:D_}),rR=typeof document>"u"?nt.useEffect:nt.useLayoutEffect;function Lg(e){return"self"in e}function oP(e){return"body"in e}function aR(e,t,n,r=Ao,a,i){const s=nt.useRef(null),l=nt.useRef(null),c=nt.useRef(null),u=nt.useCallback(g=>{let p,m,y;const v=g.target;if(oP(v)||Lg(v)){const b=Lg(v)?v:v.defaultView;y=i===!0?ts(b,b.scrollX):b.scrollY,p=i===!0?b.document.documentElement.scrollWidth:b.document.documentElement.scrollHeight,m=i===!0?b.innerWidth:b.innerHeight}else y=i===!0?ts(v,v.scrollLeft):v.scrollTop,p=i===!0?v.scrollWidth:v.scrollHeight,m=i===!0?v.offsetWidth:v.offsetHeight;const x=()=>{e({scrollHeight:p,scrollTop:Math.max(y,0),viewportHeight:m})};g.suppressFlushSync===!0?x():KO.flushSync(x),l.current!==null&&(y===l.current||y<=0||y===p-m)&&(l.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,i]);nt.useEffect(()=>{const g=a??s.current;return r(a??s.current),u({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",u,{passive:!0}),()=>{r(null),g.removeEventListener("scroll",u)}},[s,u,n,r,a]);function d(g){const p=s.current;if(!p||(i===!0?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const m=g.behavior==="smooth";let y,v,x;Lg(p)?(v=Math.max(Ii(p.document.documentElement,i===!0?"width":"height"),i===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),y=i===!0?p.innerWidth:p.innerHeight,x=i===!0?ts(p,p.scrollX):p.scrollY):(v=p[i===!0?"scrollWidth":"scrollHeight"],y=Ii(p,i===!0?"width":"height"),x=i===!0?ts(p,p.scrollLeft):p.scrollTop);const b=v-y;if(g.top===void 0){p.scrollTo(g);return}const k=Math.ceil(Math.max(Math.min(b,g.top),0));if(g.top=k,V5(y,v)||k===x){e({scrollHeight:v,scrollTop:x,viewportHeight:y}),m&&t(!0);return}m?(l.current=k,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,t(!0)},1e3)):l.current=null,i===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},left:N_(p,k)}),p.scrollTo(g)}function f(g){i===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},...g.top===void 0?{}:{left:N_(s.current,g.top)}}),s.current.scrollBy(g)}return{scrollByCallback:f,scrollerRef:s,scrollToCallback:d}}function Yv(e){return e}const lP=Bt(()=>{const e=ze(l=>`Item ${l}`),t=ze(l=>`Group ${l}`),n=ze({}),r=ze(Yv),a=ze("div"),i=ze(Ao),s=(l,c=null)=>Xn(Le(n,Ke(u=>u[l]),tn()),c);return{components:n,computeItemKey:r,EmptyPlaceholder:s("EmptyPlaceholder"),FooterComponent:s("Footer"),GroupComponent:s("Group","div"),groupContent:t,HeaderComponent:s("Header"),HeaderFooterTag:a,ItemComponent:s("Item","div"),itemContent:e,ListComponent:s("List","div"),ScrollerComponent:s("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),TopItemListComponent:s("TopItemList")}}),cP=Bt(([e,t])=>({...e,...t}),rn(J5,lP)),uP=({height:e})=>o.jsx("div",{style:{height:e}}),dP={overflowAnchor:"none",position:Kv(),zIndex:1},iR={overflowAnchor:"none"},fP={...iR,display:"inline-block",height:"100%"},P_=nt.memo(function({showTopList:e=!1}){const t=xt("listState"),n=Ur("sizeRanges"),r=xt("useWindowScroll"),a=xt("customScrollParent"),i=Ur("windowScrollContainerState"),s=Ur("scrollContainerState"),l=a||r?i:s,c=xt("itemContent"),u=xt("context"),d=xt("groupContent"),f=xt("trackItemSizes"),g=xt("itemSize"),p=xt("log"),m=Ur("gap"),y=xt("horizontalDirection"),{callbackRef:v}=CD(n,g,f,e?Ao:l,p,m,a,y,xt("skipAnimationFrameInResizeObserver")),[x,b]=nt.useState(0);Qv("deviation",O=>{x!==O&&b(O)});const k=xt("EmptyPlaceholder"),N=xt("ScrollSeekPlaceholder")??uP,_=xt("ListComponent"),w=xt("ItemComponent"),E=xt("GroupComponent"),S=xt("computeItemKey"),M=xt("isSeeking"),j=xt("groupIndices").length>0,F=xt("alignToBottom"),P=xt("initialItemFinalLocationReached"),W=e?{}:{boxSizing:"border-box",...y?{display:"inline-block",height:"100%",marginInlineStart:x===0?F?"auto":0:x,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:x===0?F?"auto":0:x,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k!==null&&k!==void 0?o.jsx(k,{...Yn(k,u)}):o.jsx(_,{...Yn(_,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:W,children:(e?t.topItems:t.items).map(O=>{const I=O.originalIndex,T=S(I+t.firstItemIndex,O.data,u);return M?h.createElement(N,{...Yn(N,u),height:O.size,index:O.index,key:T,type:O.type||"item",...O.type==="group"?{}:{groupIndex:O.groupIndex}}):O.type==="group"?h.createElement(E,{...Yn(E,u),"data-index":I,"data-item-index":O.index,"data-known-size":O.size,key:T,style:dP},d(O.index,u)):h.createElement(w,{...Yn(w,u),...mP(w,O.data),"data-index":I,"data-item-group-index":O.groupIndex,"data-item-index":O.index,"data-known-size":O.size,key:T,style:y?fP:iR},j?c(O.index,O.groupIndex,O.data,u):c(O.index,O.data,u))})})}),gP={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},pP={outline:"none",overflowX:"auto",position:"relative"},Xv=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),sR=(e,t,n=0)=>({...Xv(e),position:t?"relative":"absolute",top:t?-n:0}),hP={position:Kv(),top:0,width:"100%",zIndex:1};function Yn(e,t){if(typeof e!="string")return{context:t}}function mP(e,t){return{item:typeof e=="string"?void 0:t}}const xP=nt.memo(function(){const e=xt("HeaderComponent"),t=Ur("headerHeight"),n=xt("HeaderFooterTag"),r=ys(nt.useMemo(()=>i=>{t(Ii(i,"height"))},[t]),!0,xt("skipAnimationFrameInResizeObserver")),a=xt("context");return e!=null?o.jsx(n,{ref:r,children:o.jsx(e,{...Yn(e,a)})}):null}),yP=nt.memo(function(){const e=xt("FooterComponent"),t=Ur("footerHeight"),n=xt("HeaderFooterTag"),r=ys(nt.useMemo(()=>i=>{t(Ii(i,"height"))},[t]),!0,xt("skipAnimationFrameInResizeObserver")),a=xt("context");return e!=null?o.jsx(n,{ref:r,children:o.jsx(e,{...Yn(e,a)})}):null});function oR({useEmitter:e,useEmitterValue:t,usePublisher:n}){return nt.memo(function({children:r,style:a,context:i,...s}){const l=n("scrollContainerState"),c=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("scrollerRef"),f=t("horizontalDirection")||!1,{scrollByCallback:g,scrollerRef:p,scrollToCallback:m}=aR(l,u,c,d,void 0,f);return e("scrollTo",m),e("scrollBy",g),o.jsx(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...f?pP:gP,...a},tabIndex:0,...s,...Yn(c,i),children:r})})}function lR({useEmitter:e,useEmitterValue:t,usePublisher:n}){return nt.memo(function({children:r,style:a,context:i,...s}){const l=n("windowScrollContainerState"),c=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("totalListHeight"),f=t("deviation"),g=t("customScrollParent"),p=nt.useRef(null),m=t("scrollerRef"),{scrollByCallback:y,scrollerRef:v,scrollToCallback:x}=aR(l,u,c,m,g);return rR(()=>{var b;return v.current=g??((b=p.current)==null?void 0:b.ownerDocument.defaultView),()=>{v.current=null}},[v,g]),e("windowScrollTo",x),e("scrollBy",y),o.jsx(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...d===0?void 0:{height:d+f}},...s,...Yn(c,i),children:r})})}const bP=({children:e})=>{const t=nt.useContext(tR),n=Ur("viewportHeight"),r=Ur("fixedItemHeight"),a=xt("alignToBottom"),i=xt("horizontalDirection"),s=nt.useMemo(()=>A5(n,c=>Ii(c,i?"width":"height")),[n,i]),l=ys(s,!0,xt("skipAnimationFrameInResizeObserver"));return nt.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),o.jsx("div",{"data-viewport-type":"element",ref:l,style:Xv(a),children:e})},vP=({children:e})=>{const t=nt.useContext(tR),n=Ur("windowViewportRect"),r=Ur("fixedItemHeight"),a=xt("customScrollParent"),i=xt("useWindowScroll"),s=xt("topListHeight"),l=L5(n,a,xt("skipAnimationFrameInResizeObserver")),c=xt("alignToBottom");return nt.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),o.jsx("div",{"data-viewport-type":"window",ref:l,style:sR(c,i,s),children:e})},kP=({children:e})=>{const t=xt("TopItemListComponent")??"div",n=xt("headerHeight"),r={...hP,marginTop:`${n}px`},a=xt("context");return o.jsx(t,{style:r,...Yn(t,a),children:e})},_P=nt.memo(function(e){const t=xt("useWindowScroll"),n=xt("topItemsIndexes").length>0,r=xt("customScrollParent"),a=xt("context");return o.jsxs(r||t?SP:EP,{...e,context:a,children:[n&&o.jsx(kP,{children:o.jsx(P_,{showTopList:!0})}),o.jsxs(r||t?vP:bP,{children:[o.jsx(xP,{}),o.jsx(P_,{}),o.jsx(yP,{})]})]})}),{Component:wP,useEmitter:Qv,useEmitterValue:xt,usePublisher:Ur}=eR(cP,{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"}},_P),EP=oR({useEmitter:Qv,useEmitterValue:xt,usePublisher:Ur}),SP=lR({useEmitter:Qv,useEmitterValue:xt,usePublisher:Ur}),NP=wP,CP=Bt(()=>{const e=ze(u=>o.jsxs("td",{children:["Item $",u]})),t=ze(null),n=ze(u=>o.jsxs("td",{colSpan:1e3,children:["Group ",u]})),r=ze(null),a=ze(null),i=ze({}),s=ze(Yv),l=ze(Ao),c=(u,d=null)=>Xn(Le(i,Ke(f=>f[u]),tn()),d);return{components:i,computeItemKey:s,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:a,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}});rn(J5,CP);Kv();const F_={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},jP={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:B_,floor:Sd,max:Cl,min:Og,round:z_}=Math;function U_(e,t,n){return Array.from({length:t-e+1}).map((r,a)=>({data:n===null?null:n[a+e],index:a+e}))}function TP(e){return{...jP,items:e}}function fu(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function RP(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const AP=Bt(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:a,headerHeight:i,scrollBy:s,scrollContainerState:l,scrollTo:c,scrollTop:u,smoothScrollTargetReached:d,viewportHeight:f},g,p,{didMount:m,propsReady:y},{customScrollParent:v,useWindowScroll:x,windowScrollContainerState:b,windowScrollTo:k,windowViewportRect:N},_])=>{const w=ze(0),E=ze(0),S=ze(F_),M=ze({height:0,width:0}),j=ze({height:0,width:0}),F=At(),P=At(),W=ze(0),O=ze(null),I=ze({column:0,row:0}),T=At(),L=At(),$=ze(!1),Z=ze(0),R=ze(!0),Y=ze(!1),V=ze(!1);Ut(Le(m,St(Z),ft(([X,ye])=>!ub(ye))),()=>{vt(R,!1)}),Ut(Le(_n(m,R,j,M,Z,Y),ft(([X,ye,Oe,Ee,,de])=>X&&!ye&&Oe.height!==0&&Ee.height!==0&&!de)),([,,,,X])=>{if(X===void 0){vt(R,!0);return}vt(Y,!0),qv(1,()=>{vt(F,X)}),ia(Le(u),()=>{vt(t,[0,0]),vt(R,!0)})}),rt(Le(L,ft(X=>X!=null&&X.scrollTop>0),ya(0)),E),Ut(Le(m,St(L),ft(([,X])=>X!=null)),([,X])=>{X&&(vt(M,X.viewport),vt(j,X.item),vt(I,X.gap),X.scrollTop>0&&(vt($,!0),ia(Le(u,ps(1)),ye=>{vt($,!1)}),vt(c,{top:X.scrollTop})))}),rt(Le(M,Ke(({height:X})=>X)),f),rt(Le(_n(dt(M,fu),dt(j,fu),dt(I,(X,ye)=>X!==void 0&&X.column===ye.column&&X.row===ye.row),dt(u)),Ke(([X,ye,Oe,Ee])=>({gap:Oe,item:ye,scrollTop:Ee,viewport:X}))),T),rt(Le(_n(dt(w),r,dt(I,RP),dt(j,fu),dt(M,fu),dt(O),dt(E),dt($),dt(R),dt(Z)),ft(([,,,,,,,X])=>!X),Ke(([X,[ye,Oe],Ee,de,Se,Ae,me,,ve,De])=>{const{column:K,row:we}=Ee,{height:Te,width:ge}=de,{width:xe}=Se;if(me===0&&(X===0||xe===0))return F_;if(ge===0){const $e=Wv(De,X),Ve=$e+Math.max(me-1,0);return TP(U_($e,Ve,Ae))}const he=cR(xe,ge,K);let fe,pe;ve?ye===0&&Oe===0&&me>0?(fe=0,pe=me-1):(fe=he*Sd((ye+we)/(Te+we)),pe=he*B_((Oe+we)/(Te+we))-1,pe=Og(X-1,Cl(pe,he-1)),fe=Og(pe,Cl(0,fe))):(fe=0,pe=-1);const U=U_(fe,pe,Ae),{bottom:D,top:G}=$_(Se,Ee,de,U),le=B_(X/he),je=le*Te+(le-1)*we-D;return{bottom:D,itemHeight:Te,items:U,itemWidth:ge,offsetBottom:je,offsetTop:G,top:G}})),S),rt(Le(O,ft(X=>X!==null),Ke(X=>X.length)),w),rt(Le(_n(M,j,S,I),ft(([X,ye,{items:Oe}])=>Oe.length>0&&ye.height!==0&&X.height!==0),Ke(([X,ye,{items:Oe},Ee])=>{const{bottom:de,top:Se}=$_(X,Ee,ye,Oe);return[Se,de]}),tn(Zl)),t);const A=ze(!1);rt(Le(u,St(A),Ke(([X,ye])=>ye||X!==0)),A);const H=Rr(Le(_n(S,w),ft(([{items:X}])=>X.length>0),St(A),ft(([[X,ye],Oe])=>{const Ee=X.items[X.items.length-1].index===ye-1;return(Oe||X.bottom>0&&X.itemHeight>0&&X.offsetBottom===0&&X.items.length===ye)&&Ee}),Ke(([[,X]])=>X-1),tn())),ce=Rr(Le(dt(S),ft(({items:X})=>X.length>0&&X[0].index===0),ya(0),tn())),ee=Rr(Le(dt(S),St($),ft(([{items:X},ye])=>X.length>0&&!ye),Ke(([{items:X}])=>({endIndex:X[X.length-1].index,startIndex:X[0].index})),tn(z5),Ba(0)));rt(ee,p.scrollSeekRangeChanged),rt(Le(F,St(M,j,w,I),Ke(([X,ye,Oe,Ee,de])=>{const Se=W5(X),{align:Ae,behavior:me,offset:ve}=Se;let De=Se.index;De==="LAST"&&(De=Ee-1),De=Cl(0,De,Og(Ee-1,De));let K=db(ye,de,Oe,De);return Ae==="end"?K=z_(K-ye.height+Oe.height):Ae==="center"&&(K=z_(K-ye.height/2+Oe.height/2)),ve!==void 0&&ve!==0&&(K+=ve),{behavior:me,top:K}})),c);const Me=Xn(Le(S,Ke(X=>X.offsetBottom+X.bottom)),0);return rt(Le(N,Ke(X=>({height:X.visibleHeight,width:X.visibleWidth}))),M),{customScrollParent:v,data:O,deviation:W,footerHeight:a,gap:I,headerHeight:i,increaseViewportBy:e,initialItemCount:E,itemDimensions:j,overscan:n,restoreStateFrom:L,scrollBy:s,scrollContainerState:l,scrollHeight:P,scrollTo:c,scrollToIndex:F,scrollTop:u,smoothScrollTargetReached:d,totalCount:w,useWindowScroll:x,viewportDimensions:M,windowScrollContainerState:b,windowScrollTo:k,windowViewportRect:N,...p,gridState:S,horizontalDirection:V,initialTopMostItemIndex:Z,totalListHeight:Me,...g,endReached:H,propsReady:y,rangeChanged:ee,startReached:ce,stateChanged:T,stateRestoreInProgress:$,..._}},rn(Vv,cr,yc,Q5,Bi,Gv,Fi));function cR(e,t,n){return Cl(1,Sd((e+n)/(Sd(t)+n)))}function $_(e,t,n,r){const{height:a}=n;if(a===void 0||r.length===0)return{bottom:0,top:0};const i=db(e,t,n,r[0].index);return{bottom:db(e,t,n,r[r.length-1].index)+a,top:i}}function db(e,t,n,r){const a=cR(e.width,n.width,t.column),i=Sd(r/a),s=i*n.height+Cl(0,i-1)*t.row;return s>0?s+t.row:s}const IP=Bt(()=>{const e=ze(f=>`Item ${f}`),t=ze({}),n=ze(null),r=ze("virtuoso-grid-item"),a=ze("virtuoso-grid-list"),i=ze(Yv),s=ze("div"),l=ze(Ao),c=(f,g=null)=>Xn(Le(t,Ke(p=>p[f]),tn()),g),u=ze(!1),d=ze(!1);return rt(dt(d),u),{components:t,computeItemKey:i,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:s,itemClassName:r,ItemComponent:c("Item","div"),itemContent:e,listClassName:a,ListComponent:c("List","div"),readyStateChanged:u,reportReadyState:d,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),MP=Bt(([e,t])=>({...e,...t}),rn(AP,IP)),LP=nt.memo(function(){const e=en("gridState"),t=en("listClassName"),n=en("itemClassName"),r=en("itemContent"),a=en("computeItemKey"),i=en("isSeeking"),s=$r("scrollHeight"),l=en("ItemComponent"),c=en("ListComponent"),u=en("ScrollSeekPlaceholder"),d=en("context"),f=$r("itemDimensions"),g=$r("gap"),p=en("log"),m=en("stateRestoreInProgress"),y=$r("reportReadyState"),v=ys(nt.useMemo(()=>x=>{const b=x.parentElement.parentElement.scrollHeight;s(b);const k=x.firstChild;if(k!==null){const{height:N,width:_}=k.getBoundingClientRect();f({height:N,width:_})}g({column:H_("column-gap",getComputedStyle(x).columnGap,p),row:H_("row-gap",getComputedStyle(x).rowGap,p)})},[s,f,g,p]),!0,!1);return rR(()=>{e.itemHeight>0&&e.itemWidth>0&&y(!0)},[e]),m?null:o.jsx(c,{className:t,ref:v,...Yn(c,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(x=>{const b=a(x.index,x.data,d);return i?o.jsx(u,{...Yn(u,d),height:e.itemHeight,index:x.index,width:e.itemWidth},b):h.createElement(l,{...Yn(l,d),className:n,"data-index":x.index,key:b},r(x.index,x.data,d))})})}),OP=nt.memo(function(){const e=en("HeaderComponent"),t=$r("headerHeight"),n=en("headerFooterTag"),r=ys(nt.useMemo(()=>i=>{t(Ii(i,"height"))},[t]),!0,!1),a=en("context");return e!=null?o.jsx(n,{ref:r,children:o.jsx(e,{...Yn(e,a)})}):null}),DP=nt.memo(function(){const e=en("FooterComponent"),t=$r("footerHeight"),n=en("headerFooterTag"),r=ys(nt.useMemo(()=>i=>{t(Ii(i,"height"))},[t]),!0,!1),a=en("context");return e!=null?o.jsx(n,{ref:r,children:o.jsx(e,{...Yn(e,a)})}):null}),PP=({children:e})=>{const t=nt.useContext(nR),n=$r("itemDimensions"),r=$r("viewportDimensions"),a=ys(nt.useMemo(()=>i=>{r(i.getBoundingClientRect())},[r]),!0,!1);return nt.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),o.jsx("div",{ref:a,style:Xv(!1),children:e})},FP=({children:e})=>{const t=nt.useContext(nR),n=$r("windowViewportRect"),r=$r("itemDimensions"),a=en("customScrollParent"),i=en("useWindowScroll"),s=L5(n,a,!1);return nt.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),o.jsx("div",{ref:s,style:sR(!1,i),children:e})},BP=nt.memo(function({...e}){const t=en("useWindowScroll"),n=en("customScrollParent"),r=n||t?UP:zP,a=n||t?FP:PP,i=en("context");return o.jsx(r,{...e,...Yn(r,i),children:o.jsxs(a,{children:[o.jsx(OP,{}),o.jsx(LP,{}),o.jsx(DP,{})]})})}),{useEmitter:uR,useEmitterValue:en,usePublisher:$r}=eR(MP,{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"}},BP),zP=oR({useEmitter:uR,useEmitterValue:en,usePublisher:$r}),UP=lR({useEmitter:uR,useEmitterValue:en,usePublisher:$r});function H_(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Tn.WARN),t==="normal"?0:parseInt(t??"0",10)}function $P(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const HP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WP={};function q_(e,t){return(WP.jsx?qP:HP).test(e)}const VP=/[ \t\n\f\r]/g;function GP(e){return typeof e=="object"?e.type==="text"?W_(e.value):!1:W_(e)}function W_(e){return e.replace(VP,"")===""}class bc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}bc.prototype.normal={};bc.prototype.property={};bc.prototype.space=void 0;function dR(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new bc(n,r,t)}function fb(e){return e.toLowerCase()}class br{constructor(t,n){this.attribute=n,this.property=t}}br.prototype.attribute="";br.prototype.booleanish=!1;br.prototype.boolean=!1;br.prototype.commaOrSpaceSeparated=!1;br.prototype.commaSeparated=!1;br.prototype.defined=!1;br.prototype.mustUseProperty=!1;br.prototype.number=!1;br.prototype.overloadedBoolean=!1;br.prototype.property="";br.prototype.spaceSeparated=!1;br.prototype.space=void 0;let KP=0;const yt=vs(),vn=vs(),gb=vs(),Fe=vs(),Gt=vs(),ss=vs(),Er=vs();function vs(){return 2**++KP}const pb=Object.freeze(Object.defineProperty({__proto__:null,boolean:yt,booleanish:vn,commaOrSpaceSeparated:Er,commaSeparated:ss,number:Fe,overloadedBoolean:gb,spaceSeparated:Gt},Symbol.toStringTag,{value:"Module"})),Dg=Object.keys(pb);class Zv extends br{constructor(t,n,r,a){let i=-1;if(super(t,n),V_(this,"space",a),typeof r=="number")for(;++i<Dg.length;){const s=Dg[i];V_(this,Dg[i],(r&pb[s])===pb[s])}}}Zv.prototype.defined=!0;function V_(e,t,n){n&&(e[t]=n)}function Io(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Zv(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[fb(r)]=r,n[fb(i.attribute)]=r}return new bc(t,n,e.space)}const fR=Io({properties:{ariaActiveDescendant:null,ariaAtomic:vn,ariaAutoComplete:null,ariaBusy:vn,ariaChecked:vn,ariaColCount:Fe,ariaColIndex:Fe,ariaColSpan:Fe,ariaControls:Gt,ariaCurrent:null,ariaDescribedBy:Gt,ariaDetails:null,ariaDisabled:vn,ariaDropEffect:Gt,ariaErrorMessage:null,ariaExpanded:vn,ariaFlowTo:Gt,ariaGrabbed:vn,ariaHasPopup:null,ariaHidden:vn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Gt,ariaLevel:Fe,ariaLive:null,ariaModal:vn,ariaMultiLine:vn,ariaMultiSelectable:vn,ariaOrientation:null,ariaOwns:Gt,ariaPlaceholder:null,ariaPosInSet:Fe,ariaPressed:vn,ariaReadOnly:vn,ariaRelevant:null,ariaRequired:vn,ariaRoleDescription:Gt,ariaRowCount:Fe,ariaRowIndex:Fe,ariaRowSpan:Fe,ariaSelected:vn,ariaSetSize:Fe,ariaSort:null,ariaValueMax:Fe,ariaValueMin:Fe,ariaValueNow:Fe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function gR(e,t){return t in e?e[t]:t}function pR(e,t){return gR(e,t.toLowerCase())}const YP=Io({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ss,acceptCharset:Gt,accessKey:Gt,action:null,allow:null,allowFullScreen:yt,allowPaymentRequest:yt,allowUserMedia:yt,alpha:yt,alt:null,as:null,async:yt,autoCapitalize:null,autoComplete:Gt,autoFocus:yt,autoPlay:yt,blocking:Gt,capture:null,charSet:null,checked:yt,cite:null,className:Gt,closedBy:null,colorSpace:null,cols:Fe,colSpan:Fe,command:null,commandFor:null,content:null,contentEditable:vn,controls:yt,controlsList:Gt,coords:Fe|ss,crossOrigin:null,data:null,dateTime:null,decoding:null,default:yt,defer:yt,dir:null,dirName:null,disabled:yt,download:gb,draggable:vn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:yt,formTarget:null,headers:Gt,height:Fe,hidden:gb,high:Fe,href:null,hrefLang:null,htmlFor:Gt,httpEquiv:Gt,id:null,imageSizes:null,imageSrcSet:null,inert:yt,inputMode:null,integrity:null,is:null,isMap:yt,itemId:null,itemProp:Gt,itemRef:Gt,itemScope:yt,itemType:Gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:yt,low:Fe,manifest:null,max:null,maxLength:Fe,media:null,method:null,min:null,minLength:Fe,multiple:yt,muted:yt,name:null,nonce:null,noModule:yt,noValidate:yt,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:yt,optimum:Fe,pattern:null,ping:Gt,placeholder:null,playsInline:yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:yt,referrerPolicy:null,rel:Gt,required:yt,reversed:yt,rows:Fe,rowSpan:Fe,sandbox:Gt,scope:null,scoped:yt,seamless:yt,selected:yt,shadowRootClonable:yt,shadowRootCustomElementRegistry:yt,shadowRootDelegatesFocus:yt,shadowRootMode:null,shadowRootSerializable:yt,shape:null,size:Fe,sizes:null,slot:null,span:Fe,spellCheck:vn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Fe,step:null,style:null,tabIndex:Fe,target:null,title:null,translate:null,type:null,typeMustMatch:yt,useMap:null,value:vn,width:Fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Gt,axis:null,background:null,bgColor:null,border:Fe,borderColor:null,bottomMargin:Fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:yt,declare:yt,event:null,face:null,frame:null,frameBorder:null,hSpace:Fe,leftMargin:Fe,link:null,longDesc:null,lowSrc:null,marginHeight:Fe,marginWidth:Fe,noResize:yt,noHref:yt,noShade:yt,noWrap:yt,object:null,profile:null,prompt:null,rev:null,rightMargin:Fe,rules:null,scheme:null,scrolling:vn,standby:null,summary:null,text:null,topMargin:Fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Fe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:yt,disablePictureInPicture:yt,disableRemotePlayback:yt,exportParts:ss,part:Gt,prefix:null,property:null,results:Fe,security:null,unselectable:null},space:"html",transform:pR}),XP=Io({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:Er,accentHeight:Fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Fe,amplitude:Fe,arabicForm:null,ascent:Fe,attributeName:null,attributeType:null,azimuth:Fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Fe,by:null,calcMode:null,capHeight:Fe,className:Gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Fe,diffuseConstant:Fe,direction:null,display:null,dur:null,divisor:Fe,dominantBaseline:null,download:yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Fe,enableBackground:null,end:null,event:null,exponent:Fe,externalResourcesRequired:null,fill:null,fillOpacity:Fe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ss,g2:ss,glyphName:ss,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Fe,horizOriginX:Fe,horizOriginY:Fe,id:null,ideographic:Fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Fe,k:Fe,k1:Fe,k2:Fe,k3:Fe,k4:Fe,kernelMatrix:Er,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Fe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Fe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Fe,overlineThickness:Fe,paintOrder:null,panose1:null,path:null,pathLength:Fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Fe,pointsAtY:Fe,pointsAtZ:Fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Er,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Er,rev:Er,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Er,requiredFeatures:Er,requiredFonts:Er,requiredFormats:Er,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Fe,specularExponent:Fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Fe,strikethroughThickness:Fe,string:null,stroke:null,strokeDashArray:Er,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Fe,strokeOpacity:Fe,strokeWidth:null,style:null,surfaceScale:Fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Er,tabIndex:Fe,tableValues:null,target:null,targetX:Fe,targetY:Fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Er,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Fe,underlineThickness:Fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Fe,values:null,vAlphabetic:Fe,vMathematical:Fe,vectorEffect:null,vHanging:Fe,vIdeographic:Fe,version:null,vertAdvY:Fe,vertOriginX:Fe,vertOriginY:Fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gR}),hR=Io({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()}}),mR=Io({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:pR}),xR=Io({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),QP={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"},ZP=/[A-Z]/g,G_=/-[a-z]/g,JP=/^data[-\w.:]+$/i;function e6(e,t){const n=fb(t);let r=t,a=br;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JP.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(G_,n6);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!G_.test(i)){let s=i.replace(ZP,t6);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=Zv}return new a(r,t)}function t6(e){return"-"+e.toLowerCase()}function n6(e){return e.charAt(1).toUpperCase()}const r6=dR([fR,YP,hR,mR,xR],"html"),Jv=dR([fR,XP,hR,mR,xR],"svg");function a6(e){return e.join(" ").trim()}var e1={},K_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i6=/\n/g,s6=/^\s*/,o6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l6=/^:\s*/,c6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u6=/^[;\s]*/,d6=/^\s+|\s+$/g,f6=`
|
|
49
|
-
`,Y_="/",X_="*",Qi="",g6="comment",p6="declaration";function h6(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 a(m){var y=m.match(i6);y&&(n+=y.length);var v=m.lastIndexOf(f6);r=~v?m.length-v:r+m.length}function i(){var m={line:n,column:r};return function(y){return y.position=new s(m),u(),y}}function s(m){this.start=m,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function l(m){var y=new Error(t.source+":"+n+":"+r+": "+m);if(y.reason=m,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function c(m){var y=m.exec(e);if(y){var v=y[0];return a(v),e=e.slice(v.length),y}}function u(){c(s6)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=i();if(!(Y_!=e.charAt(0)||X_!=e.charAt(1))){for(var y=2;Qi!=e.charAt(y)&&(X_!=e.charAt(y)||Y_!=e.charAt(y+1));)++y;if(y+=2,Qi===e.charAt(y-1))return l("End of comment missing");var v=e.slice(2,y-2);return r+=2,a(v),e=e.slice(y),r+=2,m({type:g6,comment:v})}}function g(){var m=i(),y=c(o6);if(y){if(f(),!c(l6))return l("property missing ':'");var v=c(c6),x=m({type:p6,property:Q_(y[0].replace(K_,Qi)),value:v?Q_(v[0].replace(K_,Qi)):Qi});return c(u6),x}}function p(){var m=[];d(m);for(var y;y=g();)y!==!1&&(m.push(y),d(m));return m}return u(),p()}function Q_(e){return e?e.replace(d6,Qi):Qi}var m6=h6,x6=mi&&mi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e1,"__esModule",{value:!0});e1.default=b6;const y6=x6(m6);function b6(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,y6.default)(e),a=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:s,value:l}=i;a?t(s,l,i):l&&(n=n||{},n[s]=l)}),n}var of={};Object.defineProperty(of,"__esModule",{value:!0});of.camelCase=void 0;var v6=/^--[a-zA-Z0-9_-]+$/,k6=/-([a-z])/g,_6=/^[^-]+$/,w6=/^-(webkit|moz|ms|o|khtml)-/,E6=/^-(ms)-/,S6=function(e){return!e||_6.test(e)||v6.test(e)},N6=function(e,t){return t.toUpperCase()},Z_=function(e,t){return"".concat(t,"-")},C6=function(e,t){return t===void 0&&(t={}),S6(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(E6,Z_):e=e.replace(w6,Z_),e.replace(k6,N6))};of.camelCase=C6;var j6=mi&&mi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},T6=j6(e1),R6=of;function hb(e,t){var n={};return!e||typeof e!="string"||(0,T6.default)(e,function(r,a){r&&a&&(n[(0,R6.camelCase)(r,t)]=a)}),n}hb.default=hb;var A6=hb;const I6=No(A6),yR=bR("end"),t1=bR("start");function bR(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 M6(e){const t=t1(e),n=yR(e);if(t&&n)return{start:t,end:n}}function jl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?J_(e.position):"start"in e||"end"in e?J_(e):"line"in e||"column"in e?mb(e):""}function mb(e){return ew(e&&e.line)+":"+ew(e&&e.column)}function J_(e){return mb(e&&e.start)+"-"+mb(e&&e.end)}function ew(e){return e&&typeof e=="number"?e:1}class Jn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=jl(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jn.prototype.file="";Jn.prototype.name="";Jn.prototype.reason="";Jn.prototype.message="";Jn.prototype.stack="";Jn.prototype.column=void 0;Jn.prototype.line=void 0;Jn.prototype.ancestors=void 0;Jn.prototype.cause=void 0;Jn.prototype.fatal=void 0;Jn.prototype.place=void 0;Jn.prototype.ruleId=void 0;Jn.prototype.source=void 0;const n1={}.hasOwnProperty,L6=new Map,O6=/[A-Z]/g,D6=new Set(["table","tbody","thead","tfoot","tr"]),P6=new Set(["td","th"]),vR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function F6(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=V6(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=W6(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Jv:r6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=kR(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function kR(e,t,n){if(t.type==="element")return B6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return z6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $6(e,t,n);if(t.type==="mdxjsEsm")return U6(e,t);if(t.type==="root")return H6(e,t,n);if(t.type==="text")return q6(e,t)}function B6(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Jv,e.schema=a),e.ancestors.push(t);const i=wR(e,t.tagName,!1),s=G6(e,t);let l=a1(e,t);return D6.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!GP(c):!0})),_R(e,s,i,t),r1(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function z6(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)}rc(e,t.position)}function U6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rc(e,t.position)}function $6(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Jv,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:wR(e,t.name,!0),s=K6(e,t),l=a1(e,t);return _R(e,s,i,t),r1(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function H6(e,t,n){const r={};return r1(r,a1(e,t)),e.create(t,e.Fragment,r,n)}function q6(e,t){return t.value}function _R(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function r1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function W6(e,t,n){return r;function r(a,i,s,l){const u=Array.isArray(s.children)?n:t;return l?u(i,s,l):u(i,s)}}function V6(e,t){return n;function n(r,a,i,s){const l=Array.isArray(i.children),c=t1(r);return t(a,i,s,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function G6(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&n1.call(t.properties,a)){const i=Y6(e,a,t.properties[a]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&P6.has(t.tagName)?r=l:n[s]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function K6(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const l=s.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else rc(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else rc(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function a1(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:L6;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=a.get(c)||0;s=c+"-"+u,a.set(c,u+1)}}const l=kR(e,i,s);l!==void 0&&n.push(l)}return n}function Y6(e,t,n){const r=e6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$P(n):a6(n)),r.property==="style"){let a=typeof n=="object"?n:X6(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Q6(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?QP[r.property]||r.property:r.attribute,n]}}function X6(e,t){try{return I6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Jn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=vR+"#cannot-parse-style-attribute",a}}function wR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,s;for(;++i<a.length;){const l=q_(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};s=s?{type:"MemberExpression",object:s,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=s}else r=q_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return n1.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);rc(e)}function rc(e,t){const n=new Jn("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=vR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q6(e){const t={};let n;for(n in e)n1.call(e,n)&&(t[Z6(n)]=e[n]);return t}function Z6(e){let t=e.replace(O6,J6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function J6(e){return"-"+e.toLowerCase()}const Pg={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"]},e7={};function i1(e,t){const n=e7,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ER(e,r,a)}function ER(e,t,n){if(t7(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 tw(e.children,t,n)}return Array.isArray(e)?tw(e,t,n):""}function tw(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=ER(e[a],t,n);return r.join("")}function t7(e){return!!(e&&typeof e=="object")}const nw=document.createElement("i");function s1(e){const t="&"+e+";";nw.innerHTML=t;const n=nw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ar(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Br(e,t){return e.length>0?(Ar(e,e.length,0,t),e):t}const rw={}.hasOwnProperty;function SR(e){const t={};let n=-1;for(;++n<e.length;)n7(t,e[n]);return t}function n7(e,t){let n;for(n in t){const a=(rw.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){rw.call(a,s)||(a[s]=[]);const l=i[s];r7(a[s],Array.isArray(l)?l:l?[l]:[])}}}function r7(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ar(e,0,0,r)}function NR(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 sa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ir=zi(/[A-Za-z]/),Qn=zi(/[\dA-Za-z]/),a7=zi(/[#-'*+\--9=?A-Z^-~]/);function Nd(e){return e!==null&&(e<32||e===127)}const xb=zi(/\d/),i7=zi(/[\dA-Fa-f]/),s7=zi(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function Kt(e){return e!==null&&(e<0||e===32)}function jt(e){return e===-2||e===-1||e===32}const lf=zi(new RegExp("\\p{P}|\\p{S}","u")),hs=zi(/\s/);function zi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mo(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&Qn(e.charCodeAt(n+1))&&Qn(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(s=String.fromCharCode(i,l),a=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+a+1,s=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Lt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return jt(c)?(e.enter(n),l(c)):t(c)}function l(c){return jt(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const o7={tokenize:l7};function l7(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Lt(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,s(l)}function s(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return lt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),s)}}const c7={tokenize:u7},aw={tokenize:d7};function u7(e){const t=this,n=[];let r=0,a,i,s;return l;function l(k){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,c,u)(k)}return u(k)}function c(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&b();const N=t.events.length;let _=N,w;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){w=t.events[_][1].end;break}x(r);let E=N;for(;E<t.events.length;)t.events[E][1].end={...w},E++;return Ar(t.events,_+1,0,t.events.slice(N)),t.events.length=E,u(k)}return l(k)}function u(k){if(r===n.length){if(!a)return g(k);if(a.currentConstruct&&a.currentConstruct.concrete)return m(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(aw,d,f)(k)}function d(k){return a&&b(),x(r),g(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,m(k)}function g(k){return t.containerState={},e.attempt(aw,p,m)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),g(k)}function m(k){if(k===null){a&&b(),x(0),e.consume(k);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),y(k)}function y(k){if(k===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(k);return}return lt(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),y)}function v(k,N){const _=t.sliceStream(k);if(N&&_.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(_),t.parser.lazy[k.start.line]){let w=a.events.length;for(;w--;)if(a.events[w][1].start.offset<s&&(!a.events[w][1].end||a.events[w][1].end.offset>s))return;const E=t.events.length;let S=E,M,j;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(M){j=t.events[S][1].end;break}M=!0}for(x(r),w=E;w<t.events.length;)t.events[w][1].end={...j},w++;Ar(t.events,S+1,0,t.events.slice(E)),t.events.length=w}}function x(k){let N=n.length;for(;N-- >k;){const _=n[N];t.containerState=_[1],_[0].exit.call(t,e)}n.length=k}function b(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function d7(e,t,n){return Lt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Eo(e){if(e===null||Kt(e)||hs(e))return 1;if(lf(e))return 2}function cf(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const yb={name:"attention",resolveAll:f7,tokenize:g7};function f7(e,t){let n=-1,r,a,i,s,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},g={...e[n][1].start};iw(f,-c),iw(g,c),s={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},e[r][1].end={...s.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Br(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Br(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Br(u,cf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Br(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Br(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ar(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function g7(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Eo(r);let i;return s;function s(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Eo(c),f=!d||d===2&&a||n.includes(c),g=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(a||!g)),u._close=!!(i===42?g:g&&(d||!f)),t(c)}}function iw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const p7={name:"autolink",tokenize:h7};function h7(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return ir(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Qn(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||Qn(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Nd(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):a7(p)?(e.consume(p),u):n(p)}function d(p){return Qn(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):g(p)}function g(p){if((p===45||Qn(p))&&r++<63){const m=p===45?g:f;return e.consume(p),m}return n(p)}}const vc={partial:!0,tokenize:m7};function m7(e,t,n){return r;function r(i){return jt(i)?Lt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||lt(i)?t(i):n(i)}}const CR={continuation:{tokenize:y7},exit:b7,name:"blockQuote",tokenize:x7};function x7(e,t,n){const r=this;return a;function a(s){if(s===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return jt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function y7(e,t,n){const r=this;return a;function a(s){return jt(s)?Lt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(CR,t,n)(s)}}function b7(e){e.exit("blockQuote")}const jR={name:"characterEscape",tokenize:v7};function v7(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return s7(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const TR={name:"characterReference",tokenize:k7};function k7(e,t,n){const r=this;let a=0,i,s;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Qn,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=i7,d):(e.enter("characterReferenceValue"),i=7,s=xb,d(f))}function d(f){if(f===59&&a){const g=e.exit("characterReferenceValue");return s===Qn&&!s1(r.sliceSerialize(g))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),d):n(f)}}const sw={partial:!0,tokenize:w7},ow={concrete:!0,name:"codeFenced",tokenize:_7};function _7(e,t,n){const r=this,a={partial:!0,tokenize:_};let i=0,s=0,l;return c;function c(w){return u(w)}function u(w){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===l?(s++,e.consume(w),d):s<3?n(w):(e.exit("codeFencedFenceSequence"),jt(w)?Lt(e,f,"whitespace")(w):f(w))}function f(w){return w===null||lt(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(sw,y,N)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||lt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(w)):jt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Lt(e,p,"whitespace")(w)):w===96&&w===l?n(w):(e.consume(w),g)}function p(w){return w===null||lt(w)?f(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||lt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(w)):w===96&&w===l?n(w):(e.consume(w),m)}function y(w){return e.attempt(a,N,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),x}function x(w){return i>0&&jt(w)?Lt(e,b,"linePrefix",i+1)(w):b(w)}function b(w){return w===null||lt(w)?e.check(sw,y,N)(w):(e.enter("codeFlowValue"),k(w))}function k(w){return w===null||lt(w)?(e.exit("codeFlowValue"),b(w)):(e.consume(w),k)}function N(w){return e.exit("codeFenced"),t(w)}function _(w,E,S){let M=0;return j;function j(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),F}function F(I){return w.enter("codeFencedFence"),jt(I)?Lt(w,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):P(I)}function P(I){return I===l?(w.enter("codeFencedFenceSequence"),W(I)):S(I)}function W(I){return I===l?(M++,w.consume(I),W):M>=s?(w.exit("codeFencedFenceSequence"),jt(I)?Lt(w,O,"whitespace")(I):O(I)):S(I)}function O(I){return I===null||lt(I)?(w.exit("codeFencedFence"),E(I)):S(I)}}}function w7(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Fg={name:"codeIndented",tokenize:S7},E7={partial:!0,tokenize:N7};function S7(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Lt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?c(u):lt(u)?e.attempt(E7,s,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||lt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function N7(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):lt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Lt(e,i,"linePrefix",5)(s)}function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):lt(s)?a(s):n(s)}}const C7={name:"codeText",previous:T7,resolve:j7,tokenize:R7};function j7(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function T7(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function R7(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),a=0,d(f)):lt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||lt(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class A7{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&el(this.left,r),i.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),el(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),el(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);el(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);el(this.left,n.reverse())}}}function el(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 RR(e){const t={};let n=-1,r,a,i,s,l,c,u;const d=new A7(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,I7(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},l=d.slice(a,n),l.unshift(r),d.splice(a,n-a+1,l))}}return Ar(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function I7(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const l=s.events,c=[],u={};let d,f,g=-1,p=n,m=0,y=0;const v=[y];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(y=g+1,v.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),g=v.length;g--;){const x=l.slice(v[g],v[g+1]),b=i.pop();c.push([b,b+x.length-1]),e.splice(b,2,x)}for(c.reverse(),g=-1;++g<c.length;)u[m+c[g][0]]=m+c[g][1],m+=c[g][1]-c[g][0]-1;return u}const M7={resolve:O7,tokenize:D7},L7={partial:!0,tokenize:P7};function O7(e){return RR(e),e}function D7(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):lt(l)?e.check(L7,s,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function s(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function P7(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Lt(e,i,"linePrefix")}function i(s){if(s===null||lt(s))return n(s);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function AR(e,t,n,r,a,i,s,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(x){return x===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(x),e.exit(i),g):x===null||x===32||x===41||Nd(x)?n(x):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(x))}function g(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(l),g(x)):x===null||x===60||lt(x)?n(x):(e.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function y(x){return!d&&(x===null||x===41||Kt(x))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(x)):d<u&&x===40?(e.consume(x),d++,y):x===41?(e.consume(x),d--,y):x===null||x===32||x===40||Nd(x)?n(x):(e.consume(x),x===92?v:y)}function v(x){return x===40||x===41||x===92?(e.consume(x),y):y(x)}}function IR(e,t,n,r,a,i){const s=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):lt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||lt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!jt(p)),p===92?g:f)}function g(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function MR(e,t,n,r,a,i){let s;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(a),e.consume(g),e.exit(a),s=g===40?41:g,c):n(g)}function c(g){return g===s?(e.enter(a),e.consume(g),e.exit(a),e.exit(r),t):(e.enter(i),u(g))}function u(g){return g===s?(e.exit(i),c(s)):g===null?n(g):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Lt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===s||g===null||lt(g)?(e.exit("chunkString"),u(g)):(e.consume(g),g===92?f:d)}function f(g){return g===s||g===92?(e.consume(g),d):d(g)}}function Tl(e,t){let n;return r;function r(a){return lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):jt(a)?Lt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const F7={name:"definition",tokenize:z7},B7={partial:!0,tokenize:U7};function z7(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return IR.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return a=sa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Kt(p)?Tl(e,u)(p):u(p)}function u(p){return AR(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(B7,f,f)(p)}function f(p){return jt(p)?Lt(e,g,"whitespace")(p):g(p)}function g(p){return p===null||lt(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function U7(e,t,n){return r;function r(l){return Kt(l)?Tl(e,a)(l):n(l)}function a(l){return MR(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return jt(l)?Lt(e,s,"whitespace")(l):s(l)}function s(l){return l===null||lt(l)?t(l):n(l)}}const $7={name:"hardBreakEscape",tokenize:H7};function H7(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return lt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const q7={name:"headingAtx",resolve:W7,tokenize:V7};function W7(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ar(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function V7(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Kt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||lt(d)?(e.exit("atxHeading"),t(d)):jt(d)?Lt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Kt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const G7=["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"],lw=["pre","script","style","textarea"],K7={concrete:!0,name:"htmlFlow",resolveTo:Q7,tokenize:Z7},Y7={partial:!0,tokenize:e8},X7={partial:!0,tokenize:J7};function Q7(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 Z7(e,t,n){const r=this;let a,i,s,l,c;return u;function u(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),f}function f(A){return A===33?(e.consume(A),g):A===47?(e.consume(A),i=!0,y):A===63?(e.consume(A),a=3,r.interrupt?t:R):ir(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function g(A){return A===45?(e.consume(A),a=2,p):A===91?(e.consume(A),a=5,l=0,m):ir(A)?(e.consume(A),a=4,r.interrupt?t:R):n(A)}function p(A){return A===45?(e.consume(A),r.interrupt?t:R):n(A)}function m(A){const H="CDATA[";return A===H.charCodeAt(l++)?(e.consume(A),l===H.length?r.interrupt?t:P:m):n(A)}function y(A){return ir(A)?(e.consume(A),s=String.fromCharCode(A),v):n(A)}function v(A){if(A===null||A===47||A===62||Kt(A)){const H=A===47,ce=s.toLowerCase();return!H&&!i&&lw.includes(ce)?(a=1,r.interrupt?t(A):P(A)):G7.includes(s.toLowerCase())?(a=6,H?(e.consume(A),x):r.interrupt?t(A):P(A)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?b(A):k(A))}return A===45||Qn(A)?(e.consume(A),s+=String.fromCharCode(A),v):n(A)}function x(A){return A===62?(e.consume(A),r.interrupt?t:P):n(A)}function b(A){return jt(A)?(e.consume(A),b):j(A)}function k(A){return A===47?(e.consume(A),j):A===58||A===95||ir(A)?(e.consume(A),N):jt(A)?(e.consume(A),k):j(A)}function N(A){return A===45||A===46||A===58||A===95||Qn(A)?(e.consume(A),N):_(A)}function _(A){return A===61?(e.consume(A),w):jt(A)?(e.consume(A),_):k(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),c=A,E):jt(A)?(e.consume(A),w):S(A)}function E(A){return A===c?(e.consume(A),c=null,M):A===null||lt(A)?n(A):(e.consume(A),E)}function S(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Kt(A)?_(A):(e.consume(A),S)}function M(A){return A===47||A===62||jt(A)?k(A):n(A)}function j(A){return A===62?(e.consume(A),F):n(A)}function F(A){return A===null||lt(A)?P(A):jt(A)?(e.consume(A),F):n(A)}function P(A){return A===45&&a===2?(e.consume(A),T):A===60&&a===1?(e.consume(A),L):A===62&&a===4?(e.consume(A),Y):A===63&&a===3?(e.consume(A),R):A===93&&a===5?(e.consume(A),Z):lt(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Y7,V,W)(A)):A===null||lt(A)?(e.exit("htmlFlowData"),W(A)):(e.consume(A),P)}function W(A){return e.check(X7,O,V)(A)}function O(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),I}function I(A){return A===null||lt(A)?W(A):(e.enter("htmlFlowData"),P(A))}function T(A){return A===45?(e.consume(A),R):P(A)}function L(A){return A===47?(e.consume(A),s="",$):P(A)}function $(A){if(A===62){const H=s.toLowerCase();return lw.includes(H)?(e.consume(A),Y):P(A)}return ir(A)&&s.length<8?(e.consume(A),s+=String.fromCharCode(A),$):P(A)}function Z(A){return A===93?(e.consume(A),R):P(A)}function R(A){return A===62?(e.consume(A),Y):A===45&&a===2?(e.consume(A),R):P(A)}function Y(A){return A===null||lt(A)?(e.exit("htmlFlowData"),V(A)):(e.consume(A),Y)}function V(A){return e.exit("htmlFlow"),t(A)}}function J7(e,t,n){const r=this;return a;function a(s){return lt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function e8(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(vc,t,n)}}const t8={name:"htmlText",tokenize:n8};function n8(e,t,n){const r=this;let a,i,s;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),_):R===63?(e.consume(R),k):ir(R)?(e.consume(R),S):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),i=0,m):ir(R)?(e.consume(R),b):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),g):lt(R)?(s=f,L(R)):(e.consume(R),f)}function g(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?T(R):R===45?g(R):f(R)}function m(R){const Y="CDATA[";return R===Y.charCodeAt(i++)?(e.consume(R),i===Y.length?y:m):n(R)}function y(R){return R===null?n(R):R===93?(e.consume(R),v):lt(R)?(s=y,L(R)):(e.consume(R),y)}function v(R){return R===93?(e.consume(R),x):y(R)}function x(R){return R===62?T(R):R===93?(e.consume(R),x):y(R)}function b(R){return R===null||R===62?T(R):lt(R)?(s=b,L(R)):(e.consume(R),b)}function k(R){return R===null?n(R):R===63?(e.consume(R),N):lt(R)?(s=k,L(R)):(e.consume(R),k)}function N(R){return R===62?T(R):k(R)}function _(R){return ir(R)?(e.consume(R),w):n(R)}function w(R){return R===45||Qn(R)?(e.consume(R),w):E(R)}function E(R){return lt(R)?(s=E,L(R)):jt(R)?(e.consume(R),E):T(R)}function S(R){return R===45||Qn(R)?(e.consume(R),S):R===47||R===62||Kt(R)?M(R):n(R)}function M(R){return R===47?(e.consume(R),T):R===58||R===95||ir(R)?(e.consume(R),j):lt(R)?(s=M,L(R)):jt(R)?(e.consume(R),M):T(R)}function j(R){return R===45||R===46||R===58||R===95||Qn(R)?(e.consume(R),j):F(R)}function F(R){return R===61?(e.consume(R),P):lt(R)?(s=F,L(R)):jt(R)?(e.consume(R),F):M(R)}function P(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,W):lt(R)?(s=P,L(R)):jt(R)?(e.consume(R),P):(e.consume(R),O)}function W(R){return R===a?(e.consume(R),a=void 0,I):R===null?n(R):lt(R)?(s=W,L(R)):(e.consume(R),W)}function O(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Kt(R)?M(R):(e.consume(R),O)}function I(R){return R===47||R===62||Kt(R)?M(R):n(R)}function T(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function L(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),$}function $(R){return jt(R)?Lt(e,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Z(R)}function Z(R){return e.enter("htmlTextData"),s(R)}}const o1={name:"labelEnd",resolveAll:s8,resolveTo:o8,tokenize:l8},r8={tokenize:c8},a8={tokenize:u8},i8={tokenize:d8};function s8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ar(e,0,e.length,n),e}function o8(e,t){let n=e.length,r=0,a,i,s,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Br(l,e.slice(i+1,i+r+3)),l=Br(l,[["enter",d,t]]),l=Br(l,cf(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),l=Br(l,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),l=Br(l,e.slice(s+1)),l=Br(l,[["exit",c,t]]),Ar(e,i,e.length,l),e}function l8(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return l;function l(g){return i?i._inactive?f(g):(s=r.parser.defined.includes(sa(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),c):n(g)}function c(g){return g===40?e.attempt(r8,d,s?d:f)(g):g===91?e.attempt(a8,d,s?u:f)(g):s?d(g):f(g)}function u(g){return e.attempt(i8,d,f)(g)}function d(g){return t(g)}function f(g){return i._balanced=!0,n(g)}}function c8(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return Kt(f)?Tl(e,i)(f):i(f)}function i(f){return f===41?d(f):AR(e,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return Kt(f)?Tl(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?MR(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Kt(f)?Tl(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function u8(e,t,n){const r=this;return a;function a(l){return IR.call(r,e,i,s,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(sa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function s(l){return n(l)}}function d8(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const f8={name:"labelStartImage",resolveAll:o1.resolveAll,tokenize:g8};function g8(e,t,n){const r=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),s):n(l)}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const p8={name:"labelStartLink",resolveAll:o1.resolveAll,tokenize:h8};function h8(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Bg={name:"lineEnding",tokenize:m8};function m8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Lt(e,t,"linePrefix")}}const Xu={name:"thematicBreak",tokenize:x8};function x8(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,l(u)}function l(u){return u===a?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||lt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),jt(u)?Lt(e,l,"whitespace")(u):l(u))}}const fr={continuation:{tokenize:k8},exit:w8,name:"list",tokenize:v8},y8={partial:!0,tokenize:E8},b8={partial:!0,tokenize:_8};function v8(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return l;function l(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xb(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Xu,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return xb(p)&&++s<10?(e.consume(p),c):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(vc,r.interrupt?n:d,e.attempt(y8,g,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,g(p)}function f(p){return jt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),g):n(p)}function g(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function k8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(vc,a,i);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Lt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!jt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(b8,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Lt(e,e.attempt(fr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function _8(e,t,n){const r=this;return Lt(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function w8(e){e.exit(this.containerState.type)}function E8(e,t,n){const r=this;return Lt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const s=r.events[r.events.length-1];return!jt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const cw={name:"setextUnderline",resolveTo:S8,tokenize:N8};function S8(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function N8(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===a?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),jt(u)?Lt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||lt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const C8={tokenize:j8};function j8(e){const t=this,n=e.attempt(vc,r,e.attempt(this.parser.constructs.flowInitial,a,Lt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(M7,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const T8={resolveAll:OR()},R8=LR("string"),A8=LR("text");function LR(e){return{resolveAll:OR(e==="text"?I8:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,l);return s;function s(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=a[d];let g=-1;if(f)for(;++g<f.length;){const p=f[g];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function OR(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function I8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,l=0,c;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)l++,s--;if(s)break;s=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const M8={42:fr,43:fr,45:fr,48:fr,49:fr,50:fr,51:fr,52:fr,53:fr,54:fr,55:fr,56:fr,57:fr,62:CR},L8={91:F7},O8={[-2]:Fg,[-1]:Fg,32:Fg},D8={35:q7,42:Xu,45:[cw,Xu],60:K7,61:cw,95:Xu,96:ow,126:ow},P8={38:TR,92:jR},F8={[-5]:Bg,[-4]:Bg,[-3]:Bg,33:f8,38:TR,42:yb,60:[p7,t8],91:p8,92:[$7,jR],93:o1,95:yb,96:C7},B8={null:[yb,T8]},z8={null:[42,95]},U8={null:[]},$8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z8,contentInitial:L8,disable:U8,document:M8,flow:D8,flowInitial:O8,insideSpan:B8,string:P8,text:F8},Symbol.toStringTag,{value:"Module"}));function H8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let s=[],l=[];const c={attempt:E(_),check:E(w),consume:b,enter:k,exit:N,interrupt:E(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:m,parser:e,previous:null,sliceSerialize:g,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(F){return s=Br(s,F),v(),s[s.length-1]!==null?[]:(S(t,0),u.events=cf(i,u.events,u),u.events)}function g(F,P){return W8(p(F),P)}function p(F){return q8(s,F)}function m(){const{_bufferIndex:F,_index:P,line:W,column:O,offset:I}=r;return{_bufferIndex:F,_index:P,line:W,column:O,offset:I}}function y(F){a[F.line]=F.column,j()}function v(){let F;for(;r._index<s.length;){const P=s[r._index];if(typeof P=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<P.length;)x(P.charCodeAt(r._bufferIndex));else x(P)}}function x(F){d=d(F)}function b(F){lt(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,j()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=F}function k(F,P){const W=P||{};return W.type=F,W.start=m(),u.events.push(["enter",W,u]),l.push(W),W}function N(F){const P=l.pop();return P.end=m(),u.events.push(["exit",P,u]),P}function _(F,P){S(F,P.from)}function w(F,P){P.restore()}function E(F,P){return W;function W(O,I,T){let L,$,Z,R;return Array.isArray(O)?V(O):"tokenize"in O?V([O]):Y(O);function Y(ee){return Me;function Me(X){const ye=X!==null&&ee[X],Oe=X!==null&&ee.null,Ee=[...Array.isArray(ye)?ye:ye?[ye]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return V(Ee)(X)}}function V(ee){return L=ee,$=0,ee.length===0?T:A(ee[$])}function A(ee){return Me;function Me(X){return R=M(),Z=ee,ee.partial||(u.currentConstruct=ee),ee.name&&u.parser.constructs.disable.null.includes(ee.name)?ce():ee.tokenize.call(P?Object.assign(Object.create(u),P):u,c,H,ce)(X)}}function H(ee){return F(Z,R),I}function ce(ee){return R.restore(),++$<L.length?A(L[$]):T}}}function S(F,P){F.resolveAll&&!i.includes(F)&&i.push(F),F.resolve&&Ar(u.events,P,u.events.length-P,F.resolve(u.events.slice(P),u)),F.resolveTo&&(u.events=F.resolveTo(u.events,u))}function M(){const F=m(),P=u.previous,W=u.currentConstruct,O=u.events.length,I=Array.from(l);return{from:O,restore:T};function T(){r=F,u.previous=P,u.currentConstruct=W,u.events.length=O,l=I,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function q8(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const l=s[0];typeof l=="string"?s[0]=l.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function W8(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
50
|
-
`;break}case-3:{s=`\r
|
|
51
|
-
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}function V8(e){const r={constructs:SR([$8,...(e||{}).extensions||[]]),content:a(o7),defined:[],document:a(c7),flow:a(C8),lazy:{},string:a(R8),text:a(A8)};return r;function a(i){return s;function s(l){return H8(r,i,l)}}}function G8(e){for(;!RR(e););return e}const uw=/[\0\t\n\r]/g;function K8(){let e=1,t="",n=!0,r;return a;function a(i,s,l){const c=[];let u,d,f,g,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(uw.lastIndex=f,u=uw.exec(i),g=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(g),!u){t=i.slice(f);break}if(p===10&&f===g&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<g&&(c.push(i.slice(f,g)),e+=g-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=g+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Y8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function X8(e){return e.replace(Y8,Q8)}function Q8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return NR(n.slice(i?2:1),i?16:10)}return s1(n)||e}const DR={}.hasOwnProperty;function Z8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),J8(n)(G8(V8(n).document().write(K8()(e,t,!0))))}function J8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(we),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(me),blockQuote:i(Oe),characterEscape:M,characterReference:M,codeFenced:i(Ee),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Ee,s),codeText:i(de,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(Se),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Ae),hardBreakEscape:i(ve),hardBreakTrailing:i(ve),htmlFlow:i(De,s),htmlFlowData:M,htmlText:i(De,s),htmlTextData:M,image:i(K),label:s,link:i(we),listItem:i(ge),listItemValue:g,listOrdered:i(Te,f),listUnordered:i(Te),paragraph:i(xe),reference:A,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(he),thematicBreak:i(pe)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:ye,autolinkProtocol:X,blockQuote:c(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:ee,characterReference:Me,codeFenced:c(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:j,codeIndented:c(x),codeText:c(I),codeTextData:j,data:j,definition:c(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(P),hardBreakTrailing:c(P),htmlFlow:c(W),htmlFlowData:j,htmlText:c(O),htmlTextData:j,image:c(L),label:Z,labelText:$,lineEnding:F,link:c(T),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:H,resourceDestinationString:R,resourceTitleString:Y,resource:V,setextHeading:c(S),setextHeadingLineSequence:E,setextHeadingText:w,strong:c(),thematicBreak:c()}};PR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let D={type:"root",children:[]};const G={stack:[D],tokenStack:[],config:t,enter:l,exit:u,buffer:s,resume:d,data:n},le=[];let je=-1;for(;++je<U.length;)if(U[je][1].type==="listOrdered"||U[je][1].type==="listUnordered")if(U[je][0]==="enter")le.push(je);else{const $e=le.pop();je=a(U,$e,je)}for(je=-1;++je<U.length;){const $e=t[U[je][0]];DR.call($e,U[je][1].type)&&$e[U[je][1].type].call(Object.assign({sliceSerialize:U[je][2].sliceSerialize},G),U[je][1])}if(G.tokenStack.length>0){const $e=G.tokenStack[G.tokenStack.length-1];($e[1]||dw).call(G,void 0,$e[0])}for(D.position={start:si(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:si(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)D=t.transforms[je](D)||D;return D}function a(U,D,G){let le=D-1,je=-1,$e=!1,Ve,Qe,Ye,_t;for(;++le<=G;){const He=U[le];switch(He[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{He[0]==="enter"?je++:je--,_t=void 0;break}case"lineEndingBlank":{He[0]==="enter"&&(Ve&&!_t&&!je&&!Ye&&(Ye=le),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!je&&He[0]==="enter"&&He[1].type==="listItemPrefix"||je===-1&&He[0]==="exit"&&(He[1].type==="listUnordered"||He[1].type==="listOrdered")){if(Ve){let at=le;for(Qe=void 0;at--;){const ue=U[at];if(ue[1].type==="lineEnding"||ue[1].type==="lineEndingBlank"){if(ue[0]==="exit")continue;Qe&&(U[Qe][1].type="lineEndingBlank",$e=!0),ue[1].type="lineEnding",Qe=at}else if(!(ue[1].type==="linePrefix"||ue[1].type==="blockQuotePrefix"||ue[1].type==="blockQuotePrefixWhitespace"||ue[1].type==="blockQuoteMarker"||ue[1].type==="listItemIndent"))break}Ye&&(!Qe||Ye<Qe)&&(Ve._spread=!0),Ve.end=Object.assign({},Qe?U[Qe][1].start:He[1].end),U.splice(Qe||le,0,["exit",Ve,He[2]]),le++,G++}if(He[1].type==="listItemPrefix"){const at={type:"listItem",_spread:!1,start:Object.assign({},He[1].start),end:void 0};Ve=at,U.splice(le,0,["enter",at,He[2]]),le++,G++,Ye=void 0,_t=!0}}}return U[D][1]._spread=$e,G}function i(U,D){return G;function G(le){l.call(this,U(le),le),D&&D.call(this,le)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(U,D,G){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([D,G||void 0]),U.position={start:si(D.start),end:void 0}}function c(U){return D;function D(G){U&&U.call(this,G),u.call(this,G)}}function u(U,D){const G=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==U.type&&(D?D.call(this,U,le[0]):(le[1]||dw).call(this,U,le[0]));else throw new Error("Cannot close `"+U.type+"` ("+jl({start:U.start,end:U.end})+"): it’s not open");G.position.end=si(U.end)}function d(){return i1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(U){if(this.data.expectingFirstListItemValue){const D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),D=this.stack[this.stack.length-1];D.lang=U}function m(){const U=this.resume(),D=this.stack[this.stack.length-1];D.meta=U}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const U=this.resume(),D=this.stack[this.stack.length-1];D.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const U=this.resume(),D=this.stack[this.stack.length-1];D.value=U.replace(/(\r?\n|\r)$/g,"")}function b(U){const D=this.resume(),G=this.stack[this.stack.length-1];G.label=D,G.identifier=sa(this.sliceSerialize(U)).toLowerCase()}function k(){const U=this.resume(),D=this.stack[this.stack.length-1];D.title=U}function N(){const U=this.resume(),D=this.stack[this.stack.length-1];D.url=U}function _(U){const D=this.stack[this.stack.length-1];if(!D.depth){const G=this.sliceSerialize(U).length;D.depth=G}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function E(U){const D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function S(){this.data.setextHeadingSlurpLineEnding=void 0}function M(U){const G=this.stack[this.stack.length-1].children;let le=G[G.length-1];(!le||le.type!=="text")&&(le=fe(),le.position={start:si(U.start),end:void 0},G.push(le)),this.stack.push(le)}function j(U){const D=this.stack.pop();D.value+=this.sliceSerialize(U),D.position.end=si(U.end)}function F(U){const D=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=D.children[D.children.length-1];G.position.end=si(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(D.type)&&(M.call(this,U),j.call(this,U))}function P(){this.data.atHardBreak=!0}function W(){const U=this.resume(),D=this.stack[this.stack.length-1];D.value=U}function O(){const U=this.resume(),D=this.stack[this.stack.length-1];D.value=U}function I(){const U=this.resume(),D=this.stack[this.stack.length-1];D.value=U}function T(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=D,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function L(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=D,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function $(U){const D=this.sliceSerialize(U),G=this.stack[this.stack.length-2];G.label=X8(D),G.identifier=sa(D).toLowerCase()}function Z(){const U=this.stack[this.stack.length-1],D=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const le=U.children;G.children=le}else G.alt=D}function R(){const U=this.resume(),D=this.stack[this.stack.length-1];D.url=U}function Y(){const U=this.resume(),D=this.stack[this.stack.length-1];D.title=U}function V(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function H(U){const D=this.resume(),G=this.stack[this.stack.length-1];G.label=D,G.identifier=sa(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function ce(U){this.data.characterReferenceType=U.type}function ee(U){const D=this.sliceSerialize(U),G=this.data.characterReferenceType;let le;G?(le=NR(D,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=s1(D);const je=this.stack[this.stack.length-1];je.value+=le}function Me(U){const D=this.stack.pop();D.position.end=si(U.end)}function X(U){j.call(this,U);const D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(U)}function ye(U){j.call(this,U);const D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(U)}function Oe(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function De(){return{type:"html",value:""}}function K(){return{type:"image",title:null,url:"",alt:null}}function we(){return{type:"link",title:null,url:"",children:[]}}function Te(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function ge(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function xe(){return{type:"paragraph",children:[]}}function he(){return{type:"strong",children:[]}}function fe(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function si(e){return{line:e.line,column:e.column,offset:e.offset}}function PR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?PR(e,r):e9(e,r)}}function e9(e,t){let n;for(n in t)if(DR.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"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function dw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+") is still open")}function t9(e){const t=this;t.parser=n;function n(r){return Z8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function n9(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 r9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
-
`}]}function a9(e,t){const n=t.value?t.value+`
|
|
53
|
-
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function i9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Mo(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function l9(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 c9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function FR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const s=a[a.length-1];return s&&s.type==="text"?s.value+=r:a.push({type:"text",value:r}),a}function u9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return FR(e,t);const a={src:Mo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function d9(e,t){const n={src:Mo(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 f9(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 g9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return FR(e,t);const a={href:Mo(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function p9(e,t){const n={href:Mo(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 h9(e,t,n){const r=e.all(t),a=n?m9(n):BR(t),i={},s=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(a||l!==0||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
|
|
54
|
-
`}),d.type==="element"&&d.tagName==="p"&&!a?s.push(...d.children):s.push(d)}const c=r[r.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&s.push({type:"text",value:`
|
|
55
|
-
`});const u={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,u),e.applyData(t,u)}function m9(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=BR(n[r])}return t}function BR(e){const t=e.spread;return t??e.children.length>1}function x9(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const s=r[a];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function y9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function v9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k9(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),a.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=t1(t.children[1]),c=yR(t.children[t.children.length-1]);l&&c&&(s.position={start:l,end:c}),a.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function _9(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,l=s?s.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],g={},p=s?s[c]:void 0;p&&(g.align=p);let m={type:"element",tagName:i,properties:g,children:[]};f&&(m.children=e.all(f),e.patch(f,m),m=e.applyData(f,m)),u.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function w9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const fw=9,gw=32;function E9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(pw(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(pw(t.slice(a),a>0,!1)),i.join("")}function pw(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===fw||i===gw;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===fw||i===gw;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function S9(e,t){const n={type:"text",value:E9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function N9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const C9={blockquote:n9,break:r9,code:a9,delete:i9,emphasis:s9,footnoteReference:o9,heading:l9,html:c9,imageReference:u9,image:d9,inlineCode:f9,linkReference:g9,link:p9,listItem:h9,list:x9,paragraph:y9,root:b9,strong:v9,table:k9,tableCell:w9,tableRow:_9,text:S9,thematicBreak:N9,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const zR=-1,uf=0,Rl=1,Cd=2,l1=3,c1=4,u1=5,d1=6,UR=7,$R=8,HR=typeof self=="object"?self:globalThis,hw=(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 HR[e](t)},j9=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,s]=t[a];switch(i){case uf:case zR:return n(s,a);case Rl:{const l=n([],a);for(const c of s)l.push(r(c));return l}case Cd:{const l=n({},a);for(const[c,u]of s)l[r(c)]=r(u);return l}case l1:return n(new Date(s),a);case c1:{const{source:l,flags:c}=s;return n(new RegExp(l,c),a)}case u1:{const l=n(new Map,a);for(const[c,u]of s)l.set(r(c),r(u));return l}case d1:{const l=n(new Set,a);for(const c of s)l.add(r(c));return l}case UR:{const{name:l,message:c}=s;return n(typeof HR[l]=="function"?hw(l,c):new Error(c),a)}case $R:return n(BigInt(s),a);case"BigInt":return n(Object(BigInt(s)),a);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:l}=new Uint8Array(s);return n(new DataView(l),s)}}return n(hw(i,s),a)};return r},mw=e=>j9(new Map,e)(0),Xi="",{toString:T9}={},{keys:R9}=Object,tl=e=>{const t=typeof e;if(t!=="object"||!e)return[uf,t];const n=T9.call(e).slice(8,-1);switch(n){case"Array":return[Rl,Xi];case"Object":return[Cd,Xi];case"Date":return[l1,Xi];case"RegExp":return[c1,Xi];case"Map":return[u1,Xi];case"Set":return[d1,Xi];case"DataView":return[Rl,n]}return n.includes("Array")?[Rl,n]:e instanceof Error?[UR,e.name||"Error"]:[Cd,n]},pu=([e,t])=>e===uf&&(t==="function"||t==="symbol"),A9=(e,t,n,r)=>{const a=(s,l)=>{const c=r.push(s)-1;return n.set(l,c),c},i=s=>{if(n.has(s))return n.get(s);let[l,c]=tl(s);switch(l){case uf:{let d=s;switch(c){case"bigint":l=$R,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([zR],s)}return a([l,d],s)}case Rl:{if(c){let g=s;return c==="DataView"?g=new Uint8Array(s.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(s)),a([c,[...g]],s)}const d=[],f=a([l,d],s);for(const g of s)d.push(i(g));return f}case Cd:{if(c)switch(c){case"BigInt":return a([c,s.toString()],s);case"Boolean":case"Number":case"String":return a([c,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const d=[],f=a([l,d],s);for(const g of R9(s))(e||!pu(tl(s[g])))&&d.push([i(g),i(s[g])]);return f}case l1:return a([l,isNaN(s.getTime())?Xi:s.toISOString()],s);case c1:{const{source:d,flags:f}=s;return a([l,{source:d,flags:f}],s)}case u1:{const d=[],f=a([l,d],s);for(const[g,p]of s)(e||!(pu(tl(g))||pu(tl(p))))&&d.push([i(g),i(p)]);return f}case d1:{const d=[],f=a([l,d],s);for(const g of s)(e||!pu(tl(g)))&&d.push(i(g));return f}}const{message:u}=s;return a([l,{name:c,message:u}],s)};return i},xw=(e,{json:t,lossy:n}={})=>{const r=[];return A9(!(t||n),!!t,new Map,r)(e),r},jd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mw(xw(e,t)):structuredClone(e):(e,t)=>mw(xw(e,t));function I9(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 M9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function L9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||I9,r=e.options.footnoteBackLabel||M9,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),g=Mo(f.toLowerCase());let p=0;const m=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++p<=y;){m.length>0&&m.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,p);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const b=v.children[v.children.length-1];b&&b.type==="text"?b.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(d,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...jd(s),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
56
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
57
|
-
`}]}}const kc=function(e){if(e==null)return F9;if(typeof e=="function")return df(e);if(typeof e=="object")return Array.isArray(e)?O9(e):D9(e);if(typeof e=="string")return P9(e);throw new Error("Expected function, string, or object as test")};function O9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=kc(e[n]);return df(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function D9(e){const t=e;return df(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function P9(e){return df(t);function t(n){return n&&n.type===e}}function df(e){return t;function t(n,r,a){return!!(B9(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function F9(){return!0}function B9(e){return e!==null&&typeof e=="object"&&"type"in e}const qR=[],z9=!0,bb=!1,U9="skip";function WR(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=kc(a),s=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return g;function g(){let p=qR,m,y,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=$9(n(c,d)),p[0]===bb))return p;if("children"in c&&c.children){const x=c;if(x.children&&p[0]!==U9)for(y=(r?x.children.length:-1)+s,v=d.concat(x);y>-1&&y<x.children.length;){const b=x.children[y];if(m=l(b,y,v)(),m[0]===bb)return m;y=typeof m[1]=="number"?m[1]:y+s}}return p}}}function $9(e){return Array.isArray(e)?e:typeof e=="number"?[z9,e]:e==null?qR:[e]}function ff(e,t,n,r){let a,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,a=n):(i=t,s=n,a=r),WR(e,i,l,a);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return s(c,f,d)}}const vb={}.hasOwnProperty,H9={};function q9(e,t){const n=t||H9,r=new Map,a=new Map,i=new Map,s={...C9,...n.handlers},l={all:u,applyData:V9,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:s,one:c,options:n,patch:W9,wrap:K9};return ff(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:a,g=String(d.identifier).toUpperCase();f.has(g)||f.set(g,d)}}),l;function c(d,f){const g=d.type,p=l.handlers[g];if(vb.call(l.handlers,g)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in d){const{children:y,...v}=d,x=jd(v);return x.children=l.all(d),x}return jd(d)}return(l.options.unknownHandler||G9)(l,d,f)}function u(d){const f=[];if("children"in d){const g=d.children;let p=-1;for(;++p<g.length;){const m=l.one(g[p],d);if(m){if(p&&g[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=yw(m.value)),!Array.isArray(m)&&m.type==="element")){const y=m.children[0];y&&y.type==="text"&&(y.value=yw(y.value))}Array.isArray(m)?f.push(...m):f.push(m)}}}return f}}function W9(e,t){e.position&&(t.position=M6(e))}function V9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,jd(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function G9(e,t){const n=t.data||{},r="value"in t&&!(vb.call(n,"hProperties")||vb.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 K9(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 yw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function bw(e,t){const n=q9(e,t),r=n.one(e,void 0),a=L9(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
|
|
61
|
-
`},a),i}function Y9(e,t){return e&&"run"in e?async function(n,r){const a=bw(n,{file:r,...t});await e.run(a,r)}:function(n,r){return bw(n,{file:r,...e||t})}}function vw(e){if(e)throw e}var Qu=Object.prototype.hasOwnProperty,VR=Object.prototype.toString,kw=Object.defineProperty,_w=Object.getOwnPropertyDescriptor,ww=function(t){return typeof Array.isArray=="function"?Array.isArray(t):VR.call(t)==="[object Array]"},Ew=function(t){if(!t||VR.call(t)!=="[object Object]")return!1;var n=Qu.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Qu.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Qu.call(t,a)},Sw=function(t,n){kw&&n.name==="__proto__"?kw(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Nw=function(t,n){if(n==="__proto__")if(Qu.call(t,n)){if(_w)return _w(t,n).value}else return;return t[n]},X9=function e(){var t,n,r,a,i,s,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=Nw(l,n),a=Nw(t,n),l!==a&&(d&&a&&(Ew(a)||(i=ww(a)))?(i?(i=!1,s=r&&ww(r)?r:[]):s=r&&Ew(r)?r:{},Sw(l,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Sw(l,{name:n,newValue:a}));return l};const zg=No(X9);function kb(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 Q9(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);l(null,...a);function l(c,...u){const d=e[++i];let f=-1;if(c){s(c);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,d?Z9(d,l)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Z9(e,t){let n;return r;function r(...s){const l=e.length>s.length;let c;l&&s.push(a);try{c=e.apply(this,s)}catch(u){const d=u;if(l&&n)throw d;return a(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(s,...l){n||(n=!0,t(s,...l))}function i(s){a(null,s)}}const xa={basename:J9,dirname:eF,extname:tF,join:nF,sep:"/"};function J9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');_c(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(r=a):(l=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function eF(e){if(_c(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 tF(e){_c(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function nF(...e){let t=-1,n;for(;++t<e.length;)_c(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":rF(n)}function rF(e){_c(e);const t=e.codePointAt(0)===47;let n=aF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function aF(e,t){let n="",r=0,a=-1,i=0,s=-1,l,c;for(;++s<=e.length;){if(s<e.length)l=e.codePointAt(s);else{if(l===47)break;l=47}if(l===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else l===46&&i>-1?i++:i=-1}return n}function _c(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iF={cwd:sF};function sF(){return"/"}function _b(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function oF(e){if(typeof e=="string")e=new URL(e);else if(!_b(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 lF(e)}function lF(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ug=["history","path","basename","stem","extname","dirname"];class GR{constructor(t){let n;t?_b(t)?n={path:t}:typeof t=="string"||cF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":iF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ug.length;){const i=Ug[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ug.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?xa.basename(this.path):void 0}set basename(t){Hg(t,"basename"),$g(t,"basename"),this.path=xa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xa.dirname(this.path):void 0}set dirname(t){Cw(this.basename,"dirname"),this.path=xa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xa.extname(this.path):void 0}set extname(t){if($g(t,"extname"),Cw(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=xa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_b(t)&&(t=oF(t)),Hg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xa.basename(this.path,this.extname):void 0}set stem(t){Hg(t,"stem"),$g(t,"stem"),this.path=xa.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Jn(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $g(e,t){if(e&&e.includes(xa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xa.sep+"`")}function Hg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Cw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function cF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uF=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},dF={}.hasOwnProperty;class f1 extends uF{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=Q9()}copy(){const t=new f1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(zg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Vg("data",this.frozen),this.namespace[t]=n,this):dF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Vg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=hu(t),r=this.parser||this.Parser;return qg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),qg("process",this.parser||this.Parser),Wg("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const l=hu(t),c=r.parse(l);r.run(c,l,function(d,f,g){if(d||!f||!g)return u(d);const p=f,m=r.stringify(p,g);pF(m)?g.value=m:g.result=m,u(d,g)});function u(d,f){d||!f?s(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),qg("processSync",this.parser||this.Parser),Wg("processSync",this.compiler||this.Compiler),this.process(t,a),Tw("processSync","process",n),r;function a(i,s){n=!0,vw(i),r=s}}run(t,n,r){jw(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,l){const c=hu(n);a.run(t,c,u);function u(d,f,g){const p=f||t;d?l(d):s?s(p):r(void 0,p,g)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Tw("runSync","run",r),a;function i(s,l){vw(s),a=l,r=!0}}stringify(t,n){this.freeze();const r=hu(n),a=this.compiler||this.Compiler;return Wg("stringify",a),jw(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Vg("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))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");l(u.plugins),u.settings&&(a.settings=zg(!0,a.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,g=-1;for(;++f<r.length;)if(r[f][0]===u){g=f;break}if(g===-1)r.push([u,...d]);else if(d.length>0){let[p,...m]=d;const y=r[g][1];kb(y)&&kb(p)&&(p=zg(!0,y,p)),r[g]=[u,p,...m]}}}}const fF=new f1().freeze();function qg(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 Vg(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 jw(e){if(!kb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hu(e){return gF(e)?e:new GR(e)}function gF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function pF(e){return typeof e=="string"||hF(e)}function hF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Rw=[],Aw={allowDangerousHtml:!0},xF=/^(https?|ircs?|mailto|xmpp)$/i,yF=[{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 ac(e){const t=bF(e),n=vF(e);return kF(t.runSync(t.parse(n),n),e)}function bF(e){const t=e.rehypePlugins||Rw,n=e.remarkPlugins||Rw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Aw}:Aw;return fF().use(t9).use(n).use(Y9,r).use(t)}function vF(e){const t=e.children||"",n=new GR;return typeof t=="string"&&(n.value=t),n}function kF(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||_F;for(const d of yF)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+mF+d.id,void 0);return ff(e,u),F6(e,{Fragment:o.Fragment,components:a,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,g){if(d.type==="raw"&&g&&typeof f=="number")return s?g.children.splice(f,1):g.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in Pg)if(Object.hasOwn(Pg,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],y=Pg[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,g)),p&&g&&typeof f=="number")return l&&d.children?g.children.splice(f,1,...d.children):g.children.splice(f,1),f}}}function _F(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||xF.test(e.slice(0,t))?e:""}function Iw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function wF(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function EF(e,t,n){const a=kc((n||{}).ignore||[]),i=SF(t);let s=-1;for(;++s<i.length;)WR(e,"text",l);function l(u,d){let f=-1,g;for(;++f<d.length;){const p=d[f],m=g?g.children:void 0;if(a(p,m?m.indexOf(p):void 0,g))return;g=p}if(g)return c(u,d)}function c(u,d){const f=d[d.length-1],g=i[s][0],p=i[s][1];let m=0;const v=f.children.indexOf(u);let x=!1,b=[];g.lastIndex=0;let k=g.exec(u.value);for(;k;){const N=k.index,_={index:k.index,input:k.input,stack:[...d,u]};let w=p(...k,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?g.lastIndex=N+1:(m!==N&&b.push({type:"text",value:u.value.slice(m,N)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=N+k[0].length,x=!0),!g.global)break;k=g.exec(u.value)}return x?(m<u.value.length&&b.push({type:"text",value:u.value.slice(m)}),f.children.splice(v,1,...b)):b=[u],v+b.length}}function SF(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([NF(a[0]),CF(a[1])])}return t}function NF(e){return typeof e=="string"?new RegExp(wF(e),"g"):e}function CF(e){return typeof e=="function"?e:function(){return e}}const Gg="phrasing",Kg=["autolink","link","image","label"];function jF(){return{transforms:[OF],enter:{literalAutolink:RF,literalAutolinkEmail:Yg,literalAutolinkHttp:Yg,literalAutolinkWww:Yg},exit:{literalAutolink:LF,literalAutolinkEmail:MF,literalAutolinkHttp:AF,literalAutolinkWww:IF}}}function TF(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gg,notInConstruct:Kg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gg,notInConstruct:Kg},{character:":",before:"[ps]",after:"\\/",inConstruct:Gg,notInConstruct:Kg}]}}function RF(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Yg(e){this.config.enter.autolinkProtocol.call(this,e)}function AF(e){this.config.exit.autolinkProtocol.call(this,e)}function IF(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 MF(e){this.config.exit.autolinkEmail.call(this,e)}function LF(e){this.exit(e)}function OF(e){EF(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,DF],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),PF]],{ignore:["link","linkReference"]})}function DF(e,t,n,r,a){let i="";if(!KR(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!FF(n)))return!1;const s=BF(n+r);if(!s[0])return!1;const l={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function PF(e,t,n,r){return!KR(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function FF(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 BF(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=Iw(e,"(");let i=Iw(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function KR(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||hs(n)||lf(n))&&(!t||n!==47)}YR.peek=KF;function zF(){this.buffer()}function UF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function $F(){this.buffer()}function HF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function qF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WF(e){this.exit(e)}function VF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function GF(e){this.exit(e)}function KF(){return"["}function YR(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const s=n.enter("footnoteReference"),l=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),s(),i+=a.move("]"),i}function YF(){return{enter:{gfmFootnoteCallString:zF,gfmFootnoteCall:UF,gfmFootnoteDefinitionLabelString:$F,gfmFootnoteDefinition:HF},exit:{gfmFootnoteCallString:qF,gfmFootnoteCall:WF,gfmFootnoteDefinitionLabelString:VF,gfmFootnoteDefinition:GF}}}function XF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:YR},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,s){const l=i.createTracker(s);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
|
|
62
|
-
`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?XR:QF))),u(),c}}function QF(e,t,n){return t===0?e:XR(e,t,n)}function XR(e,t,n){return(n?"":" ")+e}const ZF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];QR.peek=rB;function JF(){return{canContainEols:["delete"],enter:{strikethrough:tB},exit:{strikethrough:nB}}}function eB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ZF}],handlers:{delete:QR}}}function tB(e){this.enter({type:"delete",children:[]},e)}function nB(e){this.exit(e)}function QR(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let s=a.move("~~");return s+=n.containerPhrasing(e,{...a.current(),before:s,after:"~"}),s+=a.move("~~"),i(),s}function rB(){return"~"}function aB(e){return e.length}function iB(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||aB,i=[],s=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const y=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const b=sB(e[d][x]);if(n.alignDelimiters!==!1){const k=a(b);v[x]=k,(c[x]===void 0||k>c[x])&&(c[x]=k)}y.push(b)}s[d]=y,l[d]=v}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=Mw(r[f]);else{const y=Mw(r);for(;++f<u;)i[f]=y}f=-1;const g=[],p=[];for(;++f<u;){const y=i[f];let v="",x="";y===99?(v=":",x=":"):y===108?v=":":y===114&&(x=":");let b=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-x.length);const k=v+"-".repeat(b)+x;n.alignDelimiters!==!1&&(b=v.length+b+x.length,b>c[f]&&(c[f]=b),p[f]=b),g[f]=k}s.splice(1,0,g),l.splice(1,0,p),d=-1;const m=[];for(;++d<s.length;){const y=s[d],v=l[d];f=-1;const x=[];for(;++f<u;){const b=y[f]||"";let k="",N="";if(n.alignDelimiters!==!1){const _=c[f]-(v[f]||0),w=i[f];w===114?k=" ".repeat(_):w===99?_%2?(k=" ".repeat(_/2+.5),N=" ".repeat(_/2-.5)):(k=" ".repeat(_/2),N=k):N=" ".repeat(_)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(k),x.push(b),n.alignDelimiters!==!1&&x.push(N),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
|
|
63
|
-
`)}function sB(e){return e==null?"":String(e)}function Mw(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}function oB(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),lB);return a(),s}function lB(e,t,n){return">"+(n?"":" ")+e}function cB(e,t){return Lw(e,t.inConstruct,!0)&&!Lw(e,t.notInConstruct,!1)}function Lw(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 Ow(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
64
|
-
`&&cB(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
65
|
-
`}function uB(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>s&&(s=i):i=1,a=r+t.length,r=n.indexOf(t,a);return s}function dB(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function fB(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 gB(e,t,n,r){const a=fB(n),i=e.value||"",s=a==="`"?"GraveAccent":"Tilde";if(dB(e,n)){const f=n.enter("codeIndented"),g=n.indentLines(i,pB);return f(),g}const l=n.createTracker(r),c=a.repeat(Math.max(uB(i,a)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${s}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${s}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
|
|
66
|
-
`,encode:["`"],...l.current()})),f()}return d+=l.move(`
|
|
67
|
-
`),i&&(d+=l.move(i+`
|
|
68
|
-
`)),d+=l.move(c),u(),d}function pB(e,t,n){return(n?"":" ")+e}function g1(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 hB(e,t,n,r){const a=g1(n),i=a==='"'?"Quote":"Apostrophe",s=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
69
|
-
`,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),s(),u}function mB(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 ic(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Td(e,t,n){const r=Eo(e),a=Eo(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ZR.peek=xB;function ZR(e,t,n,r){const a=mB(n),i=n.enter("emphasis"),s=n.createTracker(r),l=s.move(a);let c=s.move(n.containerPhrasing(e,{after:a,before:l,...s.current()}));const u=c.charCodeAt(0),d=Td(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=ic(u)+c.slice(1));const f=c.charCodeAt(c.length-1),g=Td(r.after.charCodeAt(0),f,a);g.inside&&(c=c.slice(0,-1)+ic(f));const p=s.move(a);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:d.outside},l+c+p}function xB(e,t,n){return n.options.emphasis||"*"}function yB(e,t){let n=!1;return ff(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,bb}),!!((!e.depth||e.depth<3)&&i1(e)&&(t.options.setext||n))}function bB(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(yB(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),g=n.containerPhrasing(e,{...i.current(),before:`
|
|
70
|
-
`,after:`
|
|
71
|
-
`});return f(),d(),g+`
|
|
72
|
-
`+(a===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
|
|
73
|
-
`))+1))}const s="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
74
|
-
`,...i.current()});return/^[\t ]/.test(u)&&(u=ic(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),c(),l(),u}JR.peek=vB;function JR(e){return e.value||""}function vB(){return"<"}eA.peek=kB;function eA(e,t,n,r){const a=g1(n),i=a==='"'?"Quote":"Apostrophe",s=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+a),u+=c.move(n.safe(e.title,{before:u,after:a,...c.current()})),u+=c.move(a),l()),u+=c.move(")"),s(),u}function kB(){return"!"}tA.peek=_B;function tA(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return s(),n.stack=d,i(),a==="full"||!u||u!==f?c+=l.move(f+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function _B(){return"!"}nA.peek=wB;function nA(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const s=n.unsafe[i],l=n.compilePattern(s);let c;if(s.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return a+r+a}function wB(){return"`"}function rA(e,t){const n=i1(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))}aA.peek=EB;function aA(e,t,n,r){const a=g1(n),i=a==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let l,c;if(rA(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(c=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=s.move(" "+a),u+=s.move(n.safe(e.title,{before:u,after:a,...s.current()})),u+=s.move(a),c()),u+=s.move(")"),l(),u}function EB(e,t,n){return rA(e,n)?"<":"["}iA.peek=SB;function iA(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return s(),n.stack=d,i(),a==="full"||!u||u!==f?c+=l.move(f+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function SB(){return"["}function p1(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 NB(e){const t=p1(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 CB(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 sA(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 jB(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?CB(n):p1(n);const l=e.ordered?s==="."?")":".":NB(n);let c=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&d&&(!d.children||!d.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&&(c=!0),sA(n)===s&&d){let f=-1;for(;++f<e.children.length;){const g=e.children[f];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(s=l),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,a(),u}function TB(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 RB(e,t,n,r){const a=TB(n);let i=n.bulletCurrent||p1(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let s=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(s-i.length)),l.shift(s);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,g,p){return g?(p?"":" ".repeat(s))+f:(p?i:i+" ".repeat(s-i.length))+f}}function AB(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),a(),s}const IB=kc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function MB(e,t,n,r){return(e.children.some(function(s){return IB(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function LB(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}oA.peek=OB;function oA(e,t,n,r){const a=LB(n),i=n.enter("strong"),s=n.createTracker(r),l=s.move(a+a);let c=s.move(n.containerPhrasing(e,{after:a,before:l,...s.current()}));const u=c.charCodeAt(0),d=Td(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=ic(u)+c.slice(1));const f=c.charCodeAt(c.length-1),g=Td(r.after.charCodeAt(0),f,a);g.inside&&(c=c.slice(0,-1)+ic(f));const p=s.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:d.outside},l+c+p}function OB(e,t,n){return n.options.strong||"*"}function DB(e,t,n,r){return n.safe(e.value,r)}function PB(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 FB(e,t,n){const r=(sA(n)+(n.options.ruleSpaces?" ":"")).repeat(PB(n));return n.options.ruleSpaces?r.slice(0,-1):r}const lA={blockquote:oB,break:Ow,code:gB,definition:hB,emphasis:ZR,hardBreak:Ow,heading:bB,html:JR,image:eA,imageReference:tA,inlineCode:nA,link:aA,linkReference:iA,list:jB,listItem:RB,paragraph:AB,root:MB,strong:oA,text:DB,thematicBreak:FB};function BB(){return{enter:{table:zB,tableData:Dw,tableHeader:Dw,tableRow:$B},exit:{codeText:HB,table:UB,tableData:Xg,tableHeader:Xg,tableRow:Xg}}}function zB(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UB(e){this.exit(e),this.data.inTable=void 0}function $B(e){this.enter({type:"tableRow",children:[]},e)}function Xg(e){this.exit(e)}function Dw(e){this.enter({type:"tableCell",children:[]},e)}function HB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,qB));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function qB(e,t){return t==="|"?t:e}function WB(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
75
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:s,tableCell:c,tableRow:l}};function s(p,m,y,v){return u(d(p,y,v),p.align)}function l(p,m,y,v){const x=f(p,y,v),b=u([x]);return b.slice(0,b.indexOf(`
|
|
76
|
-
`))}function c(p,m,y,v){const x=y.enter("tableCell"),b=y.enter("phrasing"),k=y.containerPhrasing(p,{...v,before:i,after:i});return b(),x(),k}function u(p,m){return iB(p,{align:m,alignDelimiters:r,padding:n,stringLength:a})}function d(p,m,y){const v=p.children;let x=-1;const b=[],k=m.enter("table");for(;++x<v.length;)b[x]=f(v[x],m,y);return k(),b}function f(p,m,y){const v=p.children;let x=-1;const b=[],k=m.enter("tableRow");for(;++x<v.length;)b[x]=c(v[x],p,m,y);return k(),b}function g(p,m,y){let v=lA.inlineCode(p,m,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function VB(){return{exit:{taskListCheckValueChecked:Pw,taskListCheckValueUnchecked:Pw,paragraph:KB}}}function GB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:YB}}}function Pw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function KB(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,s;for(;++i<a.length;){const l=a[i];if(l.type==="paragraph"){s=l;break}}s===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 YB(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(s);let c=lA.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+s}}function XB(){return[jF(),YF(),JF(),BB(),VB()]}function QB(e){return{extensions:[TF(),XF(e),eB(),WB(e),GB()]}}const ZB={tokenize:az,partial:!0},cA={tokenize:iz,partial:!0},uA={tokenize:sz,partial:!0},dA={tokenize:oz,partial:!0},JB={tokenize:lz,partial:!0},fA={name:"wwwAutolink",tokenize:nz,previous:pA},gA={name:"protocolAutolink",tokenize:rz,previous:hA},Xa={name:"emailAutolink",tokenize:tz,previous:mA},Sa={};function ez(){return{text:Sa}}let qi=48;for(;qi<123;)Sa[qi]=Xa,qi++,qi===58?qi=65:qi===91&&(qi=97);Sa[43]=Xa;Sa[45]=Xa;Sa[46]=Xa;Sa[95]=Xa;Sa[72]=[Xa,gA];Sa[104]=[Xa,gA];Sa[87]=[Xa,fA];Sa[119]=[Xa,fA];function tz(e,t,n){const r=this;let a,i;return s;function s(f){return!wb(f)||!mA.call(r,r.previous)||h1(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return wb(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(JB,d,u)(f):f===45||f===95||Qn(f)?(i=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),a=!0,c}function d(f){return i&&a&&ir(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function nz(e,t,n){const r=this;return a;function a(s){return s!==87&&s!==119||!pA.call(r,r.previous)||h1(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ZB,e.attempt(cA,e.attempt(uA,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function rz(e,t,n){const r=this;let a="",i=!1;return s;function s(f){return(f===72||f===104)&&hA.call(r,r.previous)&&!h1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(ir(f)&&a.length<5)return a+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const g=a.toLowerCase();if(g==="http"||g==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),i?u:(i=!0,c)):n(f)}function u(f){return f===null||Nd(f)||Kt(f)||hs(f)||lf(f)?n(f):e.attempt(cA,e.attempt(uA,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function az(e,t,n){let r=0;return a;function a(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),a):s===46&&r===3?(e.consume(s),i):n(s)}function i(s){return s===null?n(s):t(s)}}function iz(e,t,n){let r,a,i;return s;function s(u){return u===46||u===95?e.check(dA,c,l)(u):u===null||Kt(u)||hs(u)||u!==45&&lf(u)?c(u):(i=!0,e.consume(u),s)}function l(u){return u===95?r=!0:(a=r,r=void 0),e.consume(u),s}function c(u){return a||r||!i?n(u):t(u)}}function sz(e,t){let n=0,r=0;return a;function a(s){return s===40?(n++,e.consume(s),a):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(dA,t,i)(s):s===null||Kt(s)||hs(s)?t(s):(e.consume(s),a)}function i(s){return s===41&&r++,e.consume(s),a}}function oz(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),a):l===60||l===null||Kt(l)||hs(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||Kt(l)||hs(l)?t(l):r(l)}function i(l){return ir(l)?s(l):n(l)}function s(l){return l===59?(e.consume(l),r):ir(l)?(e.consume(l),s):n(l)}}function lz(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return Qn(i)?n(i):t(i)}}function pA(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Kt(e)}function hA(e){return!ir(e)}function mA(e){return!(e===47||wb(e))}function wb(e){return e===43||e===45||e===46||e===95||Qn(e)}function h1(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 cz={tokenize:xz,partial:!0};function uz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:pz,continuation:{tokenize:hz},exit:mz}},text:{91:{name:"gfmFootnoteCall",tokenize:gz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:dz,resolveTo:fz}}}}function dz(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!s||!s._balanced)return n(c);const u=sa(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function fz(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function gz(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!s||f===null||f===91||Kt(f))return n(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return a.includes(sa(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Kt(f)||(s=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function pz(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,l;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(s>999||m===93&&!l||m===null||m===91||Kt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=sa(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Kt(m)||(l=!0),s++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),s++,d):d(m)}function g(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),a.includes(i)||a.push(i),Lt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function hz(e,t,n){return e.check(vc,t,e.attempt(cz,t,n))}function mz(e){e.exit("gfmFootnoteDefinition")}function xz(e,t,n){const r=this;return Lt(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):n(i)}}function yz(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(s,l){let c=-1;for(;++c<s.length;)if(s[c][0]==="enter"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._close){let u=c;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[c][1].end.offset-s[c][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[c][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[c][1].end)},f={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[c][1].start)},g=[["enter",d,l],["enter",s[u][1],l],["exit",s[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&Ar(g,g.length,0,cf(p,s.slice(u+1,c),l)),Ar(g,g.length,0,[["exit",f,l],["enter",s[c][1],l],["exit",s[c][1],l],["exit",d,l]]),Ar(s,u-1,c-u+3,g),c=u+g.length-2;break}}for(c=-1;++c<s.length;)s[c][1].type==="strikethroughSequenceTemporary"&&(s[c][1].type="data");return s}function i(s,l,c){const u=this.previous,d=this.events;let f=0;return g;function g(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(s.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const y=Eo(u);if(m===126)return f>1?c(m):(s.consume(m),f++,p);if(f<2&&!n)return c(m);const v=s.exit("strikethroughSequenceTemporary"),x=Eo(m);return v._open=!x||x===2&&!!y,v._close=!y||y===2&&!!x,l(m)}}}class bz{constructor(){this.map=[]}add(t,n,r){vz(this,t,n,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function vz(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function kz(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function _z(){return{flow:{null:{name:"table",tokenize:wz,resolveAll:Ez}}}}function wz(e,t,n){const r=this;let a=0,i=0,s;return l;function l(j){let F=r.events.length-1;for(;F>-1;){const O=r.events[F][1].type;if(O==="lineEnding"||O==="linePrefix")F--;else break}const P=F>-1?r.events[F][1].type:null,W=P==="tableHead"||P==="tableRow"?w:c;return W===w&&r.parser.lazy[r.now().line]?n(j):W(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),u(j)}function u(j){return j===124||(s=!0,i+=1),d(j)}function d(j){return j===null?n(j):lt(j)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):jt(j)?Lt(e,d,"whitespace")(j):(i+=1,s&&(s=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),f(j)))}function f(j){return j===null||j===124||Kt(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?g:f)}function g(j){return j===92||j===124?(e.consume(j),f):f(j)}function p(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),s=!1,jt(j)?Lt(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?v(j):j===124?(s=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),y):_(j)}function y(j){return jt(j)?Lt(e,v,"whitespace")(j):v(j)}function v(j){return j===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),x):j===45?(i+=1,x(j)):j===null||lt(j)?N(j):_(j)}function x(j){return j===45?(e.enter("tableDelimiterFiller"),b(j)):_(j)}function b(j){return j===45?(e.consume(j),b):j===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(j))}function k(j){return jt(j)?Lt(e,N,"whitespace")(j):N(j)}function N(j){return j===124?m(j):j===null||lt(j)?!s||a!==i?_(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):_(j)}function _(j){return n(j)}function w(j){return e.enter("tableRow"),E(j)}function E(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),E):j===null||lt(j)?(e.exit("tableRow"),t(j)):jt(j)?Lt(e,E,"whitespace")(j):(e.enter("data"),S(j))}function S(j){return j===null||j===124||Kt(j)?(e.exit("data"),E(j)):(e.consume(j),j===92?M:S)}function M(j){return j===92||j===124?(e.consume(j),S):S(j)}}function Ez(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],s=[0,0,0,0],l=!1,c=0,u,d,f;const g=new bz;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(Fw(g,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},g.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],s=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},g.add(n,0,[["enter",d,t]])),a=m.type==="tableDelimiterRow"?2:d?3:1):a&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],f=mu(g,t,i,a,void 0,f),i=[0,0,0,0]),s[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],f=mu(g,t,i,a,void 0,f)),i=s,s=[i[1],n,0,0])):m.type==="tableHead"?(l=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,i[1]!==0?(s[0]=s[1],f=mu(g,t,i,a,n,f)):s[1]!==0&&(f=mu(g,t,s,a,n,f)),a=0):a&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&Fw(g,t,c,u,d),g.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=kz(t.events,n))}return e}function mu(e,t,n,r,a,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},qs(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=qs(t.events,n[1]);if(i={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=qs(t.events,n[2]),d=qs(t.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const g=t.events[n[2]],p=t.events[n[3]];if(g[1].end=Object.assign({},p[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,y=n[3]-n[2]-1;e.add(m,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return a!==void 0&&(i.end=Object.assign({},qs(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function Fw(e,t,n,r,a){const i=[],s=qs(t.events,n);a&&(a.end=Object.assign({},s),i.push(["exit",a,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function qs(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Sz={name:"tasklistCheck",tokenize:Cz};function Nz(){return{text:{91:Sz}}}function Cz(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Kt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):n(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return lt(c)?t(c):jt(c)?e.check({tokenize:jz},t,n)(c):n(c)}}function jz(e,t,n){return Lt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function Tz(e){return SR([ez(),uz(),yz(e),_z(),Nz()])}const Rz={};function sc(e){const t=this,n=e||Rz,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Tz(n)),i.push(XB()),s.push(QB(n))}const Bw=function(e,t,n){const r=kc(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]},ks=function(e){if(e==null)return Mz;if(typeof e=="string")return Iz(e);if(typeof e=="object")return Az(e);if(typeof e=="function")return m1(e);throw new Error("Expected function, string, or array as `test`")};function Az(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ks(e[n]);return m1(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function Iz(e){return m1(t);function t(n){return n.tagName===e}}function m1(e){return t;function t(n,r,a){return!!(Lz(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function Mz(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function Lz(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const zw=/\n/g,Uw=/[\t ]+/g,Eb=ks("br"),$w=ks($z),Oz=ks("p"),Hw=ks("tr"),Dz=ks(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Uz,Hz]),xA=ks(["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 Pz(e,t){const n=t||{},r="children"in e?e.children:[],a=xA(e),i=vA(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(...bA(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)s.push(...yA(r[l],e,{whitespace:i,breakBefore:l?void 0:a,breakAfter:l<r.length-1?Eb(r[l+1]):a}));const c=[];let u;for(l=-1;++l<s.length;){const d=s[l];typeof d=="number"?u!==void 0&&d>u&&(u=d):d&&(u!==void 0&&u>-1&&c.push(`
|
|
77
|
-
`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function yA(e,t,n){return e.type==="element"?Fz(e,t,n):e.type==="text"?n.whitespace==="normal"?bA(e,n):Bz(e):[]}function Fz(e,t,n){const r=vA(e,n),a=e.children||[];let i=-1,s=[];if(Dz(e))return s;let l,c;for(Eb(e)||Hw(e)&&Bw(t,e,Hw)?c=`
|
|
78
|
-
`:Oz(e)?(l=2,c=2):xA(e)&&(l=1,c=1);++i<a.length;)s=s.concat(yA(a[i],e,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<a.length-1?Eb(a[i+1]):c}));return $w(e)&&Bw(t,e,$w)&&s.push(" "),l&&s.unshift(l),c&&s.push(c),s}function bA(e,t){const n=String(e.value),r=[],a=[];let i=0;for(;i<=n.length;){zw.lastIndex=i;const c=zw.exec(n),u=c&&"index"in c?c.index:n.length;r.push(zz(n.slice(i,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,u===n.length?t.breakAfter:!0)),i=u+1}let s=-1,l;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(a.push(r[s]),l=void 0):r[s]?(typeof l=="number"&&a.push(l),a.push(r[s]),l=0):(s===0||s===r.length-1)&&a.push(0);return a}function Bz(e){return[String(e.value)]}function zz(e,t,n){const r=[];let a=0,i;for(;a<e.length;){Uw.lastIndex=a;const s=Uw.exec(e);i=s?s.index:e.length,!a&&!i&&s&&!t&&r.push(""),a!==i&&r.push(e.slice(a,i)),a=s?i+s[0].length:i}return a!==i&&!n&&r.push(""),r.join(" ")}function vA(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function Uz(e){return!!(e.properties||{}).hidden}function $z(e){return e.tagName==="td"||e.tagName==="th"}function Hz(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function qz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},p=t.optional(a)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],x=["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"],N={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},w=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:N,contains:w.concat([{begin:/\(/,end:/\)/,keywords:N,contains:w.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:N,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:N,relevance:0},{begin:p,returnBegin:!0,contains:[g],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:N,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,S,_,w,[f,{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:N,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:N},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Wz(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=qz(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 Vz(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,a]};a.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},g=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${g.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},y=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],x={match:/(\/[a-z._-]+)+/},b=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],N=["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"],_=["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:y,literal:v,built_in:[...b,...k,"set","shopt",...N,..._]},contains:[p,e.SHEBANG(),m,f,i,s,x,l,c,u,d,n]}}function Gz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",s="("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},p=t.optional(a)+e.IDENT_RE+"\\s*\\(",v={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"},x=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],b={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:x.concat([{begin:/\(/,end:/\)/,keywords:v,contains:x.concat(["self"]),relevance:0}]),relevance:0},k={begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:v,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(g,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"</",contains:[].concat(b,k,x,[f,{begin:e.IDENT_RE+"::",keywords:v},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function Kz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},p=t.optional(a)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],x=["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"],N={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},w=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:N,contains:w.concat([{begin:/\(/,end:/\)/,keywords:N,contains:w.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:N,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:N,relevance:0},{begin:p,returnBegin:!0,contains:[g],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:N,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,S,_,w,[f,{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:N,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:N},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Yz(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["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"],s={keyword:a.concat(i),built_in:t,literal:r},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),g={className:"subst",begin:/\{/,end:/\}/,keywords:s},p=e.inherit(g,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},g]},v=e.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});g.contains=[y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const x={variants:[u,y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},k=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",N={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,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"}},x,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,b,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:"("+k+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,b],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[x,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},N]}}const Xz=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/},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_-]*/}}),Qz=["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"],Zz=["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"],Jz=[...Qz,...Zz],eU=["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(),tU=["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(),nU=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rU=["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","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 aU(e){const t=e.regex,n=Xz(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="and or not only",i=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+tU.join("|")+")"},{begin:":(:)?("+nU.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rU.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:eU.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Jz.join("|")+")\\b"}]}}function iU(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+ +----$/)},{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 sU(e){const i={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:i,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:i,illegal:/["']/}]}]}}function oU(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 lU(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},l={begin:/\[/,end:/\]/,contains:[r,i,a,s,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,u=/"(\\"|[^"])*"/,d=/'[^']*'/,f=t.either(c,u,d),g=t.concat(f,"(\\s*\\.\\s*",f,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:g,className:"attr",starts:{end:/$/,contains:[r,l,i,a,s,n]}}]}}var Ws="[0-9](_*[0-9])*",xu=`\\.(${Ws})`,yu="[0-9a-fA-F](_*[0-9a-fA-F])*",qw={className:"number",variants:[{begin:`(\\b(${Ws})((${xu})|\\.)?|(${xu}))[eE][+-]?(${Ws})[fFdD]?\\b`},{begin:`\\b(${Ws})((${xu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${xu})[fFdD]?\\b`},{begin:`\\b(${Ws})[fFdD]\\b`},{begin:`\\b0[xX]((${yu})\\.?|(${yu})?\\.(${yu}))[pP][+-]?(${Ws})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${yu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function kA(e,t,n){return n===-1?"":e.replace(t,r=>kA(e,t,n-1))}function cU(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+kA("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:[d,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:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,qw,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},qw,u]}}const Ww="[A-Za-z$_][0-9A-Za-z$_]*",uU=["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"],dU=["true","false","null","undefined","NaN","Infinity"],_A=["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"],wA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],EA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fU=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],gU=[].concat(EA,_A,wA);function pU(e){const t=e.regex,n=($,{after:Z})=>{const R="</"+$[0].slice(1);return $.input.indexOf(R,Z)!==-1},r=Ww,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,Z)=>{const R=$[0].length+$.index,Y=$.input[R];if(Y==="<"||Y===","){Z.ignoreMatch();return}Y===">"&&(n($,{after:R})||Z.ignoreMatch());let V;const A=$.input.substring(R);if(V=A.match(/^\s*=/)){Z.ignoreMatch();return}if((V=A.match(/^\s+extends\s+/))&&V.index===0){Z.ignoreMatch();return}}},l={$pattern:Ww,keyword:uU,literal:dU,built_in:gU,"variable.language":fU},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,g]},b={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]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,{match:/\$\d+/},f];g.contains=k.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(k)});const N=[].concat(b,g.contains),_=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(N)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},E={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"}}]},S={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:{_:[..._A,...wA]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P($){return t.concat("(?!",$.join("|"),")")}const W={match:t.concat(/\b/,P([...EA,"super","import"].map($=>`${$}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},I={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,b,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,e.REGEXP_MODE,{className:"function",begin:T,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},W,F,E,I,{match:/\$[(.]/}]}}function hU(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,a,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Vs="[0-9](_*[0-9])*",bu=`\\.(${Vs})`,vu="[0-9a-fA-F](_*[0-9a-fA-F])*",mU={className:"number",variants:[{begin:`(\\b(${Vs})((${bu})|\\.)?|(${bu}))[eE][+-]?(${Vs})[fFdD]?\\b`},{begin:`\\b(${Vs})((${bu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${bu})[fFdD]?\\b`},{begin:`\\b(${Vs})[fFdD]\\b`},{begin:`\\b0[xX]((${vu})\\.?|(${vu})?\\.(${vu}))[pP][+-]?(${Vs})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${vu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function xU(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,a]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,a]}]};a.contains.push(s);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(s,{className:"string"}),"self"]}]},u=mU,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},g=f;return g.variants[1].contains=[f],f.variants[1].contains=[g],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,l,c,{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:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,s,e.C_NUMBER_MODE]},d]},{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},l,c]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
79
|
-
`},u]}}const yU=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/},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_-]*/}}),bU=["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"],vU=["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"],kU=[...bU,...vU],_U=["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(),SA=["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(),NA=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),wU=["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","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(),EU=SA.concat(NA).sort().reverse();function SU(e){const t=yU(e),n=EU,r="and or not only",a="[\\w-]+",i="("+a+"|@\\{"+a+"\\})",s=[],l=[],c=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},u=function(k,N,_){return{className:k,begin:N,relevance:_}},d={$pattern:/[a-z-]+/,keyword:r,attribute:_U.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+a,10),u("variable","@\\{"+a+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const g=l.concat({begin:/\{/,end:/\}/,contains:s}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+wU.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},y={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:g}},x={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+a+"\\}"),{begin:"\\b("+kU.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+SA.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+NA.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:g},{begin:"!important"},t.FUNCTION_DISPATCH]},b={begin:a+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[x]};return s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,v,b,m,x,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function NU(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},a=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function CU(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},a={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},s={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,a,i,s]}}function jU(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),g=e.inherit(d,{contains:[]});u.contains.push(g),d.contains.push(f);let p=[n,c];return[u,d,f,g].forEach(x=>{x.contains=x.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},a,r,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function TU(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_]*/,l={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,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:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function RU(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},s={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={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},d=[e.BACKSLASH_ESCAPE,i,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],g=(y,v,x="\\1")=>{const b=x==="\\1"?x:t.concat(x,v);return t.concat(t.concat("(?:",y,")"),v,/(?:\\.|[^\\\/])*?/,b,/(?:\\.|[^\\\/])*?/,x,r)},p=(y,v,x)=>t.concat(t.concat("(?:",y,")"),v,/(?:\\.|[^\\\/])*?/,x,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:d,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}]},u,{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:g("s|tr|y",t.either(...f,{capture:!0}))},{begin:g("s|tr|y","\\(","\\)")},{begin:g("s|tr|y","\\[","\\]")},{begin:g("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:a,contains:m}}function AU(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),a=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+r},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(O,I)=>{I.data._beginMatch=O[1]||O[2]},"on:end":(O,I)=>{I.data._beginMatch!==O[1]&&I.ignoreMatch()}},g=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
80
|
-
]`,m={scope:"string",variants:[d,u,f,g]},y={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},v=["false","null","true"],x=["__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"],b=["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"],N={keyword:x,literal:(O=>{const I=[];return O.forEach(T=>{I.push(T),T.toLowerCase()===T?I.push(T.toUpperCase()):I.push(T.toLowerCase())}),I})(v),built_in:b},_=O=>O.map(I=>I.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",_(b).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},E=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),E],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),E],scope:{1:"title.class",3:"variable.constant"}},{match:[a,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},M={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},j={relevance:0,begin:/\(/,end:/\)/,keywords:N,contains:[M,s,S,e.C_BLOCK_COMMENT_MODE,m,y,w]},F={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",_(x).join("\\b|"),"|",_(b).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[j]};j.contains.push(F);const P=[M,S,e.C_BLOCK_COMMENT_MODE,m,y,w],W={begin:t.concat(/#\[\s*\\?/,t.either(a,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...P]},...P,{scope:"meta",variants:[{match:a},{match:i}]}]};return{case_insensitive:!1,keywords:N,contains:[W,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}]}},l,{scope:"variable.language",match:/\$this\b/},s,F,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},w,{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:N,contains:["self",W,s,S,e.C_BLOCK_COMMENT_MODE,m,y]}]},{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]},m,y]}}function IU(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 MU(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function LU(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"],l={$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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{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,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},g="[0-9](_?[0-9])*",p=`(\\b(${g}))?\\.(${g})|\\b(${g})\\.`,m=`\\b|${r.join("|")}`,y={className:"number",relevance:0,variants:[{begin:`(\\b(${g})|(${p}))[eE][+-]?(${g})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${g})[jJ](?=${m})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},x={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,y,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,y,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,y,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[x]},{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:[y,x,f]}]}}function OU(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function DU(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function PU(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(r,/(::\w+)*/),s={"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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],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,d]})]}]},g="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${g})(\\.(${p}))?([eE][+-]?(${p})|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"}]},y={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},w=[f,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:s},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],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(c,u),relevance:0}].concat(c,u);d.contains=w,y.contains=w;const j=[{begin:/^\s*=>/,starts:{end:"$",contains:w}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:w}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(j).concat(u).concat(w)}}function FU(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),a=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,t.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",l=["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"],c=["true","false","Some","None","Ok","Err"],u=["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!"],d=["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:d,keyword:l,literal:c,built_in:u},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_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],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:u,type:d}},{className:"punctuation",begin:"->"},i]}}const BU=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/},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_-]*/}}),zU=["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"],UU=["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"],$U=[...zU,...UU],HU=["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(),qU=["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(),WU=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),VU=["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","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 GU(e){const t=BU(e),n=WU,r=qU,a="@[a-z-]+",i="and or not only",l={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("+$U.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+VU.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,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:HU.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function KU(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function YU(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],l=["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"],c=["add","asc","collation","desc","final","first","last","view"],u=["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"],d=["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"],f=["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"],g=["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"],p=d,m=[...u,...c].filter(_=>!d.includes(_)),y={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},x={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function b(_){return t.concat(/\b/,t.either(..._.map(w=>w.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:b(g),relevance:0};function N(_,{exceptions:w,when:E}={}){const S=E;return w=w||[],_.map(M=>M.match(/\|\d+$/)||w.includes(M)?M:S(M)?`${M}|0`:M)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:N(m,{when:_=>_.length<3}),literal:i,type:l,built_in:f},contains:[{scope:"type",match:b(s)},k,x,y,r,a,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function CA(e){return e?typeof e=="string"?e:e.source:null}function nl(e){return qt("(?=",e,")")}function qt(...e){return e.map(n=>CA(n)).join("")}function XU(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function rr(...e){return"("+(XU(e).capture?"":"?:")+e.map(r=>CA(r)).join("|")+")"}const x1=e=>qt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),QU=["Protocol","Type"].map(x1),Vw=["init","self"].map(x1),ZU=["Any","Self"],Qg=["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"],Gw=["false","nil","true"],JU=["assignment","associativity","higherThan","left","lowerThan","none","right"],e$=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Kw=["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"],jA=rr(/[/=\-+!*%<>&|^~?]/,/[\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]/),TA=rr(jA,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Zg=qt(jA,TA,"*"),RA=rr(/[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]/),Rd=rr(RA,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ha=qt(RA,Rd,"*"),ku=qt(/[A-Z]/,Rd,"*"),t$=["attached","autoclosure",qt(/convention\(/,rr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",qt(/objc\(/,ha,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],n$=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function r$(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,rr(...QU,...Vw)],className:{2:"keyword"}},i={match:qt(/\./,rr(...Qg)),relevance:0},s=Qg.filter(ve=>typeof ve=="string").concat(["_|0"]),l=Qg.filter(ve=>typeof ve!="string").concat(ZU).map(x1),c={variants:[{className:"keyword",match:rr(...l,...Vw)}]},u={$pattern:rr(/\b\w+/,/#\w+/),keyword:s.concat(e$),literal:Gw},d=[a,i,c],f={match:qt(/\./,rr(...Kw)),relevance:0},g={className:"built_in",match:qt(/\b/,rr(...Kw),/(?=\()/)},p=[f,g],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:Zg},{match:`\\.(\\.|${TA})+`}]},v=[m,y],x="([0-9]_*)+",b="([0-9a-fA-F]_*)+",k={className:"number",relevance:0,variants:[{match:`\\b(${x})(\\.(${x}))?([eE][+-]?(${x}))?\\b`},{match:`\\b0x(${b})(\\.(${b}))?([pP][+-]?(${x}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},N=(ve="")=>({className:"subst",variants:[{match:qt(/\\/,ve,/[0\\tnr"']/)},{match:qt(/\\/,ve,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(ve="")=>({className:"subst",match:qt(/\\/,ve,/[\t ]*(?:[\r\n]|\r\n)/)}),w=(ve="")=>({className:"subst",label:"interpol",begin:qt(/\\/,ve,/\(/),end:/\)/}),E=(ve="")=>({begin:qt(ve,/"""/),end:qt(/"""/,ve),contains:[N(ve),_(ve),w(ve)]}),S=(ve="")=>({begin:qt(ve,/"/),end:qt(/"/,ve),contains:[N(ve),w(ve)]}),M={className:"string",variants:[E(),E("#"),E("##"),E("###"),S(),S("#"),S("##"),S("###")]},j=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],F={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:j},P=ve=>{const De=qt(ve,/\//),K=qt(/\//,ve);return{begin:De,end:K,contains:[...j,{scope:"comment",begin:`#(?!.*${K})`,end:/$/}]}},W={scope:"regexp",variants:[P("###"),P("##"),P("#"),F]},O={match:qt(/`/,ha,/`/)},I={className:"variable",match:/\$\d+/},T={className:"variable",match:`\\$${Rd}+`},L=[O,I,T],$={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:n$,contains:[...v,k,M]}]}},Z={scope:"keyword",match:qt(/@/,rr(...t$),nl(rr(/\(/,/\s+/)))},R={scope:"meta",match:qt(/@/,ha)},Y=[$,Z,R],V={match:nl(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:qt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Rd,"+")},{className:"type",match:ku,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:qt(/\s+&\s+/,nl(ku)),relevance:0}]},A={begin:/</,end:/>/,keywords:u,contains:[...r,...d,...Y,m,V]};V.contains.push(A);const H={match:qt(ha,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",H,...r,W,...d,...p,...v,k,M,...L,...Y,V]},ee={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,V]},Me={begin:rr(nl(qt(ha,/\s*:/)),nl(qt(ha,/\s+/,ha,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ha}]},X={begin:/\(/,end:/\)/,keywords:u,contains:[Me,...r,...d,...v,k,M,...Y,V,ce],endsParent:!0,illegal:/["']/},ye={match:[/(func|macro)/,/\s+/,rr(O.match,ha,Zg)],className:{1:"keyword",3:"title.function"},contains:[ee,X,t],illegal:[/\[/,/%/]},Oe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ee,X,t],illegal:/\[|%/},Ee={match:[/operator/,/\s+/,Zg],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,ku],className:{1:"keyword",3:"title"},contains:[V],keywords:[...JU,...Gw],end:/}/},Se={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ae={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},me={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ha,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[ee,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ku},...d],relevance:0}]};for(const ve of M.variants){const De=ve.contains.find(we=>we.label==="interpol");De.keywords=u;const K=[...d,...p,...v,k,M,...L];De.contains=[...K,{begin:/\(/,end:/\)/,contains:["self",...K]}]}return{name:"Swift",keywords:u,contains:[...r,ye,Oe,Se,Ae,me,Ee,de,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},W,...d,...p,...v,k,M,...L,...Y,V,ce]}}const Ad="[A-Za-z$_][0-9A-Za-z$_]*",AA=["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"],IA=["true","false","null","undefined","NaN","Infinity"],MA=["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"],LA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],OA=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],DA=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],PA=[].concat(OA,MA,LA);function a$(e){const t=e.regex,n=($,{after:Z})=>{const R="</"+$[0].slice(1);return $.input.indexOf(R,Z)!==-1},r=Ad,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,Z)=>{const R=$[0].length+$.index,Y=$.input[R];if(Y==="<"||Y===","){Z.ignoreMatch();return}Y===">"&&(n($,{after:R})||Z.ignoreMatch());let V;const A=$.input.substring(R);if(V=A.match(/^\s*=/)){Z.ignoreMatch();return}if((V=A.match(/^\s+extends\s+/))&&V.index===0){Z.ignoreMatch();return}}},l={$pattern:Ad,keyword:AA,literal:IA,built_in:PA,"variable.language":DA},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,g]},b={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]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,{match:/\$\d+/},f];g.contains=k.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(k)});const N=[].concat(b,g.contains),_=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(N)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},E={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"}}]},S={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:{_:[...MA,...LA]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P($){return t.concat("(?!",$.join("|"),")")}const W={match:t.concat(/\b/,P([...OA,"super","import"].map($=>`${$}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},I={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,b,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,e.REGEXP_MODE,{className:"function",begin:T,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},W,F,E,I,{match:/\$[(.]/}]}}function i$(e){const t=e.regex,n=a$(e),r=Ad,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Ad,keyword:AA.concat(c),literal:IA,built_in:PA.concat(a),"variable.language":DA},d={className:"meta",begin:"@"+r},f=(y,v,x)=>{const b=y.contains.findIndex(k=>k.label===v);if(b===-1)throw new Error("can not find mode to replace");y.contains.splice(b,1,x)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const g=n.contains.find(y=>y.scope==="attr"),p=Object.assign({},g,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,g,p]),n.contains=n.contains.concat([d,i,s,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const m=n.contains.find(y=>y.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function s$(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,a),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,t.either(i,a),/ +/,t.either(s,l),/ *#/)}]},u={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])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),g=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,c,u,d,f,g,{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:[g]}]}}function o$(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],a={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={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"}},i,s,a,e.QUOTE_STRING_MODE,c,u,l]}}function l$(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(i,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,c,l,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,c,l]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[u],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:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function c$(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,a]},l=e.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),g={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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},v=[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}},g,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,y,i,s],x=[...v];return x.pop(),x.push(l),p.contains=x,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const u$={arduino:Wz,bash:Vz,c:Gz,cpp:Kz,csharp:Yz,css:aU,diff:iU,go:sU,graphql:oU,ini:lU,java:cU,javascript:pU,json:hU,kotlin:xU,less:SU,lua:NU,makefile:CU,markdown:jU,objectivec:TU,perl:RU,php:AU,"php-template":IU,plaintext:MU,python:LU,"python-repl":OU,r:DU,ruby:PU,rust:FU,scss:GU,shell:KU,sql:YU,swift:r$,typescript:i$,vbnet:s$,wasm:o$,xml:l$,yaml:c$};function FA(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&FA(n)}),e}class Yw{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function BA(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function vi(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const a in r)n[a]=r[a]}),n}const d$="</span>",Xw=e=>!!e.scope,f$=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,a)=>`${r}${"_".repeat(a+1)}`)].join(" ")}return`${t}${e}`};class g${constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=BA(t)}openNode(t){if(!Xw(t))return;const n=f$(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Xw(t)&&(this.buffer+=d$)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Qw=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class y1{constructor(){this.rootNode=Qw(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=Qw({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{y1._collapse(n)}))}}class p$ extends y1{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new g$(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function oc(e){return e?typeof e=="string"?e:e.source:null}function zA(e){return _s("(?=",e,")")}function h$(e){return _s("(?:",e,")*")}function m$(e){return _s("(?:",e,")?")}function _s(...e){return e.map(n=>oc(n)).join("")}function x$(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function b1(...e){return"("+(x$(e).capture?"":"?:")+e.map(r=>oc(r)).join("|")+")"}function UA(e){return new RegExp(e.toString()+"|").exec("").length-1}function y$(e,t){const n=e&&e.exec(t);return n&&n.index===0}const b$=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function v1(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const a=n;let i=oc(r),s="";for(;i.length>0;){const l=b$.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+a):(s+=l[0],l[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(t)}const v$=/\b\B/,$A="[a-zA-Z]\\w*",k1="[a-zA-Z_]\\w*",HA="\\b\\d+(\\.\\d+)?",qA="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",WA="\\b(0b[01]+)",k$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",_$=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=_s(t,/.*\b/,e.binary,/\b.*/)),vi({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},lc={begin:"\\\\[\\s\\S]",relevance:0},w$={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[lc]},E$={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[lc]},S$={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/},gf=function(e,t,n={}){const r=vi({scope:"comment",begin:e,end:t,contains:[]},n);r.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 a=b1("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 r.contains.push({begin:_s(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},N$=gf("//","$"),C$=gf("/\\*","\\*/"),j$=gf("#","$"),T$={scope:"number",begin:HA,relevance:0},R$={scope:"number",begin:qA,relevance:0},A$={scope:"number",begin:WA,relevance:0},I$={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[lc,{begin:/\[/,end:/\]/,relevance:0,contains:[lc]}]},M$={scope:"title",begin:$A,relevance:0},L$={scope:"title",begin:k1,relevance:0},O$={begin:"\\.\\s*"+k1,relevance:0},D$=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var _u=Object.freeze({__proto__:null,APOS_STRING_MODE:w$,BACKSLASH_ESCAPE:lc,BINARY_NUMBER_MODE:A$,BINARY_NUMBER_RE:WA,COMMENT:gf,C_BLOCK_COMMENT_MODE:C$,C_LINE_COMMENT_MODE:N$,C_NUMBER_MODE:R$,C_NUMBER_RE:qA,END_SAME_AS_BEGIN:D$,HASH_COMMENT_MODE:j$,IDENT_RE:$A,MATCH_NOTHING_RE:v$,METHOD_GUARD:O$,NUMBER_MODE:T$,NUMBER_RE:HA,PHRASAL_WORDS_MODE:S$,QUOTE_STRING_MODE:E$,REGEXP_MODE:I$,RE_STARTERS_RE:k$,SHEBANG:_$,TITLE_MODE:M$,UNDERSCORE_IDENT_RE:k1,UNDERSCORE_TITLE_MODE:L$});function P$(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function F$(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function B$(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=P$,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function z$(e,t){Array.isArray(e.illegal)&&(e.illegal=b1(...e.illegal))}function U$(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function $$(e,t){e.relevance===void 0&&(e.relevance=1)}const H$=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=_s(n.beforeMatch,zA(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},q$=["of","and","for","in","not","or","if","then","parent","list","value"],W$="keyword";function VA(e,t,n=W$){const r=Object.create(null);return typeof e=="string"?a(n,e.split(" ")):Array.isArray(e)?a(n,e):Object.keys(e).forEach(function(i){Object.assign(r,VA(e[i],t,i))}),r;function a(i,s){t&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){const c=l.split("|");r[c[0]]=[i,V$(c[0],c[1])]})}}function V$(e,t){return t?Number(t):G$(e)?0:1}function G$(e){return q$.includes(e.toLowerCase())}const Zw={},os=e=>{console.error(e)},Jw=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Bs=(e,t)=>{Zw[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Zw[`${e}/${t}`]=!0)},Id=new Error;function GA(e,t,{key:n}){let r=0;const a=e[n],i={},s={};for(let l=1;l<=t.length;l++)s[l+r]=a[l],i[l+r]=!0,r+=UA(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function K$(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw os("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Id;if(typeof e.beginScope!="object"||e.beginScope===null)throw os("beginScope must be object"),Id;GA(e,e.begin,{key:"beginScope"}),e.begin=v1(e.begin,{joinWith:""})}}function Y$(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw os("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Id;if(typeof e.endScope!="object"||e.endScope===null)throw os("endScope must be object"),Id;GA(e,e.end,{key:"endScope"}),e.end=v1(e.end,{joinWith:""})}}function X$(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Q$(e){X$(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),K$(e),Y$(e)}function Z$(e){function t(s,l){return new RegExp(oc(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=UA(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(v1(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,g)=>g>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function a(s){const l=new r;return s.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){const c=s;if(s.isCompiled)return c;[F$,U$,Q$,H$].forEach(d=>d(s,l)),e.compilerExtensions.forEach(d=>d(s,l)),s.__beforeBegin=null,[B$,z$,$$].forEach(d=>d(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=VA(s.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(s.begin||(s.begin=/\B|\b/),c.beginRe=t(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=t(c.end)),c.terminatorEnd=oc(c.end)||"",s.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(c.illegalRe=t(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(d){return J$(d==="self"?s:d)})),s.contains.forEach(function(d){i(d,c)}),s.starts&&i(s.starts,l),c.matcher=a(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=vi(e.classNameAliases||{}),i(e)}function KA(e){return e?e.endsWithParent||KA(e.starts):!1}function J$(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return vi(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:KA(e)?vi(e,{starts:e.starts?vi(e.starts):null}):Object.isFrozen(e)?vi(e):e}var eH="11.11.1";class tH extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Jg=BA,e2=vi,t2=Symbol("nomatch"),nH=7,YA=function(e){const t=Object.create(null),n=Object.create(null),r=[];let a=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p$};function c(T){return l.noHighlightRe.test(T)}function u(T){let L=T.className+" ";L+=T.parentNode?T.parentNode.className:"";const $=l.languageDetectRe.exec(L);if($){const Z=S($[1]);return Z||(Jw(i.replace("{}",$[1])),Jw("Falling back to no-highlight mode for this block.",T)),Z?$[1]:"no-highlight"}return L.split(/\s+/).find(Z=>c(Z)||S(Z))}function d(T,L,$){let Z="",R="";typeof L=="object"?(Z=T,$=L.ignoreIllegals,R=L.language):(Bs("10.7.0","highlight(lang, code, ...args) has been deprecated."),Bs("10.7.0",`Please use highlight(code, options) instead.
|
|
81
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),R=T,Z=L),$===void 0&&($=!0);const Y={code:Z,language:R};O("before:highlight",Y);const V=Y.result?Y.result:f(Y.language,Y.code,$);return V.code=Y.code,O("after:highlight",V),V}function f(T,L,$,Z){const R=Object.create(null);function Y(U,D){return U.keywords[D]}function V(){if(!K.keywords){Te.addText(ge);return}let U=0;K.keywordPatternRe.lastIndex=0;let D=K.keywordPatternRe.exec(ge),G="";for(;D;){G+=ge.substring(U,D.index);const le=me.case_insensitive?D[0].toLowerCase():D[0],je=Y(K,le);if(je){const[$e,Ve]=je;if(Te.addText(G),G="",R[le]=(R[le]||0)+1,R[le]<=nH&&(xe+=Ve),$e.startsWith("_"))G+=D[0];else{const Qe=me.classNameAliases[$e]||$e;ce(D[0],Qe)}}else G+=D[0];U=K.keywordPatternRe.lastIndex,D=K.keywordPatternRe.exec(ge)}G+=ge.substring(U),Te.addText(G)}function A(){if(ge==="")return;let U=null;if(typeof K.subLanguage=="string"){if(!t[K.subLanguage]){Te.addText(ge);return}U=f(K.subLanguage,ge,!0,we[K.subLanguage]),we[K.subLanguage]=U._top}else U=p(ge,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(xe+=U.relevance),Te.__addSublanguage(U._emitter,U.language)}function H(){K.subLanguage!=null?A():V(),ge=""}function ce(U,D){U!==""&&(Te.startScope(D),Te.addText(U),Te.endScope())}function ee(U,D){let G=1;const le=D.length-1;for(;G<=le;){if(!U._emit[G]){G++;continue}const je=me.classNameAliases[U[G]]||U[G],$e=D[G];je?ce($e,je):(ge=$e,V(),ge=""),G++}}function Me(U,D){return U.scope&&typeof U.scope=="string"&&Te.openNode(me.classNameAliases[U.scope]||U.scope),U.beginScope&&(U.beginScope._wrap?(ce(ge,me.classNameAliases[U.beginScope._wrap]||U.beginScope._wrap),ge=""):U.beginScope._multi&&(ee(U.beginScope,D),ge="")),K=Object.create(U,{parent:{value:K}}),K}function X(U,D,G){let le=y$(U.endRe,G);if(le){if(U["on:end"]){const je=new Yw(U);U["on:end"](D,je),je.isMatchIgnored&&(le=!1)}if(le){for(;U.endsParent&&U.parent;)U=U.parent;return U}}if(U.endsWithParent)return X(U.parent,D,G)}function ye(U){return K.matcher.regexIndex===0?(ge+=U[0],1):(pe=!0,0)}function Oe(U){const D=U[0],G=U.rule,le=new Yw(G),je=[G.__beforeBegin,G["on:begin"]];for(const $e of je)if($e&&($e(U,le),le.isMatchIgnored))return ye(D);return G.skip?ge+=D:(G.excludeBegin&&(ge+=D),H(),!G.returnBegin&&!G.excludeBegin&&(ge=D)),Me(G,U),G.returnBegin?0:D.length}function Ee(U){const D=U[0],G=L.substring(U.index),le=X(K,U,G);if(!le)return t2;const je=K;K.endScope&&K.endScope._wrap?(H(),ce(D,K.endScope._wrap)):K.endScope&&K.endScope._multi?(H(),ee(K.endScope,U)):je.skip?ge+=D:(je.returnEnd||je.excludeEnd||(ge+=D),H(),je.excludeEnd&&(ge=D));do K.scope&&Te.closeNode(),!K.skip&&!K.subLanguage&&(xe+=K.relevance),K=K.parent;while(K!==le.parent);return le.starts&&Me(le.starts,U),je.returnEnd?0:D.length}function de(){const U=[];for(let D=K;D!==me;D=D.parent)D.scope&&U.unshift(D.scope);U.forEach(D=>Te.openNode(D))}let Se={};function Ae(U,D){const G=D&&D[0];if(ge+=U,G==null)return H(),0;if(Se.type==="begin"&&D.type==="end"&&Se.index===D.index&&G===""){if(ge+=L.slice(D.index,D.index+1),!a){const le=new Error(`0 width match regex (${T})`);throw le.languageName=T,le.badRule=Se.rule,le}return 1}if(Se=D,D.type==="begin")return Oe(D);if(D.type==="illegal"&&!$){const le=new Error('Illegal lexeme "'+G+'" for mode "'+(K.scope||"<unnamed>")+'"');throw le.mode=K,le}else if(D.type==="end"){const le=Ee(D);if(le!==t2)return le}if(D.type==="illegal"&&G==="")return ge+=`
|
|
82
|
-
`,1;if(fe>1e5&&fe>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ge+=G,G.length}const me=S(T);if(!me)throw os(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const ve=Z$(me);let De="",K=Z||ve;const we={},Te=new l.__emitter(l);de();let ge="",xe=0,he=0,fe=0,pe=!1;try{if(me.__emitTokens)me.__emitTokens(L,Te);else{for(K.matcher.considerAll();;){fe++,pe?pe=!1:K.matcher.considerAll(),K.matcher.lastIndex=he;const U=K.matcher.exec(L);if(!U)break;const D=L.substring(he,U.index),G=Ae(D,U);he=U.index+G}Ae(L.substring(he))}return Te.finalize(),De=Te.toHTML(),{language:T,value:De,relevance:xe,illegal:!1,_emitter:Te,_top:K}}catch(U){if(U.message&&U.message.includes("Illegal"))return{language:T,value:Jg(L),illegal:!0,relevance:0,_illegalBy:{message:U.message,index:he,context:L.slice(he-100,he+100),mode:U.mode,resultSoFar:De},_emitter:Te};if(a)return{language:T,value:Jg(L),illegal:!1,relevance:0,errorRaised:U,_emitter:Te,_top:K};throw U}}function g(T){const L={value:Jg(T),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return L._emitter.addText(T),L}function p(T,L){L=L||l.languages||Object.keys(t);const $=g(T),Z=L.filter(S).filter(j).map(H=>f(H,T,!1));Z.unshift($);const R=Z.sort((H,ce)=>{if(H.relevance!==ce.relevance)return ce.relevance-H.relevance;if(H.language&&ce.language){if(S(H.language).supersetOf===ce.language)return 1;if(S(ce.language).supersetOf===H.language)return-1}return 0}),[Y,V]=R,A=Y;return A.secondBest=V,A}function m(T,L,$){const Z=L&&n[L]||$;T.classList.add("hljs"),T.classList.add(`language-${Z}`)}function y(T){let L=null;const $=u(T);if(c($))return;if(O("before:highlightElement",{el:T,language:$}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(l.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(T)),l.throwUnescapedHTML))throw new tH("One of your code blocks includes unescaped HTML.",T.innerHTML);L=T;const Z=L.textContent,R=$?d(Z,{language:$,ignoreIllegals:!0}):p(Z);T.innerHTML=R.value,T.dataset.highlighted="yes",m(T,$,R.language),T.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(T.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),O("after:highlightElement",{el:T,result:R,text:Z})}function v(T){l=e2(l,T)}const x=()=>{N(),Bs("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function b(){N(),Bs("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function N(){function T(){N()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",T,!1),k=!0;return}document.querySelectorAll(l.cssSelector).forEach(y)}function _(T,L){let $=null;try{$=L(e)}catch(Z){if(os("Language definition for '{}' could not be registered.".replace("{}",T)),a)os(Z);else throw Z;$=s}$.name||($.name=T),t[T]=$,$.rawDefinition=L.bind(null,e),$.aliases&&M($.aliases,{languageName:T})}function w(T){delete t[T];for(const L of Object.keys(n))n[L]===T&&delete n[L]}function E(){return Object.keys(t)}function S(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function M(T,{languageName:L}){typeof T=="string"&&(T=[T]),T.forEach($=>{n[$.toLowerCase()]=L})}function j(T){const L=S(T);return L&&!L.disableAutodetect}function F(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=L=>{T["before:highlightBlock"](Object.assign({block:L.el},L))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=L=>{T["after:highlightBlock"](Object.assign({block:L.el},L))})}function P(T){F(T),r.push(T)}function W(T){const L=r.indexOf(T);L!==-1&&r.splice(L,1)}function O(T,L){const $=T;r.forEach(function(Z){Z[$]&&Z[$](L)})}function I(T){return Bs("10.7.0","highlightBlock will be removed entirely in v12.0"),Bs("10.7.0","Please use highlightElement now."),y(T)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:N,highlightElement:y,highlightBlock:I,configure:v,initHighlighting:x,initHighlightingOnLoad:b,registerLanguage:_,unregisterLanguage:w,listLanguages:E,getLanguage:S,registerAliases:M,autoDetection:j,inherit:e2,addPlugin:P,removePlugin:W}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString=eH,e.regex={concat:_s,lookahead:zA,either:b1,optional:m$,anyNumberOfTimes:h$};for(const T in _u)typeof _u[T]=="object"&&FA(_u[T]);return Object.assign(e,_u),e},So=YA({});So.newInstance=()=>YA({});var rH=So;So.HighlightJS=So;So.default=So;const aH=No(rH),n2={},iH="hljs-";function sH(e){const t=aH.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:a,register:i,registerAlias:s,registered:l};function n(c,u,d){const f=d||n2,g=typeof f.prefix=="string"?f.prefix:iH;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:oH,classPrefix:g});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,y=m.data;return y.language=p.language,y.relevance=p.relevance,m}function r(c,u){const f=(u||n2).subset||a();let g=-1,p=0,m;for(;++g<f.length;){const y=f[g];if(!t.getLanguage(y))continue;const v=n(y,c,u);v.data&&v.data.relevance!==void 0&&v.data.relevance>p&&(p=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function a(){return t.listLanguages()}function i(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function s(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class oH{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],a=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:a}):r.children.push(...a)}openNode(t){const n=this,r=t.split(".").map(function(s,l){return l?s+"_".repeat(l):n.options.classPrefix+s}),a=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const lH={};function r2(e){const t=e||lH,n=t.aliases,r=t.detect||!1,a=t.languages||u$,i=t.plainText,s=t.prefix,l=t.subset;let c="hljs";const u=sH(a);if(n&&u.registerAlias(n),s){const d=s.indexOf("-");c=d===-1?s:s.slice(0,d)}return function(d,f){ff(d,"element",function(g,p,m){if(g.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=cH(g);if(y===!1||!y&&!r||y&&i&&i.includes(y))return;Array.isArray(g.properties.className)||(g.properties.className=[]),g.properties.className.includes(c)||g.properties.className.unshift(c);const v=Pz(g,{whitespace:"pre"});let x;try{x=y?u.highlight(y,v,{prefix:s}):u.highlightAuto(v,{prefix:s,subset:l})}catch(b){const k=b;if(y&&/Unknown language/.test(k.message)){f.message("Cannot highlight as `"+y+"`, it’s not registered",{ancestors:[m,g],cause:k,place:g.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw k}!y&&x.data&&x.data.language&&g.properties.className.push("language-"+x.data.language),x.children.length>0&&(g.children=x.children)})}}function cH(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const a=String(t[n]);if(a==="no-highlight"||a==="nohighlight")return!1;!r&&a.slice(0,5)==="lang-"&&(r=a.slice(5)),!r&&a.slice(0,9)==="language-"&&(r=a.slice(9))}return r}function Sb(){function e(t){const n=new Set(["strong","emphasis","delete"]);function r(a){if(a.children)for(let i=0;i<a.children.length;i++){const s=a.children[i];if(n.has(s.type)){if(i>0){const u=a.children[i-1];u.type==="text"?u.value&&/[a-zA-Z0-9]$/.test(u.value)&&!u.value.endsWith(" ")&&!u.value.endsWith(`
|
|
83
|
-
`)&&(u.value+=" "):(a.children.splice(i,0,{type:"text",value:" "}),i++)}const l=i+1,c=l<a.children.length?a.children[l]:null;c&&(c.type==="text"?c.value&&/^[a-zA-Z0-9]/.test(c.value)&&!c.value.startsWith(" ")&&!c.value.startsWith(`
|
|
84
|
-
`)&&(c.value=" "+c.value):n.has(c.type)&&a.children.splice(l,0,{type:"text",value:" "}))}r(s)}}return r(t),t}return e}function Zu({children:e,language:t,className:n,frameless:r,...a}){const[i,s]=h.useState(!1),l=String(e).replace(/\n$/,""),c=n||(t?"language-"+t:""),u=async()=>{try{await navigator.clipboard.writeText(l),s(!0),setTimeout(()=>s(!1),2e3)}catch{const d=document.createElement("textarea");d.value=l,document.body.appendChild(d),d.select(),document.execCommand("copy"),document.body.removeChild(d),s(!0),setTimeout(()=>s(!1),2e3)}};return r?o.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[o.jsx("button",{onClick:u,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-sm",title:"Copy","aria-label":"Copy code",children:i?o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:o.jsx("code",{className:c||void 0,children:e})})]}):o.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:[o.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:[o.jsx("span",{children:t||"code"}),o.jsx("button",{onClick:u,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:i?o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"]})})]}),o.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:o.jsx("code",{className:c||void 0,children:e})})]})}function pf(e,t){if(!t)return"";try{const n=typeof t=="string"?JSON.parse(t):t;if(n.command)return n.command;if(n.filePath&&e==="read")return`read ${n.filePath}`;if(n.pattern&&e==="grep"){const r=n.path||n.include||".";return`grep "${n.pattern}" ${r}`}if(n.pattern&&e==="glob")return`glob "${n.pattern}"`;if(n.filePath&&e==="edit")return`edit ${n.filePath}`;if(n.filePath&&e==="write")return`write ${n.filePath}`;if(n._purpose&&e==="task")return`task "${n._purpose}"`;if(n.url&&(e==="webfetch"||e==="fetch"))return`fetch ${n.url}`;if(n.action&&e==="todo"){let r=`todo ${n.action}`;return n.text&&(r+=` "${n.text}"`),n.id&&(r+=` #${n.id}`),r}if(n.action&&e==="permission"){let r=`permission ${n.action}`;return n.type&&(r+=` ${n.type}`),n.target&&(r+=` ${n.target}`),r}{const r=[];for(const[a,i]of Object.entries(n))if(!(i==null||i===""))if(typeof i=="boolean")i&&r.push(`--${a}`);else if(Array.isArray(i)){const s=i.map(c=>String(c)).join(", "),l=s.length>60?s.slice(0,60)+"...":s;r.push(`--${a} "${l}"`)}else{const s=String(i),l=s.length>60?s.slice(0,60)+"...":s;r.push(`--${a} "${l}"`)}return r.length>0?`${e} ${r.join(" ")}`:e||""}}catch{return""}}function ls(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function uH(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 dH({part:e}){const{t}=Rt(),{tool:n,state:r}=e,[a,i]=h.useState(!1);if(!r)return null;const s=r.status||"running",l=r.title||n||t("tool.tool"),c=pf(n||l,r.input),u=r.input&&r.input._purpose?r.input._purpose:null,d=s==="completed"?uH(r.output):null,f=!u||a,g={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"},p={running:o.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:o.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:o.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:o.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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 o.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${g[s]||g.running}`,children:[o.jsxs("div",{className:`flex items-center gap-2 ${u?"cursor-pointer select-none":""}`,onClick:u?()=>i(!a):void 0,children:[p[s]||p.running,u?o.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:u}):o.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:l}),u&&o.jsx("svg",{className:`w-4 h-4 text-gray-400 flex-shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&c&&!d&&o.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:[o.jsx("span",{className:"text-green-400 select-none",children:"$ "}),o.jsx("span",{className:"text-gray-100",children:c})]}),d?o.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[o.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.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"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),o.jsxs("span",{children:[d.type==="mermaid"?"Mermaid diagram":d.type==="svg"?"SVG illustration":"Math",d.title?o.jsxs(o.Fragment,{children:[": ",o.jsx("span",{className:"font-medium",children:d.title})]}):null," rendered → see ",o.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):r.output&&s==="completed"&&f&&o.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:ls((typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,600)).slice(0,500)}),r.error&&f&&o.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:ls(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function fH({part:e}){const{tool:t,state:n}=e,[r,a]=h.useState(!1);if(!n)return null;const i=n.status||"running",s=n.title||t||"Tool",l=pf(t||s,n.input),c=n.input&&n.input._purpose?n.input._purpose:null,u=!c||r;return o.jsxs("div",{className:"py-1",children:[o.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${c?"cursor-pointer select-none":""}`,onClick:c?()=>a(!r):void 0,children:[i==="running"&&o.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),i==="completed"&&o.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i==="error"&&o.jsx("svg",{className:"w-3 h-3 text-red-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),i==="pending_confirmation"&&o.jsx("svg",{className:"w-3 h-3 text-blue-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),c?o.jsx("span",{className:"font-medium truncate flex-1",children:c}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium truncate",children:s}),l&&o.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:l})]}),c&&o.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),u&&l&&o.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:l}),n.output&&i==="completed"&&u&&o.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:ls(typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)).slice(0,500)}),n.error&&u&&o.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:ls(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)}),n.error&&!u&&o.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:ls(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function gH({text:e,isStreaming:t}){const{t:n}=Rt(),[r,a]=h.useState(!1),i=e&&e.trim().length>0;return o.jsxs("div",{className:"py-1",children:[o.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${i?"cursor-pointer select-none":""}`,onClick:i?()=>a(!r):void 0,children:[t?o.jsxs("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):o.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o.jsx("span",{className:"font-medium flex-1",children:n("chat.thinking")}),i&&o.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),r&&i&&o.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:o.jsx(ac,{remarkPlugins:[sc,Sb],children:e})})]})}const Na="",Nb="pave-working-directory";function Al(){if(typeof window>"u")return null;try{return localStorage.getItem(Nb)||null}catch{return null}}function ep(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(Nb):localStorage.setItem(Nb,e)}catch{}}async function Xe(e,t={}){const n=Al(),r={"Content-Type":"application/json",...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:a,...i}=t,s=await fetch(`${Na}${e}`,{...i,headers:r});if(!s.ok){let l=null;try{const u=await s.text();try{l=JSON.parse(u)}catch{l=null}if(!l){const d=new Error(`${s.status}: ${u||s.statusText}`);throw d.status=s.status,d}}catch(u){if(u.message)throw u.status===void 0&&(u.status=s.status),u;const d=new Error(`${s.status}: ${s.statusText}`);throw d.status=s.status,d}const c=new Error(`${s.status}: ${l.error||l.message||JSON.stringify(l)}`);throw c.status=s.status,c.body=l,l.reauthRequired&&(c.reauthRequired=!0),c}return s.json()}function Cb(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())),t.set("includeOtherApps","false");const n=t.toString(),r=n?`/session?${n}`:"/session";return Xe(r)}function a2(e){return Xe("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function tp(e){return Xe(`/session/${e}`)}function Dr(e,t){return Xe(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function pH(e){return Xe(`/session/${e}/regenerate-title`,{method:"POST"})}function hH(e){return Xe(`/session/${e}/fork`,{method:"POST"})}function i2(e){return Xe(`/session/${e}`,{method:"DELETE"})}function mH(e){return Xe(`/session/${e}/archive/session`,{method:"POST"})}function xH(){return Xe("/session",{method:"DELETE"})}function yH(e){return Xe(`/session/${e}/message`)}function wu(e,t,n,r,a,i){const s={content:t,async:!0};return n&&n.length>0&&(s.parts=n),r&&(s.model=r),a&&(s.agent=a),i&&i.enqueue&&(s.enqueue=!0,i.priority&&(s.priority=i.priority),i.displayContent&&(s.displayContent=i.displayContent)),i&&i.moeTopK&&(s.moe_top_k=i.moeTopK),i&&i.reasoningEffort&&(s.reasoning_effort=i.reasoningEffort),i&&i.adaptiveQuality&&(s.adaptive_quality=!0),Xe(`/session/${e}/message`,{method:"POST",body:JSON.stringify(s)})}function np(e){return Xe(`/session/${e}/queue`)}function s2(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),Xe(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function o2(e,t){return Xe(`/session/${e}/queue/${t}`,{method:"DELETE"})}function bH(e,t){return Xe(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function vH(e){return Xe(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function kH(e){return Xe(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function _H(e){return Xe(`/session/${e}/abort`,{method:"POST"})}function XA(e){return Xe(`/session/${e}/idle-injection`)}function wH(e,t){return Xe(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function EH(e){return Xe(`/session/${e}/idle-injection`,{method:"DELETE"})}function SH(e){return Xe(`/session/${e}/scheduled-injections`)}function NH(e,t){return Xe(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function CH(e,t,n){return Xe(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function jH(e,t){return Xe(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function TH(){return Xe("/config/providers")}function RH(){return Xe("/api/models/registry")}function AH(){return Xe("/auth/status")}function IH(){return Xe("/auth/logout",{method:"POST"})}function MH(){return Xe("/api/permissions/pending")}function LH(e){return Xe(`/api/permissions/confirm/${e}`,{method:"POST"})}function OH(e){return Xe(`/api/permissions/deny/${e}`,{method:"POST"})}function DH(){return Xe("/api/questions/pending")}function PH(e,t){return Xe(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function FH(e){return Xe(`/api/questions/${e}/reject`,{method:"POST"})}function _1(){return Xe("/skills")}function BH(){return Xe("/skills/commands")}function zH(){return Xe("/skills/registry")}function UH(e){return Xe(`/skills/${encodeURIComponent(e)}`)}function $H(e){return Xe(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function HH(e){return Xe(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function qH(){return Xe("/skills/check-updates")}function WH(e,t){return Xe(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function VH(e){return Xe(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function GH(e){return Xe(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function QA(){return Xe("/api/skill-defaults")}function KH(e){return Xe("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function YH(e){return Xe(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function XH(){return Xe("/config")}function QH(e){const t=e?"?model="+encodeURIComponent(e):"";return Xe("/config/adaptive-quality"+t)}function jb(){return Xe("/path")}function l2(e){return Xe("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function ZH(e){return Xe("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function ZA(){return Xe("/settings")}function JH(e){return Xe("/settings",{method:"PUT",body:JSON.stringify(e)})}function c2(e){const t=new URLSearchParams;e&&(e.unreadOnly&&t.set("unreadOnly","true"),typeof e.limit=="number"&&t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const n=t.toString();return Xe("/api/user/inbox"+(n?"?"+n:""))}function eq(e){return Xe("/api/user/inbox/"+encodeURIComponent(e)+"/read",{method:"POST"})}function tq(e){return Xe("/api/user/inbox/"+encodeURIComponent(e)+"/unread",{method:"POST"})}function nq(e){return Xe("/api/user/inbox/"+encodeURIComponent(e),{method:"DELETE"})}function rq(){return Xe("/api/user/inbox/read-all",{method:"POST"})}function aq(){return Xe("/api/user/inbox",{method:"DELETE"})}async function iq(e){const t=await fetch(Na+"/session/"+e+"/export",{credentials:"include"});if(!t.ok){const s=await t.json().catch(()=>({}));throw new Error(s.error||"Export failed")}const n=await t.blob(),r=t.headers.get("X-Filename")||"session.yaml",a=URL.createObjectURL(n),i=document.createElement("a");i.href=a,i.download=r,document.body.appendChild(i),i.click(),setTimeout(()=>{URL.revokeObjectURL(a),i.parentNode&&i.parentNode.removeChild(i)},0)}function sq(e){return Xe("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function oq(e,t,n,r){const a=Al(),i={};a&&(i["x-opencode-directory"]=a),e.type?i["Content-Type"]=e.type:i["Content-Type"]="audio/webm";let s=Na+"/api/transcribe";const l=[];t&&l.push("language="+encodeURIComponent(t)),n&&l.push("model="+encodeURIComponent(n));const c=r&&r.initialPrompt;c&&l.push("initial_prompt="+encodeURIComponent(c)),l.length>0&&(s+="?"+l.join("&"));const u=await fetch(s,{method:"POST",credentials:"include",headers:i,body:e}),d=await u.text();let f=null;if(d)try{f=JSON.parse(d)}catch{}if(!u.ok){const g=new Error(f&&f.error||"Transcription failed (HTTP "+u.status+")");throw g.status=u.status,g.code=f&&f.code,g.fallback=f&&f.fallback,g}if(!f){const g=new Error("Invalid response from transcription endpoint");throw g.code="invalid_response",g.fallback=!0,g}return f}let Gs=null,cl=0;function Tb(){const e=Date.now();return Gs&&e<cl||(Gs=Xe("/api/transcribe/config").then(t=>(cl=Date.now()+5e3,t)).catch(t=>{throw Gs=null,cl=0,t}),cl=1/0),Gs}function lq(e){return Gs=null,cl=0,Xe("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function u2(){return Xe("/session/status")}function cq(e){return Xe(`/session/${encodeURIComponent(e)}/dlp/status`)}function uq(){return Xe("/api/dlp/policy")}function dq(e){return Xe("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function fq(e){return(await fetch(`${Na}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function gq(e){return(await fetch(`${Na}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function d2(e){const t=await fetch(`${Na}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function pq(e){return(await fetch(`${Na}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function rp(e){try{const t=await fetch(`${Na}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function hq(e){const t=await fetch(`${Na}/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 f2(e){try{const t=await fetch(`${Na}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function mq(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function xq({part:e,questionId:t}){const{t:n}=Rt(),{state:r}=e;if(!r)return null;const a=r.status||"running",i=r.input||{},s=Array.isArray(i.questions)&&i.questions.length>0?i.questions:[{text:"(no question)",options:void 0}],l=a==="completed",c=r.output||"",[u,d]=h.useState({}),[f,g]=h.useState({}),[p,m]=h.useState(null),[y,v]=h.useState(null),[x,b]=h.useState(t),k=h.useRef(!0),N=h.useRef(null);h.useEffect(()=>{t&&b(t)},[t]);const _=e.callID||e.id||null;h.useEffect(()=>{if(l||x||!_)return;let W=!1;return DH().then(O=>{if(W||!k.current)return;const I=Array.isArray(O&&O.pending)?O.pending:[];for(var T=0;T<I.length;T++){var L=I[T],$=L.tool&&L.tool.callID?L.tool.callID:null;if($===_&&L.id){b(L.id);break}}}).catch(()=>{}),()=>{W=!0}},[l,x,_]),h.useEffect(()=>()=>{k.current=!1},[]),h.useEffect(()=>{!l&&N.current&&(N.current.focus(),N.current.scrollIntoView({behavior:"smooth",block:"center"}))},[l]);const w=W=>{var O,I;return(((O=u[W])==null?void 0:O.length)??0)>0||(((I=f[W])==null?void 0:I.trim().length)??0)>0},E=s.every((W,O)=>w(O)),S=(W,O,I)=>{d(T=>{const L=T[W]??[];return I?{...T,[W]:L.includes(O)?L.filter($=>$!==O):[...L,O]}:{...T,[W]:L.includes(O)?[]:[O]}})},M=h.useCallback(async()=>{if(!E||!x)return;const W=s.map((O,I)=>{var $;const T=u[I]??[],L=($=f[I])==null?void 0:$.trim();return L?[...T,L]:T});m("reply"),v(null);try{const O=await PH(x,W);if(!k.current)return;if(O&&O.success===!1){v(O.error||"Failed to reply"),m(null);return}}catch(O){if(!k.current)return;v(O.message||"Failed to reply"),m(null)}},[x,s,u,f,E]),j=h.useCallback(async()=>{if(x){m("reject"),v(null);try{const W=await FH(x);if(!k.current)return;if(W&&W.success===!1){v(W.error||"Failed to dismiss"),m(null);return}}catch(W){if(!k.current)return;v(W.message||"Failed to dismiss"),m(null)}}},[x]),F=W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),M())};if(l)return o.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:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:n("question.title")}),o.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),s.map((W,O)=>o.jsxs("div",{className:O>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[o.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:W.text}),c&&o.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:yq(c,O,s.length)})]},O))]});let P=!1;return o.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:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0 animate-pulse",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:n("question.title")})]}),s.map((W,O)=>{const I=Array.isArray(W.options)?W.options:[],T=I.length>0,L=W.multiple===!0,$=W.custom!==!1,Z=u[O]??[],R=$&&!P;return R&&(P=!0),o.jsxs("div",{className:O>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(W.header||L)&&o.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[W.header&&o.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:W.header}),L&&o.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:n("question.select_all")})]}),o.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:W.text}),T&&o.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:I.map((Y,V)=>{const A=mq(Y),H=Z.includes(A);return o.jsx("button",{onClick:()=>S(O,A,L),disabled:p!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${H?"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":H,children:A},V)})}),$&&o.jsx("input",{ref:R?N:void 0,type:"text",value:f[O]??"",onChange:Y=>g(V=>({...V,[O]:Y.target.value})),onKeyDown:F,disabled:p!==null,placeholder:n(T?"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-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]},O)}),y&&o.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:y}),!x&&!l&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:n("question.reconnecting")||"Reconnecting…"}),o.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[o.jsx("button",{onClick:j,disabled:p!==null||!x,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(p==="reject"?"question.dismissing":"question.dismiss")}),o.jsx("button",{onClick:M,disabled:p!==null||!E||!x,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:p==="reply"?n("question.submitting"):s.length>1?n("question.submit_n",{count:s.length}):n("question.submit")})]})]})}function yq(e,t,n){if(n===1){const i="User's answer: ";return e.startsWith(i)?e.slice(i.length):e}const r=e.split(`
|
|
85
|
-
`),a=`[${t+1}] `;for(const i of r)if(i.startsWith(a))return i.slice(a.length);return e}function bq({sessionId:e}){const{t}=Rt(),[n,r]=h.useState(null),[a,i]=h.useState(!1),[s,l]=h.useState(null),[c,u]=h.useState(!1),[d,f]=h.useState(null),g=h.useRef(null),p=n!==null;h.useEffect(()=>{if(!a)return;const b=k=>{k.key==="Escape"&&(k.stopPropagation(),i(!1))};return window.addEventListener("keydown",b),g.current&&g.current.focus(),()=>window.removeEventListener("keydown",b)},[a]);const m=async()=>{if(!(p||!e)){i(!0),u(!0),f(null);try{const{content:b}=await hq(e);l(typeof b=="string"?b:"")}catch(b){console.error("Failed to load PLAN.md:",b),f(t("planCard.loadError"))}finally{u(!1)}}},y=()=>{p||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},v=()=>{p||r("dismissed")},x="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 o.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 "+(p?"opacity-50":""),children:[o.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("button",{type:"button",onClick:m,disabled:p||c||!e,className:x+" 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")}),o.jsx("button",{type:"button",onClick:y,disabled:p,className:x+" 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")}),o.jsx("button",{type:"button",onClick:v,disabled:p,className:x+" 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")})]}),p&&o.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(n==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),a&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>i(!1),children:o.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:b=>b.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[o.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),o.jsx("button",{ref:g,type:"button",onClick:()=>i(!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:"✕"})]}),c?o.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):d?o.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:d}):o.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs text-gray-800 dark:text-gray-200",children:s})]})})]})}const vq="plan.md";function kq(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function _q(e){return typeof e!="string"||!e?!1:kq(e).toLowerCase()===vq}function wq(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||{};_q(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function w1(e,t,n=!1){if(t){const r=Object.values(t).filter(a=>a.type==="reasoning"&&n?!1:a.type==="text"||a.type==="reasoning").map(a=>a.text||a.delta||"").join(`
|
|
86
|
-
|
|
87
|
-
`);if(r)return r}return!e||e.length===0?"":e.filter(r=>r.type==="reasoning"&&n?!1:r.type==="text"||r.type==="reasoning").map(r=>r.text||"").join(`
|
|
88
|
-
|
|
89
|
-
`)}function Eq(e,t,n){const r=w1(e,t,n);if(!e||e.length===0)return r;const a=[];for(let i=0;i<e.length;i++){const s=e[i];if(s.type!=="tool")continue;const l=s.tool||s.state&&s.state.title||"",c=s.state||{},u=c.input||{},d=[];l&&d.push(l),u._purpose&&d.push(u._purpose);const f=Object.keys(u).filter(g=>g!=="_purpose");if(f.length>0){const g={};for(let p=0;p<f.length;p++)g[f[p]]=u[f[p]];try{d.push(JSON.stringify(g))}catch{}}if(c.output){let g=typeof c.output=="string"?c.output:function(){try{return JSON.stringify(c.output,null,2)}catch{return String(c.output)}}();g=g.replace(/\x1b\[[0-9;]*m/g,""),g.length>500&&(g=g.slice(0,500)),d.push(g)}if(c.error){const g=typeof c.error=="string"?c.error:c.error.message||String(c.error);d.push(g)}d.length>0&&a.push(d.join(`
|
|
90
|
-
`))}return a.length===0?r:r+`
|
|
91
|
-
|
|
92
|
-
`+a.join(`
|
|
93
|
-
|
|
94
|
-
`)}function Sq(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
|
|
95
|
-
`),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
|
|
96
|
-
`),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
|
|
97
|
-
`),t=t.replace(/`[^`\n]+`/g," "),t=t.replace(/!\[[^\]]*\]\([^)]*\)/g," "),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/^\[[^\]]+\]:\s.*$/gm," "),t=t.replace(/<(https?:\/\/[^>]+)>/g,"$1"),t=t.replace(/<\/?[a-zA-Z][^>]*>/g," "),t}function JA({message:e,parts:t,streamingParts:n,user:r,searchQuery:a,matchOffset:i,matchCount:s,activeMatchIndex:l,registerMatchRef:c,onRetry:u,onEditAndResend:d,onCancelQueued:f,hackerMode:g,mobileFrameless:p,hideThinking:m,isPrivate:y,isLast:v,isBusy:x,sessionID:b,questionIdMap:k,isCompactedOut:N}){var{t:_}=Rt(),w=e.role==="user",E=!w&&v&&!x?wq(t)!==null:!1,S=w&&e._queued===!0,M=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[j,F]=h.useState(!1),[P,W]=h.useState(!1),[O,I]=h.useState(""),T=h.useRef(null),L=h.useRef(!0),$=h.useRef(null);h.useEffect(function(){var xe=$.current;!xe||!P||(xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,300)+"px")},[O,P]),h.useEffect(function(){return L.current=!0,function(){L.current=!1,T.current&&clearTimeout(T.current)}},[]);var Z=w1(t,n,m),R=(t||[]).filter(function(xe){return xe.type==="tool"}),Y=(t||[]).filter(function(xe){return xe.type==="file"&&xe.filename}),V=(t||[]).filter(function(xe){if(xe.type!=="image_url"||!xe.image_url)return!1;var he=xe.image_url.url||xe.image_url;if(typeof he!="string")return!1;if(he.startsWith("data:image/")){var fe=he.indexOf(";"),pe=fe>5?he.substring(5,fe).toLowerCase():"",U=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return U.indexOf(pe)!==-1}if(he.startsWith("https://"))try{var D=new URL(he),G=D.pathname.toLowerCase();return!G.endsWith(".svg")&&!G.endsWith(".svgz")}catch{return!1}return!1});if(!w){var A=!!Z,H=V.length>0,ce=R.length>0,ee=R.some(function(xe){return(xe.tool||xe.state&&xe.state.title||"")==="question"}),Me=!g||ee;if(!A&&!H&&(!ce||!Me))return null}var X=Cq(e.time,_),ye=e.isAutoInjected===!0,Oe=e.isCompaction===!0,Ee=function(){var xe=Z||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(xe).then(function(){L.current&&(F(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){L.current&&F(!1)},2e3))}).catch(function(){L.current&&de(xe)}):de(xe)},de=function(xe){var he=document.createElement("textarea");he.value=xe,he.style.position="fixed",he.style.opacity="0",document.body.appendChild(he),he.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(he)}L.current&&(F(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){L.current&&F(!1)},2e3))},Se=function(){I(Z||""),W(!0)},Ae=function(){W(!1),I("")},me=function(){O.trim()&&(S&&f&&f(e.id),d&&d(O.trim())),W(!1),I("")},ve=null;if(w){var De=Oe?_("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":Z;a&&s>0&&!Oe?ve=jq(Z||"",a,i,l,c):ve=o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:De})}var K={pre:function({node:xe,children:he,...fe}){if(h.isValidElement(he)){var pe=he.type;if(pe==="code"||typeof pe=="string"&&pe.toLowerCase()==="code"){var U=he.props||{},D=className.match(/language-(\S+)/),G=D?D[1]:"",le=Il(U.children);return o.jsx(Zu,{language:G,className,frameless:Te,children:le})}}var je=Il(he);return je?o.jsx(Zu,{language:"",className:"",frameless:Te,children:je}):o.jsx("pre",{...fe,children:he})},code:function({node:xe,className:he,children:fe,...pe}){if(xe&&xe.position&&pe["data-sourcepos"],he&&he.indexOf("language-")!==-1){var U=he.match(/language-(\S+)/),D=U?U[1]:"";return o.jsx(Zu,{language:D,className:he,frameless:Te,children:Il(fe)})}return o.jsx("code",{className:Te?"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",...pe,children:fe})},a:function({node:xe,children:he,href:fe,...pe}){return o.jsx("a",{href:fe,...pe,target:"_blank",rel:"noopener noreferrer",children:he})},table:function({node:xe,children:he,...fe}){return o.jsx("div",{className:Te?"overflow-x-auto my-3":"overflow-x-auto",children:o.jsx("table",{className:Te?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...fe,children:he})})},th:function({node:xe,children:he,...fe}){return o.jsx("th",{className:Te?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...fe,children:he})},td:function({node:xe,children:he,...fe}){return o.jsx("td",{className:Te?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...fe,children:he})}},we={current:0},Te=p&&!w,ge=Te&&v&&x;return o.jsxs("div",{className:`group flex gap-3 ${w?"justify-end":"justify-start"} ${S?"opacity-60 italic":""}${N?" opacity-60":""}`,"data-compacted-out":N?"true":void 0,children:[!w&&!Te&&o.jsx("div",{className:`flex-shrink-0 w-7 h-7 rounded-lg flex items-center justify-center mt-1 ${y?"bg-emerald-600":"bg-primary-500"}`,title:y?"Private model (DLP)":void 0,children:y?o.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:o.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"})}):o.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),o.jsxs("div",{className:`flex flex-col min-w-0 ${Te?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[o.jsx("div",{className:`min-w-0 overflow-hidden ${w?`bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5${S&&!P?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:Te?ge?"border-t-2 border-primary-400 dark:border-primary-500/60 pt-2":"":`${y?"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`}`,...S&&!P&&d&&f?{onClick:Se,title:_("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(xe){(xe.key==="Enter"||xe.key===" ")&&(xe.preventDefault(),Se())}}:{},children:w?P?o.jsxs("div",{className:"space-y-2",children:[o.jsx("textarea",{ref:$,value:O,onChange:function(xe){I(xe.target.value)},className:"w-full bg-white/20 text-white placeholder-white/50 text-sm rounded-lg px-3 py-2 outline-none resize-none min-h-[60px] max-h-[300px] overflow-y-auto",rows:1,autoFocus:!0}),o.jsxs("div",{className:"flex gap-2 justify-end",children:[o.jsx("button",{onClick:Ae,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:me,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):o.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[ve,Y.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Y.map(function(xe,he){return o.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:xe.mime||"",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:o.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"})}),o.jsx("span",{className:"truncate",children:xe.filename})]},xe.id||"file-"+he)})}),V.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:V.map(function(xe,he){var fe=xe.image_url.url||xe.image_url;return o.jsx("a",{href:fe,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:fe,alt:_("chat.attachment_with_index",{index:he+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},xe.id||"img-"+he)})})]}):Nq(t,n,V,Y,K,we,a,i,s,l,c,g,m,_,Te,k,v,x)}),E&&o.jsx(bq,{sessionId:b}),o.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${w?"justify-end":"justify-start"}`,children:[X&&o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:X}),ye&&o.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:_("chat.idle_injection_auto_badge")}),e.finish==="interrupted"&&o.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:_("chat.interrupted_badge")||"Interrupted"}),e.moeTopK&&e.moeTopK>0&&o.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"}),o.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:[Z&&o.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-none focus:ring-1 focus:ring-primary-500","aria-label":_(j?"chat.copied":"chat.copy_message"),title:_(j?"chat.copied":"chat.copy_message"),children:j?o.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),w&&!S&&!P&&d&&o.jsx("button",{onClick:Se,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-none focus:ring-1 focus:ring-primary-500","aria-label":_("chat.edit_resend"),title:_("chat.edit_resend"),children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),w&&S&&!P&&d&&f&&o.jsx("button",{onClick:Se,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-none focus:ring-1 focus:ring-primary-500","aria-label":_("chat.edit_resend"),title:_("chat.edit_resend"),children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),w&&S&&f&&o.jsx("button",{onClick:function(){f(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-none focus:ring-1 focus:ring-primary-500","aria-label":_("chat.cancel_queued"),title:_("chat.cancel_queued"),children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),!w&&u&&o.jsx("button",{onClick:u,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-none focus:ring-1 focus:ring-primary-500","aria-label":_("chat.regenerate"),title:_("chat.regenerate"),children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]})]})]}),w&&o.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center mt-1",children:o.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:M})})]})}function Nq(e,t,n,r,a,i,s,l,c,u,d,f,g,p,m,y,v,x){var b=(e||[]).slice();if(t){for(var k={},N=0;N<b.length;N++)k[b[N].id]=!0;for(var _=Object.keys(t),w=0;w<_.length;w++){var E=t[_[w]];(E.type==="text"||E.type==="reasoning")&&!k[E.id]&&b.push({id:E.id,type:E.type,text:E.text||E.delta||""})}}var S=[],M="",j="",F="",P="";function W(){M&&(S.push({type:"text",text:M,key:j}),M="",j="")}function O(){F&&(S.push({type:"reasoning",text:F,key:P}),F="",P="")}for(var I=0;I<b.length;I++){var T=b[I];if(T.type==="text"){O(),j||(j="text-"+(T.id||I));var L=T.text||"";M&&L&&!M.endsWith(`
|
|
98
|
-
`)&&(M+=`
|
|
99
|
-
`),M+=L}else if(T.type==="reasoning"){W(),P||(P="reasoning-"+(T.id||I));var $=T.text||"";F&&$&&!F.endsWith(`
|
|
100
|
-
`)&&(F+=`
|
|
101
|
-
`),F+=$}else T.type==="tool"&&(O(),W(),S.push({type:"tool",part:T,key:"tool-"+(T.id||I)}))}if(O(),W(),r.length>0&&S.push({type:"files",parts:r,key:"files"}),n.length>0&&S.push({type:"images",parts:n,key:"images"}),S.length===0)return null;var Z=[],R=[],Y="";function V(){R.length>0&&(Z.push(o.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:R},"accent-"+Y)),R=[])}for(var A=0;A<S.length;A++){var H=S[A];if(H.type==="text"){V();var ce=Object.assign({},a);if(s&&c>0){var ee=function(Ee,de){return function({children:Se,node:Ae,...me}){return o.jsx(Ee,{...me,children:Rb(Se,s,l,de,u,d)})}};ce.p=ee("p",i),ce.li=ee("li",i),ce.td=ee("td",i),ce.th=ee("th",i),ce.h1=ee("h1",i),ce.h2=ee("h2",i),ce.h3=ee("h3",i),ce.h4=ee("h4",i),ce.h5=ee("h5",i),ce.h6=ee("h6",i),ce.blockquote=ee("blockquote",i)}Z.push(o.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:o.jsx(ac,{remarkPlugins:[sc,Sb],rehypePlugins:[r2],components:ce,children:H.text})},H.key))}else if(H.type==="reasoning")if(m)R.length===0&&(Y=H.key),R.push(o.jsx(gH,{text:H.text,isStreaming:A===S.length-1&&v&&x},H.key));else{if(V(),g)continue;Z.push(o.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:[o.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),p("chat.thinking")]}),o.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:o.jsx(ac,{remarkPlugins:[sc,Sb],rehypePlugins:[r2],components:a,children:H.text})})]},H.key))}else if(H.type==="tool"){var Me=H.part.tool||H.part.state&&H.part.state.title||"",X=Me==="question";if(X){V();var ye=H.part.callID||H.part.id||"",Oe=y&&y[ye]?y[ye]:null;Z.push(o.jsx("div",{className:"my-2",children:o.jsx(xq,{part:H.part,questionId:Oe})},H.key))}else m&&!f?(R.length===0&&(Y=H.key),R.push(o.jsx(fH,{part:H.part},H.key))):(V(),Z.push(o.jsx("div",{className:`my-2 ${f?"hidden":""}`,children:o.jsx(dH,{part:H.part})},H.key)))}else H.type==="files"?(V(),Z.push(o.jsx("div",{className:Z.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:H.parts.map(function(Ee,de){return o.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:Ee.mime||"",children:[o.jsx("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:o.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"})}),o.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:Ee.filename})]},Ee.id||"file-"+de)})})},H.key))):H.type==="images"&&Z.push(o.jsx("div",{className:Z.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:H.parts.map(function(Ee,de){var Se=Ee.image_url.url||Ee.image_url;return o.jsx("a",{href:Se,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:Se,alt:p("chat.attachment_with_index",{index:de+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},Ee.id||"img-"+de)})})},H.key))}return V(),Z}function Il(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(Il).join(""):h.isValidElement(e)?Il(e.props.children):""}function Cq(e,t){if(!e)return"";var n=e.created||e.updated;if(!n)return"";var r=new Date(n);if(isNaN(r.getTime()))return"";var a=new Date,i=r.toDateString()===a.toDateString(),s=new Date(a);s.setDate(s.getDate()-1);var l=r.toDateString()===s.toDateString(),c=r.getHours(),u=r.getMinutes(),d=c>=12?"PM":"AM";c=c%12,c===0&&(c=12);var f=c+":"+(u<10?"0":"")+u+" "+d;if(i)return f;if(l)return t?t("chat.yesterday_time",{time:f}):"Yesterday "+f;var g=r.getMonth()+1,p=r.getDate();return g+"/"+p+" "+f}function jq(e,t,n,r,a){if(!t||!e)return o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:e});for(var i=e.toLowerCase(),s=t.toLowerCase(),l=[],c=0,u=0;;){var d=i.indexOf(s,c);if(d===-1)break;d>c&&l.push(e.substring(c,d));var f=n+u,g=f===r;l.push(o.jsx("mark",{ref:function(p){a(f,p)},className:g?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:e.substring(d,d+t.length)},"m-"+u)),u++,c=d+t.length}return c<e.length&&l.push(e.substring(c)),o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:l})}function Rb(e,t,n,r,a,i){if(!e)return e;if(Array.isArray(e))return e.map(function(y,v){return o.jsx(h.Fragment,{children:Rb(y,t,n,r,a,i)},v)});if(typeof e=="string"){for(var s=e,l=s.toLowerCase(),c=t.toLowerCase(),u=[],d=0;;){var f=l.indexOf(c,d);if(f===-1)break;f>d&&u.push(s.substring(d,f));var g=n+r.current,p=g===a;u.push(o.jsx("mark",{ref:function(y){i(g,y)},className:p?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:s.substring(f,f+t.length)},"m-"+r.current)),r.current++,d=f+t.length}return d<s.length&&u.push(s.substring(d)),u.length>0?u:s}if(h.isValidElement(e)){if(e.type==="code"||e.type===Zu)return e;if(e.props&&e.props.children!==void 0){var m=Rb(e.props.children,t,n,r,a,i);return h.cloneElement(e,void 0,m)}}return e}function Tq({sessionID:e,banners:t,hidden:n,onToggle:r}){var[a,i]=h.useState(0),[s,l]=h.useState(!1);if(h.useRef(null),h.useEffect(function(){i(0)},[e,t&&t.length,t&&t[0]&&t[0].timestamp]),!e||!t||t.length===0)return null;if(n)return o.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 c=t[a]||t[0],u=function(){i(function(f){return Math.min(t.length-1,f+1)})},d=function(){i(function(f){return Math.max(0,f-1)})};return o.jsxs(o.Fragment,{children:[o.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:o.jsxs("div",{className:"relative w-full overflow-hidden cursor-zoom-in",style:{aspectRatio:"16 / 9",maxHeight:"20vh"},onClick:function(){l(!0)},title:c.prompt||"Session banner",children:[o.jsx("img",{src:c.url,alt:c.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),c.prompt?o.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:o.jsx("div",{className:"line-clamp-2",children:c.prompt})}):null,t.length>1?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:function(f){f.stopPropagation(),u()},disabled:a>=t.length-1,className:"absolute left-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Older banner",children:"‹"}),o.jsx("button",{type:"button",onClick:function(f){f.stopPropagation(),d()},disabled:a<=0,className:"absolute right-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Newer banner",children:"›"}),o.jsx("div",{className:"absolute top-1 right-2 bg-black/40 text-white text-[10px] px-1.5 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:a+1+" / "+t.length})]}):null]})}),s?o.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-4 cursor-zoom-out",onClick:function(){l(!1)},children:[o.jsxs("div",{className:"max-w-5xl w-full",onClick:function(f){f.stopPropagation()},children:[o.jsx("img",{src:c.url,alt:c.prompt||"Session banner",className:"w-full h-auto rounded shadow-2xl",style:{aspectRatio:"16 / 9",objectFit:"cover"}}),c.prompt?o.jsx("div",{className:"text-white text-sm mt-3 px-2",children:c.prompt}):null,o.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(c.timestamp).toLocaleString(),t.length>1?" · "+(a+1)+" of "+t.length:""]})]}),o.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(){l(!1)},"aria-label":"Close",children:"×"})]}):null]})}var Rq=h.forwardRef(function({messages:t,streamingParts:n,streamingProgress:r,isBusy:a,compactingInfo:i,compactionResult:s,onSwitchToCompactedSession:l,onDismissCompactionResult:c,user:u,searchQuery:d,activeMatchIndex:f,onTotalMatchesChange:g,onRetry:p,onEditAndResend:m,onCancelQueued:y,hackerMode:v,mobileFrameless:x,hideThinking:b,sessionID:k,banners:N,bannerHidden:_,onToggleBanner:w,privateMessageIds:E,parentSessionID:S,onViewParentSession:M,compactionPinned:j,onUnpinCompaction:F,questionIdMap:P},W){const{t:O}=Rt();var I=h.useRef(null),T=h.useRef(!0),L=h.useRef({}),$=h.useRef(null),Z=h.useRef(null),[R,Y]=h.useState(!1),[V,A]=h.useState(!1),H=h.useRef({startIndex:0,endIndex:0}),ce=h.useRef(null),ee=h.useRef(!1),Me=h.useRef(0);h.useEffect(function(){A(!1)},[k]);var X=h.useCallback(function(){Z.current?Z.current.scrollTop=Z.current.scrollHeight:I.current&&I.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);h.useImperativeHandle(W,function(){return{scrollToBottom:X,resetAutoScroll:function(){T.current=!0}}},[X]);var ye=h.useCallback(function(D,G){G?L.current[D]=G:delete L.current[D]},[]),Oe=h.useRef({}),Ee=h.useMemo(function(){if(!d)return{perMessage:{},total:0,_nextCache:{}};for(var D=d.toLowerCase(),G=0,le={},je={},$e=Oe.current,Ve=0;Ve<t.length;Ve++){var Qe=t[Ve],Ye=Eq(Qe.parts,n[Qe.info.id],b),_t=Qe.info.role==="assistant",He=_t?Sq(Ye):Ye,at=He.toLowerCase(),ue=Qe.info.id,qe=$e[ue],Ge;qe&&qe.text===at&&qe.query===D?Ge=qe.count:Ge=Aq(at,D),je[ue]={text:at,query:D,count:Ge},Ge>0&&(le[Qe.info.id]={offset:G,count:Ge,messageIndex:Ve}),G+=Ge}return{perMessage:le,total:G,_nextCache:je}},[t,n,d,b]);h.useEffect(function(){Oe.current=Ee._nextCache},[Ee]);var de=h.useMemo(function(){return{perMessage:Ee.perMessage,total:Ee.total}},[Ee]);h.useEffect(function(){g&&g(de.total)},[de.total,g]);var Se=h.useMemo(function(){for(var D=0,G=0;G<t.length&&t[G].info.compactedOut===!0;G++)D++;return D},[t]),Ae=h.useMemo(function(){return V||Se===0?t:t.slice(Se)},[t,V,Se]);h.useEffect(function(){if(!(!d||de.total===0||V||Se===0)){var D=de.perMessage;for(var G in D)if(D.hasOwnProperty(G)&&D[G].messageIndex<Se){A(!0);break}}},[d,de,V,Se]),h.useLayoutEffect(function(){if(ce.current!=null&&I.current){var D=ce.current;ce.current=null;var G=requestAnimationFrame(function(){I.current&&I.current.scrollToIndex({index:D,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(G)}}},[Ae]);var me=h.useCallback(function(){ee.current=!0,V?(ce.current=0,A(!1)):(ce.current=H.current.startIndex+Se,A(!0))},[V,Se]);h.useEffect(function(){var D=Ae.length>Me.current;if(Me.current=Ae.length,!D||!T.current||ee.current){ee.current=!1;return}var G=setTimeout(function(){T.current&&Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},150);return function(){clearTimeout(G)}},[Ae.length]),h.useEffect(function(){!T.current||d||Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[n,t,d]);var ve=h.useMemo(function(){if(!d||de.total===0)return[];var D=[],G=de.perMessage;for(var le in G)G.hasOwnProperty(le)&&D.push(G[le]);return D.sort(function(je,$e){return je.messageIndex-$e.messageIndex}),D},[d,de]);h.useEffect(function(){if(!(!d||de.total===0||f<0)){for(var D=-1,G=0;G<ve.length;G++){var le=ve[G];if(f>=le.offset&&f<le.offset+le.count){D=le.messageIndex;break}}if(!(D<0)){var je=V||Se===0?0:Se,$e=D-je;if(!($e<0)){I.current&&I.current.scrollToIndex({index:$e,align:"center",behavior:"smooth"});var Ve=requestAnimationFrame(function(){var Qe=setTimeout(function(){var Ye=L.current[f];Ye&&Ye.scrollIntoView&&Ye.scrollIntoView({behavior:"smooth",block:"center"})},200);$.current=Qe});return function(){cancelAnimationFrame(Ve),$.current&&(clearTimeout($.current),$.current=null)}}}}},[f,d,de.total,ve,V,Se]),h.useEffect(function(){L.current={}},[d]);for(var De=-1,K=Ae.length-1;K>=0;K--)if(Ae[K].info.role==="assistant"){De=K;break}var we=h.useCallback(function(D){return d?!1:D?"smooth":!1},[d]),Te=h.useCallback(function(D){T.current=D,Y(function(G){return!D&&t.length>0})},[d,Ae.length]),ge=h.useMemo(function(){return V&&Se>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[V,Se]),xe=h.useCallback(function(D,G){var le=de.perMessage[G.info.id]||null,je=D===De,$e=G.info.role==="user",Ve=G.info.compactedOut===!0,Qe=V&&D>0&&t[D-1].info.compactedOut===!0,Ye=Qe&&!Ve;return o.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[Ye?o.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[o.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:O&&O("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),o.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,o.jsx(JA,{isCompactedOut:Ve,message:G.info,parts:G.parts,streamingParts:n[G.info.id],user:u,searchQuery:d,matchOffset:le?le.offset:-1,matchCount:le?le.count:0,activeMatchIndex:f,registerMatchRef:ye,isLast:je,isBusy:a,sessionID:k,onRetry:je&&!a&&!Ve?p:void 0,onEditAndResend:$e&&!a&&!Ve&&!Mq(G.parts)?m:void 0,onCancelQueued:Ve?void 0:y,hackerMode:v,mobileFrameless:x,hideThinking:b,isPrivate:E&&E.has(G.info.id),questionIdMap:P})]})},[de,De,t,n,u,d,f,ye,a,k,p,m,y,v,x,b,E,P,V,O]),he=h.useMemo(function(){return o.jsxs(o.Fragment,{children:[a&&(x?!0:!Iq(t,n,v,b))&&(x?o.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:o.jsxs("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.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"})]})}):o.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:[o.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:o.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),o.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),a&&!x&&r&&r.toolCalls>0&&o.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:[o.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:o.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.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"})]})}),o.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:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:Lq(r.toolNames,O)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:Oq(r.toolArgBytes)})]}),o.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.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"}})})]})]})]})},[a,x,t,n,r,v,b,O]),fe=h.useMemo(function(){return function(){return o.jsxs(o.Fragment,{children:[o.jsx(Tq,{sessionID:k,banners:N,hidden:_,onToggle:w}),o.jsx(Dq,{sessionID:k,parentSessionID:S,onViewParentSession:M,compactionPinned:j,onUnpinCompaction:F,t:O}),Se>0?o.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:o.jsx("button",{type:"button",onClick:me,"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-sm",children:V?O&&O("compaction.hide_history")||"Hide messages before compaction":O&&O("compaction.show_history",{count:Se})||"Show "+Se+" messages before compaction"})}):null]})}},[k,N,_,w,S,M,j,F,O,Se,V,me]),pe=h.useMemo(function(){return function(){return he}},[he]),U=h.useMemo(function(){return{Header:fe,Footer:pe}},[fe,pe]);return o.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[o.jsx(NP,{ref:I,scrollerRef:function(D){Z.current=D},data:Ae,itemContent:xe,followOutput:we,atBottomStateChange:Te,rangeChanged:function(D){H.current=D},increaseViewportBy:ge,defaultItemHeight:120,computeItemKey:function(D,G){return G.info.id},components:U,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),R&&o.jsx("button",{onClick:X,"aria-label":O("chat.scroll_to_bottom"),className:"fixed bottom-24 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-none focus:ring-2 focus:ring-primary-500 transition-all",title:O("chat.scroll_to_bottom"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function Aq(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 Iq(e,t,n,r){var a=!n;for(var i of Object.keys(t)){var s=t[i];if(s){var l=Object.values(s).some(function(g){return g.type==="reasoning"&&r?!1:(g.type==="text"||g.type==="reasoning")&&(g.text||g.delta)});if(l)return!0}}for(var c=e.length-1;c>=0;c--){var u=e[c];if(u.info.role==="assistant"){var d=(u.parts||[]).some(function(g){return g.type==="reasoning"&&r?!1:(g.type==="text"||g.type==="reasoning")&&g.text}),f=(u.parts||[]).some(function(g){return g.type==="tool"});return d||a&&f}if(u.info.role==="user")break}return!1}function Mq(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function Lq(e,t){if(!e||e.length===0)return t?t("chat.tool_preparing"):"Preparing tool call";var n={write:t?t("chat.tool_write"):"Writing file",edit:t?t("chat.tool_edit"):"Editing file",read:t?t("chat.tool_read"):"Reading file",bash:t?t("chat.tool_bash"):"Running command",glob:t?t("chat.tool_glob"):"Searching files",grep:t?t("chat.tool_grep"):"Searching code"},r=e[0],a=n[r]||(t?t("chat.tool_preparing_name",{name:r}):"Preparing "+r);return e.length>1&&(a+=" +"+(e.length-1)),a}function Oq(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function Dq({sessionID:e,parentSessionID:t,onViewParentSession:n,compactionPinned:r,onUnpinCompaction:a,t:i}){var s="pave:compactionBannerDismissed:"+e,l=function(){try{return localStorage.getItem(s)==="1"}catch{return!1}},c=function(){try{localStorage.setItem(s,"1")}catch{}p(!0)},u=function(){n&&t&&n(t)},d=l(),f=h.useState(!d),g=f[0],p=f[1];return!t||g?null:o.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:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{className:"text-xs text-blue-700 dark:text-blue-300 flex-1 min-w-0",children:i&&i("compaction.banner_title")||"This session was compacted from a previous conversation."}),o.jsx("button",{type:"button",onClick:u,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-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:i&&i("compaction.view_original")||"View original"}),r?o.jsx("button",{type:"button",onClick:function(){a&&a(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:i&&i("chat.unpin_compacted")||"Unpin — go back to original"}):null,o.jsx("button",{type:"button",onClick:c,"aria-label":i&&i("compaction.dismiss")||"Dismiss",className:"text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-300 flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const hf=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],eI=["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"],tI=[...hf,...eI],Md=5,g2=Math.floor(4*1024*1024/1.34),p2=5*1024*1024,h2=6*1024*1024,m2=Math.floor(4*1024*1024/1.34),Pq=tI.join(",");function ap(e){return e?hf.indexOf(e.toLowerCase())!==-1:!1}class Fq{constructor(t){t||(t={}),this._sampleRate=t.sampleRate||16e3,this._capacity=Math.max(1,Math.round((t.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(t){if(!t||!(t instanceof Float32Array))throw new TypeError("append() requires a Float32Array argument");const n=t.length;if(n===0)return;if(this._totalAppended+=n,n>=this._capacity){const s=n-this._capacity;this._buffer.set(t.subarray(s,n)),this._start=0,this._length=this._capacity;return}const r=(this._start+this._length)%this._capacity,a=Math.min(n,this._capacity-r);this._buffer.set(t.subarray(0,a),r),a<n&&this._buffer.set(t.subarray(a,n),0);const i=this._length+n;if(i<=this._capacity)this._length=i;else{const s=i-this._capacity;this._start=(this._start+s)%this._capacity,this._length=this._capacity}}read(t,n){if(typeof t!="number"||t<0)throw new RangeError("read() offset must be >= 0, got "+t);if(typeof n!="number"||n<0)throw new RangeError("read() count must be >= 0, got "+n);if(t>=this._length||n===0)return new Float32Array(0);const r=Math.min(n,this._length-t),a=new Float32Array(r),i=(this._start+t)%this._capacity,s=Math.min(r,this._capacity-i);return a.set(this._buffer.subarray(i,i+s),0),s<r&&a.set(this._buffer.subarray(0,r-s),s),a}trimBefore(t){(typeof t!="number"||t<0)&&(t=0),t>this._length&&(t=this._length),this._start=(this._start+t)%this._capacity,this._length-=t}clear(){this._start=0,this._length=0,this._totalAppended=0}}var Bq={AudioRingBuffer:Fq};class zq{constructor(t){t||(t={}),this._sampleRate=t.sampleRate||16e3,this._chunkSamples=Math.round((t.chunkDuration||10)*this._sampleRate),this._overlapSamples=Math.round((t.overlapDuration||3)*this._sampleRate),this._minChunkSamples=Math.round((t.minChunkDuration||3)*this._sampleRate),this._maxInitialPrompt=t.maxInitialPrompt||200,this.reset()}get slotIndex(){return this._slotIndex}get pendingNewSamples(){return this._pendingNewSamples}get inflight(){return this._inflight}appendAndSchedule(t){if(this._inflight)return null;const n=t.totalAppended-this._lastSlotEndTotalAppended;this._pendingNewSamples=Math.max(0,n);const r=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<r?null:this._cutSlot(t)}reportResult(t){this._inflight&&(this._inflight=!1,this._prevText=t||"")}drain(t){if(this._inflight)return null;const n=t.totalAppended-this._lastSlotEndTotalAppended;return n<=0?null:this._cutSlot(t,n)}reset(){this._slotIndex=0,this._inflight=!1,this._pendingNewSamples=0,this._lastSlotEndTotalAppended=0,this._prevText="",this._drained=!1}clearPrevText(){this._prevText=""}_cutSlot(t,n){const r=this._slotIndex===0,a=t.totalAppended-t.length,i=r?0:Math.min(this._overlapSamples,Math.max(0,this._lastSlotEndTotalAppended-a)),s=n!=null?Math.min(n,t.totalAppended-this._lastSlotEndTotalAppended):Math.min(this._pendingNewSamples,t.totalAppended-this._lastSlotEndTotalAppended),l=i+s,c=Math.max(0,this._lastSlotEndTotalAppended-a-i),u=t.read(c,l);let d="";this._prevText.length>0&&(d=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const f={audio:u,overlapSamples:i,slotIndex:this._slotIndex,initialPrompt:d,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=s,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,f}}var Uq={TranscriptionScheduler:zq};function $q(e,t){const n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;let a=new Array(r+1),i=new Array(r+1);for(let s=0;s<=r;s++)a[s]=s;for(let s=1;s<=n;s++){i[0]=s;for(let c=1;c<=r;c++){const u=e[s-1]===t[c-1]?0:1;i[c]=Math.min(i[c-1]+1,a[c]+1,a[c-1]+u)}const l=a;a=i,i=l}return a[r]}function Hq(e,t,n){if(!e)return t||"";if(!t)return"";const r=n&&n.maxOverlapChars||50,a=n&&typeof n.maxEditRatio=="number"?n.maxEditRatio:.2,i=Math.min(r,e.length,t.length);for(let s=i;s>=1;s--){const l=e.slice(-s),c=t.slice(0,s);if($q(l,c)/s<=a)return t.slice(s)}return t}var qq={dedupOverlap:Hq};const zs=16e3;function Eu(e,t,n,r){try{const a=localStorage.getItem(e);if(a==null||a==="")return t;const i=Number(a);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}catch{return t}}const Wq=2,Vq=.6,Gq=1,Kq=200,x2=3,ip=2,Yq=1e3,y2=.01,b2=800;function v2(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 Xq(e,t){const n=e.sampleRate,r=e.getChannelData(0);if(n===t)return new Float32Array(r);const a=n/t,i=Math.round(r.length/a),s=new Float32Array(i);for(let l=0;l<i;l+=1){const c=l*a,u=Math.floor(c),d=Math.min(u+1,r.length-1),f=c-u;s[l]=r[u]*(1-f)+r[d]*f}return s}function Qq(e,t){const a=t*1*2,i=1*(16/8),s=e.length*i,l=new ArrayBuffer(44+s),c=new DataView(l);let u=0;for(let d=0;d<4;d++)c.setUint8(u++,"RIFF".charCodeAt(d));c.setUint32(u,36+s,!0),u+=4;for(let d=0;d<4;d++)c.setUint8(u++,"WAVE".charCodeAt(d));for(let d=0;d<4;d++)c.setUint8(u++,"fmt ".charCodeAt(d));c.setUint32(u,16,!0),u+=4,c.setUint16(u,1,!0),u+=2,c.setUint16(u,1,!0),u+=2,c.setUint32(u,t,!0),u+=4,c.setUint32(u,a,!0),u+=4,c.setUint16(u,i,!0),u+=2,c.setUint16(u,16,!0),u+=2;for(let d=0;d<4;d++)c.setUint8(u++,"data".charCodeAt(d));c.setUint32(u,s,!0),u+=4;for(let d=0;d<e.length;d++){const f=Math.max(-1,Math.min(1,e[d]));c.setInt16(u,f<0?f*32768:f*32767,!0),u+=2}return new Blob([l],{type:"audio/wav"})}function Zq({onTranscript:e,onError:t,onAutoSubmit:n,language:r,model:a}){const[i,s]=h.useState("idle"),[l,c]=h.useState(0),[u,d]=h.useState(null),[f,g]=h.useState(null),[p,m]=h.useState(""),y=h.useRef(null),v=h.useRef(null),x=h.useRef(null),b=h.useRef(null),k=h.useRef(!1),N=h.useRef(null),_=h.useRef(null),w=h.useRef(null),E=h.useRef(null),S=h.useRef(null),M=h.useRef(null),j=h.useRef(0),F=h.useRef(!1),P=h.useRef(""),W=h.useRef(!1),O=h.useRef(null),I=h.useRef(b2),T=h.useRef(null),L=h.useRef(!1),$=h.useRef(""),Z=h.useRef(""),R=h.useRef("idle"),Y=h.useCallback(he=>{R.current=he,s(he)},[]),V=h.useRef(e),A=h.useRef(t),H=h.useRef(n),ce=h.useRef(r),ee=h.useRef(a);h.useEffect(()=>{V.current=e},[e]),h.useEffect(()=>{A.current=t},[t]),h.useEffect(()=>{H.current=n},[n]),h.useEffect(()=>{ce.current=r},[r]),h.useEffect(()=>{ee.current=a},[a]),h.useEffect(()=>{E.current&&(R.current==="recording"||R.current==="paused")&&E.current.clearPrevText()},[r]);const Me=h.useCallback(()=>S.current?Promise.resolve(S.current):(M.current||(M.current=Tb().then(he=>(S.current=he,he)).catch(()=>{const he={mode:"auto",backendAvailable:!1};return S.current=he,he})),M.current),[]);h.useEffect(()=>{Me()},[Me]);const X=h.useCallback(()=>{if(N.current&&(N.current.getTracks().forEach(he=>he.stop()),N.current=null),T.current){try{T.current.readyState===WebSocket.OPEN&&T.current.send("Done"),T.current.close()}catch{}T.current=null}L.current=!1},[]),ye=h.useCallback(()=>{y.current&&(y.current.terminate(),y.current=null)},[]),Oe=h.useCallback(()=>{const he=x.current,fe=v.current,pe=b.current;if(he){try{he.disconnect()}catch{}he.onaudioprocess=null,x.current=null}if(fe){try{fe.disconnect()}catch{}v.current=null}if(pe){try{pe.disconnect()}catch{}b.current=null}k.current=!1,X(),_.current&&_.current.state!=="closed"&&(_.current.close().catch(()=>{}),_.current=null),ye(),w.current&&w.current.clear(),E.current&&E.current.reset(),j.current=0},[X,ye]),Ee=h.useRef(null),de=h.useRef(null),Se=h.useRef(null),Ae=h.useRef(null),me=h.useRef(null),ve=h.useRef(null);Ee.current=function(fe){const pe=fe&&fe.text||"";fe&&fe.chunkId;const U=E.current,D=fe&&fe._silent;U&&U.reportResult(pe);const G=qq.dedupOverlap(P.current,pe);if(G){const le=P.current+G;P.current=le,m(le),V.current&&V.current(G)}if(j.current=0,(D||pe.trim()==="")&&P.current.trim()&&H.current&&H.current(),R.current==="draining"&&U&&!U.inflight){const le=w.current,je=U.drain(le);je?Ae.current(je):ve.current();return}Se.current()},de.current=function(fe){const pe=E.current;if(pe&&pe.reportResult(""),j.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",fe,"("+j.current+"/"+x2+")"),j.current>=x2){Oe(),Y("idle"),A.current&&A.current("Voice transcription failed repeatedly. Please try again.");return}if(R.current==="draining"&&pe&&!pe.inflight){ve.current();return}Se.current()},Se.current=function(){const fe=E.current,pe=w.current;if(!fe||!pe)return;const U=R.current;if(U!=="recording"&&U!=="paused"&&U!=="draining")return;const D=fe.appendAndSchedule(pe);if(D){Ae.current(D);return}if((U==="paused"||U==="draining")&&!fe.inflight){const G=fe.drain(pe);G?Ae.current(G):U==="draining"&&ve.current()}},Ae.current=async function(fe){const pe=v2(fe.audio);if(pe<y2){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+pe.toFixed(6)+")"),Ee.current({text:"",chunkId:fe.chunkId,_silent:!0});return}const U=S.current||{mode:"auto",backendAvailable:!1},D=U.backendAvailable&&U.mode!=="local-only",G=U.mode!=="backend-only",le=ce.current,je=ee.current;if(D&&!F.current){const Qe=Qq(fe.audio,zs),Ye={};fe.initialPrompt&&(Ye.initialPrompt=fe.initialPrompt);let _t=null;for(let He=0;He<=ip;He++)try{const at=await oq(Qe,le,je,Ye);if(typeof at.text=="string"){g("backend"),Ee.current({text:at.text,chunkId:fe.chunkId});return}}catch(at){_t=at;const ue=at.status;if((ue===429||ue===503)&&He<ip){const qe=Yq*2**He;console.warn("[useContinuousVoiceInput] Backend "+ue+", retrying in "+qe+"ms (attempt "+(He+1)+"/"+ip+")"),await new Promise(Ge=>{setTimeout(Ge,qe)});continue}(ue===429||ue===503)&&(F.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!G){de.current(_t?_t.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",_t?_t.message:"unknown")}if(!G){de.current("Backend transcription is not available and local mode is disabled.");return}const $e=me.current();g("local");const Ve={type:"transcribe",audio:fe.audio};le&&(Ve.language=le),fe.initialPrompt&&(Ve.initialPrompt=fe.initialPrompt),fe.chunkId&&(Ve.chunkId=fe.chunkId),$e.postMessage(Ve,[fe.audio.buffer])},me.current=function(){if(y.current)return y.current;const fe=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});return fe.onmessage=pe=>{const U=pe.data;if(U)switch(U.type){case"loading":c(U.progress||0),d(U.file?U.file.split("/").pop():null);break;case"ready":R.current==="loading"&&Y("recording"),c(100),d(null);break;case"result":Ee.current(U);break;case"error":de.current(U.error||"Transcription failed");break}},fe.onerror=()=>{const pe=E.current;pe&&pe.reportResult(""),j.current+=1,ye();const U=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});U.onmessage=D=>{const G=D.data;if(G)switch(G.type){case"loading":c(G.progress||0),d(G.file?G.file.split("/").pop():null);break;case"ready":R.current==="loading"&&Y("recording"),c(100),d(null),Se.current();break;case"result":Ee.current(G);break;case"error":de.current(G.error||"Transcription failed");break}},U.onerror=()=>{U.terminate(),y.current=null,Oe(),Y("idle"),P.current="",m(""),A.current&&A.current("Voice transcription worker crashed.")},y.current=U},y.current=fe,fe},ve.current=function(){const fe=y.current;fe&&fe.postMessage({type:"unload"}),_.current&&_.current.state!=="closed"&&(_.current.close().catch(()=>{}),_.current=null),E.current&&E.current.reset(),w.current&&w.current.clear(),Y("idle")};const De=h.useCallback(async()=>{if(R.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){A.current&&A.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){A.current&&A.current("Audio recording is not supported in this browser.");return}try{const he=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:zs,echoCancellation:!0,noiseSuppression:!0}});N.current=he,S.current=null,M.current=null;const fe=await Me(),pe=!!(fe.streaming&&fe.streaming.wsUrl),U=!pe&&(fe.mode==="local-only"||!fe.backendAvailable&&fe.mode!=="backend-only"),D=window.AudioContext||window.webkitAudioContext;(!_.current||_.current.state==="closed")&&(_.current=new D);const G=_.current;if(w.current=new Bq.AudioRingBuffer({maxDuration:30,sampleRate:zs}),E.current=new Uq.TranscriptionScheduler({chunkDuration:Eu("pave.asr.chunkDuration",Wq,.5,30),overlapDuration:Eu("pave.asr.overlapDuration",Vq,0,10),minChunkDuration:Eu("pave.asr.minChunkDuration",Gq,.3,15),sampleRate:zs,maxInitialPrompt:Kq}),P.current="",m(""),j.current=0,F.current=!1,W.current=!1,O.current=null,I.current=Eu("pave.asr.vadSilenceMs",b2,200,5e3),$.current="",Z.current="",L.current=pe,pe){const Qe=(Ye,_t)=>{if(!Ye)return _t;if(!_t)return Ye;const He=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(_t),at=/\s$/.test(Ye)||He?"":" ";return Ye+at+_t};try{const Ye=new WebSocket(fe.streaming.wsUrl);Ye.binaryType="arraybuffer",T.current=Ye,Ye.onmessage=_t=>{let He="";try{He=typeof _t.data=="string"?_t.data:new TextDecoder().decode(_t.data)}catch{return}if(He==="Done!")return;let at="",ue=!1;try{const Ge=JSON.parse(He);at=Ge&&typeof Ge.text=="string"?Ge.text:"",ue=!!(Ge&&Ge.is_final)}catch{at=He}at=(at||"").trim();const qe=Qe($.current,at);qe&&qe!==Z.current&&(Z.current=qe,P.current=qe,m(qe),g("streaming"),V.current&&V.current(qe,{mode:"snapshot",engine:fe.streaming&&fe.streaming.engine||"paraformer"})),ue&&at&&(H.current?($.current="",Z.current="",P.current="",m(""),H.current()):$.current=Qe($.current,at))},Ye.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(Ye){console.warn("[useContinuousVoiceInput] streaming connect failed:",Ye),L.current=!1}}const le=G.createMediaStreamSource(he),$e=G.createScriptProcessor(4096,1,1),Ve=G.createGain();Ve.gain.value=0,le.connect($e),$e.connect(Ve),Ve.connect(G.destination),v.current=le,x.current=$e,b.current=Ve,k.current=!1,$e.onaudioprocess=Qe=>{if(k.current)return;const Ye=Qe.inputBuffer,_t=Ye.sampleRate,He=Ye.getChannelData(0);let at;if(_t===zs?at=new Float32Array(He):at=Xq({sampleRate:_t,getChannelData:()=>He},zs),at.length===0)return;if(L.current&&T.current&&T.current.readyState===WebSocket.OPEN){const bt=new Float32Array(at.length);bt.set(at),T.current.send(bt.buffer);return}const ue=w.current;ue&&ue.append(at);const qe=v2(at),Ge=performance.now();if(qe>=y2)W.current=!0,O.current=null;else if(W.current){if(!O.current)O.current=Ge;else if(Ge-O.current>=I.current){W.current=!1,O.current=null;const bt=E.current;if(bt&&!bt.inflight&&ue){const cn=bt.drain(ue);cn&&Ae.current(cn)}}}Se.current()},U?(Y("loading"),c(0),me.current().postMessage({type:"load"})):(Y("recording"),c(100))}catch(he){X(),Y("idle");const fe=he.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(he.message||String(he));A.current&&A.current(fe)}}},[Me,X]),K=h.useCallback(()=>{const he=R.current;if(he==="loading"){Oe(),ye(),Y("idle");return}if(he!=="recording"&&he!=="paused")return;const fe=x.current,pe=v.current,U=b.current;if(fe){try{fe.disconnect()}catch{}fe.onaudioprocess=null,x.current=null}if(pe){try{pe.disconnect()}catch{}v.current=null}if(U){try{U.disconnect()}catch{}b.current=null}X(),Y("draining"),setTimeout(()=>{const D=E.current,G=w.current;if(!D||!G){ve.current();return}if(!D.inflight){const le=D.drain(G);le?Ae.current(le):ve.current()}},0)},[X,Oe,ye]),we=h.useCallback(()=>{R.current==="recording"&&(k.current=!0,Y("paused"),Se.current())},[]),Te=h.useCallback(()=>{R.current==="paused"&&(k.current=!1,Y("recording"))},[]),ge=h.useCallback(()=>{R.current!=="idle"&&(Oe(),ye(),P.current="",m(""),Y("idle"))},[Oe,ye]),xe=h.useCallback(()=>{if(R.current!=="idle"){A.current&&A.current("Cannot clear cache while recording.");return}Y("loading"),c(0),ye(),me.current().postMessage({type:"clearCache"})},[ye]);return h.useEffect(()=>()=>{Oe(),ye()},[Oe,ye]),{state:i,progress:l,downloadingFile:u,transcriptionSource:f,transcriptText:p,startRecording:De,stopRecording:K,pauseRecording:we,resumeRecording:Te,cancelRecording:ge,clearModelCache:xe}}function Jq({skills:e,builtins:t,filter:n,onSelect:r,visible:a,selectedIndex:i,activeSkill:s,onBack:l}){const{t:c}=Rt(),u=h.useRef(null),d=h.useRef(null);if(h.useEffect(()=>{u.current&&u.current.scrollIntoView({block:"nearest"})},[i,s,n,e.length]),!a)return null;const f=(n||"").trim().toLowerCase();let g=[],p=!1;if(s){p=!0;const m=e.find(v=>v.skill===s);g=(m&&m.commands||[]).filter(v=>f?(v.name||"").toLowerCase().includes(f)||(v.description||"").toLowerCase().includes(f):!0).map(v=>({type:"command",skill:s,name:v.name,description:v.description}))}else{const m=(t||[]).filter(v=>f?(v.name||"").toLowerCase().includes(f)||(v.description||"").toLowerCase().includes(f):!0).map(v=>({type:"builtin",name:v.name,description:v.description})),y=e.filter(v=>f?(v.skill||"").toLowerCase().includes(f)||(v.description||"").toLowerCase().includes(f)||(v.commands||[]).some(x=>(x.name||"").toLowerCase().includes(f)||(x.description||"").toLowerCase().includes(f)):!0).map(v=>({type:"skill",skill:v.skill,description:v.description,commandCount:(v.commands||[]).length,configured:v.configured}));g=m.concat(y)}return o.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:[o.jsxs("div",{className:"flex-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:[p&&o.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1 hover:text-gray-700 dark:hover:text-gray-200 transition-colors","aria-label":c("slashCommand.back"),children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),c("slashCommand.skills")]}),o.jsx("span",{className:"flex-1 text-right",children:p?s+" "+c("slashCommand.commands"):c("slashCommand.title")})]}),o.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-y-auto",id:"slash-command-listbox",role:"listbox","aria-label":s?c("slashCommand.commands")+" — "+s:c("slashCommand.title"),children:g.length===0?o.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 dark:text-gray-500 text-center",children:c("slashCommand.noResults")}):g.map((m,y)=>{const v=y===i,x="slash-item-"+y;return o.jsx("div",{id:x,ref:v?u:null,role:"option","aria-selected":v,onClick:()=>{m.type==="skill"?r(m.skill,null):m.type==="builtin"?r("__builtin__",m.name):r(m.skill,m.name)},className:"flex items-center gap-3 px-3 py-2 cursor-pointer text-sm transition-colors "+(v?"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:m.type==="builtin"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:o.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:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"font-medium",children:["/",m.name]}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),m.description&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:m.description})]})]}):m.type==="skill"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-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:(m.skill||"?")[0].toUpperCase()}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium truncate",children:m.skill}),!m.configured&&o.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:c("slashCommand.notConfigured")})]}),m.description&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:m.description})]}),o.jsxs("div",{className:"flex-shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[m.commandCount," ",m.commandCount===1?c("slashCommand.command"):c("slashCommand.commands")]}),o.jsx("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:o.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:o.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"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("span",{className:"font-medium",children:["/",s," ",m.name]}),m.description&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:m.description})]})]})},m.type+"-"+(m.skill||"_")+"-"+(m.name||""))})}),o.jsxs("div",{className:"flex-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:[o.jsxs("span",{children:[o.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",c("slashCommand.navigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",c("slashCommand.select")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",c("slashCommand.close")]})]})]})}const Ju=[{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 eW(){return Ju.slice()}function tW(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Ju.length;n++)if(Ju[n].name===t)return Ju[n];return null}function nW(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("/"))return null;const n=t.match(/^\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/);if(!n)return null;const r=n[1].toLowerCase(),a=tW(r);if(!a)return null;const i=(n[2]||"").trim();return{name:r,args:i,builtin:a}}const Wi="pave-draft-",rW=h.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:a,sessionId:i,queuedCount:s=0,onBuiltinCommand:l},c){const{t:u}=Rt(),[d,f]=h.useState(""),[g,p]=h.useState([]),[m,y]=h.useState(!1);h.useEffect(()=>{const te=()=>y(!1);return window.addEventListener("pave:plan-execute",te),()=>window.removeEventListener("pave:plan-execute",te)},[]);const[v,x]=h.useState(null),[b,k]=h.useState([]),[N,_]=h.useState(""),[w,E]=h.useState(!1),S=h.useRef(null),M=h.useRef([]),[j,F]=h.useState(-1),P="pave-asr-language",W=[{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"}],[O,I]=h.useState(()=>{try{return localStorage.getItem(P)||"auto"}catch{return"auto"}}),[T,L]=h.useState(!1),$=h.useRef(null),Z=[{code:"whisper",label:"Whisper"},{code:"paraformer",label:"Paraformer"}],[R,Y]=h.useState("whisper"),[V,A]=h.useState(!1),H=h.useRef(null),ce=h.useRef(g),ee=h.useRef(null),Me=h.useRef(null),X=h.useRef(null),ye=h.useRef(i),Oe=h.useRef(d),Ee=h.useRef(null),[de,Se]=h.useState(!1),[Ae,me]=h.useState(""),[ve,De]=h.useState([]),[K,we]=h.useState(0),[Te,ge]=h.useState(null),xe=h.useRef({data:null,time:0}),he=6e4,fe=h.useCallback(te=>{x(te),Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(()=>x(null),5e3)},[]);h.useEffect(()=>()=>{Ee.current&&clearTimeout(Ee.current)},[]),h.useLayoutEffect(()=>{Oe.current=d},[d]),h.useLayoutEffect(()=>{ye.current=i,X.current&&(clearTimeout(X.current),X.current=null);let te="";if(i)try{te=localStorage.getItem(Wi+i)||""}catch{}return f(te),Oe.current=te,p(ke=>(ke.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview)}),[])),()=>{X.current&&(clearTimeout(X.current),X.current=null);const ke=ye.current;if(ke)try{Oe.current?localStorage.setItem(Wi+ke,Oe.current):localStorage.removeItem(Wi+ke)}catch{}}},[i]),h.useEffect(()=>{ye.current&&(X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{try{d?localStorage.setItem(Wi+ye.current,d):localStorage.removeItem(Wi+ye.current)}catch{}},300))},[d]);const pe=h.useCallback(async()=>{const te=xe.current;if(te.data&&Date.now()-te.time<he){De(te.data);return}try{const ke=await BH(),Ie=Array.isArray(ke)?ke:[];xe.current={data:Ie,time:Date.now()},De(Ie)}catch{De([])}},[]),U=h.useMemo(()=>eW(),[]),D=h.useMemo(()=>{const te=(Ae||"").trim().toLowerCase();if(Te){const We=ve.find(mt=>mt.skill===Te);return(We&&We.commands||[]).filter(mt=>te?(mt.name||"").toLowerCase().includes(te)||(mt.description||"").toLowerCase().includes(te):!0).map(mt=>({type:"command",skill:Te,name:mt.name}))}const ke=U.filter(We=>te?(We.name||"").toLowerCase().includes(te)||(We.description||"").toLowerCase().includes(te):!0).map(We=>({type:"builtin",name:We.name})),Ie=ve.filter(We=>te?(We.skill||"").toLowerCase().includes(te)||(We.description||"").toLowerCase().includes(te)||(We.commands||[]).some(ht=>(ht.name||"").toLowerCase().includes(te)||(ht.description||"").toLowerCase().includes(te)):!0).map(We=>({type:"skill",skill:We.skill}));return ke.concat(Ie)},[Ae,Te,ve,U]),G=h.useCallback(()=>D.length,[D]),le=h.useCallback(te=>{if(f(te),Oe.current=te,te.startsWith("/")){const ke=te.slice(1),Ie=ke.split(/\s/)[0]||"";if(!Ie.includes("/")&&!Ie.includes(".")){if(Te){const We=Te+" ";ke.startsWith(We)?(me(ke.slice(We.length)),we(0)):(ge(null),me(ke),we(0))}else me(ke),we(0);de||(pe(),Se(!0),we(0))}else Se(!1),me(""),ge(null),we(0)}else Se(!1),me(""),ge(null),we(0)},[de,Te,pe]),je=h.useCallback((te,ke)=>{var Ie,We,ht;if(te==="__builtin__"&&ke){f("/"+ke+" "),Se(!1),me(""),ge(null),we(0),(Ie=ee.current)==null||Ie.focus();return}if(!ke)ge(te),me(""),we(0),f("/"+te+" "),(We=ee.current)==null||We.focus();else{const mt="/"+te+" "+ke+" ";f(mt),Se(!1),me(""),ge(null),we(0),(ht=ee.current)==null||ht.focus()}},[]),$e=h.useCallback(()=>{var te;ge(null),me(""),we(0),f("/"),(te=ee.current)==null||te.focus()},[]),Ve=h.useRef(""),Qe=h.useCallback((te,ke)=>{if(ke&&ke.mode==="snapshot"){const Ie=Ve.current||"",We=Ie&&!Ie.endsWith(" ")&&!Ie.endsWith(`
|
|
102
|
-
`)?" ":"";f(Ie+We+(te||""));return}f(Ie=>{const We=Ie&&!Ie.endsWith(" ")&&!Ie.endsWith(`
|
|
103
|
-
`)?" ":"";return Ie+We+te})},[]),Ye=h.useRef(null),_t=h.useCallback(()=>{Ve.current="",setTimeout(()=>{Ye.current&&Ye.current()},50)},[]),{state:He,progress:at,downloadingFile:ue,startRecording:qe,stopRecording:Ge,resumeRecording:bt,cancelRecording:cn}=Zq({onTranscript:Qe,onError:fe,onAutoSubmit:_t,model:N||void 0,language:O&&O!=="auto"?O:void 0}),Hn=h.useCallback(()=>(f(te=>(Ve.current=te||"",te)),qe()),[qe]);h.useEffect(()=>{try{O&&localStorage.setItem(P,O)}catch{}},[O]),h.useEffect(()=>{if(!T)return;const te=ke=>{$.current&&!$.current.contains(ke.target)&&L(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[T]),h.useEffect(()=>{let te=!1;return Tb().then(ke=>{te||(ke&&Array.isArray(ke.models)&&ke.models.length>0&&(k(ke.models),_(Ie=>Ie||ke.models[0].name)),ke&&(ke.preferredEngine==="whisper"||ke.preferredEngine==="paraformer")&&Y(ke.preferredEngine))}).catch(()=>{}),()=>{te=!0}},[Tb]),h.useEffect(()=>{if(!V)return;const te=ke=>{H.current&&!H.current.contains(ke.target)&&A(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[V]);const On=h.useCallback(te=>{A(!1),Y(ke=>ke===te?ke:(lq(te).then(()=>{te==="paraformer"&&fe("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{Y(ke),fe("Could not switch the speech engine — is the server reachable?")}),te))},[fe]);h.useEffect(()=>{if(!w){F(-1);return}M.current.length=b.length;function te(Ie){S.current&&!S.current.contains(Ie.target)&&E(!1)}function ke(Ie){if(Ie.key==="Escape"){E(!1);return}Ie.key!=="ArrowDown"&&Ie.key!=="ArrowUp"&&Ie.key!=="Home"&&Ie.key!=="End"||(Ie.preventDefault(),F(We=>{const ht=M.current.length;if(!ht)return We;const mt=typeof We=="number"?We:-1;let It=mt;return Ie.key==="ArrowDown"?It=mt<ht-1?mt+1:0:Ie.key==="ArrowUp"?It=mt>0?mt-1:ht-1:Ie.key==="Home"?It=0:Ie.key==="End"&&(It=ht-1),M.current[It]&&M.current[It].focus(),It}))}return document.addEventListener("mousedown",te),document.addEventListener("keydown",ke),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",ke)}},[w,b.length]),h.useEffect(()=>{const te=ee.current;te&&(te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px")},[d]),h.useEffect(()=>{ce.current=g},[g]),h.useEffect(()=>{var te;(te=ee.current)==null||te.focus()},[]),h.useImperativeHandle(c,()=>({focus:()=>{var te;(te=ee.current)==null||te.focus()},setText:te=>{f(typeof te=="string"?te:""),requestAnimationFrame(()=>{var ke;return(ke=ee.current)==null?void 0:ke.focus()})}}),[]);const hn=async()=>{const te=d.trim();var ke=g.filter(function(mt){return ap(mt.type)}),Ie=g.filter(function(mt){return!ap(mt.type)});const We=nW(te);if(We&&typeof l=="function"){const mt=ye.current;try{await l(We.name,We.args,{imageAttachments:ke.length>0?ke:void 0,fileAttachments:Ie.length>0?Ie:void 0})}catch{return}if(f(""),Se(!1),me(""),ge(null),we(0),mt)try{localStorage.removeItem(Wi+mt)}catch{}g.forEach(function(It){It.preview&&URL.revokeObjectURL(It.preview)}),p([]),ee.current&&(ee.current.style.height="auto");return}if(!te&&ke.length===0&&Ie.length===0)return;const ht=ye.current;try{await t(te,ke.length>0?ke:void 0,m?"plan":void 0,Ie.length>0?Ie:void 0)}catch{return}if(f(""),Se(!1),me(""),ge(null),we(0),ht)try{localStorage.removeItem(Wi+ht)}catch{}g.forEach(function(mt){mt.preview&&URL.revokeObjectURL(mt.preview)}),p([]),ee.current&&(ee.current.style.height="auto")};Ye.current=hn;const er=te=>{if(de){const ke=G();if(te.key==="ArrowDown"){ke>0&&(te.preventDefault(),we(Ie=>(Ie+1)%ke));return}if(te.key==="ArrowUp"){ke>0&&(te.preventDefault(),we(Ie=>(Ie-1+ke)%ke));return}if(te.key==="Enter"||te.key==="Tab"){if(ke>0){te.preventDefault();const Ie=D[K];Ie&&(Ie.type==="command"?je(Ie.skill,Ie.name):Ie.type==="builtin"?je("__builtin__",Ie.name):je(Ie.skill,null));return}if(te.key==="Tab"){Se(!1),me(""),ge(null),we(0);return}}if(te.key==="Escape"){te.preventDefault(),Se(!1),me(""),ge(null),we(0);return}if(te.key==="Backspace"&&Te){const Ie=d.slice(1),We=Te+" ";if(Ie===We||Ie===Te){te.preventDefault(),$e();return}}}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),hn())},an=te=>{if(!a){var ke=te.clipboardData&&te.clipboardData.items;if(ke){for(var Ie=[],We=0;We<ke.length;We++){var ht=(ke[We].type||"").toLowerCase();if(hf.indexOf(ht)!==-1){var mt=ke[We].getAsFile();mt&&Ie.push(mt)}}if(Ie.length!==0){for(var It=!1,_e=0;_e<ke.length;_e++)if(ke[_e].type&&ke[_e].type.startsWith("text/")){It=!0;break}It||te.preventDefault();var it=Ie.map(function(Ot){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Ot,name:Ot.name||"pasted-image.png",size:Ot.size,type:Ot.type,preview:null}});p(function(Ot){var Dt=Md-Ot.length;if(Dt<=0)return Ot;for(var qn=it.slice(0,Dt),Sn=0;Sn<qn.length;Sn++)qn[Sn].preview=URL.createObjectURL(qn[Sn].file);return Ot.concat(qn)})}}}},Ct=te=>{const ke=Array.from(te.target.files||[]);if(ke.length===0)return;const Ie=ke.filter(ht=>tI.indexOf(ht.type)!==-1);if(Ie.length===0){te.target.value="";return}const We=Ie.map(ht=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:ht,name:ht.name,size:ht.size,type:ht.type,preview:null}));p(ht=>{var mt=Md-ht.length;if(mt<=0)return ht;for(var It=We.slice(0,mt),_e=0;_e<It.length;_e++)It[_e].preview=ap(It[_e].file.type)?URL.createObjectURL(It[_e].file):null;return[...ht,...It]}),te.target.value=""},vr=te=>{p(ke=>{const Ie=ke.find(We=>We.id===te);return Ie!=null&&Ie.preview&&URL.revokeObjectURL(Ie.preview),ke.filter(We=>We.id!==te)})},oe=te=>te<1024?te+" B":te<1024*1024?(te/1024).toFixed(1)+" KB":(te/(1024*1024)).toFixed(1)+" MB";return h.useEffect(()=>()=>{ce.current.forEach(te=>{te.preview&&URL.revokeObjectURL(te.preview)})},[]),o.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:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[m&&o.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:[o.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),g.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:g.map(te=>o.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:[te.preview?o.jsx("img",{src:te.preview,alt:te.name,className:"w-10 h-10 rounded object-cover"}):o.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:te.name}),o.jsx("p",{className:"text-xs text-gray-400",children:oe(te.size)})]}),o.jsx("button",{onClick:()=>vr(te.id),"aria-label":`Remove attachment ${te.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:o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},te.id))}),o.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:[o.jsx(Jq,{skills:ve,builtins:U,filter:Ae,onSelect:je,visible:de,selectedIndex:K,activeSkill:Te,onBack:$e}),o.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[o.jsx("button",{onClick:()=>{var te;return(te=Me.current)==null?void 0:te.click()},disabled:a||r,className:"flex-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:u("chat.attach_file"),"aria-label":u("chat.attach_file"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})})}),o.jsx("input",{ref:Me,type:"file",multiple:!0,accept:Pq,onChange:Ct,className:"hidden"}),o.jsx("button",{onClick:He==="recording"?Ge:He==="paused"?bt:He==="loading"?cn:Hn,disabled:He==="draining"||(a||r)&&He!=="recording"&&He!=="loading"&&He!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(He==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":He==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":He==="loading"||He==="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:He==="recording"?u("voice.stop_recording")||"Stop recording":He==="paused"?u("voice.resume_recording")||"Resume recording":He==="loading"?u("voice.loading_model"):He==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),"aria-label":He==="recording"?u("voice.stop_recording")||"Stop recording":He==="paused"?u("voice.resume_recording")||"Resume recording":He==="loading"?u("voice.loading_model"):He==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),children:He==="draining"?o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):He==="loading"?o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):He==="recording"?o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):He==="paused"?o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("circle",{cx:"12",cy:"12",r:"6"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})})}),He==="loading"&&o.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 whitespace-nowrap flex items-center gap-2",children:[o.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${at}%`}})}),o.jsx("span",{children:ue?`${ue} ${at}%`:`${at}%`})]}),R==="whisper"&&o.jsxs("div",{className:"relative flex-shrink-0",ref:$,children:[o.jsxs("button",{onClick:()=>L(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition language","aria-label":"Select speech recognition language","aria-haspopup":"menu","aria-expanded":T,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"})}),o.jsx("span",{className:"max-w-[80px] truncate",children:(W.find(te=>te.code===O)||W[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),T&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[180px] max-h-64 overflow-y-auto z-50",role:"menu","aria-label":"Speech recognition language",children:W.map(te=>o.jsx("button",{role:"menuitemradio","aria-checked":te.code===O,onClick:()=>{I(te.code),L(!1),te.code==="yue"&&fe("Cantonese requires whisper-small or larger. If transcription is poor, this device may be using the tiny model (Safari, or older cached version).")},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===O?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:te.label},te.code))})]}),o.jsxs("div",{className:"relative flex-shrink-0",ref:H,children:[o.jsxs("button",{onClick:()=>A(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition engine","aria-label":"Select speech recognition engine","aria-haspopup":"menu","aria-expanded":V,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 010-5.304m5.304 0a3.75 3.75 0 010 5.304m-7.425 2.121a6.75 6.75 0 010-9.546m9.546 0a6.75 6.75 0 010 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),o.jsx("span",{className:"max-w-[90px] truncate",children:(Z.find(te=>te.code===R)||Z[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),V&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[200px] z-50",role:"menu","aria-label":"Speech recognition engine",children:Z.map(te=>o.jsxs("button",{role:"menuitemradio","aria-checked":te.code===R,onClick:()=>On(te.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===R?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[o.jsx("div",{children:te.label}),o.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:te.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},te.code))})]}),R==="whisper"&&b.length>1&&o.jsxs("div",{className:"relative flex-shrink-0",ref:S,children:[o.jsxs("button",{onClick:()=>E(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:u("voice.select_asr_model"),"aria-label":u("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":w,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),o.jsx("span",{className:"max-w-[80px] truncate",children:(b.find(te=>te.name===N)||b[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),w&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[160px] z-50",role:"menu","aria-label":u("voice.select_asr_model"),children:b.map((te,ke)=>o.jsxs("button",{ref:Ie=>{M.current[ke]=Ie},role:"menuitemradio","aria-checked":te.name===N,tabIndex:j===ke?0:-1,onClick:()=>{_(te.name),E(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.name===N?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[te.label,te.type!=="openai"&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",te.type,")"]})]},`${te.name}-${ke}`))})]}),o.jsxs("button",{onClick:()=>y(te=>!te),disabled:a||r,className:"flex-shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(m?"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:m?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":m?"Disable plan mode":"Enable plan mode","aria-pressed":m,children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})}),m?"Plan":""]})]}),o.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[o.jsx("textarea",{ref:ee,value:d,onChange:te=>le(te.target.value),onKeyDown:er,onPaste:an,placeholder:u("chat.send_placeholder"),disabled:a,rows:1,role:de?"combobox":void 0,"aria-controls":de?"slash-command-listbox":void 0,"aria-activedescendant":de&&G()>0?"slash-item-"+K:void 0,"aria-expanded":de||void 0,className:"flex-1 bg-transparent resize-none outline-none 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&&o.jsx("button",{onClick:n,className:"flex-shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:u("chat.stop_generating"),"aria-label":u("chat.stop_generating"),children:o.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),o.jsxs("button",{onClick:hn,disabled:!d.trim()&&g.length===0||a,className:"relative flex-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)":u("chat.send_button"),"aria-label":r?"Queue message":u("chat.send_button"),"aria-disabled":!d.trim()&&g.length===0||a?"true":void 0,children:[o.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),s>0&&o.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":`${s} message${s===1?"":"s"} queued`,children:s})]})]})]}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:u("chat.send_hint")}),v&&o.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:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{children:v}),o.jsx("button",{onClick:()=>x(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":u("voice.dismiss_error"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})});function aW({darkMode:e,onToggleTheme:t}){const{t:n}=Rt(),r=(v,x)=>{const b=n(v);return b===v?x:b},[a,i]=h.useState(""),[s,l]=h.useState(""),[c,u]=h.useState(!1),[d,f]=h.useState(null),[g,p]=h.useState(!1);h.useEffect(()=>{fetch("/auth/membership/available").then(v=>v.json()).then(v=>p(v.available===!0)).catch(()=>{})},[]);const m=async v=>{v.preventDefault(),f(null),u(!0);try{const x=await fetch("/auth/membership/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,password:s})}),b=await x.json().catch(()=>({}));if(!x.ok){f(b.error||"Login failed"),u(!1);return}window.location.reload()}catch(x){f("Connection error: "+x.message),u(!1)}},y=async()=>{f(null),u(!0);try{const v=await fetch("/auth/local/login",{method:"POST",credentials:"include"}),x=await v.json().catch(()=>({}));if(!v.ok){f(x.error||"Local login failed"),u(!1);return}window.location.href="/"}catch(v){f("Connection error: "+v.message),u(!1)}};return o.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[o.jsx("div",{className:"flex justify-end p-4",children:o.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?o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})}),o.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:o.jsxs("div",{className:"w-full max-w-sm",children:[o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:o.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-sm ring-1 ring-accent-400/20",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),d&&o.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:d}),g&&o.jsxs("form",{onSubmit:m,className:"space-y-3 mb-4",children:[o.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:a,onChange:v=>i(v.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-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),o.jsx("input",{type:"password",placeholder:r("login.password_placeholder","Password"),value:s,onChange:v=>l(v.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-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),o.jsx("button",{type:"submit",disabled:c,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:c?r("login.signing_in","Signing in..."):n("login.sign_in")})]}),g&&o.jsxs("div",{className:"flex items-center gap-3 my-4",children:[o.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),o.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),o.jsxs("button",{type:"button",onClick:y,disabled:c,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 disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),r("login.sign_in_locally","Sign in locally")]}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function iW({user:e,onLogout:t,onSkillManagement:n,onAgentManagement:r,onPricingSettings:a,onDlpSettings:i,onSettings:s}){const{t:l}=Rt(),[c,u]=h.useState(!1),d=h.useRef(null);if(h.useEffect(()=>{if(!c)return;function g(p){d.current&&!d.current.contains(p.target)&&u(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!e)return null;const f=(e.name||e.email||"?").split(" ").map(g=>g[0]).join("").slice(0,2).toUpperCase();return o.jsxs("div",{className:"relative",ref:d,children:[o.jsxs("button",{onClick:()=>u(!c),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||l("user_menu.title"),children:[e.picture?o.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):o.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:o.jsx("span",{className:"text-white text-xs font-semibold",children:f})}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),o.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),c&&o.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:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[o.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&o.jsxs("button",{type:"button",onClick:()=>{u(!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:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),l("user_menu.skills")]}),r&&o.jsxs("button",{onClick:()=>{u(!1),r()},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:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),l("user_menu.agents")]}),a&&o.jsxs("button",{onClick:()=>{u(!1),a()},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:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l("user_menu.pricing")]}),i&&o.jsxs("button",{onClick:()=>{u(!1),i()},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:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),l("user_menu.privacy_dlp")]}),s&&o.jsxs("button",{onClick:()=>{u(!1),s()},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:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.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"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),l("user_menu.settings")]}),t&&o.jsx("button",{onClick:()=>{u(!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:l("user_menu.sign_out")})]})]})}function nI({toolParts:e}){const{t}=Rt();return!e||e.length===0?o.jsxs("div",{className:"p-4",children:[o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):o.jsxs("div",{className:"p-4",children:[o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),o.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>o.jsx(sW,{part:n},n.id))})]})}function sW({part:e}){var a,i;const t=((a=e.state)==null?void 0:a.status)||"running",n=((i=e.state)==null?void 0:i.input)||{},r=oW(e.tool,n);return o.jsxs("div",{className:"flex items-center gap-2 py-1",children:[o.jsxs("div",{className:"flex-shrink-0",children:[t==="running"&&o.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&o.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&o.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&o.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:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),o.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 oW(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+Su(t.filePath);case"Write":return"Writing "+Su(t.filePath);case"Edit":return"Editing "+Su(t.filePath);case"Bash":{const n=t.command||"";return k2(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+Ab(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+Ab(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return lW(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+Su(t.filePath):t.command?k2(t.command):"Running "+e.toLowerCase()}}function Su(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 k2(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 "+Ab(n,20)}function lW(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 Ab(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const Ib=10,Mb=24,_2=2,cW=14,rI="pave-terminal-font-size";function uW(){try{const e=localStorage.getItem(rI);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=Ib&&t<=Mb)return t}}catch{}return cW}function aI({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=Rt();const i=h.useRef(null),s=h.useRef(null),l=h.useRef(null),[c,u]=h.useState(uW),d=h.useCallback(()=>{u(y=>Math.max(Ib,y-_2))},[]),f=h.useCallback(()=>{u(y=>Math.min(Mb,y+_2))},[]);h.useEffect(()=>{try{localStorage.setItem(rI,String(c))}catch{}},[c]);const g=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"},p=`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`;h.useEffect(()=>{i.current&&!t&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]);const m=h.useCallback(()=>{const y=s.current;if(!y)return;const v=y.getContext("2d");if(!v)return;const x=()=>{const S=y.parentElement;if(S&&S.clientWidth>0&&S.clientHeight>0){y.width=S.clientWidth,y.height=S.clientHeight;return}const M=y.getBoundingClientRect();if(M.width>0&&M.height>0){y.width=M.width,y.height=M.height;return}y.width=0,y.height=0};x();const b=c;let k=Math.floor(y.width/b),N=new Array(k).fill(1);const _="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",w=()=>{v.fillStyle="rgba(0, 0, 0, 0.05)",v.fillRect(0,0,y.width,y.height),v.fillStyle="#0F0",v.font=b+"px monospace";for(let S=0;S<N.length;S++){const M=_.charAt(Math.floor(Math.random()*_.length));v.fillText(M,S*b,N[S]*b),N[S]*b>y.height&&Math.random()>.975&&(N[S]=0),N[S]++}l.current=requestAnimationFrame(w)},E=()=>{x(),k=Math.floor(y.width/b);const S=new Array(k).fill(0);for(let M=0;M<Math.min(N.length,S.length);M++)S[M]=N[M];N=S};return window.addEventListener("resize",E),l.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",E),l.current&&cancelAnimationFrame(l.current)}},[c]);return h.useEffect(()=>{let y;return t?y=m():l.current&&(cancelAnimationFrame(l.current),l.current=null),()=>{y&&y(),l.current&&(cancelAnimationFrame(l.current),l.current=null)}},[t,m]),e&&e.some(y=>{var v;return(((v=y.state)==null?void 0:v.status)||"running")==="running"}),o.jsxs("div",{className:`flex flex-col h-full ${g.bg} font-mono`,style:{fontSize:c+"px"},children:[o.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${g.headerBg} border-b ${g.headerBorder} flex-shrink-0`,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),o.jsx("span",{className:`${g.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:d,disabled:c<=Ib,className:p,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),o.jsx("button",{type:"button",onClick:f,disabled:c>=Mb,className:p,"aria-label":a("terminal.increase_font"),title:a("terminal.increase_font"),children:"A+"})]})]}),o.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?o.jsxs(o.Fragment,{children:[o.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&o.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(y=>o.jsx(fW,{part:y},y.id))})]}):o.jsx("div",{ref:i,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?o.jsxs("div",{children:[o.jsxs("div",{className:g.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]}),o.jsx("p",{className:`${g.waitingText} mt-2`,children:"Awaiting commands..."})]}):o.jsxs(o.Fragment,{children:[e.map(y=>o.jsx(dW,{part:y,theme:g},y.id)),o.jsxs("div",{className:g.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function dW({part:e,theme:t}){var{t:n}=Rt();const{tool:r,state:a}=e;if(!a)return null;const i=a.status||"running",l=pf(r||a.title,a.input)||r||a.title||"unknown",c=a.output?ls(typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)):null;return o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:`${t.commandColor} break-all`,children:[o.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),l]}),i==="running"&&o.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),i==="completed"&&c&&o.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:c}),i==="completed"&&!c&&o.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),i==="error"&&o.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",a.error?ls(typeof a.error=="string"?a.error:a.error.message||n("common.error")):n("common.unknown_error")]}),i==="pending_confirmation"&&o.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function fW({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",i=pf(t||n.title,n.input)||t||n.title||"unknown",s={running:"text-yellow-400",completed:"text-green-400",error:"text-red-400",pending_confirmation:"text-blue-400"},l={running:"RUN",completed:"OK",error:"ERR",pending_confirmation:"WAIT"};return o.jsxs("div",{className:"text-xs font-mono truncate",children:[o.jsxs("span",{className:s[r]||"text-gray-400",children:["[",l[r]||r,"]"]}),o.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",i]})]})}function E1(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 sp,w2;function gW(){if(w2)return sp;w2=1;function e(){this.__data__=[],this.size=0}return sp=e,sp}var op,E2;function Lo(){if(E2)return op;E2=1;function e(t,n){return t===n||t!==t&&n!==n}return op=e,op}var lp,S2;function mf(){if(S2)return lp;S2=1;var e=Lo();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return lp=t,lp}var cp,N2;function pW(){if(N2)return cp;N2=1;var e=mf(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,s=e(i,a);if(s<0)return!1;var l=i.length-1;return s==l?i.pop():n.call(i,s,1),--this.size,!0}return cp=r,cp}var up,C2;function hW(){if(C2)return up;C2=1;var e=mf();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return up=t,up}var dp,j2;function mW(){if(j2)return dp;j2=1;var e=mf();function t(n){return e(this.__data__,n)>-1}return dp=t,dp}var fp,T2;function xW(){if(T2)return fp;T2=1;var e=mf();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return fp=t,fp}var gp,R2;function xf(){if(R2)return gp;R2=1;var e=gW(),t=pW(),n=hW(),r=mW(),a=xW();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,gp=i,gp}var pp,A2;function yW(){if(A2)return pp;A2=1;var e=xf();function t(){this.__data__=new e,this.size=0}return pp=t,pp}var hp,I2;function bW(){if(I2)return hp;I2=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return hp=e,hp}var mp,M2;function vW(){if(M2)return mp;M2=1;function e(t){return this.__data__.get(t)}return mp=e,mp}var xp,L2;function kW(){if(L2)return xp;L2=1;function e(t){return this.__data__.has(t)}return xp=e,xp}var yp,O2;function iI(){if(O2)return yp;O2=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return yp=e,yp}var bp,D2;function ca(){if(D2)return bp;D2=1;var e=iI(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return bp=n,bp}var vp,P2;function Oo(){if(P2)return vp;P2=1;var e=ca(),t=e.Symbol;return vp=t,vp}var kp,F2;function _W(){if(F2)return kp;F2=1;var e=Oo(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(s){var l=n.call(s,a),c=s[a];try{s[a]=void 0;var u=!0}catch{}var d=r.call(s);return u&&(l?s[a]=c:delete s[a]),d}return kp=i,kp}var _p,B2;function wW(){if(B2)return _p;B2=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return _p=n,_p}var wp,z2;function ws(){if(z2)return wp;z2=1;var e=Oo(),t=_W(),n=wW(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?a:r:i&&i in Object(l)?t(l):n(l)}return wp=s,wp}var Ep,U2;function Vr(){if(U2)return Ep;U2=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ep=e,Ep}var Sp,$2;function wc(){if($2)return Sp;$2=1;var e=ws(),t=Vr(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(l){if(!t(l))return!1;var c=e(l);return c==r||c==a||c==n||c==i}return Sp=s,Sp}var Np,H2;function EW(){if(H2)return Np;H2=1;var e=ca(),t=e["__core-js_shared__"];return Np=t,Np}var Cp,q2;function SW(){if(q2)return Cp;q2=1;var e=EW(),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 Cp=n,Cp}var jp,W2;function sI(){if(W2)return jp;W2=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 jp=n,jp}var Tp,V2;function NW(){if(V2)return Tp;V2=1;var e=wc(),t=SW(),n=Vr(),r=sI(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(g){if(!n(g)||t(g))return!1;var p=e(g)?d:i;return p.test(r(g))}return Tp=f,Tp}var Rp,G2;function CW(){if(G2)return Rp;G2=1;function e(t,n){return t==null?void 0:t[n]}return Rp=e,Rp}var Ap,K2;function Es(){if(K2)return Ap;K2=1;var e=NW(),t=CW();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return Ap=n,Ap}var Ip,Y2;function S1(){if(Y2)return Ip;Y2=1;var e=Es(),t=ca(),n=e(t,"Map");return Ip=n,Ip}var Mp,X2;function yf(){if(X2)return Mp;X2=1;var e=Es(),t=e(Object,"create");return Mp=t,Mp}var Lp,Q2;function jW(){if(Q2)return Lp;Q2=1;var e=yf();function t(){this.__data__=e?e(null):{},this.size=0}return Lp=t,Lp}var Op,Z2;function TW(){if(Z2)return Op;Z2=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Op=e,Op}var Dp,J2;function RW(){if(J2)return Dp;J2=1;var e=yf(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var s=this.__data__;if(e){var l=s[i];return l===t?void 0:l}return r.call(s,i)?s[i]:void 0}return Dp=a,Dp}var Pp,eE;function AW(){if(eE)return Pp;eE=1;var e=yf(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Pp=r,Pp}var Fp,tE;function IW(){if(tE)return Fp;tE=1;var e=yf(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return Fp=n,Fp}var Bp,nE;function MW(){if(nE)return Bp;nE=1;var e=jW(),t=TW(),n=RW(),r=AW(),a=IW();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Bp=i,Bp}var zp,rE;function LW(){if(rE)return zp;rE=1;var e=MW(),t=xf(),n=S1();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return zp=r,zp}var Up,aE;function OW(){if(aE)return Up;aE=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Up=e,Up}var $p,iE;function bf(){if(iE)return $p;iE=1;var e=OW();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return $p=t,$p}var Hp,sE;function DW(){if(sE)return Hp;sE=1;var e=bf();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Hp=t,Hp}var qp,oE;function PW(){if(oE)return qp;oE=1;var e=bf();function t(n){return e(this,n).get(n)}return qp=t,qp}var Wp,lE;function FW(){if(lE)return Wp;lE=1;var e=bf();function t(n){return e(this,n).has(n)}return Wp=t,Wp}var Vp,cE;function BW(){if(cE)return Vp;cE=1;var e=bf();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return Vp=t,Vp}var Gp,uE;function N1(){if(uE)return Gp;uE=1;var e=LW(),t=DW(),n=PW(),r=FW(),a=BW();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Gp=i,Gp}var Kp,dE;function zW(){if(dE)return Kp;dE=1;var e=xf(),t=S1(),n=N1(),r=200;function a(i,s){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<r-1)return c.push([i,s]),this.size=++l.size,this;l=this.__data__=new n(c)}return l.set(i,s),this.size=l.size,this}return Kp=a,Kp}var Yp,fE;function vf(){if(fE)return Yp;fE=1;var e=xf(),t=yW(),n=bW(),r=vW(),a=kW(),i=zW();function s(l){var c=this.__data__=new e(l);this.size=c.size}return s.prototype.clear=t,s.prototype.delete=n,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,Yp=s,Yp}var Xp,gE;function C1(){if(gE)return Xp;gE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Xp=e,Xp}var Qp,pE;function oI(){if(pE)return Qp;pE=1;var e=Es(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return Qp=t,Qp}var Zp,hE;function kf(){if(hE)return Zp;hE=1;var e=oI();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Zp=t,Zp}var Jp,mE;function _f(){if(mE)return Jp;mE=1;var e=kf(),t=Lo(),n=Object.prototype,r=n.hasOwnProperty;function a(i,s,l){var c=i[s];(!(r.call(i,s)&&t(c,l))||l===void 0&&!(s in i))&&e(i,s,l)}return Jp=a,Jp}var eh,xE;function Ec(){if(xE)return eh;xE=1;var e=_f(),t=kf();function n(r,a,i,s){var l=!i;i||(i={});for(var c=-1,u=a.length;++c<u;){var d=a[c],f=s?s(i[d],r[d],d,i,r):void 0;f===void 0&&(f=r[d]),l?t(i,d,f):e(i,d,f)}return i}return eh=n,eh}var th,yE;function UW(){if(yE)return th;yE=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return th=e,th}var nh,bE;function Ca(){if(bE)return nh;bE=1;function e(t){return t!=null&&typeof t=="object"}return nh=e,nh}var rh,vE;function $W(){if(vE)return rh;vE=1;var e=ws(),t=Ca(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return rh=r,rh}var ah,kE;function Sc(){if(kE)return ah;kE=1;var e=$W(),t=Ca(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(s){return t(s)&&r.call(s,"callee")&&!a.call(s,"callee")};return ah=i,ah}var ih,_E;function En(){if(_E)return ih;_E=1;var e=Array.isArray;return ih=e,ih}var ul={exports:{}},sh,wE;function HW(){if(wE)return sh;wE=1;function e(){return!1}return sh=e,sh}ul.exports;var EE;function Do(){return EE||(EE=1,function(e,t){var n=ca(),r=HW(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===a,l=s?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u}(ul,ul.exports)),ul.exports}var oh,SE;function wf(){if(SE)return oh;SE=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return oh=n,oh}var lh,NE;function j1(){if(NE)return lh;NE=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return lh=t,lh}var ch,CE;function qW(){if(CE)return ch;CE=1;var e=ws(),t=j1(),n=Ca(),r="[object Arguments]",a="[object Array]",i="[object Boolean]",s="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",g="[object RegExp]",p="[object Set]",m="[object String]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",N="[object Int8Array]",_="[object Int16Array]",w="[object Int32Array]",E="[object Uint8Array]",S="[object Uint8ClampedArray]",M="[object Uint16Array]",j="[object Uint32Array]",F={};F[b]=F[k]=F[N]=F[_]=F[w]=F[E]=F[S]=F[M]=F[j]=!0,F[r]=F[a]=F[v]=F[i]=F[x]=F[s]=F[l]=F[c]=F[u]=F[d]=F[f]=F[g]=F[p]=F[m]=F[y]=!1;function P(W){return n(W)&&t(W.length)&&!!F[e(W)]}return ch=P,ch}var uh,jE;function Ef(){if(jE)return uh;jE=1;function e(t){return function(n){return t(n)}}return uh=e,uh}var dl={exports:{}};dl.exports;var TE;function T1(){return TE||(TE=1,function(e,t){var n=iI(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,s=i&&n.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=l}(dl,dl.exports)),dl.exports}var dh,RE;function Nc(){if(RE)return dh;RE=1;var e=qW(),t=Ef(),n=T1(),r=n&&n.isTypedArray,a=r?t(r):e;return dh=a,dh}var fh,AE;function lI(){if(AE)return fh;AE=1;var e=UW(),t=Sc(),n=En(),r=Do(),a=wf(),i=Nc(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=n(u),g=!f&&t(u),p=!f&&!g&&r(u),m=!f&&!g&&!p&&i(u),y=f||g||p||m,v=y?e(u.length,String):[],x=v.length;for(var b in u)(d||l.call(u,b))&&!(y&&(b=="length"||p&&(b=="offset"||b=="parent")||m&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||a(b,x)))&&v.push(b);return v}return fh=c,fh}var gh,IE;function Sf(){if(IE)return gh;IE=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return gh=t,gh}var ph,ME;function cI(){if(ME)return ph;ME=1;function e(t,n){return function(r){return t(n(r))}}return ph=e,ph}var hh,LE;function WW(){if(LE)return hh;LE=1;var e=cI(),t=e(Object.keys,Object);return hh=t,hh}var mh,OE;function R1(){if(OE)return mh;OE=1;var e=Sf(),t=WW(),n=Object.prototype,r=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var s=[];for(var l in Object(i))r.call(i,l)&&l!="constructor"&&s.push(l);return s}return mh=a,mh}var xh,DE;function Qa(){if(DE)return xh;DE=1;var e=wc(),t=j1();function n(r){return r!=null&&t(r.length)&&!e(r)}return xh=n,xh}var yh,PE;function Ui(){if(PE)return yh;PE=1;var e=lI(),t=R1(),n=Qa();function r(a){return n(a)?e(a):t(a)}return yh=r,yh}var bh,FE;function VW(){if(FE)return bh;FE=1;var e=Ec(),t=Ui();function n(r,a){return r&&e(a,t(a),r)}return bh=n,bh}var vh,BE;function GW(){if(BE)return vh;BE=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return vh=e,vh}var kh,zE;function KW(){if(zE)return kh;zE=1;var e=Vr(),t=Sf(),n=GW(),r=Object.prototype,a=r.hasOwnProperty;function i(s){if(!e(s))return n(s);var l=t(s),c=[];for(var u in s)u=="constructor"&&(l||!a.call(s,u))||c.push(u);return c}return kh=i,kh}var _h,UE;function Ss(){if(UE)return _h;UE=1;var e=lI(),t=KW(),n=Qa();function r(a){return n(a)?e(a,!0):t(a)}return _h=r,_h}var wh,$E;function YW(){if($E)return wh;$E=1;var e=Ec(),t=Ss();function n(r,a){return r&&e(a,t(a),r)}return wh=n,wh}var fl={exports:{}};fl.exports;var HE;function uI(){return HE||(HE=1,function(e,t){var n=ca(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,s=i?n.Buffer:void 0,l=s?s.allocUnsafe:void 0;function c(u,d){if(d)return u.slice();var f=u.length,g=l?l(f):new u.constructor(f);return u.copy(g),g}e.exports=c}(fl,fl.exports)),fl.exports}var Eh,qE;function dI(){if(qE)return Eh;qE=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return Eh=e,Eh}var Sh,WE;function fI(){if(WE)return Sh;WE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=0,s=[];++r<a;){var l=t[r];n(l,r,t)&&(s[i++]=l)}return s}return Sh=e,Sh}var Nh,VE;function gI(){if(VE)return Nh;VE=1;function e(){return[]}return Nh=e,Nh}var Ch,GE;function A1(){if(GE)return Ch;GE=1;var e=fI(),t=gI(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(s){return s==null?[]:(s=Object(s),e(a(s),function(l){return r.call(s,l)}))}:t;return Ch=i,Ch}var jh,KE;function XW(){if(KE)return jh;KE=1;var e=Ec(),t=A1();function n(r,a){return e(r,t(r),a)}return jh=n,jh}var Th,YE;function I1(){if(YE)return Th;YE=1;function e(t,n){for(var r=-1,a=n.length,i=t.length;++r<a;)t[i+r]=n[r];return t}return Th=e,Th}var Rh,XE;function Nf(){if(XE)return Rh;XE=1;var e=cI(),t=e(Object.getPrototypeOf,Object);return Rh=t,Rh}var Ah,QE;function pI(){if(QE)return Ah;QE=1;var e=I1(),t=Nf(),n=A1(),r=gI(),a=Object.getOwnPropertySymbols,i=a?function(s){for(var l=[];s;)e(l,n(s)),s=t(s);return l}:r;return Ah=i,Ah}var Ih,ZE;function QW(){if(ZE)return Ih;ZE=1;var e=Ec(),t=pI();function n(r,a){return e(r,t(r),a)}return Ih=n,Ih}var Mh,JE;function hI(){if(JE)return Mh;JE=1;var e=I1(),t=En();function n(r,a,i){var s=a(r);return t(r)?s:e(s,i(r))}return Mh=n,Mh}var Lh,eS;function mI(){if(eS)return Lh;eS=1;var e=hI(),t=A1(),n=Ui();function r(a){return e(a,n,t)}return Lh=r,Lh}var Oh,tS;function ZW(){if(tS)return Oh;tS=1;var e=hI(),t=pI(),n=Ss();function r(a){return e(a,n,t)}return Oh=r,Oh}var Dh,nS;function JW(){if(nS)return Dh;nS=1;var e=Es(),t=ca(),n=e(t,"DataView");return Dh=n,Dh}var Ph,rS;function eV(){if(rS)return Ph;rS=1;var e=Es(),t=ca(),n=e(t,"Promise");return Ph=n,Ph}var Fh,aS;function xI(){if(aS)return Fh;aS=1;var e=Es(),t=ca(),n=e(t,"Set");return Fh=n,Fh}var Bh,iS;function tV(){if(iS)return Bh;iS=1;var e=Es(),t=ca(),n=e(t,"WeakMap");return Bh=n,Bh}var zh,sS;function Po(){if(sS)return zh;sS=1;var e=JW(),t=S1(),n=eV(),r=xI(),a=tV(),i=ws(),s=sI(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",g="[object DataView]",p=s(e),m=s(t),y=s(n),v=s(r),x=s(a),b=i;return(e&&b(new e(new ArrayBuffer(1)))!=g||t&&b(new t)!=l||n&&b(n.resolve())!=u||r&&b(new r)!=d||a&&b(new a)!=f)&&(b=function(k){var N=i(k),_=N==c?k.constructor:void 0,w=_?s(_):"";if(w)switch(w){case p:return g;case m:return l;case y:return u;case v:return d;case x:return f}return N}),zh=b,zh}var Uh,oS;function nV(){if(oS)return Uh;oS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,i=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(i.index=r.index,i.input=r.input),i}return Uh=n,Uh}var $h,lS;function yI(){if(lS)return $h;lS=1;var e=ca(),t=e.Uint8Array;return $h=t,$h}var Hh,cS;function M1(){if(cS)return Hh;cS=1;var e=yI();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Hh=t,Hh}var qh,uS;function rV(){if(uS)return qh;uS=1;var e=M1();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return qh=t,qh}var Wh,dS;function aV(){if(dS)return Wh;dS=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Wh=t,Wh}var Vh,fS;function iV(){if(fS)return Vh;fS=1;var e=Oo(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Vh=r,Vh}var Gh,gS;function bI(){if(gS)return Gh;gS=1;var e=M1();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Gh=t,Gh}var Kh,pS;function sV(){if(pS)return Kh;pS=1;var e=M1(),t=rV(),n=aV(),r=iV(),a=bI(),i="[object Boolean]",s="[object Date]",l="[object Map]",c="[object Number]",u="[object RegExp]",d="[object Set]",f="[object String]",g="[object Symbol]",p="[object ArrayBuffer]",m="[object DataView]",y="[object Float32Array]",v="[object Float64Array]",x="[object Int8Array]",b="[object Int16Array]",k="[object Int32Array]",N="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",E="[object Uint32Array]";function S(M,j,F){var P=M.constructor;switch(j){case p:return e(M);case i:case s:return new P(+M);case m:return t(M,F);case y:case v:case x:case b:case k:case N:case _:case w:case E:return a(M,F);case l:return new P;case c:case f:return new P(M);case u:return n(M);case d:return new P;case g:return r(M)}}return Kh=S,Kh}var Yh,hS;function vI(){if(hS)return Yh;hS=1;var e=Vr(),t=Object.create,n=function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var i=new r;return r.prototype=void 0,i}}();return Yh=n,Yh}var Xh,mS;function kI(){if(mS)return Xh;mS=1;var e=vI(),t=Nf(),n=Sf();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Xh=r,Xh}var Qh,xS;function oV(){if(xS)return Qh;xS=1;var e=Po(),t=Ca(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Qh=r,Qh}var Zh,yS;function lV(){if(yS)return Zh;yS=1;var e=oV(),t=Ef(),n=T1(),r=n&&n.isMap,a=r?t(r):e;return Zh=a,Zh}var Jh,bS;function cV(){if(bS)return Jh;bS=1;var e=Po(),t=Ca(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return Jh=r,Jh}var em,vS;function uV(){if(vS)return em;vS=1;var e=cV(),t=Ef(),n=T1(),r=n&&n.isSet,a=r?t(r):e;return em=a,em}var tm,kS;function _I(){if(kS)return tm;kS=1;var e=vf(),t=C1(),n=_f(),r=VW(),a=YW(),i=uI(),s=dI(),l=XW(),c=QW(),u=mI(),d=ZW(),f=Po(),g=nV(),p=sV(),m=kI(),y=En(),v=Do(),x=lV(),b=Vr(),k=uV(),N=Ui(),_=Ss(),w=1,E=2,S=4,M="[object Arguments]",j="[object Array]",F="[object Boolean]",P="[object Date]",W="[object Error]",O="[object Function]",I="[object GeneratorFunction]",T="[object Map]",L="[object Number]",$="[object Object]",Z="[object RegExp]",R="[object Set]",Y="[object String]",V="[object Symbol]",A="[object WeakMap]",H="[object ArrayBuffer]",ce="[object DataView]",ee="[object Float32Array]",Me="[object Float64Array]",X="[object Int8Array]",ye="[object Int16Array]",Oe="[object Int32Array]",Ee="[object Uint8Array]",de="[object Uint8ClampedArray]",Se="[object Uint16Array]",Ae="[object Uint32Array]",me={};me[M]=me[j]=me[H]=me[ce]=me[F]=me[P]=me[ee]=me[Me]=me[X]=me[ye]=me[Oe]=me[T]=me[L]=me[$]=me[Z]=me[R]=me[Y]=me[V]=me[Ee]=me[de]=me[Se]=me[Ae]=!0,me[W]=me[O]=me[A]=!1;function ve(De,K,we,Te,ge,xe){var he,fe=K&w,pe=K&E,U=K&S;if(we&&(he=ge?we(De,Te,ge,xe):we(De)),he!==void 0)return he;if(!b(De))return De;var D=y(De);if(D){if(he=g(De),!fe)return s(De,he)}else{var G=f(De),le=G==O||G==I;if(v(De))return i(De,fe);if(G==$||G==M||le&&!ge){if(he=pe||le?{}:m(De),!fe)return pe?c(De,a(he,De)):l(De,r(he,De))}else{if(!me[G])return ge?De:{};he=p(De,G,fe)}}xe||(xe=new e);var je=xe.get(De);if(je)return je;xe.set(De,he),k(De)?De.forEach(function(Qe){he.add(ve(Qe,K,we,Qe,De,xe))}):x(De)&&De.forEach(function(Qe,Ye){he.set(Ye,ve(Qe,K,we,Ye,De,xe))});var $e=U?pe?d:u:pe?_:N,Ve=D?void 0:$e(De);return t(Ve||De,function(Qe,Ye){Ve&&(Ye=Qe,Qe=De[Ye]),n(he,Ye,ve(Qe,K,we,Ye,De,xe))}),he}return tm=ve,tm}var nm,_S;function dV(){if(_S)return nm;_S=1;var e=_I(),t=4;function n(r){return e(r,t)}return nm=n,nm}var rm,wS;function L1(){if(wS)return rm;wS=1;function e(t){return function(){return t}}return rm=e,rm}var am,ES;function fV(){if(ES)return am;ES=1;function e(t){return function(n,r,a){for(var i=-1,s=Object(n),l=a(n),c=l.length;c--;){var u=l[t?c:++i];if(r(s[u],u,s)===!1)break}return n}}return am=e,am}var im,SS;function O1(){if(SS)return im;SS=1;var e=fV(),t=e();return im=t,im}var sm,NS;function D1(){if(NS)return sm;NS=1;var e=O1(),t=Ui();function n(r,a){return r&&e(r,a,t)}return sm=n,sm}var om,CS;function gV(){if(CS)return om;CS=1;var e=Qa();function t(n,r){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var s=a.length,l=r?s:-1,c=Object(a);(r?l--:++l<s)&&i(c[l],l,c)!==!1;);return a}}return om=t,om}var lm,jS;function Cf(){if(jS)return lm;jS=1;var e=D1(),t=gV(),n=t(e);return lm=n,lm}var cm,TS;function Ns(){if(TS)return cm;TS=1;function e(t){return t}return cm=e,cm}var um,RS;function wI(){if(RS)return um;RS=1;var e=Ns();function t(n){return typeof n=="function"?n:e}return um=t,um}var dm,AS;function EI(){if(AS)return dm;AS=1;var e=C1(),t=Cf(),n=wI(),r=En();function a(i,s){var l=r(i)?e:t;return l(i,n(s))}return dm=a,dm}var fm,IS;function SI(){return IS||(IS=1,fm=EI()),fm}var gm,MS;function pV(){if(MS)return gm;MS=1;var e=Cf();function t(n,r){var a=[];return e(n,function(i,s,l){r(i,s,l)&&a.push(i)}),a}return gm=t,gm}var pm,LS;function hV(){if(LS)return pm;LS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return pm=t,pm}var hm,OS;function mV(){if(OS)return hm;OS=1;function e(t){return this.__data__.has(t)}return hm=e,hm}var mm,DS;function NI(){if(DS)return mm;DS=1;var e=N1(),t=hV(),n=mV();function r(a){var i=-1,s=a==null?0:a.length;for(this.__data__=new e;++i<s;)this.add(a[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,mm=r,mm}var xm,PS;function xV(){if(PS)return xm;PS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return xm=e,xm}var ym,FS;function CI(){if(FS)return ym;FS=1;function e(t,n){return t.has(n)}return ym=e,ym}var bm,BS;function jI(){if(BS)return bm;BS=1;var e=NI(),t=xV(),n=CI(),r=1,a=2;function i(s,l,c,u,d,f){var g=c&r,p=s.length,m=l.length;if(p!=m&&!(g&&m>p))return!1;var y=f.get(s),v=f.get(l);if(y&&v)return y==l&&v==s;var x=-1,b=!0,k=c&a?new e:void 0;for(f.set(s,l),f.set(l,s);++x<p;){var N=s[x],_=l[x];if(u)var w=g?u(_,N,x,l,s,f):u(N,_,x,s,l,f);if(w!==void 0){if(w)continue;b=!1;break}if(k){if(!t(l,function(E,S){if(!n(k,S)&&(N===E||d(N,E,c,u,f)))return k.push(S)})){b=!1;break}}else if(!(N===_||d(N,_,c,u,f))){b=!1;break}}return f.delete(s),f.delete(l),b}return bm=i,bm}var vm,zS;function yV(){if(zS)return vm;zS=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return vm=e,vm}var km,US;function P1(){if(US)return km;US=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return km=e,km}var _m,$S;function bV(){if($S)return _m;$S=1;var e=Oo(),t=yI(),n=Lo(),r=jI(),a=yV(),i=P1(),s=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",g="[object Number]",p="[object RegExp]",m="[object Set]",y="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",b="[object DataView]",k=e?e.prototype:void 0,N=k?k.valueOf:void 0;function _(w,E,S,M,j,F,P){switch(S){case b:if(w.byteLength!=E.byteLength||w.byteOffset!=E.byteOffset)return!1;w=w.buffer,E=E.buffer;case x:return!(w.byteLength!=E.byteLength||!F(new t(w),new t(E)));case c:case u:case g:return n(+w,+E);case d:return w.name==E.name&&w.message==E.message;case p:case y:return w==E+"";case f:var W=a;case m:var O=M&s;if(W||(W=i),w.size!=E.size&&!O)return!1;var I=P.get(w);if(I)return I==E;M|=l,P.set(w,E);var T=r(W(w),W(E),M,j,F,P);return P.delete(w),T;case v:if(N)return N.call(w)==N.call(E)}return!1}return _m=_,_m}var wm,HS;function vV(){if(HS)return wm;HS=1;var e=mI(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,s,l,c,u,d){var f=l&t,g=e(i),p=g.length,m=e(s),y=m.length;if(p!=y&&!f)return!1;for(var v=p;v--;){var x=g[v];if(!(f?x in s:r.call(s,x)))return!1}var b=d.get(i),k=d.get(s);if(b&&k)return b==s&&k==i;var N=!0;d.set(i,s),d.set(s,i);for(var _=f;++v<p;){x=g[v];var w=i[x],E=s[x];if(c)var S=f?c(E,w,x,s,i,d):c(w,E,x,i,s,d);if(!(S===void 0?w===E||u(w,E,l,c,d):S)){N=!1;break}_||(_=x=="constructor")}if(N&&!_){var M=i.constructor,j=s.constructor;M!=j&&"constructor"in i&&"constructor"in s&&!(typeof M=="function"&&M instanceof M&&typeof j=="function"&&j instanceof j)&&(N=!1)}return d.delete(i),d.delete(s),N}return wm=a,wm}var Em,qS;function kV(){if(qS)return Em;qS=1;var e=vf(),t=jI(),n=bV(),r=vV(),a=Po(),i=En(),s=Do(),l=Nc(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",g=Object.prototype,p=g.hasOwnProperty;function m(y,v,x,b,k,N){var _=i(y),w=i(v),E=_?d:a(y),S=w?d:a(v);E=E==u?f:E,S=S==u?f:S;var M=E==f,j=S==f,F=E==S;if(F&&s(y)){if(!s(v))return!1;_=!0,M=!1}if(F&&!M)return N||(N=new e),_||l(y)?t(y,v,x,b,k,N):n(y,v,E,x,b,k,N);if(!(x&c)){var P=M&&p.call(y,"__wrapped__"),W=j&&p.call(v,"__wrapped__");if(P||W){var O=P?y.value():y,I=W?v.value():v;return N||(N=new e),k(O,I,x,b,N)}}return F?(N||(N=new e),r(y,v,x,b,k,N)):!1}return Em=m,Em}var Sm,WS;function TI(){if(WS)return Sm;WS=1;var e=kV(),t=Ca();function n(r,a,i,s,l){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,i,s,n,l)}return Sm=n,Sm}var Nm,VS;function _V(){if(VS)return Nm;VS=1;var e=vf(),t=TI(),n=1,r=2;function a(i,s,l,c){var u=l.length,d=u,f=!c;if(i==null)return!d;for(i=Object(i);u--;){var g=l[u];if(f&&g[2]?g[1]!==i[g[0]]:!(g[0]in i))return!1}for(;++u<d;){g=l[u];var p=g[0],m=i[p],y=g[1];if(f&&g[2]){if(m===void 0&&!(p in i))return!1}else{var v=new e;if(c)var x=c(m,y,p,i,s,v);if(!(x===void 0?t(y,m,n|r,c,v):x))return!1}}return!0}return Nm=a,Nm}var Cm,GS;function RI(){if(GS)return Cm;GS=1;var e=Vr();function t(n){return n===n&&!e(n)}return Cm=t,Cm}var jm,KS;function wV(){if(KS)return jm;KS=1;var e=RI(),t=Ui();function n(r){for(var a=t(r),i=a.length;i--;){var s=a[i],l=r[s];a[i]=[s,l,e(l)]}return a}return jm=n,jm}var Tm,YS;function AI(){if(YS)return Tm;YS=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Tm=e,Tm}var Rm,XS;function EV(){if(XS)return Rm;XS=1;var e=_V(),t=wV(),n=AI();function r(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(s){return s===a||e(s,a,i)}}return Rm=r,Rm}var Am,QS;function Fo(){if(QS)return Am;QS=1;var e=ws(),t=Ca(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Am=r,Am}var Im,ZS;function F1(){if(ZS)return Im;ZS=1;var e=En(),t=Fo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,s){if(e(i))return!1;var l=typeof i;return l=="number"||l=="symbol"||l=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||s!=null&&i in Object(s)}return Im=a,Im}var Mm,JS;function SV(){if(JS)return Mm;JS=1;var e=N1(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var s=arguments,l=a?a.apply(this,s):s[0],c=i.cache;if(c.has(l))return c.get(l);var u=r.apply(this,s);return i.cache=c.set(l,u)||c,u};return i.cache=new(n.Cache||e),i}return n.Cache=e,Mm=n,Mm}var Lm,eN;function NV(){if(eN)return Lm;eN=1;var e=SV(),t=500;function n(r){var a=e(r,function(s){return i.size===t&&i.clear(),s}),i=a.cache;return a}return Lm=n,Lm}var Om,tN;function CV(){if(tN)return Om;tN=1;var e=NV(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(s,l,c,u){i.push(c?u.replace(n,"$1"):l||s)}),i});return Om=r,Om}var Dm,nN;function jf(){if(nN)return Dm;nN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return Dm=e,Dm}var Pm,rN;function jV(){if(rN)return Pm;rN=1;var e=Oo(),t=jf(),n=En(),r=Fo(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function s(l){if(typeof l=="string")return l;if(n(l))return t(l,s)+"";if(r(l))return i?i.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return Pm=s,Pm}var Fm,aN;function II(){if(aN)return Fm;aN=1;var e=jV();function t(n){return n==null?"":e(n)}return Fm=t,Fm}var Bm,iN;function Tf(){if(iN)return Bm;iN=1;var e=En(),t=F1(),n=CV(),r=II();function a(i,s){return e(i)?i:t(i,s)?[i]:n(r(i))}return Bm=a,Bm}var zm,sN;function Cc(){if(sN)return zm;sN=1;var e=Fo();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return zm=t,zm}var Um,oN;function Rf(){if(oN)return Um;oN=1;var e=Tf(),t=Cc();function n(r,a){a=e(a,r);for(var i=0,s=a.length;r!=null&&i<s;)r=r[t(a[i++])];return i&&i==s?r:void 0}return Um=n,Um}var $m,lN;function TV(){if(lN)return $m;lN=1;var e=Rf();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return $m=t,$m}var Hm,cN;function RV(){if(cN)return Hm;cN=1;function e(t,n){return t!=null&&n in Object(t)}return Hm=e,Hm}var qm,uN;function MI(){if(uN)return qm;uN=1;var e=Tf(),t=Sc(),n=En(),r=wf(),a=j1(),i=Cc();function s(l,c,u){c=e(c,l);for(var d=-1,f=c.length,g=!1;++d<f;){var p=i(c[d]);if(!(g=l!=null&&u(l,p)))break;l=l[p]}return g||++d!=f?g:(f=l==null?0:l.length,!!f&&a(f)&&r(p,f)&&(n(l)||t(l)))}return qm=s,qm}var Wm,dN;function LI(){if(dN)return Wm;dN=1;var e=RV(),t=MI();function n(r,a){return r!=null&&t(r,a,e)}return Wm=n,Wm}var Vm,fN;function AV(){if(fN)return Vm;fN=1;var e=TI(),t=TV(),n=LI(),r=F1(),a=RI(),i=AI(),s=Cc(),l=1,c=2;function u(d,f){return r(d)&&a(f)?i(s(d),f):function(g){var p=t(g,d);return p===void 0&&p===f?n(g,d):e(f,p,l|c)}}return Vm=u,Vm}var Gm,gN;function OI(){if(gN)return Gm;gN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Gm=e,Gm}var Km,pN;function IV(){if(pN)return Km;pN=1;var e=Rf();function t(n){return function(r){return e(r,n)}}return Km=t,Km}var Ym,hN;function MV(){if(hN)return Ym;hN=1;var e=OI(),t=IV(),n=F1(),r=Cc();function a(i){return n(i)?e(r(i)):t(i)}return Ym=a,Ym}var Xm,mN;function Za(){if(mN)return Xm;mN=1;var e=EV(),t=AV(),n=Ns(),r=En(),a=MV();function i(s){return typeof s=="function"?s:s==null?n:typeof s=="object"?r(s)?t(s[0],s[1]):e(s):a(s)}return Xm=i,Xm}var Qm,xN;function DI(){if(xN)return Qm;xN=1;var e=fI(),t=pV(),n=Za(),r=En();function a(i,s){var l=r(i)?e:t;return l(i,n(s,3))}return Qm=a,Qm}var Zm,yN;function LV(){if(yN)return Zm;yN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Zm=n,Zm}var Jm,bN;function PI(){if(bN)return Jm;bN=1;var e=LV(),t=MI();function n(r,a){return r!=null&&t(r,a,e)}return Jm=n,Jm}var e0,vN;function OV(){if(vN)return e0;vN=1;var e=R1(),t=Po(),n=Sc(),r=En(),a=Qa(),i=Do(),s=Sf(),l=Nc(),c="[object Map]",u="[object Set]",d=Object.prototype,f=d.hasOwnProperty;function g(p){if(p==null)return!0;if(a(p)&&(r(p)||typeof p=="string"||typeof p.splice=="function"||i(p)||l(p)||n(p)))return!p.length;var m=t(p);if(m==c||m==u)return!p.size;if(s(p))return!e(p).length;for(var y in p)if(f.call(p,y))return!1;return!0}return e0=g,e0}var t0,kN;function FI(){if(kN)return t0;kN=1;function e(t){return t===void 0}return t0=e,t0}var n0,_N;function BI(){if(_N)return n0;_N=1;var e=Cf(),t=Qa();function n(r,a){var i=-1,s=t(r)?Array(r.length):[];return e(r,function(l,c,u){s[++i]=a(l,c,u)}),s}return n0=n,n0}var r0,wN;function zI(){if(wN)return r0;wN=1;var e=jf(),t=Za(),n=BI(),r=En();function a(i,s){var l=r(i)?e:n;return l(i,t(s,3))}return r0=a,r0}var a0,EN;function DV(){if(EN)return a0;EN=1;function e(t,n,r,a){var i=-1,s=t==null?0:t.length;for(a&&s&&(r=t[++i]);++i<s;)r=n(r,t[i],i,t);return r}return a0=e,a0}var i0,SN;function PV(){if(SN)return i0;SN=1;function e(t,n,r,a,i){return i(t,function(s,l,c){r=a?(a=!1,s):n(r,s,l,c)}),r}return i0=e,i0}var s0,NN;function UI(){if(NN)return s0;NN=1;var e=DV(),t=Cf(),n=Za(),r=PV(),a=En();function i(s,l,c){var u=a(s)?e:r,d=arguments.length<3;return u(s,n(l,4),c,d,t)}return s0=i,s0}var o0,CN;function FV(){if(CN)return o0;CN=1;var e=ws(),t=En(),n=Ca(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return o0=a,o0}var l0,jN;function BV(){if(jN)return l0;jN=1;var e=OI(),t=e("length");return l0=t,l0}var c0,TN;function zV(){if(TN)return c0;TN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+e+a+i+"]");function c(u){return l.test(u)}return c0=c,c0}var u0,RN;function UV(){if(RN)return u0;RN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",s="["+e+"]",l="["+a+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",m=u+"?",y="["+i+"]?",v="(?:"+p+"(?:"+[d,f,g].join("|")+")"+y+m+")*",x=y+m+v,b="(?:"+[d+l+"?",l,f,g,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+b+x,"g");function N(_){for(var w=k.lastIndex=0;k.test(_);)++w;return w}return u0=N,u0}var d0,AN;function $V(){if(AN)return d0;AN=1;var e=BV(),t=zV(),n=UV();function r(a){return t(a)?n(a):e(a)}return d0=r,d0}var f0,IN;function HV(){if(IN)return f0;IN=1;var e=R1(),t=Po(),n=Qa(),r=FV(),a=$V(),i="[object Map]",s="[object Set]";function l(c){if(c==null)return 0;if(n(c))return r(c)?a(c):c.length;var u=t(c);return u==i||u==s?c.size:e(c).length}return f0=l,f0}var g0,MN;function qV(){if(MN)return g0;MN=1;var e=C1(),t=vI(),n=D1(),r=Za(),a=Nf(),i=En(),s=Do(),l=wc(),c=Vr(),u=Nc();function d(f,g,p){var m=i(f),y=m||s(f)||u(f);if(g=r(g,4),p==null){var v=f&&f.constructor;y?p=m?new v:[]:c(f)?p=l(v)?t(a(f)):{}:p={}}return(y?e:n)(f,function(x,b,k){return g(p,x,b,k)}),p}return g0=d,g0}var p0,LN;function WV(){if(LN)return p0;LN=1;var e=Oo(),t=Sc(),n=En(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return p0=a,p0}var h0,ON;function B1(){if(ON)return h0;ON=1;var e=I1(),t=WV();function n(r,a,i,s,l){var c=-1,u=r.length;for(i||(i=t),l||(l=[]);++c<u;){var d=r[c];a>0&&i(d)?a>1?n(d,a-1,i,s,l):e(l,d):s||(l[l.length]=d)}return l}return h0=n,h0}var m0,DN;function VV(){if(DN)return m0;DN=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 m0=e,m0}var x0,PN;function $I(){if(PN)return x0;PN=1;var e=VV(),t=Math.max;function n(r,a,i){return a=t(a===void 0?r.length-1:a,0),function(){for(var s=arguments,l=-1,c=t(s.length-a,0),u=Array(c);++l<c;)u[l]=s[a+l];l=-1;for(var d=Array(a+1);++l<a;)d[l]=s[l];return d[a]=i(u),e(r,this,d)}}return x0=n,x0}var y0,FN;function GV(){if(FN)return y0;FN=1;var e=L1(),t=oI(),n=Ns(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return y0=r,y0}var b0,BN;function KV(){if(BN)return b0;BN=1;var e=800,t=16,n=Date.now;function r(a){var i=0,s=0;return function(){var l=n(),c=t-(l-s);if(s=l,c>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return b0=r,b0}var v0,zN;function HI(){if(zN)return v0;zN=1;var e=GV(),t=KV(),n=t(e);return v0=n,v0}var k0,UN;function Af(){if(UN)return k0;UN=1;var e=Ns(),t=$I(),n=HI();function r(a,i){return n(t(a,i,e),a+"")}return k0=r,k0}var _0,$N;function qI(){if($N)return _0;$N=1;function e(t,n,r,a){for(var i=t.length,s=r+(a?1:-1);a?s--:++s<i;)if(n(t[s],s,t))return s;return-1}return _0=e,_0}var w0,HN;function YV(){if(HN)return w0;HN=1;function e(t){return t!==t}return w0=e,w0}var E0,qN;function XV(){if(qN)return E0;qN=1;function e(t,n,r){for(var a=r-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return E0=e,E0}var S0,WN;function QV(){if(WN)return S0;WN=1;var e=qI(),t=YV(),n=XV();function r(a,i,s){return i===i?n(a,i,s):e(a,t,s)}return S0=r,S0}var N0,VN;function ZV(){if(VN)return N0;VN=1;var e=QV();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return N0=t,N0}var C0,GN;function JV(){if(GN)return C0;GN=1;function e(t,n,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(n,t[a]))return!0;return!1}return C0=e,C0}var j0,KN;function eG(){if(KN)return j0;KN=1;function e(){}return j0=e,j0}var T0,YN;function tG(){if(YN)return T0;YN=1;var e=xI(),t=eG(),n=P1(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return T0=a,T0}var R0,XN;function nG(){if(XN)return R0;XN=1;var e=NI(),t=ZV(),n=JV(),r=CI(),a=tG(),i=P1(),s=200;function l(c,u,d){var f=-1,g=t,p=c.length,m=!0,y=[],v=y;if(d)m=!1,g=n;else if(p>=s){var x=u?null:a(c);if(x)return i(x);m=!1,g=r,v=new e}else v=u?[]:y;e:for(;++f<p;){var b=c[f],k=u?u(b):b;if(b=d||b!==0?b:0,m&&k===k){for(var N=v.length;N--;)if(v[N]===k)continue e;u&&v.push(k),y.push(b)}else g(v,k,d)||(v!==y&&v.push(k),y.push(b))}return y}return R0=l,R0}var A0,QN;function WI(){if(QN)return A0;QN=1;var e=Qa(),t=Ca();function n(r){return t(r)&&e(r)}return A0=n,A0}var I0,ZN;function rG(){if(ZN)return I0;ZN=1;var e=B1(),t=Af(),n=nG(),r=WI(),a=t(function(i){return n(e(i,1,r,!0))});return I0=a,I0}var M0,JN;function aG(){if(JN)return M0;JN=1;var e=jf();function t(n,r){return e(r,function(a){return n[a]})}return M0=t,M0}var L0,eC;function VI(){if(eC)return L0;eC=1;var e=aG(),t=Ui();function n(r){return r==null?[]:e(r,t(r))}return L0=n,L0}var O0,tC;function Gr(){if(tC)return O0;tC=1;var e;if(typeof E1=="function")try{e={clone:dV(),constant:L1(),each:SI(),filter:DI(),has:PI(),isArray:En(),isEmpty:OV(),isFunction:wc(),isUndefined:FI(),keys:Ui(),map:zI(),reduce:UI(),size:HV(),transform:qV(),union:rG(),values:VI()}}catch{}return e||(e=window._),O0=e,O0}var D0,nC;function z1(){if(nC)return D0;nC=1;var e=Gr();D0=a;var t="\0",n="\0",r="";function a(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(d){return this._label=d,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(f){return e.isEmpty(d._in[f])})},a.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(f){return e.isEmpty(d._out[f])})},a.prototype.setNodes=function(d,f){var g=arguments,p=this;return e.each(d,function(m){g.length>1?p.setNode(m,f):p.setNode(m)}),this},a.prototype.setNode=function(d,f){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=f),this):(this._nodes[d]=arguments.length>1?f:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},a.prototype.node=function(d){return this._nodes[d]},a.prototype.hasNode=function(d){return e.has(this._nodes,d)},a.prototype.removeNode=function(d){var f=this;if(e.has(this._nodes,d)){var g=function(p){f.removeEdge(f._edgeObjs[p])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(p){f.setParent(p)}),delete this._children[d]),e.each(e.keys(this._in[d]),g),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),g),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},a.prototype.setParent=function(d,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=n;else{f+="";for(var g=f;!e.isUndefined(g);g=this.parent(g))if(g===d)throw new Error("Setting "+f+" as parent of "+d+" would create a cycle");this.setNode(f)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=f,this._children[f][d]=!0,this},a.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},a.prototype.parent=function(d){if(this._isCompound){var f=this._parent[d];if(f!==n)return f}},a.prototype.children=function(d){if(e.isUndefined(d)&&(d=n),this._isCompound){var f=this._children[d];if(f)return e.keys(f)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}},a.prototype.predecessors=function(d){var f=this._preds[d];if(f)return e.keys(f)},a.prototype.successors=function(d){var f=this._sucs[d];if(f)return e.keys(f)},a.prototype.neighbors=function(d){var f=this.predecessors(d);if(f)return e.union(f,this.successors(d))},a.prototype.isLeaf=function(d){var f;return this.isDirected()?f=this.successors(d):f=this.neighbors(d),f.length===0},a.prototype.filterNodes=function(d){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var g=this;e.each(this._nodes,function(y,v){d(v)&&f.setNode(v,y)}),e.each(this._edgeObjs,function(y){f.hasNode(y.v)&&f.hasNode(y.w)&&f.setEdge(y,g.edge(y))});var p={};function m(y){var v=g.parent(y);return v===void 0||f.hasNode(v)?(p[y]=v,v):v in p?p[v]:m(v)}return this._isCompound&&e.each(f.nodes(),function(y){f.setParent(y,m(y))}),f},a.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(d,f){var g=this,p=arguments;return e.reduce(d,function(m,y){return p.length>1?g.setEdge(m,y,f):g.setEdge(m,y),y}),this},a.prototype.setEdge=function(){var d,f,g,p,m=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(d=y.v,f=y.w,g=y.name,arguments.length===2&&(p=arguments[1],m=!0)):(d=y,f=arguments[1],g=arguments[3],arguments.length>2&&(p=arguments[2],m=!0)),d=""+d,f=""+f,e.isUndefined(g)||(g=""+g);var v=l(this._isDirected,d,f,g);if(e.has(this._edgeLabels,v))return m&&(this._edgeLabels[v]=p),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(f),this._edgeLabels[v]=m?p:this._defaultEdgeLabelFn(d,f,g);var x=c(this._isDirected,d,f,g);return d=x.v,f=x.w,Object.freeze(x),this._edgeObjs[v]=x,i(this._preds[f],d),i(this._sucs[d],f),this._in[f][v]=x,this._out[d][v]=x,this._edgeCount++,this},a.prototype.edge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g);return this._edgeLabels[p]},a.prototype.hasEdge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g);return e.has(this._edgeLabels,p)},a.prototype.removeEdge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g),m=this._edgeObjs[p];return m&&(d=m.v,f=m.w,delete this._edgeLabels[p],delete this._edgeObjs[p],s(this._preds[f],d),s(this._sucs[d],f),delete this._in[f][p],delete this._out[d][p],this._edgeCount--),this},a.prototype.inEdges=function(d,f){var g=this._in[d];if(g){var p=e.values(g);return f?e.filter(p,function(m){return m.v===f}):p}},a.prototype.outEdges=function(d,f){var g=this._out[d];if(g){var p=e.values(g);return f?e.filter(p,function(m){return m.w===f}):p}},a.prototype.nodeEdges=function(d,f){var g=this.inEdges(d,f);if(g)return g.concat(this.outEdges(d,f))};function i(d,f){d[f]?d[f]++:d[f]=1}function s(d,f){--d[f]||delete d[f]}function l(d,f,g,p){var m=""+f,y=""+g;if(!d&&m>y){var v=m;m=y,y=v}return m+r+y+r+(e.isUndefined(p)?t:p)}function c(d,f,g,p){var m=""+f,y=""+g;if(!d&&m>y){var v=m;m=y,y=v}var x={v:m,w:y};return p&&(x.name=p),x}function u(d,f){return l(d,f.v,f.w,f.name)}return D0}var P0,rC;function iG(){return rC||(rC=1,P0="2.1.8"),P0}var F0,aC;function sG(){return aC||(aC=1,F0={Graph:z1(),version:iG()}),F0}var B0,iC;function oG(){if(iC)return B0;iC=1;var e=Gr(),t=z1();B0={write:n,read:i};function n(s){var l={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:r(s),edges:a(s)};return e.isUndefined(s.graph())||(l.value=e.clone(s.graph())),l}function r(s){return e.map(s.nodes(),function(l){var c=s.node(l),u=s.parent(l),d={v:l};return e.isUndefined(c)||(d.value=c),e.isUndefined(u)||(d.parent=u),d})}function a(s){return e.map(s.edges(),function(l){var c=s.edge(l),u={v:l.v,w:l.w};return e.isUndefined(l.name)||(u.name=l.name),e.isUndefined(c)||(u.value=c),u})}function i(s){var l=new t(s.options).setGraph(s.value);return e.each(s.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),e.each(s.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return B0}var z0,sC;function lG(){if(sC)return z0;sC=1;var e=Gr();z0=t;function t(n){var r={},a=[],i;function s(l){e.has(r,l)||(r[l]=!0,i.push(l),e.each(n.successors(l),s),e.each(n.predecessors(l),s))}return e.each(n.nodes(),function(l){i=[],s(l),i.length&&a.push(i)}),a}return z0}var U0,oC;function GI(){if(oC)return U0;oC=1;var e=Gr();U0=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,s=i.length;return a[n]=s,i.push({key:n,priority:r}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,i=a+1,s=n;a<r.length&&(s=r[a].priority<r[s].priority?a:s,i<r.length&&(s=r[i].priority<r[s].priority?i:s),s!==n&&(this._swap(n,s),this._heapify(s)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,r){var a=this._arr,i=this._keyIndices,s=a[n],l=a[r];a[n]=l,a[r]=s,i[l.key]=n,i[s.key]=r},U0}var $0,lC;function KI(){if(lC)return $0;lC=1;var e=Gr(),t=GI();$0=r;var n=e.constant(1);function r(i,s,l,c){return a(i,String(s),l||n,c||function(u){return i.outEdges(u)})}function a(i,s,l,c){var u={},d=new t,f,g,p=function(m){var y=m.v!==f?m.v:m.w,v=u[y],x=l(m),b=g.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+m+" Weight: "+x);b<v.distance&&(v.distance=b,v.predecessor=f,d.decrease(y,b))};for(i.nodes().forEach(function(m){var y=m===s?0:Number.POSITIVE_INFINITY;u[m]={distance:y},d.add(m,y)});d.size()>0&&(f=d.removeMin(),g=u[f],g.distance!==Number.POSITIVE_INFINITY);)c(f).forEach(p);return u}return $0}var H0,cC;function cG(){if(cC)return H0;cC=1;var e=KI(),t=Gr();H0=n;function n(r,a,i){return t.transform(r.nodes(),function(s,l){s[l]=e(r,l,a,i)},{})}return H0}var q0,uC;function YI(){if(uC)return q0;uC=1;var e=Gr();q0=t;function t(n){var r=0,a=[],i={},s=[];function l(c){var u=i[c]={onStack:!0,lowlink:r,index:r++};if(a.push(c),n.successors(c).forEach(function(g){e.has(i,g)?i[g].onStack&&(u.lowlink=Math.min(u.lowlink,i[g].index)):(l(g),u.lowlink=Math.min(u.lowlink,i[g].lowlink))}),u.lowlink===u.index){var d=[],f;do f=a.pop(),i[f].onStack=!1,d.push(f);while(c!==f);s.push(d)}}return n.nodes().forEach(function(c){e.has(i,c)||l(c)}),s}return q0}var W0,dC;function uG(){if(dC)return W0;dC=1;var e=Gr(),t=YI();W0=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return W0}var V0,fC;function dG(){if(fC)return V0;fC=1;var e=Gr();V0=n;var t=e.constant(1);function n(a,i,s){return r(a,i||t,s||function(l){return a.outEdges(l)})}function r(a,i,s){var l={},c=a.nodes();return c.forEach(function(u){l[u]={},l[u][u]={distance:0},c.forEach(function(d){u!==d&&(l[u][d]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(d){var f=d.v===u?d.w:d.v,g=i(d);l[u][f]={distance:g,predecessor:u}})}),c.forEach(function(u){var d=l[u];c.forEach(function(f){var g=l[f];c.forEach(function(p){var m=g[u],y=d[p],v=g[p],x=m.distance+y.distance;x<v.distance&&(v.distance=x,v.predecessor=y.predecessor)})})}),l}return V0}var G0,gC;function XI(){if(gC)return G0;gC=1;var e=Gr();G0=t,t.CycleException=n;function t(r){var a={},i={},s=[];function l(c){if(e.has(i,c))throw new n;e.has(a,c)||(i[c]=!0,a[c]=!0,e.each(r.predecessors(c),l),delete i[c],s.push(c))}if(e.each(r.sinks(),l),e.size(a)!==r.nodeCount())throw new n;return s}function n(){}return n.prototype=new Error,G0}var K0,pC;function fG(){if(pC)return K0;pC=1;var e=XI();K0=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return K0}var Y0,hC;function QI(){if(hC)return Y0;hC=1;var e=Gr();Y0=t;function t(r,a,i){e.isArray(a)||(a=[a]);var s=(r.isDirected()?r.successors:r.neighbors).bind(r),l=[],c={};return e.each(a,function(u){if(!r.hasNode(u))throw new Error("Graph does not have node: "+u);n(r,u,i==="post",c,s,l)}),l}function n(r,a,i,s,l,c){e.has(s,a)||(s[a]=!0,i||c.push(a),e.each(l(a),function(u){n(r,u,i,s,l,c)}),i&&c.push(a))}return Y0}var X0,mC;function gG(){if(mC)return X0;mC=1;var e=QI();X0=t;function t(n,r){return e(n,r,"post")}return X0}var Q0,xC;function pG(){if(xC)return Q0;xC=1;var e=QI();Q0=t;function t(n,r){return e(n,r,"pre")}return Q0}var Z0,yC;function hG(){if(yC)return Z0;yC=1;var e=Gr(),t=z1(),n=GI();Z0=r;function r(a,i){var s=new t,l={},c=new n,u;function d(g){var p=g.v===u?g.w:g.v,m=c.priority(p);if(m!==void 0){var y=i(g);y<m&&(l[p]=u,c.decrease(p,y))}}if(a.nodeCount()===0)return s;e.each(a.nodes(),function(g){c.add(g,Number.POSITIVE_INFINITY),s.setNode(g)}),c.decrease(a.nodes()[0],0);for(var f=!1;c.size()>0;){if(u=c.removeMin(),e.has(l,u))s.setEdge(u,l[u]);else{if(f)throw new Error("Input graph is not connected: "+a);f=!0}a.nodeEdges(u).forEach(d)}return s}return Z0}var J0,bC;function mG(){return bC||(bC=1,J0={components:lG(),dijkstra:KI(),dijkstraAll:cG(),findCycles:uG(),floydWarshall:dG(),isAcyclic:fG(),postorder:gG(),preorder:pG(),prim:hG(),tarjan:YI(),topsort:XI()}),J0}var ex,vC;function xG(){if(vC)return ex;vC=1;var e=sG();return ex={Graph:e.Graph,json:oG(),alg:mG(),version:e.version},ex}var Ld;if(typeof E1=="function")try{Ld=xG()}catch{}Ld||(Ld=window.graphlib);var ua=Ld,tx,kC;function yG(){if(kC)return tx;kC=1;var e=_I(),t=1,n=4;function r(a){return e(a,t|n)}return tx=r,tx}var nx,_C;function If(){if(_C)return nx;_C=1;var e=Lo(),t=Qa(),n=wf(),r=Vr();function a(i,s,l){if(!r(l))return!1;var c=typeof s;return(c=="number"?t(l)&&n(s,l.length):c=="string"&&s in l)?e(l[s],i):!1}return nx=a,nx}var rx,wC;function bG(){if(wC)return rx;wC=1;var e=Af(),t=Lo(),n=If(),r=Ss(),a=Object.prototype,i=a.hasOwnProperty,s=e(function(l,c){l=Object(l);var u=-1,d=c.length,f=d>2?c[2]:void 0;for(f&&n(c[0],c[1],f)&&(d=1);++u<d;)for(var g=c[u],p=r(g),m=-1,y=p.length;++m<y;){var v=p[m],x=l[v];(x===void 0||t(x,a[v])&&!i.call(l,v))&&(l[v]=g[v])}return l});return rx=s,rx}var ax,EC;function vG(){if(EC)return ax;EC=1;var e=Za(),t=Qa(),n=Ui();function r(a){return function(i,s,l){var c=Object(i);if(!t(i)){var u=e(s,3);i=n(i),s=function(f){return u(c[f],f,c)}}var d=a(i,s,l);return d>-1?c[u?i[d]:d]:void 0}}return ax=r,ax}var ix,SC;function kG(){if(SC)return ix;SC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return ix=t,ix}var sx,NC;function _G(){if(NC)return sx;NC=1;var e=kG(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return sx=n,sx}var ox,CC;function wG(){if(CC)return ox;CC=1;var e=_G(),t=Vr(),n=Fo(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(n(u))return r;if(t(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=t(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=i.test(u);return f||s.test(u)?l(u.slice(2),f?2:8):a.test(u)?r:+u}return ox=c,ox}var lx,jC;function ZI(){if(jC)return lx;jC=1;var e=wG(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return lx=r,lx}var cx,TC;function EG(){if(TC)return cx;TC=1;var e=ZI();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return cx=t,cx}var ux,RC;function SG(){if(RC)return ux;RC=1;var e=qI(),t=Za(),n=EG(),r=Math.max;function a(i,s,l){var c=i==null?0:i.length;if(!c)return-1;var u=l==null?0:n(l);return u<0&&(u=r(c+u,0)),e(i,t(s,3),u)}return ux=a,ux}var dx,AC;function NG(){if(AC)return dx;AC=1;var e=vG(),t=SG(),n=e(t);return dx=n,dx}var fx,IC;function JI(){if(IC)return fx;IC=1;var e=B1();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return fx=t,fx}var gx,MC;function CG(){if(MC)return gx;MC=1;var e=O1(),t=wI(),n=Ss();function r(a,i){return a==null?a:e(a,t(i),n)}return gx=r,gx}var px,LC;function jG(){if(LC)return px;LC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return px=e,px}var hx,OC;function TG(){if(OC)return hx;OC=1;var e=kf(),t=D1(),n=Za();function r(a,i){var s={};return i=n(i,3),t(a,function(l,c,u){e(s,c,i(l,c,u))}),s}return hx=r,hx}var mx,DC;function U1(){if(DC)return mx;DC=1;var e=Fo();function t(n,r,a){for(var i=-1,s=n.length;++i<s;){var l=n[i],c=r(l);if(c!=null&&(u===void 0?c===c&&!e(c):a(c,u)))var u=c,d=l}return d}return mx=t,mx}var xx,PC;function RG(){if(PC)return xx;PC=1;function e(t,n){return t>n}return xx=e,xx}var yx,FC;function AG(){if(FC)return yx;FC=1;var e=U1(),t=RG(),n=Ns();function r(a){return a&&a.length?e(a,n,t):void 0}return yx=r,yx}var bx,BC;function e3(){if(BC)return bx;BC=1;var e=kf(),t=Lo();function n(r,a,i){(i!==void 0&&!t(r[a],i)||i===void 0&&!(a in r))&&e(r,a,i)}return bx=n,bx}var vx,zC;function IG(){if(zC)return vx;zC=1;var e=ws(),t=Nf(),n=Ca(),r="[object Object]",a=Function.prototype,i=Object.prototype,s=a.toString,l=i.hasOwnProperty,c=s.call(Object);function u(d){if(!n(d)||e(d)!=r)return!1;var f=t(d);if(f===null)return!0;var g=l.call(f,"constructor")&&f.constructor;return typeof g=="function"&&g instanceof g&&s.call(g)==c}return vx=u,vx}var kx,UC;function t3(){if(UC)return kx;UC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return kx=e,kx}var _x,$C;function MG(){if($C)return _x;$C=1;var e=Ec(),t=Ss();function n(r){return e(r,t(r))}return _x=n,_x}var wx,HC;function LG(){if(HC)return wx;HC=1;var e=e3(),t=uI(),n=bI(),r=dI(),a=kI(),i=Sc(),s=En(),l=WI(),c=Do(),u=wc(),d=Vr(),f=IG(),g=Nc(),p=t3(),m=MG();function y(v,x,b,k,N,_,w){var E=p(v,b),S=p(x,b),M=w.get(S);if(M){e(v,b,M);return}var j=_?_(E,S,b+"",v,x,w):void 0,F=j===void 0;if(F){var P=s(S),W=!P&&c(S),O=!P&&!W&&g(S);j=S,P||W||O?s(E)?j=E:l(E)?j=r(E):W?(F=!1,j=t(S,!0)):O?(F=!1,j=n(S,!0)):j=[]:f(S)||i(S)?(j=E,i(E)?j=m(E):(!d(E)||u(E))&&(j=a(S))):F=!1}F&&(w.set(S,j),N(j,S,k,_,w),w.delete(S)),e(v,b,j)}return wx=y,wx}var Ex,qC;function OG(){if(qC)return Ex;qC=1;var e=vf(),t=e3(),n=O1(),r=LG(),a=Vr(),i=Ss(),s=t3();function l(c,u,d,f,g){c!==u&&n(u,function(p,m){if(g||(g=new e),a(p))r(c,u,m,d,l,f,g);else{var y=f?f(s(c,m),p,m+"",c,u,g):void 0;y===void 0&&(y=p),t(c,m,y)}},i)}return Ex=l,Ex}var Sx,WC;function DG(){if(WC)return Sx;WC=1;var e=Af(),t=If();function n(r){return e(function(a,i){var s=-1,l=i.length,c=l>1?i[l-1]:void 0,u=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,u&&t(i[0],i[1],u)&&(c=l<3?void 0:c,l=1),a=Object(a);++s<l;){var d=i[s];d&&r(a,d,s,c)}return a})}return Sx=n,Sx}var Nx,VC;function PG(){if(VC)return Nx;VC=1;var e=OG(),t=DG(),n=t(function(r,a,i){e(r,a,i)});return Nx=n,Nx}var Cx,GC;function n3(){if(GC)return Cx;GC=1;function e(t,n){return t<n}return Cx=e,Cx}var jx,KC;function FG(){if(KC)return jx;KC=1;var e=U1(),t=n3(),n=Ns();function r(a){return a&&a.length?e(a,n,t):void 0}return jx=r,jx}var Tx,YC;function BG(){if(YC)return Tx;YC=1;var e=U1(),t=Za(),n=n3();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Tx=r,Tx}var Rx,XC;function zG(){if(XC)return Rx;XC=1;var e=ca(),t=function(){return e.Date.now()};return Rx=t,Rx}var Ax,QC;function UG(){if(QC)return Ax;QC=1;var e=_f(),t=Tf(),n=wf(),r=Vr(),a=Cc();function i(s,l,c,u){if(!r(s))return s;l=t(l,s);for(var d=-1,f=l.length,g=f-1,p=s;p!=null&&++d<f;){var m=a(l[d]),y=c;if(m==="__proto__"||m==="constructor"||m==="prototype")return s;if(d!=g){var v=p[m];y=u?u(v,m,p):void 0,y===void 0&&(y=r(v)?v:n(l[d+1])?[]:{})}e(p,m,y),p=p[m]}return s}return Ax=i,Ax}var Ix,ZC;function $G(){if(ZC)return Ix;ZC=1;var e=Rf(),t=UG(),n=Tf();function r(a,i,s){for(var l=-1,c=i.length,u={};++l<c;){var d=i[l],f=e(a,d);s(f,d)&&t(u,n(d,a),f)}return u}return Ix=r,Ix}var Mx,JC;function HG(){if(JC)return Mx;JC=1;var e=$G(),t=LI();function n(r,a){return e(r,a,function(i,s){return t(r,s)})}return Mx=n,Mx}var Lx,e4;function qG(){if(e4)return Lx;e4=1;var e=JI(),t=$I(),n=HI();function r(a){return n(t(a,void 0,e),a+"")}return Lx=r,Lx}var Ox,t4;function WG(){if(t4)return Ox;t4=1;var e=HG(),t=qG(),n=t(function(r,a){return r==null?{}:e(r,a)});return Ox=n,Ox}var Dx,n4;function VG(){if(n4)return Dx;n4=1;var e=Math.ceil,t=Math.max;function n(r,a,i,s){for(var l=-1,c=t(e((a-r)/(i||1)),0),u=Array(c);c--;)u[s?c:++l]=r,r+=i;return u}return Dx=n,Dx}var Px,r4;function GG(){if(r4)return Px;r4=1;var e=VG(),t=If(),n=ZI();function r(a){return function(i,s,l){return l&&typeof l!="number"&&t(i,s,l)&&(s=l=void 0),i=n(i),s===void 0?(s=i,i=0):s=n(s),l=l===void 0?i<s?1:-1:n(l),e(i,s,l,a)}}return Px=r,Px}var Fx,a4;function KG(){if(a4)return Fx;a4=1;var e=GG(),t=e();return Fx=t,Fx}var Bx,i4;function YG(){if(i4)return Bx;i4=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Bx=e,Bx}var zx,s4;function XG(){if(s4)return zx;s4=1;var e=Fo();function t(n,r){if(n!==r){var a=n!==void 0,i=n===null,s=n===n,l=e(n),c=r!==void 0,u=r===null,d=r===r,f=e(r);if(!u&&!f&&!l&&n>r||l&&c&&d&&!u&&!f||i&&c&&d||!a&&d||!s)return 1;if(!i&&!l&&!f&&n<r||f&&a&&s&&!i&&!l||u&&a&&s||!c&&s||!d)return-1}return 0}return zx=t,zx}var Ux,o4;function QG(){if(o4)return Ux;o4=1;var e=XG();function t(n,r,a){for(var i=-1,s=n.criteria,l=r.criteria,c=s.length,u=a.length;++i<c;){var d=e(s[i],l[i]);if(d){if(i>=u)return d;var f=a[i];return d*(f=="desc"?-1:1)}}return n.index-r.index}return Ux=t,Ux}var $x,l4;function ZG(){if(l4)return $x;l4=1;var e=jf(),t=Rf(),n=Za(),r=BI(),a=YG(),i=Ef(),s=QG(),l=Ns(),c=En();function u(d,f,g){f.length?f=e(f,function(y){return c(y)?function(v){return t(v,y.length===1?y[0]:y)}:y}):f=[l];var p=-1;f=e(f,i(n));var m=r(d,function(y,v,x){var b=e(f,function(k){return k(y)});return{criteria:b,index:++p,value:y}});return a(m,function(y,v){return s(y,v,g)})}return $x=u,$x}var Hx,c4;function JG(){if(c4)return Hx;c4=1;var e=B1(),t=ZG(),n=Af(),r=If(),a=n(function(i,s){if(i==null)return[];var l=s.length;return l>1&&r(i,s[0],s[1])?s=[]:l>2&&r(s[0],s[1],s[2])&&(s=[s[0]]),t(i,e(s,1),[])});return Hx=a,Hx}var qx,u4;function eK(){if(u4)return qx;u4=1;var e=II(),t=0;function n(r){var a=++t;return e(r)+a}return qx=n,qx}var Wx,d4;function tK(){if(d4)return Wx;d4=1;function e(t,n,r){for(var a=-1,i=t.length,s=n.length,l={};++a<i;){var c=a<s?n[a]:void 0;r(l,t[a],c)}return l}return Wx=e,Wx}var Vx,f4;function nK(){if(f4)return Vx;f4=1;var e=_f(),t=tK();function n(r,a){return t(r||[],a||[],e)}return Vx=n,Vx}var Od;if(typeof E1=="function")try{Od={cloneDeep:yG(),constant:L1(),defaults:bG(),each:SI(),filter:DI(),find:NG(),flatten:JI(),forEach:EI(),forIn:CG(),has:PI(),isUndefined:FI(),last:jG(),map:zI(),mapValues:TG(),max:AG(),merge:PG(),min:FG(),minBy:BG(),now:zG(),pick:WG(),range:KG(),reduce:UI(),sortBy:JG(),uniqueId:eK(),values:VI(),zipObject:nK()}}catch{}Od||(Od=window._);var ln=Od,rK=Mf;function Mf(){var e={};e._next=e._prev=e,this._sentinel=e}Mf.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return r3(t),t};Mf.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&r3(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t};Mf.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,aK)),n=n._prev;return"["+e.join(", ")+"]"};function r3(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function aK(e,t){if(e!=="_next"&&e!=="_prev")return t}var za=ln,iK=ua.Graph,sK=rK,oK=cK,lK=za.constant(1);function cK(e,t){if(e.nodeCount()<=1)return[];var n=dK(e,t||lK),r=uK(n.graph,n.buckets,n.zeroIdx);return za.flatten(za.map(r,function(a){return e.outEdges(a.v,a.w)}),!0)}function uK(e,t,n){for(var r=[],a=t[t.length-1],i=t[0],s;e.nodeCount();){for(;s=i.dequeue();)Gx(e,t,n,s);for(;s=a.dequeue();)Gx(e,t,n,s);if(e.nodeCount()){for(var l=t.length-2;l>0;--l)if(s=t[l].dequeue(),s){r=r.concat(Gx(e,t,n,s,!0));break}}}return r}function Gx(e,t,n,r,a){var i=a?[]:void 0;return za.forEach(e.inEdges(r.v),function(s){var l=e.edge(s),c=e.node(s.v);a&&i.push({v:s.v,w:s.w}),c.out-=l,Lb(t,n,c)}),za.forEach(e.outEdges(r.v),function(s){var l=e.edge(s),c=s.w,u=e.node(c);u.in-=l,Lb(t,n,u)}),e.removeNode(r.v),i}function dK(e,t){var n=new iK,r=0,a=0;za.forEach(e.nodes(),function(l){n.setNode(l,{v:l,in:0,out:0})}),za.forEach(e.edges(),function(l){var c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d),a=Math.max(a,n.node(l.v).out+=u),r=Math.max(r,n.node(l.w).in+=u)});var i=za.range(a+r+3).map(function(){return new sK}),s=r+1;return za.forEach(n.nodes(),function(l){Lb(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function Lb(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var rs=ln,fK=oK,gK={run:pK,undo:mK};function pK(e){var t=e.graph().acyclicer==="greedy"?fK(e,n(e)):hK(e);rs.forEach(t,function(r){var a=e.edge(r);e.removeEdge(r),a.forwardName=r.name,a.reversed=!0,e.setEdge(r.w,r.v,a,rs.uniqueId("rev"))});function n(r){return function(a){return r.edge(a).weight}}}function hK(e){var t=[],n={},r={};function a(i){rs.has(r,i)||(r[i]=!0,n[i]=!0,rs.forEach(e.outEdges(i),function(s){rs.has(n,s.w)?t.push(s):a(s.w)}),delete n[i])}return rs.forEach(e.nodes(),a),t}function mK(e){rs.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}var zt=ln,a3=ua.Graph,yr={addDummyNode:i3,simplify:xK,asNonCompoundGraph:yK,successorWeights:bK,predecessorWeights:vK,intersectRect:kK,buildLayerMatrix:_K,normalizeRanks:wK,removeEmptyRanks:EK,addBorderNode:SK,maxRank:s3,partition:NK,time:CK,notime:jK};function i3(e,t,n,r){var a;do a=zt.uniqueId(r);while(e.hasNode(a));return n.dummy=t,e.setNode(a,n),a}function xK(e){var t=new a3().setGraph(e.graph());return zt.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),zt.forEach(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},a=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+a.weight,minlen:Math.max(r.minlen,a.minlen)})}),t}function yK(e){var t=new a3({multigraph:e.isMultigraph()}).setGraph(e.graph());return zt.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),zt.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function bK(e){var t=zt.map(e.nodes(),function(n){var r={};return zt.forEach(e.outEdges(n),function(a){r[a.w]=(r[a.w]||0)+e.edge(a).weight}),r});return zt.zipObject(e.nodes(),t)}function vK(e){var t=zt.map(e.nodes(),function(n){var r={};return zt.forEach(e.inEdges(n),function(a){r[a.v]=(r[a.v]||0)+e.edge(a).weight}),r});return zt.zipObject(e.nodes(),t)}function kK(e,t){var n=e.x,r=e.y,a=t.x-n,i=t.y-r,s=e.width/2,l=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var c,u;return Math.abs(i)*s>Math.abs(a)*l?(i<0&&(l=-l),c=l*a/i,u=l):(a<0&&(s=-s),c=s,u=s*i/a),{x:n+c,y:r+u}}function _K(e){var t=zt.map(zt.range(s3(e)+1),function(){return[]});return zt.forEach(e.nodes(),function(n){var r=e.node(n),a=r.rank;zt.isUndefined(a)||(t[a][r.order]=n)}),t}function wK(e){var t=zt.min(zt.map(e.nodes(),function(n){return e.node(n).rank}));zt.forEach(e.nodes(),function(n){var r=e.node(n);zt.has(r,"rank")&&(r.rank-=t)})}function EK(e){var t=zt.min(zt.map(e.nodes(),function(i){return e.node(i).rank})),n=[];zt.forEach(e.nodes(),function(i){var s=e.node(i).rank-t;n[s]||(n[s]=[]),n[s].push(i)});var r=0,a=e.graph().nodeRankFactor;zt.forEach(n,function(i,s){zt.isUndefined(i)&&s%a!==0?--r:r&&zt.forEach(i,function(l){e.node(l).rank+=r})})}function SK(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),i3(e,"border",a,t)}function s3(e){return zt.max(zt.map(e.nodes(),function(t){var n=e.node(t).rank;if(!zt.isUndefined(n))return n}))}function NK(e,t){var n={lhs:[],rhs:[]};return zt.forEach(e,function(r){t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function CK(e,t){var n=zt.now();try{return t()}finally{console.log(e+" time: "+(zt.now()-n)+"ms")}}function jK(e,t){return t()}var o3=ln,TK=yr,RK={run:AK,undo:MK};function AK(e){e.graph().dummyChains=[],o3.forEach(e.edges(),function(t){IK(e,t)})}function IK(e,t){var n=t.v,r=e.node(n).rank,a=t.w,i=e.node(a).rank,s=t.name,l=e.edge(t),c=l.labelRank;if(i!==r+1){e.removeEdge(t);var u,d,f;for(f=0,++r;r<i;++f,++r)l.points=[],d={width:0,height:0,edgeLabel:l,edgeObj:t,rank:r},u=TK.addDummyNode(e,"edge",d,"_d"),r===c&&(d.width=l.width,d.height=l.height,d.dummy="edge-label",d.labelpos=l.labelpos),e.setEdge(n,u,{weight:l.weight},s),f===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,a,{weight:l.weight},s)}}function MK(e){o3.forEach(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,a;for(e.setEdge(n.edgeObj,r);n.dummy;)a=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=a,n=e.node(t)})}var Nu=ln,Lf={longestPath:LK,slack:OK};function LK(e){var t={};function n(r){var a=e.node(r);if(Nu.has(t,r))return a.rank;t[r]=!0;var i=Nu.min(Nu.map(e.outEdges(r),function(s){return n(s.w)-e.edge(s).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}Nu.forEach(e.sources(),n)}function OK(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Dd=ln,DK=ua.Graph,Pd=Lf.slack,l3=PK;function PK(e){var t=new DK({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var a,i;FK(t,e)<r;)a=BK(t,e),i=t.hasNode(a.v)?Pd(e,a):-Pd(e,a),zK(t,e,i);return t}function FK(e,t){function n(r){Dd.forEach(t.nodeEdges(r),function(a){var i=a.v,s=r===i?a.w:i;!e.hasNode(s)&&!Pd(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return Dd.forEach(e.nodes(),n),e.nodeCount()}function BK(e,t){return Dd.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Pd(t,n)})}function zK(e,t,n){Dd.forEach(e.nodes(),function(r){t.node(r).rank+=n})}var Ka=ln,UK=l3,$K=Lf.slack,HK=Lf.longestPath,qK=ua.alg.preorder,WK=ua.alg.postorder,VK=yr.simplify,GK=Cs;Cs.initLowLimValues=H1;Cs.initCutValues=$1;Cs.calcCutValue=c3;Cs.leaveEdge=d3;Cs.enterEdge=f3;Cs.exchangeEdges=g3;function Cs(e){e=VK(e),HK(e);var t=UK(e);H1(t),$1(t,e);for(var n,r;n=d3(t);)r=f3(t,e,n),g3(t,e,n,r)}function $1(e,t){var n=WK(e,e.nodes());n=n.slice(0,n.length-1),Ka.forEach(n,function(r){KK(e,t,r)})}function KK(e,t,n){var r=e.node(n),a=r.parent;e.edge(n,a).cutvalue=c3(e,t,n)}function c3(e,t,n){var r=e.node(n),a=r.parent,i=!0,s=t.edge(n,a),l=0;return s||(i=!1,s=t.edge(a,n)),l=s.weight,Ka.forEach(t.nodeEdges(n),function(c){var u=c.v===n,d=u?c.w:c.v;if(d!==a){var f=u===i,g=t.edge(c).weight;if(l+=f?g:-g,XK(e,n,d)){var p=e.edge(n,d).cutvalue;l+=f?-p:p}}}),l}function H1(e,t){arguments.length<2&&(t=e.nodes()[0]),u3(e,{},1,t)}function u3(e,t,n,r,a){var i=n,s=e.node(r);return t[r]=!0,Ka.forEach(e.neighbors(r),function(l){Ka.has(t,l)||(n=u3(e,t,n,l,r))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}function d3(e){return Ka.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function f3(e,t,n){var r=n.v,a=n.w;t.hasEdge(r,a)||(r=n.w,a=n.v);var i=e.node(r),s=e.node(a),l=i,c=!1;i.lim>s.lim&&(l=s,c=!0);var u=Ka.filter(t.edges(),function(d){return c===g4(e,e.node(d.v),l)&&c!==g4(e,e.node(d.w),l)});return Ka.minBy(u,function(d){return $K(t,d)})}function g3(e,t,n,r){var a=n.v,i=n.w;e.removeEdge(a,i),e.setEdge(r.v,r.w,{}),H1(e),$1(e,t),YK(e,t)}function YK(e,t){var n=Ka.find(e.nodes(),function(a){return!t.node(a).parent}),r=qK(e,n);r=r.slice(1),Ka.forEach(r,function(a){var i=e.node(a).parent,s=t.edge(a,i),l=!1;s||(s=t.edge(i,a),l=!0),t.node(a).rank=t.node(i).rank+(l?s.minlen:-s.minlen)})}function XK(e,t,n){return e.hasEdge(t,n)}function g4(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var QK=Lf,p3=QK.longestPath,ZK=l3,JK=GK,eY=tY;function tY(e){switch(e.graph().ranker){case"network-simplex":p4(e);break;case"tight-tree":rY(e);break;case"longest-path":nY(e);break;default:p4(e)}}var nY=p3;function rY(e){p3(e),ZK(e)}function p4(e){JK(e)}var Ob=ln,aY=iY;function iY(e){var t=oY(e);Ob.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=sY(e,t,a.v,a.w),s=i.path,l=i.lca,c=0,u=s[c],d=!0;n!==a.w;){if(r=e.node(n),d){for(;(u=s[c])!==l&&e.node(u).maxRank<r.rank;)c++;u===l&&(d=!1)}if(!d){for(;c<s.length-1&&e.node(u=s[c+1]).minRank<=r.rank;)c++;u=s[c]}e.setParent(n,u),n=e.successors(n)[0]}})}function sY(e,t,n,r){var a=[],i=[],s=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim),c,u;c=n;do c=e.parent(c),a.push(c);while(c&&(t[c].low>s||l>t[c].lim));for(u=c,c=r;(c=e.parent(c))!==u;)i.push(c);return{path:a.concat(i.reverse()),lca:u}}function oY(e){var t={},n=0;function r(a){var i=n;Ob.forEach(e.children(a),r),t[a]={low:i,lim:n++}}return Ob.forEach(e.children(),r),t}var Ua=ln,Db=yr,lY={run:cY,cleanup:fY};function cY(e){var t=Db.addDummyNode(e,"root",{},"_root"),n=uY(e),r=Ua.max(Ua.values(n))-1,a=2*r+1;e.graph().nestingRoot=t,Ua.forEach(e.edges(),function(s){e.edge(s).minlen*=a});var i=dY(e)+1;Ua.forEach(e.children(),function(s){h3(e,t,a,i,r,n,s)}),e.graph().nodeRankFactor=a}function h3(e,t,n,r,a,i,s){var l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}var c=Db.addBorderNode(e,"_bt"),u=Db.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(c,s),d.borderTop=c,e.setParent(u,s),d.borderBottom=u,Ua.forEach(l,function(f){h3(e,t,n,r,a,i,f);var g=e.node(f),p=g.borderTop?g.borderTop:f,m=g.borderBottom?g.borderBottom:f,y=g.borderTop?r:2*r,v=p!==m?1:a-i[s]+1;e.setEdge(c,p,{weight:y,minlen:v,nestingEdge:!0}),e.setEdge(m,u,{weight:y,minlen:v,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,c,{weight:0,minlen:a+i[s]})}function uY(e){var t={};function n(r,a){var i=e.children(r);i&&i.length&&Ua.forEach(i,function(s){n(s,a+1)}),t[r]=a}return Ua.forEach(e.children(),function(r){n(r,1)}),t}function dY(e){return Ua.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function fY(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,Ua.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}var Kx=ln,gY=yr,pY=hY;function hY(e){function t(n){var r=e.children(n),a=e.node(n);if(r.length&&Kx.forEach(r,t),Kx.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,s=a.maxRank+1;i<s;++i)h4(e,"borderLeft","_bl",n,a,i),h4(e,"borderRight","_br",n,a,i)}}Kx.forEach(e.children(),t)}function h4(e,t,n,r,a,i){var s={width:0,height:0,rank:i,borderType:t},l=a[t][i-1],c=gY.addDummyNode(e,"border",s,n);a[t][i]=c,e.setParent(c,r),l&&e.setEdge(l,c,{weight:1})}var ka=ln,mY={adjust:xY,undo:yY};function xY(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&m3(e)}function yY(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&bY(e),(t==="lr"||t==="rl")&&(vY(e),m3(e))}function m3(e){ka.forEach(e.nodes(),function(t){m4(e.node(t))}),ka.forEach(e.edges(),function(t){m4(e.edge(t))})}function m4(e){var t=e.width;e.width=e.height,e.height=t}function bY(e){ka.forEach(e.nodes(),function(t){Yx(e.node(t))}),ka.forEach(e.edges(),function(t){var n=e.edge(t);ka.forEach(n.points,Yx),ka.has(n,"y")&&Yx(n)})}function Yx(e){e.y=-e.y}function vY(e){ka.forEach(e.nodes(),function(t){Xx(e.node(t))}),ka.forEach(e.edges(),function(t){var n=e.edge(t);ka.forEach(n.points,Xx),ka.has(n,"x")&&Xx(n)})}function Xx(e){var t=e.x;e.x=e.y,e.y=t}var La=ln,kY=_Y;function _Y(e){var t={},n=La.filter(e.nodes(),function(l){return!e.children(l).length}),r=La.max(La.map(n,function(l){return e.node(l).rank})),a=La.map(La.range(r+1),function(){return[]});function i(l){if(!La.has(t,l)){t[l]=!0;var c=e.node(l);a[c.rank].push(l),La.forEach(e.successors(l),i)}}var s=La.sortBy(n,function(l){return e.node(l).rank});return La.forEach(s,i),a}var oi=ln,wY=EY;function EY(e,t){for(var n=0,r=1;r<t.length;++r)n+=SY(e,t[r-1],t[r]);return n}function SY(e,t,n){for(var r=oi.zipObject(n,oi.map(n,function(u,d){return d})),a=oi.flatten(oi.map(t,function(u){return oi.sortBy(oi.map(e.outEdges(u),function(d){return{pos:r[d.w],weight:e.edge(d).weight}}),"pos")}),!0),i=1;i<n.length;)i<<=1;var s=2*i-1;i-=1;var l=oi.map(new Array(s),function(){return 0}),c=0;return oi.forEach(a.forEach(function(u){var d=u.pos+i;l[d]+=u.weight;for(var f=0;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f})),c}var x4=ln,NY=CY;function CY(e,t){return x4.map(t,function(n){var r=e.inEdges(n);if(r.length){var a=x4.reduce(r,function(i,s){var l=e.edge(s),c=e.node(s.v);return{sum:i.sum+l.weight*c.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:n}})}var Nr=ln,jY=TY;function TY(e,t){var n={};Nr.forEach(e,function(a,i){var s=n[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};Nr.isUndefined(a.barycenter)||(s.barycenter=a.barycenter,s.weight=a.weight)}),Nr.forEach(t.edges(),function(a){var i=n[a.v],s=n[a.w];!Nr.isUndefined(i)&&!Nr.isUndefined(s)&&(s.indegree++,i.out.push(n[a.w]))});var r=Nr.filter(n,function(a){return!a.indegree});return RY(r)}function RY(e){var t=[];function n(i){return function(s){s.merged||(Nr.isUndefined(s.barycenter)||Nr.isUndefined(i.barycenter)||s.barycenter>=i.barycenter)&&AY(i,s)}}function r(i){return function(s){s.in.push(i),--s.indegree===0&&e.push(s)}}for(;e.length;){var a=e.pop();t.push(a),Nr.forEach(a.in.reverse(),n(a)),Nr.forEach(a.out,r(a))}return Nr.map(Nr.filter(t,function(i){return!i.merged}),function(i){return Nr.pick(i,["vs","i","barycenter","weight"])})}function AY(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}var gl=ln,IY=yr,MY=LY;function LY(e,t){var n=IY.partition(e,function(d){return gl.has(d,"barycenter")}),r=n.lhs,a=gl.sortBy(n.rhs,function(d){return-d.i}),i=[],s=0,l=0,c=0;r.sort(OY(!!t)),c=y4(i,a,c),gl.forEach(r,function(d){c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,l+=d.weight,c=y4(i,a,c)});var u={vs:gl.flatten(i,!0)};return l&&(u.barycenter=s/l,u.weight=l),u}function y4(e,t,n){for(var r;t.length&&(r=gl.last(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function OY(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}var pi=ln,DY=NY,PY=jY,FY=MY,BY=x3;function x3(e,t,n,r){var a=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,c={};s&&(a=pi.filter(a,function(m){return m!==s&&m!==l}));var u=DY(e,a);pi.forEach(u,function(m){if(e.children(m.v).length){var y=x3(e,m.v,n,r);c[m.v]=y,pi.has(y,"barycenter")&&UY(m,y)}});var d=PY(u,n);zY(d,c);var f=FY(d,r);if(s&&(f.vs=pi.flatten([s,f.vs,l],!0),e.predecessors(s).length)){var g=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(l)[0]);pi.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+g.order+p.order)/(f.weight+2),f.weight+=2}return f}function zY(e,t){pi.forEach(e,function(n){n.vs=pi.flatten(n.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function UY(e,t){pi.isUndefined(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var pl=ln,$Y=ua.Graph,HY=qY;function qY(e,t,n){var r=WY(e),a=new $Y({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(i){return e.node(i)});return pl.forEach(e.nodes(),function(i){var s=e.node(i),l=e.parent(i);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(a.setNode(i),a.setParent(i,l||r),pl.forEach(e[n](i),function(c){var u=c.v===i?c.w:c.v,d=a.edge(u,i),f=pl.isUndefined(d)?0:d.weight;a.setEdge(u,i,{weight:e.edge(c).weight+f})}),pl.has(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),a}function WY(e){for(var t;e.hasNode(t=pl.uniqueId("_root")););return t}var VY=ln,GY=KY;function KY(e,t,n){var r={},a;VY.forEach(n,function(i){for(var s=e.parent(i),l,c;s;){if(l=e.parent(s),l?(c=r[l],r[l]=s):(c=a,a=s),c&&c!==s){t.setEdge(c,s);return}s=l}})}var Ti=ln,YY=kY,XY=wY,QY=BY,ZY=HY,JY=GY,eX=ua.Graph,b4=yr,tX=nX;function nX(e){var t=b4.maxRank(e),n=v4(e,Ti.range(1,t+1),"inEdges"),r=v4(e,Ti.range(t-1,-1,-1),"outEdges"),a=YY(e);k4(e,a);for(var i=Number.POSITIVE_INFINITY,s,l=0,c=0;c<4;++l,++c){rX(l%2?n:r,l%4>=2),a=b4.buildLayerMatrix(e);var u=XY(e,a);u<i&&(c=0,s=Ti.cloneDeep(a),i=u)}k4(e,s)}function v4(e,t,n){return Ti.map(t,function(r){return ZY(e,r,n)})}function rX(e,t){var n=new eX;Ti.forEach(e,function(r){var a=r.graph().root,i=QY(r,a,n,t);Ti.forEach(i.vs,function(s,l){r.node(s).order=l}),JY(r,n,i.vs)})}function k4(e,t){Ti.forEach(t,function(n){Ti.forEach(n,function(r,a){e.node(r).order=a})})}var kt=ln,aX=ua.Graph,iX=yr,sX={positionX:xX};function oX(e,t){var n={};function r(a,i){var s=0,l=0,c=a.length,u=kt.last(i);return kt.forEach(i,function(d,f){var g=cX(e,d),p=g?e.node(g).order:c;(g||d===u)&&(kt.forEach(i.slice(l,f+1),function(m){kt.forEach(e.predecessors(m),function(y){var v=e.node(y),x=v.order;(x<s||p<x)&&!(v.dummy&&e.node(m).dummy)&&y3(n,y,m)})}),l=f+1,s=p)}),i}return kt.reduce(t,r),n}function lX(e,t){var n={};function r(i,s,l,c,u){var d;kt.forEach(kt.range(s,l),function(f){d=i[f],e.node(d).dummy&&kt.forEach(e.predecessors(d),function(g){var p=e.node(g);p.dummy&&(p.order<c||p.order>u)&&y3(n,g,d)})})}function a(i,s){var l=-1,c,u=0;return kt.forEach(s,function(d,f){if(e.node(d).dummy==="border"){var g=e.predecessors(d);g.length&&(c=e.node(g[0]).order,r(s,u,f,l,c),u=f,l=c)}r(s,u,s.length,c,i.length)}),s}return kt.reduce(t,a),n}function cX(e,t){if(e.node(t).dummy)return kt.find(e.predecessors(t),function(n){return e.node(n).dummy})}function y3(e,t,n){if(t>n){var r=t;t=n,n=r}var a=e[t];a||(e[t]=a={}),a[n]=!0}function uX(e,t,n){if(t>n){var r=t;t=n,n=r}return kt.has(e[t],n)}function dX(e,t,n,r){var a={},i={},s={};return kt.forEach(t,function(l){kt.forEach(l,function(c,u){a[c]=c,i[c]=c,s[c]=u})}),kt.forEach(t,function(l){var c=-1;kt.forEach(l,function(u){var d=r(u);if(d.length){d=kt.sortBy(d,function(y){return s[y]});for(var f=(d.length-1)/2,g=Math.floor(f),p=Math.ceil(f);g<=p;++g){var m=d[g];i[u]===u&&c<s[m]&&!uX(n,u,m)&&(i[m]=u,i[u]=a[u]=a[m],c=s[m])}}})}),{root:a,align:i}}function fX(e,t,n,r,a){var i={},s=gX(e,t,n,a),l=a?"borderLeft":"borderRight";function c(f,g){for(var p=s.nodes(),m=p.pop(),y={};m;)y[m]?f(m):(y[m]=!0,p.push(m),p=p.concat(g(m))),m=p.pop()}function u(f){i[f]=s.inEdges(f).reduce(function(g,p){return Math.max(g,i[p.v]+s.edge(p))},0)}function d(f){var g=s.outEdges(f).reduce(function(m,y){return Math.min(m,i[y.w]-s.edge(y))},Number.POSITIVE_INFINITY),p=e.node(f);g!==Number.POSITIVE_INFINITY&&p.borderType!==l&&(i[f]=Math.max(i[f],g))}return c(u,s.predecessors.bind(s)),c(d,s.successors.bind(s)),kt.forEach(r,function(f){i[f]=i[n[f]]}),i}function gX(e,t,n,r){var a=new aX,i=e.graph(),s=yX(i.nodesep,i.edgesep,r);return kt.forEach(t,function(l){var c;kt.forEach(l,function(u){var d=n[u];if(a.setNode(d),c){var f=n[c],g=a.edge(f,d);a.setEdge(f,d,Math.max(s(e,u,c),g||0))}c=u})}),a}function pX(e,t){return kt.minBy(kt.values(t),function(n){var r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return kt.forIn(n,function(i,s){var l=bX(e,s)/2;r=Math.max(i+l,r),a=Math.min(i-l,a)}),r-a})}function hX(e,t){var n=kt.values(t),r=kt.min(n),a=kt.max(n);kt.forEach(["u","d"],function(i){kt.forEach(["l","r"],function(s){var l=i+s,c=e[l],u;if(c!==t){var d=kt.values(c);u=s==="l"?r-kt.min(d):a-kt.max(d),u&&(e[l]=kt.mapValues(c,function(f){return f+u}))}})})}function mX(e,t){return kt.mapValues(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var a=kt.sortBy(kt.map(e,r));return(a[1]+a[2])/2})}function xX(e){var t=iX.buildLayerMatrix(e),n=kt.merge(oX(e,t),lX(e,t)),r={},a;kt.forEach(["u","d"],function(s){a=s==="u"?t:kt.values(t).reverse(),kt.forEach(["l","r"],function(l){l==="r"&&(a=kt.map(a,function(f){return kt.values(f).reverse()}));var c=(s==="u"?e.predecessors:e.successors).bind(e),u=dX(e,a,n,c),d=fX(e,a,u.root,u.align,l==="r");l==="r"&&(d=kt.mapValues(d,function(f){return-f})),r[s+l]=d})});var i=pX(e,r);return hX(r,i),mX(r,e.graph().align)}function yX(e,t,n){return function(r,a,i){var s=r.node(a),l=r.node(i),c=0,u;if(c+=s.width/2,kt.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(c+=n?u:-u),u=0,c+=(s.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,kt.has(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),u=0,c}}function bX(e,t){return e.node(t).width}var hl=ln,b3=yr,vX=sX.positionX,kX=_X;function _X(e){e=b3.asNonCompoundGraph(e),wX(e),hl.forEach(vX(e),function(t,n){e.node(n).x=t})}function wX(e){var t=b3.buildLayerMatrix(e),n=e.graph().ranksep,r=0;hl.forEach(t,function(a){var i=hl.max(hl.map(a,function(s){return e.node(s).height}));hl.forEach(a,function(s){e.node(s).y=r+i/2}),r+=i+n})}var Nt=ln,_4=gK,w4=RK,EX=eY,SX=yr.normalizeRanks,NX=aY,CX=yr.removeEmptyRanks,E4=lY,jX=pY,S4=mY,TX=tX,RX=kX,Mi=yr,AX=ua.Graph,IX=MX;function MX(e,t){var n=t&&t.debugTiming?Mi.time:Mi.notime;n("layout",function(){var r=n(" buildLayoutGraph",function(){return qX(e)});n(" runLayout",function(){LX(r,n)}),n(" updateInputGraph",function(){OX(e,r)})})}function LX(e,t){t(" makeSpaceForEdgeLabels",function(){WX(e)}),t(" removeSelfEdges",function(){eQ(e)}),t(" acyclic",function(){_4.run(e)}),t(" nestingGraph.run",function(){E4.run(e)}),t(" rank",function(){EX(Mi.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){VX(e)}),t(" removeEmptyRanks",function(){CX(e)}),t(" nestingGraph.cleanup",function(){E4.cleanup(e)}),t(" normalizeRanks",function(){SX(e)}),t(" assignRankMinMax",function(){GX(e)}),t(" removeEdgeLabelProxies",function(){KX(e)}),t(" normalize.run",function(){w4.run(e)}),t(" parentDummyChains",function(){NX(e)}),t(" addBorderSegments",function(){jX(e)}),t(" order",function(){TX(e)}),t(" insertSelfEdges",function(){tQ(e)}),t(" adjustCoordinateSystem",function(){S4.adjust(e)}),t(" position",function(){RX(e)}),t(" positionSelfEdges",function(){nQ(e)}),t(" removeBorderNodes",function(){JX(e)}),t(" normalize.undo",function(){w4.undo(e)}),t(" fixupEdgeLabelCoords",function(){QX(e)}),t(" undoCoordinateSystem",function(){S4.undo(e)}),t(" translateGraph",function(){YX(e)}),t(" assignNodeIntersects",function(){XX(e)}),t(" reversePoints",function(){ZX(e)}),t(" acyclic.undo",function(){_4.undo(e)})}function OX(e,t){Nt.forEach(e.nodes(),function(n){var r=e.node(n),a=t.node(n);r&&(r.x=a.x,r.y=a.y,t.children(n).length&&(r.width=a.width,r.height=a.height))}),Nt.forEach(e.edges(),function(n){var r=e.edge(n),a=t.edge(n);r.points=a.points,Nt.has(a,"x")&&(r.x=a.x,r.y=a.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var DX=["nodesep","edgesep","ranksep","marginx","marginy"],PX={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},FX=["acyclicer","ranker","rankdir","align"],BX=["width","height"],zX={width:0,height:0},UX=["minlen","weight","width","height","labeloffset"],$X={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},HX=["labelpos"];function qX(e){var t=new AX({multigraph:!0,compound:!0}),n=Zx(e.graph());return t.setGraph(Nt.merge({},PX,Qx(n,DX),Nt.pick(n,FX))),Nt.forEach(e.nodes(),function(r){var a=Zx(e.node(r));t.setNode(r,Nt.defaults(Qx(a,BX),zX)),t.setParent(r,e.parent(r))}),Nt.forEach(e.edges(),function(r){var a=Zx(e.edge(r));t.setEdge(r,Nt.merge({},$X,Qx(a,UX),Nt.pick(a,HX)))}),t}function WX(e){var t=e.graph();t.ranksep/=2,Nt.forEach(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function VX(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),a=e.node(t.w),i={rank:(a.rank-r.rank)/2+r.rank,e:t};Mi.addDummyNode(e,"edge-proxy",i,"_ep")}})}function GX(e){var t=0;Nt.forEach(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Nt.max(t,r.maxRank))}),e.graph().maxRank=t}function KX(e){Nt.forEach(e.nodes(),function(t){var n=e.node(t);n.dummy==="edge-proxy"&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function YX(e){var t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,a=0,i=e.graph(),s=i.marginx||0,l=i.marginy||0;function c(u){var d=u.x,f=u.y,g=u.width,p=u.height;t=Math.min(t,d-g/2),n=Math.max(n,d+g/2),r=Math.min(r,f-p/2),a=Math.max(a,f+p/2)}Nt.forEach(e.nodes(),function(u){c(e.node(u))}),Nt.forEach(e.edges(),function(u){var d=e.edge(u);Nt.has(d,"x")&&c(d)}),t-=s,r-=l,Nt.forEach(e.nodes(),function(u){var d=e.node(u);d.x-=t,d.y-=r}),Nt.forEach(e.edges(),function(u){var d=e.edge(u);Nt.forEach(d.points,function(f){f.x-=t,f.y-=r}),Nt.has(d,"x")&&(d.x-=t),Nt.has(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=a-r+l}function XX(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),a=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=a,s=r),n.points.unshift(Mi.intersectRect(r,i)),n.points.push(Mi.intersectRect(a,s))})}function QX(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);if(Nt.has(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function ZX(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function JX(e){Nt.forEach(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),a=e.node(n.borderBottom),i=e.node(Nt.last(n.borderLeft)),s=e.node(Nt.last(n.borderRight));n.width=Math.abs(s.x-i.x),n.height=Math.abs(a.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),Nt.forEach(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function eQ(e){Nt.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function tQ(e){var t=Mi.buildLayerMatrix(e);Nt.forEach(t,function(n){var r=0;Nt.forEach(n,function(a,i){var s=e.node(a);s.order=i+r,Nt.forEach(s.selfEdges,function(l){Mi.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:s.rank,order:i+ ++r,e:l.e,label:l.label},"_se")}),delete s.selfEdges})})}function nQ(e){Nt.forEach(e.nodes(),function(t){var n=e.node(t);if(n.dummy==="selfedge"){var r=e.node(n.e.v),a=r.x+r.width/2,i=r.y,s=n.x-a,l=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],n.label.x=n.x,n.label.y=n.y}})}function Qx(e,t){return Nt.mapValues(Nt.pick(e,t),Number)}function Zx(e){var t={};return Nt.forEach(e,function(n,r){t[r.toLowerCase()]=n}),t}var Cu=ln,rQ=yr,aQ=ua.Graph,iQ={debugOrdering:sQ};function sQ(e){var t=rQ.buildLayerMatrix(e),n=new aQ({compound:!0,multigraph:!0}).setGraph({});return Cu.forEach(e.nodes(),function(r){n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),Cu.forEach(e.edges(),function(r){n.setEdge(r.v,r.w,{},r.name)}),Cu.forEach(t,function(r,a){var i="layer"+a;n.setNode(i,{rank:"same"}),Cu.reduce(r,function(s,l){return n.setEdge(s,l,{style:"invis"}),l})}),n}var oQ="0.8.5",lQ={graphlib:ua,layout:IX,debug:iQ,util:{time:yr.time,notime:yr.notime},version:oQ};const Fd=No(lQ),cQ={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"}},uQ={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 dQ(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function N4(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function fQ({todos:e,darkMode:t}){const n=Array.isArray(e)?e:[],[r,a]=h.useState(null),i=h.useRef(null),s=h.useRef(null),[l,c]=h.useState(400),[u,d]=h.useState(function(){if(typeof window<"u"){const P=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(P)&&P>.1)return P}return 1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(u))},[u]);const[f,g]=h.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",f?"true":"false")},[f]);const[p,m]=h.useState(function(){if(typeof window<"u"){const P=localStorage.getItem("pave-map-rankdir");if(P==="LR"||P==="TB")return P}return"TB"});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",p)},[p]);const y=h.useMemo(function(){if(f)return n;const P=n.filter(function(O){return O.status!=="completed"}),W={};return P.forEach(function(O){W[O.id]=!0}),P.map(function(O){if(!O.blockedBy||!O.blockedBy.length)return O;const I=O.blockedBy.filter(function(T){return W[T]});return I.length===O.blockedBy.length?O:Object.assign({},O,{blockedBy:I})})},[n,f]);h.useEffect(function(){if(!i.current)return;function P(){i.current&&c(i.current.clientWidth||400)}P();const W=new ResizeObserver(P);return W.observe(i.current),function(){W.disconnect()}},[]);const v=h.useMemo(function(){if(!y.length)return{nodes:[],edges:[],width:0,height:0};const P=new Fd.graphlib.Graph;P.setGraph({rankdir:p,nodesep:24,ranksep:36,marginx:16,marginy:16}),P.setDefaultEdgeLabel(function(){return{}});const W=180,O=56;y.forEach(function(L){P.setNode(String(L.id),{width:W,height:O,todo:L})}),y.forEach(function(L){(L.blockedBy||[]).forEach(function(Z){P.hasNode(String(Z))&&P.setEdge(String(Z),String(L.id))})}),Fd.layout(P);const I=P.nodes().map(function(L){const $=P.node(L);return{id:L,x:$.x-W/2,y:$.y-O/2,w:W,h:O,todo:$.todo}}),T=P.edges().map(function(L){const $=P.edge(L);return{from:L.v,to:L.w,points:$.points}});return{nodes:I,edges:T,width:P.graph().width||W+32,height:P.graph().height||O+32}},[y,p]),x=t?uQ:cQ;if(!y.length){const P=n.length-y.length;return o.jsxs("div",{ref:i,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[o.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:o.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})})}),P>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[P," completed ",P===1?"todo is":"todos are"," hidden."]}),o.jsx("button",{type:"button",onClick:function(){g(!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"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),o.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 ",o.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function b(P){if(!P||P.length<2)return"";let W="M "+P[0].x+" "+P[0].y;for(let O=1;O<P.length;O++)W+=" L "+P[O].x+" "+P[O].y;return W}const k=n.reduce(function(P,W){const O=N4(W);return P[O]=(P[O]||0)+1,P},{}),N=k.completed||0,_=Math.max(v.width,100),w=Math.max(v.height,100),S=(_>l-24?1:(l-24)/_)*u,M=_*S,j=w*S;function F(P){(P.ctrlKey||P.metaKey)&&(P.preventDefault(),d(function(W){const O=P.deltaY<0?W*1.1:W/1.1;return Math.max(.25,Math.min(4,O))}))}return o.jsxs("div",{ref:i,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[o.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),o.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[o.jsxs("span",{children:[n.length," total"]}),k.in_progress?o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[k.in_progress," active"]}):null,N?o.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[N," done"]}):null,k.blocked?o.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[k.blocked," blocked"]}):null,o.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[o.jsx("button",{type:"button",onClick:function(){m(function(P){return P==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:p==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:p==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){d(function(P){return Math.max(.25,P/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),o.jsxs("button",{type:"button",onClick:function(){d(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(u*100),"%"]}),o.jsx("button",{type:"button",onClick:function(){d(function(P){return Math.min(4,P*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),N>0?o.jsx("button",{type:"button",onClick:function(){g(function(P){return!P})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(f?"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:f?"Hide completed todos":"Show completed todos",children:f?"hide done":"show done"}):null]})]}),o.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:F,children:o.jsxs("svg",{viewBox:"0 0 "+_+" "+w,width:M,height:j,style:{display:"block"},children:[o.jsx("defs",{children:o.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),v.edges.map(function(P,W){return o.jsx("path",{d:b(P.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+W)}),v.nodes.map(function(P){const W=N4(P.todo),O=x[W],I=W==="in_progress",T=r===P.id;return o.jsxs("g",{transform:"translate("+P.x+","+P.y+")",onMouseEnter:function(){a(P.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[o.jsx("rect",{width:P.w,height:P.h,rx:6,ry:6,fill:O.fill,stroke:O.stroke,strokeWidth:I||T?2:1.25,children:I?o.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),I?o.jsx("circle",{cx:10,cy:10,r:3.5,fill:O.stroke,children:o.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,o.jsx("text",{x:P.w/2,y:P.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:O.label,children:"#"+P.todo.id}),o.jsx("text",{x:P.w/2,y:P.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:dQ(P.todo.text,26)}),T&&P.todo.text&&P.todo.text.length>26?o.jsx("title",{children:P.todo.text}):null]},P.id)})]})})]})}const gQ={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"}},pQ={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},hQ={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},mQ={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"}},xQ={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},yQ={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},bQ={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},vQ={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},li={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function kQ(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function _Q(e,t){return e.kind==="thought"?t?vQ:bQ:e.status==="error"?t?yQ:hQ:(t?mQ:gQ)[e.tool]||(t?xQ:pQ)}function wQ({graph:e,darkMode:t,onNodeClick:n}){const r=e&&Array.isArray(e.nodes)?e.nodes:[],a=e&&Array.isArray(e.edges)?e.edges:[],i=h.useRef(null),s=h.useRef(null),[l,c]=h.useState(null),[u,d]=h.useState(400),[f,g]=h.useState(function(){if(typeof window<"u"){const I=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(I)&&I>.1)return I}return 1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(f))},[f]);const[p,m]=h.useState(function(){if(typeof window<"u"){const I=localStorage.getItem("pave-toolmap-rankdir");if(I==="LR"||I==="TB")return I}return"TB"});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",p)},[p]);const[y,v]=h.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",y?"true":"false")},[y]);const[x,b]=h.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",x?"true":"false")},[x]);const k=h.useMemo(function(){let I=r;return y||(I=I.filter(function(T){return!T.hidden})),x||(I=I.filter(function(T){return T.kind!=="thought"})),I},[r,y,x]),N=h.useMemo(function(){const I={};return k.forEach(function(T){I[T.id]=!0}),a.filter(function(T){return I[T.from]&&I[T.to]})},[a,k]),_=h.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const I=new Fd.graphlib.Graph;I.setGraph({rankdir:p,nodesep:18,ranksep:32,marginx:14,marginy:14}),I.setDefaultEdgeLabel(function(){return{}});const T=168,L=44,$=240,Z=60;k.forEach(function(V){V.kind==="thought"?I.setNode(V.id,{width:$,height:Z,node:V}):I.setNode(V.id,{width:T,height:L,node:V})}),N.forEach(function(V){I.hasNode(V.from)&&I.hasNode(V.to)&&I.setEdge(V.from,V.to,{kind:V.kind})}),Fd.layout(I);const R=I.nodes().map(function(V){const A=I.node(V);return{id:V,x:A.x-A.width/2,y:A.y-A.height/2,w:A.width,h:A.height,node:A.node}}),Y=I.edges().map(function(V){const A=I.edge(V);return{from:V.v,to:V.w,points:A.points||[],kind:A.kind||"seq"}});return{nodes:R,edges:Y,width:I.graph().width||T+28,height:I.graph().height||L+28}},[k,N,p]);h.useEffect(function(){if(!i.current)return;function I(){i.current&&d(i.current.clientWidth||400)}I();const T=new ResizeObserver(I);return T.observe(i.current),function(){T.disconnect()}},[]);const w=h.useMemo(function(){const I={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(T){if(T.kind==="thought"){I.thoughts++;return}I.total++,T.hidden&&I.hidden++,T.status==="error"?I.error++:T.status==="running"?I.running++:I.ok++}),I},[r]);if(!k.length)return o.jsxs("div",{ref:i,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[o.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:o.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})})}),o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),o.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."}),w.hidden>0&&!y?o.jsxs("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 ",w.hidden," hidden"]}):null]});function E(I){if(!I||I.length<2)return"";let T="M "+I[0].x+" "+I[0].y;for(let L=1;L<I.length;L++)T+=" L "+I[L].x+" "+I[L].y;return T}const S=Math.max(_.width,100),M=Math.max(_.height,100),F=(S>u-24?1:(u-24)/S)*f,P=S*F,W=M*F;function O(I){(I.ctrlKey||I.metaKey)&&(I.preventDefault(),g(function(T){const L=I.deltaY<0?T*1.1:T/1.1;return Math.max(.25,Math.min(4,L))}))}return o.jsxs("div",{ref:i,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[o.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),o.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[o.jsxs("span",{children:[w.total," tools"]}),w.running?o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[w.running," live"]}):null,w.error?o.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[w.error," err"]}):null,o.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[o.jsx("button",{type:"button",onClick:function(){m(function(I){return I==="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:p==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:p==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){g(function(I){return Math.max(.25,I/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:"−"}),o.jsxs("button",{type:"button",onClick:function(){g(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),o.jsx("button",{type:"button",onClick:function(){g(function(I){return Math.min(4,I*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:"+"})]}),w.hidden>0?o.jsx("button",{type:"button",onClick:function(){v(function(I){return!I})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(y?"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:y?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:y?"hide bk":"show bk"}):null,w.thoughts>0?o.jsx("button",{type:"button",onClick:function(){b(function(I){return!I})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(x?"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:x?"Hide reasoning bubbles":"Show reasoning bubbles ("+w.thoughts+" thoughts)",children:x?"💭 "+w.thoughts:"💭 off"}):null]})]}),o.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:O,children:o.jsxs("svg",{viewBox:"0 0 "+S+" "+M,width:P,height:W,style:{display:"block"},children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.data.dark:li.data.light})}),o.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.file.dark:li.file.light})}),o.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.seq.dark:li.seq.light})})]}),_.edges.map(function(I,T){const L=t?li[I.kind].dark:li[I.kind].light;return o.jsx("path",{d:E(I.points),fill:"none",stroke:L,strokeWidth:I.kind==="data"?1.75:I.kind==="file"?1.25:1,strokeDasharray:I.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+I.kind+")"},"e"+T)}),_.nodes.map(function(I){const T=I.node,L=_Q(T,t),$=T.status==="running",Z=l===I.id;if(T.kind==="thought"){const Y=T.label||"",V=32,A=3,H=Y.split(/\s+/),ce=[];let ee="";for(const Me of H){if(ce.length===A-1&&(ee+" "+Me).length>V){ce.push(ee);const X=H.slice(H.indexOf(Me)).join(" ");ce.push(X.length>V?X.slice(0,V-1)+"…":X),ee="";break}if(!ee){ee=Me;continue}if((ee+" "+Me).length<=V?ee=ee+" "+Me:(ce.push(ee),ee=Me),ce.length>=A)break}return ee&&ce.length<A&&ce.push(ee),o.jsxs("g",{transform:"translate("+I.x+","+I.y+")",onMouseEnter:function(){c(I.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(T)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:I.w,height:I.h,rx:I.h/2,ry:I.h/2,fill:L.fill,stroke:L.stroke,strokeWidth:Z?1.75:1,strokeDasharray:T.source==="reasoning"?void 0:"4,2"}),o.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:L.label,children:ce.map(function(Me,X){return o.jsx("tspan",{x:14,dy:X===0?14:11,children:(X===0?"💭 ":"")+Me},"ln"+X)})}),o.jsx("title",{children:(T.source==="reasoning"?"[reasoning] ":"[thought] ")+(T.fullText||T.label)})]},I.id)}return o.jsxs("g",{transform:"translate("+I.x+","+I.y+")",onMouseEnter:function(){c(I.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(T)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:I.w,height:I.h,rx:5,ry:5,fill:L.fill,stroke:L.stroke,strokeWidth:$||Z?2:1.25,opacity:T.hidden?.55:1,children:$?o.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),o.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:L.label,children:T.tool}),o.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:kQ(T.label,22)}),o.jsx("title",{children:T.tool+" · "+T.label+(T.status==="error"?" · ERROR":T.status==="running"?" · RUNNING":"")}),$?o.jsxs("g",{transform:"translate("+(I.w-9)+",9)",children:[o.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:L.stroke,strokeWidth:.75}),o.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[o.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),o.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},I.id)})]})})]})}/*! @license DOMPurify 3.4.13 | (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.13/LICENSE */function C4(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 EQ(e){if(Array.isArray(e))return e}function SQ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,s,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function NQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
104
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CQ(e,t){return EQ(e)||SQ(e,t)||jQ(e,t)||NQ()}function jQ(e,t){if(e){if(typeof e=="string")return C4(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)?C4(e,t):void 0}}const v3=Object.entries,j4=Object.setPrototypeOf,TQ=Object.isFrozen,RQ=Object.getPrototypeOf,AQ=Object.getOwnPropertyDescriptor;let Bn=Object.freeze,$n=Object.seal,Ks=Object.create,k3=typeof Reflect<"u"&&Reflect,Pb=k3.apply,Fb=k3.construct;Bn||(Bn=function(t){return t});$n||($n=function(t){return t});Pb||(Pb=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];return t.apply(n,a)});Fb||(Fb=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Us=wn(Array.prototype.forEach),IQ=wn(Array.prototype.lastIndexOf),T4=wn(Array.prototype.pop),$s=wn(Array.prototype.push),MQ=wn(Array.prototype.splice),hi=Array.isArray,ml=wn(String.prototype.toLowerCase),Jx=wn(String.prototype.toString),R4=wn(String.prototype.match),rl=wn(String.prototype.replace),A4=wn(String.prototype.indexOf),LQ=wn(String.prototype.trim),OQ=wn(Number.prototype.toString),DQ=wn(Boolean.prototype.toString),I4=typeof BigInt>"u"?null:wn(BigInt.prototype.toString),M4=typeof Symbol>"u"?null:wn(Symbol.prototype.toString),In=wn(Object.prototype.hasOwnProperty),al=wn(Object.prototype.toString),An=wn(RegExp.prototype.test),Vi=PQ(TypeError);function wn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return Pb(e,t,r)}}function PQ(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Fb(e,n)}}function Mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ml;if(j4&&j4(e,null),!hi(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(TQ(t)||(t[r]=i),a=i)}e[a]=!0}return e}function FQ(e){for(let t=0;t<e.length;t++)In(e,t)||(e[t]=null);return e}function Gn(e){const t=Ks(null);for(const r of v3(e)){var n=CQ(r,2);const a=n[0],i=n[1];In(e,a)&&(hi(i)?t[a]=FQ(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=Gn(i):t[a]=i)}return t}function BQ(e){switch(typeof e){case"string":return e;case"number":return OQ(e);case"boolean":return DQ(e);case"bigint":return I4?I4(e):"0";case"symbol":return M4?M4(e):"Symbol()";case"undefined":return al(e);case"function":case"object":{if(e===null)return al(e);const t=e,n=Zr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:al(r)}return al(e)}default:return al(e)}}function Zr(e,t){for(;e!==null;){const r=AQ(e,t);if(r){if(r.get)return wn(r.get);if(typeof r.value=="function")return wn(r.value)}e=RQ(e)}function n(){return null}return n}function zQ(e){try{return An(e,""),!0}catch{return!1}}const L4=Bn(["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"]),ey=Bn(["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"]),ty=Bn(["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"]),UQ=Bn(["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"]),ny=Bn(["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"]),$Q=Bn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),O4=Bn(["#text"]),D4=Bn(["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"]),ry=Bn(["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","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","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"]),P4=Bn(["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"]),ju=Bn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),HQ=$n(/{{[\w\W]*|^[\w\W]*}}/g),qQ=$n(/<%[\w\W]*|^[\w\W]*%>/g),WQ=$n(/\${[\w\W]*/g),VQ=$n(/^data-[\-\w.\u00B7-\uFFFF]+$/),GQ=$n(/^aria-[\-\w]+$/),F4=$n(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),KQ=$n(/^(?:\w+script|data):/i),YQ=$n(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),XQ=$n(/^html$/i),QQ=$n(/^[a-z][.\w]*(-[.\w]+)+$/i),B4=$n(/<[/\w!]/g),z4=$n(/<[/\w]/g),ZQ=$n(/<\/no(script|embed|frames)/i),JQ=$n(/\/>/i),wr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},eZ=function(){return typeof window>"u"?null:window},tZ=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},U4=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ci=function(t,n,r,a){return In(t,n)&&hi(t[n])?Mt(a.base?Gn(a.base):{},t[n],a.transform):r};function _3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eZ();const t=Be=>_3(Be);if(t.version="3.4.13",t.removed=[],!e||!e.document||e.document.nodeType!==wr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,f=e.trustedTypes,g=l.prototype,p=Zr(g,"cloneNode"),m=Zr(g,"remove"),y=Zr(g,"nextSibling"),v=Zr(g,"childNodes"),x=Zr(g,"parentNode"),b=Zr(g,"shadowRoot"),k=Zr(g,"attributes"),N=s&&s.prototype?Zr(s.prototype,"nodeType"):null,_=s&&s.prototype?Zr(s.prototype,"nodeName"):null,w=s&&s.prototype?Zr(s.prototype,"ownerDocument"):null;if(typeof i=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let E,S="",M,j=!1,F=0;const P=function(){if(F>0)throw Vi('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},W=function(z){P(),F++;try{return E.createHTML(z)}finally{F--}},O=function(z){P(),F++;try{return E.createScriptURL(z)}finally{F--}},I=function(){return j||(M=tZ(f,a),j=!0),M},T=n,L=T.implementation,$=T.createNodeIterator,Z=T.createDocumentFragment,R=T.getElementsByTagName,Y=r.importNode;let V=U4();t.isSupported=typeof v3=="function"&&typeof x=="function"&&L&&L.createHTMLDocument!==void 0;const A=HQ,H=qQ,ce=WQ,ee=VQ,Me=GQ,X=KQ,ye=YQ,Oe=QQ;let Ee=F4,de=null;const Se=Mt({},[...L4,...ey,...ty,...ny,...O4]);let Ae=null;const me=Mt({},[...D4,...ry,...P4,...ju]);let ve=Object.seal(Ks(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}})),De=null,K=null;const we=Object.seal(Ks(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Te=!0,ge=!0,xe=!1,he=!0,fe=!1,pe=!0,U=!1,D=!1,G=null,le=null,je=!1,$e=!1,Ve=!1,Qe=!1,Ye=!0,_t=!1;const He="user-content-";let at=!0,ue=!1,qe={},Ge=null;const bt=Mt({},["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 cn=null;const Hn=Mt({},["audio","video","img","source","image","track"]);let On=null;const hn=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),er="http://www.w3.org/1998/Math/MathML",an="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";let vr=Ct,oe=!1,te=null;const ke=Mt({},[er,an,Ct],Jx),Ie=Bn(["mi","mo","mn","ms","mtext"]);let We=Mt({},Ie);const ht=Bn(["annotation-xml"]);let mt=Mt({},ht);const It=Mt({},["title","style","font","a","script"]);let _e=null;const it=["application/xhtml+xml","text/html"],Ot="text/html";let Dt=null,qn=null;const Sn=n.createElement("form"),Kr=function(z){return z instanceof RegExp||z instanceof Function},Ja=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(qn&&qn===z)return;(!z||typeof z!="object")&&(z={}),z=Gn(z),_e=it.indexOf(z.PARSER_MEDIA_TYPE)===-1?Ot:z.PARSER_MEDIA_TYPE,Dt=_e==="application/xhtml+xml"?Jx:ml,de=ci(z,"ALLOWED_TAGS",Se,{transform:Dt}),Ae=ci(z,"ALLOWED_ATTR",me,{transform:Dt}),te=ci(z,"ALLOWED_NAMESPACES",ke,{transform:Jx}),On=ci(z,"ADD_URI_SAFE_ATTR",hn,{transform:Dt,base:hn}),cn=ci(z,"ADD_DATA_URI_TAGS",Hn,{transform:Dt,base:Hn}),Ge=ci(z,"FORBID_CONTENTS",bt,{transform:Dt}),De=ci(z,"FORBID_TAGS",Gn({}),{transform:Dt}),K=ci(z,"FORBID_ATTR",Gn({}),{transform:Dt}),qe=In(z,"USE_PROFILES")?z.USE_PROFILES&&typeof z.USE_PROFILES=="object"?Gn(z.USE_PROFILES):z.USE_PROFILES:!1,Te=z.ALLOW_ARIA_ATTR!==!1,ge=z.ALLOW_DATA_ATTR!==!1,xe=z.ALLOW_UNKNOWN_PROTOCOLS||!1,he=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=z.SAFE_FOR_TEMPLATES||!1,pe=z.SAFE_FOR_XML!==!1,U=z.WHOLE_DOCUMENT||!1,$e=z.RETURN_DOM||!1,Ve=z.RETURN_DOM_FRAGMENT||!1,Qe=z.RETURN_TRUSTED_TYPE||!1,je=z.FORCE_BODY||!1,Ye=z.SANITIZE_DOM!==!1,_t=z.SANITIZE_NAMED_PROPS||!1,at=z.KEEP_CONTENT!==!1,ue=z.IN_PLACE||!1,Ee=zQ(z.ALLOWED_URI_REGEXP)?z.ALLOWED_URI_REGEXP:F4,vr=typeof z.NAMESPACE=="string"?z.NAMESPACE:Ct,We=In(z,"MATHML_TEXT_INTEGRATION_POINTS")&&z.MATHML_TEXT_INTEGRATION_POINTS&&typeof z.MATHML_TEXT_INTEGRATION_POINTS=="object"?Gn(z.MATHML_TEXT_INTEGRATION_POINTS):Mt({},Ie),mt=In(z,"HTML_INTEGRATION_POINTS")&&z.HTML_INTEGRATION_POINTS&&typeof z.HTML_INTEGRATION_POINTS=="object"?Gn(z.HTML_INTEGRATION_POINTS):Mt({},ht);const ie=In(z,"CUSTOM_ELEMENT_HANDLING")&&z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING=="object"?Gn(z.CUSTOM_ELEMENT_HANDLING):Ks(null);if(ve=Ks(null),In(ie,"tagNameCheck")&&Kr(ie.tagNameCheck)&&(ve.tagNameCheck=ie.tagNameCheck),In(ie,"attributeNameCheck")&&Kr(ie.attributeNameCheck)&&(ve.attributeNameCheck=ie.attributeNameCheck),In(ie,"allowCustomizedBuiltInElements")&&typeof ie.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=ie.allowCustomizedBuiltInElements),$n(ve),fe&&(ge=!1),Ve&&($e=!0),qe&&(de=Mt({},O4),Ae=Ks(null),qe.html===!0&&(Mt(de,L4),Mt(Ae,D4)),qe.svg===!0&&(Mt(de,ey),Mt(Ae,ry),Mt(Ae,ju)),qe.svgFilters===!0&&(Mt(de,ty),Mt(Ae,ry),Mt(Ae,ju)),qe.mathMl===!0&&(Mt(de,ny),Mt(Ae,P4),Mt(Ae,ju))),we.tagCheck=null,we.attributeCheck=null,In(z,"ADD_TAGS")&&(typeof z.ADD_TAGS=="function"?we.tagCheck=z.ADD_TAGS:hi(z.ADD_TAGS)&&(de===Se&&(de=Gn(de)),Mt(de,z.ADD_TAGS,Dt))),In(z,"ADD_ATTR")&&(typeof z.ADD_ATTR=="function"?we.attributeCheck=z.ADD_ATTR:hi(z.ADD_ATTR)&&(Ae===me&&(Ae=Gn(Ae)),Mt(Ae,z.ADD_ATTR,Dt))),In(z,"ADD_URI_SAFE_ATTR")&&hi(z.ADD_URI_SAFE_ATTR)&&Mt(On,z.ADD_URI_SAFE_ATTR,Dt),In(z,"FORBID_CONTENTS")&&hi(z.FORBID_CONTENTS)&&(Ge===bt&&(Ge=Gn(Ge)),Mt(Ge,z.FORBID_CONTENTS,Dt)),In(z,"ADD_FORBID_CONTENTS")&&hi(z.ADD_FORBID_CONTENTS)&&(Ge===bt&&(Ge=Gn(Ge)),Mt(Ge,z.ADD_FORBID_CONTENTS,Dt)),at&&(de["#text"]=!0),U&&Mt(de,["html","head","body"]),de.table&&(Mt(de,["tbody"]),delete De.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Re=E;E=z.TRUSTED_TYPES_POLICY;try{S=W("")}catch(et){throw E=Re,et}}else z.TRUSTED_TYPES_POLICY===null?(E=void 0,S=""):(E===void 0&&(E=I()),E&&typeof S=="string"&&(S=W("")));Bn&&Bn(z),qn=z},ur=Mt({},[...ey,...ty,...UQ]),Tc=Mt({},[...ny,...$Q]),ei=function(z,ie,Re){return ie.namespaceURI===Ct?z==="svg":ie.namespaceURI===er?z==="svg"&&(Re==="annotation-xml"||We[Re]):!!ur[z]},js=function(z,ie,Re){return ie.namespaceURI===Ct?z==="math":ie.namespaceURI===an?z==="math"&&mt[Re]:!!Tc[z]},Rc=function(z,ie,Re){return ie.namespaceURI===an&&!mt[Re]||ie.namespaceURI===er&&!We[Re]?!1:!Tc[z]&&(It[z]||!ur[z])},Ac=function(z){let ie=x(z);(!ie||!ie.tagName)&&(ie={namespaceURI:vr,tagName:"template"});const Re=ml(z.tagName),et=ml(ie.tagName);return te[z.namespaceURI]?z.namespaceURI===an?ei(Re,ie,et):z.namespaceURI===er?js(Re,ie,et):z.namespaceURI===Ct?Rc(Re,ie,et):!!(_e==="application/xhtml+xml"&&te[z.namespaceURI]):!1},kr=function(z){$s(t.removed,{element:z});try{x(z).removeChild(z)}catch{if(m(z),!x(z))throw Vi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Dn=function(z){$i(z);const ie=v(z);if(ie){const et=[];Us(ie,st=>{$s(et,st)}),Us(et,st=>{try{m(st)}catch{}})}const Re=k(z);if(Re)for(let et=Re.length-1;et>=0;--et){const st=Re[et],gt=st&&st.name;if(typeof gt=="string")try{z.removeAttribute(gt)}catch{}}},mn=function(z,ie){try{$s(t.removed,{attribute:ie.getAttributeNode(z),from:ie})}catch{$s(t.removed,{attribute:null,from:ie})}if(ie.removeAttribute(z),z==="is")if($e||Ve)try{kr(ie)}catch{}else try{ie.setAttribute(z,"")}catch{}},Ic=function(z){const ie=k(z);if(ie)for(let Re=ie.length-1;Re>=0;--Re){const et=ie[Re],st=et&&et.name;if(!(typeof st!="string"||Ae[Dt(st)]))try{z.removeAttribute(st)}catch{}}},$i=function(z){const ie=[z];for(;ie.length>0;){const Re=ie.pop();(N?N(Re):Re.nodeType)===wr.element&&Ic(Re);const st=v(Re);if(st)for(let gt=st.length-1;gt>=0;--gt)ie.push(st[gt])}},da=function(z){if(!pe)return;const ie=[z];for(;ie.length>0;){const Re=ie.pop(),et=N?N(Re):Re.nodeType;if(et===wr.processingInstruction||et===wr.comment&&An(z4,Re.data)){try{m(Re)}catch{}continue}if(et===wr.element){const gt=Re,Pt=Dt(_?_(Re):Re.nodeName);try{gt.hasAttribute&>.hasAttribute("patchsrc")&>.removeAttribute("patchsrc"),gt.hasAttribute&>.hasAttribute("for")&&Pt!=="label"&&Pt!=="output"&>.removeAttribute("for")}catch{}}const st=v(Re);if(st)for(let gt=st.length-1;gt>=0;--gt)ie.push(st[gt])}},Mc=function(z){let ie=null,Re=null;if(je)z="<remove></remove>"+z;else{const gt=R4(z,/^[\r\n\t ]+/);Re=gt&>[0]}_e==="application/xhtml+xml"&&vr===Ct&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const et=E?W(z):z;if(vr===Ct)try{ie=new d().parseFromString(et,_e)}catch{}if(!ie||!ie.documentElement){ie=L.createDocument(vr,"template",null);try{ie.documentElement.innerHTML=oe?S:et}catch{}}const st=ie.body||ie.documentElement;return z&&Re&&st.insertBefore(n.createTextNode(Re),st.childNodes[0]||null),vr===Ct?R.call(ie,U?"html":"body")[0]:U?ie.documentElement:st},Ts=function(z){const ie=w?w(z):z.ownerDocument;return $.call(ie||z,z,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Rs=function(z){return z=rl(z,A," "),z=rl(z,H," "),z=rl(z,ce," "),z},ti=function(z){var ie;z.normalize();const Re=w?w(z):z.ownerDocument,et=$.call(Re||z,z,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let st=et.nextNode();for(;st;)st.data=Rs(st.data),st=et.nextNode();const gt=(ie=z.querySelectorAll)===null||ie===void 0?void 0:ie.call(z,"template");gt&&Us(gt,Pt=>{ja(Pt.content)&&ti(Pt.content)})},As=function(z){const ie=_?_(z):null;return typeof ie!="string"||Dt(ie)!=="form"?!1:typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||z.attributes!==k(z)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function"||z.nodeType!==N(z)||z.childNodes!==v(z)},ja=function(z){if(!N||typeof z!="object"||z===null)return!1;try{return N(z)===wr.documentFragment}catch{return!1}},Yr=function(z){if(!N||typeof z!="object"||z===null)return!1;try{return typeof N(z)=="number"}catch{return!1}};function dr(Be,z,ie){Be.length!==0&&Us(Be,Re=>{Re.call(t,z,ie,qn)})}const Df=function(z,ie){return!!(pe&&z.hasChildNodes()&&!Yr(z.firstElementChild)&&An(B4,z.textContent)&&An(B4,z.innerHTML)||pe&&z.namespaceURI===Ct&&ie==="style"&&Yr(z.firstElementChild)||z.nodeType===wr.processingInstruction||pe&&z.nodeType===wr.comment&&An(z4,z.data))},Hi=function(z,ie,Re){if(!De[ie]&&Dc(ie)&&(ve.tagNameCheck instanceof RegExp&&An(ve.tagNameCheck,ie)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(ie)))return!1;if(at&&!Ge[ie]){const et=x(z),st=v(z);if(st&&et){const gt=st.length;for(let Pt=gt-1;Pt>=0;--Pt){const $t=z===Re?p(st[Pt],!0):st[Pt];et.insertBefore($t,y(z))}}}return kr(z),!0},Bo=function(z,ie,Re,et){return z.length===0?ie:ie===Re||ie===et?Gn(ie):ie},tt=function(z,ie){if(dr(V.beforeSanitizeElements,z,null),z!==ie&&x(z)===null)return ue&&$i(z),!0;if(As(z))return kr(z),!0;const Re=Dt(_?_(z):z.nodeName);if(de=Bo(V.uponSanitizeElement,de,Se,G),dr(V.uponSanitizeElement,z,{tagName:Re,allowedTags:de}),z!==ie&&x(z)===null)return ue&&$i(z),!0;if(Df(z,Re))return kr(z),!0;if(De[Re]||!(we.tagCheck instanceof Function&&we.tagCheck(Re))&&!de[Re]){const st=Hi(z,Re,ie);return st===!1&&dr(V.afterSanitizeElements,z,null),st}if((N?N(z):z.nodeType)===wr.element&&!Ac(z)||(Re==="noscript"||Re==="noembed"||Re==="noframes")&&An(ZQ,z.innerHTML))return kr(z),!0;if(fe&&z.nodeType===wr.text){const st=Rs(z.textContent);z.textContent!==st&&($s(t.removed,{element:z.cloneNode()}),z.textContent=st)}return dr(V.afterSanitizeElements,z,null),!1},Lc=function(z,ie,Re){if(K[ie]||pe&&ie==="patchsrc"||pe&&ie==="for"&&z!=="label"&&z!=="output"||Ye&&(ie==="id"||ie==="name")&&(Re in n||Re in Sn))return!1;const et=Ae[ie]||we.attributeCheck instanceof Function&&we.attributeCheck(ie,z);if(!(ge&&An(ee,ie))){if(!(Te&&An(Me,ie))){if(et){if(!On[ie]){if(!An(Ee,rl(Re,ye,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&z!=="script"&&A4(Re,"data:")===0&&cn[z])){if(!(xe&&!An(X,rl(Re,ye,"")))){if(Re)return!1}}}}}else if(!(Dc(z)&&(ve.tagNameCheck instanceof RegExp&&An(ve.tagNameCheck,z)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(z))&&(ve.attributeNameCheck instanceof RegExp&&An(ve.attributeNameCheck,ie)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(ie,z))||ie==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&An(ve.tagNameCheck,Re)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(Re))))return!1}}return!0},Oc=Mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Dc=function(z){return!Oc[ml(z)]&&An(Oe,z)},Pf=function(z,ie,Re,et){if(E&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Re)switch(f.getAttributeType(z,ie)){case"TrustedHTML":return W(et);case"TrustedScriptURL":return O(et)}return et},Pc=function(z,ie,Re,et){try{Re?z.setAttributeNS(Re,ie,et):z.setAttribute(ie,et),As(z)?kr(z):T4(t.removed)}catch{mn(ie,z)}},Fc=function(z){dr(V.beforeSanitizeAttributes,z,null);const ie=z.attributes;if(!ie||As(z))return;Ae=Bo(V.uponSanitizeAttribute,Ae,me,le);const Re={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let et=ie.length;const st=Dt(z.nodeName);for(;et--;){const gt=ie[et],Pt=gt.name,$t=gt.namespaceURI,un=gt.value,Qt=Dt(Pt),ri=un;let xn=Pt==="value"?ri:LQ(ri);if(Re.attrName=Qt,Re.attrValue=xn,Re.keepAttr=!0,Re.forceKeepAttr=void 0,dr(V.uponSanitizeAttribute,z,Re),xn=Re.attrValue,_t&&(Qt==="id"||Qt==="name")&&A4(xn,He)!==0&&(mn(Pt,z),xn=He+xn),pe&&An(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,xn)){mn(Pt,z);continue}if(Qt==="attributename"&&R4(xn,"href")){mn(Pt,z);continue}if(!Re.forceKeepAttr){if(!Re.keepAttr){mn(Pt,z);continue}if(!he&&An(JQ,xn)){mn(Pt,z);continue}if(fe&&(xn=Rs(xn)),!Lc(st,Qt,xn)){mn(Pt,z);continue}xn=Pf(st,Qt,$t,xn),xn!==ri&&Pc(z,Pt,$t,xn)}}dr(V.afterSanitizeAttributes,z,null)},ni=function(z){let ie=null;const Re=Ts(z);for(dr(V.beforeSanitizeShadowDOM,z,null);ie=Re.nextNode();)if(dr(V.uponSanitizeShadowNode,ie,null),tt(ie,z),Fc(ie),ja(ie.content)&&ni(ie.content),(N?N(ie):ie.nodeType)===wr.element){const st=b(ie);ja(st)&&(zo(st),ni(st))}dr(V.afterSanitizeShadowDOM,z,null)},zo=function(z){const ie=[{node:z,shadow:null}];for(;ie.length>0;){const Re=ie.pop();if(Re.shadow){ni(Re.shadow);continue}const et=Re.node,gt=(N?N(et):et.nodeType)===wr.element,Pt=v(et);if(Pt)for(let $t=Pt.length-1;$t>=0;--$t)ie.push({node:Pt[$t],shadow:null});if(gt){const $t=_?_(et):null;if(typeof $t=="string"&&Dt($t)==="template"){const un=et.content;ja(un)&&ie.push({node:un,shadow:null})}}if(gt){const $t=b(et);ja($t)&&ie.push({node:null,shadow:$t},{node:$t,shadow:null})}}};return t.sanitize=function(Be){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,Re=null,et=null,st=null;if(oe=!Be,oe&&(Be="<!-->"),typeof Be!="string"&&!Yr(Be)&&(Be=BQ(Be),typeof Be!="string"))throw Vi("dirty is not a string, aborting");if(!t.isSupported)return Be;D?(de=G,Ae=le):Ja(z),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(de=Gn(de)),V.uponSanitizeAttribute.length>0&&(Ae=Gn(Ae)),t.removed=[];const gt=ue&&typeof Be!="string"&&Yr(Be);if(gt){da(Be);const un=_?_(Be):Be.nodeName;if(typeof un=="string"){const Qt=Dt(un);if(!de[Qt]||De[Qt])throw Dn(Be),Vi("root node is forbidden and cannot be sanitized in-place")}if(As(Be))throw Dn(Be),Vi("root node is clobbered and cannot be sanitized in-place");try{zo(Be)}catch(Qt){throw Dn(Be),Qt}}else if(Yr(Be))ie=Mc("<!---->"),Re=ie.ownerDocument.importNode(Be,!0),Re.nodeType===wr.element&&Re.nodeName==="BODY"||Re.nodeName==="HTML"?ie=Re:ie.appendChild(Re),zo(Re);else{if(!$e&&!fe&&!U&&Be.indexOf("<")===-1)return E&&Qe?W(Be):Be;if(ie=Mc(Be),!ie)return $e?null:Qe?S:""}ie&&je&&kr(ie.firstChild);const Pt=gt?Be:ie;try{const un=Ts(Pt);for(;et=un.nextNode();)tt(et,Pt),Fc(et),ja(et.content)&&ni(et.content)}catch(un){throw gt&&(Dn(Be),Us(t.removed,Qt=>{Qt.element&&$i(Qt.element)})),un}if(gt)return Us(t.removed,un=>{un.element&&$i(un.element)}),fe&&ti(Be),Be;if($e){if(fe&&ti(ie),Ve)for(st=Z.call(ie.ownerDocument);ie.firstChild;)st.appendChild(ie.firstChild);else st=ie;return(Ae.shadowroot||Ae.shadowrootmode)&&(st=Y.call(r,st,!0)),st}let $t=U?ie.outerHTML:ie.innerHTML;return U&&de["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&An(XQ,ie.ownerDocument.doctype.name)&&($t="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
|
|
105
|
-
`+$t),fe&&($t=Rs($t)),E&&Qe?W($t):$t},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ja(Be),D=!0,G=de,le=Ae},t.clearConfig=function(){qn=null,D=!1,G=null,le=null,E=M,S=""},t.isValidAttribute=function(Be,z,ie){qn||Ja({});const Re=Dt(Be),et=Dt(z);return Lc(Re,et,ie)},t.addHook=function(Be,z){typeof z=="function"&&In(V,Be)&&$s(V[Be],z)},t.removeHook=function(Be,z){if(In(V,Be)){if(z!==void 0){const ie=IQ(V[Be],z);return ie===-1?void 0:MQ(V[Be],ie,1)[0]}return T4(V[Be])}},t.removeHooks=function(Be){In(V,Be)&&(V[Be]=[])},t.removeAllHooks=function(){V=U4()},t}var nZ=_3();let ay=null;function rZ(){return ay||(ay=S5(()=>import("./mermaid.core-D_mctH75.js").then(e=>e.bo),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),ay}function $4(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let H4=0;function aZ(){return H4+=1,"pave-canvas-"+H4}function iZ({source:e}){const t=h.useRef(null),n=h.useRef(aZ()),[r,a]=h.useState(null),[i,s]=h.useState($4());return h.useEffect(function(){if(typeof window>"u")return;const l=new MutationObserver(function(){const c=$4();s(function(u){return u!==c?c:u})});return l.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){l.disconnect()}},[]),h.useEffect(function(){let l=!1;return a(null),rZ().then(function(c){l||(c.initialize({startOnLoad:!1,securityLevel:"strict",theme:i?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),c.render(n.current,e).then(function(u){if(!l&&t.current){let d=u.svg;d=d.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),d=d.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),d=d.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),d=d.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=d}}).catch(function(u){l||a(u&&u.message||String(u))}))}).catch(function(c){l||a("Failed to load mermaid: "+(c&&c.message||String(c)))}),function(){l=!0}},[e,i]),r?o.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[o.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),o.jsx("pre",{className:"whitespace-pre-wrap",children:r}),o.jsxs("details",{className:"mt-2",children:[o.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),o.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):o.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 sZ({source:e}){const t=h.useMemo(function(){return nZ.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return o.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function oZ({source:e}){return o.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function lZ({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=o.jsx(iZ,{source:e.source}):e.type==="svg"?t=o.jsx(sZ,{source:e.source}):e.type==="katex"?t=o.jsx(oZ,{source:e.source}):t=o.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function q4({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,a]=h.useState(Math.max(0,n.length-1)),[i,s]=h.useState(1),[l,c]=h.useState(!1);h.useEffect(function(){a(function(v){return v>=n.length-2?Math.max(0,n.length-1):Math.min(v,Math.max(0,n.length-1))})},[n.length]),h.useEffect(function(){s(1)},[r]),h.useEffect(function(){if(!l)return;const v=x=>{x.key==="Escape"&&c(!1)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[l]);const u=h.useCallback(()=>s(v=>Math.min(4,+(v+.25).toFixed(2))),[]),d=h.useCallback(()=>s(v=>Math.max(.5,+(v-.25).toFixed(2))),[]),f=h.useCallback(()=>s(1),[]);if(n.length===0)return o.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[o.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:o.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"})}),o.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 ",o.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 g=Math.min(Math.max(0,r),n.length-1),p=n[g],m=o.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?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>a(Math.max(0,g-1)),disabled:g===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:"←"}),o.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[g+1,"/",n.length]}),o.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,g+1)),disabled:g===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:"→"})]}):o.jsx("div",{}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:d,disabled:i<=.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:"−"}),o.jsxs("button",{type:"button",onClick:f,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(i*100),"%"]}),o.jsx("button",{type:"button",onClick:u,disabled:i>=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:"+"}),o.jsx("button",{type:"button",onClick:()=>c(v=>!v),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:l?"Exit fullscreen (Esc)":"Fullscreen",children:l?"⤢":"⛶"}),t?o.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]})]}),y=o.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[p.title?o.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:p.title}):null,o.jsx("div",{style:{transform:`scale(${i})`,transformOrigin:"top left",width:i===1?"100%":`${100/i}%`},children:o.jsx(lZ,{canvas:p})}),p.caption?o.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:p.caption}):null]});return l?o.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[m,y]}):o.jsxs("div",{className:"h-full flex flex-col",children:[m,y]})}function cZ(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function uZ(e,t){const n=cZ(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}const q1={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function W1(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function V1(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}const W4={"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},dZ=128e3;function iy(e){const[t,n]=h.useState(e),r=h.useRef(e),a=h.useRef(0),i=h.useRef(0);return h.useEffect(()=>{if(e===r.current)return;a.current=0,r.current=t;const s=400,l=t,c=e,u=d=>{a.current||(a.current=d);const f=d-a.current,g=Math.min(f/s,1),p=1-Math.pow(1-g,3);n(Math.round(l+(c-l)*p)),g<1?i.current=requestAnimationFrame(u):n(c)};return i.current=requestAnimationFrame(u),()=>cancelAnimationFrame(i.current)},[e]),t}function fZ({messages:e,isBusy:t,activeModel:n,sessionModel:r,isPrivateMode:a,registryEntries:i}){var Y,V;var{t:s}=Rt();const l=e.filter(A=>{var H;return((H=A.info)==null?void 0:H.role)==="user"}).length,c=e.filter(A=>{var H;return((H=A.info)==null?void 0:H.role)==="assistant"}).length;let u=0,d=0,f=0,g=null,p=null;for(let A=e.length-1;A>=0;A--){const H=e[A];if(((Y=H.info)==null?void 0:Y.role)==="assistant"&&((V=H.info)==null?void 0:V.mode)!=="compaction"){const ce=H.info.tokens;if(ce&&(ce.input||ce.output)){!g&&H.info.modelID&&(g=H.info.modelID),u=ce.lastInput??ce.input??0,d=ce.lastOutput??ce.output??0,f=ce.lastReasoning??ce.reasoning??0,H.info.contextLimit&&(p=H.info.contextLimit);break}}}const m=iy(u),y=iy(d),v=iy(f),x=m+y+v,b=u+d+f>0;let k=n;typeof r=="string"&&r?k=r:r&&r.providerID&&r.modelID&&(k=r.providerID+"/"+r.modelID);let{modelID:N,activeModelID:_}=uZ(k,g),w=null;if(a){N="privacy",_="privacy";let A=null;typeof r=="string"&&r?A=r.includes("/")?r.split("/").pop():r:r&&r.modelID&&(A=r.modelID),w=A||(n?String(n).split("/").pop():null)}else g&&_&&g!==_&&(w=g);const E=h.useMemo(()=>{const A={};if(i&&i.length>0){for(const H of i)if(H.limit&&typeof H.limit.context=="number"&&H.limit.context>0){A[H.key]=H.limit.context;const ce=H.key.includes("/")?H.key.split("/").pop():H.key;ce&&(A[ce]=H.limit.context)}}return A},[i]),S=g||N,j=!!(g&&_&&g!==_)&&(E[k]||E[N]||W4[N])||p||E[S]||E[k]||W4[S]||dZ,F=Math.min(100,Math.round(m/j*100));let P="bg-green-500";F>=90?P="bg-red-500":F>=75?P="bg-orange-500":F>=50&&(P="bg-yellow-500");const W="border-gray-200 dark:border-gray-800",O="text-gray-500 dark:text-gray-400",I="text-gray-500 dark:text-gray-400",T="text-gray-700 dark:text-gray-300",L="border-gray-100 dark:border-gray-800";return o.jsxs("div",{className:`p-4 border-t ${W}`,children:[o.jsx("p",{className:`text-xs ${O} uppercase tracking-wide font-medium mb-3`,children:s("token_usage.session_info")}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:s("token_usage.messages")}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:l+c})]}),N&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:s("token_usage.model")}),o.jsx("span",{className:`text-xs font-medium ${T} truncate ml-2 max-w-[140px]`,children:V4(N)})]}),w&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:s("token_usage.originally")}),o.jsx("span",{className:`text-xs ${I} truncate ml-2 max-w-[140px]`,children:V4(w)})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:s("token_usage.status")}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${t?"bg-accent-400 animate-pulse":"bg-green-500"}`}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:s(t?"token_usage.generating":"token_usage.idle")})]})]}),b?o.jsx(o.Fragment,{children:o.jsxs("div",{className:`border-t ${L} pt-2 mt-2`,children:[o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:`text-xs ${I}`,children:"Context"}),o.jsxs("span",{className:`text-xs ${I}`,children:[F,"% of ",(j/1e3).toFixed(0),"k"]})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${P} transition-all duration-300`,style:{width:`${F}%`}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:"Input"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:m.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${I}`,children:"Output"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:y.toLocaleString()})]}),f>0&&o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${I}`,children:"Reasoning"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:v.toLocaleString()})]}),o.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${L}`,children:[o.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Total"}),o.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:x.toLocaleString()})]})]})}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${I}`,children:"Tokens"}),o.jsx("span",{className:`text-xs ${I}`,children:"--"})]})]})]})}function V4(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 gZ({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:i}){const{t:s}=Rt(),[l,c]=h.useState(!1),u=h.useRef(null),[d,f]=h.useState(-1),g=h.useRef([]);h.useEffect(()=>{if(!l)return;function b(k){u.current&&!u.current.contains(k.target)&&c(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),h.useEffect(()=>{if(!l)return;function b(k){if(k.key==="Escape"){c(!1);return}k.key!=="ArrowDown"&&k.key!=="ArrowUp"&&k.key!=="Home"&&k.key!=="End"||(k.preventDefault(),f(N=>{const _=g.current.length;if(!_)return N;const w=typeof N=="number"?N:-1;let E=w;return k.key==="ArrowDown"?E=w<_-1?w+1:0:k.key==="ArrowUp"?E=w>0?w-1:_-1:k.key==="Home"?E=0:k.key==="End"&&(E=_-1),g.current[E]&&g.current[E].focus(),E}))}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[l]);const p=typeof e=="string"&&e.trim()?e.trim():null,m=p!=null,y=Array.isArray(n)?n:[],v=pZ(p,t,y,s),x=h.useCallback(b=>{r(b===t||p&&p===b?null:b),c(!1)},[p,t,r]);return g.current.length=y.length,o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(b=>!b),disabled:a,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(m||v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(a?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:i||s("model_selector.title"),"aria-label":i||s("model_selector.title"),"aria-haspopup":"menu","aria-expanded":l,children:[i?o.jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.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"}),o.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):o.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{className:"max-w-[120px] truncate",children:v}),o.jsx("svg",{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&o.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":s("model_selector.list_label"),children:[y.length===0&&o.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:s("model_selector.no_models")}),y.map((b,k)=>{const N=p===b.key,_=!!t&&(b.key===t||b.target===t||b.url===t),w=b.builtin?b.key:b.displayName||b.key;return o.jsxs("button",{type:"button",ref:E=>{g.current[k]=E},tabIndex:d===k?0:-1,role:"menuitemradio","aria-checked":N||!m&&_,onClick:()=>x(b.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(N||!m&&_?"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:[o.jsx("span",{className:"font-medium",children:w}),_&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",s("model_selector.default_label"),")"]})]},b.key)})]})]})}function pZ(e,t,n,r){return e?G4(e,n):t?G4(t,n):r("model_selector.default_label")}function hZ(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 G4(e,t){if(!e)return"";const n=hZ(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function mZ(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,a=e.t,i=e.disabled,s=h.useState(!1),l=s[0],c=s[1],u=h.useState([]),d=u[0],f=u[1],g=h.useState(!1),p=g[0],m=g[1],y=h.useRef(null),v=t instanceof Array?new Set(t):new Set,x=h.useCallback(async function(){m(!0);try{var w=await _1();f(w||[])}catch{}finally{m(!1)}},[]);h.useEffect(function(){x()},[x]),h.useEffect(function(){if(!l)return;function w(E){y.current&&!y.current.contains(E.target)&&c(!1)}return document.addEventListener("mousedown",w),function(){document.removeEventListener("mousedown",w)}},[l]);var b=v.size,k=v.has("agent"),N=k?b-1:b,_=Math.max(0,d.length-N+(k?0:1));return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{onClick:function(){c(!l)},disabled:i,className:"p-1.5 rounded-lg transition-colors "+(b>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")+(i?" opacity-50 cursor-not-allowed":""),title:a("skills.toggle_title"),"aria-label":a("skills.toggle_title"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),_>0&&o.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:_})]}),l&&o.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:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[o.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:a("skills.toggle_header")}),o.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:a("skills.toggle_hint")})]}),p?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):d.length===0?o.jsx("div",{className:"px-3 py-4 text-center",children:o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("skills.no_skills")})}):o.jsx("div",{className:"py-1",children:d.map(function(w){var E=v.has(w.name);return o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:w.name}),o.jsx("button",{onClick:function(){n(w.name,E)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(E?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!E,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(E?"translate-x-1":"translate-x-5")})})]},w.name)})}),o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("p",{className:"text-[10px] font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:a("skills.builtin_tools")})}),o.jsx("div",{className:"py-1",children:o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:a("skills.agent_comm")}),o.jsx("button",{onClick:function(){n("agent",k)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(k?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!k,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(k?"translate-x-1":"translate-x-5")})})]})}),r&&o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("button",{onClick:r,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:a("skills.reset_to_defaults")})})]})]})}function xZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.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 yZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 bZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 vZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 kZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 _Z({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 wZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 EZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function SZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 NZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.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 CZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.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 jZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.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 TZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.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 RZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.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 AZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.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 K4={gmail:yZ,gdrive:bZ,discord:vZ,whatsapp:kZ,wrike:_Z,gtasks:wZ,mailchimp:EZ,bamboohr:SZ,pandadoc:NZ,exa:CZ,dropbox:jZ,freshbooks:TZ,gcal:RZ,docx2md:AZ};function IZ(e){return Object.prototype.hasOwnProperty.call(K4,e)?K4[e]:xZ}const Y4={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"};function MZ({installed:e,configured:t,t:n}){return e?t?o.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:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.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")]}):o.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:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.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")]}):o.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 LZ({skill:e,onClose:t,onSaved:n}){var{t:r}=Rt(),a=hc(),[i,s]=h.useState({}),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,g]=h.useState(null),[p,m]=h.useState(!1),[y,v]=h.useState(null);h.useEffect(function(){var S=!1;async function M(){try{var j=await UH(e.name);if(S)return;v(j);for(var F=Object.create(null),P=Object.keys(j.tokens||{}),W=0;W<P.length;W++){var O=P[W],I=j.tokens[O]||{},T=I.env||O;F[T]=""}s(F),c(!1)}catch(L){S||(g(L.message),c(!1))}}return M(),function(){S=!0}},[e.name]);var x=h.useMemo(function(){if(!y||!y.tokens)return null;for(var S=Object.keys(y.tokens),M=0;M<S.length;M++){var j=y.tokens[S[M]]||{};if(j.description&&j.description.includes("OAuth")){for(var F=null,P=null,W=null,O=Object.entries(y.tokens),I=0;I<O.length;I++){var T=O[I][0];T.includes("REFRESH_TOKEN")&&(F=T),(T.includes("CLIENT_ID")||T.includes("APP_KEY"))&&(P=T),(T.includes("CLIENT_SECRET")||T.includes("APP_SECRET"))&&(W=T)}if(F&&P){var L=y.tokens[F]&&y.tokens[F].configured,$=y.tokens[P]&&y.tokens[P].configured,Z=W&&y.tokens[W]&&y.tokens[W].configured,R="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?R="Google":e.name==="dropbox"?R="Dropbox":e.name==="freshbooks"&&(R="FreshBooks"),{provider:R,canConnect:$&&Z&&!L,refreshConfigured:L,clientIdConfigured:$,clientSecretConfigured:Z}}}}return null},[y,e.name]),b=h.useCallback(async function(){g(null),m(!0);try{var S=await YH(e.name),M=600,j=700,F=(window.screen.width-M)/2,P=(window.screen.height-j)/2,W=window.open(S.authorizeUrl,"oauth_popup","width="+M+",height="+j+",left="+F+",top="+P+",scrollbars=yes");if(W)var O=setInterval(function(){W.closed&&(clearInterval(O),m(!1),n())},500);else g("Popup blocked. Please allow popups or visit: "+S.authorizeUrl),m(!1)}catch(I){g(I.message),m(!1)}},[e.name,n]),k=h.useCallback(async function(){g(null),d(!0);try{for(var S=Object.create(null),M=Object.keys(i),j=0;j<M.length;j++){var F=M[j];i[F]&&i[F].trim()&&(S[F]=i[F].trim())}if(Object.keys(S).length===0){g(r("skills.enter_token")),d(!1);return}await WH(e.name,S),n()}catch(P){g(P.message)}finally{d(!1)}},[i,e.name,n,r]),N=h.useCallback(async function(){if(await a({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){g(null),d(!0);try{await VH(e.name),n()}catch(S){g(S.message)}finally{d(!1)}}},[e.name,n,a,r]),_=h.useCallback(function(S,M){s(function(j){var F=Object.assign(Object.create(null),j);return F[S]=M,F})},[]),w=y?Object.entries(y.tokens||{}).map(function(S){var M=S[0],j=S[1],F=j&&j.env||M;return{name:M,env:F,description:j.description,configured:j.configured,maskedValue:j.maskedValue}}):[],E=h.useRef(null);return h.useEffect(function(){function S(M){M.key==="Escape"&&t()}return document.addEventListener("keydown",S),E.current&&E.current.focus(),function(){document.removeEventListener("keydown",S)}},[t]),o.jsx("div",{ref:E,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:o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(S){S.stopPropagation()},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),o.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:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),l&&o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!l&&w.length>0&&o.jsx("div",{className:"space-y-3 mb-4",children:w.map(function(S){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[S.env,S.configured&&o.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:S.maskedValue}),")"]})]}),S.description&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:S.description}),o.jsx("input",{type:"password",placeholder:S.configured?r("skills.leave_blank"):r("skills.enter_value"),value:i[S.env]||"",onChange:function(M){_(S.env,M.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"})]},S.env)})}),!l&&x&&o.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:x.canConnect?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:x.provider})}),o.jsx("button",{onClick:b,disabled:p||u,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:p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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:x.provider})]})})]}):x.refreshConfigured?o.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.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:x.provider})]}):o.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:x.provider})})}),!l&&!f&&w.length===0&&o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),f&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:f}),!l&&w.length>0&&o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("button",{onClick:N,disabled:u,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")}),o.jsxs("div",{className:"flex gap-2",children:[o.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")}),o.jsx("button",{onClick:k,disabled:u,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(u?"skills.saving":"skills.save")})]})]})]})})}function OZ({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:i,onUpdate:s,onUninstall:l,skillDefaultEnabled:c,onToggleDefault:u,t:d}){var f=IZ(e.name),g=Object.prototype.hasOwnProperty.call(Y4,e.name)?Y4[e.name]:"#6B7280",[p,m]=h.useState(!1),y=r===e.name,v=n&&n.hasUpdate,x=h.useCallback(async function(){m(!0);try{await i(e)}finally{m(!1)}},[e,i]),b=h.useCallback(function(){s&&s(e.name)},[e.name,s]);return o.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:[o.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:g}}),o.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[o.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:g+"15"},children:o.jsx(f,{className:"w-5 h-5",style:{color:g}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsx(MZ,{installed:t,configured:t&&e.allTokensConfigured,t:d}),t&&v&&o.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:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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&&!v&&o.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:d("skills.up_to_date")})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||d("skills.no_description")}),e.version&&o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),o.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:function(){a(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("skills.configure")}),u&&o.jsxs("button",{onClick:function(){u(e.name,!c)},title:d("skills.default_for_new_sessions"),className:"px-2 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 "+(c?"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:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),d("skills.default")]}),v&&o.jsx("button",{onClick:b,disabled:y,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:y?o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),d("skills.updating")]}):d("skills.update")}),l&&o.jsx("button",{onClick:function(){l(e)},title:d("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":d("skills.uninstall"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]}):o.jsx("button",{onClick:x,disabled:p,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:p?o.jsxs("span",{className:"flex items-center justify-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),d("skills.installing")]}):d("skills.install")})})]})}function DZ({onBack:e}){var{t}=Rt(),[n,r]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState("all"),[m,y]=h.useState(""),[v,x]=h.useState(!1),[b,k]=h.useState(Object.create(null)),[N,_]=h.useState(null),[w,E]=h.useState(!1),[S,M]=h.useState(Object.create(null)),j=hc(),F=h.useCallback(async function(){l(!0),u(null),E(!1);try{var H=await Promise.allSettled([_1(),zH(),QA()]),ce=H[0].status==="fulfilled"?H[0].value:[],ee=H[1].status==="fulfilled"?H[1].value:[],Me=H[2].status==="fulfilled"?H[2].value.skillDefaults||{}:{};r(ce),i(ee),M(Me);var X=[];H[0].status==="rejected"&&X.push(t("skills.load_installed_failed",{error:H[0].reason.message})),H[1].status==="rejected"&&X.push(t("skills.load_marketplace_failed",{error:H[1].reason.message})),X.length>0&&u(X.join("; "))}catch(ye){u(ye.message)}finally{l(!1)}},[t]);h.useEffect(function(){F()},[F]);var P=[],W=new Set(n.map(function(H){return H.name}));n.forEach(function(H){P.push(Object.assign({},H,{_installed:!0}))}),a.forEach(function(H){W.has(H.name)||P.push(Object.assign({},H,{_installed:!1,allTokensConfigured:!1}))});var O=P;if(g==="installed"?O=P.filter(function(H){return H._installed}):g==="available"&&(O=P.filter(function(H){return!H._installed})),m){var I=m.toLowerCase();O=O.filter(function(H){return H.name&&H.name.toLowerCase().indexOf(I)!==-1||H.description&&H.description.toLowerCase().indexOf(I)!==-1||H.category&&H.category.toLowerCase().indexOf(I)!==-1})}var T=h.useCallback(async function(H){try{await $H(H.name),F()}catch(ce){u(t("skills.install_failed",{error:ce.message}))}},[F,t]),L=h.useCallback(function(H){f(H)},[]),$=h.useCallback(async function(H){if(await j({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:H.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await GH(H.name),F()}catch(ce){u(t("skills.uninstall_failed",{error:ce.message}))}},[F,j,t]),Z=h.useCallback(function(){f(null),F()},[F]),R=h.useCallback(async function(H,ce){M(function(Me){var X=Object.assign({},Me);return ce?X[H]=!0:delete X[H],X});try{var ee={};ee[H]=ce,await KH(ee)}catch(Me){M(function(X){var ye=Object.assign({},X);return ce?delete ye[H]:ye[H]=!0,ye}),u(Me.message)}},[]),Y=h.useCallback(async function(){x(!0),u(null);try{var H=await qH(),ce=Object.create(null);(H.skills||[]).forEach(function(ee){ce[ee.name]={hasUpdate:ee.hasUpdate,latestVersion:ee.latestVersion,currentVersion:ee.currentVersion}}),k(ce),E(!0)}catch(ee){u(ee.message)}finally{x(!1)}},[]),V=h.useCallback(async function(H){_(H),u(null);try{var ce=await HH(H);ce.updated&&(k(function(ee){var Me=Object.assign(Object.create(null),ee);return Me[H]={hasUpdate:!1,latestVersion:ee[H]?ee[H].latestVersion:null,currentVersion:ee[H]?ee[H].currentVersion:null},Me}),F())}catch(ee){u(t("skills.update_failed")+": "+ee.message)}finally{_(null)}},[F,t]),A=Object.values(b).filter(function(H){return H&&H.hasUpdate}).length;return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.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:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:a.filter(function(H){return!W.has(H.name)}).length})})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:Y,disabled:v||s,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:v?o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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")]})}),A>0&&o.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:A})}),w&&A===0&&!v&&o.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")}),o.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(H){return o.jsx("button",{onClick:function(){p(H)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(g===H?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+H)},H)})})]})]}),o.jsx("div",{className:"flex-shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:o.jsxs("div",{className:"relative",children:[o.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:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),o.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:m,onChange:function(H){y(H.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-none focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[s&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),c&&o.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:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:c})}),!s&&O.length===0&&o.jsx("div",{className:"text-center py-12",children:o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(m?"skills.no_match":"skills.no_skills")})}),!s&&O.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:O.map(function(H){return o.jsx(OZ,{skill:H,installed:H._installed,updateInfo:b[H.name],updatingSkill:N,onConfigure:L,onInstall:T,onUpdate:V,onUninstall:H._installed?$:null,skillDefaultEnabled:!!S[H.name],onToggleDefault:H._installed?R:null,t},H.name)})})]}),d&&o.jsx(LZ,{skill:d,onClose:function(){f(null)},onSaved:Z})]})}const Yt="";function Xt(e,t={}){return fetch(e,{credentials:"include",...t})}async function PZ(){const e=await Xt(Yt+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function FZ(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function Bb(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/start",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to start agent")}return t.json()}async function zb(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/stop",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to stop agent")}return t.json()}async function Bd(e,t){const n={};t&&t.clean&&(n.clean=!0);const r=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to restart agent")}return r.json()}async function Ub(e,t){const n={};t&&t.level&&(n.level=t.level),t&&t.span&&(n.span=t.span);const r=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/pause",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to pause agent")}return r.json()}async function $b(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/unpause",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to unpause agent")}return t.json()}async function BZ(e,t,n,r){const a={message:t,priority:n};r!=null&&(a.replyToInbox=r);const i=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error||"Failed to send message to agent")}return i.json()}async function zZ(e,t,n){const r={message:t};n!=null&&(r.replyToInbox=n);const a=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/interrupt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to send urgent interrupt to agent")}return a.json()}async function UZ(e,t){let n=Yt+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(n+="?refresh=true");const r=await Xt(n);if(!r.ok)throw new Error("Failed to fetch agent messages: "+r.statusText);return r.json()}async function $Z(){const e=await Xt(Yt+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function HZ(e){const t=await Xt(Yt+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to update pricing")}return t.json()}async function qZ(){const e=await Xt(Yt+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||"Failed to reset pricing")}return e.json()}async function WZ(e,t=!1){const n=Yt+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),r=await Xt(n,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to delete agent")}return r.json()}async function VZ(e){const t=await Xt(Yt+"/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to create agent")}return t.json()}async function w3(){const e=await Xt(Yt+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function G1(){const e=await Xt(Yt+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function GZ(e,t){const n=await Xt(Yt+"/api/agents/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update agent")}return n.json()}async function KZ(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/agents-md");if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to fetch AGENTS.md")}return t.json()}async function YZ(e,t){const n=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/agents-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update AGENTS.md")}return n.json()}async function E3(e){const t=await Xt(Yt+"/api/agents/"+encodeURIComponent(e)+"/export");if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to export agent")}const n=await t.text(),r=new Blob([n],{type:"text/yaml"}),a=URL.createObjectURL(r),i=t.headers.get("X-Filename")||e+".agent.yaml",s=document.createElement("a");s.href=a,s.download=i,document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),5e3)}async function XZ(e,t){const n=new URLSearchParams,r=n.toString()?"?"+n.toString():"",a=await Xt(Yt+"/api/agents/import"+r,{method:"POST",headers:{"Content-Type":"text/yaml"},body:e});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to import agent")}return a.json()}async function sy(){const e=await Xt(Yt+"/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 QZ(){const e=await Xt(Yt+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(n)===0||a===n?new Error(a):new Error(n+": "+a):new Error(n)}const t=await e.json();if(t.status!=="success"){let n=t.error||t.message||"";throw t.output&&!t.error&&!t.message?n="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(n+=t.output?" ("+t.output+")":""),n||(n="Update returned unexpected status: "+(t.status||"unknown")),new Error(n)}return t}async function X4(){const e=await Xt(Yt+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function Q4(e,t){const n=await Xt(Yt+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to save model: "+n.statusText)}return n.json()}async function Z4(e){const t=await Xt(Yt+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to delete model: "+t.statusText)}return t.json()}function S3(e){const t=typeof e=="string"?e.split("-"):null;if(t&&t.length===3){const n=Number(t[0]),r=Number(t[1]),a=Number(t[2]);if(!Number.isNaN(n)&&!Number.isNaN(r)&&!Number.isNaN(a))return new Date(n,r-1,a)}return new Date(e)}function ZZ(e){const t=S3(e),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return n[t.getDay()]+", "+r[t.getMonth()]+" "+t.getDate()}function Tu(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function JZ({data:e}){if(!e||e.length===0)return o.jsx("div",{className:"h-32 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No usage data available"});const t=280,n=120,r={top:10,right:10,bottom:25,left:40},a=t-r.left-r.right,i=n-r.top-r.bottom,s=Math.max(...e.map(g=>(g.input||0)+(g.output||0)+(g.cached||0)),1),l=a/e.length,c=Math.max(8,l*.6),u=(l-c)/2,d=g=>i-g/s*i,f=[0,.25,.5,.75,1].map(g=>Math.round(s*g));return o.jsxs("div",{className:"relative",children:[o.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${t} ${n}`,className:"overflow-visible",children:[f.map((g,p)=>{const m=r.top+d(g);return o.jsxs("g",{children:[o.jsx("line",{x1:r.left,y1:m,x2:t-r.right,y2:m,stroke:"currentColor",strokeOpacity:.1,className:"text-gray-400 dark:text-gray-600"}),o.jsx("text",{x:r.left-5,y:m,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Tu(g)})]},p)}),e.map((g,p)=>{const m=r.left+p*l+u,y=g.input||0,v=g.output||0,x=g.cached||0,b=y/s*i,k=v/s*i,N=x/s*i,_=r.top+i-b,w=_-k,E=w-N,S=S3(g.date),M=["S","M","T","W","T","F","S"][S.getDay()];return o.jsxs("g",{className:"group",children:[o.jsx("rect",{x:m-u,y:r.top,width:l,height:i,fill:"transparent",className:"cursor-pointer"}),y>0&&o.jsx("rect",{x:m,y:_,width:c,height:b,rx:2,className:"fill-blue-500 dark:fill-blue-400 transition-opacity group-hover:opacity-80"}),v>0&&o.jsx("rect",{x:m,y:w,width:c,height:k,rx:2,className:"fill-green-500 dark:fill-green-400 transition-opacity group-hover:opacity-80"}),x>0&&o.jsx("rect",{x:m,y:E,width:c,height:N,rx:2,className:"fill-purple-500 dark:fill-purple-400 transition-opacity group-hover:opacity-80"}),o.jsx("text",{x:m+c/2,y:n-5,textAnchor:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:M}),o.jsxs("g",{className:"opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[o.jsx("rect",{x:m+c/2-45,y:Math.min(E,w,_)-50,width:90,height:45,rx:4,className:"fill-gray-900 dark:fill-gray-100"}),o.jsx("text",{x:m+c/2,y:Math.min(E,w,_)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:ZZ(g.date)}),o.jsxs("text",{x:m+c/2,y:Math.min(E,w,_)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Tu(y)]}),o.jsxs("text",{x:m+c/2,y:Math.min(E,w,_)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Tu(v)]}),o.jsxs("text",{x:m+c/2,y:Math.min(E,w,_)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Tu(x)]})]})]},p)})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-blue-500 dark:bg-blue-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Input"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-green-500 dark:bg-green-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Output"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500 dark:bg-purple-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Cached"})]})]})]})}function eJ({agentName:e,onClose:t,onToolPartsChange:n,hackerMode:r}){var{t:a}=Rt(),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(null),[f,g]=h.useState(!1),[p,m]=h.useState(""),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,N]=h.useState(!1),[_,w]=h.useState(!1),[E,S]=h.useState(!1),M=h.useRef(null),j=h.useRef(null),F=h.useRef(!0),P=h.useRef([]),W=h.useRef(null),O=h.useRef(null),I=h.useRef(null),T=h.useRef(null);h.useEffect(function(){P.current=i},[i]);var L=h.useCallback(async function(ee,Me){if(e){Me!==!1&&c(!0);try{var X=await UZ(e,{refresh:!!ee}),ye=X.messages||[],Oe=P.current,Ee=ye.length!==Oe.length;if(!Ee&&ye.length>0&&Oe.length>0){var de=ye[ye.length-1],Se=Oe[Oe.length-1];if(de.info.id!==Se.info.id&&(Ee=!0),!Ee){var Ae=de.parts||[],me=Se.parts||[];if(Ae.length!==me.length)Ee=!0;else for(var ve=0;ve<Ae.length&&!Ee;ve++){var De=Ae[ve]||{},K=me[ve]||{},we=De.state?De.state.status:De.status,Te=K.state?K.state.status:K.status;(De.id!==K.id||we!==Te)&&(Ee=!0)}}}Ee&&s(ye.slice()),d(null)}catch(ge){console.error("Failed to load messages:",ge),d(ge.message)}finally{Me!==!1&&c(!1)}}},[e]);h.useEffect(function(){L(!0);var ee=setInterval(function(){L(!0,!1)},5e3);return function(){clearInterval(ee),O.current&&clearTimeout(O.current),T.current&&clearTimeout(T.current)}},[L]),h.useEffect(function(){F.current&&M.current&&M.current.scrollIntoView({behavior:"smooth"})},[i]);var $=h.useCallback(function(){var ee=j.current;ee&&(F.current=ee.scrollHeight-ee.scrollTop-ee.clientHeight<50)},[]),Z=h.useMemo(function(){for(var ee=null,Me=i.length-1;Me>=0;Me--)if(i[Me].info&&i[Me].info.role==="assistant"){ee=i[Me];break}return ee?(ee.parts||[]).filter(function(X){return X.type==="tool"}):[]},[i]);h.useEffect(function(){n&&n(Z)},[Z,n]);var R=h.useCallback(async function(){if(!(!p.trim()||x)){b(!0),N(!1),w(!1),S(!1),d(null);try{await BZ(e,p.trim(),"normal",y),m(""),N(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(function(){N(!1),g(!1),O.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){L(!0,!1),T.current=null},500)}catch(ee){d(ee.message)}finally{b(!1)}}},[e,p,y,x,L]),Y=h.useCallback(async function(){if(!(!p.trim()||x)){if(!E){S(!0);return}b(!0),N(!1),w(!0),S(!1),d(null);try{await zZ(e,p.trim(),y),m(""),N(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(function(){N(!1),g(!1),O.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){L(!0,!1),T.current=null},500)}catch(ee){d(ee.message)}finally{b(!1)}}},[e,p,x,E,y,L]),V=h.useCallback(function(){g(!1),S(!1),d(null),O.current&&(clearTimeout(O.current),O.current=null),T.current&&(clearTimeout(T.current),T.current=null),N(!1)},[]);h.useEffect(function(){if(!f)return;function ee(Me){Me.key==="Escape"&&!x&&V()}return document.addEventListener("keydown",ee),function(){document.removeEventListener("keydown",ee)}},[f,V,x]),h.useEffect(function(){if(!(!f||!I.current)){var ee=I.current;ee.contains(document.activeElement)||ee.focus()}},[f]);var A=h.useCallback(function(ee){ee.target===ee.currentTarget&&!x&&V()},[V,x]),H=h.useCallback(function(ee){ee.key==="Enter"&&!ee.shiftKey&&!E&&(ee.preventDefault(),R())},[R,E]),ce=h.useCallback(function(){},[]);return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 relative",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:t,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:a("agents.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Conversation"}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e," - ",i.length," messages"]})]})]}),o.jsx("button",{onClick:function(){F.current=!0,L(!0),M.current&&M.current.scrollIntoView({behavior:"smooth"})},disabled:l,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",title:a("agents.refresh"),children:o.jsx("svg",{className:`w-4 h-4 ${l?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]}),u&&o.jsxs("div",{className:"mx-4 mt-3 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:u}),o.jsx("button",{onClick:function(){d(null)},className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),k&&o.jsxs("div",{className:`mx-4 mt-3 px-4 py-2 text-sm rounded-lg flex items-center gap-2 ${_?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400"}`,children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:_?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a(_?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),o.jsx("div",{ref:j,onScroll:$,className:"flex-1 overflow-y-auto px-4 py-4",children:l&&i.length===0?o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):i.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-3",children:o.jsx("svg",{className:"w-6 h-6 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("agent_conversation.no_messages")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:a("agent_conversation.no_messages_hint")})]}):o.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[i.map(function(ee){return o.jsx(JA,{message:ee.info,parts:ee.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:ce,hackerMode:r,hideThinking:!1},ee.info.id)}),o.jsx("div",{ref:M})]})}),o.jsx("div",{className:"absolute bottom-6 right-6",children:o.jsxs("button",{onClick:function(){g(!0),S(!1),d(null)},className:"px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white rounded-full shadow-lg font-medium text-sm transition-colors flex items-center gap-2","aria-label":a("agent_conversation.compose_button"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a("agent_conversation.compose_button")]})}),f&&o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:A,children:o.jsxs("div",{ref:I,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":"compose-modal-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 max-h-[80vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[o.jsx("h3",{id:"compose-modal-title",className:"text-base font-semibold text-gray-900 dark:text-white",children:a("agent_conversation.modal_title",{name:e})}),o.jsx("button",{onClick:V,disabled:x,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"+(x?" opacity-50 cursor-not-allowed":""),"aria-label":a("common.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:y,onChange:function(ee){v(ee.target.checked)},className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:a("agent_conversation.reply_to_inbox")})]}),o.jsx("textarea",{ref:W,value:p,onChange:function(ee){m(ee.target.value)},onKeyDown:H,placeholder:a("agent_conversation.send_placeholder"),className:"w-full px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 outline-none resize-none text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:border-transparent",rows:4,disabled:x,autoFocus:!0}),k&&o.jsx("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:a(_?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")}),u&&o.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:u})]}),o.jsx("div",{className:"px-5 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:E?o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 font-medium",children:a("agent_conversation.urgent_warning")}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("button",{onClick:function(){S(!1)},className:"px-3 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:a("common.cancel")}),o.jsxs("button",{onClick:Y,disabled:!p.trim()||x,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed text-xs font-medium transition-colors flex items-center gap-1.5",children:[x&&_?o.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.confirm_interrupt")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("button",{onClick:Y,disabled:!p.trim()||x,className:"px-3 py-1.5 text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.urgent_interrupt_button")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:V,disabled:x,className:"px-4 py-2 text-sm transition-colors"+(x?" text-gray-400 dark:text-gray-600 cursor-not-allowed":" text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),children:a("common.cancel")}),o.jsxs("button",{onClick:R,disabled:!p.trim()||x,className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm transition-colors flex items-center gap-2",children:[x&&!_?o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})}),a("agent_conversation.send_button")]})]})]})})]})})]})}function tJ({isOpen:e,agent:t,onClose:n,onUpdated:r,onDeleted:a}){const{t:i}=Rt(),[s,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState(""),[g,p]=h.useState(""),[m,y]=h.useState(!1),[v,x]=h.useState([]),[b,k]=h.useState(!1),[N,_]=h.useState(""),[w,E]=h.useState(null),[S,M]=h.useState(!1),[j,F]=h.useState([]),[P,W]=h.useState([]),[O,I]=h.useState(!1),[T,L]=h.useState(!0),[$,Z]=h.useState(!1),[R,Y]=h.useState(!1),[V,A]=h.useState(null),[H,ce]=h.useState(!1),[ee,Me]=h.useState(!1),[X,ye]=h.useState("general"),[Oe,Ee]=h.useState(!1);h.useEffect(()=>{const ge={cancelled:!1};if(e&&t&&!Oe){de();const xe=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";Se(ge,xe),Ee(!0)}return e||(Ee(!1),y(!1),p(""),L(!0),W([])),()=>{ge.cancelled=!0}},[e,t==null?void 0:t.name]);const de=()=>{if(!t)return;l(t.displayName||t.name||""),u(t.cwd||"");const ge=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";f(ge),y(!1),p(""),x(Array.isArray(t.skills)?t.skills:[]),k(!!t.skipInitialPrompt)},Se=async(ge,xe)=>{I(!0),L(!0),t!=null&&t.name&&Z(!0);const he=[w3(),G1()];t!=null&&t.name&&he.push(KZ(t.name));const fe=await Promise.allSettled(he);if(ge.cancelled)return;const[pe,U,D]=fe;if(pe.status==="fulfilled"?F(pe.value):(console.error("Failed to load skills:",pe.reason),F([])),I(!1),U.status==="fulfilled"){const G=U.value;W(G);const le=xe;G.find(je=>je.id===le)||(y(!0),p(le),f(le))}else console.error("Failed to load models:",U.reason),W([]);if(L(!1),t!=null&&t.name&&D){if(D.status==="fulfilled"){const G=D.value;_(G.content||""),E(G.path||null),M(G.exists||!1)}else console.error("Failed to load AGENTS.md:",D.reason),_(""),E(null),M(!1);Z(!1)}},Ae=ge=>{x(xe=>xe.includes(ge)?xe.filter(he=>he!==ge):[...xe,ge])},me=()=>{v.length===j.length?x([]):x(j.map(ge=>ge.name))},ve=async ge=>{if(ge&&ge.preventDefault(),!!(t!=null&&t.name)){A(null),Y(!0);try{await GZ(t.name,{displayName:s.trim()||t.name,workspace:c.trim(),model:d,skipInitialPrompt:b,skills:v}),w&&N!==null&&!Te&&await YZ(t.name,N),r&&r(t.name),n()}catch(xe){A(xe.message)}finally{Y(!1)}}},De=async()=>{if(t!=null&&t.name){Me(!0),A(null);try{await WZ(t.name,!0),a&&a(t.name),n()}catch(ge){A(ge.message),ce(!1)}finally{Me(!1)}}},K=()=>{!R&&!ee&&(A(null),ce(!1),ye("general"),n())};if(!e||!t)return null;const we=t.state==="working"||t.state==="idle"||t.state==="starting",Te=c.trim()!==(t.cwd||"");return o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:K}),H&&o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>ce(!1)}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Delete Agent?"}),o.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:["Are you sure you want to delete ",o.jsx("strong",{children:t.displayName||t.name}),"?",we&&o.jsx("span",{className:"block mt-2 text-yellow-600 dark:text-yellow-400",children:"Warning: This agent is currently running and will be stopped."})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mb-4",children:"This will remove the agent registration. The workspace directory will not be deleted."}),o.jsxs("div",{className:"flex justify-end gap-3",children:[o.jsx("button",{onClick:()=>ce(!1),disabled:ee,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{onClick:De,disabled:ee,className:"px-4 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-2",children:ee?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("common.deleting")]}):i("common.delete")})]})]})]}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:i("agent_edit.title")}),o.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t.name,we&&o.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",i("agent_edit.running_warning"),")"]})]})]}),o.jsx("button",{onClick:K,disabled:R||ee,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-800 px-6",children:[o.jsx("button",{onClick:()=>ye("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="general"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_general")}),o.jsx("button",{onClick:()=>ye("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="soul"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_soul")})]}),o.jsxs("form",{onSubmit:ge=>ge.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[V&&o.jsxs("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>A(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),X==="general"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[i("agent_edit.name_label"),o.jsx("span",{className:"text-gray-400 font-normal ml-1",children:i("agent_edit.cannot_change")})]}),o.jsx("input",{type:"text",value:t.name,disabled:!0,className:"w-full px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed font-mono"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.display_name_label")}),o.jsx("input",{type:"text",value:s,onChange:ge=>l(ge.target.value),placeholder:i("agent_edit.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.working_dir_label")}),we?o.jsx("div",{className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 font-mono text-sm break-all",children:c||i("agent_edit.not_set")}):o.jsx("input",{type:"text",value:c,onChange:ge=>u(ge.target.value),placeholder:i("agent_edit.working_dir_placeholder"),disabled:R||ee,className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm disabled:opacity-50"}),we?o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.stop_to_change")}):c.trim()!==(t.cwd||"")?o.jsx("p",{className:"mt-1 text-xs text-amber-500 dark:text-amber-400",children:i("agent_edit.workspace_move_warning")}):o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.working_dir_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.model_label")}),T?o.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:i("agent_edit.loading_models")}):P.length===0?o.jsx("input",{type:"text",value:d,onChange:ge=>f(ge.target.value),placeholder:i("agent_edit.model_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"}):o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:m?"__custom__":d,onChange:ge=>{ge.target.value==="__custom__"?(y(!0),d&&d!=="__custom__"&&p(d)):(y(!1),f(ge.target.value))},className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500",children:[(()=>{const ge=V1(P);return Object.entries(ge).map(([xe,he])=>o.jsx("optgroup",{label:q1[xe]||xe,children:he.map(fe=>o.jsxs("option",{value:fe.id,children:[fe.name,W1(fe.tier)]},fe.id))},xe))})(),o.jsx("option",{value:"__custom__",children:i("agent_edit.custom_model")})]}),m&&o.jsx("input",{type:"text",value:g,onChange:ge=>{p(ge.target.value),f(ge.target.value)},placeholder:i("agent_edit.custom_model_placeholder"),className:"w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"})]}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i(m?"agent_edit.custom_model_hint":"agent_edit.model_hint")})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.start_mode")}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:b,onChange:ge=>k(ge.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:i("agent_edit.dormant_mode")}),o.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:i("agent_edit.dormant_mode_desc")})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.skills_label")}),o.jsx("button",{type:"button",onClick:me,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:v.length===j.length?i("agent_edit.deselect_all"):i("agent_edit.select_all")})]}),o.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:O?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.loading_skills")}):j.length===0?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.no_skills")}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:j.map(ge=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${v.includes(ge.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[o.jsx("input",{type:"checkbox",checked:v.includes(ge.name),onChange:()=>Ae(ge.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:ge.description,children:[ge.icon&&o.jsx("span",{className:"mr-1",children:ge.icon}),ge.name]})]},ge.name))})}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.skills_selected",{count:v.length})})]})]}),X==="soul"&&o.jsxs("div",{className:"space-y-4",children:[w&&o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 rounded px-3 py-2",children:[w,!S&&o.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:i("agent_edit.will_be_created")})]}),!w&&!c.trim()&&o.jsx("div",{className:"px-4 py-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 text-sm rounded-lg",children:i("agent_edit.no_workspace_warning")}),Te&&o.jsx("div",{className:"px-4 py-3 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm rounded-lg",children:i("agent_edit.workspace_changed_warning")}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.instructions_label")}),o.jsx("textarea",{value:N,onChange:ge=>_(ge.target.value),disabled:!w||Te,rows:16,placeholder:i($?"common.loading":"agent_edit.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.instructions_hint")})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[o.jsxs("button",{type:"button",onClick:()=>ce(!0),disabled:R||ee,className:"px-4 py-2 rounded-lg text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),i("common.delete")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{type:"button",onClick:K,disabled:R||ee,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{type:"button",onClick:ve,disabled:R||ee,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:R?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("agent_edit.saving")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i("agent_edit.save")]})})]})]})]})]})}const J4={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},ej={working:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:o.jsx("svg",{className:"w-4 h-4 mr-1.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})};function nJ({state:e}){const t=J4[e]||J4.stopped,n=ej[e]||ej.stopped;return o.jsxs("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${t}`,children:[n,e]})}function rJ(e){if(!e)return"-";const t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+"s";const r=Math.floor(n/60);if(r<60)return r+"m";const a=Math.floor(r/60),i=r%60;if(a<24)return a+"h "+i+"m";const s=Math.floor(a/24),l=a%24;return s+"d "+l+"h"}function oy({label:e,value:t,max:n,color:r}){const a=n>0?Math.min(100,Math.round(t/n*100)):0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:t.toLocaleString()})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${r} transition-all duration-300`,style:{width:a+"%"}})})]})}function Gi({label:e,value:t,mono:n}){return o.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:`text-sm text-gray-900 dark:text-gray-100 ${n?"font-mono":""}`,children:t||"-"})]})}function aJ({agent:e,onClose:t,onAction:n,onToolPartsChange:r,hackerMode:a}){const{t:i}=Rt(),[s,l]=h.useState(e),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState(!1),[m,y]=h.useState(!1),v=h.useCallback(async()=>{if(e!=null&&e.name)try{const S=await FZ(e.name);l(S),u(null)}catch(S){console.error("Failed to load agent:",S),u(S.message)}},[e==null?void 0:e.name]);h.useEffect(()=>{v();const S=setInterval(v,5e3);return()=>clearInterval(S)},[v]);const x=h.useCallback(async S=>{f(S),u(null);try{S==="start"?await Bb(s.name):S==="stop"?await zb(s.name):S==="restart"?await Bd(s.name):S==="cleanRestart"?await Bd(s.name,{clean:!0}):S==="pause"?await Ub(s.name,{level:"tools"}):S==="unpause"&&await $b(s.name),await v(),n&&n(s.name,S)}catch(M){u(M.message)}finally{f(null)}},[s==null?void 0:s.name,v,n]),b=(s==null?void 0:s.state)==="working"||(s==null?void 0:s.state)==="idle"||(s==null?void 0:s.state)==="starting"||(s==null?void 0:s.state)==="paused",k=(s==null?void 0:s.state)==="paused"||(s==null?void 0:s.paused),N=(s==null?void 0:s.displayName)||(s==null?void 0:s.name)||"Unknown Agent",_=(s==null?void 0:s.tokens)||{input:0,output:0,cached:0,total:0},w=Math.max(_.input,_.output,_.cached,1),E=(s==null?void 0:s.cost)||{input:0,output:0,cached:0,total:0};return g?o.jsx(eJ,{agentName:s==null?void 0:s.name,onClose:()=>{p(!1),r&&r(null)},onToolPartsChange:r,hackerMode:a}):o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors flex-shrink-0",title:i("agent_detail.back"),"aria-label":i("agent_detail.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",title:N,children:N}),(s==null?void 0:s.displayName)&&s.displayName!==s.name&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:s.name,children:s.name})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:()=>y(!0),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:i("agent_detail.edit_settings"),"aria-label":i("agent_detail.edit_settings"),children:o.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.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.065 2.572c1.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.572 1.065c-.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.065-2.572c-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"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx(nJ,{state:(s==null?void 0:s.state)||"stopped"})]})]}),o.jsx(tJ,{isOpen:m,agent:s,onClose:()=>y(!1),onUpdated:S=>{v(),n&&n(S,"updated")},onDeleted:S=>{n&&n(S,"deleted"),t()}}),c&&o.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>u(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[o.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:b?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>x("stop"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:i(d==="stop"?"agents.stopping":"agents.stop")}),k?o.jsx("button",{onClick:()=>x("unpause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="unpause"?"agents.resuming":"agents.resume")}):o.jsx("button",{onClick:()=>x("pause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:i(d==="pause"?"agents.pausing":"agents.pause")}),o.jsx("button",{onClick:()=>x("restart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:i(d==="restart"?"agents.restarting":"agents.restart")}),o.jsx("button",{onClick:()=>x("cleanRestart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",title:i("agents.clean_restart_tooltip"),children:i(d==="cleanRestart"?"agents.restarting":"agents.clean_restart")})]}):o.jsx("button",{onClick:()=>x("start"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="start"?"agents.starting":"agents.start")})}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.agent_info")}),o.jsxs("div",{className:"space-y-0",children:[o.jsx(Gi,{label:i("agent_detail.model"),value:s==null?void 0:s.model,mono:!0}),o.jsx(Gi,{label:i("agent_detail.port"),value:s==null?void 0:s.port,mono:!0}),o.jsx(Gi,{label:i("agent_detail.pid"),value:s==null?void 0:s.pid,mono:!0}),o.jsx(Gi,{label:i("agent_detail.session_id"),value:s!=null&&s.sessionId?s.sessionId.slice(0,12)+"...":null,mono:!0}),o.jsx(Gi,{label:i("agent_detail.uptime"),value:rJ(s==null?void 0:s.startedAt)}),o.jsx(Gi,{label:i("agent_detail.iteration"),value:s==null?void 0:s.iteration}),o.jsx(Gi,{label:i("agent_detail.start_mode"),value:s!=null&&s.skipInitialPrompt?i("agent_detail.start_mode_dormant"):i("agent_detail.start_mode_normal")})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.token_usage")}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(oy,{label:i("agent_detail.token_input"),value:_.input,max:w,color:"bg-blue-500"}),o.jsx(oy,{label:i("agent_detail.token_output"),value:_.output,max:w,color:"bg-green-500"}),o.jsx(oy,{label:i("agent_detail.token_cached"),value:_.cached,max:w,color:"bg-purple-500"}),o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Total"}),o.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:_.total.toLocaleString()})]})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Estimated Cost"}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",E.input.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",E.output.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",E.cached.toFixed(4)]})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:i("agent_detail.total_cost")}),o.jsxs("span",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:["$",E.total.toFixed(4)]})]})]}),(s==null?void 0:s.dailyUsage)&&s.dailyUsage.length>0&&o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Daily Usage (Last 7 Days)"}),o.jsx(JZ,{data:s.dailyUsage})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>p(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),i("agent_detail.view_conversation")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>y(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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("agent_detail.edit_settings")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:async()=>{try{await E3(s.name)}catch(S){u(i("agents.export_error")+": "+S.message)}},children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),i("agents.export")]})]}),(s==null?void 0:s.cwd)&&o.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500 break-all",children:[o.jsx("span",{className:"font-medium",children:i("agent_detail.working_dir_label")}),o.jsx("br",{}),o.jsx("span",{className:"font-mono",children:s.cwd})]})]})]})}const Ru=["swift","quick","rapid","agile","nimble","clever","smart","wise","bright","keen","bold","brave","calm","steady","noble","silent","shadow","storm","iron","steel","amber","azure","cobalt","crimson","golden","cosmic","cyber","digital","quantum","prime"],Au=["falcon","hawk","eagle","raven","phoenix","wolf","fox","hound","coyote","tiger","panther","lynx","leopard","bear","orca","shark","viper","cobra","dragon","griffin","sentinel","guardian","titan","node","nexus","core","spark","pulse"];function tj(e=[],t=100){const n=new Set(e.map(s=>s.toLowerCase()));for(let s=0;s<t;s++){const l=Ru[Math.floor(Math.random()*Ru.length)],c=Au[Math.floor(Math.random()*Au.length)],u=`${l}-${c}`;if(!n.has(u))return u}const r=Ru[Math.floor(Math.random()*Ru.length)],a=Au[Math.floor(Math.random()*Au.length)],i=Math.floor(Math.random()*1e3);return`${r}-${a}-${i}`}function nj(e,t=[]){if(!e||typeof e!="string")return{valid:!1,error:"Name is required"};const n=e.trim().toLowerCase();return n.length===0?{valid:!1,error:"Name cannot be empty"}:n.length<2?{valid:!1,error:"Name must be at least 2 characters"}:n.length>50?{valid:!1,error:"Name must be 50 characters or less"}:/^[a-z0-9_-]+$/.test(n)?new Set(t.map(a=>a.toLowerCase())).has(n)?{valid:!1,error:"An agent with this name already exists"}:{valid:!0,error:null}:{valid:!1,error:"Name can only contain lowercase letters, numbers, hyphens, and underscores"}}function iJ(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const Iu=`# AGENTS.md - AI Agent Instructions
|
|
106
|
-
|
|
107
|
-
## Overview
|
|
108
|
-
You are an autonomous AI agent. Your goal is to help users accomplish tasks efficiently.
|
|
109
|
-
|
|
110
|
-
## Guidelines
|
|
111
|
-
- Be helpful and accurate
|
|
112
|
-
- Ask for clarification when needed
|
|
113
|
-
- Use available tools appropriately
|
|
114
|
-
- Report progress on long-running tasks
|
|
115
|
-
|
|
116
|
-
## Constraints
|
|
117
|
-
- Do not make changes without user approval for destructive operations
|
|
118
|
-
- Follow security best practices
|
|
119
|
-
- Respect rate limits and resource constraints
|
|
120
|
-
`;function sJ({isOpen:e,onClose:t,existingAgentNames:n=[],onCreated:r}){const{t:a}=Rt(),[i,s]=h.useState(""),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,g]=h.useState("github-copilot/claude-opus-4.6"),[p,m]=h.useState(""),[y,v]=h.useState(!1),[x,b]=h.useState(Iu),[k,N]=h.useState([]),[_,w]=h.useState(!1),[E,S]=h.useState([]),[M,j]=h.useState([]),[F,P]=h.useState(!1),[W,O]=h.useState(!0),[I,T]=h.useState({}),[L,$]=h.useState(!1),[Z,R]=h.useState(null);h.useEffect(()=>{const X={cancelled:!1};return e?(s(tj(n)),c(""),d(""),g("github-copilot/claude-opus-4.6"),m(""),v(!1),b(Iu),N([]),w(!1),T({}),$(!1),R(null),Y(X,"github-copilot/claude-opus-4.6")):(O(!0),j([])),()=>{X.cancelled=!0}},[e]);const Y=async(X,ye)=>{P(!0),O(!0);const[Oe,Ee]=await Promise.allSettled([w3(),G1()]);if(!X.cancelled){if(Oe.status==="fulfilled"?S(Oe.value):(console.error("Failed to load skills:",Oe.reason),S([])),P(!1),Ee.status==="fulfilled"){const de=Ee.value;j(de),de.find(Se=>Se.id===ye)||(v(!0),m(ye))}else console.error("Failed to load models:",Ee.reason),j([]);O(!1)}},V=()=>{const X=tj(n);s(X),T(ye=>({...ye,name:null}))},A=X=>{const ye=X.target.value;s(ye);const Oe=nj(ye,n);Oe.valid?T(Ee=>({...Ee,name:null})):T(Ee=>({...Ee,name:Oe.error}))},H=X=>{N(ye=>ye.includes(X)?ye.filter(Oe=>Oe!==X):[...ye,X])},ce=()=>{k.length===E.length?N([]):N(E.map(X=>X.name))},ee=async X=>{X&&X.preventDefault(),R(null);const ye={},Oe=nj(i,n);if(Oe.valid||(ye.name=Oe.error),u.trim()||(ye.workspace=a("agent_create.validate_workspace")),f||(ye.model=a("agent_create.validate_model")),Object.keys(ye).length>0){T(ye);return}$(!0);try{const Ee={name:iJ(i),displayName:l.trim()||null,workspace:u.trim(),model:f,soul:x.trim()||null,skills:k,skipInitialPrompt:_},de=await VZ(Ee);s(""),c(""),d(""),g("github-copilot/claude-opus-4.6"),b(Iu),N([]),w(!1),T({}),r&&r(de.agent),t()}catch(Ee){R(Ee.message)}finally{$(!1)}},Me=()=>{L||(T({}),R(null),t())};return e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:Me}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("agent_create.title")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("agent_create.configure_subtitle")})]}),o.jsx("button",{onClick:Me,disabled:L,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("form",{onSubmit:X=>X.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[Z&&o.jsx("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg",children:Z}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("agent_create.name_label")}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:i,onChange:A,placeholder:a("agent_create.name_placeholder"),className:`flex-1 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 ${I.name?"border-red-500":"border-gray-200 dark:border-gray-700"}`}),o.jsxs("button",{type:"button",onClick:V,className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors flex items-center gap-2",title:a("agent_create.name_generate"),"aria-label":a("agent_create.name_generate"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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("agent_create.random")]})]}),I.name&&o.jsx("p",{className:"mt-1 text-sm text-red-500",children:I.name}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a("agent_create.name_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("agent_create.display_name_label")}),o.jsx("input",{type:"text",value:l,onChange:X=>c(X.target.value),placeholder:a("agent_create.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a("agent_create.display_name_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("agent_create.working_dir_label")}),o.jsx("input",{type:"text",value:u,onChange:X=>d(X.target.value),placeholder:a("agent_create.working_dir_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border ${I.workspace?"border-red-500":"border-gray-200 dark:border-gray-700"} text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm`}),I.workspace&&o.jsx("p",{className:"mt-1 text-xs text-red-500",children:I.workspace}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a("agent_create.working_dir_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("agent_create.model_label")}),W?o.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:a("agent_create.loading_models")}):M.length===0?o.jsx("input",{type:"text",value:f,onChange:X=>g(X.target.value),placeholder:a("agent_create.model_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${I.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`}):o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:y?"__custom__":f,onChange:X=>{X.target.value==="__custom__"?(v(!0),f&&f!=="__custom__"&&m(f)):(v(!1),g(X.target.value))},className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 ${I.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`,children:[(()=>{const X=V1(M);return Object.entries(X).map(([Oe,Ee])=>o.jsx("optgroup",{label:q1[Oe]||Oe,children:Ee.map(de=>o.jsxs("option",{value:de.id,children:[de.name,W1(de.tier)]},de.id))},Oe))})(),o.jsx("option",{value:"__custom__",children:a("agent_create.custom_model")})]}),y&&o.jsx("input",{type:"text",value:p,onChange:X=>{m(X.target.value),g(X.target.value)},placeholder:a("agent_create.custom_model_placeholder"),className:`w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${I.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`})]}),I.model&&o.jsx("p",{className:"mt-1 text-sm text-red-500",children:I.model}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a(y?"agent_create.custom_model_hint":"agent_create.model_hint")})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:a("agent_create.start_mode")}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:_,onChange:X=>w(X.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:a("agent_create.dormant_mode")}),o.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:a("agent_create.dormant_mode_desc")})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:a("agent_create.skills_label")}),o.jsx("button",{type:"button",onClick:ce,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:k.length===E.length?a("agent_create.deselect_all"):a("agent_create.select_all")})]}),o.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:F?o.jsx("div",{className:"text-center py-4 text-gray-500",children:a("agent_create.loading_skills")}):E.length===0?o.jsx("div",{className:"text-center py-4 text-gray-500",children:a("agent_create.no_skills")}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:E.map(X=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${k.includes(X.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[o.jsx("input",{type:"checkbox",checked:k.includes(X.name),onChange:()=>H(X.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:X.description,children:[X.icon&&o.jsx("span",{className:"mr-1",children:X.icon}),X.name]})]},X.name))})}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a("agent_create.skills_selected",{count:k.length})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a("agent_create.instructions_label"),o.jsx("span",{className:"text-gray-400 font-normal ml-1",children:a("agent_create.instructions_optional")})]}),o.jsx("button",{type:"button",onClick:()=>b(Iu),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:a("agent_create.reset_default")})]}),o.jsx("textarea",{value:x,onChange:X=>b(X.target.value),rows:8,placeholder:a("agent_create.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none"}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:a("agent_create.instructions_hint")})]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[o.jsx("button",{type:"button",onClick:Me,disabled:L,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:a("agent_create.cancel")}),o.jsx("button",{type:"button",onClick:ee,disabled:L||!!I.name,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:L?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.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("agent_create.spawning")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),a("agent_create.spawn")]})})]})]})]}):null}const rj="pave-agents-panel-collapsed",aj={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},ij={working:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1zm4 0a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:o.jsx("svg",{className:"w-3 h-3 mr-1 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})},oJ="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z",lJ="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";function cJ({state:e}){const t=aj[e]||aj.stopped,n=ij[e]||ij.stopped;return o.jsxs("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t}`,children:[n,e]})}function uJ(e){if(!e)return"-";const t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+"s";const r=Math.floor(n/60);if(r<60)return r+"m";const a=Math.floor(r/60),i=r%60;if(a<24)return a+"h "+i+"m";const s=Math.floor(a/24),l=a%24;return s+"d "+l+"h"}function dJ({agent:e,onAction:t,onSelect:n,onExport:r,actionLoading:a,isSelected:i,onToggleSelect:s}){const{t:l}=Rt(),c=e.state==="working"||e.state==="idle"||e.state==="starting"||e.state==="paused",u=e.state==="paused"||e.paused,d=u?"paused":e.state,f=e.displayName||e.name;return o.jsxs("div",{className:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-4 hover:border-primary-300 dark:hover:border-primary-700 hover:shadow-md transition-all duration-150 cursor-pointer flex flex-col",onClick:()=>n(e),children:[o.jsxs("div",{className:"flex items-start justify-between mb-3",children:[o.jsx("input",{type:"checkbox",checked:i||!1,onChange:g=>{g.stopPropagation(),s&&s(e.name)},onClick:g=>g.stopPropagation(),className:"mt-1 mr-2 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500 flex-shrink-0","aria-label":l("agents.select")+" "+(e.displayName||e.name)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",title:f,children:f}),e.displayName&&e.displayName!==e.name&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:e.name,children:e.name})]}),o.jsx(cJ,{state:d})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-gray-400 mb-4",children:[o.jsxs("div",{children:[o.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[l("agents.uptime"),":"]})," ",o.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:uJ(e.startedAt)})]}),o.jsxs("div",{children:[o.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[l("agents.iteration"),":"]})," ",o.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.iteration||0})]}),o.jsxs("div",{children:[o.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[l("agents.port"),":"]})," ",o.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.port||"-"})]}),o.jsxs("div",{children:[o.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[l("agents.pid"),":"]})," ",o.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.pid||"-"})]})]}),o.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mb-3 truncate",title:e.model||"",children:e.model?l("agents.model_label",{model:e.model}):" "}),o.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t border-gray-100 dark:border-gray-800 mt-auto flex-wrap",children:[c?o.jsxs(o.Fragment,{children:[u?o.jsx("button",{onClick:g=>{g.stopPropagation(),t(e.name,"unpause")},disabled:(a==null?void 0:a.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.action)==="unpause"?l("agents.resuming"):l("agents.resume")}):o.jsx("button",{onClick:g=>{g.stopPropagation(),t(e.name,"pause")},disabled:(a==null?void 0:a.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.action)==="pause"?l("agents.pausing"):l("agents.pause")}),o.jsx("button",{onClick:g=>{g.stopPropagation(),t(e.name,"stop")},disabled:(a==null?void 0:a.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.action)==="stop"?l("agents.stopping"):l("agents.stop")}),o.jsx("button",{onClick:g=>{g.stopPropagation(),t(e.name,"restart")},disabled:(a==null?void 0:a.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.action)==="restart"?l("agents.restarting"):l("agents.restart")})]}):o.jsx("button",{onClick:g=>{g.stopPropagation(),t(e.name,"start")},disabled:(a==null?void 0:a.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.action)==="start"?l("agents.starting"):l("agents.start")}),o.jsx("button",{onClick:g=>{g.stopPropagation(),r(e.name)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:l("agents.export"),"aria-label":l("agents.export"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{type:"button",onClick:g=>{g.stopPropagation(),n(e)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:l("agents.view_details"),"aria-label":l("agents.view_details"),children:o.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:oJ}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:lJ})]})})]})]})}function fJ({agents:e,totalCost:t}){const n=e.filter(a=>a.state==="working"||a.state==="idle").length,r=e.reduce((a,i)=>{var s;return a+(((s=i.tokens)==null?void 0:s.total)||0)},0);return o.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 px-6 py-3",children:o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-6",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["Active: ",o.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[n,"/",e.length]})]})]}),o.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Total Tokens: ",o.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:r.toLocaleString()})]})]}),o.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Est. Cost: ",o.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:["$",t.toFixed(4)]})]})]})})}function gJ({onBack:e,onSelectAgent:t,initialAgentName:n,onInitialAgentConsumed:r,hackerMode:a,matrixMode:i,darkMode:s,onToggleMatrix:l,terminalWidth:c,onTerminalWidthChange:u,terminalMinWidth:d,terminalMaxWidth:f}){const{t:g}=Rt(),[p,m]=h.useState([]),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,N]=h.useState(null),[_,w]=h.useState(null),[E,S]=h.useState(null),[M,j]=h.useState(null),[F,P]=h.useState(!1),[W,O]=h.useState(new Set),[I,T]=h.useState(null),[L,$]=h.useState(()=>{if(typeof window>"u")return!1;try{return localStorage.getItem(rj)==="true"}catch{return!1}}),Z=h.useMemo(()=>Array.isArray(I)?I.length===0?I:!a&&I.every(G=>G.state&&G.state.status==="completed"||G.state&&G.state.status==="error")?[]:I:null,[I,a]),R=h.useRef(null),Y=h.useRef(!0);h.useEffect(()=>()=>{Y.current=!1,A.current&&clearTimeout(A.current)},[]),h.useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(rj,L?"true":"false")}catch{}},[L]);const V=h.useRef(!1),A=h.useRef(null),H=h.useCallback(async D=>{if(R.current)return D?(V.current=!0,R.current.then(()=>R.current||Promise.resolve())):R.current;const G=(async()=>{let le=!1;try{const je=await PZ();if(!Y.current)return le;const $e=Array.isArray(je)?je:[];m($e),j(Ve=>Ve&&($e.find(Ye=>Ye.name===Ve.name)||null)),w(null),le=!0}catch(je){if(!Y.current)return le;console.error("Failed to load agents:",je),w(je.message)}finally{Y.current&&v(!1),R.current=null,V.current&&Y.current&&(V.current=!1,H())}return le})();return R.current=G,G},[]),ce=h.useCallback(async()=>{if(!Y.current)return;b(!0),N(null),A.current&&(clearTimeout(A.current),A.current=null);let D=!1;try{const[G]=await Promise.all([H(!0),new Promise(le=>{setTimeout(le,400)})]);D=G===!0}catch{D=!1}finally{Y.current&&(b(!1),N(D?"success":"error"),A.current=setTimeout(()=>{Y.current&&N(null),A.current=null},1e3))}},[H]);h.useEffect(()=>{H();const D=setInterval(H,5e3);return()=>clearInterval(D)},[H]),h.useEffect(()=>{if(!n||p.length===0)return;const D=p.find(G=>G.name===n);D&&(j(D),T(null),t&&t(D),r&&r())},[n,p,t,r]);const ee=h.useCallback(async(D,G)=>{S({name:D,action:G}),w(null);try{G==="start"?await Bb(D):G==="stop"?await zb(D):G==="restart"?await Bd(D):G==="pause"?await Ub(D,{level:"iterations"}):G==="unpause"&&await $b(D),await H(!0)}catch(le){w(le.message)}finally{S(null)}},[H]),Me=p.reduce((D,G)=>{var le;return D+(((le=G.cost)==null?void 0:le.total)||0)},0),X=h.useCallback(D=>{j(D),T(null),t&&t(D)},[t]),ye=h.useCallback(()=>{j(null),T(null)},[]),Oe=h.useCallback(D=>{O(G=>{const le=new Set(G);return le.has(D)?le.delete(D):le.add(D),le})},[]),Ee=h.useCallback(()=>{O(new Set(p.map(D=>D.name)))},[p]),de=h.useCallback(()=>{O(new Set)},[]),Se=h.useCallback(async D=>{var le;if(W.size===0)return;w(null);const G=[...W];try{const $e=(await Promise.allSettled(G.map(async Ve=>{D==="pause"?await Ub(Ve,{level:"iterations"}):D==="unpause"?await $b(Ve):D==="stop"?await zb(Ve):D==="restart"?await Bd(Ve):D==="start"&&await Bb(Ve)}))).filter(Ve=>Ve.status==="rejected");$e.length>0&&w(((le=$e[0].reason)==null?void 0:le.message)||"Some actions failed"),await H(!0)}catch(je){w(je.message)}},[W,H]),Ae=h.useCallback(()=>{H(!0)},[H]),me=h.useCallback(D=>{H(!0),D&&j(D)},[H]),[ve,De]=h.useState(!1),[K,we]=h.useState(null),Te=h.useRef(null);h.useEffect(()=>()=>{Te.current&&clearTimeout(Te.current)},[]);const ge=h.useCallback(async D=>{try{await E3(D)}catch(G){w(g("agents.export_error")+": "+G.message)}},[g]),xe=h.useCallback(async D=>{try{we(null),await XZ(D),we({type:"success",message:g("agents.import_success")}),H(!0),Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{we(G=>G&&G.type==="success"?null:G),Te.current=null},5e3)}catch(G){we({type:"error",message:g("agents.import_error")+": "+G.message})}},[g,H]),he=h.useCallback(()=>{const D=document.createElement("input");D.type="file",D.accept=".yaml,.yml",D.onchange=G=>{const le=G&&G.target&&G.target.files,je=le&&le[0];if(!je)return;const $e=je.name.toLowerCase();if(!$e.endsWith(".yaml")&&!$e.endsWith(".yml")){we({type:"error",message:g("agents.import_invalid_file")});return}if(je.size>10*1024*1024){we({type:"error",message:g("agents.import_file_too_large")});return}const Ve=new FileReader;Ve.onload=Qe=>{const Ye=Qe&&Qe.target?Qe.target.result:null;typeof Ye=="string"&&xe(Ye)},Ve.onerror=()=>{we({type:"error",message:g("agents.import_read_error")})},Ve.readAsText(je)},D.click()},[g,xe]),fe=h.useCallback(D=>{D.preventDefault(),D.stopPropagation(),De(!0)},[]),pe=h.useCallback(D=>{D.preventDefault(),D.stopPropagation();const G=D.relatedTarget;(!G||!D.currentTarget.contains(G))&&De(!1)},[]),U=h.useCallback(D=>{D.preventDefault(),D.stopPropagation(),De(!1);const G=D.dataTransfer&&D.dataTransfer.files,le=G&&G[0];if(!le)return;const je=le.name.toLowerCase();if(!je.endsWith(".yaml")&&!je.endsWith(".yml")){we({type:"error",message:g("agents.import_invalid_file")});return}if(le.size>10*1024*1024){we({type:"error",message:g("agents.import_file_too_large")});return}const $e=new FileReader;$e.onload=Ve=>{const Qe=Ve&&Ve.target?Ve.target.result:null;typeof Qe=="string"&&xe(Qe)},$e.onerror=()=>{we({type:"error",message:g("agents.import_read_error")})},$e.readAsText(le)},[g,xe]);return M?o.jsxs("div",{className:"h-full flex",children:[o.jsxs("div",{className:`${L?"w-12":"w-80"} transition-all duration-200 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-gray-50 dark:bg-gray-950`,children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 dark:border-gray-800",children:[L?null:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:e,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:g("agents.back_to_chat"),"aria-label":g("agents.back_to_chat"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:g("agents.title")})]}),o.jsx("button",{onClick:()=>$(D=>!D),className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors ${L?"mx-auto":""}`,title:g(L?"agents.expand_panel":"agents.collapse_panel"),"aria-label":g(L?"agents.expand_panel":"agents.collapse_panel"),"aria-expanded":!L,"aria-controls":"agents-panel-content",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:L?"M8.25 4.5l7.5 7.5-7.5 7.5":"M15.75 19.5L8.25 12l7.5-7.5"})})}),L?null:o.jsx("button",{onClick:ce,disabled:y||x,className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${k==="success"?"text-green-500":k==="error"?"text-red-500":"text-gray-400"}`,title:g("agents.refresh"),"aria-label":g("agents.refresh"),children:o.jsx("svg",{className:`w-4 h-4 ${x?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]}),o.jsx("div",{id:"agents-panel-content",className:"flex-1 overflow-y-auto p-2",children:L?o.jsx("div",{className:"py-2 flex flex-col items-center gap-1.5",children:p.map(D=>{const G=D.name===M.name,le=D.state==="working"||D.state==="idle";return o.jsx("button",{onClick:()=>X(D),className:"p-0.5 rounded-full",title:D.displayName||D.name,"aria-label":D.displayName||D.name,children:o.jsx("div",{className:`w-3 h-3 rounded-full ${G?"ring-2 ring-primary-500 bg-primary-400":le?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`})},D.name)})}):o.jsx("div",{className:"space-y-1",children:p.map(D=>{const G=D.name===M.name,le=D.state==="working"||D.state==="idle";return o.jsx("button",{onClick:()=>X(D),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${G?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"}`,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${le?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`}),o.jsx("span",{className:"text-sm font-medium truncate",children:D.displayName||D.name})]})},D.name)})})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(aJ,{agent:M,onClose:ye,onAction:Ae,onToolPartsChange:T,hackerMode:a})}),Array.isArray(Z)&&o.jsxs("aside",{style:{width:c},className:`border-l hidden lg:flex flex-col relative bg-gray-50 dark:bg-gray-900 ${a?s?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[o.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":g("agents.resize_terminal"),"aria-valuemin":d,"aria-valuemax":f,"aria-valuenow":c,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${a?s?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}`,onMouseDown:D=>{D.preventDefault();const G=D.clientX,le=c,je=Ve=>{const Qe=G-Ve.clientX,Ye=Math.min(f,Math.max(d,le+Qe));u&&u(Ye)},$e=()=>{document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",$e)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",$e)}}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:a?o.jsx(aI,{toolParts:Z,matrixMode:i,onToggleMatrix:l,darkMode:s}):o.jsx(nI,{toolParts:Z})})]})]}):o.jsxs("div",{className:"h-full flex flex-col relative",onDragOver:fe,onDragLeave:pe,onDrop:U,children:[ve&&o.jsx("div",{className:"absolute inset-0 z-50 bg-primary-500/10 border-2 border-dashed border-primary-500 rounded-xl flex items-center justify-center pointer-events-none",children:o.jsx("div",{className:"bg-white dark:bg-gray-900 px-6 py-4 rounded-lg shadow-lg text-primary-600 dark:text-primary-400 font-medium",children:g("agents.drop_to_import")})}),o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:e,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:g("agents.back_to_chat"),"aria-label":g("agents.back_to_chat"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:g("agents.title")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g("agents.subtitle")})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:ce,disabled:y||x,className:`p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${k==="success"?"text-green-500":k==="error"?"text-red-500":"text-gray-500 dark:text-gray-400"}`,title:g("agents.refresh"),"aria-label":g("agents.refresh"),children:o.jsx("svg",{className:`w-4 h-4 ${x?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsxs("button",{onClick:he,className:"px-4 py-2 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 font-medium text-sm transition-colors flex items-center gap-2",title:g("agents.import_button"),"aria-label":g("agents.import_button"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),g("agents.import_button")]}),o.jsxs("button",{onClick:()=>P(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),g("agents.spawn_button")]})]})]}),p.length>0&&o.jsx(fJ,{agents:p,totalCost:Me}),_&&o.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:_}),o.jsx("button",{onClick:()=>w(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),K&&o.jsxs("div",{className:`mx-6 mt-4 px-4 py-2 text-sm rounded-lg flex items-center justify-between ${K.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:[o.jsx("span",{children:K.message}),o.jsx("button",{onClick:()=>we(null),"aria-label":g("common.close")||"Close",title:g("common.close")||"Close",className:`ml-2 ${K.type==="success"?"text-green-400 hover:text-green-600":"text-red-400 hover:text-red-600"}`,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y&&p.length===0?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center",children:[o.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4",children:o.jsx("svg",{className:"w-8 h-8 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.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"})})}),o.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-1",children:g("agents.no_agents_title")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:g("agents.no_agents_desc")}),o.jsxs("button",{onClick:()=>P(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),g("agents.spawn_button")]}),o.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-4",children:["Or run ",o.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded",children:"pave agent --daemon"})," in a project directory"]})]}):o.jsxs(o.Fragment,{children:[W.size>0&&o.jsxs("div",{className:"mb-4 px-4 py-2.5 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg flex items-center gap-3 flex-wrap",children:[o.jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:g("agents.selected",{count:W.size})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>Se("pause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:g("agents.pauseAll")}),o.jsx("button",{onClick:()=>Se("unpause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:g("agents.unpauseAll")}),o.jsx("button",{onClick:()=>Se("stop"),className:"px-3 py-1 text-xs font-medium rounded-md bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800/40 transition-colors",children:g("agents.stopAll")}),o.jsx("button",{onClick:()=>Se("restart"),className:"px-3 py-1 text-xs font-medium rounded-md bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800/40 transition-colors",children:g("agents.restartAll")}),o.jsx("button",{onClick:()=>Se("start"),className:"px-3 py-1 text-xs font-medium rounded-md bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 transition-colors",children:g("agents.startAll")})]}),o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsx("button",{onClick:Ee,className:"px-2 py-1 text-xs text-primary-600 dark:text-primary-400 hover:underline",children:g("agents.selectAll")}),o.jsx("button",{onClick:de,className:"px-2 py-1 text-xs text-gray-500 dark:text-gray-400 hover:underline",children:g("agents.deselectAll")})]})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(D=>o.jsx(dJ,{agent:D,onAction:ee,onSelect:X,onExport:ge,actionLoading:E,isSelected:W.has(D.name),onToggleSelect:Oe},D.name))})]})}),o.jsx(sJ,{isOpen:F,onClose:()=>P(!1),existingAgentNames:p.map(D=>D.name),onCreated:me})]})}let Jr=null;function N3(){if(Jr&&Jr.state==="closed"&&(Jr=null),!Jr){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{Jr=new e}catch(t){throw Jr=null,t}}return Jr.state==="suspended"&&Jr.resume().catch(()=>{}),Jr}if(typeof document<"u"){const e=async()=>{let t;try{t=N3()}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"&&(Jr=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function C3(){let e;try{e=N3()}catch{return}if(e)try{const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.value=800,r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.01,t+.1),n.connect(r),r.connect(e.destination),n.start(t),n.stop(t+.1);const a=e.createOscillator(),i=e.createGain();a.type="sine",a.frequency.value=1e3,i.gain.setValueAtTime(.3,t+.1),i.gain.exponentialRampToValueAtTime(.01,t+.2),a.connect(i),i.connect(e.destination),a.start(t+.1),a.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),Jr=null}}function j3(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function pJ(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const T3="pave-native-notifications";function jc(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function hJ(){return jc()?Notification.permission:"unsupported"}function cc(){if(!jc()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(T3)==="true"}catch{return!1}}function mJ(e){try{localStorage.setItem(T3,e?"true":"false")}catch{}}async function xJ(){if(!jc())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function R3({title:e,body:t,tag:n,icon:r,onClick:a}){if(!jc()||Notification.permission!=="granted"||!cc())return null;try{const i=new Notification(e,{body:t||"",tag:n||"pave-"+Date.now(),icon:r||"/pave-logo-light.png",silent:!1});return typeof a=="function"&&(i.onclick=function(){a(),i.close()}),setTimeout(()=>{try{i.close()}catch{}},8e3),i}catch{return null}}const A3="pave-push-notifications",yJ="/sw.js";function Of(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function bJ(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function vJ(){try{return localStorage.getItem(A3)==="true"}catch{return!1}}function zd(e){try{localStorage.setItem(A3,e?"true":"false")}catch{}}function ly(){return typeof Notification>"u"?"unsupported":Notification.permission}async function kJ(){if(!Of())return null;try{return await navigator.serviceWorker.register(yJ,{scope:"/"})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function _J(){if(!Of())return console.warn("[web-push] Not supported in this browser"),!1;const e=await kJ();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("/api/push/vapid-public-key",{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const a=await r.json();t=jJ(a.publicKey)}catch(r){return console.error("[web-push] Failed to get VAPID key:",r.message),!1}let n=await e.pushManager.getSubscription();if(n){let r=!0;if(n.options&&n.options.applicationServerKey){const a=new Uint8Array(n.options.applicationServerKey);r=CJ(a,t)}if(r)return await sj(n),zd(!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 sj(n),zd(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function wJ(){if(!Of())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch("/api/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return zd(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),zd(!1),!1}}async function sj(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:oj(e.getKey("p256dh")),auth:oj(e.getKey("auth"))}},await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function EJ(){const e=await fetch("/api/push/test",{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function SJ(e){if(typeof document>"u"||typeof window>"u")return;function t(n){const r=typeof e=="function"?e():null,a=JSON.stringify({visible:n,activeSessionId:r});try{if(navigator.sendBeacon){const i=new Blob([a],{type:"application/json"});navigator.sendBeacon("/api/visibility",i);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:a}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function NJ(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("/api/visibility",r);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:n}).catch(()=>{})}catch{}}function CJ(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 jJ(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4),r=atob(t+n),a=new Uint8Array(r.length);for(let i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return a}function oj(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 cy=["AI Model & Provider","Prefill Fallback","Models","LM Studio","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp"],lj={"AI Model & Provider":"settings.category.model","Prefill Fallback":"settings.category.prefillFallback",Models:"settings.category.models","LM Studio":"settings.category.lmstudio",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",WhatsApp:"settings.category.whatsapp"};function TJ({source:e,envVar:t,t:n}){return e==="env"?o.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",title:n("settings.env_override",{envVar:t}),children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),n("settings.source_env")]}):e==="settings"?o.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",children:n("settings.source_saved")}):o.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:n("settings.source_default")})}var RJ=["__proto__","constructor","prototype"];function uy(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function AJ(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 I3(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function cj(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=I3(n);t[r]=n}return t}function uj(e){var t=e.name,n=e.config,r=e.setName,a=e.setConfig,i=e.onSave,s=e.onCancel,l=e.saving,c=e.isNew,u=e.t;function d(v){a(function(x){return Object.assign({},x,v)})}function f(v){a(function(x){return Object.assign({},x,{limit:Object.assign({},x.limit||{},v)})})}function g(v){a(function(x){return Object.assign({},x,{cost:Object.assign({},x.cost||{},v)})})}var p="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",m="text-xs text-gray-500 dark:text-gray-400 block mb-0.5",y=I3(n.spec);return o.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:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"col-span-2",children:[o.jsx("label",{className:m,children:u("settings.model_registry.name")}),o.jsx("input",{type:"text",value:t,onChange:function(v){r(v.target.value)},className:p+" font-mono",placeholder:u("settings.model_registry.name_placeholder"),autoFocus:c})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsxs("label",{className:m,children:[u("settings.model_registry.spec"),y&&o.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:y==="url"?"URL":u("settings.model_registry.kind_alias")})]}),o.jsx("input",{type:"text",value:n.spec||"",onChange:function(v){d({spec:v.target.value})},className:p+" font-mono",placeholder:u("settings.model_registry.spec_placeholder")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:u("settings.model_registry.spec_hint")})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("label",{className:m,children:u("settings.model_registry.displayName")}),o.jsx("input",{type:"text",value:n.displayName||"",onChange:function(v){d({displayName:v.target.value})},className:p,placeholder:u("settings.model_registry.displayName_placeholder")})]}),o.jsxs("details",{className:"col-span-2",children:[o.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:u("settings.model_registry.advanced")}),o.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:m,children:u("settings.model_registry.limit_context")}),o.jsx("input",{type:"number",value:n.limit?n.limit.context:128e3,onChange:function(v){f({context:parseInt(v.target.value,10)||128e3})},className:p})]}),o.jsxs("div",{children:[o.jsx("label",{className:m,children:u("settings.model_registry.limit_output")}),o.jsx("input",{type:"number",value:n.limit?n.limit.output:8192,onChange:function(v){f({output:parseInt(v.target.value,10)||8192})},className:p})]}),o.jsxs("div",{children:[o.jsx("label",{className:m,children:u("settings.model_registry.cost_input")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.input:0,onChange:function(v){g({input:parseFloat(v.target.value)||0})},className:p})]}),o.jsxs("div",{children:[o.jsx("label",{className:m,children:u("settings.model_registry.cost_output")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.output:0,onChange:function(v){g({output:parseFloat(v.target.value)||0})},className:p})]})]})]})]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[o.jsx("button",{type:"button",onClick:i,disabled:l||!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:u(l?c?"settings.model_registry.adding":"settings.model_registry.saving":c?"settings.model_registry.add":"settings.model_registry.save")}),o.jsx("button",{type:"button",onClick:s,disabled:l,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:u("settings.model_registry.cancel")})]})]})}function IJ({value:e,onChange:t,t:n}){const[r,a]=h.useState(null),[i,s]=h.useState(!0),[l,c]=h.useState(null),[u,d]=h.useState(!1),[f,g]=h.useState(""),[p,m]=h.useState(uy()),[y,v]=h.useState(null),[x,b]=h.useState(!1),[k,N]=h.useState(null);h.useEffect(function(){var O=!1;return s(!0),X4().then(function(I){O||(a(I),s(!1))}).catch(function(I){O||(c(I.message),s(!1))}),function(){O=!0}},[]);var _=h.useCallback(function(){s(!0),c(null),X4().then(function(O){a(O),s(!1)}).catch(function(O){c(O.message),s(!1)})},[]);function w(O,I,T){var L=(O||"").trim();return L?RJ.indexOf(L)!==-1?n("settings.model_registry.error_name_reserved",{name:L}):L!==T&&I.indexOf(L)!==-1?n("settings.model_registry.error_name_exists",{name:L}):null:n("settings.model_registry.error_name_required")}var E=h.useCallback(async function(){if(r){var O=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),I=w(f,O,null);if(I){N(I);return}b(!0),N(null);try{await Q4(f.trim(),cj(p)),d(!1),g(""),m(uy()),_(),t&&t(e)}catch(T){N(T.message)}finally{b(!1)}}},[f,p,r,t,e,_]),S=h.useCallback(async function(O){b(!0),N(null);try{await Z4(O),_(),t&&t(e)}catch(I){N(I.message)}finally{b(!1)}},[t,e,_]),M=h.useCallback(async function(){if(!(!y||!r)){var O=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),I=w(y.name,O,y.originalName);if(I){N(I);return}b(!0),N(null);try{var T=y.name.trim(),L=cj(y.config);if(await Q4(T,L),T!==y.originalName)try{await Z4(y.originalName)}catch($){N(n("settings.model_registry.error_rename_cleanup",{error:$.message}))}v(null),_(),t&&t(e)}catch($){N($.message)}finally{b(!1)}}},[y,r,t,e,_]);if(i)return o.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[o.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),n("settings.model_registry.loading")]});if(l)return o.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:n("settings.model_registry.load_error",{error:l})});var j=r&&r.user?r.user:{},F=r&&r.builtin?r.builtin:{},P=Object.keys(j),W=Object.keys(F);return o.jsxs("div",{className:"space-y-3",children:[k&&o.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:k}),W.length>0&&o.jsxs("div",{children:[o.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")}),o.jsx("div",{className:"space-y-1",children:W.map(function(O){var I=F[O];return o.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:[o.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:O}),I.provider&&o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:I.provider}),I.limit&&I.limit.context&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:I.limit.context/1e3})}),I.tier&&o.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:I.tier})]},O)})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("settings.model_registry.user")}),!u&&!y&&o.jsx("button",{type:"button",onClick:function(){d(!0),g(""),m(uy()),N(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")})]}),P.length===0&&!u&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:n("settings.model_registry.no_user_models")}),o.jsxs("div",{className:"space-y-2",children:[P.map(function(O){var I=j[O];return y&&y.originalName===O?o.jsx(uj,{name:y.name,config:y.config,setName:function(T){v(function(L){return L&&Object.assign({},L,{name:T})})},setConfig:function(T){v(function(L){if(!L)return L;var $=typeof T=="function"?T(L.config):T;return Object.assign({},L,{config:$})})},onSave:M,onCancel:function(){v(null),N(null)},saving:x,isNew:!1,t:n},O):o.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:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:O}),I.displayName&&I.displayName!==O&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",I.displayName,")"]}),I.url&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",I.url]}),!I.url&&I.target&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",I.target]}),I.limit&&I.limit.context&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:I.limit.context/1e3})})]}),o.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o.jsx("button",{type:"button",onClick:function(){v({originalName:O,name:O,config:AJ(I)}),d(!1),N(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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{type:"button",onClick:function(){window.confirm(n("settings.model_registry.delete_confirm",{name:O}))&&S(O)},disabled:x,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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})})]})]},O)}),u&&o.jsx(uj,{name:f,config:p,setName:g,setConfig:function(O){m(function(I){return typeof O=="function"?O(I):O})},onSave:E,onCancel:function(){d(!1),N(null)},saving:x,isNew:!0,t:n})]})]})]})}function MJ({setting:e,value:t,onChange:n,error:r,models:a,t:i}){const[s,l]=h.useState(!1),c=e.source==="env",u="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")+(c?" opacity-60 cursor-not-allowed":"")+" text-gray-900 dark:text-gray-100",d=e.type==="model-select"&&a&&a.length>0&&t&&!a.find(function(g){return g.id===t});if(h.useEffect(function(){e.type!=="model-select"||!a||a.length===0||t&&a.find(function(g){return g.id===t})&&l(!1)},[t,a,e.type]),e.type==="model-select"){if(!a||a.length===0)return o.jsxs("div",{children:[o.jsx("input",{type:"text",value:t,onChange:function(m){n(m.target.value)},disabled:c,placeholder:e.defaultValue||i("settings.custom_model_placeholder"),className:u}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const g=s||d,p=V1(a);return o.jsxs("div",{children:[o.jsxs("select",{value:g?"__custom__":t,onChange:function(m){m.target.value==="__custom__"?l(!0):(l(!1),n(m.target.value))},disabled:c,className:u,children:[Object.entries(p).map(function(m){var y=m[0],v=m[1];return o.jsx("optgroup",{label:q1[y]||y,children:v.map(function(x){return o.jsxs("option",{value:x.id,children:[x.name,W1(x.tier)]},x.id)})},y)}),o.jsx("option",{value:"__custom__",children:i("settings.custom_model")})]}),g&&o.jsx("input",{type:"text",value:t,onChange:function(m){n(m.target.value)},disabled:c,placeholder:i("settings.custom_model_placeholder"),className:u+" mt-2 font-mono"}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="boolean"){const g=typeof t=="string"?t.toLowerCase():String(t),p=g==="true"||g==="1";return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{type:"button",role:"switch","aria-checked":p,"aria-label":e.label,disabled:c,onClick:function(){n(p?"false":"true")},className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(p?"bg-primary-600":"bg-gray-200 dark:bg-gray-600")+(c?" opacity-50 cursor-not-allowed":""),children:o.jsx("span",{"aria-hidden":"true",className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(p?"translate-x-5":"translate-x-0")})}),o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:i(p?"settings.enabled":"settings.disabled")})]}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="select")return o.jsxs("div",{children:[o.jsx("select",{value:t,onChange:function(g){n(g.target.value)},disabled:c,className:u,children:(e.options||[]).map(function(g){var p=e.optionLabels&&e.optionLabels[g]||g;return o.jsx("option",{value:g,children:p},g)})}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="number")return o.jsxs("div",{children:[o.jsx("input",{type:"number",value:t,onChange:function(g){n(g.target.value)},disabled:c,min:e.min,max:e.max,placeholder:e.defaultValue||i("settings.not_set"),className:u}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="textarea")return o.jsxs("div",{children:[o.jsx("textarea",{value:t,onChange:function(g){n(g.target.value)},disabled:c,placeholder:e.defaultValue||i("settings.not_set"),className:u+" resize-y min-h-[80px]",rows:4}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="object")return o.jsxs("div",{children:[o.jsx(IJ,{value:t,onChange:n,t:i}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const f=e.type==="password"?"password":"text";return o.jsxs("div",{children:[o.jsx("input",{type:f,value:t,onChange:function(g){n(g.target.value)},disabled:c,placeholder:e.defaultValue||i("settings.not_set"),className:u,autoComplete:e.type==="password"?"off":void 0}),r&&o.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}function LJ({onBack:e,activeSessionId:t,mobileFrameless:n,onMobileFramelessChange:r}){const{t:a,locale:i,setLocale:s,availableLocales:l}=Rt(),[c,u]=h.useState([]),[d,f]=h.useState({}),[g,p]=h.useState({}),[m,y]=h.useState(!0),[v,x]=h.useState(!1),[b,k]=h.useState(null),[N,_]=h.useState(null),[w,E]=h.useState([]),[S,M]=h.useState(()=>Al()||""),[j,F]=h.useState(()=>Al()||""),[P,W]=h.useState(""),[O,I]=h.useState(null),[T,L]=h.useState(!1),[$,Z]=h.useState(()=>j3()),[R]=h.useState(()=>jc()),[Y,V]=h.useState(()=>hJ()),[A,H]=h.useState(()=>cc()),[ce]=h.useState(()=>Of()),[ee,Me]=h.useState(()=>vJ()),[X,ye]=h.useState(()=>ly()),[Oe,Ee]=h.useState(!1),[de,Se]=h.useState("checking"),[Ae,me]=h.useState(null),[ve,De]=h.useState(null),[K,we]=h.useState(null),Te=h.useCallback(function(){const ue=!$;Z(ue),pJ(ue),ue&&C3()},[$]),ge=h.useCallback(async function(){if(!R)return;if(!A&&Notification.permission!=="granted"){const qe=await xJ();if(V(qe),qe!=="granted")return}const ue=!A;H(ue),mJ(ue)},[A,R]),xe=h.useCallback(async function(){if(!(!ce||Oe)){Ee(!0);try{ee?(await wJ(),Me(!1)):(await _J()&&Me(!0),ye(ly()))}catch(ue){console.error("[settings] Web push toggle failed:",ue.message)}finally{Ee(!1)}}},[ee,ce,Oe]),he=h.useCallback(async function(){if(!Oe){Ee(!0);try{const ue=await EJ();ue.sent>0?alert("Test push sent! Check your device."):ue.failed>0?alert("Push delivery failed ("+ue.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(ue){alert("Test push failed: "+ue.message)}finally{Ee(!1)}}},[Oe]),fe=h.useCallback(function(ue){me(ue.currentVersion),De(ue.latestVersion),ue.error?(we(ue.error),Se("check-error")):ue.updateAvailable?Se("update-available"):Se("no-updates")},[]),pe=h.useCallback(async function(){Se("checking"),we(null);try{const ue=await sy();fe(ue)}catch(ue){we(ue.message),Se("check-error")}},[fe]),U=h.useCallback(async function(){Se("updating"),we(null);try{await QZ(),Se("success");try{const ue=await sy();me(ue.currentVersion),De(ue.latestVersion)}catch{}}catch(ue){we(ue.message),Se("error")}},[]),D=h.useCallback(async function(){try{y(!0),_(null);const qe=(await ZA()).settings||[];u(qe);const Ge={};for(let bt=0;bt<qe.length;bt++)Ge[qe[bt].key]=qe[bt].value;f(Ge),p({}),k(null);try{const bt=await jb();W(bt.home||"")}catch{}}catch(ue){_(ue.message)}finally{y(!1)}},[]);h.useEffect(function(){D();var ue=!1;return async function(){try{const Ge=await G1();ue||E(Ge||[])}catch{}}(),function(){ue=!0}},[D]),h.useEffect(function(){var ue=!1;return Se("checking"),async function(){try{const Ge=await sy();ue||fe(Ge)}catch(Ge){ue||(we(Ge&&Ge.message?Ge.message:String(Ge)),Se("check-error"))}}(),function(){ue=!0}},[fe]);const G=h.useCallback(function(ue,qe){f(function(Ge){return{...Ge,[ue]:qe}}),p(function(Ge){if(!Ge[ue])return Ge;const{[ue]:bt,...cn}=Ge;return cn}),k(null)},[]),le=h.useCallback(async function(){x(!0),k(null);try{const ue={};for(let bt=0;bt<c.length;bt++){const cn=c[bt];cn.source!=="env"&&d[cn.key]!==cn.value&&(ue[cn.key]=d[cn.key])}if(Object.keys(ue).length===0){k({type:"info",message:a("settings.no_changes")}),x(!1);return}const qe=await JH(ue),Ge=Object.keys(qe.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(ue)}}))}catch{}if(Ge.length>0?(p(qe.errors),k({type:"warning",message:a("settings.partial_save")})):k({type:"success",message:a("settings.saved")}),qe.settings){const bt=qe.settings;u(bt);const cn={};for(let Hn=0;Hn<bt.length;Hn++)cn[bt[Hn].key]=bt[Hn].value;Ge.length>0?f(function(Hn){const On={...cn};for(let hn=0;hn<Ge.length;hn++)Hn[Ge[hn]]!==void 0&&(On[Ge[hn]]=Hn[Ge[hn]]);return On}):f(cn)}}catch(ue){k({type:"error",message:a("settings.save_failed",{error:ue.message})})}finally{x(!1)}},[c,d,a]),je=h.useCallback(function(){const ue={};for(let qe=0;qe<c.length;qe++)ue[c[qe].key]=c[qe].value;f(ue),p({}),k(null),M(j),I(null)},[c,j]),$e=h.useCallback(function(ue){M(ue),I(null),k(null)},[]),Ve=h.useCallback(async function(){const ue=S.trim();if(!ue){if(ep(null),F(""),M(""),I(null),k({type:"success",message:a("settings.working_dir_reset")}),t)try{await Dr(t,{directory:null})}catch(Ge){console.warn("SettingsPage: failed to clear session directory:",Ge.message)}return}L(!0),I(null);const qe=Al();try{ep(ue);const Ge=await jb();if(F(ue),M(ue),k({type:"success",message:a("settings.working_dir_updated",{path:Ge.cwd})}),t)try{await Dr(t,{directory:ue})}catch(bt){console.warn("SettingsPage: failed to update session directory:",bt.message)}}catch(Ge){ep(qe),M(j),I(a("settings.working_dir_invalid",{error:Ge.message}))}finally{L(!1)}},[S,j,t]);let Qe=!1;for(let ue=0;ue<c.length;ue++)if(c[ue].source!=="env"&&d[c[ue].key]!==c[ue].value){Qe=!0;break}const Ye=S!==j;Qe=Qe||Ye;const _t={};for(let ue=0;ue<c.length;ue++){const qe=c[ue].category;_t[qe]||(_t[qe]=[]),_t[qe].push(c[ue])}const He=[];for(let ue=0;ue<cy.length;ue++)_t[cy[ue]]&&He.push(cy[ue]);const at=Object.keys(_t);for(let ue=0;ue<at.length;ue++)He.indexOf(at[ue])<0&&He.push(at[ue]);return m?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):N?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[o.jsx("p",{className:"text-red-600 dark:text-red-400",children:a("settings.failed_to_load",{error:N})}),o.jsx("button",{onClick:D,className:"px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700",children:a("common.retry")})]}):o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:e,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:a("settings.back"),"aria-label":a("settings.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("settings.title")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("settings.description")})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[Qe&&o.jsx("button",{onClick:je,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 transition-colors",children:a("settings.reset")}),o.jsx("button",{onClick:le,disabled:v||!Qe,className:"px-4 py-1.5 text-sm font-medium rounded-lg transition-colors "+(Qe&&!v?"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:a(v?"settings.saving":"settings.save")})]})]}),b&&o.jsx("div",{className:"mx-6 mt-4 px-4 py-2 rounded-lg text-sm "+(b.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800":b.type==="error"?"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border border-red-200 dark:border-red-800":b.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border border-amber-200 dark:border-amber-800":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border border-blue-200 dark:border-blue-800"),children:b.message}),o.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:o.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:a("settings.category.language")}),o.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[o.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:a("settings.language")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:a("settings.language_description")}),o.jsx("select",{id:"settings-language",value:i,onChange:function(ue){s(ue.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:l.map(function(ue){return o.jsxs("option",{value:ue.code,children:[ue.nativeName," (",ue.name,")"]},ue.code)})}),o.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:a("settings.language_auto_applied")})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:a("settings.notifications")}),o.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"settings-notification-sound",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:a("settings.notification_sound")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:a("settings.notification_sound_desc")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:a("settings.auto_saved")})]}),o.jsx("button",{id:"settings-notification-sound",type:"button",role:"switch","aria-checked":$,onClick:Te,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+($?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:o.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+($?"translate-x-5":"translate-x-0")})})]}),o.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"settings-native-notifications",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:a("settings.native_notifications")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:a("settings.native_notifications_desc")}),Y==="denied"&&o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:a("settings.native_notifications_blocked")}),Y==="default"&&o.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:a("settings.native_notifications_permission")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:a("settings.auto_saved")})]}),R?o.jsx("button",{id:"settings-native-notifications",type:"button",role:"switch","aria-checked":A,onClick:ge,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(A?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:o.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(A?"translate-x-5":"translate-x-0")})}):o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("settings.native_notifications_unsupported")})]}),o.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"settings-web-push",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:"Push Notifications (PWA)"}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Server-delivered push when you switch away from the app. Works on iOS Safari (installed to Home Screen) and desktop browsers."}),ce&&!bJ()&&o.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."}),X==="denied"&&o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:"Notifications blocked by browser — enable in browser settings."}),ee&&o.jsx("button",{type:"button",onClick:he,disabled:Oe,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:Oe?"Sending...":"Send test notification"})]}),ce?o.jsx("button",{id:"settings-web-push",type:"button",role:"switch","aria-checked":ee,onClick:xe,disabled:Oe,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 "+(ee?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:o.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(ee?"translate-x-5":"translate-x-0")})}):o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"Not supported in this browser"})]})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:a("settings.appearance")}),o.jsx("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"settings-mobile-frameless",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:a("settings.mobile_frameless")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:a("settings.mobile_frameless_desc")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:a("settings.auto_saved")})]}),o.jsx("button",{id:"settings-mobile-frameless",type:"button",role:"switch","aria-checked":n,onClick:()=>r(!n),className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(n?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:o.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(n?"translate-x-5":"translate-x-0")})})]})})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:a("settings.workspace")}),o.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[o.jsx("label",{htmlFor:"settings-working-dir",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:a("settings.working_dir")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:a("settings.working_dir_desc")}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{id:"settings-working-dir",type:"text",value:S,onChange:function(ue){$e(ue.target.value)},placeholder:P||"~ (home directory)",className:"flex-1 block rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(O?"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"}),o.jsx("button",{onClick:Ve,disabled:T||!Ye,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(Ye&&!T?"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:a(T?"settings.validating":"settings.apply")})]}),O&&o.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:O}),j&&o.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:a("settings.currently_set_to",{path:j})})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:a("settings.version_title")}),o.jsx("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a("settings.current_version")}),o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:Ae||"--"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a("settings.latest_version")}),o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:de==="checking"?a("settings.checking_updates"):ve||"--"})]}),de==="update-available"&&o.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[a("settings.update_available")," (",ve,")"]}),de==="no-updates"&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("settings.no_updates")}),de==="success"&&o.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:a("settings.update_success")}),de==="check-error"&&K&&o.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[a("settings.check_updates_failed"),": ",K]}),de==="error"&&K&&o.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[a("settings.update_failed"),": ",K]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[(de==="idle"||de==="no-updates"||de==="error"||de==="check-error"||de==="success")&&o.jsx("button",{onClick:pe,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:a("settings.check_updates")}),de==="update-available"&&o.jsx("button",{onClick:U,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors",children:a("settings.update_button")}),de==="updating"&&o.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:a("settings.update_in_progress")}),de==="checking"&&o.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:a("settings.checking_updates")})]})]})})]}),He.map(function(ue){return o.jsxs("section",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 uppercase tracking-wider mb-4",children:lj[ue]?a(lj[ue]):ue}),o.jsx("div",{className:"space-y-4",children:_t[ue].map(function(qe){return o.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:qe.label}),o.jsx(TJ,{source:qe.source,envVar:qe.envVar,t:a})]}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:[qe.description,qe.requiresRestart&&o.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:a("settings.requires_restart")}),qe.source==="env"&&o.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:a("settings.env_override",{envVar:qe.envVar})})]}),o.jsx(MJ,{setting:qe,value:d[qe.key]!==void 0?d[qe.key]:"",onChange:function(Ge){G(qe.key,Ge)},error:g[qe.key],models:w,t:a}),qe.source!=="default"&&qe.defaultValue!==void 0&&qe.type!=="object"&&o.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:a("settings.default_prefix",{value:qe.defaultValue===""?a("settings.default_empty"):qe.defaultValue})})]},qe.key)})})]},ue)})]})})]})}function OJ({modelName:e,rates:t,onChange:n,onDelete:r,isDefault:a,t:i}){return o.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`text-sm font-medium truncate ${a?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),a&&o.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:i("pricing.fallback_badge")})]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("pricing.label_input")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:t.input,onChange:s=>n(e,"input",parseFloat(s.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:i("pricing.input_tokens")})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("pricing.label_output")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:t.output,onChange:s=>n(e,"output",parseFloat(s.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:i("pricing.output_tokens")})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("pricing.label_cache")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:t.cached,onChange:s=>n(e,"cached",parseFloat(s.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:i("pricing.cached_tokens")})]}),!a&&o.jsx("button",{onClick:()=>r(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors",title:i("pricing.remove_model"),"aria-label":i("pricing.remove_model_aria",{modelName:e}),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),a&&o.jsx("div",{className:"w-6"})]})]})}function DJ({onAdd:e,existingModels:t,t:n}){const[r,a]=h.useState(""),[i,s]=h.useState(5),[l,c]=h.useState(15),[u,d]=h.useState(2.5),[f,g]=h.useState(""),p=m=>{m.preventDefault(),g("");const y=r.trim().toLowerCase();if(!y){g(n("pricing.model_required"));return}if(t.includes(y)){g(n("pricing.model_exists"));return}if(y==="default"){g(n("pricing.default_exists"));return}e(y,{input:i,output:l,cached:u}),a(""),s(5),c(15),d(2.5)};return o.jsxs("form",{onSubmit:p,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[o.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("pricing.add_new_model")}),o.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[o.jsx("div",{className:"flex-1 min-w-[120px]",children:o.jsx("input",{type:"text",placeholder:n("pricing.add_model_placeholder"),value:r,onChange:m=>a(m.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"})}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_input")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:i,onChange:m=>s(parseFloat(m.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"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_output")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:l,onChange:m=>c(parseFloat(m.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"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_cache")}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:u,onChange:m=>d(parseFloat(m.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"})]}),o.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")})]}),f&&o.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function PJ({onClose:e}){const{t}=Rt(),n=hc(),[r,a]=h.useState(null),[i,s]=h.useState(!0),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,g]=h.useState(!1),p=h.useRef(null);h.useEffect(()=>{let _=!1;async function w(){try{const E=await $Z();_||(a(E),s(!1))}catch(E){_||(d(E.message),s(!1))}}return w(),()=>{_=!0}},[]),h.useEffect(()=>{async function _(w){w.key==="Escape"&&(f?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",_),p.current&&p.current.focus(),()=>document.removeEventListener("keydown",_)},[e,f,n,t]);const m=h.useCallback((_,w,E)=>{a(S=>!S||!S.models?S:{...S,models:{...S.models,[_]:{...S.models[_],[w]:E}}}),g(!0)},[]),y=h.useCallback(async _=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:_}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(a(w=>{if(!w||!w.models)return w;const E={...w.models};return delete E[_],{...w,models:E}}),g(!0))},[n,t]),v=h.useCallback((_,w)=>{a(E=>E?{...E,models:{...E.models,[_]:w}}:{models:{[_]:w}}),g(!0)},[]),x=h.useCallback(async()=>{d(null),c(!0);try{await HZ(r),g(!1),e()}catch(_){d(_.message)}finally{c(!1)}},[r,e]),b=h.useCallback(async()=>{if(await n({title:t("pricing.reset_title"),message:t("pricing.reset_confirm"),destructive:!0,confirmLabel:t("pricing.reset")})){d(null),c(!0);try{const _=await qZ();a(_.pricing),g(!1)}catch(_){d(_.message)}finally{c(!1)}}},[n,t]),k=h.useCallback(async()=>{f?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[f,e,n,t]),N=r!=null&&r.models?Object.entries(r.models).sort(([_],[w])=>_==="default"?1:w==="default"?-1:_.localeCompare(w)):[];return o.jsx("div",{ref:p,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:k,role:"dialog","aria-modal":"true","aria-label":t("pricing.title"),children:o.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:_=>_.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),o.jsx("button",{onClick:k,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[i&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),u&&o.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:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),!i&&r&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[o.jsx("span",{children:t("pricing.configured_count",{count:N.length})}),o.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),o.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[o.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:[o.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),o.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),o.jsx("div",{className:"w-6"})]}),o.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:N.map(([_,w])=>o.jsx(OJ,{modelName:_,rates:w,onChange:m,onDelete:y,isDefault:_==="default",t},_))})]}),o.jsx(DJ,{onAdd:v,existingModels:N.map(([_])=>_),t})]})]}),o.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:[o.jsx("button",{onClick:b,disabled:l,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")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:k,disabled:l,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")}),o.jsxs("button",{onClick:x,disabled:l||!f,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:[l&&o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const FJ=[{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"}],BJ=["low","medium","high"];function zJ({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 o.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function dj({name:e,regex:t,severity:n,enabled:r,builtin:a,onToggle:i,onRemove:s,t:l}){return o.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:[o.jsxs("label",{className:"relative inline-flex items-center cursor-pointer flex-shrink-0",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:()=>i(e),className:"sr-only peer",disabled:!1}),o.jsx("div",{className:"w-8 h-4 bg-gray-200 peer-focus:outline-none 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"})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),a&&o.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"})]}),o.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})]}),o.jsx(zJ,{severity:n}),!a&&o.jsx("button",{onClick:()=>s(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:l("dlp.remove_pattern"),"aria-label":l("dlp.remove_pattern_aria",{name:e}),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function UJ({onAdd:e,existingNames:t,t:n}){const[r,a]=h.useState(""),[i,s]=h.useState(""),[l,c]=h.useState("medium"),[u,d]=h.useState(""),f=p=>{if(t.includes(p.name)){d(n("dlp.pattern_exists",{name:p.name}));return}a(p.name),s(p.regex),c(p.severity),d("")},g=p=>{if(p.preventDefault(),d(""),!r.trim()){d(n("dlp.name_required"));return}if(!i.trim()){d(n("dlp.regex_required"));return}if(t.includes(r.trim())){d(n("dlp.pattern_exists",{name:r.trim()}));return}try{new RegExp(i)}catch{d(n("dlp.invalid_regex"));return}e(r.trim(),i.trim(),l),a(""),s(""),c("medium")};return o.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[o.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("dlp.add_pattern")}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:FJ.map(p=>o.jsx("button",{onClick:()=>f(p),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:p.label},p.id))}),o.jsxs("form",{onSubmit:g,className:"flex items-end gap-2 flex-wrap",children:[o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.pattern_name")}),o.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:r,onChange:p=>a(p.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"})]}),o.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.regex_pattern")}),o.jsx("input",{type:"text",placeholder:"e.g. \\b[A-Z]\\d{7}\\b",value:i,onChange:p=>s(p.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"})]}),o.jsxs("div",{className:"w-24",children:[o.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.severity")}),o.jsx("select",{value:l,onChange:p=>c(p.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:BJ.map(p=>o.jsx("option",{value:p,children:p},p))})]}),o.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")})]}),u&&o.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:u})]})}function $J({onClose:e}){const{t}=Rt(),n=hc(),[r,a]=h.useState(null),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,g]=h.useState(null),[p,m]=h.useState(!1),[y,v]=h.useState(!0),[x,b]=h.useState("ask"),[k,N]=h.useState([]),[_,w]=h.useState({}),[E,S]=h.useState("epm/privacy"),M=h.useRef(null);h.useEffect(()=>{let T=!1;async function L(){var $;try{const Z=await uq();T||(s(Z.builtins||[]),v(Z.enabled!==!1),b(Z.defaultAction||"ask"),N(Z.disabledBuiltins||[]),w(Z.patterns||{}),S((($=Z.privateMode)==null?void 0:$.rerouteModel)||"epm/privacy"),a(Z),c(!1))}catch(Z){T||(g(Z.message),c(!1))}}return L(),()=>{T=!0}},[]),h.useEffect(()=>{async function T(L){L.key==="Escape"&&(p?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",T),M.current&&M.current.focus(),()=>document.removeEventListener("keydown",T)},[e,p,n,t]);const j=h.useCallback(T=>{N(L=>L.includes(T)?L.filter($=>$!==T):[...L,T]),m(!0)},[]),F=h.useCallback((T,L,$)=>{w(Z=>({...Z,[T]:{regex:L,severity:$}})),m(!0)},[]),P=h.useCallback(T=>{w(L=>{const $={...L};return delete $[T],$}),m(!0)},[]),W=h.useCallback(async()=>{g(null),d(!0);try{const L=await dq({enabled:y,defaultAction:x,disabledBuiltins:k,privateMode:{rerouteModel:E},patterns:_});m(!1),a(L.policy),e()}catch(T){g(T.message)}finally{d(!1)}},[y,x,k,_,E,e]),O=h.useCallback(async()=>{p?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[p,e,n,t]),I=[...i.map(T=>T.name),...Object.keys(_)];return o.jsx("div",{ref:M,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:O,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:T=>T.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),o.jsx("button",{onClick:O,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[l&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&o.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:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!l&&o.jsxs(o.Fragment,{children:[o.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:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),o.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:y,onChange:T=>{v(T.target.checked),m(!0)},className:"sr-only peer"}),o.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none 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"})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),o.jsxs("select",{value:x,onChange:T=>{b(T.target.value),m(!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:[o.jsx("option",{value:"ask",children:"Ask (show modal)"}),o.jsx("option",{value:"reroute",children:"Always reroute to private"}),o.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),o.jsx("input",{type:"text",value:E,onChange:T=>{S(T.target.value),m(!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"})]}),o.jsxs("div",{className:"mb-4 mt-6",children:[o.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),o.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:i.map(T=>o.jsx(dj,{name:T.name,regex:T.regex,severity:T.severity,enabled:!k.includes(T.name),builtin:!0,onToggle:j,onRemove:()=>{},t},T.name))})]}),o.jsxs("div",{className:"mb-4 mt-4",children:[o.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.user_patterns_desc")}),Object.keys(_).length===0?o.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")}):o.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(_).map(([T,L])=>o.jsx(dj,{name:T,regex:L.regex,severity:L.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:P,t},T))})]}),o.jsx(UJ,{onAdd:F,existingNames:I,t})]})]}),!l&&o.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[o.jsx("button",{onClick:O,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")}),o.jsx("button",{onClick:W,disabled:u||!p,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(u?"dlp.saving":"dlp.save")})]})]})})}function HJ(e,t){var n={grant:"permission.action_grant",revoke:"permission.action_revoke",clear:"permission.action_clear_all"},r={network:"permission.type_network","fs.read":"permission.type_file_read","fs.write":"permission.type_file_write","filesystem.read":"permission.type_file_read","filesystem.write":"permission.type_file_write",module:"permission.type_module",modules:"permission.type_module",require:"permission.type_module",system:"permission.type_system",command:"permission.type_system"};if(e.action==="clear")return t("permission.clear_all");var a=n[e.action]?t(n[e.action]):e.action,i=r[e.type]?t(r[e.type]):e.type;return t("permission.request_desc",{action:a,type:i,target:e.target||"*"})}function qJ({request:e,onDismiss:t}){const{t:n}=Rt(),[r,a]=h.useState(null),[i,s]=h.useState(null),l=h.useRef(!0),c=h.useRef(null);h.useEffect(()=>()=>{l.current=!1,c.current&&clearTimeout(c.current)},[]);const u=h.useCallback(m=>{m.includes("not found")||m.includes("expired")?s("Request expired"):m.includes("already")?s("Request already processed"):s(m),a("dismissing"),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{l.current&&t(e.id)},2e3)},[e.id,t]),d=h.useCallback(async()=>{a("allow"),s(null);try{const m=await LH(e.id);if(!l.current)return;if(m&&m.success===!1){const y=m.error||m.message||"Failed to confirm";u(y);return}t(e.id)}catch(m){if(!l.current)return;const y=m.message||"Failed to confirm";u(y)}},[e.id,t,u]),f=h.useCallback(async()=>{a("deny"),s(null);try{const m=await OH(e.id);if(!l.current)return;if(m&&m.success===!1){const y=m.error||m.message||"Failed to deny";u(y);return}t(e.id)}catch(m){if(!l.current)return;const y=m.message||"Failed to deny";u(y)}},[e.id,t,u]),g=e.action==="clear",p=e.action==="revoke";return o.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:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${g?"bg-red-100 dark:bg-red-900/30":p?"bg-amber-100 dark:bg-amber-900/30":"bg-blue-100 dark:bg-blue-900/30"}`,children:o.jsx("svg",{className:`w-4 h-4 ${g?"text-red-600 dark:text-red-400":p?"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:o.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"})})}),o.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:n("permission.title")})]}),o.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:HJ(e,n)}),o.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")]}),i&&o.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:i}),o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx("button",{onClick:f,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")}),o.jsx("button",{onClick:d,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 ${g?"bg-red-600 hover:bg-red-700":p?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:n(r==="allow"?"permission.allowing":"permission.allow")})]})]})}function WJ({requests:e,onDismiss:t}){return!e||e.length===0?null:o.jsx(o.Fragment,{children:e.map(n=>o.jsx(qJ,{request:n,onDismiss:t},n.id))})}var VJ="https://account.openpave.ai/dashboard";function GJ({open:e,onClose:t,upgradeUrl:n}){var{t:r}=Rt(),a=h.useRef(null),i=h.useRef(null),s=h.useRef(t),l=VJ;if(typeof n=="string"&&n.length>0)try{var c=new URL(n),u=["account.openpave.ai"];c.protocol==="https:"&&u.indexOf(c.hostname)!==-1&&(l=c.href)}catch{}return h.useEffect(function(){s.current=t},[t]),h.useEffect(function(){e&&i.current&&i.current.focus()},[e]),h.useEffect(function(){if(!e)return;function d(f){f.key==="Escape"&&(typeof f.preventDefault=="function"&&f.preventDefault(),typeof f.stopImmediatePropagation=="function"?f.stopImmediatePropagation():typeof f.stopPropagation=="function"&&f.stopPropagation(),s.current())}return document.addEventListener("keydown",d,!0),function(){document.removeEventListener("keydown",d,!0)}},[e]),h.useEffect(function(){if(!e||!a.current)return;function d(f){if(f.key==="Tab"){var g=a.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(g.length!==0){var p=g[0],m=g[g.length-1];f.shiftKey?document.activeElement===p&&(f.preventDefault(),m.focus()):document.activeElement===m&&(f.preventDefault(),p.focus())}}}return document.addEventListener("keydown",d),function(){document.removeEventListener("keydown",d)}},[e]),e?o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(d){d.target===d.currentTarget&&t()},children:o.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":r("credits.limit_reached"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[o.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[o.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),o.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("credits.limit_reached")})]}),o.jsx("div",{className:"px-5 py-4",children:o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("credits.limit_message")})}),o.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[o.jsx("button",{ref:i,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-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:r("credits.dismiss")}),o.jsxs("a",{href:l,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-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 inline-flex items-center gap-1.5",children:[r("credits.add_credits"),o.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:[o.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"}),o.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 Hb(e){if(e==null)return"";const t=Date.now()-e;if(t<=0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const a=Math.floor(r/60);if(a<24)return`${a}h ago`;const i=Math.floor(a/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}const KJ=15e3;function YJ({onNavigateToAgent:e}){const{t}=Rt(),[n,r]=h.useState(!1),[a,i]=h.useState([]),[s,l]=h.useState(0),[c,u]=h.useState(!1),[d,f]=h.useState(null),g=h.useRef(null),p=h.useRef(null),m=h.useRef(0),y=h.useRef(!1),v=h.useRef(!1),x=h.useRef(0),b=h.useRef(a);b.current=a,h.useEffect(()=>{function Y(){document.visibilityState==="visible"&&(v.current=!0)}return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},[]);const k=h.useCallback(async Y=>{const V=++x.current;try{let A,H=null;if(Y){const ce=await c2();if(V!==x.current)return;H=ce.messages||[],i(H),A=ce.unread||0,l(A)}else{const ce=await c2({unreadOnly:!0,limit:1});if(V!==x.current)return;A=ce.unread||0,l(A),cc()&&A>0&&ce.messages&&ce.messages.length>0&&(H=ce.messages)}if(y.current&&A>m.current&&!v.current&&j3()&&C3(),y.current&&A>m.current&&cc()){const ce=A-m.current,ee=H||b.current||[],Me=ce===1&&ee.length>0?ee.find(de=>!de.read):null,X=Me&&Me.from?Me.from:"",Oe=!X||X==="__pave_webui__"||X==="unknown"?"PAVE":X,Ee=Me&&Me.message?Me.message.slice(0,120).replace(/\n/g," "):ce===1?"New inbox message":ce+" new inbox messages";R3({title:Oe,body:Ee,tag:"pave-inbox-"+Date.now(),onClick:function(){window.focus()}})}v.current=!1,m.current=A,y.current=!0}catch{}},[]);h.useEffect(()=>{k(n);const Y=setInterval(()=>k(n),KJ);return()=>clearInterval(Y)},[k,n]),h.useEffect(()=>{if(!n)return;function Y(V){g.current&&!g.current.contains(V.target)&&r(!1)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[n]);const N=h.useRef(new Set),_=h.useCallback(async Y=>{if(!(!Y.filename||Y.read)&&!N.current.has(Y.filename)){N.current.add(Y.filename);try{await eq(Y.filename),i(V=>V.map(A=>A.filename===Y.filename?{...A,read:!0}:A)),l(V=>Math.max(0,V-1)),f(V=>V&&V.filename===Y.filename?{...V,read:!0}:V)}catch{}finally{N.current.delete(Y.filename)}}},[]),w=h.useCallback(async()=>{u(!0);try{await rq(),i(Y=>Y.map(V=>({...V,read:!0}))),l(0)}catch{}finally{u(!1)}},[]),E=h.useCallback(async()=>{u(!0);try{await aq(),i([]),l(0)}catch{}finally{u(!1)}},[]),S=h.useCallback((Y,V)=>{V.read||_(V),r(!1),f(null),e&&e(Y)},[e,_]),M=h.useCallback(Y=>{f(Y),Y.read||_(Y)},[_]),j=h.useCallback(()=>{f(null)},[]),F=h.useRef(new Set),P=h.useCallback(async Y=>{if(!(!Y.filename||!Y.read)&&!F.current.has(Y.filename)){F.current.add(Y.filename);try{await tq(Y.filename),i(V=>{const A=V.map(ce=>ce.filename===Y.filename?{...ce,read:!1}:ce),H=A.reduce((ce,ee)=>ce+(ee.read?0:1),0);return l(H),A}),f(V=>V&&V.filename===Y.filename?{...V,read:!1}:V)}catch{}finally{F.current.delete(Y.filename)}}},[]),W=h.useCallback(async Y=>{if(Y.filename)try{await nq(Y.filename),i(V=>{const A=V.filter(ce=>ce.filename!==Y.filename),H=A.reduce((ce,ee)=>ce+(ee.read?0:1),0);return l(H),A}),f(V=>V&&V.filename===Y.filename?null:V)}catch{}},[]),O=h.useMemo(()=>[...a].sort((Y,V)=>(V.timestamp||0)-(Y.timestamp||0)),[a]),I=h.useCallback(()=>{if(!d)return;const Y=O.findIndex(V=>V.filename===d.filename);if(Y>0){const V=O[Y-1];f(V),V.read||_(V)}},[d,O,_]),T=h.useCallback(()=>{if(!d)return;const Y=O.findIndex(V=>V.filename===d.filename);if(Y>=0&&Y<O.length-1){const V=O[Y+1];f(V),V.read||_(V)}},[d,O,_]),L=h.useMemo(()=>d?O.findIndex(Y=>Y.filename===d.filename):-1,[d,O]),$=L>0,Z=L>=0&&L<O.length-1,R=!!d;return h.useEffect(()=>{if(!R)return;function Y(V){V.key==="Escape"&&f(null)}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[R]),h.useEffect(()=>{R&&p.current&&p.current.focus()},[R]),o.jsxs("div",{className:"relative",ref:g,children:[o.jsxs("button",{onClick:()=>r(!n),className:"relative p-1.5 rounded-lg transition-colors text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:t("user_inbox.title"),"aria-label":t("user_inbox.title"),"aria-expanded":n,"aria-haspopup":"true",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),s>0&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[16px] h-4 px-1 text-[10px] font-bold text-white bg-red-500 rounded-full leading-none",children:s>99?"99+":s})]}),n&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 flex flex-col max-h-[28rem]",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[o.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:t("user_inbox.title")}),o.jsxs("div",{className:"flex items-center gap-1",children:[a.length>0&&s>0&&o.jsx("button",{onClick:w,disabled:c,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline disabled:opacity-50",title:t("user_inbox.mark_all_read"),children:t("user_inbox.mark_all_read")}),a.length>0&&o.jsx("button",{onClick:E,disabled:c,className:"text-xs text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400 ml-2 disabled:opacity-50",title:t("user_inbox.clear_all"),children:t("user_inbox.clear_all")})]})]}),o.jsx("div",{className:"overflow-y-auto flex-1",children:O.length===0?o.jsx("div",{className:"px-3 py-6 text-center text-sm text-gray-400 dark:text-gray-500",children:t("user_inbox.empty")}):O.map((Y,V)=>{const A=Y.from||"unknown",H=A!=="unknown";return o.jsxs("div",{className:"px-3 py-2 border-b border-gray-50 dark:border-gray-800 last:border-b-0 transition-colors "+(Y.read?"bg-white dark:bg-gray-900":"bg-primary-50 dark:bg-primary-900/10"),children:[o.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[o.jsx("button",{onClick:()=>{H&&S(A,Y)},disabled:!H,className:"text-xs font-semibold truncate max-w-[60%] "+(H?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),title:H?t("user_inbox.view_agent")+": "+A:A,children:A}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[Y.priority==="high"&&o.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase",children:t("user_inbox.high_priority")}),o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap",children:Y.timestamp!=null?Hb(Y.timestamp):""}),!Y.read&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-500 flex-shrink-0",title:t("user_inbox.unread")})]})]}),o.jsx("div",{role:"button",tabIndex:0,onClick:()=>M(Y),onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),M(Y))},className:"text-left w-full text-sm text-gray-700 dark:text-gray-300 break-words line-clamp-3 hover:text-gray-900 dark:hover:text-gray-100 cursor-pointer",title:t("user_inbox.view_message"),children:o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*]:m-0 [&>*]:leading-snug",children:o.jsx(ac,{remarkPlugins:[sc],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:ce,children:ee,href:Me,...X}){return o.jsx("a",{href:Me,...X,target:"_blank",rel:"noopener noreferrer",onClick:ye=>ye.stopPropagation(),children:ee})},p:function({node:ce,children:ee,...Me}){return o.jsx("span",{...Me,children:ee})}},children:Y.message})})})]},Y.filename||V)})})]}),d&&o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:Y=>{Y.target===Y.currentTarget&&j()},children:o.jsxs("div",{ref:p,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":t("user_inbox.view_message"),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 max-h-[80vh] flex flex-col outline-none focus-visible:ring-2 focus-visible:ring-primary-500",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("button",{type:"button",onClick:()=>{const Y=d.from||"unknown";Y!=="unknown"&&S(Y,d)},disabled:!d.from||d.from==="unknown",className:"text-sm font-semibold truncate "+(d.from&&d.from!=="unknown"?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),children:d.from||"unknown"}),d.priority==="high"&&o.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase flex-shrink-0",children:t("user_inbox.high_priority")}),o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap flex-shrink-0",children:d.timestamp?Hb(d.timestamp):""})]}),o.jsx("button",{type:"button",onClick:j,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 flex-shrink-0","aria-label":t("user_inbox.close"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"px-4 py-3 overflow-y-auto flex-1",children:o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none break-words",children:o.jsx(ac,{remarkPlugins:[sc],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:Y,children:V,href:A,...H}){return o.jsx("a",{href:A,...H,target:"_blank",rel:"noopener noreferrer",children:V})},p:function({node:Y,children:V,...A}){return o.jsx("p",{...A,style:{whiteSpace:"pre-wrap"},children:V})}},children:d.message||""})})}),o.jsxs("div",{className:"px-4 py-2 border-t border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:I,disabled:!$,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.prev_message"),"aria-label":t("user_inbox.prev_message"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums min-w-[3rem] text-center",children:L>=0?`${L+1} / ${O.length}`:""}),o.jsx("button",{type:"button",onClick:T,disabled:!Z,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.next_message"),"aria-label":t("user_inbox.next_message"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d.read?o.jsx("button",{type:"button",onClick:()=>P(d),className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:underline",title:t("user_inbox.mark_unread"),children:t("user_inbox.mark_unread")}):o.jsx("button",{type:"button",onClick:()=>_(d),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",title:t("user_inbox.mark_read"),children:t("user_inbox.mark_read")}),o.jsx("button",{type:"button",onClick:()=>W(d),className:"text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 hover:underline",title:t("user_inbox.delete"),children:t("user_inbox.delete")}),o.jsx("button",{type:"button",onClick:j,className:"text-xs px-3 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:t("user_inbox.close")})]})]})]})})]})}function dy(e,t){if(!e||!t)return!e;const n=String(e).toLowerCase(),r=String(t).toLowerCase();let a=0;for(let i=0;i<r.length&&a<n.length;i+=1)r[i]===n[a]&&(a+=1);return a===n.length}function XJ(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function QJ({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:a,sessions:i,busySessions:s={}}){const{t:l}=Rt(),[c,u]=h.useState(""),[d,f]=h.useState(0),[g,p]=h.useState(null),[m,y]=h.useState(!1),v=h.useRef(null),x=h.useRef(null),b=h.useRef(null),k=c?c.trim():"";h.useEffect(()=>{if(e){u(""),f(0),p(null),y(!1);const M=requestAnimationFrame(()=>{v.current&&v.current.focus()});return()=>cancelAnimationFrame(M)}},[e]),h.useEffect(()=>{let M=!1;const j=c?c.trim():"";if(b.current&&(clearTimeout(b.current),b.current=null),!e){p(null),y(!1);return}if(j.length<2){p(null),y(!1);return}return p(null),y(!0),b.current=setTimeout(()=>{Cb({q:j,limit:20}).then(F=>{if(M)return;const P=Array.isArray(F)?F:F.sessions||[];p(P),y(!1)}).catch(()=>{M||y(!1)})},300),()=>{M=!0,b.current&&(clearTimeout(b.current),b.current=null)}},[c,e]);const N=h.useCallback(M=>{if(!a)return M;const j=M.findIndex(W=>W.id===a);if(j<=0)return M;const F=M.slice(),[P]=F.splice(j,1);return F.unshift(P),F},[a]),_=h.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:l("spotlight.new_chat")}),[l]),w=h.useMemo(()=>{const M=i||[],j=!k||dy(k,"new chat")||dy(k,l("spotlight.new_chat")),F=O=>j&&r?a&&O.length>0&&O[0].id===a?[O[0],_,...O.slice(1)]:[_,...O]:O;if(!k)return F(N(M.slice(0,10)));const P=M.filter(O=>dy(k,O.title||""));let W;if(g){const O=new Set(P.map(T=>T.id)),I=g.filter(T=>!O.has(T.id));W=P.concat(I).slice(0,20)}else W=P.slice(0,20);return F(N(W))},[k,i,g,N,_,r,l,a]);h.useEffect(()=>{f(0)},[k]),h.useEffect(()=>{f(M=>w.length===0?0:M>=w.length?w.length-1:M)},[w.length]),h.useEffect(()=>{if(!x.current)return;const M=x.current.querySelectorAll('[role="option"]');M[d]&&M[d].scrollIntoView({block:"nearest"})},[d,w.length]);const E=h.useCallback(M=>{if(M&&M.isAction&&M.actionType==="new-chat"){r&&r(),t();return}const j=typeof M=="string"?M:M==null?void 0:M.id;j&&n(j),t()},[n,r,t]),S=h.useCallback(M=>{M.key==="ArrowDown"?(M.preventDefault(),f(j=>w.length===0?0:(j+1)%w.length)):M.key==="ArrowUp"?(M.preventDefault(),f(j=>w.length===0?0:(j-1+w.length)%w.length)):M.key==="Enter"?(M.preventDefault(),w[d]&&E(w[d])):M.key==="Escape"&&(M.preventDefault(),t())},[w,d,E,t]);return e?o.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:o.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:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":l("spotlight.title"),children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[o.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),o.jsx("input",{ref:v,type:"text",className:"flex-1 bg-transparent text-gray-900 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-500 outline-none",placeholder:l("spotlight.placeholder"),value:c,onChange:M=>u(M.target.value),onKeyDown:S,"aria-label":l("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":w[d]?"spotlight-item-"+d:void 0,autoComplete:"off",spellCheck:"false"}),o.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"})]}),o.jsxs("div",{id:"spotlight-results",ref:x,role:"listbox","aria-label":l("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!k&&w.length>0&&o.jsx("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider",children:l("spotlight.recent_sessions")}),w.map((M,j)=>{var F;return M.isAction&&M.actionType==="new-chat"?o.jsxs("div",{id:"spotlight-item-"+j,role:"option","aria-selected":j===d,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-800 ${j===d?"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:()=>E(M),children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm font-medium truncate",children:M.title})})]},M.id):o.jsxs("div",{id:"spotlight-item-"+j,role:"option","aria-selected":j===d,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${j===d?"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:()=>E(M),children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm font-medium truncate",children:M.title||l("spotlight.untitled")})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s[M.id]&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse",role:"status",title:l("sidebar.session_processing"),"aria-label":l("sidebar.session_processing")}),M.id===a&&o.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:l("spotlight.current")}),o.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:XJ(M)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:Hb((F=M.time)==null?void 0:F.updated)})]})]},M.id)}),k&&w.length===0&&!m&&o.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:l("spotlight.no_results")}),m&&w.length===0&&o.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:l("spotlight.searching")})]}),o.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:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.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:"↑"}),o.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:"↓"}),l("spotlight.navigate")]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.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:"↵"}),l("spotlight.select")]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.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"}),l("spotlight.close")]})]})]})}):null}const K1="pave_recent_directories",ZJ=10;function fj(e,t){if(!e)return"";const n=e.replace(/\\/g,"/"),r=t?t.replace(/\\/g,"/"):"";if(r&&n.startsWith(r))return"~"+n.slice(r.length);const a=n.split("/").filter(Boolean);return a.length>4?".../"+a.slice(-2).join("/"):n}function Y1(){try{const e=localStorage.getItem(K1);return e?JSON.parse(e):[]}catch{return[]}}function JJ(e){try{let t=Y1();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,ZJ),localStorage.setItem(K1,JSON.stringify(t)),t}catch{return[e]}}function eee(e){try{let t=Y1();return t=t.filter(n=>n!==e),localStorage.setItem(K1,JSON.stringify(t)),t}catch{return[]}}function M3({className:e}){return o.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:o.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 tee({isOpen:e,onClose:t,sessionId:n,currentDirectory:r,homeDir:a,onDirectoryChange:i}){var{t:s}=Rt(),l=h.useRef(null),c=h.useRef(null),[u,d]=h.useState(r||""),[f,g]=h.useState("idle"),[p,m]=h.useState(null),[y,v]=h.useState([]),[x,b]=h.useState(!1),[k,N]=h.useState(!1),[_,w]=h.useState(null),E=h.useRef(null),S=h.useRef(0);h.useEffect(function(){e&&(v(Y1()),d(r||""),g("idle"),m(null),w(null))},[e,r]),h.useEffect(function(){e&&l.current&&setTimeout(function(){l.current.focus(),l.current.select()},50)},[e]);var M=h.useCallback(function(L){if(!L||L.trim()===""){g("idle"),m(null);return}E.current&&clearTimeout(E.current),g("checking"),S.current+=1;var $=S.current;E.current=setTimeout(async function(){try{const Z=await l2(L.trim());if($!==S.current)return;m(Z),Z.exists&&Z.isDirectory?g("valid"):Z.exists?(g("error"),m({...Z,error:s("chat.working_directory_invalid")})):g("not_found")}catch(Z){if($!==S.current)return;g("error"),m({error:Z.message})}},300)},[s]),j=h.useCallback(function(L){var $=L.target.value;d($),w(null),M($)},[M]),F=h.useCallback(function(L){d(L),w(null),M(L)},[M]),P=h.useCallback(function(L,$){L.stopPropagation(),v(eee($))},[]),W=h.useCallback(async function(){if(u.trim()){b(!0),w(null);try{const L=await ZH(u.trim());if(L.success)try{const $=await l2(L.path);g("valid"),m($)}catch{g("valid"),m({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:L.path})}}catch(L){w(s("chat.working_directory_create_failed",{error:L.message}))}finally{b(!1)}}},[u,s]),O=h.useCallback(async function(){if(!(!u.trim()||f!=="valid")){N(!0),w(null);try{const L=(p==null?void 0:p.path)||u.trim();await Dr(n,{directory:L}),v(JJ(L)),i&&i(L),t()}catch(L){w(L.message)}finally{N(!1)}}},[u,f,p,n,i,t]);h.useEffect(function(){if(!e)return;function L($){$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),t())}return document.addEventListener("keydown",L,!0),function(){document.removeEventListener("keydown",L,!0)}},[e,t]),h.useEffect(function(){if(!e)return;function L($){$.key==="Enter"&&f==="valid"&&!k&&($.preventDefault(),O())}return document.addEventListener("keydown",L),function(){document.removeEventListener("keydown",L)}},[e,f,k,O]),h.useEffect(function(){return function(){E.current&&clearTimeout(E.current)}},[]);var I=h.useMemo(function(){return fj(r,a)},[r,a]);if(!e)return null;var T=null;return f==="checking"?T=o.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[o.jsx("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin mr-2"}),s("chat.working_directory_checking")]}):f==="valid"&&p?T=o.jsx("p",{className:"text-xs text-green-500 mt-1",children:p.hasAgentsMd?"✓ "+s("chat.working_directory_has_agents_md"):"✓ "+s("chat.working_directory_no_agents_md")}):f==="not_found"?T=o.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",s("chat.working_directory_not_found")]}):f==="error"&&(p!=null&&p.error)&&(T=o.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",p.error]})),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(L){L.target===L.currentTarget&&t()},children:o.jsxs("div",{ref:c,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:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(M3,{className:"w-5 h-5 text-gray-400"}),o.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:s("chat.working_directory")})]}),o.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":s("common.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:s("chat.working_directory_current")}),o.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:r,children:I||r||s("chat.working_directory_not_set")})]}),o.jsxs("div",{children:[o.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:s("chat.working_directory_new_path")}),o.jsx("input",{ref:l,id:"directory-input",type:"text",value:u,onChange:j,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-none focus:border-blue-500",placeholder:s("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"}),T]}),_&&o.jsx("p",{className:"text-sm text-red-500",children:_}),y.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:s("chat.working_directory_recent")}),o.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:y.map(function(L){return o.jsxs("div",{onClick:function(){F(L)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[o.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:L,children:fj(L,a)}),o.jsx("button",{onClick:function($){P($,L)},className:"text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity ml-2",title:s("chat.working_directory_remove_recent"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},L)})})]})]}),o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[o.jsx("div",{children:f==="not_found"&&o.jsx("button",{onClick:W,disabled:x,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:x?"...":s("chat.working_directory_create")})}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-300 hover:text-gray-100 transition-colors",children:s("chat.working_directory_cancel")}),o.jsx("button",{onClick:O,disabled:f!=="valid"||k,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:k?"...":s("chat.working_directory_change")})]})]})]})})}var dn={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 nee(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function Mu(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function Lu(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function Hs(e){var t=e.children;return o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function ree(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,a=Rt().t,i=h.useRef(null),s=h.useState(null);s[0];var l=s[1],c=h.useState(!0),u=c[0],d=c[1],f=h.useState(!1),g=f[0],p=f[1],m=h.useState(null),y=m[0],v=m[1],x=h.useState(null),b=x[0],k=x[1],N=h.useState(dn.enabled),_=N[0],w=N[1],E=h.useState(dn.message),S=E[0],M=E[1],j=h.useState(String(dn.intervalMs)),F=j[0],P=j[1],W=h.useState(String(dn.maxInjections)),O=W[0],I=W[1],T=h.useState(dn.timeout.enabled),L=T[0],$=T[1],Z=h.useState(String(dn.timeout.thresholdMs)),R=Z[0],Y=Z[1],V=h.useState(String(dn.timeout.cooldownMs)),A=V[0],H=V[1],ce=h.useState(dn.mode),ee=ce[0],Me=ce[1],X=h.useState(String(dn.waitMs)),ye=X[0],Oe=X[1],Ee=h.useRef(null),de=h.useState([]),Se=de[0],Ae=de[1],me=h.useState(!1),ve=me[0],De=me[1],K=h.useState(!1),we=K[0],Te=K[1],ge=h.useState("9"),xe=ge[0],he=ge[1],fe=h.useState("0"),pe=fe[0],U=fe[1],D=h.useState("AM"),G=D[0],le=D[1],je=h.useState("weekdays"),$e=je[0],Ve=je[1],Qe=h.useState([1,2,3,4,5]),Ye=Qe[0],_t=Qe[1],He=h.useState(""),at=He[0],ue=He[1],qe="";try{qe=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}h.useEffect(function(){return function(){Ee.current&&clearTimeout(Ee.current)}},[]);var Ge=h.useCallback(function(){r&&(d(!0),v(null),XA(r).then(function(_e){var it=_e&&_e.config?_e.config:dn;l(it),w(it.enabled||!1),M(it.message||dn.message),P(Mu(it.intervalMs!=null?it.intervalMs:dn.intervalMs)),I(nee(it.maxInjections!=null?it.maxInjections:dn.maxInjections)),$(it.timeout?it.timeout.enabled:dn.timeout.enabled),Y(Mu(it.timeout&&it.timeout.thresholdMs!=null?it.timeout.thresholdMs:dn.timeout.thresholdMs)),H(Mu(it.timeout&&it.timeout.cooldownMs!=null?it.timeout.cooldownMs:dn.timeout.cooldownMs)),Me(it.mode||dn.mode),Oe(Mu(it.waitMs!=null?it.waitMs:dn.waitMs))}).catch(function(_e){v(_e.message||"Failed to load config")}).finally(function(){d(!1)}))},[r]);h.useEffect(function(){t&&Ge()},[t,Ge]);var bt=h.useCallback(function(){r&&SH(r).then(function(_e){Ae(_e&&_e.schedules?_e.schedules:[])}).catch(function(){Ae([])})},[r]);h.useEffect(function(){t&&bt()},[t,bt]),h.useEffect(function(){if(!t)return;function _e(it){it.key==="Escape"&&n()}return document.addEventListener("keydown",_e),function(){document.removeEventListener("keydown",_e)}},[t,n]);function cn(){if(r){p(!0),v(null),k(null);var _e={enabled:_,message:S.trim()||dn.message,intervalMs:Lu(F)||dn.intervalMs,maxInjections:parseInt(O,10)||0,mode:ee||dn.mode,waitMs:Lu(ye),timeout:{enabled:L,thresholdMs:Lu(R)||dn.timeout.thresholdMs,cooldownMs:Lu(A)||dn.timeout.cooldownMs}};wH(r,_e).then(function(){l(_e),k(a("chat.idle_injection_saved")),Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){k(null)},3e3)}).catch(function(it){v(it.message||"Failed to save")}).finally(function(){p(!1)})}}function Hn(){r&&(p(!0),v(null),k(null),EH(r).then(function(){w(!1),l(null)}).catch(function(_e){v(_e.message||"Failed to disable")}).finally(function(){p(!1)}))}function On(_e,it){var Ot=parseInt(_e,10);return it==="PM"&&Ot!==12&&(Ot+=12),it==="AM"&&Ot===12&&(Ot=0),Ot}function hn(_e){return _e===0?{h:12,ap:"AM"}:_e<12?{h:_e,ap:"AM"}:_e===12?{h:12,ap:"PM"}:{h:_e-12,ap:"PM"}}function er(_e,it){return _e==="every_day"?[0,1,2,3,4,5,6]:_e==="weekdays"?[1,2,3,4,5]:_e==="weekends"?[0,6]:it.slice().sort()}function an(_e){var it=hn(_e.hour),Ot=String(_e.minute).padStart(2,"0");return it.h+":"+Ot+" "+it.ap}function Ct(_e){var it=_e.daysOfWeek||[],Ot="";if(it.length===7)Ot=a("scheduled_injection.repeat_every_day");else if(it.length===5&&it.indexOf(1)!==-1&&it.indexOf(5)!==-1)Ot=a("scheduled_injection.repeat_weekdays");else if(it.length===2&&it.indexOf(0)!==-1&&it.indexOf(6)!==-1)Ot=a("scheduled_injection.repeat_weekends");else{for(var Dt=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],qn=[],Sn=0;Sn<7;Sn++)it.indexOf(Sn)!==-1&&qn.push(a("scheduled_injection."+Dt[Sn]));Ot=qn.join(", ")}return _e.timezone&&(Ot+=" ("+_e.timezone+")"),Ot}function vr(){if(r){Te(!0),v(null);var _e={hour:On(xe,G),minute:parseInt(pe,10),daysOfWeek:er($e,Ye),timezone:qe||null,message:at.trim(),enabled:!0};NH(r,_e).then(function(){De(!1),ue(""),bt()}).catch(function(it){v(it.message||a("scheduled_injection.error_generic"))}).finally(function(){Te(!1)})}}function oe(_e,it){r&&CH(r,_e,{enabled:!it}).then(function(){bt()}).catch(function(Ot){v(Ot.message||"Failed to toggle schedule")})}function te(_e){r&&jH(r,_e).then(function(){bt()}).catch(function(it){v(it.message||"Failed to delete schedule")})}function ke(_e){var it=Ye.indexOf(_e);_t(it===-1?Ye.concat([_e]):Ye.filter(function(Ot){return Ot!==_e}))}if(!t)return null;var Ie="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",We="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-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",ht="space-y-3",mt=function(_e){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(_e?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},It=function(_e){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(_e?"translate-x-6":"translate-x-1")};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),o.jsxs("aside",{ref:i,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":a("chat.idle_injection_title"),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("chat.idle_injection_title")}),o.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":a("common.close"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:u?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):o.jsxs(o.Fragment,{children:[y&&o.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:y}),b&&o.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:b}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_toggle")}),o.jsx("button",{type:"button",onClick:function(){w(!_)},className:mt(_),"aria-pressed":_,"aria-label":a("chat.idle_injection_toggle"),children:o.jsx("span",{className:It(_)})})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-message",children:a("chat.idle_injection_message")}),o.jsx("textarea",{id:"ii-message",value:S,onChange:function(_e){M(_e.target.value)},className:We+" resize-none",rows:3,placeholder:a("chat.idle_injection_message_placeholder"),disabled:!_})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-interval",children:a("chat.idle_injection_interval")}),o.jsx("input",{id:"ii-interval",type:"number",value:F,onChange:function(_e){P(_e.target.value)},className:We,min:.5,step:.5,disabled:!_}),o.jsx(Hs,{children:a("chat.idle_injection_interval_desc")})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-max",children:a("chat.idle_injection_max")}),o.jsx("input",{id:"ii-max",type:"number",value:O,onChange:function(_e){I(_e.target.value)},className:We,min:0,disabled:!_}),o.jsx(Hs,{children:a("chat.idle_injection_max_desc")})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-mode",children:a("chat.idle_injection_mode")}),o.jsxs("select",{id:"ii-mode",value:ee,onChange:function(_e){Me(_e.target.value)},className:We,disabled:!_,children:[o.jsx("option",{value:"urgent",children:a("chat.idle_injection_mode_urgent")}),o.jsx("option",{value:"normal",children:a("chat.idle_injection_mode_normal")}),o.jsx("option",{value:"idle",children:a("chat.idle_injection_mode_idle")})]}),o.jsx(Hs,{children:a("chat.idle_injection_mode_desc")})]}),ee==="idle"&&o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-wait",children:a("chat.idle_injection_wait_ms")}),o.jsx("input",{id:"ii-wait",type:"number",value:ye,onChange:function(_e){Oe(_e.target.value)},className:We,min:0,step:.5,disabled:!_}),o.jsx(Hs,{children:a("chat.idle_injection_wait_ms_desc")})]}),o.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_timeout_toggle")}),o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("chat.idle_injection_timeout_toggle_desc")})]}),o.jsx("button",{type:"button",onClick:function(){$(!L)},className:mt(L),"aria-pressed":L,"aria-label":a("chat.idle_injection_timeout_toggle"),disabled:!_,children:o.jsx("span",{className:It(L)})})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-threshold",children:a("chat.idle_injection_timeout_threshold")}),o.jsx("input",{id:"ii-threshold",type:"number",value:R,onChange:function(_e){Y(_e.target.value)},className:We,min:1,step:.5,disabled:!_||!L}),o.jsx(Hs,{children:a("chat.idle_injection_timeout_threshold_desc")})]}),o.jsxs("div",{className:ht,children:[o.jsx("label",{className:Ie,htmlFor:"ii-cooldown",children:a("chat.idle_injection_timeout_cooldown")}),o.jsx("input",{id:"ii-cooldown",type:"number",value:A,onChange:function(_e){H(_e.target.value)},className:We,min:.5,step:.5,disabled:!_||!L}),o.jsx(Hs,{children:a("chat.idle_injection_timeout_cooldown_desc")})]}),o.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),o.jsxs("div",{className:ht,children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("scheduled_injection.title")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("scheduled_injection.subtitle")})]}),Se.length===0&&!ve&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("scheduled_injection.empty")}),Se.map(function(_e){return o.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(_e.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:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:an(_e)}),o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ct(_e)})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("button",{type:"button",onClick:function(){oe(_e.id,_e.enabled)},className:mt(_e.enabled),"aria-pressed":_e.enabled,"aria-label":a("scheduled_injection.enabled"),children:o.jsx("span",{className:It(_e.enabled)})}),o.jsx("button",{type:"button",onClick:function(){te(_e.id)},className:"p-1 rounded text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors","aria-label":a("scheduled_injection.delete"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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.message&&o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',_e.message,'"']})]},_e.id)}),ve?o.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:[o.jsxs("div",{children:[o.jsx("label",{className:Ie,children:a("scheduled_injection.time")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("select",{value:xe,onChange:function(_e){he(_e.target.value)},className:We+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(_e){return o.jsx("option",{value:String(_e),children:_e},_e)})}),o.jsx("span",{className:"text-gray-500",children:":"}),o.jsxs("select",{value:pe,onChange:function(_e){U(_e.target.value)},className:We+" w-20",children:[o.jsx("option",{value:"0",children:"00"}),o.jsx("option",{value:"15",children:"15"}),o.jsx("option",{value:"30",children:"30"}),o.jsx("option",{value:"45",children:"45"})]}),o.jsxs("select",{value:G,onChange:function(_e){le(_e.target.value)},className:We+" w-20",children:[o.jsx("option",{value:"AM",children:"AM"}),o.jsx("option",{value:"PM",children:"PM"})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:Ie,children:a("scheduled_injection.repeat")}),o.jsxs("select",{value:$e,onChange:function(_e){Ve(_e.target.value)},className:We,children:[o.jsx("option",{value:"every_day",children:a("scheduled_injection.repeat_every_day")}),o.jsx("option",{value:"weekdays",children:a("scheduled_injection.repeat_weekdays")}),o.jsx("option",{value:"weekends",children:a("scheduled_injection.repeat_weekends")}),o.jsx("option",{value:"custom",children:a("scheduled_injection.repeat_custom")})]})]}),$e==="custom"&&o.jsx("div",{children:o.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(_e){var it=Ye.indexOf(_e.d)!==-1;return o.jsx("button",{type:"button",onClick:function(){ke(_e.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(it?"bg-primary-600 text-white":"bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-300 dark:hover:bg-gray-700"),children:a("scheduled_injection."+_e.k)},_e.d)})})}),qe&&o.jsxs("div",{children:[o.jsx("label",{className:Ie,children:a("scheduled_injection.timezone")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:qe})]}),o.jsxs("div",{children:[o.jsx("label",{className:Ie,children:a("scheduled_injection.message")}),o.jsx("textarea",{value:at,onChange:function(_e){ue(_e.target.value)},className:We+" resize-none",rows:2,placeholder:a("scheduled_injection.message_placeholder")})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:vr,disabled:we||$e==="custom"&&Ye.length===0,className:"flex-1 px-3 py-1.5 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(we?"scheduled_injection.saving":"scheduled_injection.save")}),o.jsx("button",{type:"button",onClick:function(){De(!1)},disabled:we,className:"px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:a("common.close")})]})]}):o.jsxs("button",{type:"button",onClick:function(){De(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",a("scheduled_injection.add")]})]})]})}),!u&&o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 flex-shrink-0",children:[o.jsx("button",{onClick:cn,disabled:g,className:"flex-1 px-4 py-2 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(g?"chat.idle_injection_saving":"chat.idle_injection_save")}),o.jsx("button",{onClick:Hn,disabled:g||!_,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a(g?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function aee({items:e,sessionId:t,isReadOnly:n,onReorder:r,onCancelItem:a,onEditItem:i,t:s}){var[l,c]=h.useState(null),[u,d]=h.useState(null),f=h.useRef(0),g=h.useCallback(function(b,k){if(e[k]&&e[k].status==="dispatching"){b.preventDefault();return}c(k),b.dataTransfer.effectAllowed="move";try{b.dataTransfer.setData("text/plain",String(k))}catch{}},[e]),p=h.useCallback(function(b,k){b.preventDefault(),f.current++,e[k]&&e[k].status!=="dispatching"&&d(k)},[e]),m=h.useCallback(function(b,k){b.preventDefault(),b.dataTransfer.dropEffect="move"},[]),y=h.useCallback(function(){f.current--,f.current<=0&&(f.current=0,d(null))},[]),v=h.useCallback(function(b,k){if(b.preventDefault(),f.current=0,d(null),l===null||l===k){c(null);return}var N=e.slice(),_=N.splice(l,1)[0];N.splice(k,0,_),c(null);var w=N.filter(function(E){return E.status!=="dispatching"}).map(function(E){return E.id});r(w)},[l,e,r]),x=h.useCallback(function(){c(null),d(null),f.current=0},[]);return!e||e.length===0?null:o.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:[o.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[s("chat.queued")," (",e.length,")"]}),e.map(function(b,k){var N=b.status==="dispatching",_=l===k,w=u===k&&l!==k,E=!N&&!n;return o.jsxs("div",{draggable:E,onDragStart:E?function(S){g(S,k)}:void 0,onDragEnter:E?function(S){p(S,k)}:void 0,onDragOver:E?function(S){m(S,k)}:void 0,onDragLeave:E?y:void 0,onDrop:E?function(S){v(S,k)}:void 0,onDragEnd:E?x:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(N?"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 ")+(_?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(w?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(E?"cursor-grab active:cursor-grabbing ":""),children:[E&&o.jsx("svg",{className:"w-3 h-3 flex-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:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){i(b)},onKeyDown:function(S){(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),i(b))},title:s("chat.edit_queued"),"aria-label":s("chat.edit_queued"),children:[o.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:b.source||"queued"}),b.priority==="urgent"&&o.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"}),o.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:b.displayContent||b.text||""}),!N&&!n&&o.jsx("svg",{className:"w-3 h-3 flex-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:o.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"})})]}),!N&&!n&&o.jsx("button",{type:"button",onClick:function(S){S.stopPropagation(),a(b.id)},className:"text-xs text-gray-500 hover:text-red-600 dark:hover:text-red-400 px-1",title:s("chat.cancel_queued"),"aria-label":s("chat.cancel_queued"),children:"×"})]},b.id)})]})}class iee{constructor(){this.eventSource=null,this.listeners=new Map,this.sessionId=null,this.reconnectTimeout=null,this.reconnectDelay=1e3,this.maxReconnectDelay=3e4,this.lastEventId=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="/global/event"+(n.length>0?"?"+n.join("&"):"");this.eventSource=new EventSource(r);const a=this.eventSource;a.onopen=()=>{this.eventSource===a&&(this.reconnectDelay=1e3,this._emit("connected",{}))},a.onmessage=i=>{if(this.eventSource===a){i.lastEventId&&(this.lastEventId=i.lastEventId);try{const s=JSON.parse(i.data);s.type&&this._emit(s.type,s)}catch{}}},a.onerror=()=>{this.eventSource===a&&(this._emit("error",{}),a.close(),this.eventSource=null,this._scheduleReconnect())}}disconnect(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&r.delete(n)}_emit(t,n){const r=this.listeners.get(t);if(r)for(const a of r)try{a(n)}catch{}}_scheduleReconnect(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.connect(this.sessionId)},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,this.maxReconnectDelay))}}const wt=new iee;function see(){var lk;const{t:e}=Rt(),t=200,n=600,r=288,a="pave-active-session";function i(){try{return localStorage.getItem(a)||null}catch{return null}}function s(C){try{C?localStorage.setItem(a,C):localStorage.removeItem(a)}catch{}}function l(){try{localStorage.removeItem(a)}catch{}}const[c,u]=h.useState(()=>{if(typeof window<"u"){const C=localStorage.getItem("pave-theme");return C?C==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1});h.useEffect(()=>{const C=document.documentElement;c?(C.classList.add("dark"),C.style.colorScheme="dark"):(C.classList.remove("dark"),C.style.colorScheme="light"),localStorage.setItem("pave-theme",c?"dark":"light")},[c]);const[d,f]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1),[g,p]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1),[m,y]=h.useState(!1),[v,x]=h.useState(0),[b,k]=h.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",b)},[b]);const[N,_]=h.useState(!1),w=h.useRef(null),E=h.useRef(new Map),[S,M]=h.useState(()=>new Set),[j,F]=h.useState(()=>new Set),P=h.useRef(null),W=h.useRef("chat"),O=h.useRef(null),[I,T]=h.useState(()=>{if(typeof window<"u"){const C=localStorage.getItem("pave-terminal-width");if(C){const q=parseInt(C,10);if(!isNaN(q)&&q>=t&&q<=n)return q}}return r}),[L,$]=h.useState(()=>{if(typeof window<"u"){const C=localStorage.getItem("pave-right-pane-visible");return C===null?!0:C==="true"}return!0}),[Z,R]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-banner-hidden")==="true":!1),Y=h.useCallback(()=>{R(C=>{const q=!C;try{localStorage.setItem("pave-banner-hidden",String(q))}catch{}return q})},[]),[V,A]=h.useState(""),H=h.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]),ce=h.useRef(L);ce.current=L;const ee=h.useCallback(()=>{const C=!ce.current;$(C),A(e(C?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);h.useEffect(()=>{localStorage.setItem("pave-hacker",d?"true":"false")},[d]),h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",g?"true":"false")},[g]),h.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",L?"true":"false")},[L]);const Me=h.useRef(I);Me.current=I,h.useEffect(()=>{const C=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(I))},200);return()=>clearTimeout(C)},[I]),h.useEffect(()=>{const C=()=>{localStorage.setItem("pave-terminal-width",String(Me.current))};return window.addEventListener("beforeunload",C),()=>{C(),window.removeEventListener("beforeunload",C)}},[]),h.useEffect(()=>{const C=J=>{if(!(J instanceof HTMLElement))return!1;const ne=J.tagName;return!!(ne==="INPUT"||ne==="TEXTAREA"||J.isContentEditable)},q=J=>{if(J.repeat)return;const ne=typeof J.key=="string"?J.key.toLowerCase():"";if((H?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&ne==="k"){J.preventDefault(),_(ae=>!ae);return}if((H?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&ne==="b"){J.preventDefault(),bt(ae=>!ae);return}const be=(H?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&ne==="j",pt=window.matchMedia("(min-width: 1024px)").matches,se=W.current==="chat";if(be&&P.current&&pt&&se){J.preventDefault(),ee();return}if(C(J.target))return;const B=J.ctrlKey&&!J.altKey&&!J.metaKey&&ne==="h",Q=J.ctrlKey&&J.shiftKey&&!J.altKey&&!J.metaKey&&ne==="m";(B||Q)&&(J.preventDefault(),f(ae=>!ae))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[e,H,ee]);const[X,ye]=h.useState(!0),[Oe,Ee]=h.useState(!1),[de,Se]=h.useState(null),[Ae,me]=h.useState("chat");W.current=Ae;const[,ve]=h.useState(null),[De,K]=h.useState(null),[we,Te]=h.useState(!1),[ge,xe]=h.useState(!1),[he,fe]=h.useState([]),[pe,U]=h.useState({});h.useEffect(()=>{AH().then(C=>{Ee(C.enabled),C.authenticated&&C.user&&Se(C.user)}).catch(C=>{console.error("Failed to check auth status:",C)}).finally(()=>ye(!1))},[]),h.useEffect(()=>{SJ(()=>P.current)},[]);const D=h.useCallback(async()=>{try{await IH()}catch(C){console.error("Logout failed:",C);return}Se(null),window.location.reload()},[]),[G,le]=h.useState(null),[je,$e]=h.useState(!1),[Ve,Qe]=h.useState([]),[Ye,_t]=h.useState([]),[He,at]=h.useState({}),ue=h.useRef(He);h.useEffect(()=>{ue.current=He},[He]);const qe=h.useRef({}),[Ge,bt]=h.useState(!0),[cn,Hn]=h.useState(!1),On=h.useRef(!1),hn=h.useRef(null),er=h.useRef(0);h.useEffect(function(){return function(){er.current&&cancelAnimationFrame(er.current)}},[]);const[an,Ct]=h.useState([]),vr=h.useRef([]);vr.current=an;const[oe,te]=h.useState(null);P.current=oe,h.useEffect(()=>{s(oe)},[oe]),h.useEffect(()=>{oe&&NJ(typeof document<"u"&&document.visibilityState==="visible",oe)},[oe]);const ke=h.useMemo(()=>oe&&an.find(C=>C.id===oe)||null,[oe,an]),[Ie,We]=h.useState([]),[ht,mt]=h.useState(!1),[It,_e]=h.useState({}),it=h.useRef(It);it.current=It;const[Ot,Dt]=h.useState({}),[qn,Sn]=h.useState(null),[Kr,Ja]=h.useState(null),ur=h.useRef(null);h.useEffect(function(){return function(){ur.current&&clearTimeout(ur.current),Dn.current&&clearTimeout(Dn.current)}},[]);const[Tc,ei]=h.useState(null),[js,Rc]=h.useState(null),[Ac,kr]=h.useState(null),Dn=h.useRef(null),mn=h.useCallback((C,q)=>{if(C){const J=!q&&!!it.current[C];J&&C===ct.current&&(Ja(null),ur.current&&(clearTimeout(ur.current),ur.current=null)),_e(ne=>{const re={...ne},Ce=!!ne[C];if(q?re[C]=!0:delete re[C],Ce&&!q&&_r.current&&_r.current[C]&&!Vf.current.has(C)){const be=_r.current[C];if(be.length>0){const pt=be.shift();C===ct.current&&Wf(be.length),Promise.resolve().then(()=>{try{Xf.current&&Xf.current(C,pt.content,pt.imageAttachments,pt.agent,pt.displayContent,pt.queuedTempId,pt.fileAttachments)}catch(se){console.error("[Queue] Drain dispatch failed:",se)}})}}return re}),J&&(Vf.current.delete(C),np(C).then(ne=>{const re=Array.isArray(ne&&ne.items)?ne.items:[];Dt(Ce=>{const be={...Ce};if(re.length===0)if(be[C])delete be[C];else return Ce;else be[C]=re;return be})}).catch(()=>{}))}C===ct.current&&mt(q)},[]),Ic=h.useCallback(C=>{const q={};Object.keys(C).forEach(ne=>{C[ne]&&C[ne].type==="busy"&&(q[ne]=!0)}),_e(ne=>{const re={...ne};return Object.keys(q).forEach(Ce=>{re[Ce]=!0}),Object.keys(C).forEach(Ce=>{C[Ce]&&C[Ce].type!=="busy"&&delete re[Ce]}),re});const J=C[ct.current];mt(!!(J&&J.type==="busy"))},[]),[$i,da]=h.useState({}),[Mc,Ts]=h.useState({}),[Rs,ti]=h.useState({});h.useEffect(()=>{b==="map"&&oe&&rp(oe).then(C=>{C&&Array.isArray(C.todos)&&ti(q=>({...q,[oe]:C.todos}))}).catch(()=>{})},[b,oe]);const[As,ja]=h.useState({});h.useEffect(()=>{b==="tools"&&oe&&f2(oe).then(C=>{C&&ja(q=>({...q,[oe]:C}))}).catch(()=>{})},[b,oe]);const[Yr,dr]=h.useState(null),[Df,Hi]=h.useState(null),[Bo,tt]=h.useState(null),[Lc,Oc]=h.useState(!1),[Dc,Pf]=h.useState(null),Pc=50,[Fc,ni]=h.useState(!1),[zo,Be]=h.useState(0),z=h.useRef(0),[ie,Re]=h.useState(!0),[et,st]=h.useState(!1),[gt,Pt]=h.useState(""),[$t,un]=h.useState(0),[Qt,ri]=h.useState(0),[xn,Is]=h.useState(!1),Ff=h.useRef(null),[Ta,L3]=h.useState(!1),[Ra,O3]=h.useState(""),[D3,Bf]=h.useState(!1),[P3,F3]=h.useState(""),[B3,X1]=h.useState(!1),[Bc,Q1]=h.useState(null),[z3,zc]=h.useState(!1),[zf,Z1]=h.useState({}),Uf=h.useRef({}),[$f,J1]=h.useState({}),Hf=h.useRef({}),[U3,$3]=h.useState({}),ek=h.useRef({}),Uc=h.useRef(new Set),Ms=h.useRef(null);h.useEffect(()=>{Uf.current=zf},[zf]),h.useEffect(()=>{Hf.current=$f},[$f]),h.useEffect(()=>{if(!oe)return;const C=an.find(q=>q.id===oe);C&&(C.moe_top_k!=null&&Uf.current[oe]===void 0&&Z1(q=>q[oe]===void 0?{...q,[oe]:C.moe_top_k}:q),C.reasoning_effort&&Hf.current[oe]===void 0&&J1(q=>q[oe]===void 0?{...q,[oe]:C.reasoning_effort}:q))},[oe,an]);const tk=zf[oe]??null,H3=$f[oe]??"max",nk=U3[oe]??null,Uo=h.useCallback((C,q)=>{Q1({text:C,type:q||"info"}),Ms.current&&clearTimeout(Ms.current),Ms.current=setTimeout(()=>{Q1(null),Ms.current=null},3e3)},[]);h.useEffect(()=>{const C=()=>{ZA().then(q=>{const ne=(Array.isArray(q==null?void 0:q.settings)?q.settings:[]).find(Ce=>Ce&&Ce.key==="PAVE_WHATSAPP_CHAT_ID"),re=ne&&ne.value||"";O3(re)}).catch(q=>{console.error("[WhatsApp] Failed to load default chatId from settings:",q.message)})};return C(),window.addEventListener("pave:settings-updated",C),()=>window.removeEventListener("pave:settings-updated",C)},[]);const $c=h.useRef(Ta),q3=h.useRef(Ra);h.useEffect(()=>{$c.current=Ta,q3.current=Ra},[Ta,Ra]);const qf=h.useRef({});h.useEffect(()=>{fq({enabled:Ta,sessionId:oe,chatId:Ra}).catch(C=>{console.error("[WhatsApp routing] Failed to update:",C.message)})},[Ta,oe,Ra]),h.useEffect(()=>{xn&&Ff.current&&Ff.current.focus()},[xn]),h.useEffect(()=>{const C=window.matchMedia("(min-width: 1024px)"),q=J=>{J.matches&&Is(!1)};return C.addEventListener("change",q),()=>C.removeEventListener("change",q)},[]);function rk(){const C=Rs[oe]||[],q=[];for(const be of Ie||[])for(const pt of be.parts||[]){if(pt.type!=="tool")continue;const se=pt.state&&pt.state.output;if(!se)continue;let B=se;if(typeof se=="string")try{B=JSON.parse(se)}catch{continue}B&&B.canvas&&B.canvas.type&&B.canvas.source&&q.push(B.canvas)}const J=oe?`pave-canvas-cleared:${oe}`:null;let ne=new Set;if(J&&typeof window<"u")try{const be=localStorage.getItem(J);be&&(ne=new Set(JSON.parse(be)))}catch{}const re=q.filter(be=>!ne.has(be.type+":"+be.source)),Ce=()=>{if(!J||typeof window>"u")return;const be=q.map(pt=>pt.type+":"+pt.source);try{localStorage.setItem(J,JSON.stringify(be))}catch{}x(pt=>pt+1)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:d?o.jsxs(o.Fragment,{children:[o.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:[o.jsx("button",{type:"button",onClick:()=>k("map"),className:`px-2 py-0.5 rounded ${b==="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"}),o.jsx("button",{type:"button",onClick:()=>k("tools"),className:`px-2 py-0.5 rounded ${b==="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"}),o.jsxs("button",{type:"button",onClick:()=>k("canvas"),className:`px-2 py-0.5 rounded relative ${b==="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",re.length>0?o.jsxs("span",{className:"ml-1 opacity-70",children:["(",re.length,")"]}):null]}),o.jsx("button",{type:"button",onClick:()=>k("terminal"),className:`px-2 py-0.5 rounded ${b==="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"})]}),o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:b==="map"?o.jsx(fQ,{todos:C,darkMode:c}):b==="tools"?o.jsx(wQ,{graph:As[oe]||null,darkMode:c}):b==="canvas"?o.jsx(q4,{canvases:re,onClear:re.length?Ce:null}):o.jsx(aI,{toolParts:gM,matrixMode:m,onToggleMatrix:()=>y(be=>!be),darkMode:c})})]}):re.length>0?o.jsx(q4,{canvases:re,onClear:re.length?Ce:null}):o.jsx(nI,{toolParts:fM})}),o.jsx(fZ,{messages:Ie,isBusy:ht,activeModel:G,sessionModel:He[oe]||null,isPrivateMode:j.has(oe),registryEntries:Ye})]})}h.useEffect(()=>{st(!1),Pt(""),un(0),ri(0),Is(!1)},[oe]),h.useEffect(()=>{if(!oe)return;let C=!1;return cq(oe).then(q=>{if(C||!q)return;const J=oe;q.privateMode&&F(ne=>{if(ne.has(J))return ne;const re=new Set(ne);return re.add(J),re}),Array.isArray(q.messageIds)&&q.messageIds.length&&M(ne=>{let re=!1;const Ce=new Set(ne);for(const be of q.messageIds)Ce.has(be)||(Ce.add(be),re=!0);return re?Ce:ne})}).catch(()=>{}),()=>{C=!0}},[oe]),h.useEffect(()=>{if(!oe){zc(!1);return}let C=!1;return XA(oe).then(q=>{if(C)return;const J=q&&q.config?q.config:{};zc(!!J.enabled)}).catch(()=>{}),()=>{C=!0}},[oe]),h.useEffect(()=>{if(!oe){$e(!1);return}const C=ue.current[oe]||G;if(!C){$e(!1);return}let q=!1;return QH(C).then(J=>{q||$e(!!(J&&J.adaptiveQuality))}).catch(()=>{q||$e(!1)}),()=>{q=!0}},[oe,G,He]),h.useEffect(()=>{Qt>0&&$t>=Qt?un(Qt-1):Qt===0&&$t!==0&&un(0)},[Qt,$t]);const Hc=h.useRef(new Set),qc=h.useCallback(C=>{if(!C||!Hc.current.has(C))return;Hc.current.delete(C);const q=vr.current.find(J=>J.id===C);q&&q.pinned||(Ct(J=>J.filter(ne=>ne.id!==C)),i2(C).catch(J=>{console.warn("Auto-cleanup of empty session failed:",C,J)}))},[]),ct=h.useRef(oe);h.useEffect(()=>{ct.current=oe;const C=_r.current[oe];Wf(C?C.length:0)},[oe]),h.useEffect(()=>{if(!oe)return;let C=!1;return np(oe).then(q=>{if(C)return;const J=Array.isArray(q&&q.items)?q.items:[],ne=oe;Dt(re=>{const Ce={...re};if(J.length===0)if(Ce[ne])delete Ce[ne];else return re;else Ce[ne]=J;return Ce})}).catch(q=>{console.warn("[queue] hydrate failed for",oe,q&&q.message)}),()=>{C=!0}},[oe]);const ak=h.useRef(b);h.useEffect(()=>{ak.current=b},[b]);const _r=h.useRef({}),[W3,Wf]=h.useState(0),Vf=h.useRef(new Set),Ls=h.useCallback(C=>{if(C===ct.current){const q=_r.current[C];Wf(q?q.length:0)}},[]),V3=h.useCallback(C=>{if(!C)return;const q=ct.current;if(!q)return;const J=_r.current[q];Array.isArray(J)&&J.length>0&&(_r.current[q]=J.filter(ne=>ne.queuedTempId!==C)),We(ne=>ne.filter(re=>re.info.id!==C)),Ls(q)},[Ls]),ai=!Oe||!!de;h.useEffect(()=>{!X&&ai&&(fa(),u2().then(C=>{Ic(C)}).catch(C=>{console.error("Failed to fetch session status:",C)}))},[X,ai]),h.useEffect(()=>{!X&&ai&&(XH().then(C=>{C&&C.model&&le(C.model)}).catch(C=>{console.error("Failed to fetch config:",C)}),TH().then(C=>{C&&Array.isArray(C.providers)&&Qe(C.providers)}).catch(C=>{console.error("Failed to fetch providers:",C)}),RH().then(C=>{C&&Array.isArray(C.entries)&&_t(C.entries)}).catch(C=>{console.error("Failed to fetch model registry:",C)}),jb().then(C=>{C&&C.home&&F3(C.home)}).catch(C=>{console.error("Failed to fetch path info:",C)}))},[X,ai]);const Gf=h.useCallback(()=>{MH().then(C=>{const q=Array.isArray(C&&C.pending)?C.pending:[];fe(q)}).catch(C=>{console.error("Failed to fetch pending permissions:",C)})},[]);h.useEffect(()=>{!X&&ai&&Gf()},[X,ai,Gf]),h.useEffect(()=>{const J=setInterval(()=>{fe(ne=>{const re=Date.now(),Ce=ne.filter(be=>re-(be.timestamp||0)<3e5);return Ce.length===ne.length?ne:Ce})},3e4);return()=>clearInterval(J)},[]);const fa=h.useCallback(async C=>{try{const q=C&&C.includeArchived||On.current,J=z.current||0,ne=Math.max(Pc,J),re=await Cb({limit:ne,offset:0,includeArchived:q});if(re&&re.sessions){const Ce=Array.isArray(re.sessions)?re.sessions:[];Ct(Ce),ni(!!re.hasMore),Be(Ce.length),z.current=Ce.length}else{const Ce=Array.isArray(re)?re:[];Ct(Ce),ni(!1),Be(Ce.length),z.current=Ce.length}}catch(q){return console.error("Failed to load sessions:",q),!1}return!0},[]);h.useEffect(()=>{function C(){oe&&mH(oe).then(function(q){q&&q.sessionID&&(ct.current=q.sessionID,te(q.sessionID),fa())}).catch(function(q){console.error("Failed to create archive session:",q);const J=(()=>{if(!q)return!1;if(q.status===404||q.response&&q.response.status===404)return!0;if(typeof q.message=="string"){const ne=q.message.match(/^(\d{3})\s*:/);if(ne&&parseInt(ne[1],10)===404)return!0}return!1})();tt(e(J?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",C),()=>document.removeEventListener("navigateToArchiveSession",C)},[oe,fa,e,tt]);const G3=async()=>{try{const C=await Cb({limit:Pc,offset:zo,includeArchived:On.current});if(C&&C.sessions){const q=Array.isArray(C.sessions)?C.sessions:[];Ct(J=>{for(var ne={},re=0;re<J.length;re++)ne[J[re].id]=!0;for(var Ce=[],be=0;be<q.length;be++)ne[q[be].id]||Ce.push(q[be]);return J.concat(Ce)}),ni(!!C.hasMore),Be(J=>{var ne=J+q.length;return z.current=ne,ne})}}catch(C){console.error("Failed to load more sessions:",C)}},Aa=async C=>{try{const q=await yH(C);return ct.current!==C?null:Array.isArray(q)?(We(J=>{const ne=q.some(Q=>Q.info.mode==="compaction"),re=Array.isArray(J)&&J.some(Q=>Q.info&&Q.info.mode==="compaction");if(ne&&!re)return q;const Ce=new Set(q.map(Q=>Q.info.id)),be=J.filter(Q=>Q.info.sessionID===C&&!Ce.has(Q.info.id)&&!String(Q.info.id).startsWith("temp-"));if(be.length===0)return q;const pt=[];let se=0,B=0;for(;se<q.length||B<be.length;){const Q=q[se],ae=be[B],Ne=Q&&Q.info.time&&typeof Q.info.time.created=="number"?Q.info.time.created:1/0,Ue=ae&&ae.info.time&&typeof ae.info.time.created=="number"?ae.info.time.created:1/0;se<q.length&&(B>=be.length||Ne<=Ue)?(pt.push(Q),se++):(pt.push(ae),B++)}return pt}),q):(We([]),null)}catch(q){return console.error("Failed to load messages:",q),ct.current===C&&We([]),null}};h.useEffect(()=>{if(!oe){We([]),da({}),Hi(null),Re(!0);return}We([]),Hi(null),Re(!1),dr(null),oe&&(d2(oe).then(se=>{se&&Array.isArray(se.banners)&&Ts(B=>({...B,[oe]:se.banners}))}).catch(()=>{}),rp(oe).then(se=>{se&&Array.isArray(se.todos)&&ti(B=>({...B,[oe]:se.todos}))}).catch(()=>{})),wt.connect(oe);let C=!1,q=!1,J=!1,ne=!1;const re=oe,Ce=se=>{if(ct.current!==re)return;const B=new Map;if(Array.isArray(se))for(const Q of se){if(!Q||!Q.info||!Q.info.id||!Array.isArray(Q.parts))continue;const ae=new Set;for(const Ne of Q.parts)Ne&&(Ne.type==="text"||Ne.type==="reasoning")&&ae.add(Ne.type);ae.size>0&&B.set(Q.info.id,ae)}da(Q=>{const ae=Q[re];if(!ae||Object.keys(ae).length===0)return Q;const Ne={};let Ue=!1;for(const Ze of Object.keys(ae)){const ot=ae[Ze],ut={};let Et=!1;const tr=B.get(Ze);for(const nr of Object.keys(ot)){const Ds=ot[nr];if(Ds._fromSnapshot){ut[nr]=Ds,Et=!0;continue}const tg=Ds.type;if(tr&&tr.has(tg)){Ue=!0;continue}ut[nr]=ot[nr],Et=!0}Et?Ne[Ze]=ut:Ue=!0}if(!Ue)return Q;if(Object.keys(Ne).length===0){const Ze={...Q};return delete Ze[re],Ze}return{...Q,[re]:Ne}})},be=setTimeout(()=>{!C&&!q&&(q=!0,Aa(re).then(se=>{J=!0,Ce(se),ne&&ct.current===re&&Aa(re).then(B=>{Ce(B)})}))},3e3),pt=[wt.on("connected",()=>{C=!0,clearTimeout(be),Re(!0),Gf(),u2().then(se=>{Ic(se)}).catch(()=>{}),np(re).then(se=>{const B=Array.isArray(se&&se.items)?se.items:[];Dt(Q=>{const ae={...Q};if(B.length===0)if(ae[re])delete ae[re];else return Q;else ae[re]=B;return ae})}).catch(()=>{}),Aa(re).then(se=>{J=!0,Ce(se),ne&&ct.current===re&&Aa(re).then(B=>{Ce(B)})})}),wt.on("error",()=>{Re(!1),!C&&!q&&(clearTimeout(be),q=!0,Aa(re).then(se=>{J=!0,Ce(se),ne&&ct.current===re&&Aa(re).then(B=>{Ce(B)})}))}),wt.on("session.status",se=>{var ae;const B=se.properties||se,Q=((ae=B.status)==null?void 0:ae.type)==="busy";mn(B.sessionID,Q)}),wt.on("message.part.delta",se=>{const B=(se.properties||se).part;if(!B||!B.sessionID)return;E.current.has(B.sessionID)&&E.current.delete(B.sessionID);const{sessionID:Q,messageID:ae}=B;if(da(Ne=>{const Ue=Ne[Q]||{},Ze={...Ue[ae]||{}},ot=Ze[B.id];return B.type==="text"||B.type==="reasoning"?Ze[B.id]={...B,text:((ot==null?void 0:ot.text)||"")+(B.delta||"")}:Ze[B.id]={...ot,...B},{...Ne,[Q]:{...Ue,[ae]:Ze}}}),B.type==="text"&&B.delta){const Ne=qf.current;Ne[Q]||(Ne[Q]={}),Ne[Q][ae]=(Ne[Q][ae]||"")+B.delta,$c.current&&console.log("[WhatsApp] Accumulating text delta:",B.delta.length,"chars, total:",Ne[Q][ae].length)}}),wt.on("streaming.snapshot",se=>{const B=se.properties||se,Q=B.sessionID,ae=B.parts;!Q||!Array.isArray(ae)||da(Ne=>{const Ue={...Ne[Q]||{}};for(const Ze of ae){const ot={...Ue[Ze.messageID]||{}};ot[Ze.id]={id:Ze.id,type:Ze.type,text:Ze.text,sessionID:Q,messageID:Ze.messageID,_fromSnapshot:!0},Ue[Ze.messageID]=ot}return{...Ne,[Q]:Ue}})}),wt.on("message.progress",se=>{const B=se.properties||se;B.sessionID===ct.current&&Hi({chunks:B.chunks||0,textLength:B.textLength||0,toolCalls:B.toolCalls||0,toolArgBytes:B.toolArgBytes||0,toolNames:B.toolNames||[]})}),wt.on("message.part.updated",se=>{const B=(se.properties||se).part;if(B){if(B.type==="text"||B.type==="reasoning"){const Q=B.sessionID;da(ae=>{const Ne=ae[Q];if(!Ne)return ae;const Ue=Ne[B.messageID];if(!Ue)return ae;const Ze={};var ot=!1;for(const ut of Object.keys(Ue))Ue[ut].type!==B.type&&(Ze[ut]=Ue[ut],ot=!0);if(!ot){const ut={...Ne};if(delete ut[B.messageID],Object.keys(ut).length===0){const Et={...ae};return delete Et[Q],Et}return{...ae,[Q]:ut}}return{...ae,[Q]:{...Ne,[B.messageID]:Ze}}})}if(B.sessionID===ct.current){if(!J){B.sessionID===re&&(ne=!0);return}(B.type==="tool"||B.type==="tool-use")&&ak.current==="tools"&&f2(B.sessionID).then(Q=>{Q&&ja(ae=>({...ae,[B.sessionID]:Q}))}).catch(()=>{}),We(Q=>Q.map(ae=>{if(ae.info.id!==B.messageID)return ae;const Ne=ae.parts.findIndex(ot=>ot.id===B.id);if(Ne>=0)return{...ae,parts:ae.parts.map((ot,ut)=>ut===Ne?B:ot)};const Ue=ae.parts.slice();let Ze=Ue.length;for(let ot=Ue.length-1;ot>=0;ot--){if(Ue[ot].id<=B.id){Ze=ot+1;break}ot===0&&(Ze=0)}return Ue.splice(Ze,0,B),{...ae,parts:Ue}}))}}}),wt.on("message.updated",se=>{const B=(se.properties||se).info;if(!(!B||B.sessionID!==ct.current)){if(!J){B.sessionID===re&&(ne=!0);return}if(We(Q=>{const ae=Q.findIndex(ut=>ut.info.id===B.id);if(ae>=0)return Q.map((ut,Et)=>Et===ae?{...ut,info:B}:ut);if(B.role==="user"){const ut=Q.findIndex(Et=>Et.info.id&&Et.info.id.startsWith("temp-")&&Et.info.role==="user");if(ut>=0)return Q.map((Et,tr)=>tr===ut?{info:B,parts:[]}:Et)}const Ne={info:B,parts:[]};if(!B.time||typeof B.time.created!="number")return[...Q,Ne];const Ue=B.time.created;let Ze=Q.length;for(let ut=Q.length-1;ut>=0;ut--){const Et=Q[ut].info.time;if(Et&&typeof Et.created=="number"&&Et.created<=Ue){Ze=ut+1;break}ut===0&&(Ze=0)}const ot=Q.slice();return ot.splice(Ze,0,Ne),ot}),B.compactedOut!==!0&&B.finish){const Q=B.sessionID;if(B.role==="assistant"&&$c.current&&Q===ct.current){const ae=qf.current[Q];ae&&ae[B.id]&&(delete ae[B.id],Object.keys(ae).length===0&&delete qf.current[Q]),gq(Q).then(Ne=>{if(Ne&&Ne.message)return console.log(`[WhatsApp] Processing queued message (${Ne.remaining} remaining)`),wu(Q,Ne.message.text,null,ue.current[Q]||void 0)}).catch(Ne=>{console.error("[WhatsApp] Failed to process queue:",Ne)})}da(ae=>{const Ne=ae[Q];if(!Ne||!Ne[B.id])return ae;const Ue={...Ne};if(delete Ue[B.id],Object.keys(Ue).length===0){const Ze={...ae};return delete Ze[Q],Ze}return{...ae,[Q]:Ue}}),Hi(null),B.finish!=="compacted"&&mn(Q,!1),Aa(ct.current)}}}),wt.on("message.deleted",se=>{const B=se.properties||se,Q=B.sessionID,ae=B.messageID;!Q||!ae||Q===ct.current&&(We(Ne=>Ne.filter(Ue=>Ue.info.id!==ae)),da(Ne=>{if(!Ne[Q])return Ne;const Ue=Ne[Q];if(!Ue[ae])return Ne;const Ze={...Ne},ot={...Ue};return delete ot[ae],Ze[Q]=ot,Ze}))}),wt.on("session.updated",se=>{const B=se.properties||se,Q=B.info||B,ae=Q&&(Q.id||Q.sessionID)||B.sessionID||B.id;if(!ae){fa();return}const Ne=Q&&Q.time&&typeof Q.time.updated=="number",Ue=Ze=>{Ct(ot=>{var ut=!1,Et=ot.map(tr=>tr.id===ae?(ut=!0,{...Ze,ui:{...Ze.ui,...tr.ui}}):tr);return!ut&&T5(Ze)&&(Et=[Ze].concat(Et)),Et.sort((tr,nr)=>nr.time.updated-tr.time.updated),Et})};Ne?(Ue(Q),at(Ze=>{let ot=Ze;const ut=Q.model;return typeof ut=="string"&&ut||ut&&typeof ut=="object"&&ut.providerID&&ut.modelID?ot={...Ze,[ae]:ut}:Ze[ae]&&(ot={...Ze},delete ot[ae]),ue.current=ot,ot})):tp(ae).then(Ze=>{Ue(Ze),at(ot=>{let ut=ot;const Et=Ze&&Ze.model;return typeof Et=="string"&&Et||Et&&typeof Et=="object"&&Et.providerID&&Et.modelID?ut={...ot,[ae]:Et}:ot[ae]&&(ut={...ot},delete ut[ae]),ue.current=ut,ut})}).catch(Ze=>{console.error("Failed to fetch updated session, falling back to full reload:",Ze),fa()})}),wt.on("session.deleted",se=>{const B=se.properties||se,Q=B.info||B,ae=Q&&(Q.id||Q.sessionID)||B.sessionID||B.id;ae&&(Ct(Ne=>Ne.filter(Ue=>Ue.id!==ae)),te(Ne=>Ne===ae?null:Ne))}),wt.on("permission.request",se=>{const B=se.properties||se;B.requestId&&fe(Q=>Q.some(ae=>ae.id===B.requestId)?Q:[...Q,{id:B.requestId,action:B.action,type:B.type,target:B.target,reason:B.reason,description:B.description,timestamp:Date.now()}])}),wt.on("permission.confirmed",se=>{const B=se.properties||se;B.requestId&&fe(Q=>Q.filter(ae=>ae.id!==B.requestId))}),wt.on("permission.denied",se=>{const B=se.properties||se;B.requestId&&fe(Q=>Q.filter(ae=>ae.id!==B.requestId))}),wt.on("question.asked",se=>{const B=se.properties||se;if(!B.id)return;const Q=B.tool&&B.tool.callID?B.tool.callID:null;if(Q&&U(ae=>({...ae,[Q]:B.id})),cc()){const ae=B.questions&&B.questions[0],Ne=ae?ae.text:"A question needs your input.",Ue=B.sessionID||null;R3({title:"PAVE — Question",body:Ne.length>200?Ne.slice(0,200)+"…":Ne,tag:"pave-question-"+B.id,onClick:Ue?function(){Or(Ue),window.focus()}:function(){window.focus()}})}}),wt.on("question.replied",se=>{const B=se.properties||se;B.requestId&&U(Q=>{var ae={};for(var Ne in Q)Q[Ne]!==B.requestId&&(ae[Ne]=Q[Ne]);return ae})}),wt.on("question.rejected",se=>{const B=se.properties||se;B.requestId&&U(Q=>{var ae={};for(var Ne in Q)Q[Ne]!==B.requestId&&(ae[Ne]=Q[Ne]);return ae})}),wt.on("quality.hint",se=>{const B=se.properties||se;if(!B.preset)return;const Q=B.sessionID;Q&&($3(ae=>({...ae,[Q]:B})),ek.current[Q]=B)}),wt.on("dlp.cancelled",se=>{const Q=(se.properties||se).sessionID;if(!Q)return;const ae=E.current.get(Q);ae&&(ae.tempId&&We(Ne=>Ne.filter(Ue=>Ue.info.id!==ae.tempId)),Q===ct.current&&w.current&&typeof w.current.setText=="function"&&w.current.setText(ae.text||""),E.current.delete(Q)),mn(Q,!1)}),wt.on("dlp.private_message",se=>{const B=se.properties||se,Q=B.sessionID,ae=B.messageID;!Q||!ae||(M(Ne=>{if(Ne.has(ae))return Ne;const Ue=new Set(Ne);return Ue.add(ae),Ue}),F(Ne=>{if(Ne.has(Q))return Ne;const Ue=new Set(Ne);return Ue.add(Q),Ue}))}),wt.on("dlp.exited_private",se=>{const Q=(se.properties||se).sessionID;Q&&F(ae=>{if(!ae.has(Q))return ae;const Ne=new Set(ae);return Ne.delete(Q),Ne})}),wt.on("session.error",se=>{const B=se.properties||se;if(B.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",B.source||""),tt("Session expired. Please log in again."),Se(null),B.sessionID&&mn(B.sessionID,!1);return}B.sessionID&&mn(B.sessionID,!1),B.sessionID===ct.current&&(B.code==="insufficient_credits"?(tt(null),Pf(B.upgradeUrl||null),Oc(!0)):tt(B.error||"An error occurred"))}),wt.on("session.retry",se=>{const B=se.properties||se;B.reason==="rate_limit"&&B.sessionID===ct.current&&(Ja({attempt:B.attempt,maxRetries:B.maxRetries,delayMs:B.delayMs,elapsedMs:B.elapsedMs||0,maxDurationMs:B.maxDurationMs||0}),ur.current&&clearTimeout(ur.current),ur.current=setTimeout(()=>Ja(null),1e4))}),wt.on("session.compacting",se=>{const B=se.properties||se;B.sessionID===ct.current&&Sn(Q=>({...Q,currentTokens:B.currentTokens??(Q==null?void 0:Q.currentTokens),threshold:B.threshold??(Q==null?void 0:Q.threshold),reason:B.reason??(Q==null?void 0:Q.reason),stage:B.stage??(Q==null?void 0:Q.stage),elapsedMs:B.elapsedMs??(Q==null?void 0:Q.elapsedMs),messageCount:B.messageCount??(Q==null?void 0:Q.messageCount),chunks:B.chunks??(Q==null?void 0:Q.chunks),textLength:B.textLength??(Q==null?void 0:Q.textLength)}))}),wt.on("session.compacted",se=>{const B=se.properties||se,Q=ct.current;if(B.sessionID===Q){if(Sn(null),ei(null),B.newSessionID&&B.newSessionID!==Q&&!B.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${Q} → ${B.newSessionID}`),B.newSession){Wc(B.newSession);const Ue=B.newSession.model;(typeof Ue=="string"&&Ue||Ue&&typeof Ue=="object"&&Ue.providerID&&Ue.modelID)&&at(ot=>{const ut={...ot,[B.newSessionID]:Ue};return ue.current=ut,ut})}ct.current=B.newSessionID,te(B.newSessionID),mt(!0);return}if(B.source==="server"){const Ue=B.summary?B.summary.substring(0,200)+(B.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${B.deletedMessages} messages replaced, ${B.summaryTokens||"?"} summary tokens`),Ue&&console.log("[SERVER-COMPACT] Summary: "+Ue),ei({source:"server",deletedMessages:B.deletedMessages||0,summaryTokens:B.summaryTokens||0,summary:Ue})}const ae=B.inPlace===!0,Ne=!!it.current[Q];ae&&Ne?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(We([]),da(Ue=>{if(!Ue[Q])return Ue;const Ze={...Ue};return delete Ze[Q],Ze}),Hi(null),Aa(Q).then(()=>{requestAnimationFrame(()=>{hn.current&&ct.current===Q&&hn.current.scrollToBottom()})}))}}),wt.on("banner.updated",se=>{const B=se.properties||se;!B||!B.sessionID||(Ts(Q=>{const ae=Q[B.sessionID]||[];if(ae.some(Ue=>Ue.timestamp===B.timestamp))return Q;const Ne=[{url:B.url,timestamp:B.timestamp,prompt:B.prompt,createdAt:new Date(B.timestamp).toISOString()},...ae];return{...Q,[B.sessionID]:Ne}}),B.sessionID===ct.current&&dr(null))}),wt.on("banner.progress",se=>{const B=se.properties||se;if(!B||B.sessionID!==ct.current)return;const Q=B.stage||"working";let ae=Q;Q==="queued"?ae="Banner queued":Q==="summarizing"?ae="Banner: summarizing…":Q==="rendering"?ae=B.line?"Banner: "+B.line.substring(0,80):"Banner: rendering…":Q==="saved"?ae="Banner saved":Q==="error"?ae="Banner error: "+(B.message||"unknown"):Q==="skipped"&&(ae="Banner skipped: "+(B.reason||"")),dr({stage:Q,label:ae,ts:Date.now()}),Q==="saved"&&B.sessionID&&d2(B.sessionID).then(Ne=>{Ne&&Array.isArray(Ne.banners)&&Ts(Ue=>({...Ue,[B.sessionID]:Ne.banners}))}).catch(()=>{})}),wt.on("todo.updated",se=>{const B=se.properties||se;!B||!B.sessionID||(Array.isArray(B.todos)?ti(Q=>({...Q,[B.sessionID]:B.todos})):rp(B.sessionID).then(Q=>{Q&&Array.isArray(Q.todos)&&ti(ae=>({...ae,[B.sessionID]:Q.todos}))}).catch(()=>{}))}),wt.on("whatsapp.message",se=>{var Q;const B=se.properties||se;B.sessionId===ct.current&&$c.current&&(console.log("[WhatsApp] Injecting message:",(Q=B.text)==null?void 0:Q.substring(0,50)),wu(B.sessionId,B.text,null,ue.current[B.sessionId]||void 0).catch(ae=>console.error("[WhatsApp] Failed to inject message:",ae)))}),wt.on("whatsapp.queued",se=>{const B=se.properties||se;B.sessionId===ct.current&&console.log(`[WhatsApp] Message queued from ${B.sender} (queue size: ${B.queueSize})`)}),wt.on("queue.updated",se=>{const B=se.properties||se;if(!B||!B.sessionID)return;const Q=Array.isArray(B.items)?B.items:[];Dt(ae=>{const Ne={...ae};return Q.length===0?delete Ne[B.sessionID]:Ne[B.sessionID]=Q,Ne})}),wt.on("idle-injection.enabled",se=>{const B=se.properties||se;!B||B.sessionID!==re||(zc(!0),Uo(e("chat.idle_injection_enabled_toast"),"success"))}),wt.on("idle-injection.disabled",se=>{const B=se.properties||se;!B||B.sessionID!==re||(zc(!1),Uo(e("chat.idle_injection_disabled_toast"),"info"))}),wt.on("idle-injection.fired",se=>{const B=se.properties||se;!B||B.sessionID!==re||Uo(e("chat.idle_injection_fired_toast"),"success")}),wt.on("idle-injection.timeout",se=>{const B=se.properties||se;!B||B.sessionID!==re||Uo(e("chat.idle_injection_timeout_toast"),"warning")}),wt.on("scheduled-injection.fired",se=>{const B=se.properties||se;!B||B.sessionID!==re||Uo(e("scheduled_injection.fired_toast"),"success")}),wt.on("scheduled-injection.added",se=>{const B=se.properties||se;!B||B.sessionID}),wt.on("scheduled-injection.removed",se=>{const B=se.properties||se;!B||B.sessionID}),wt.on("prefill.fallback",se=>{const B=se.properties||se;!B||B.sessionID!==re||(kr({originalModel:B.originalModel,fallbackModel:B.fallbackModel,reason:B.reason||"prefill_too_large"}),Dn.current&&clearTimeout(Dn.current),Dn.current=setTimeout(()=>{kr(null),Dn.current=null},15e3))}),wt.on("auth.device_code",se=>{const B=se.properties||se;B.user_code&&B.verification_uri&&Rc({verification_uri:B.verification_uri,user_code:B.user_code,expires_in:B.expires_in||300})})];return()=>{clearTimeout(be),Ms.current&&clearTimeout(Ms.current),Dn.current&&(clearTimeout(Dn.current),Dn.current=null),kr(null),pt.forEach(se=>se()),wt.disconnect()}},[oe]),h.useEffect(()=>{if(!oe)return;const C=setTimeout(()=>{var q;(q=w.current)==null||q.focus()},50);return()=>{clearTimeout(C)}},[oe]);function Wc(C){Ct(q=>{for(var J=0;J<q.length;J++)if(q[J].id===C.id)return q.map(ne=>ne.id===C.id?C:ne);return[C,...q]})}const Kf=h.useCallback(async()=>{try{const C=await a2();Wc(C);const q=ct.current;q&&q!==C.id&&qc(q),Hc.current.add(C.id),ct.current=C.id,te(C.id)}catch(C){tt("Failed to create session: "+C.message)}},[qc]);O.current=Kf;const Or=h.useCallback(async C=>{var J;if(C===ct.current)return;const q=ct.current;q&&q!==C&&qc(q),ct.current=C,te(C),tt(null),mt(!!it.current[C]),Sn(null);try{const ne=await tp(C);if(ct.current!==C)return;((J=ne==null?void 0:ne.status)==null?void 0:J.type)==="busy"&&mt(!0),Ct(re=>{var B;if(!ne)return re;const Ce=re.findIndex(Q=>Q.id===C),be=((B=ne.time)==null?void 0:B.updated)||0;if(Ce>=0){const Q=re[Ce],ae=re.filter(Ze=>Ze.id!==C),Ne={...ne,ui:{...ne.ui,...Q.ui}},Ue=ae.findIndex(Ze=>{var ot;return(((ot=Ze.time)==null?void 0:ot.updated)||0)<=be});return ae.splice(Ue<0?ae.length:Ue,0,Ne),ae}const pt=re.findIndex(Q=>{var ae;return(((ae=Q.time)==null?void 0:ae.updated)||0)<=be}),se=[...re];return se.splice(pt<0?se.length:pt,0,ne),se}),at(re=>{if(ne&&ne.model)return{...re,[C]:ne.model};if(re[C]){const Ce={...re};return delete Ce[C],Ce}return re})}catch(ne){console.error("Failed to fetch session status for session",C,ne)}},[qc]),K3=h.useCallback(async C=>{try{await i2(C),Ct(q=>q.filter(J=>J.id!==C)),oe===C&&(ct.current=null,te(null))}catch(q){tt("Failed to delete: "+q.message)}},[oe]),Y3=h.useCallback(async()=>{try{await xH(),await fa(),ct.current=null,te(C=>C&&null)}catch(C){tt("Failed to delete sessions: "+C.message)}},[fa]),X3=h.useCallback(async(C,q)=>{try{await Dr(C,{title:q}),Ct(J=>J.map(ne=>ne.id===C?{...ne,title:q}:ne))}catch(J){tt("Failed to rename: "+J.message)}},[]),Q3=h.useCallback(async C=>{try{const q=await pH(C);q&&q.title&&Ct(J=>J.map(ne=>ne.id===C?{...ne,title:q.title}:ne))}catch(q){tt("Failed to regenerate title: "+q.message)}},[]),Z3=h.useCallback(async(C,q)=>{try{await Dr(C,{pinned:q}),Ct(J=>J.map(ne=>ne.id===C?{...ne,pinned:q}:ne))}catch(J){tt("Failed to pin: "+J.message)}},[]),J3=h.useCallback(async C=>{const q=an.find(ne=>ne.id===C);if(!q||!q.parentSessionID)return;const J=q.parentSessionID;try{await kH(C),Ct(ne=>ne.map(re=>re.id===C?{...re,compactionPinned:!1}:re)),ct.current=J,te(J)}catch(ne){tt("Failed to unpin: "+ne.message)}},[an]),eM=h.useCallback(async(C,q)=>{try{await Dr(C,{archived:q}),!On.current&&q?(Ct(J=>J.filter(ne=>ne.id!==C)),oe===C&&(ct.current=null,te(null))):Ct(J=>J.map(ne=>ne.id===C?{...ne,archived:q}:ne))}catch(J){tt("Failed to archive: "+J.message)}},[oe]),tM=h.useCallback(async({readOnly:C=!1}={})=>{if(!oe)return;let q,J,ne;if(Ct(re=>{var be;const Ce=re.find(pt=>pt.id===oe);return q=((be=Ce==null?void 0:Ce.ui)==null?void 0:be.hideThinking)??!0,J=!q,ne=Ce==null?void 0:Ce.ui,re.map(pt=>pt.id===oe?{...pt,ui:{...pt.ui,hideThinking:J}}:pt)}),!C)try{await Dr(oe,{ui:{...ne,hideThinking:J}})}catch(re){console.error("Failed to persist hideThinking:",re),Ct(Ce=>Ce.map(be=>be.id===oe?{...be,ui:{...be.ui,hideThinking:q}}:be)),tt("Failed to save thinking visibility preference"+(re!=null&&re.message?": "+re.message:""))}},[oe]),ik=h.useCallback(async C=>{try{await iq(C)}catch(q){tt("Export failed: "+q.message)}},[]),Yf=h.useCallback(async C=>{try{const q=await sq(C);q&&q.id&&(await fa(),Or(q.id))}catch(q){tt("Import failed: "+q.message)}},[fa,Or]),sk=h.useRef(!1);h.useEffect(()=>{if(!sk.current&&!(!ai||an.length===0)){sk.current=!0;var C=null,q=!1;try{var J=new URLSearchParams(window.location.search);C=J.get("session"),q=!!C}catch{}if(C||(C=i()),!!C){if(an.some(function(ne){return ne.id===C})){Or(C);return}tp(C).then(function(ne){ne&&ne.id?Or(C):q||l()}).catch(function(){q||l()})}}},[ai,an,Or]),h.useEffect(()=>{function C(q){var J=q.data;!J||J.type!=="navigate-session"||J.sessionId&&Or(J.sessionId)}return window.addEventListener("message",C),function(){window.removeEventListener("message",C)}},[Or]),h.useEffect(()=>{function C(){try{var J=indexedDB.open("pave-sw",1);J.onupgradeneeded=function(){J.result.createObjectStore("pave-pending-nav")},J.onsuccess=function(){var ne=J.result;if(!ne.objectStoreNames.contains("pave-pending-nav")){ne.close();return}var re=ne.transaction("pave-pending-nav","readwrite"),Ce=re.objectStore("pave-pending-nav"),be=Ce.get("sessionId");be.onsuccess=function(){var pt=be.result;Ce.delete("sessionId"),pt&&pt!==ct.current&&Or(pt)},re.oncomplete=function(){ne.close()},re.onerror=function(){ne.close()}},J.onerror=function(){}}catch{}}function q(){document.visibilityState==="visible"&&(C(),setTimeout(C,500),setTimeout(C,1500))}return document.addEventListener("visibilitychange",q),function(){document.removeEventListener("visibilitychange",q)}},[Or]);const nM=h.useCallback(async C=>{if(!oe)return;const q=qe.current,J=(q[oe]||0)+1;q[oe]=J;const ne=ue.current[oe];at(re=>{const Ce={...re};return C?Ce[oe]=C:delete Ce[oe],ue.current=Ce,Ce});try{const re=await Dr(oe,{model:C||null});if(q[oe]!==J)return;re&&(typeof re.model=="string"&&re.model||re.model&&typeof re.model=="object"&&re.model.providerID&&re.model.modelID)?at(Ce=>{const be={...Ce,[oe]:re.model};return ue.current=be,be}):C||at(Ce=>{const be={...Ce};return delete be[oe],ue.current=be,be})}catch(re){if(q[oe]!==J)return;at(Ce=>{const be={...Ce};return ne!==void 0?be[oe]=ne:delete be[oe],ue.current=be,be}),console.error("[ModelChange] PATCH failed for session",oe,re),tt("Failed to update session model: "+re.message)}},[oe]),rM=h.useCallback(async function(C,q){if(oe){var J=ke&&ke.disabledSkills||[],ne;q?ne=J.filter(function(re){return re!==C}):ne=J.concat([C]),Ct(function(re){return re.map(function(Ce){return Ce.id===oe?{...Ce,disabledSkills:ne}:Ce})});try{await Dr(oe,{disabledSkills:ne})}catch(re){Ct(function(Ce){return Ce.map(function(be){return be.id===oe?{...be,disabledSkills:J}:be})}),console.error("[SkillToggle] PATCH failed:",re)}}},[oe,ke]),aM=h.useCallback(async function(){if(oe)try{var C=await QA(),q=C.skillDefaults||{},J=await _1(),ne=["agent"];(J||[]).forEach(function(re){q[re.name]||ne.push(re.name)}),Ct(function(re){return re.map(function(Ce){return Ce.id===oe?{...Ce,disabledSkills:ne}:Ce})}),await Dr(oe,{disabledSkills:ne})}catch(re){console.error("[SkillToggle] Reset to defaults failed:",re)}},[oe]),iM=h.useCallback(C=>{Ct(q=>q.map(J=>J.id===oe?{...J,directory:C}:J)),Bf(!1)},[oe]),sM=h.useCallback(async()=>{const C=!On.current;On.current=C,await fa({includeArchived:C})?Hn(C):On.current=!C},[]),$o=h.useCallback(async(C,q,J,ne,re,Ce,be)=>{const pt=C===ct.current;Ce&&pt&&We(Vt=>Vt.filter(ga=>ga.info.id!==Ce));var se=(J?J.length:0)+(be?be.length:0);if(se>Md)throw tt("Too many attachments. Maximum "+Md+" per message."),new Error("Too many attachments");var B=[],Q=0;if(J&&J.length>0){for(var ae=0;ae<J.length;ae++){var Ne=(J[ae].file.type||"").toLowerCase();if(hf.indexOf(Ne)===-1)throw tt('Unsupported image type: "'+J[ae].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(J[ae].file.size>g2){var Ue=Math.round(J[ae].file.size/1024/1024*10)/10,Ze=Math.round(g2/1024/1024*10)/10;throw tt('Image "'+J[ae].name+'" ('+Ue+"MB) exceeds the "+Ze+"MB size limit."),new Error("Image too large")}Q+=J[ae].file.size}if(Q>m2){var ot=Math.round(Q/1024/1024*10)/10,ut=Math.round(m2/1024/1024*10)/10;throw tt("Combined image size ("+ot+"MB) exceeds the "+ut+"MB total image limit."),new Error("Combined image size too large")}try{B=await Promise.all(J.map(function(Vt){return new Promise(function(ga,Pn){var Rn=new FileReader;Rn.onload=function(){if(typeof Rn.result!="string"){Pn(new Error("FileReader did not produce a data URL for: "+Vt.name));return}ga({type:"image_url",image_url:{url:Rn.result}})},Rn.onerror=function(){Pn(new Error("Failed to read file: "+Vt.name))},Rn.readAsDataURL(Vt.file)})}))}catch(Vt){throw tt("Failed to read image: "+Vt.message),Vt}}var Et=[],tr=0;if(be&&be.length>0){for(var nr=0;nr<be.length;nr++){var Ds=(be[nr].file.type||"").toLowerCase();if(eI.indexOf(Ds)===-1)throw tt('Unsupported file type: "'+be[nr].name+'" ('+(Ds||"unknown")+")."),new Error("Unsupported file type");if(be[nr].file.size>p2){var tg=Math.round(be[nr].file.size/1024/1024*10)/10,bM=Math.round(p2/1024/1024*10)/10;throw tt('File "'+be[nr].name+'" ('+tg+"MB) exceeds the "+bM+"MB size limit."),new Error("File too large")}tr+=be[nr].file.size}if(Q+tr>h2){var vM=Math.round((Q+tr)/1024/1024*10)/10,kM=Math.round(h2/1024/1024*10)/10;throw tt("Combined attachment size ("+vM+"MB) exceeds the "+kM+"MB total limit."),new Error("Combined attachment size too large")}try{Et=await Promise.all(be.map(function(Vt){return new Promise(function(ga,Pn){var Rn=new FileReader;Rn.onload=function(){if(typeof Rn.result!="string"){Pn(new Error("FileReader did not produce a data URL for: "+Vt.name));return}ga({type:"file",mime:Vt.file.type,filename:Vt.name,url:Rn.result})},Rn.onerror=function(){Pn(new Error("Failed to read file: "+Vt.name))},Rn.readAsDataURL(Vt.file)})}))}catch(Vt){throw tt("Failed to read file: "+Vt.message),Vt}}const Ma="temp-"+Date.now();for(var ng=[{id:Ma+"-text",type:"text",text:re}],Vc=0;Vc<B.length;Vc++)ng.push({id:Ma+"-img-"+Vc,type:"image_url",image_url:B[Vc].image_url});for(var qo=0;qo<Et.length;qo++)ng.push({id:Ma+"-file-"+qo,type:"file",mime:Et[qo].mime,filename:Et[qo].filename});const _M={info:{id:Ma,sessionID:C,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:ng};We(Vt=>pt?[...Vt,_M]:Vt),mn(C,!0),E.current.set(C,{text:re,tempId:Ma});try{var ck=null;(B.length>0||Et.length>0)&&(ck=Et.concat(B));const Vt=Uf.current[C]??null,ga=Hf.current[C]??"max",Pn=Vt===null&&!Uc.current.has(C),Rn=ek.current[C],rg=Pn&&Rn?Rn.moe_topk||null:Vt;await wu(C,q,ck,ue.current[C]||void 0,ne,{moeTopK:rg,reasoningEffort:ga,adaptiveQuality:Pn})}catch(Vt){if(Vt.status===409)if(B.length>0||Et.length>0){const Pn=Ma;_r.current[C]||(_r.current[C]=[]),_r.current[C].push({content:q,imageAttachments:J,fileAttachments:be,agent:ne,displayContent:re,queuedTempId:Pn}),Ls(C),mn(C,!1);return}else try{await s2(C,q,{displayContent:re,agent:ne||void 0,model:ue.current[C]||void 0,moeTopK:effectiveMoeTopK,reasoningEffort:sessReasoning,adaptiveQuality:isAutoMode}),We(Pn=>Pn.filter(Rn=>Rn.info.id!==Ma)),mn(C,!1);return}catch(Pn){throw tt("Failed to queue message: "+Pn.message),mn(C,!1),We(Rn=>Rn.filter(rg=>rg.info.id!==Ma)),Pn}throw tt("Failed to send: "+Vt.message),mn(C,!1),We(ga=>ga.filter(Pn=>Pn.info.id!==Ma)),Vt}},[Ls]),Xf=h.useRef($o);h.useEffect(()=>{Xf.current=$o},[$o]);const Ia=h.useCallback(async(C,q,J,ne)=>{tt(null);const re=C,Ce=C.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Ce){const ae=Ce[1],Ne=Ce[2],Ue=Ce[3]||"",Ze=Ue||ae+" "+Ne,ot=(ae+"_"+Ne).replace(/-/g,"_").slice(0,128);C="[SKILL_HINT: User explicitly requested "+ae+"."+Ne+(Ue?" with args: "+Ue:"")+". Call the "+ot+` tool with these parameters.]
|
|
121
|
-
|
|
122
|
-
`+Ze}let be=ct.current;if(!be)try{const ae=await a2();Wc(ae),ct.current=ae.id,te(ae.id),be=ae.id,await new Promise(Ne=>setTimeout(Ne,200))}catch(ae){throw tt("Failed to create session: "+ae.message),ae}if(Hc.current.delete(be),!!It[be]){if(!(q&&q.length>0||ne&&ne.length>0)){try{await s2(be,C,{displayContent:re,agent:J||void 0,model:ue.current[be]||void 0})}catch(ot){tt("Failed to queue message: "+ot.message)}return}const Ne="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Ue=[{id:Ne+"-text",type:"text",text:re}];if(q&&q.length>0)for(var se=0;se<q.length;se++){var B=q[se].preview||"";Ue.push({id:Ne+"-img-"+se,type:"image_url",image_url:{url:B}})}if(ne&&ne.length>0)for(var Q=0;Q<ne.length;Q++)Ue.push({id:Ne+"-file-"+Q,type:"file",mime:ne[Q].file.type,filename:ne[Q].name});const Ze={info:{id:Ne,sessionID:be,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Ue};We(ot=>[...ot,Ze]),_r.current[be]||(_r.current[be]=[]),_r.current[be].push({content:C,imageAttachments:q,agent:J,displayContent:re,queuedTempId:Ne,fileAttachments:ne}),Ls(be);return}await $o(be,C,q,J,re,null,ne)},[It,$o,Ls]);h.useEffect(()=>{const C=()=>{Ia(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",C),()=>window.removeEventListener("pave:plan-execute",C)},[Ia,e]);const oM=h.useCallback(async()=>{if(oe)try{const C=oe;Vf.current.add(C),await _H(C)}catch(C){console.error("Abort failed:",C)}},[oe]),lM=h.useCallback(async(C,q,J)=>{if(tt(null),C==="btw"){const ne=ct.current;if(!ne){tt("No active session to fork.");return}let re;try{re=await hH(ne)}catch(be){throw tt("Fork failed: "+(be&&be.message?be.message:String(be))),be}if(!re||!re.id)throw tt("Fork failed: server returned no session id."),new Error("Fork returned no session");Wc(re),ct.current=re.id,te(re.id),await new Promise(be=>setTimeout(be,200));const Ce=(q||"").trim();if(Ce)try{await Ia(Ce,J&&J.imageAttachments?J.imageAttachments:void 0,void 0,J&&J.fileAttachments?J.fileAttachments:void 0)}catch{}return}if(C==="compact"){const ne=ct.current;if(!ne){tt("No active session to compact.");return}tt(null),Sn({reason:"manual",stage:"starting"}),ei(null),vH(ne).then(re=>{if(!re||!re.success){Sn(null),tt("Compaction failed: "+(re&&re.error||"unknown error"));return}Aa(ne),Sn(null),ei(null)}).catch(re=>{Sn(null),re&&re.status===409?tt("Cannot compact while the session is busy. Wait for the current response to finish."):tt("Compaction failed: "+(re&&re.message?re.message:String(re)))});return}tt("Unknown built-in command: /"+C)},[Ia]),cM=h.useCallback(C=>{fe(q=>q.filter(J=>J.id!==C))},[]),uM=h.useCallback(async()=>{for(var C=Ie.length-1;C>=0;C--)if(Ie[C].info.role==="user"){var q=Ie[C].parts||[],J=w1(q,null),ne=q.filter(function(be){return be.type==="image_url"&&be.image_url});if(J.trim()||ne.length>0)if(ne.length>0){var re=oe;if(!re)break;mn(re,!0),tt(null);try{var Ce=ne.map(function(be){return{type:"image_url",image_url:be.image_url}});await wu(re,J.trim(),Ce,ue.current[re]||void 0)}catch(be){tt("Failed to retry: "+be.message),mn(re,!1)}}else try{await Ia(J.trim())}catch(be){tt("Failed to retry: "+be.message),mn(oe,!1)}break}},[Ie,Ia,oe]),dM=h.useCallback(async function(C){if(C&&C.trim()){tt(null),hn.current&&hn.current.resetAutoScroll();try{await Ia(C.trim()),er.current&&cancelAnimationFrame(er.current),er.current=requestAnimationFrame(function(){er.current=0,hn.current&&hn.current.scrollToBottom()})}catch(q){tt("Failed to resend: "+q.message),mn(oe,!1)}}},[Ia]),Xr=h.useMemo(()=>ke?ke.source==="tui"||ke.source==="legacy"||ke.source==="archive"||ke._readOnly===!0:!1,[ke]),Qf=h.useMemo(()=>ke?ke._readOnly===!0&&ke.source!=="tui"&&ke.source!=="legacy"&&ke.source!=="archive":!1,[ke]),Zf=h.useMemo(()=>{if(!Qf||!ke||!an)return null;for(const C of an)if(C.parentSessionID===ke.id)return C.id;return null},[Qf,ke,an]),fM=h.useMemo(()=>{var J;let C=null;for(let ne=Ie.length-1;ne>=0;ne--)if(((J=Ie[ne].info)==null?void 0:J.role)==="assistant"){C=Ie[ne];break}if(!C)return[];const q=(C.parts||[]).filter(ne=>ne.type==="tool");return q.length===0?[]:!ht&&q.every(re=>{var Ce,be;return((Ce=re.state)==null?void 0:Ce.status)==="completed"||((be=re.state)==null?void 0:be.status)==="error"})?[]:q},[Ie,ht]),gM=h.useMemo(()=>{var q;const C=[];for(const J of Ie)if(((q=J.info)==null?void 0:q.role)==="assistant"){const ne=(J.parts||[]).filter(re=>re.type==="tool");C.push(...ne)}return C},[Ie]),Os=h.useRef(0),[pM,Jf]=h.useState(!1),hM=h.useCallback(C=>{if(C.preventDefault(),C.stopPropagation(),Os.current++,Os.current===1){const q=C.dataTransfer;let J=!1;q&&q.items&&q.items.length>0&&(J=Array.from(q.items).some(ne=>ne.kind==="file")),J&&Jf(!0)}},[]),mM=h.useCallback(C=>{C.preventDefault(),C.stopPropagation(),Os.current=Math.max(0,Os.current-1),Os.current===0&&Jf(!1)},[]),xM=h.useCallback(C=>{C.preventDefault(),C.stopPropagation()},[]),yM=h.useCallback(C=>{C.preventDefault(),C.stopPropagation(),Os.current=0,Jf(!1);const q=C.dataTransfer&&C.dataTransfer.files;if(!q||q.length===0)return;const J=q[0],ne=J.name.toLowerCase();if(!ne.endsWith(".yaml")&&!ne.endsWith(".yml")){tt(e("import.invalid_file_type"));return}const re=10*1024*1024;if(J.size>re){tt(e("import.file_too_large"));return}const Ce=new FileReader;Ce.onload=be=>{const pt=be&&be.target?be.target.result:null;if(typeof pt!="string"){tt(e("import.read_error"));return}Yf(pt)},Ce.onerror=()=>{tt(e("import.read_error"))},Ce.readAsText(J)},[Yf,tt,e]);if(X)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:o.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!de)return o.jsx(aW,{darkMode:c,onToggleTheme:()=>u(!c)});const ok=ke==null?void 0:ke.title,eg=typeof ok=="string"?ok.trim():"",Ho=((lk=ke==null?void 0:ke.ui)==null?void 0:lk.hideThinking)??!0;return o.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:hM,onDragLeave:mM,onDragOver:xM,onDrop:yM,children:[pM&&o.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:o.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:o.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),o.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 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("img",{src:c?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-8"}),o.jsx("h1",{className:"sr-only",children:"PAVE"})]}),o.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[o.jsx("button",{onClick:()=>me("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ae==="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")}),o.jsx("button",{onClick:()=>me("agents"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ae==="agents"?"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.agents_tab")}),o.jsx("button",{onClick:()=>me("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ae==="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")}),o.jsx("button",{onClick:()=>me("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ae==="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")})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(YJ,{onNavigateToAgent:C=>{K(C),me("agents")}}),o.jsx("button",{onClick:()=>f(!d),className:`p-1.5 rounded-lg transition-colors ${d?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(d?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(d?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),oe&&Ae==="chat"&&o.jsx("button",{onClick:ee,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${L?"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:H?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:H?"Cmd+J":"Ctrl+J"}),"aria-pressed":L,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx(eD,{darkMode:c,onToggle:()=>u(!c)}),de&&o.jsx(iW,{user:de,onLogout:D,onSkillManagement:()=>me("skills"),onAgentManagement:()=>me("agents"),onPricingSettings:()=>Te(!0),onDlpSettings:()=>xe(!0),onSettings:()=>me("settings")})]})]}),Ae==="skills"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(DZ,{onBack:()=>me("chat")})}):Ae==="agents"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(gJ,{onBack:()=>me("chat"),onSelectAgent:C=>{ve(C)},initialAgentName:De,onInitialAgentConsumed:()=>K(null),hackerMode:d,matrixMode:m,darkMode:c,onToggleMatrix:()=>y(C=>!C),terminalWidth:I,onTerminalWidthChange:T,terminalMinWidth:t,terminalMaxWidth:n})}):Ae==="settings"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(LJ,{onBack:()=>me("chat"),activeSessionId:oe,mobileFrameless:g,onMobileFramelessChange:p})}):o.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[o.jsx(pD,{sessions:an,activeSessionId:oe,busySessions:It,onSelectSession:C=>{Or(C),window.innerWidth<768&&bt(!1)},onNewChat:Kf,onDeleteSession:K3,onDeleteAllSessions:Y3,onRenameSession:X3,onRegenerateTitle:Q3,onPinSession:Z3,onArchiveSession:eM,onExportSession:ik,onImportSession:Yf,onImportError:C=>tt(C),showArchived:cn,onToggleShowArchived:sM,isOpen:Ge,onClose:()=>bt(!1),onToggle:()=>bt(C=>!C),hasMoreSessions:Fc,onLoadMoreSessions:G3}),o.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:oe?o.jsxs(o.Fragment,{children:[o.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 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(gZ,{sessionModel:j.has(oe)?"epm/privacy":He[oe]||null,activeModel:G,registryEntries:Ye,onModelChange:nM,disabled:ht||j.has(oe),lockedReason:j.has(oe)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},oe),eg?o.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:eg,children:eg}):null,o.jsx("button",{onClick:()=>Bf(!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:Xr,children:o.jsx(M3,{className:"w-4 h-4"})}),o.jsx(mZ,{sessionId:oe,disabledSkills:ke?ke.disabledSkills:[],onToggle:rM,onResetToDefaults:aM,t:e,disabled:Xr}),o.jsx("button",{onClick:()=>X1(!0),className:`p-1.5 rounded-lg transition-colors ${z3?"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:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),je&&o.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(C=>{const q=tk===null&&nk&&!Uc.current.has(oe)&&nk.moe_topk===C.val,J=tk===C.val;return o.jsx("button",{onClick:()=>{C.val===null?Uc.current.delete(oe):Uc.current.add(oe),Z1(ne=>({...ne,[oe]:C.val})),Dr(oe,{moe_top_k:C.val}).catch(()=>{})},disabled:Xr,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${J?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":q?"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:C.label},C.label)})}),o.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(C=>o.jsx("button",{onClick:()=>{J1(q=>({...q,[oe]:C.val})),Dr(oe,{reasoning_effort:C.val}).catch(()=>{})},disabled:Xr,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${H3===C.val?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:C.label},C.val))})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>tM({readOnly:Xr}),className:`p-1.5 rounded-lg transition-colors ${Ho?"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(Ho?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(Ho?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!Ho,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{onClick:async()=>{if(oe)try{await pq(oe),tt("Banner generation queued (~2 min)"),setTimeout(()=>tt(null),4e3)}catch(C){tt(`Banner: ${C.message||C}`)}},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:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{onClick:Y,className:`p-1.5 rounded-lg transition-colors ${Z?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}`,title:Z?"Show banner":"Hide banner","aria-label":Z?"Show banner":"Hide banner","aria-pressed":!Z,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Z?o.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"}):o.jsxs(o.Fragment,{children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.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"})]})})}),Yr?o.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Yr.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Yr.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:Yr.label,children:Yr.label}):null,o.jsx("button",{onClick:()=>{if(!Ra){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}L3(C=>!C)},disabled:!Ra,className:`p-1.5 rounded-lg transition-colors ${Ra?Ta?"bg-green-500/10 text-green-600 dark:text-green-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":"text-gray-300 dark:text-gray-600 cursor-not-allowed"}`,title:Ra?e(Ta?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(Ta?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":Ta,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),o.jsx("button",{onClick:()=>Is(C=>!C),className:`p-1.5 rounded-lg transition-colors lg:hidden ${xn?"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":xn,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{onClick:()=>ik(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:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})})}),o.jsx("button",{onClick:()=>{st(C=>!C),et&&(Pt(""),un(0),ri(0))},className:`p-1.5 rounded-lg transition-colors ${et?"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:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),et&&o.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 flex-shrink-0",children:[o.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),o.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:gt,onChange:C=>{Pt(C.target.value),un(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-none"}),gt&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums",children:Qt>0?e("app.match_count",{current:$t+1,total:Qt}):e("app.no_matches")}),gt&&Qt>0&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>un(C=>(C-1+Qt)%Qt),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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),o.jsx("button",{onClick:()=>un(C=>(C+1)%Qt),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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),o.jsx("button",{onClick:()=>{st(!1),Pt(""),un(0),ri(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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!ie&&o.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:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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"})}),o.jsx("span",{children:e("app.reconnecting")})]}),Bo&&o.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:[o.jsx("span",{children:Bo}),o.jsx("button",{onClick:()=>tt(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Bc&&o.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${Bc.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":Bc.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:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{children:Bc.text})]}),js&&o.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:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),o.jsxs("div",{className:"mt-1",children:[o.jsx("a",{href:js.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:js.verification_uri})," ","— ",o.jsx("span",{className:"font-mono font-bold text-base select-all",children:js.user_code})]}),o.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),o.jsx("button",{onClick:()=>Rc(null),className:"ml-2 text-blue-400 hover:text-blue-600 flex-shrink-0","aria-label":"Dismiss",title:"Dismiss",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),Kr&&o.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:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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 ",Kr.attempt,"/",Kr.maxRetries,Kr.maxDurationMs>0&&Kr.elapsedMs>0&&o.jsxs(o.Fragment,{children:[" (",Math.round(Kr.elapsedMs/1e3),"s / ",Math.round(Kr.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(Kr.delayMs/1e3),"s. Click Stop to cancel."]}),o.jsx("button",{onClick:()=>{Ja(null),ur.current&&(clearTimeout(ur.current),ur.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ac&&o.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:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.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: ",Ac.fallbackModel," (local model unavailable)"]}),o.jsx("button",{onClick:()=>{kr(null),Dn.current&&(clearTimeout(Dn.current),Dn.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx(Rq,{ref:hn,messages:Ie,streamingParts:$i[oe]||{},streamingProgress:Df,isBusy:ht,compactingInfo:qn,compactionResult:Tc,onSwitchToCompactedSession:C=>{ct.current=C,te(C),ei(null)},onDismissCompactionResult:()=>ei(null),parentSessionID:ke&&ke.parentSessionID,compactionPinned:ke&&ke.compactionPinned,onUnpinCompaction:J3,onViewParentSession:C=>{ct.current=C,te(C),Ct(function(q){return q.map(function(J){return J.id===C?{...J,_readOnly:!0}:J})})},user:de,searchQuery:gt,activeMatchIndex:$t,onTotalMatchesChange:ri,onRetry:Xr?void 0:uM,onEditAndResend:Xr?void 0:dM,onCancelQueued:Xr?void 0:V3,hackerMode:d,mobileFrameless:g,hideThinking:Ho,sessionID:oe,banners:Mc[oe]||[],bannerHidden:Z,onToggleBanner:Y,privateMessageIds:S,questionIdMap:pe}),(Ot[oe]||[]).length>0&&o.jsx(aee,{items:Ot[oe]||[],sessionId:oe,isReadOnly:Xr,onReorder:function(C){bH(oe,C).catch(function(q){tt("Failed to reorder: "+q.message)})},onCancelItem:function(C){o2(oe,C).catch(function(q){tt("Failed to cancel: "+q.message)})},onEditItem:function(C){if(!(C.status==="dispatching"||Xr)){o2(oe,C.id).catch(function(){});var q=C.displayContent||C.text||"";q&&w.current&&typeof w.current.setText=="function"&&w.current.setText(q)}},t:e}),Xr?o.jsx("div",{className:"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",children:Qf?o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),Zf?o.jsx("button",{onClick:()=>{ct.current=Zf,te(Zf)},className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"}):o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"})]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:ke&&ke.source==="archive"?o.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"}):o.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"})}),o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:ke&&ke.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):o.jsx(rW,{ref:w,sessionId:oe,onSend:Ia,onBuiltinCommand:lM,onAbort:oM,isBusy:ht,queuedCount:W3+(Ot[oe]||[]).length})]}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[o.jsx("img",{src:c?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-16 mb-4"}),o.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),o.jsx("button",{onClick:Kf,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&&o.jsxs("aside",{style:{width:I},className:`border-l hidden ${L?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${d?c?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[o.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":e("app.resize_terminal"),"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":I,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${d?c?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}`,onMouseDown:C=>{C.preventDefault();const q=C.clientX,J=I,ne=Ce=>{const be=q-Ce.clientX,pt=Math.min(n,Math.max(t,J+be));T(pt)},re=()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",re)};document.addEventListener("mousemove",ne),document.addEventListener("mouseup",re)}}),!xn&&rk()]}),xn&&oe&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>Is(!1)}),o.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:C=>{(C.key==="Escape"||C.key==="Esc")&&(C.stopPropagation(),Is(!1))},ref:Ff,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[o.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),o.jsx("button",{onClick:()=>Is(!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:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),rk()]})]})]}),we&&o.jsx(PJ,{onClose:()=>Te(!1)}),ge&&o.jsx($J,{onClose:()=>xe(!1)}),o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:o.jsx(WJ,{requests:he,onDismiss:cM})}),o.jsx(GJ,{open:Lc,onClose:()=>Oc(!1),upgradeUrl:Dc}),o.jsx(tee,{isOpen:D3,onClose:()=>Bf(!1),sessionId:oe,currentDirectory:(ke==null?void 0:ke.directory)||"",homeDir:P3,onDirectoryChange:iM}),o.jsx(ree,{isOpen:B3,onClose:()=>X1(!1),sessionId:oe}),o.jsx(QJ,{isOpen:N,onClose:()=>{_(!1),setTimeout(()=>{var C;return(C=w.current)==null?void 0:C.focus()},0)},onSelectSession:C=>{Or(C)},onNewChat:()=>{typeof O.current=="function"&&O.current()},activeSessionId:oe,sessions:an,busySessions:It}),o.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:V})]})}const oee=JO();fy.createRoot(document.getElementById("root")).render(o.jsx(nt.StrictMode,{children:o.jsx(ZO,{initialLocale:oee,children:o.jsx(nD,{children:o.jsx(see,{})})})}));export{S5 as _,mi as c,No as g,nZ as p};
|