@cnrai/pave 0.11.62 → 0.11.64

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.
Files changed (68) hide show
  1. package/package.json +1 -1
  2. package/pave.js +2 -2
  3. package/web/assets/{abnfDiagram-VRR7QNED-BOEXPnf2.js → abnfDiagram-VRR7QNED-qRSe9DAB.js} +1 -1
  4. package/web/assets/{arc-CtHGX8OF.js → arc-B7SXJwvQ.js} +1 -1
  5. package/web/assets/{architectureDiagram-ZJ3FMSHR-DwZYh9g0.js → architectureDiagram-ZJ3FMSHR-DDYMKNo_.js} +1 -1
  6. package/web/assets/{blockDiagram-677ZJIJ3-Cg85sk-r.js → blockDiagram-677ZJIJ3-DUAxiYnz.js} +1 -1
  7. package/web/assets/{c4Diagram-LMCZKHZV-Cn0jjR6K.js → c4Diagram-LMCZKHZV-E7l-uYc0.js} +1 -1
  8. package/web/assets/channel-Bea3U6kR.js +1 -0
  9. package/web/assets/{chunk-2Q5K7J3B-DZaj3WE9.js → chunk-2Q5K7J3B-CFaAUvC6.js} +1 -1
  10. package/web/assets/{chunk-32BRIVSS-5i2k8SnI.js → chunk-32BRIVSS-DwEvjPZL.js} +1 -1
  11. package/web/assets/{chunk-5VM5RSS4-C4ik25DI.js → chunk-5VM5RSS4-BuT2qpJC.js} +1 -1
  12. package/web/assets/{chunk-EX3LRPZG-C2Aj7ZaF.js → chunk-EX3LRPZG-B79R-suC.js} +1 -1
  13. package/web/assets/{chunk-JWPE2WC7-Dp39DnNj.js → chunk-JWPE2WC7-B3eT8v8h.js} +1 -1
  14. package/web/assets/{chunk-MOJQB5TN-CUsuypcn.js → chunk-MOJQB5TN-CTduFJG_.js} +1 -1
  15. package/web/assets/{chunk-RYQCIY6F-DTj6fDVR.js → chunk-RYQCIY6F-CwVsCKni.js} +1 -1
  16. package/web/assets/{chunk-V7JOEXUC-3B0V4tK-.js → chunk-V7JOEXUC-DuYm5ISe.js} +1 -1
  17. package/web/assets/{chunk-VR4S4FIN-933u5QFk.js → chunk-VR4S4FIN-DOGM8M0x.js} +1 -1
  18. package/web/assets/{chunk-XXDRQBXY-BuQHtbgG.js → chunk-XXDRQBXY-D1lUnqR9.js} +1 -1
  19. package/web/assets/classDiagram-OUVF2IWQ-ljhJH3EO.js +1 -0
  20. package/web/assets/classDiagram-v2-EOCWNBFH-ljhJH3EO.js +1 -0
  21. package/web/assets/{cose-bilkent-JH36ORCC-D2Ox0GKS.js → cose-bilkent-JH36ORCC-F0vY69Q1.js} +1 -1
  22. package/web/assets/{cynefin-VYW2F7L2-DGhrso25.js → cynefin-VYW2F7L2-D1bEJ_1X.js} +1 -1
  23. package/web/assets/{cynefinDiagram-TSTJHNR4-D4Q-LXpN.js → cynefinDiagram-TSTJHNR4-C5i6TpKM.js} +1 -1
  24. package/web/assets/{dagre-VKFMJZFB-CJfklujy.js → dagre-VKFMJZFB-BaJhQrcg.js} +1 -1
  25. package/web/assets/{diagram-FQU43EPY-F0ZWNO9a.js → diagram-FQU43EPY-B5s2GugH.js} +1 -1
  26. package/web/assets/{diagram-G47NLZAW-Ciek2h0T.js → diagram-G47NLZAW-CqhWh7wb.js} +1 -1
  27. package/web/assets/{diagram-NH7WQ7WH-mqZiVoIz.js → diagram-NH7WQ7WH-Be8CFL2y.js} +1 -1
  28. package/web/assets/{diagram-OA4YK3LP-phwbNcHF.js → diagram-OA4YK3LP-CdVytGiC.js} +1 -1
  29. package/web/assets/{diagram-WEI45ONY-KqTSh5op.js → diagram-WEI45ONY-CimHxyF4.js} +1 -1
  30. package/web/assets/{ebnfDiagram-CCIWWBDH-Luse_OCu.js → ebnfDiagram-CCIWWBDH-B5h3rL5s.js} +1 -1
  31. package/web/assets/{erDiagram-Q63AITRT-MzmMexMX.js → erDiagram-Q63AITRT-CEP5X1_j.js} +1 -1
  32. package/web/assets/{flowDiagram-23GEKE2U-D3aTzPI3.js → flowDiagram-23GEKE2U-xuryGu7o.js} +1 -1
  33. package/web/assets/{ganttDiagram-NO4QXBWP-Dg-id9Bc.js → ganttDiagram-NO4QXBWP-DAE1Z40G.js} +1 -1
  34. package/web/assets/{gitGraphDiagram-IHSO6WYX-CbL2lxkt.js → gitGraphDiagram-IHSO6WYX-CJBqjaw2.js} +1 -1
  35. package/web/assets/index-DHKNoyPu.css +10 -0
  36. package/web/assets/index-DZcQ8cq-.js +121 -0
  37. package/web/assets/{infoDiagram-FWYZ7A6U-Bf2JsxPr.js → infoDiagram-FWYZ7A6U-CZ4YANgy.js} +1 -1
  38. package/web/assets/{ishikawaDiagram-FXEZZL3T-DM318yNh.js → ishikawaDiagram-FXEZZL3T-CClm-Sn4.js} +1 -1
  39. package/web/assets/{journeyDiagram-5HDEW3XC-B102VNUm.js → journeyDiagram-5HDEW3XC-BifxEcxw.js} +1 -1
  40. package/web/assets/{kanban-definition-HUTT4EX6-C322CzSK.js → kanban-definition-HUTT4EX6-DEstl5u8.js} +1 -1
  41. package/web/assets/{linear-DuTPYaS2.js → linear-DFGFp-ES.js} +1 -1
  42. package/web/assets/{mermaid.core-D4tbD1m5.js → mermaid.core-D2L8Rtb7.js} +4 -4
  43. package/web/assets/{mindmap-definition-LN4V7U3C-R0ha73bh.js → mindmap-definition-LN4V7U3C-BaYXUjOF.js} +1 -1
  44. package/web/assets/{pegDiagram-2B236MQR-DLy3SVUO.js → pegDiagram-2B236MQR-DCE72-8K.js} +1 -1
  45. package/web/assets/{pieDiagram-ENE6RG2P-HTsWWOy-.js → pieDiagram-ENE6RG2P-32NA7bXp.js} +1 -1
  46. package/web/assets/{quadrantDiagram-ABIIQ3AL-DlR06Qj-.js → quadrantDiagram-ABIIQ3AL-BBziNWms.js} +1 -1
  47. package/web/assets/{railroadDiagram-RFXS5EU6-mS4NKjCn.js → railroadDiagram-RFXS5EU6-CPa5am_S.js} +1 -1
  48. package/web/assets/{requirementDiagram-TGXJPOKE-DmbolwtN.js → requirementDiagram-TGXJPOKE-CPcFcu10.js} +1 -1
  49. package/web/assets/{sankeyDiagram-HTMAVEWB-tkVZfmPQ.js → sankeyDiagram-HTMAVEWB-DUrSTgld.js} +1 -1
  50. package/web/assets/{sequenceDiagram-DBY2YBRQ-Nixs1-BF.js → sequenceDiagram-DBY2YBRQ-Bem4ofsM.js} +1 -1
  51. package/web/assets/{sizeCapture-X5ZJPWSS-DCFX0D3z.js → sizeCapture-X5ZJPWSS-D0nColKd.js} +1 -1
  52. package/web/assets/{stateDiagram-2N3HPSRC-CUWZf2VQ.js → stateDiagram-2N3HPSRC-Fd7AhaTH.js} +1 -1
  53. package/web/assets/stateDiagram-v2-6OUMAXLB-DkJN7koK.js +1 -0
  54. package/web/assets/{swimlanes-5IMT3BWC-D7R_sYxN.js → swimlanes-5IMT3BWC-1Lc6dTz0.js} +2 -2
  55. package/web/assets/swimlanesDiagram-G3AALYLV-CnY2Vcjb.js +8 -0
  56. package/web/assets/{timeline-definition-FHXFAJF6-CTRGxKV6.js → timeline-definition-FHXFAJF6-Buz7EWxM.js} +1 -1
  57. package/web/assets/{vennDiagram-L72KCM5P-DzPCEPeR.js → vennDiagram-L72KCM5P-oTEYn7-i.js} +1 -1
  58. package/web/assets/{wardleyDiagram-EHGQE667-DD6cej5Z.js → wardleyDiagram-EHGQE667-BLo-yQ5P.js} +1 -1
  59. package/web/assets/{xychartDiagram-FW5EYKEG-DuMPTT7s.js → xychartDiagram-FW5EYKEG-DEdu279q.js} +1 -1
  60. package/web/assets/{zh-TW-CWgKQVJ3.js → zh-TW-CyqgrzJC.js} +1 -1
  61. package/web/index.html +2 -2
  62. package/web/assets/channel-C4cA5nCW.js +0 -1
  63. package/web/assets/classDiagram-OUVF2IWQ-FFVx9rLD.js +0 -1
  64. package/web/assets/classDiagram-v2-EOCWNBFH-FFVx9rLD.js +0 -1
  65. package/web/assets/index-3SDqFyb4.js +0 -121
  66. package/web/assets/index-BpPso_Ms.css +0 -10
  67. package/web/assets/stateDiagram-v2-6OUMAXLB-BOuwbXW6.js +0 -1
  68. package/web/assets/swimlanesDiagram-G3AALYLV-cCeiPbcb.js +0 -8
@@ -1,121 +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 za=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lC={exports:{}},Iu={},cC={exports:{}},ht={};/**
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 ml=Symbol.for("react.element"),FR=Symbol.for("react.portal"),BR=Symbol.for("react.fragment"),zR=Symbol.for("react.strict_mode"),UR=Symbol.for("react.profiler"),qR=Symbol.for("react.provider"),$R=Symbol.for("react.context"),HR=Symbol.for("react.forward_ref"),WR=Symbol.for("react.suspense"),VR=Symbol.for("react.memo"),GR=Symbol.for("react.lazy"),Tv=Symbol.iterator;function KR(e){return e===null||typeof e!="object"?null:(e=Tv&&e[Tv]||e["@@iterator"],typeof e=="function"?e:null)}var uC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dC=Object.assign,fC={};function Ds(e,t,n){this.props=e,this.context=t,this.refs=fC,this.updater=n||uC}Ds.prototype.isReactComponent={};Ds.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")};Ds.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gC(){}gC.prototype=Ds.prototype;function wx(e,t,n){this.props=e,this.context=t,this.refs=fC,this.updater=n||uC}var Ex=wx.prototype=new gC;Ex.constructor=wx;dC(Ex,Ds.prototype);Ex.isPureReactComponent=!0;var Av=Array.isArray,pC=Object.prototype.hasOwnProperty,Nx={current:null},hC={key:!0,ref:!0,__self:!0,__source:!0};function mC(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)pC.call(t,r)&&!hC.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:ml,type:e,key:i,ref:s,props:a,_owner:Nx.current}}function YR(e,t){return{$$typeof:ml,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Sx(e){return typeof e=="object"&&e!==null&&e.$$typeof===ml}function QR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Rv=/\/+/g;function Yd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?QR(""+e.key):t.toString(36)}function Mc(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 ml:case FR:s=!0}}if(s)return s=e,a=a(s),e=r===""?"."+Yd(s,0):r,Av(a)?(n="",e!=null&&(n=e.replace(Rv,"$&/")+"/"),Mc(a,t,n,"",function(u){return u})):a!=null&&(Sx(a)&&(a=YR(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(Rv,"$&/")+"/")+e)),t.push(a)),1;if(s=0,r=r===""?".":r+":",Av(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Yd(i,l);s+=Mc(i,t,n,c,a)}else if(c=KR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Yd(i,l++),s+=Mc(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 Vl(e,t,n){if(e==null)return e;var r=[],a=0;return Mc(e,r,"","",function(i){return t.call(n,i,a++)}),r}function XR(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 Bn={current:null},Ic={transition:null},ZR={ReactCurrentDispatcher:Bn,ReactCurrentBatchConfig:Ic,ReactCurrentOwner:Nx};function yC(){throw Error("act(...) is not supported in production builds of React.")}ht.Children={map:Vl,forEach:function(e,t,n){Vl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vl(e,function(){t++}),t},toArray:function(e){return Vl(e,function(t){return t})||[]},only:function(e){if(!Sx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ht.Component=Ds;ht.Fragment=BR;ht.Profiler=UR;ht.PureComponent=wx;ht.StrictMode=zR;ht.Suspense=WR;ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ZR;ht.act=yC;ht.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=dC({},e.props),a=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Nx.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)pC.call(t,c)&&!hC.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:ml,type:e.type,key:a,ref:i,props:r,_owner:s}};ht.createContext=function(e){return e={$$typeof:$R,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:qR,_context:e},e.Consumer=e};ht.createElement=mC;ht.createFactory=function(e){var t=mC.bind(null,e);return t.type=e,t};ht.createRef=function(){return{current:null}};ht.forwardRef=function(e){return{$$typeof:HR,render:e}};ht.isValidElement=Sx;ht.lazy=function(e){return{$$typeof:GR,_payload:{_status:-1,_result:e},_init:XR}};ht.memo=function(e,t){return{$$typeof:VR,type:e,compare:t===void 0?null:t}};ht.startTransition=function(e){var t=Ic.transition;Ic.transition={};try{e()}finally{Ic.transition=t}};ht.unstable_act=yC;ht.useCallback=function(e,t){return Bn.current.useCallback(e,t)};ht.useContext=function(e){return Bn.current.useContext(e)};ht.useDebugValue=function(){};ht.useDeferredValue=function(e){return Bn.current.useDeferredValue(e)};ht.useEffect=function(e,t){return Bn.current.useEffect(e,t)};ht.useId=function(){return Bn.current.useId()};ht.useImperativeHandle=function(e,t,n){return Bn.current.useImperativeHandle(e,t,n)};ht.useInsertionEffect=function(e,t){return Bn.current.useInsertionEffect(e,t)};ht.useLayoutEffect=function(e,t){return Bn.current.useLayoutEffect(e,t)};ht.useMemo=function(e,t){return Bn.current.useMemo(e,t)};ht.useReducer=function(e,t,n){return Bn.current.useReducer(e,t,n)};ht.useRef=function(e){return Bn.current.useRef(e)};ht.useState=function(e){return Bn.current.useState(e)};ht.useSyncExternalStore=function(e,t,n){return Bn.current.useSyncExternalStore(e,t,n)};ht.useTransition=function(){return Bn.current.useTransition()};ht.version="18.3.1";cC.exports=ht;var h=cC.exports;const JR=hl(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 e3=h,t3=Symbol.for("react.element"),n3=Symbol.for("react.fragment"),r3=Object.prototype.hasOwnProperty,a3=e3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i3={key:!0,ref:!0,__self:!0,__source:!0};function xC(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)r3.call(t,r)&&!i3.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:t3,type:e,key:i,ref:s,props:a,_owner:a3.current}}Iu.Fragment=n3;Iu.jsx=xC;Iu.jsxs=xC;lC.exports=Iu;var o=lC.exports,Z0={},bC={exports:{}},sr={},vC={exports:{}},kC={};/**
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(F,Q){var S=F.length;F.push(Q);e:for(;0<S;){var Y=S-1>>>1,V=F[Y];if(0<a(V,Q))F[Y]=Q,F[S]=V,S=Y;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var Q=F[0],S=F.pop();if(S!==Q){F[0]=S;e:for(var Y=0,V=F.length,j=V>>>1;Y<j;){var $=2*(Y+1)-1,ce=F[$],J=$+1,_e=F[J];if(0>a(ce,S))J<V&&0>a(_e,ce)?(F[Y]=_e,F[J]=S,Y=J):(F[Y]=ce,F[$]=S,Y=$);else if(J<V&&0>a(_e,S))F[Y]=_e,F[J]=S,Y=J;else break e}}return Q}function a(F,Q){var S=F.sortIndex-Q.sortIndex;return S!==0?S:F.id-Q.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(F){for(var Q=n(u);Q!==null;){if(Q.callback===null)r(u);else if(Q.startTime<=F)r(u),Q.sortIndex=Q.expirationTime,t(c,Q);else break;Q=n(u)}}function N(F){if(y=!1,k(F),!m)if(n(c)!==null)m=!0,C(E);else{var Q=n(u);Q!==null&&L(N,Q.startTime-F)}}function E(F,Q){m=!1,y&&(y=!1,x(R),R=-1),p=!0;var S=g;try{for(k(Q),f=n(c);f!==null&&(!(f.expirationTime>Q)||F&&!q());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,g=f.priorityLevel;var V=Y(f.expirationTime<=Q);Q=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),k(Q)}else r(c);f=n(c)}if(f!==null)var j=!0;else{var $=n(u);$!==null&&L(N,$.startTime-Q),j=!1}return j}finally{f=null,g=S,p=!1}}var w=!1,T=null,R=-1,D=5,A=-1;function q(){return!(e.unstable_now()-A<D)}function U(){if(T!==null){var F=e.unstable_now();A=F;var Q=!0;try{Q=T(!0,F)}finally{Q?K():(w=!1,T=null)}}else w=!1}var K;if(typeof b=="function")K=function(){b(U)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,M=P.port2;P.port1.onmessage=U,K=function(){M.postMessage(null)}}else K=function(){v(U,0)};function C(F){T=F,w||(w=!0,K())}function L(F,Q){R=v(function(){F(e.unstable_now())},Q)}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(F){F.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,C(E))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(F){switch(g){case 1:case 2:case 3:var Q=3;break;default:Q=g}var S=g;g=Q;try{return F()}finally{g=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,Q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var S=g;g=F;try{return Q()}finally{g=S}},e.unstable_scheduleCallback=function(F,Q,S){var Y=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?Y+S:Y):S=Y,F){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=S+V,F={id:d++,callback:Q,priorityLevel:F,startTime:S,expirationTime:V,sortIndex:-1},S>Y?(F.sortIndex=S,t(u,F),n(c)===null&&F===n(u)&&(y?(x(R),R=-1):y=!0,L(N,S-Y))):(F.sortIndex=V,t(c,F),m||p||(m=!0,C(E))),F},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(F){var Q=g;return function(){var S=g;g=Q;try{return F.apply(this,arguments)}finally{g=S}}}})(kC);vC.exports=kC;var s3=vC.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 o3=h,ir=s3;function je(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 _C=new Set,Wo={};function Oi(e,t){Cs(e,t),Cs(e+"Capture",t)}function Cs(e,t){for(Wo[e]=t,e=0;e<t.length;e++)_C.add(t[e])}var pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),J0=Object.prototype.hasOwnProperty,l3=/^[: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]*$/,Mv={},Iv={};function c3(e){return J0.call(Iv,e)?!0:J0.call(Mv,e)?!1:l3.test(e)?Iv[e]=!0:(Mv[e]=!0,!1)}function u3(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 d3(e,t,n,r){if(t===null||typeof t>"u"||u3(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 zn(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 En={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){En[e]=new zn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];En[t]=new zn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){En[e]=new zn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){En[e]=new zn(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){En[e]=new zn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){En[e]=new zn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){En[e]=new zn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){En[e]=new zn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){En[e]=new zn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Cx=/[\-:]([a-z])/g;function jx(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(Cx,jx);En[t]=new zn(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(Cx,jx);En[t]=new zn(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(Cx,jx);En[t]=new zn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){En[e]=new zn(e,1,!1,e.toLowerCase(),null,!1,!1)});En.xlinkHref=new zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){En[e]=new zn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Tx(e,t,n,r){var a=En.hasOwnProperty(t)?En[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(d3(t,n,a,r)&&(n=null),r||a===null?c3(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 ba=o3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Gl=Symbol.for("react.element"),ls=Symbol.for("react.portal"),cs=Symbol.for("react.fragment"),Ax=Symbol.for("react.strict_mode"),ey=Symbol.for("react.profiler"),wC=Symbol.for("react.provider"),EC=Symbol.for("react.context"),Rx=Symbol.for("react.forward_ref"),ty=Symbol.for("react.suspense"),ny=Symbol.for("react.suspense_list"),Mx=Symbol.for("react.memo"),La=Symbol.for("react.lazy"),NC=Symbol.for("react.offscreen"),Lv=Symbol.iterator;function ao(e){return e===null||typeof e!="object"?null:(e=Lv&&e[Lv]||e["@@iterator"],typeof e=="function"?e:null)}var Qt=Object.assign,Qd;function vo(e){if(Qd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Qd=t&&t[1]||""}return`
34
- `+Qd+e}var Xd=!1;function Zd(e,t){if(!e||Xd)return"";Xd=!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{Xd=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?vo(e):""}function f3(e){switch(e.tag){case 5:return vo(e.type);case 16:return vo("Lazy");case 13:return vo("Suspense");case 19:return vo("SuspenseList");case 0:case 2:case 15:return e=Zd(e.type,!1),e;case 11:return e=Zd(e.type.render,!1),e;case 1:return e=Zd(e.type,!0),e;default:return""}}function ry(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 cs:return"Fragment";case ls:return"Portal";case ey:return"Profiler";case Ax:return"StrictMode";case ty:return"Suspense";case ny:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case EC:return(e.displayName||"Context")+".Consumer";case wC:return(e._context.displayName||"Context")+".Provider";case Rx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mx:return t=e.displayName||null,t!==null?t:ry(e.type)||"Memo";case La:t=e._payload,e=e._init;try{return ry(e(t))}catch{}}return null}function g3(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 ry(t);case 8:return t===Ax?"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 ei(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function SC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function p3(e){var t=SC(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 Kl(e){e._valueTracker||(e._valueTracker=p3(e))}function CC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=SC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Kc(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 ay(e,t){var n=t.checked;return Qt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ov(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ei(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 jC(e,t){t=t.checked,t!=null&&Tx(e,"checked",t,!1)}function iy(e,t){jC(e,t);var n=ei(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")?sy(e,t.type,n):t.hasOwnProperty("defaultValue")&&sy(e,t.type,ei(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Dv(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 sy(e,t,n){(t!=="number"||Kc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ko=Array.isArray;function vs(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=""+ei(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 oy(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(je(91));return Qt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(je(92));if(ko(n)){if(1<n.length)throw Error(je(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ei(n)}}function TC(e,t){var n=ei(t.value),r=ei(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 Fv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function AC(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 ly(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?AC(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yl,RC=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(Yl=Yl||document.createElement("div"),Yl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ro={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},h3=["Webkit","ms","Moz","O"];Object.keys(Ro).forEach(function(e){h3.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ro[t]=Ro[e]})});function MC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ro.hasOwnProperty(e)&&Ro[e]?(""+t).trim():t+"px"}function IC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=MC(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var m3=Qt({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 cy(e,t){if(t){if(m3[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(je(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(je(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(je(61))}if(t.style!=null&&typeof t.style!="object")throw Error(je(62))}}function uy(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 dy=null;function Ix(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fy=null,ks=null,_s=null;function Bv(e){if(e=bl(e)){if(typeof fy!="function")throw Error(je(280));var t=e.stateNode;t&&(t=Fu(t),fy(e.stateNode,e.type,t))}}function LC(e){ks?_s?_s.push(e):_s=[e]:ks=e}function OC(){if(ks){var e=ks,t=_s;if(_s=ks=null,Bv(e),t)for(e=0;e<t.length;e++)Bv(t[e])}}function DC(e,t){return e(t)}function PC(){}var Jd=!1;function FC(e,t,n){if(Jd)return e(t,n);Jd=!0;try{return DC(e,t,n)}finally{Jd=!1,(ks!==null||_s!==null)&&(PC(),OC())}}function Go(e,t){var n=e.stateNode;if(n===null)return null;var r=Fu(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(je(231,t,typeof n));return n}var gy=!1;if(pa)try{var io={};Object.defineProperty(io,"passive",{get:function(){gy=!0}}),window.addEventListener("test",io,io),window.removeEventListener("test",io,io)}catch{gy=!1}function y3(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 Mo=!1,Yc=null,Qc=!1,py=null,x3={onError:function(e){Mo=!0,Yc=e}};function b3(e,t,n,r,a,i,s,l,c){Mo=!1,Yc=null,y3.apply(x3,arguments)}function v3(e,t,n,r,a,i,s,l,c){if(b3.apply(this,arguments),Mo){if(Mo){var u=Yc;Mo=!1,Yc=null}else throw Error(je(198));Qc||(Qc=!0,py=u)}}function Di(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 BC(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 zv(e){if(Di(e)!==e)throw Error(je(188))}function k3(e){var t=e.alternate;if(!t){if(t=Di(e),t===null)throw Error(je(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 zv(a),e;if(i===r)return zv(a),t;i=i.sibling}throw Error(je(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(je(189))}}if(n.alternate!==r)throw Error(je(190))}if(n.tag!==3)throw Error(je(188));return n.stateNode.current===n?e:t}function zC(e){return e=k3(e),e!==null?UC(e):null}function UC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=UC(e);if(t!==null)return t;e=e.sibling}return null}var qC=ir.unstable_scheduleCallback,Uv=ir.unstable_cancelCallback,_3=ir.unstable_shouldYield,w3=ir.unstable_requestPaint,en=ir.unstable_now,E3=ir.unstable_getCurrentPriorityLevel,Lx=ir.unstable_ImmediatePriority,$C=ir.unstable_UserBlockingPriority,Xc=ir.unstable_NormalPriority,N3=ir.unstable_LowPriority,HC=ir.unstable_IdlePriority,Lu=null,Hr=null;function S3(e){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Lu,e,void 0,(e.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:T3,C3=Math.log,j3=Math.LN2;function T3(e){return e>>>=0,e===0?32:31-(C3(e)/j3|0)|0}var Ql=64,Xl=4194304;function _o(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 Zc(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=_o(l):(i&=s,i!==0&&(r=_o(i)))}else s=n&~a,s!==0?r=_o(s):i!==0&&(r=_o(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-Tr(t),a=1<<n,r|=e[n],t&=~a;return r}function A3(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 R3(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Tr(i),l=1<<s,c=a[s];c===-1?(!(l&n)||l&r)&&(a[s]=A3(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function hy(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function WC(){var e=Ql;return Ql<<=1,!(Ql&4194240)&&(Ql=64),e}function ef(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tr(t),e[t]=n}function M3(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-Tr(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function Ox(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tr(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var At=0;function VC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var GC,Dx,KC,YC,QC,my=!1,Zl=[],Wa=null,Va=null,Ga=null,Ko=new Map,Yo=new Map,Da=[],I3="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 qv(e,t){switch(e){case"focusin":case"focusout":Wa=null;break;case"dragenter":case"dragleave":Va=null;break;case"mouseover":case"mouseout":Ga=null;break;case"pointerover":case"pointerout":Ko.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yo.delete(t.pointerId)}}function so(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=bl(t),t!==null&&Dx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function L3(e,t,n,r,a){switch(t){case"focusin":return Wa=so(Wa,e,t,n,r,a),!0;case"dragenter":return Va=so(Va,e,t,n,r,a),!0;case"mouseover":return Ga=so(Ga,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Ko.set(i,so(Ko.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Yo.set(i,so(Yo.get(i)||null,e,t,n,r,a)),!0}return!1}function XC(e){var t=vi(e.target);if(t!==null){var n=Di(t);if(n!==null){if(t=n.tag,t===13){if(t=BC(n),t!==null){e.blockedOn=t,QC(e.priority,function(){KC(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 Lc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);dy=r,n.target.dispatchEvent(r),dy=null}else return t=bl(n),t!==null&&Dx(t),e.blockedOn=n,!1;t.shift()}return!0}function $v(e,t,n){Lc(e)&&n.delete(t)}function O3(){my=!1,Wa!==null&&Lc(Wa)&&(Wa=null),Va!==null&&Lc(Va)&&(Va=null),Ga!==null&&Lc(Ga)&&(Ga=null),Ko.forEach($v),Yo.forEach($v)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,my||(my=!0,ir.unstable_scheduleCallback(ir.unstable_NormalPriority,O3)))}function Qo(e){function t(a){return oo(a,e)}if(0<Zl.length){oo(Zl[0],e);for(var n=1;n<Zl.length;n++){var r=Zl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wa!==null&&oo(Wa,e),Va!==null&&oo(Va,e),Ga!==null&&oo(Ga,e),Ko.forEach(t),Yo.forEach(t),n=0;n<Da.length;n++)r=Da[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Da.length&&(n=Da[0],n.blockedOn===null);)XC(n),n.blockedOn===null&&Da.shift()}var ws=ba.ReactCurrentBatchConfig,Jc=!0;function D3(e,t,n,r){var a=At,i=ws.transition;ws.transition=null;try{At=1,Px(e,t,n,r)}finally{At=a,ws.transition=i}}function P3(e,t,n,r){var a=At,i=ws.transition;ws.transition=null;try{At=4,Px(e,t,n,r)}finally{At=a,ws.transition=i}}function Px(e,t,n,r){if(Jc){var a=yy(e,t,n,r);if(a===null)df(e,t,r,eu,n),qv(e,r);else if(L3(a,e,t,n,r))r.stopPropagation();else if(qv(e,r),t&4&&-1<I3.indexOf(e)){for(;a!==null;){var i=bl(a);if(i!==null&&GC(i),i=yy(e,t,n,r),i===null&&df(e,t,r,eu,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else df(e,t,r,null,n)}}var eu=null;function yy(e,t,n,r){if(eu=null,e=Ix(r),e=vi(e),e!==null)if(t=Di(e),t===null)e=null;else if(n=t.tag,n===13){if(e=BC(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 eu=e,null}function ZC(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(E3()){case Lx:return 1;case $C:return 4;case Xc:case N3:return 16;case HC:return 536870912;default:return 16}default:return 16}}var Ua=null,Fx=null,Oc=null;function JC(){if(Oc)return Oc;var e,t=Fx,n=t.length,r,a="value"in Ua?Ua.value:Ua.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 Oc=a.slice(e,1<r?1-r:void 0)}function Dc(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 Jl(){return!0}function Hv(){return!1}function or(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)?Jl:Hv,this.isPropagationStopped=Hv,this}return Qt(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=Jl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Jl)},persist:function(){},isPersistent:Jl}),t}var Ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bx=or(Ps),xl=Qt({},Ps,{view:0,detail:0}),F3=or(xl),tf,nf,lo,Ou=Qt({},xl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zx,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!==lo&&(lo&&e.type==="mousemove"?(tf=e.screenX-lo.screenX,nf=e.screenY-lo.screenY):nf=tf=0,lo=e),tf)},movementY:function(e){return"movementY"in e?e.movementY:nf}}),Wv=or(Ou),B3=Qt({},Ou,{dataTransfer:0}),z3=or(B3),U3=Qt({},xl,{relatedTarget:0}),rf=or(U3),q3=Qt({},Ps,{animationName:0,elapsedTime:0,pseudoElement:0}),$3=or(q3),H3=Qt({},Ps,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),W3=or(H3),V3=Qt({},Ps,{data:0}),Vv=or(V3),G3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K3={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"},Y3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Q3(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Y3[e])?!!t[e]:!1}function zx(){return Q3}var X3=Qt({},xl,{key:function(e){if(e.key){var t=G3[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Dc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?K3[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zx,charCode:function(e){return e.type==="keypress"?Dc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Dc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Z3=or(X3),J3=Qt({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gv=or(J3),eM=Qt({},xl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zx}),tM=or(eM),nM=Qt({},Ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),rM=or(nM),aM=Qt({},Ou,{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}),iM=or(aM),sM=[9,13,27,32],Ux=pa&&"CompositionEvent"in window,Io=null;pa&&"documentMode"in document&&(Io=document.documentMode);var oM=pa&&"TextEvent"in window&&!Io,e4=pa&&(!Ux||Io&&8<Io&&11>=Io),Kv=" ",Yv=!1;function t4(e,t){switch(e){case"keyup":return sM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function n4(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var us=!1;function lM(e,t){switch(e){case"compositionend":return n4(t);case"keypress":return t.which!==32?null:(Yv=!0,Kv);case"textInput":return e=t.data,e===Kv&&Yv?null:e;default:return null}}function cM(e,t){if(us)return e==="compositionend"||!Ux&&t4(e,t)?(e=JC(),Oc=Fx=Ua=null,us=!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 e4&&t.locale!=="ko"?null:t.data;default:return null}}var uM={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 Qv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!uM[e.type]:t==="textarea"}function r4(e,t,n,r){LC(r),t=tu(t,"onChange"),0<t.length&&(n=new Bx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Lo=null,Xo=null;function dM(e){p4(e,0)}function Du(e){var t=gs(e);if(CC(t))return e}function fM(e,t){if(e==="change")return t}var a4=!1;if(pa){var af;if(pa){var sf="oninput"in document;if(!sf){var Xv=document.createElement("div");Xv.setAttribute("oninput","return;"),sf=typeof Xv.oninput=="function"}af=sf}else af=!1;a4=af&&(!document.documentMode||9<document.documentMode)}function Zv(){Lo&&(Lo.detachEvent("onpropertychange",i4),Xo=Lo=null)}function i4(e){if(e.propertyName==="value"&&Du(Xo)){var t=[];r4(t,Xo,e,Ix(e)),FC(dM,t)}}function gM(e,t,n){e==="focusin"?(Zv(),Lo=t,Xo=n,Lo.attachEvent("onpropertychange",i4)):e==="focusout"&&Zv()}function pM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Du(Xo)}function hM(e,t){if(e==="click")return Du(t)}function mM(e,t){if(e==="input"||e==="change")return Du(t)}function yM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mr=typeof Object.is=="function"?Object.is:yM;function Zo(e,t){if(Mr(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(!J0.call(t,a)||!Mr(e[a],t[a]))return!1}return!0}function Jv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function e1(e,t){var n=Jv(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=Jv(n)}}function s4(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?s4(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function o4(){for(var e=window,t=Kc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Kc(e.document)}return t}function qx(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 xM(e){var t=o4(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&s4(n.ownerDocument.documentElement,n)){if(r!==null&&qx(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=e1(n,i);var s=e1(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 bM=pa&&"documentMode"in document&&11>=document.documentMode,ds=null,xy=null,Oo=null,by=!1;function t1(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;by||ds==null||ds!==Kc(r)||(r=ds,"selectionStart"in r&&qx(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}),Oo&&Zo(Oo,r)||(Oo=r,r=tu(xy,"onSelect"),0<r.length&&(t=new Bx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ds)))}function ec(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fs={animationend:ec("Animation","AnimationEnd"),animationiteration:ec("Animation","AnimationIteration"),animationstart:ec("Animation","AnimationStart"),transitionend:ec("Transition","TransitionEnd")},of={},l4={};pa&&(l4=document.createElement("div").style,"AnimationEvent"in window||(delete fs.animationend.animation,delete fs.animationiteration.animation,delete fs.animationstart.animation),"TransitionEvent"in window||delete fs.transitionend.transition);function Pu(e){if(of[e])return of[e];if(!fs[e])return e;var t=fs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in l4)return of[e]=t[n];return e}var c4=Pu("animationend"),u4=Pu("animationiteration"),d4=Pu("animationstart"),f4=Pu("transitionend"),g4=new Map,n1="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 ri(e,t){g4.set(e,t),Oi(t,[e])}for(var lf=0;lf<n1.length;lf++){var cf=n1[lf],vM=cf.toLowerCase(),kM=cf[0].toUpperCase()+cf.slice(1);ri(vM,"on"+kM)}ri(c4,"onAnimationEnd");ri(u4,"onAnimationIteration");ri(d4,"onAnimationStart");ri("dblclick","onDoubleClick");ri("focusin","onFocus");ri("focusout","onBlur");ri(f4,"onTransitionEnd");Cs("onMouseEnter",["mouseout","mouseover"]);Cs("onMouseLeave",["mouseout","mouseover"]);Cs("onPointerEnter",["pointerout","pointerover"]);Cs("onPointerLeave",["pointerout","pointerover"]);Oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Oi("onBeforeInput",["compositionend","keypress","textInput","paste"]);Oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wo="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(" "),_M=new Set("cancel close invalid load scroll toggle".split(" ").concat(wo));function r1(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,v3(r,t,void 0,e),e.currentTarget=null}function p4(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;r1(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;r1(a,l,u),i=c}}}if(Qc)throw e=py,Qc=!1,py=null,e}function qt(e,t){var n=t[Ey];n===void 0&&(n=t[Ey]=new Set);var r=e+"__bubble";n.has(r)||(h4(t,e,2,!1),n.add(r))}function uf(e,t,n){var r=0;t&&(r|=4),h4(n,e,r,t)}var tc="_reactListening"+Math.random().toString(36).slice(2);function Jo(e){if(!e[tc]){e[tc]=!0,_C.forEach(function(n){n!=="selectionchange"&&(_M.has(n)||uf(n,!1,e),uf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[tc]||(t[tc]=!0,uf("selectionchange",!1,t))}}function h4(e,t,n,r){switch(ZC(t)){case 1:var a=D3;break;case 4:a=P3;break;default:a=Px}n=a.bind(null,t,n,e),a=void 0,!gy||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 df(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=vi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}FC(function(){var u=i,d=Ix(n),f=[];e:{var g=g4.get(e);if(g!==void 0){var p=Bx,m=e;switch(e){case"keypress":if(Dc(n)===0)break e;case"keydown":case"keyup":p=Z3;break;case"focusin":m="focus",p=rf;break;case"focusout":m="blur",p=rf;break;case"beforeblur":case"afterblur":p=rf;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=Wv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=z3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=tM;break;case c4:case u4:case d4:p=$3;break;case f4:p=rM;break;case"scroll":p=F3;break;case"wheel":p=iM;break;case"copy":case"cut":case"paste":p=W3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Gv}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=Go(b,x),N!=null&&y.push(el(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!==dy&&(m=n.relatedTarget||n.fromElement)&&(vi(m)||m[ha]))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?vi(m):null,m!==null&&(v=Di(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(y=Wv,N="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=Gv,N="onPointerLeave",x="onPointerEnter",b="pointer"),v=p==null?g:gs(p),k=m==null?g:gs(m),g=new y(N,b+"leave",p,n,d),g.target=v,g.relatedTarget=k,N=null,vi(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=Zi(k))b++;for(k=0,N=x;N;N=Zi(N))k++;for(;0<b-k;)y=Zi(y),b--;for(;0<k-b;)x=Zi(x),k--;for(;b--;){if(y===x||x!==null&&y===x.alternate)break t;y=Zi(y),x=Zi(x)}y=null}else y=null;p!==null&&a1(f,g,p,y,!1),m!==null&&v!==null&&a1(f,v,m,y,!0)}}e:{if(g=u?gs(u):window,p=g.nodeName&&g.nodeName.toLowerCase(),p==="select"||p==="input"&&g.type==="file")var E=fM;else if(Qv(g))if(a4)E=mM;else{E=pM;var w=gM}else(p=g.nodeName)&&p.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(E=hM);if(E&&(E=E(e,u))){r4(f,E,n,d);break e}w&&w(e,g,u),e==="focusout"&&(w=g._wrapperState)&&w.controlled&&g.type==="number"&&sy(g,"number",g.value)}switch(w=u?gs(u):window,e){case"focusin":(Qv(w)||w.contentEditable==="true")&&(ds=w,xy=u,Oo=null);break;case"focusout":Oo=xy=ds=null;break;case"mousedown":by=!0;break;case"contextmenu":case"mouseup":case"dragend":by=!1,t1(f,n,d);break;case"selectionchange":if(bM)break;case"keydown":case"keyup":t1(f,n,d)}var T;if(Ux)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else us?t4(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(e4&&n.locale!=="ko"&&(us||R!=="onCompositionStart"?R==="onCompositionEnd"&&us&&(T=JC()):(Ua=d,Fx="value"in Ua?Ua.value:Ua.textContent,us=!0)),w=tu(u,R),0<w.length&&(R=new Vv(R,e,null,n,d),f.push({event:R,listeners:w}),T?R.data=T:(T=n4(n),T!==null&&(R.data=T)))),(T=oM?lM(e,n):cM(e,n))&&(u=tu(u,"onBeforeInput"),0<u.length&&(d=new Vv("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=T))}p4(f,t)})}function el(e,t,n){return{instance:e,listener:t,currentTarget:n}}function tu(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Go(e,n),i!=null&&r.unshift(el(e,i,a)),i=Go(e,t),i!=null&&r.push(el(e,i,a))),e=e.return}return r}function Zi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function a1(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=Go(n,i),c!=null&&s.unshift(el(n,c,l))):a||(c=Go(n,i),c!=null&&s.push(el(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var wM=/\r\n?/g,EM=/\u0000|\uFFFD/g;function i1(e){return(typeof e=="string"?e:""+e).replace(wM,`
38
- `).replace(EM,"")}function nc(e,t,n){if(t=i1(t),i1(e)!==t&&n)throw Error(je(425))}function nu(){}var vy=null,ky=null;function _y(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 wy=typeof setTimeout=="function"?setTimeout:void 0,NM=typeof clearTimeout=="function"?clearTimeout:void 0,s1=typeof Promise=="function"?Promise:void 0,SM=typeof queueMicrotask=="function"?queueMicrotask:typeof s1<"u"?function(e){return s1.resolve(null).then(e).catch(CM)}:wy;function CM(e){setTimeout(function(){throw e})}function ff(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),Qo(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Qo(t)}function Ka(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 o1(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 Fs=Math.random().toString(36).slice(2),qr="__reactFiber$"+Fs,tl="__reactProps$"+Fs,ha="__reactContainer$"+Fs,Ey="__reactEvents$"+Fs,jM="__reactListeners$"+Fs,TM="__reactHandles$"+Fs;function vi(e){var t=e[qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ha]||n[qr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=o1(e);e!==null;){if(n=e[qr])return n;e=o1(e)}return t}e=n,n=e.parentNode}return null}function bl(e){return e=e[qr]||e[ha],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function gs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(je(33))}function Fu(e){return e[tl]||null}var Ny=[],ps=-1;function ai(e){return{current:e}}function $t(e){0>ps||(e.current=Ny[ps],Ny[ps]=null,ps--)}function Ut(e,t){ps++,Ny[ps]=e.current,e.current=t}var ti={},In=ai(ti),Wn=ai(!1),Ti=ti;function js(e,t){var n=e.type.contextTypes;if(!n)return ti;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 Vn(e){return e=e.childContextTypes,e!=null}function ru(){$t(Wn),$t(In)}function l1(e,t,n){if(In.current!==ti)throw Error(je(168));Ut(In,t),Ut(Wn,n)}function m4(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(je(108,g3(e)||"Unknown",a));return Qt({},n,r)}function au(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ti,Ti=In.current,Ut(In,e),Ut(Wn,Wn.current),!0}function c1(e,t,n){var r=e.stateNode;if(!r)throw Error(je(169));n?(e=m4(e,t,Ti),r.__reactInternalMemoizedMergedChildContext=e,$t(Wn),$t(In),Ut(In,e)):$t(Wn),Ut(Wn,n)}var oa=null,Bu=!1,gf=!1;function y4(e){oa===null?oa=[e]:oa.push(e)}function AM(e){Bu=!0,y4(e)}function ii(){if(!gf&&oa!==null){gf=!0;var e=0,t=At;try{var n=oa;for(At=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}oa=null,Bu=!1}catch(a){throw oa!==null&&(oa=oa.slice(e+1)),qC(Lx,ii),a}finally{At=t,gf=!1}}return null}var hs=[],ms=0,iu=null,su=0,fr=[],gr=0,Ai=null,la=1,ca="";function mi(e,t){hs[ms++]=su,hs[ms++]=iu,iu=e,su=t}function x4(e,t,n){fr[gr++]=la,fr[gr++]=ca,fr[gr++]=Ai,Ai=e;var r=la;e=ca;var a=32-Tr(r)-1;r&=~(1<<a),n+=1;var i=32-Tr(t)+a;if(30<i){var s=a-a%5;i=(r&(1<<s)-1).toString(32),r>>=s,a-=s,la=1<<32-Tr(t)+a|n<<a|r,ca=i+e}else la=1<<i|n<<a|r,ca=e}function $x(e){e.return!==null&&(mi(e,1),x4(e,1,0))}function Hx(e){for(;e===iu;)iu=hs[--ms],hs[ms]=null,su=hs[--ms],hs[ms]=null;for(;e===Ai;)Ai=fr[--gr],fr[gr]=null,ca=fr[--gr],fr[gr]=null,la=fr[--gr],fr[gr]=null}var rr=null,nr=null,Ht=!1,jr=null;function b4(e,t){var n=hr(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 u1(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,rr=e,nr=Ka(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,rr=e,nr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ai!==null?{id:la,overflow:ca}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=hr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,rr=e,nr=null,!0):!1;default:return!1}}function Sy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Cy(e){if(Ht){var t=nr;if(t){var n=t;if(!u1(e,t)){if(Sy(e))throw Error(je(418));t=Ka(n.nextSibling);var r=rr;t&&u1(e,t)?b4(r,n):(e.flags=e.flags&-4097|2,Ht=!1,rr=e)}}else{if(Sy(e))throw Error(je(418));e.flags=e.flags&-4097|2,Ht=!1,rr=e}}}function d1(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;rr=e}function rc(e){if(e!==rr)return!1;if(!Ht)return d1(e),Ht=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!_y(e.type,e.memoizedProps)),t&&(t=nr)){if(Sy(e))throw v4(),Error(je(418));for(;t;)b4(e,t),t=Ka(t.nextSibling)}if(d1(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){nr=Ka(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}nr=null}}else nr=rr?Ka(e.stateNode.nextSibling):null;return!0}function v4(){for(var e=nr;e;)e=Ka(e.nextSibling)}function Ts(){nr=rr=null,Ht=!1}function Wx(e){jr===null?jr=[e]:jr.push(e)}var RM=ba.ReactCurrentBatchConfig;function co(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(je(309));var r=n.stateNode}if(!r)throw Error(je(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(je(284));if(!n._owner)throw Error(je(290,e))}return e}function ac(e,t){throw e=Object.prototype.toString.call(t),Error(je(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function f1(e){var t=e._init;return t(e._payload)}function k4(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=Za(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=vf(k,x.mode,N),b.return=x,b):(b=a(b,k),b.return=x,b)}function c(x,b,k,N){var E=k.type;return E===cs?d(x,b,k.props.children,N,k.key):b!==null&&(b.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===La&&f1(E)===b.type)?(N=a(b,k.props),N.ref=co(x,b,k),N.return=x,N):(N=$c(k.type,k.key,k.props,null,x.mode,N),N.ref=co(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=kf(k,x.mode,N),b.return=x,b):(b=a(b,k.children||[]),b.return=x,b)}function d(x,b,k,N,E){return b===null||b.tag!==7?(b=Ni(k,x.mode,N,E),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=vf(""+b,x.mode,k),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Gl:return k=$c(b.type,b.key,b.props,null,x.mode,k),k.ref=co(x,null,b),k.return=x,k;case ls:return b=kf(b,x.mode,k),b.return=x,b;case La:var N=b._init;return f(x,N(b._payload),k)}if(ko(b)||ao(b))return b=Ni(b,x.mode,k,null),b.return=x,b;ac(x,b)}return null}function g(x,b,k,N){var E=b!==null?b.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return E!==null?null:l(x,b,""+k,N);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Gl:return k.key===E?c(x,b,k,N):null;case ls:return k.key===E?u(x,b,k,N):null;case La:return E=k._init,g(x,b,E(k._payload),N)}if(ko(k)||ao(k))return E!==null?null:d(x,b,k,N,null);ac(x,k)}return null}function p(x,b,k,N,E){if(typeof N=="string"&&N!==""||typeof N=="number")return x=x.get(k)||null,l(b,x,""+N,E);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Gl:return x=x.get(N.key===null?k:N.key)||null,c(b,x,N,E);case ls:return x=x.get(N.key===null?k:N.key)||null,u(b,x,N,E);case La:var w=N._init;return p(x,b,k,w(N._payload),E)}if(ko(N)||ao(N))return x=x.get(k)||null,d(b,x,N,E,null);ac(b,N)}return null}function m(x,b,k,N){for(var E=null,w=null,T=b,R=b=0,D=null;T!==null&&R<k.length;R++){T.index>R?(D=T,T=null):D=T.sibling;var A=g(x,T,k[R],N);if(A===null){T===null&&(T=D);break}e&&T&&A.alternate===null&&t(x,T),b=i(A,b,R),w===null?E=A:w.sibling=A,w=A,T=D}if(R===k.length)return n(x,T),Ht&&mi(x,R),E;if(T===null){for(;R<k.length;R++)T=f(x,k[R],N),T!==null&&(b=i(T,b,R),w===null?E=T:w.sibling=T,w=T);return Ht&&mi(x,R),E}for(T=r(x,T);R<k.length;R++)D=p(T,x,R,k[R],N),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?R:D.key),b=i(D,b,R),w===null?E=D:w.sibling=D,w=D);return e&&T.forEach(function(q){return t(x,q)}),Ht&&mi(x,R),E}function y(x,b,k,N){var E=ao(k);if(typeof E!="function")throw Error(je(150));if(k=E.call(k),k==null)throw Error(je(151));for(var w=E=null,T=b,R=b=0,D=null,A=k.next();T!==null&&!A.done;R++,A=k.next()){T.index>R?(D=T,T=null):D=T.sibling;var q=g(x,T,A.value,N);if(q===null){T===null&&(T=D);break}e&&T&&q.alternate===null&&t(x,T),b=i(q,b,R),w===null?E=q:w.sibling=q,w=q,T=D}if(A.done)return n(x,T),Ht&&mi(x,R),E;if(T===null){for(;!A.done;R++,A=k.next())A=f(x,A.value,N),A!==null&&(b=i(A,b,R),w===null?E=A:w.sibling=A,w=A);return Ht&&mi(x,R),E}for(T=r(x,T);!A.done;R++,A=k.next())A=p(T,x,R,A.value,N),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?R:A.key),b=i(A,b,R),w===null?E=A:w.sibling=A,w=A);return e&&T.forEach(function(U){return t(x,U)}),Ht&&mi(x,R),E}function v(x,b,k,N){if(typeof k=="object"&&k!==null&&k.type===cs&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Gl:e:{for(var E=k.key,w=b;w!==null;){if(w.key===E){if(E=k.type,E===cs){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===E||typeof E=="object"&&E!==null&&E.$$typeof===La&&f1(E)===w.type){n(x,w.sibling),b=a(w,k.props),b.ref=co(x,w,k),b.return=x,x=b;break e}n(x,w);break}else t(x,w);w=w.sibling}k.type===cs?(b=Ni(k.props.children,x.mode,N,k.key),b.return=x,x=b):(N=$c(k.type,k.key,k.props,null,x.mode,N),N.ref=co(x,b,k),N.return=x,x=N)}return s(x);case ls: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=kf(k,x.mode,N),b.return=x,x=b}return s(x);case La:return w=k._init,v(x,b,w(k._payload),N)}if(ko(k))return m(x,b,k,N);if(ao(k))return y(x,b,k,N);ac(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=vf(k,x.mode,N),b.return=x,x=b),s(x)):n(x,b)}return v}var As=k4(!0),_4=k4(!1),ou=ai(null),lu=null,ys=null,Vx=null;function Gx(){Vx=ys=lu=null}function Kx(e){var t=ou.current;$t(ou),e._currentValue=t}function jy(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 Es(e,t){lu=e,Vx=ys=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Hn=!0),e.firstContext=null)}function yr(e){var t=e._currentValue;if(Vx!==e)if(e={context:e,memoizedValue:t,next:null},ys===null){if(lu===null)throw Error(je(308));ys=e,lu.dependencies={lanes:0,firstContext:e}}else ys=ys.next=e;return t}var ki=null;function Yx(e){ki===null?ki=[e]:ki.push(e)}function w4(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Yx(t)):(n.next=a.next,a.next=n),t.interleaved=n,ma(e,r)}function ma(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 Oa=!1;function Qx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E4(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 fa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,kt&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,ma(e,n)}return a=r.interleaved,a===null?(t.next=t,Yx(r)):(t.next=a.next,a.next=t),r.interleaved=t,ma(e,n)}function Pc(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,Ox(e,n)}}function g1(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 cu(e,t,n,r){var a=e.updateQueue;Oa=!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=Qt({},f,g);break e;case 2:Oa=!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);Mi|=s,e.lanes=s,e.memoizedState=f}}function p1(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(je(191,a));a.call(r)}}}var vl={},Wr=ai(vl),nl=ai(vl),rl=ai(vl);function _i(e){if(e===vl)throw Error(je(174));return e}function Xx(e,t){switch(Ut(rl,t),Ut(nl,e),Ut(Wr,vl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ly(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ly(t,e)}$t(Wr),Ut(Wr,t)}function Rs(){$t(Wr),$t(nl),$t(rl)}function N4(e){_i(rl.current);var t=_i(Wr.current),n=ly(t,e.type);t!==n&&(Ut(nl,e),Ut(Wr,n))}function Zx(e){nl.current===e&&($t(Wr),$t(nl))}var Kt=ai(0);function uu(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 pf=[];function Jx(){for(var e=0;e<pf.length;e++)pf[e]._workInProgressVersionPrimary=null;pf.length=0}var Fc=ba.ReactCurrentDispatcher,hf=ba.ReactCurrentBatchConfig,Ri=0,Yt=null,fn=null,yn=null,du=!1,Do=!1,al=0,MM=0;function jn(){throw Error(je(321))}function eb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mr(e[n],t[n]))return!1;return!0}function tb(e,t,n,r,a,i){if(Ri=i,Yt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Fc.current=e===null||e.memoizedState===null?DM:PM,e=n(r,a),Do){i=0;do{if(Do=!1,al=0,25<=i)throw Error(je(301));i+=1,yn=fn=null,t.updateQueue=null,Fc.current=FM,e=n(r,a)}while(Do)}if(Fc.current=fu,t=fn!==null&&fn.next!==null,Ri=0,yn=fn=Yt=null,du=!1,t)throw Error(je(300));return e}function nb(){var e=al!==0;return al=0,e}function zr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yn===null?Yt.memoizedState=yn=e:yn=yn.next=e,yn}function xr(){if(fn===null){var e=Yt.alternate;e=e!==null?e.memoizedState:null}else e=fn.next;var t=yn===null?Yt.memoizedState:yn.next;if(t!==null)yn=t,fn=e;else{if(e===null)throw Error(je(310));fn=e,e={memoizedState:fn.memoizedState,baseState:fn.baseState,baseQueue:fn.baseQueue,queue:fn.queue,next:null},yn===null?Yt.memoizedState=yn=e:yn=yn.next=e}return yn}function il(e,t){return typeof t=="function"?t(e):t}function mf(e){var t=xr(),n=t.queue;if(n===null)throw Error(je(311));n.lastRenderedReducer=e;var r=fn,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((Ri&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,Yt.lanes|=d,Mi|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,Mr(r,t.memoizedState)||(Hn=!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,Yt.lanes|=i,Mi|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function yf(e){var t=xr(),n=t.queue;if(n===null)throw Error(je(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);Mr(i,t.memoizedState)||(Hn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function S4(){}function C4(e,t){var n=Yt,r=xr(),a=t(),i=!Mr(r.memoizedState,a);if(i&&(r.memoizedState=a,Hn=!0),r=r.queue,rb(A4.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||yn!==null&&yn.memoizedState.tag&1){if(n.flags|=2048,sl(9,T4.bind(null,n,r,a,t),void 0,null),xn===null)throw Error(je(349));Ri&30||j4(n,t,a)}return a}function j4(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Yt.updateQueue,t===null?(t={lastEffect:null,stores:null},Yt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function T4(e,t,n,r){t.value=n,t.getSnapshot=r,R4(t)&&M4(e)}function A4(e,t,n){return n(function(){R4(t)&&M4(e)})}function R4(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function M4(e){var t=ma(e,1);t!==null&&Ar(t,e,1,-1)}function h1(e){var t=zr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:e},t.queue=e,e=e.dispatch=OM.bind(null,Yt,e),[t.memoizedState,e]}function sl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Yt.updateQueue,t===null?(t={lastEffect:null,stores:null},Yt.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 I4(){return xr().memoizedState}function Bc(e,t,n,r){var a=zr();Yt.flags|=e,a.memoizedState=sl(1|t,n,void 0,r===void 0?null:r)}function zu(e,t,n,r){var a=xr();r=r===void 0?null:r;var i=void 0;if(fn!==null){var s=fn.memoizedState;if(i=s.destroy,r!==null&&eb(r,s.deps)){a.memoizedState=sl(t,n,i,r);return}}Yt.flags|=e,a.memoizedState=sl(1|t,n,i,r)}function m1(e,t){return Bc(8390656,8,e,t)}function rb(e,t){return zu(2048,8,e,t)}function L4(e,t){return zu(4,2,e,t)}function O4(e,t){return zu(4,4,e,t)}function D4(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 P4(e,t,n){return n=n!=null?n.concat([e]):null,zu(4,4,D4.bind(null,t,e),n)}function ab(){}function F4(e,t){var n=xr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&eb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function B4(e,t){var n=xr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&eb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function z4(e,t,n){return Ri&21?(Mr(n,t)||(n=WC(),Yt.lanes|=n,Mi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Hn=!0),e.memoizedState=n)}function IM(e,t){var n=At;At=n!==0&&4>n?n:4,e(!0);var r=hf.transition;hf.transition={};try{e(!1),t()}finally{At=n,hf.transition=r}}function U4(){return xr().memoizedState}function LM(e,t,n){var r=Xa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},q4(e))$4(t,n);else if(n=w4(e,t,n,r),n!==null){var a=Fn();Ar(n,e,r,a),H4(n,t,r)}}function OM(e,t,n){var r=Xa(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(q4(e))$4(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,Mr(l,s)){var c=t.interleaved;c===null?(a.next=a,Yx(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=w4(e,t,a,r),n!==null&&(a=Fn(),Ar(n,e,r,a),H4(n,t,r))}}function q4(e){var t=e.alternate;return e===Yt||t!==null&&t===Yt}function $4(e,t){Do=du=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function H4(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ox(e,n)}}var fu={readContext:yr,useCallback:jn,useContext:jn,useEffect:jn,useImperativeHandle:jn,useInsertionEffect:jn,useLayoutEffect:jn,useMemo:jn,useReducer:jn,useRef:jn,useState:jn,useDebugValue:jn,useDeferredValue:jn,useTransition:jn,useMutableSource:jn,useSyncExternalStore:jn,useId:jn,unstable_isNewReconciler:!1},DM={readContext:yr,useCallback:function(e,t){return zr().memoizedState=[e,t===void 0?null:t],e},useContext:yr,useEffect:m1,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bc(4194308,4,D4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bc(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bc(4,2,e,t)},useMemo:function(e,t){var n=zr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zr();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=LM.bind(null,Yt,e),[r.memoizedState,e]},useRef:function(e){var t=zr();return e={current:e},t.memoizedState=e},useState:h1,useDebugValue:ab,useDeferredValue:function(e){return zr().memoizedState=e},useTransition:function(){var e=h1(!1),t=e[0];return e=IM.bind(null,e[1]),zr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Yt,a=zr();if(Ht){if(n===void 0)throw Error(je(407));n=n()}else{if(n=t(),xn===null)throw Error(je(349));Ri&30||j4(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,m1(A4.bind(null,r,i,e),[e]),r.flags|=2048,sl(9,T4.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=zr(),t=xn.identifierPrefix;if(Ht){var n=ca,r=la;n=(r&~(1<<32-Tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=al++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=MM++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},PM={readContext:yr,useCallback:F4,useContext:yr,useEffect:rb,useImperativeHandle:P4,useInsertionEffect:L4,useLayoutEffect:O4,useMemo:B4,useReducer:mf,useRef:I4,useState:function(){return mf(il)},useDebugValue:ab,useDeferredValue:function(e){var t=xr();return z4(t,fn.memoizedState,e)},useTransition:function(){var e=mf(il)[0],t=xr().memoizedState;return[e,t]},useMutableSource:S4,useSyncExternalStore:C4,useId:U4,unstable_isNewReconciler:!1},FM={readContext:yr,useCallback:F4,useContext:yr,useEffect:rb,useImperativeHandle:P4,useInsertionEffect:L4,useLayoutEffect:O4,useMemo:B4,useReducer:yf,useRef:I4,useState:function(){return yf(il)},useDebugValue:ab,useDeferredValue:function(e){var t=xr();return fn===null?t.memoizedState=e:z4(t,fn.memoizedState,e)},useTransition:function(){var e=yf(il)[0],t=xr().memoizedState;return[e,t]},useMutableSource:S4,useSyncExternalStore:C4,useId:U4,unstable_isNewReconciler:!1};function Sr(e,t){if(e&&e.defaultProps){t=Qt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ty(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Qt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Uu={isMounted:function(e){return(e=e._reactInternals)?Di(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Fn(),a=Xa(e),i=fa(r,a);i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,a),t!==null&&(Ar(t,e,a,r),Pc(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Fn(),a=Xa(e),i=fa(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,a),t!==null&&(Ar(t,e,a,r),Pc(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Fn(),r=Xa(e),a=fa(n,r);a.tag=2,t!=null&&(a.callback=t),t=Ya(e,a,r),t!==null&&(Ar(t,e,r,n),Pc(t,e,r))}};function y1(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?!Zo(n,r)||!Zo(a,i):!0}function W4(e,t,n){var r=!1,a=ti,i=t.contextType;return typeof i=="object"&&i!==null?i=yr(i):(a=Vn(t)?Ti:In.current,r=t.contextTypes,i=(r=r!=null)?js(e,a):ti),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Uu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function x1(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&&Uu.enqueueReplaceState(t,t.state,null)}function Ay(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Qx(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=yr(i):(i=Vn(t)?Ti:In.current,a.context=js(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ty(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&&Uu.enqueueReplaceState(a,a.state,null),cu(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Ms(e,t){try{var n="",r=t;do n+=f3(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 xf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ry(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var BM=typeof WeakMap=="function"?WeakMap:Map;function V4(e,t,n){n=fa(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pu||(pu=!0,Uy=r),Ry(e,t)},n}function G4(e,t,n){n=fa(-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(){Ry(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ry(e,t),typeof r!="function"&&(Qa===null?Qa=new Set([this]):Qa.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function b1(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new BM;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=JM.bind(null,e,t,n),t.then(e,e))}function v1(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 k1(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=fa(-1,1),t.tag=2,Ya(n,t,1))),n.lanes|=1),e)}var zM=ba.ReactCurrentOwner,Hn=!1;function Dn(e,t,n,r){t.child=e===null?_4(t,null,n,r):As(t,e.child,n,r)}function _1(e,t,n,r,a){n=n.render;var i=t.ref;return Es(t,a),r=tb(e,t,n,r,i,a),n=nb(),e!==null&&!Hn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,ya(e,t,a)):(Ht&&n&&$x(t),t.flags|=1,Dn(e,t,r,a),t.child)}function w1(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!fb(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,K4(e,t,i,r,a)):(e=$c(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:Zo,n(s,r)&&e.ref===t.ref)return ya(e,t,a)}return t.flags|=1,e=Za(i,r),e.ref=t.ref,e.return=t,t.child=e}function K4(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(Zo(i,r)&&e.ref===t.ref)if(Hn=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(Hn=!0);else return t.lanes=e.lanes,ya(e,t,a)}return My(e,t,n,r,a)}function Y4(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},Ut(bs,er),er|=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,Ut(bs,er),er|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ut(bs,er),er|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ut(bs,er),er|=r;return Dn(e,t,a,n),t.child}function Q4(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function My(e,t,n,r,a){var i=Vn(n)?Ti:In.current;return i=js(t,i),Es(t,a),n=tb(e,t,n,r,i,a),r=nb(),e!==null&&!Hn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,ya(e,t,a)):(Ht&&r&&$x(t),t.flags|=1,Dn(e,t,n,a),t.child)}function E1(e,t,n,r,a){if(Vn(n)){var i=!0;au(t)}else i=!1;if(Es(t,a),t.stateNode===null)zc(e,t),W4(t,n,r),Ay(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=yr(u):(u=Vn(n)?Ti:In.current,u=js(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)&&x1(t,s,r,u),Oa=!1;var g=t.memoizedState;s.state=g,cu(t,r,s,a),c=t.memoizedState,l!==r||g!==c||Wn.current||Oa?(typeof d=="function"&&(Ty(t,n,d,r),c=t.memoizedState),(l=Oa||y1(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,E4(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Sr(t.type,l),s.props=u,f=t.pendingProps,g=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=yr(c):(c=Vn(n)?Ti:In.current,c=js(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)&&x1(t,s,r,c),Oa=!1,g=t.memoizedState,s.state=g,cu(t,r,s,a);var m=t.memoizedState;l!==f||g!==m||Wn.current||Oa?(typeof p=="function"&&(Ty(t,n,p,r),m=t.memoizedState),(u=Oa||y1(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 Iy(e,t,n,r,i,a)}function Iy(e,t,n,r,a,i){Q4(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return a&&c1(t,n,!1),ya(e,t,i);r=t.stateNode,zM.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=As(t,e.child,null,i),t.child=As(t,null,l,i)):Dn(e,t,l,i),t.memoizedState=r.state,a&&c1(t,n,!0),t.child}function X4(e){var t=e.stateNode;t.pendingContext?l1(e,t.pendingContext,t.pendingContext!==t.context):t.context&&l1(e,t.context,!1),Xx(e,t.containerInfo)}function N1(e,t,n,r,a){return Ts(),Wx(a),t.flags|=256,Dn(e,t,n,r),t.child}var Ly={dehydrated:null,treeContext:null,retryLane:0};function Oy(e){return{baseLanes:e,cachePool:null,transitions:null}}function Z4(e,t,n){var r=t.pendingProps,a=Kt.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),Ut(Kt,a&1),e===null)return Cy(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=Hu(s,r,0,null),e=Ni(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Oy(n),t.memoizedState=Ly,e):ib(t,s));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return UM(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=Za(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=Za(l,i):(i=Ni(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?Oy(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Ly,r}return i=e.child,e=i.sibling,r=Za(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 ib(e,t){return t=Hu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ic(e,t,n,r){return r!==null&&Wx(r),As(t,e.child,null,n),e=ib(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function UM(e,t,n,r,a,i,s){if(n)return t.flags&256?(t.flags&=-257,r=xf(Error(je(422))),ic(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Hu({mode:"visible",children:r.children},a,0,null),i=Ni(i,a,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&As(t,e.child,null,s),t.child.memoizedState=Oy(s),t.memoizedState=Ly,i);if(!(t.mode&1))return ic(e,t,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(je(419)),r=xf(i,r,void 0),ic(e,t,s,r)}if(l=(s&e.childLanes)!==0,Hn||l){if(r=xn,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,ma(e,a),Ar(r,e,a,-1))}return db(),r=xf(Error(je(421))),ic(e,t,s,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=eI.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,nr=Ka(a.nextSibling),rr=t,Ht=!0,jr=null,e!==null&&(fr[gr++]=la,fr[gr++]=ca,fr[gr++]=Ai,la=e.id,ca=e.overflow,Ai=t),t=ib(t,r.children),t.flags|=4096,t)}function S1(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),jy(e.return,t,n)}function bf(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 J4(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Dn(e,t,r.children,n),r=Kt.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&&S1(e,n,t);else if(e.tag===19)S1(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(Ut(Kt,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&&uu(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),bf(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&&uu(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}bf(t,!0,n,null,i);break;case"together":bf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function zc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ya(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Mi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(je(153));if(t.child!==null){for(e=t.child,n=Za(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Za(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qM(e,t,n){switch(t.tag){case 3:X4(t),Ts();break;case 5:N4(t);break;case 1:Vn(t.type)&&au(t);break;case 4:Xx(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Ut(ou,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ut(Kt,Kt.current&1),t.flags|=128,null):n&t.child.childLanes?Z4(e,t,n):(Ut(Kt,Kt.current&1),e=ya(e,t,n),e!==null?e.sibling:null);Ut(Kt,Kt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return J4(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ut(Kt,Kt.current),r)break;return null;case 22:case 23:return t.lanes=0,Y4(e,t,n)}return ya(e,t,n)}var ej,Dy,tj,nj;ej=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}};Dy=function(){};tj=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,_i(Wr.current);var i=null;switch(n){case"input":a=ay(e,a),r=ay(e,r),i=[];break;case"select":a=Qt({},a,{value:void 0}),r=Qt({},r,{value:void 0}),i=[];break;case"textarea":a=oy(e,a),r=oy(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=nu)}cy(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"&&(Wo.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"&&(Wo.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&qt("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)}};nj=function(e,t,n,r){n!==r&&(t.flags|=4)};function uo(e,t){if(!Ht)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 Tn(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 $M(e,t,n){var r=t.pendingProps;switch(Hx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tn(t),null;case 1:return Vn(t.type)&&ru(),Tn(t),null;case 3:return r=t.stateNode,Rs(),$t(Wn),$t(In),Jx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(rc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jr!==null&&(Hy(jr),jr=null))),Dy(e,t),Tn(t),null;case 5:Zx(t);var a=_i(rl.current);if(n=t.type,e!==null&&t.stateNode!=null)tj(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(je(166));return Tn(t),null}if(e=_i(Wr.current),rc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[qr]=t,r[tl]=i,e=(t.mode&1)!==0,n){case"dialog":qt("cancel",r),qt("close",r);break;case"iframe":case"object":case"embed":qt("load",r);break;case"video":case"audio":for(a=0;a<wo.length;a++)qt(wo[a],r);break;case"source":qt("error",r);break;case"img":case"image":case"link":qt("error",r),qt("load",r);break;case"details":qt("toggle",r);break;case"input":Ov(r,i),qt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},qt("invalid",r);break;case"textarea":Pv(r,i),qt("invalid",r)}cy(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&&nc(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&nc(r.textContent,l,e),a=["children",""+l]):Wo.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&qt("scroll",r)}switch(n){case"input":Kl(r),Dv(r,i,!0);break;case"textarea":Kl(r),Fv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=nu)}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=AC(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[qr]=t,e[tl]=r,ej(e,t,!1,!1),t.stateNode=e;e:{switch(s=uy(n,r),n){case"dialog":qt("cancel",e),qt("close",e),a=r;break;case"iframe":case"object":case"embed":qt("load",e),a=r;break;case"video":case"audio":for(a=0;a<wo.length;a++)qt(wo[a],e);a=r;break;case"source":qt("error",e),a=r;break;case"img":case"image":case"link":qt("error",e),qt("load",e),a=r;break;case"details":qt("toggle",e),a=r;break;case"input":Ov(e,r),a=ay(e,r),qt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Qt({},r,{value:void 0}),qt("invalid",e);break;case"textarea":Pv(e,r),a=oy(e,r),qt("invalid",e);break;default:a=r}cy(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?IC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&RC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Vo(e,c):typeof c=="number"&&Vo(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Wo.hasOwnProperty(i)?c!=null&&i==="onScroll"&&qt("scroll",e):c!=null&&Tx(e,i,c,s))}switch(n){case"input":Kl(e),Dv(e,r,!1);break;case"textarea":Kl(e),Fv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ei(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?vs(e,!!r.multiple,i,!1):r.defaultValue!=null&&vs(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=nu)}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 Tn(t),null;case 6:if(e&&t.stateNode!=null)nj(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(je(166));if(n=_i(rl.current),_i(Wr.current),rc(t)){if(r=t.stateNode,n=t.memoizedProps,r[qr]=t,(i=r.nodeValue!==n)&&(e=rr,e!==null))switch(e.tag){case 3:nc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&nc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[qr]=t,t.stateNode=r}return Tn(t),null;case 13:if($t(Kt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ht&&nr!==null&&t.mode&1&&!(t.flags&128))v4(),Ts(),t.flags|=98560,i=!1;else if(i=rc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(je(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(je(317));i[qr]=t}else Ts(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Tn(t),i=!1}else jr!==null&&(Hy(jr),jr=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||Kt.current&1?gn===0&&(gn=3):db())),t.updateQueue!==null&&(t.flags|=4),Tn(t),null);case 4:return Rs(),Dy(e,t),e===null&&Jo(t.stateNode.containerInfo),Tn(t),null;case 10:return Kx(t.type._context),Tn(t),null;case 17:return Vn(t.type)&&ru(),Tn(t),null;case 19:if($t(Kt),i=t.memoizedState,i===null)return Tn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)uo(i,!1);else{if(gn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=uu(e),s!==null){for(t.flags|=128,uo(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 Ut(Kt,Kt.current&1|2),t.child}e=e.sibling}i.tail!==null&&en()>Is&&(t.flags|=128,r=!0,uo(i,!1),t.lanes=4194304)}else{if(!r)if(e=uu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ht)return Tn(t),null}else 2*en()-i.renderingStartTime>Is&&n!==1073741824&&(t.flags|=128,r=!0,uo(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=en(),t.sibling=null,n=Kt.current,Ut(Kt,r?n&1|2:n&1),t):(Tn(t),null);case 22:case 23:return ub(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?er&1073741824&&(Tn(t),t.subtreeFlags&6&&(t.flags|=8192)):Tn(t),null;case 24:return null;case 25:return null}throw Error(je(156,t.tag))}function HM(e,t){switch(Hx(t),t.tag){case 1:return Vn(t.type)&&ru(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Rs(),$t(Wn),$t(In),Jx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zx(t),null;case 13:if($t(Kt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(je(340));Ts()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $t(Kt),null;case 4:return Rs(),null;case 10:return Kx(t.type._context),null;case 22:case 23:return ub(),null;case 24:return null;default:return null}}var sc=!1,Rn=!1,WM=typeof WeakSet=="function"?WeakSet:Set,qe=null;function xs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Zt(e,t,r)}else n.current=null}function Py(e,t,n){try{n()}catch(r){Zt(e,t,r)}}var C1=!1;function VM(e,t){if(vy=Jc,e=o4(),qx(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(ky={focusedElem:e,selectionRange:n},Jc=!1,qe=t;qe!==null;)if(t=qe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,qe=e;else for(;qe!==null;){t=qe;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:Sr(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(je(163))}}catch(N){Zt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,qe=e;break}qe=t.return}return m=C1,C1=!1,m}function Po(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&&Py(t,n,i)}a=a.next}while(a!==r)}}function qu(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 Fy(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 rj(e){var t=e.alternate;t!==null&&(e.alternate=null,rj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qr],delete t[tl],delete t[Ey],delete t[jM],delete t[TM])),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 aj(e){return e.tag===5||e.tag===3||e.tag===4}function j1(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||aj(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 By(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=nu));else if(r!==4&&(e=e.child,e!==null))for(By(e,t,n),e=e.sibling;e!==null;)By(e,t,n),e=e.sibling}function zy(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(zy(e,t,n),e=e.sibling;e!==null;)zy(e,t,n),e=e.sibling}var kn=null,Cr=!1;function Ta(e,t,n){for(n=n.child;n!==null;)ij(e,t,n),n=n.sibling}function ij(e,t,n){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Lu,n)}catch{}switch(n.tag){case 5:Rn||xs(n,t);case 6:var r=kn,a=Cr;kn=null,Ta(e,t,n),kn=r,Cr=a,kn!==null&&(Cr?(e=kn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kn.removeChild(n.stateNode));break;case 18:kn!==null&&(Cr?(e=kn,n=n.stateNode,e.nodeType===8?ff(e.parentNode,n):e.nodeType===1&&ff(e,n),Qo(e)):ff(kn,n.stateNode));break;case 4:r=kn,a=Cr,kn=n.stateNode.containerInfo,Cr=!0,Ta(e,t,n),kn=r,Cr=a;break;case 0:case 11:case 14:case 15:if(!Rn&&(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)&&Py(n,t,s),a=a.next}while(a!==r)}Ta(e,t,n);break;case 1:if(!Rn&&(xs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Zt(n,t,l)}Ta(e,t,n);break;case 21:Ta(e,t,n);break;case 22:n.mode&1?(Rn=(r=Rn)||n.memoizedState!==null,Ta(e,t,n),Rn=r):Ta(e,t,n);break;default:Ta(e,t,n)}}function T1(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new WM),t.forEach(function(r){var a=tI.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function wr(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:kn=l.stateNode,Cr=!1;break e;case 3:kn=l.stateNode.containerInfo,Cr=!0;break e;case 4:kn=l.stateNode.containerInfo,Cr=!0;break e}l=l.return}if(kn===null)throw Error(je(160));ij(i,s,a),kn=null,Cr=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){Zt(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)sj(t,e),t=t.sibling}function sj(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(wr(t,e),Fr(e),r&4){try{Po(3,e,e.return),qu(3,e)}catch(y){Zt(e,e.return,y)}try{Po(5,e,e.return)}catch(y){Zt(e,e.return,y)}}break;case 1:wr(t,e),Fr(e),r&512&&n!==null&&xs(n,n.return);break;case 5:if(wr(t,e),Fr(e),r&512&&n!==null&&xs(n,n.return),e.flags&32){var a=e.stateNode;try{Vo(a,"")}catch(y){Zt(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&&jC(a,i),uy(l,s);var u=uy(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?IC(a,f):d==="dangerouslySetInnerHTML"?RC(a,f):d==="children"?Vo(a,f):Tx(a,d,f,u)}switch(l){case"input":iy(a,i);break;case"textarea":TC(a,i);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?vs(a,!!i.multiple,p,!1):g!==!!i.multiple&&(i.defaultValue!=null?vs(a,!!i.multiple,i.defaultValue,!0):vs(a,!!i.multiple,i.multiple?[]:"",!1))}a[tl]=i}catch(y){Zt(e,e.return,y)}}break;case 6:if(wr(t,e),Fr(e),r&4){if(e.stateNode===null)throw Error(je(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){Zt(e,e.return,y)}}break;case 3:if(wr(t,e),Fr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Qo(t.containerInfo)}catch(y){Zt(e,e.return,y)}break;case 4:wr(t,e),Fr(e);break;case 13:wr(t,e),Fr(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(lb=en())),r&4&&T1(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Rn=(u=Rn)||d,wr(t,e),Rn=u):wr(t,e),Fr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(qe=e,d=e.child;d!==null;){for(f=qe=d;qe!==null;){switch(g=qe,p=g.child,g.tag){case 0:case 11:case 14:case 15:Po(4,g,g.return);break;case 1:xs(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){Zt(r,n,y)}}break;case 5:xs(g,g.return);break;case 22:if(g.memoizedState!==null){R1(f);continue}}p!==null?(p.return=g,qe=p):R1(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=MC("display",s))}catch(y){Zt(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Zt(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:wr(t,e),Fr(e),r&4&&T1(e);break;case 21:break;default:wr(t,e),Fr(e)}}function Fr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(aj(n)){var r=n;break e}n=n.return}throw Error(je(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Vo(a,""),r.flags&=-33);var i=j1(e);zy(e,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,l=j1(e);By(e,l,s);break;default:throw Error(je(161))}}catch(c){Zt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function GM(e,t,n){qe=e,oj(e)}function oj(e,t,n){for(var r=(e.mode&1)!==0;qe!==null;){var a=qe,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||sc;if(!s){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Rn;l=sc;var u=Rn;if(sc=s,(Rn=c)&&!u)for(qe=a;qe!==null;)s=qe,c=s.child,s.tag===22&&s.memoizedState!==null?M1(a):c!==null?(c.return=s,qe=c):M1(a);for(;i!==null;)qe=i,oj(i),i=i.sibling;qe=a,sc=l,Rn=u}A1(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,qe=i):A1(e)}}function A1(e){for(;qe!==null;){var t=qe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Rn||qu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Rn)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Sr(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&p1(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}p1(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&&Qo(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(je(163))}Rn||t.flags&512&&Fy(t)}catch(g){Zt(t,t.return,g)}}if(t===e){qe=null;break}if(n=t.sibling,n!==null){n.return=t.return,qe=n;break}qe=t.return}}function R1(e){for(;qe!==null;){var t=qe;if(t===e){qe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,qe=n;break}qe=t.return}}function M1(e){for(;qe!==null;){var t=qe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{qu(4,t)}catch(c){Zt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){Zt(t,a,c)}}var i=t.return;try{Fy(t)}catch(c){Zt(t,i,c)}break;case 5:var s=t.return;try{Fy(t)}catch(c){Zt(t,s,c)}}}catch(c){Zt(t,t.return,c)}if(t===e){qe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,qe=l;break}qe=t.return}}var KM=Math.ceil,gu=ba.ReactCurrentDispatcher,sb=ba.ReactCurrentOwner,mr=ba.ReactCurrentBatchConfig,kt=0,xn=null,rn=null,wn=0,er=0,bs=ai(0),gn=0,ol=null,Mi=0,$u=0,ob=0,Fo=null,$n=null,lb=0,Is=1/0,sa=null,pu=!1,Uy=null,Qa=null,oc=!1,qa=null,hu=0,Bo=0,qy=null,Uc=-1,qc=0;function Fn(){return kt&6?en():Uc!==-1?Uc:Uc=en()}function Xa(e){return e.mode&1?kt&2&&wn!==0?wn&-wn:RM.transition!==null?(qc===0&&(qc=WC()),qc):(e=At,e!==0||(e=window.event,e=e===void 0?16:ZC(e.type)),e):1}function Ar(e,t,n,r){if(50<Bo)throw Bo=0,qy=null,Error(je(185));yl(e,n,r),(!(kt&2)||e!==xn)&&(e===xn&&(!(kt&2)&&($u|=n),gn===4&&Pa(e,wn)),Gn(e,r),n===1&&kt===0&&!(t.mode&1)&&(Is=en()+500,Bu&&ii()))}function Gn(e,t){var n=e.callbackNode;R3(e,t);var r=Zc(e,e===xn?wn:0);if(r===0)n!==null&&Uv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Uv(n),t===1)e.tag===0?AM(I1.bind(null,e)):y4(I1.bind(null,e)),SM(function(){!(kt&6)&&ii()}),n=null;else{switch(VC(r)){case 1:n=Lx;break;case 4:n=$C;break;case 16:n=Xc;break;case 536870912:n=HC;break;default:n=Xc}n=hj(n,lj.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lj(e,t){if(Uc=-1,qc=0,kt&6)throw Error(je(327));var n=e.callbackNode;if(Ns()&&e.callbackNode!==n)return null;var r=Zc(e,e===xn?wn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=mu(e,r);else{t=r;var a=kt;kt|=2;var i=uj();(xn!==e||wn!==t)&&(sa=null,Is=en()+500,Ei(e,t));do try{XM();break}catch(l){cj(e,l)}while(!0);Gx(),gu.current=i,kt=a,rn!==null?t=0:(xn=null,wn=0,t=gn)}if(t!==0){if(t===2&&(a=hy(e),a!==0&&(r=a,t=$y(e,a))),t===1)throw n=ol,Ei(e,0),Pa(e,r),Gn(e,en()),n;if(t===6)Pa(e,r);else{if(a=e.current.alternate,!(r&30)&&!YM(a)&&(t=mu(e,r),t===2&&(i=hy(e),i!==0&&(r=i,t=$y(e,i))),t===1))throw n=ol,Ei(e,0),Pa(e,r),Gn(e,en()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(je(345));case 2:yi(e,$n,sa);break;case 3:if(Pa(e,r),(r&130023424)===r&&(t=lb+500-en(),10<t)){if(Zc(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Fn(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=wy(yi.bind(null,e,$n,sa),t);break}yi(e,$n,sa);break;case 4:if(Pa(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var s=31-Tr(r);i=1<<s,s=t[s],s>a&&(a=s),r&=~i}if(r=a,r=en()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*KM(r/1960))-r,10<r){e.timeoutHandle=wy(yi.bind(null,e,$n,sa),r);break}yi(e,$n,sa);break;case 5:yi(e,$n,sa);break;default:throw Error(je(329))}}}return Gn(e,en()),e.callbackNode===n?lj.bind(null,e):null}function $y(e,t){var n=Fo;return e.current.memoizedState.isDehydrated&&(Ei(e,t).flags|=256),e=mu(e,t),e!==2&&(t=$n,$n=n,t!==null&&Hy(t)),e}function Hy(e){$n===null?$n=e:$n.push.apply($n,e)}function YM(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(!Mr(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 Pa(e,t){for(t&=~ob,t&=~$u,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tr(t),r=1<<n;e[n]=-1,t&=~r}}function I1(e){if(kt&6)throw Error(je(327));Ns();var t=Zc(e,0);if(!(t&1))return Gn(e,en()),null;var n=mu(e,t);if(e.tag!==0&&n===2){var r=hy(e);r!==0&&(t=r,n=$y(e,r))}if(n===1)throw n=ol,Ei(e,0),Pa(e,t),Gn(e,en()),n;if(n===6)throw Error(je(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,yi(e,$n,sa),Gn(e,en()),null}function cb(e,t){var n=kt;kt|=1;try{return e(t)}finally{kt=n,kt===0&&(Is=en()+500,Bu&&ii())}}function Ii(e){qa!==null&&qa.tag===0&&!(kt&6)&&Ns();var t=kt;kt|=1;var n=mr.transition,r=At;try{if(mr.transition=null,At=1,e)return e()}finally{At=r,mr.transition=n,kt=t,!(kt&6)&&ii()}}function ub(){er=bs.current,$t(bs)}function Ei(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,NM(n)),rn!==null)for(n=rn.return;n!==null;){var r=n;switch(Hx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ru();break;case 3:Rs(),$t(Wn),$t(In),Jx();break;case 5:Zx(r);break;case 4:Rs();break;case 13:$t(Kt);break;case 19:$t(Kt);break;case 10:Kx(r.type._context);break;case 22:case 23:ub()}n=n.return}if(xn=e,rn=e=Za(e.current,null),wn=er=t,gn=0,ol=null,ob=$u=Mi=0,$n=Fo=null,ki!==null){for(t=0;t<ki.length;t++)if(n=ki[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}ki=null}return e}function cj(e,t){do{var n=rn;try{if(Gx(),Fc.current=fu,du){for(var r=Yt.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}du=!1}if(Ri=0,yn=fn=Yt=null,Do=!1,al=0,sb.current=null,n===null||n.return===null){gn=1,ol=t,rn=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=wn,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=v1(s);if(p!==null){p.flags&=-257,k1(p,s,l,i,t),p.mode&1&&b1(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)){b1(i,u,t),db();break e}c=Error(je(426))}}else if(Ht&&l.mode&1){var v=v1(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),k1(v,s,l,i,t),Wx(Ms(c,l));break e}}i=c=Ms(c,l),gn!==4&&(gn=2),Fo===null?Fo=[i]:Fo.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=V4(i,c,t);g1(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"&&(Qa===null||!Qa.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=G4(i,l,t);g1(i,N);break e}}i=i.return}while(i!==null)}fj(n)}catch(E){t=E,rn===n&&n!==null&&(rn=n=n.return);continue}break}while(!0)}function uj(){var e=gu.current;return gu.current=fu,e===null?fu:e}function db(){(gn===0||gn===3||gn===2)&&(gn=4),xn===null||!(Mi&268435455)&&!($u&268435455)||Pa(xn,wn)}function mu(e,t){var n=kt;kt|=2;var r=uj();(xn!==e||wn!==t)&&(sa=null,Ei(e,t));do try{QM();break}catch(a){cj(e,a)}while(!0);if(Gx(),kt=n,gu.current=r,rn!==null)throw Error(je(261));return xn=null,wn=0,gn}function QM(){for(;rn!==null;)dj(rn)}function XM(){for(;rn!==null&&!_3();)dj(rn)}function dj(e){var t=pj(e.alternate,e,er);e.memoizedProps=e.pendingProps,t===null?fj(e):rn=t,sb.current=null}function fj(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=HM(n,t),n!==null){n.flags&=32767,rn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{gn=6,rn=null;return}}else if(n=$M(n,t,er),n!==null){rn=n;return}if(t=t.sibling,t!==null){rn=t;return}rn=t=e}while(t!==null);gn===0&&(gn=5)}function yi(e,t,n){var r=At,a=mr.transition;try{mr.transition=null,At=1,ZM(e,t,n,r)}finally{mr.transition=a,At=r}return null}function ZM(e,t,n,r){do Ns();while(qa!==null);if(kt&6)throw Error(je(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(je(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(M3(e,i),e===xn&&(rn=xn=null,wn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||oc||(oc=!0,hj(Xc,function(){return Ns(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=mr.transition,mr.transition=null;var s=At;At=1;var l=kt;kt|=4,sb.current=null,VM(e,n),sj(n,e),xM(ky),Jc=!!vy,ky=vy=null,e.current=n,GM(n),w3(),kt=l,At=s,mr.transition=i}else e.current=n;if(oc&&(oc=!1,qa=e,hu=a),i=e.pendingLanes,i===0&&(Qa=null),S3(n.stateNode),Gn(e,en()),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(pu)throw pu=!1,e=Uy,Uy=null,e;return hu&1&&e.tag!==0&&Ns(),i=e.pendingLanes,i&1?e===qy?Bo++:(Bo=0,qy=e):Bo=0,ii(),null}function Ns(){if(qa!==null){var e=VC(hu),t=mr.transition,n=At;try{if(mr.transition=null,At=16>e?16:e,qa===null)var r=!1;else{if(e=qa,qa=null,hu=0,kt&6)throw Error(je(331));var a=kt;for(kt|=4,qe=e.current;qe!==null;){var i=qe,s=i.child;if(qe.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(qe=u;qe!==null;){var d=qe;switch(d.tag){case 0:case 11:case 15:Po(8,d,i)}var f=d.child;if(f!==null)f.return=d,qe=f;else for(;qe!==null;){d=qe;var g=d.sibling,p=d.return;if(rj(d),d===u){qe=null;break}if(g!==null){g.return=p,qe=g;break}qe=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)}}qe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,qe=s;else e:for(;qe!==null;){if(i=qe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Po(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,qe=x;break e}qe=i.return}}var b=e.current;for(qe=b;qe!==null;){s=qe;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,qe=k;else e:for(s=b;qe!==null;){if(l=qe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:qu(9,l)}}catch(E){Zt(l,l.return,E)}if(l===s){qe=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,qe=N;break e}qe=l.return}}if(kt=a,ii(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Lu,e)}catch{}r=!0}return r}finally{At=n,mr.transition=t}}return!1}function L1(e,t,n){t=Ms(n,t),t=V4(e,t,1),e=Ya(e,t,1),t=Fn(),e!==null&&(yl(e,1,t),Gn(e,t))}function Zt(e,t,n){if(e.tag===3)L1(e,e,n);else for(;t!==null;){if(t.tag===3){L1(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qa===null||!Qa.has(r))){e=Ms(n,e),e=G4(t,e,1),t=Ya(t,e,1),e=Fn(),t!==null&&(yl(t,1,e),Gn(t,e));break}}t=t.return}}function JM(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Fn(),e.pingedLanes|=e.suspendedLanes&n,xn===e&&(wn&n)===n&&(gn===4||gn===3&&(wn&130023424)===wn&&500>en()-lb?Ei(e,0):ob|=n),Gn(e,t)}function gj(e,t){t===0&&(e.mode&1?(t=Xl,Xl<<=1,!(Xl&130023424)&&(Xl=4194304)):t=1);var n=Fn();e=ma(e,t),e!==null&&(yl(e,t,n),Gn(e,n))}function eI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gj(e,n)}function tI(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(je(314))}r!==null&&r.delete(t),gj(e,n)}var pj;pj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wn.current)Hn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Hn=!1,qM(e,t,n);Hn=!!(e.flags&131072)}else Hn=!1,Ht&&t.flags&1048576&&x4(t,su,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zc(e,t),e=t.pendingProps;var a=js(t,In.current);Es(t,n),a=tb(null,t,r,e,a,n);var i=nb();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,Vn(r)?(i=!0,au(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qx(t),a.updater=Uu,t.stateNode=a,a._reactInternals=t,Ay(t,r,e,n),t=Iy(null,t,r,!0,i,n)):(t.tag=0,Ht&&i&&$x(t),Dn(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=rI(r),e=Sr(r,e),a){case 0:t=My(null,t,r,e,n);break e;case 1:t=E1(null,t,r,e,n);break e;case 11:t=_1(null,t,r,e,n);break e;case 14:t=w1(null,t,r,Sr(r.type,e),n);break e}throw Error(je(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),My(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),E1(e,t,r,a,n);case 3:e:{if(X4(t),e===null)throw Error(je(387));r=t.pendingProps,i=t.memoizedState,a=i.element,E4(e,t),cu(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=Ms(Error(je(423)),t),t=N1(e,t,r,n,a);break e}else if(r!==a){a=Ms(Error(je(424)),t),t=N1(e,t,r,n,a);break e}else for(nr=Ka(t.stateNode.containerInfo.firstChild),rr=t,Ht=!0,jr=null,n=_4(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ts(),r===a){t=ya(e,t,n);break e}Dn(e,t,r,n)}t=t.child}return t;case 5:return N4(t),e===null&&Cy(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,_y(r,a)?s=null:i!==null&&_y(r,i)&&(t.flags|=32),Q4(e,t),Dn(e,t,s,n),t.child;case 6:return e===null&&Cy(t),null;case 13:return Z4(e,t,n);case 4:return Xx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=As(t,null,r,n):Dn(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),_1(e,t,r,a,n);case 7:return Dn(e,t,t.pendingProps,n),t.child;case 8:return Dn(e,t,t.pendingProps.children,n),t.child;case 12:return Dn(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,Ut(ou,r._currentValue),r._currentValue=s,i!==null)if(Mr(i.value,s)){if(i.children===a.children&&!Wn.current){t=ya(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=fa(-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),jy(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(je(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),jy(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}Dn(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Es(t,n),a=yr(a),r=r(a),t.flags|=1,Dn(e,t,r,n),t.child;case 14:return r=t.type,a=Sr(r,t.pendingProps),a=Sr(r.type,a),w1(e,t,r,a,n);case 15:return K4(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),zc(e,t),t.tag=1,Vn(r)?(e=!0,au(t)):e=!1,Es(t,n),W4(t,r,a),Ay(t,r,a,n),Iy(null,t,r,!0,e,n);case 19:return J4(e,t,n);case 22:return Y4(e,t,n)}throw Error(je(156,t.tag))};function hj(e,t){return qC(e,t)}function nI(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 hr(e,t,n,r){return new nI(e,t,n,r)}function fb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rI(e){if(typeof e=="function")return fb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Rx)return 11;if(e===Mx)return 14}return 2}function Za(e,t){var n=e.alternate;return n===null?(n=hr(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 $c(e,t,n,r,a,i){var s=2;if(r=e,typeof e=="function")fb(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case cs:return Ni(n.children,a,i,t);case Ax:s=8,a|=8;break;case ey:return e=hr(12,n,t,a|2),e.elementType=ey,e.lanes=i,e;case ty:return e=hr(13,n,t,a),e.elementType=ty,e.lanes=i,e;case ny:return e=hr(19,n,t,a),e.elementType=ny,e.lanes=i,e;case NC:return Hu(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case wC:s=10;break e;case EC:s=9;break e;case Rx:s=11;break e;case Mx:s=14;break e;case La:s=16,r=null;break e}throw Error(je(130,e==null?e:typeof e,""))}return t=hr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function Ni(e,t,n,r){return e=hr(7,e,r,t),e.lanes=n,e}function Hu(e,t,n,r){return e=hr(22,e,r,t),e.elementType=NC,e.lanes=n,e.stateNode={isHidden:!1},e}function vf(e,t,n){return e=hr(6,e,null,t),e.lanes=n,e}function kf(e,t,n){return t=hr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function aI(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=ef(0),this.expirationTimes=ef(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ef(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function gb(e,t,n,r,a,i,s,l,c){return e=new aI(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=hr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qx(i),e}function iI(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ls,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function mj(e){if(!e)return ti;e=e._reactInternals;e:{if(Di(e)!==e||e.tag!==1)throw Error(je(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Vn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(je(171))}if(e.tag===1){var n=e.type;if(Vn(n))return m4(e,n,t)}return t}function yj(e,t,n,r,a,i,s,l,c){return e=gb(n,r,!0,e,a,i,s,l,c),e.context=mj(null),n=e.current,r=Fn(),a=Xa(n),i=fa(r,a),i.callback=t??null,Ya(n,i,a),e.current.lanes=a,yl(e,a,r),Gn(e,r),e}function Wu(e,t,n,r){var a=t.current,i=Fn(),s=Xa(a);return n=mj(n),t.context===null?t.context=n:t.pendingContext=n,t=fa(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ya(a,t,s),e!==null&&(Ar(e,a,s,i),Pc(e,a,s)),s}function yu(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 O1(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pb(e,t){O1(e,t),(e=e.alternate)&&O1(e,t)}function sI(){return null}var xj=typeof reportError=="function"?reportError:function(e){console.error(e)};function hb(e){this._internalRoot=e}Vu.prototype.render=hb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(je(409));Wu(e,t,null,null)};Vu.prototype.unmount=hb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ii(function(){Wu(null,e,null,null)}),t[ha]=null}};function Vu(e){this._internalRoot=e}Vu.prototype.unstable_scheduleHydration=function(e){if(e){var t=YC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Da.length&&t!==0&&t<Da[n].priority;n++);Da.splice(n,0,e),n===0&&XC(e)}};function mb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Gu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function D1(){}function oI(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=yu(s);i.call(u)}}var s=yj(t,r,e,0,null,!1,!1,"",D1);return e._reactRootContainer=s,e[ha]=s.current,Jo(e.nodeType===8?e.parentNode:e),Ii(),s}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=yu(c);l.call(u)}}var c=gb(e,0,!1,null,null,!1,!1,"",D1);return e._reactRootContainer=c,e[ha]=c.current,Jo(e.nodeType===8?e.parentNode:e),Ii(function(){Wu(t,c,n,r)}),c}function Ku(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=yu(s);l.call(c)}}Wu(t,s,e,a)}else s=oI(n,t,e,a,r);return yu(s)}GC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=_o(t.pendingLanes);n!==0&&(Ox(t,n|1),Gn(t,en()),!(kt&6)&&(Is=en()+500,ii()))}break;case 13:Ii(function(){var r=ma(e,1);if(r!==null){var a=Fn();Ar(r,e,1,a)}}),pb(e,1)}};Dx=function(e){if(e.tag===13){var t=ma(e,134217728);if(t!==null){var n=Fn();Ar(t,e,134217728,n)}pb(e,134217728)}};KC=function(e){if(e.tag===13){var t=Xa(e),n=ma(e,t);if(n!==null){var r=Fn();Ar(n,e,t,r)}pb(e,t)}};YC=function(){return At};QC=function(e,t){var n=At;try{return At=e,t()}finally{At=n}};fy=function(e,t,n){switch(t){case"input":if(iy(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=Fu(r);if(!a)throw Error(je(90));CC(r),iy(r,a)}}}break;case"textarea":TC(e,n);break;case"select":t=n.value,t!=null&&vs(e,!!n.multiple,t,!1)}};DC=cb;PC=Ii;var lI={usingClientEntryPoint:!1,Events:[bl,gs,Fu,LC,OC,cb]},fo={findFiberByHostInstance:vi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cI={bundleType:fo.bundleType,version:fo.version,rendererPackageName:fo.rendererPackageName,rendererConfig:fo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ba.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zC(e),e===null?null:e.stateNode},findFiberByHostInstance:fo.findFiberByHostInstance||sI,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 lc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lc.isDisabled&&lc.supportsFiber)try{Lu=lc.inject(cI),Hr=lc}catch{}}sr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lI;sr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mb(t))throw Error(je(200));return iI(e,t,null,n)};sr.createRoot=function(e,t){if(!mb(e))throw Error(je(299));var n=!1,r="",a=xj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=gb(e,1,!1,null,null,n,!1,r,a),e[ha]=t.current,Jo(e.nodeType===8?e.parentNode:e),new hb(t)};sr.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(je(188)):(e=Object.keys(e).join(","),Error(je(268,e)));return e=zC(t),e=e===null?null:e.stateNode,e};sr.flushSync=function(e){return Ii(e)};sr.hydrate=function(e,t,n){if(!Gu(t))throw Error(je(200));return Ku(null,e,t,!0,n)};sr.hydrateRoot=function(e,t,n){if(!mb(e))throw Error(je(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=xj;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=yj(t,null,e,1,n??null,a,!1,i,s),e[ha]=t.current,Jo(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 Vu(t)};sr.render=function(e,t,n){if(!Gu(t))throw Error(je(200));return Ku(null,e,t,!1,n)};sr.unmountComponentAtNode=function(e){if(!Gu(e))throw Error(je(40));return e._reactRootContainer?(Ii(function(){Ku(null,null,e,!1,function(){e._reactRootContainer=null,e[ha]=null})}),!0):!1};sr.unstable_batchedUpdates=cb;sr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Gu(n))throw Error(je(200));if(e==null||e._reactInternals===void 0)throw Error(je(38));return Ku(e,t,n,!1,r)};sr.version="18.3.1-next-f1338f8080-20240426";function bj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bj)}catch(e){console.error(e)}}bj(),bC.exports=sr;var uI=bC.exports,P1=uI;Z0.createRoot=P1.createRoot,Z0.hydrateRoot=P1.hydrateRoot;const dI="modulepreload",fI=function(e){return"/"+e},F1={},vj=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=fI(c),c in F1)return;F1[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":dI,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)})},ga={"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 all conversations? 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.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","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.","compacted_history.load":"Load previous {count} turns","compacted_history.load_more":"Load {count} more turns ({remaining} remaining)","compacted_history.all_loaded":"All compacted history loaded ({count} turns)","compacted_history.compacted_turns":"{count} turns compacted","compacted_history.hide":"Hide","compacted_history.loaded_and_total":"{loaded} of {total} turns shown","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"},$a={en:ga},gI={"zh-TW":()=>vj(()=>import("./zh-TW-CWgKQVJ3.js"),[])},Ss=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function B1(e){if($a[e])return $a[e];const t=gI[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),ga;try{const n=await t();return $a[e]=n.default||n,$a[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),ga}}function kj(e,t,n){let r=e[t];return r===void 0&&e!==ga&&(r=ga[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 _j=h.createContext(null);function pI({initialLocale:e="en",children:t}){const r=Ss.map(g=>g.code).includes(e)?e:"en",[a,i]=h.useState(r),[s,l]=h.useState($a[r]||ga),c=h.useRef(0);h.useEffect(()=>{let g=!1;if(r!=="en"&&!$a[r]){const p=++c.current;B1(r).then(m=>{if(g||c.current!==p)return;const y=m===ga&&r!=="en"?"en":r;$a[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 B1(g);if(c.current!==p)return;const y=m===ga&&g!=="en"?"en":g;$a[y]=m,l(m),i(y);try{localStorage.setItem("pave-locale",y)}catch{}},[]),d=h.useCallback((g,p)=>kj(s,g,p),[s]),f=h.useMemo(()=>({t:d,locale:a,setLocale:u,availableLocales:Ss}),[d,a,u]);return o.jsx(_j.Provider,{value:f,children:t})}function mt(){const e=h.useContext(_j);return e||{t:(t,n)=>kj(ga,t,n),locale:"en",setLocale:()=>{},availableLocales:Ss}}function hI(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Ss.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Ss.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=Ss.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function mI({darkMode:e,onToggle:t}){const{t:n}=mt();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 yI({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:i,cancelLabel:s,destructive:l}){var{t:c}=mt(),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 wj=h.createContext(null);function xI({children:e}){var{t}=mt(),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(wj.Provider,{value:l,children:[e,o.jsx(yI,{open:i.open,onClose:c,onConfirm:u,title:i.title,message:i.message,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,destructive:i.destructive})]})}function kl(){var e=h.useContext(wj);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}function bI(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 vI(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=bI(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 go="\0__other__";function kI(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]||go}else l=go;n[l]||(n[l]=[]),n[l].push(s)}const r=Object.keys(n).sort(function(i,s){return i===go?1:s===go?-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===go?t("sidebar.other"):s;a.push({key:s,label:l,sessions:n[s]})}return a}function _I({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:E}=mt(),w=kl(),[T,R]=h.useState(""),[D,A]=h.useState(null),[q,U]=h.useState(""),[K,P]=h.useState(!1),M=K||!!T,{webSessions:C,tuiSessions:L}=h.useMemo(()=>{const ne=[],Ce=[],ke=Array.isArray(e)?e:[];for(var pe=0;pe<ke.length;pe++)ke[pe].source==="tui"?Ce.push(ke[pe]):ne.push(ke[pe]);return{webSessions:ne,tuiSessions:Ce}},[e]),F=T?C.filter(function(ne){return(ne.title||E("sidebar.untitled")).toLowerCase().includes(T.toLowerCase())}):C,Q=T?L.filter(function(ne){return(ne.title||E("sidebar.untitled")).toLowerCase().includes(T.toLowerCase())}):L,S=h.useMemo(()=>kI(Q,E),[Q,E]),{pinnedSessions:Y,regularSessions:V,archivedSessions:j}=h.useMemo(()=>{const ne=[],Ce=[],ke=[];for(let pe=0;pe<F.length;pe++){const me=F[pe];me.archived?ke.push(me):me.pinned?ne.push(me):Ce.push(me)}return{pinnedSessions:ne,regularSessions:Ce,archivedSessions:ke}},[F]),$=h.useMemo(()=>vI(V,E),[V,E]),ce=ne=>{A(ne.id),U(ne.title||"")},J=ne=>{q.trim()&&l(ne,q.trim()),A(null),U("")},_e=(ne,Ce)=>{const ke=Ce&&Ce.dimmed,pe=ne.source==="legacy"||ne.source==="archive"||ne._readOnly;return o.jsx("div",{role:"button",tabIndex:0,className:`group flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${ne.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":ke?"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(ne.id),onKeyDown:me=>{me.currentTarget===me.target&&(me.key==="Enter"||me.key===" ")&&(me.preventDefault(),r(ne.id))},children:D===ne.id?o.jsx("input",{autoFocus:!0,value:q,onChange:me=>U(me.target.value),onBlur:()=>J(ne.id),onKeyDown:me=>{me.key==="Enter"?(me.preventDefault(),me.stopPropagation(),me.currentTarget.blur()):me.key==="Escape"?(me.stopPropagation(),A(null)):me.key===" "&&me.stopPropagation()},onClick:me=>me.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:[ne.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"})}),ne.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"})}),ne.compactedAt&&ne.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[ne.id]&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:E("sidebar.session_processing"),"aria-label":E("sidebar.session_processing")}),o.jsxs("span",{className:`flex-1 flex items-center min-w-0 ${ke?"italic":""}`,children:[o.jsx("span",{className:"truncate min-w-0",children:ne.title||E("sidebar.untitled")}),ne.archived&&o.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",E("sidebar.archived"),")"]})]}),o.jsxs("div",{className:"hidden group-hover:flex group-focus-within:flex items-center gap-0.5",children:[u&&(!ne.archived||ne.pinned)&&o.jsx("button",{onClick:me=>{me.stopPropagation(),u(ne.id,!ne.pinned)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:ne.pinned?E("sidebar.unpin"):E("sidebar.pin"),"aria-label":ne.pinned?E("sidebar.unpin"):E("sidebar.pin"),children:o.jsx("svg",{className:`w-3 h-3 ${ne.pinned?"text-amber-500":""}`,fill:ne.pinned?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:ne.pinned?0:1.5,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"})})}),!pe&&o.jsxs(o.Fragment,{children:[d&&o.jsx("button",{onClick:async me=>{me.stopPropagation(),!(!ne.archived&&!await w({title:E("sidebar.archive"),message:E("sidebar.confirmArchive",{defaultValue:"Archive this session? It will be hidden from the sidebar."}),confirmLabel:E("sidebar.archive")}))&&d(ne.id,!ne.archived)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:ne.archived?E("sidebar.unarchive"):E("sidebar.archive"),"aria-label":ne.archived?E("sidebar.unarchive"):E("sidebar.archive"),children:o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:ne.archived?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-2V8m-9 4l3 3m0 0l3-3m-3 3V12"}):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-2V8m-9 4h4"})})}),f&&o.jsx("button",{onClick:me=>{me.stopPropagation(),f(ne.id)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:E("sidebar.export"),"aria-label":E("sidebar.export"),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:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),o.jsx("button",{onClick:me=>{me.stopPropagation(),ce(ne)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:E("sidebar.rename"),"aria-label":E("sidebar.rename"),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.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"})})}),o.jsx("button",{onClick:me=>{me.stopPropagation(),c&&c(ne.id)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:E("sidebar.regenerate_title"),"aria-label":E("sidebar.regenerate_title"),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:"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("button",{onClick:async me=>{me.stopPropagation(),await w({title:E("sidebar.delete_title"),message:E("sidebar.delete_confirm"),destructive:!0,confirmLabel:E("sidebar.delete")})&&i(ne.id)},className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-red-500",title:E("sidebar.delete"),"aria-label":E("sidebar.delete"),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"})})})]})]})]})},ne.id)},ue=ne=>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:ne})});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:E("sidebar.show"),"aria-label":E("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:E("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:E("sidebar.hide"),"aria-label":E("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:E("app.new_chat")}),g&&o.jsx("button",{onClick:()=>{const ne=document.createElement("input");ne.type="file",ne.accept=".yaml,.yml",ne.onchange=Ce=>{const ke=Ce&&Ce.target&&Ce.target.files,pe=ke&&ke[0];if(pe){const me=pe.name.toLowerCase();if(!me.endsWith(".yaml")&&!me.endsWith(".yml")){p&&p(E("import.invalid_file_type"));return}const De=10*1024*1024;if(pe.size>De){p&&p(E("import.file_too_large"));return}const Ne=new FileReader;Ne.onload=Ee=>{const Oe=Ee&&Ee.target?Ee.target.result:null;if(typeof Oe!="string"){p&&p(E("import.read_error"));return}g(Oe)},Ne.onerror=()=>{p&&p(E("import.read_error"))},Ne.readAsText(pe)}},ne.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:E("sidebar.import"),"aria-label":E("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:E("sidebar.search_placeholder"),value:T,onChange:ne=>R(ne.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:[Y.length===0&&$.every(ne=>ne.sessions.length===0)&&(!m||j.length===0)&&Q.length===0&&o.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:E(T?"sidebar.no_matches":"sidebar.no_conversations")}),Y.length>0&&o.jsxs(o.Fragment,{children:[ue(E("sidebar.pinned")),Y.map(ne=>_e(ne))]}),$.map(ne=>o.jsxs("div",{children:[(Y.length>0||$.length>1)&&ue(ne.label),ne.sessions.map(Ce=>_e(Ce))]},ne.key)),m&&j.length>0&&o.jsxs(o.Fragment,{children:[ue(E("sidebar.archived")),j.map(ne=>_e(ne,{dimmed:!0}))]}),Q.length>0&&o.jsxs(o.Fragment,{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:()=>{T||P(ne=>!ne)},"aria-expanded":M,disabled:!!T,children:[o.jsx("svg",{className:`w-3 h-3 text-gray-400 dark:text-gray-500 transition-transform duration-200 ${M?"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:E("sidebar.terminal")}),o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",Q.length,")"]})]}),M&&S.map(ne=>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:ne.label})]}),ne.sessions.map(Ce=>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 ${Ce.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(Ce.id),onKeyDown:ke=>{ke.currentTarget===ke.target&&(ke.key==="Enter"||ke.key===" ")&&(ke.preventDefault(),r(Ce.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:Ce.title||E("sidebar.untitled")})]},Ce.id))]},ne.key))]}),k&&!T&&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"})}),E("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"})}),E(m?"sidebar.hide_archived":"sidebar.show_archived")]})}),F.some(function(ne){return ne.source!=="legacy"&&!ne._readOnly})&&s&&o.jsx("div",{className:"pt-3 pb-2 px-1",children:o.jsxs("button",{onClick:async()=>{await w({title:E("sidebar.delete_all_title"),message:E("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:E("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"})}),E("sidebar.delete_all")]})})]})]})]})}function wI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const EI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SI={};function z1(e,t){return(SI.jsx?NI:EI).test(e)}const CI=/[ \t\n\f\r]/g;function jI(e){return typeof e=="object"?e.type==="text"?U1(e.value):!1:U1(e)}function U1(e){return e.replace(CI,"")===""}class _l{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}_l.prototype.normal={};_l.prototype.property={};_l.prototype.space=void 0;function Ej(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new _l(n,r,t)}function Wy(e){return e.toLowerCase()}class Yn{constructor(t,n){this.attribute=n,this.property=t}}Yn.prototype.attribute="";Yn.prototype.booleanish=!1;Yn.prototype.boolean=!1;Yn.prototype.commaOrSpaceSeparated=!1;Yn.prototype.commaSeparated=!1;Yn.prototype.defined=!1;Yn.prototype.mustUseProperty=!1;Yn.prototype.number=!1;Yn.prototype.overloadedBoolean=!1;Yn.prototype.property="";Yn.prototype.spaceSeparated=!1;Yn.prototype.space=void 0;let TI=0;const st=Pi(),nn=Pi(),Vy=Pi(),Ae=Pi(),Dt=Pi(),Si=Pi(),Jn=Pi();function Pi(){return 2**++TI}const Gy=Object.freeze(Object.defineProperty({__proto__:null,boolean:st,booleanish:nn,commaOrSpaceSeparated:Jn,commaSeparated:Si,number:Ae,overloadedBoolean:Vy,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),_f=Object.keys(Gy);class yb extends Yn{constructor(t,n,r,a){let i=-1;if(super(t,n),q1(this,"space",a),typeof r=="number")for(;++i<_f.length;){const s=_f[i];q1(this,_f[i],(r&Gy[s])===Gy[s])}}}yb.prototype.defined=!0;function q1(e,t,n){n&&(e[t]=n)}function Bs(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new yb(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Wy(r)]=r,n[Wy(i.attribute)]=r}return new _l(t,n,e.space)}const Nj=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Dt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:Ae,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Dt,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:nn,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Sj(e,t){return t in e?e[t]:t}function Cj(e,t){return Sj(e,t.toLowerCase())}const AI=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Si,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:st,allowPaymentRequest:st,allowUserMedia:st,alpha:st,alt:null,as:null,async:st,autoCapitalize:null,autoComplete:Dt,autoFocus:st,autoPlay:st,blocking:Dt,capture:null,charSet:null,checked:st,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:Ae,colSpan:Ae,command:null,commandFor:null,content:null,contentEditable:nn,controls:st,controlsList:Dt,coords:Ae|Si,crossOrigin:null,data:null,dateTime:null,decoding:null,default:st,defer:st,dir:null,dirName:null,disabled:st,download:Vy,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:st,formTarget:null,headers:Dt,height:Ae,hidden:Vy,high:Ae,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:st,inputMode:null,integrity:null,is:null,isMap:st,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:st,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:st,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:st,muted:st,name:null,nonce:null,noModule:st,noValidate:st,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:st,optimum:Ae,pattern:null,ping:Dt,placeholder:null,playsInline:st,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:st,referrerPolicy:null,rel:Dt,required:st,reversed:st,rows:Ae,rowSpan:Ae,sandbox:Dt,scope:null,scoped:st,seamless:st,selected:st,shadowRootClonable:st,shadowRootCustomElementRegistry:st,shadowRootDelegatesFocus:st,shadowRootMode:null,shadowRootSerializable:st,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:st,useMap:null,value:nn,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:st,declare:st,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:st,noHref:st,noShade:st,noWrap:st,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:st,disablePictureInPicture:st,disableRemotePlayback:st,exportParts:Si,part:Dt,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:Cj}),RI=Bs({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:Jn,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:Dt,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:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:st,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,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:Si,g2:Si,glyphName:Si,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:Jn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,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:Ae,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:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jn,rev:Jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jn,requiredFeatures:Jn,requiredFonts:Jn,requiredFormats:Jn,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:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:Jn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Jn,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Jn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Sj}),jj=Bs({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()}}),Tj=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Cj}),Aj=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),MI={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"},II=/[A-Z]/g,$1=/-[a-z]/g,LI=/^data[-\w.:]+$/i;function OI(e,t){const n=Wy(t);let r=t,a=Yn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&LI.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($1,PI);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$1.test(i)){let s=i.replace(II,DI);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=yb}return new a(r,t)}function DI(e){return"-"+e.toLowerCase()}function PI(e){return e.charAt(1).toUpperCase()}const FI=Ej([Nj,AI,jj,Tj,Aj],"html"),xb=Ej([Nj,RI,jj,Tj,Aj],"svg");function BI(e){return e.join(" ").trim()}var bb={},H1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,zI=/\n/g,UI=/^\s*/,qI=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$I=/^:\s*/,HI=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,WI=/^[;\s]*/,VI=/^\s+|\s+$/g,GI=`
49
- `,W1="/",V1="*",bi="",KI="comment",YI="declaration";function QI(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(zI);y&&(n+=y.length);var v=m.lastIndexOf(GI);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(UI)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=i();if(!(W1!=e.charAt(0)||V1!=e.charAt(1))){for(var y=2;bi!=e.charAt(y)&&(V1!=e.charAt(y)||W1!=e.charAt(y+1));)++y;if(y+=2,bi===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:KI,comment:v})}}function g(){var m=i(),y=c(qI);if(y){if(f(),!c($I))return l("property missing ':'");var v=c(HI),x=m({type:YI,property:G1(y[0].replace(H1,bi)),value:v?G1(v[0].replace(H1,bi)):bi});return c(WI),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 G1(e){return e?e.replace(VI,bi):bi}var XI=QI,ZI=za&&za.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bb,"__esModule",{value:!0});bb.default=eL;const JI=ZI(XI);function eL(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,JI.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 Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.camelCase=void 0;var tL=/^--[a-zA-Z0-9_-]+$/,nL=/-([a-z])/g,rL=/^[^-]+$/,aL=/^-(webkit|moz|ms|o|khtml)-/,iL=/^-(ms)-/,sL=function(e){return!e||rL.test(e)||tL.test(e)},oL=function(e,t){return t.toUpperCase()},K1=function(e,t){return"".concat(t,"-")},lL=function(e,t){return t===void 0&&(t={}),sL(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(iL,K1):e=e.replace(aL,K1),e.replace(nL,oL))};Yu.camelCase=lL;var cL=za&&za.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},uL=cL(bb),dL=Yu;function Ky(e,t){var n={};return!e||typeof e!="string"||(0,uL.default)(e,function(r,a){r&&a&&(n[(0,dL.camelCase)(r,t)]=a)}),n}Ky.default=Ky;var fL=Ky;const gL=hl(fL),Rj=Mj("end"),vb=Mj("start");function Mj(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 pL(e){const t=vb(e),n=Rj(e);if(t&&n)return{start:t,end:n}}function zo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Y1(e.position):"start"in e||"end"in e?Y1(e):"line"in e||"column"in e?Yy(e):""}function Yy(e){return Q1(e&&e.line)+":"+Q1(e&&e.column)}function Y1(e){return Yy(e&&e.start)+"-"+Yy(e&&e.end)}function Q1(e){return e&&typeof e=="number"?e:1}class Ln 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=zo(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}}Ln.prototype.file="";Ln.prototype.name="";Ln.prototype.reason="";Ln.prototype.message="";Ln.prototype.stack="";Ln.prototype.column=void 0;Ln.prototype.line=void 0;Ln.prototype.ancestors=void 0;Ln.prototype.cause=void 0;Ln.prototype.fatal=void 0;Ln.prototype.place=void 0;Ln.prototype.ruleId=void 0;Ln.prototype.source=void 0;const kb={}.hasOwnProperty,hL=new Map,mL=/[A-Z]/g,yL=new Set(["table","tbody","thead","tfoot","tr"]),xL=new Set(["td","th"]),Ij="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bL(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=CL(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=SL(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"?xb:FI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Lj(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Lj(e,t,n){if(t.type==="element")return vL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return wL(e,t,n);if(t.type==="mdxjsEsm")return _L(e,t);if(t.type==="root")return EL(e,t,n);if(t.type==="text")return NL(e,t)}function vL(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=xb,e.schema=a),e.ancestors.push(t);const i=Dj(e,t.tagName,!1),s=jL(e,t);let l=wb(e,t);return yL.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!jI(c):!0})),Oj(e,s,i,t),_b(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function kL(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)}ll(e,t.position)}function _L(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ll(e,t.position)}function wL(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=xb,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Dj(e,t.name,!0),s=TL(e,t),l=wb(e,t);return Oj(e,s,i,t),_b(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function EL(e,t,n){const r={};return _b(r,wb(e,t)),e.create(t,e.Fragment,r,n)}function NL(e,t){return t.value}function Oj(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function _b(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function SL(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 CL(e,t){return n;function n(r,a,i,s){const l=Array.isArray(i.children),c=vb(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 jL(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&kb.call(t.properties,a)){const i=AL(e,a,t.properties[a]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&xL.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 TL(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 ll(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 ll(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function wb(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:hL;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=Lj(e,i,s);l!==void 0&&n.push(l)}return n}function AL(e,t,n){const r=OI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?wI(n):BI(n)),r.property==="style"){let a=typeof n=="object"?n:RL(e,String(n));return e.stylePropertyNameCase==="css"&&(a=ML(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?MI[r.property]||r.property:r.attribute,n]}}function RL(e,t){try{return gL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Ln("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=Ij+"#cannot-parse-style-attribute",a}}function Dj(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=z1(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=z1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return kb.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);ll(e)}function ll(e,t){const n=new Ln("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=Ij+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ML(e){const t={};let n;for(n in e)kb.call(e,n)&&(t[IL(n)]=e[n]);return t}function IL(e){let t=e.replace(mL,LL);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function LL(e){return"-"+e.toLowerCase()}const wf={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"]},OL={};function Eb(e,t){const n=OL,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Pj(e,r,a)}function Pj(e,t,n){if(DL(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 X1(e.children,t,n)}return Array.isArray(e)?X1(e,t,n):""}function X1(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Pj(e[a],t,n);return r.join("")}function DL(e){return!!(e&&typeof e=="object")}const Z1=document.createElement("i");function Nb(e){const t="&"+e+";";Z1.innerHTML=t;const n=Z1.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 pr(e,t){return e.length>0?(ar(e,e.length,0,t),e):t}const J1={}.hasOwnProperty;function Fj(e){const t={};let n=-1;for(;++n<e.length;)PL(t,e[n]);return t}function PL(e,t){let n;for(n in t){const a=(J1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){J1.call(a,s)||(a[s]=[]);const l=i[s];FL(a[s],Array.isArray(l)?l:l?[l]:[])}}}function FL(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 Bj(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 Rr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pn=si(/[A-Za-z]/),Mn=si(/[\dA-Za-z]/),BL=si(/[#-'*+\--9=?A-Z^-~]/);function xu(e){return e!==null&&(e<32||e===127)}const Qy=si(/\d/),zL=si(/[\dA-Fa-f]/),UL=si(/[!-/:-@[-`{-~]/);function nt(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function pt(e){return e===-2||e===-1||e===32}const Qu=si(new RegExp("\\p{P}|\\p{S}","u")),Li=si(/\s/);function si(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zs(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&Mn(e.charCodeAt(n+1))&&Mn(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 vt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return pt(c)?(e.enter(n),l(c)):t(c)}function l(c){return pt(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const qL={tokenize:$L};function $L(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"),vt(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 nt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),s)}}const HL={tokenize:WL},ek={tokenize:VL};function WL(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 E=N,w;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){w=t.events[E][1].end;break}x(r);let T=N;for(;T<t.events.length;)t.events[T][1].end={...w},T++;return ar(t.events,E+1,0,t.events.slice(N)),t.events.length=T,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(ek,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(ek,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 nt(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),y)}function v(k,N){const E=t.sliceStream(k);if(N&&E.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(E),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 T=t.events.length;let R=T,D,A;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(D){A=t.events[R][1].end;break}D=!0}for(x(r),w=T;w<t.events.length;)t.events[w][1].end={...A},w++;ar(t.events,R+1,0,t.events.slice(T)),t.events.length=w}}function x(k){let N=n.length;for(;N-- >k;){const E=n[N];t.containerState=E[1],E[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 VL(e,t,n){return vt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ls(e){if(e===null||Pt(e)||Li(e))return 1;if(Qu(e))return 2}function Xu(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 Xy={name:"attention",resolveAll:GL,tokenize:KL};function GL(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};tk(f,-c),tk(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=pr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=pr(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=pr(u,Xu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=pr(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=pr(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 KL(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ls(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=Ls(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 tk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YL={name:"autolink",tokenize:QL};function QL(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 Pn(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Mn(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||Mn(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||xu(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):BL(p)?(e.consume(p),u):n(p)}function d(p){return Mn(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||Mn(p))&&r++<63){const m=p===45?g:f;return e.consume(p),m}return n(p)}}const wl={partial:!0,tokenize:XL};function XL(e,t,n){return r;function r(i){return pt(i)?vt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||nt(i)?t(i):n(i)}}const zj={continuation:{tokenize:JL},exit:eO,name:"blockQuote",tokenize:ZL};function ZL(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 pt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function JL(e,t,n){const r=this;return a;function a(s){return pt(s)?vt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(zj,t,n)(s)}}function eO(e){e.exit("blockQuote")}const Uj={name:"characterEscape",tokenize:tO};function tO(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 UL(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const qj={name:"characterReference",tokenize:nO};function nO(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=Mn,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=zL,d):(e.enter("characterReferenceValue"),i=7,s=Qy,d(f))}function d(f){if(f===59&&a){const g=e.exit("characterReferenceValue");return s===Mn&&!Nb(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 nk={partial:!0,tokenize:aO},rk={concrete:!0,name:"codeFenced",tokenize:rO};function rO(e,t,n){const r=this,a={partial:!0,tokenize:E};let i=0,s=0,l;return c;function c(w){return u(w)}function u(w){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[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"),pt(w)?vt(e,f,"whitespace")(w):f(w))}function f(w){return w===null||nt(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(nk,y,N)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||nt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(w)):pt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vt(e,p,"whitespace")(w)):w===96&&w===l?n(w):(e.consume(w),g)}function p(w){return w===null||nt(w)?f(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||nt(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&&pt(w)?vt(e,b,"linePrefix",i+1)(w):b(w)}function b(w){return w===null||nt(w)?e.check(nk,y,N)(w):(e.enter("codeFlowValue"),k(w))}function k(w){return w===null||nt(w)?(e.exit("codeFlowValue"),b(w)):(e.consume(w),k)}function N(w){return e.exit("codeFenced"),t(w)}function E(w,T,R){let D=0;return A;function A(M){return w.enter("lineEnding"),w.consume(M),w.exit("lineEnding"),q}function q(M){return w.enter("codeFencedFence"),pt(M)?vt(w,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):U(M)}function U(M){return M===l?(w.enter("codeFencedFenceSequence"),K(M)):R(M)}function K(M){return M===l?(D++,w.consume(M),K):D>=s?(w.exit("codeFencedFenceSequence"),pt(M)?vt(w,P,"whitespace")(M):P(M)):R(M)}function P(M){return M===null||nt(M)?(w.exit("codeFencedFence"),T(M)):R(M)}}}function aO(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 Ef={name:"codeIndented",tokenize:sO},iO={partial:!0,tokenize:oO};function sO(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),vt(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):nt(u)?e.attempt(iO,s,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||nt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function oO(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):nt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):vt(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):nt(s)?a(s):n(s)}}const lO={name:"codeText",previous:uO,resolve:cO,tokenize:dO};function cO(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 uO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dO(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)):nt(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||nt(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 fO{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&&po(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),po(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),po(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);po(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);po(this.left,n.reverse())}}}function po(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 $j(e){const t={};let n=-1,r,a,i,s,l,c,u;const d=new fO(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,gO(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 gO(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 pO={resolve:mO,tokenize:yO},hO={partial:!0,tokenize:xO};function mO(e){return $j(e),e}function yO(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):nt(l)?e.check(hO,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 xO(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),vt(e,i,"linePrefix")}function i(s){if(s===null||nt(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 Hj(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||xu(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||nt(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||Pt(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||xu(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 Wj(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):nt(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||nt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!pt(p)),p===92?g:f)}function g(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function Vj(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):nt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),vt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===s||g===null||nt(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 Uo(e,t){let n;return r;function r(a){return nt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):pt(a)?vt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const bO={name:"definition",tokenize:kO},vO={partial:!0,tokenize:_O};function kO(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Wj.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return a=Rr(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 Pt(p)?Uo(e,u)(p):u(p)}function u(p){return Hj(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(vO,f,f)(p)}function f(p){return pt(p)?vt(e,g,"whitespace")(p):g(p)}function g(p){return p===null||nt(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function _O(e,t,n){return r;function r(l){return Pt(l)?Uo(e,a)(l):n(l)}function a(l){return Vj(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return pt(l)?vt(e,s,"whitespace")(l):s(l)}function s(l){return l===null||nt(l)?t(l):n(l)}}const wO={name:"hardBreakEscape",tokenize:EO};function EO(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return nt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const NO={name:"headingAtx",resolve:SO,tokenize:CO};function SO(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 CO(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||Pt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||nt(d)?(e.exit("atxHeading"),t(d)):pt(d)?vt(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||Pt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const jO=["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"],ak=["pre","script","style","textarea"],TO={concrete:!0,name:"htmlFlow",resolveTo:MO,tokenize:IO},AO={partial:!0,tokenize:OO},RO={partial:!0,tokenize:LO};function MO(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 IO(e,t,n){const r=this;let a,i,s,l,c;return u;function u(j){return d(j)}function d(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),f}function f(j){return j===33?(e.consume(j),g):j===47?(e.consume(j),i=!0,y):j===63?(e.consume(j),a=3,r.interrupt?t:S):Pn(j)?(e.consume(j),s=String.fromCharCode(j),v):n(j)}function g(j){return j===45?(e.consume(j),a=2,p):j===91?(e.consume(j),a=5,l=0,m):Pn(j)?(e.consume(j),a=4,r.interrupt?t:S):n(j)}function p(j){return j===45?(e.consume(j),r.interrupt?t:S):n(j)}function m(j){const $="CDATA[";return j===$.charCodeAt(l++)?(e.consume(j),l===$.length?r.interrupt?t:U:m):n(j)}function y(j){return Pn(j)?(e.consume(j),s=String.fromCharCode(j),v):n(j)}function v(j){if(j===null||j===47||j===62||Pt(j)){const $=j===47,ce=s.toLowerCase();return!$&&!i&&ak.includes(ce)?(a=1,r.interrupt?t(j):U(j)):jO.includes(s.toLowerCase())?(a=6,$?(e.consume(j),x):r.interrupt?t(j):U(j)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):i?b(j):k(j))}return j===45||Mn(j)?(e.consume(j),s+=String.fromCharCode(j),v):n(j)}function x(j){return j===62?(e.consume(j),r.interrupt?t:U):n(j)}function b(j){return pt(j)?(e.consume(j),b):A(j)}function k(j){return j===47?(e.consume(j),A):j===58||j===95||Pn(j)?(e.consume(j),N):pt(j)?(e.consume(j),k):A(j)}function N(j){return j===45||j===46||j===58||j===95||Mn(j)?(e.consume(j),N):E(j)}function E(j){return j===61?(e.consume(j),w):pt(j)?(e.consume(j),E):k(j)}function w(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),c=j,T):pt(j)?(e.consume(j),w):R(j)}function T(j){return j===c?(e.consume(j),c=null,D):j===null||nt(j)?n(j):(e.consume(j),T)}function R(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Pt(j)?E(j):(e.consume(j),R)}function D(j){return j===47||j===62||pt(j)?k(j):n(j)}function A(j){return j===62?(e.consume(j),q):n(j)}function q(j){return j===null||nt(j)?U(j):pt(j)?(e.consume(j),q):n(j)}function U(j){return j===45&&a===2?(e.consume(j),C):j===60&&a===1?(e.consume(j),L):j===62&&a===4?(e.consume(j),Y):j===63&&a===3?(e.consume(j),S):j===93&&a===5?(e.consume(j),Q):nt(j)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(AO,V,K)(j)):j===null||nt(j)?(e.exit("htmlFlowData"),K(j)):(e.consume(j),U)}function K(j){return e.check(RO,P,V)(j)}function P(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),M}function M(j){return j===null||nt(j)?K(j):(e.enter("htmlFlowData"),U(j))}function C(j){return j===45?(e.consume(j),S):U(j)}function L(j){return j===47?(e.consume(j),s="",F):U(j)}function F(j){if(j===62){const $=s.toLowerCase();return ak.includes($)?(e.consume(j),Y):U(j)}return Pn(j)&&s.length<8?(e.consume(j),s+=String.fromCharCode(j),F):U(j)}function Q(j){return j===93?(e.consume(j),S):U(j)}function S(j){return j===62?(e.consume(j),Y):j===45&&a===2?(e.consume(j),S):U(j)}function Y(j){return j===null||nt(j)?(e.exit("htmlFlowData"),V(j)):(e.consume(j),Y)}function V(j){return e.exit("htmlFlow"),t(j)}}function LO(e,t,n){const r=this;return a;function a(s){return nt(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 OO(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(wl,t,n)}}const DO={name:"htmlText",tokenize:PO};function PO(e,t,n){const r=this;let a,i,s;return l;function l(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),c}function c(S){return S===33?(e.consume(S),u):S===47?(e.consume(S),E):S===63?(e.consume(S),k):Pn(S)?(e.consume(S),R):n(S)}function u(S){return S===45?(e.consume(S),d):S===91?(e.consume(S),i=0,m):Pn(S)?(e.consume(S),b):n(S)}function d(S){return S===45?(e.consume(S),p):n(S)}function f(S){return S===null?n(S):S===45?(e.consume(S),g):nt(S)?(s=f,L(S)):(e.consume(S),f)}function g(S){return S===45?(e.consume(S),p):f(S)}function p(S){return S===62?C(S):S===45?g(S):f(S)}function m(S){const Y="CDATA[";return S===Y.charCodeAt(i++)?(e.consume(S),i===Y.length?y:m):n(S)}function y(S){return S===null?n(S):S===93?(e.consume(S),v):nt(S)?(s=y,L(S)):(e.consume(S),y)}function v(S){return S===93?(e.consume(S),x):y(S)}function x(S){return S===62?C(S):S===93?(e.consume(S),x):y(S)}function b(S){return S===null||S===62?C(S):nt(S)?(s=b,L(S)):(e.consume(S),b)}function k(S){return S===null?n(S):S===63?(e.consume(S),N):nt(S)?(s=k,L(S)):(e.consume(S),k)}function N(S){return S===62?C(S):k(S)}function E(S){return Pn(S)?(e.consume(S),w):n(S)}function w(S){return S===45||Mn(S)?(e.consume(S),w):T(S)}function T(S){return nt(S)?(s=T,L(S)):pt(S)?(e.consume(S),T):C(S)}function R(S){return S===45||Mn(S)?(e.consume(S),R):S===47||S===62||Pt(S)?D(S):n(S)}function D(S){return S===47?(e.consume(S),C):S===58||S===95||Pn(S)?(e.consume(S),A):nt(S)?(s=D,L(S)):pt(S)?(e.consume(S),D):C(S)}function A(S){return S===45||S===46||S===58||S===95||Mn(S)?(e.consume(S),A):q(S)}function q(S){return S===61?(e.consume(S),U):nt(S)?(s=q,L(S)):pt(S)?(e.consume(S),q):D(S)}function U(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),a=S,K):nt(S)?(s=U,L(S)):pt(S)?(e.consume(S),U):(e.consume(S),P)}function K(S){return S===a?(e.consume(S),a=void 0,M):S===null?n(S):nt(S)?(s=K,L(S)):(e.consume(S),K)}function P(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Pt(S)?D(S):(e.consume(S),P)}function M(S){return S===47||S===62||Pt(S)?D(S):n(S)}function C(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function L(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),F}function F(S){return pt(S)?vt(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):Q(S)}function Q(S){return e.enter("htmlTextData"),s(S)}}const Sb={name:"labelEnd",resolveAll:UO,resolveTo:qO,tokenize:$O},FO={tokenize:HO},BO={tokenize:WO},zO={tokenize:VO};function UO(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 qO(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=pr(l,e.slice(i+1,i+r+3)),l=pr(l,[["enter",d,t]]),l=pr(l,Xu(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),l=pr(l,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),l=pr(l,e.slice(s+1)),l=pr(l,[["exit",c,t]]),ar(e,i,e.length,l),e}function $O(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(Rr(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(FO,d,s?d:f)(g):g===91?e.attempt(BO,d,s?u:f)(g):s?d(g):f(g)}function u(g){return e.attempt(zO,d,f)(g)}function d(g){return t(g)}function f(g){return i._balanced=!0,n(g)}}function HO(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 Pt(f)?Uo(e,i)(f):i(f)}function i(f){return f===41?d(f):Hj(e,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return Pt(f)?Uo(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Vj(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Pt(f)?Uo(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 WO(e,t,n){const r=this;return a;function a(l){return Wj.call(r,e,i,s,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function s(l){return n(l)}}function VO(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 GO={name:"labelStartImage",resolveAll:Sb.resolveAll,tokenize:KO};function KO(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 YO={name:"labelStartLink",resolveAll:Sb.resolveAll,tokenize:QO};function QO(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 Nf={name:"lineEnding",tokenize:XO};function XO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),vt(e,t,"linePrefix")}}const Hc={name:"thematicBreak",tokenize:ZO};function ZO(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||nt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),pt(u)?vt(e,l,"whitespace")(u):l(u))}}const qn={continuation:{tokenize:nD},exit:aD,name:"list",tokenize:tD},JO={partial:!0,tokenize:iD},eD={partial:!0,tokenize:rD};function tD(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:Qy(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(Hc,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 Qy(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(wl,r.interrupt?n:d,e.attempt(JO,g,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,g(p)}function f(p){return pt(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 nD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wl,a,i);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!pt(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(eD,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,vt(e,e.attempt(qn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function rD(e,t,n){const r=this;return vt(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 aD(e){e.exit(this.containerState.type)}function iD(e,t,n){const r=this;return vt(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!pt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const ik={name:"setextUnderline",resolveTo:sD,tokenize:oD};function sD(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 oD(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"),pt(u)?vt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||nt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const lD={tokenize:cD};function cD(e){const t=this,n=e.attempt(wl,r,e.attempt(this.parser.constructs.flowInitial,a,vt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(pO,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 uD={resolveAll:Kj()},dD=Gj("string"),fD=Gj("text");function Gj(e){return{resolveAll:Kj(e==="text"?gD: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 Kj(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 gD(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 pD={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:zj},hD={91:bO},mD={[-2]:Ef,[-1]:Ef,32:Ef},yD={35:NO,42:Hc,45:[ik,Hc],60:TO,61:ik,95:Hc,96:rk,126:rk},xD={38:qj,92:Uj},bD={[-5]:Nf,[-4]:Nf,[-3]:Nf,33:GO,38:qj,42:Xy,60:[YL,DO],91:YO,92:[wO,Uj],93:Sb,95:Xy,96:lO},vD={null:[Xy,uD]},kD={null:[42,95]},_D={null:[]},wD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kD,contentInitial:hD,disable:_D,document:pD,flow:yD,flowInitial:mD,insideSpan:vD,string:xD,text:bD},Symbol.toStringTag,{value:"Module"}));function ED(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:T(E),check:T(w),consume:b,enter:k,exit:N,interrupt:T(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(q){return s=pr(s,q),v(),s[s.length-1]!==null?[]:(R(t,0),u.events=Xu(i,u.events,u),u.events)}function g(q,U){return SD(p(q),U)}function p(q){return ND(s,q)}function m(){const{_bufferIndex:q,_index:U,line:K,column:P,offset:M}=r;return{_bufferIndex:q,_index:U,line:K,column:P,offset:M}}function y(q){a[q.line]=q.column,A()}function v(){let q;for(;r._index<s.length;){const U=s[r._index];if(typeof U=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<U.length;)x(U.charCodeAt(r._bufferIndex));else x(U)}}function x(q){d=d(q)}function b(q){nt(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,A()):q!==-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=q}function k(q,U){const K=U||{};return K.type=q,K.start=m(),u.events.push(["enter",K,u]),l.push(K),K}function N(q){const U=l.pop();return U.end=m(),u.events.push(["exit",U,u]),U}function E(q,U){R(q,U.from)}function w(q,U){U.restore()}function T(q,U){return K;function K(P,M,C){let L,F,Q,S;return Array.isArray(P)?V(P):"tokenize"in P?V([P]):Y(P);function Y(J){return _e;function _e(ue){const ne=ue!==null&&J[ue],Ce=ue!==null&&J.null,ke=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return V(ke)(ue)}}function V(J){return L=J,F=0,J.length===0?C:j(J[F])}function j(J){return _e;function _e(ue){return S=D(),Q=J,J.partial||(u.currentConstruct=J),J.name&&u.parser.constructs.disable.null.includes(J.name)?ce():J.tokenize.call(U?Object.assign(Object.create(u),U):u,c,$,ce)(ue)}}function $(J){return q(Q,S),M}function ce(J){return S.restore(),++F<L.length?j(L[F]):C}}}function R(q,U){q.resolveAll&&!i.includes(q)&&i.push(q),q.resolve&&ar(u.events,U,u.events.length-U,q.resolve(u.events.slice(U),u)),q.resolveTo&&(u.events=q.resolveTo(u.events,u))}function D(){const q=m(),U=u.previous,K=u.currentConstruct,P=u.events.length,M=Array.from(l);return{from:P,restore:C};function C(){r=q,u.previous=U,u.currentConstruct=K,u.events.length=P,l=M,A()}}function A(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function ND(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 SD(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 CD(e){const r={constructs:Fj([wD,...(e||{}).extensions||[]]),content:a(qL),defined:[],document:a(HL),flow:a(lD),lazy:{},string:a(dD),text:a(fD)};return r;function a(i){return s;function s(l){return ED(r,i,l)}}}function jD(e){for(;!$j(e););return e}const sk=/[\0\t\n\r]/g;function TD(){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(sk.lastIndex=f,u=sk.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 AD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RD(e){return e.replace(AD,MD)}function MD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Bj(n.slice(i?2:1),i?16:10)}return Nb(n)||e}const Yj={}.hasOwnProperty;function ID(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),LD(n)(jD(CD(n).document().write(TD()(e,t,!0))))}function LD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(he),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(Ne),blockQuote:i(Ce),characterEscape:D,characterReference:D,codeFenced:i(ke),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ke,s),codeText:i(pe,s),codeTextData:D,data:D,codeFlowValue:D,definition:i(me),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(De),hardBreakEscape:i(Ee),hardBreakTrailing:i(Ee),htmlFlow:i(Oe,s),htmlFlowData:D,htmlText:i(Oe,s),htmlTextData:D,image:i(fe),label:s,link:i(he),listItem:i(Z),listItemValue:g,listOrdered:i(Le,f),listUnordered:i(Le),paragraph:i(ve),reference:j,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(Ne),strong:i(Re),thematicBreak:i(Ge)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:ne,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:J,characterReference:_e,codeFenced:c(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:A,codeIndented:c(x),codeText:c(M),codeTextData:A,data:A,definition:c(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(U),hardBreakTrailing:c(U),htmlFlow:c(K),htmlFlowData:A,htmlText:c(P),htmlTextData:A,image:c(L),label:Q,labelText:F,lineEnding:q,link:c(C),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:$,resourceDestinationString:S,resourceTitleString:Y,resource:V,setextHeading:c(R),setextHeadingLineSequence:T,setextHeadingText:w,strong:c(),thematicBreak:c()}};Qj(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let z={type:"root",children:[]};const re={stack:[z],tokenStack:[],config:t,enter:l,exit:u,buffer:s,resume:d,data:n},le=[];let Se=-1;for(;++Se<W.length;)if(W[Se][1].type==="listOrdered"||W[Se][1].type==="listUnordered")if(W[Se][0]==="enter")le.push(Se);else{const ze=le.pop();Se=a(W,ze,Se)}for(Se=-1;++Se<W.length;){const ze=t[W[Se][0]];Yj.call(ze,W[Se][1].type)&&ze[W[Se][1].type].call(Object.assign({sliceSerialize:W[Se][2].sliceSerialize},re),W[Se][1])}if(re.tokenStack.length>0){const ze=re.tokenStack[re.tokenStack.length-1];(ze[1]||ok).call(re,void 0,ze[0])}for(z.position={start:Aa(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Aa(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Se=-1;++Se<t.transforms.length;)z=t.transforms[Se](z)||z;return z}function a(W,z,re){let le=z-1,Se=-1,ze=!1,Ve,Ke,ot,wt;for(;++le<=re;){const _t=W[le];switch(_t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{_t[0]==="enter"?Se++:Se--,wt=void 0;break}case"lineEndingBlank":{_t[0]==="enter"&&(Ve&&!wt&&!Se&&!ot&&(ot=le),wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wt=void 0}if(!Se&&_t[0]==="enter"&&_t[1].type==="listItemPrefix"||Se===-1&&_t[0]==="exit"&&(_t[1].type==="listUnordered"||_t[1].type==="listOrdered")){if(Ve){let Jt=le;for(Ke=void 0;Jt--;){const ye=W[Jt];if(ye[1].type==="lineEnding"||ye[1].type==="lineEndingBlank"){if(ye[0]==="exit")continue;Ke&&(W[Ke][1].type="lineEndingBlank",ze=!0),ye[1].type="lineEnding",Ke=Jt}else if(!(ye[1].type==="linePrefix"||ye[1].type==="blockQuotePrefix"||ye[1].type==="blockQuotePrefixWhitespace"||ye[1].type==="blockQuoteMarker"||ye[1].type==="listItemIndent"))break}ot&&(!Ke||ot<Ke)&&(Ve._spread=!0),Ve.end=Object.assign({},Ke?W[Ke][1].start:_t[1].end),W.splice(Ke||le,0,["exit",Ve,_t[2]]),le++,re++}if(_t[1].type==="listItemPrefix"){const Jt={type:"listItem",_spread:!1,start:Object.assign({},_t[1].start),end:void 0};Ve=Jt,W.splice(le,0,["enter",Jt,_t[2]]),le++,re++,ot=void 0,wt=!0}}}return W[z][1]._spread=ze,re}function i(W,z){return re;function re(le){l.call(this,W(le),le),z&&z.call(this,le)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(W,z,re){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([z,re||void 0]),W.position={start:Aa(z.start),end:void 0}}function c(W){return z;function z(re){W&&W.call(this,re),u.call(this,re)}}function u(W,z){const re=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==W.type&&(z?z.call(this,W,le[0]):(le[1]||ok).call(this,W,le[0]));else throw new Error("Cannot close `"+W.type+"` ("+zo({start:W.start,end:W.end})+"): it’s not open");re.position.end=Aa(W.end)}function d(){return Eb(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(W){if(this.data.expectingFirstListItemValue){const z=this.stack[this.stack.length-2];z.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),z=this.stack[this.stack.length-1];z.lang=W}function m(){const W=this.resume(),z=this.stack[this.stack.length-1];z.meta=W}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const W=this.resume(),z=this.stack[this.stack.length-1];z.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const W=this.resume(),z=this.stack[this.stack.length-1];z.value=W.replace(/(\r?\n|\r)$/g,"")}function b(W){const z=this.resume(),re=this.stack[this.stack.length-1];re.label=z,re.identifier=Rr(this.sliceSerialize(W)).toLowerCase()}function k(){const W=this.resume(),z=this.stack[this.stack.length-1];z.title=W}function N(){const W=this.resume(),z=this.stack[this.stack.length-1];z.url=W}function E(W){const z=this.stack[this.stack.length-1];if(!z.depth){const re=this.sliceSerialize(W).length;z.depth=re}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function T(W){const z=this.stack[this.stack.length-1];z.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function D(W){const re=this.stack[this.stack.length-1].children;let le=re[re.length-1];(!le||le.type!=="text")&&(le=Be(),le.position={start:Aa(W.start),end:void 0},re.push(le)),this.stack.push(le)}function A(W){const z=this.stack.pop();z.value+=this.sliceSerialize(W),z.position.end=Aa(W.end)}function q(W){const z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=z.children[z.children.length-1];re.position.end=Aa(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(z.type)&&(D.call(this,W),A.call(this,W))}function U(){this.data.atHardBreak=!0}function K(){const W=this.resume(),z=this.stack[this.stack.length-1];z.value=W}function P(){const W=this.resume(),z=this.stack[this.stack.length-1];z.value=W}function M(){const W=this.resume(),z=this.stack[this.stack.length-1];z.value=W}function C(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const z=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=z,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function L(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const z=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=z,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(W){const z=this.sliceSerialize(W),re=this.stack[this.stack.length-2];re.label=RD(z),re.identifier=Rr(z).toLowerCase()}function Q(){const W=this.stack[this.stack.length-1],z=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const le=W.children;re.children=le}else re.alt=z}function S(){const W=this.resume(),z=this.stack[this.stack.length-1];z.url=W}function Y(){const W=this.resume(),z=this.stack[this.stack.length-1];z.title=W}function V(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function $(W){const z=this.resume(),re=this.stack[this.stack.length-1];re.label=z,re.identifier=Rr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ce(W){this.data.characterReferenceType=W.type}function J(W){const z=this.sliceSerialize(W),re=this.data.characterReferenceType;let le;re?(le=Bj(z,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=Nb(z);const Se=this.stack[this.stack.length-1];Se.value+=le}function _e(W){const z=this.stack.pop();z.position.end=Aa(W.end)}function ue(W){A.call(this,W);const z=this.stack[this.stack.length-1];z.url=this.sliceSerialize(W)}function ne(W){A.call(this,W);const z=this.stack[this.stack.length-1];z.url="mailto:"+this.sliceSerialize(W)}function Ce(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Ne(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function fe(){return{type:"image",title:null,url:"",alt:null}}function he(){return{type:"link",title:null,url:"",children:[]}}function Le(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Z(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function ve(){return{type:"paragraph",children:[]}}function Re(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function Aa(e){return{line:e.line,column:e.column,offset:e.offset}}function Qj(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Qj(e,r):OD(e,r)}}function OD(e,t){let n;for(n in t)if(Yj.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 ok(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+zo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+zo({start:t.start,end:t.end})+") is still open")}function DD(e){const t=this;t.parser=n;function n(r){return ID(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function PD(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 FD(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
52
- `}]}function BD(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 zD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=zs(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 $D(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 HD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Xj(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 WD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Xj(e,t);const a={src:zs(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 VD(e,t){const n={src:zs(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 GD(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 KD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Xj(e,t);const a={href:zs(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 YD(e,t){const n={href:zs(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 QD(e,t,n){const r=e.all(t),a=n?XD(n):Zj(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 XD(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=Zj(n[r])}return t}function Zj(e){const t=e.spread;return t??e.children.length>1}function ZD(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 JD(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eP(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function tP(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nP(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=vb(t.children[1]),c=Rj(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 rP(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 aP(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const lk=9,ck=32;function iP(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(uk(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(uk(t.slice(a),a>0,!1)),i.join("")}function uk(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===lk||i===ck;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===lk||i===ck;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function sP(e,t){const n={type:"text",value:iP(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function oP(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const lP={blockquote:PD,break:FD,code:BD,delete:zD,emphasis:UD,footnoteReference:qD,heading:$D,html:HD,imageReference:WD,image:VD,inlineCode:GD,linkReference:KD,link:YD,listItem:QD,list:ZD,paragraph:JD,root:eP,strong:tP,table:nP,tableCell:aP,tableRow:rP,text:sP,thematicBreak:oP,toml:cc,yaml:cc,definition:cc,footnoteDefinition:cc};function cc(){}const Jj=-1,Zu=0,qo=1,bu=2,Cb=3,jb=4,Tb=5,Ab=6,e5=7,t5=8,n5=typeof self=="object"?self:globalThis,dk=(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 n5[e](t)},cP=(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 Zu:case Jj:return n(s,a);case qo:{const l=n([],a);for(const c of s)l.push(r(c));return l}case bu:{const l=n({},a);for(const[c,u]of s)l[r(c)]=r(u);return l}case Cb:return n(new Date(s),a);case jb:{const{source:l,flags:c}=s;return n(new RegExp(l,c),a)}case Tb:{const l=n(new Map,a);for(const[c,u]of s)l.set(r(c),r(u));return l}case Ab:{const l=n(new Set,a);for(const c of s)l.add(r(c));return l}case e5:{const{name:l,message:c}=s;return n(typeof n5[l]=="function"?dk(l,c):new Error(c),a)}case t5: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(dk(i,s),a)};return r},fk=e=>cP(new Map,e)(0),xi="",{toString:uP}={},{keys:dP}=Object,ho=e=>{const t=typeof e;if(t!=="object"||!e)return[Zu,t];const n=uP.call(e).slice(8,-1);switch(n){case"Array":return[qo,xi];case"Object":return[bu,xi];case"Date":return[Cb,xi];case"RegExp":return[jb,xi];case"Map":return[Tb,xi];case"Set":return[Ab,xi];case"DataView":return[qo,n]}return n.includes("Array")?[qo,n]:e instanceof Error?[e5,e.name||"Error"]:[bu,n]},uc=([e,t])=>e===Zu&&(t==="function"||t==="symbol"),fP=(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]=ho(s);switch(l){case Zu:{let d=s;switch(c){case"bigint":l=t5,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([Jj],s)}return a([l,d],s)}case qo:{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 bu:{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 dP(s))(e||!uc(ho(s[g])))&&d.push([i(g),i(s[g])]);return f}case Cb:return a([l,isNaN(s.getTime())?xi:s.toISOString()],s);case jb:{const{source:d,flags:f}=s;return a([l,{source:d,flags:f}],s)}case Tb:{const d=[],f=a([l,d],s);for(const[g,p]of s)(e||!(uc(ho(g))||uc(ho(p))))&&d.push([i(g),i(p)]);return f}case Ab:{const d=[],f=a([l,d],s);for(const g of s)(e||!uc(ho(g)))&&d.push(i(g));return f}}const{message:u}=s;return a([l,{name:c,message:u}],s)};return i},gk=(e,{json:t,lossy:n}={})=>{const r=[];return fP(!(t||n),!!t,new Map,r)(e),r},vu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?fk(gk(e,t)):structuredClone(e):(e,t)=>fk(gk(e,t));function gP(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 pP(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hP(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||gP,r=e.options.footnoteBackLabel||pP,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=zs(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:{...vu(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 El=function(e){if(e==null)return bP;if(typeof e=="function")return Ju(e);if(typeof e=="object")return Array.isArray(e)?mP(e):yP(e);if(typeof e=="string")return xP(e);throw new Error("Expected function, string, or object as test")};function mP(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=El(e[n]);return Ju(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function yP(e){const t=e;return Ju(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function xP(e){return Ju(t);function t(n){return n&&n.type===e}}function Ju(e){return t;function t(n,r,a){return!!(vP(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function bP(){return!0}function vP(e){return e!==null&&typeof e=="object"&&"type"in e}const r5=[],kP=!0,Zy=!1,_P="skip";function a5(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=El(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=r5,m,y,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=wP(n(c,d)),p[0]===Zy))return p;if("children"in c&&c.children){const x=c;if(x.children&&p[0]!==_P)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]===Zy)return m;y=typeof m[1]=="number"?m[1]:y+s}}return p}}}function wP(e){return Array.isArray(e)?e:typeof e=="number"?[kP,e]:e==null?r5:[e]}function ed(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),a5(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 Jy={}.hasOwnProperty,EP={};function NP(e,t){const n=t||EP,r=new Map,a=new Map,i=new Map,s={...lP,...n.handlers},l={all:u,applyData:CP,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:s,one:c,options:n,patch:SP,wrap:TP};return ed(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(Jy.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=vu(v);return x.children=l.all(d),x}return vu(d)}return(l.options.unknownHandler||jP)(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=pk(m.value)),!Array.isArray(m)&&m.type==="element")){const y=m.children[0];y&&y.type==="text"&&(y.value=pk(y.value))}Array.isArray(m)?f.push(...m):f.push(m)}}}return f}}function SP(e,t){e.position&&(t.position=pL(e))}function CP(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,vu(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function jP(e,t){const n=t.data||{},r="value"in t&&!(Jy.call(n,"hProperties")||Jy.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 TP(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 pk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function hk(e,t){const n=NP(e,t),r=n.one(e,void 0),a=hP(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 AP(e,t){return e&&"run"in e?async function(n,r){const a=hk(n,{file:r,...t});await e.run(a,r)}:function(n,r){return hk(n,{file:r,...e||t})}}function mk(e){if(e)throw e}var Wc=Object.prototype.hasOwnProperty,i5=Object.prototype.toString,yk=Object.defineProperty,xk=Object.getOwnPropertyDescriptor,bk=function(t){return typeof Array.isArray=="function"?Array.isArray(t):i5.call(t)==="[object Array]"},vk=function(t){if(!t||i5.call(t)!=="[object Object]")return!1;var n=Wc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Wc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Wc.call(t,a)},kk=function(t,n){yk&&n.name==="__proto__"?yk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},_k=function(t,n){if(n==="__proto__")if(Wc.call(t,n)){if(xk)return xk(t,n).value}else return;return t[n]},RP=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=_k(l,n),a=_k(t,n),l!==a&&(d&&a&&(vk(a)||(i=bk(a)))?(i?(i=!1,s=r&&bk(r)?r:[]):s=r&&vk(r)?r:{},kk(l,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&kk(l,{name:n,newValue:a}));return l};const Sf=hl(RP);function ex(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 MP(){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?IP(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 IP(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 Ur={basename:LP,dirname:OP,extname:DP,join:PP,sep:"/"};function LP(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Nl(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 OP(e){if(Nl(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 DP(e){Nl(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 PP(...e){let t=-1,n;for(;++t<e.length;)Nl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":FP(n)}function FP(e){Nl(e);const t=e.codePointAt(0)===47;let n=BP(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BP(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 Nl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zP={cwd:UP};function UP(){return"/"}function tx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function qP(e){if(typeof e=="string")e=new URL(e);else if(!tx(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 $P(e)}function $P(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 Cf=["history","path","basename","stem","extname","dirname"];class s5{constructor(t){let n;t?tx(t)?n={path:t}:typeof t=="string"||HP(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":zP.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Cf.length;){const i=Cf[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)Cf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ur.basename(this.path):void 0}set basename(t){Tf(t,"basename"),jf(t,"basename"),this.path=Ur.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ur.dirname(this.path):void 0}set dirname(t){wk(this.basename,"dirname"),this.path=Ur.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ur.extname(this.path):void 0}set extname(t){if(jf(t,"extname"),wk(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=Ur.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){tx(t)&&(t=qP(t)),Tf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ur.basename(this.path,this.extname):void 0}set stem(t){Tf(t,"stem"),jf(t,"stem"),this.path=Ur.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 Ln(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 jf(e,t){if(e&&e.includes(Ur.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ur.sep+"`")}function Tf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function HP(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const WP=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},VP={}.hasOwnProperty;class Rb extends WP{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=MP()}copy(){const t=new Rb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Sf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Mf("data",this.frozen),this.namespace[t]=n,this):VP.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Mf("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=dc(t),r=this.parser||this.Parser;return Af("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Af("process",this.parser||this.Parser),Rf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const l=dc(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);YP(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(),Af("processSync",this.parser||this.Parser),Rf("processSync",this.compiler||this.Compiler),this.process(t,a),Nk("processSync","process",n),r;function a(i,s){n=!0,mk(i),r=s}}run(t,n,r){Ek(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=dc(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),Nk("runSync","run",r),a;function i(s,l){mk(s),a=l,r=!0}}stringify(t,n){this.freeze();const r=dc(n),a=this.compiler||this.Compiler;return Rf("stringify",a),Ek(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Mf("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=Sf(!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];ex(y)&&ex(p)&&(p=Sf(!0,y,p)),r[g]=[u,p,...m]}}}}const GP=new Rb().freeze();function Af(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Rf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mf(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 Ek(e){if(!ex(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Nk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function dc(e){return KP(e)?e:new s5(e)}function KP(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function YP(e){return typeof e=="string"||QP(e)}function QP(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const XP="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Sk=[],Ck={allowDangerousHtml:!0},ZP=/^(https?|ircs?|mailto|xmpp)$/i,JP=[{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 cl(e){const t=e6(e),n=t6(e);return n6(t.runSync(t.parse(n),n),e)}function e6(e){const t=e.rehypePlugins||Sk,n=e.remarkPlugins||Sk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ck}:Ck;return GP().use(DD).use(n).use(AP,r).use(t)}function t6(e){const t=e.children||"",n=new s5;return typeof t=="string"&&(n.value=t),n}function n6(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||r6;for(const d of JP)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+XP+d.id,void 0);return ed(e,u),bL(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 wf)if(Object.hasOwn(wf,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],y=wf[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 r6(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||ZP.test(e.slice(0,t))?e:""}function jk(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 a6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function i6(e,t,n){const a=El((n||{}).ignore||[]),i=s6(t);let s=-1;for(;++s<i.length;)a5(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,E={index:k.index,input:k.input,stack:[...d,u]};let w=p(...k,E);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 s6(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([o6(a[0]),l6(a[1])])}return t}function o6(e){return typeof e=="string"?new RegExp(a6(e),"g"):e}function l6(e){return typeof e=="function"?e:function(){return e}}const If="phrasing",Lf=["autolink","link","image","label"];function c6(){return{transforms:[m6],enter:{literalAutolink:d6,literalAutolinkEmail:Of,literalAutolinkHttp:Of,literalAutolinkWww:Of},exit:{literalAutolink:h6,literalAutolinkEmail:p6,literalAutolinkHttp:f6,literalAutolinkWww:g6}}}function u6(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:If,notInConstruct:Lf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:If,notInConstruct:Lf},{character:":",before:"[ps]",after:"\\/",inConstruct:If,notInConstruct:Lf}]}}function d6(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Of(e){this.config.enter.autolinkProtocol.call(this,e)}function f6(e){this.config.exit.autolinkProtocol.call(this,e)}function g6(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 p6(e){this.config.exit.autolinkEmail.call(this,e)}function h6(e){this.exit(e)}function m6(e){i6(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,y6],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),x6]],{ignore:["link","linkReference"]})}function y6(e,t,n,r,a){let i="";if(!o5(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!b6(n)))return!1;const s=v6(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 x6(e,t,n,r){return!o5(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function b6(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 v6(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=jk(e,"(");let i=jk(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 o5(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Li(n)||Qu(n))&&(!t||n!==47)}l5.peek=T6;function k6(){this.buffer()}function _6(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function w6(){this.buffer()}function E6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function N6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function S6(e){this.exit(e)}function C6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function j6(e){this.exit(e)}function T6(){return"["}function l5(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 A6(){return{enter:{gfmFootnoteCallString:k6,gfmFootnoteCall:_6,gfmFootnoteDefinitionLabelString:w6,gfmFootnoteDefinition:E6},exit:{gfmFootnoteCallString:N6,gfmFootnoteCall:S6,gfmFootnoteDefinitionLabelString:C6,gfmFootnoteDefinition:j6}}}function R6(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:l5},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?c5:M6))),u(),c}}function M6(e,t,n){return t===0?e:c5(e,t,n)}function c5(e,t,n){return(n?"":" ")+e}const I6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];u5.peek=F6;function L6(){return{canContainEols:["delete"],enter:{strikethrough:D6},exit:{strikethrough:P6}}}function O6(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:I6}],handlers:{delete:u5}}}function D6(e){this.enter({type:"delete",children:[]},e)}function P6(e){this.exit(e)}function u5(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 F6(){return"~"}function B6(e){return e.length}function z6(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||B6,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=U6(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]=Tk(r[f]);else{const y=Tk(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 E=c[f]-(v[f]||0),w=i[f];w===114?k=" ".repeat(E):w===99?E%2?(k=" ".repeat(E/2+.5),N=" ".repeat(E/2-.5)):(k=" ".repeat(E/2),N=k):N=" ".repeat(E)}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 U6(e){return e==null?"":String(e)}function Tk(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 q6(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()),$6);return a(),s}function $6(e,t,n){return">"+(n?"":" ")+e}function H6(e,t){return Ak(e,t.inConstruct,!0)&&!Ak(e,t.notInConstruct,!1)}function Ak(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 Rk(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
64
- `&&H6(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
65
- `}function W6(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 V6(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 G6(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 K6(e,t,n,r){const a=G6(n),i=e.value||"",s=a==="`"?"GraveAccent":"Tilde";if(V6(e,n)){const f=n.enter("codeIndented"),g=n.indentLines(i,Y6);return f(),g}const l=n.createTracker(r),c=a.repeat(Math.max(W6(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 Y6(e,t,n){return(n?"":" ")+e}function Mb(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 Q6(e,t,n,r){const a=Mb(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 X6(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 ul(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ku(e,t,n){const r=Ls(e),a=Ls(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}}d5.peek=Z6;function d5(e,t,n,r){const a=X6(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=ku(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=ul(u)+c.slice(1));const f=c.charCodeAt(c.length-1),g=ku(r.after.charCodeAt(0),f,a);g.inside&&(c=c.slice(0,-1)+ul(f));const p=s.move(a);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:d.outside},l+c+p}function Z6(e,t,n){return n.options.emphasis||"*"}function J6(e,t){let n=!1;return ed(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Zy}),!!((!e.depth||e.depth<3)&&Eb(e)&&(t.options.setext||n))}function e7(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(J6(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=ul(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),c(),l(),u}f5.peek=t7;function f5(e){return e.value||""}function t7(){return"<"}g5.peek=n7;function g5(e,t,n,r){const a=Mb(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 n7(){return"!"}p5.peek=r7;function p5(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 r7(){return"!"}h5.peek=a7;function h5(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 a7(){return"`"}function m5(e,t){const n=Eb(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))}y5.peek=i7;function y5(e,t,n,r){const a=Mb(n),i=a==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let l,c;if(m5(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 i7(e,t,n){return m5(e,n)?"<":"["}x5.peek=s7;function x5(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 s7(){return"["}function Ib(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 o7(e){const t=Ib(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 l7(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 b5(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 c7(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?l7(n):Ib(n);const l=e.ordered?s==="."?")":".":o7(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),b5(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 u7(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 d7(e,t,n,r){const a=u7(n);let i=n.bulletCurrent||Ib(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 f7(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),a(),s}const g7=El(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function p7(e,t,n,r){return(e.children.some(function(s){return g7(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function h7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}v5.peek=m7;function v5(e,t,n,r){const a=h7(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=ku(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=ul(u)+c.slice(1));const f=c.charCodeAt(c.length-1),g=ku(r.after.charCodeAt(0),f,a);g.inside&&(c=c.slice(0,-1)+ul(f));const p=s.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:d.outside},l+c+p}function m7(e,t,n){return n.options.strong||"*"}function y7(e,t,n,r){return n.safe(e.value,r)}function x7(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 b7(e,t,n){const r=(b5(n)+(n.options.ruleSpaces?" ":"")).repeat(x7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const k5={blockquote:q6,break:Rk,code:K6,definition:Q6,emphasis:d5,hardBreak:Rk,heading:e7,html:f5,image:g5,imageReference:p5,inlineCode:h5,link:y5,linkReference:x5,list:c7,listItem:d7,paragraph:f7,root:p7,strong:v5,text:y7,thematicBreak:b7};function v7(){return{enter:{table:k7,tableData:Mk,tableHeader:Mk,tableRow:w7},exit:{codeText:E7,table:_7,tableData:Df,tableHeader:Df,tableRow:Df}}}function k7(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 _7(e){this.exit(e),this.data.inTable=void 0}function w7(e){this.enter({type:"tableRow",children:[]},e)}function Df(e){this.exit(e)}function Mk(e){this.enter({type:"tableCell",children:[]},e)}function E7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,N7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function N7(e,t){return t==="|"?t:e}function S7(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 z6(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=k5.inlineCode(p,m,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function C7(){return{exit:{taskListCheckValueChecked:Ik,taskListCheckValueUnchecked:Ik,paragraph:T7}}}function j7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:A7}}}function Ik(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function T7(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 A7(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=k5.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 R7(){return[c6(),A6(),L6(),v7(),C7()]}function M7(e){return{extensions:[u6(),R6(e),O6(),S7(e),j7()]}}const I7={tokenize:B7,partial:!0},_5={tokenize:z7,partial:!0},w5={tokenize:U7,partial:!0},E5={tokenize:q7,partial:!0},L7={tokenize:$7,partial:!0},N5={name:"wwwAutolink",tokenize:P7,previous:C5},S5={name:"protocolAutolink",tokenize:F7,previous:j5},va={name:"emailAutolink",tokenize:D7,previous:T5},Vr={};function O7(){return{text:Vr}}let fi=48;for(;fi<123;)Vr[fi]=va,fi++,fi===58?fi=65:fi===91&&(fi=97);Vr[43]=va;Vr[45]=va;Vr[46]=va;Vr[95]=va;Vr[72]=[va,S5];Vr[104]=[va,S5];Vr[87]=[va,N5];Vr[119]=[va,N5];function D7(e,t,n){const r=this;let a,i;return s;function s(f){return!nx(f)||!T5.call(r,r.previous)||Lb(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return nx(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(L7,d,u)(f):f===45||f===95||Mn(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&&Pn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function P7(e,t,n){const r=this;return a;function a(s){return s!==87&&s!==119||!C5.call(r,r.previous)||Lb(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(I7,e.attempt(_5,e.attempt(w5,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function F7(e,t,n){const r=this;let a="",i=!1;return s;function s(f){return(f===72||f===104)&&j5.call(r,r.previous)&&!Lb(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(Pn(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||xu(f)||Pt(f)||Li(f)||Qu(f)?n(f):e.attempt(_5,e.attempt(w5,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function B7(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 z7(e,t,n){let r,a,i;return s;function s(u){return u===46||u===95?e.check(E5,c,l)(u):u===null||Pt(u)||Li(u)||u!==45&&Qu(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 U7(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(E5,t,i)(s):s===null||Pt(s)||Li(s)?t(s):(e.consume(s),a)}function i(s){return s===41&&r++,e.consume(s),a}}function q7(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||Pt(l)||Li(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||Pt(l)||Li(l)?t(l):r(l)}function i(l){return Pn(l)?s(l):n(l)}function s(l){return l===59?(e.consume(l),r):Pn(l)?(e.consume(l),s):n(l)}}function $7(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return Mn(i)?n(i):t(i)}}function C5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function j5(e){return!Pn(e)}function T5(e){return!(e===47||nx(e))}function nx(e){return e===43||e===45||e===46||e===95||Mn(e)}function Lb(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 H7={tokenize:Z7,partial:!0};function W7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Y7,continuation:{tokenize:Q7},exit:X7}},text:{91:{name:"gfmFootnoteCall",tokenize:K7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:V7,resolveTo:G7}}}}function V7(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=Rr(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 G7(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 K7(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||Pt(f))return n(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return a.includes(Rr(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Pt(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 Y7(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||Pt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Rr(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Pt(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),vt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Q7(e,t,n){return e.check(wl,t,e.attempt(H7,t,n))}function X7(e){e.exit("gfmFootnoteDefinition")}function Z7(e,t,n){const r=this;return vt(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 J7(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,Xu(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=Ls(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=Ls(m);return v._open=!x||x===2&&!!y,v._close=!y||y===2&&!!x,l(m)}}}class e8{constructor(){this.map=[]}add(t,n,r){t8(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 t8(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 n8(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 r8(){return{flow:{null:{name:"table",tokenize:a8,resolveAll:i8}}}}function a8(e,t,n){const r=this;let a=0,i=0,s;return l;function l(A){let q=r.events.length-1;for(;q>-1;){const P=r.events[q][1].type;if(P==="lineEnding"||P==="linePrefix")q--;else break}const U=q>-1?r.events[q][1].type:null,K=U==="tableHead"||U==="tableRow"?w:c;return K===w&&r.parser.lazy[r.now().line]?n(A):K(A)}function c(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(s=!0,i+=1),d(A)}function d(A){return A===null?n(A):nt(A)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),p):n(A):pt(A)?vt(e,d,"whitespace")(A):(i+=1,s&&(s=!1,a+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),f(A)))}function f(A){return A===null||A===124||Pt(A)?(e.exit("data"),d(A)):(e.consume(A),A===92?g:f)}function g(A){return A===92||A===124?(e.consume(A),f):f(A)}function p(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),s=!1,pt(A)?vt(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):m(A))}function m(A){return A===45||A===58?v(A):A===124?(s=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),y):E(A)}function y(A){return pt(A)?vt(e,v,"whitespace")(A):v(A)}function v(A){return A===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),x):A===45?(i+=1,x(A)):A===null||nt(A)?N(A):E(A)}function x(A){return A===45?(e.enter("tableDelimiterFiller"),b(A)):E(A)}function b(A){return A===45?(e.consume(A),b):A===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(A))}function k(A){return pt(A)?vt(e,N,"whitespace")(A):N(A)}function N(A){return A===124?m(A):A===null||nt(A)?!s||a!==i?E(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):E(A)}function E(A){return n(A)}function w(A){return e.enter("tableRow"),T(A)}function T(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),T):A===null||nt(A)?(e.exit("tableRow"),t(A)):pt(A)?vt(e,T,"whitespace")(A):(e.enter("data"),R(A))}function R(A){return A===null||A===124||Pt(A)?(e.exit("data"),T(A)):(e.consume(A),A===92?D:R)}function D(A){return A===92||A===124?(e.consume(A),R):R(A)}}function i8(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 e8;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(Lk(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=fc(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=fc(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=fc(g,t,i,a,n,f)):s[1]!==0&&(f=fc(g,t,s,a,n,f)),a=0):a&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&Lk(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=n8(t.events,n))}return e}function fc(e,t,n,r,a,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},as(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=as(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=as(t.events,n[2]),d=as(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({},as(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function Lk(e,t,n,r,a){const i=[],s=as(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 as(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const s8={name:"tasklistCheck",tokenize:l8};function o8(){return{text:{91:s8}}}function l8(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 Pt(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 nt(c)?t(c):pt(c)?e.check({tokenize:c8},t,n)(c):n(c)}}function c8(e,t,n){return vt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function u8(e){return Fj([O7(),W7(),J7(e),r8(),o8()])}const d8={};function dl(e){const t=this,n=e||d8,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(u8(n)),i.push(R7()),s.push(M7(n))}const Ok=function(e,t,n){const r=El(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]},Fi=function(e){if(e==null)return p8;if(typeof e=="string")return g8(e);if(typeof e=="object")return f8(e);if(typeof e=="function")return Ob(e);throw new Error("Expected function, string, or array as `test`")};function f8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Fi(e[n]);return Ob(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function g8(e){return Ob(t);function t(n){return n.tagName===e}}function Ob(e){return t;function t(n,r,a){return!!(h8(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function p8(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function h8(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Dk=/\n/g,Pk=/[\t ]+/g,rx=Fi("br"),Fk=Fi(w8),m8=Fi("p"),Bk=Fi("tr"),y8=Fi(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",_8,E8]),A5=Fi(["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 x8(e,t){const n=t||{},r="children"in e?e.children:[],a=A5(e),i=I5(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(...M5(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)s.push(...R5(r[l],e,{whitespace:i,breakBefore:l?void 0:a,breakAfter:l<r.length-1?rx(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 R5(e,t,n){return e.type==="element"?b8(e,t,n):e.type==="text"?n.whitespace==="normal"?M5(e,n):v8(e):[]}function b8(e,t,n){const r=I5(e,n),a=e.children||[];let i=-1,s=[];if(y8(e))return s;let l,c;for(rx(e)||Bk(e)&&Ok(t,e,Bk)?c=`
78
- `:m8(e)?(l=2,c=2):A5(e)&&(l=1,c=1);++i<a.length;)s=s.concat(R5(a[i],e,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<a.length-1?rx(a[i+1]):c}));return Fk(e)&&Ok(t,e,Fk)&&s.push(" "),l&&s.unshift(l),c&&s.push(c),s}function M5(e,t){const n=String(e.value),r=[],a=[];let i=0;for(;i<=n.length;){Dk.lastIndex=i;const c=Dk.exec(n),u=c&&"index"in c?c.index:n.length;r.push(k8(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 v8(e){return[String(e.value)]}function k8(e,t,n){const r=[];let a=0,i;for(;a<e.length;){Pk.lastIndex=a;const s=Pk.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 I5(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 _8(e){return!!(e.properties||{}).hidden}function w8(e){return e.tagName==="td"||e.tagName==="th"}function E8(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function N8(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},E={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},w=[E,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={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},R={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(T,R,E,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 S8(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=N8(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 C8(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"],E=["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,...E]},contains:[p,e.SHEBANG(),m,f,i,s,x,l,c,u,d,n]}}function j8(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 T8(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},E={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},w=[E,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={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},R={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(T,R,E,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 A8(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 R8=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_-]*/}}),M8=["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"],I8=["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"],L8=[...M8,...I8],O8=["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(),D8=["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(),P8=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),F8=["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 B8(e){const t=e.regex,n=R8(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:":("+D8.join("|")+")"},{begin:":(:)?("+P8.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+F8.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:O8.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+L8.join("|")+")\\b"}]}}function z8(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 U8(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 q8(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 $8(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 is="[0-9](_*[0-9])*",gc=`\\.(${is})`,pc="[0-9a-fA-F](_*[0-9a-fA-F])*",zk={className:"number",variants:[{begin:`(\\b(${is})((${gc})|\\.)?|(${gc}))[eE][+-]?(${is})[fFdD]?\\b`},{begin:`\\b(${is})((${gc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${gc})[fFdD]?\\b`},{begin:`\\b(${is})[fFdD]\\b`},{begin:`\\b0[xX]((${pc})\\.?|(${pc})?\\.(${pc}))[pP][+-]?(${is})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function L5(e,t,n){return n===-1?"":e.replace(t,r=>L5(e,t,n-1))}function H8(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+L5("(?:<"+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,zk,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},zk,u]}}const Uk="[A-Za-z$_][0-9A-Za-z$_]*",W8=["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"],V8=["true","false","null","undefined","NaN","Infinity"],O5=["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"],D5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],P5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],G8=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],K8=[].concat(P5,O5,D5);function Y8(e){const t=e.regex,n=(F,{after:Q})=>{const S="</"+F[0].slice(1);return F.input.indexOf(S,Q)!==-1},r=Uk,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,Q)=>{const S=F[0].length+F.index,Y=F.input[S];if(Y==="<"||Y===","){Q.ignoreMatch();return}Y===">"&&(n(F,{after:S})||Q.ignoreMatch());let V;const j=F.input.substring(S);if(V=j.match(/^\s*=/)){Q.ignoreMatch();return}if((V=j.match(/^\s+extends\s+/))&&V.index===0){Q.ignoreMatch();return}}},l={$pattern:Uk,keyword:W8,literal:V8,built_in:K8,"variable.language":G8},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),E=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},T={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"}}]},R={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:{_:[...O5,...D5]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(F){return t.concat("(?!",F.join("|"),")")}const K={match:t.concat(/\b/,U([...P5,"super","import"].map(F=>`${F}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,b,{match:/\$\d+/},f,R,{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:C,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:E}]}]},{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"]}]}]},A,{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},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},K,q,T,M,{match:/\$[(.]/}]}}function Q8(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 ss="[0-9](_*[0-9])*",hc=`\\.(${ss})`,mc="[0-9a-fA-F](_*[0-9a-fA-F])*",X8={className:"number",variants:[{begin:`(\\b(${ss})((${hc})|\\.)?|(${hc}))[eE][+-]?(${ss})[fFdD]?\\b`},{begin:`\\b(${ss})((${hc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${hc})[fFdD]?\\b`},{begin:`\\b(${ss})[fFdD]\\b`},{begin:`\\b0[xX]((${mc})\\.?|(${mc})?\\.(${mc}))[pP][+-]?(${ss})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${mc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Z8(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=X8,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 J8=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_-]*/}}),e9=["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"],t9=["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"],n9=[...e9,...t9],r9=["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(),F5=["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(),B5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),a9=["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(),i9=F5.concat(B5).sort().reverse();function s9(e){const t=J8(e),n=i9,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,E){return{className:k,begin:N,relevance:E}},d={$pattern:/[a-z-]+/,keyword:r,attribute:r9.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("+a9.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("+n9.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:":("+F5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+B5.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 o9(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 l9(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 c9(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 u9(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 d9(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 f9(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":(P,M)=>{M.data._beginMatch=P[1]||P[2]},"on:end":(P,M)=>{M.data._beginMatch!==P[1]&&M.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:(P=>{const M=[];return P.forEach(C=>{M.push(C),C.toLowerCase()===C?M.push(C.toUpperCase()):M.push(C.toLowerCase())}),M})(v),built_in:b},E=P=>P.map(M=>M.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",E(b).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(r,"\\b(?!\\()"),R={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],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"}}]},D={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/\(/,end:/\)/,keywords:N,contains:[D,s,R,e.C_BLOCK_COMMENT_MODE,m,y,w]},q={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",E(x).join("\\b|"),"|",E(b).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(q);const U=[D,R,e.C_BLOCK_COMMENT_MODE,m,y,w],K={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",...U]},...U,{scope:"meta",variants:[{match:a},{match:i}]}]};return{case_insensitive:!1,keywords:N,contains:[K,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,q,R,{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",K,s,R,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 g9(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 p9(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function h9(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 m9(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function y9(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 x9(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 A=[{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(A).concat(u).concat(w)}}function b9(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 v9=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_-]*/}}),k9=["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"],_9=["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"],w9=[...k9,..._9],E9=["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(),N9=["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(),S9=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),C9=["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 j9(e){const t=v9(e),n=S9,r=N9,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("+w9.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("+C9.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:E9.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 T9(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function A9(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(E=>!d.includes(E)),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(E){return t.concat(/\b/,t.either(...E.map(w=>w.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:b(g),relevance:0};function N(E,{exceptions:w,when:T}={}){const R=T;return w=w||[],E.map(D=>D.match(/\|\d+$/)||w.includes(D)?D:R(D)?`${D}|0`:D)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:N(m,{when:E=>E.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 z5(e){return e?typeof e=="string"?e:e.source:null}function mo(e){return Rt("(?=",e,")")}function Rt(...e){return e.map(n=>z5(n)).join("")}function R9(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function On(...e){return"("+(R9(e).capture?"":"?:")+e.map(r=>z5(r)).join("|")+")"}const Db=e=>Rt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),M9=["Protocol","Type"].map(Db),qk=["init","self"].map(Db),I9=["Any","Self"],Pf=["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"],$k=["false","nil","true"],L9=["assignment","associativity","higherThan","left","lowerThan","none","right"],O9=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Hk=["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"],U5=On(/[/=\-+!*%<>&|^~?]/,/[\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]/),q5=On(U5,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ff=Rt(U5,q5,"*"),$5=On(/[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]/),_u=On($5,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Br=Rt($5,_u,"*"),yc=Rt(/[A-Z]/,_u,"*"),D9=["attached","autoclosure",Rt(/convention\(/,On("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Rt(/objc\(/,Br,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],P9=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function F9(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,On(...M9,...qk)],className:{2:"keyword"}},i={match:Rt(/\./,On(...Pf)),relevance:0},s=Pf.filter(Ee=>typeof Ee=="string").concat(["_|0"]),l=Pf.filter(Ee=>typeof Ee!="string").concat(I9).map(Db),c={variants:[{className:"keyword",match:On(...l,...qk)}]},u={$pattern:On(/\b\w+/,/#\w+/),keyword:s.concat(O9),literal:$k},d=[a,i,c],f={match:Rt(/\./,On(...Hk)),relevance:0},g={className:"built_in",match:Rt(/\b/,On(...Hk),/(?=\()/)},p=[f,g],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:Ff},{match:`\\.(\\.|${q5})+`}]},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=(Ee="")=>({className:"subst",variants:[{match:Rt(/\\/,Ee,/[0\\tnr"']/)},{match:Rt(/\\/,Ee,/u\{[0-9a-fA-F]{1,8}\}/)}]}),E=(Ee="")=>({className:"subst",match:Rt(/\\/,Ee,/[\t ]*(?:[\r\n]|\r\n)/)}),w=(Ee="")=>({className:"subst",label:"interpol",begin:Rt(/\\/,Ee,/\(/),end:/\)/}),T=(Ee="")=>({begin:Rt(Ee,/"""/),end:Rt(/"""/,Ee),contains:[N(Ee),E(Ee),w(Ee)]}),R=(Ee="")=>({begin:Rt(Ee,/"/),end:Rt(/"/,Ee),contains:[N(Ee),w(Ee)]}),D={className:"string",variants:[T(),T("#"),T("##"),T("###"),R(),R("#"),R("##"),R("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],q={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},U=Ee=>{const Oe=Rt(Ee,/\//),fe=Rt(/\//,Ee);return{begin:Oe,end:fe,contains:[...A,{scope:"comment",begin:`#(?!.*${fe})`,end:/$/}]}},K={scope:"regexp",variants:[U("###"),U("##"),U("#"),q]},P={match:Rt(/`/,Br,/`/)},M={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${_u}+`},L=[P,M,C],F={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:P9,contains:[...v,k,D]}]}},Q={scope:"keyword",match:Rt(/@/,On(...D9),mo(On(/\(/,/\s+/)))},S={scope:"meta",match:Rt(/@/,Br)},Y=[F,Q,S],V={match:mo(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Rt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,_u,"+")},{className:"type",match:yc,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Rt(/\s+&\s+/,mo(yc)),relevance:0}]},j={begin:/</,end:/>/,keywords:u,contains:[...r,...d,...Y,m,V]};V.contains.push(j);const $={match:Rt(Br,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",$,...r,K,...d,...p,...v,k,D,...L,...Y,V]},J={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,V]},_e={begin:On(mo(Rt(Br,/\s*:/)),mo(Rt(Br,/\s+/,Br,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Br}]},ue={begin:/\(/,end:/\)/,keywords:u,contains:[_e,...r,...d,...v,k,D,...Y,V,ce],endsParent:!0,illegal:/["']/},ne={match:[/(func|macro)/,/\s+/,On(P.match,Br,Ff)],className:{1:"keyword",3:"title.function"},contains:[J,ue,t],illegal:[/\[/,/%/]},Ce={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[J,ue,t],illegal:/\[|%/},ke={match:[/operator/,/\s+/,Ff],className:{1:"keyword",3:"title"}},pe={begin:[/precedencegroup/,/\s+/,yc],className:{1:"keyword",3:"title"},contains:[V],keywords:[...L9,...$k],end:/}/},me={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},De={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Br,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[J,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:yc},...d],relevance:0}]};for(const Ee of D.variants){const Oe=Ee.contains.find(he=>he.label==="interpol");Oe.keywords=u;const fe=[...d,...p,...v,k,D,...L];Oe.contains=[...fe,{begin:/\(/,end:/\)/,contains:["self",...fe]}]}return{name:"Swift",keywords:u,contains:[...r,ne,Ce,me,De,Ne,ke,pe,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},K,...d,...p,...v,k,D,...L,...Y,V,ce]}}const wu="[A-Za-z$_][0-9A-Za-z$_]*",H5=["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"],W5=["true","false","null","undefined","NaN","Infinity"],V5=["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"],G5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],K5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Y5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Q5=[].concat(K5,V5,G5);function B9(e){const t=e.regex,n=(F,{after:Q})=>{const S="</"+F[0].slice(1);return F.input.indexOf(S,Q)!==-1},r=wu,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,Q)=>{const S=F[0].length+F.index,Y=F.input[S];if(Y==="<"||Y===","){Q.ignoreMatch();return}Y===">"&&(n(F,{after:S})||Q.ignoreMatch());let V;const j=F.input.substring(S);if(V=j.match(/^\s*=/)){Q.ignoreMatch();return}if((V=j.match(/^\s+extends\s+/))&&V.index===0){Q.ignoreMatch();return}}},l={$pattern:wu,keyword:H5,literal:W5,built_in:Q5,"variable.language":Y5},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),E=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},T={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"}}]},R={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:{_:[...V5,...G5]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(F){return t.concat("(?!",F.join("|"),")")}const K={match:t.concat(/\b/,U([...K5,"super","import"].map(F=>`${F}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,v,b,{match:/\$\d+/},f,R,{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:C,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:E}]}]},{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"]}]}]},A,{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},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},K,q,T,M,{match:/\$[(.]/}]}}function z9(e){const t=e.regex,n=B9(e),r=wu,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:wu,keyword:H5.concat(c),literal:W5,built_in:Q5.concat(a),"variable.language":Y5},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 U9(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 q9(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 $9(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 H9(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 W9={arduino:S8,bash:C8,c:j8,cpp:T8,csharp:A8,css:B8,diff:z8,go:U8,graphql:q8,ini:$8,java:H8,javascript:Y8,json:Q8,kotlin:Z8,less:s9,lua:o9,makefile:l9,markdown:c9,objectivec:u9,perl:d9,php:f9,"php-template":g9,plaintext:p9,python:h9,"python-repl":m9,r:y9,ruby:x9,rust:b9,scss:j9,shell:T9,sql:A9,swift:F9,typescript:z9,vbnet:U9,wasm:q9,xml:$9,yaml:H9};function X5(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)&&X5(n)}),e}class Wk{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Z5(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Ha(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 V9="</span>",Vk=e=>!!e.scope,G9=(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 K9{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Z5(t)}openNode(t){if(!Vk(t))return;const n=G9(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Vk(t)&&(this.buffer+=V9)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Gk=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Pb{constructor(){this.rootNode=Gk(),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=Gk({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=>{Pb._collapse(n)}))}}class Y9 extends Pb{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 K9(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function fl(e){return e?typeof e=="string"?e:e.source:null}function J5(e){return Bi("(?=",e,")")}function Q9(e){return Bi("(?:",e,")*")}function X9(e){return Bi("(?:",e,")?")}function Bi(...e){return e.map(n=>fl(n)).join("")}function Z9(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Fb(...e){return"("+(Z9(e).capture?"":"?:")+e.map(r=>fl(r)).join("|")+")"}function eT(e){return new RegExp(e.toString()+"|").exec("").length-1}function J9(e,t){const n=e&&e.exec(t);return n&&n.index===0}const eF=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Bb(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const a=n;let i=fl(r),s="";for(;i.length>0;){const l=eF.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 tF=/\b\B/,tT="[a-zA-Z]\\w*",zb="[a-zA-Z_]\\w*",nT="\\b\\d+(\\.\\d+)?",rT="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",aT="\\b(0b[01]+)",nF="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",rF=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Bi(t,/.*\b/,e.binary,/\b.*/)),Ha({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},gl={begin:"\\\\[\\s\\S]",relevance:0},aF={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[gl]},iF={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[gl]},sF={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/},td=function(e,t,n={}){const r=Ha({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=Fb("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:Bi(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},oF=td("//","$"),lF=td("/\\*","\\*/"),cF=td("#","$"),uF={scope:"number",begin:nT,relevance:0},dF={scope:"number",begin:rT,relevance:0},fF={scope:"number",begin:aT,relevance:0},gF={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[gl,{begin:/\[/,end:/\]/,relevance:0,contains:[gl]}]},pF={scope:"title",begin:tT,relevance:0},hF={scope:"title",begin:zb,relevance:0},mF={begin:"\\.\\s*"+zb,relevance:0},yF=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 xc=Object.freeze({__proto__:null,APOS_STRING_MODE:aF,BACKSLASH_ESCAPE:gl,BINARY_NUMBER_MODE:fF,BINARY_NUMBER_RE:aT,COMMENT:td,C_BLOCK_COMMENT_MODE:lF,C_LINE_COMMENT_MODE:oF,C_NUMBER_MODE:dF,C_NUMBER_RE:rT,END_SAME_AS_BEGIN:yF,HASH_COMMENT_MODE:cF,IDENT_RE:tT,MATCH_NOTHING_RE:tF,METHOD_GUARD:mF,NUMBER_MODE:uF,NUMBER_RE:nT,PHRASAL_WORDS_MODE:sF,QUOTE_STRING_MODE:iF,REGEXP_MODE:gF,RE_STARTERS_RE:nF,SHEBANG:rF,TITLE_MODE:pF,UNDERSCORE_IDENT_RE:zb,UNDERSCORE_TITLE_MODE:hF});function xF(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function bF(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function vF(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=xF,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function kF(e,t){Array.isArray(e.illegal)&&(e.illegal=Fb(...e.illegal))}function _F(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 wF(e,t){e.relevance===void 0&&(e.relevance=1)}const EF=(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=Bi(n.beforeMatch,J5(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},NF=["of","and","for","in","not","or","if","then","parent","list","value"],SF="keyword";function iT(e,t,n=SF){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,iT(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,CF(c[0],c[1])]})}}function CF(e,t){return t?Number(t):jF(e)?0:1}function jF(e){return NF.includes(e.toLowerCase())}const Kk={},Ci=e=>{console.error(e)},Yk=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ji=(e,t)=>{Kk[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Kk[`${e}/${t}`]=!0)},Eu=new Error;function sT(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+=eT(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function TF(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ci("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Eu;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ci("beginScope must be object"),Eu;sT(e,e.begin,{key:"beginScope"}),e.begin=Bb(e.begin,{joinWith:""})}}function AF(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ci("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Eu;if(typeof e.endScope!="object"||e.endScope===null)throw Ci("endScope must be object"),Eu;sT(e,e.end,{key:"endScope"}),e.end=Bb(e.end,{joinWith:""})}}function RF(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function MF(e){RF(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),TF(e),AF(e)}function IF(e){function t(s,l){return new RegExp(fl(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+=eT(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(Bb(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;[bF,_F,MF,EF].forEach(d=>d(s,l)),e.compilerExtensions.forEach(d=>d(s,l)),s.__beforeBegin=null,[vF,kF,wF].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=iT(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=fl(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 LF(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=Ha(e.classNameAliases||{}),i(e)}function oT(e){return e?e.endsWithParent||oT(e.starts):!1}function LF(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ha(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:oT(e)?Ha(e,{starts:e.starts?Ha(e.starts):null}):Object.isFrozen(e)?Ha(e):e}var OF="11.11.1";class DF extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Bf=Z5,Qk=Ha,Xk=Symbol("nomatch"),PF=7,lT=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:Y9};function c(C){return l.noHighlightRe.test(C)}function u(C){let L=C.className+" ";L+=C.parentNode?C.parentNode.className:"";const F=l.languageDetectRe.exec(L);if(F){const Q=R(F[1]);return Q||(Yk(i.replace("{}",F[1])),Yk("Falling back to no-highlight mode for this block.",C)),Q?F[1]:"no-highlight"}return L.split(/\s+/).find(Q=>c(Q)||R(Q))}function d(C,L,F){let Q="",S="";typeof L=="object"?(Q=C,F=L.ignoreIllegals,S=L.language):(Ji("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ji("10.7.0",`Please use highlight(code, options) instead.
81
- https://github.com/highlightjs/highlight.js/issues/2277`),S=C,Q=L),F===void 0&&(F=!0);const Y={code:Q,language:S};P("before:highlight",Y);const V=Y.result?Y.result:f(Y.language,Y.code,F);return V.code=Y.code,P("after:highlight",V),V}function f(C,L,F,Q){const S=Object.create(null);function Y(W,z){return W.keywords[z]}function V(){if(!fe.keywords){Le.addText(Z);return}let W=0;fe.keywordPatternRe.lastIndex=0;let z=fe.keywordPatternRe.exec(Z),re="";for(;z;){re+=Z.substring(W,z.index);const le=Ne.case_insensitive?z[0].toLowerCase():z[0],Se=Y(fe,le);if(Se){const[ze,Ve]=Se;if(Le.addText(re),re="",S[le]=(S[le]||0)+1,S[le]<=PF&&(ve+=Ve),ze.startsWith("_"))re+=z[0];else{const Ke=Ne.classNameAliases[ze]||ze;ce(z[0],Ke)}}else re+=z[0];W=fe.keywordPatternRe.lastIndex,z=fe.keywordPatternRe.exec(Z)}re+=Z.substring(W),Le.addText(re)}function j(){if(Z==="")return;let W=null;if(typeof fe.subLanguage=="string"){if(!t[fe.subLanguage]){Le.addText(Z);return}W=f(fe.subLanguage,Z,!0,he[fe.subLanguage]),he[fe.subLanguage]=W._top}else W=p(Z,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(ve+=W.relevance),Le.__addSublanguage(W._emitter,W.language)}function $(){fe.subLanguage!=null?j():V(),Z=""}function ce(W,z){W!==""&&(Le.startScope(z),Le.addText(W),Le.endScope())}function J(W,z){let re=1;const le=z.length-1;for(;re<=le;){if(!W._emit[re]){re++;continue}const Se=Ne.classNameAliases[W[re]]||W[re],ze=z[re];Se?ce(ze,Se):(Z=ze,V(),Z=""),re++}}function _e(W,z){return W.scope&&typeof W.scope=="string"&&Le.openNode(Ne.classNameAliases[W.scope]||W.scope),W.beginScope&&(W.beginScope._wrap?(ce(Z,Ne.classNameAliases[W.beginScope._wrap]||W.beginScope._wrap),Z=""):W.beginScope._multi&&(J(W.beginScope,z),Z="")),fe=Object.create(W,{parent:{value:fe}}),fe}function ue(W,z,re){let le=J9(W.endRe,re);if(le){if(W["on:end"]){const Se=new Wk(W);W["on:end"](z,Se),Se.isMatchIgnored&&(le=!1)}if(le){for(;W.endsParent&&W.parent;)W=W.parent;return W}}if(W.endsWithParent)return ue(W.parent,z,re)}function ne(W){return fe.matcher.regexIndex===0?(Z+=W[0],1):(Ge=!0,0)}function Ce(W){const z=W[0],re=W.rule,le=new Wk(re),Se=[re.__beforeBegin,re["on:begin"]];for(const ze of Se)if(ze&&(ze(W,le),le.isMatchIgnored))return ne(z);return re.skip?Z+=z:(re.excludeBegin&&(Z+=z),$(),!re.returnBegin&&!re.excludeBegin&&(Z=z)),_e(re,W),re.returnBegin?0:z.length}function ke(W){const z=W[0],re=L.substring(W.index),le=ue(fe,W,re);if(!le)return Xk;const Se=fe;fe.endScope&&fe.endScope._wrap?($(),ce(z,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?($(),J(fe.endScope,W)):Se.skip?Z+=z:(Se.returnEnd||Se.excludeEnd||(Z+=z),$(),Se.excludeEnd&&(Z=z));do fe.scope&&Le.closeNode(),!fe.skip&&!fe.subLanguage&&(ve+=fe.relevance),fe=fe.parent;while(fe!==le.parent);return le.starts&&_e(le.starts,W),Se.returnEnd?0:z.length}function pe(){const W=[];for(let z=fe;z!==Ne;z=z.parent)z.scope&&W.unshift(z.scope);W.forEach(z=>Le.openNode(z))}let me={};function De(W,z){const re=z&&z[0];if(Z+=W,re==null)return $(),0;if(me.type==="begin"&&z.type==="end"&&me.index===z.index&&re===""){if(Z+=L.slice(z.index,z.index+1),!a){const le=new Error(`0 width match regex (${C})`);throw le.languageName=C,le.badRule=me.rule,le}return 1}if(me=z,z.type==="begin")return Ce(z);if(z.type==="illegal"&&!F){const le=new Error('Illegal lexeme "'+re+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw le.mode=fe,le}else if(z.type==="end"){const le=ke(z);if(le!==Xk)return le}if(z.type==="illegal"&&re==="")return Z+=`
82
- `,1;if(Be>1e5&&Be>z.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Z+=re,re.length}const Ne=R(C);if(!Ne)throw Ci(i.replace("{}",C)),new Error('Unknown language: "'+C+'"');const Ee=IF(Ne);let Oe="",fe=Q||Ee;const he={},Le=new l.__emitter(l);pe();let Z="",ve=0,Re=0,Be=0,Ge=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(L,Le);else{for(fe.matcher.considerAll();;){Be++,Ge?Ge=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=Re;const W=fe.matcher.exec(L);if(!W)break;const z=L.substring(Re,W.index),re=De(z,W);Re=W.index+re}De(L.substring(Re))}return Le.finalize(),Oe=Le.toHTML(),{language:C,value:Oe,relevance:ve,illegal:!1,_emitter:Le,_top:fe}}catch(W){if(W.message&&W.message.includes("Illegal"))return{language:C,value:Bf(L),illegal:!0,relevance:0,_illegalBy:{message:W.message,index:Re,context:L.slice(Re-100,Re+100),mode:W.mode,resultSoFar:Oe},_emitter:Le};if(a)return{language:C,value:Bf(L),illegal:!1,relevance:0,errorRaised:W,_emitter:Le,_top:fe};throw W}}function g(C){const L={value:Bf(C),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return L._emitter.addText(C),L}function p(C,L){L=L||l.languages||Object.keys(t);const F=g(C),Q=L.filter(R).filter(A).map($=>f($,C,!1));Q.unshift(F);const S=Q.sort(($,ce)=>{if($.relevance!==ce.relevance)return ce.relevance-$.relevance;if($.language&&ce.language){if(R($.language).supersetOf===ce.language)return 1;if(R(ce.language).supersetOf===$.language)return-1}return 0}),[Y,V]=S,j=Y;return j.secondBest=V,j}function m(C,L,F){const Q=L&&n[L]||F;C.classList.add("hljs"),C.classList.add(`language-${Q}`)}function y(C){let L=null;const F=u(C);if(c(F))return;if(P("before:highlightElement",{el:C,language:F}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.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(C)),l.throwUnescapedHTML))throw new DF("One of your code blocks includes unescaped HTML.",C.innerHTML);L=C;const Q=L.textContent,S=F?d(Q,{language:F,ignoreIllegals:!0}):p(Q);C.innerHTML=S.value,C.dataset.highlighted="yes",m(C,F,S.language),C.result={language:S.language,re:S.relevance,relevance:S.relevance},S.secondBest&&(C.secondBest={language:S.secondBest.language,relevance:S.secondBest.relevance}),P("after:highlightElement",{el:C,result:S,text:Q})}function v(C){l=Qk(l,C)}const x=()=>{N(),Ji("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function b(){N(),Ji("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function N(){function C(){N()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",C,!1),k=!0;return}document.querySelectorAll(l.cssSelector).forEach(y)}function E(C,L){let F=null;try{F=L(e)}catch(Q){if(Ci("Language definition for '{}' could not be registered.".replace("{}",C)),a)Ci(Q);else throw Q;F=s}F.name||(F.name=C),t[C]=F,F.rawDefinition=L.bind(null,e),F.aliases&&D(F.aliases,{languageName:C})}function w(C){delete t[C];for(const L of Object.keys(n))n[L]===C&&delete n[L]}function T(){return Object.keys(t)}function R(C){return C=(C||"").toLowerCase(),t[C]||t[n[C]]}function D(C,{languageName:L}){typeof C=="string"&&(C=[C]),C.forEach(F=>{n[F.toLowerCase()]=L})}function A(C){const L=R(C);return L&&!L.disableAutodetect}function q(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=L=>{C["before:highlightBlock"](Object.assign({block:L.el},L))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=L=>{C["after:highlightBlock"](Object.assign({block:L.el},L))})}function U(C){q(C),r.push(C)}function K(C){const L=r.indexOf(C);L!==-1&&r.splice(L,1)}function P(C,L){const F=C;r.forEach(function(Q){Q[F]&&Q[F](L)})}function M(C){return Ji("10.7.0","highlightBlock will be removed entirely in v12.0"),Ji("10.7.0","Please use highlightElement now."),y(C)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:N,highlightElement:y,highlightBlock:M,configure:v,initHighlighting:x,initHighlightingOnLoad:b,registerLanguage:E,unregisterLanguage:w,listLanguages:T,getLanguage:R,registerAliases:D,autoDetection:A,inherit:Qk,addPlugin:U,removePlugin:K}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString=OF,e.regex={concat:Bi,lookahead:J5,either:Fb,optional:X9,anyNumberOfTimes:Q9};for(const C in xc)typeof xc[C]=="object"&&X5(xc[C]);return Object.assign(e,xc),e},Os=lT({});Os.newInstance=()=>lT({});var FF=Os;Os.HighlightJS=Os;Os.default=Os;const BF=hl(FF),Zk={},zF="hljs-";function UF(e){const t=BF.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||Zk,g=typeof f.prefix=="string"?f.prefix:zF;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:qF,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||Zk).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 qF{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 $F={};function Jk(e){const t=e||$F,n=t.aliases,r=t.detect||!1,a=t.languages||W9,i=t.plainText,s=t.prefix,l=t.subset;let c="hljs";const u=UF(a);if(n&&u.registerAlias(n),s){const d=s.indexOf("-");c=d===-1?s:s.slice(0,d)}return function(d,f){ed(d,"element",function(g,p,m){if(g.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=HF(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=x8(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 HF(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 ax(){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 Vc({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 nd(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 ji(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function WF(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 VF({part:e}){const{t}=mt(),{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=nd(n||l,r.input),u=r.input&&r.input._purpose?r.input._purpose:null,d=s==="completed"?WF(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:ji((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:ji(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function GF({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=nd(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:ji(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:ji(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:ji(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function KF({text:e,isStreaming:t}){const{t:n}=mt(),[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(cl,{remarkPlugins:[dl,ax],children:e})})]})}const Gr="",ix="pave-working-directory";function $o(){if(typeof window>"u")return null;try{return localStorage.getItem(ix)||null}catch{return null}}function zf(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(ix):localStorage.setItem(ix,e)}catch{}}async function Ue(e,t={}){const n=$o(),r={"Content-Type":"application/json",...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:a,...i}=t,s=await fetch(`${Gr}${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 sx(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()));const n=t.toString(),r=n?`/session?${n}`:"/session";return Ue(r)}function e_(e){return Ue("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function Uf(e){return Ue(`/session/${e}`)}function dr(e,t){return Ue(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function YF(e){return Ue(`/session/${e}/regenerate-title`,{method:"POST"})}function QF(e){return Ue(`/session/${e}/fork`,{method:"POST"})}function t_(e){return Ue(`/session/${e}`,{method:"DELETE"})}function XF(e){return Ue(`/session/${e}/archive/session`,{method:"POST"})}function ZF(){return Ue("/session",{method:"DELETE"})}function JF(e){return Ue(`/session/${e}/message`)}function bc(e,t,n){const r="?limit="+(t||0)+"&offset="+(n||0);return Ue("/session/"+e+"/compacted"+r)}function vc(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),Ue(`/session/${e}/message`,{method:"POST",body:JSON.stringify(s)})}function qf(e){return Ue(`/session/${e}/queue`)}function n_(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),Ue(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function r_(e,t){return Ue(`/session/${e}/queue/${t}`,{method:"DELETE"})}function eB(e,t){return Ue(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function tB(e){return Ue(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function nB(e){return Ue(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function rB(e){return Ue(`/session/${e}/abort`,{method:"POST"})}function cT(e){return Ue(`/session/${e}/idle-injection`)}function aB(e,t){return Ue(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function iB(e){return Ue(`/session/${e}/idle-injection`,{method:"DELETE"})}function sB(e){return Ue(`/session/${e}/scheduled-injections`)}function oB(e,t){return Ue(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function lB(e,t,n){return Ue(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function cB(e,t){return Ue(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function uB(){return Ue("/config/providers")}function dB(){return Ue("/api/models/registry")}function fB(){return Ue("/auth/status")}function gB(){return Ue("/auth/logout",{method:"POST"})}function pB(){return Ue("/api/permissions/pending")}function hB(e){return Ue(`/api/permissions/confirm/${e}`,{method:"POST"})}function mB(e){return Ue(`/api/permissions/deny/${e}`,{method:"POST"})}function yB(){return Ue("/api/questions/pending")}function xB(e,t){return Ue(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function bB(e){return Ue(`/api/questions/${e}/reject`,{method:"POST"})}function Ub(){return Ue("/skills")}function vB(){return Ue("/skills/commands")}function kB(){return Ue("/skills/registry")}function _B(e){return Ue(`/skills/${encodeURIComponent(e)}`)}function wB(e){return Ue(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function EB(e){return Ue(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function NB(){return Ue("/skills/check-updates")}function SB(e,t){return Ue(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function CB(e){return Ue(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function jB(e){return Ue(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function uT(){return Ue("/api/skill-defaults")}function TB(e){return Ue("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function AB(e){return Ue(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function RB(){return Ue("/config")}function MB(e){const t=e?"?model="+encodeURIComponent(e):"";return Ue("/config/adaptive-quality"+t)}function ox(){return Ue("/path")}function a_(e){return Ue("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function IB(e){return Ue("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function dT(){return Ue("/settings")}function LB(e){return Ue("/settings",{method:"PUT",body:JSON.stringify(e)})}function i_(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 Ue("/api/user/inbox"+(n?"?"+n:""))}function OB(e){return Ue("/api/user/inbox/"+encodeURIComponent(e)+"/read",{method:"POST"})}function DB(e){return Ue("/api/user/inbox/"+encodeURIComponent(e)+"/unread",{method:"POST"})}function PB(e){return Ue("/api/user/inbox/"+encodeURIComponent(e),{method:"DELETE"})}function FB(){return Ue("/api/user/inbox/read-all",{method:"POST"})}function BB(){return Ue("/api/user/inbox",{method:"DELETE"})}async function zB(e){const t=await fetch(Gr+"/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 UB(e){return Ue("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function qB(e,t,n,r){const a=$o(),i={};a&&(i["x-opencode-directory"]=a),e.type?i["Content-Type"]=e.type:i["Content-Type"]="audio/webm";let s=Gr+"/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 yo=null,kc=0;function lx(){const e=Date.now();return yo&&e<kc||(yo=Ue("/api/transcribe/config").then(t=>(kc=Date.now()+5e3,t)).catch(t=>{throw yo=null,kc=0,t}),kc=1/0),yo}function s_(){return Ue("/session/status")}function $B(e){return Ue(`/session/${encodeURIComponent(e)}/dlp/status`)}function HB(){return Ue("/api/dlp/policy")}function WB(e){return Ue("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function VB(e){return(await fetch(`${Gr}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function GB(e){return(await fetch(`${Gr}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function o_(e){const t=await fetch(`${Gr}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function KB(e){return(await fetch(`${Gr}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function $f(e){try{const t=await fetch(`${Gr}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function YB(e){const t=await fetch(`${Gr}/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 l_(e){try{const t=await fetch(`${Gr}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function QB(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function XB({part:e,questionId:t}){const{t:n}=mt(),{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=e.callID||e.id||null;h.useEffect(()=>{if(l||x||!E)return;let K=!1;return yB().then(P=>{if(K||!k.current)return;const M=Array.isArray(P&&P.pending)?P.pending:[];for(var C=0;C<M.length;C++){var L=M[C],F=L.tool&&L.tool.callID?L.tool.callID:null;if(F===E&&L.id){b(L.id);break}}}).catch(()=>{}),()=>{K=!0}},[l,x,E]),h.useEffect(()=>()=>{k.current=!1},[]),h.useEffect(()=>{!l&&N.current&&(N.current.focus(),N.current.scrollIntoView({behavior:"smooth",block:"center"}))},[l]);const w=K=>{var P,M;return(((P=u[K])==null?void 0:P.length)??0)>0||(((M=f[K])==null?void 0:M.trim().length)??0)>0},T=s.every((K,P)=>w(P)),R=(K,P,M)=>{d(C=>{const L=C[K]??[];return M?{...C,[K]:L.includes(P)?L.filter(F=>F!==P):[...L,P]}:{...C,[K]:L.includes(P)?[]:[P]}})},D=h.useCallback(async()=>{if(!T||!x)return;const K=s.map((P,M)=>{var F;const C=u[M]??[],L=(F=f[M])==null?void 0:F.trim();return L?[...C,L]:C});m("reply"),v(null);try{const P=await xB(x,K);if(!k.current)return;if(P&&P.success===!1){v(P.error||"Failed to reply"),m(null);return}}catch(P){if(!k.current)return;v(P.message||"Failed to reply"),m(null)}},[x,s,u,f,T]),A=h.useCallback(async()=>{if(x){m("reject"),v(null);try{const K=await bB(x);if(!k.current)return;if(K&&K.success===!1){v(K.error||"Failed to dismiss"),m(null);return}}catch(K){if(!k.current)return;v(K.message||"Failed to dismiss"),m(null)}}},[x]),q=K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),D())};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((K,P)=>o.jsxs("div",{className:P>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:K.text}),c&&o.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:ZB(c,P,s.length)})]},P))]});let U=!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((K,P)=>{const M=Array.isArray(K.options)?K.options:[],C=M.length>0,L=K.multiple===!0,F=K.custom!==!1,Q=u[P]??[],S=F&&!U;return S&&(U=!0),o.jsxs("div",{className:P>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(K.header||L)&&o.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[K.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:K.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:K.text}),C&&o.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:M.map((Y,V)=>{const j=QB(Y),$=Q.includes(j);return o.jsx("button",{onClick:()=>R(P,j,L),disabled:p!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${$?"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":$,children:j},V)})}),F&&o.jsx("input",{ref:S?N:void 0,type:"text",value:f[P]??"",onChange:Y=>g(V=>({...V,[P]:Y.target.value})),onKeyDown:q,disabled:p!==null,placeholder:n(C?"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"})]},P)}),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:A,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:D,disabled:p!==null||!T||!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 ZB(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 JB({sessionId:e}){const{t}=mt(),[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 YB(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 ez="plan.md";function tz(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function nz(e){return typeof e!="string"||!e?!1:tz(e).toLowerCase()===ez}function rz(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||{};nz(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function qb(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 az(e,t,n){const r=qb(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 iz(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 fT({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}){var{t:N}=mt(),E=e.role==="user",w=!E&&v&&!x?rz(t)!==null:!1,T=E&&e._queued===!0,R=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[D,A]=h.useState(!1),[q,U]=h.useState(!1),[K,P]=h.useState(""),M=h.useRef(null),C=h.useRef(!0),L=h.useRef(null);h.useEffect(function(){var Z=L.current;!Z||!q||(Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,300)+"px")},[K,q]),h.useEffect(function(){return C.current=!0,function(){C.current=!1,M.current&&clearTimeout(M.current)}},[]);var F=qb(t,n,m),Q=(t||[]).filter(function(Z){return Z.type==="tool"}),S=(t||[]).filter(function(Z){return Z.type==="file"&&Z.filename}),Y=(t||[]).filter(function(Z){if(Z.type!=="image_url"||!Z.image_url)return!1;var ve=Z.image_url.url||Z.image_url;if(typeof ve!="string")return!1;if(ve.startsWith("data:image/")){var Re=ve.indexOf(";"),Be=Re>5?ve.substring(5,Re).toLowerCase():"",Ge=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return Ge.indexOf(Be)!==-1}if(ve.startsWith("https://"))try{var W=new URL(ve),z=W.pathname.toLowerCase();return!z.endsWith(".svg")&&!z.endsWith(".svgz")}catch{return!1}return!1});if(!E){var V=!!F,j=Y.length>0,$=Q.length>0,ce=Q.some(function(Z){return(Z.tool||Z.state&&Z.state.title||"")==="question"}),J=!g||ce;if(!V&&!j&&(!$||!J))return null}var _e=oz(e.time,N),ue=e.isAutoInjected===!0,ne=e.isCompaction===!0,Ce=function(){var Z=F||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(Z).then(function(){C.current&&(A(!0),M.current&&clearTimeout(M.current),M.current=setTimeout(function(){C.current&&A(!1)},2e3))}).catch(function(){C.current&&ke(Z)}):ke(Z)},ke=function(Z){var ve=document.createElement("textarea");ve.value=Z,ve.style.position="fixed",ve.style.opacity="0",document.body.appendChild(ve),ve.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(ve)}C.current&&(A(!0),M.current&&clearTimeout(M.current),M.current=setTimeout(function(){C.current&&A(!1)},2e3))},pe=function(){P(F||""),U(!0)},me=function(){U(!1),P("")},De=function(){K.trim()&&(T&&f&&f(e.id),d&&d(K.trim())),U(!1),P("")},Ne=null;if(E){var Ee=ne?N("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":F;a&&s>0&&!ne?Ne=lz(F||"",a,i,l,c):Ne=o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Ee})}var Oe={pre:function({node:Z,children:ve,...Re}){if(h.isValidElement(ve)){var Be=ve.type;if(Be==="code"||typeof Be=="string"&&Be.toLowerCase()==="code"){var Ge=ve.props||{},W=className.match(/language-(\S+)/),z=W?W[1]:"",re=Ho(Ge.children);return o.jsx(Vc,{language:z,className,frameless:he,children:re})}}var le=Ho(ve);return le?o.jsx(Vc,{language:"",className:"",frameless:he,children:le}):o.jsx("pre",{...Re,children:ve})},code:function({node:Z,className:ve,children:Re,...Be}){if(Z&&Z.position&&Be["data-sourcepos"],ve&&ve.indexOf("language-")!==-1){var Ge=ve.match(/language-(\S+)/),W=Ge?Ge[1]:"";return o.jsx(Vc,{language:W,className:ve,frameless:he,children:Ho(Re)})}return o.jsx("code",{className:he?"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",...Be,children:Re})},a:function({node:Z,children:ve,href:Re,...Be}){return o.jsx("a",{href:Re,...Be,target:"_blank",rel:"noopener noreferrer",children:ve})},table:function({node:Z,children:ve,...Re}){return o.jsx("div",{className:he?"overflow-x-auto my-3":"overflow-x-auto",children:o.jsx("table",{className:he?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...Re,children:ve})})},th:function({node:Z,children:ve,...Re}){return o.jsx("th",{className:he?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...Re,children:ve})},td:function({node:Z,children:ve,...Re}){return o.jsx("td",{className:he?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...Re,children:ve})}},fe={current:0},he=p&&!E,Le=he&&v&&x;return o.jsxs("div",{className:`group flex gap-3 ${E?"justify-end":"justify-start"} ${T?"opacity-60 italic":""}`,children:[!E&&!he&&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 ${he?"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 ${E?`bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5${T&&!q?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:he?Le?"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`}`,...T&&!q&&d&&f?{onClick:pe,title:N("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(Z){(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),pe())}}:{},children:E?q?o.jsxs("div",{className:"space-y-2",children:[o.jsx("textarea",{ref:L,value:K,onChange:function(Z){P(Z.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:me,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:De,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:[Ne,S.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:S.map(function(Z,ve){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:Z.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:Z.filename})]},Z.id||"file-"+ve)})}),Y.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Y.map(function(Z,ve){var Re=Z.image_url.url||Z.image_url;return o.jsx("a",{href:Re,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:Re,alt:N("chat.attachment_with_index",{index:ve+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},Z.id||"img-"+ve)})})]}):sz(t,n,Y,S,Oe,fe,a,i,s,l,c,g,m,N,he,k,v,x)}),w&&o.jsx(JB,{sessionId:b}),o.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${E?"justify-end":"justify-start"}`,children:[_e&&o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:_e}),ue&&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:N("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:N("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:[F&&o.jsx("button",{onClick:Ce,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":N(D?"chat.copied":"chat.copy_message"),title:N(D?"chat.copied":"chat.copy_message"),children:D?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"})})}),E&&!T&&!q&&d&&o.jsx("button",{onClick:pe,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":N("chat.edit_resend"),title:N("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"})})}),E&&T&&!q&&d&&f&&o.jsx("button",{onClick:pe,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":N("chat.edit_resend"),title:N("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"})})}),E&&T&&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":N("chat.cancel_queued"),title:N("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"})})}),!E&&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":N("chat.regenerate"),title:N("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"})})})]})]})]}),E&&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:R})})]})}function sz(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 E=Object.keys(t),w=0;w<E.length;w++){var T=t[E[w]];(T.type==="text"||T.type==="reasoning")&&!k[T.id]&&b.push({id:T.id,type:T.type,text:T.text||T.delta||""})}}var R=[],D="",A="",q="",U="";function K(){D&&(R.push({type:"text",text:D,key:A}),D="",A="")}function P(){q&&(R.push({type:"reasoning",text:q,key:U}),q="",U="")}for(var M=0;M<b.length;M++){var C=b[M];if(C.type==="text"){P(),A||(A="text-"+(C.id||M));var L=C.text||"";D&&L&&!D.endsWith(`
98
- `)&&(D+=`
99
- `),D+=L}else if(C.type==="reasoning"){K(),U||(U="reasoning-"+(C.id||M));var F=C.text||"";q&&F&&!q.endsWith(`
100
- `)&&(q+=`
101
- `),q+=F}else C.type==="tool"&&(P(),K(),R.push({type:"tool",part:C,key:"tool-"+(C.id||M)}))}if(P(),K(),r.length>0&&R.push({type:"files",parts:r,key:"files"}),n.length>0&&R.push({type:"images",parts:n,key:"images"}),R.length===0)return null;var Q=[],S=[],Y="";function V(){S.length>0&&(Q.push(o.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:S},"accent-"+Y)),S=[])}for(var j=0;j<R.length;j++){var $=R[j];if($.type==="text"){V();var ce=Object.assign({},a);if(s&&c>0){var J=function(ke,pe){return function({children:me,node:De,...Ne}){return o.jsx(ke,{...Ne,children:cx(me,s,l,pe,u,d)})}};ce.p=J("p",i),ce.li=J("li",i),ce.td=J("td",i),ce.th=J("th",i),ce.h1=J("h1",i),ce.h2=J("h2",i),ce.h3=J("h3",i),ce.h4=J("h4",i),ce.h5=J("h5",i),ce.h6=J("h6",i),ce.blockquote=J("blockquote",i)}Q.push(o.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:o.jsx(cl,{remarkPlugins:[dl,ax],rehypePlugins:[Jk],components:ce,children:$.text})},$.key))}else if($.type==="reasoning")if(m)S.length===0&&(Y=$.key),S.push(o.jsx(KF,{text:$.text,isStreaming:j===R.length-1&&v&&x},$.key));else{if(V(),g)continue;Q.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(cl,{remarkPlugins:[dl,ax],rehypePlugins:[Jk],components:a,children:$.text})})]},$.key))}else if($.type==="tool"){var _e=$.part.tool||$.part.state&&$.part.state.title||"",ue=_e==="question";if(ue){V();var ne=$.part.callID||$.part.id||"",Ce=y&&y[ne]?y[ne]:null;Q.push(o.jsx("div",{className:"my-2",children:o.jsx(XB,{part:$.part,questionId:Ce})},$.key))}else m&&!f?(S.length===0&&(Y=$.key),S.push(o.jsx(GF,{part:$.part},$.key))):(V(),Q.push(o.jsx("div",{className:`my-2 ${f?"hidden":""}`,children:o.jsx(VF,{part:$.part})},$.key)))}else $.type==="files"?(V(),Q.push(o.jsx("div",{className:Q.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:$.parts.map(function(ke,pe){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:ke.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:ke.filename})]},ke.id||"file-"+pe)})})},$.key))):$.type==="images"&&Q.push(o.jsx("div",{className:Q.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:$.parts.map(function(ke,pe){var me=ke.image_url.url||ke.image_url;return o.jsx("a",{href:me,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:me,alt:p("chat.attachment_with_index",{index:pe+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ke.id||"img-"+pe)})})},$.key))}return V(),Q}function Ho(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(Ho).join(""):h.isValidElement(e)?Ho(e.props.children):""}function oz(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 lz(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 cx(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:cx(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===Vc)return e;if(e.props&&e.props.children!==void 0){var m=cx(e.props.children,t,n,r,a,i);return h.cloneElement(e,void 0,m)}}return e}function cz({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 uz=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:E,onToggleBanner:w,privateMessageIds:T,parentSessionID:R,onViewParentSession:D,compactionPinned:A,onUnpinCompaction:q,questionIdMap:U,compactedHistory:K,onLoadMoreCompacted:P,onHideCompacted:M,loadingCompacted:C},L){const{t:F}=mt(),Q=h.useRef(null),S=h.useRef(null),Y=h.useRef(!0),V=h.useRef({}),[j,$]=h.useState(!1);var ce=function(){Q.current&&Q.current.scrollIntoView({behavior:"smooth"})};h.useImperativeHandle(L,function(){return{scrollToBottom:ce,resetAutoScroll:function(){Y.current=!0}}},[]);var J=h.useCallback(function(pe,me){me?V.current[pe]=me:delete V.current[pe]},[]),_e=h.useRef({}),ue=h.useMemo(function(){if(!d)return{perMessage:{},total:0,_nextCache:{}};for(var pe=d.toLowerCase(),me=0,De={},Ne={},Ee=_e.current,Oe=0;Oe<t.length;Oe++){var fe=t[Oe],he=az(fe.parts,n[fe.info.id],b),Le=fe.info.role==="assistant",Z=Le?iz(he):he,ve=Z.toLowerCase(),Re=fe.info.id,Be=Ee[Re],Ge;Be&&Be.text===ve&&Be.query===pe?Ge=Be.count:Ge=dz(ve,pe),Ne[Re]={text:ve,query:pe,count:Ge},Ge>0&&(De[fe.info.id]={offset:me,count:Ge}),me+=Ge}return{perMessage:De,total:me,_nextCache:Ne}},[t,n,d,b]);h.useEffect(function(){_e.current=ue._nextCache},[ue]);var ne=h.useMemo(function(){return{perMessage:ue.perMessage,total:ue.total}},[ue]);h.useEffect(function(){g&&g(ne.total)},[ne.total,g]),h.useEffect(function(){if(!(!d||ne.total===0)){var pe=requestAnimationFrame(function(){var me=V.current[f];me&&me.scrollIntoView({behavior:"smooth",block:"center"})});return function(){cancelAnimationFrame(pe)}}},[f,d,ne.total]),h.useEffect(function(){V.current={}},[d]),h.useEffect(function(){var pe=S.current;if(pe){var me=0,De=!1,Ne=function(){me||(me=requestAnimationFrame(function(){if(me=0,!!S.current){var Ee=pe.scrollTop,Oe=pe.scrollHeight,fe=pe.clientHeight,he=Oe-Ee-fe;Y.current=he<80;var Le=he>200;Le!==De&&(De=Le,$(Le))}}))};return pe.addEventListener("scroll",Ne),Ne(),function(){pe.removeEventListener("scroll",Ne),me&&cancelAnimationFrame(me)}}},[]),h.useEffect(function(){!d&&Y.current&&Q.current&&Q.current.scrollIntoView({behavior:"smooth"})},[t,n,d]);for(var Ce=-1,ke=t.length-1;ke>=0;ke--)if(t[ke].info.role==="assistant"){Ce=ke;break}return o.jsxs("div",{ref:S,className:"flex-1 overflow-y-auto overflow-x-hidden relative",children:[o.jsx(cz,{sessionID:k,banners:N,hidden:E,onToggle:w}),o.jsx(mz,{sessionID:k,parentSessionID:R,onViewParentSession:D,compactionPinned:A,onUnpinCompaction:q,t:F}),o.jsx(yz,{compactedHistory:K,onLoadMore:P,onHide:M,loading:C,t:F}),o.jsx("div",{className:"px-2 sm:px-4 py-6",children:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto space-y-6",children:[t.map(function(pe,me){var De=ne.perMessage[pe.info.id]||null,Ne=me===Ce,Ee=pe.info.role==="user";return o.jsx(fT,{message:pe.info,parts:pe.parts,streamingParts:n[pe.info.id],user:u,searchQuery:d,matchOffset:De?De.offset:-1,matchCount:De?De.count:0,activeMatchIndex:f,registerMatchRef:J,isLast:Ne,isBusy:a,sessionID:k,onRetry:Ne&&!a?p:void 0,onEditAndResend:Ee&&!a&&!gz(pe.parts)?m:void 0,onCancelQueued:y,hackerMode:v,mobileFrameless:x,hideThinking:b,isPrivate:T&&T.has(pe.info.id),questionIdMap:U},pe.info.id)}),a&&(x?!0:!fz(t,n,v,b))&&(x?o.jsx("div",{className:"flex justify-start py-2",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",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",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:pz(r.toolNames,F)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:hz(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"}})})]})]}),o.jsx("div",{ref:Q})]})}),j&&o.jsx("button",{onClick:ce,"aria-label":F("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:F("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 dz(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 fz(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 gz(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function pz(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 hz(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function mz({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"})})})]})})}function yz({compactedHistory:e,onLoadMore:t,onHide:n,loading:r,t:a}){if(!e||e.totalTurns<=0)return null;var i=e.totalTurns,s=e.loadedTurns||0,l=e.hasMore,c=i-s,u=10;if(s>=i&&!l)return o.jsx("div",{className:"px-2 sm:px-4 py-1.5 bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-800/60",children:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2 flex-wrap",children:[o.jsx("svg",{className:"w-3.5 h-3.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:"M5 13l4 4L19 7"})}),o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 flex-1 min-w-0 truncate",children:a&&a("compacted_history.all_loaded",{count:s})||"All compacted history loaded ("+s+" turns)"}),n&&o.jsx("button",{type:"button",onClick:n,className:"text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:a&&a("compacted_history.hide")||"Hide"})]})});var d;return s===0?d=a&&a("compacted_history.load",{count:Math.min(u,c)})||"Load previous "+Math.min(u,c)+" turns":d=a&&a("compacted_history.load_more",{count:Math.min(u,c),remaining:c})||"Load "+Math.min(u,c)+" more turns ("+c+" remaining)",o.jsx("div",{className:"px-2 sm:px-4 py-2 bg-amber-50 dark:bg-amber-900/20 border-b border-amber-200 dark:border-amber-800/50",children:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2 flex-wrap",children:[o.jsx("svg",{className:"w-4 h-4 text-amber-500 dark:text-amber-400 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",{className:"text-xs text-amber-700 dark:text-amber-300 flex-1 min-w-0 truncate",children:s>0?a&&a("compacted_history.loaded_and_total",{loaded:s,total:i})||s+" of "+i+" turns shown":a&&a("compacted_history.compacted_turns",{count:i})||i+" turns compacted"}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("button",{type:"button",onClick:t,disabled:r,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 disabled:opacity-50 disabled:no-underline",children:r?"…":d}),s>0&&n&&o.jsx("button",{type:"button",onClick:n,className:"text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap",children:a&&a("compacted_history.hide")||"Hide"})]})]})})}const rd=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],gT=["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"],pT=[...rd,...gT],Nu=5,c_=Math.floor(4*1024*1024/1.34),u_=5*1024*1024,d_=6*1024*1024,f_=Math.floor(4*1024*1024/1.34),xz=pT.join(",");function Hf(e){return e?rd.indexOf(e.toLowerCase())!==-1:!1}class bz{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 vz={AudioRingBuffer:bz};class kz{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 _z={TranscriptionScheduler:kz};function wz(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 Ez(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(wz(l,c)/s<=a)return t.slice(s)}return t}var Nz={dedupOverlap:Ez};const es=16e3,Sz=10,Cz=3,jz=3,Tz=200,g_=3,Wf=2,Az=1e3,p_=.01,Rz=1500;function h_(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 Mz(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 Iz(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 Lz({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),E=h.useRef(null),w=h.useRef(null),T=h.useRef(null),R=h.useRef(null),D=h.useRef(null),A=h.useRef(0),q=h.useRef(!1),U=h.useRef(""),K=h.useRef(!1),P=h.useRef(null),M=h.useRef("idle"),C=h.useCallback(fe=>{M.current=fe,s(fe)},[]),L=h.useRef(e),F=h.useRef(t),Q=h.useRef(n),S=h.useRef(r),Y=h.useRef(a);h.useEffect(()=>{L.current=e},[e]),h.useEffect(()=>{F.current=t},[t]),h.useEffect(()=>{Q.current=n},[n]),h.useEffect(()=>{S.current=r},[r]),h.useEffect(()=>{Y.current=a},[a]),h.useEffect(()=>{T.current&&(M.current==="recording"||M.current==="paused")&&T.current.clearPrevText()},[r]);const V=h.useCallback(()=>R.current?Promise.resolve(R.current):(D.current||(D.current=lx().then(fe=>(R.current=fe,fe)).catch(()=>{const fe={mode:"auto",backendAvailable:!1};return R.current=fe,fe})),D.current),[]);h.useEffect(()=>{V()},[V]);const j=h.useCallback(()=>{N.current&&(N.current.getTracks().forEach(fe=>fe.stop()),N.current=null)},[]),$=h.useCallback(()=>{y.current&&(y.current.terminate(),y.current=null)},[]),ce=h.useCallback(()=>{const fe=x.current,he=v.current,Le=b.current;if(fe){try{fe.disconnect()}catch{}fe.onaudioprocess=null,x.current=null}if(he){try{he.disconnect()}catch{}v.current=null}if(Le){try{Le.disconnect()}catch{}b.current=null}k.current=!1,j(),E.current&&E.current.state!=="closed"&&(E.current.close().catch(()=>{}),E.current=null),$(),w.current&&w.current.clear(),T.current&&T.current.reset(),A.current=0},[j,$]),J=h.useRef(null),_e=h.useRef(null),ue=h.useRef(null),ne=h.useRef(null),Ce=h.useRef(null),ke=h.useRef(null);J.current=function(he){const Le=he&&he.text||"";he&&he.chunkId;const Z=T.current,ve=he&&he._silent;Z&&Z.reportResult(Le);const Re=Nz.dedupOverlap(U.current,Le);if(Re){const Be=U.current+Re;U.current=Be,m(Be),L.current&&L.current(Re)}if(A.current=0,(ve||Le.trim()==="")&&U.current.trim()&&Q.current&&Q.current(),M.current==="draining"&&Z&&!Z.inflight){const Be=w.current,Ge=Z.drain(Be);Ge?ne.current(Ge):ke.current();return}ue.current()},_e.current=function(he){const Le=T.current;if(Le&&Le.reportResult(""),A.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",he,"("+A.current+"/"+g_+")"),A.current>=g_){ce(),C("idle"),F.current&&F.current("Voice transcription failed repeatedly. Please try again.");return}if(M.current==="draining"&&Le&&!Le.inflight){ke.current();return}ue.current()},ue.current=function(){const he=T.current,Le=w.current;if(!he||!Le)return;const Z=M.current;if(Z!=="recording"&&Z!=="paused"&&Z!=="draining")return;const ve=he.appendAndSchedule(Le);if(ve){ne.current(ve);return}if((Z==="paused"||Z==="draining")&&!he.inflight){const Re=he.drain(Le);Re?ne.current(Re):Z==="draining"&&ke.current()}},ne.current=async function(he){const Le=h_(he.audio);if(Le<p_){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+Le.toFixed(6)+")"),J.current({text:"",chunkId:he.chunkId,_silent:!0});return}const Z=R.current||{mode:"auto",backendAvailable:!1},ve=Z.backendAvailable&&Z.mode!=="local-only",Re=Z.mode!=="backend-only",Be=S.current,Ge=Y.current;if(ve&&!q.current){const re=Iz(he.audio,es),le={};he.initialPrompt&&(le.initialPrompt=he.initialPrompt);let Se=null;for(let ze=0;ze<=Wf;ze++)try{const Ve=await qB(re,Be,Ge,le);if(typeof Ve.text=="string"){g("backend"),J.current({text:Ve.text,chunkId:he.chunkId});return}}catch(Ve){Se=Ve;const Ke=Ve.status;if((Ke===429||Ke===503)&&ze<Wf){const ot=Az*2**ze;console.warn("[useContinuousVoiceInput] Backend "+Ke+", retrying in "+ot+"ms (attempt "+(ze+1)+"/"+Wf+")"),await new Promise(wt=>{setTimeout(wt,ot)});continue}(Ke===429||Ke===503)&&(q.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!Re){_e.current(Se?Se.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",Se?Se.message:"unknown")}if(!Re){_e.current("Backend transcription is not available and local mode is disabled.");return}const W=Ce.current();g("local");const z={type:"transcribe",audio:he.audio};Be&&(z.language=Be),he.initialPrompt&&(z.initialPrompt=he.initialPrompt),he.chunkId&&(z.chunkId=he.chunkId),W.postMessage(z,[he.audio.buffer])},Ce.current=function(){if(y.current)return y.current;const he=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});return he.onmessage=Le=>{const Z=Le.data;if(Z)switch(Z.type){case"loading":c(Z.progress||0),d(Z.file?Z.file.split("/").pop():null);break;case"ready":M.current==="loading"&&C("recording"),c(100),d(null);break;case"result":J.current(Z);break;case"error":_e.current(Z.error||"Transcription failed");break}},he.onerror=()=>{const Le=T.current;Le&&Le.reportResult(""),A.current+=1,$();const Z=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});Z.onmessage=ve=>{const Re=ve.data;if(Re)switch(Re.type){case"loading":c(Re.progress||0),d(Re.file?Re.file.split("/").pop():null);break;case"ready":M.current==="loading"&&C("recording"),c(100),d(null),ue.current();break;case"result":J.current(Re);break;case"error":_e.current(Re.error||"Transcription failed");break}},Z.onerror=()=>{Z.terminate(),y.current=null,ce(),C("idle"),U.current="",m(""),F.current&&F.current("Voice transcription worker crashed.")},y.current=Z},y.current=he,he},ke.current=function(){const he=y.current;he&&he.postMessage({type:"unload"}),E.current&&E.current.state!=="closed"&&(E.current.close().catch(()=>{}),E.current=null),T.current&&T.current.reset(),w.current&&w.current.clear(),C("idle")};const pe=h.useCallback(async()=>{if(M.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){F.current&&F.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){F.current&&F.current("Audio recording is not supported in this browser.");return}try{const fe=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:es,echoCancellation:!0,noiseSuppression:!0}});N.current=fe;const he=await V(),Le=he.mode==="local-only"||!he.backendAvailable&&he.mode!=="backend-only",Z=window.AudioContext||window.webkitAudioContext;(!E.current||E.current.state==="closed")&&(E.current=new Z);const ve=E.current;w.current=new vz.AudioRingBuffer({maxDuration:30,sampleRate:es}),T.current=new _z.TranscriptionScheduler({chunkDuration:Sz,overlapDuration:Cz,minChunkDuration:jz,sampleRate:es,maxInitialPrompt:Tz}),U.current="",m(""),A.current=0,q.current=!1,K.current=!1,P.current=null;const Re=ve.createMediaStreamSource(fe),Ge=ve.createScriptProcessor(4096,1,1),W=ve.createGain();W.gain.value=0,Re.connect(Ge),Ge.connect(W),W.connect(ve.destination),v.current=Re,x.current=Ge,b.current=W,k.current=!1,Ge.onaudioprocess=z=>{if(k.current)return;const re=z.inputBuffer,le=re.sampleRate,Se=re.getChannelData(0);let ze;if(le===es?ze=new Float32Array(Se):ze=Mz({sampleRate:le,getChannelData:()=>Se},es),ze.length===0)return;const Ve=w.current;Ve&&Ve.append(ze);const Ke=h_(ze),ot=performance.now();if(Ke>=p_)K.current=!0,P.current=null;else if(K.current){if(!P.current)P.current=ot;else if(ot-P.current>=Rz){K.current=!1,P.current=null;const wt=T.current;if(wt&&!wt.inflight&&Ve){const _t=wt.drain(Ve);_t&&ne.current(_t)}}}ue.current()},Le?(C("loading"),c(0),Ce.current().postMessage({type:"load"})):(C("recording"),c(100))}catch(fe){j(),C("idle");const he=fe.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(fe.message||String(fe));F.current&&F.current(he)}}},[V,j]),me=h.useCallback(()=>{const fe=M.current;if(fe==="loading"){ce(),$(),C("idle");return}if(fe!=="recording"&&fe!=="paused")return;const he=x.current,Le=v.current,Z=b.current;if(he){try{he.disconnect()}catch{}he.onaudioprocess=null,x.current=null}if(Le){try{Le.disconnect()}catch{}v.current=null}if(Z){try{Z.disconnect()}catch{}b.current=null}j(),C("draining"),setTimeout(()=>{const ve=T.current,Re=w.current;if(!ve||!Re){ke.current();return}if(!ve.inflight){const Be=ve.drain(Re);Be?ne.current(Be):ke.current()}},0)},[j,ce,$]),De=h.useCallback(()=>{M.current==="recording"&&(k.current=!0,C("paused"),ue.current())},[]),Ne=h.useCallback(()=>{M.current==="paused"&&(k.current=!1,C("recording"))},[]),Ee=h.useCallback(()=>{M.current!=="idle"&&(ce(),$(),U.current="",m(""),C("idle"))},[ce,$]),Oe=h.useCallback(()=>{if(M.current!=="idle"){F.current&&F.current("Cannot clear cache while recording.");return}C("loading"),c(0),$(),Ce.current().postMessage({type:"clearCache"})},[$]);return h.useEffect(()=>()=>{ce(),$()},[ce,$]),{state:i,progress:l,downloadingFile:u,transcriptionSource:f,transcriptText:p,startRecording:pe,stopRecording:me,pauseRecording:De,resumeRecording:Ne,cancelRecording:Ee,clearModelCache:Oe}}function Oz({skills:e,builtins:t,filter:n,onSelect:r,visible:a,selectedIndex:i,activeSkill:s,onBack:l}){const{t:c}=mt(),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 Gc=[{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 Dz(){return Gc.slice()}function Pz(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Gc.length;n++)if(Gc[n].name===t)return Gc[n];return null}function Fz(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=Pz(r);if(!a)return null;const i=(n[2]||"").trim();return{name:r,args:i,builtin:a}}const gi="pave-draft-",Bz=h.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:a,sessionId:i,queuedCount:s=0,onBuiltinCommand:l},c){const{t:u}=mt(),[d,f]=h.useState(""),[g,p]=h.useState([]),[m,y]=h.useState(!1);h.useEffect(()=>{const ee=()=>y(!1);return window.addEventListener("pave:plan-execute",ee),()=>window.removeEventListener("pave:plan-execute",ee)},[]);const[v,x]=h.useState(null),[b,k]=h.useState([]),[N,E]=h.useState(""),[w,T]=h.useState(!1),R=h.useRef(null),D=h.useRef([]),[A,q]=h.useState(-1),U="pave-asr-language",K=[{code:"auto",label:"Auto"},{code:"en",label:"English"},{code:"yue",label:"粵語"},{code:"zh",label:"普通話"},{code:"ja",label:"日本語"},{code:"ko",label:"한국어"},{code:"es",label:"Español"},{code:"fr",label:"Français"},{code:"de",label:"Deutsch"},{code:"fi",label:"Suomi"}],[P,M]=h.useState(()=>{try{return localStorage.getItem(U)||"auto"}catch{return"auto"}}),[C,L]=h.useState(!1),F=h.useRef(null),Q=h.useRef(g),S=h.useRef(null),Y=h.useRef(null),V=h.useRef(null),j=h.useRef(i),$=h.useRef(d),ce=h.useRef(null),[J,_e]=h.useState(!1),[ue,ne]=h.useState(""),[Ce,ke]=h.useState([]),[pe,me]=h.useState(0),[De,Ne]=h.useState(null),Ee=h.useRef({data:null,time:0}),Oe=6e4,fe=h.useCallback(ee=>{x(ee),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>x(null),5e3)},[]);h.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current)},[]),h.useLayoutEffect(()=>{$.current=d},[d]),h.useLayoutEffect(()=>{j.current=i,V.current&&(clearTimeout(V.current),V.current=null);let ee="";if(i)try{ee=localStorage.getItem(gi+i)||""}catch{}return f(ee),$.current=ee,p(Me=>(Me.forEach(Pe=>{Pe.preview&&URL.revokeObjectURL(Pe.preview)}),[])),()=>{V.current&&(clearTimeout(V.current),V.current=null);const Me=j.current;if(Me)try{$.current?localStorage.setItem(gi+Me,$.current):localStorage.removeItem(gi+Me)}catch{}}},[i]),h.useEffect(()=>{j.current&&(V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{try{d?localStorage.setItem(gi+j.current,d):localStorage.removeItem(gi+j.current)}catch{}},300))},[d]);const he=h.useCallback(async()=>{const ee=Ee.current;if(ee.data&&Date.now()-ee.time<Oe){ke(ee.data);return}try{const Me=await vB(),Pe=Array.isArray(Me)?Me:[];Ee.current={data:Pe,time:Date.now()},ke(Pe)}catch{ke([])}},[]),Le=h.useMemo(()=>Dz(),[]),Z=h.useMemo(()=>{const ee=(ue||"").trim().toLowerCase();if(De){const Xe=Ce.find(dt=>dt.skill===De);return(Xe&&Xe.commands||[]).filter(dt=>ee?(dt.name||"").toLowerCase().includes(ee)||(dt.description||"").toLowerCase().includes(ee):!0).map(dt=>({type:"command",skill:De,name:dt.name}))}const Me=Le.filter(Xe=>ee?(Xe.name||"").toLowerCase().includes(ee)||(Xe.description||"").toLowerCase().includes(ee):!0).map(Xe=>({type:"builtin",name:Xe.name})),Pe=Ce.filter(Xe=>ee?(Xe.skill||"").toLowerCase().includes(ee)||(Xe.description||"").toLowerCase().includes(ee)||(Xe.commands||[]).some(yt=>(yt.name||"").toLowerCase().includes(ee)||(yt.description||"").toLowerCase().includes(ee)):!0).map(Xe=>({type:"skill",skill:Xe.skill}));return Me.concat(Pe)},[ue,De,Ce,Le]),ve=h.useCallback(()=>Z.length,[Z]),Re=h.useCallback(ee=>{if(f(ee),$.current=ee,ee.startsWith("/")){const Me=ee.slice(1),Pe=Me.split(/\s/)[0]||"";if(!Pe.includes("/")&&!Pe.includes(".")){if(De){const Xe=De+" ";Me.startsWith(Xe)?(ne(Me.slice(Xe.length)),me(0)):(Ne(null),ne(Me),me(0))}else ne(Me),me(0);J||(he(),_e(!0),me(0))}else _e(!1),ne(""),Ne(null),me(0)}else _e(!1),ne(""),Ne(null),me(0)},[J,De,he]),Be=h.useCallback((ee,Me)=>{var Pe,Xe,yt;if(ee==="__builtin__"&&Me){f("/"+Me+" "),_e(!1),ne(""),Ne(null),me(0),(Pe=S.current)==null||Pe.focus();return}if(!Me)Ne(ee),ne(""),me(0),f("/"+ee+" "),(Xe=S.current)==null||Xe.focus();else{const dt="/"+ee+" "+Me+" ";f(dt),_e(!1),ne(""),Ne(null),me(0),(yt=S.current)==null||yt.focus()}},[]),Ge=h.useCallback(()=>{var ee;Ne(null),ne(""),me(0),f("/"),(ee=S.current)==null||ee.focus()},[]),W=h.useCallback(ee=>{f(Me=>{const Pe=Me&&!Me.endsWith(" ")&&!Me.endsWith(`
102
- `)?" ":"";return Me+Pe+ee})},[]),z=h.useRef(null),re=h.useCallback(()=>{setTimeout(()=>{z.current&&z.current()},50)},[]),{state:le,progress:Se,downloadingFile:ze,startRecording:Ve,stopRecording:Ke,resumeRecording:ot,cancelRecording:wt}=Lz({onTranscript:W,onError:fe,onAutoSubmit:re,model:N||void 0,language:P&&P!=="auto"?P:void 0});h.useEffect(()=>{try{P&&localStorage.setItem(U,P)}catch{}},[P]),h.useEffect(()=>{if(!C)return;const ee=Me=>{F.current&&!F.current.contains(Me.target)&&L(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[C]),h.useEffect(()=>{let ee=!1;return lx().then(Me=>{ee||Me&&Array.isArray(Me.models)&&Me.models.length>0&&(k(Me.models),E(Pe=>Pe||Me.models[0].name))}).catch(()=>{}),()=>{ee=!0}},[lx]),h.useEffect(()=>{if(!w){q(-1);return}D.current.length=b.length;function ee(Pe){R.current&&!R.current.contains(Pe.target)&&T(!1)}function Me(Pe){if(Pe.key==="Escape"){T(!1);return}Pe.key!=="ArrowDown"&&Pe.key!=="ArrowUp"&&Pe.key!=="Home"&&Pe.key!=="End"||(Pe.preventDefault(),q(Xe=>{const yt=D.current.length;if(!yt)return Xe;const dt=typeof Xe=="number"?Xe:-1;let ft=dt;return Pe.key==="ArrowDown"?ft=dt<yt-1?dt+1:0:Pe.key==="ArrowUp"?ft=dt>0?dt-1:yt-1:Pe.key==="Home"?ft=0:Pe.key==="End"&&(ft=yt-1),D.current[ft]&&D.current[ft].focus(),ft}))}return document.addEventListener("mousedown",ee),document.addEventListener("keydown",Me),()=>{document.removeEventListener("mousedown",ee),document.removeEventListener("keydown",Me)}},[w,b.length]),h.useEffect(()=>{const ee=S.current;ee&&(ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,200)+"px")},[d]),h.useEffect(()=>{Q.current=g},[g]),h.useEffect(()=>{var ee;(ee=S.current)==null||ee.focus()},[]),h.useImperativeHandle(c,()=>({focus:()=>{var ee;(ee=S.current)==null||ee.focus()},setText:ee=>{f(typeof ee=="string"?ee:""),requestAnimationFrame(()=>{var Me;return(Me=S.current)==null?void 0:Me.focus()})}}),[]);const _t=async()=>{const ee=d.trim();var Me=g.filter(function(dt){return Hf(dt.type)}),Pe=g.filter(function(dt){return!Hf(dt.type)});const Xe=Fz(ee);if(Xe&&typeof l=="function"){const dt=j.current;try{await l(Xe.name,Xe.args,{imageAttachments:Me.length>0?Me:void 0,fileAttachments:Pe.length>0?Pe:void 0})}catch{return}if(f(""),_e(!1),ne(""),Ne(null),me(0),dt)try{localStorage.removeItem(gi+dt)}catch{}g.forEach(function(ft){ft.preview&&URL.revokeObjectURL(ft.preview)}),p([]),S.current&&(S.current.style.height="auto");return}if(!ee&&Me.length===0&&Pe.length===0)return;const yt=j.current;try{await t(ee,Me.length>0?Me:void 0,m?"plan":void 0,Pe.length>0?Pe:void 0)}catch{return}if(f(""),_e(!1),ne(""),Ne(null),me(0),yt)try{localStorage.removeItem(gi+yt)}catch{}g.forEach(function(dt){dt.preview&&URL.revokeObjectURL(dt.preview)}),p([]),S.current&&(S.current.style.height="auto")};z.current=_t;const Jt=ee=>{if(J){const Me=ve();if(ee.key==="ArrowDown"){Me>0&&(ee.preventDefault(),me(Pe=>(Pe+1)%Me));return}if(ee.key==="ArrowUp"){Me>0&&(ee.preventDefault(),me(Pe=>(Pe-1+Me)%Me));return}if(ee.key==="Enter"||ee.key==="Tab"){if(Me>0){ee.preventDefault();const Pe=Z[pe];Pe&&(Pe.type==="command"?Be(Pe.skill,Pe.name):Pe.type==="builtin"?Be("__builtin__",Pe.name):Be(Pe.skill,null));return}if(ee.key==="Tab"){_e(!1),ne(""),Ne(null),me(0);return}}if(ee.key==="Escape"){ee.preventDefault(),_e(!1),ne(""),Ne(null),me(0);return}if(ee.key==="Backspace"&&De){const Pe=d.slice(1),Xe=De+" ";if(Pe===Xe||Pe===De){ee.preventDefault(),Ge();return}}}ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),_t())},ye=ee=>{if(!a){var Me=ee.clipboardData&&ee.clipboardData.items;if(Me){for(var Pe=[],Xe=0;Xe<Me.length;Xe++){var yt=(Me[Xe].type||"").toLowerCase();if(rd.indexOf(yt)!==-1){var dt=Me[Xe].getAsFile();dt&&Pe.push(dt)}}if(Pe.length!==0){for(var ft=!1,Mt=0;Mt<Me.length;Mt++)if(Me[Mt].type&&Me[Mt].type.startsWith("text/")){ft=!0;break}ft||ee.preventDefault();var Un=Pe.map(function(Nt){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Nt,name:Nt.name||"pasted-image.png",size:Nt.size,type:Nt.type,preview:null}});p(function(Nt){var Tt=Nu-Nt.length;if(Tt<=0)return Nt;for(var Xt=Un.slice(0,Tt),te=0;te<Xt.length;te++)Xt[te].preview=URL.createObjectURL(Xt[te].file);return Nt.concat(Xt)})}}}},We=ee=>{const Me=Array.from(ee.target.files||[]);if(Me.length===0)return;const Pe=Me.filter(yt=>pT.indexOf(yt.type)!==-1);if(Pe.length===0){ee.target.value="";return}const Xe=Pe.map(yt=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:yt,name:yt.name,size:yt.size,type:yt.type,preview:null}));p(yt=>{var dt=Nu-yt.length;if(dt<=0)return yt;for(var ft=Xe.slice(0,dt),Mt=0;Mt<ft.length;Mt++)ft[Mt].preview=Hf(ft[Mt].file.type)?URL.createObjectURL(ft[Mt].file):null;return[...yt,...ft]}),ee.target.value=""},Qe=ee=>{p(Me=>{const Pe=Me.find(Xe=>Xe.id===ee);return Pe!=null&&Pe.preview&&URL.revokeObjectURL(Pe.preview),Me.filter(Xe=>Xe.id!==ee)})},ut=ee=>ee<1024?ee+" B":ee<1024*1024?(ee/1024).toFixed(1)+" KB":(ee/(1024*1024)).toFixed(1)+" MB";return h.useEffect(()=>()=>{Q.current.forEach(ee=>{ee.preview&&URL.revokeObjectURL(ee.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(ee=>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:[ee.preview?o.jsx("img",{src:ee.preview,alt:ee.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:ee.name}),o.jsx("p",{className:"text-xs text-gray-400",children:ut(ee.size)})]}),o.jsx("button",{onClick:()=>Qe(ee.id),"aria-label":`Remove attachment ${ee.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"})})})]},ee.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(Oz,{skills:Ce,builtins:Le,filter:ue,onSelect:Be,visible:J,selectedIndex:pe,activeSkill:De,onBack:Ge}),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 ee;return(ee=Y.current)==null?void 0:ee.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:Y,type:"file",multiple:!0,accept:xz,onChange:We,className:"hidden"}),o.jsx("button",{onClick:le==="recording"?Ke:le==="paused"?ot:le==="loading"?wt:Ve,disabled:le==="draining"||(a||r)&&le!=="recording"&&le!=="loading"&&le!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(le==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":le==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":le==="loading"||le==="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:le==="recording"?u("voice.stop_recording")||"Stop recording":le==="paused"?u("voice.resume_recording")||"Resume recording":le==="loading"?u("voice.loading_model"):le==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),"aria-label":le==="recording"?u("voice.stop_recording")||"Stop recording":le==="paused"?u("voice.resume_recording")||"Resume recording":le==="loading"?u("voice.loading_model"):le==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),children:le==="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"})]}):le==="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"})]}):le==="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"})}):le==="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"})})}),le==="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:`${Se}%`}})}),o.jsx("span",{children:ze?`${ze} ${Se}%`:`${Se}%`})]}),o.jsxs("div",{className:"relative flex-shrink-0",ref:F,children:[o.jsxs("button",{onClick:()=>L(ee=>!ee),disabled:le==="recording"||le==="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":C,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:(K.find(ee=>ee.code===P)||K[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"})})]}),C&&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:K.map(ee=>o.jsx("button",{role:"menuitemradio","aria-checked":ee.code===P,onClick:()=>{M(ee.code),L(!1),ee.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 "+(ee.code===P?"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:ee.label},ee.code))})]}),b.length>1&&o.jsxs("div",{className:"relative flex-shrink-0",ref:R,children:[o.jsxs("button",{onClick:()=>T(ee=>!ee),disabled:le==="recording"||le==="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(ee=>ee.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((ee,Me)=>o.jsxs("button",{ref:Pe=>{D.current[Me]=Pe},role:"menuitemradio","aria-checked":ee.name===N,tabIndex:A===Me?0:-1,onClick:()=>{E(ee.name),T(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(ee.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:[ee.label,ee.type!=="openai"&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",ee.type,")"]})]},`${ee.name}-${Me}`))})]}),o.jsxs("button",{onClick:()=>y(ee=>!ee),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:S,value:d,onChange:ee=>Re(ee.target.value),onKeyDown:Jt,onPaste:ye,placeholder:u("chat.send_placeholder"),disabled:a,rows:1,role:J?"combobox":void 0,"aria-controls":J?"slash-command-listbox":void 0,"aria-activedescendant":J&&ve()>0?"slash-item-"+pe:void 0,"aria-expanded":J||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:_t,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 zz({darkMode:e,onToggleTheme:t}){const{t:n}=mt(),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 Uz({user:e,onLogout:t,onSkillManagement:n,onAgentManagement:r,onPricingSettings:a,onDlpSettings:i,onSettings:s}){const{t:l}=mt(),[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 hT({toolParts:e}){const{t}=mt();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(qz,{part:n},n.id))})]})}function qz({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=$z(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 $z(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+_c(t.filePath);case"Write":return"Writing "+_c(t.filePath);case"Edit":return"Editing "+_c(t.filePath);case"Bash":{const n=t.command||"";return m_(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+ux(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+ux(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return Hz(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+_c(t.filePath):t.command?m_(t.command):"Running "+e.toLowerCase()}}function _c(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 m_(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 "+ux(n,20)}function Hz(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 ux(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const dx=10,fx=24,y_=2,Wz=14,mT="pave-terminal-font-size";function Vz(){try{const e=localStorage.getItem(mT);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=dx&&t<=fx)return t}}catch{}return Wz}function yT({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=mt();const i=h.useRef(null),s=h.useRef(null),l=h.useRef(null),[c,u]=h.useState(Vz),d=h.useCallback(()=>{u(y=>Math.max(dx,y-y_))},[]),f=h.useCallback(()=>{u(y=>Math.min(fx,y+y_))},[]);h.useEffect(()=>{try{localStorage.setItem(mT,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 R=y.parentElement;if(R&&R.clientWidth>0&&R.clientHeight>0){y.width=R.clientWidth,y.height=R.clientHeight;return}const D=y.getBoundingClientRect();if(D.width>0&&D.height>0){y.width=D.width,y.height=D.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 E="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン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 R=0;R<N.length;R++){const D=E.charAt(Math.floor(Math.random()*E.length));v.fillText(D,R*b,N[R]*b),N[R]*b>y.height&&Math.random()>.975&&(N[R]=0),N[R]++}l.current=requestAnimationFrame(w)},T=()=>{x(),k=Math.floor(y.width/b);const R=new Array(k).fill(0);for(let D=0;D<Math.min(N.length,R.length);D++)R[D]=N[D];N=R};return window.addEventListener("resize",T),l.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",T),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<=dx,className:p,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),o.jsx("button",{type:"button",onClick:f,disabled:c>=fx,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(Kz,{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(Gz,{part:y,theme:g},y.id)),o.jsxs("div",{className:g.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function Gz({part:e,theme:t}){var{t:n}=mt();const{tool:r,state:a}=e;if(!a)return null;const i=a.status||"running",l=nd(r||a.title,a.input)||r||a.title||"unknown",c=a.output?ji(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?ji(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 Kz({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",i=nd(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 $b(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 Vf,x_;function Yz(){if(x_)return Vf;x_=1;function e(){this.__data__=[],this.size=0}return Vf=e,Vf}var Gf,b_;function Us(){if(b_)return Gf;b_=1;function e(t,n){return t===n||t!==t&&n!==n}return Gf=e,Gf}var Kf,v_;function ad(){if(v_)return Kf;v_=1;var e=Us();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Kf=t,Kf}var Yf,k_;function Qz(){if(k_)return Yf;k_=1;var e=ad(),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 Yf=r,Yf}var Qf,__;function Xz(){if(__)return Qf;__=1;var e=ad();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return Qf=t,Qf}var Xf,w_;function Zz(){if(w_)return Xf;w_=1;var e=ad();function t(n){return e(this.__data__,n)>-1}return Xf=t,Xf}var Zf,E_;function Jz(){if(E_)return Zf;E_=1;var e=ad();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 Zf=t,Zf}var Jf,N_;function id(){if(N_)return Jf;N_=1;var e=Yz(),t=Qz(),n=Xz(),r=Zz(),a=Jz();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,Jf=i,Jf}var eg,S_;function eU(){if(S_)return eg;S_=1;var e=id();function t(){this.__data__=new e,this.size=0}return eg=t,eg}var tg,C_;function tU(){if(C_)return tg;C_=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return tg=e,tg}var ng,j_;function nU(){if(j_)return ng;j_=1;function e(t){return this.__data__.get(t)}return ng=e,ng}var rg,T_;function rU(){if(T_)return rg;T_=1;function e(t){return this.__data__.has(t)}return rg=e,rg}var ag,A_;function xT(){if(A_)return ag;A_=1;var e=typeof za=="object"&&za&&za.Object===Object&&za;return ag=e,ag}var ig,R_;function Ir(){if(R_)return ig;R_=1;var e=xT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ig=n,ig}var sg,M_;function qs(){if(M_)return sg;M_=1;var e=Ir(),t=e.Symbol;return sg=t,sg}var og,I_;function aU(){if(I_)return og;I_=1;var e=qs(),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 og=i,og}var lg,L_;function iU(){if(L_)return lg;L_=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return lg=n,lg}var cg,O_;function zi(){if(O_)return cg;O_=1;var e=qs(),t=aU(),n=iU(),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 cg=s,cg}var ug,D_;function br(){if(D_)return ug;D_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ug=e,ug}var dg,P_;function Sl(){if(P_)return dg;P_=1;var e=zi(),t=br(),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 dg=s,dg}var fg,F_;function sU(){if(F_)return fg;F_=1;var e=Ir(),t=e["__core-js_shared__"];return fg=t,fg}var gg,B_;function oU(){if(B_)return gg;B_=1;var e=sU(),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 gg=n,gg}var pg,z_;function bT(){if(z_)return pg;z_=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 pg=n,pg}var hg,U_;function lU(){if(U_)return hg;U_=1;var e=Sl(),t=oU(),n=br(),r=bT(),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 hg=f,hg}var mg,q_;function cU(){if(q_)return mg;q_=1;function e(t,n){return t==null?void 0:t[n]}return mg=e,mg}var yg,$_;function Ui(){if($_)return yg;$_=1;var e=lU(),t=cU();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return yg=n,yg}var xg,H_;function Hb(){if(H_)return xg;H_=1;var e=Ui(),t=Ir(),n=e(t,"Map");return xg=n,xg}var bg,W_;function sd(){if(W_)return bg;W_=1;var e=Ui(),t=e(Object,"create");return bg=t,bg}var vg,V_;function uU(){if(V_)return vg;V_=1;var e=sd();function t(){this.__data__=e?e(null):{},this.size=0}return vg=t,vg}var kg,G_;function dU(){if(G_)return kg;G_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return kg=e,kg}var _g,K_;function fU(){if(K_)return _g;K_=1;var e=sd(),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 _g=a,_g}var wg,Y_;function gU(){if(Y_)return wg;Y_=1;var e=sd(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return wg=r,wg}var Eg,Q_;function pU(){if(Q_)return Eg;Q_=1;var e=sd(),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 Eg=n,Eg}var Ng,X_;function hU(){if(X_)return Ng;X_=1;var e=uU(),t=dU(),n=fU(),r=gU(),a=pU();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,Ng=i,Ng}var Sg,Z_;function mU(){if(Z_)return Sg;Z_=1;var e=hU(),t=id(),n=Hb();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Sg=r,Sg}var Cg,J_;function yU(){if(J_)return Cg;J_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Cg=e,Cg}var jg,ew;function od(){if(ew)return jg;ew=1;var e=yU();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return jg=t,jg}var Tg,tw;function xU(){if(tw)return Tg;tw=1;var e=od();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Tg=t,Tg}var Ag,nw;function bU(){if(nw)return Ag;nw=1;var e=od();function t(n){return e(this,n).get(n)}return Ag=t,Ag}var Rg,rw;function vU(){if(rw)return Rg;rw=1;var e=od();function t(n){return e(this,n).has(n)}return Rg=t,Rg}var Mg,aw;function kU(){if(aw)return Mg;aw=1;var e=od();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 Mg=t,Mg}var Ig,iw;function Wb(){if(iw)return Ig;iw=1;var e=mU(),t=xU(),n=bU(),r=vU(),a=kU();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,Ig=i,Ig}var Lg,sw;function _U(){if(sw)return Lg;sw=1;var e=id(),t=Hb(),n=Wb(),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 Lg=a,Lg}var Og,ow;function ld(){if(ow)return Og;ow=1;var e=id(),t=eU(),n=tU(),r=nU(),a=rU(),i=_U();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,Og=s,Og}var Dg,lw;function Vb(){if(lw)return Dg;lw=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 Dg=e,Dg}var Pg,cw;function vT(){if(cw)return Pg;cw=1;var e=Ui(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return Pg=t,Pg}var Fg,uw;function cd(){if(uw)return Fg;uw=1;var e=vT();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Fg=t,Fg}var Bg,dw;function ud(){if(dw)return Bg;dw=1;var e=cd(),t=Us(),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 Bg=a,Bg}var zg,fw;function Cl(){if(fw)return zg;fw=1;var e=ud(),t=cd();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 zg=n,zg}var Ug,gw;function wU(){if(gw)return Ug;gw=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Ug=e,Ug}var qg,pw;function Kr(){if(pw)return qg;pw=1;function e(t){return t!=null&&typeof t=="object"}return qg=e,qg}var $g,hw;function EU(){if(hw)return $g;hw=1;var e=zi(),t=Kr(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return $g=r,$g}var Hg,mw;function jl(){if(mw)return Hg;mw=1;var e=EU(),t=Kr(),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 Hg=i,Hg}var Wg,yw;function sn(){if(yw)return Wg;yw=1;var e=Array.isArray;return Wg=e,Wg}var Eo={exports:{}},Vg,xw;function NU(){if(xw)return Vg;xw=1;function e(){return!1}return Vg=e,Vg}Eo.exports;var bw;function $s(){return bw||(bw=1,function(e,t){var n=Ir(),r=NU(),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}(Eo,Eo.exports)),Eo.exports}var Gg,vw;function dd(){if(vw)return Gg;vw=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 Gg=n,Gg}var Kg,kw;function Gb(){if(kw)return Kg;kw=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Kg=t,Kg}var Yg,_w;function SU(){if(_w)return Yg;_w=1;var e=zi(),t=Gb(),n=Kr(),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]",E="[object Int16Array]",w="[object Int32Array]",T="[object Uint8Array]",R="[object Uint8ClampedArray]",D="[object Uint16Array]",A="[object Uint32Array]",q={};q[b]=q[k]=q[N]=q[E]=q[w]=q[T]=q[R]=q[D]=q[A]=!0,q[r]=q[a]=q[v]=q[i]=q[x]=q[s]=q[l]=q[c]=q[u]=q[d]=q[f]=q[g]=q[p]=q[m]=q[y]=!1;function U(K){return n(K)&&t(K.length)&&!!q[e(K)]}return Yg=U,Yg}var Qg,ww;function fd(){if(ww)return Qg;ww=1;function e(t){return function(n){return t(n)}}return Qg=e,Qg}var No={exports:{}};No.exports;var Ew;function Kb(){return Ew||(Ew=1,function(e,t){var n=xT(),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}(No,No.exports)),No.exports}var Xg,Nw;function Tl(){if(Nw)return Xg;Nw=1;var e=SU(),t=fd(),n=Kb(),r=n&&n.isTypedArray,a=r?t(r):e;return Xg=a,Xg}var Zg,Sw;function kT(){if(Sw)return Zg;Sw=1;var e=wU(),t=jl(),n=sn(),r=$s(),a=dd(),i=Tl(),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 Zg=c,Zg}var Jg,Cw;function gd(){if(Cw)return Jg;Cw=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return Jg=t,Jg}var ep,jw;function _T(){if(jw)return ep;jw=1;function e(t,n){return function(r){return t(n(r))}}return ep=e,ep}var tp,Tw;function CU(){if(Tw)return tp;Tw=1;var e=_T(),t=e(Object.keys,Object);return tp=t,tp}var np,Aw;function Yb(){if(Aw)return np;Aw=1;var e=gd(),t=CU(),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 np=a,np}var rp,Rw;function ka(){if(Rw)return rp;Rw=1;var e=Sl(),t=Gb();function n(r){return r!=null&&t(r.length)&&!e(r)}return rp=n,rp}var ap,Mw;function oi(){if(Mw)return ap;Mw=1;var e=kT(),t=Yb(),n=ka();function r(a){return n(a)?e(a):t(a)}return ap=r,ap}var ip,Iw;function jU(){if(Iw)return ip;Iw=1;var e=Cl(),t=oi();function n(r,a){return r&&e(a,t(a),r)}return ip=n,ip}var sp,Lw;function TU(){if(Lw)return sp;Lw=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return sp=e,sp}var op,Ow;function AU(){if(Ow)return op;Ow=1;var e=br(),t=gd(),n=TU(),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 op=i,op}var lp,Dw;function qi(){if(Dw)return lp;Dw=1;var e=kT(),t=AU(),n=ka();function r(a){return n(a)?e(a,!0):t(a)}return lp=r,lp}var cp,Pw;function RU(){if(Pw)return cp;Pw=1;var e=Cl(),t=qi();function n(r,a){return r&&e(a,t(a),r)}return cp=n,cp}var So={exports:{}};So.exports;var Fw;function wT(){return Fw||(Fw=1,function(e,t){var n=Ir(),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}(So,So.exports)),So.exports}var up,Bw;function ET(){if(Bw)return up;Bw=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 up=e,up}var dp,zw;function NT(){if(zw)return dp;zw=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 dp=e,dp}var fp,Uw;function ST(){if(Uw)return fp;Uw=1;function e(){return[]}return fp=e,fp}var gp,qw;function Qb(){if(qw)return gp;qw=1;var e=NT(),t=ST(),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 gp=i,gp}var pp,$w;function MU(){if($w)return pp;$w=1;var e=Cl(),t=Qb();function n(r,a){return e(r,t(r),a)}return pp=n,pp}var hp,Hw;function Xb(){if(Hw)return hp;Hw=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 hp=e,hp}var mp,Ww;function pd(){if(Ww)return mp;Ww=1;var e=_T(),t=e(Object.getPrototypeOf,Object);return mp=t,mp}var yp,Vw;function CT(){if(Vw)return yp;Vw=1;var e=Xb(),t=pd(),n=Qb(),r=ST(),a=Object.getOwnPropertySymbols,i=a?function(s){for(var l=[];s;)e(l,n(s)),s=t(s);return l}:r;return yp=i,yp}var xp,Gw;function IU(){if(Gw)return xp;Gw=1;var e=Cl(),t=CT();function n(r,a){return e(r,t(r),a)}return xp=n,xp}var bp,Kw;function jT(){if(Kw)return bp;Kw=1;var e=Xb(),t=sn();function n(r,a,i){var s=a(r);return t(r)?s:e(s,i(r))}return bp=n,bp}var vp,Yw;function TT(){if(Yw)return vp;Yw=1;var e=jT(),t=Qb(),n=oi();function r(a){return e(a,n,t)}return vp=r,vp}var kp,Qw;function LU(){if(Qw)return kp;Qw=1;var e=jT(),t=CT(),n=qi();function r(a){return e(a,n,t)}return kp=r,kp}var _p,Xw;function OU(){if(Xw)return _p;Xw=1;var e=Ui(),t=Ir(),n=e(t,"DataView");return _p=n,_p}var wp,Zw;function DU(){if(Zw)return wp;Zw=1;var e=Ui(),t=Ir(),n=e(t,"Promise");return wp=n,wp}var Ep,Jw;function AT(){if(Jw)return Ep;Jw=1;var e=Ui(),t=Ir(),n=e(t,"Set");return Ep=n,Ep}var Np,e2;function PU(){if(e2)return Np;e2=1;var e=Ui(),t=Ir(),n=e(t,"WeakMap");return Np=n,Np}var Sp,t2;function Hs(){if(t2)return Sp;t2=1;var e=OU(),t=Hb(),n=DU(),r=AT(),a=PU(),i=zi(),s=bT(),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),E=N==c?k.constructor:void 0,w=E?s(E):"";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}),Sp=b,Sp}var Cp,n2;function FU(){if(n2)return Cp;n2=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 Cp=n,Cp}var jp,r2;function RT(){if(r2)return jp;r2=1;var e=Ir(),t=e.Uint8Array;return jp=t,jp}var Tp,a2;function Zb(){if(a2)return Tp;a2=1;var e=RT();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Tp=t,Tp}var Ap,i2;function BU(){if(i2)return Ap;i2=1;var e=Zb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Ap=t,Ap}var Rp,s2;function zU(){if(s2)return Rp;s2=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Rp=t,Rp}var Mp,o2;function UU(){if(o2)return Mp;o2=1;var e=qs(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Mp=r,Mp}var Ip,l2;function MT(){if(l2)return Ip;l2=1;var e=Zb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Ip=t,Ip}var Lp,c2;function qU(){if(c2)return Lp;c2=1;var e=Zb(),t=BU(),n=zU(),r=UU(),a=MT(),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]",E="[object Uint8ClampedArray]",w="[object Uint16Array]",T="[object Uint32Array]";function R(D,A,q){var U=D.constructor;switch(A){case p:return e(D);case i:case s:return new U(+D);case m:return t(D,q);case y:case v:case x:case b:case k:case N:case E:case w:case T:return a(D,q);case l:return new U;case c:case f:return new U(D);case u:return n(D);case d:return new U;case g:return r(D)}}return Lp=R,Lp}var Op,u2;function IT(){if(u2)return Op;u2=1;var e=br(),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 Op=n,Op}var Dp,d2;function LT(){if(d2)return Dp;d2=1;var e=IT(),t=pd(),n=gd();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Dp=r,Dp}var Pp,f2;function $U(){if(f2)return Pp;f2=1;var e=Hs(),t=Kr(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Pp=r,Pp}var Fp,g2;function HU(){if(g2)return Fp;g2=1;var e=$U(),t=fd(),n=Kb(),r=n&&n.isMap,a=r?t(r):e;return Fp=a,Fp}var Bp,p2;function WU(){if(p2)return Bp;p2=1;var e=Hs(),t=Kr(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return Bp=r,Bp}var zp,h2;function VU(){if(h2)return zp;h2=1;var e=WU(),t=fd(),n=Kb(),r=n&&n.isSet,a=r?t(r):e;return zp=a,zp}var Up,m2;function OT(){if(m2)return Up;m2=1;var e=ld(),t=Vb(),n=ud(),r=jU(),a=RU(),i=wT(),s=ET(),l=MU(),c=IU(),u=TT(),d=LU(),f=Hs(),g=FU(),p=qU(),m=LT(),y=sn(),v=$s(),x=HU(),b=br(),k=VU(),N=oi(),E=qi(),w=1,T=2,R=4,D="[object Arguments]",A="[object Array]",q="[object Boolean]",U="[object Date]",K="[object Error]",P="[object Function]",M="[object GeneratorFunction]",C="[object Map]",L="[object Number]",F="[object Object]",Q="[object RegExp]",S="[object Set]",Y="[object String]",V="[object Symbol]",j="[object WeakMap]",$="[object ArrayBuffer]",ce="[object DataView]",J="[object Float32Array]",_e="[object Float64Array]",ue="[object Int8Array]",ne="[object Int16Array]",Ce="[object Int32Array]",ke="[object Uint8Array]",pe="[object Uint8ClampedArray]",me="[object Uint16Array]",De="[object Uint32Array]",Ne={};Ne[D]=Ne[A]=Ne[$]=Ne[ce]=Ne[q]=Ne[U]=Ne[J]=Ne[_e]=Ne[ue]=Ne[ne]=Ne[Ce]=Ne[C]=Ne[L]=Ne[F]=Ne[Q]=Ne[S]=Ne[Y]=Ne[V]=Ne[ke]=Ne[pe]=Ne[me]=Ne[De]=!0,Ne[K]=Ne[P]=Ne[j]=!1;function Ee(Oe,fe,he,Le,Z,ve){var Re,Be=fe&w,Ge=fe&T,W=fe&R;if(he&&(Re=Z?he(Oe,Le,Z,ve):he(Oe)),Re!==void 0)return Re;if(!b(Oe))return Oe;var z=y(Oe);if(z){if(Re=g(Oe),!Be)return s(Oe,Re)}else{var re=f(Oe),le=re==P||re==M;if(v(Oe))return i(Oe,Be);if(re==F||re==D||le&&!Z){if(Re=Ge||le?{}:m(Oe),!Be)return Ge?c(Oe,a(Re,Oe)):l(Oe,r(Re,Oe))}else{if(!Ne[re])return Z?Oe:{};Re=p(Oe,re,Be)}}ve||(ve=new e);var Se=ve.get(Oe);if(Se)return Se;ve.set(Oe,Re),k(Oe)?Oe.forEach(function(Ke){Re.add(Ee(Ke,fe,he,Ke,Oe,ve))}):x(Oe)&&Oe.forEach(function(Ke,ot){Re.set(ot,Ee(Ke,fe,he,ot,Oe,ve))});var ze=W?Ge?d:u:Ge?E:N,Ve=z?void 0:ze(Oe);return t(Ve||Oe,function(Ke,ot){Ve&&(ot=Ke,Ke=Oe[ot]),n(Re,ot,Ee(Ke,fe,he,ot,Oe,ve))}),Re}return Up=Ee,Up}var qp,y2;function GU(){if(y2)return qp;y2=1;var e=OT(),t=4;function n(r){return e(r,t)}return qp=n,qp}var $p,x2;function Jb(){if(x2)return $p;x2=1;function e(t){return function(){return t}}return $p=e,$p}var Hp,b2;function KU(){if(b2)return Hp;b2=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 Hp=e,Hp}var Wp,v2;function ev(){if(v2)return Wp;v2=1;var e=KU(),t=e();return Wp=t,Wp}var Vp,k2;function tv(){if(k2)return Vp;k2=1;var e=ev(),t=oi();function n(r,a){return r&&e(r,a,t)}return Vp=n,Vp}var Gp,_2;function YU(){if(_2)return Gp;_2=1;var e=ka();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 Gp=t,Gp}var Kp,w2;function hd(){if(w2)return Kp;w2=1;var e=tv(),t=YU(),n=t(e);return Kp=n,Kp}var Yp,E2;function $i(){if(E2)return Yp;E2=1;function e(t){return t}return Yp=e,Yp}var Qp,N2;function DT(){if(N2)return Qp;N2=1;var e=$i();function t(n){return typeof n=="function"?n:e}return Qp=t,Qp}var Xp,S2;function PT(){if(S2)return Xp;S2=1;var e=Vb(),t=hd(),n=DT(),r=sn();function a(i,s){var l=r(i)?e:t;return l(i,n(s))}return Xp=a,Xp}var Zp,C2;function FT(){return C2||(C2=1,Zp=PT()),Zp}var Jp,j2;function QU(){if(j2)return Jp;j2=1;var e=hd();function t(n,r){var a=[];return e(n,function(i,s,l){r(i,s,l)&&a.push(i)}),a}return Jp=t,Jp}var eh,T2;function XU(){if(T2)return eh;T2=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return eh=t,eh}var th,A2;function ZU(){if(A2)return th;A2=1;function e(t){return this.__data__.has(t)}return th=e,th}var nh,R2;function BT(){if(R2)return nh;R2=1;var e=Wb(),t=XU(),n=ZU();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,nh=r,nh}var rh,M2;function JU(){if(M2)return rh;M2=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 rh=e,rh}var ah,I2;function zT(){if(I2)return ah;I2=1;function e(t,n){return t.has(n)}return ah=e,ah}var ih,L2;function UT(){if(L2)return ih;L2=1;var e=BT(),t=JU(),n=zT(),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],E=l[x];if(u)var w=g?u(E,N,x,l,s,f):u(N,E,x,s,l,f);if(w!==void 0){if(w)continue;b=!1;break}if(k){if(!t(l,function(T,R){if(!n(k,R)&&(N===T||d(N,T,c,u,f)))return k.push(R)})){b=!1;break}}else if(!(N===E||d(N,E,c,u,f))){b=!1;break}}return f.delete(s),f.delete(l),b}return ih=i,ih}var sh,O2;function eq(){if(O2)return sh;O2=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return sh=e,sh}var oh,D2;function nv(){if(D2)return oh;D2=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return oh=e,oh}var lh,P2;function tq(){if(P2)return lh;P2=1;var e=qs(),t=RT(),n=Us(),r=UT(),a=eq(),i=nv(),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 E(w,T,R,D,A,q,U){switch(R){case b:if(w.byteLength!=T.byteLength||w.byteOffset!=T.byteOffset)return!1;w=w.buffer,T=T.buffer;case x:return!(w.byteLength!=T.byteLength||!q(new t(w),new t(T)));case c:case u:case g:return n(+w,+T);case d:return w.name==T.name&&w.message==T.message;case p:case y:return w==T+"";case f:var K=a;case m:var P=D&s;if(K||(K=i),w.size!=T.size&&!P)return!1;var M=U.get(w);if(M)return M==T;D|=l,U.set(w,T);var C=r(K(w),K(T),D,A,q,U);return U.delete(w),C;case v:if(N)return N.call(w)==N.call(T)}return!1}return lh=E,lh}var ch,F2;function nq(){if(F2)return ch;F2=1;var e=TT(),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 E=f;++v<p;){x=g[v];var w=i[x],T=s[x];if(c)var R=f?c(T,w,x,s,i,d):c(w,T,x,i,s,d);if(!(R===void 0?w===T||u(w,T,l,c,d):R)){N=!1;break}E||(E=x=="constructor")}if(N&&!E){var D=i.constructor,A=s.constructor;D!=A&&"constructor"in i&&"constructor"in s&&!(typeof D=="function"&&D instanceof D&&typeof A=="function"&&A instanceof A)&&(N=!1)}return d.delete(i),d.delete(s),N}return ch=a,ch}var uh,B2;function rq(){if(B2)return uh;B2=1;var e=ld(),t=UT(),n=tq(),r=nq(),a=Hs(),i=sn(),s=$s(),l=Tl(),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 E=i(y),w=i(v),T=E?d:a(y),R=w?d:a(v);T=T==u?f:T,R=R==u?f:R;var D=T==f,A=R==f,q=T==R;if(q&&s(y)){if(!s(v))return!1;E=!0,D=!1}if(q&&!D)return N||(N=new e),E||l(y)?t(y,v,x,b,k,N):n(y,v,T,x,b,k,N);if(!(x&c)){var U=D&&p.call(y,"__wrapped__"),K=A&&p.call(v,"__wrapped__");if(U||K){var P=U?y.value():y,M=K?v.value():v;return N||(N=new e),k(P,M,x,b,N)}}return q?(N||(N=new e),r(y,v,x,b,k,N)):!1}return uh=m,uh}var dh,z2;function qT(){if(z2)return dh;z2=1;var e=rq(),t=Kr();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 dh=n,dh}var fh,U2;function aq(){if(U2)return fh;U2=1;var e=ld(),t=qT(),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 fh=a,fh}var gh,q2;function $T(){if(q2)return gh;q2=1;var e=br();function t(n){return n===n&&!e(n)}return gh=t,gh}var ph,$2;function iq(){if($2)return ph;$2=1;var e=$T(),t=oi();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 ph=n,ph}var hh,H2;function HT(){if(H2)return hh;H2=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return hh=e,hh}var mh,W2;function sq(){if(W2)return mh;W2=1;var e=aq(),t=iq(),n=HT();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 mh=r,mh}var yh,V2;function Ws(){if(V2)return yh;V2=1;var e=zi(),t=Kr(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return yh=r,yh}var xh,G2;function rv(){if(G2)return xh;G2=1;var e=sn(),t=Ws(),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 xh=a,xh}var bh,K2;function oq(){if(K2)return bh;K2=1;var e=Wb(),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,bh=n,bh}var vh,Y2;function lq(){if(Y2)return vh;Y2=1;var e=oq(),t=500;function n(r){var a=e(r,function(s){return i.size===t&&i.clear(),s}),i=a.cache;return a}return vh=n,vh}var kh,Q2;function cq(){if(Q2)return kh;Q2=1;var e=lq(),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 kh=r,kh}var _h,X2;function md(){if(X2)return _h;X2=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 _h=e,_h}var wh,Z2;function uq(){if(Z2)return wh;Z2=1;var e=qs(),t=md(),n=sn(),r=Ws(),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 wh=s,wh}var Eh,J2;function WT(){if(J2)return Eh;J2=1;var e=uq();function t(n){return n==null?"":e(n)}return Eh=t,Eh}var Nh,eE;function yd(){if(eE)return Nh;eE=1;var e=sn(),t=rv(),n=cq(),r=WT();function a(i,s){return e(i)?i:t(i,s)?[i]:n(r(i))}return Nh=a,Nh}var Sh,tE;function Al(){if(tE)return Sh;tE=1;var e=Ws();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Sh=t,Sh}var Ch,nE;function xd(){if(nE)return Ch;nE=1;var e=yd(),t=Al();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 Ch=n,Ch}var jh,rE;function dq(){if(rE)return jh;rE=1;var e=xd();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return jh=t,jh}var Th,aE;function fq(){if(aE)return Th;aE=1;function e(t,n){return t!=null&&n in Object(t)}return Th=e,Th}var Ah,iE;function VT(){if(iE)return Ah;iE=1;var e=yd(),t=jl(),n=sn(),r=dd(),a=Gb(),i=Al();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 Ah=s,Ah}var Rh,sE;function GT(){if(sE)return Rh;sE=1;var e=fq(),t=VT();function n(r,a){return r!=null&&t(r,a,e)}return Rh=n,Rh}var Mh,oE;function gq(){if(oE)return Mh;oE=1;var e=qT(),t=dq(),n=GT(),r=rv(),a=$T(),i=HT(),s=Al(),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 Mh=u,Mh}var Ih,lE;function KT(){if(lE)return Ih;lE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Ih=e,Ih}var Lh,cE;function pq(){if(cE)return Lh;cE=1;var e=xd();function t(n){return function(r){return e(r,n)}}return Lh=t,Lh}var Oh,uE;function hq(){if(uE)return Oh;uE=1;var e=KT(),t=pq(),n=rv(),r=Al();function a(i){return n(i)?e(r(i)):t(i)}return Oh=a,Oh}var Dh,dE;function _a(){if(dE)return Dh;dE=1;var e=sq(),t=gq(),n=$i(),r=sn(),a=hq();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 Dh=i,Dh}var Ph,fE;function YT(){if(fE)return Ph;fE=1;var e=NT(),t=QU(),n=_a(),r=sn();function a(i,s){var l=r(i)?e:t;return l(i,n(s,3))}return Ph=a,Ph}var Fh,gE;function mq(){if(gE)return Fh;gE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Fh=n,Fh}var Bh,pE;function QT(){if(pE)return Bh;pE=1;var e=mq(),t=VT();function n(r,a){return r!=null&&t(r,a,e)}return Bh=n,Bh}var zh,hE;function yq(){if(hE)return zh;hE=1;var e=Yb(),t=Hs(),n=jl(),r=sn(),a=ka(),i=$s(),s=gd(),l=Tl(),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 zh=g,zh}var Uh,mE;function XT(){if(mE)return Uh;mE=1;function e(t){return t===void 0}return Uh=e,Uh}var qh,yE;function ZT(){if(yE)return qh;yE=1;var e=hd(),t=ka();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 qh=n,qh}var $h,xE;function JT(){if(xE)return $h;xE=1;var e=md(),t=_a(),n=ZT(),r=sn();function a(i,s){var l=r(i)?e:n;return l(i,t(s,3))}return $h=a,$h}var Hh,bE;function xq(){if(bE)return Hh;bE=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 Hh=e,Hh}var Wh,vE;function bq(){if(vE)return Wh;vE=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 Wh=e,Wh}var Vh,kE;function eA(){if(kE)return Vh;kE=1;var e=xq(),t=hd(),n=_a(),r=bq(),a=sn();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 Vh=i,Vh}var Gh,_E;function vq(){if(_E)return Gh;_E=1;var e=zi(),t=sn(),n=Kr(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return Gh=a,Gh}var Kh,wE;function kq(){if(wE)return Kh;wE=1;var e=KT(),t=e("length");return Kh=t,Kh}var Yh,EE;function _q(){if(EE)return Yh;EE=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 Yh=c,Yh}var Qh,NE;function wq(){if(NE)return Qh;NE=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(E){for(var w=k.lastIndex=0;k.test(E);)++w;return w}return Qh=N,Qh}var Xh,SE;function Eq(){if(SE)return Xh;SE=1;var e=kq(),t=_q(),n=wq();function r(a){return t(a)?n(a):e(a)}return Xh=r,Xh}var Zh,CE;function Nq(){if(CE)return Zh;CE=1;var e=Yb(),t=Hs(),n=ka(),r=vq(),a=Eq(),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 Zh=l,Zh}var Jh,jE;function Sq(){if(jE)return Jh;jE=1;var e=Vb(),t=IT(),n=tv(),r=_a(),a=pd(),i=sn(),s=$s(),l=Sl(),c=br(),u=Tl();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 Jh=d,Jh}var em,TE;function Cq(){if(TE)return em;TE=1;var e=qs(),t=jl(),n=sn(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return em=a,em}var tm,AE;function av(){if(AE)return tm;AE=1;var e=Xb(),t=Cq();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 tm=n,tm}var nm,RE;function jq(){if(RE)return nm;RE=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 nm=e,nm}var rm,ME;function tA(){if(ME)return rm;ME=1;var e=jq(),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 rm=n,rm}var am,IE;function Tq(){if(IE)return am;IE=1;var e=Jb(),t=vT(),n=$i(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return am=r,am}var im,LE;function Aq(){if(LE)return im;LE=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 im=r,im}var sm,OE;function nA(){if(OE)return sm;OE=1;var e=Tq(),t=Aq(),n=t(e);return sm=n,sm}var om,DE;function bd(){if(DE)return om;DE=1;var e=$i(),t=tA(),n=nA();function r(a,i){return n(t(a,i,e),a+"")}return om=r,om}var lm,PE;function rA(){if(PE)return lm;PE=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 lm=e,lm}var cm,FE;function Rq(){if(FE)return cm;FE=1;function e(t){return t!==t}return cm=e,cm}var um,BE;function Mq(){if(BE)return um;BE=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 um=e,um}var dm,zE;function Iq(){if(zE)return dm;zE=1;var e=rA(),t=Rq(),n=Mq();function r(a,i,s){return i===i?n(a,i,s):e(a,t,s)}return dm=r,dm}var fm,UE;function Lq(){if(UE)return fm;UE=1;var e=Iq();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return fm=t,fm}var gm,qE;function Oq(){if(qE)return gm;qE=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 gm=e,gm}var pm,$E;function Dq(){if($E)return pm;$E=1;function e(){}return pm=e,pm}var hm,HE;function Pq(){if(HE)return hm;HE=1;var e=AT(),t=Dq(),n=nv(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return hm=a,hm}var mm,WE;function Fq(){if(WE)return mm;WE=1;var e=BT(),t=Lq(),n=Oq(),r=zT(),a=Pq(),i=nv(),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 mm=l,mm}var ym,VE;function aA(){if(VE)return ym;VE=1;var e=ka(),t=Kr();function n(r){return t(r)&&e(r)}return ym=n,ym}var xm,GE;function Bq(){if(GE)return xm;GE=1;var e=av(),t=bd(),n=Fq(),r=aA(),a=t(function(i){return n(e(i,1,r,!0))});return xm=a,xm}var bm,KE;function zq(){if(KE)return bm;KE=1;var e=md();function t(n,r){return e(r,function(a){return n[a]})}return bm=t,bm}var vm,YE;function iA(){if(YE)return vm;YE=1;var e=zq(),t=oi();function n(r){return r==null?[]:e(r,t(r))}return vm=n,vm}var km,QE;function vr(){if(QE)return km;QE=1;var e;if(typeof $b=="function")try{e={clone:GU(),constant:Jb(),each:FT(),filter:YT(),has:QT(),isArray:sn(),isEmpty:yq(),isFunction:Sl(),isUndefined:XT(),keys:oi(),map:JT(),reduce:eA(),size:Nq(),transform:Sq(),union:Bq(),values:iA()}}catch{}return e||(e=window._),km=e,km}var _m,XE;function iv(){if(XE)return _m;XE=1;var e=vr();_m=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 _m}var wm,ZE;function Uq(){return ZE||(ZE=1,wm="2.1.8"),wm}var Em,JE;function qq(){return JE||(JE=1,Em={Graph:iv(),version:Uq()}),Em}var Nm,eN;function $q(){if(eN)return Nm;eN=1;var e=vr(),t=iv();Nm={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 Nm}var Sm,tN;function Hq(){if(tN)return Sm;tN=1;var e=vr();Sm=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 Sm}var Cm,nN;function sA(){if(nN)return Cm;nN=1;var e=vr();Cm=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},Cm}var jm,rN;function oA(){if(rN)return jm;rN=1;var e=vr(),t=sA();jm=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 jm}var Tm,aN;function Wq(){if(aN)return Tm;aN=1;var e=oA(),t=vr();Tm=n;function n(r,a,i){return t.transform(r.nodes(),function(s,l){s[l]=e(r,l,a,i)},{})}return Tm}var Am,iN;function lA(){if(iN)return Am;iN=1;var e=vr();Am=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 Am}var Rm,sN;function Vq(){if(sN)return Rm;sN=1;var e=vr(),t=lA();Rm=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 Rm}var Mm,oN;function Gq(){if(oN)return Mm;oN=1;var e=vr();Mm=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 Mm}var Im,lN;function cA(){if(lN)return Im;lN=1;var e=vr();Im=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,Im}var Lm,cN;function Kq(){if(cN)return Lm;cN=1;var e=cA();Lm=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Lm}var Om,uN;function uA(){if(uN)return Om;uN=1;var e=vr();Om=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 Om}var Dm,dN;function Yq(){if(dN)return Dm;dN=1;var e=uA();Dm=t;function t(n,r){return e(n,r,"post")}return Dm}var Pm,fN;function Qq(){if(fN)return Pm;fN=1;var e=uA();Pm=t;function t(n,r){return e(n,r,"pre")}return Pm}var Fm,gN;function Xq(){if(gN)return Fm;gN=1;var e=vr(),t=iv(),n=sA();Fm=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 Fm}var Bm,pN;function Zq(){return pN||(pN=1,Bm={components:Hq(),dijkstra:oA(),dijkstraAll:Wq(),findCycles:Vq(),floydWarshall:Gq(),isAcyclic:Kq(),postorder:Yq(),preorder:Qq(),prim:Xq(),tarjan:lA(),topsort:cA()}),Bm}var zm,hN;function Jq(){if(hN)return zm;hN=1;var e=qq();return zm={Graph:e.Graph,json:$q(),alg:Zq(),version:e.version},zm}var Su;if(typeof $b=="function")try{Su=Jq()}catch{}Su||(Su=window.graphlib);var Lr=Su,Um,mN;function e$(){if(mN)return Um;mN=1;var e=OT(),t=1,n=4;function r(a){return e(a,t|n)}return Um=r,Um}var qm,yN;function vd(){if(yN)return qm;yN=1;var e=Us(),t=ka(),n=dd(),r=br();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 qm=a,qm}var $m,xN;function t$(){if(xN)return $m;xN=1;var e=bd(),t=Us(),n=vd(),r=qi(),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 $m=s,$m}var Hm,bN;function n$(){if(bN)return Hm;bN=1;var e=_a(),t=ka(),n=oi();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 Hm=r,Hm}var Wm,vN;function r$(){if(vN)return Wm;vN=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Wm=t,Wm}var Vm,kN;function a$(){if(kN)return Vm;kN=1;var e=r$(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Vm=n,Vm}var Gm,_N;function i$(){if(_N)return Gm;_N=1;var e=a$(),t=br(),n=Ws(),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 Gm=c,Gm}var Km,wN;function dA(){if(wN)return Km;wN=1;var e=i$(),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 Km=r,Km}var Ym,EN;function s$(){if(EN)return Ym;EN=1;var e=dA();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return Ym=t,Ym}var Qm,NN;function o$(){if(NN)return Qm;NN=1;var e=rA(),t=_a(),n=s$(),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 Qm=a,Qm}var Xm,SN;function l$(){if(SN)return Xm;SN=1;var e=n$(),t=o$(),n=e(t);return Xm=n,Xm}var Zm,CN;function fA(){if(CN)return Zm;CN=1;var e=av();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Zm=t,Zm}var Jm,jN;function c$(){if(jN)return Jm;jN=1;var e=ev(),t=DT(),n=qi();function r(a,i){return a==null?a:e(a,t(i),n)}return Jm=r,Jm}var e0,TN;function u$(){if(TN)return e0;TN=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return e0=e,e0}var t0,AN;function d$(){if(AN)return t0;AN=1;var e=cd(),t=tv(),n=_a();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 t0=r,t0}var n0,RN;function sv(){if(RN)return n0;RN=1;var e=Ws();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 n0=t,n0}var r0,MN;function f$(){if(MN)return r0;MN=1;function e(t,n){return t>n}return r0=e,r0}var a0,IN;function g$(){if(IN)return a0;IN=1;var e=sv(),t=f$(),n=$i();function r(a){return a&&a.length?e(a,n,t):void 0}return a0=r,a0}var i0,LN;function gA(){if(LN)return i0;LN=1;var e=cd(),t=Us();function n(r,a,i){(i!==void 0&&!t(r[a],i)||i===void 0&&!(a in r))&&e(r,a,i)}return i0=n,i0}var s0,ON;function p$(){if(ON)return s0;ON=1;var e=zi(),t=pd(),n=Kr(),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 s0=u,s0}var o0,DN;function pA(){if(DN)return o0;DN=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return o0=e,o0}var l0,PN;function h$(){if(PN)return l0;PN=1;var e=Cl(),t=qi();function n(r){return e(r,t(r))}return l0=n,l0}var c0,FN;function m$(){if(FN)return c0;FN=1;var e=gA(),t=wT(),n=MT(),r=ET(),a=LT(),i=jl(),s=sn(),l=aA(),c=$s(),u=Sl(),d=br(),f=p$(),g=Tl(),p=pA(),m=h$();function y(v,x,b,k,N,E,w){var T=p(v,b),R=p(x,b),D=w.get(R);if(D){e(v,b,D);return}var A=E?E(T,R,b+"",v,x,w):void 0,q=A===void 0;if(q){var U=s(R),K=!U&&c(R),P=!U&&!K&&g(R);A=R,U||K||P?s(T)?A=T:l(T)?A=r(T):K?(q=!1,A=t(R,!0)):P?(q=!1,A=n(R,!0)):A=[]:f(R)||i(R)?(A=T,i(T)?A=m(T):(!d(T)||u(T))&&(A=a(R))):q=!1}q&&(w.set(R,A),N(A,R,k,E,w),w.delete(R)),e(v,b,A)}return c0=y,c0}var u0,BN;function y$(){if(BN)return u0;BN=1;var e=ld(),t=gA(),n=ev(),r=m$(),a=br(),i=qi(),s=pA();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 u0=l,u0}var d0,zN;function x$(){if(zN)return d0;zN=1;var e=bd(),t=vd();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 d0=n,d0}var f0,UN;function b$(){if(UN)return f0;UN=1;var e=y$(),t=x$(),n=t(function(r,a,i){e(r,a,i)});return f0=n,f0}var g0,qN;function hA(){if(qN)return g0;qN=1;function e(t,n){return t<n}return g0=e,g0}var p0,$N;function v$(){if($N)return p0;$N=1;var e=sv(),t=hA(),n=$i();function r(a){return a&&a.length?e(a,n,t):void 0}return p0=r,p0}var h0,HN;function k$(){if(HN)return h0;HN=1;var e=sv(),t=_a(),n=hA();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return h0=r,h0}var m0,WN;function _$(){if(WN)return m0;WN=1;var e=Ir(),t=function(){return e.Date.now()};return m0=t,m0}var y0,VN;function w$(){if(VN)return y0;VN=1;var e=ud(),t=yd(),n=dd(),r=br(),a=Al();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 y0=i,y0}var x0,GN;function E$(){if(GN)return x0;GN=1;var e=xd(),t=w$(),n=yd();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 x0=r,x0}var b0,KN;function N$(){if(KN)return b0;KN=1;var e=E$(),t=GT();function n(r,a){return e(r,a,function(i,s){return t(r,s)})}return b0=n,b0}var v0,YN;function S$(){if(YN)return v0;YN=1;var e=fA(),t=tA(),n=nA();function r(a){return n(t(a,void 0,e),a+"")}return v0=r,v0}var k0,QN;function C$(){if(QN)return k0;QN=1;var e=N$(),t=S$(),n=t(function(r,a){return r==null?{}:e(r,a)});return k0=n,k0}var _0,XN;function j$(){if(XN)return _0;XN=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 _0=n,_0}var w0,ZN;function T$(){if(ZN)return w0;ZN=1;var e=j$(),t=vd(),n=dA();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 w0=r,w0}var E0,JN;function A$(){if(JN)return E0;JN=1;var e=T$(),t=e();return E0=t,E0}var N0,eS;function R$(){if(eS)return N0;eS=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return N0=e,N0}var S0,tS;function M$(){if(tS)return S0;tS=1;var e=Ws();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 S0=t,S0}var C0,nS;function I$(){if(nS)return C0;nS=1;var e=M$();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 C0=t,C0}var j0,rS;function L$(){if(rS)return j0;rS=1;var e=md(),t=xd(),n=_a(),r=ZT(),a=R$(),i=fd(),s=I$(),l=$i(),c=sn();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 j0=u,j0}var T0,aS;function O$(){if(aS)return T0;aS=1;var e=av(),t=L$(),n=bd(),r=vd(),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 T0=a,T0}var A0,iS;function D$(){if(iS)return A0;iS=1;var e=WT(),t=0;function n(r){var a=++t;return e(r)+a}return A0=n,A0}var R0,sS;function P$(){if(sS)return R0;sS=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 R0=e,R0}var M0,oS;function F$(){if(oS)return M0;oS=1;var e=ud(),t=P$();function n(r,a){return t(r||[],a||[],e)}return M0=n,M0}var Cu;if(typeof $b=="function")try{Cu={cloneDeep:e$(),constant:Jb(),defaults:t$(),each:FT(),filter:YT(),find:l$(),flatten:fA(),forEach:PT(),forIn:c$(),has:QT(),isUndefined:XT(),last:u$(),map:JT(),mapValues:d$(),max:g$(),merge:b$(),min:v$(),minBy:k$(),now:_$(),pick:C$(),range:A$(),reduce:eA(),sortBy:O$(),uniqueId:D$(),values:iA(),zipObject:F$()}}catch{}Cu||(Cu=window._);var Wt=Cu,B$=kd;function kd(){var e={};e._next=e._prev=e,this._sentinel=e}kd.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return mA(t),t};kd.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&mA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t};kd.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,z$)),n=n._prev;return"["+e.join(", ")+"]"};function mA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function z$(e,t){if(e!=="_next"&&e!=="_prev")return t}var ua=Wt,U$=Lr.Graph,q$=B$,$$=W$,H$=ua.constant(1);function W$(e,t){if(e.nodeCount()<=1)return[];var n=G$(e,t||H$),r=V$(n.graph,n.buckets,n.zeroIdx);return ua.flatten(ua.map(r,function(a){return e.outEdges(a.v,a.w)}),!0)}function V$(e,t,n){for(var r=[],a=t[t.length-1],i=t[0],s;e.nodeCount();){for(;s=i.dequeue();)I0(e,t,n,s);for(;s=a.dequeue();)I0(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(I0(e,t,n,s,!0));break}}}return r}function I0(e,t,n,r,a){var i=a?[]:void 0;return ua.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,gx(t,n,c)}),ua.forEach(e.outEdges(r.v),function(s){var l=e.edge(s),c=s.w,u=e.node(c);u.in-=l,gx(t,n,u)}),e.removeNode(r.v),i}function G$(e,t){var n=new U$,r=0,a=0;ua.forEach(e.nodes(),function(l){n.setNode(l,{v:l,in:0,out:0})}),ua.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=ua.range(a+r+3).map(function(){return new q$}),s=r+1;return ua.forEach(n.nodes(),function(l){gx(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function gx(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 wi=Wt,K$=$$,Y$={run:Q$,undo:Z$};function Q$(e){var t=e.graph().acyclicer==="greedy"?K$(e,n(e)):X$(e);wi.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,wi.uniqueId("rev"))});function n(r){return function(a){return r.edge(a).weight}}}function X$(e){var t=[],n={},r={};function a(i){wi.has(r,i)||(r[i]=!0,n[i]=!0,wi.forEach(e.outEdges(i),function(s){wi.has(n,s.w)?t.push(s):a(s.w)}),delete n[i])}return wi.forEach(e.nodes(),a),t}function Z$(e){wi.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 Et=Wt,yA=Lr.Graph,Kn={addDummyNode:xA,simplify:J$,asNonCompoundGraph:eH,successorWeights:tH,predecessorWeights:nH,intersectRect:rH,buildLayerMatrix:aH,normalizeRanks:iH,removeEmptyRanks:sH,addBorderNode:oH,maxRank:bA,partition:lH,time:cH,notime:uH};function xA(e,t,n,r){var a;do a=Et.uniqueId(r);while(e.hasNode(a));return n.dummy=t,e.setNode(a,n),a}function J$(e){var t=new yA().setGraph(e.graph());return Et.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),Et.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 eH(e){var t=new yA({multigraph:e.isMultigraph()}).setGraph(e.graph());return Et.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),Et.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function tH(e){var t=Et.map(e.nodes(),function(n){var r={};return Et.forEach(e.outEdges(n),function(a){r[a.w]=(r[a.w]||0)+e.edge(a).weight}),r});return Et.zipObject(e.nodes(),t)}function nH(e){var t=Et.map(e.nodes(),function(n){var r={};return Et.forEach(e.inEdges(n),function(a){r[a.v]=(r[a.v]||0)+e.edge(a).weight}),r});return Et.zipObject(e.nodes(),t)}function rH(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 aH(e){var t=Et.map(Et.range(bA(e)+1),function(){return[]});return Et.forEach(e.nodes(),function(n){var r=e.node(n),a=r.rank;Et.isUndefined(a)||(t[a][r.order]=n)}),t}function iH(e){var t=Et.min(Et.map(e.nodes(),function(n){return e.node(n).rank}));Et.forEach(e.nodes(),function(n){var r=e.node(n);Et.has(r,"rank")&&(r.rank-=t)})}function sH(e){var t=Et.min(Et.map(e.nodes(),function(i){return e.node(i).rank})),n=[];Et.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;Et.forEach(n,function(i,s){Et.isUndefined(i)&&s%a!==0?--r:r&&Et.forEach(i,function(l){e.node(l).rank+=r})})}function oH(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),xA(e,"border",a,t)}function bA(e){return Et.max(Et.map(e.nodes(),function(t){var n=e.node(t).rank;if(!Et.isUndefined(n))return n}))}function lH(e,t){var n={lhs:[],rhs:[]};return Et.forEach(e,function(r){t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function cH(e,t){var n=Et.now();try{return t()}finally{console.log(e+" time: "+(Et.now()-n)+"ms")}}function uH(e,t){return t()}var vA=Wt,dH=Kn,fH={run:gH,undo:hH};function gH(e){e.graph().dummyChains=[],vA.forEach(e.edges(),function(t){pH(e,t)})}function pH(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=dH.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 hH(e){vA.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 wc=Wt,_d={longestPath:mH,slack:yH};function mH(e){var t={};function n(r){var a=e.node(r);if(wc.has(t,r))return a.rank;t[r]=!0;var i=wc.min(wc.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}wc.forEach(e.sources(),n)}function yH(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var ju=Wt,xH=Lr.Graph,Tu=_d.slack,kA=bH;function bH(e){var t=new xH({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var a,i;vH(t,e)<r;)a=kH(t,e),i=t.hasNode(a.v)?Tu(e,a):-Tu(e,a),_H(t,e,i);return t}function vH(e,t){function n(r){ju.forEach(t.nodeEdges(r),function(a){var i=a.v,s=r===i?a.w:i;!e.hasNode(s)&&!Tu(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return ju.forEach(e.nodes(),n),e.nodeCount()}function kH(e,t){return ju.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Tu(t,n)})}function _H(e,t,n){ju.forEach(e.nodes(),function(r){t.node(r).rank+=n})}var xa=Wt,wH=kA,EH=_d.slack,NH=_d.longestPath,SH=Lr.alg.preorder,CH=Lr.alg.postorder,jH=Kn.simplify,TH=Hi;Hi.initLowLimValues=lv;Hi.initCutValues=ov;Hi.calcCutValue=_A;Hi.leaveEdge=EA;Hi.enterEdge=NA;Hi.exchangeEdges=SA;function Hi(e){e=jH(e),NH(e);var t=wH(e);lv(t),ov(t,e);for(var n,r;n=EA(t);)r=NA(t,e,n),SA(t,e,n,r)}function ov(e,t){var n=CH(e,e.nodes());n=n.slice(0,n.length-1),xa.forEach(n,function(r){AH(e,t,r)})}function AH(e,t,n){var r=e.node(n),a=r.parent;e.edge(n,a).cutvalue=_A(e,t,n)}function _A(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,xa.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,MH(e,n,d)){var p=e.edge(n,d).cutvalue;l+=f?-p:p}}}),l}function lv(e,t){arguments.length<2&&(t=e.nodes()[0]),wA(e,{},1,t)}function wA(e,t,n,r,a){var i=n,s=e.node(r);return t[r]=!0,xa.forEach(e.neighbors(r),function(l){xa.has(t,l)||(n=wA(e,t,n,l,r))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}function EA(e){return xa.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function NA(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=xa.filter(t.edges(),function(d){return c===lS(e,e.node(d.v),l)&&c!==lS(e,e.node(d.w),l)});return xa.minBy(u,function(d){return EH(t,d)})}function SA(e,t,n,r){var a=n.v,i=n.w;e.removeEdge(a,i),e.setEdge(r.v,r.w,{}),lv(e),ov(e,t),RH(e,t)}function RH(e,t){var n=xa.find(e.nodes(),function(a){return!t.node(a).parent}),r=SH(e,n);r=r.slice(1),xa.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 MH(e,t,n){return e.hasEdge(t,n)}function lS(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var IH=_d,CA=IH.longestPath,LH=kA,OH=TH,DH=PH;function PH(e){switch(e.graph().ranker){case"network-simplex":cS(e);break;case"tight-tree":BH(e);break;case"longest-path":FH(e);break;default:cS(e)}}var FH=CA;function BH(e){CA(e),LH(e)}function cS(e){OH(e)}var px=Wt,zH=UH;function UH(e){var t=$H(e);px.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=qH(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 qH(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 $H(e){var t={},n=0;function r(a){var i=n;px.forEach(e.children(a),r),t[a]={low:i,lim:n++}}return px.forEach(e.children(),r),t}var da=Wt,hx=Kn,HH={run:WH,cleanup:KH};function WH(e){var t=hx.addDummyNode(e,"root",{},"_root"),n=VH(e),r=da.max(da.values(n))-1,a=2*r+1;e.graph().nestingRoot=t,da.forEach(e.edges(),function(s){e.edge(s).minlen*=a});var i=GH(e)+1;da.forEach(e.children(),function(s){jA(e,t,a,i,r,n,s)}),e.graph().nodeRankFactor=a}function jA(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=hx.addBorderNode(e,"_bt"),u=hx.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(c,s),d.borderTop=c,e.setParent(u,s),d.borderBottom=u,da.forEach(l,function(f){jA(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 VH(e){var t={};function n(r,a){var i=e.children(r);i&&i.length&&da.forEach(i,function(s){n(s,a+1)}),t[r]=a}return da.forEach(e.children(),function(r){n(r,1)}),t}function GH(e){return da.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function KH(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,da.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}var L0=Wt,YH=Kn,QH=XH;function XH(e){function t(n){var r=e.children(n),a=e.node(n);if(r.length&&L0.forEach(r,t),L0.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,s=a.maxRank+1;i<s;++i)uS(e,"borderLeft","_bl",n,a,i),uS(e,"borderRight","_br",n,a,i)}}L0.forEach(e.children(),t)}function uS(e,t,n,r,a,i){var s={width:0,height:0,rank:i,borderType:t},l=a[t][i-1],c=YH.addDummyNode(e,"border",s,n);a[t][i]=c,e.setParent(c,r),l&&e.setEdge(l,c,{weight:1})}var $r=Wt,ZH={adjust:JH,undo:eW};function JH(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&TA(e)}function eW(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&tW(e),(t==="lr"||t==="rl")&&(nW(e),TA(e))}function TA(e){$r.forEach(e.nodes(),function(t){dS(e.node(t))}),$r.forEach(e.edges(),function(t){dS(e.edge(t))})}function dS(e){var t=e.width;e.width=e.height,e.height=t}function tW(e){$r.forEach(e.nodes(),function(t){O0(e.node(t))}),$r.forEach(e.edges(),function(t){var n=e.edge(t);$r.forEach(n.points,O0),$r.has(n,"y")&&O0(n)})}function O0(e){e.y=-e.y}function nW(e){$r.forEach(e.nodes(),function(t){D0(e.node(t))}),$r.forEach(e.edges(),function(t){var n=e.edge(t);$r.forEach(n.points,D0),$r.has(n,"x")&&D0(n)})}function D0(e){var t=e.x;e.x=e.y,e.y=t}var ia=Wt,rW=aW;function aW(e){var t={},n=ia.filter(e.nodes(),function(l){return!e.children(l).length}),r=ia.max(ia.map(n,function(l){return e.node(l).rank})),a=ia.map(ia.range(r+1),function(){return[]});function i(l){if(!ia.has(t,l)){t[l]=!0;var c=e.node(l);a[c.rank].push(l),ia.forEach(e.successors(l),i)}}var s=ia.sortBy(n,function(l){return e.node(l).rank});return ia.forEach(s,i),a}var Ra=Wt,iW=sW;function sW(e,t){for(var n=0,r=1;r<t.length;++r)n+=oW(e,t[r-1],t[r]);return n}function oW(e,t,n){for(var r=Ra.zipObject(n,Ra.map(n,function(u,d){return d})),a=Ra.flatten(Ra.map(t,function(u){return Ra.sortBy(Ra.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=Ra.map(new Array(s),function(){return 0}),c=0;return Ra.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 fS=Wt,lW=cW;function cW(e,t){return fS.map(t,function(n){var r=e.inEdges(n);if(r.length){var a=fS.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 tr=Wt,uW=dW;function dW(e,t){var n={};tr.forEach(e,function(a,i){var s=n[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};tr.isUndefined(a.barycenter)||(s.barycenter=a.barycenter,s.weight=a.weight)}),tr.forEach(t.edges(),function(a){var i=n[a.v],s=n[a.w];!tr.isUndefined(i)&&!tr.isUndefined(s)&&(s.indegree++,i.out.push(n[a.w]))});var r=tr.filter(n,function(a){return!a.indegree});return fW(r)}function fW(e){var t=[];function n(i){return function(s){s.merged||(tr.isUndefined(s.barycenter)||tr.isUndefined(i.barycenter)||s.barycenter>=i.barycenter)&&gW(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),tr.forEach(a.in.reverse(),n(a)),tr.forEach(a.out,r(a))}return tr.map(tr.filter(t,function(i){return!i.merged}),function(i){return tr.pick(i,["vs","i","barycenter","weight"])})}function gW(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 Co=Wt,pW=Kn,hW=mW;function mW(e,t){var n=pW.partition(e,function(d){return Co.has(d,"barycenter")}),r=n.lhs,a=Co.sortBy(n.rhs,function(d){return-d.i}),i=[],s=0,l=0,c=0;r.sort(yW(!!t)),c=gS(i,a,c),Co.forEach(r,function(d){c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,l+=d.weight,c=gS(i,a,c)});var u={vs:Co.flatten(i,!0)};return l&&(u.barycenter=s/l,u.weight=l),u}function gS(e,t,n){for(var r;t.length&&(r=Co.last(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function yW(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 Fa=Wt,xW=lW,bW=uW,vW=hW,kW=AA;function AA(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=Fa.filter(a,function(m){return m!==s&&m!==l}));var u=xW(e,a);Fa.forEach(u,function(m){if(e.children(m.v).length){var y=AA(e,m.v,n,r);c[m.v]=y,Fa.has(y,"barycenter")&&wW(m,y)}});var d=bW(u,n);_W(d,c);var f=vW(d,r);if(s&&(f.vs=Fa.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]);Fa.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 _W(e,t){Fa.forEach(e,function(n){n.vs=Fa.flatten(n.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function wW(e,t){Fa.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 jo=Wt,EW=Lr.Graph,NW=SW;function SW(e,t,n){var r=CW(e),a=new EW({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(i){return e.node(i)});return jo.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),jo.forEach(e[n](i),function(c){var u=c.v===i?c.w:c.v,d=a.edge(u,i),f=jo.isUndefined(d)?0:d.weight;a.setEdge(u,i,{weight:e.edge(c).weight+f})}),jo.has(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),a}function CW(e){for(var t;e.hasNode(t=jo.uniqueId("_root")););return t}var jW=Wt,TW=AW;function AW(e,t,n){var r={},a;jW.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 Ja=Wt,RW=rW,MW=iW,IW=kW,LW=NW,OW=TW,DW=Lr.Graph,pS=Kn,PW=FW;function FW(e){var t=pS.maxRank(e),n=hS(e,Ja.range(1,t+1),"inEdges"),r=hS(e,Ja.range(t-1,-1,-1),"outEdges"),a=RW(e);mS(e,a);for(var i=Number.POSITIVE_INFINITY,s,l=0,c=0;c<4;++l,++c){BW(l%2?n:r,l%4>=2),a=pS.buildLayerMatrix(e);var u=MW(e,a);u<i&&(c=0,s=Ja.cloneDeep(a),i=u)}mS(e,s)}function hS(e,t,n){return Ja.map(t,function(r){return LW(e,r,n)})}function BW(e,t){var n=new DW;Ja.forEach(e,function(r){var a=r.graph().root,i=IW(r,a,n,t);Ja.forEach(i.vs,function(s,l){r.node(s).order=l}),OW(r,n,i.vs)})}function mS(e,t){Ja.forEach(t,function(n){Ja.forEach(n,function(r,a){e.node(r).order=a})})}var lt=Wt,zW=Lr.Graph,UW=Kn,qW={positionX:JW};function $W(e,t){var n={};function r(a,i){var s=0,l=0,c=a.length,u=lt.last(i);return lt.forEach(i,function(d,f){var g=WW(e,d),p=g?e.node(g).order:c;(g||d===u)&&(lt.forEach(i.slice(l,f+1),function(m){lt.forEach(e.predecessors(m),function(y){var v=e.node(y),x=v.order;(x<s||p<x)&&!(v.dummy&&e.node(m).dummy)&&RA(n,y,m)})}),l=f+1,s=p)}),i}return lt.reduce(t,r),n}function HW(e,t){var n={};function r(i,s,l,c,u){var d;lt.forEach(lt.range(s,l),function(f){d=i[f],e.node(d).dummy&&lt.forEach(e.predecessors(d),function(g){var p=e.node(g);p.dummy&&(p.order<c||p.order>u)&&RA(n,g,d)})})}function a(i,s){var l=-1,c,u=0;return lt.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 lt.reduce(t,a),n}function WW(e,t){if(e.node(t).dummy)return lt.find(e.predecessors(t),function(n){return e.node(n).dummy})}function RA(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 VW(e,t,n){if(t>n){var r=t;t=n,n=r}return lt.has(e[t],n)}function GW(e,t,n,r){var a={},i={},s={};return lt.forEach(t,function(l){lt.forEach(l,function(c,u){a[c]=c,i[c]=c,s[c]=u})}),lt.forEach(t,function(l){var c=-1;lt.forEach(l,function(u){var d=r(u);if(d.length){d=lt.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]&&!VW(n,u,m)&&(i[m]=u,i[u]=a[u]=a[m],c=s[m])}}})}),{root:a,align:i}}function KW(e,t,n,r,a){var i={},s=YW(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)),lt.forEach(r,function(f){i[f]=i[n[f]]}),i}function YW(e,t,n,r){var a=new zW,i=e.graph(),s=eV(i.nodesep,i.edgesep,r);return lt.forEach(t,function(l){var c;lt.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 QW(e,t){return lt.minBy(lt.values(t),function(n){var r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return lt.forIn(n,function(i,s){var l=tV(e,s)/2;r=Math.max(i+l,r),a=Math.min(i-l,a)}),r-a})}function XW(e,t){var n=lt.values(t),r=lt.min(n),a=lt.max(n);lt.forEach(["u","d"],function(i){lt.forEach(["l","r"],function(s){var l=i+s,c=e[l],u;if(c!==t){var d=lt.values(c);u=s==="l"?r-lt.min(d):a-lt.max(d),u&&(e[l]=lt.mapValues(c,function(f){return f+u}))}})})}function ZW(e,t){return lt.mapValues(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var a=lt.sortBy(lt.map(e,r));return(a[1]+a[2])/2})}function JW(e){var t=UW.buildLayerMatrix(e),n=lt.merge($W(e,t),HW(e,t)),r={},a;lt.forEach(["u","d"],function(s){a=s==="u"?t:lt.values(t).reverse(),lt.forEach(["l","r"],function(l){l==="r"&&(a=lt.map(a,function(f){return lt.values(f).reverse()}));var c=(s==="u"?e.predecessors:e.successors).bind(e),u=GW(e,a,n,c),d=KW(e,a,u.root,u.align,l==="r");l==="r"&&(d=lt.mapValues(d,function(f){return-f})),r[s+l]=d})});var i=QW(e,r);return XW(r,i),ZW(r,e.graph().align)}function eV(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,lt.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,lt.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 tV(e,t){return e.node(t).width}var To=Wt,MA=Kn,nV=qW.positionX,rV=aV;function aV(e){e=MA.asNonCompoundGraph(e),iV(e),To.forEach(nV(e),function(t,n){e.node(n).x=t})}function iV(e){var t=MA.buildLayerMatrix(e),n=e.graph().ranksep,r=0;To.forEach(t,function(a){var i=To.max(To.map(a,function(s){return e.node(s).height}));To.forEach(a,function(s){e.node(s).y=r+i/2}),r+=i+n})}var gt=Wt,yS=Y$,xS=fH,sV=DH,oV=Kn.normalizeRanks,lV=zH,cV=Kn.removeEmptyRanks,bS=HH,uV=QH,vS=ZH,dV=PW,fV=rV,ni=Kn,gV=Lr.Graph,pV=hV;function hV(e,t){var n=t&&t.debugTiming?ni.time:ni.notime;n("layout",function(){var r=n(" buildLayoutGraph",function(){return SV(e)});n(" runLayout",function(){mV(r,n)}),n(" updateInputGraph",function(){yV(e,r)})})}function mV(e,t){t(" makeSpaceForEdgeLabels",function(){CV(e)}),t(" removeSelfEdges",function(){DV(e)}),t(" acyclic",function(){yS.run(e)}),t(" nestingGraph.run",function(){bS.run(e)}),t(" rank",function(){sV(ni.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){jV(e)}),t(" removeEmptyRanks",function(){cV(e)}),t(" nestingGraph.cleanup",function(){bS.cleanup(e)}),t(" normalizeRanks",function(){oV(e)}),t(" assignRankMinMax",function(){TV(e)}),t(" removeEdgeLabelProxies",function(){AV(e)}),t(" normalize.run",function(){xS.run(e)}),t(" parentDummyChains",function(){lV(e)}),t(" addBorderSegments",function(){uV(e)}),t(" order",function(){dV(e)}),t(" insertSelfEdges",function(){PV(e)}),t(" adjustCoordinateSystem",function(){vS.adjust(e)}),t(" position",function(){fV(e)}),t(" positionSelfEdges",function(){FV(e)}),t(" removeBorderNodes",function(){OV(e)}),t(" normalize.undo",function(){xS.undo(e)}),t(" fixupEdgeLabelCoords",function(){IV(e)}),t(" undoCoordinateSystem",function(){vS.undo(e)}),t(" translateGraph",function(){RV(e)}),t(" assignNodeIntersects",function(){MV(e)}),t(" reversePoints",function(){LV(e)}),t(" acyclic.undo",function(){yS.undo(e)})}function yV(e,t){gt.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))}),gt.forEach(e.edges(),function(n){var r=e.edge(n),a=t.edge(n);r.points=a.points,gt.has(a,"x")&&(r.x=a.x,r.y=a.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var xV=["nodesep","edgesep","ranksep","marginx","marginy"],bV={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},vV=["acyclicer","ranker","rankdir","align"],kV=["width","height"],_V={width:0,height:0},wV=["minlen","weight","width","height","labeloffset"],EV={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},NV=["labelpos"];function SV(e){var t=new gV({multigraph:!0,compound:!0}),n=F0(e.graph());return t.setGraph(gt.merge({},bV,P0(n,xV),gt.pick(n,vV))),gt.forEach(e.nodes(),function(r){var a=F0(e.node(r));t.setNode(r,gt.defaults(P0(a,kV),_V)),t.setParent(r,e.parent(r))}),gt.forEach(e.edges(),function(r){var a=F0(e.edge(r));t.setEdge(r,gt.merge({},EV,P0(a,wV),gt.pick(a,NV)))}),t}function CV(e){var t=e.graph();t.ranksep/=2,gt.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 jV(e){gt.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};ni.addDummyNode(e,"edge-proxy",i,"_ep")}})}function TV(e){var t=0;gt.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=gt.max(t,r.maxRank))}),e.graph().maxRank=t}function AV(e){gt.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 RV(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)}gt.forEach(e.nodes(),function(u){c(e.node(u))}),gt.forEach(e.edges(),function(u){var d=e.edge(u);gt.has(d,"x")&&c(d)}),t-=s,r-=l,gt.forEach(e.nodes(),function(u){var d=e.node(u);d.x-=t,d.y-=r}),gt.forEach(e.edges(),function(u){var d=e.edge(u);gt.forEach(d.points,function(f){f.x-=t,f.y-=r}),gt.has(d,"x")&&(d.x-=t),gt.has(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=a-r+l}function MV(e){gt.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(ni.intersectRect(r,i)),n.points.push(ni.intersectRect(a,s))})}function IV(e){gt.forEach(e.edges(),function(t){var n=e.edge(t);if(gt.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 LV(e){gt.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function OV(e){gt.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(gt.last(n.borderLeft)),s=e.node(gt.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}}),gt.forEach(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function DV(e){gt.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 PV(e){var t=ni.buildLayerMatrix(e);gt.forEach(t,function(n){var r=0;gt.forEach(n,function(a,i){var s=e.node(a);s.order=i+r,gt.forEach(s.selfEdges,function(l){ni.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 FV(e){gt.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 P0(e,t){return gt.mapValues(gt.pick(e,t),Number)}function F0(e){var t={};return gt.forEach(e,function(n,r){t[r.toLowerCase()]=n}),t}var Ec=Wt,BV=Kn,zV=Lr.Graph,UV={debugOrdering:qV};function qV(e){var t=BV.buildLayerMatrix(e),n=new zV({compound:!0,multigraph:!0}).setGraph({});return Ec.forEach(e.nodes(),function(r){n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),Ec.forEach(e.edges(),function(r){n.setEdge(r.v,r.w,{},r.name)}),Ec.forEach(t,function(r,a){var i="layer"+a;n.setNode(i,{rank:"same"}),Ec.reduce(r,function(s,l){return n.setEdge(s,l,{style:"invis"}),l})}),n}var $V="0.8.5",HV={graphlib:Lr,layout:pV,debug:UV,util:{time:Kn.time,notime:Kn.notime},version:$V};const Au=hl(HV),WV={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"}},VV={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 GV(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function kS(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function KV({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 U=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(U)&&U>.1)return U}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 U=localStorage.getItem("pave-map-rankdir");if(U==="LR"||U==="TB")return U}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 U=n.filter(function(P){return P.status!=="completed"}),K={};return U.forEach(function(P){K[P.id]=!0}),U.map(function(P){if(!P.blockedBy||!P.blockedBy.length)return P;const M=P.blockedBy.filter(function(C){return K[C]});return M.length===P.blockedBy.length?P:Object.assign({},P,{blockedBy:M})})},[n,f]);h.useEffect(function(){if(!i.current)return;function U(){i.current&&c(i.current.clientWidth||400)}U();const K=new ResizeObserver(U);return K.observe(i.current),function(){K.disconnect()}},[]);const v=h.useMemo(function(){if(!y.length)return{nodes:[],edges:[],width:0,height:0};const U=new Au.graphlib.Graph;U.setGraph({rankdir:p,nodesep:24,ranksep:36,marginx:16,marginy:16}),U.setDefaultEdgeLabel(function(){return{}});const K=180,P=56;y.forEach(function(L){U.setNode(String(L.id),{width:K,height:P,todo:L})}),y.forEach(function(L){(L.blockedBy||[]).forEach(function(Q){U.hasNode(String(Q))&&U.setEdge(String(Q),String(L.id))})}),Au.layout(U);const M=U.nodes().map(function(L){const F=U.node(L);return{id:L,x:F.x-K/2,y:F.y-P/2,w:K,h:P,todo:F.todo}}),C=U.edges().map(function(L){const F=U.edge(L);return{from:L.v,to:L.w,points:F.points}});return{nodes:M,edges:C,width:U.graph().width||K+32,height:U.graph().height||P+32}},[y,p]),x=t?VV:WV;if(!y.length){const U=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"})})}),U>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:[U," completed ",U===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(U){if(!U||U.length<2)return"";let K="M "+U[0].x+" "+U[0].y;for(let P=1;P<U.length;P++)K+=" L "+U[P].x+" "+U[P].y;return K}const k=n.reduce(function(U,K){const P=kS(K);return U[P]=(U[P]||0)+1,U},{}),N=k.completed||0,E=Math.max(v.width,100),w=Math.max(v.height,100),R=(E>l-24?1:(l-24)/E)*u,D=E*R,A=w*R;function q(U){(U.ctrlKey||U.metaKey)&&(U.preventDefault(),d(function(K){const P=U.deltaY<0?K*1.1:K/1.1;return Math.max(.25,Math.min(4,P))}))}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(U){return U==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title: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(U){return Math.max(.25,U/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),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(U){return Math.min(4,U*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),N>0?o.jsx("button",{type:"button",onClick:function(){g(function(U){return!U})},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:q,children:o.jsxs("svg",{viewBox:"0 0 "+E+" "+w,width:D,height:A,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(U,K){return o.jsx("path",{d:b(U.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+K)}),v.nodes.map(function(U){const K=kS(U.todo),P=x[K],M=K==="in_progress",C=r===U.id;return o.jsxs("g",{transform:"translate("+U.x+","+U.y+")",onMouseEnter:function(){a(U.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[o.jsx("rect",{width:U.w,height:U.h,rx:6,ry:6,fill:P.fill,stroke:P.stroke,strokeWidth:M||C?2:1.25,children:M?o.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),M?o.jsx("circle",{cx:10,cy:10,r:3.5,fill:P.stroke,children:o.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,o.jsx("text",{x:U.w/2,y:U.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:P.label,children:"#"+U.todo.id}),o.jsx("text",{x:U.w/2,y:U.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:GV(U.todo.text,26)}),C&&U.todo.text&&U.todo.text.length>26?o.jsx("title",{children:U.todo.text}):null]},U.id)})]})})]})}const YV={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"}},QV={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},XV={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},ZV={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"}},JV={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},eG={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},tG={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},nG={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},Ma={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function rG(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function aG(e,t){return e.kind==="thought"?t?nG:tG:e.status==="error"?t?eG:XV:(t?ZV:YV)[e.tool]||(t?JV:QV)}function iG({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 M=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(M)&&M>.1)return M}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 M=localStorage.getItem("pave-toolmap-rankdir");if(M==="LR"||M==="TB")return M}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 M=r;return y||(M=M.filter(function(C){return!C.hidden})),x||(M=M.filter(function(C){return C.kind!=="thought"})),M},[r,y,x]),N=h.useMemo(function(){const M={};return k.forEach(function(C){M[C.id]=!0}),a.filter(function(C){return M[C.from]&&M[C.to]})},[a,k]),E=h.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const M=new Au.graphlib.Graph;M.setGraph({rankdir:p,nodesep:18,ranksep:32,marginx:14,marginy:14}),M.setDefaultEdgeLabel(function(){return{}});const C=168,L=44,F=240,Q=60;k.forEach(function(V){V.kind==="thought"?M.setNode(V.id,{width:F,height:Q,node:V}):M.setNode(V.id,{width:C,height:L,node:V})}),N.forEach(function(V){M.hasNode(V.from)&&M.hasNode(V.to)&&M.setEdge(V.from,V.to,{kind:V.kind})}),Au.layout(M);const S=M.nodes().map(function(V){const j=M.node(V);return{id:V,x:j.x-j.width/2,y:j.y-j.height/2,w:j.width,h:j.height,node:j.node}}),Y=M.edges().map(function(V){const j=M.edge(V);return{from:V.v,to:V.w,points:j.points||[],kind:j.kind||"seq"}});return{nodes:S,edges:Y,width:M.graph().width||C+28,height:M.graph().height||L+28}},[k,N,p]);h.useEffect(function(){if(!i.current)return;function M(){i.current&&d(i.current.clientWidth||400)}M();const C=new ResizeObserver(M);return C.observe(i.current),function(){C.disconnect()}},[]);const w=h.useMemo(function(){const M={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(C){if(C.kind==="thought"){M.thoughts++;return}M.total++,C.hidden&&M.hidden++,C.status==="error"?M.error++:C.status==="running"?M.running++:M.ok++}),M},[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 T(M){if(!M||M.length<2)return"";let C="M "+M[0].x+" "+M[0].y;for(let L=1;L<M.length;L++)C+=" L "+M[L].x+" "+M[L].y;return C}const R=Math.max(E.width,100),D=Math.max(E.height,100),q=(R>u-24?1:(u-24)/R)*f,U=R*q,K=D*q;function P(M){(M.ctrlKey||M.metaKey)&&(M.preventDefault(),g(function(C){const L=M.deltaY<0?C*1.1:C/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(M){return M==="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(M){return Math.max(.25,M/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(M){return Math.min(4,M*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(M){return!M})},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(M){return!M})},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:P,children:o.jsxs("svg",{viewBox:"0 0 "+R+" "+D,width:U,height:K,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?Ma.data.dark:Ma.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?Ma.file.dark:Ma.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?Ma.seq.dark:Ma.seq.light})})]}),E.edges.map(function(M,C){const L=t?Ma[M.kind].dark:Ma[M.kind].light;return o.jsx("path",{d:T(M.points),fill:"none",stroke:L,strokeWidth:M.kind==="data"?1.75:M.kind==="file"?1.25:1,strokeDasharray:M.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+M.kind+")"},"e"+C)}),E.nodes.map(function(M){const C=M.node,L=aG(C,t),F=C.status==="running",Q=l===M.id;if(C.kind==="thought"){const Y=C.label||"",V=32,j=3,$=Y.split(/\s+/),ce=[];let J="";for(const _e of $){if(ce.length===j-1&&(J+" "+_e).length>V){ce.push(J);const ue=$.slice($.indexOf(_e)).join(" ");ce.push(ue.length>V?ue.slice(0,V-1)+"…":ue),J="";break}if(!J){J=_e;continue}if((J+" "+_e).length<=V?J=J+" "+_e:(ce.push(J),J=_e),ce.length>=j)break}return J&&ce.length<j&&ce.push(J),o.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){c(M.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(C)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:M.h/2,ry:M.h/2,fill:L.fill,stroke:L.stroke,strokeWidth:Q?1.75:1,strokeDasharray:C.source==="reasoning"?void 0:"4,2"}),o.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:L.label,children:ce.map(function(_e,ue){return o.jsx("tspan",{x:14,dy:ue===0?14:11,children:(ue===0?"💭 ":"")+_e},"ln"+ue)})}),o.jsx("title",{children:(C.source==="reasoning"?"[reasoning] ":"[thought] ")+(C.fullText||C.label)})]},M.id)}return o.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){c(M.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(C)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:5,ry:5,fill:L.fill,stroke:L.stroke,strokeWidth:F||Q?2:1.25,opacity:C.hidden?.55:1,children:F?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:C.tool}),o.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:rG(C.label,22)}),o.jsx("title",{children:C.tool+" · "+C.label+(C.status==="error"?" · ERROR":C.status==="running"?" · RUNNING":"")}),F?o.jsxs("g",{transform:"translate("+(M.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]},M.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 _S(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 sG(e){if(Array.isArray(e))return e}function oG(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 lG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
103
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cG(e,t){return sG(e)||oG(e,t)||uG(e,t)||lG()}function uG(e,t){if(e){if(typeof e=="string")return _S(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)?_S(e,t):void 0}}const IA=Object.entries,wS=Object.setPrototypeOf,dG=Object.isFrozen,fG=Object.getPrototypeOf,gG=Object.getOwnPropertyDescriptor;let _n=Object.freeze,Nn=Object.seal,os=Object.create,LA=typeof Reflect<"u"&&Reflect,mx=LA.apply,yx=LA.construct;_n||(_n=function(t){return t});Nn||(Nn=function(t){return t});mx||(mx=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)});yx||(yx=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 ts=an(Array.prototype.forEach),pG=an(Array.prototype.lastIndexOf),ES=an(Array.prototype.pop),ns=an(Array.prototype.push),hG=an(Array.prototype.splice),Ba=Array.isArray,Ao=an(String.prototype.toLowerCase),B0=an(String.prototype.toString),NS=an(String.prototype.match),xo=an(String.prototype.replace),SS=an(String.prototype.indexOf),mG=an(String.prototype.trim),yG=an(Number.prototype.toString),xG=an(Boolean.prototype.toString),CS=typeof BigInt>"u"?null:an(BigInt.prototype.toString),jS=typeof Symbol>"u"?null:an(Symbol.prototype.toString),mn=an(Object.prototype.hasOwnProperty),bo=an(Object.prototype.toString),hn=an(RegExp.prototype.test),pi=bG(TypeError);function an(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 mx(e,t,r)}}function bG(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return yx(e,n)}}function bt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ao;if(wS&&wS(e,null),!Ba(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(dG(t)||(t[r]=i),a=i)}e[a]=!0}return e}function vG(e){for(let t=0;t<e.length;t++)mn(e,t)||(e[t]=null);return e}function An(e){const t=os(null);for(const r of IA(e)){var n=cG(r,2);const a=n[0],i=n[1];mn(e,a)&&(Ba(i)?t[a]=vG(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=An(i):t[a]=i)}return t}function kG(e){switch(typeof e){case"string":return e;case"number":return yG(e);case"boolean":return xG(e);case"bigint":return CS?CS(e):"0";case"symbol":return jS?jS(e):"Symbol()";case"undefined":return bo(e);case"function":case"object":{if(e===null)return bo(e);const t=e,n=Er(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:bo(r)}return bo(e)}default:return bo(e)}}function Er(e,t){for(;e!==null;){const r=gG(e,t);if(r){if(r.get)return an(r.get);if(typeof r.value=="function")return an(r.value)}e=fG(e)}function n(){return null}return n}function _G(e){try{return hn(e,""),!0}catch{return!1}}const TS=_n(["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"]),z0=_n(["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"]),U0=_n(["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"]),wG=_n(["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"]),q0=_n(["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"]),EG=_n(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),AS=_n(["#text"]),RS=_n(["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"]),$0=_n(["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"]),MS=_n(["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"]),Nc=_n(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),NG=Nn(/{{[\w\W]*|^[\w\W]*}}/g),SG=Nn(/<%[\w\W]*|^[\w\W]*%>/g),CG=Nn(/\${[\w\W]*/g),jG=Nn(/^data-[\-\w.\u00B7-\uFFFF]+$/),TG=Nn(/^aria-[\-\w]+$/),IS=Nn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),AG=Nn(/^(?:\w+script|data):/i),RG=Nn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),MG=Nn(/^html$/i),IG=Nn(/^[a-z][.\w]*(-[.\w]+)+$/i),LS=Nn(/<[/\w!]/g),OS=Nn(/<[/\w]/g),LG=Nn(/<\/no(script|embed|frames)/i),OG=Nn(/\/>/i),Zn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},DG=function(){return typeof window>"u"?null:window},PG=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}},DS=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ia=function(t,n,r,a){return mn(t,n)&&Ba(t[n])?bt(a.base?An(a.base):{},t[n],a.transform):r};function OA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:DG();const t=Ie=>OA(Ie);if(t.version="3.4.13",t.removed=[],!e||!e.document||e.document.nodeType!==Zn.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=Er(g,"cloneNode"),m=Er(g,"remove"),y=Er(g,"nextSibling"),v=Er(g,"childNodes"),x=Er(g,"parentNode"),b=Er(g,"shadowRoot"),k=Er(g,"attributes"),N=s&&s.prototype?Er(s.prototype,"nodeType"):null,E=s&&s.prototype?Er(s.prototype,"nodeName"):null,w=s&&s.prototype?Er(s.prototype,"ownerDocument"):null;if(typeof i=="function"){const Ie=n.createElement("template");Ie.content&&Ie.content.ownerDocument&&(n=Ie.content.ownerDocument)}let T,R="",D,A=!1,q=0;const U=function(){if(q>0)throw pi('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.')},K=function(O){U(),q++;try{return T.createHTML(O)}finally{q--}},P=function(O){U(),q++;try{return T.createScriptURL(O)}finally{q--}},M=function(){return A||(D=PG(f,a),A=!0),D},C=n,L=C.implementation,F=C.createNodeIterator,Q=C.createDocumentFragment,S=C.getElementsByTagName,Y=r.importNode;let V=DS();t.isSupported=typeof IA=="function"&&typeof x=="function"&&L&&L.createHTMLDocument!==void 0;const j=NG,$=SG,ce=CG,J=jG,_e=TG,ue=AG,ne=RG,Ce=IG;let ke=IS,pe=null;const me=bt({},[...TS,...z0,...U0,...q0,...AS]);let De=null;const Ne=bt({},[...RS,...$0,...MS,...Nc]);let Ee=Object.seal(os(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}})),Oe=null,fe=null;const he=Object.seal(os(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,Z=!0,ve=!1,Re=!0,Be=!1,Ge=!0,W=!1,z=!1,re=null,le=null,Se=!1,ze=!1,Ve=!1,Ke=!1,ot=!0,wt=!1;const _t="user-content-";let Jt=!0,ye=!1,We={},Qe=null;const ut=bt({},["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 ee=null;const Me=bt({},["audio","video","img","source","image","track"]);let Pe=null;const Xe=bt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Mt=ft,Un=!1,Nt=null;const Tt=bt({},[yt,dt,ft],B0),Xt=_n(["mi","mo","mn","ms","mtext"]);let te=bt({},Xt);const zt=_n(["annotation-xml"]);let it=bt({},zt);const Vt=bt({},["title","style","font","a","script"]);let xe=null;const Ye=["application/xhtml+xml","text/html"],St="text/html";let It=null,lr=null;const Qn=n.createElement("form"),wa=function(O){return O instanceof RegExp||O instanceof Function},Or=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(lr&&lr===O)return;(!O||typeof O!="object")&&(O={}),O=An(O),xe=Ye.indexOf(O.PARSER_MEDIA_TYPE)===-1?St:O.PARSER_MEDIA_TYPE,It=xe==="application/xhtml+xml"?B0:Ao,pe=Ia(O,"ALLOWED_TAGS",me,{transform:It}),De=Ia(O,"ALLOWED_ATTR",Ne,{transform:It}),Nt=Ia(O,"ALLOWED_NAMESPACES",Tt,{transform:B0}),Pe=Ia(O,"ADD_URI_SAFE_ATTR",Xe,{transform:It,base:Xe}),ee=Ia(O,"ADD_DATA_URI_TAGS",Me,{transform:It,base:Me}),Qe=Ia(O,"FORBID_CONTENTS",ut,{transform:It}),Oe=Ia(O,"FORBID_TAGS",An({}),{transform:It}),fe=Ia(O,"FORBID_ATTR",An({}),{transform:It}),We=mn(O,"USE_PROFILES")?O.USE_PROFILES&&typeof O.USE_PROFILES=="object"?An(O.USE_PROFILES):O.USE_PROFILES:!1,Le=O.ALLOW_ARIA_ATTR!==!1,Z=O.ALLOW_DATA_ATTR!==!1,ve=O.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=O.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Be=O.SAFE_FOR_TEMPLATES||!1,Ge=O.SAFE_FOR_XML!==!1,W=O.WHOLE_DOCUMENT||!1,ze=O.RETURN_DOM||!1,Ve=O.RETURN_DOM_FRAGMENT||!1,Ke=O.RETURN_TRUSTED_TYPE||!1,Se=O.FORCE_BODY||!1,ot=O.SANITIZE_DOM!==!1,wt=O.SANITIZE_NAMED_PROPS||!1,Jt=O.KEEP_CONTENT!==!1,ye=O.IN_PLACE||!1,ke=_G(O.ALLOWED_URI_REGEXP)?O.ALLOWED_URI_REGEXP:IS,Mt=typeof O.NAMESPACE=="string"?O.NAMESPACE:ft,te=mn(O,"MATHML_TEXT_INTEGRATION_POINTS")&&O.MATHML_TEXT_INTEGRATION_POINTS&&typeof O.MATHML_TEXT_INTEGRATION_POINTS=="object"?An(O.MATHML_TEXT_INTEGRATION_POINTS):bt({},Xt),it=mn(O,"HTML_INTEGRATION_POINTS")&&O.HTML_INTEGRATION_POINTS&&typeof O.HTML_INTEGRATION_POINTS=="object"?An(O.HTML_INTEGRATION_POINTS):bt({},zt);const se=mn(O,"CUSTOM_ELEMENT_HANDLING")&&O.CUSTOM_ELEMENT_HANDLING&&typeof O.CUSTOM_ELEMENT_HANDLING=="object"?An(O.CUSTOM_ELEMENT_HANDLING):os(null);if(Ee=os(null),mn(se,"tagNameCheck")&&wa(se.tagNameCheck)&&(Ee.tagNameCheck=se.tagNameCheck),mn(se,"attributeNameCheck")&&wa(se.attributeNameCheck)&&(Ee.attributeNameCheck=se.attributeNameCheck),mn(se,"allowCustomizedBuiltInElements")&&typeof se.allowCustomizedBuiltInElements=="boolean"&&(Ee.allowCustomizedBuiltInElements=se.allowCustomizedBuiltInElements),Nn(Ee),Be&&(Z=!1),Ve&&(ze=!0),We&&(pe=bt({},AS),De=os(null),We.html===!0&&(bt(pe,TS),bt(De,RS)),We.svg===!0&&(bt(pe,z0),bt(De,$0),bt(De,Nc)),We.svgFilters===!0&&(bt(pe,U0),bt(De,$0),bt(De,Nc)),We.mathMl===!0&&(bt(pe,q0),bt(De,MS),bt(De,Nc))),he.tagCheck=null,he.attributeCheck=null,mn(O,"ADD_TAGS")&&(typeof O.ADD_TAGS=="function"?he.tagCheck=O.ADD_TAGS:Ba(O.ADD_TAGS)&&(pe===me&&(pe=An(pe)),bt(pe,O.ADD_TAGS,It))),mn(O,"ADD_ATTR")&&(typeof O.ADD_ATTR=="function"?he.attributeCheck=O.ADD_ATTR:Ba(O.ADD_ATTR)&&(De===Ne&&(De=An(De)),bt(De,O.ADD_ATTR,It))),mn(O,"ADD_URI_SAFE_ATTR")&&Ba(O.ADD_URI_SAFE_ATTR)&&bt(Pe,O.ADD_URI_SAFE_ATTR,It),mn(O,"FORBID_CONTENTS")&&Ba(O.FORBID_CONTENTS)&&(Qe===ut&&(Qe=An(Qe)),bt(Qe,O.FORBID_CONTENTS,It)),mn(O,"ADD_FORBID_CONTENTS")&&Ba(O.ADD_FORBID_CONTENTS)&&(Qe===ut&&(Qe=An(Qe)),bt(Qe,O.ADD_FORBID_CONTENTS,It)),Jt&&(pe["#text"]=!0),W&&bt(pe,["html","head","body"]),pe.table&&(bt(pe,["tbody"]),delete Oe.tbody),O.TRUSTED_TYPES_POLICY){if(typeof O.TRUSTED_TYPES_POLICY.createHTML!="function")throw pi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof O.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const we=T;T=O.TRUSTED_TYPES_POLICY;try{R=K("")}catch(He){throw T=we,He}}else O.TRUSTED_TYPES_POLICY===null?(T=void 0,R=""):(T===void 0&&(T=M()),T&&typeof R=="string"&&(R=K("")));_n&&_n(O),lr=O},Vs=bt({},[...z0,...U0,...wG]),li=bt({},[...q0,...EG]),Gs=function(O,se,we){return se.namespaceURI===ft?O==="svg":se.namespaceURI===yt?O==="svg"&&(we==="annotation-xml"||te[we]):!!Vs[O]},Wi=function(O,se,we){return se.namespaceURI===ft?O==="math":se.namespaceURI===dt?O==="math"&&it[we]:!!li[O]},Ed=function(O,se,we){return se.namespaceURI===dt&&!it[we]||se.namespaceURI===yt&&!te[we]?!1:!li[O]&&(Vt[O]||!Vs[O])},Yr=function(O){let se=x(O);(!se||!se.tagName)&&(se={namespaceURI:Mt,tagName:"template"});const we=Ao(O.tagName),He=Ao(se.tagName);return Nt[O.namespaceURI]?O.namespaceURI===dt?Gs(we,se,He):O.namespaceURI===yt?Wi(we,se,He):O.namespaceURI===ft?Ed(we,se,He):!!(xe==="application/xhtml+xml"&&Nt[O.namespaceURI]):!1},bn=function(O){ns(t.removed,{element:O});try{x(O).removeChild(O)}catch{if(m(O),!x(O))throw pi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Qr=function(O){cr(O);const se=v(O);if(se){const He=[];ts(se,Ze=>{ns(He,Ze)}),ts(He,Ze=>{try{m(Ze)}catch{}})}const we=k(O);if(we)for(let He=we.length-1;He>=0;--He){const Ze=we[He],at=Ze&&Ze.name;if(typeof at=="string")try{O.removeAttribute(at)}catch{}}},on=function(O,se){try{ns(t.removed,{attribute:se.getAttributeNode(O),from:se})}catch{ns(t.removed,{attribute:null,from:se})}if(se.removeAttribute(O),O==="is")if(ze||Ve)try{bn(se)}catch{}else try{se.setAttribute(O,"")}catch{}},Nd=function(O){const se=k(O);if(se)for(let we=se.length-1;we>=0;--we){const He=se[we],Ze=He&&He.name;if(!(typeof Ze!="string"||De[It(Ze)]))try{O.removeAttribute(Ze)}catch{}}},cr=function(O){const se=[O];for(;se.length>0;){const we=se.pop();(N?N(we):we.nodeType)===Zn.element&&Nd(we);const Ze=v(we);if(Ze)for(let at=Ze.length-1;at>=0;--at)se.push(Ze[at])}},Vi=function(O){if(!Ge)return;const se=[O];for(;se.length>0;){const we=se.pop(),He=N?N(we):we.nodeType;if(He===Zn.processingInstruction||He===Zn.comment&&hn(OS,we.data)){try{m(we)}catch{}continue}if(He===Zn.element){const at=we,Ct=It(E?E(we):we.nodeName);try{at.hasAttribute&&at.hasAttribute("patchsrc")&&at.removeAttribute("patchsrc"),at.hasAttribute&&at.hasAttribute("for")&&Ct!=="label"&&Ct!=="output"&&at.removeAttribute("for")}catch{}}const Ze=v(we);if(Ze)for(let at=Ze.length-1;at>=0;--at)se.push(Ze[at])}},Ks=function(O){let se=null,we=null;if(Se)O="<remove></remove>"+O;else{const at=NS(O,/^[\r\n\t ]+/);we=at&&at[0]}xe==="application/xhtml+xml"&&Mt===ft&&(O='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+O+"</body></html>");const He=T?K(O):O;if(Mt===ft)try{se=new d().parseFromString(He,xe)}catch{}if(!se||!se.documentElement){se=L.createDocument(Mt,"template",null);try{se.documentElement.innerHTML=Un?R:He}catch{}}const Ze=se.body||se.documentElement;return O&&we&&Ze.insertBefore(n.createTextNode(we),Ze.childNodes[0]||null),Mt===ft?S.call(se,W?"html":"body")[0]:W?se.documentElement:Ze},Ys=function(O){const se=w?w(O):O.ownerDocument;return F.call(se||O,O,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Xr=function(O){return O=xo(O,j," "),O=xo(O,$," "),O=xo(O,ce," "),O},Sn=function(O){var se;O.normalize();const we=w?w(O):O.ownerDocument,He=F.call(we||O,O,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let Ze=He.nextNode();for(;Ze;)Ze.data=Xr(Ze.data),Ze=He.nextNode();const at=(se=O.querySelectorAll)===null||se===void 0?void 0:se.call(O,"template");at&&ts(at,Ct=>{Zr(Ct.content)&&Sn(Ct.content)})},ln=function(O){const se=E?E(O):null;return typeof se!="string"||It(se)!=="form"?!1:typeof O.nodeName!="string"||typeof O.textContent!="string"||typeof O.removeChild!="function"||O.attributes!==k(O)||typeof O.removeAttribute!="function"||typeof O.setAttribute!="function"||typeof O.namespaceURI!="string"||typeof O.insertBefore!="function"||typeof O.hasChildNodes!="function"||O.nodeType!==N(O)||O.childNodes!==v(O)},Zr=function(O){if(!N||typeof O!="object"||O===null)return!1;try{return N(O)===Zn.documentFragment}catch{return!1}},ci=function(O){if(!N||typeof O!="object"||O===null)return!1;try{return typeof N(O)=="number"}catch{return!1}};function cn(Ie,O,se){Ie.length!==0&&ts(Ie,we=>{we.call(t,O,se,lr)})}const Sd=function(O,se){return!!(Ge&&O.hasChildNodes()&&!ci(O.firstElementChild)&&hn(LS,O.textContent)&&hn(LS,O.innerHTML)||Ge&&O.namespaceURI===ft&&se==="style"&&ci(O.firstElementChild)||O.nodeType===Zn.processingInstruction||Ge&&O.nodeType===Zn.comment&&hn(OS,O.data))},Qs=function(O,se,we){if(!Oe[se]&&Ea(se)&&(Ee.tagNameCheck instanceof RegExp&&hn(Ee.tagNameCheck,se)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(se)))return!1;if(Jt&&!Qe[se]){const He=x(O),Ze=v(O);if(Ze&&He){const at=Ze.length;for(let Ct=at-1;Ct>=0;--Ct){const Lt=O===we?p(Ze[Ct],!0):Ze[Ct];He.insertBefore(Lt,y(O))}}}return bn(O),!0},Ml=function(O,se,we,He){return O.length===0?se:se===we||se===He?An(se):se},ui=function(O,se){if(cn(V.beforeSanitizeElements,O,null),O!==se&&x(O)===null)return ye&&cr(O),!0;if(ln(O))return bn(O),!0;const we=It(E?E(O):O.nodeName);if(pe=Ml(V.uponSanitizeElement,pe,me,re),cn(V.uponSanitizeElement,O,{tagName:we,allowedTags:pe}),O!==se&&x(O)===null)return ye&&cr(O),!0;if(Sd(O,we))return bn(O),!0;if(Oe[we]||!(he.tagCheck instanceof Function&&he.tagCheck(we))&&!pe[we]){const Ze=Qs(O,we,se);return Ze===!1&&cn(V.afterSanitizeElements,O,null),Ze}if((N?N(O):O.nodeType)===Zn.element&&!Yr(O)||(we==="noscript"||we==="noembed"||we==="noframes")&&hn(LG,O.innerHTML))return bn(O),!0;if(Be&&O.nodeType===Zn.text){const Ze=Xr(O.textContent);O.textContent!==Ze&&(ns(t.removed,{element:O.cloneNode()}),O.textContent=Ze)}return cn(V.afterSanitizeElements,O,null),!1},Il=function(O,se,we){if(fe[se]||Ge&&se==="patchsrc"||Ge&&se==="for"&&O!=="label"&&O!=="output"||ot&&(se==="id"||se==="name")&&(we in n||we in Qn))return!1;const He=De[se]||he.attributeCheck instanceof Function&&he.attributeCheck(se,O);if(!(Z&&hn(J,se))){if(!(Le&&hn(_e,se))){if(He){if(!Pe[se]){if(!hn(ke,xo(we,ne,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&O!=="script"&&SS(we,"data:")===0&&ee[O])){if(!(ve&&!hn(ue,xo(we,ne,"")))){if(we)return!1}}}}}else if(!(Ea(O)&&(Ee.tagNameCheck instanceof RegExp&&hn(Ee.tagNameCheck,O)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(O))&&(Ee.attributeNameCheck instanceof RegExp&&hn(Ee.attributeNameCheck,se)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(se,O))||se==="is"&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&hn(Ee.tagNameCheck,we)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(we))))return!1}}return!0},Ll=bt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ea=function(O){return!Ll[Ao(O)]&&hn(Ce,O)},Xs=function(O,se,we,He){if(T&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!we)switch(f.getAttributeType(O,se)){case"TrustedHTML":return K(He);case"TrustedScriptURL":return P(He)}return He},Cd=function(O,se,we,He){try{we?O.setAttributeNS(we,se,He):O.setAttribute(se,He),ln(O)?bn(O):ES(t.removed)}catch{on(se,O)}},Na=function(O){cn(V.beforeSanitizeAttributes,O,null);const se=O.attributes;if(!se||ln(O))return;De=Ml(V.uponSanitizeAttribute,De,Ne,le);const we={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:De,forceKeepAttr:void 0};let He=se.length;const Ze=It(O.nodeName);for(;He--;){const at=se[He],Ct=at.name,Lt=at.namespaceURI,un=at.value,Cn=It(Ct),Sa=un;let dn=Ct==="value"?Sa:mG(Sa);if(we.attrName=Cn,we.attrValue=dn,we.keepAttr=!0,we.forceKeepAttr=void 0,cn(V.uponSanitizeAttribute,O,we),dn=we.attrValue,wt&&(Cn==="id"||Cn==="name")&&SS(dn,_t)!==0&&(on(Ct,O),dn=_t+dn),Ge&&hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,dn)){on(Ct,O);continue}if(Cn==="attributename"&&NS(dn,"href")){on(Ct,O);continue}if(!we.forceKeepAttr){if(!we.keepAttr){on(Ct,O);continue}if(!Re&&hn(OG,dn)){on(Ct,O);continue}if(Be&&(dn=Xr(dn)),!Il(Ze,Cn,dn)){on(Ct,O);continue}dn=Xs(Ze,Cn,Lt,dn),dn!==Sa&&Cd(O,Ct,Lt,dn)}}cn(V.afterSanitizeAttributes,O,null)},di=function(O){let se=null;const we=Ys(O);for(cn(V.beforeSanitizeShadowDOM,O,null);se=we.nextNode();)if(cn(V.uponSanitizeShadowNode,se,null),ui(se,O),Na(se),Zr(se.content)&&di(se.content),(N?N(se):se.nodeType)===Zn.element){const Ze=b(se);Zr(Ze)&&($e(Ze),di(Ze))}cn(V.afterSanitizeShadowDOM,O,null)},$e=function(O){const se=[{node:O,shadow:null}];for(;se.length>0;){const we=se.pop();if(we.shadow){di(we.shadow);continue}const He=we.node,at=(N?N(He):He.nodeType)===Zn.element,Ct=v(He);if(Ct)for(let Lt=Ct.length-1;Lt>=0;--Lt)se.push({node:Ct[Lt],shadow:null});if(at){const Lt=E?E(He):null;if(typeof Lt=="string"&&It(Lt)==="template"){const un=He.content;Zr(un)&&se.push({node:un,shadow:null})}}if(at){const Lt=b(He);Zr(Lt)&&se.push({node:null,shadow:Lt},{node:Lt,shadow:null})}}};return t.sanitize=function(Ie){let O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,we=null,He=null,Ze=null;if(Un=!Ie,Un&&(Ie="<!-->"),typeof Ie!="string"&&!ci(Ie)&&(Ie=kG(Ie),typeof Ie!="string"))throw pi("dirty is not a string, aborting");if(!t.isSupported)return Ie;z?(pe=re,De=le):Or(O),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(pe=An(pe)),V.uponSanitizeAttribute.length>0&&(De=An(De)),t.removed=[];const at=ye&&typeof Ie!="string"&&ci(Ie);if(at){Vi(Ie);const un=E?E(Ie):Ie.nodeName;if(typeof un=="string"){const Cn=It(un);if(!pe[Cn]||Oe[Cn])throw Qr(Ie),pi("root node is forbidden and cannot be sanitized in-place")}if(ln(Ie))throw Qr(Ie),pi("root node is clobbered and cannot be sanitized in-place");try{$e(Ie)}catch(Cn){throw Qr(Ie),Cn}}else if(ci(Ie))se=Ks("<!---->"),we=se.ownerDocument.importNode(Ie,!0),we.nodeType===Zn.element&&we.nodeName==="BODY"||we.nodeName==="HTML"?se=we:se.appendChild(we),$e(we);else{if(!ze&&!Be&&!W&&Ie.indexOf("<")===-1)return T&&Ke?K(Ie):Ie;if(se=Ks(Ie),!se)return ze?null:Ke?R:""}se&&Se&&bn(se.firstChild);const Ct=at?Ie:se;try{const un=Ys(Ct);for(;He=un.nextNode();)ui(He,Ct),Na(He),Zr(He.content)&&di(He.content)}catch(un){throw at&&(Qr(Ie),ts(t.removed,Cn=>{Cn.element&&cr(Cn.element)})),un}if(at)return ts(t.removed,un=>{un.element&&cr(un.element)}),Be&&Sn(Ie),Ie;if(ze){if(Be&&Sn(se),Ve)for(Ze=Q.call(se.ownerDocument);se.firstChild;)Ze.appendChild(se.firstChild);else Ze=se;return(De.shadowroot||De.shadowrootmode)&&(Ze=Y.call(r,Ze,!0)),Ze}let Lt=W?se.outerHTML:se.innerHTML;return W&&pe["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&hn(MG,se.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
104
- `+Lt),Be&&(Lt=Xr(Lt)),T&&Ke?K(Lt):Lt},t.setConfig=function(){let Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Or(Ie),z=!0,re=pe,le=De},t.clearConfig=function(){lr=null,z=!1,re=null,le=null,T=D,R=""},t.isValidAttribute=function(Ie,O,se){lr||Or({});const we=It(Ie),He=It(O);return Il(we,He,se)},t.addHook=function(Ie,O){typeof O=="function"&&mn(V,Ie)&&ns(V[Ie],O)},t.removeHook=function(Ie,O){if(mn(V,Ie)){if(O!==void 0){const se=pG(V[Ie],O);return se===-1?void 0:hG(V[Ie],se,1)[0]}return ES(V[Ie])}},t.removeHooks=function(Ie){mn(V,Ie)&&(V[Ie]=[])},t.removeAllHooks=function(){V=DS()},t}var FG=OA();let H0=null;function BG(){return H0||(H0=vj(()=>import("./mermaid.core-D4tbD1m5.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})),H0}function PS(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let FS=0;function zG(){return FS+=1,"pave-canvas-"+FS}function UG({source:e}){const t=h.useRef(null),n=h.useRef(zG()),[r,a]=h.useState(null),[i,s]=h.useState(PS());return h.useEffect(function(){if(typeof window>"u")return;const l=new MutationObserver(function(){const c=PS();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),BG().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 qG({source:e}){const t=h.useMemo(function(){return FG.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return o.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function $G({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 HG({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=o.jsx(UG,{source:e.source}):e.type==="svg"?t=o.jsx(qG,{source:e.source}):e.type==="katex"?t=o.jsx($G,{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 BS({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(HG,{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 WG(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function VG(e,t){const n=WG(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}const cv={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function uv(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function dv(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}const zS={"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},GG=128e3;function W0(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 KG({messages:e,isBusy:t,activeModel:n,sessionModel:r,isPrivateMode:a,registryEntries:i}){var Y,V;var{t:s}=mt();const l=e.filter(j=>{var $;return(($=j.info)==null?void 0:$.role)==="user"}).length,c=e.filter(j=>{var $;return(($=j.info)==null?void 0:$.role)==="assistant"}).length;let u=0,d=0,f=0,g=null,p=null;for(let j=e.length-1;j>=0;j--){const $=e[j];if(((Y=$.info)==null?void 0:Y.role)==="assistant"&&((V=$.info)==null?void 0:V.mode)!=="compaction"){const ce=$.info.tokens;if(ce&&(ce.input||ce.output)){!g&&$.info.modelID&&(g=$.info.modelID),u=ce.lastInput??ce.input??0,d=ce.lastOutput??ce.output??0,f=ce.lastReasoning??ce.reasoning??0,$.info.contextLimit&&(p=$.info.contextLimit);break}}}const m=W0(u),y=W0(d),v=W0(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:E}=VG(k,g),w=null;if(a){N="privacy",E="privacy";let j=null;typeof r=="string"&&r?j=r.includes("/")?r.split("/").pop():r:r&&r.modelID&&(j=r.modelID),w=j||(n?String(n).split("/").pop():null)}else g&&E&&g!==E&&(w=g);const T=h.useMemo(()=>{const j={};if(i&&i.length>0){for(const $ of i)if($.limit&&typeof $.limit.context=="number"&&$.limit.context>0){j[$.key]=$.limit.context;const ce=$.key.includes("/")?$.key.split("/").pop():$.key;ce&&(j[ce]=$.limit.context)}}return j},[i]),R=g||N,A=!!(g&&E&&g!==E)&&(T[k]||T[N]||zS[N])||p||T[R]||T[k]||zS[R]||GG,q=Math.min(100,Math.round(m/A*100));let U="bg-green-500";q>=90?U="bg-red-500":q>=75?U="bg-orange-500":q>=50&&(U="bg-yellow-500");const K="border-gray-200 dark:border-gray-800",P="text-gray-500 dark:text-gray-400",M="text-gray-500 dark:text-gray-400",C="text-gray-700 dark:text-gray-300",L="border-gray-100 dark:border-gray-800";return o.jsxs("div",{className:`p-4 border-t ${K}`,children:[o.jsx("p",{className:`text-xs ${P} 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 ${M}`,children:s("token_usage.messages")}),o.jsx("span",{className:`text-xs font-medium ${C}`,children:l+c})]}),N&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.model")}),o.jsx("span",{className:`text-xs font-medium ${C} truncate ml-2 max-w-[140px]`,children:US(N)})]}),w&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.originally")}),o.jsx("span",{className:`text-xs ${M} truncate ml-2 max-w-[140px]`,children:US(w)})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,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 ${C}`,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 ${M}`,children:"Context"}),o.jsxs("span",{className:`text-xs ${M}`,children:[q,"% of ",(A/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 ${U} transition-all duration-300`,style:{width:`${q}%`}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Input"}),o.jsx("span",{className:`text-xs font-medium ${C} tabular-nums`,children:m.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Output"}),o.jsx("span",{className:`text-xs font-medium ${C} 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 ${M}`,children:"Reasoning"}),o.jsx("span",{className:`text-xs font-medium ${C} 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 ${M}`,children:"Tokens"}),o.jsx("span",{className:`text-xs ${M}`,children:"--"})]})]})]})}function US(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 YG({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:i}){const{t:s}=mt(),[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 E=g.current.length;if(!E)return N;const w=typeof N=="number"?N:-1;let T=w;return k.key==="ArrowDown"?T=w<E-1?w+1:0:k.key==="ArrowUp"?T=w>0?w-1:E-1:k.key==="Home"?T=0:k.key==="End"&&(T=E-1),g.current[T]&&g.current[T].focus(),T}))}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=QG(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,E=!!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:T=>{g.current[k]=T},tabIndex:d===k?0:-1,role:"menuitemradio","aria-checked":N||!m&&E,onClick:()=>x(b.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(N||!m&&E?"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}),E&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",s("model_selector.default_label"),")"]})]},b.key)})]})]})}function QG(e,t,n,r){return e?qS(e,n):t?qS(t,n):r("model_selector.default_label")}function XG(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 qS(e,t){if(!e)return"";const n=XG(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function ZG(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 Ub();f(w||[])}catch{}finally{m(!1)}},[]);h.useEffect(function(){x()},[x]),h.useEffect(function(){if(!l)return;function w(T){y.current&&!y.current.contains(T.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,E=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"})}),E>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:E})]}),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 T=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,T)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(T?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!T,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(T?"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 JG({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 eK({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 tK({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 nK({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 rK({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 aK({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 iK({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 sK({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 oK({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 lK({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 cK({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 uK({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 dK({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 fK({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 gK({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 $S={gmail:eK,gdrive:tK,discord:nK,whatsapp:rK,wrike:aK,gtasks:iK,mailchimp:sK,bamboohr:oK,pandadoc:lK,exa:cK,dropbox:uK,freshbooks:dK,gcal:fK,docx2md:gK};function pK(e){return Object.prototype.hasOwnProperty.call($S,e)?$S[e]:JG}const HS={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 hK({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 mK({skill:e,onClose:t,onSaved:n}){var{t:r}=mt(),a=kl(),[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 R=!1;async function D(){try{var A=await _B(e.name);if(R)return;v(A);for(var q=Object.create(null),U=Object.keys(A.tokens||{}),K=0;K<U.length;K++){var P=U[K],M=A.tokens[P]||{},C=M.env||P;q[C]=""}s(q),c(!1)}catch(L){R||(g(L.message),c(!1))}}return D(),function(){R=!0}},[e.name]);var x=h.useMemo(function(){if(!y||!y.tokens)return null;for(var R=Object.keys(y.tokens),D=0;D<R.length;D++){var A=y.tokens[R[D]]||{};if(A.description&&A.description.includes("OAuth")){for(var q=null,U=null,K=null,P=Object.entries(y.tokens),M=0;M<P.length;M++){var C=P[M][0];C.includes("REFRESH_TOKEN")&&(q=C),(C.includes("CLIENT_ID")||C.includes("APP_KEY"))&&(U=C),(C.includes("CLIENT_SECRET")||C.includes("APP_SECRET"))&&(K=C)}if(q&&U){var L=y.tokens[q]&&y.tokens[q].configured,F=y.tokens[U]&&y.tokens[U].configured,Q=K&&y.tokens[K]&&y.tokens[K].configured,S="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?S="Google":e.name==="dropbox"?S="Dropbox":e.name==="freshbooks"&&(S="FreshBooks"),{provider:S,canConnect:F&&Q&&!L,refreshConfigured:L,clientIdConfigured:F,clientSecretConfigured:Q}}}}return null},[y,e.name]),b=h.useCallback(async function(){g(null),m(!0);try{var R=await AB(e.name),D=600,A=700,q=(window.screen.width-D)/2,U=(window.screen.height-A)/2,K=window.open(R.authorizeUrl,"oauth_popup","width="+D+",height="+A+",left="+q+",top="+U+",scrollbars=yes");if(K)var P=setInterval(function(){K.closed&&(clearInterval(P),m(!1),n())},500);else g("Popup blocked. Please allow popups or visit: "+R.authorizeUrl),m(!1)}catch(M){g(M.message),m(!1)}},[e.name,n]),k=h.useCallback(async function(){g(null),d(!0);try{for(var R=Object.create(null),D=Object.keys(i),A=0;A<D.length;A++){var q=D[A];i[q]&&i[q].trim()&&(R[q]=i[q].trim())}if(Object.keys(R).length===0){g(r("skills.enter_token")),d(!1);return}await SB(e.name,R),n()}catch(U){g(U.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 CB(e.name),n()}catch(R){g(R.message)}finally{d(!1)}}},[e.name,n,a,r]),E=h.useCallback(function(R,D){s(function(A){var q=Object.assign(Object.create(null),A);return q[R]=D,q})},[]),w=y?Object.entries(y.tokens||{}).map(function(R){var D=R[0],A=R[1],q=A&&A.env||D;return{name:D,env:q,description:A.description,configured:A.configured,maskedValue:A.maskedValue}}):[],T=h.useRef(null);return h.useEffect(function(){function R(D){D.key==="Escape"&&t()}return document.addEventListener("keydown",R),T.current&&T.current.focus(),function(){document.removeEventListener("keydown",R)}},[t]),o.jsx("div",{ref:T,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(R){R.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(R){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[R.env,R.configured&&o.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:R.maskedValue}),")"]})]}),R.description&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R.description}),o.jsx("input",{type:"password",placeholder:R.configured?r("skills.leave_blank"):r("skills.enter_value"),value:i[R.env]||"",onChange:function(D){E(R.env,D.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"})]},R.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 yK({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:i,onUpdate:s,onUninstall:l,skillDefaultEnabled:c,onToggleDefault:u,t:d}){var f=pK(e.name),g=Object.prototype.hasOwnProperty.call(HS,e.name)?HS[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(hK,{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 xK({onBack:e}){var{t}=mt(),[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,E]=h.useState(null),[w,T]=h.useState(!1),[R,D]=h.useState(Object.create(null)),A=kl(),q=h.useCallback(async function(){l(!0),u(null),T(!1);try{var $=await Promise.allSettled([Ub(),kB(),uT()]),ce=$[0].status==="fulfilled"?$[0].value:[],J=$[1].status==="fulfilled"?$[1].value:[],_e=$[2].status==="fulfilled"?$[2].value.skillDefaults||{}:{};r(ce),i(J),D(_e);var ue=[];$[0].status==="rejected"&&ue.push(t("skills.load_installed_failed",{error:$[0].reason.message})),$[1].status==="rejected"&&ue.push(t("skills.load_marketplace_failed",{error:$[1].reason.message})),ue.length>0&&u(ue.join("; "))}catch(ne){u(ne.message)}finally{l(!1)}},[t]);h.useEffect(function(){q()},[q]);var U=[],K=new Set(n.map(function($){return $.name}));n.forEach(function($){U.push(Object.assign({},$,{_installed:!0}))}),a.forEach(function($){K.has($.name)||U.push(Object.assign({},$,{_installed:!1,allTokensConfigured:!1}))});var P=U;if(g==="installed"?P=U.filter(function($){return $._installed}):g==="available"&&(P=U.filter(function($){return!$._installed})),m){var M=m.toLowerCase();P=P.filter(function($){return $.name&&$.name.toLowerCase().indexOf(M)!==-1||$.description&&$.description.toLowerCase().indexOf(M)!==-1||$.category&&$.category.toLowerCase().indexOf(M)!==-1})}var C=h.useCallback(async function($){try{await wB($.name),q()}catch(ce){u(t("skills.install_failed",{error:ce.message}))}},[q,t]),L=h.useCallback(function($){f($)},[]),F=h.useCallback(async function($){if(await A({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:$.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await jB($.name),q()}catch(ce){u(t("skills.uninstall_failed",{error:ce.message}))}},[q,A,t]),Q=h.useCallback(function(){f(null),q()},[q]),S=h.useCallback(async function($,ce){D(function(_e){var ue=Object.assign({},_e);return ce?ue[$]=!0:delete ue[$],ue});try{var J={};J[$]=ce,await TB(J)}catch(_e){D(function(ue){var ne=Object.assign({},ue);return ce?delete ne[$]:ne[$]=!0,ne}),u(_e.message)}},[]),Y=h.useCallback(async function(){x(!0),u(null);try{var $=await NB(),ce=Object.create(null);($.skills||[]).forEach(function(J){ce[J.name]={hasUpdate:J.hasUpdate,latestVersion:J.latestVersion,currentVersion:J.currentVersion}}),k(ce),T(!0)}catch(J){u(J.message)}finally{x(!1)}},[]),V=h.useCallback(async function($){E($),u(null);try{var ce=await EB($);ce.updated&&(k(function(J){var _e=Object.assign(Object.create(null),J);return _e[$]={hasUpdate:!1,latestVersion:J[$]?J[$].latestVersion:null,currentVersion:J[$]?J[$].currentVersion:null},_e}),q())}catch(J){u(t("skills.update_failed")+": "+J.message)}finally{E(null)}},[q,t]),j=Object.values(b).filter(function($){return $&&$.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($){return!K.has($.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")]})}),j>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:j})}),w&&j===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($){return o.jsx("button",{onClick:function(){p($)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(g===$?"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_"+$)},$)})})]})]}),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($){y($.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&&P.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&&P.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map(function($){return o.jsx(yK,{skill:$,installed:$._installed,updateInfo:b[$.name],updatingSkill:N,onConfigure:L,onInstall:C,onUpdate:V,onUninstall:$._installed?F:null,skillDefaultEnabled:!!R[$.name],onToggleDefault:$._installed?S:null,t},$.name)})})]}),d&&o.jsx(mK,{skill:d,onClose:function(){f(null)},onSaved:Q})]})}const Ft="";function Bt(e,t={}){return fetch(e,{credentials:"include",...t})}async function bK(){const e=await Bt(Ft+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function vK(e){const t=await Bt(Ft+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function xx(e){const t=await Bt(Ft+"/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 bx(e){const t=await Bt(Ft+"/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 Ru(e,t){const n={};t&&t.clean&&(n.clean=!0);const r=await Bt(Ft+"/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 vx(e,t){const n={};t&&t.level&&(n.level=t.level),t&&t.span&&(n.span=t.span);const r=await Bt(Ft+"/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 kx(e){const t=await Bt(Ft+"/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 kK(e,t,n,r){const a={message:t,priority:n};r!=null&&(a.replyToInbox=r);const i=await Bt(Ft+"/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 _K(e,t,n){const r={message:t};n!=null&&(r.replyToInbox=n);const a=await Bt(Ft+"/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 wK(e,t){let n=Ft+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(n+="?refresh=true");const r=await Bt(n);if(!r.ok)throw new Error("Failed to fetch agent messages: "+r.statusText);return r.json()}async function EK(){const e=await Bt(Ft+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function NK(e){const t=await Bt(Ft+"/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 SK(){const e=await Bt(Ft+"/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 CK(e,t=!1){const n=Ft+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),r=await Bt(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 jK(e){const t=await Bt(Ft+"/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 DA(){const e=await Bt(Ft+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function fv(){const e=await Bt(Ft+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function TK(e,t){const n=await Bt(Ft+"/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 AK(e){const t=await Bt(Ft+"/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 RK(e,t){const n=await Bt(Ft+"/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 PA(e){const t=await Bt(Ft+"/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 MK(e,t){const n=new URLSearchParams,r=n.toString()?"?"+n.toString():"",a=await Bt(Ft+"/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 V0(){const e=await Bt(Ft+"/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 IK(){const e=await Bt(Ft+"/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 WS(){const e=await Bt(Ft+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function VS(e,t){const n=await Bt(Ft+"/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 GS(e){const t=await Bt(Ft+"/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 FA(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 LK(e){const t=FA(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 Sc(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function OK({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:Sc(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,E=r.top+i-b,w=E-k,T=w-N,R=FA(g.date),D=["S","M","T","W","T","F","S"][R.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:E,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:T,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:D}),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(T,w,E)-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(T,w,E)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:LK(g.date)}),o.jsxs("text",{x:m+c/2,y:Math.min(T,w,E)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Sc(y)]}),o.jsxs("text",{x:m+c/2,y:Math.min(T,w,E)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Sc(v)]}),o.jsxs("text",{x:m+c/2,y:Math.min(T,w,E)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Sc(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 DK({agentName:e,onClose:t,onToolPartsChange:n,hackerMode:r}){var{t:a}=mt(),[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),[E,w]=h.useState(!1),[T,R]=h.useState(!1),D=h.useRef(null),A=h.useRef(null),q=h.useRef(!0),U=h.useRef([]),K=h.useRef(null),P=h.useRef(null),M=h.useRef(null),C=h.useRef(null);h.useEffect(function(){U.current=i},[i]);var L=h.useCallback(async function(J,_e){if(e){_e!==!1&&c(!0);try{var ue=await wK(e,{refresh:!!J}),ne=ue.messages||[],Ce=U.current,ke=ne.length!==Ce.length;if(!ke&&ne.length>0&&Ce.length>0){var pe=ne[ne.length-1],me=Ce[Ce.length-1];if(pe.info.id!==me.info.id&&(ke=!0),!ke){var De=pe.parts||[],Ne=me.parts||[];if(De.length!==Ne.length)ke=!0;else for(var Ee=0;Ee<De.length&&!ke;Ee++){var Oe=De[Ee]||{},fe=Ne[Ee]||{},he=Oe.state?Oe.state.status:Oe.status,Le=fe.state?fe.state.status:fe.status;(Oe.id!==fe.id||he!==Le)&&(ke=!0)}}}ke&&s(ne.slice()),d(null)}catch(Z){console.error("Failed to load messages:",Z),d(Z.message)}finally{_e!==!1&&c(!1)}}},[e]);h.useEffect(function(){L(!0);var J=setInterval(function(){L(!0,!1)},5e3);return function(){clearInterval(J),P.current&&clearTimeout(P.current),C.current&&clearTimeout(C.current)}},[L]),h.useEffect(function(){q.current&&D.current&&D.current.scrollIntoView({behavior:"smooth"})},[i]);var F=h.useCallback(function(){var J=A.current;J&&(q.current=J.scrollHeight-J.scrollTop-J.clientHeight<50)},[]),Q=h.useMemo(function(){for(var J=null,_e=i.length-1;_e>=0;_e--)if(i[_e].info&&i[_e].info.role==="assistant"){J=i[_e];break}return J?(J.parts||[]).filter(function(ue){return ue.type==="tool"}):[]},[i]);h.useEffect(function(){n&&n(Q)},[Q,n]);var S=h.useCallback(async function(){if(!(!p.trim()||x)){b(!0),N(!1),w(!1),R(!1),d(null);try{await kK(e,p.trim(),"normal",y),m(""),N(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(function(){N(!1),g(!1),P.current=null},1500),C.current&&clearTimeout(C.current),C.current=setTimeout(function(){L(!0,!1),C.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,y,x,L]),Y=h.useCallback(async function(){if(!(!p.trim()||x)){if(!T){R(!0);return}b(!0),N(!1),w(!0),R(!1),d(null);try{await _K(e,p.trim(),y),m(""),N(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(function(){N(!1),g(!1),P.current=null},1500),C.current&&clearTimeout(C.current),C.current=setTimeout(function(){L(!0,!1),C.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,x,T,y,L]),V=h.useCallback(function(){g(!1),R(!1),d(null),P.current&&(clearTimeout(P.current),P.current=null),C.current&&(clearTimeout(C.current),C.current=null),N(!1)},[]);h.useEffect(function(){if(!f)return;function J(_e){_e.key==="Escape"&&!x&&V()}return document.addEventListener("keydown",J),function(){document.removeEventListener("keydown",J)}},[f,V,x]),h.useEffect(function(){if(!(!f||!M.current)){var J=M.current;J.contains(document.activeElement)||J.focus()}},[f]);var j=h.useCallback(function(J){J.target===J.currentTarget&&!x&&V()},[V,x]),$=h.useCallback(function(J){J.key==="Enter"&&!J.shiftKey&&!T&&(J.preventDefault(),S())},[S,T]),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(){q.current=!0,L(!0),D.current&&D.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 ${E?"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:E?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(E?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),o.jsx("div",{ref:A,onScroll:F,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(J){return o.jsx(fT,{message:J.info,parts:J.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:ce,hackerMode:r,hideThinking:!1},J.info.id)}),o.jsx("div",{ref:D})]})}),o.jsx("div",{className:"absolute bottom-6 right-6",children:o.jsxs("button",{onClick:function(){g(!0),R(!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:j,children:o.jsxs("div",{ref:M,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(J){v(J.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:K,value:p,onChange:function(J){m(J.target.value)},onKeyDown:$,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(E?"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:T?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(){R(!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&&E?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:S,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&&!E?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 PK({isOpen:e,agent:t,onClose:n,onUpdated:r,onDeleted:a}){const{t:i}=mt(),[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,E]=h.useState(""),[w,T]=h.useState(null),[R,D]=h.useState(!1),[A,q]=h.useState([]),[U,K]=h.useState([]),[P,M]=h.useState(!1),[C,L]=h.useState(!0),[F,Q]=h.useState(!1),[S,Y]=h.useState(!1),[V,j]=h.useState(null),[$,ce]=h.useState(!1),[J,_e]=h.useState(!1),[ue,ne]=h.useState("general"),[Ce,ke]=h.useState(!1);h.useEffect(()=>{const Z={cancelled:!1};if(e&&t&&!Ce){pe();const ve=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";me(Z,ve),ke(!0)}return e||(ke(!1),y(!1),p(""),L(!0),K([])),()=>{Z.cancelled=!0}},[e,t==null?void 0:t.name]);const pe=()=>{if(!t)return;l(t.displayName||t.name||""),u(t.cwd||"");const Z=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";f(Z),y(!1),p(""),x(Array.isArray(t.skills)?t.skills:[]),k(!!t.skipInitialPrompt)},me=async(Z,ve)=>{M(!0),L(!0),t!=null&&t.name&&Q(!0);const Re=[DA(),fv()];t!=null&&t.name&&Re.push(AK(t.name));const Be=await Promise.allSettled(Re);if(Z.cancelled)return;const[Ge,W,z]=Be;if(Ge.status==="fulfilled"?q(Ge.value):(console.error("Failed to load skills:",Ge.reason),q([])),M(!1),W.status==="fulfilled"){const re=W.value;K(re);const le=ve;re.find(Se=>Se.id===le)||(y(!0),p(le),f(le))}else console.error("Failed to load models:",W.reason),K([]);if(L(!1),t!=null&&t.name&&z){if(z.status==="fulfilled"){const re=z.value;E(re.content||""),T(re.path||null),D(re.exists||!1)}else console.error("Failed to load AGENTS.md:",z.reason),E(""),T(null),D(!1);Q(!1)}},De=Z=>{x(ve=>ve.includes(Z)?ve.filter(Re=>Re!==Z):[...ve,Z])},Ne=()=>{v.length===A.length?x([]):x(A.map(Z=>Z.name))},Ee=async Z=>{if(Z&&Z.preventDefault(),!!(t!=null&&t.name)){j(null),Y(!0);try{await TK(t.name,{displayName:s.trim()||t.name,workspace:c.trim(),model:d,skipInitialPrompt:b,skills:v}),w&&N!==null&&!Le&&await RK(t.name,N),r&&r(t.name),n()}catch(ve){j(ve.message)}finally{Y(!1)}}},Oe=async()=>{if(t!=null&&t.name){_e(!0),j(null);try{await CK(t.name,!0),a&&a(t.name),n()}catch(Z){j(Z.message),ce(!1)}finally{_e(!1)}}},fe=()=>{!S&&!J&&(j(null),ce(!1),ne("general"),n())};if(!e||!t)return null;const he=t.state==="working"||t.state==="idle"||t.state==="starting",Le=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:fe}),$&&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}),"?",he&&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:J,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:Oe,disabled:J,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:J?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,he&&o.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",i("agent_edit.running_warning"),")"]})]})]}),o.jsx("button",{onClick:fe,disabled:S||J,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:()=>ne("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${ue==="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:()=>ne("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${ue==="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:Z=>Z.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:()=>j(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"})})})]}),ue==="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:Z=>l(Z.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")}),he?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:Z=>u(Z.target.value),placeholder:i("agent_edit.working_dir_placeholder"),disabled:S||J,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"}),he?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")}),C?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")}):U.length===0?o.jsx("input",{type:"text",value:d,onChange:Z=>f(Z.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:Z=>{Z.target.value==="__custom__"?(y(!0),d&&d!=="__custom__"&&p(d)):(y(!1),f(Z.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 Z=dv(U);return Object.entries(Z).map(([ve,Re])=>o.jsx("optgroup",{label:cv[ve]||ve,children:Re.map(Be=>o.jsxs("option",{value:Be.id,children:[Be.name,uv(Be.tier)]},Be.id))},ve))})(),o.jsx("option",{value:"__custom__",children:i("agent_edit.custom_model")})]}),m&&o.jsx("input",{type:"text",value:g,onChange:Z=>{p(Z.target.value),f(Z.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:Z=>k(Z.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:Ne,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:v.length===A.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:P?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.loading_skills")}):A.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:A.map(Z=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${v.includes(Z.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(Z.name),onChange:()=>De(Z.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:Z.description,children:[Z.icon&&o.jsx("span",{className:"mr-1",children:Z.icon}),Z.name]})]},Z.name))})}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.skills_selected",{count:v.length})})]})]}),ue==="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,!R&&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")}),Le&&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:Z=>E(Z.target.value),disabled:!w||Le,rows:16,placeholder:i(F?"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:S||J,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:fe,disabled:S||J,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:Ee,disabled:S||J,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:S?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 KS={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"},YS={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 FK({state:e}){const t=KS[e]||KS.stopped,n=YS[e]||YS.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 BK(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 G0({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 hi({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 zK({agent:e,onClose:t,onAction:n,onToolPartsChange:r,hackerMode:a}){const{t:i}=mt(),[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 R=await vK(e.name);l(R),u(null)}catch(R){console.error("Failed to load agent:",R),u(R.message)}},[e==null?void 0:e.name]);h.useEffect(()=>{v();const R=setInterval(v,5e3);return()=>clearInterval(R)},[v]);const x=h.useCallback(async R=>{f(R),u(null);try{R==="start"?await xx(s.name):R==="stop"?await bx(s.name):R==="restart"?await Ru(s.name):R==="cleanRestart"?await Ru(s.name,{clean:!0}):R==="pause"?await vx(s.name,{level:"tools"}):R==="unpause"&&await kx(s.name),await v(),n&&n(s.name,R)}catch(D){u(D.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",E=(s==null?void 0:s.tokens)||{input:0,output:0,cached:0,total:0},w=Math.max(E.input,E.output,E.cached,1),T=(s==null?void 0:s.cost)||{input:0,output:0,cached:0,total:0};return g?o.jsx(DK,{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(FK,{state:(s==null?void 0:s.state)||"stopped"})]})]}),o.jsx(PK,{isOpen:m,agent:s,onClose:()=>y(!1),onUpdated:R=>{v(),n&&n(R,"updated")},onDeleted:R=>{n&&n(R,"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(hi,{label:i("agent_detail.model"),value:s==null?void 0:s.model,mono:!0}),o.jsx(hi,{label:i("agent_detail.port"),value:s==null?void 0:s.port,mono:!0}),o.jsx(hi,{label:i("agent_detail.pid"),value:s==null?void 0:s.pid,mono:!0}),o.jsx(hi,{label:i("agent_detail.session_id"),value:s!=null&&s.sessionId?s.sessionId.slice(0,12)+"...":null,mono:!0}),o.jsx(hi,{label:i("agent_detail.uptime"),value:BK(s==null?void 0:s.startedAt)}),o.jsx(hi,{label:i("agent_detail.iteration"),value:s==null?void 0:s.iteration}),o.jsx(hi,{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(G0,{label:i("agent_detail.token_input"),value:E.input,max:w,color:"bg-blue-500"}),o.jsx(G0,{label:i("agent_detail.token_output"),value:E.output,max:w,color:"bg-green-500"}),o.jsx(G0,{label:i("agent_detail.token_cached"),value:E.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:E.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:["$",T.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:["$",T.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:["$",T.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:["$",T.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(OK,{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 PA(s.name)}catch(R){u(i("agents.export_error")+": "+R.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 Cc=["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"],jc=["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 QS(e=[],t=100){const n=new Set(e.map(s=>s.toLowerCase()));for(let s=0;s<t;s++){const l=Cc[Math.floor(Math.random()*Cc.length)],c=jc[Math.floor(Math.random()*jc.length)],u=`${l}-${c}`;if(!n.has(u))return u}const r=Cc[Math.floor(Math.random()*Cc.length)],a=jc[Math.floor(Math.random()*jc.length)],i=Math.floor(Math.random()*1e3);return`${r}-${a}-${i}`}function XS(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 UK(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const Tc=`# AGENTS.md - AI Agent Instructions
105
-
106
- ## Overview
107
- You are an autonomous AI agent. Your goal is to help users accomplish tasks efficiently.
108
-
109
- ## Guidelines
110
- - Be helpful and accurate
111
- - Ask for clarification when needed
112
- - Use available tools appropriately
113
- - Report progress on long-running tasks
114
-
115
- ## Constraints
116
- - Do not make changes without user approval for destructive operations
117
- - Follow security best practices
118
- - Respect rate limits and resource constraints
119
- `;function qK({isOpen:e,onClose:t,existingAgentNames:n=[],onCreated:r}){const{t:a}=mt(),[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(Tc),[k,N]=h.useState([]),[E,w]=h.useState(!1),[T,R]=h.useState([]),[D,A]=h.useState([]),[q,U]=h.useState(!1),[K,P]=h.useState(!0),[M,C]=h.useState({}),[L,F]=h.useState(!1),[Q,S]=h.useState(null);h.useEffect(()=>{const ue={cancelled:!1};return e?(s(QS(n)),c(""),d(""),g("github-copilot/claude-opus-4.6"),m(""),v(!1),b(Tc),N([]),w(!1),C({}),F(!1),S(null),Y(ue,"github-copilot/claude-opus-4.6")):(P(!0),A([])),()=>{ue.cancelled=!0}},[e]);const Y=async(ue,ne)=>{U(!0),P(!0);const[Ce,ke]=await Promise.allSettled([DA(),fv()]);if(!ue.cancelled){if(Ce.status==="fulfilled"?R(Ce.value):(console.error("Failed to load skills:",Ce.reason),R([])),U(!1),ke.status==="fulfilled"){const pe=ke.value;A(pe),pe.find(me=>me.id===ne)||(v(!0),m(ne))}else console.error("Failed to load models:",ke.reason),A([]);P(!1)}},V=()=>{const ue=QS(n);s(ue),C(ne=>({...ne,name:null}))},j=ue=>{const ne=ue.target.value;s(ne);const Ce=XS(ne,n);Ce.valid?C(ke=>({...ke,name:null})):C(ke=>({...ke,name:Ce.error}))},$=ue=>{N(ne=>ne.includes(ue)?ne.filter(Ce=>Ce!==ue):[...ne,ue])},ce=()=>{k.length===T.length?N([]):N(T.map(ue=>ue.name))},J=async ue=>{ue&&ue.preventDefault(),S(null);const ne={},Ce=XS(i,n);if(Ce.valid||(ne.name=Ce.error),u.trim()||(ne.workspace=a("agent_create.validate_workspace")),f||(ne.model=a("agent_create.validate_model")),Object.keys(ne).length>0){C(ne);return}F(!0);try{const ke={name:UK(i),displayName:l.trim()||null,workspace:u.trim(),model:f,soul:x.trim()||null,skills:k,skipInitialPrompt:E},pe=await jK(ke);s(""),c(""),d(""),g("github-copilot/claude-opus-4.6"),b(Tc),N([]),w(!1),C({}),r&&r(pe.agent),t()}catch(ke){S(ke.message)}finally{F(!1)}},_e=()=>{L||(C({}),S(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:_e}),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:_e,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:ue=>ue.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[Q&&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:Q}),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:j,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 ${M.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")]})]}),M.name&&o.jsx("p",{className:"mt-1 text-sm text-red-500",children:M.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:ue=>c(ue.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:ue=>d(ue.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 ${M.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`}),M.workspace&&o.jsx("p",{className:"mt-1 text-xs text-red-500",children:M.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")}),K?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")}):D.length===0?o.jsx("input",{type:"text",value:f,onChange:ue=>g(ue.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 ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`}):o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:y?"__custom__":f,onChange:ue=>{ue.target.value==="__custom__"?(v(!0),f&&f!=="__custom__"&&m(f)):(v(!1),g(ue.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 ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`,children:[(()=>{const ue=dv(D);return Object.entries(ue).map(([Ce,ke])=>o.jsx("optgroup",{label:cv[Ce]||Ce,children:ke.map(pe=>o.jsxs("option",{value:pe.id,children:[pe.name,uv(pe.tier)]},pe.id))},Ce))})(),o.jsx("option",{value:"__custom__",children:a("agent_create.custom_model")})]}),y&&o.jsx("input",{type:"text",value:p,onChange:ue=>{m(ue.target.value),g(ue.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 ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`})]}),M.model&&o.jsx("p",{className:"mt-1 text-sm text-red-500",children:M.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:E,onChange:ue=>w(ue.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===T.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:q?o.jsx("div",{className:"text-center py-4 text-gray-500",children:a("agent_create.loading_skills")}):T.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:T.map(ue=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${k.includes(ue.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(ue.name),onChange:()=>$(ue.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:ue.description,children:[ue.icon&&o.jsx("span",{className:"mr-1",children:ue.icon}),ue.name]})]},ue.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(Tc),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:a("agent_create.reset_default")})]}),o.jsx("textarea",{value:x,onChange:ue=>b(ue.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:_e,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:J,disabled:L||!!M.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 ZS="pave-agents-panel-collapsed",JS={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"},eC={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"})})},$K="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",HK="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";function WK({state:e}){const t=JS[e]||JS.stopped,n=eC[e]||eC.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 VK(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 GK({agent:e,onAction:t,onSelect:n,onExport:r,actionLoading:a,isSelected:i,onToggleSelect:s}){const{t:l}=mt(),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(WK,{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:VK(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:$K}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:HK})]})})]})]})}function KK({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 YK({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}=mt(),[p,m]=h.useState([]),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,N]=h.useState(null),[E,w]=h.useState(null),[T,R]=h.useState(null),[D,A]=h.useState(null),[q,U]=h.useState(!1),[K,P]=h.useState(new Set),[M,C]=h.useState(null),[L,F]=h.useState(()=>{if(typeof window>"u")return!1;try{return localStorage.getItem(ZS)==="true"}catch{return!1}}),Q=h.useMemo(()=>Array.isArray(M)?M.length===0?M:!a&&M.every(re=>re.state&&re.state.status==="completed"||re.state&&re.state.status==="error")?[]:M:null,[M,a]),S=h.useRef(null),Y=h.useRef(!0);h.useEffect(()=>()=>{Y.current=!1,j.current&&clearTimeout(j.current)},[]),h.useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(ZS,L?"true":"false")}catch{}},[L]);const V=h.useRef(!1),j=h.useRef(null),$=h.useCallback(async z=>{if(S.current)return z?(V.current=!0,S.current.then(()=>S.current||Promise.resolve())):S.current;const re=(async()=>{let le=!1;try{const Se=await bK();if(!Y.current)return le;const ze=Array.isArray(Se)?Se:[];m(ze),A(Ve=>Ve&&(ze.find(ot=>ot.name===Ve.name)||null)),w(null),le=!0}catch(Se){if(!Y.current)return le;console.error("Failed to load agents:",Se),w(Se.message)}finally{Y.current&&v(!1),S.current=null,V.current&&Y.current&&(V.current=!1,$())}return le})();return S.current=re,re},[]),ce=h.useCallback(async()=>{if(!Y.current)return;b(!0),N(null),j.current&&(clearTimeout(j.current),j.current=null);let z=!1;try{const[re]=await Promise.all([$(!0),new Promise(le=>{setTimeout(le,400)})]);z=re===!0}catch{z=!1}finally{Y.current&&(b(!1),N(z?"success":"error"),j.current=setTimeout(()=>{Y.current&&N(null),j.current=null},1e3))}},[$]);h.useEffect(()=>{$();const z=setInterval($,5e3);return()=>clearInterval(z)},[$]),h.useEffect(()=>{if(!n||p.length===0)return;const z=p.find(re=>re.name===n);z&&(A(z),C(null),t&&t(z),r&&r())},[n,p,t,r]);const J=h.useCallback(async(z,re)=>{R({name:z,action:re}),w(null);try{re==="start"?await xx(z):re==="stop"?await bx(z):re==="restart"?await Ru(z):re==="pause"?await vx(z,{level:"iterations"}):re==="unpause"&&await kx(z),await $(!0)}catch(le){w(le.message)}finally{R(null)}},[$]),_e=p.reduce((z,re)=>{var le;return z+(((le=re.cost)==null?void 0:le.total)||0)},0),ue=h.useCallback(z=>{A(z),C(null),t&&t(z)},[t]),ne=h.useCallback(()=>{A(null),C(null)},[]),Ce=h.useCallback(z=>{P(re=>{const le=new Set(re);return le.has(z)?le.delete(z):le.add(z),le})},[]),ke=h.useCallback(()=>{P(new Set(p.map(z=>z.name)))},[p]),pe=h.useCallback(()=>{P(new Set)},[]),me=h.useCallback(async z=>{var le;if(K.size===0)return;w(null);const re=[...K];try{const ze=(await Promise.allSettled(re.map(async Ve=>{z==="pause"?await vx(Ve,{level:"iterations"}):z==="unpause"?await kx(Ve):z==="stop"?await bx(Ve):z==="restart"?await Ru(Ve):z==="start"&&await xx(Ve)}))).filter(Ve=>Ve.status==="rejected");ze.length>0&&w(((le=ze[0].reason)==null?void 0:le.message)||"Some actions failed"),await $(!0)}catch(Se){w(Se.message)}},[K,$]),De=h.useCallback(()=>{$(!0)},[$]),Ne=h.useCallback(z=>{$(!0),z&&A(z)},[$]),[Ee,Oe]=h.useState(!1),[fe,he]=h.useState(null),Le=h.useRef(null);h.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current)},[]);const Z=h.useCallback(async z=>{try{await PA(z)}catch(re){w(g("agents.export_error")+": "+re.message)}},[g]),ve=h.useCallback(async z=>{try{he(null),await MK(z),he({type:"success",message:g("agents.import_success")}),$(!0),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{he(re=>re&&re.type==="success"?null:re),Le.current=null},5e3)}catch(re){he({type:"error",message:g("agents.import_error")+": "+re.message})}},[g,$]),Re=h.useCallback(()=>{const z=document.createElement("input");z.type="file",z.accept=".yaml,.yml",z.onchange=re=>{const le=re&&re.target&&re.target.files,Se=le&&le[0];if(!Se)return;const ze=Se.name.toLowerCase();if(!ze.endsWith(".yaml")&&!ze.endsWith(".yml")){he({type:"error",message:g("agents.import_invalid_file")});return}if(Se.size>10*1024*1024){he({type:"error",message:g("agents.import_file_too_large")});return}const Ve=new FileReader;Ve.onload=Ke=>{const ot=Ke&&Ke.target?Ke.target.result:null;typeof ot=="string"&&ve(ot)},Ve.onerror=()=>{he({type:"error",message:g("agents.import_read_error")})},Ve.readAsText(Se)},z.click()},[g,ve]),Be=h.useCallback(z=>{z.preventDefault(),z.stopPropagation(),Oe(!0)},[]),Ge=h.useCallback(z=>{z.preventDefault(),z.stopPropagation();const re=z.relatedTarget;(!re||!z.currentTarget.contains(re))&&Oe(!1)},[]),W=h.useCallback(z=>{z.preventDefault(),z.stopPropagation(),Oe(!1);const re=z.dataTransfer&&z.dataTransfer.files,le=re&&re[0];if(!le)return;const Se=le.name.toLowerCase();if(!Se.endsWith(".yaml")&&!Se.endsWith(".yml")){he({type:"error",message:g("agents.import_invalid_file")});return}if(le.size>10*1024*1024){he({type:"error",message:g("agents.import_file_too_large")});return}const ze=new FileReader;ze.onload=Ve=>{const Ke=Ve&&Ve.target?Ve.target.result:null;typeof Ke=="string"&&ve(Ke)},ze.onerror=()=>{he({type:"error",message:g("agents.import_read_error")})},ze.readAsText(le)},[g,ve]);return D?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:()=>F(z=>!z),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(z=>{const re=z.name===D.name,le=z.state==="working"||z.state==="idle";return o.jsx("button",{onClick:()=>ue(z),className:"p-0.5 rounded-full",title:z.displayName||z.name,"aria-label":z.displayName||z.name,children:o.jsx("div",{className:`w-3 h-3 rounded-full ${re?"ring-2 ring-primary-500 bg-primary-400":le?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`})},z.name)})}):o.jsx("div",{className:"space-y-1",children:p.map(z=>{const re=z.name===D.name,le=z.state==="working"||z.state==="idle";return o.jsx("button",{onClick:()=>ue(z),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${re?"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:z.displayName||z.name})]})},z.name)})})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(zK,{agent:D,onClose:ne,onAction:De,onToolPartsChange:C,hackerMode:a})}),Array.isArray(Q)&&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:z=>{z.preventDefault();const re=z.clientX,le=c,Se=Ve=>{const Ke=re-Ve.clientX,ot=Math.min(f,Math.max(d,le+Ke));u&&u(ot)},ze=()=>{document.removeEventListener("mousemove",Se),document.removeEventListener("mouseup",ze)};document.addEventListener("mousemove",Se),document.addEventListener("mouseup",ze)}}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:a?o.jsx(yT,{toolParts:Q,matrixMode:i,onToggleMatrix:l,darkMode:s}):o.jsx(hT,{toolParts:Q})})]})]}):o.jsxs("div",{className:"h-full flex flex-col relative",onDragOver:Be,onDragLeave:Ge,onDrop:W,children:[Ee&&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:Re,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:()=>U(!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(KK,{agents:p,totalCost:_e}),E&&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:E}),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"})})})]}),fe&&o.jsxs("div",{className:`mx-6 mt-4 px-4 py-2 text-sm rounded-lg flex items-center justify-between ${fe.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:fe.message}),o.jsx("button",{onClick:()=>he(null),"aria-label":g("common.close")||"Close",title:g("common.close")||"Close",className:`ml-2 ${fe.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:()=>U(!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:[K.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:K.size})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>me("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:()=>me("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:()=>me("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:()=>me("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:()=>me("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:ke,className:"px-2 py-1 text-xs text-primary-600 dark:text-primary-400 hover:underline",children:g("agents.selectAll")}),o.jsx("button",{onClick:pe,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(z=>o.jsx(GK,{agent:z,onAction:J,onSelect:ue,onExport:Z,actionLoading:T,isSelected:K.has(z.name),onToggleSelect:Ce},z.name))})]})}),o.jsx(qK,{isOpen:q,onClose:()=>U(!1),existingAgentNames:p.map(z=>z.name),onCreated:Ne})]})}let Nr=null;function BA(){if(Nr&&Nr.state==="closed"&&(Nr=null),!Nr){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{Nr=new e}catch(t){throw Nr=null,t}}return Nr.state==="suspended"&&Nr.resume().catch(()=>{}),Nr}if(typeof document<"u"){const e=async()=>{let t;try{t=BA()}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"&&(Nr=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function zA(){let e;try{e=BA()}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(()=>{}),Nr=null}}function UA(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function QK(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const qA="pave-native-notifications";function Rl(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function XK(){return Rl()?Notification.permission:"unsupported"}function pl(){if(!Rl()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(qA)==="true"}catch{return!1}}function ZK(e){try{localStorage.setItem(qA,e?"true":"false")}catch{}}async function JK(){if(!Rl())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function $A({title:e,body:t,tag:n,icon:r,onClick:a}){if(!Rl()||Notification.permission!=="granted"||!pl())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 HA="pave-push-notifications",eY="/sw.js";function wd(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function tY(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function nY(){try{return localStorage.getItem(HA)==="true"}catch{return!1}}function Mu(e){try{localStorage.setItem(HA,e?"true":"false")}catch{}}function K0(){return typeof Notification>"u"?"unsupported":Notification.permission}async function rY(){if(!wd())return null;try{return await navigator.serviceWorker.register(eY,{scope:"/"})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function aY(){if(!wd())return console.warn("[web-push] Not supported in this browser"),!1;const e=await rY();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=uY(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=cY(a,t)}if(r)return await tC(n),Mu(!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 tC(n),Mu(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function iY(){if(!wd())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 Mu(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),Mu(!1),!1}}async function tC(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:nC(e.getKey("p256dh")),auth:nC(e.getKey("auth"))}},await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function sY(){const e=await fetch("/api/push/test",{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function oY(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 lY(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 cY(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 uY(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 nC(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 Y0=["AI Model & Provider","Prefill Fallback","Models","LM Studio","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp"],rC={"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 dY({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 fY=["__proto__","constructor","prototype"];function Q0(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function gY(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 WA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function aC(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=WA(n);t[r]=n}return t}function iC(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=WA(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 pY({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(Q0()),[y,v]=h.useState(null),[x,b]=h.useState(!1),[k,N]=h.useState(null);h.useEffect(function(){var P=!1;return s(!0),WS().then(function(M){P||(a(M),s(!1))}).catch(function(M){P||(c(M.message),s(!1))}),function(){P=!0}},[]);var E=h.useCallback(function(){s(!0),c(null),WS().then(function(P){a(P),s(!1)}).catch(function(P){c(P.message),s(!1)})},[]);function w(P,M,C){var L=(P||"").trim();return L?fY.indexOf(L)!==-1?n("settings.model_registry.error_name_reserved",{name:L}):L!==C&&M.indexOf(L)!==-1?n("settings.model_registry.error_name_exists",{name:L}):null:n("settings.model_registry.error_name_required")}var T=h.useCallback(async function(){if(r){var P=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),M=w(f,P,null);if(M){N(M);return}b(!0),N(null);try{await VS(f.trim(),aC(p)),d(!1),g(""),m(Q0()),E(),t&&t(e)}catch(C){N(C.message)}finally{b(!1)}}},[f,p,r,t,e,E]),R=h.useCallback(async function(P){b(!0),N(null);try{await GS(P),E(),t&&t(e)}catch(M){N(M.message)}finally{b(!1)}},[t,e,E]),D=h.useCallback(async function(){if(!(!y||!r)){var P=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),M=w(y.name,P,y.originalName);if(M){N(M);return}b(!0),N(null);try{var C=y.name.trim(),L=aC(y.config);if(await VS(C,L),C!==y.originalName)try{await GS(y.originalName)}catch(F){N(n("settings.model_registry.error_rename_cleanup",{error:F.message}))}v(null),E(),t&&t(e)}catch(F){N(F.message)}finally{b(!1)}}},[y,r,t,e,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 A=r&&r.user?r.user:{},q=r&&r.builtin?r.builtin:{},U=Object.keys(A),K=Object.keys(q);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}),K.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:K.map(function(P){var M=q[P];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:P}),M.provider&&o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:M.provider}),M.limit&&M.limit.context&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:M.limit.context/1e3})}),M.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:M.tier})]},P)})})]}),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(Q0()),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")})]}),U.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:[U.map(function(P){var M=A[P];return y&&y.originalName===P?o.jsx(iC,{name:y.name,config:y.config,setName:function(C){v(function(L){return L&&Object.assign({},L,{name:C})})},setConfig:function(C){v(function(L){if(!L)return L;var F=typeof C=="function"?C(L.config):C;return Object.assign({},L,{config:F})})},onSave:D,onCancel:function(){v(null),N(null)},saving:x,isNew:!1,t:n},P):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:P}),M.displayName&&M.displayName!==P&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",M.displayName,")"]}),M.url&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",M.url]}),!M.url&&M.target&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",M.target]}),M.limit&&M.limit.context&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:M.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:P,name:P,config:gY(M)}),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:P}))&&R(P)},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"})})})]})]},P)}),u&&o.jsx(iC,{name:f,config:p,setName:g,setConfig:function(P){m(function(M){return typeof P=="function"?P(M):P})},onSave:T,onCancel:function(){d(!1),N(null)},saving:x,isNew:!0,t:n})]})]})]})}function hY({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=dv(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:cv[y]||y,children:v.map(function(x){return o.jsxs("option",{value:x.id,children:[x.name,uv(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(pY,{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 mY({onBack:e,activeSessionId:t,mobileFrameless:n,onMobileFramelessChange:r}){const{t:a,locale:i,setLocale:s,availableLocales:l}=mt(),[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,E]=h.useState(null),[w,T]=h.useState([]),[R,D]=h.useState(()=>$o()||""),[A,q]=h.useState(()=>$o()||""),[U,K]=h.useState(""),[P,M]=h.useState(null),[C,L]=h.useState(!1),[F,Q]=h.useState(()=>UA()),[S]=h.useState(()=>Rl()),[Y,V]=h.useState(()=>XK()),[j,$]=h.useState(()=>pl()),[ce]=h.useState(()=>wd()),[J,_e]=h.useState(()=>nY()),[ue,ne]=h.useState(()=>K0()),[Ce,ke]=h.useState(!1),[pe,me]=h.useState("checking"),[De,Ne]=h.useState(null),[Ee,Oe]=h.useState(null),[fe,he]=h.useState(null),Le=h.useCallback(function(){const ye=!F;Q(ye),QK(ye),ye&&zA()},[F]),Z=h.useCallback(async function(){if(!S)return;if(!j&&Notification.permission!=="granted"){const We=await JK();if(V(We),We!=="granted")return}const ye=!j;$(ye),ZK(ye)},[j,S]),ve=h.useCallback(async function(){if(!(!ce||Ce)){ke(!0);try{J?(await iY(),_e(!1)):(await aY()&&_e(!0),ne(K0()))}catch(ye){console.error("[settings] Web push toggle failed:",ye.message)}finally{ke(!1)}}},[J,ce,Ce]),Re=h.useCallback(async function(){if(!Ce){ke(!0);try{const ye=await sY();ye.sent>0?alert("Test push sent! Check your device."):ye.failed>0?alert("Push delivery failed ("+ye.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(ye){alert("Test push failed: "+ye.message)}finally{ke(!1)}}},[Ce]),Be=h.useCallback(function(ye){Ne(ye.currentVersion),Oe(ye.latestVersion),ye.error?(he(ye.error),me("check-error")):ye.updateAvailable?me("update-available"):me("no-updates")},[]),Ge=h.useCallback(async function(){me("checking"),he(null);try{const ye=await V0();Be(ye)}catch(ye){he(ye.message),me("check-error")}},[Be]),W=h.useCallback(async function(){me("updating"),he(null);try{await IK(),me("success");try{const ye=await V0();Ne(ye.currentVersion),Oe(ye.latestVersion)}catch{}}catch(ye){he(ye.message),me("error")}},[]),z=h.useCallback(async function(){try{y(!0),E(null);const We=(await dT()).settings||[];u(We);const Qe={};for(let ut=0;ut<We.length;ut++)Qe[We[ut].key]=We[ut].value;f(Qe),p({}),k(null);try{const ut=await ox();K(ut.home||"")}catch{}}catch(ye){E(ye.message)}finally{y(!1)}},[]);h.useEffect(function(){z();var ye=!1;return async function(){try{const Qe=await fv();ye||T(Qe||[])}catch{}}(),function(){ye=!0}},[z]),h.useEffect(function(){var ye=!1;return me("checking"),async function(){try{const Qe=await V0();ye||Be(Qe)}catch(Qe){ye||(he(Qe&&Qe.message?Qe.message:String(Qe)),me("check-error"))}}(),function(){ye=!0}},[Be]);const re=h.useCallback(function(ye,We){f(function(Qe){return{...Qe,[ye]:We}}),p(function(Qe){if(!Qe[ye])return Qe;const{[ye]:ut,...ee}=Qe;return ee}),k(null)},[]),le=h.useCallback(async function(){x(!0),k(null);try{const ye={};for(let ut=0;ut<c.length;ut++){const ee=c[ut];ee.source!=="env"&&d[ee.key]!==ee.value&&(ye[ee.key]=d[ee.key])}if(Object.keys(ye).length===0){k({type:"info",message:a("settings.no_changes")}),x(!1);return}const We=await LB(ye),Qe=Object.keys(We.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(ye)}}))}catch{}if(Qe.length>0?(p(We.errors),k({type:"warning",message:a("settings.partial_save")})):k({type:"success",message:a("settings.saved")}),We.settings){const ut=We.settings;u(ut);const ee={};for(let Me=0;Me<ut.length;Me++)ee[ut[Me].key]=ut[Me].value;Qe.length>0?f(function(Me){const Pe={...ee};for(let Xe=0;Xe<Qe.length;Xe++)Me[Qe[Xe]]!==void 0&&(Pe[Qe[Xe]]=Me[Qe[Xe]]);return Pe}):f(ee)}}catch(ye){k({type:"error",message:a("settings.save_failed",{error:ye.message})})}finally{x(!1)}},[c,d,a]),Se=h.useCallback(function(){const ye={};for(let We=0;We<c.length;We++)ye[c[We].key]=c[We].value;f(ye),p({}),k(null),D(A),M(null)},[c,A]),ze=h.useCallback(function(ye){D(ye),M(null),k(null)},[]),Ve=h.useCallback(async function(){const ye=R.trim();if(!ye){if(zf(null),q(""),D(""),M(null),k({type:"success",message:a("settings.working_dir_reset")}),t)try{await dr(t,{directory:null})}catch(Qe){console.warn("SettingsPage: failed to clear session directory:",Qe.message)}return}L(!0),M(null);const We=$o();try{zf(ye);const Qe=await ox();if(q(ye),D(ye),k({type:"success",message:a("settings.working_dir_updated",{path:Qe.cwd})}),t)try{await dr(t,{directory:ye})}catch(ut){console.warn("SettingsPage: failed to update session directory:",ut.message)}}catch(Qe){zf(We),D(A),M(a("settings.working_dir_invalid",{error:Qe.message}))}finally{L(!1)}},[R,A,t]);let Ke=!1;for(let ye=0;ye<c.length;ye++)if(c[ye].source!=="env"&&d[c[ye].key]!==c[ye].value){Ke=!0;break}const ot=R!==A;Ke=Ke||ot;const wt={};for(let ye=0;ye<c.length;ye++){const We=c[ye].category;wt[We]||(wt[We]=[]),wt[We].push(c[ye])}const _t=[];for(let ye=0;ye<Y0.length;ye++)wt[Y0[ye]]&&_t.push(Y0[ye]);const Jt=Object.keys(wt);for(let ye=0;ye<Jt.length;ye++)_t.indexOf(Jt[ye])<0&&_t.push(Jt[ye]);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:z,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:[Ke&&o.jsx("button",{onClick:Se,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||!Ke,className:"px-4 py-1.5 text-sm font-medium rounded-lg transition-colors "+(Ke&&!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(ye){s(ye.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(ye){return o.jsxs("option",{value:ye.code,children:[ye.nativeName," (",ye.name,")"]},ye.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":F,onClick:Le,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 "+(F?"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 "+(F?"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")})]}),S?o.jsx("button",{id:"settings-native-notifications",type:"button",role:"switch","aria-checked":j,onClick:Z,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 "+(j?"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 "+(j?"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&&!tY()&&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."}),ue==="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."}),J&&o.jsx("button",{type:"button",onClick:Re,disabled:Ce,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:Ce?"Sending...":"Send test notification"})]}),ce?o.jsx("button",{id:"settings-web-push",type:"button",role:"switch","aria-checked":J,onClick:ve,disabled:Ce,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 "+(J?"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 "+(J?"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:R,onChange:function(ye){ze(ye.target.value)},placeholder:U||"~ (home directory)",className:"flex-1 block rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(P?"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:C||!ot,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(ot&&!C?"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(C?"settings.validating":"settings.apply")})]}),P&&o.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:P}),A&&o.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:a("settings.currently_set_to",{path:A})})]})]}),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:De||"--"})]}),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:pe==="checking"?a("settings.checking_updates"):Ee||"--"})]}),pe==="update-available"&&o.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[a("settings.update_available")," (",Ee,")"]}),pe==="no-updates"&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("settings.no_updates")}),pe==="success"&&o.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:a("settings.update_success")}),pe==="check-error"&&fe&&o.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[a("settings.check_updates_failed"),": ",fe]}),pe==="error"&&fe&&o.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[a("settings.update_failed"),": ",fe]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[(pe==="idle"||pe==="no-updates"||pe==="error"||pe==="check-error"||pe==="success")&&o.jsx("button",{onClick:Ge,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")}),pe==="update-available"&&o.jsx("button",{onClick:W,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")}),pe==="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")}),pe==="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")})]})]})})]}),_t.map(function(ye){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:rC[ye]?a(rC[ye]):ye}),o.jsx("div",{className:"space-y-4",children:wt[ye].map(function(We){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:We.label}),o.jsx(dY,{source:We.source,envVar:We.envVar,t:a})]}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:[We.description,We.requiresRestart&&o.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:a("settings.requires_restart")}),We.source==="env"&&o.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:a("settings.env_override",{envVar:We.envVar})})]}),o.jsx(hY,{setting:We,value:d[We.key]!==void 0?d[We.key]:"",onChange:function(Qe){re(We.key,Qe)},error:g[We.key],models:w,t:a}),We.source!=="default"&&We.defaultValue!==void 0&&We.type!=="object"&&o.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:a("settings.default_prefix",{value:We.defaultValue===""?a("settings.default_empty"):We.defaultValue})})]},We.key)})})]},ye)})]})})]})}function yY({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 xY({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 bY({onClose:e}){const{t}=mt(),n=kl(),[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 E=!1;async function w(){try{const T=await EK();E||(a(T),s(!1))}catch(T){E||(d(T.message),s(!1))}}return w(),()=>{E=!0}},[]),h.useEffect(()=>{async function E(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",E),p.current&&p.current.focus(),()=>document.removeEventListener("keydown",E)},[e,f,n,t]);const m=h.useCallback((E,w,T)=>{a(R=>!R||!R.models?R:{...R,models:{...R.models,[E]:{...R.models[E],[w]:T}}}),g(!0)},[]),y=h.useCallback(async E=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:E}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(a(w=>{if(!w||!w.models)return w;const T={...w.models};return delete T[E],{...w,models:T}}),g(!0))},[n,t]),v=h.useCallback((E,w)=>{a(T=>T?{...T,models:{...T.models,[E]:w}}:{models:{[E]:w}}),g(!0)},[]),x=h.useCallback(async()=>{d(null),c(!0);try{await NK(r),g(!1),e()}catch(E){d(E.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 E=await SK();a(E.pricing),g(!1)}catch(E){d(E.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(([E],[w])=>E==="default"?1:w==="default"?-1:E.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:E=>E.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(([E,w])=>o.jsx(yY,{modelName:E,rates:w,onChange:m,onDelete:y,isDefault:E==="default",t},E))})]}),o.jsx(xY,{onAdd:v,existingModels:N.map(([E])=>E),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 vY=[{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"}],kY=["low","medium","high"];function _Y({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 sC({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(_Y,{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 wY({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:vY.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:kY.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 EY({onClose:e}){const{t}=mt(),n=kl(),[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([]),[E,w]=h.useState({}),[T,R]=h.useState("epm/privacy"),D=h.useRef(null);h.useEffect(()=>{let C=!1;async function L(){var F;try{const Q=await HB();C||(s(Q.builtins||[]),v(Q.enabled!==!1),b(Q.defaultAction||"ask"),N(Q.disabledBuiltins||[]),w(Q.patterns||{}),R(((F=Q.privateMode)==null?void 0:F.rerouteModel)||"epm/privacy"),a(Q),c(!1))}catch(Q){C||(g(Q.message),c(!1))}}return L(),()=>{C=!0}},[]),h.useEffect(()=>{async function C(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",C),D.current&&D.current.focus(),()=>document.removeEventListener("keydown",C)},[e,p,n,t]);const A=h.useCallback(C=>{N(L=>L.includes(C)?L.filter(F=>F!==C):[...L,C]),m(!0)},[]),q=h.useCallback((C,L,F)=>{w(Q=>({...Q,[C]:{regex:L,severity:F}})),m(!0)},[]),U=h.useCallback(C=>{w(L=>{const F={...L};return delete F[C],F}),m(!0)},[]),K=h.useCallback(async()=>{g(null),d(!0);try{const L=await WB({enabled:y,defaultAction:x,disabledBuiltins:k,privateMode:{rerouteModel:T},patterns:E});m(!1),a(L.policy),e()}catch(C){g(C.message)}finally{d(!1)}},[y,x,k,E,T,e]),P=h.useCallback(async()=>{p?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[p,e,n,t]),M=[...i.map(C=>C.name),...Object.keys(E)];return o.jsx("div",{ref:D,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:P,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:C=>C.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:P,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:C=>{v(C.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:C=>{b(C.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:T,onChange:C=>{R(C.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(C=>o.jsx(sC,{name:C.name,regex:C.regex,severity:C.severity,enabled:!k.includes(C.name),builtin:!0,onToggle:A,onRemove:()=>{},t},C.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(E).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(E).map(([C,L])=>o.jsx(sC,{name:C,regex:L.regex,severity:L.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:U,t},C))})]}),o.jsx(wY,{onAdd:q,existingNames:M,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:P,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:K,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 NY(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 SY({request:e,onDismiss:t}){const{t:n}=mt(),[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 hB(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 mB(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:NY(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 CY({requests:e,onDismiss:t}){return!e||e.length===0?null:o.jsx(o.Fragment,{children:e.map(n=>o.jsx(SY,{request:n,onDismiss:t},n.id))})}var jY="https://account.openpave.ai/dashboard";function TY({open:e,onClose:t,upgradeUrl:n}){var{t:r}=mt(),a=h.useRef(null),i=h.useRef(null),s=h.useRef(t),l=jY;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 _x(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 AY=15e3;function RY({onNavigateToAgent:e}){const{t}=mt(),[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 j,$=null;if(Y){const ce=await i_();if(V!==x.current)return;$=ce.messages||[],i($),j=ce.unread||0,l(j)}else{const ce=await i_({unreadOnly:!0,limit:1});if(V!==x.current)return;j=ce.unread||0,l(j),pl()&&j>0&&ce.messages&&ce.messages.length>0&&($=ce.messages)}if(y.current&&j>m.current&&!v.current&&UA()&&zA(),y.current&&j>m.current&&pl()){const ce=j-m.current,J=$||b.current||[],_e=ce===1&&J.length>0?J.find(pe=>!pe.read):null,ue=_e&&_e.from?_e.from:"",Ce=!ue||ue==="__pave_webui__"||ue==="unknown"?"PAVE":ue,ke=_e&&_e.message?_e.message.slice(0,120).replace(/\n/g," "):ce===1?"New inbox message":ce+" new inbox messages";$A({title:Ce,body:ke,tag:"pave-inbox-"+Date.now(),onClick:function(){window.focus()}})}v.current=!1,m.current=j,y.current=!0}catch{}},[]);h.useEffect(()=>{k(n);const Y=setInterval(()=>k(n),AY);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),E=h.useCallback(async Y=>{if(!(!Y.filename||Y.read)&&!N.current.has(Y.filename)){N.current.add(Y.filename);try{await OB(Y.filename),i(V=>V.map(j=>j.filename===Y.filename?{...j,read:!0}:j)),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 FB(),i(Y=>Y.map(V=>({...V,read:!0}))),l(0)}catch{}finally{u(!1)}},[]),T=h.useCallback(async()=>{u(!0);try{await BB(),i([]),l(0)}catch{}finally{u(!1)}},[]),R=h.useCallback((Y,V)=>{V.read||E(V),r(!1),f(null),e&&e(Y)},[e,E]),D=h.useCallback(Y=>{f(Y),Y.read||E(Y)},[E]),A=h.useCallback(()=>{f(null)},[]),q=h.useRef(new Set),U=h.useCallback(async Y=>{if(!(!Y.filename||!Y.read)&&!q.current.has(Y.filename)){q.current.add(Y.filename);try{await DB(Y.filename),i(V=>{const j=V.map(ce=>ce.filename===Y.filename?{...ce,read:!1}:ce),$=j.reduce((ce,J)=>ce+(J.read?0:1),0);return l($),j}),f(V=>V&&V.filename===Y.filename?{...V,read:!1}:V)}catch{}finally{q.current.delete(Y.filename)}}},[]),K=h.useCallback(async Y=>{if(Y.filename)try{await PB(Y.filename),i(V=>{const j=V.filter(ce=>ce.filename!==Y.filename),$=j.reduce((ce,J)=>ce+(J.read?0:1),0);return l($),j}),f(V=>V&&V.filename===Y.filename?null:V)}catch{}},[]),P=h.useMemo(()=>[...a].sort((Y,V)=>(V.timestamp||0)-(Y.timestamp||0)),[a]),M=h.useCallback(()=>{if(!d)return;const Y=P.findIndex(V=>V.filename===d.filename);if(Y>0){const V=P[Y-1];f(V),V.read||E(V)}},[d,P,E]),C=h.useCallback(()=>{if(!d)return;const Y=P.findIndex(V=>V.filename===d.filename);if(Y>=0&&Y<P.length-1){const V=P[Y+1];f(V),V.read||E(V)}},[d,P,E]),L=h.useMemo(()=>d?P.findIndex(Y=>Y.filename===d.filename):-1,[d,P]),F=L>0,Q=L>=0&&L<P.length-1,S=!!d;return h.useEffect(()=>{if(!S)return;function Y(V){V.key==="Escape"&&f(null)}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[S]),h.useEffect(()=>{S&&p.current&&p.current.focus()},[S]),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:T,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:P.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")}):P.map((Y,V)=>{const j=Y.from||"unknown",$=j!=="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:()=>{$&&R(j,Y)},disabled:!$,className:"text-xs font-semibold truncate max-w-[60%] "+($?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),title:$?t("user_inbox.view_agent")+": "+j:j,children:j}),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?_x(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:()=>D(Y),onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),D(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(cl,{remarkPlugins:[dl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:ce,children:J,href:_e,...ue}){return o.jsx("a",{href:_e,...ue,target:"_blank",rel:"noopener noreferrer",onClick:ne=>ne.stopPropagation(),children:J})},p:function({node:ce,children:J,..._e}){return o.jsx("span",{..._e,children:J})}},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&&A()},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"&&R(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?_x(d.timestamp):""})]}),o.jsx("button",{type:"button",onClick:A,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(cl,{remarkPlugins:[dl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:Y,children:V,href:j,...$}){return o.jsx("a",{href:j,...$,target:"_blank",rel:"noopener noreferrer",children:V})},p:function({node:Y,children:V,...j}){return o.jsx("p",{...j,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:M,disabled:!F,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} / ${P.length}`:""}),o.jsx("button",{type:"button",onClick:C,disabled:!Q,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:()=>U(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:()=>E(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:()=>K(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:A,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 X0(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 MY(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function IY({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:a,sessions:i,busySessions:s={}}){const{t:l}=mt(),[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 D=requestAnimationFrame(()=>{v.current&&v.current.focus()});return()=>cancelAnimationFrame(D)}},[e]),h.useEffect(()=>{let D=!1;const A=c?c.trim():"";if(b.current&&(clearTimeout(b.current),b.current=null),!e){p(null),y(!1);return}if(A.length<2){p(null),y(!1);return}return p(null),y(!0),b.current=setTimeout(()=>{sx({q:A,limit:20}).then(q=>{if(D)return;const U=Array.isArray(q)?q:q.sessions||[];p(U),y(!1)}).catch(()=>{D||y(!1)})},300),()=>{D=!0,b.current&&(clearTimeout(b.current),b.current=null)}},[c,e]);const N=h.useCallback(D=>{if(!a)return D;const A=D.findIndex(K=>K.id===a);if(A<=0)return D;const q=D.slice(),[U]=q.splice(A,1);return q.unshift(U),q},[a]),E=h.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:l("spotlight.new_chat")}),[l]),w=h.useMemo(()=>{const D=i||[],A=!k||X0(k,"new chat")||X0(k,l("spotlight.new_chat")),q=P=>A&&r?a&&P.length>0&&P[0].id===a?[P[0],E,...P.slice(1)]:[E,...P]:P;if(!k)return q(N(D.slice(0,10)));const U=D.filter(P=>X0(k,P.title||""));let K;if(g){const P=new Set(U.map(C=>C.id)),M=g.filter(C=>!P.has(C.id));K=U.concat(M).slice(0,20)}else K=U.slice(0,20);return q(N(K))},[k,i,g,N,E,r,l,a]);h.useEffect(()=>{f(0)},[k]),h.useEffect(()=>{f(D=>w.length===0?0:D>=w.length?w.length-1:D)},[w.length]),h.useEffect(()=>{if(!x.current)return;const D=x.current.querySelectorAll('[role="option"]');D[d]&&D[d].scrollIntoView({block:"nearest"})},[d,w.length]);const T=h.useCallback(D=>{if(D&&D.isAction&&D.actionType==="new-chat"){r&&r(),t();return}const A=typeof D=="string"?D:D==null?void 0:D.id;A&&n(A),t()},[n,r,t]),R=h.useCallback(D=>{D.key==="ArrowDown"?(D.preventDefault(),f(A=>w.length===0?0:(A+1)%w.length)):D.key==="ArrowUp"?(D.preventDefault(),f(A=>w.length===0?0:(A-1+w.length)%w.length)):D.key==="Enter"?(D.preventDefault(),w[d]&&T(w[d])):D.key==="Escape"&&(D.preventDefault(),t())},[w,d,T,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:D=>D.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:D=>u(D.target.value),onKeyDown:R,"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((D,A)=>{var q;return D.isAction&&D.actionType==="new-chat"?o.jsxs("div",{id:"spotlight-item-"+A,role:"option","aria-selected":A===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 ${A===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:()=>T(D),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:D.title})})]},D.id):o.jsxs("div",{id:"spotlight-item-"+A,role:"option","aria-selected":A===d,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${A===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:()=>T(D),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:D.title||l("spotlight.untitled")})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s[D.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")}),D.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:MY(D)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:_x((q=D.time)==null?void 0:q.updated)})]})]},D.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 gv="pave_recent_directories",LY=10;function oC(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 pv(){try{const e=localStorage.getItem(gv);return e?JSON.parse(e):[]}catch{return[]}}function OY(e){try{let t=pv();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,LY),localStorage.setItem(gv,JSON.stringify(t)),t}catch{return[e]}}function DY(e){try{let t=pv();return t=t.filter(n=>n!==e),localStorage.setItem(gv,JSON.stringify(t)),t}catch{return[]}}function VA({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 PY({isOpen:e,onClose:t,sessionId:n,currentDirectory:r,homeDir:a,onDirectoryChange:i}){var{t:s}=mt(),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),[E,w]=h.useState(null),T=h.useRef(null),R=h.useRef(0);h.useEffect(function(){e&&(v(pv()),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 D=h.useCallback(function(L){if(!L||L.trim()===""){g("idle"),m(null);return}T.current&&clearTimeout(T.current),g("checking"),R.current+=1;var F=R.current;T.current=setTimeout(async function(){try{const Q=await a_(L.trim());if(F!==R.current)return;m(Q),Q.exists&&Q.isDirectory?g("valid"):Q.exists?(g("error"),m({...Q,error:s("chat.working_directory_invalid")})):g("not_found")}catch(Q){if(F!==R.current)return;g("error"),m({error:Q.message})}},300)},[s]),A=h.useCallback(function(L){var F=L.target.value;d(F),w(null),D(F)},[D]),q=h.useCallback(function(L){d(L),w(null),D(L)},[D]),U=h.useCallback(function(L,F){L.stopPropagation(),v(DY(F))},[]),K=h.useCallback(async function(){if(u.trim()){b(!0),w(null);try{const L=await IB(u.trim());if(L.success)try{const F=await a_(L.path);g("valid"),m(F)}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]),P=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(OY(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(F){F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),t())}return document.addEventListener("keydown",L,!0),function(){document.removeEventListener("keydown",L,!0)}},[e,t]),h.useEffect(function(){if(!e)return;function L(F){F.key==="Enter"&&f==="valid"&&!k&&(F.preventDefault(),P())}return document.addEventListener("keydown",L),function(){document.removeEventListener("keydown",L)}},[e,f,k,P]),h.useEffect(function(){return function(){T.current&&clearTimeout(T.current)}},[]);var M=h.useMemo(function(){return oC(r,a)},[r,a]);if(!e)return null;var C=null;return f==="checking"?C=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?C=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"?C=o.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",s("chat.working_directory_not_found")]}):f==="error"&&(p!=null&&p.error)&&(C=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(VA,{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:M||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:A,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"}),C]}),E&&o.jsx("p",{className:"text-sm text-red-500",children:E}),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(){q(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:oC(L,a)}),o.jsx("button",{onClick:function(F){U(F,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:K,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:P,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 Gt={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 FY(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function Ac(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function Rc(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function rs(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 BY(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,a=mt().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(Gt.enabled),E=N[0],w=N[1],T=h.useState(Gt.message),R=T[0],D=T[1],A=h.useState(String(Gt.intervalMs)),q=A[0],U=A[1],K=h.useState(String(Gt.maxInjections)),P=K[0],M=K[1],C=h.useState(Gt.timeout.enabled),L=C[0],F=C[1],Q=h.useState(String(Gt.timeout.thresholdMs)),S=Q[0],Y=Q[1],V=h.useState(String(Gt.timeout.cooldownMs)),j=V[0],$=V[1],ce=h.useState(Gt.mode),J=ce[0],_e=ce[1],ue=h.useState(String(Gt.waitMs)),ne=ue[0],Ce=ue[1],ke=h.useRef(null),pe=h.useState([]),me=pe[0],De=pe[1],Ne=h.useState(!1),Ee=Ne[0],Oe=Ne[1],fe=h.useState(!1),he=fe[0],Le=fe[1],Z=h.useState("9"),ve=Z[0],Re=Z[1],Be=h.useState("0"),Ge=Be[0],W=Be[1],z=h.useState("AM"),re=z[0],le=z[1],Se=h.useState("weekdays"),ze=Se[0],Ve=Se[1],Ke=h.useState([1,2,3,4,5]),ot=Ke[0],wt=Ke[1],_t=h.useState(""),Jt=_t[0],ye=_t[1],We="";try{We=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}h.useEffect(function(){return function(){ke.current&&clearTimeout(ke.current)}},[]);var Qe=h.useCallback(function(){r&&(d(!0),v(null),cT(r).then(function(xe){var Ye=xe&&xe.config?xe.config:Gt;l(Ye),w(Ye.enabled||!1),D(Ye.message||Gt.message),U(Ac(Ye.intervalMs!=null?Ye.intervalMs:Gt.intervalMs)),M(FY(Ye.maxInjections!=null?Ye.maxInjections:Gt.maxInjections)),F(Ye.timeout?Ye.timeout.enabled:Gt.timeout.enabled),Y(Ac(Ye.timeout&&Ye.timeout.thresholdMs!=null?Ye.timeout.thresholdMs:Gt.timeout.thresholdMs)),$(Ac(Ye.timeout&&Ye.timeout.cooldownMs!=null?Ye.timeout.cooldownMs:Gt.timeout.cooldownMs)),_e(Ye.mode||Gt.mode),Ce(Ac(Ye.waitMs!=null?Ye.waitMs:Gt.waitMs))}).catch(function(xe){v(xe.message||"Failed to load config")}).finally(function(){d(!1)}))},[r]);h.useEffect(function(){t&&Qe()},[t,Qe]);var ut=h.useCallback(function(){r&&sB(r).then(function(xe){De(xe&&xe.schedules?xe.schedules:[])}).catch(function(){De([])})},[r]);h.useEffect(function(){t&&ut()},[t,ut]),h.useEffect(function(){if(!t)return;function xe(Ye){Ye.key==="Escape"&&n()}return document.addEventListener("keydown",xe),function(){document.removeEventListener("keydown",xe)}},[t,n]);function ee(){if(r){p(!0),v(null),k(null);var xe={enabled:E,message:R.trim()||Gt.message,intervalMs:Rc(q)||Gt.intervalMs,maxInjections:parseInt(P,10)||0,mode:J||Gt.mode,waitMs:Rc(ne),timeout:{enabled:L,thresholdMs:Rc(S)||Gt.timeout.thresholdMs,cooldownMs:Rc(j)||Gt.timeout.cooldownMs}};aB(r,xe).then(function(){l(xe),k(a("chat.idle_injection_saved")),ke.current&&clearTimeout(ke.current),ke.current=setTimeout(function(){k(null)},3e3)}).catch(function(Ye){v(Ye.message||"Failed to save")}).finally(function(){p(!1)})}}function Me(){r&&(p(!0),v(null),k(null),iB(r).then(function(){w(!1),l(null)}).catch(function(xe){v(xe.message||"Failed to disable")}).finally(function(){p(!1)}))}function Pe(xe,Ye){var St=parseInt(xe,10);return Ye==="PM"&&St!==12&&(St+=12),Ye==="AM"&&St===12&&(St=0),St}function Xe(xe){return xe===0?{h:12,ap:"AM"}:xe<12?{h:xe,ap:"AM"}:xe===12?{h:12,ap:"PM"}:{h:xe-12,ap:"PM"}}function yt(xe,Ye){return xe==="every_day"?[0,1,2,3,4,5,6]:xe==="weekdays"?[1,2,3,4,5]:xe==="weekends"?[0,6]:Ye.slice().sort()}function dt(xe){var Ye=Xe(xe.hour),St=String(xe.minute).padStart(2,"0");return Ye.h+":"+St+" "+Ye.ap}function ft(xe){var Ye=xe.daysOfWeek||[],St="";if(Ye.length===7)St=a("scheduled_injection.repeat_every_day");else if(Ye.length===5&&Ye.indexOf(1)!==-1&&Ye.indexOf(5)!==-1)St=a("scheduled_injection.repeat_weekdays");else if(Ye.length===2&&Ye.indexOf(0)!==-1&&Ye.indexOf(6)!==-1)St=a("scheduled_injection.repeat_weekends");else{for(var It=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],lr=[],Qn=0;Qn<7;Qn++)Ye.indexOf(Qn)!==-1&&lr.push(a("scheduled_injection."+It[Qn]));St=lr.join(", ")}return xe.timezone&&(St+=" ("+xe.timezone+")"),St}function Mt(){if(r){Le(!0),v(null);var xe={hour:Pe(ve,re),minute:parseInt(Ge,10),daysOfWeek:yt(ze,ot),timezone:We||null,message:Jt.trim(),enabled:!0};oB(r,xe).then(function(){Oe(!1),ye(""),ut()}).catch(function(Ye){v(Ye.message||a("scheduled_injection.error_generic"))}).finally(function(){Le(!1)})}}function Un(xe,Ye){r&&lB(r,xe,{enabled:!Ye}).then(function(){ut()}).catch(function(St){v(St.message||"Failed to toggle schedule")})}function Nt(xe){r&&cB(r,xe).then(function(){ut()}).catch(function(Ye){v(Ye.message||"Failed to delete schedule")})}function Tt(xe){var Ye=ot.indexOf(xe);wt(Ye===-1?ot.concat([xe]):ot.filter(function(St){return St!==xe}))}if(!t)return null;var Xt="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",te="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",zt="space-y-3",it=function(xe){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(xe?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},Vt=function(xe){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(xe?"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(!E)},className:it(E),"aria-pressed":E,"aria-label":a("chat.idle_injection_toggle"),children:o.jsx("span",{className:Vt(E)})})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-message",children:a("chat.idle_injection_message")}),o.jsx("textarea",{id:"ii-message",value:R,onChange:function(xe){D(xe.target.value)},className:te+" resize-none",rows:3,placeholder:a("chat.idle_injection_message_placeholder"),disabled:!E})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-interval",children:a("chat.idle_injection_interval")}),o.jsx("input",{id:"ii-interval",type:"number",value:q,onChange:function(xe){U(xe.target.value)},className:te,min:.5,step:.5,disabled:!E}),o.jsx(rs,{children:a("chat.idle_injection_interval_desc")})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-max",children:a("chat.idle_injection_max")}),o.jsx("input",{id:"ii-max",type:"number",value:P,onChange:function(xe){M(xe.target.value)},className:te,min:0,disabled:!E}),o.jsx(rs,{children:a("chat.idle_injection_max_desc")})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-mode",children:a("chat.idle_injection_mode")}),o.jsxs("select",{id:"ii-mode",value:J,onChange:function(xe){_e(xe.target.value)},className:te,disabled:!E,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(rs,{children:a("chat.idle_injection_mode_desc")})]}),J==="idle"&&o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-wait",children:a("chat.idle_injection_wait_ms")}),o.jsx("input",{id:"ii-wait",type:"number",value:ne,onChange:function(xe){Ce(xe.target.value)},className:te,min:0,step:.5,disabled:!E}),o.jsx(rs,{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(){F(!L)},className:it(L),"aria-pressed":L,"aria-label":a("chat.idle_injection_timeout_toggle"),disabled:!E,children:o.jsx("span",{className:Vt(L)})})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-threshold",children:a("chat.idle_injection_timeout_threshold")}),o.jsx("input",{id:"ii-threshold",type:"number",value:S,onChange:function(xe){Y(xe.target.value)},className:te,min:1,step:.5,disabled:!E||!L}),o.jsx(rs,{children:a("chat.idle_injection_timeout_threshold_desc")})]}),o.jsxs("div",{className:zt,children:[o.jsx("label",{className:Xt,htmlFor:"ii-cooldown",children:a("chat.idle_injection_timeout_cooldown")}),o.jsx("input",{id:"ii-cooldown",type:"number",value:j,onChange:function(xe){$(xe.target.value)},className:te,min:.5,step:.5,disabled:!E||!L}),o.jsx(rs,{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:zt,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")})]}),me.length===0&&!Ee&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("scheduled_injection.empty")}),me.map(function(xe){return o.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(xe.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:dt(xe)}),o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:ft(xe)})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("button",{type:"button",onClick:function(){Un(xe.id,xe.enabled)},className:it(xe.enabled),"aria-pressed":xe.enabled,"aria-label":a("scheduled_injection.enabled"),children:o.jsx("span",{className:Vt(xe.enabled)})}),o.jsx("button",{type:"button",onClick:function(){Nt(xe.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"})})})]})]}),xe.message&&o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',xe.message,'"']})]},xe.id)}),Ee?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:Xt,children:a("scheduled_injection.time")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("select",{value:ve,onChange:function(xe){Re(xe.target.value)},className:te+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(xe){return o.jsx("option",{value:String(xe),children:xe},xe)})}),o.jsx("span",{className:"text-gray-500",children:":"}),o.jsxs("select",{value:Ge,onChange:function(xe){W(xe.target.value)},className:te+" 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:re,onChange:function(xe){le(xe.target.value)},className:te+" 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:Xt,children:a("scheduled_injection.repeat")}),o.jsxs("select",{value:ze,onChange:function(xe){Ve(xe.target.value)},className:te,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")})]})]}),ze==="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(xe){var Ye=ot.indexOf(xe.d)!==-1;return o.jsx("button",{type:"button",onClick:function(){Tt(xe.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(Ye?"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."+xe.k)},xe.d)})})}),We&&o.jsxs("div",{children:[o.jsx("label",{className:Xt,children:a("scheduled_injection.timezone")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:We})]}),o.jsxs("div",{children:[o.jsx("label",{className:Xt,children:a("scheduled_injection.message")}),o.jsx("textarea",{value:Jt,onChange:function(xe){ye(xe.target.value)},className:te+" 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:Mt,disabled:he||ze==="custom"&&ot.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(he?"scheduled_injection.saving":"scheduled_injection.save")}),o.jsx("button",{type:"button",onClick:function(){Oe(!1)},disabled:he,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(){Oe(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",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:ee,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:Me,disabled:g||!E,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 zY({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(),E=N.splice(l,1)[0];N.splice(k,0,E),c(null);var w=N.filter(function(T){return T.status!=="dispatching"}).map(function(T){return T.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",E=l===k,w=u===k&&l!==k,T=!N&&!n;return o.jsxs("div",{draggable:T,onDragStart:T?function(R){g(R,k)}:void 0,onDragEnter:T?function(R){p(R,k)}:void 0,onDragOver:T?function(R){m(R,k)}:void 0,onDragLeave:T?y:void 0,onDrop:T?function(R){v(R,k)}:void 0,onDragEnd:T?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 ")+(E?"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 ":"")+(T?"cursor-grab active:cursor-grabbing ":""),children:[T&&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(R){(R.key==="Enter"||R.key===" ")&&(R.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(R){R.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 UY{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 ct=new UY;function qY(){var Cv;const{t:e}=mt(),t=200,n=600,r=288,a=10,i="pave-active-session";function s(){try{return localStorage.getItem(i)||null}catch{return null}}function l(_){try{_?localStorage.setItem(i,_):localStorage.removeItem(i)}catch{}}function c(){try{localStorage.removeItem(i)}catch{}}function u(_){return"pave:compactedExpanded:"+_}function d(_){try{var B=localStorage.getItem(u(_)),G=B?parseInt(B,10):0;return Number.isFinite(G)&&G>0?G:0}catch{return 0}}function f(_,B){try{B>0?localStorage.setItem(u(_),String(B)):localStorage.removeItem(u(_))}catch{}}const[g,p]=h.useState(()=>{if(typeof window<"u"){const _=localStorage.getItem("pave-theme");return _?_==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1});h.useEffect(()=>{const _=document.documentElement;g?(_.classList.add("dark"),_.style.colorScheme="dark"):(_.classList.remove("dark"),_.style.colorScheme="light"),localStorage.setItem("pave-theme",g?"dark":"light")},[g]);const[m,y]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1),[v,x]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1),[b,k]=h.useState(!1),[N,E]=h.useState(0),[w,T]=h.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",w)},[w]);const[R,D]=h.useState(!1),A=h.useRef(null),q=h.useRef(new Map),[U,K]=h.useState(()=>new Set),[P,M]=h.useState(()=>new Set),C=h.useRef(null),L=h.useRef("chat"),F=h.useRef(null),[Q,S]=h.useState(()=>{if(typeof window<"u"){const _=localStorage.getItem("pave-terminal-width");if(_){const B=parseInt(_,10);if(!isNaN(B)&&B>=t&&B<=n)return B}}return r}),[Y,V]=h.useState(()=>{if(typeof window<"u"){const _=localStorage.getItem("pave-right-pane-visible");return _===null?!0:_==="true"}return!0}),[j,$]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-banner-hidden")==="true":!1),ce=h.useCallback(()=>{$(_=>{const B=!_;try{localStorage.setItem("pave-banner-hidden",String(B))}catch{}return B})},[]),[J,_e]=h.useState(""),ue=h.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]),ne=h.useRef(Y);ne.current=Y;const Ce=h.useCallback(()=>{const _=!ne.current;V(_),_e(e(_?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);h.useEffect(()=>{localStorage.setItem("pave-hacker",m?"true":"false")},[m]),h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",v?"true":"false")},[v]),h.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",Y?"true":"false")},[Y]);const ke=h.useRef(Q);ke.current=Q,h.useEffect(()=>{const _=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(Q))},200);return()=>clearTimeout(_)},[Q]),h.useEffect(()=>{const _=()=>{localStorage.setItem("pave-terminal-width",String(ke.current))};return window.addEventListener("beforeunload",_),()=>{_(),window.removeEventListener("beforeunload",_)}},[]),h.useEffect(()=>{const _=G=>{if(!(G instanceof HTMLElement))return!1;const X=G.tagName;return!!(X==="INPUT"||X==="TEXTAREA"||G.isContentEditable)},B=G=>{if(G.repeat)return;const X=typeof G.key=="string"?G.key.toLowerCase():"";if((ue?G.metaKey:G.ctrlKey)&&!G.altKey&&!G.shiftKey&&X==="k"){G.preventDefault(),D(H=>!H);return}if((ue?G.metaKey:G.ctrlKey)&&!G.altKey&&!G.shiftKey&&X==="b"){G.preventDefault(),Xe(H=>!H);return}const ge=(ue?G.metaKey:G.ctrlKey)&&!G.altKey&&!G.shiftKey&&X==="j",et=window.matchMedia("(min-width: 1024px)").matches,jt=L.current==="chat";if(ge&&C.current&&et&&jt){G.preventDefault(),Ce();return}if(_(G.target))return;const ie=G.ctrlKey&&!G.altKey&&!G.metaKey&&X==="h",I=G.ctrlKey&&G.shiftKey&&!G.altKey&&!G.metaKey&&X==="m";(ie||I)&&(G.preventDefault(),y(H=>!H))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[e,ue,Ce]);const[pe,me]=h.useState(!0),[De,Ne]=h.useState(!1),[Ee,Oe]=h.useState(null),[fe,he]=h.useState("chat");L.current=fe;const[,Le]=h.useState(null),[Z,ve]=h.useState(null),[Re,Be]=h.useState(!1),[Ge,W]=h.useState(!1),[z,re]=h.useState([]),[le,Se]=h.useState({});h.useEffect(()=>{fB().then(_=>{Ne(_.enabled),_.authenticated&&_.user&&Oe(_.user)}).catch(_=>{console.error("Failed to check auth status:",_)}).finally(()=>me(!1))},[]),h.useEffect(()=>{oY(()=>C.current)},[]);const ze=h.useCallback(async()=>{try{await gB()}catch(_){console.error("Logout failed:",_);return}Oe(null),window.location.reload()},[]),[Ve,Ke]=h.useState(null),[ot,wt]=h.useState(!1),[_t,Jt]=h.useState([]),[ye,We]=h.useState([]),[Qe,ut]=h.useState({}),ee=h.useRef(Qe);h.useEffect(()=>{ee.current=Qe},[Qe]);const Me=h.useRef({}),[Pe,Xe]=h.useState(!0),[yt,dt]=h.useState(!1),ft=h.useRef(!1),Mt=h.useRef(null),Un=h.useRef(0);h.useEffect(function(){return function(){Un.current&&cancelAnimationFrame(Un.current)}},[]);const[Nt,Tt]=h.useState([]),Xt=h.useRef([]);Xt.current=Nt;const[te,zt]=h.useState(null);C.current=te,h.useEffect(()=>{l(te)},[te]),h.useEffect(()=>{te&&lY(typeof document<"u"&&document.visibilityState==="visible",te)},[te]);const it=h.useMemo(()=>te&&Nt.find(_=>_.id===te)||null,[te,Nt]),[Vt,xe]=h.useState([]),[Ye,St]=h.useState({}),[It,lr]=h.useState(!1),[Qn,wa]=h.useState(!1),[Or,Vs]=h.useState({}),li=h.useRef(Or);li.current=Or;const[Gs,Wi]=h.useState({}),[Ed,Yr]=h.useState(null),[bn,Qr]=h.useState(null),on=h.useRef(null);h.useEffect(function(){return function(){on.current&&clearTimeout(on.current),Sn.current&&clearTimeout(Sn.current)}},[]);const[Nd,cr]=h.useState(null),[Vi,Ks]=h.useState(null),[Ys,Xr]=h.useState(null),Sn=h.useRef(null),ln=h.useCallback((_,B)=>{if(_){const G=!B&&!!li.current[_];G&&_===Je.current&&(Qr(null),on.current&&(clearTimeout(on.current),on.current=null)),Vs(X=>{const ae={...X},de=!!X[_];if(B?ae[_]=!0:delete ae[_],de&&!B&&Xn.current&&Xn.current[_]&&!Pd.current.has(_)){const ge=Xn.current[_];if(ge.length>0){const et=ge.shift();_===Je.current&&Dd(ge.length),Promise.resolve().then(()=>{try{Ud.current&&Ud.current(_,et.content,et.imageAttachments,et.agent,et.displayContent,et.queuedTempId,et.fileAttachments)}catch(jt){console.error("[Queue] Drain dispatch failed:",jt)}})}}return ae}),G&&(Pd.current.delete(_),qf(_).then(X=>{const ae=Array.isArray(X&&X.items)?X.items:[];Wi(de=>{const ge={...de};if(ae.length===0)if(ge[_])delete ge[_];else return de;else ge[_]=ae;return ge})}).catch(()=>{}))}_===Je.current&&wa(B)},[]),Zr=h.useCallback(_=>{const B={};Object.keys(_).forEach(X=>{_[X]&&_[X].type==="busy"&&(B[X]=!0)}),Vs(X=>{const ae={...X};return Object.keys(B).forEach(de=>{ae[de]=!0}),Object.keys(_).forEach(de=>{_[de]&&_[de].type!=="busy"&&delete ae[de]}),ae});const G=_[Je.current];wa(!!(G&&G.type==="busy"))},[]),[ci,cn]=h.useState({}),[Sd,Qs]=h.useState({}),[Ml,ui]=h.useState({});h.useEffect(()=>{w==="map"&&te&&$f(te).then(_=>{_&&Array.isArray(_.todos)&&ui(B=>({...B,[te]:_.todos}))}).catch(()=>{})},[w,te]);const[Il,Ll]=h.useState({});h.useEffect(()=>{w==="tools"&&te&&l_(te).then(_=>{_&&Ll(B=>({...B,[te]:_}))}).catch(()=>{})},[w,te]);const[Ea,Xs]=h.useState(null),[Cd,Na]=h.useState(null),[di,$e]=h.useState(null),[Ie,O]=h.useState(!1),[se,we]=h.useState(null),He=50,[Ze,at]=h.useState(!1),[Ct,Lt]=h.useState(0),un=h.useRef(0),[Cn,Sa]=h.useState(!0),[dn,jd]=h.useState(!1),[Ol,Dl]=h.useState(""),[Zs,Ca]=h.useState(0),[kr,Pl]=h.useState(0),[Gi,Ki]=h.useState(!1),Td=h.useRef(null),[Jr,GA]=h.useState(!1),[ea,KA]=h.useState(""),[YA,Ad]=h.useState(!1),[QA,XA]=h.useState(""),[ZA,hv]=h.useState(!1),[Fl,mv]=h.useState(null),[JA,Bl]=h.useState(!1),[Rd,yv]=h.useState({}),Md=h.useRef({}),[Id,xv]=h.useState({}),Ld=h.useRef({}),[eR,tR]=h.useState({}),bv=h.useRef({}),zl=h.useRef(new Set),Yi=h.useRef(null);h.useEffect(()=>{Md.current=Rd},[Rd]),h.useEffect(()=>{Ld.current=Id},[Id]),h.useEffect(()=>{if(!te)return;const _=Nt.find(B=>B.id===te);_&&(_.moe_top_k!=null&&Md.current[te]===void 0&&yv(B=>B[te]===void 0?{...B,[te]:_.moe_top_k}:B),_.reasoning_effort&&Ld.current[te]===void 0&&xv(B=>B[te]===void 0?{...B,[te]:_.reasoning_effort}:B))},[te,Nt]);const vv=Rd[te]??null,nR=Id[te]??"max",kv=eR[te]??null,Js=h.useCallback((_,B)=>{mv({text:_,type:B||"info"}),Yi.current&&clearTimeout(Yi.current),Yi.current=setTimeout(()=>{mv(null),Yi.current=null},3e3)},[]);h.useEffect(()=>{const _=()=>{dT().then(B=>{const X=(Array.isArray(B==null?void 0:B.settings)?B.settings:[]).find(de=>de&&de.key==="PAVE_WHATSAPP_CHAT_ID"),ae=X&&X.value||"";KA(ae)}).catch(B=>{console.error("[WhatsApp] Failed to load default chatId from settings:",B.message)})};return _(),window.addEventListener("pave:settings-updated",_),()=>window.removeEventListener("pave:settings-updated",_)},[]);const Ul=h.useRef(Jr),rR=h.useRef(ea);h.useEffect(()=>{Ul.current=Jr,rR.current=ea},[Jr,ea]);const Od=h.useRef({});h.useEffect(()=>{VB({enabled:Jr,sessionId:te,chatId:ea}).catch(_=>{console.error("[WhatsApp routing] Failed to update:",_.message)})},[Jr,te,ea]),h.useEffect(()=>{Gi&&Td.current&&Td.current.focus()},[Gi]),h.useEffect(()=>{const _=window.matchMedia("(min-width: 1024px)"),B=G=>{G.matches&&Ki(!1)};return _.addEventListener("change",B),()=>_.removeEventListener("change",B)},[]);function _v(){const _=Ml[te]||[],B=[];for(const ge of Vt||[])for(const et of ge.parts||[]){if(et.type!=="tool")continue;const jt=et.state&&et.state.output;if(!jt)continue;let ie=jt;if(typeof jt=="string")try{ie=JSON.parse(jt)}catch{continue}ie&&ie.canvas&&ie.canvas.type&&ie.canvas.source&&B.push(ie.canvas)}const G=te?`pave-canvas-cleared:${te}`:null;let X=new Set;if(G&&typeof window<"u")try{const ge=localStorage.getItem(G);ge&&(X=new Set(JSON.parse(ge)))}catch{}const ae=B.filter(ge=>!X.has(ge.type+":"+ge.source)),de=()=>{if(!G||typeof window>"u")return;const ge=B.map(et=>et.type+":"+et.source);try{localStorage.setItem(G,JSON.stringify(ge))}catch{}E(et=>et+1)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:m?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:()=>T("map"),className:`px-2 py-0.5 rounded ${w==="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:()=>T("tools"),className:`px-2 py-0.5 rounded ${w==="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:()=>T("canvas"),className:`px-2 py-0.5 rounded relative ${w==="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",ae.length>0?o.jsxs("span",{className:"ml-1 opacity-70",children:["(",ae.length,")"]}):null]}),o.jsx("button",{type:"button",onClick:()=>T("terminal"),className:`px-2 py-0.5 rounded ${w==="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:w==="map"?o.jsx(KV,{todos:_,darkMode:g}):w==="tools"?o.jsx(iG,{graph:Il[te]||null,darkMode:g}):w==="canvas"?o.jsx(BS,{canvases:ae,onClear:ae.length?de:null}):o.jsx(yT,{toolParts:TR,matrixMode:b,onToggleMatrix:()=>k(ge=>!ge),darkMode:g})})]}):ae.length>0?o.jsx(BS,{canvases:ae,onClear:ae.length?de:null}):o.jsx(hT,{toolParts:jR})}),o.jsx(KG,{messages:Vt,isBusy:Qn,activeModel:Ve,sessionModel:Qe[te]||null,isPrivateMode:P.has(te),registryEntries:ye})]})}h.useEffect(()=>{jd(!1),Dl(""),Ca(0),Pl(0),Ki(!1)},[te]),h.useEffect(()=>{if(!te)return;let _=!1;return $B(te).then(B=>{if(_||!B)return;const G=te;B.privateMode&&M(X=>{if(X.has(G))return X;const ae=new Set(X);return ae.add(G),ae}),Array.isArray(B.messageIds)&&B.messageIds.length&&K(X=>{let ae=!1;const de=new Set(X);for(const ge of B.messageIds)de.has(ge)||(de.add(ge),ae=!0);return ae?de:X})}).catch(()=>{}),()=>{_=!0}},[te]),h.useEffect(()=>{if(!te){Bl(!1);return}let _=!1;return cT(te).then(B=>{if(_)return;const G=B&&B.config?B.config:{};Bl(!!G.enabled)}).catch(()=>{}),()=>{_=!0}},[te]),h.useEffect(()=>{if(!te){wt(!1);return}const _=ee.current[te]||Ve;if(!_){wt(!1);return}let B=!1;return MB(_).then(G=>{B||wt(!!(G&&G.adaptiveQuality))}).catch(()=>{B||wt(!1)}),()=>{B=!0}},[te,Ve,Qe]),h.useEffect(()=>{kr>0&&Zs>=kr?Ca(kr-1):kr===0&&Zs!==0&&Ca(0)},[kr,Zs]);const ql=h.useRef(new Set),$l=h.useCallback(_=>{if(!_||!ql.current.has(_))return;ql.current.delete(_);const B=Xt.current.find(G=>G.id===_);B&&B.pinned||(Tt(G=>G.filter(X=>X.id!==_)),t_(_).catch(G=>{console.warn("Auto-cleanup of empty session failed:",_,G)}))},[]),Je=h.useRef(te);h.useEffect(()=>{Je.current=te;const _=Xn.current[te];Dd(_?_.length:0)},[te]),h.useEffect(()=>{if(!te)return;let _=!1;return qf(te).then(B=>{if(_)return;const G=Array.isArray(B&&B.items)?B.items:[],X=te;Wi(ae=>{const de={...ae};if(G.length===0)if(de[X])delete de[X];else return ae;else de[X]=G;return de})}).catch(B=>{console.warn("[queue] hydrate failed for",te,B&&B.message)}),()=>{_=!0}},[te]);const wv=h.useRef(w);h.useEffect(()=>{wv.current=w},[w]);const Xn=h.useRef({}),[aR,Dd]=h.useState(0),Pd=h.useRef(new Set),Qi=h.useCallback(_=>{if(_===Je.current){const B=Xn.current[_];Dd(B?B.length:0)}},[]),iR=h.useCallback(_=>{if(!_)return;const B=Je.current;if(!B)return;const G=Xn.current[B];Array.isArray(G)&&G.length>0&&(Xn.current[B]=G.filter(X=>X.queuedTempId!==_)),xe(X=>X.filter(ae=>ae.info.id!==_)),Qi(B)},[Qi]),ja=!De||!!Ee;h.useEffect(()=>{!pe&&ja&&(Dr(),s_().then(_=>{Zr(_)}).catch(_=>{console.error("Failed to fetch session status:",_)}))},[pe,ja]),h.useEffect(()=>{!pe&&ja&&(RB().then(_=>{_&&_.model&&Ke(_.model)}).catch(_=>{console.error("Failed to fetch config:",_)}),uB().then(_=>{_&&Array.isArray(_.providers)&&Jt(_.providers)}).catch(_=>{console.error("Failed to fetch providers:",_)}),dB().then(_=>{_&&Array.isArray(_.entries)&&We(_.entries)}).catch(_=>{console.error("Failed to fetch model registry:",_)}),ox().then(_=>{_&&_.home&&XA(_.home)}).catch(_=>{console.error("Failed to fetch path info:",_)}))},[pe,ja]);const Fd=h.useCallback(()=>{pB().then(_=>{const B=Array.isArray(_&&_.pending)?_.pending:[];re(B)}).catch(_=>{console.error("Failed to fetch pending permissions:",_)})},[]);h.useEffect(()=>{!pe&&ja&&Fd()},[pe,ja,Fd]),h.useEffect(()=>{const G=setInterval(()=>{re(X=>{const ae=Date.now(),de=X.filter(ge=>ae-(ge.timestamp||0)<3e5);return de.length===X.length?X:de})},3e4);return()=>clearInterval(G)},[]);const Dr=h.useCallback(async _=>{try{const B=_&&_.includeArchived||ft.current,G=un.current||0,X=Math.max(He,G),ae=await sx({limit:X,offset:0,includeArchived:B});if(ae&&ae.sessions){const de=Array.isArray(ae.sessions)?ae.sessions:[];Tt(de),at(!!ae.hasMore),Lt(de.length),un.current=de.length}else{const de=Array.isArray(ae)?ae:[];Tt(de),at(!1),Lt(de.length),un.current=de.length}}catch(B){return console.error("Failed to load sessions:",B),!1}return!0},[]);h.useEffect(()=>{function _(){te&&XF(te).then(function(B){B&&B.sessionID&&(Je.current=B.sessionID,zt(B.sessionID),Dr())}).catch(function(B){console.error("Failed to create archive session:",B);const G=(()=>{if(!B)return!1;if(B.status===404||B.response&&B.response.status===404)return!0;if(typeof B.message=="string"){const X=B.message.match(/^(\d{3})\s*:/);if(X&&parseInt(X[1],10)===404)return!0}return!1})();$e(e(G?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",_),()=>document.removeEventListener("navigateToArchiveSession",_)},[te,Dr,e,$e]);const sR=async()=>{try{const _=await sx({limit:He,offset:Ct,includeArchived:ft.current});if(_&&_.sessions){const B=Array.isArray(_.sessions)?_.sessions:[];Tt(G=>{for(var X={},ae=0;ae<G.length;ae++)X[G[ae].id]=!0;for(var de=[],ge=0;ge<B.length;ge++)X[B[ge].id]||de.push(B[ge]);return G.concat(de)}),at(!!_.hasMore),Lt(G=>{var X=G+B.length;return un.current=X,X})}}catch(_){console.error("Failed to load more sessions:",_)}},ta=async _=>{try{const B=await JF(_);return Je.current!==_?null:Array.isArray(B)?(xe(G=>{const X=B.some(I=>I.info.mode==="compaction"),ae=Array.isArray(G)&&G.some(I=>I.info&&I.info.mode==="compaction");if(X&&!ae)return B;const de=new Set(B.map(I=>I.info.id)),ge=G.filter(I=>I.info.sessionID===_&&!de.has(I.info.id)&&!String(I.info.id).startsWith("temp-"));if(ge.length===0)return B;const et=[];let jt=0,ie=0;for(;jt<B.length||ie<ge.length;){const I=B[jt],H=ge[ie],oe=I&&I.info.time&&typeof I.info.time.created=="number"?I.info.time.created:1/0,be=H&&H.info.time&&typeof H.info.time.created=="number"?H.info.time.created:1/0;jt<B.length&&(ie>=ge.length||oe<=be)?(et.push(I),jt++):(et.push(H),ie++)}return et}),B):(xe([]),null)}catch(B){return console.error("Failed to load messages:",B),Je.current===_&&xe([]),null}};h.useEffect(()=>{if(!te){xe([]),cn({}),Na(null),Sa(!0);return}if(xe([]),Na(null),Sa(!1),Xs(null),te){o_(te).then(ie=>{ie&&Array.isArray(ie.banners)&&Qs(I=>({...I,[te]:ie.banners}))}).catch(()=>{}),$f(te).then(ie=>{ie&&Array.isArray(ie.todos)&&ui(I=>({...I,[te]:ie.todos}))}).catch(()=>{});var _=te;bc(_,0,0).then(function(ie){if(Je.current===_&&!(!ie||typeof ie.totalTurns!="number")){var I=ie.totalTurns,H=d(_);if(I===0){St(function(oe){if(!oe[_])return oe;var be=Object.assign({},oe);return delete be[_],be});return}H>0&&H<=I?bc(_,H,0).then(function(oe){Je.current===_&&(!oe||!Array.isArray(oe.messages)||St(function(be){return Object.assign({},be,{[_]:{totalTurns:I,loadedTurns:oe.loadedTurns||H,hasMore:oe.hasMore!==!1,messages:oe.messages}})}))}).catch(function(){St(function(oe){return Object.assign({},oe,{[_]:{totalTurns:I,loadedTurns:0,hasMore:I>0,messages:[]}})})}):St(function(oe){return Object.assign({},oe,{[_]:{totalTurns:I,loadedTurns:0,hasMore:I>0,messages:[]}})})}}).catch(()=>{})}ct.connect(te);let B=!1,G=!1,X=!1,ae=!1;const de=te,ge=ie=>{if(Je.current!==de)return;const I=new Map;if(Array.isArray(ie))for(const H of ie){if(!H||!H.info||!H.info.id||!Array.isArray(H.parts))continue;const oe=new Set;for(const be of H.parts)be&&(be.type==="text"||be.type==="reasoning")&&oe.add(be.type);oe.size>0&&I.set(H.info.id,oe)}cn(H=>{const oe=H[de];if(!oe||Object.keys(oe).length===0)return H;const be={};let Te=!1;for(const Fe of Object.keys(oe)){const rt=oe[Fe],tt={};let xt=!1;const tn=I.get(Fe);for(const ra of Object.keys(rt)){const no=rt[ra];if(no._fromSnapshot){tt[ra]=no,xt=!0;continue}const Vd=no.type;if(tn&&tn.has(Vd)){Te=!0;continue}tt[ra]=rt[ra],xt=!0}xt?be[Fe]=tt:Te=!0}if(!Te)return H;if(Object.keys(be).length===0){const Fe={...H};return delete Fe[de],Fe}return{...H,[de]:be}})},et=setTimeout(()=>{!B&&!G&&(G=!0,ta(de).then(ie=>{X=!0,ge(ie),ae&&Je.current===de&&ta(de).then(I=>{ge(I)})}))},3e3),jt=[ct.on("connected",()=>{B=!0,clearTimeout(et),Sa(!0),Fd(),s_().then(ie=>{Zr(ie)}).catch(()=>{}),qf(de).then(ie=>{const I=Array.isArray(ie&&ie.items)?ie.items:[];Wi(H=>{const oe={...H};if(I.length===0)if(oe[de])delete oe[de];else return H;else oe[de]=I;return oe})}).catch(()=>{}),ta(de).then(ie=>{X=!0,ge(ie),ae&&Je.current===de&&ta(de).then(I=>{ge(I)})})}),ct.on("error",()=>{Sa(!1),!B&&!G&&(clearTimeout(et),G=!0,ta(de).then(ie=>{X=!0,ge(ie),ae&&Je.current===de&&ta(de).then(I=>{ge(I)})}))}),ct.on("session.status",ie=>{var oe;const I=ie.properties||ie,H=((oe=I.status)==null?void 0:oe.type)==="busy";ln(I.sessionID,H)}),ct.on("message.part.delta",ie=>{const I=(ie.properties||ie).part;if(!I||!I.sessionID)return;q.current.has(I.sessionID)&&q.current.delete(I.sessionID);const{sessionID:H,messageID:oe}=I;if(cn(be=>{const Te=be[H]||{},Fe={...Te[oe]||{}},rt=Fe[I.id];return I.type==="text"||I.type==="reasoning"?Fe[I.id]={...I,text:((rt==null?void 0:rt.text)||"")+(I.delta||"")}:Fe[I.id]={...rt,...I},{...be,[H]:{...Te,[oe]:Fe}}}),I.type==="text"&&I.delta){const be=Od.current;be[H]||(be[H]={}),be[H][oe]=(be[H][oe]||"")+I.delta,Ul.current&&console.log("[WhatsApp] Accumulating text delta:",I.delta.length,"chars, total:",be[H][oe].length)}}),ct.on("streaming.snapshot",ie=>{const I=ie.properties||ie,H=I.sessionID,oe=I.parts;!H||!Array.isArray(oe)||cn(be=>{const Te={...be[H]||{}};for(const Fe of oe){const rt={...Te[Fe.messageID]||{}};rt[Fe.id]={id:Fe.id,type:Fe.type,text:Fe.text,sessionID:H,messageID:Fe.messageID,_fromSnapshot:!0},Te[Fe.messageID]=rt}return{...be,[H]:Te}})}),ct.on("message.progress",ie=>{const I=ie.properties||ie;I.sessionID===Je.current&&Na({chunks:I.chunks||0,textLength:I.textLength||0,toolCalls:I.toolCalls||0,toolArgBytes:I.toolArgBytes||0,toolNames:I.toolNames||[]})}),ct.on("message.part.updated",ie=>{const I=(ie.properties||ie).part;if(I){if(I.type==="text"||I.type==="reasoning"){const H=I.sessionID;cn(oe=>{const be=oe[H];if(!be)return oe;const Te=be[I.messageID];if(!Te)return oe;const Fe={};var rt=!1;for(const tt of Object.keys(Te))Te[tt].type!==I.type&&(Fe[tt]=Te[tt],rt=!0);if(!rt){const tt={...be};if(delete tt[I.messageID],Object.keys(tt).length===0){const xt={...oe};return delete xt[H],xt}return{...oe,[H]:tt}}return{...oe,[H]:{...be,[I.messageID]:Fe}}})}if(I.sessionID===Je.current){if(!X){I.sessionID===de&&(ae=!0);return}(I.type==="tool"||I.type==="tool-use")&&wv.current==="tools"&&l_(I.sessionID).then(H=>{H&&Ll(oe=>({...oe,[I.sessionID]:H}))}).catch(()=>{}),xe(H=>H.map(oe=>{if(oe.info.id!==I.messageID)return oe;const be=oe.parts.findIndex(rt=>rt.id===I.id);if(be>=0)return{...oe,parts:oe.parts.map((rt,tt)=>tt===be?I:rt)};const Te=oe.parts.slice();let Fe=Te.length;for(let rt=Te.length-1;rt>=0;rt--){if(Te[rt].id<=I.id){Fe=rt+1;break}rt===0&&(Fe=0)}return Te.splice(Fe,0,I),{...oe,parts:Te}}))}}}),ct.on("message.updated",ie=>{const I=(ie.properties||ie).info;if(!(!I||I.sessionID!==Je.current)){if(!X){I.sessionID===de&&(ae=!0);return}if(xe(H=>{const oe=H.findIndex(tt=>tt.info.id===I.id);if(oe>=0)return H.map((tt,xt)=>xt===oe?{...tt,info:I}:tt);if(I.role==="user"){const tt=H.findIndex(xt=>xt.info.id&&xt.info.id.startsWith("temp-")&&xt.info.role==="user");if(tt>=0)return H.map((xt,tn)=>tn===tt?{info:I,parts:[]}:xt)}const be={info:I,parts:[]};if(!I.time||typeof I.time.created!="number")return[...H,be];const Te=I.time.created;let Fe=H.length;for(let tt=H.length-1;tt>=0;tt--){const xt=H[tt].info.time;if(xt&&typeof xt.created=="number"&&xt.created<=Te){Fe=tt+1;break}tt===0&&(Fe=0)}const rt=H.slice();return rt.splice(Fe,0,be),rt}),I.finish){const H=I.sessionID;if(I.role==="assistant"&&Ul.current&&H===Je.current){const oe=Od.current[H];oe&&oe[I.id]&&(delete oe[I.id],Object.keys(oe).length===0&&delete Od.current[H]),GB(H).then(be=>{if(be&&be.message)return console.log(`[WhatsApp] Processing queued message (${be.remaining} remaining)`),vc(H,be.message.text,null,ee.current[H]||void 0)}).catch(be=>{console.error("[WhatsApp] Failed to process queue:",be)})}cn(oe=>{const be=oe[H];if(!be||!be[I.id])return oe;const Te={...be};if(delete Te[I.id],Object.keys(Te).length===0){const Fe={...oe};return delete Fe[H],Fe}return{...oe,[H]:Te}}),Na(null),I.finish!=="compacted"&&ln(H,!1),ta(Je.current)}}}),ct.on("message.deleted",ie=>{const I=ie.properties||ie,H=I.sessionID,oe=I.messageID;!H||!oe||H===Je.current&&(xe(be=>be.filter(Te=>Te.info.id!==oe)),cn(be=>{if(!be[H])return be;const Te=be[H];if(!Te[oe])return be;const Fe={...be},rt={...Te};return delete rt[oe],Fe[H]=rt,Fe}))}),ct.on("session.updated",ie=>{const I=ie.properties||ie,H=I.info||I,oe=H&&(H.id||H.sessionID)||I.sessionID||I.id;if(!oe){Dr();return}const be=H&&H.time&&typeof H.time.updated=="number",Te=Fe=>{Tt(rt=>{var tt=!1,xt=rt.map(tn=>tn.id===oe?(tt=!0,{...Fe,ui:{...Fe.ui,...tn.ui}}):tn);return tt||(xt=[Fe].concat(xt)),xt.sort((tn,ra)=>ra.time.updated-tn.time.updated),xt})};be?(Te(H),ut(Fe=>{let rt=Fe;const tt=H.model;return typeof tt=="string"&&tt||tt&&typeof tt=="object"&&tt.providerID&&tt.modelID?rt={...Fe,[oe]:tt}:Fe[oe]&&(rt={...Fe},delete rt[oe]),ee.current=rt,rt})):Uf(oe).then(Fe=>{Te(Fe),ut(rt=>{let tt=rt;const xt=Fe&&Fe.model;return typeof xt=="string"&&xt||xt&&typeof xt=="object"&&xt.providerID&&xt.modelID?tt={...rt,[oe]:xt}:rt[oe]&&(tt={...rt},delete tt[oe]),ee.current=tt,tt})}).catch(Fe=>{console.error("Failed to fetch updated session, falling back to full reload:",Fe),Dr()})}),ct.on("session.deleted",ie=>{const I=ie.properties||ie,H=I.info||I,oe=H&&(H.id||H.sessionID)||I.sessionID||I.id;oe&&(Tt(be=>be.filter(Te=>Te.id!==oe)),zt(be=>be===oe?null:be))}),ct.on("permission.request",ie=>{const I=ie.properties||ie;I.requestId&&re(H=>H.some(oe=>oe.id===I.requestId)?H:[...H,{id:I.requestId,action:I.action,type:I.type,target:I.target,reason:I.reason,description:I.description,timestamp:Date.now()}])}),ct.on("permission.confirmed",ie=>{const I=ie.properties||ie;I.requestId&&re(H=>H.filter(oe=>oe.id!==I.requestId))}),ct.on("permission.denied",ie=>{const I=ie.properties||ie;I.requestId&&re(H=>H.filter(oe=>oe.id!==I.requestId))}),ct.on("question.asked",ie=>{const I=ie.properties||ie;if(!I.id)return;const H=I.tool&&I.tool.callID?I.tool.callID:null;if(H&&Se(oe=>({...oe,[H]:I.id})),pl()){const oe=I.questions&&I.questions[0],be=oe?oe.text:"A question needs your input.",Te=I.sessionID||null;$A({title:"PAVE — Question",body:be.length>200?be.slice(0,200)+"…":be,tag:"pave-question-"+I.id,onClick:Te?function(){ur(Te),window.focus()}:function(){window.focus()}})}}),ct.on("question.replied",ie=>{const I=ie.properties||ie;I.requestId&&Se(H=>{var oe={};for(var be in H)H[be]!==I.requestId&&(oe[be]=H[be]);return oe})}),ct.on("question.rejected",ie=>{const I=ie.properties||ie;I.requestId&&Se(H=>{var oe={};for(var be in H)H[be]!==I.requestId&&(oe[be]=H[be]);return oe})}),ct.on("quality.hint",ie=>{const I=ie.properties||ie;if(!I.preset)return;const H=I.sessionID;H&&(tR(oe=>({...oe,[H]:I})),bv.current[H]=I)}),ct.on("dlp.cancelled",ie=>{const H=(ie.properties||ie).sessionID;if(!H)return;const oe=q.current.get(H);oe&&(oe.tempId&&xe(be=>be.filter(Te=>Te.info.id!==oe.tempId)),H===Je.current&&A.current&&typeof A.current.setText=="function"&&A.current.setText(oe.text||""),q.current.delete(H)),ln(H,!1)}),ct.on("dlp.private_message",ie=>{const I=ie.properties||ie,H=I.sessionID,oe=I.messageID;!H||!oe||(K(be=>{if(be.has(oe))return be;const Te=new Set(be);return Te.add(oe),Te}),M(be=>{if(be.has(H))return be;const Te=new Set(be);return Te.add(H),Te}))}),ct.on("dlp.exited_private",ie=>{const H=(ie.properties||ie).sessionID;H&&M(oe=>{if(!oe.has(H))return oe;const be=new Set(oe);return be.delete(H),be})}),ct.on("session.error",ie=>{const I=ie.properties||ie;if(I.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",I.source||""),$e("Session expired. Please log in again."),Oe(null),I.sessionID&&ln(I.sessionID,!1);return}I.sessionID&&ln(I.sessionID,!1),I.sessionID===Je.current&&(I.code==="insufficient_credits"?($e(null),we(I.upgradeUrl||null),O(!0)):$e(I.error||"An error occurred"))}),ct.on("session.retry",ie=>{const I=ie.properties||ie;I.reason==="rate_limit"&&I.sessionID===Je.current&&(Qr({attempt:I.attempt,maxRetries:I.maxRetries,delayMs:I.delayMs,elapsedMs:I.elapsedMs||0,maxDurationMs:I.maxDurationMs||0}),on.current&&clearTimeout(on.current),on.current=setTimeout(()=>Qr(null),1e4))}),ct.on("session.compacting",ie=>{const I=ie.properties||ie;I.sessionID===Je.current&&Yr(H=>({...H,currentTokens:I.currentTokens??(H==null?void 0:H.currentTokens),threshold:I.threshold??(H==null?void 0:H.threshold),reason:I.reason??(H==null?void 0:H.reason),stage:I.stage??(H==null?void 0:H.stage),elapsedMs:I.elapsedMs??(H==null?void 0:H.elapsedMs),messageCount:I.messageCount??(H==null?void 0:H.messageCount),chunks:I.chunks??(H==null?void 0:H.chunks),textLength:I.textLength??(H==null?void 0:H.textLength)}))}),ct.on("session.compacted",ie=>{const I=ie.properties||ie,H=Je.current;if(I.sessionID===H){if(Yr(null),cr(null),I.newSessionID&&I.newSessionID!==H&&!I.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${H} → ${I.newSessionID}`),St(function(Te){if(!Te[H])return Te;var Fe=Object.assign({},Te);return delete Fe[H],Fe}),f(H,0),I.newSession){Hl(I.newSession);const Te=I.newSession.model;(typeof Te=="string"&&Te||Te&&typeof Te=="object"&&Te.providerID&&Te.modelID)&&ut(rt=>{const tt={...rt,[I.newSessionID]:Te};return ee.current=tt,tt})}Je.current=I.newSessionID,zt(I.newSessionID),wa(!0);return}if(I.source==="server"){const Te=I.summary?I.summary.substring(0,200)+(I.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${I.deletedMessages} messages replaced, ${I.summaryTokens||"?"} summary tokens`),Te&&console.log("[SERVER-COMPACT] Summary: "+Te),cr({source:"server",deletedMessages:I.deletedMessages||0,summaryTokens:I.summaryTokens||0,summary:Te})}const oe=I.inPlace===!0,be=!!li.current[H];oe&&be?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(xe([]),St(function(Te){if(!Te[H])return Te;var Fe=Object.assign({},Te);return delete Fe[H],Fe}),f(H,0),cn(Te=>{if(!Te[H])return Te;const Fe={...Te};return delete Fe[H],Fe}),Na(null),ta(H).then(()=>{bc(H,0,0).then(function(Te){Je.current===H&&(!Te||typeof Te.totalTurns!="number"||Te.totalTurns>0&&St(function(Fe){return Object.assign({},Fe,{[H]:{totalTurns:Te.totalTurns,loadedTurns:0,hasMore:Te.totalTurns>0,messages:[]}})}))}).catch(()=>{}),requestAnimationFrame(()=>{Mt.current&&Je.current===H&&Mt.current.scrollToBottom()})}))}}),ct.on("banner.updated",ie=>{const I=ie.properties||ie;!I||!I.sessionID||(Qs(H=>{const oe=H[I.sessionID]||[];if(oe.some(Te=>Te.timestamp===I.timestamp))return H;const be=[{url:I.url,timestamp:I.timestamp,prompt:I.prompt,createdAt:new Date(I.timestamp).toISOString()},...oe];return{...H,[I.sessionID]:be}}),I.sessionID===Je.current&&Xs(null))}),ct.on("banner.progress",ie=>{const I=ie.properties||ie;if(!I||I.sessionID!==Je.current)return;const H=I.stage||"working";let oe=H;H==="queued"?oe="Banner queued":H==="summarizing"?oe="Banner: summarizing…":H==="rendering"?oe=I.line?"Banner: "+I.line.substring(0,80):"Banner: rendering…":H==="saved"?oe="Banner saved":H==="error"?oe="Banner error: "+(I.message||"unknown"):H==="skipped"&&(oe="Banner skipped: "+(I.reason||"")),Xs({stage:H,label:oe,ts:Date.now()}),H==="saved"&&I.sessionID&&o_(I.sessionID).then(be=>{be&&Array.isArray(be.banners)&&Qs(Te=>({...Te,[I.sessionID]:be.banners}))}).catch(()=>{})}),ct.on("todo.updated",ie=>{const I=ie.properties||ie;!I||!I.sessionID||(Array.isArray(I.todos)?ui(H=>({...H,[I.sessionID]:I.todos})):$f(I.sessionID).then(H=>{H&&Array.isArray(H.todos)&&ui(oe=>({...oe,[I.sessionID]:H.todos}))}).catch(()=>{}))}),ct.on("whatsapp.message",ie=>{var H;const I=ie.properties||ie;I.sessionId===Je.current&&Ul.current&&(console.log("[WhatsApp] Injecting message:",(H=I.text)==null?void 0:H.substring(0,50)),vc(I.sessionId,I.text,null,ee.current[I.sessionId]||void 0).catch(oe=>console.error("[WhatsApp] Failed to inject message:",oe)))}),ct.on("whatsapp.queued",ie=>{const I=ie.properties||ie;I.sessionId===Je.current&&console.log(`[WhatsApp] Message queued from ${I.sender} (queue size: ${I.queueSize})`)}),ct.on("queue.updated",ie=>{const I=ie.properties||ie;if(!I||!I.sessionID)return;const H=Array.isArray(I.items)?I.items:[];Wi(oe=>{const be={...oe};return H.length===0?delete be[I.sessionID]:be[I.sessionID]=H,be})}),ct.on("idle-injection.enabled",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||(Bl(!0),Js(e("chat.idle_injection_enabled_toast"),"success"))}),ct.on("idle-injection.disabled",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||(Bl(!1),Js(e("chat.idle_injection_disabled_toast"),"info"))}),ct.on("idle-injection.fired",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||Js(e("chat.idle_injection_fired_toast"),"success")}),ct.on("idle-injection.timeout",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||Js(e("chat.idle_injection_timeout_toast"),"warning")}),ct.on("scheduled-injection.fired",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||Js(e("scheduled_injection.fired_toast"),"success")}),ct.on("scheduled-injection.added",ie=>{const I=ie.properties||ie;!I||I.sessionID}),ct.on("scheduled-injection.removed",ie=>{const I=ie.properties||ie;!I||I.sessionID}),ct.on("prefill.fallback",ie=>{const I=ie.properties||ie;!I||I.sessionID!==de||(Xr({originalModel:I.originalModel,fallbackModel:I.fallbackModel,reason:I.reason||"prefill_too_large"}),Sn.current&&clearTimeout(Sn.current),Sn.current=setTimeout(()=>{Xr(null),Sn.current=null},15e3))}),ct.on("auth.device_code",ie=>{const I=ie.properties||ie;I.user_code&&I.verification_uri&&Ks({verification_uri:I.verification_uri,user_code:I.user_code,expires_in:I.expires_in||300})})];return()=>{clearTimeout(et),Yi.current&&clearTimeout(Yi.current),Sn.current&&(clearTimeout(Sn.current),Sn.current=null),Xr(null),jt.forEach(ie=>ie()),ct.disconnect()}},[te]),h.useEffect(()=>{if(!te)return;const _=setTimeout(()=>{var B;(B=A.current)==null||B.focus()},50);return()=>{clearTimeout(_)}},[te]);function Hl(_){Tt(B=>{for(var G=0;G<B.length;G++)if(B[G].id===_.id)return B.map(X=>X.id===_.id?_:X);return[_,...B]})}const Bd=h.useCallback(async()=>{try{const _=await e_();Hl(_);const B=Je.current;B&&B!==_.id&&$l(B),ql.current.add(_.id),Je.current=_.id,zt(_.id)}catch(_){$e("Failed to create session: "+_.message)}},[$l]),oR=h.useMemo(function(){var _=Ye[te];if(!_||!_.messages||_.messages.length===0)return Vt;for(var B=_.messages,G=[],X=0,ae=0;X<Vt.length||ae<B.length;){var de=Vt[X],ge=B[ae],et=de&&de.info&&de.info.time&&typeof de.info.time.created=="number"?de.info.time.created:1/0,jt=ge&&ge.info&&ge.info.time&&typeof ge.info.time.created=="number"?ge.info.time.created:1/0;X<Vt.length&&(ae>=B.length||et<=jt)?(G.push(de),X++):(G.push(ge),ae++)}return G},[Vt,Ye,te]);F.current=Bd;const ur=h.useCallback(async _=>{var G;if(_===Je.current)return;const B=Je.current;B&&B!==_&&$l(B),Je.current=_,zt(_),$e(null),wa(!!li.current[_]),Yr(null);try{const X=await Uf(_);if(Je.current!==_)return;((G=X==null?void 0:X.status)==null?void 0:G.type)==="busy"&&wa(!0),Tt(ae=>{var ie;if(!X)return ae;const de=ae.findIndex(I=>I.id===_),ge=((ie=X.time)==null?void 0:ie.updated)||0;if(de>=0){const I=ae[de],H=ae.filter(Te=>Te.id!==_),oe={...X,ui:{...X.ui,...I.ui}},be=H.findIndex(Te=>{var Fe;return(((Fe=Te.time)==null?void 0:Fe.updated)||0)<=ge});return H.splice(be<0?H.length:be,0,oe),H}const et=ae.findIndex(I=>{var H;return(((H=I.time)==null?void 0:H.updated)||0)<=ge}),jt=[...ae];return jt.splice(et<0?jt.length:et,0,X),jt}),ut(ae=>{if(X&&X.model)return{...ae,[_]:X.model};if(ae[_]){const de={...ae};return delete de[_],de}return ae})}catch(X){console.error("Failed to fetch session status for session",_,X)}},[$l]),lR=h.useCallback(async function(){var _=Je.current;if(_){var B=Ye[_];if(B){var G=B.loadedTurns||0,X=a;lr(!0);try{var ae=await bc(_,X,G);if(!ae||!Array.isArray(ae.messages))return;var de=ae.messages.concat(B.messages||[]),ge=(B.loadedTurns||0)+(ae.loadedTurns||0);St(function(et){var jt=et[_]||B;return Object.assign({},et,{[_]:{totalTurns:ae.totalTurns!=null?ae.totalTurns:jt.totalTurns,loadedTurns:ge,hasMore:ae.hasMore!==!1,messages:de}})}),f(_,ge)}catch(et){console.error("Failed to load compacted messages:",et)}finally{lr(!1)}}}},[Ye]),cR=h.useCallback(function(){var _=Je.current;_&&(St(function(B){if(!B[_])return B;var G=Object.assign({},B);return G[_]={totalTurns:B[_].totalTurns,loadedTurns:0,hasMore:B[_].totalTurns>0,messages:[]},G}),f(_,0))},[]),uR=h.useCallback(async _=>{try{await t_(_),Tt(B=>B.filter(G=>G.id!==_)),te===_&&(Je.current=null,zt(null))}catch(B){$e("Failed to delete: "+B.message)}},[te]),dR=h.useCallback(async()=>{try{await ZF(),await Dr(),Je.current=null,zt(_=>_&&null)}catch(_){$e("Failed to delete sessions: "+_.message)}},[Dr]),fR=h.useCallback(async(_,B)=>{try{await dr(_,{title:B}),Tt(G=>G.map(X=>X.id===_?{...X,title:B}:X))}catch(G){$e("Failed to rename: "+G.message)}},[]),gR=h.useCallback(async _=>{try{const B=await YF(_);B&&B.title&&Tt(G=>G.map(X=>X.id===_?{...X,title:B.title}:X))}catch(B){$e("Failed to regenerate title: "+B.message)}},[]),pR=h.useCallback(async(_,B)=>{try{await dr(_,{pinned:B}),Tt(G=>G.map(X=>X.id===_?{...X,pinned:B}:X))}catch(G){$e("Failed to pin: "+G.message)}},[]),hR=h.useCallback(async _=>{const B=Nt.find(X=>X.id===_);if(!B||!B.parentSessionID)return;const G=B.parentSessionID;try{await nB(_),Tt(X=>X.map(ae=>ae.id===_?{...ae,compactionPinned:!1}:ae)),Je.current=G,zt(G)}catch(X){$e("Failed to unpin: "+X.message)}},[Nt]),mR=h.useCallback(async(_,B)=>{try{await dr(_,{archived:B}),!ft.current&&B?(Tt(G=>G.filter(X=>X.id!==_)),te===_&&(Je.current=null,zt(null))):Tt(G=>G.map(X=>X.id===_?{...X,archived:B}:X))}catch(G){$e("Failed to archive: "+G.message)}},[te]),yR=h.useCallback(async({readOnly:_=!1}={})=>{if(!te)return;let B,G,X;if(Tt(ae=>{var ge;const de=ae.find(et=>et.id===te);return B=((ge=de==null?void 0:de.ui)==null?void 0:ge.hideThinking)??!0,G=!B,X=de==null?void 0:de.ui,ae.map(et=>et.id===te?{...et,ui:{...et.ui,hideThinking:G}}:et)}),!_)try{await dr(te,{ui:{...X,hideThinking:G}})}catch(ae){console.error("Failed to persist hideThinking:",ae),Tt(de=>de.map(ge=>ge.id===te?{...ge,ui:{...ge.ui,hideThinking:B}}:ge)),$e("Failed to save thinking visibility preference"+(ae!=null&&ae.message?": "+ae.message:""))}},[te]),Ev=h.useCallback(async _=>{try{await zB(_)}catch(B){$e("Export failed: "+B.message)}},[]),zd=h.useCallback(async _=>{try{const B=await UB(_);B&&B.id&&(await Dr(),ur(B.id))}catch(B){$e("Import failed: "+B.message)}},[Dr,ur]),Nv=h.useRef(!1);h.useEffect(()=>{if(!Nv.current&&!(!ja||Nt.length===0)){Nv.current=!0;var _=null,B=!1;try{var G=new URLSearchParams(window.location.search);_=G.get("session"),B=!!_}catch{}if(_||(_=s()),!!_){if(Nt.some(function(X){return X.id===_})){ur(_);return}Uf(_).then(function(X){X&&X.id?ur(_):B||c()}).catch(function(){B||c()})}}},[ja,Nt,ur]),h.useEffect(()=>{function _(B){var G=B.data;!G||G.type!=="navigate-session"||G.sessionId&&ur(G.sessionId)}return window.addEventListener("message",_),function(){window.removeEventListener("message",_)}},[ur]),h.useEffect(()=>{function _(){try{var G=indexedDB.open("pave-sw",1);G.onupgradeneeded=function(){G.result.createObjectStore("pave-pending-nav")},G.onsuccess=function(){var X=G.result;if(!X.objectStoreNames.contains("pave-pending-nav")){X.close();return}var ae=X.transaction("pave-pending-nav","readwrite"),de=ae.objectStore("pave-pending-nav"),ge=de.get("sessionId");ge.onsuccess=function(){var et=ge.result;de.delete("sessionId"),et&&et!==Je.current&&ur(et)},ae.oncomplete=function(){X.close()},ae.onerror=function(){X.close()}},G.onerror=function(){}}catch{}}function B(){document.visibilityState==="visible"&&(_(),setTimeout(_,500),setTimeout(_,1500))}return document.addEventListener("visibilitychange",B),function(){document.removeEventListener("visibilitychange",B)}},[ur]);const xR=h.useCallback(async _=>{if(!te)return;const B=Me.current,G=(B[te]||0)+1;B[te]=G;const X=ee.current[te];ut(ae=>{const de={...ae};return _?de[te]=_:delete de[te],ee.current=de,de});try{const ae=await dr(te,{model:_||null});if(B[te]!==G)return;ae&&(typeof ae.model=="string"&&ae.model||ae.model&&typeof ae.model=="object"&&ae.model.providerID&&ae.model.modelID)?ut(de=>{const ge={...de,[te]:ae.model};return ee.current=ge,ge}):_||ut(de=>{const ge={...de};return delete ge[te],ee.current=ge,ge})}catch(ae){if(B[te]!==G)return;ut(de=>{const ge={...de};return X!==void 0?ge[te]=X:delete ge[te],ee.current=ge,ge}),console.error("[ModelChange] PATCH failed for session",te,ae),$e("Failed to update session model: "+ae.message)}},[te]),bR=h.useCallback(async function(_,B){if(te){var G=it&&it.disabledSkills||[],X;B?X=G.filter(function(ae){return ae!==_}):X=G.concat([_]),Tt(function(ae){return ae.map(function(de){return de.id===te?{...de,disabledSkills:X}:de})});try{await dr(te,{disabledSkills:X})}catch(ae){Tt(function(de){return de.map(function(ge){return ge.id===te?{...ge,disabledSkills:G}:ge})}),console.error("[SkillToggle] PATCH failed:",ae)}}},[te,it]),vR=h.useCallback(async function(){if(te)try{var _=await uT(),B=_.skillDefaults||{},G=await Ub(),X=["agent"];(G||[]).forEach(function(ae){B[ae.name]||X.push(ae.name)}),Tt(function(ae){return ae.map(function(de){return de.id===te?{...de,disabledSkills:X}:de})}),await dr(te,{disabledSkills:X})}catch(ae){console.error("[SkillToggle] Reset to defaults failed:",ae)}},[te]),kR=h.useCallback(_=>{Tt(B=>B.map(G=>G.id===te?{...G,directory:_}:G)),Ad(!1)},[te]),_R=h.useCallback(async()=>{const _=!ft.current;ft.current=_,await Dr({includeArchived:_})?dt(_):ft.current=!_},[]),eo=h.useCallback(async(_,B,G,X,ae,de,ge)=>{const et=_===Je.current;de&&et&&xe(Ot=>Ot.filter(Pr=>Pr.info.id!==de));var jt=(G?G.length:0)+(ge?ge.length:0);if(jt>Nu)throw $e("Too many attachments. Maximum "+Nu+" per message."),new Error("Too many attachments");var ie=[],I=0;if(G&&G.length>0){for(var H=0;H<G.length;H++){var oe=(G[H].file.type||"").toLowerCase();if(rd.indexOf(oe)===-1)throw $e('Unsupported image type: "'+G[H].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(G[H].file.size>c_){var be=Math.round(G[H].file.size/1024/1024*10)/10,Te=Math.round(c_/1024/1024*10)/10;throw $e('Image "'+G[H].name+'" ('+be+"MB) exceeds the "+Te+"MB size limit."),new Error("Image too large")}I+=G[H].file.size}if(I>f_){var Fe=Math.round(I/1024/1024*10)/10,rt=Math.round(f_/1024/1024*10)/10;throw $e("Combined image size ("+Fe+"MB) exceeds the "+rt+"MB total image limit."),new Error("Combined image size too large")}try{ie=await Promise.all(G.map(function(Ot){return new Promise(function(Pr,vn){var pn=new FileReader;pn.onload=function(){if(typeof pn.result!="string"){vn(new Error("FileReader did not produce a data URL for: "+Ot.name));return}Pr({type:"image_url",image_url:{url:pn.result}})},pn.onerror=function(){vn(new Error("Failed to read file: "+Ot.name))},pn.readAsDataURL(Ot.file)})}))}catch(Ot){throw $e("Failed to read image: "+Ot.message),Ot}}var tt=[],xt=0;if(ge&&ge.length>0){for(var tn=0;tn<ge.length;tn++){var ra=(ge[tn].file.type||"").toLowerCase();if(gT.indexOf(ra)===-1)throw $e('Unsupported file type: "'+ge[tn].name+'" ('+(ra||"unknown")+")."),new Error("Unsupported file type");if(ge[tn].file.size>u_){var no=Math.round(ge[tn].file.size/1024/1024*10)/10,Vd=Math.round(u_/1024/1024*10)/10;throw $e('File "'+ge[tn].name+'" ('+no+"MB) exceeds the "+Vd+"MB size limit."),new Error("File too large")}xt+=ge[tn].file.size}if(I+xt>d_){var OR=Math.round((I+xt)/1024/1024*10)/10,DR=Math.round(d_/1024/1024*10)/10;throw $e("Combined attachment size ("+OR+"MB) exceeds the "+DR+"MB total limit."),new Error("Combined attachment size too large")}try{tt=await Promise.all(ge.map(function(Ot){return new Promise(function(Pr,vn){var pn=new FileReader;pn.onload=function(){if(typeof pn.result!="string"){vn(new Error("FileReader did not produce a data URL for: "+Ot.name));return}Pr({type:"file",mime:Ot.file.type,filename:Ot.name,url:pn.result})},pn.onerror=function(){vn(new Error("Failed to read file: "+Ot.name))},pn.readAsDataURL(Ot.file)})}))}catch(Ot){throw $e("Failed to read file: "+Ot.message),Ot}}const aa="temp-"+Date.now();for(var Gd=[{id:aa+"-text",type:"text",text:ae}],Wl=0;Wl<ie.length;Wl++)Gd.push({id:aa+"-img-"+Wl,type:"image_url",image_url:ie[Wl].image_url});for(var ro=0;ro<tt.length;ro++)Gd.push({id:aa+"-file-"+ro,type:"file",mime:tt[ro].mime,filename:tt[ro].filename});const PR={info:{id:aa,sessionID:_,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:Gd};xe(Ot=>et?[...Ot,PR]:Ot),ln(_,!0),q.current.set(_,{text:ae,tempId:aa});try{var jv=null;(ie.length>0||tt.length>0)&&(jv=tt.concat(ie));const Ot=Md.current[_]??null,Pr=Ld.current[_]??"max",vn=Ot===null&&!zl.current.has(_),pn=bv.current[_],Kd=vn&&pn?pn.moe_topk||null:Ot;await vc(_,B,jv,ee.current[_]||void 0,X,{moeTopK:Kd,reasoningEffort:Pr,adaptiveQuality:vn})}catch(Ot){if(Ot.status===409)if(ie.length>0||tt.length>0){const vn=aa;Xn.current[_]||(Xn.current[_]=[]),Xn.current[_].push({content:B,imageAttachments:G,fileAttachments:ge,agent:X,displayContent:ae,queuedTempId:vn}),Qi(_),ln(_,!1);return}else try{await n_(_,B,{displayContent:ae,agent:X||void 0,model:ee.current[_]||void 0,moeTopK:effectiveMoeTopK,reasoningEffort:sessReasoning,adaptiveQuality:isAutoMode}),xe(vn=>vn.filter(pn=>pn.info.id!==aa)),ln(_,!1);return}catch(vn){throw $e("Failed to queue message: "+vn.message),ln(_,!1),xe(pn=>pn.filter(Kd=>Kd.info.id!==aa)),vn}throw $e("Failed to send: "+Ot.message),ln(_,!1),xe(Pr=>Pr.filter(vn=>vn.info.id!==aa)),Ot}},[Qi]),Ud=h.useRef(eo);h.useEffect(()=>{Ud.current=eo},[eo]);const na=h.useCallback(async(_,B,G,X)=>{$e(null);const ae=_,de=_.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(de){const H=de[1],oe=de[2],be=de[3]||"",Te=be||H+" "+oe,Fe=(H+"_"+oe).replace(/-/g,"_").slice(0,128);_="[SKILL_HINT: User explicitly requested "+H+"."+oe+(be?" with args: "+be:"")+". Call the "+Fe+` tool with these parameters.]
120
-
121
- `+Te}let ge=Je.current;if(!ge)try{const H=await e_();Hl(H),Je.current=H.id,zt(H.id),ge=H.id,await new Promise(oe=>setTimeout(oe,200))}catch(H){throw $e("Failed to create session: "+H.message),H}if(ql.current.delete(ge),!!Or[ge]){if(!(B&&B.length>0||X&&X.length>0)){try{await n_(ge,_,{displayContent:ae,agent:G||void 0,model:ee.current[ge]||void 0})}catch(Fe){$e("Failed to queue message: "+Fe.message)}return}const oe="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),be=[{id:oe+"-text",type:"text",text:ae}];if(B&&B.length>0)for(var jt=0;jt<B.length;jt++){var ie=B[jt].preview||"";be.push({id:oe+"-img-"+jt,type:"image_url",image_url:{url:ie}})}if(X&&X.length>0)for(var I=0;I<X.length;I++)be.push({id:oe+"-file-"+I,type:"file",mime:X[I].file.type,filename:X[I].name});const Te={info:{id:oe,sessionID:ge,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:be};xe(Fe=>[...Fe,Te]),Xn.current[ge]||(Xn.current[ge]=[]),Xn.current[ge].push({content:_,imageAttachments:B,agent:G,displayContent:ae,queuedTempId:oe,fileAttachments:X}),Qi(ge);return}await eo(ge,_,B,G,ae,null,X)},[Or,eo,Qi]);h.useEffect(()=>{const _=()=>{na(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",_),()=>window.removeEventListener("pave:plan-execute",_)},[na,e]);const wR=h.useCallback(async()=>{if(te)try{const _=te;Pd.current.add(_),await rB(_)}catch(_){console.error("Abort failed:",_)}},[te]),ER=h.useCallback(async(_,B,G)=>{if($e(null),_==="btw"){const X=Je.current;if(!X){$e("No active session to fork.");return}let ae;try{ae=await QF(X)}catch(ge){throw $e("Fork failed: "+(ge&&ge.message?ge.message:String(ge))),ge}if(!ae||!ae.id)throw $e("Fork failed: server returned no session id."),new Error("Fork returned no session");Hl(ae),Je.current=ae.id,zt(ae.id),await new Promise(ge=>setTimeout(ge,200));const de=(B||"").trim();if(de)try{await na(de,G&&G.imageAttachments?G.imageAttachments:void 0,void 0,G&&G.fileAttachments?G.fileAttachments:void 0)}catch{}return}if(_==="compact"){const X=Je.current;if(!X){$e("No active session to compact.");return}$e(null),Yr({reason:"manual",stage:"starting"}),cr(null),tB(X).then(ae=>{if(!ae||!ae.success){Yr(null),$e("Compaction failed: "+(ae&&ae.error||"unknown error"));return}ta(X),Yr(null),cr(null)}).catch(ae=>{Yr(null),ae&&ae.status===409?$e("Cannot compact while the session is busy. Wait for the current response to finish."):$e("Compaction failed: "+(ae&&ae.message?ae.message:String(ae)))});return}$e("Unknown built-in command: /"+_)},[na]),NR=h.useCallback(_=>{re(B=>B.filter(G=>G.id!==_))},[]),SR=h.useCallback(async()=>{for(var _=Vt.length-1;_>=0;_--)if(Vt[_].info.role==="user"){var B=Vt[_].parts||[],G=qb(B,null),X=B.filter(function(ge){return ge.type==="image_url"&&ge.image_url});if(G.trim()||X.length>0)if(X.length>0){var ae=te;if(!ae)break;ln(ae,!0),$e(null);try{var de=X.map(function(ge){return{type:"image_url",image_url:ge.image_url}});await vc(ae,G.trim(),de,ee.current[ae]||void 0)}catch(ge){$e("Failed to retry: "+ge.message),ln(ae,!1)}}else try{await na(G.trim())}catch(ge){$e("Failed to retry: "+ge.message),ln(te,!1)}break}},[Vt,na,te]),CR=h.useCallback(async function(_){if(_&&_.trim()){$e(null),Mt.current&&Mt.current.resetAutoScroll();try{await na(_.trim()),Un.current&&cancelAnimationFrame(Un.current),Un.current=requestAnimationFrame(function(){Un.current=0,Mt.current&&Mt.current.scrollToBottom()})}catch(B){$e("Failed to resend: "+B.message),ln(te,!1)}}},[na]),_r=h.useMemo(()=>it?it.source==="tui"||it.source==="legacy"||it.source==="archive"||it._readOnly===!0:!1,[it]),qd=h.useMemo(()=>it?it._readOnly===!0&&it.source!=="tui"&&it.source!=="legacy"&&it.source!=="archive":!1,[it]),$d=h.useMemo(()=>{if(!qd||!it||!Nt)return null;for(const _ of Nt)if(_.parentSessionID===it.id)return _.id;return null},[qd,it,Nt]),jR=h.useMemo(()=>{var G;let _=null;for(let X=Vt.length-1;X>=0;X--)if(((G=Vt[X].info)==null?void 0:G.role)==="assistant"){_=Vt[X];break}if(!_)return[];const B=(_.parts||[]).filter(X=>X.type==="tool");return B.length===0?[]:!Qn&&B.every(ae=>{var de,ge;return((de=ae.state)==null?void 0:de.status)==="completed"||((ge=ae.state)==null?void 0:ge.status)==="error"})?[]:B},[Vt,Qn]),TR=h.useMemo(()=>{var B;const _=[];for(const G of Vt)if(((B=G.info)==null?void 0:B.role)==="assistant"){const X=(G.parts||[]).filter(ae=>ae.type==="tool");_.push(...X)}return _},[Vt]),Xi=h.useRef(0),[AR,Hd]=h.useState(!1),RR=h.useCallback(_=>{if(_.preventDefault(),_.stopPropagation(),Xi.current++,Xi.current===1){const B=_.dataTransfer;let G=!1;B&&B.items&&B.items.length>0&&(G=Array.from(B.items).some(X=>X.kind==="file")),G&&Hd(!0)}},[]),MR=h.useCallback(_=>{_.preventDefault(),_.stopPropagation(),Xi.current=Math.max(0,Xi.current-1),Xi.current===0&&Hd(!1)},[]),IR=h.useCallback(_=>{_.preventDefault(),_.stopPropagation()},[]),LR=h.useCallback(_=>{_.preventDefault(),_.stopPropagation(),Xi.current=0,Hd(!1);const B=_.dataTransfer&&_.dataTransfer.files;if(!B||B.length===0)return;const G=B[0],X=G.name.toLowerCase();if(!X.endsWith(".yaml")&&!X.endsWith(".yml")){$e(e("import.invalid_file_type"));return}const ae=10*1024*1024;if(G.size>ae){$e(e("import.file_too_large"));return}const de=new FileReader;de.onload=ge=>{const et=ge&&ge.target?ge.target.result:null;if(typeof et!="string"){$e(e("import.read_error"));return}zd(et)},de.onerror=()=>{$e(e("import.read_error"))},de.readAsText(G)},[zd,$e,e]);if(pe)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(!Ee)return o.jsx(zz,{darkMode:g,onToggleTheme:()=>p(!g)});const Sv=it==null?void 0:it.title,Wd=typeof Sv=="string"?Sv.trim():"",to=((Cv=it==null?void 0:it.ui)==null?void 0:Cv.hideThinking)??!0;return o.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:RR,onDragLeave:MR,onDragOver:IR,onDrop:LR,children:[AR&&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:g?"/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:()=>he("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${fe==="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:()=>he("agents"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${fe==="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:()=>he("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${fe==="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:()=>he("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${fe==="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(RY,{onNavigateToAgent:_=>{ve(_),he("agents")}}),o.jsx("button",{onClick:()=>y(!m),className:`p-1.5 rounded-lg transition-colors ${m?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(m?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(m?"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"})})}),te&&fe==="chat"&&o.jsx("button",{onClick:Ce,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${Y?"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:ue?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:ue?"Cmd+J":"Ctrl+J"}),"aria-pressed":Y,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(mI,{darkMode:g,onToggle:()=>p(!g)}),Ee&&o.jsx(Uz,{user:Ee,onLogout:ze,onSkillManagement:()=>he("skills"),onAgentManagement:()=>he("agents"),onPricingSettings:()=>Be(!0),onDlpSettings:()=>W(!0),onSettings:()=>he("settings")})]})]}),fe==="skills"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(xK,{onBack:()=>he("chat")})}):fe==="agents"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(YK,{onBack:()=>he("chat"),onSelectAgent:_=>{Le(_)},initialAgentName:Z,onInitialAgentConsumed:()=>ve(null),hackerMode:m,matrixMode:b,darkMode:g,onToggleMatrix:()=>k(_=>!_),terminalWidth:Q,onTerminalWidthChange:S,terminalMinWidth:t,terminalMaxWidth:n})}):fe==="settings"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(mY,{onBack:()=>he("chat"),activeSessionId:te,mobileFrameless:v,onMobileFramelessChange:x})}):o.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[o.jsx(_I,{sessions:Nt,activeSessionId:te,busySessions:Or,onSelectSession:_=>{ur(_),window.innerWidth<768&&Xe(!1)},onNewChat:Bd,onDeleteSession:uR,onDeleteAllSessions:dR,onRenameSession:fR,onRegenerateTitle:gR,onPinSession:pR,onArchiveSession:mR,onExportSession:Ev,onImportSession:zd,onImportError:_=>$e(_),showArchived:yt,onToggleShowArchived:_R,isOpen:Pe,onClose:()=>Xe(!1),onToggle:()=>Xe(_=>!_),hasMoreSessions:Ze,onLoadMoreSessions:sR}),o.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:te?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(YG,{sessionModel:P.has(te)?"epm/privacy":Qe[te]||null,activeModel:Ve,registryEntries:ye,onModelChange:xR,disabled:Qn||P.has(te),lockedReason:P.has(te)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},te),Wd?o.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:Wd,children:Wd}):null,o.jsx("button",{onClick:()=>Ad(!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:_r,children:o.jsx(VA,{className:"w-4 h-4"})}),o.jsx(ZG,{sessionId:te,disabledSkills:it?it.disabledSkills:[],onToggle:bR,onResetToDefaults:vR,t:e,disabled:_r}),o.jsx("button",{onClick:()=>hv(!0),className:`p-1.5 rounded-lg transition-colors ${JA?"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"})})}),ot&&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(_=>{const B=vv===null&&kv&&!zl.current.has(te)&&kv.moe_topk===_.val,G=vv===_.val;return o.jsx("button",{onClick:()=>{_.val===null?zl.current.delete(te):zl.current.add(te),yv(X=>({...X,[te]:_.val})),dr(te,{moe_top_k:_.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${G?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":B?"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:_.label},_.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(_=>o.jsx("button",{onClick:()=>{xv(B=>({...B,[te]:_.val})),dr(te,{reasoning_effort:_.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${nR===_.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:_.label},_.val))})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>yR({readOnly:_r}),className:`p-1.5 rounded-lg transition-colors ${to?"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(to?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(to?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!to,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(te)try{await KB(te),$e("Banner generation queued (~2 min)"),setTimeout(()=>$e(null),4e3)}catch(_){$e(`Banner: ${_.message||_}`)}},disabled:!te,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:ce,className:`p-1.5 rounded-lg transition-colors ${j?"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:j?"Show banner":"Hide banner","aria-label":j?"Show banner":"Hide banner","aria-pressed":!j,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:j?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"})]})})}),Ea?o.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Ea.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Ea.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:Ea.label,children:Ea.label}):null,o.jsx("button",{onClick:()=>{if(!ea){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}GA(_=>!_)},disabled:!ea,className:`p-1.5 rounded-lg transition-colors ${ea?Jr?"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:ea?e(Jr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(Jr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":Jr,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:()=>Ki(_=>!_),className:`p-1.5 rounded-lg transition-colors lg:hidden ${Gi?"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":Gi,"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:()=>Ev(te),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:()=>{jd(_=>!_),dn&&(Dl(""),Ca(0),Pl(0))},className:`p-1.5 rounded-lg transition-colors ${dn?"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"})})})]})]}),dn&&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:Ol,onChange:_=>{Dl(_.target.value),Ca(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"}),Ol&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums",children:kr>0?e("app.match_count",{current:Zs+1,total:kr}):e("app.no_matches")}),Ol&&kr>0&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>Ca(_=>(_-1+kr)%kr),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:()=>Ca(_=>(_+1)%kr),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:()=>{jd(!1),Dl(""),Ca(0),Pl(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"})})})]}),!Cn&&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")})]}),di&&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:di}),o.jsx("button",{onClick:()=>$e(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"})})})]}),Fl&&o.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${Fl.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":Fl.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:Fl.text})]}),Vi&&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:Vi.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:Vi.verification_uri})," ","— ",o.jsx("span",{className:"font-mono font-bold text-base select-all",children:Vi.user_code})]}),o.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),o.jsx("button",{onClick:()=>Ks(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"})})})]})}),bn&&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 ",bn.attempt,"/",bn.maxRetries,bn.maxDurationMs>0&&bn.elapsedMs>0&&o.jsxs(o.Fragment,{children:[" (",Math.round(bn.elapsedMs/1e3),"s / ",Math.round(bn.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(bn.delayMs/1e3),"s. Click Stop to cancel."]}),o.jsx("button",{onClick:()=>{Qr(null),on.current&&(clearTimeout(on.current),on.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"})})})]}),Ys&&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: ",Ys.fallbackModel," (local model unavailable)"]}),o.jsx("button",{onClick:()=>{Xr(null),Sn.current&&(clearTimeout(Sn.current),Sn.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(uz,{ref:Mt,messages:oR,streamingParts:ci[te]||{},streamingProgress:Cd,isBusy:Qn,compactingInfo:Ed,compactionResult:Nd,onSwitchToCompactedSession:_=>{Je.current=_,zt(_),cr(null)},onDismissCompactionResult:()=>cr(null),parentSessionID:it&&it.parentSessionID,compactionPinned:it&&it.compactionPinned,onUnpinCompaction:hR,onViewParentSession:_=>{Je.current=_,zt(_),Tt(function(B){return B.map(function(G){return G.id===_?{...G,_readOnly:!0}:G})})},user:Ee,searchQuery:Ol,activeMatchIndex:Zs,onTotalMatchesChange:Pl,onRetry:_r?void 0:SR,onEditAndResend:_r?void 0:CR,onCancelQueued:_r?void 0:iR,hackerMode:m,mobileFrameless:v,hideThinking:to,sessionID:te,banners:Sd[te]||[],bannerHidden:j,onToggleBanner:ce,compactedHistory:Ye[te]||null,onLoadMoreCompacted:lR,onHideCompacted:cR,loadingCompacted:It,privateMessageIds:U,questionIdMap:le}),(Gs[te]||[]).length>0&&o.jsx(zY,{items:Gs[te]||[],sessionId:te,isReadOnly:_r,onReorder:function(_){eB(te,_).catch(function(B){$e("Failed to reorder: "+B.message)})},onCancelItem:function(_){r_(te,_).catch(function(B){$e("Failed to cancel: "+B.message)})},onEditItem:function(_){if(!(_.status==="dispatching"||_r)){r_(te,_.id).catch(function(){});var B=_.displayContent||_.text||"";B&&A.current&&typeof A.current.setText=="function"&&A.current.setText(B)}},t:e}),_r?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:qd?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"})}),$d?o.jsx("button",{onClick:()=>{Je.current=$d,zt($d)},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:it&&it.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:it&&it.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):o.jsx(Bz,{ref:A,sessionId:te,onSend:na,onBuiltinCommand:ER,onAbort:wR,isBusy:Qn,queuedCount:aR+(Gs[te]||[]).length})]}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[o.jsx("img",{src:g?"/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:Bd,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")})]})}),te&&o.jsxs("aside",{style:{width:Q},className:`border-l hidden ${Y?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${m?g?"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":Q,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${m?g?"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:_=>{_.preventDefault();const B=_.clientX,G=Q,X=de=>{const ge=B-de.clientX,et=Math.min(n,Math.max(t,G+ge));S(et)},ae=()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ae)};document.addEventListener("mousemove",X),document.addEventListener("mouseup",ae)}}),!Gi&&_v()]}),Gi&&te&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>Ki(!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:_=>{(_.key==="Escape"||_.key==="Esc")&&(_.stopPropagation(),Ki(!1))},ref:Td,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:()=>Ki(!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"})})})]}),_v()]})]})]}),Re&&o.jsx(bY,{onClose:()=>Be(!1)}),Ge&&o.jsx(EY,{onClose:()=>W(!1)}),o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:o.jsx(CY,{requests:z,onDismiss:NR})}),o.jsx(TY,{open:Ie,onClose:()=>O(!1),upgradeUrl:se}),o.jsx(PY,{isOpen:YA,onClose:()=>Ad(!1),sessionId:te,currentDirectory:(it==null?void 0:it.directory)||"",homeDir:QA,onDirectoryChange:kR}),o.jsx(BY,{isOpen:ZA,onClose:()=>hv(!1),sessionId:te}),o.jsx(IY,{isOpen:R,onClose:()=>{D(!1),setTimeout(()=>{var _;return(_=A.current)==null?void 0:_.focus()},0)},onSelectSession:_=>{ur(_)},onNewChat:()=>{typeof F.current=="function"&&F.current()},activeSessionId:te,sessions:Nt,busySessions:Or}),o.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:J})]})}const $Y=hI();Z0.createRoot(document.getElementById("root")).render(o.jsx(JR.StrictMode,{children:o.jsx(pI,{initialLocale:$Y,children:o.jsx(xI,{children:o.jsx(qY,{})})})}));export{vj as _,za as c,hl as g,FG as p};