@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
@@ -0,0 +1,121 @@
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 Da=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ZS={exports:{}},Su={},JS={exports:{}},bt={};/**
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 sl=Symbol.for("react.element"),SR=Symbol.for("react.portal"),CR=Symbol.for("react.fragment"),jR=Symbol.for("react.strict_mode"),TR=Symbol.for("react.profiler"),AR=Symbol.for("react.provider"),RR=Symbol.for("react.context"),MR=Symbol.for("react.forward_ref"),IR=Symbol.for("react.suspense"),LR=Symbol.for("react.memo"),OR=Symbol.for("react.lazy"),bv=Symbol.iterator;function DR(e){return e===null||typeof e!="object"?null:(e=bv&&e[bv]||e["@@iterator"],typeof e=="function"?e:null)}var eC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tC=Object.assign,nC={};function Ms(e,t,n){this.props=e,this.context=t,this.refs=nC,this.updater=n||eC}Ms.prototype.isReactComponent={};Ms.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")};Ms.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rC(){}rC.prototype=Ms.prototype;function px(e,t,n){this.props=e,this.context=t,this.refs=nC,this.updater=n||eC}var gx=px.prototype=new rC;gx.constructor=px;tC(gx,Ms.prototype);gx.isPureReactComponent=!0;var vv=Array.isArray,aC=Object.prototype.hasOwnProperty,hx={current:null},iC={key:!0,ref:!0,__self:!0,__source:!0};function sC(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)aC.call(t,r)&&!iC.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:sl,type:e,key:i,ref:s,props:a,_owner:hx.current}}function PR(e,t){return{$$typeof:sl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function mx(e){return typeof e=="object"&&e!==null&&e.$$typeof===sl}function FR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var kv=/\/+/g;function Bd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?FR(""+e.key):t.toString(36)}function Nc(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 sl:case SR:s=!0}}if(s)return s=e,a=a(s),e=r===""?"."+Bd(s,0):r,vv(a)?(n="",e!=null&&(n=e.replace(kv,"$&/")+"/"),Nc(a,t,n,"",function(u){return u})):a!=null&&(mx(a)&&(a=PR(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(kv,"$&/")+"/")+e)),t.push(a)),1;if(s=0,r=r===""?".":r+":",vv(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Bd(i,l);s+=Nc(i,t,n,c,a)}else if(c=DR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Bd(i,l++),s+=Nc(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 zl(e,t,n){if(e==null)return e;var r=[],a=0;return Nc(e,r,"","",function(i){return t.call(n,i,a++)}),r}function BR(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 On={current:null},Sc={transition:null},zR={ReactCurrentDispatcher:On,ReactCurrentBatchConfig:Sc,ReactCurrentOwner:hx};function oC(){throw Error("act(...) is not supported in production builds of React.")}bt.Children={map:zl,forEach:function(e,t,n){zl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zl(e,function(){t++}),t},toArray:function(e){return zl(e,function(t){return t})||[]},only:function(e){if(!mx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};bt.Component=Ms;bt.Fragment=CR;bt.Profiler=TR;bt.PureComponent=px;bt.StrictMode=jR;bt.Suspense=IR;bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=zR;bt.act=oC;bt.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=tC({},e.props),a=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=hx.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)aC.call(t,c)&&!iC.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:sl,type:e.type,key:a,ref:i,props:r,_owner:s}};bt.createContext=function(e){return e={$$typeof:RR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:AR,_context:e},e.Consumer=e};bt.createElement=sC;bt.createFactory=function(e){var t=sC.bind(null,e);return t.type=e,t};bt.createRef=function(){return{current:null}};bt.forwardRef=function(e){return{$$typeof:MR,render:e}};bt.isValidElement=mx;bt.lazy=function(e){return{$$typeof:OR,_payload:{_status:-1,_result:e},_init:BR}};bt.memo=function(e,t){return{$$typeof:LR,type:e,compare:t===void 0?null:t}};bt.startTransition=function(e){var t=Sc.transition;Sc.transition={};try{e()}finally{Sc.transition=t}};bt.unstable_act=oC;bt.useCallback=function(e,t){return On.current.useCallback(e,t)};bt.useContext=function(e){return On.current.useContext(e)};bt.useDebugValue=function(){};bt.useDeferredValue=function(e){return On.current.useDeferredValue(e)};bt.useEffect=function(e,t){return On.current.useEffect(e,t)};bt.useId=function(){return On.current.useId()};bt.useImperativeHandle=function(e,t,n){return On.current.useImperativeHandle(e,t,n)};bt.useInsertionEffect=function(e,t){return On.current.useInsertionEffect(e,t)};bt.useLayoutEffect=function(e,t){return On.current.useLayoutEffect(e,t)};bt.useMemo=function(e,t){return On.current.useMemo(e,t)};bt.useReducer=function(e,t,n){return On.current.useReducer(e,t,n)};bt.useRef=function(e){return On.current.useRef(e)};bt.useState=function(e){return On.current.useState(e)};bt.useSyncExternalStore=function(e,t,n){return On.current.useSyncExternalStore(e,t,n)};bt.useTransition=function(){return On.current.useTransition()};bt.version="18.3.1";JS.exports=bt;var h=JS.exports;const UR=il(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 qR=h,$R=Symbol.for("react.element"),HR=Symbol.for("react.fragment"),WR=Object.prototype.hasOwnProperty,VR=qR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,GR={key:!0,ref:!0,__self:!0,__source:!0};function lC(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)WR.call(t,r)&&!GR.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:$R,type:e,key:i,ref:s,props:a,_owner:VR.current}}Su.Fragment=HR;Su.jsx=lC;Su.jsxs=lC;ZS.exports=Su;var o=ZS.exports,q0={},cC={exports:{}},ir={},uC={exports:{}},dC={};/**
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(B,Q){var C=B.length;B.push(Q);e:for(;0<C;){var K=C-1>>>1,W=B[K];if(0<a(W,Q))B[K]=Q,B[C]=W,C=K;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var Q=B[0],C=B.pop();if(C!==Q){B[0]=C;e:for(var K=0,W=B.length,j=W>>>1;K<j;){var U=2*(K+1)-1,le=B[U],Z=U+1,ke=B[Z];if(0>a(le,C))Z<W&&0>a(ke,le)?(B[K]=ke,B[Z]=C,K=Z):(B[K]=le,B[U]=C,K=U);else if(Z<W&&0>a(ke,C))B[K]=ke,B[Z]=C,K=Z;else break e}}return Q}function a(B,Q){var C=B.sortIndex-Q.sortIndex;return C!==0?C:B.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,p=3,g=!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(B){for(var Q=n(u);Q!==null;){if(Q.callback===null)r(u);else if(Q.startTime<=B)r(u),Q.sortIndex=Q.expirationTime,t(c,Q);else break;Q=n(u)}}function N(B){if(y=!1,k(B),!m)if(n(c)!==null)m=!0,S(w);else{var Q=n(u);Q!==null&&I(N,Q.startTime-B)}}function w(B,Q){m=!1,y&&(y=!1,x(A),A=-1),g=!0;var C=p;try{for(k(Q),f=n(c);f!==null&&(!(f.expirationTime>Q)||B&&!$());){var K=f.callback;if(typeof K=="function"){f.callback=null,p=f.priorityLevel;var W=K(f.expirationTime<=Q);Q=e.unstable_now(),typeof W=="function"?f.callback=W:f===n(c)&&r(c),k(Q)}else r(c);f=n(c)}if(f!==null)var j=!0;else{var U=n(u);U!==null&&I(N,U.startTime-Q),j=!1}return j}finally{f=null,p=C,g=!1}}var _=!1,T=null,A=-1,D=5,R=-1;function $(){return!(e.unstable_now()-R<D)}function F(){if(T!==null){var B=e.unstable_now();R=B;var Q=!0;try{Q=T(!0,B)}finally{Q?G():(_=!1,T=null)}}else _=!1}var G;if(typeof b=="function")G=function(){b(F)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,M=P.port2;P.port1.onmessage=F,G=function(){M.postMessage(null)}}else G=function(){v(F,0)};function S(B){T=B,_||(_=!0,G())}function I(B,Q){A=v(function(){B(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(B){B.callback=null},e.unstable_continueExecution=function(){m||g||(m=!0,S(w))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(B){switch(p){case 1:case 2:case 3:var Q=3;break;default:Q=p}var C=p;p=Q;try{return B()}finally{p=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,Q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var C=p;p=B;try{return Q()}finally{p=C}},e.unstable_scheduleCallback=function(B,Q,C){var K=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?K+C:K):C=K,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=C+W,B={id:d++,callback:Q,priorityLevel:B,startTime:C,expirationTime:W,sortIndex:-1},C>K?(B.sortIndex=C,t(u,B),n(c)===null&&B===n(u)&&(y?(x(A),A=-1):y=!0,I(N,C-K))):(B.sortIndex=W,t(c,B),m||g||(m=!0,S(w))),B},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(B){var Q=p;return function(){var C=p;p=Q;try{return B.apply(this,arguments)}finally{p=C}}}})(dC);uC.exports=dC;var KR=uC.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 YR=h,ar=KR;function Ae(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 fC=new Set,Oo={};function Ti(e,t){ws(e,t),ws(e+"Capture",t)}function ws(e,t){for(Oo[e]=t,e=0;e<t.length;e++)fC.add(t[e])}var ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$0=Object.prototype.hasOwnProperty,QR=/^[: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]*$/,_v={},wv={};function XR(e){return $0.call(wv,e)?!0:$0.call(_v,e)?!1:QR.test(e)?wv[e]=!0:(_v[e]=!0,!1)}function ZR(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 JR(e,t,n,r){if(t===null||typeof t>"u"||ZR(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 Dn(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 vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vn[e]=new Dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vn[t]=new Dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vn[e]=new Dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vn[e]=new Dn(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){vn[e]=new Dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vn[e]=new Dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vn[e]=new Dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vn[e]=new Dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vn[e]=new Dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var yx=/[\-:]([a-z])/g;function xx(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(yx,xx);vn[t]=new Dn(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(yx,xx);vn[t]=new Dn(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(yx,xx);vn[t]=new Dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!1,!1)});vn.xlinkHref=new Dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function bx(e,t,n,r){var a=vn.hasOwnProperty(t)?vn[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(JR(t,n,a,r)&&(n=null),r||a===null?XR(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 ha=YR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ul=Symbol.for("react.element"),as=Symbol.for("react.portal"),is=Symbol.for("react.fragment"),vx=Symbol.for("react.strict_mode"),H0=Symbol.for("react.profiler"),pC=Symbol.for("react.provider"),gC=Symbol.for("react.context"),kx=Symbol.for("react.forward_ref"),W0=Symbol.for("react.suspense"),V0=Symbol.for("react.suspense_list"),_x=Symbol.for("react.memo"),Aa=Symbol.for("react.lazy"),hC=Symbol.for("react.offscreen"),Ev=Symbol.iterator;function Ks(e){return e===null||typeof e!="object"?null:(e=Ev&&e[Ev]||e["@@iterator"],typeof e=="function"?e:null)}var Qt=Object.assign,zd;function co(e){if(zd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zd=t&&t[1]||""}return`
34
+ `+zd+e}var Ud=!1;function qd(e,t){if(!e||Ud)return"";Ud=!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{Ud=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?co(e):""}function e3(e){switch(e.tag){case 5:return co(e.type);case 16:return co("Lazy");case 13:return co("Suspense");case 19:return co("SuspenseList");case 0:case 2:case 15:return e=qd(e.type,!1),e;case 11:return e=qd(e.type.render,!1),e;case 1:return e=qd(e.type,!0),e;default:return""}}function G0(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 is:return"Fragment";case as:return"Portal";case H0:return"Profiler";case vx:return"StrictMode";case W0:return"Suspense";case V0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gC:return(e.displayName||"Context")+".Consumer";case pC:return(e._context.displayName||"Context")+".Provider";case kx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _x:return t=e.displayName||null,t!==null?t:G0(e.type)||"Memo";case Aa:t=e._payload,e=e._init;try{return G0(e(t))}catch{}}return null}function t3(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 G0(t);case 8:return t===vx?"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 Qa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function n3(e){var t=mC(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 ql(e){e._valueTracker||(e._valueTracker=n3(e))}function yC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=mC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Uc(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 K0(e,t){var n=t.checked;return Qt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Qa(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 xC(e,t){t=t.checked,t!=null&&bx(e,"checked",t,!1)}function Y0(e,t){xC(e,t);var n=Qa(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")?Q0(e,t.type,n):t.hasOwnProperty("defaultValue")&&Q0(e,t.type,Qa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sv(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 Q0(e,t,n){(t!=="number"||Uc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var uo=Array.isArray;function ms(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=""+Qa(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 X0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ae(91));return Qt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Cv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ae(92));if(uo(n)){if(1<n.length)throw Error(Ae(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Qa(n)}}function bC(e,t){var n=Qa(t.value),r=Qa(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 jv(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vC(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 Z0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vC(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var $l,kC=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($l=$l||document.createElement("div"),$l.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=$l.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Do(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ko={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},r3=["Webkit","ms","Moz","O"];Object.keys(ko).forEach(function(e){r3.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ko[t]=ko[e]})});function _C(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ko.hasOwnProperty(e)&&ko[e]?(""+t).trim():t+"px"}function wC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=_C(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var a3=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 J0(e,t){if(t){if(a3[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ae(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ae(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ae(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ae(62))}}function ey(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ty=null;function wx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ny=null,ys=null,xs=null;function Tv(e){if(e=cl(e)){if(typeof ny!="function")throw Error(Ae(280));var t=e.stateNode;t&&(t=Ru(t),ny(e.stateNode,e.type,t))}}function EC(e){ys?xs?xs.push(e):xs=[e]:ys=e}function NC(){if(ys){var e=ys,t=xs;if(xs=ys=null,Tv(e),t)for(e=0;e<t.length;e++)Tv(t[e])}}function SC(e,t){return e(t)}function CC(){}var $d=!1;function jC(e,t,n){if($d)return e(t,n);$d=!0;try{return SC(e,t,n)}finally{$d=!1,(ys!==null||xs!==null)&&(CC(),NC())}}function Po(e,t){var n=e.stateNode;if(n===null)return null;var r=Ru(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(Ae(231,t,typeof n));return n}var ry=!1;if(ua)try{var Ys={};Object.defineProperty(Ys,"passive",{get:function(){ry=!0}}),window.addEventListener("test",Ys,Ys),window.removeEventListener("test",Ys,Ys)}catch{ry=!1}function i3(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 _o=!1,qc=null,$c=!1,ay=null,s3={onError:function(e){_o=!0,qc=e}};function o3(e,t,n,r,a,i,s,l,c){_o=!1,qc=null,i3.apply(s3,arguments)}function l3(e,t,n,r,a,i,s,l,c){if(o3.apply(this,arguments),_o){if(_o){var u=qc;_o=!1,qc=null}else throw Error(Ae(198));$c||($c=!0,ay=u)}}function Ai(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 TC(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 Av(e){if(Ai(e)!==e)throw Error(Ae(188))}function c3(e){var t=e.alternate;if(!t){if(t=Ai(e),t===null)throw Error(Ae(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 Av(a),e;if(i===r)return Av(a),t;i=i.sibling}throw Error(Ae(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(Ae(189))}}if(n.alternate!==r)throw Error(Ae(190))}if(n.tag!==3)throw Error(Ae(188));return n.stateNode.current===n?e:t}function AC(e){return e=c3(e),e!==null?RC(e):null}function RC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=RC(e);if(t!==null)return t;e=e.sibling}return null}var MC=ar.unstable_scheduleCallback,Rv=ar.unstable_cancelCallback,u3=ar.unstable_shouldYield,d3=ar.unstable_requestPaint,tn=ar.unstable_now,f3=ar.unstable_getCurrentPriorityLevel,Ex=ar.unstable_ImmediatePriority,IC=ar.unstable_UserBlockingPriority,Hc=ar.unstable_NormalPriority,p3=ar.unstable_LowPriority,LC=ar.unstable_IdlePriority,Cu=null,Hr=null;function g3(e){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Cu,e,void 0,(e.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:y3,h3=Math.log,m3=Math.LN2;function y3(e){return e>>>=0,e===0?32:31-(h3(e)/m3|0)|0}var Hl=64,Wl=4194304;function fo(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 Wc(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=fo(l):(i&=s,i!==0&&(r=fo(i)))}else s=n&~a,s!==0?r=fo(s):i!==0&&(r=fo(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 x3(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 b3(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]=x3(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function iy(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function OC(){var e=Hl;return Hl<<=1,!(Hl&4194240)&&(Hl=64),e}function Hd(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ol(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 v3(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 Nx(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 DC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var PC,Sx,FC,BC,zC,sy=!1,Vl=[],Ua=null,qa=null,$a=null,Fo=new Map,Bo=new Map,Ma=[],k3="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 Mv(e,t){switch(e){case"focusin":case"focusout":Ua=null;break;case"dragenter":case"dragleave":qa=null;break;case"mouseover":case"mouseout":$a=null;break;case"pointerover":case"pointerout":Fo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bo.delete(t.pointerId)}}function Qs(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=cl(t),t!==null&&Sx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function _3(e,t,n,r,a){switch(t){case"focusin":return Ua=Qs(Ua,e,t,n,r,a),!0;case"dragenter":return qa=Qs(qa,e,t,n,r,a),!0;case"mouseover":return $a=Qs($a,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Fo.set(i,Qs(Fo.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Bo.set(i,Qs(Bo.get(i)||null,e,t,n,r,a)),!0}return!1}function UC(e){var t=gi(e.target);if(t!==null){var n=Ai(t);if(n!==null){if(t=n.tag,t===13){if(t=TC(n),t!==null){e.blockedOn=t,zC(e.priority,function(){FC(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 Cc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=oy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ty=r,n.target.dispatchEvent(r),ty=null}else return t=cl(n),t!==null&&Sx(t),e.blockedOn=n,!1;t.shift()}return!0}function Iv(e,t,n){Cc(e)&&n.delete(t)}function w3(){sy=!1,Ua!==null&&Cc(Ua)&&(Ua=null),qa!==null&&Cc(qa)&&(qa=null),$a!==null&&Cc($a)&&($a=null),Fo.forEach(Iv),Bo.forEach(Iv)}function Xs(e,t){e.blockedOn===t&&(e.blockedOn=null,sy||(sy=!0,ar.unstable_scheduleCallback(ar.unstable_NormalPriority,w3)))}function zo(e){function t(a){return Xs(a,e)}if(0<Vl.length){Xs(Vl[0],e);for(var n=1;n<Vl.length;n++){var r=Vl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ua!==null&&Xs(Ua,e),qa!==null&&Xs(qa,e),$a!==null&&Xs($a,e),Fo.forEach(t),Bo.forEach(t),n=0;n<Ma.length;n++)r=Ma[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ma.length&&(n=Ma[0],n.blockedOn===null);)UC(n),n.blockedOn===null&&Ma.shift()}var bs=ha.ReactCurrentBatchConfig,Vc=!0;function E3(e,t,n,r){var a=At,i=bs.transition;bs.transition=null;try{At=1,Cx(e,t,n,r)}finally{At=a,bs.transition=i}}function N3(e,t,n,r){var a=At,i=bs.transition;bs.transition=null;try{At=4,Cx(e,t,n,r)}finally{At=a,bs.transition=i}}function Cx(e,t,n,r){if(Vc){var a=oy(e,t,n,r);if(a===null)ef(e,t,r,Gc,n),Mv(e,r);else if(_3(a,e,t,n,r))r.stopPropagation();else if(Mv(e,r),t&4&&-1<k3.indexOf(e)){for(;a!==null;){var i=cl(a);if(i!==null&&PC(i),i=oy(e,t,n,r),i===null&&ef(e,t,r,Gc,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else ef(e,t,r,null,n)}}var Gc=null;function oy(e,t,n,r){if(Gc=null,e=wx(r),e=gi(e),e!==null)if(t=Ai(e),t===null)e=null;else if(n=t.tag,n===13){if(e=TC(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 Gc=e,null}function qC(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(f3()){case Ex:return 1;case IC:return 4;case Hc:case p3:return 16;case LC:return 536870912;default:return 16}default:return 16}}var Pa=null,jx=null,jc=null;function $C(){if(jc)return jc;var e,t=jx,n=t.length,r,a="value"in Pa?Pa.value:Pa.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 jc=a.slice(e,1<r?1-r:void 0)}function Tc(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 Gl(){return!0}function Lv(){return!1}function sr(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)?Gl:Lv,this.isPropagationStopped=Lv,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=Gl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Gl)},persist:function(){},isPersistent:Gl}),t}var Is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tx=sr(Is),ll=Qt({},Is,{view:0,detail:0}),S3=sr(ll),Wd,Vd,Zs,ju=Qt({},ll,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ax,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!==Zs&&(Zs&&e.type==="mousemove"?(Wd=e.screenX-Zs.screenX,Vd=e.screenY-Zs.screenY):Vd=Wd=0,Zs=e),Wd)},movementY:function(e){return"movementY"in e?e.movementY:Vd}}),Ov=sr(ju),C3=Qt({},ju,{dataTransfer:0}),j3=sr(C3),T3=Qt({},ll,{relatedTarget:0}),Gd=sr(T3),A3=Qt({},Is,{animationName:0,elapsedTime:0,pseudoElement:0}),R3=sr(A3),M3=Qt({},Is,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),I3=sr(M3),L3=Qt({},Is,{data:0}),Dv=sr(L3),O3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},D3={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"},P3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function F3(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=P3[e])?!!t[e]:!1}function Ax(){return F3}var B3=Qt({},ll,{key:function(e){if(e.key){var t=O3[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Tc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?D3[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ax,charCode:function(e){return e.type==="keypress"?Tc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),z3=sr(B3),U3=Qt({},ju,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pv=sr(U3),q3=Qt({},ll,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ax}),$3=sr(q3),H3=Qt({},Is,{propertyName:0,elapsedTime:0,pseudoElement:0}),W3=sr(H3),V3=Qt({},ju,{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}),G3=sr(V3),K3=[9,13,27,32],Rx=ua&&"CompositionEvent"in window,wo=null;ua&&"documentMode"in document&&(wo=document.documentMode);var Y3=ua&&"TextEvent"in window&&!wo,HC=ua&&(!Rx||wo&&8<wo&&11>=wo),Fv=" ",Bv=!1;function WC(e,t){switch(e){case"keyup":return K3.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function VC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ss=!1;function Q3(e,t){switch(e){case"compositionend":return VC(t);case"keypress":return t.which!==32?null:(Bv=!0,Fv);case"textInput":return e=t.data,e===Fv&&Bv?null:e;default:return null}}function X3(e,t){if(ss)return e==="compositionend"||!Rx&&WC(e,t)?(e=$C(),jc=jx=Pa=null,ss=!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 HC&&t.locale!=="ko"?null:t.data;default:return null}}var Z3={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 zv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Z3[e.type]:t==="textarea"}function GC(e,t,n,r){EC(r),t=Kc(t,"onChange"),0<t.length&&(n=new Tx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Eo=null,Uo=null;function J3(e){a4(e,0)}function Tu(e){var t=cs(e);if(yC(t))return e}function eM(e,t){if(e==="change")return t}var KC=!1;if(ua){var Kd;if(ua){var Yd="oninput"in document;if(!Yd){var Uv=document.createElement("div");Uv.setAttribute("oninput","return;"),Yd=typeof Uv.oninput=="function"}Kd=Yd}else Kd=!1;KC=Kd&&(!document.documentMode||9<document.documentMode)}function qv(){Eo&&(Eo.detachEvent("onpropertychange",YC),Uo=Eo=null)}function YC(e){if(e.propertyName==="value"&&Tu(Uo)){var t=[];GC(t,Uo,e,wx(e)),jC(J3,t)}}function tM(e,t,n){e==="focusin"?(qv(),Eo=t,Uo=n,Eo.attachEvent("onpropertychange",YC)):e==="focusout"&&qv()}function nM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tu(Uo)}function rM(e,t){if(e==="click")return Tu(t)}function aM(e,t){if(e==="input"||e==="change")return Tu(t)}function iM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mr=typeof Object.is=="function"?Object.is:iM;function qo(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(!$0.call(t,a)||!Mr(e[a],t[a]))return!1}return!0}function $v(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hv(e,t){var n=$v(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=$v(n)}}function QC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?QC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function XC(){for(var e=window,t=Uc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Uc(e.document)}return t}function Mx(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 sM(e){var t=XC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&QC(n.ownerDocument.documentElement,n)){if(r!==null&&Mx(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=Hv(n,i);var s=Hv(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 oM=ua&&"documentMode"in document&&11>=document.documentMode,os=null,ly=null,No=null,cy=!1;function Wv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cy||os==null||os!==Uc(r)||(r=os,"selectionStart"in r&&Mx(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}),No&&qo(No,r)||(No=r,r=Kc(ly,"onSelect"),0<r.length&&(t=new Tx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=os)))}function Kl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ls={animationend:Kl("Animation","AnimationEnd"),animationiteration:Kl("Animation","AnimationIteration"),animationstart:Kl("Animation","AnimationStart"),transitionend:Kl("Transition","TransitionEnd")},Qd={},ZC={};ua&&(ZC=document.createElement("div").style,"AnimationEvent"in window||(delete ls.animationend.animation,delete ls.animationiteration.animation,delete ls.animationstart.animation),"TransitionEvent"in window||delete ls.transitionend.transition);function Au(e){if(Qd[e])return Qd[e];if(!ls[e])return e;var t=ls[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ZC)return Qd[e]=t[n];return e}var JC=Au("animationend"),e4=Au("animationiteration"),t4=Au("animationstart"),n4=Au("transitionend"),r4=new Map,Vv="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 Ja(e,t){r4.set(e,t),Ti(t,[e])}for(var Xd=0;Xd<Vv.length;Xd++){var Zd=Vv[Xd],lM=Zd.toLowerCase(),cM=Zd[0].toUpperCase()+Zd.slice(1);Ja(lM,"on"+cM)}Ja(JC,"onAnimationEnd");Ja(e4,"onAnimationIteration");Ja(t4,"onAnimationStart");Ja("dblclick","onDoubleClick");Ja("focusin","onFocus");Ja("focusout","onBlur");Ja(n4,"onTransitionEnd");ws("onMouseEnter",["mouseout","mouseover"]);ws("onMouseLeave",["mouseout","mouseover"]);ws("onPointerEnter",["pointerout","pointerover"]);ws("onPointerLeave",["pointerout","pointerover"]);Ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ti("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var po="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(" "),uM=new Set("cancel close invalid load scroll toggle".split(" ").concat(po));function Gv(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,l3(r,t,void 0,e),e.currentTarget=null}function a4(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;Gv(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;Gv(a,l,u),i=c}}}if($c)throw e=ay,$c=!1,ay=null,e}function Ut(e,t){var n=t[gy];n===void 0&&(n=t[gy]=new Set);var r=e+"__bubble";n.has(r)||(i4(t,e,2,!1),n.add(r))}function Jd(e,t,n){var r=0;t&&(r|=4),i4(n,e,r,t)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function $o(e){if(!e[Yl]){e[Yl]=!0,fC.forEach(function(n){n!=="selectionchange"&&(uM.has(n)||Jd(n,!1,e),Jd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yl]||(t[Yl]=!0,Jd("selectionchange",!1,t))}}function i4(e,t,n,r){switch(qC(t)){case 1:var a=E3;break;case 4:a=N3;break;default:a=Cx}n=a.bind(null,t,n,e),a=void 0,!ry||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 ef(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=gi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}jC(function(){var u=i,d=wx(n),f=[];e:{var p=r4.get(e);if(p!==void 0){var g=Tx,m=e;switch(e){case"keypress":if(Tc(n)===0)break e;case"keydown":case"keyup":g=z3;break;case"focusin":m="focus",g=Gd;break;case"focusout":m="blur",g=Gd;break;case"beforeblur":case"afterblur":g=Gd;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":g=Ov;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=j3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=$3;break;case JC:case e4:case t4:g=R3;break;case n4:g=W3;break;case"scroll":g=S3;break;case"wheel":g=G3;break;case"copy":case"cut":case"paste":g=I3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Pv}var y=(t&4)!==0,v=!y&&e==="scroll",x=y?p!==null?p+"Capture":null:p;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=Po(b,x),N!=null&&y.push(Ho(b,N,k)))),v)break;b=b.return}0<y.length&&(p=new g(p,m,null,n,d),f.push({event:p,listeners:y}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",p&&n!==ty&&(m=n.relatedTarget||n.fromElement)&&(gi(m)||m[da]))break e;if((g||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,g?(m=n.relatedTarget||n.toElement,g=u,m=m?gi(m):null,m!==null&&(v=Ai(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(g=null,m=u),g!==m)){if(y=Ov,N="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=Pv,N="onPointerLeave",x="onPointerEnter",b="pointer"),v=g==null?p:cs(g),k=m==null?p:cs(m),p=new y(N,b+"leave",g,n,d),p.target=v,p.relatedTarget=k,N=null,gi(d)===u&&(y=new y(x,b+"enter",m,n,d),y.target=k,y.relatedTarget=v,N=y),v=N,g&&m)t:{for(y=g,x=m,b=0,k=y;k;k=Ki(k))b++;for(k=0,N=x;N;N=Ki(N))k++;for(;0<b-k;)y=Ki(y),b--;for(;0<k-b;)x=Ki(x),k--;for(;b--;){if(y===x||x!==null&&y===x.alternate)break t;y=Ki(y),x=Ki(x)}y=null}else y=null;g!==null&&Kv(f,p,g,y,!1),m!==null&&v!==null&&Kv(f,v,m,y,!0)}}e:{if(p=u?cs(u):window,g=p.nodeName&&p.nodeName.toLowerCase(),g==="select"||g==="input"&&p.type==="file")var w=eM;else if(zv(p))if(KC)w=aM;else{w=nM;var _=tM}else(g=p.nodeName)&&g.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(w=rM);if(w&&(w=w(e,u))){GC(f,w,n,d);break e}_&&_(e,p,u),e==="focusout"&&(_=p._wrapperState)&&_.controlled&&p.type==="number"&&Q0(p,"number",p.value)}switch(_=u?cs(u):window,e){case"focusin":(zv(_)||_.contentEditable==="true")&&(os=_,ly=u,No=null);break;case"focusout":No=ly=os=null;break;case"mousedown":cy=!0;break;case"contextmenu":case"mouseup":case"dragend":cy=!1,Wv(f,n,d);break;case"selectionchange":if(oM)break;case"keydown":case"keyup":Wv(f,n,d)}var T;if(Rx)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else ss?WC(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(HC&&n.locale!=="ko"&&(ss||A!=="onCompositionStart"?A==="onCompositionEnd"&&ss&&(T=$C()):(Pa=d,jx="value"in Pa?Pa.value:Pa.textContent,ss=!0)),_=Kc(u,A),0<_.length&&(A=new Dv(A,e,null,n,d),f.push({event:A,listeners:_}),T?A.data=T:(T=VC(n),T!==null&&(A.data=T)))),(T=Y3?Q3(e,n):X3(e,n))&&(u=Kc(u,"onBeforeInput"),0<u.length&&(d=new Dv("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=T))}a4(f,t)})}function Ho(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Kc(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Po(e,n),i!=null&&r.unshift(Ho(e,i,a)),i=Po(e,t),i!=null&&r.push(Ho(e,i,a))),e=e.return}return r}function Ki(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Kv(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=Po(n,i),c!=null&&s.unshift(Ho(n,c,l))):a||(c=Po(n,i),c!=null&&s.push(Ho(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var dM=/\r\n?/g,fM=/\u0000|\uFFFD/g;function Yv(e){return(typeof e=="string"?e:""+e).replace(dM,`
38
+ `).replace(fM,"")}function Ql(e,t,n){if(t=Yv(t),Yv(e)!==t&&n)throw Error(Ae(425))}function Yc(){}var uy=null,dy=null;function fy(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var py=typeof setTimeout=="function"?setTimeout:void 0,pM=typeof clearTimeout=="function"?clearTimeout:void 0,Qv=typeof Promise=="function"?Promise:void 0,gM=typeof queueMicrotask=="function"?queueMicrotask:typeof Qv<"u"?function(e){return Qv.resolve(null).then(e).catch(hM)}:py;function hM(e){setTimeout(function(){throw e})}function tf(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),zo(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);zo(t)}function Ha(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 Xv(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 Ls=Math.random().toString(36).slice(2),qr="__reactFiber$"+Ls,Wo="__reactProps$"+Ls,da="__reactContainer$"+Ls,gy="__reactEvents$"+Ls,mM="__reactListeners$"+Ls,yM="__reactHandles$"+Ls;function gi(e){var t=e[qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[da]||n[qr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Xv(e);e!==null;){if(n=e[qr])return n;e=Xv(e)}return t}e=n,n=e.parentNode}return null}function cl(e){return e=e[qr]||e[da],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function cs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ae(33))}function Ru(e){return e[Wo]||null}var hy=[],us=-1;function ei(e){return{current:e}}function qt(e){0>us||(e.current=hy[us],hy[us]=null,us--)}function zt(e,t){us++,hy[us]=e.current,e.current=t}var Xa={},Cn=ei(Xa),$n=ei(!1),wi=Xa;function Es(e,t){var n=e.type.contextTypes;if(!n)return Xa;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 Hn(e){return e=e.childContextTypes,e!=null}function Qc(){qt($n),qt(Cn)}function Zv(e,t,n){if(Cn.current!==Xa)throw Error(Ae(168));zt(Cn,t),zt($n,n)}function s4(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(Ae(108,t3(e)||"Unknown",a));return Qt({},n,r)}function Xc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xa,wi=Cn.current,zt(Cn,e),zt($n,$n.current),!0}function Jv(e,t,n){var r=e.stateNode;if(!r)throw Error(Ae(169));n?(e=s4(e,t,wi),r.__reactInternalMemoizedMergedChildContext=e,qt($n),qt(Cn),zt(Cn,e)):qt($n),zt($n,n)}var ra=null,Mu=!1,nf=!1;function o4(e){ra===null?ra=[e]:ra.push(e)}function xM(e){Mu=!0,o4(e)}function ti(){if(!nf&&ra!==null){nf=!0;var e=0,t=At;try{var n=ra;for(At=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ra=null,Mu=!1}catch(a){throw ra!==null&&(ra=ra.slice(e+1)),MC(Ex,ti),a}finally{At=t,nf=!1}}return null}var ds=[],fs=0,Zc=null,Jc=0,ur=[],dr=0,Ei=null,aa=1,ia="";function ui(e,t){ds[fs++]=Jc,ds[fs++]=Zc,Zc=e,Jc=t}function l4(e,t,n){ur[dr++]=aa,ur[dr++]=ia,ur[dr++]=Ei,Ei=e;var r=aa;e=ia;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,aa=1<<32-Tr(t)+a|n<<a|r,ia=i+e}else aa=1<<i|n<<a|r,ia=e}function Ix(e){e.return!==null&&(ui(e,1),l4(e,1,0))}function Lx(e){for(;e===Zc;)Zc=ds[--fs],ds[fs]=null,Jc=ds[--fs],ds[fs]=null;for(;e===Ei;)Ei=ur[--dr],ur[dr]=null,ia=ur[--dr],ur[dr]=null,aa=ur[--dr],ur[dr]=null}var nr=null,tr=null,Ht=!1,jr=null;function c4(e,t){var n=pr(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 e1(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,nr=e,tr=Ha(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,nr=e,tr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ei!==null?{id:aa,overflow:ia}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=pr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,nr=e,tr=null,!0):!1;default:return!1}}function my(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yy(e){if(Ht){var t=tr;if(t){var n=t;if(!e1(e,t)){if(my(e))throw Error(Ae(418));t=Ha(n.nextSibling);var r=nr;t&&e1(e,t)?c4(r,n):(e.flags=e.flags&-4097|2,Ht=!1,nr=e)}}else{if(my(e))throw Error(Ae(418));e.flags=e.flags&-4097|2,Ht=!1,nr=e}}}function t1(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;nr=e}function Xl(e){if(e!==nr)return!1;if(!Ht)return t1(e),Ht=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!fy(e.type,e.memoizedProps)),t&&(t=tr)){if(my(e))throw u4(),Error(Ae(418));for(;t;)c4(e,t),t=Ha(t.nextSibling)}if(t1(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ae(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){tr=Ha(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}tr=null}}else tr=nr?Ha(e.stateNode.nextSibling):null;return!0}function u4(){for(var e=tr;e;)e=Ha(e.nextSibling)}function Ns(){tr=nr=null,Ht=!1}function Ox(e){jr===null?jr=[e]:jr.push(e)}var bM=ha.ReactCurrentBatchConfig;function Js(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(Ae(309));var r=n.stateNode}if(!r)throw Error(Ae(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(Ae(284));if(!n._owner)throw Error(Ae(290,e))}return e}function Zl(e,t){throw e=Object.prototype.toString.call(t),Error(Ae(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function n1(e){var t=e._init;return t(e._payload)}function d4(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=Ka(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=uf(k,x.mode,N),b.return=x,b):(b=a(b,k),b.return=x,b)}function c(x,b,k,N){var w=k.type;return w===is?d(x,b,k.props.children,N,k.key):b!==null&&(b.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Aa&&n1(w)===b.type)?(N=a(b,k.props),N.ref=Js(x,b,k),N.return=x,N):(N=Dc(k.type,k.key,k.props,null,x.mode,N),N.ref=Js(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=df(k,x.mode,N),b.return=x,b):(b=a(b,k.children||[]),b.return=x,b)}function d(x,b,k,N,w){return b===null||b.tag!==7?(b=bi(k,x.mode,N,w),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=uf(""+b,x.mode,k),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ul:return k=Dc(b.type,b.key,b.props,null,x.mode,k),k.ref=Js(x,null,b),k.return=x,k;case as:return b=df(b,x.mode,k),b.return=x,b;case Aa:var N=b._init;return f(x,N(b._payload),k)}if(uo(b)||Ks(b))return b=bi(b,x.mode,k,null),b.return=x,b;Zl(x,b)}return null}function p(x,b,k,N){var w=b!==null?b.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return w!==null?null:l(x,b,""+k,N);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ul:return k.key===w?c(x,b,k,N):null;case as:return k.key===w?u(x,b,k,N):null;case Aa:return w=k._init,p(x,b,w(k._payload),N)}if(uo(k)||Ks(k))return w!==null?null:d(x,b,k,N,null);Zl(x,k)}return null}function g(x,b,k,N,w){if(typeof N=="string"&&N!==""||typeof N=="number")return x=x.get(k)||null,l(b,x,""+N,w);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Ul:return x=x.get(N.key===null?k:N.key)||null,c(b,x,N,w);case as:return x=x.get(N.key===null?k:N.key)||null,u(b,x,N,w);case Aa:var _=N._init;return g(x,b,k,_(N._payload),w)}if(uo(N)||Ks(N))return x=x.get(k)||null,d(b,x,N,w,null);Zl(b,N)}return null}function m(x,b,k,N){for(var w=null,_=null,T=b,A=b=0,D=null;T!==null&&A<k.length;A++){T.index>A?(D=T,T=null):D=T.sibling;var R=p(x,T,k[A],N);if(R===null){T===null&&(T=D);break}e&&T&&R.alternate===null&&t(x,T),b=i(R,b,A),_===null?w=R:_.sibling=R,_=R,T=D}if(A===k.length)return n(x,T),Ht&&ui(x,A),w;if(T===null){for(;A<k.length;A++)T=f(x,k[A],N),T!==null&&(b=i(T,b,A),_===null?w=T:_.sibling=T,_=T);return Ht&&ui(x,A),w}for(T=r(x,T);A<k.length;A++)D=g(T,x,A,k[A],N),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?A:D.key),b=i(D,b,A),_===null?w=D:_.sibling=D,_=D);return e&&T.forEach(function($){return t(x,$)}),Ht&&ui(x,A),w}function y(x,b,k,N){var w=Ks(k);if(typeof w!="function")throw Error(Ae(150));if(k=w.call(k),k==null)throw Error(Ae(151));for(var _=w=null,T=b,A=b=0,D=null,R=k.next();T!==null&&!R.done;A++,R=k.next()){T.index>A?(D=T,T=null):D=T.sibling;var $=p(x,T,R.value,N);if($===null){T===null&&(T=D);break}e&&T&&$.alternate===null&&t(x,T),b=i($,b,A),_===null?w=$:_.sibling=$,_=$,T=D}if(R.done)return n(x,T),Ht&&ui(x,A),w;if(T===null){for(;!R.done;A++,R=k.next())R=f(x,R.value,N),R!==null&&(b=i(R,b,A),_===null?w=R:_.sibling=R,_=R);return Ht&&ui(x,A),w}for(T=r(x,T);!R.done;A++,R=k.next())R=g(T,x,A,R.value,N),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?A:R.key),b=i(R,b,A),_===null?w=R:_.sibling=R,_=R);return e&&T.forEach(function(F){return t(x,F)}),Ht&&ui(x,A),w}function v(x,b,k,N){if(typeof k=="object"&&k!==null&&k.type===is&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Ul:e:{for(var w=k.key,_=b;_!==null;){if(_.key===w){if(w=k.type,w===is){if(_.tag===7){n(x,_.sibling),b=a(_,k.props.children),b.return=x,x=b;break e}}else if(_.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Aa&&n1(w)===_.type){n(x,_.sibling),b=a(_,k.props),b.ref=Js(x,_,k),b.return=x,x=b;break e}n(x,_);break}else t(x,_);_=_.sibling}k.type===is?(b=bi(k.props.children,x.mode,N,k.key),b.return=x,x=b):(N=Dc(k.type,k.key,k.props,null,x.mode,N),N.ref=Js(x,b,k),N.return=x,x=N)}return s(x);case as:e:{for(_=k.key;b!==null;){if(b.key===_)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=df(k,x.mode,N),b.return=x,x=b}return s(x);case Aa:return _=k._init,v(x,b,_(k._payload),N)}if(uo(k))return m(x,b,k,N);if(Ks(k))return y(x,b,k,N);Zl(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=uf(k,x.mode,N),b.return=x,x=b),s(x)):n(x,b)}return v}var Ss=d4(!0),f4=d4(!1),eu=ei(null),tu=null,ps=null,Dx=null;function Px(){Dx=ps=tu=null}function Fx(e){var t=eu.current;qt(eu),e._currentValue=t}function xy(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 vs(e,t){tu=e,Dx=ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qn=!0),e.firstContext=null)}function hr(e){var t=e._currentValue;if(Dx!==e)if(e={context:e,memoizedValue:t,next:null},ps===null){if(tu===null)throw Error(Ae(308));ps=e,tu.dependencies={lanes:0,firstContext:e}}else ps=ps.next=e;return t}var hi=null;function Bx(e){hi===null?hi=[e]:hi.push(e)}function p4(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Bx(t)):(n.next=a.next,a.next=n),t.interleaved=n,fa(e,r)}function fa(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 Ra=!1;function zx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g4(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 la(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nt&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,fa(e,n)}return a=r.interleaved,a===null?(t.next=t,Bx(r)):(t.next=a.next,a.next=t),r.interleaved=t,fa(e,n)}function Ac(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,Nx(e,n)}}function r1(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 nu(e,t,n,r){var a=e.updateQueue;Ra=!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 p=l.lane,g=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,y=l;switch(p=t,g=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(g,f,p);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,p=typeof m=="function"?m.call(g,f,p):m,p==null)break e;f=Qt({},f,p);break e;case 2:Ra=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=a.effects,p===null?a.effects=[l]:p.push(l))}else g={eventTime:g,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=g,c=f):d=d.next=g,s|=p;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;p=l,l=p.next,p.next=null,a.lastBaseUpdate=p,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);Si|=s,e.lanes=s,e.memoizedState=f}}function a1(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(Ae(191,a));a.call(r)}}}var ul={},Wr=ei(ul),Vo=ei(ul),Go=ei(ul);function mi(e){if(e===ul)throw Error(Ae(174));return e}function Ux(e,t){switch(zt(Go,t),zt(Vo,e),zt(Wr,ul),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Z0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Z0(t,e)}qt(Wr),zt(Wr,t)}function Cs(){qt(Wr),qt(Vo),qt(Go)}function h4(e){mi(Go.current);var t=mi(Wr.current),n=Z0(t,e.type);t!==n&&(zt(Vo,e),zt(Wr,n))}function qx(e){Vo.current===e&&(qt(Wr),qt(Vo))}var Kt=ei(0);function ru(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 rf=[];function $x(){for(var e=0;e<rf.length;e++)rf[e]._workInProgressVersionPrimary=null;rf.length=0}var Rc=ha.ReactCurrentDispatcher,af=ha.ReactCurrentBatchConfig,Ni=0,Yt=null,on=null,pn=null,au=!1,So=!1,Ko=0,vM=0;function _n(){throw Error(Ae(321))}function Hx(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 Wx(e,t,n,r,a,i){if(Ni=i,Yt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Rc.current=e===null||e.memoizedState===null?EM:NM,e=n(r,a),So){i=0;do{if(So=!1,Ko=0,25<=i)throw Error(Ae(301));i+=1,pn=on=null,t.updateQueue=null,Rc.current=SM,e=n(r,a)}while(So)}if(Rc.current=iu,t=on!==null&&on.next!==null,Ni=0,pn=on=Yt=null,au=!1,t)throw Error(Ae(300));return e}function Vx(){var e=Ko!==0;return Ko=0,e}function zr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pn===null?Yt.memoizedState=pn=e:pn=pn.next=e,pn}function mr(){if(on===null){var e=Yt.alternate;e=e!==null?e.memoizedState:null}else e=on.next;var t=pn===null?Yt.memoizedState:pn.next;if(t!==null)pn=t,on=e;else{if(e===null)throw Error(Ae(310));on=e,e={memoizedState:on.memoizedState,baseState:on.baseState,baseQueue:on.baseQueue,queue:on.queue,next:null},pn===null?Yt.memoizedState=pn=e:pn=pn.next=e}return pn}function Yo(e,t){return typeof t=="function"?t(e):t}function sf(e){var t=mr(),n=t.queue;if(n===null)throw Error(Ae(311));n.lastRenderedReducer=e;var r=on,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((Ni&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,Si|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,Mr(r,t.memoizedState)||(qn=!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,Si|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function of(e){var t=mr(),n=t.queue;if(n===null)throw Error(Ae(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)||(qn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function m4(){}function y4(e,t){var n=Yt,r=mr(),a=t(),i=!Mr(r.memoizedState,a);if(i&&(r.memoizedState=a,qn=!0),r=r.queue,Gx(v4.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||pn!==null&&pn.memoizedState.tag&1){if(n.flags|=2048,Qo(9,b4.bind(null,n,r,a,t),void 0,null),gn===null)throw Error(Ae(349));Ni&30||x4(n,t,a)}return a}function x4(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 b4(e,t,n,r){t.value=n,t.getSnapshot=r,k4(t)&&_4(e)}function v4(e,t,n){return n(function(){k4(t)&&_4(e)})}function k4(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function _4(e){var t=fa(e,1);t!==null&&Ar(t,e,1,-1)}function i1(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:Yo,lastRenderedState:e},t.queue=e,e=e.dispatch=wM.bind(null,Yt,e),[t.memoizedState,e]}function Qo(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 w4(){return mr().memoizedState}function Mc(e,t,n,r){var a=zr();Yt.flags|=e,a.memoizedState=Qo(1|t,n,void 0,r===void 0?null:r)}function Iu(e,t,n,r){var a=mr();r=r===void 0?null:r;var i=void 0;if(on!==null){var s=on.memoizedState;if(i=s.destroy,r!==null&&Hx(r,s.deps)){a.memoizedState=Qo(t,n,i,r);return}}Yt.flags|=e,a.memoizedState=Qo(1|t,n,i,r)}function s1(e,t){return Mc(8390656,8,e,t)}function Gx(e,t){return Iu(2048,8,e,t)}function E4(e,t){return Iu(4,2,e,t)}function N4(e,t){return Iu(4,4,e,t)}function S4(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 C4(e,t,n){return n=n!=null?n.concat([e]):null,Iu(4,4,S4.bind(null,t,e),n)}function Kx(){}function j4(e,t){var n=mr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Hx(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function T4(e,t){var n=mr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Hx(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function A4(e,t,n){return Ni&21?(Mr(n,t)||(n=OC(),Yt.lanes|=n,Si|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qn=!0),e.memoizedState=n)}function kM(e,t){var n=At;At=n!==0&&4>n?n:4,e(!0);var r=af.transition;af.transition={};try{e(!1),t()}finally{At=n,af.transition=r}}function R4(){return mr().memoizedState}function _M(e,t,n){var r=Ga(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},M4(e))I4(t,n);else if(n=p4(e,t,n,r),n!==null){var a=Ln();Ar(n,e,r,a),L4(n,t,r)}}function wM(e,t,n){var r=Ga(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(M4(e))I4(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,Bx(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=p4(e,t,a,r),n!==null&&(a=Ln(),Ar(n,e,r,a),L4(n,t,r))}}function M4(e){var t=e.alternate;return e===Yt||t!==null&&t===Yt}function I4(e,t){So=au=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function L4(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nx(e,n)}}var iu={readContext:hr,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},EM={readContext:hr,useCallback:function(e,t){return zr().memoizedState=[e,t===void 0?null:t],e},useContext:hr,useEffect:s1,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mc(4194308,4,S4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mc(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mc(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=_M.bind(null,Yt,e),[r.memoizedState,e]},useRef:function(e){var t=zr();return e={current:e},t.memoizedState=e},useState:i1,useDebugValue:Kx,useDeferredValue:function(e){return zr().memoizedState=e},useTransition:function(){var e=i1(!1),t=e[0];return e=kM.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(Ae(407));n=n()}else{if(n=t(),gn===null)throw Error(Ae(349));Ni&30||x4(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,s1(v4.bind(null,r,i,e),[e]),r.flags|=2048,Qo(9,b4.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=zr(),t=gn.identifierPrefix;if(Ht){var n=ia,r=aa;n=(r&~(1<<32-Tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ko++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vM++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},NM={readContext:hr,useCallback:j4,useContext:hr,useEffect:Gx,useImperativeHandle:C4,useInsertionEffect:E4,useLayoutEffect:N4,useMemo:T4,useReducer:sf,useRef:w4,useState:function(){return sf(Yo)},useDebugValue:Kx,useDeferredValue:function(e){var t=mr();return A4(t,on.memoizedState,e)},useTransition:function(){var e=sf(Yo)[0],t=mr().memoizedState;return[e,t]},useMutableSource:m4,useSyncExternalStore:y4,useId:R4,unstable_isNewReconciler:!1},SM={readContext:hr,useCallback:j4,useContext:hr,useEffect:Gx,useImperativeHandle:C4,useInsertionEffect:E4,useLayoutEffect:N4,useMemo:T4,useReducer:of,useRef:w4,useState:function(){return of(Yo)},useDebugValue:Kx,useDeferredValue:function(e){var t=mr();return on===null?t.memoizedState=e:A4(t,on.memoizedState,e)},useTransition:function(){var e=of(Yo)[0],t=mr().memoizedState;return[e,t]},useMutableSource:m4,useSyncExternalStore:y4,useId:R4,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 by(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 Lu={isMounted:function(e){return(e=e._reactInternals)?Ai(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ln(),a=Ga(e),i=la(r,a);i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,a),t!==null&&(Ar(t,e,a,r),Ac(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ln(),a=Ga(e),i=la(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,a),t!==null&&(Ar(t,e,a,r),Ac(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ln(),r=Ga(e),a=la(n,r);a.tag=2,t!=null&&(a.callback=t),t=Wa(e,a,r),t!==null&&(Ar(t,e,r,n),Ac(t,e,r))}};function o1(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?!qo(n,r)||!qo(a,i):!0}function O4(e,t,n){var r=!1,a=Xa,i=t.contextType;return typeof i=="object"&&i!==null?i=hr(i):(a=Hn(t)?wi:Cn.current,r=t.contextTypes,i=(r=r!=null)?Es(e,a):Xa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Lu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function l1(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&&Lu.enqueueReplaceState(t,t.state,null)}function vy(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},zx(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=hr(i):(i=Hn(t)?wi:Cn.current,a.context=Es(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(by(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&&Lu.enqueueReplaceState(a,a.state,null),nu(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function js(e,t){try{var n="",r=t;do n+=e3(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 lf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ky(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var CM=typeof WeakMap=="function"?WeakMap:Map;function D4(e,t,n){n=la(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ou||(ou=!0,Ry=r),ky(e,t)},n}function P4(e,t,n){n=la(-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(){ky(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){ky(e,t),typeof r!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function c1(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new CM;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=UM.bind(null,e,t,n),t.then(e,e))}function u1(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 d1(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=la(-1,1),t.tag=2,Wa(n,t,1))),n.lanes|=1),e)}var jM=ha.ReactCurrentOwner,qn=!1;function Mn(e,t,n,r){t.child=e===null?f4(t,null,n,r):Ss(t,e.child,n,r)}function f1(e,t,n,r,a){n=n.render;var i=t.ref;return vs(t,a),r=Wx(e,t,n,r,i,a),n=Vx(),e!==null&&!qn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,pa(e,t,a)):(Ht&&n&&Ix(t),t.flags|=1,Mn(e,t,r,a),t.child)}function p1(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!nb(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,F4(e,t,i,r,a)):(e=Dc(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:qo,n(s,r)&&e.ref===t.ref)return pa(e,t,a)}return t.flags|=1,e=Ka(i,r),e.ref=t.ref,e.return=t,t.child=e}function F4(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(qo(i,r)&&e.ref===t.ref)if(qn=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(qn=!0);else return t.lanes=e.lanes,pa(e,t,a)}return _y(e,t,n,r,a)}function B4(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},zt(hs,Jn),Jn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,zt(hs,Jn),Jn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,zt(hs,Jn),Jn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,zt(hs,Jn),Jn|=r;return Mn(e,t,a,n),t.child}function z4(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function _y(e,t,n,r,a){var i=Hn(n)?wi:Cn.current;return i=Es(t,i),vs(t,a),n=Wx(e,t,n,r,i,a),r=Vx(),e!==null&&!qn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,pa(e,t,a)):(Ht&&r&&Ix(t),t.flags|=1,Mn(e,t,n,a),t.child)}function g1(e,t,n,r,a){if(Hn(n)){var i=!0;Xc(t)}else i=!1;if(vs(t,a),t.stateNode===null)Ic(e,t),O4(t,n,r),vy(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=hr(u):(u=Hn(n)?wi:Cn.current,u=Es(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)&&l1(t,s,r,u),Ra=!1;var p=t.memoizedState;s.state=p,nu(t,r,s,a),c=t.memoizedState,l!==r||p!==c||$n.current||Ra?(typeof d=="function"&&(by(t,n,d,r),c=t.memoizedState),(l=Ra||o1(t,n,l,r,p,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,g4(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Sr(t.type,l),s.props=u,f=t.pendingProps,p=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=hr(c):(c=Hn(n)?wi:Cn.current,c=Es(t,c));var g=n.getDerivedStateFromProps;(d=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||p!==c)&&l1(t,s,r,c),Ra=!1,p=t.memoizedState,s.state=p,nu(t,r,s,a);var m=t.memoizedState;l!==f||p!==m||$n.current||Ra?(typeof g=="function"&&(by(t,n,g,r),m=t.memoizedState),(u=Ra||o1(t,n,u,r,p,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&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===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&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return wy(e,t,n,r,i,a)}function wy(e,t,n,r,a,i){z4(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return a&&Jv(t,n,!1),pa(e,t,i);r=t.stateNode,jM.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Ss(t,e.child,null,i),t.child=Ss(t,null,l,i)):Mn(e,t,l,i),t.memoizedState=r.state,a&&Jv(t,n,!0),t.child}function U4(e){var t=e.stateNode;t.pendingContext?Zv(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zv(e,t.context,!1),Ux(e,t.containerInfo)}function h1(e,t,n,r,a){return Ns(),Ox(a),t.flags|=256,Mn(e,t,n,r),t.child}var Ey={dehydrated:null,treeContext:null,retryLane:0};function Ny(e){return{baseLanes:e,cachePool:null,transitions:null}}function q4(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),zt(Kt,a&1),e===null)return yy(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=Pu(s,r,0,null),e=bi(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ny(n),t.memoizedState=Ey,e):Yx(t,s));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return TM(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=Ka(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=Ka(l,i):(i=bi(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?Ny(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Ey,r}return i=e.child,e=i.sibling,r=Ka(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 Yx(e,t){return t=Pu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jl(e,t,n,r){return r!==null&&Ox(r),Ss(t,e.child,null,n),e=Yx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function TM(e,t,n,r,a,i,s){if(n)return t.flags&256?(t.flags&=-257,r=lf(Error(Ae(422))),Jl(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Pu({mode:"visible",children:r.children},a,0,null),i=bi(i,a,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ss(t,e.child,null,s),t.child.memoizedState=Ny(s),t.memoizedState=Ey,i);if(!(t.mode&1))return Jl(e,t,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Ae(419)),r=lf(i,r,void 0),Jl(e,t,s,r)}if(l=(s&e.childLanes)!==0,qn||l){if(r=gn,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,fa(e,a),Ar(r,e,a,-1))}return tb(),r=lf(Error(Ae(421))),Jl(e,t,s,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=qM.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,tr=Ha(a.nextSibling),nr=t,Ht=!0,jr=null,e!==null&&(ur[dr++]=aa,ur[dr++]=ia,ur[dr++]=Ei,aa=e.id,ia=e.overflow,Ei=t),t=Yx(t,r.children),t.flags|=4096,t)}function m1(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xy(e.return,t,n)}function cf(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 $4(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Mn(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&&m1(e,n,t);else if(e.tag===19)m1(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(zt(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&&ru(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),cf(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&&ru(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}cf(t,!0,n,null,i);break;case"together":cf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function pa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Si|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ae(153));if(t.child!==null){for(e=t.child,n=Ka(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ka(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function AM(e,t,n){switch(t.tag){case 3:U4(t),Ns();break;case 5:h4(t);break;case 1:Hn(t.type)&&Xc(t);break;case 4:Ux(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;zt(eu,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(zt(Kt,Kt.current&1),t.flags|=128,null):n&t.child.childLanes?q4(e,t,n):(zt(Kt,Kt.current&1),e=pa(e,t,n),e!==null?e.sibling:null);zt(Kt,Kt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $4(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),zt(Kt,Kt.current),r)break;return null;case 22:case 23:return t.lanes=0,B4(e,t,n)}return pa(e,t,n)}var H4,Sy,W4,V4;H4=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}};Sy=function(){};W4=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,mi(Wr.current);var i=null;switch(n){case"input":a=K0(e,a),r=K0(e,r),i=[];break;case"select":a=Qt({},a,{value:void 0}),r=Qt({},r,{value:void 0}),i=[];break;case"textarea":a=X0(e,a),r=X0(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yc)}J0(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"&&(Oo.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"&&(Oo.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Ut("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)}};V4=function(e,t,n,r){n!==r&&(t.flags|=4)};function eo(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 wn(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 RM(e,t,n){var r=t.pendingProps;switch(Lx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wn(t),null;case 1:return Hn(t.type)&&Qc(),wn(t),null;case 3:return r=t.stateNode,Cs(),qt($n),qt(Cn),$x(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Xl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jr!==null&&(Ly(jr),jr=null))),Sy(e,t),wn(t),null;case 5:qx(t);var a=mi(Go.current);if(n=t.type,e!==null&&t.stateNode!=null)W4(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ae(166));return wn(t),null}if(e=mi(Wr.current),Xl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[qr]=t,r[Wo]=i,e=(t.mode&1)!==0,n){case"dialog":Ut("cancel",r),Ut("close",r);break;case"iframe":case"object":case"embed":Ut("load",r);break;case"video":case"audio":for(a=0;a<po.length;a++)Ut(po[a],r);break;case"source":Ut("error",r);break;case"img":case"image":case"link":Ut("error",r),Ut("load",r);break;case"details":Ut("toggle",r);break;case"input":Nv(r,i),Ut("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ut("invalid",r);break;case"textarea":Cv(r,i),Ut("invalid",r)}J0(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&&Ql(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Ql(r.textContent,l,e),a=["children",""+l]):Oo.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&Ut("scroll",r)}switch(n){case"input":ql(r),Sv(r,i,!0);break;case"textarea":ql(r),jv(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Yc)}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=vC(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[Wo]=r,H4(e,t,!1,!1),t.stateNode=e;e:{switch(s=ey(n,r),n){case"dialog":Ut("cancel",e),Ut("close",e),a=r;break;case"iframe":case"object":case"embed":Ut("load",e),a=r;break;case"video":case"audio":for(a=0;a<po.length;a++)Ut(po[a],e);a=r;break;case"source":Ut("error",e),a=r;break;case"img":case"image":case"link":Ut("error",e),Ut("load",e),a=r;break;case"details":Ut("toggle",e),a=r;break;case"input":Nv(e,r),a=K0(e,r),Ut("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Qt({},r,{value:void 0}),Ut("invalid",e);break;case"textarea":Cv(e,r),a=X0(e,r),Ut("invalid",e);break;default:a=r}J0(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?wC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&kC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Do(e,c):typeof c=="number"&&Do(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Oo.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Ut("scroll",e):c!=null&&bx(e,i,c,s))}switch(n){case"input":ql(e),Sv(e,r,!1);break;case"textarea":ql(e),jv(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Qa(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?ms(e,!!r.multiple,i,!1):r.defaultValue!=null&&ms(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Yc)}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 wn(t),null;case 6:if(e&&t.stateNode!=null)V4(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ae(166));if(n=mi(Go.current),mi(Wr.current),Xl(t)){if(r=t.stateNode,n=t.memoizedProps,r[qr]=t,(i=r.nodeValue!==n)&&(e=nr,e!==null))switch(e.tag){case 3:Ql(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ql(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 wn(t),null;case 13:if(qt(Kt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ht&&tr!==null&&t.mode&1&&!(t.flags&128))u4(),Ns(),t.flags|=98560,i=!1;else if(i=Xl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Ae(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ae(317));i[qr]=t}else Ns(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wn(t),i=!1}else jr!==null&&(Ly(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?ln===0&&(ln=3):tb())),t.updateQueue!==null&&(t.flags|=4),wn(t),null);case 4:return Cs(),Sy(e,t),e===null&&$o(t.stateNode.containerInfo),wn(t),null;case 10:return Fx(t.type._context),wn(t),null;case 17:return Hn(t.type)&&Qc(),wn(t),null;case 19:if(qt(Kt),i=t.memoizedState,i===null)return wn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)eo(i,!1);else{if(ln!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=ru(e),s!==null){for(t.flags|=128,eo(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return zt(Kt,Kt.current&1|2),t.child}e=e.sibling}i.tail!==null&&tn()>Ts&&(t.flags|=128,r=!0,eo(i,!1),t.lanes=4194304)}else{if(!r)if(e=ru(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),eo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ht)return wn(t),null}else 2*tn()-i.renderingStartTime>Ts&&n!==1073741824&&(t.flags|=128,r=!0,eo(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=tn(),t.sibling=null,n=Kt.current,zt(Kt,r?n&1|2:n&1),t):(wn(t),null);case 22:case 23:return eb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jn&1073741824&&(wn(t),t.subtreeFlags&6&&(t.flags|=8192)):wn(t),null;case 24:return null;case 25:return null}throw Error(Ae(156,t.tag))}function MM(e,t){switch(Lx(t),t.tag){case 1:return Hn(t.type)&&Qc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cs(),qt($n),qt(Cn),$x(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qx(t),null;case 13:if(qt(Kt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ae(340));Ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return qt(Kt),null;case 4:return Cs(),null;case 10:return Fx(t.type._context),null;case 22:case 23:return eb(),null;case 24:return null;default:return null}}var ec=!1,Nn=!1,IM=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function gs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){en(e,t,r)}else n.current=null}function Cy(e,t,n){try{n()}catch(r){en(e,t,r)}}var y1=!1;function LM(e,t){if(uy=Vc,e=XC(),Mx(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,p=null;t:for(;;){for(var g;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),(g=f.firstChild)!==null;)p=f,f=g;for(;;){if(f===e)break t;if(p===n&&++u===a&&(l=s),p===i&&++d===r&&(c=s),(g=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=g}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(dy={focusedElem:e,selectionRange:n},Vc=!1,Ue=t;Ue!==null;)if(t=Ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ue=e;else for(;Ue!==null;){t=Ue;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(Ae(163))}}catch(N){en(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Ue=e;break}Ue=t.return}return m=y1,y1=!1,m}function Co(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&&Cy(t,n,i)}a=a.next}while(a!==r)}}function Ou(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 jy(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 G4(e){var t=e.alternate;t!==null&&(e.alternate=null,G4(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qr],delete t[Wo],delete t[gy],delete t[mM],delete t[yM])),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 K4(e){return e.tag===5||e.tag===3||e.tag===4}function x1(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||K4(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 Ty(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=Yc));else if(r!==4&&(e=e.child,e!==null))for(Ty(e,t,n),e=e.sibling;e!==null;)Ty(e,t,n),e=e.sibling}function Ay(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(Ay(e,t,n),e=e.sibling;e!==null;)Ay(e,t,n),e=e.sibling}var yn=null,Cr=!1;function Na(e,t,n){for(n=n.child;n!==null;)Y4(e,t,n),n=n.sibling}function Y4(e,t,n){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Cu,n)}catch{}switch(n.tag){case 5:Nn||gs(n,t);case 6:var r=yn,a=Cr;yn=null,Na(e,t,n),yn=r,Cr=a,yn!==null&&(Cr?(e=yn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):yn.removeChild(n.stateNode));break;case 18:yn!==null&&(Cr?(e=yn,n=n.stateNode,e.nodeType===8?tf(e.parentNode,n):e.nodeType===1&&tf(e,n),zo(e)):tf(yn,n.stateNode));break;case 4:r=yn,a=Cr,yn=n.stateNode.containerInfo,Cr=!0,Na(e,t,n),yn=r,Cr=a;break;case 0:case 11:case 14:case 15:if(!Nn&&(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)&&Cy(n,t,s),a=a.next}while(a!==r)}Na(e,t,n);break;case 1:if(!Nn&&(gs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){en(n,t,l)}Na(e,t,n);break;case 21:Na(e,t,n);break;case 22:n.mode&1?(Nn=(r=Nn)||n.memoizedState!==null,Na(e,t,n),Nn=r):Na(e,t,n);break;default:Na(e,t,n)}}function b1(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new IM),t.forEach(function(r){var a=$M.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:yn=l.stateNode,Cr=!1;break e;case 3:yn=l.stateNode.containerInfo,Cr=!0;break e;case 4:yn=l.stateNode.containerInfo,Cr=!0;break e}l=l.return}if(yn===null)throw Error(Ae(160));Y4(i,s,a),yn=null,Cr=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){en(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Q4(t,e),t=t.sibling}function Q4(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{Co(3,e,e.return),Ou(3,e)}catch(y){en(e,e.return,y)}try{Co(5,e,e.return)}catch(y){en(e,e.return,y)}}break;case 1:wr(t,e),Fr(e),r&512&&n!==null&&gs(n,n.return);break;case 5:if(wr(t,e),Fr(e),r&512&&n!==null&&gs(n,n.return),e.flags&32){var a=e.stateNode;try{Do(a,"")}catch(y){en(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&&xC(a,i),ey(l,s);var u=ey(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?wC(a,f):d==="dangerouslySetInnerHTML"?kC(a,f):d==="children"?Do(a,f):bx(a,d,f,u)}switch(l){case"input":Y0(a,i);break;case"textarea":bC(a,i);break;case"select":var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var g=i.value;g!=null?ms(a,!!i.multiple,g,!1):p!==!!i.multiple&&(i.defaultValue!=null?ms(a,!!i.multiple,i.defaultValue,!0):ms(a,!!i.multiple,i.multiple?[]:"",!1))}a[Wo]=i}catch(y){en(e,e.return,y)}}break;case 6:if(wr(t,e),Fr(e),r&4){if(e.stateNode===null)throw Error(Ae(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){en(e,e.return,y)}}break;case 3:if(wr(t,e),Fr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zo(t.containerInfo)}catch(y){en(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||(Zx=tn())),r&4&&b1(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Nn=(u=Nn)||d,wr(t,e),Nn=u):wr(t,e),Fr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Ue=e,d=e.child;d!==null;){for(f=Ue=d;Ue!==null;){switch(p=Ue,g=p.child,p.tag){case 0:case 11:case 14:case 15:Co(4,p,p.return);break;case 1:gs(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){en(r,n,y)}}break;case 5:gs(p,p.return);break;case 22:if(p.memoizedState!==null){k1(f);continue}}g!==null?(g.return=p,Ue=g):k1(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=_C("display",s))}catch(y){en(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){en(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&&b1(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(K4(n)){var r=n;break e}n=n.return}throw Error(Ae(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Do(a,""),r.flags&=-33);var i=x1(e);Ay(e,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,l=x1(e);Ty(e,l,s);break;default:throw Error(Ae(161))}}catch(c){en(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function OM(e,t,n){Ue=e,X4(e)}function X4(e,t,n){for(var r=(e.mode&1)!==0;Ue!==null;){var a=Ue,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||ec;if(!s){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Nn;l=ec;var u=Nn;if(ec=s,(Nn=c)&&!u)for(Ue=a;Ue!==null;)s=Ue,c=s.child,s.tag===22&&s.memoizedState!==null?_1(a):c!==null?(c.return=s,Ue=c):_1(a);for(;i!==null;)Ue=i,X4(i),i=i.sibling;Ue=a,ec=l,Nn=u}v1(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,Ue=i):v1(e)}}function v1(e){for(;Ue!==null;){var t=Ue;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Nn||Ou(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Nn)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&&a1(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}a1(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&&zo(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ae(163))}Nn||t.flags&512&&jy(t)}catch(p){en(t,t.return,p)}}if(t===e){Ue=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ue=n;break}Ue=t.return}}function k1(e){for(;Ue!==null;){var t=Ue;if(t===e){Ue=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ue=n;break}Ue=t.return}}function _1(e){for(;Ue!==null;){var t=Ue;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ou(4,t)}catch(c){en(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){en(t,a,c)}}var i=t.return;try{jy(t)}catch(c){en(t,i,c)}break;case 5:var s=t.return;try{jy(t)}catch(c){en(t,s,c)}}}catch(c){en(t,t.return,c)}if(t===e){Ue=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ue=l;break}Ue=t.return}}var DM=Math.ceil,su=ha.ReactCurrentDispatcher,Qx=ha.ReactCurrentOwner,gr=ha.ReactCurrentBatchConfig,Nt=0,gn=null,rn=null,bn=0,Jn=0,hs=ei(0),ln=0,Xo=null,Si=0,Du=0,Xx=0,jo=null,Un=null,Zx=0,Ts=1/0,na=null,ou=!1,Ry=null,Va=null,tc=!1,Fa=null,lu=0,To=0,My=null,Lc=-1,Oc=0;function Ln(){return Nt&6?tn():Lc!==-1?Lc:Lc=tn()}function Ga(e){return e.mode&1?Nt&2&&bn!==0?bn&-bn:bM.transition!==null?(Oc===0&&(Oc=OC()),Oc):(e=At,e!==0||(e=window.event,e=e===void 0?16:qC(e.type)),e):1}function Ar(e,t,n,r){if(50<To)throw To=0,My=null,Error(Ae(185));ol(e,n,r),(!(Nt&2)||e!==gn)&&(e===gn&&(!(Nt&2)&&(Du|=n),ln===4&&Ia(e,bn)),Wn(e,r),n===1&&Nt===0&&!(t.mode&1)&&(Ts=tn()+500,Mu&&ti()))}function Wn(e,t){var n=e.callbackNode;b3(e,t);var r=Wc(e,e===gn?bn:0);if(r===0)n!==null&&Rv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Rv(n),t===1)e.tag===0?xM(w1.bind(null,e)):o4(w1.bind(null,e)),gM(function(){!(Nt&6)&&ti()}),n=null;else{switch(DC(r)){case 1:n=Ex;break;case 4:n=IC;break;case 16:n=Hc;break;case 536870912:n=LC;break;default:n=Hc}n=ij(n,Z4.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Z4(e,t){if(Lc=-1,Oc=0,Nt&6)throw Error(Ae(327));var n=e.callbackNode;if(ks()&&e.callbackNode!==n)return null;var r=Wc(e,e===gn?bn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=cu(e,r);else{t=r;var a=Nt;Nt|=2;var i=ej();(gn!==e||bn!==t)&&(na=null,Ts=tn()+500,xi(e,t));do try{BM();break}catch(l){J4(e,l)}while(!0);Px(),su.current=i,Nt=a,rn!==null?t=0:(gn=null,bn=0,t=ln)}if(t!==0){if(t===2&&(a=iy(e),a!==0&&(r=a,t=Iy(e,a))),t===1)throw n=Xo,xi(e,0),Ia(e,r),Wn(e,tn()),n;if(t===6)Ia(e,r);else{if(a=e.current.alternate,!(r&30)&&!PM(a)&&(t=cu(e,r),t===2&&(i=iy(e),i!==0&&(r=i,t=Iy(e,i))),t===1))throw n=Xo,xi(e,0),Ia(e,r),Wn(e,tn()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Ae(345));case 2:di(e,Un,na);break;case 3:if(Ia(e,r),(r&130023424)===r&&(t=Zx+500-tn(),10<t)){if(Wc(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Ln(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=py(di.bind(null,e,Un,na),t);break}di(e,Un,na);break;case 4:if(Ia(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=tn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*DM(r/1960))-r,10<r){e.timeoutHandle=py(di.bind(null,e,Un,na),r);break}di(e,Un,na);break;case 5:di(e,Un,na);break;default:throw Error(Ae(329))}}}return Wn(e,tn()),e.callbackNode===n?Z4.bind(null,e):null}function Iy(e,t){var n=jo;return e.current.memoizedState.isDehydrated&&(xi(e,t).flags|=256),e=cu(e,t),e!==2&&(t=Un,Un=n,t!==null&&Ly(t)),e}function Ly(e){Un===null?Un=e:Un.push.apply(Un,e)}function PM(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 Ia(e,t){for(t&=~Xx,t&=~Du,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 w1(e){if(Nt&6)throw Error(Ae(327));ks();var t=Wc(e,0);if(!(t&1))return Wn(e,tn()),null;var n=cu(e,t);if(e.tag!==0&&n===2){var r=iy(e);r!==0&&(t=r,n=Iy(e,r))}if(n===1)throw n=Xo,xi(e,0),Ia(e,t),Wn(e,tn()),n;if(n===6)throw Error(Ae(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,di(e,Un,na),Wn(e,tn()),null}function Jx(e,t){var n=Nt;Nt|=1;try{return e(t)}finally{Nt=n,Nt===0&&(Ts=tn()+500,Mu&&ti())}}function Ci(e){Fa!==null&&Fa.tag===0&&!(Nt&6)&&ks();var t=Nt;Nt|=1;var n=gr.transition,r=At;try{if(gr.transition=null,At=1,e)return e()}finally{At=r,gr.transition=n,Nt=t,!(Nt&6)&&ti()}}function eb(){Jn=hs.current,qt(hs)}function xi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,pM(n)),rn!==null)for(n=rn.return;n!==null;){var r=n;switch(Lx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Qc();break;case 3:Cs(),qt($n),qt(Cn),$x();break;case 5:qx(r);break;case 4:Cs();break;case 13:qt(Kt);break;case 19:qt(Kt);break;case 10:Fx(r.type._context);break;case 22:case 23:eb()}n=n.return}if(gn=e,rn=e=Ka(e.current,null),bn=Jn=t,ln=0,Xo=null,Xx=Du=Si=0,Un=jo=null,hi!==null){for(t=0;t<hi.length;t++)if(n=hi[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}hi=null}return e}function J4(e,t){do{var n=rn;try{if(Px(),Rc.current=iu,au){for(var r=Yt.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}au=!1}if(Ni=0,pn=on=Yt=null,So=!1,Ko=0,Qx.current=null,n===null||n.return===null){ln=1,Xo=t,rn=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=bn,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 p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var g=u1(s);if(g!==null){g.flags&=-257,d1(g,s,l,i,t),g.mode&1&&c1(i,u,t),t=g,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)){c1(i,u,t),tb();break e}c=Error(Ae(426))}}else if(Ht&&l.mode&1){var v=u1(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),d1(v,s,l,i,t),Ox(js(c,l));break e}}i=c=js(c,l),ln!==4&&(ln=2),jo===null?jo=[i]:jo.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=D4(i,c,t);r1(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"&&(Va===null||!Va.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=P4(i,l,t);r1(i,N);break e}}i=i.return}while(i!==null)}nj(n)}catch(w){t=w,rn===n&&n!==null&&(rn=n=n.return);continue}break}while(!0)}function ej(){var e=su.current;return su.current=iu,e===null?iu:e}function tb(){(ln===0||ln===3||ln===2)&&(ln=4),gn===null||!(Si&268435455)&&!(Du&268435455)||Ia(gn,bn)}function cu(e,t){var n=Nt;Nt|=2;var r=ej();(gn!==e||bn!==t)&&(na=null,xi(e,t));do try{FM();break}catch(a){J4(e,a)}while(!0);if(Px(),Nt=n,su.current=r,rn!==null)throw Error(Ae(261));return gn=null,bn=0,ln}function FM(){for(;rn!==null;)tj(rn)}function BM(){for(;rn!==null&&!u3();)tj(rn)}function tj(e){var t=aj(e.alternate,e,Jn);e.memoizedProps=e.pendingProps,t===null?nj(e):rn=t,Qx.current=null}function nj(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=MM(n,t),n!==null){n.flags&=32767,rn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ln=6,rn=null;return}}else if(n=RM(n,t,Jn),n!==null){rn=n;return}if(t=t.sibling,t!==null){rn=t;return}rn=t=e}while(t!==null);ln===0&&(ln=5)}function di(e,t,n){var r=At,a=gr.transition;try{gr.transition=null,At=1,zM(e,t,n,r)}finally{gr.transition=a,At=r}return null}function zM(e,t,n,r){do ks();while(Fa!==null);if(Nt&6)throw Error(Ae(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(Ae(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(v3(e,i),e===gn&&(rn=gn=null,bn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||tc||(tc=!0,ij(Hc,function(){return ks(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=gr.transition,gr.transition=null;var s=At;At=1;var l=Nt;Nt|=4,Qx.current=null,LM(e,n),Q4(n,e),sM(dy),Vc=!!uy,dy=uy=null,e.current=n,OM(n),d3(),Nt=l,At=s,gr.transition=i}else e.current=n;if(tc&&(tc=!1,Fa=e,lu=a),i=e.pendingLanes,i===0&&(Va=null),g3(n.stateNode),Wn(e,tn()),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(ou)throw ou=!1,e=Ry,Ry=null,e;return lu&1&&e.tag!==0&&ks(),i=e.pendingLanes,i&1?e===My?To++:(To=0,My=e):To=0,ti(),null}function ks(){if(Fa!==null){var e=DC(lu),t=gr.transition,n=At;try{if(gr.transition=null,At=16>e?16:e,Fa===null)var r=!1;else{if(e=Fa,Fa=null,lu=0,Nt&6)throw Error(Ae(331));var a=Nt;for(Nt|=4,Ue=e.current;Ue!==null;){var i=Ue,s=i.child;if(Ue.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Ue=u;Ue!==null;){var d=Ue;switch(d.tag){case 0:case 11:case 15:Co(8,d,i)}var f=d.child;if(f!==null)f.return=d,Ue=f;else for(;Ue!==null;){d=Ue;var p=d.sibling,g=d.return;if(G4(d),d===u){Ue=null;break}if(p!==null){p.return=g,Ue=p;break}Ue=g}}}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)}}Ue=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Ue=s;else e:for(;Ue!==null;){if(i=Ue,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Co(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,Ue=x;break e}Ue=i.return}}var b=e.current;for(Ue=b;Ue!==null;){s=Ue;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,Ue=k;else e:for(s=b;Ue!==null;){if(l=Ue,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ou(9,l)}}catch(w){en(l,l.return,w)}if(l===s){Ue=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Ue=N;break e}Ue=l.return}}if(Nt=a,ti(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Cu,e)}catch{}r=!0}return r}finally{At=n,gr.transition=t}}return!1}function E1(e,t,n){t=js(n,t),t=D4(e,t,1),e=Wa(e,t,1),t=Ln(),e!==null&&(ol(e,1,t),Wn(e,t))}function en(e,t,n){if(e.tag===3)E1(e,e,n);else for(;t!==null;){if(t.tag===3){E1(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Va===null||!Va.has(r))){e=js(n,e),e=P4(t,e,1),t=Wa(t,e,1),e=Ln(),t!==null&&(ol(t,1,e),Wn(t,e));break}}t=t.return}}function UM(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ln(),e.pingedLanes|=e.suspendedLanes&n,gn===e&&(bn&n)===n&&(ln===4||ln===3&&(bn&130023424)===bn&&500>tn()-Zx?xi(e,0):Xx|=n),Wn(e,t)}function rj(e,t){t===0&&(e.mode&1?(t=Wl,Wl<<=1,!(Wl&130023424)&&(Wl=4194304)):t=1);var n=Ln();e=fa(e,t),e!==null&&(ol(e,t,n),Wn(e,n))}function qM(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rj(e,n)}function $M(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(Ae(314))}r!==null&&r.delete(t),rj(e,n)}var aj;aj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$n.current)qn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qn=!1,AM(e,t,n);qn=!!(e.flags&131072)}else qn=!1,Ht&&t.flags&1048576&&l4(t,Jc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ic(e,t),e=t.pendingProps;var a=Es(t,Cn.current);vs(t,n),a=Wx(null,t,r,e,a,n);var i=Vx();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,Hn(r)?(i=!0,Xc(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,zx(t),a.updater=Lu,t.stateNode=a,a._reactInternals=t,vy(t,r,e,n),t=wy(null,t,r,!0,i,n)):(t.tag=0,Ht&&i&&Ix(t),Mn(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ic(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=WM(r),e=Sr(r,e),a){case 0:t=_y(null,t,r,e,n);break e;case 1:t=g1(null,t,r,e,n);break e;case 11:t=f1(null,t,r,e,n);break e;case 14:t=p1(null,t,r,Sr(r.type,e),n);break e}throw Error(Ae(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),_y(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),g1(e,t,r,a,n);case 3:e:{if(U4(t),e===null)throw Error(Ae(387));r=t.pendingProps,i=t.memoizedState,a=i.element,g4(e,t),nu(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=js(Error(Ae(423)),t),t=h1(e,t,r,n,a);break e}else if(r!==a){a=js(Error(Ae(424)),t),t=h1(e,t,r,n,a);break e}else for(tr=Ha(t.stateNode.containerInfo.firstChild),nr=t,Ht=!0,jr=null,n=f4(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ns(),r===a){t=pa(e,t,n);break e}Mn(e,t,r,n)}t=t.child}return t;case 5:return h4(t),e===null&&yy(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,fy(r,a)?s=null:i!==null&&fy(r,i)&&(t.flags|=32),z4(e,t),Mn(e,t,s,n),t.child;case 6:return e===null&&yy(t),null;case 13:return q4(e,t,n);case 4:return Ux(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ss(t,null,r,n):Mn(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),f1(e,t,r,a,n);case 7:return Mn(e,t,t.pendingProps,n),t.child;case 8:return Mn(e,t,t.pendingProps.children,n),t.child;case 12:return Mn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,s=a.value,zt(eu,r._currentValue),r._currentValue=s,i!==null)if(Mr(i.value,s)){if(i.children===a.children&&!$n.current){t=pa(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=la(-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),xy(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(Ae(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),xy(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}Mn(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,vs(t,n),a=hr(a),r=r(a),t.flags|=1,Mn(e,t,r,n),t.child;case 14:return r=t.type,a=Sr(r,t.pendingProps),a=Sr(r.type,a),p1(e,t,r,a,n);case 15:return F4(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Sr(r,a),Ic(e,t),t.tag=1,Hn(r)?(e=!0,Xc(t)):e=!1,vs(t,n),O4(t,r,a),vy(t,r,a,n),wy(null,t,r,!0,e,n);case 19:return $4(e,t,n);case 22:return B4(e,t,n)}throw Error(Ae(156,t.tag))};function ij(e,t){return MC(e,t)}function HM(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 pr(e,t,n,r){return new HM(e,t,n,r)}function nb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function WM(e){if(typeof e=="function")return nb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===kx)return 11;if(e===_x)return 14}return 2}function Ka(e,t){var n=e.alternate;return n===null?(n=pr(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 Dc(e,t,n,r,a,i){var s=2;if(r=e,typeof e=="function")nb(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case is:return bi(n.children,a,i,t);case vx:s=8,a|=8;break;case H0:return e=pr(12,n,t,a|2),e.elementType=H0,e.lanes=i,e;case W0:return e=pr(13,n,t,a),e.elementType=W0,e.lanes=i,e;case V0:return e=pr(19,n,t,a),e.elementType=V0,e.lanes=i,e;case hC:return Pu(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pC:s=10;break e;case gC:s=9;break e;case kx:s=11;break e;case _x:s=14;break e;case Aa:s=16,r=null;break e}throw Error(Ae(130,e==null?e:typeof e,""))}return t=pr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function bi(e,t,n,r){return e=pr(7,e,r,t),e.lanes=n,e}function Pu(e,t,n,r){return e=pr(22,e,r,t),e.elementType=hC,e.lanes=n,e.stateNode={isHidden:!1},e}function uf(e,t,n){return e=pr(6,e,null,t),e.lanes=n,e}function df(e,t,n){return t=pr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function VM(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=Hd(0),this.expirationTimes=Hd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hd(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function rb(e,t,n,r,a,i,s,l,c){return e=new VM(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=pr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zx(i),e}function GM(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:as,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function sj(e){if(!e)return Xa;e=e._reactInternals;e:{if(Ai(e)!==e||e.tag!==1)throw Error(Ae(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Hn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ae(171))}if(e.tag===1){var n=e.type;if(Hn(n))return s4(e,n,t)}return t}function oj(e,t,n,r,a,i,s,l,c){return e=rb(n,r,!0,e,a,i,s,l,c),e.context=sj(null),n=e.current,r=Ln(),a=Ga(n),i=la(r,a),i.callback=t??null,Wa(n,i,a),e.current.lanes=a,ol(e,a,r),Wn(e,r),e}function Fu(e,t,n,r){var a=t.current,i=Ln(),s=Ga(a);return n=sj(n),t.context===null?t.context=n:t.pendingContext=n,t=la(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Wa(a,t,s),e!==null&&(Ar(e,a,s,i),Ac(e,a,s)),s}function uu(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 N1(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ab(e,t){N1(e,t),(e=e.alternate)&&N1(e,t)}function KM(){return null}var lj=typeof reportError=="function"?reportError:function(e){console.error(e)};function ib(e){this._internalRoot=e}Bu.prototype.render=ib.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ae(409));Fu(e,t,null,null)};Bu.prototype.unmount=ib.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ci(function(){Fu(null,e,null,null)}),t[da]=null}};function Bu(e){this._internalRoot=e}Bu.prototype.unstable_scheduleHydration=function(e){if(e){var t=BC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ma.length&&t!==0&&t<Ma[n].priority;n++);Ma.splice(n,0,e),n===0&&UC(e)}};function sb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function zu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function S1(){}function YM(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=uu(s);i.call(u)}}var s=oj(t,r,e,0,null,!1,!1,"",S1);return e._reactRootContainer=s,e[da]=s.current,$o(e.nodeType===8?e.parentNode:e),Ci(),s}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=uu(c);l.call(u)}}var c=rb(e,0,!1,null,null,!1,!1,"",S1);return e._reactRootContainer=c,e[da]=c.current,$o(e.nodeType===8?e.parentNode:e),Ci(function(){Fu(t,c,n,r)}),c}function Uu(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=uu(s);l.call(c)}}Fu(t,s,e,a)}else s=YM(n,t,e,a,r);return uu(s)}PC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fo(t.pendingLanes);n!==0&&(Nx(t,n|1),Wn(t,tn()),!(Nt&6)&&(Ts=tn()+500,ti()))}break;case 13:Ci(function(){var r=fa(e,1);if(r!==null){var a=Ln();Ar(r,e,1,a)}}),ab(e,1)}};Sx=function(e){if(e.tag===13){var t=fa(e,134217728);if(t!==null){var n=Ln();Ar(t,e,134217728,n)}ab(e,134217728)}};FC=function(e){if(e.tag===13){var t=Ga(e),n=fa(e,t);if(n!==null){var r=Ln();Ar(n,e,t,r)}ab(e,t)}};BC=function(){return At};zC=function(e,t){var n=At;try{return At=e,t()}finally{At=n}};ny=function(e,t,n){switch(t){case"input":if(Y0(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=Ru(r);if(!a)throw Error(Ae(90));yC(r),Y0(r,a)}}}break;case"textarea":bC(e,n);break;case"select":t=n.value,t!=null&&ms(e,!!n.multiple,t,!1)}};SC=Jx;CC=Ci;var QM={usingClientEntryPoint:!1,Events:[cl,cs,Ru,EC,NC,Jx]},to={findFiberByHostInstance:gi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XM={bundleType:to.bundleType,version:to.version,rendererPackageName:to.rendererPackageName,rendererConfig:to.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ha.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=AC(e),e===null?null:e.stateNode},findFiberByHostInstance:to.findFiberByHostInstance||KM,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 nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{Cu=nc.inject(XM),Hr=nc}catch{}}ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QM;ir.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sb(t))throw Error(Ae(200));return GM(e,t,null,n)};ir.createRoot=function(e,t){if(!sb(e))throw Error(Ae(299));var n=!1,r="",a=lj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=rb(e,1,!1,null,null,n,!1,r,a),e[da]=t.current,$o(e.nodeType===8?e.parentNode:e),new ib(t)};ir.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(Ae(188)):(e=Object.keys(e).join(","),Error(Ae(268,e)));return e=AC(t),e=e===null?null:e.stateNode,e};ir.flushSync=function(e){return Ci(e)};ir.hydrate=function(e,t,n){if(!zu(t))throw Error(Ae(200));return Uu(null,e,t,!0,n)};ir.hydrateRoot=function(e,t,n){if(!sb(e))throw Error(Ae(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=lj;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=oj(t,null,e,1,n??null,a,!1,i,s),e[da]=t.current,$o(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 Bu(t)};ir.render=function(e,t,n){if(!zu(t))throw Error(Ae(200));return Uu(null,e,t,!1,n)};ir.unmountComponentAtNode=function(e){if(!zu(e))throw Error(Ae(40));return e._reactRootContainer?(Ci(function(){Uu(null,null,e,!1,function(){e._reactRootContainer=null,e[da]=null})}),!0):!1};ir.unstable_batchedUpdates=Jx;ir.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!zu(n))throw Error(Ae(200));if(e==null||e._reactInternals===void 0)throw Error(Ae(38));return Uu(e,t,n,!1,r)};ir.version="18.3.1-next-f1338f8080-20240426";function cj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cj)}catch(e){console.error(e)}}cj(),cC.exports=ir;var ZM=cC.exports,C1=ZM;q0.createRoot=C1.createRoot,q0.hydrateRoot=C1.hydrateRoot;const JM="modulepreload",eI=function(e){return"/"+e},j1={},uj=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=eI(c),c in j1)return;j1[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":JM,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,g)=>{f.addEventListener("load",p),f.addEventListener("error",()=>g(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)})},ca={"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.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","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"},Ba={en:ca},tI={"zh-TW":()=>uj(()=>import("./zh-TW-CyqgrzJC.js"),[])},_s=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function T1(e){if(Ba[e])return Ba[e];const t=tI[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),ca;try{const n=await t();return Ba[e]=n.default||n,Ba[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),ca}}function dj(e,t,n){let r=e[t];return r===void 0&&e!==ca&&(r=ca[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 fj=h.createContext(null);function nI({initialLocale:e="en",children:t}){const r=_s.map(p=>p.code).includes(e)?e:"en",[a,i]=h.useState(r),[s,l]=h.useState(Ba[r]||ca),c=h.useRef(0);h.useEffect(()=>{let p=!1;if(r!=="en"&&!Ba[r]){const g=++c.current;T1(r).then(m=>{if(p||c.current!==g)return;const y=m===ca&&r!=="en"?"en":r;Ba[y]=m,l(m),y!==r&&i(y)})}return()=>{p=!0,c.current+=1}},[]);const u=h.useCallback(async p=>{const g=++c.current,m=await T1(p);if(c.current!==g)return;const y=m===ca&&p!=="en"?"en":p;Ba[y]=m,l(m),i(y);try{localStorage.setItem("pave-locale",y)}catch{}},[]),d=h.useCallback((p,g)=>dj(s,p,g),[s]),f=h.useMemo(()=>({t:d,locale:a,setLocale:u,availableLocales:_s}),[d,a,u]);return o.jsx(fj.Provider,{value:f,children:t})}function vt(){const e=h.useContext(fj);return e||{t:(t,n)=>dj(ca,t,n),locale:"en",setLocale:()=>{},availableLocales:_s}}function rI(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&_s.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=_s.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=_s.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function aI({darkMode:e,onToggle:t}){const{t:n}=vt();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 iI({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:i,cancelLabel:s,destructive:l}){var{t:c}=vt(),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"),p=s||c("confirm_dialog.cancel"),g=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:p}),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 "+g,children:f})]})]})})}var pj=h.createContext(null);function sI({children:e}){var{t}=vt(),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(p){n.current=p,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(pj.Provider,{value:l,children:[e,o.jsx(iI,{open:i.open,onClose:c,onConfirm:u,title:i.title,message:i.message,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,destructive:i.destructive})]})}function dl(){var e=h.useContext(pj);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}function oI(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 lI(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=oI(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 no="\0__other__";function cI(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]||no}else l=no;n[l]||(n[l]=[]),n[l].push(s)}const r=Object.keys(n).sort(function(i,s){return i===no?1:s===no?-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===no?t("sidebar.other"):s;a.push({key:s,label:l,sessions:n[s]})}return a}function uI({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:p,onImportError:g,showArchived:m,onToggleShowArchived:y,isOpen:v,onClose:x,onToggle:b,hasMoreSessions:k,onLoadMoreSessions:N}){const{t:w}=vt(),_=dl(),[T,A]=h.useState(""),[D,R]=h.useState(null),[$,F]=h.useState(""),[G,P]=h.useState(!1),M=G||!!T,{webSessions:S,tuiSessions:I}=h.useMemo(()=>{const X=[],Ne=[],ve=Array.isArray(e)?e:[];for(var me=0;me<ve.length;me++)ve[me].source==="tui"?Ne.push(ve[me]):X.push(ve[me]);return{webSessions:X,tuiSessions:Ne}},[e]),B=T?S.filter(function(X){return(X.title||w("sidebar.untitled")).toLowerCase().includes(T.toLowerCase())}):S,Q=T?I.filter(function(X){return(X.title||w("sidebar.untitled")).toLowerCase().includes(T.toLowerCase())}):I,C=h.useMemo(()=>cI(Q,w),[Q,w]),{pinnedSessions:K,regularSessions:W,archivedSessions:j}=h.useMemo(()=>{const X=[],Ne=[],ve=[];for(let me=0;me<B.length;me++){const pe=B[me];pe.archived?ve.push(pe):pe.pinned?X.push(pe):Ne.push(pe)}return{pinnedSessions:X,regularSessions:Ne,archivedSessions:ve}},[B]),U=h.useMemo(()=>lI(W,w),[W,w]),le=X=>{R(X.id),F(X.title||"")},Z=X=>{$.trim()&&l(X,$.trim()),R(null),F("")},ke=(X,Ne)=>{const ve=Ne&&Ne.dimmed,me=X.source==="legacy"||X.source==="archive"||X._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 ${X.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":ve?"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(X.id),onKeyDown:pe=>{pe.currentTarget===pe.target&&(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),r(X.id))},children:D===X.id?o.jsx("input",{autoFocus:!0,value:$,onChange:pe=>F(pe.target.value),onBlur:()=>Z(X.id),onKeyDown:pe=>{pe.key==="Enter"?(pe.preventDefault(),pe.stopPropagation(),pe.currentTarget.blur()):pe.key==="Escape"?(pe.stopPropagation(),R(null)):pe.key===" "&&pe.stopPropagation()},onClick:pe=>pe.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):o.jsxs(o.Fragment,{children:[X.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"})}),X.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"})}),X.compactedAt&&X.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[X.id]&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:w("sidebar.session_processing"),"aria-label":w("sidebar.session_processing")}),o.jsxs("span",{className:`flex-1 flex items-center min-w-0 ${ve?"italic":""}`,children:[o.jsx("span",{className:"truncate min-w-0",children:X.title||w("sidebar.untitled")}),X.archived&&o.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",w("sidebar.archived"),")"]})]}),o.jsxs("div",{className:"hidden group-hover:flex group-focus-within:flex items-center gap-0.5",children:[u&&(!X.archived||X.pinned)&&o.jsx("button",{onClick:pe=>{pe.stopPropagation(),u(X.id,!X.pinned)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:X.pinned?w("sidebar.unpin"):w("sidebar.pin"),"aria-label":X.pinned?w("sidebar.unpin"):w("sidebar.pin"),children:o.jsx("svg",{className:`w-3 h-3 ${X.pinned?"text-amber-500":""}`,fill:X.pinned?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:X.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"})})}),!me&&o.jsxs(o.Fragment,{children:[d&&o.jsx("button",{onClick:async pe=>{pe.stopPropagation(),!(!X.archived&&!await _({title:w("sidebar.archive"),message:w("sidebar.confirmArchive",{defaultValue:"Archive this session? It will be hidden from the sidebar."}),confirmLabel:w("sidebar.archive")}))&&d(X.id,!X.archived)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:X.archived?w("sidebar.unarchive"):w("sidebar.archive"),"aria-label":X.archived?w("sidebar.unarchive"):w("sidebar.archive"),children:o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:X.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:pe=>{pe.stopPropagation(),f(X.id)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:w("sidebar.export"),"aria-label":w("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:pe=>{pe.stopPropagation(),le(X)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:w("sidebar.rename"),"aria-label":w("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:pe=>{pe.stopPropagation(),c&&c(X.id)},className:"p-1 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:w("sidebar.regenerate_title"),"aria-label":w("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 pe=>{pe.stopPropagation(),await _({title:w("sidebar.delete_title"),message:w("sidebar.delete_confirm"),destructive:!0,confirmLabel:w("sidebar.delete")})&&i(X.id)},className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-red-500",title:w("sidebar.delete"),"aria-label":w("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"})})})]})]})]})},X.id)},re=X=>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:X})});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:w("sidebar.show"),"aria-label":w("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:w("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:w("sidebar.hide"),"aria-label":w("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:w("app.new_chat")}),p&&o.jsx("button",{onClick:()=>{const X=document.createElement("input");X.type="file",X.accept=".yaml,.yml",X.onchange=Ne=>{const ve=Ne&&Ne.target&&Ne.target.files,me=ve&&ve[0];if(me){const pe=me.name.toLowerCase();if(!pe.endsWith(".yaml")&&!pe.endsWith(".yml")){g&&g(w("import.invalid_file_type"));return}const Le=10*1024*1024;if(me.size>Le){g&&g(w("import.file_too_large"));return}const Se=new FileReader;Se.onload=Te=>{const Fe=Te&&Te.target?Te.target.result:null;if(typeof Fe!="string"){g&&g(w("import.read_error"));return}p(Fe)},Se.onerror=()=>{g&&g(w("import.read_error"))},Se.readAsText(me)}},X.click()},className:"py-2 px-3 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 text-sm transition-colors",title:w("sidebar.import"),"aria-label":w("sidebar.import"),children: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:w("sidebar.search_placeholder"),value:T,onChange:X=>A(X.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:[K.length===0&&U.every(X=>X.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:w(T?"sidebar.no_matches":"sidebar.no_conversations")}),K.length>0&&o.jsxs(o.Fragment,{children:[re(w("sidebar.pinned")),K.map(X=>ke(X))]}),U.map(X=>o.jsxs("div",{children:[(K.length>0||U.length>1)&&re(X.label),X.sessions.map(Ne=>ke(Ne))]},X.key)),m&&j.length>0&&o.jsxs(o.Fragment,{children:[re(w("sidebar.archived")),j.map(X=>ke(X,{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(X=>!X)},"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:w("sidebar.terminal")}),o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",Q.length,")"]})]}),M&&C.map(X=>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:X.label})]}),X.sessions.map(Ne=>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 ${Ne.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(Ne.id),onKeyDown:ve=>{ve.currentTarget===ve.target&&(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),r(Ne.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:Ne.title||w("sidebar.untitled")})]},Ne.id))]},X.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"})}),w("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"})}),w(m?"sidebar.hide_archived":"sidebar.show_archived")]})}),B.some(function(X){return X.source!=="legacy"&&!X._readOnly})&&s&&o.jsx("div",{className:"pt-3 pb-2 px-1",children:o.jsxs("button",{onClick:async()=>{await _({title:w("sidebar.delete_all_title"),message:w("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:w("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"})}),w("sidebar.delete_all")]})})]})]})]})}function dI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gI={};function A1(e,t){return(gI.jsx?pI:fI).test(e)}const hI=/[ \t\n\f\r]/g;function mI(e){return typeof e=="object"?e.type==="text"?R1(e.value):!1:R1(e)}function R1(e){return e.replace(hI,"")===""}class fl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}fl.prototype.normal={};fl.prototype.property={};fl.prototype.space=void 0;function gj(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new fl(n,r,t)}function Oy(e){return e.toLowerCase()}class Gn{constructor(t,n){this.attribute=n,this.property=t}}Gn.prototype.attribute="";Gn.prototype.booleanish=!1;Gn.prototype.boolean=!1;Gn.prototype.commaOrSpaceSeparated=!1;Gn.prototype.commaSeparated=!1;Gn.prototype.defined=!1;Gn.prototype.mustUseProperty=!1;Gn.prototype.number=!1;Gn.prototype.overloadedBoolean=!1;Gn.prototype.property="";Gn.prototype.spaceSeparated=!1;Gn.prototype.space=void 0;let yI=0;const lt=Ri(),nn=Ri(),Dy=Ri(),Re=Ri(),Ot=Ri(),vi=Ri(),Zn=Ri();function Ri(){return 2**++yI}const Py=Object.freeze(Object.defineProperty({__proto__:null,boolean:lt,booleanish:nn,commaOrSpaceSeparated:Zn,commaSeparated:vi,number:Re,overloadedBoolean:Dy,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),ff=Object.keys(Py);class ob extends Gn{constructor(t,n,r,a){let i=-1;if(super(t,n),M1(this,"space",a),typeof r=="number")for(;++i<ff.length;){const s=ff[i];M1(this,ff[i],(r&Py[s])===Py[s])}}}ob.prototype.defined=!0;function M1(e,t,n){n&&(e[t]=n)}function Os(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new ob(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Oy(r)]=r,n[Oy(i.attribute)]=r}return new fl(t,n,e.space)}const hj=Os({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:Re,ariaColIndex:Re,ariaColSpan:Re,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Ot,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:Re,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:Re,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Ot,ariaRowCount:Re,ariaRowIndex:Re,ariaRowSpan:Re,ariaSelected:nn,ariaSetSize:Re,ariaSort:null,ariaValueMax:Re,ariaValueMin:Re,ariaValueNow:Re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mj(e,t){return t in e?e[t]:t}function yj(e,t){return mj(e,t.toLowerCase())}const xI=Os({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vi,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:lt,allowPaymentRequest:lt,allowUserMedia:lt,alpha:lt,alt:null,as:null,async:lt,autoCapitalize:null,autoComplete:Ot,autoFocus:lt,autoPlay:lt,blocking:Ot,capture:null,charSet:null,checked:lt,cite:null,className:Ot,closedBy:null,colorSpace:null,cols:Re,colSpan:Re,command:null,commandFor:null,content:null,contentEditable:nn,controls:lt,controlsList:Ot,coords:Re|vi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:lt,defer:lt,dir:null,dirName:null,disabled:lt,download:Dy,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:lt,formTarget:null,headers:Ot,height:Re,hidden:Dy,high:Re,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:lt,inputMode:null,integrity:null,is:null,isMap:lt,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:lt,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:lt,low:Re,manifest:null,max:null,maxLength:Re,media:null,method:null,min:null,minLength:Re,multiple:lt,muted:lt,name:null,nonce:null,noModule:lt,noValidate:lt,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:lt,optimum:Re,pattern:null,ping:Ot,placeholder:null,playsInline:lt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:lt,referrerPolicy:null,rel:Ot,required:lt,reversed:lt,rows:Re,rowSpan:Re,sandbox:Ot,scope:null,scoped:lt,seamless:lt,selected:lt,shadowRootClonable:lt,shadowRootCustomElementRegistry:lt,shadowRootDelegatesFocus:lt,shadowRootMode:null,shadowRootSerializable:lt,shape:null,size:Re,sizes:null,slot:null,span:Re,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Re,step:null,style:null,tabIndex:Re,target:null,title:null,translate:null,type:null,typeMustMatch:lt,useMap:null,value:nn,width:Re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:Re,borderColor:null,bottomMargin:Re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:lt,declare:lt,event:null,face:null,frame:null,frameBorder:null,hSpace:Re,leftMargin:Re,link:null,longDesc:null,lowSrc:null,marginHeight:Re,marginWidth:Re,noResize:lt,noHref:lt,noShade:lt,noWrap:lt,object:null,profile:null,prompt:null,rev:null,rightMargin:Re,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:Re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Re,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:lt,disablePictureInPicture:lt,disableRemotePlayback:lt,exportParts:vi,part:Ot,prefix:null,property:null,results:Re,security:null,unselectable:null},space:"html",transform:yj}),bI=Os({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:Zn,accentHeight:Re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Re,amplitude:Re,arabicForm:null,ascent:Re,attributeName:null,attributeType:null,azimuth:Re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Re,by:null,calcMode:null,capHeight:Re,className:Ot,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:Re,diffuseConstant:Re,direction:null,display:null,dur:null,divisor:Re,dominantBaseline:null,download:lt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Re,enableBackground:null,end:null,event:null,exponent:Re,externalResourcesRequired:null,fill:null,fillOpacity:Re,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:vi,g2:vi,glyphName:vi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Re,horizOriginX:Re,horizOriginY:Re,id:null,ideographic:Re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Re,k:Re,k1:Re,k2:Re,k3:Re,k4:Re,kernelMatrix:Zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Re,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:Re,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:Re,overlineThickness:Re,paintOrder:null,panose1:null,path:null,pathLength:Re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Re,pointsAtY:Re,pointsAtZ:Re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zn,rev:Zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zn,requiredFeatures:Zn,requiredFonts:Zn,requiredFormats:Zn,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:Re,specularExponent:Re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Re,strikethroughThickness:Re,string:null,stroke:null,strokeDashArray:Zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Re,strokeOpacity:Re,strokeWidth:null,style:null,surfaceScale:Re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zn,tabIndex:Re,tableValues:null,target:null,targetX:Re,targetY:Re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Re,underlineThickness:Re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Re,values:null,vAlphabetic:Re,vMathematical:Re,vectorEffect:null,vHanging:Re,vIdeographic:Re,version:null,vertAdvY:Re,vertOriginX:Re,vertOriginY:Re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mj}),xj=Os({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()}}),bj=Os({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yj}),vj=Os({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vI={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"},kI=/[A-Z]/g,I1=/-[a-z]/g,_I=/^data[-\w.:]+$/i;function wI(e,t){const n=Oy(t);let r=t,a=Gn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_I.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(I1,NI);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!I1.test(i)){let s=i.replace(kI,EI);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=ob}return new a(r,t)}function EI(e){return"-"+e.toLowerCase()}function NI(e){return e.charAt(1).toUpperCase()}const SI=gj([hj,xI,xj,bj,vj],"html"),lb=gj([hj,bI,xj,bj,vj],"svg");function CI(e){return e.join(" ").trim()}var cb={},L1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,jI=/\n/g,TI=/^\s*/,AI=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,RI=/^:\s*/,MI=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,II=/^[;\s]*/,LI=/^\s+|\s+$/g,OI=`
49
+ `,O1="/",D1="*",pi="",DI="comment",PI="declaration";function FI(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(jI);y&&(n+=y.length);var v=m.lastIndexOf(OI);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(TI)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=i();if(!(O1!=e.charAt(0)||D1!=e.charAt(1))){for(var y=2;pi!=e.charAt(y)&&(D1!=e.charAt(y)||O1!=e.charAt(y+1));)++y;if(y+=2,pi===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:DI,comment:v})}}function p(){var m=i(),y=c(AI);if(y){if(f(),!c(RI))return l("property missing ':'");var v=c(MI),x=m({type:PI,property:P1(y[0].replace(L1,pi)),value:v?P1(v[0].replace(L1,pi)):pi});return c(II),x}}function g(){var m=[];d(m);for(var y;y=p();)y!==!1&&(m.push(y),d(m));return m}return u(),g()}function P1(e){return e?e.replace(LI,pi):pi}var BI=FI,zI=Da&&Da.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cb,"__esModule",{value:!0});cb.default=qI;const UI=zI(BI);function qI(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,UI.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 qu={};Object.defineProperty(qu,"__esModule",{value:!0});qu.camelCase=void 0;var $I=/^--[a-zA-Z0-9_-]+$/,HI=/-([a-z])/g,WI=/^[^-]+$/,VI=/^-(webkit|moz|ms|o|khtml)-/,GI=/^-(ms)-/,KI=function(e){return!e||WI.test(e)||$I.test(e)},YI=function(e,t){return t.toUpperCase()},F1=function(e,t){return"".concat(t,"-")},QI=function(e,t){return t===void 0&&(t={}),KI(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(GI,F1):e=e.replace(VI,F1),e.replace(HI,YI))};qu.camelCase=QI;var XI=Da&&Da.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ZI=XI(cb),JI=qu;function Fy(e,t){var n={};return!e||typeof e!="string"||(0,ZI.default)(e,function(r,a){r&&a&&(n[(0,JI.camelCase)(r,t)]=a)}),n}Fy.default=Fy;var eL=Fy;const tL=il(eL),kj=_j("end"),ub=_j("start");function _j(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 nL(e){const t=ub(e),n=kj(e);if(t&&n)return{start:t,end:n}}function Ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?B1(e.position):"start"in e||"end"in e?B1(e):"line"in e||"column"in e?By(e):""}function By(e){return z1(e&&e.line)+":"+z1(e&&e.column)}function B1(e){return By(e&&e.start)+"-"+By(e&&e.end)}function z1(e){return e&&typeof e=="number"?e:1}class jn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=Ao(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const db={}.hasOwnProperty,rL=new Map,aL=/[A-Z]/g,iL=new Set(["table","tbody","thead","tfoot","tr"]),sL=new Set(["td","th"]),wj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function oL(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=hL(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=gL(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"?lb:SI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Ej(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Ej(e,t,n){if(t.type==="element")return lL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return dL(e,t,n);if(t.type==="mdxjsEsm")return uL(e,t);if(t.type==="root")return fL(e,t,n);if(t.type==="text")return pL(e,t)}function lL(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=lb,e.schema=a),e.ancestors.push(t);const i=Sj(e,t.tagName,!1),s=mL(e,t);let l=pb(e,t);return iL.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!mI(c):!0})),Nj(e,s,i,t),fb(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function cL(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)}Zo(e,t.position)}function uL(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zo(e,t.position)}function dL(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=lb,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Sj(e,t.name,!0),s=yL(e,t),l=pb(e,t);return Nj(e,s,i,t),fb(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function fL(e,t,n){const r={};return fb(r,pb(e,t)),e.create(t,e.Fragment,r,n)}function pL(e,t){return t.value}function Nj(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function fb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function gL(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 hL(e,t){return n;function n(r,a,i,s){const l=Array.isArray(i.children),c=ub(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 mL(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&db.call(t.properties,a)){const i=xL(e,a,t.properties[a]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&sL.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 yL(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 Zo(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 Zo(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function pb(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:rL;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=Ej(e,i,s);l!==void 0&&n.push(l)}return n}function xL(e,t,n){const r=wI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?dI(n):CI(n)),r.property==="style"){let a=typeof n=="object"?n:bL(e,String(n));return e.stylePropertyNameCase==="css"&&(a=vL(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?vI[r.property]||r.property:r.attribute,n]}}function bL(e,t){try{return tL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new jn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=wj+"#cannot-parse-style-attribute",a}}function Sj(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=A1(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=A1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return db.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zo(e)}function Zo(e,t){const n=new jn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=wj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vL(e){const t={};let n;for(n in e)db.call(e,n)&&(t[kL(n)]=e[n]);return t}function kL(e){let t=e.replace(aL,_L);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function _L(e){return"-"+e.toLowerCase()}const pf={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"]},wL={};function gb(e,t){const n=wL,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Cj(e,r,a)}function Cj(e,t,n){if(EL(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 U1(e.children,t,n)}return Array.isArray(e)?U1(e,t,n):""}function U1(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Cj(e[a],t,n);return r.join("")}function EL(e){return!!(e&&typeof e=="object")}const q1=document.createElement("i");function hb(e){const t="&"+e+";";q1.innerHTML=t;const n=q1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function rr(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 fr(e,t){return e.length>0?(rr(e,e.length,0,t),e):t}const $1={}.hasOwnProperty;function jj(e){const t={};let n=-1;for(;++n<e.length;)NL(t,e[n]);return t}function NL(e,t){let n;for(n in t){const a=($1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){$1.call(a,s)||(a[s]=[]);const l=i[s];SL(a[s],Array.isArray(l)?l:l?[l]:[])}}}function SL(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);rr(e,0,0,r)}function Tj(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 In=ni(/[A-Za-z]/),Sn=ni(/[\dA-Za-z]/),CL=ni(/[#-'*+\--9=?A-Z^-~]/);function du(e){return e!==null&&(e<32||e===127)}const zy=ni(/\d/),jL=ni(/[\dA-Fa-f]/),TL=ni(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function xt(e){return e===-2||e===-1||e===32}const $u=ni(new RegExp("\\p{P}|\\p{S}","u")),ji=ni(/\s/);function ni(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ds(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&Sn(e.charCodeAt(n+1))&&Sn(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 _t(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return xt(c)?(e.enter(n),l(c)):t(c)}function l(c){return xt(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const AL={tokenize:RL};function RL(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"),_t(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 tt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),s)}}const ML={tokenize:IL},H1={tokenize:LL};function IL(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 w=N,_;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){_=t.events[w][1].end;break}x(r);let T=N;for(;T<t.events.length;)t.events[T][1].end={..._},T++;return rr(t.events,w+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 p(k);if(a.currentConstruct&&a.currentConstruct.concrete)return m(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(H1,d,f)(k)}function d(k){return a&&b(),x(r),p(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,m(k)}function p(k){return t.containerState={},e.attempt(H1,g,m)(k)}function g(k){return r++,n.push([t.currentConstruct,t.containerState]),p(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 tt(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),y)}function v(k,N){const w=t.sliceStream(k);if(N&&w.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(w),t.parser.lazy[k.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<s&&(!a.events[_][1].end||a.events[_][1].end.offset>s))return;const T=t.events.length;let A=T,D,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(D){R=t.events[A][1].end;break}D=!0}for(x(r),_=T;_<t.events.length;)t.events[_][1].end={...R},_++;rr(t.events,A+1,0,t.events.slice(T)),t.events.length=_}}function x(k){let N=n.length;for(;N-- >k;){const w=n[N];t.containerState=w[1],w[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 LL(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function As(e){if(e===null||Dt(e)||ji(e))return 1;if($u(e))return 2}function Hu(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 Uy={name:"attention",resolveAll:OL,tokenize:DL};function OL(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},p={...e[n][1].start};W1(f,-c),W1(p,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:p},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=fr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=fr(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=fr(u,Hu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=fr(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=fr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,rr(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 DL(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=As(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=As(c),f=!d||d===2&&a||n.includes(c),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(d||!f)),t(c)}}function W1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PL={name:"autolink",tokenize:FL};function FL(e,t,n){let r=0;return a;function a(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(g){return In(g)?(e.consume(g),s):g===64?n(g):u(g)}function s(g){return g===43||g===45||g===46||Sn(g)?(r=1,l(g)):u(g)}function l(g){return g===58?(e.consume(g),r=0,c):(g===43||g===45||g===46||Sn(g))&&r++<32?(e.consume(g),l):(r=0,u(g))}function c(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||du(g)?n(g):(e.consume(g),c)}function u(g){return g===64?(e.consume(g),d):CL(g)?(e.consume(g),u):n(g)}function d(g){return Sn(g)?f(g):n(g)}function f(g){return g===46?(e.consume(g),r=0,d):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):p(g)}function p(g){if((g===45||Sn(g))&&r++<63){const m=g===45?p:f;return e.consume(g),m}return n(g)}}const pl={partial:!0,tokenize:BL};function BL(e,t,n){return r;function r(i){return xt(i)?_t(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||tt(i)?t(i):n(i)}}const Aj={continuation:{tokenize:UL},exit:qL,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 xt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function UL(e,t,n){const r=this;return a;function a(s){return xt(s)?_t(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Aj,t,n)(s)}}function qL(e){e.exit("blockQuote")}const Rj={name:"characterEscape",tokenize:$L};function $L(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 TL(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Mj={name:"characterReference",tokenize:HL};function HL(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=Sn,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=jL,d):(e.enter("characterReferenceValue"),i=7,s=zy,d(f))}function d(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===Sn&&!hb(r.sliceSerialize(p))?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 V1={partial:!0,tokenize:VL},G1={concrete:!0,name:"codeFenced",tokenize:WL};function WL(e,t,n){const r=this,a={partial:!0,tokenize:w};let i=0,s=0,l;return c;function c(_){return u(_)}function u(_){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,l=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===l?(s++,e.consume(_),d):s<3?n(_):(e.exit("codeFencedFenceSequence"),xt(_)?_t(e,f,"whitespace")(_):f(_))}function f(_){return _===null||tt(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(V1,y,N)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===null||tt(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(_)):xt(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_t(e,g,"whitespace")(_)):_===96&&_===l?n(_):(e.consume(_),p)}function g(_){return _===null||tt(_)?f(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||tt(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(_)):_===96&&_===l?n(_):(e.consume(_),m)}function y(_){return e.attempt(a,N,v)(_)}function v(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x}function x(_){return i>0&&xt(_)?_t(e,b,"linePrefix",i+1)(_):b(_)}function b(_){return _===null||tt(_)?e.check(V1,y,N)(_):(e.enter("codeFlowValue"),k(_))}function k(_){return _===null||tt(_)?(e.exit("codeFlowValue"),b(_)):(e.consume(_),k)}function N(_){return e.exit("codeFenced"),t(_)}function w(_,T,A){let D=0;return R;function R(M){return _.enter("lineEnding"),_.consume(M),_.exit("lineEnding"),$}function $(M){return _.enter("codeFencedFence"),xt(M)?_t(_,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):F(M)}function F(M){return M===l?(_.enter("codeFencedFenceSequence"),G(M)):A(M)}function G(M){return M===l?(D++,_.consume(M),G):D>=s?(_.exit("codeFencedFenceSequence"),xt(M)?_t(_,P,"whitespace")(M):P(M)):A(M)}function P(M){return M===null||tt(M)?(_.exit("codeFencedFence"),T(M)):A(M)}}}function VL(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 gf={name:"codeIndented",tokenize:KL},GL={partial:!0,tokenize:YL};function KL(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),_t(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):tt(u)?e.attempt(GL,s,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||tt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function YL(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):_t(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):tt(s)?a(s):n(s)}}const QL={name:"codeText",previous:ZL,resolve:XL,tokenize:JL};function XL(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 ZL(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JL(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)):tt(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||tt(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 eO{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&&ro(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),ro(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ro(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);ro(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ro(this.left,n.reverse())}}}function ro(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 Ij(e){const t={};let n=-1,r,a,i,s,l,c,u;const d=new eO(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,tO(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 rr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function tO(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,p=-1,g=n,m=0,y=0;const v=[y];for(;g;){for(;e.get(++a)[1]!==g;);i.push(a),g._tokenizer||(d=r.sliceStream(g),g.next||d.push(null),f&&s.defineSkip(g.start),g._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),g._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=g,g=g.next}for(g=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(y=p+1,v.push(y),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(s.events=[],g?(g._tokenizer=void 0,g.previous=void 0):v.pop(),p=v.length;p--;){const x=l.slice(v[p],v[p+1]),b=i.pop();c.push([b,b+x.length-1]),e.splice(b,2,x)}for(c.reverse(),p=-1;++p<c.length;)u[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return u}const nO={resolve:aO,tokenize:iO},rO={partial:!0,tokenize:sO};function aO(e){return Ij(e),e}function iO(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):tt(l)?e.check(rO,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 sO(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),_t(e,i,"linePrefix")}function i(s){if(s===null||tt(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 Lj(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),p):x===null||x===32||x===41||du(x)?n(x):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(x))}function p(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"}),g(x))}function g(x){return x===62?(e.exit("chunkString"),e.exit(l),p(x)):x===null||x===60||tt(x)?n(x):(e.consume(x),x===92?m:g)}function m(x){return x===60||x===62||x===92?(e.consume(x),g):g(x)}function y(x){return!d&&(x===null||x===41||Dt(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||du(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 Oj(e,t,n,r,a,i){const s=this;let l=0,c;return u;function u(g){return e.enter(r),e.enter(a),e.consume(g),e.exit(a),e.enter(i),d}function d(g){return l>999||g===null||g===91||g===93&&!c||g===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(g):g===93?(e.exit(i),e.enter(a),e.consume(g),e.exit(a),e.exit(r),t):tt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===null||g===91||g===93||tt(g)||l++>999?(e.exit("chunkString"),d(g)):(e.consume(g),c||(c=!xt(g)),g===92?p:f)}function p(g){return g===91||g===92||g===93?(e.consume(g),l++,f):f(g)}}function Dj(e,t,n,r,a,i){let s;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,c):n(p)}function c(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),c(s)):p===null?n(p):tt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),_t(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||tt(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Ro(e,t){let n;return r;function r(a){return tt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):xt(a)?_t(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const oO={name:"definition",tokenize:cO},lO={partial:!0,tokenize:uO};function cO(e,t,n){const r=this;let a;return i;function i(g){return e.enter("definition"),s(g)}function s(g){return Oj.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function l(g){return a=Rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),c):n(g)}function c(g){return Dt(g)?Ro(e,u)(g):u(g)}function u(g){return Lj(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function d(g){return e.attempt(lO,f,f)(g)}function f(g){return xt(g)?_t(e,p,"whitespace")(g):p(g)}function p(g){return g===null||tt(g)?(e.exit("definition"),r.parser.defined.push(a),t(g)):n(g)}}function uO(e,t,n){return r;function r(l){return Dt(l)?Ro(e,a)(l):n(l)}function a(l){return Dj(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return xt(l)?_t(e,s,"whitespace")(l):s(l)}function s(l){return l===null||tt(l)?t(l):n(l)}}const dO={name:"hardBreakEscape",tokenize:fO};function fO(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return tt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const pO={name:"headingAtx",resolve:gO,tokenize:hO};function gO(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"},rr(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function hO(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||Dt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||tt(d)?(e.exit("atxHeading"),t(d)):xt(d)?_t(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||Dt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const mO=["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"],K1=["pre","script","style","textarea"],yO={concrete:!0,name:"htmlFlow",resolveTo:vO,tokenize:kO},xO={partial:!0,tokenize:wO},bO={partial:!0,tokenize:_O};function vO(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 kO(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),p):j===47?(e.consume(j),i=!0,y):j===63?(e.consume(j),a=3,r.interrupt?t:C):In(j)?(e.consume(j),s=String.fromCharCode(j),v):n(j)}function p(j){return j===45?(e.consume(j),a=2,g):j===91?(e.consume(j),a=5,l=0,m):In(j)?(e.consume(j),a=4,r.interrupt?t:C):n(j)}function g(j){return j===45?(e.consume(j),r.interrupt?t:C):n(j)}function m(j){const U="CDATA[";return j===U.charCodeAt(l++)?(e.consume(j),l===U.length?r.interrupt?t:F:m):n(j)}function y(j){return In(j)?(e.consume(j),s=String.fromCharCode(j),v):n(j)}function v(j){if(j===null||j===47||j===62||Dt(j)){const U=j===47,le=s.toLowerCase();return!U&&!i&&K1.includes(le)?(a=1,r.interrupt?t(j):F(j)):mO.includes(s.toLowerCase())?(a=6,U?(e.consume(j),x):r.interrupt?t(j):F(j)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):i?b(j):k(j))}return j===45||Sn(j)?(e.consume(j),s+=String.fromCharCode(j),v):n(j)}function x(j){return j===62?(e.consume(j),r.interrupt?t:F):n(j)}function b(j){return xt(j)?(e.consume(j),b):R(j)}function k(j){return j===47?(e.consume(j),R):j===58||j===95||In(j)?(e.consume(j),N):xt(j)?(e.consume(j),k):R(j)}function N(j){return j===45||j===46||j===58||j===95||Sn(j)?(e.consume(j),N):w(j)}function w(j){return j===61?(e.consume(j),_):xt(j)?(e.consume(j),w):k(j)}function _(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),c=j,T):xt(j)?(e.consume(j),_):A(j)}function T(j){return j===c?(e.consume(j),c=null,D):j===null||tt(j)?n(j):(e.consume(j),T)}function A(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Dt(j)?w(j):(e.consume(j),A)}function D(j){return j===47||j===62||xt(j)?k(j):n(j)}function R(j){return j===62?(e.consume(j),$):n(j)}function $(j){return j===null||tt(j)?F(j):xt(j)?(e.consume(j),$):n(j)}function F(j){return j===45&&a===2?(e.consume(j),S):j===60&&a===1?(e.consume(j),I):j===62&&a===4?(e.consume(j),K):j===63&&a===3?(e.consume(j),C):j===93&&a===5?(e.consume(j),Q):tt(j)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(xO,W,G)(j)):j===null||tt(j)?(e.exit("htmlFlowData"),G(j)):(e.consume(j),F)}function G(j){return e.check(bO,P,W)(j)}function P(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),M}function M(j){return j===null||tt(j)?G(j):(e.enter("htmlFlowData"),F(j))}function S(j){return j===45?(e.consume(j),C):F(j)}function I(j){return j===47?(e.consume(j),s="",B):F(j)}function B(j){if(j===62){const U=s.toLowerCase();return K1.includes(U)?(e.consume(j),K):F(j)}return In(j)&&s.length<8?(e.consume(j),s+=String.fromCharCode(j),B):F(j)}function Q(j){return j===93?(e.consume(j),C):F(j)}function C(j){return j===62?(e.consume(j),K):j===45&&a===2?(e.consume(j),C):F(j)}function K(j){return j===null||tt(j)?(e.exit("htmlFlowData"),W(j)):(e.consume(j),K)}function W(j){return e.exit("htmlFlow"),t(j)}}function _O(e,t,n){const r=this;return a;function a(s){return tt(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 wO(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(pl,t,n)}}const EO={name:"htmlText",tokenize:NO};function NO(e,t,n){const r=this;let a,i,s;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),w):C===63?(e.consume(C),k):In(C)?(e.consume(C),A):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,m):In(C)?(e.consume(C),b):n(C)}function d(C){return C===45?(e.consume(C),g):n(C)}function f(C){return C===null?n(C):C===45?(e.consume(C),p):tt(C)?(s=f,I(C)):(e.consume(C),f)}function p(C){return C===45?(e.consume(C),g):f(C)}function g(C){return C===62?S(C):C===45?p(C):f(C)}function m(C){const K="CDATA[";return C===K.charCodeAt(i++)?(e.consume(C),i===K.length?y:m):n(C)}function y(C){return C===null?n(C):C===93?(e.consume(C),v):tt(C)?(s=y,I(C)):(e.consume(C),y)}function v(C){return C===93?(e.consume(C),x):y(C)}function x(C){return C===62?S(C):C===93?(e.consume(C),x):y(C)}function b(C){return C===null||C===62?S(C):tt(C)?(s=b,I(C)):(e.consume(C),b)}function k(C){return C===null?n(C):C===63?(e.consume(C),N):tt(C)?(s=k,I(C)):(e.consume(C),k)}function N(C){return C===62?S(C):k(C)}function w(C){return In(C)?(e.consume(C),_):n(C)}function _(C){return C===45||Sn(C)?(e.consume(C),_):T(C)}function T(C){return tt(C)?(s=T,I(C)):xt(C)?(e.consume(C),T):S(C)}function A(C){return C===45||Sn(C)?(e.consume(C),A):C===47||C===62||Dt(C)?D(C):n(C)}function D(C){return C===47?(e.consume(C),S):C===58||C===95||In(C)?(e.consume(C),R):tt(C)?(s=D,I(C)):xt(C)?(e.consume(C),D):S(C)}function R(C){return C===45||C===46||C===58||C===95||Sn(C)?(e.consume(C),R):$(C)}function $(C){return C===61?(e.consume(C),F):tt(C)?(s=$,I(C)):xt(C)?(e.consume(C),$):D(C)}function F(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,G):tt(C)?(s=F,I(C)):xt(C)?(e.consume(C),F):(e.consume(C),P)}function G(C){return C===a?(e.consume(C),a=void 0,M):C===null?n(C):tt(C)?(s=G,I(C)):(e.consume(C),G)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Dt(C)?D(C):(e.consume(C),P)}function M(C){return C===47||C===62||Dt(C)?D(C):n(C)}function S(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function I(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),B}function B(C){return xt(C)?_t(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):Q(C)}function Q(C){return e.enter("htmlTextData"),s(C)}}const mb={name:"labelEnd",resolveAll:TO,resolveTo:AO,tokenize:RO},SO={tokenize:MO},CO={tokenize:IO},jO={tokenize:LO};function TO(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&&rr(e,0,e.length,n),e}function AO(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=fr(l,e.slice(i+1,i+r+3)),l=fr(l,[["enter",d,t]]),l=fr(l,Hu(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),l=fr(l,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),l=fr(l,e.slice(s+1)),l=fr(l,[["exit",c,t]]),rr(e,i,e.length,l),e}function RO(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(p){return i?i._inactive?f(p):(s=r.parser.defined.includes(Rr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(SO,d,s?d:f)(p):p===91?e.attempt(CO,d,s?u:f)(p):s?d(p):f(p)}function u(p){return e.attempt(jO,d,f)(p)}function d(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function MO(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 Dt(f)?Ro(e,i)(f):i(f)}function i(f){return f===41?d(f):Lj(e,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return Dt(f)?Ro(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Dj(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Dt(f)?Ro(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 IO(e,t,n){const r=this;return a;function a(l){return Oj.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 LO(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 OO={name:"labelStartImage",resolveAll:mb.resolveAll,tokenize:DO};function DO(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 PO={name:"labelStartLink",resolveAll:mb.resolveAll,tokenize:FO};function FO(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 hf={name:"lineEnding",tokenize:BO};function BO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),_t(e,t,"linePrefix")}}const Pc={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||tt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),xt(u)?_t(e,l,"whitespace")(u):l(u))}}const zn={continuation:{tokenize:HO},exit:VO,name:"list",tokenize:$O},UO={partial:!0,tokenize:GO},qO={partial:!0,tokenize:WO};function $O(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(g){const m=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:zy(g)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(Pc,n,u)(g):u(g);if(!r.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(g)}return n(g)}function c(g){return zy(g)&&++s<10?(e.consume(g),c):(!r.interrupt||s<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),u(g)):n(g)}function u(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,e.check(pl,r.interrupt?n:d,e.attempt(UO,p,f))}function d(g){return r.containerState.initialBlankLine=!0,i++,p(g)}function f(g){return xt(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),p):n(g)}function p(g){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function HO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pl,a,i);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_t(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!xt(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(qO,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,_t(e,e.attempt(zn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function WO(e,t,n){const r=this;return _t(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 VO(e){e.exit(this.containerState.type)}function GO(e,t,n){const r=this;return _t(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!xt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Y1={name:"setextUnderline",resolveTo:KO,tokenize:YO};function KO(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 YO(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"),xt(u)?_t(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||tt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const QO={tokenize:XO};function XO(e){const t=this,n=e.attempt(pl,r,e.attempt(this.parser.constructs.flowInitial,a,_t(e,e.attempt(this.parser.constructs.flow,a,e.attempt(nO,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 ZO={resolveAll:Fj()},JO=Pj("string"),eD=Pj("text");function Pj(e){return{resolveAll:Fj(e==="text"?tD: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 p=-1;if(f)for(;++p<f.length;){const g=f[p];if(!g.previous||g.previous.call(r,r.previous))return!0}return!1}}}function Fj(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 tD(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 nD={42:zn,43:zn,45:zn,48:zn,49:zn,50:zn,51:zn,52:zn,53:zn,54:zn,55:zn,56:zn,57:zn,62:Aj},rD={91:oO},aD={[-2]:gf,[-1]:gf,32:gf},iD={35:pO,42:Pc,45:[Y1,Pc],60:yO,61:Y1,95:Pc,96:G1,126:G1},sD={38:Mj,92:Rj},oD={[-5]:hf,[-4]:hf,[-3]:hf,33:OO,38:Mj,42:Uy,60:[PL,EO],91:PO,92:[dO,Rj],93:mb,95:Uy,96:QL},lD={null:[Uy,ZO]},cD={null:[42,95]},uD={null:[]},dD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:cD,contentInitial:rD,disable:uD,document:nD,flow:iD,flowInitial:aD,insideSpan:lD,string:sD,text:oD},Symbol.toStringTag,{value:"Module"}));function fD(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(w),check:T(_),consume:b,enter:k,exit:N,interrupt:T(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:g,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f($){return s=fr(s,$),v(),s[s.length-1]!==null?[]:(A(t,0),u.events=Hu(i,u.events,u),u.events)}function p($,F){return gD(g($),F)}function g($){return pD(s,$)}function m(){const{_bufferIndex:$,_index:F,line:G,column:P,offset:M}=r;return{_bufferIndex:$,_index:F,line:G,column:P,offset:M}}function y($){a[$.line]=$.column,R()}function v(){let $;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<F.length;)x(F.charCodeAt(r._bufferIndex));else x(F)}}function x($){d=d($)}function b($){tt($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,R()):$!==-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=$}function k($,F){const G=F||{};return G.type=$,G.start=m(),u.events.push(["enter",G,u]),l.push(G),G}function N($){const F=l.pop();return F.end=m(),u.events.push(["exit",F,u]),F}function w($,F){A($,F.from)}function _($,F){F.restore()}function T($,F){return G;function G(P,M,S){let I,B,Q,C;return Array.isArray(P)?W(P):"tokenize"in P?W([P]):K(P);function K(Z){return ke;function ke(re){const X=re!==null&&Z[re],Ne=re!==null&&Z.null,ve=[...Array.isArray(X)?X:X?[X]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return W(ve)(re)}}function W(Z){return I=Z,B=0,Z.length===0?S:j(Z[B])}function j(Z){return ke;function ke(re){return C=D(),Q=Z,Z.partial||(u.currentConstruct=Z),Z.name&&u.parser.constructs.disable.null.includes(Z.name)?le():Z.tokenize.call(F?Object.assign(Object.create(u),F):u,c,U,le)(re)}}function U(Z){return $(Q,C),M}function le(Z){return C.restore(),++B<I.length?j(I[B]):S}}}function A($,F){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&rr(u.events,F,u.events.length-F,$.resolve(u.events.slice(F),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function D(){const $=m(),F=u.previous,G=u.currentConstruct,P=u.events.length,M=Array.from(l);return{from:P,restore:S};function S(){r=$,u.previous=F,u.currentConstruct=G,u.events.length=P,l=M,R()}}function R(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function pD(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 gD(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 hD(e){const r={constructs:jj([dD,...(e||{}).extensions||[]]),content:a(AL),defined:[],document:a(ML),flow:a(QO),lazy:{},string:a(JO),text:a(eD)};return r;function a(i){return s;function s(l){return fD(r,i,l)}}}function mD(e){for(;!Ij(e););return e}const Q1=/[\0\t\n\r]/g;function yD(){let e=1,t="",n=!0,r;return a;function a(i,s,l){const c=[];let u,d,f,p,g;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(Q1.lastIndex=f,u=Q1.exec(i),p=u&&u.index!==void 0?u.index:i.length,g=i.charCodeAt(p),!u){t=i.slice(f);break}if(g===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(i.slice(f,p)),e+=p-f),g){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=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const xD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bD(e){return e.replace(xD,vD)}function vD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Tj(n.slice(i?2:1),i?16:10)}return hb(n)||e}const Bj={}.hasOwnProperty;function kD(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),_D(n)(mD(hD(n).document().write(yD()(e,t,!0))))}function _D(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(xe),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(Se),blockQuote:i(Ne),characterEscape:D,characterReference:D,codeFenced:i(ve),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ve,s),codeText:i(me,s),codeTextData:D,data:D,codeFlowValue:D,definition:i(pe),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Le),hardBreakEscape:i(Te),hardBreakTrailing:i(Te),htmlFlow:i(Fe,s),htmlFlowData:D,htmlText:i(Fe,s),htmlTextData:D,image:i(fe),label:s,link:i(xe),listItem:i(ue),listItemValue:p,listOrdered:i(Ce,f),listUnordered:i(Ce),paragraph:i(he),reference:j,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(Se),strong:i(_e),thematicBreak:i(Xe)},exit:{atxHeading:c(),atxHeadingSequence:w,autolink:c(),autolinkEmail:X,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:Z,characterReference:ke,codeFenced:c(v),codeFencedFence:y,codeFencedFenceInfo:g,codeFencedFenceMeta:m,codeFlowValue:R,codeIndented:c(x),codeText:c(M),codeTextData:R,data:R,definition:c(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(F),hardBreakTrailing:c(F),htmlFlow:c(G),htmlFlowData:R,htmlText:c(P),htmlTextData:R,image:c(I),label:Q,labelText:B,lineEnding:$,link:c(S),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:U,resourceDestinationString:C,resourceTitleString:K,resource:W,setextHeading:c(A),setextHeadingLineSequence:T,setextHeadingText:_,strong:c(),thematicBreak:c()}};zj(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let z={type:"root",children:[]};const te={stack:[z],tokenStack:[],config:t,enter:l,exit:u,buffer:s,resume:d,data:n},ce=[];let je=-1;for(;++je<H.length;)if(H[je][1].type==="listOrdered"||H[je][1].type==="listUnordered")if(H[je][0]==="enter")ce.push(je);else{const Be=ce.pop();je=a(H,Be,je)}for(je=-1;++je<H.length;){const Be=t[H[je][0]];Bj.call(Be,H[je][1].type)&&Be[H[je][1].type].call(Object.assign({sliceSerialize:H[je][2].sliceSerialize},te),H[je][1])}if(te.tokenStack.length>0){const Be=te.tokenStack[te.tokenStack.length-1];(Be[1]||X1).call(te,void 0,Be[0])}for(z.position={start:Sa(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Sa(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)z=t.transforms[je](z)||z;return z}function a(H,z,te){let ce=z-1,je=-1,Be=!1,Ke,Ye,ot,Rt;for(;++ce<=te;){const mt=H[ce];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?je++:je--,Rt=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(Ke&&!Rt&&!je&&!ot&&(ot=ce),Rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rt=void 0}if(!je&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||je===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(Ke){let Mt=ce;for(Ye=void 0;Mt--;){const de=H[Mt];if(de[1].type==="lineEnding"||de[1].type==="lineEndingBlank"){if(de[0]==="exit")continue;Ye&&(H[Ye][1].type="lineEndingBlank",Be=!0),de[1].type="lineEnding",Ye=Mt}else if(!(de[1].type==="linePrefix"||de[1].type==="blockQuotePrefix"||de[1].type==="blockQuotePrefixWhitespace"||de[1].type==="blockQuoteMarker"||de[1].type==="listItemIndent"))break}ot&&(!Ye||ot<Ye)&&(Ke._spread=!0),Ke.end=Object.assign({},Ye?H[Ye][1].start:mt[1].end),H.splice(Ye||ce,0,["exit",Ke,mt[2]]),ce++,te++}if(mt[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};Ke=Mt,H.splice(ce,0,["enter",Mt,mt[2]]),ce++,te++,ot=void 0,Rt=!0}}}return H[z][1]._spread=Be,te}function i(H,z){return te;function te(ce){l.call(this,H(ce),ce),z&&z.call(this,ce)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(H,z,te){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([z,te||void 0]),H.position={start:Sa(z.start),end:void 0}}function c(H){return z;function z(te){H&&H.call(this,te),u.call(this,te)}}function u(H,z){const te=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==H.type&&(z?z.call(this,H,ce[0]):(ce[1]||X1).call(this,H,ce[0]));else throw new Error("Cannot close `"+H.type+"` ("+Ao({start:H.start,end:H.end})+"): it’s not open");te.position.end=Sa(H.end)}function d(){return gb(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const z=this.stack[this.stack.length-2];z.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function g(){const H=this.resume(),z=this.stack[this.stack.length-1];z.lang=H}function m(){const H=this.resume(),z=this.stack[this.stack.length-1];z.meta=H}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const H=this.resume(),z=this.stack[this.stack.length-1];z.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const H=this.resume(),z=this.stack[this.stack.length-1];z.value=H.replace(/(\r?\n|\r)$/g,"")}function b(H){const z=this.resume(),te=this.stack[this.stack.length-1];te.label=z,te.identifier=Rr(this.sliceSerialize(H)).toLowerCase()}function k(){const H=this.resume(),z=this.stack[this.stack.length-1];z.title=H}function N(){const H=this.resume(),z=this.stack[this.stack.length-1];z.url=H}function w(H){const z=this.stack[this.stack.length-1];if(!z.depth){const te=this.sliceSerialize(H).length;z.depth=te}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function T(H){const z=this.stack[this.stack.length-1];z.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function D(H){const te=this.stack[this.stack.length-1].children;let ce=te[te.length-1];(!ce||ce.type!=="text")&&(ce=Pe(),ce.position={start:Sa(H.start),end:void 0},te.push(ce)),this.stack.push(ce)}function R(H){const z=this.stack.pop();z.value+=this.sliceSerialize(H),z.position.end=Sa(H.end)}function $(H){const z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const te=z.children[z.children.length-1];te.position.end=Sa(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(z.type)&&(D.call(this,H),R.call(this,H))}function F(){this.data.atHardBreak=!0}function G(){const H=this.resume(),z=this.stack[this.stack.length-1];z.value=H}function P(){const H=this.resume(),z=this.stack[this.stack.length-1];z.value=H}function M(){const H=this.resume(),z=this.stack[this.stack.length-1];z.value=H}function S(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const z=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=z,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function I(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const z=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=z,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function B(H){const z=this.sliceSerialize(H),te=this.stack[this.stack.length-2];te.label=bD(z),te.identifier=Rr(z).toLowerCase()}function Q(){const H=this.stack[this.stack.length-1],z=this.resume(),te=this.stack[this.stack.length-1];if(this.data.inReference=!0,te.type==="link"){const ce=H.children;te.children=ce}else te.alt=z}function C(){const H=this.resume(),z=this.stack[this.stack.length-1];z.url=H}function K(){const H=this.resume(),z=this.stack[this.stack.length-1];z.title=H}function W(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function U(H){const z=this.resume(),te=this.stack[this.stack.length-1];te.label=z,te.identifier=Rr(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function le(H){this.data.characterReferenceType=H.type}function Z(H){const z=this.sliceSerialize(H),te=this.data.characterReferenceType;let ce;te?(ce=Tj(z,te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=hb(z);const je=this.stack[this.stack.length-1];je.value+=ce}function ke(H){const z=this.stack.pop();z.position.end=Sa(H.end)}function re(H){R.call(this,H);const z=this.stack[this.stack.length-1];z.url=this.sliceSerialize(H)}function X(H){R.call(this,H);const z=this.stack[this.stack.length-1];z.url="mailto:"+this.sliceSerialize(H)}function Ne(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Le(){return{type:"emphasis",children:[]}}function Se(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function fe(){return{type:"image",title:null,url:"",alt:null}}function xe(){return{type:"link",title:null,url:"",children:[]}}function Ce(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function ue(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function he(){return{type:"paragraph",children:[]}}function _e(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function Xe(){return{type:"thematicBreak"}}}function Sa(e){return{line:e.line,column:e.column,offset:e.offset}}function zj(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?zj(e,r):wD(e,r)}}function wD(e,t){let n;for(n in t)if(Bj.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 X1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ao({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ao({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ao({start:t.start,end:t.end})+") is still open")}function ED(e){const t=this;t.parser=n;function n(r){return kD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ND(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 SD(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
52
+ `}]}function CD(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 jD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Ds(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 RD(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 MD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Uj(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 ID(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uj(e,t);const a={src:Ds(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 LD(e,t){const n={src:Ds(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 OD(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 DD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uj(e,t);const a={href:Ds(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 PD(e,t){const n={href:Ds(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 FD(e,t,n){const r=e.all(t),a=n?BD(n):qj(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 BD(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=qj(n[r])}return t}function qj(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 UD(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qD(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $D(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HD(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=ub(t.children[1]),c=kj(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 WD(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],p={},g=s?s[c]:void 0;g&&(p.align=g);let m={type:"element",tagName:i,properties:p,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 VD(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Z1=9,J1=32;function GD(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(ek(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(ek(t.slice(a),a>0,!1)),i.join("")}function ek(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===Z1||i===J1;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===Z1||i===J1;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function KD(e,t){const n={type:"text",value:GD(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function YD(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const QD={blockquote:ND,break:SD,code:CD,delete:jD,emphasis:TD,footnoteReference:AD,heading:RD,html:MD,imageReference:ID,image:LD,inlineCode:OD,linkReference:DD,link:PD,listItem:FD,list:zD,paragraph:UD,root:qD,strong:$D,table:HD,tableCell:VD,tableRow:WD,text:KD,thematicBreak:YD,toml:rc,yaml:rc,definition:rc,footnoteDefinition:rc};function rc(){}const $j=-1,Wu=0,Mo=1,fu=2,yb=3,xb=4,bb=5,vb=6,Hj=7,Wj=8,Vj=typeof self=="object"?self:globalThis,tk=(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 Vj[e](t)},XD=(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 Wu:case $j:return n(s,a);case Mo:{const l=n([],a);for(const c of s)l.push(r(c));return l}case fu:{const l=n({},a);for(const[c,u]of s)l[r(c)]=r(u);return l}case yb:return n(new Date(s),a);case xb:{const{source:l,flags:c}=s;return n(new RegExp(l,c),a)}case bb:{const l=n(new Map,a);for(const[c,u]of s)l.set(r(c),r(u));return l}case vb:{const l=n(new Set,a);for(const c of s)l.add(r(c));return l}case Hj:{const{name:l,message:c}=s;return n(typeof Vj[l]=="function"?tk(l,c):new Error(c),a)}case Wj: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(tk(i,s),a)};return r},nk=e=>XD(new Map,e)(0),fi="",{toString:ZD}={},{keys:JD}=Object,ao=e=>{const t=typeof e;if(t!=="object"||!e)return[Wu,t];const n=ZD.call(e).slice(8,-1);switch(n){case"Array":return[Mo,fi];case"Object":return[fu,fi];case"Date":return[yb,fi];case"RegExp":return[xb,fi];case"Map":return[bb,fi];case"Set":return[vb,fi];case"DataView":return[Mo,n]}return n.includes("Array")?[Mo,n]:e instanceof Error?[Hj,e.name||"Error"]:[fu,n]},ac=([e,t])=>e===Wu&&(t==="function"||t==="symbol"),eP=(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]=ao(s);switch(l){case Wu:{let d=s;switch(c){case"bigint":l=Wj,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([$j],s)}return a([l,d],s)}case Mo:{if(c){let p=s;return c==="DataView"?p=new Uint8Array(s.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(s)),a([c,[...p]],s)}const d=[],f=a([l,d],s);for(const p of s)d.push(i(p));return f}case fu:{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 p of JD(s))(e||!ac(ao(s[p])))&&d.push([i(p),i(s[p])]);return f}case yb:return a([l,isNaN(s.getTime())?fi:s.toISOString()],s);case xb:{const{source:d,flags:f}=s;return a([l,{source:d,flags:f}],s)}case bb:{const d=[],f=a([l,d],s);for(const[p,g]of s)(e||!(ac(ao(p))||ac(ao(g))))&&d.push([i(p),i(g)]);return f}case vb:{const d=[],f=a([l,d],s);for(const p of s)(e||!ac(ao(p)))&&d.push(i(p));return f}}const{message:u}=s;return a([l,{name:c,message:u}],s)};return i},rk=(e,{json:t,lossy:n}={})=>{const r=[];return eP(!(t||n),!!t,new Map,r)(e),r},pu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nk(rk(e,t)):structuredClone(e):(e,t)=>nk(rk(e,t));function tP(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 nP(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function rP(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tP,r=e.options.footnoteBackLabel||nP,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(),p=Ds(f.toLowerCase());let g=0;const m=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++g<=y;){m.length>0&&m.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,g);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,g),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-"+p},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:{...pu(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 gl=function(e){if(e==null)return oP;if(typeof e=="function")return Vu(e);if(typeof e=="object")return Array.isArray(e)?aP(e):iP(e);if(typeof e=="string")return sP(e);throw new Error("Expected function, string, or object as test")};function aP(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=gl(e[n]);return Vu(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function iP(e){const t=e;return Vu(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function sP(e){return Vu(t);function t(n){return n&&n.type===e}}function Vu(e){return t;function t(n,r,a){return!!(lP(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function oP(){return!0}function lP(e){return e!==null&&typeof e=="object"&&"type"in e}const Gj=[],cP=!0,qy=!1,uP="skip";function Kj(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=gl(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 g=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(g?"<"+g+">":""))+")"})}return p;function p(){let g=Gj,m,y,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(g=dP(n(c,d)),g[0]===qy))return g;if("children"in c&&c.children){const x=c;if(x.children&&g[0]!==uP)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]===qy)return m;y=typeof m[1]=="number"?m[1]:y+s}}return g}}}function dP(e){return Array.isArray(e)?e:typeof e=="number"?[cP,e]:e==null?Gj:[e]}function Gu(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),Kj(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 $y={}.hasOwnProperty,fP={};function pP(e,t){const n=t||fP,r=new Map,a=new Map,i=new Map,s={...QD,...n.handlers},l={all:u,applyData:hP,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:s,one:c,options:n,patch:gP,wrap:yP};return Gu(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:a,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),l;function c(d,f){const p=d.type,g=l.handlers[p];if($y.call(l.handlers,p)&&g)return g(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in d){const{children:y,...v}=d,x=pu(v);return x.children=l.all(d),x}return pu(d)}return(l.options.unknownHandler||mP)(l,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let g=-1;for(;++g<p.length;){const m=l.one(p[g],d);if(m){if(g&&p[g-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=ak(m.value)),!Array.isArray(m)&&m.type==="element")){const y=m.children[0];y&&y.type==="text"&&(y.value=ak(y.value))}Array.isArray(m)?f.push(...m):f.push(m)}}}return f}}function gP(e,t){e.position&&(t.position=nL(e))}function hP(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,pu(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function mP(e,t){const n=t.data||{},r="value"in t&&!($y.call(n,"hProperties")||$y.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 yP(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 ak(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ik(e,t){const n=pP(e,t),r=n.one(e,void 0),a=rP(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 xP(e,t){return e&&"run"in e?async function(n,r){const a=ik(n,{file:r,...t});await e.run(a,r)}:function(n,r){return ik(n,{file:r,...e||t})}}function sk(e){if(e)throw e}var Fc=Object.prototype.hasOwnProperty,Yj=Object.prototype.toString,ok=Object.defineProperty,lk=Object.getOwnPropertyDescriptor,ck=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Yj.call(t)==="[object Array]"},uk=function(t){if(!t||Yj.call(t)!=="[object Object]")return!1;var n=Fc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Fc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Fc.call(t,a)},dk=function(t,n){ok&&n.name==="__proto__"?ok(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},fk=function(t,n){if(n==="__proto__")if(Fc.call(t,n)){if(lk)return lk(t,n).value}else return;return t[n]},bP=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=fk(l,n),a=fk(t,n),l!==a&&(d&&a&&(uk(a)||(i=ck(a)))?(i?(i=!1,s=r&&ck(r)?r:[]):s=r&&uk(r)?r:{},dk(l,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&dk(l,{name:n,newValue:a}));return l};const mf=il(bP);function Hy(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 vP(){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?kP(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 kP(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:_P,dirname:wP,extname:EP,join:NP,sep:"/"};function _P(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');hl(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 wP(e){if(hl(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 EP(e){hl(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 NP(...e){let t=-1,n;for(;++t<e.length;)hl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":SP(n)}function SP(e){hl(e);const t=e.codePointAt(0)===47;let n=CP(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function CP(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 hl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jP={cwd:TP};function TP(){return"/"}function Wy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function AP(e){if(typeof e=="string")e=new URL(e);else if(!Wy(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 RP(e)}function RP(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 yf=["history","path","basename","stem","extname","dirname"];class Qj{constructor(t){let n;t?Wy(t)?n={path:t}:typeof t=="string"||MP(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jP.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yf.length;){const i=yf[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)yf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ur.basename(this.path):void 0}set basename(t){bf(t,"basename"),xf(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){pk(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(xf(t,"extname"),pk(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){Wy(t)&&(t=AP(t)),bf(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){bf(t,"stem"),xf(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 jn(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xf(e,t){if(e&&e.includes(Ur.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ur.sep+"`")}function bf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function MP(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const IP=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},LP={}.hasOwnProperty;class kb extends IP{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=vP()}copy(){const t=new kb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(mf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_f("data",this.frozen),this.namespace[t]=n,this):LP.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_f("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=ic(t),r=this.parser||this.Parser;return vf("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),vf("process",this.parser||this.Parser),kf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const l=ic(t),c=r.parse(l);r.run(c,l,function(d,f,p){if(d||!f||!p)return u(d);const g=f,m=r.stringify(g,p);PP(m)?p.value=m:p.result=m,u(d,p)});function u(d,f){d||!f?s(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),vf("processSync",this.parser||this.Parser),kf("processSync",this.compiler||this.Compiler),this.process(t,a),hk("processSync","process",n),r;function a(i,s){n=!0,sk(i),r=s}}run(t,n,r){gk(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=ic(n);a.run(t,c,u);function u(d,f,p){const g=f||t;d?l(d):s?s(g):r(void 0,g,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),hk("runSync","run",r),a;function i(s,l){sk(s),a=l,r=!0}}stringify(t,n){this.freeze();const r=ic(n),a=this.compiler||this.Compiler;return kf("stringify",a),gk(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(_f("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=mf(!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,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[g,...m]=d;const y=r[p][1];Hy(y)&&Hy(g)&&(g=mf(!0,y,g)),r[p]=[u,g,...m]}}}}const OP=new kb().freeze();function vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _f(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 gk(e){if(!Hy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ic(e){return DP(e)?e:new Qj(e)}function DP(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PP(e){return typeof e=="string"||FP(e)}function FP(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const BP="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",mk=[],yk={allowDangerousHtml:!0},zP=/^(https?|ircs?|mailto|xmpp)$/i,UP=[{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 Jo(e){const t=qP(e),n=$P(e);return HP(t.runSync(t.parse(n),n),e)}function qP(e){const t=e.rehypePlugins||mk,n=e.remarkPlugins||mk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yk}:yk;return OP().use(ED).use(n).use(xP,r).use(t)}function $P(e){const t=e.children||"",n=new Qj;return typeof t=="string"&&(n.value=t),n}function HP(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||WP;for(const d of UP)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+BP+d.id,void 0);return Gu(e,u),oL(e,{Fragment:o.Fragment,components:a,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return s?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let g;for(g in pf)if(Object.hasOwn(pf,g)&&Object.hasOwn(d.properties,g)){const m=d.properties[g],y=pf[g];(y===null||y.includes(d.tagName))&&(d.properties[g]=c(String(m||""),g,d))}}if(d.type==="element"){let g=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!g&&r&&typeof f=="number"&&(g=!r(d,f,p)),g&&p&&typeof f=="number")return l&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function WP(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 xk(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 VP(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function GP(e,t,n){const a=gl((n||{}).ignore||[]),i=KP(t);let s=-1;for(;++s<i.length;)Kj(e,"text",l);function l(u,d){let f=-1,p;for(;++f<d.length;){const g=d[f],m=p?p.children:void 0;if(a(g,m?m.indexOf(g):void 0,p))return;p=g}if(p)return c(u,d)}function c(u,d){const f=d[d.length-1],p=i[s][0],g=i[s][1];let m=0;const v=f.children.indexOf(u);let x=!1,b=[];p.lastIndex=0;let k=p.exec(u.value);for(;k;){const N=k.index,w={index:k.index,input:k.input,stack:[...d,u]};let _=g(...k,w);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?p.lastIndex=N+1:(m!==N&&b.push({type:"text",value:u.value.slice(m,N)}),Array.isArray(_)?b.push(..._):_&&b.push(_),m=N+k[0].length,x=!0),!p.global)break;k=p.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 KP(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([YP(a[0]),QP(a[1])])}return t}function YP(e){return typeof e=="string"?new RegExp(VP(e),"g"):e}function QP(e){return typeof e=="function"?e:function(){return e}}const wf="phrasing",Ef=["autolink","link","image","label"];function XP(){return{transforms:[a6],enter:{literalAutolink:JP,literalAutolinkEmail:Nf,literalAutolinkHttp:Nf,literalAutolinkWww:Nf},exit:{literalAutolink:r6,literalAutolinkEmail:n6,literalAutolinkHttp:e6,literalAutolinkWww:t6}}}function ZP(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wf,notInConstruct:Ef},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wf,notInConstruct:Ef},{character:":",before:"[ps]",after:"\\/",inConstruct:wf,notInConstruct:Ef}]}}function JP(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Nf(e){this.config.enter.autolinkProtocol.call(this,e)}function e6(e){this.config.exit.autolinkProtocol.call(this,e)}function t6(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 n6(e){this.config.exit.autolinkEmail.call(this,e)}function r6(e){this.exit(e)}function a6(e){GP(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,i6],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),s6]],{ignore:["link","linkReference"]})}function i6(e,t,n,r,a){let i="";if(!Xj(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!o6(n)))return!1;const s=l6(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 s6(e,t,n,r){return!Xj(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function o6(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 l6(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=xk(e,"(");let i=xk(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 Xj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ji(n)||$u(n))&&(!t||n!==47)}Zj.peek=y6;function c6(){this.buffer()}function u6(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function d6(){this.buffer()}function f6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function p6(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 g6(e){this.exit(e)}function h6(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 m6(e){this.exit(e)}function y6(){return"["}function Zj(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 x6(){return{enter:{gfmFootnoteCallString:c6,gfmFootnoteCall:u6,gfmFootnoteDefinitionLabelString:d6,gfmFootnoteDefinition:f6},exit:{gfmFootnoteCallString:p6,gfmFootnoteCall:g6,gfmFootnoteDefinitionLabelString:h6,gfmFootnoteDefinition:m6}}}function b6(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Zj},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?Jj:v6))),u(),c}}function v6(e,t,n){return t===0?e:Jj(e,t,n)}function Jj(e,t,n){return(n?"":" ")+e}const k6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];e5.peek=S6;function _6(){return{canContainEols:["delete"],enter:{strikethrough:E6},exit:{strikethrough:N6}}}function w6(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:k6}],handlers:{delete:e5}}}function E6(e){this.enter({type:"delete",children:[]},e)}function N6(e){this.exit(e)}function e5(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 S6(){return"~"}function C6(e){return e.length}function j6(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||C6,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=T6(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]=bk(r[f]);else{const y=bk(r);for(;++f<u;)i[f]=y}f=-1;const p=[],g=[];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),g[f]=b),p[f]=k}s.splice(1,0,p),l.splice(1,0,g),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 w=c[f]-(v[f]||0),_=i[f];_===114?k=" ".repeat(w):_===99?w%2?(k=" ".repeat(w/2+.5),N=" ".repeat(w/2-.5)):(k=" ".repeat(w/2),N=k):N=" ".repeat(w)}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 T6(e){return e==null?"":String(e)}function bk(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 A6(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()),R6);return a(),s}function R6(e,t,n){return">"+(n?"":" ")+e}function M6(e,t){return vk(e,t.inConstruct,!0)&&!vk(e,t.notInConstruct,!1)}function vk(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 kk(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
64
+ `&&M6(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
65
+ `}function I6(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 L6(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 O6(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 D6(e,t,n,r){const a=O6(n),i=e.value||"",s=a==="`"?"GraveAccent":"Tilde";if(L6(e,n)){const f=n.enter("codeIndented"),p=n.indentLines(i,P6);return f(),p}const l=n.createTracker(r),c=a.repeat(Math.max(I6(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 P6(e,t,n){return(n?"":" ")+e}function _b(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 F6(e,t,n,r){const a=_b(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 B6(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 el(e){return"&#x"+e.toString(16).toUpperCase()+";"}function gu(e,t,n){const r=As(e),a=As(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}}t5.peek=z6;function t5(e,t,n,r){const a=B6(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=gu(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=el(u)+c.slice(1));const f=c.charCodeAt(c.length-1),p=gu(r.after.charCodeAt(0),f,a);p.inside&&(c=c.slice(0,-1)+el(f));const g=s.move(a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+g}function z6(e,t,n){return n.options.emphasis||"*"}function U6(e,t){let n=!1;return Gu(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,qy}),!!((!e.depth||e.depth<3)&&gb(e)&&(t.options.setext||n))}function q6(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(U6(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
70
+ `,after:`
71
+ `});return f(),d(),p+`
72
+ `+(a===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.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=el(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),c(),l(),u}n5.peek=$6;function n5(e){return e.value||""}function $6(){return"<"}r5.peek=H6;function r5(e,t,n,r){const a=_b(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 H6(){return"!"}a5.peek=W6;function a5(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 W6(){return"!"}i5.peek=V6;function i5(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 V6(){return"`"}function s5(e,t){const n=gb(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))}o5.peek=G6;function o5(e,t,n,r){const a=_b(n),i=a==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let l,c;if(s5(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 G6(e,t,n){return s5(e,n)?"<":"["}l5.peek=K6;function l5(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 K6(){return"["}function wb(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 Y6(e){const t=wb(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 Q6(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 c5(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 X6(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?Q6(n):wb(n);const l=e.ordered?s==="."?")":".":Y6(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),c5(n)===s&&d){let f=-1;for(;++f<e.children.length;){const p=e.children[f];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.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 Z6(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 J6(e,t,n,r){const a=Z6(n);let i=n.bulletCurrent||wb(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,p,g){return p?(g?"":" ".repeat(s))+f:(g?i:i+" ".repeat(s-i.length))+f}}function e7(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),a(),s}const t7=gl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function n7(e,t,n,r){return(e.children.some(function(s){return t7(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function r7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}u5.peek=a7;function u5(e,t,n,r){const a=r7(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=gu(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(c=el(u)+c.slice(1));const f=c.charCodeAt(c.length-1),p=gu(r.after.charCodeAt(0),f,a);p.inside&&(c=c.slice(0,-1)+el(f));const g=s.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+g}function a7(e,t,n){return n.options.strong||"*"}function i7(e,t,n,r){return n.safe(e.value,r)}function s7(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 o7(e,t,n){const r=(c5(n)+(n.options.ruleSpaces?" ":"")).repeat(s7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const d5={blockquote:A6,break:kk,code:D6,definition:F6,emphasis:t5,hardBreak:kk,heading:q6,html:n5,image:r5,imageReference:a5,inlineCode:i5,link:o5,linkReference:l5,list:X6,listItem:J6,paragraph:e7,root:n7,strong:u5,text:i7,thematicBreak:o7};function l7(){return{enter:{table:c7,tableData:_k,tableHeader:_k,tableRow:d7},exit:{codeText:f7,table:u7,tableData:Sf,tableHeader:Sf,tableRow:Sf}}}function c7(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 u7(e){this.exit(e),this.data.inTable=void 0}function d7(e){this.enter({type:"tableRow",children:[]},e)}function Sf(e){this.exit(e)}function _k(e){this.enter({type:"tableCell",children:[]},e)}function f7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,p7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function p7(e,t){return t==="|"?t:e}function g7(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:p,table:s,tableCell:c,tableRow:l}};function s(g,m,y,v){return u(d(g,y,v),g.align)}function l(g,m,y,v){const x=f(g,y,v),b=u([x]);return b.slice(0,b.indexOf(`
76
+ `))}function c(g,m,y,v){const x=y.enter("tableCell"),b=y.enter("phrasing"),k=y.containerPhrasing(g,{...v,before:i,after:i});return b(),x(),k}function u(g,m){return j6(g,{align:m,alignDelimiters:r,padding:n,stringLength:a})}function d(g,m,y){const v=g.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(g,m,y){const v=g.children;let x=-1;const b=[],k=m.enter("tableRow");for(;++x<v.length;)b[x]=c(v[x],g,m,y);return k(),b}function p(g,m,y){let v=d5.inlineCode(g,m,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function h7(){return{exit:{taskListCheckValueChecked:wk,taskListCheckValueUnchecked:wk,paragraph:y7}}}function m7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:x7}}}function wk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function y7(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 x7(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=d5.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 b7(){return[XP(),x6(),_6(),l7(),h7()]}function v7(e){return{extensions:[ZP(),b6(e),w6(),g7(e),m7()]}}const k7={tokenize:C7,partial:!0},f5={tokenize:j7,partial:!0},p5={tokenize:T7,partial:!0},g5={tokenize:A7,partial:!0},_7={tokenize:R7,partial:!0},h5={name:"wwwAutolink",tokenize:N7,previous:y5},m5={name:"protocolAutolink",tokenize:S7,previous:x5},ma={name:"emailAutolink",tokenize:E7,previous:b5},Vr={};function w7(){return{text:Vr}}let si=48;for(;si<123;)Vr[si]=ma,si++,si===58?si=65:si===91&&(si=97);Vr[43]=ma;Vr[45]=ma;Vr[46]=ma;Vr[95]=ma;Vr[72]=[ma,m5];Vr[104]=[ma,m5];Vr[87]=[ma,h5];Vr[119]=[ma,h5];function E7(e,t,n){const r=this;let a,i;return s;function s(f){return!Vy(f)||!b5.call(r,r.previous)||Eb(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return Vy(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(_7,d,u)(f):f===45||f===95||Sn(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&&In(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function N7(e,t,n){const r=this;return a;function a(s){return s!==87&&s!==119||!y5.call(r,r.previous)||Eb(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(k7,e.attempt(f5,e.attempt(p5,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function S7(e,t,n){const r=this;let a="",i=!1;return s;function s(f){return(f===72||f===104)&&x5.call(r,r.previous)&&!Eb(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(In(f)&&a.length<5)return a+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const p=a.toLowerCase();if(p==="http"||p==="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||du(f)||Dt(f)||ji(f)||$u(f)?n(f):e.attempt(f5,e.attempt(p5,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function C7(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 j7(e,t,n){let r,a,i;return s;function s(u){return u===46||u===95?e.check(g5,c,l)(u):u===null||Dt(u)||ji(u)||u!==45&&$u(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 T7(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(g5,t,i)(s):s===null||Dt(s)||ji(s)?t(s):(e.consume(s),a)}function i(s){return s===41&&r++,e.consume(s),a}}function A7(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||Dt(l)||ji(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||Dt(l)||ji(l)?t(l):r(l)}function i(l){return In(l)?s(l):n(l)}function s(l){return l===59?(e.consume(l),r):In(l)?(e.consume(l),s):n(l)}}function R7(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return Sn(i)?n(i):t(i)}}function y5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function x5(e){return!In(e)}function b5(e){return!(e===47||Vy(e))}function Vy(e){return e===43||e===45||e===46||e===95||Sn(e)}function Eb(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 M7={tokenize:z7,partial:!0};function I7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:P7,continuation:{tokenize:F7},exit:B7}},text:{91:{name:"gfmFootnoteCall",tokenize:D7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:L7,resolveTo:O7}}}}function L7(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 O7(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 D7(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||Dt(f))return n(f);if(f===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return a.includes(Rr(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Dt(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 P7(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||Dt(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"),p}return Dt(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 p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),a.includes(i)||a.push(i),_t(e,g,"gfmFootnoteDefinitionWhitespace")):n(m)}function g(m){return t(m)}}function F7(e,t,n){return e.check(pl,t,e.attempt(M7,t,n))}function B7(e){e.exit("gfmFootnoteDefinition")}function z7(e,t,n){const r=this;return _t(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 U7(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)},p=[["enter",d,l],["enter",s[u][1],l],["exit",s[u][1],l],["enter",f,l]],g=l.parser.constructs.insideSpan.null;g&&rr(p,p.length,0,Hu(g,s.slice(u+1,c),l)),rr(p,p.length,0,[["exit",f,l],["enter",s[c][1],l],["exit",s[c][1],l],["exit",d,l]]),rr(s,u-1,c-u+3,p),c=u+p.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 p;function p(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(s.enter("strikethroughSequenceTemporary"),g(m))}function g(m){const y=As(u);if(m===126)return f>1?c(m):(s.consume(m),f++,g);if(f<2&&!n)return c(m);const v=s.exit("strikethroughSequenceTemporary"),x=As(m);return v._open=!x||x===2&&!!y,v._close=!y||y===2&&!!x,l(m)}}}class q7{constructor(){this.map=[]}add(t,n,r){$7(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 $7(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 H7(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 W7(){return{flow:{null:{name:"table",tokenize:V7,resolveAll:G7}}}}function V7(e,t,n){const r=this;let a=0,i=0,s;return l;function l(R){let $=r.events.length-1;for(;$>-1;){const P=r.events[$][1].type;if(P==="lineEnding"||P==="linePrefix")$--;else break}const F=$>-1?r.events[$][1].type:null,G=F==="tableHead"||F==="tableRow"?_:c;return G===_&&r.parser.lazy[r.now().line]?n(R):G(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(s=!0,i+=1),d(R)}function d(R){return R===null?n(R):tt(R)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),g):n(R):xt(R)?_t(e,d,"whitespace")(R):(i+=1,s&&(s=!1,a+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),f(R)))}function f(R){return R===null||R===124||Dt(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?p:f)}function p(R){return R===92||R===124?(e.consume(R),f):f(R)}function g(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),s=!1,xt(R)?_t(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):m(R))}function m(R){return R===45||R===58?v(R):R===124?(s=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),y):w(R)}function y(R){return xt(R)?_t(e,v,"whitespace")(R):v(R)}function v(R){return R===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),x):R===45?(i+=1,x(R)):R===null||tt(R)?N(R):w(R)}function x(R){return R===45?(e.enter("tableDelimiterFiller"),b(R)):w(R)}function b(R){return R===45?(e.consume(R),b):R===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(R))}function k(R){return xt(R)?_t(e,N,"whitespace")(R):N(R)}function N(R){return R===124?m(R):R===null||tt(R)?!s||a!==i?w(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):w(R)}function w(R){return n(R)}function _(R){return e.enter("tableRow"),T(R)}function T(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),T):R===null||tt(R)?(e.exit("tableRow"),t(R)):xt(R)?_t(e,T,"whitespace")(R):(e.enter("data"),A(R))}function A(R){return R===null||R===124||Dt(R)?(e.exit("data"),T(R)):(e.consume(R),R===92?D:A)}function D(R){return R===92||R===124?(e.consume(R),A):A(R)}}function G7(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 p=new q7;for(;++n<e.length;){const g=e[n],m=g[1];g[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(Ek(p,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.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)},p.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=sc(p,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=sc(p,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=sc(p,t,i,a,n,f)):s[1]!==0&&(f=sc(p,t,s,a,n,f)),a=0):a&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&Ek(p,t,c,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const g=t.events[n];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=H7(t.events,n))}return e}function sc(e,t,n,r,a,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},es(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=es(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=es(t.events,n[2]),d=es(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 p=t.events[n[2]],g=t.events[n[3]];if(p[1].end=Object.assign({},g[1].end),p[1].type="chunkText",p[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({},es(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function Ek(e,t,n,r,a){const i=[],s=es(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 es(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const K7={name:"tasklistCheck",tokenize:Q7};function Y7(){return{text:{91:K7}}}function Q7(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 Dt(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 tt(c)?t(c):xt(c)?e.check({tokenize:X7},t,n)(c):n(c)}}function X7(e,t,n){return _t(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function Z7(e){return jj([w7(),I7(),U7(e),W7(),Y7()])}const J7={};function tl(e){const t=this,n=e||J7,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Z7(n)),i.push(b7()),s.push(v7(n))}const Nk=function(e,t,n){const r=gl(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]},Mi=function(e){if(e==null)return n8;if(typeof e=="string")return t8(e);if(typeof e=="object")return e8(e);if(typeof e=="function")return Nb(e);throw new Error("Expected function, string, or array as `test`")};function e8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Mi(e[n]);return Nb(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function t8(e){return Nb(t);function t(n){return n.tagName===e}}function Nb(e){return t;function t(n,r,a){return!!(r8(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function n8(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function r8(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Sk=/\n/g,Ck=/[\t ]+/g,Gy=Mi("br"),jk=Mi(d8),a8=Mi("p"),Tk=Mi("tr"),i8=Mi(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",u8,f8]),v5=Mi(["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 s8(e,t){const n=t||{},r="children"in e?e.children:[],a=v5(e),i=w5(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(..._5(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)s.push(...k5(r[l],e,{whitespace:i,breakBefore:l?void 0:a,breakAfter:l<r.length-1?Gy(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 k5(e,t,n){return e.type==="element"?o8(e,t,n):e.type==="text"?n.whitespace==="normal"?_5(e,n):l8(e):[]}function o8(e,t,n){const r=w5(e,n),a=e.children||[];let i=-1,s=[];if(i8(e))return s;let l,c;for(Gy(e)||Tk(e)&&Nk(t,e,Tk)?c=`
78
+ `:a8(e)?(l=2,c=2):v5(e)&&(l=1,c=1);++i<a.length;)s=s.concat(k5(a[i],e,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<a.length-1?Gy(a[i+1]):c}));return jk(e)&&Nk(t,e,jk)&&s.push(" "),l&&s.unshift(l),c&&s.push(c),s}function _5(e,t){const n=String(e.value),r=[],a=[];let i=0;for(;i<=n.length;){Sk.lastIndex=i;const c=Sk.exec(n),u=c&&"index"in c?c.index:n.length;r.push(c8(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 l8(e){return[String(e.value)]}function c8(e,t,n){const r=[];let a=0,i;for(;a<e.length;){Ck.lastIndex=a;const s=Ck.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 w5(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 u8(e){return!!(e.properties||{}).hidden}function d8(e){return e.tagName==="td"||e.tagName==="th"}function f8(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function p8(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]},p={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},g=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},w={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[w,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:N,contains:_.concat([{begin:/\(/,end:/\)/,keywords:N,contains:_.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+s+"[\\*&\\s]+)+"+g,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:N,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:N,relevance:0},{begin:g,returnBegin:!0,contains:[p],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,A,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 g8(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=p8(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 h8(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]},p=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],g=e.SHEBANG({binary:`(${p.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"],w=["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,...w]},contains:[g,e.SHEBANG(),m,f,i,s,x,l,c,u,d,n]}}function m8(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]},p={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},g=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]+)+"+g,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:v,relevance:0},{begin:g,returnBegin:!0,contains:[e.inherit(p,{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 y8(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]},p={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},g=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},w={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[w,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:N,contains:_.concat([{begin:/\(/,end:/\)/,keywords:N,contains:_.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+s+"[\\*&\\s]+)+"+g,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:N,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:N,relevance:0},{begin:g,returnBegin:!0,contains:[p],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,A,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 x8(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/}),p={className:"subst",begin:/\{/,end:/\}/,keywords:s},g=e.inherit(p,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,g]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]},v=e.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},g]});p.contains=[y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],g.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 b8=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_-]*/}}),v8=["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"],k8=["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"],_8=[...v8,...k8],w8=["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(),E8=["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(),N8=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),S8=["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 C8(e){const t=e.regex,n=b8(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:":("+E8.join("|")+")"},{begin:":(:)?("+N8.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+S8.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:w8.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+_8.join("|")+")\\b"}]}}function j8(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 T8(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 A8(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 R8(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),p=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:p,className:"attr",starts:{end:/$/,contains:[r,l,i,a,s,n]}}]}}var ts="[0-9](_*[0-9])*",oc=`\\.(${ts})`,lc="[0-9a-fA-F](_*[0-9a-fA-F])*",Ak={className:"number",variants:[{begin:`(\\b(${ts})((${oc})|\\.)?|(${oc}))[eE][+-]?(${ts})[fFdD]?\\b`},{begin:`\\b(${ts})((${oc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${oc})[fFdD]?\\b`},{begin:`\\b(${ts})[fFdD]\\b`},{begin:`\\b0[xX]((${lc})\\.?|(${lc})?\\.(${lc}))[pP][+-]?(${ts})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${lc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function E5(e,t,n){return n===-1?"":e.replace(t,r=>E5(e,t,n-1))}function M8(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+E5("(?:<"+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,Ak,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Ak,u]}}const Rk="[A-Za-z$_][0-9A-Za-z$_]*",I8=["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"],L8=["true","false","null","undefined","NaN","Infinity"],N5=["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"],S5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],C5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],O8=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],D8=[].concat(C5,N5,S5);function P8(e){const t=e.regex,n=(B,{after:Q})=>{const C="</"+B[0].slice(1);return B.input.indexOf(C,Q)!==-1},r=Rk,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,Q)=>{const C=B[0].length+B.index,K=B.input[C];if(K==="<"||K===","){Q.ignoreMatch();return}K===">"&&(n(B,{after:C})||Q.ignoreMatch());let W;const j=B.input.substring(C);if(W=j.match(/^\s*=/)){Q.ignoreMatch();return}if((W=j.match(/^\s+extends\s+/))&&W.index===0){Q.ignoreMatch();return}}},l={$pattern:Rk,keyword:I8,literal:L8,built_in:D8,"variable.language":O8},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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},g={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,p]},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,g,m,y,v,{match:/\$\d+/},f];p.contains=k.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(k)});const N=[].concat(b,p.contains),w=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(N)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:w},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"}}]},A={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:{_:[...N5,...S5]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},$={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(B){return t.concat("(?!",B.join("|"),")")}const G={match:t.concat(/\b/,F([...C5,"super","import"].map(B=>`${B}\\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:/\(\)/},_]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,m,y,v,b,{match:/\$\d+/},f,A,{scope:"attr",match:r+t.lookahead(":"),relevance:0},I,{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:S,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:w}]}]},{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"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,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:[_]},G,$,T,M,{match:/\$[(.]/}]}}function F8(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 ns="[0-9](_*[0-9])*",cc=`\\.(${ns})`,uc="[0-9a-fA-F](_*[0-9a-fA-F])*",B8={className:"number",variants:[{begin:`(\\b(${ns})((${cc})|\\.)?|(${cc}))[eE][+-]?(${ns})[fFdD]?\\b`},{begin:`\\b(${ns})((${cc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${cc})[fFdD]?\\b`},{begin:`\\b(${ns})[fFdD]\\b`},{begin:`\\b0[xX]((${uc})\\.?|(${uc})?\\.(${uc}))[pP][+-]?(${ns})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${uc})[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=B8,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},p=f;return p.variants[1].contains=[f],f.variants[1].contains=[p],{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 U8=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_-]*/}}),q8=["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"],$8=["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"],H8=[...q8,...$8],W8=["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(),j5=["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(),T5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),V8=["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(),G8=j5.concat(T5).sort().reverse();function K8(e){const t=U8(e),n=G8,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,w){return{className:k,begin:N,relevance:w}},d={$pattern:/[a-z-]+/,keyword:r,attribute:W8.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 p=l.concat({begin:/\{/,end:/\}/,contains:s}),g={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("+V8.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:p}},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,g,u("keyword","all\\b"),u("variable","@\\{"+a+"\\}"),{begin:"\\b("+H8.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:":("+j5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+T5.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:p},{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,g,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function Y8(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 Q8(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 X8(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:[]}),p=e.inherit(d,{contains:[]});u.contains.push(p),d.contains.push(f);let g=[n,c];return[u,d,f,p].forEach(x=>{x.contains=x.contains.concat(g)}),g=g.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:g},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:g}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:g,end:"$"},a,r,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Z8(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 J8(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=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],p=(y,v,x="\\1")=>{const b=x==="\\1"?x:t.concat(x,v);return t.concat(t.concat("(?:",y,")"),v,/(?:\\.|[^\\\/])*?/,b,/(?:\\.|[^\\\/])*?/,x,r)},g=(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:p("s|tr|y",t.either(...f,{capture:!0}))},{begin:p("s|tr|y","\\(","\\)")},{begin:p("s|tr|y","\\[","\\]")},{begin:p("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:g("(?:m|qr)?",/\//,/\//)},{begin:g("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:g("m|qr",/\(/,/\)/)},{begin:g("m|qr",/\[/,/\]/)},{begin:g("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 e9(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()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),g=`[
80
+ ]`,m={scope:"string",variants:[d,u,f,p]},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(S=>{M.push(S),S.toLowerCase()===S?M.push(S.toUpperCase()):M.push(S.toLowerCase())}),M})(v),built_in:b},w=P=>P.map(M=>M.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,t.concat(g,"+"),t.concat("(?!",w(b).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(r,"\\b(?!\\()"),A={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(/(?!::)/))},R={relevance:0,begin:/\(/,end:/\)/,keywords:N,contains:[D,s,A,e.C_BLOCK_COMMENT_MODE,m,y,_]},$={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",w(x).join("\\b|"),"|",w(b).join("\\b|"),"\\b)"),r,t.concat(g,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[R]};R.contains.push($);const F=[D,A,e.C_BLOCK_COMMENT_MODE,m,y,_],G={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",...F]},...F,{scope:"meta",variants:[{match:a},{match:i}]}]};return{case_insensitive:!1,keywords:N,contains:[G,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,$,A,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},_,{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",G,s,A,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 t9(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 n9(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function r9(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]},p="[0-9](_?[0-9])*",g=`(\\b(${p}))?\\.(${p})|\\b(${p})\\.`,m=`\\b|${r.join("|")}`,y={className:"number",relevance:0,variants:[{begin:`(\\b(${p})|(${g}))[eE][+-]?(${p})[jJ]?(?=${m})`},{begin:`(${g})[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(${p})[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 a9(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function i9(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 s9(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]})]}]},p="[1-9](_?[0-9])*|0",g="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${p})(\\.(${g}))?([eE][+-]?(${g})|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}]},_=[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=_,y.contains=_;const R=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:_}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(R).concat(u).concat(_)}}function o9(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 l9=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_-]*/}}),c9=["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"],u9=["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"],d9=[...c9,...u9],f9=["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(),p9=["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(),g9=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h9=["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 m9(e){const t=l9(e),n=g9,r=p9,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("+d9.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("+h9.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:f9.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 y9(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function x9(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"],p=["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"],g=d,m=[...u,...c].filter(w=>!d.includes(w)),y={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},x={match:t.concat(/\b/,t.either(...g),/\s*\(/),relevance:0,keywords:{built_in:g}};function b(w){return t.concat(/\b/,t.either(...w.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:b(p),relevance:0};function N(w,{exceptions:_,when:T}={}){const A=T;return _=_||[],w.map(D=>D.match(/\|\d+$/)||_.includes(D)?D:A(D)?`${D}|0`:D)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:N(m,{when:w=>w.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 A5(e){return e?typeof e=="string"?e:e.source:null}function io(e){return It("(?=",e,")")}function It(...e){return e.map(n=>A5(n)).join("")}function b9(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Rn(...e){return"("+(b9(e).capture?"":"?:")+e.map(r=>A5(r)).join("|")+")"}const Sb=e=>It(/\b/,e,/\w$/.test(e)?/\b/:/\B/),v9=["Protocol","Type"].map(Sb),Mk=["init","self"].map(Sb),k9=["Any","Self"],Cf=["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"],Ik=["false","nil","true"],_9=["assignment","associativity","higherThan","left","lowerThan","none","right"],w9=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Lk=["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"],R5=Rn(/[/=\-+!*%<>&|^~?]/,/[\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]/),M5=Rn(R5,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),jf=It(R5,M5,"*"),I5=Rn(/[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]/),hu=Rn(I5,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Br=It(I5,hu,"*"),dc=It(/[A-Z]/,hu,"*"),E9=["attached","autoclosure",It(/convention\(/,Rn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",It(/objc\(/,Br,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],N9=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function S9(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,Rn(...v9,...Mk)],className:{2:"keyword"}},i={match:It(/\./,Rn(...Cf)),relevance:0},s=Cf.filter(Te=>typeof Te=="string").concat(["_|0"]),l=Cf.filter(Te=>typeof Te!="string").concat(k9).map(Sb),c={variants:[{className:"keyword",match:Rn(...l,...Mk)}]},u={$pattern:Rn(/\b\w+/,/#\w+/),keyword:s.concat(w9),literal:Ik},d=[a,i,c],f={match:It(/\./,Rn(...Lk)),relevance:0},p={className:"built_in",match:It(/\b/,Rn(...Lk),/(?=\()/)},g=[f,p],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:jf},{match:`\\.(\\.|${M5})+`}]},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=(Te="")=>({className:"subst",variants:[{match:It(/\\/,Te,/[0\\tnr"']/)},{match:It(/\\/,Te,/u\{[0-9a-fA-F]{1,8}\}/)}]}),w=(Te="")=>({className:"subst",match:It(/\\/,Te,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(Te="")=>({className:"subst",label:"interpol",begin:It(/\\/,Te,/\(/),end:/\)/}),T=(Te="")=>({begin:It(Te,/"""/),end:It(/"""/,Te),contains:[N(Te),w(Te),_(Te)]}),A=(Te="")=>({begin:It(Te,/"/),end:It(/"/,Te),contains:[N(Te),_(Te)]}),D={className:"string",variants:[T(),T("#"),T("##"),T("###"),A(),A("#"),A("##"),A("###")]},R=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],$={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:R},F=Te=>{const Fe=It(Te,/\//),fe=It(/\//,Te);return{begin:Fe,end:fe,contains:[...R,{scope:"comment",begin:`#(?!.*${fe})`,end:/$/}]}},G={scope:"regexp",variants:[F("###"),F("##"),F("#"),$]},P={match:It(/`/,Br,/`/)},M={className:"variable",match:/\$\d+/},S={className:"variable",match:`\\$${hu}+`},I=[P,M,S],B={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:N9,contains:[...v,k,D]}]}},Q={scope:"keyword",match:It(/@/,Rn(...E9),io(Rn(/\(/,/\s+/)))},C={scope:"meta",match:It(/@/,Br)},K=[B,Q,C],W={match:io(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:It(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,hu,"+")},{className:"type",match:dc,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:It(/\s+&\s+/,io(dc)),relevance:0}]},j={begin:/</,end:/>/,keywords:u,contains:[...r,...d,...K,m,W]};W.contains.push(j);const U={match:It(Br,/\s*:/),keywords:"_|0",relevance:0},le={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",U,...r,G,...d,...g,...v,k,D,...I,...K,W]},Z={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,W]},ke={begin:Rn(io(It(Br,/\s*:/)),io(It(Br,/\s+/,Br,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Br}]},re={begin:/\(/,end:/\)/,keywords:u,contains:[ke,...r,...d,...v,k,D,...K,W,le],endsParent:!0,illegal:/["']/},X={match:[/(func|macro)/,/\s+/,Rn(P.match,Br,jf)],className:{1:"keyword",3:"title.function"},contains:[Z,re,t],illegal:[/\[/,/%/]},Ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Z,re,t],illegal:/\[|%/},ve={match:[/operator/,/\s+/,jf],className:{1:"keyword",3:"title"}},me={begin:[/precedencegroup/,/\s+/,dc],className:{1:"keyword",3:"title"},contains:[W],keywords:[..._9,...Ik],end:/}/},pe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Le={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Se={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Br,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[Z,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:dc},...d],relevance:0}]};for(const Te of D.variants){const Fe=Te.contains.find(xe=>xe.label==="interpol");Fe.keywords=u;const fe=[...d,...g,...v,k,D,...I];Fe.contains=[...fe,{begin:/\(/,end:/\)/,contains:["self",...fe]}]}return{name:"Swift",keywords:u,contains:[...r,X,Ne,pe,Le,Se,ve,me,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},G,...d,...g,...v,k,D,...I,...K,W,le]}}const mu="[A-Za-z$_][0-9A-Za-z$_]*",L5=["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"],O5=["true","false","null","undefined","NaN","Infinity"],D5=["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"],P5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],F5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],B5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],z5=[].concat(F5,D5,P5);function C9(e){const t=e.regex,n=(B,{after:Q})=>{const C="</"+B[0].slice(1);return B.input.indexOf(C,Q)!==-1},r=mu,a={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,Q)=>{const C=B[0].length+B.index,K=B.input[C];if(K==="<"||K===","){Q.ignoreMatch();return}K===">"&&(n(B,{after:C})||Q.ignoreMatch());let W;const j=B.input.substring(C);if(W=j.match(/^\s*=/)){Q.ignoreMatch();return}if((W=j.match(/^\s+extends\s+/))&&W.index===0){Q.ignoreMatch();return}}},l={$pattern:mu,keyword:L5,literal:O5,built_in:z5,"variable.language":B5},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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},g={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,p]},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,g,m,y,v,{match:/\$\d+/},f];p.contains=k.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(k)});const N=[].concat(b,p.contains),w=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(N)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:w},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"}}]},A={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:{_:[...D5,...P5]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},$={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(B){return t.concat("(?!",B.join("|"),")")}const G={match:t.concat(/\b/,F([...F5,"super","import"].map(B=>`${B}\\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:/\(\)/},_]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:w,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,g,m,y,v,b,{match:/\$\d+/},f,A,{scope:"attr",match:r+t.lookahead(":"),relevance:0},I,{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:S,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:w}]}]},{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"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,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:[_]},G,$,T,M,{match:/\$[(.]/}]}}function j9(e){const t=e.regex,n=C9(e),r=mu,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:mu,keyword:L5.concat(c),literal:O5,built_in:z5.concat(a),"variable.language":B5},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 p=n.contains.find(y=>y.scope==="attr"),g=Object.assign({},p,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,p,g]),n.contains=n.contains.concat([d,i,s,g]),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 T9(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:/>/}]}),p=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,p,{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:[p]}]}}function A9(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 R9(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 M9(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,{}[\]]+/}]}),p={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"},g={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[g],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[g],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}},p,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,y,i,s],x=[...v];return x.pop(),x.push(l),g.contains=x,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const I9={arduino:g8,bash:h8,c:m8,cpp:y8,csharp:x8,css:C8,diff:j8,go:T8,graphql:A8,ini:R8,java:M8,javascript:P8,json:F8,kotlin:z8,less:K8,lua:Y8,makefile:Q8,markdown:X8,objectivec:Z8,perl:J8,php:e9,"php-template":t9,plaintext:n9,python:r9,"python-repl":a9,r:i9,ruby:s9,rust:o9,scss:m9,shell:y9,sql:x9,swift:S9,typescript:j9,vbnet:T9,wasm:A9,xml:R9,yaml:M9};function U5(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)&&U5(n)}),e}class Ok{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function q5(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function za(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 L9="</span>",Dk=e=>!!e.scope,O9=(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 D9{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=q5(t)}openNode(t){if(!Dk(t))return;const n=O9(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Dk(t)&&(this.buffer+=L9)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Pk=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Cb{constructor(){this.rootNode=Pk(),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=Pk({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=>{Cb._collapse(n)}))}}class P9 extends Cb{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 D9(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function nl(e){return e?typeof e=="string"?e:e.source:null}function $5(e){return Ii("(?=",e,")")}function F9(e){return Ii("(?:",e,")*")}function B9(e){return Ii("(?:",e,")?")}function Ii(...e){return e.map(n=>nl(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 jb(...e){return"("+(z9(e).capture?"":"?:")+e.map(r=>nl(r)).join("|")+")"}function H5(e){return new RegExp(e.toString()+"|").exec("").length-1}function U9(e,t){const n=e&&e.exec(t);return n&&n.index===0}const q9=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Tb(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const a=n;let i=nl(r),s="";for(;i.length>0;){const l=q9.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 $9=/\b\B/,W5="[a-zA-Z]\\w*",Ab="[a-zA-Z_]\\w*",V5="\\b\\d+(\\.\\d+)?",G5="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",K5="\\b(0b[01]+)",H9="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",W9=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Ii(t,/.*\b/,e.binary,/\b.*/)),za({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},rl={begin:"\\\\[\\s\\S]",relevance:0},V9={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[rl]},G9={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[rl]},K9={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/},Ku=function(e,t,n={}){const r=za({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=jb("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:Ii(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Y9=Ku("//","$"),Q9=Ku("/\\*","\\*/"),X9=Ku("#","$"),Z9={scope:"number",begin:V5,relevance:0},J9={scope:"number",begin:G5,relevance:0},eF={scope:"number",begin:K5,relevance:0},tF={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[rl,{begin:/\[/,end:/\]/,relevance:0,contains:[rl]}]},nF={scope:"title",begin:W5,relevance:0},rF={scope:"title",begin:Ab,relevance:0},aF={begin:"\\.\\s*"+Ab,relevance:0},iF=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 fc=Object.freeze({__proto__:null,APOS_STRING_MODE:V9,BACKSLASH_ESCAPE:rl,BINARY_NUMBER_MODE:eF,BINARY_NUMBER_RE:K5,COMMENT:Ku,C_BLOCK_COMMENT_MODE:Q9,C_LINE_COMMENT_MODE:Y9,C_NUMBER_MODE:J9,C_NUMBER_RE:G5,END_SAME_AS_BEGIN:iF,HASH_COMMENT_MODE:X9,IDENT_RE:W5,MATCH_NOTHING_RE:$9,METHOD_GUARD:aF,NUMBER_MODE:Z9,NUMBER_RE:V5,PHRASAL_WORDS_MODE:K9,QUOTE_STRING_MODE:G9,REGEXP_MODE:tF,RE_STARTERS_RE:H9,SHEBANG:W9,TITLE_MODE:nF,UNDERSCORE_IDENT_RE:Ab,UNDERSCORE_TITLE_MODE:rF});function sF(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function oF(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function lF(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=sF,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function cF(e,t){Array.isArray(e.illegal)&&(e.illegal=jb(...e.illegal))}function uF(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 dF(e,t){e.relevance===void 0&&(e.relevance=1)}const fF=(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=Ii(n.beforeMatch,$5(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},pF=["of","and","for","in","not","or","if","then","parent","list","value"],gF="keyword";function Y5(e,t,n=gF){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,Y5(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,hF(c[0],c[1])]})}}function hF(e,t){return t?Number(t):mF(e)?0:1}function mF(e){return pF.includes(e.toLowerCase())}const Fk={},ki=e=>{console.error(e)},Bk=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Yi=(e,t)=>{Fk[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Fk[`${e}/${t}`]=!0)},yu=new Error;function Q5(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+=H5(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function yF(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ki("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),yu;if(typeof e.beginScope!="object"||e.beginScope===null)throw ki("beginScope must be object"),yu;Q5(e,e.begin,{key:"beginScope"}),e.begin=Tb(e.begin,{joinWith:""})}}function xF(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ki("skip, excludeEnd, returnEnd not compatible with endScope: {}"),yu;if(typeof e.endScope!="object"||e.endScope===null)throw ki("endScope must be object"),yu;Q5(e,e.end,{key:"endScope"}),e.end=Tb(e.end,{joinWith:""})}}function bF(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function vF(e){bF(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),yF(e),xF(e)}function kF(e){function t(s,l){return new RegExp(nl(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+=H5(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(Tb(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,p)=>p>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;[oF,uF,vF,fF].forEach(d=>d(s,l)),e.compilerExtensions.forEach(d=>d(s,l)),s.__beforeBegin=null,[lF,cF,dF].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=Y5(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=nl(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 _F(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=za(e.classNameAliases||{}),i(e)}function X5(e){return e?e.endsWithParent||X5(e.starts):!1}function _F(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return za(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:X5(e)?za(e,{starts:e.starts?za(e.starts):null}):Object.isFrozen(e)?za(e):e}var wF="11.11.1";class EF extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Tf=q5,zk=za,Uk=Symbol("nomatch"),NF=7,Z5=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:P9};function c(S){return l.noHighlightRe.test(S)}function u(S){let I=S.className+" ";I+=S.parentNode?S.parentNode.className:"";const B=l.languageDetectRe.exec(I);if(B){const Q=A(B[1]);return Q||(Bk(i.replace("{}",B[1])),Bk("Falling back to no-highlight mode for this block.",S)),Q?B[1]:"no-highlight"}return I.split(/\s+/).find(Q=>c(Q)||A(Q))}function d(S,I,B){let Q="",C="";typeof I=="object"?(Q=S,B=I.ignoreIllegals,C=I.language):(Yi("10.7.0","highlight(lang, code, ...args) has been deprecated."),Yi("10.7.0",`Please use highlight(code, options) instead.
81
+ https://github.com/highlightjs/highlight.js/issues/2277`),C=S,Q=I),B===void 0&&(B=!0);const K={code:Q,language:C};P("before:highlight",K);const W=K.result?K.result:f(K.language,K.code,B);return W.code=K.code,P("after:highlight",W),W}function f(S,I,B,Q){const C=Object.create(null);function K(H,z){return H.keywords[z]}function W(){if(!fe.keywords){Ce.addText(ue);return}let H=0;fe.keywordPatternRe.lastIndex=0;let z=fe.keywordPatternRe.exec(ue),te="";for(;z;){te+=ue.substring(H,z.index);const ce=Se.case_insensitive?z[0].toLowerCase():z[0],je=K(fe,ce);if(je){const[Be,Ke]=je;if(Ce.addText(te),te="",C[ce]=(C[ce]||0)+1,C[ce]<=NF&&(he+=Ke),Be.startsWith("_"))te+=z[0];else{const Ye=Se.classNameAliases[Be]||Be;le(z[0],Ye)}}else te+=z[0];H=fe.keywordPatternRe.lastIndex,z=fe.keywordPatternRe.exec(ue)}te+=ue.substring(H),Ce.addText(te)}function j(){if(ue==="")return;let H=null;if(typeof fe.subLanguage=="string"){if(!t[fe.subLanguage]){Ce.addText(ue);return}H=f(fe.subLanguage,ue,!0,xe[fe.subLanguage]),xe[fe.subLanguage]=H._top}else H=g(ue,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(he+=H.relevance),Ce.__addSublanguage(H._emitter,H.language)}function U(){fe.subLanguage!=null?j():W(),ue=""}function le(H,z){H!==""&&(Ce.startScope(z),Ce.addText(H),Ce.endScope())}function Z(H,z){let te=1;const ce=z.length-1;for(;te<=ce;){if(!H._emit[te]){te++;continue}const je=Se.classNameAliases[H[te]]||H[te],Be=z[te];je?le(Be,je):(ue=Be,W(),ue=""),te++}}function ke(H,z){return H.scope&&typeof H.scope=="string"&&Ce.openNode(Se.classNameAliases[H.scope]||H.scope),H.beginScope&&(H.beginScope._wrap?(le(ue,Se.classNameAliases[H.beginScope._wrap]||H.beginScope._wrap),ue=""):H.beginScope._multi&&(Z(H.beginScope,z),ue="")),fe=Object.create(H,{parent:{value:fe}}),fe}function re(H,z,te){let ce=U9(H.endRe,te);if(ce){if(H["on:end"]){const je=new Ok(H);H["on:end"](z,je),je.isMatchIgnored&&(ce=!1)}if(ce){for(;H.endsParent&&H.parent;)H=H.parent;return H}}if(H.endsWithParent)return re(H.parent,z,te)}function X(H){return fe.matcher.regexIndex===0?(ue+=H[0],1):(Xe=!0,0)}function Ne(H){const z=H[0],te=H.rule,ce=new Ok(te),je=[te.__beforeBegin,te["on:begin"]];for(const Be of je)if(Be&&(Be(H,ce),ce.isMatchIgnored))return X(z);return te.skip?ue+=z:(te.excludeBegin&&(ue+=z),U(),!te.returnBegin&&!te.excludeBegin&&(ue=z)),ke(te,H),te.returnBegin?0:z.length}function ve(H){const z=H[0],te=I.substring(H.index),ce=re(fe,H,te);if(!ce)return Uk;const je=fe;fe.endScope&&fe.endScope._wrap?(U(),le(z,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(U(),Z(fe.endScope,H)):je.skip?ue+=z:(je.returnEnd||je.excludeEnd||(ue+=z),U(),je.excludeEnd&&(ue=z));do fe.scope&&Ce.closeNode(),!fe.skip&&!fe.subLanguage&&(he+=fe.relevance),fe=fe.parent;while(fe!==ce.parent);return ce.starts&&ke(ce.starts,H),je.returnEnd?0:z.length}function me(){const H=[];for(let z=fe;z!==Se;z=z.parent)z.scope&&H.unshift(z.scope);H.forEach(z=>Ce.openNode(z))}let pe={};function Le(H,z){const te=z&&z[0];if(ue+=H,te==null)return U(),0;if(pe.type==="begin"&&z.type==="end"&&pe.index===z.index&&te===""){if(ue+=I.slice(z.index,z.index+1),!a){const ce=new Error(`0 width match regex (${S})`);throw ce.languageName=S,ce.badRule=pe.rule,ce}return 1}if(pe=z,z.type==="begin")return Ne(z);if(z.type==="illegal"&&!B){const ce=new Error('Illegal lexeme "'+te+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw ce.mode=fe,ce}else if(z.type==="end"){const ce=ve(z);if(ce!==Uk)return ce}if(z.type==="illegal"&&te==="")return ue+=`
82
+ `,1;if(Pe>1e5&&Pe>z.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ue+=te,te.length}const Se=A(S);if(!Se)throw ki(i.replace("{}",S)),new Error('Unknown language: "'+S+'"');const Te=kF(Se);let Fe="",fe=Q||Te;const xe={},Ce=new l.__emitter(l);me();let ue="",he=0,_e=0,Pe=0,Xe=!1;try{if(Se.__emitTokens)Se.__emitTokens(I,Ce);else{for(fe.matcher.considerAll();;){Pe++,Xe?Xe=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=_e;const H=fe.matcher.exec(I);if(!H)break;const z=I.substring(_e,H.index),te=Le(z,H);_e=H.index+te}Le(I.substring(_e))}return Ce.finalize(),Fe=Ce.toHTML(),{language:S,value:Fe,relevance:he,illegal:!1,_emitter:Ce,_top:fe}}catch(H){if(H.message&&H.message.includes("Illegal"))return{language:S,value:Tf(I),illegal:!0,relevance:0,_illegalBy:{message:H.message,index:_e,context:I.slice(_e-100,_e+100),mode:H.mode,resultSoFar:Fe},_emitter:Ce};if(a)return{language:S,value:Tf(I),illegal:!1,relevance:0,errorRaised:H,_emitter:Ce,_top:fe};throw H}}function p(S){const I={value:Tf(S),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return I._emitter.addText(S),I}function g(S,I){I=I||l.languages||Object.keys(t);const B=p(S),Q=I.filter(A).filter(R).map(U=>f(U,S,!1));Q.unshift(B);const C=Q.sort((U,le)=>{if(U.relevance!==le.relevance)return le.relevance-U.relevance;if(U.language&&le.language){if(A(U.language).supersetOf===le.language)return 1;if(A(le.language).supersetOf===U.language)return-1}return 0}),[K,W]=C,j=K;return j.secondBest=W,j}function m(S,I,B){const Q=I&&n[I]||B;S.classList.add("hljs"),S.classList.add(`language-${Q}`)}function y(S){let I=null;const B=u(S);if(c(B))return;if(P("before:highlightElement",{el:S,language:B}),S.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",S);return}if(S.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(S)),l.throwUnescapedHTML))throw new EF("One of your code blocks includes unescaped HTML.",S.innerHTML);I=S;const Q=I.textContent,C=B?d(Q,{language:B,ignoreIllegals:!0}):g(Q);S.innerHTML=C.value,S.dataset.highlighted="yes",m(S,B,C.language),S.result={language:C.language,re:C.relevance,relevance:C.relevance},C.secondBest&&(S.secondBest={language:C.secondBest.language,relevance:C.secondBest.relevance}),P("after:highlightElement",{el:S,result:C,text:Q})}function v(S){l=zk(l,S)}const x=()=>{N(),Yi("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function b(){N(),Yi("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function N(){function S(){N()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",S,!1),k=!0;return}document.querySelectorAll(l.cssSelector).forEach(y)}function w(S,I){let B=null;try{B=I(e)}catch(Q){if(ki("Language definition for '{}' could not be registered.".replace("{}",S)),a)ki(Q);else throw Q;B=s}B.name||(B.name=S),t[S]=B,B.rawDefinition=I.bind(null,e),B.aliases&&D(B.aliases,{languageName:S})}function _(S){delete t[S];for(const I of Object.keys(n))n[I]===S&&delete n[I]}function T(){return Object.keys(t)}function A(S){return S=(S||"").toLowerCase(),t[S]||t[n[S]]}function D(S,{languageName:I}){typeof S=="string"&&(S=[S]),S.forEach(B=>{n[B.toLowerCase()]=I})}function R(S){const I=A(S);return I&&!I.disableAutodetect}function $(S){S["before:highlightBlock"]&&!S["before:highlightElement"]&&(S["before:highlightElement"]=I=>{S["before:highlightBlock"](Object.assign({block:I.el},I))}),S["after:highlightBlock"]&&!S["after:highlightElement"]&&(S["after:highlightElement"]=I=>{S["after:highlightBlock"](Object.assign({block:I.el},I))})}function F(S){$(S),r.push(S)}function G(S){const I=r.indexOf(S);I!==-1&&r.splice(I,1)}function P(S,I){const B=S;r.forEach(function(Q){Q[B]&&Q[B](I)})}function M(S){return Yi("10.7.0","highlightBlock will be removed entirely in v12.0"),Yi("10.7.0","Please use highlightElement now."),y(S)}Object.assign(e,{highlight:d,highlightAuto:g,highlightAll:N,highlightElement:y,highlightBlock:M,configure:v,initHighlighting:x,initHighlightingOnLoad:b,registerLanguage:w,unregisterLanguage:_,listLanguages:T,getLanguage:A,registerAliases:D,autoDetection:R,inherit:zk,addPlugin:F,removePlugin:G}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString=wF,e.regex={concat:Ii,lookahead:$5,either:jb,optional:B9,anyNumberOfTimes:F9};for(const S in fc)typeof fc[S]=="object"&&U5(fc[S]);return Object.assign(e,fc),e},Rs=Z5({});Rs.newInstance=()=>Z5({});var SF=Rs;Rs.HighlightJS=Rs;Rs.default=Rs;const CF=il(SF),qk={},jF="hljs-";function TF(e){const t=CF.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||qk,p=typeof f.prefix=="string"?f.prefix:jF;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:AF,classPrefix:p});const g=t.highlight(u,{ignoreIllegals:!0,language:c});if(g.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:g.errorRaised});const m=g._emitter.root,y=m.data;return y.language=g.language,y.relevance=g.relevance,m}function r(c,u){const f=(u||qk).subset||a();let p=-1,g=0,m;for(;++p<f.length;){const y=f[p];if(!t.getLanguage(y))continue;const v=n(y,c,u);v.data&&v.data.relevance!==void 0&&v.data.relevance>g&&(g=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:g}}}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 AF{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 RF={};function $k(e){const t=e||RF,n=t.aliases,r=t.detect||!1,a=t.languages||I9,i=t.plainText,s=t.prefix,l=t.subset;let c="hljs";const u=TF(a);if(n&&u.registerAlias(n),s){const d=s.indexOf("-");c=d===-1?s:s.slice(0,d)}return function(d,f){Gu(d,"element",function(p,g,m){if(p.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=MF(p);if(y===!1||!y&&!r||y&&i&&i.includes(y))return;Array.isArray(p.properties.className)||(p.properties.className=[]),p.properties.className.includes(c)||p.properties.className.unshift(c);const v=s8(p,{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,p],cause:k,place:p.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw k}!y&&x.data&&x.data.language&&p.properties.className.push("language-"+x.data.language),x.children.length>0&&(p.children=x.children)})}}function MF(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 Ky(){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 Bc({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 Yu(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 _i(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function IF(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 LF({part:e}){const{t}=vt(),{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=Yu(n||l,r.input),u=r.input&&r.input._purpose?r.input._purpose:null,d=s==="completed"?IF(r.output):null,f=!u||a,p={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"},g={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 ${p[s]||p.running}`,children:[o.jsxs("div",{className:`flex items-center gap-2 ${u?"cursor-pointer select-none":""}`,onClick:u?()=>i(!a):void 0,children:[g[s]||g.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:_i((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:_i(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function OF({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=Yu(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:_i(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:_i(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:_i(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function DF({text:e,isStreaming:t}){const{t:n}=vt(),[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(Jo,{remarkPlugins:[tl,Ky],children:e})})]})}const Gr="",Yy="pave-working-directory";function Io(){if(typeof window>"u")return null;try{return localStorage.getItem(Yy)||null}catch{return null}}function Af(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(Yy):localStorage.setItem(Yy,e)}catch{}}async function ze(e,t={}){const n=Io(),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 Qy(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 ze(r)}function Hk(e){return ze("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function Rf(e){return ze(`/session/${e}`)}function cr(e,t){return ze(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function PF(e){return ze(`/session/${e}/regenerate-title`,{method:"POST"})}function FF(e){return ze(`/session/${e}/fork`,{method:"POST"})}function Wk(e){return ze(`/session/${e}`,{method:"DELETE"})}function BF(e){return ze(`/session/${e}/archive/session`,{method:"POST"})}function zF(){return ze("/session",{method:"DELETE"})}function UF(e){return ze(`/session/${e}/message`)}function pc(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),ze(`/session/${e}/message`,{method:"POST",body:JSON.stringify(s)})}function Mf(e){return ze(`/session/${e}/queue`)}function Vk(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),ze(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function Gk(e,t){return ze(`/session/${e}/queue/${t}`,{method:"DELETE"})}function qF(e,t){return ze(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function $F(e){return ze(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function HF(e){return ze(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function WF(e){return ze(`/session/${e}/abort`,{method:"POST"})}function J5(e){return ze(`/session/${e}/idle-injection`)}function VF(e,t){return ze(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function GF(e){return ze(`/session/${e}/idle-injection`,{method:"DELETE"})}function KF(e){return ze(`/session/${e}/scheduled-injections`)}function YF(e,t){return ze(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function QF(e,t,n){return ze(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function XF(e,t){return ze(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function ZF(){return ze("/config/providers")}function JF(){return ze("/api/models/registry")}function eB(){return ze("/auth/status")}function tB(){return ze("/auth/logout",{method:"POST"})}function nB(){return ze("/api/permissions/pending")}function rB(e){return ze(`/api/permissions/confirm/${e}`,{method:"POST"})}function aB(e){return ze(`/api/permissions/deny/${e}`,{method:"POST"})}function iB(){return ze("/api/questions/pending")}function sB(e,t){return ze(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function oB(e){return ze(`/api/questions/${e}/reject`,{method:"POST"})}function Rb(){return ze("/skills")}function lB(){return ze("/skills/commands")}function cB(){return ze("/skills/registry")}function uB(e){return ze(`/skills/${encodeURIComponent(e)}`)}function dB(e){return ze(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function fB(e){return ze(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function pB(){return ze("/skills/check-updates")}function gB(e,t){return ze(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function hB(e){return ze(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function mB(e){return ze(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function eT(){return ze("/api/skill-defaults")}function yB(e){return ze("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function xB(e){return ze(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function bB(){return ze("/config")}function vB(e){const t=e?"?model="+encodeURIComponent(e):"";return ze("/config/adaptive-quality"+t)}function Xy(){return ze("/path")}function Kk(e){return ze("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function kB(e){return ze("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function tT(){return ze("/settings")}function _B(e){return ze("/settings",{method:"PUT",body:JSON.stringify(e)})}function Yk(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 ze("/api/user/inbox"+(n?"?"+n:""))}function wB(e){return ze("/api/user/inbox/"+encodeURIComponent(e)+"/read",{method:"POST"})}function EB(e){return ze("/api/user/inbox/"+encodeURIComponent(e)+"/unread",{method:"POST"})}function NB(e){return ze("/api/user/inbox/"+encodeURIComponent(e),{method:"DELETE"})}function SB(){return ze("/api/user/inbox/read-all",{method:"POST"})}function CB(){return ze("/api/user/inbox",{method:"DELETE"})}async function jB(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 TB(e){return ze("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function AB(e,t,n,r){const a=Io(),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 p=new Error(f&&f.error||"Transcription failed (HTTP "+u.status+")");throw p.status=u.status,p.code=f&&f.code,p.fallback=f&&f.fallback,p}if(!f){const p=new Error("Invalid response from transcription endpoint");throw p.code="invalid_response",p.fallback=!0,p}return f}let so=null,gc=0;function Zy(){const e=Date.now();return so&&e<gc||(so=ze("/api/transcribe/config").then(t=>(gc=Date.now()+5e3,t)).catch(t=>{throw so=null,gc=0,t}),gc=1/0),so}function Qk(){return ze("/session/status")}function RB(e){return ze(`/session/${encodeURIComponent(e)}/dlp/status`)}function MB(){return ze("/api/dlp/policy")}function IB(e){return ze("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function LB(e){return(await fetch(`${Gr}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function OB(e){return(await fetch(`${Gr}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function Xk(e){const t=await fetch(`${Gr}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function DB(e){return(await fetch(`${Gr}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function If(e){try{const t=await fetch(`${Gr}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function PB(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 Zk(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 FB(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function BB({part:e,questionId:t}){const{t:n}=vt(),{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,p]=h.useState({}),[g,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 w=e.callID||e.id||null;h.useEffect(()=>{if(l||x||!w)return;let G=!1;return iB().then(P=>{if(G||!k.current)return;const M=Array.isArray(P&&P.pending)?P.pending:[];for(var S=0;S<M.length;S++){var I=M[S],B=I.tool&&I.tool.callID?I.tool.callID:null;if(B===w&&I.id){b(I.id);break}}}).catch(()=>{}),()=>{G=!0}},[l,x,w]),h.useEffect(()=>()=>{k.current=!1},[]),h.useEffect(()=>{!l&&N.current&&(N.current.focus(),N.current.scrollIntoView({behavior:"smooth",block:"center"}))},[l]);const _=G=>{var P,M;return(((P=u[G])==null?void 0:P.length)??0)>0||(((M=f[G])==null?void 0:M.trim().length)??0)>0},T=s.every((G,P)=>_(P)),A=(G,P,M)=>{d(S=>{const I=S[G]??[];return M?{...S,[G]:I.includes(P)?I.filter(B=>B!==P):[...I,P]}:{...S,[G]:I.includes(P)?[]:[P]}})},D=h.useCallback(async()=>{if(!T||!x)return;const G=s.map((P,M)=>{var B;const S=u[M]??[],I=(B=f[M])==null?void 0:B.trim();return I?[...S,I]:S});m("reply"),v(null);try{const P=await sB(x,G);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]),R=h.useCallback(async()=>{if(x){m("reject"),v(null);try{const G=await oB(x);if(!k.current)return;if(G&&G.success===!1){v(G.error||"Failed to dismiss"),m(null);return}}catch(G){if(!k.current)return;v(G.message||"Failed to dismiss"),m(null)}}},[x]),$=G=>{G.key==="Enter"&&!G.shiftKey&&(G.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((G,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:G.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 F=!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((G,P)=>{const M=Array.isArray(G.options)?G.options:[],S=M.length>0,I=G.multiple===!0,B=G.custom!==!1,Q=u[P]??[],C=B&&!F;return C&&(F=!0),o.jsxs("div",{className:P>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(G.header||I)&&o.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[G.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:G.header}),I&&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:G.text}),S&&o.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:M.map((K,W)=>{const j=FB(K),U=Q.includes(j);return o.jsx("button",{onClick:()=>A(P,j,I),disabled:g!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${U?"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":U,children:j},W)})}),B&&o.jsx("input",{ref:C?N:void 0,type:"text",value:f[P]??"",onChange:K=>p(W=>({...W,[P]:K.target.value})),onKeyDown:$,disabled:g!==null,placeholder:n(S?"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:R,disabled:g!==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(g==="reject"?"question.dismissing":"question.dismiss")}),o.jsx("button",{onClick:D,disabled:g!==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:g==="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 UB({sessionId:e}){const{t}=vt(),[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),p=h.useRef(null),g=n!==null;h.useEffect(()=>{if(!a)return;const b=k=>{k.key==="Escape"&&(k.stopPropagation(),i(!1))};return window.addEventListener("keydown",b),p.current&&p.current.focus(),()=>window.removeEventListener("keydown",b)},[a]);const m=async()=>{if(!(g||!e)){i(!0),u(!0),f(null);try{const{content:b}=await PB(e);l(typeof b=="string"?b:"")}catch(b){console.error("Failed to load PLAN.md:",b),f(t("planCard.loadError"))}finally{u(!1)}}},y=()=>{g||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},v=()=>{g||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 "+(g?"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:g||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:g,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:g,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")})]}),g&&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:p,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 qB="plan.md";function $B(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function HB(e){return typeof e!="string"||!e?!1:$B(e).toLowerCase()===qB}function WB(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||{};HB(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function Mb(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 VB(e,t,n){const r=Mb(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(p=>p!=="_purpose");if(f.length>0){const p={};for(let g=0;g<f.length;g++)p[f[g]]=u[f[g]];try{d.push(JSON.stringify(p))}catch{}}if(c.output){let p=typeof c.output=="string"?c.output:function(){try{return JSON.stringify(c.output,null,2)}catch{return String(c.output)}}();p=p.replace(/\x1b\[[0-9;]*m/g,""),p.length>500&&(p=p.slice(0,500)),d.push(p)}if(c.error){const p=typeof c.error=="string"?c.error:c.error.message||String(c.error);d.push(p)}d.length>0&&a.push(d.join(`
90
+ `))}return a.length===0?r:r+`
91
+
92
+ `+a.join(`
93
+
94
+ `)}function GB(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 nT({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:p,mobileFrameless:g,hideThinking:m,isPrivate:y,isLast:v,isBusy:x,sessionID:b,questionIdMap:k,isCompactedOut:N}){var{t:w}=vt(),_=e.role==="user",T=!_&&v&&!x?WB(t)!==null:!1,A=_&&e._queued===!0,D=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[R,$]=h.useState(!1),[F,G]=h.useState(!1),[P,M]=h.useState(""),S=h.useRef(null),I=h.useRef(!0),B=h.useRef(null);h.useEffect(function(){var he=B.current;!he||!F||(he.style.height="auto",he.style.height=Math.min(he.scrollHeight,300)+"px")},[P,F]),h.useEffect(function(){return I.current=!0,function(){I.current=!1,S.current&&clearTimeout(S.current)}},[]);var Q=Mb(t,n,m),C=(t||[]).filter(function(he){return he.type==="tool"}),K=(t||[]).filter(function(he){return he.type==="file"&&he.filename}),W=(t||[]).filter(function(he){if(he.type!=="image_url"||!he.image_url)return!1;var _e=he.image_url.url||he.image_url;if(typeof _e!="string")return!1;if(_e.startsWith("data:image/")){var Pe=_e.indexOf(";"),Xe=Pe>5?_e.substring(5,Pe).toLowerCase():"",H=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return H.indexOf(Xe)!==-1}if(_e.startsWith("https://"))try{var z=new URL(_e),te=z.pathname.toLowerCase();return!te.endsWith(".svg")&&!te.endsWith(".svgz")}catch{return!1}return!1});if(!_){var j=!!Q,U=W.length>0,le=C.length>0,Z=C.some(function(he){return(he.tool||he.state&&he.state.title||"")==="question"}),ke=!p||Z;if(!j&&!U&&(!le||!ke))return null}var re=YB(e.time,w),X=e.isAutoInjected===!0,Ne=e.isCompaction===!0,ve=function(){var he=Q||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(he).then(function(){I.current&&($(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(function(){I.current&&$(!1)},2e3))}).catch(function(){I.current&&me(he)}):me(he)},me=function(he){var _e=document.createElement("textarea");_e.value=he,_e.style.position="fixed",_e.style.opacity="0",document.body.appendChild(_e),_e.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(_e)}I.current&&($(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(function(){I.current&&$(!1)},2e3))},pe=function(){M(Q||""),G(!0)},Le=function(){G(!1),M("")},Se=function(){P.trim()&&(A&&f&&f(e.id),d&&d(P.trim())),G(!1),M("")},Te=null;if(_){var Fe=Ne?w("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":Q;a&&s>0&&!Ne?Te=QB(Q||"",a,i,l,c):Te=o.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Fe})}var fe={pre:function({node:he,children:_e,...Pe}){if(h.isValidElement(_e)){var Xe=_e.type;if(Xe==="code"||typeof Xe=="string"&&Xe.toLowerCase()==="code"){var H=_e.props||{},z=className.match(/language-(\S+)/),te=z?z[1]:"",ce=Lo(H.children);return o.jsx(Bc,{language:te,className,frameless:Ce,children:ce})}}var je=Lo(_e);return je?o.jsx(Bc,{language:"",className:"",frameless:Ce,children:je}):o.jsx("pre",{...Pe,children:_e})},code:function({node:he,className:_e,children:Pe,...Xe}){if(he&&he.position&&Xe["data-sourcepos"],_e&&_e.indexOf("language-")!==-1){var H=_e.match(/language-(\S+)/),z=H?H[1]:"";return o.jsx(Bc,{language:z,className:_e,frameless:Ce,children:Lo(Pe)})}return o.jsx("code",{className:Ce?"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",...Xe,children:Pe})},a:function({node:he,children:_e,href:Pe,...Xe}){return o.jsx("a",{href:Pe,...Xe,target:"_blank",rel:"noopener noreferrer",children:_e})},table:function({node:he,children:_e,...Pe}){return o.jsx("div",{className:Ce?"overflow-x-auto my-3":"overflow-x-auto",children:o.jsx("table",{className:Ce?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...Pe,children:_e})})},th:function({node:he,children:_e,...Pe}){return o.jsx("th",{className:Ce?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...Pe,children:_e})},td:function({node:he,children:_e,...Pe}){return o.jsx("td",{className:Ce?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...Pe,children:_e})}},xe={current:0},Ce=g&&!_,ue=Ce&&v&&x;return o.jsxs("div",{className:`group flex gap-3 ${_?"justify-end":"justify-start"} ${A?"opacity-60 italic":""}${N?" opacity-60":""}`,"data-compacted-out":N?"true":void 0,children:[!_&&!Ce&&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 ${Ce?"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 ${_?`bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5${A&&!F?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:Ce?ue?"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`}`,...A&&!F&&d&&f?{onClick:pe,title:w("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(he){(he.key==="Enter"||he.key===" ")&&(he.preventDefault(),pe())}}:{},children:_?F?o.jsxs("div",{className:"space-y-2",children:[o.jsx("textarea",{ref:B,value:P,onChange:function(he){M(he.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:Le,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:Se,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:[Te,K.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:K.map(function(he,_e){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:he.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:he.filename})]},he.id||"file-"+_e)})}),W.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:W.map(function(he,_e){var Pe=he.image_url.url||he.image_url;return o.jsx("a",{href:Pe,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:Pe,alt:w("chat.attachment_with_index",{index:_e+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},he.id||"img-"+_e)})})]}):KB(t,n,W,K,fe,xe,a,i,s,l,c,p,m,w,Ce,k,v,x)}),T&&o.jsx(UB,{sessionId:b}),o.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${_?"justify-end":"justify-start"}`,children:[re&&o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:re}),X&&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:w("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:w("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:[Q&&o.jsx("button",{onClick:ve,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":w(R?"chat.copied":"chat.copy_message"),title:w(R?"chat.copied":"chat.copy_message"),children:R?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"})})}),_&&!A&&!F&&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":w("chat.edit_resend"),title:w("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"})})}),_&&A&&!F&&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":w("chat.edit_resend"),title:w("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"})})}),_&&A&&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":w("chat.cancel_queued"),title:w("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"})})}),!_&&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":w("chat.regenerate"),title:w("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"})})})]})]})]}),_&&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:D})})]})}function KB(e,t,n,r,a,i,s,l,c,u,d,f,p,g,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 w=Object.keys(t),_=0;_<w.length;_++){var T=t[w[_]];(T.type==="text"||T.type==="reasoning")&&!k[T.id]&&b.push({id:T.id,type:T.type,text:T.text||T.delta||""})}}var A=[],D="",R="",$="",F="";function G(){D&&(A.push({type:"text",text:D,key:R}),D="",R="")}function P(){$&&(A.push({type:"reasoning",text:$,key:F}),$="",F="")}for(var M=0;M<b.length;M++){var S=b[M];if(S.type==="text"){P(),R||(R="text-"+(S.id||M));var I=S.text||"";D&&I&&!D.endsWith(`
98
+ `)&&(D+=`
99
+ `),D+=I}else if(S.type==="reasoning"){G(),F||(F="reasoning-"+(S.id||M));var B=S.text||"";$&&B&&!$.endsWith(`
100
+ `)&&($+=`
101
+ `),$+=B}else S.type==="tool"&&(P(),G(),A.push({type:"tool",part:S,key:"tool-"+(S.id||M)}))}if(P(),G(),r.length>0&&A.push({type:"files",parts:r,key:"files"}),n.length>0&&A.push({type:"images",parts:n,key:"images"}),A.length===0)return null;var Q=[],C=[],K="";function W(){C.length>0&&(Q.push(o.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:C},"accent-"+K)),C=[])}for(var j=0;j<A.length;j++){var U=A[j];if(U.type==="text"){W();var le=Object.assign({},a);if(s&&c>0){var Z=function(ve,me){return function({children:pe,node:Le,...Se}){return o.jsx(ve,{...Se,children:Jy(pe,s,l,me,u,d)})}};le.p=Z("p",i),le.li=Z("li",i),le.td=Z("td",i),le.th=Z("th",i),le.h1=Z("h1",i),le.h2=Z("h2",i),le.h3=Z("h3",i),le.h4=Z("h4",i),le.h5=Z("h5",i),le.h6=Z("h6",i),le.blockquote=Z("blockquote",i)}Q.push(o.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:o.jsx(Jo,{remarkPlugins:[tl,Ky],rehypePlugins:[$k],components:le,children:U.text})},U.key))}else if(U.type==="reasoning")if(m)C.length===0&&(K=U.key),C.push(o.jsx(DF,{text:U.text,isStreaming:j===A.length-1&&v&&x},U.key));else{if(W(),p)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"})}),g("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(Jo,{remarkPlugins:[tl,Ky],rehypePlugins:[$k],components:a,children:U.text})})]},U.key))}else if(U.type==="tool"){var ke=U.part.tool||U.part.state&&U.part.state.title||"",re=ke==="question";if(re){W();var X=U.part.callID||U.part.id||"",Ne=y&&y[X]?y[X]:null;Q.push(o.jsx("div",{className:"my-2",children:o.jsx(BB,{part:U.part,questionId:Ne})},U.key))}else m&&!f?(C.length===0&&(K=U.key),C.push(o.jsx(OF,{part:U.part},U.key))):(W(),Q.push(o.jsx("div",{className:`my-2 ${f?"hidden":""}`,children:o.jsx(LF,{part:U.part})},U.key)))}else U.type==="files"?(W(),Q.push(o.jsx("div",{className:Q.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:U.parts.map(function(ve,me){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:ve.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:ve.filename})]},ve.id||"file-"+me)})})},U.key))):U.type==="images"&&Q.push(o.jsx("div",{className:Q.length>0?"mt-2":"",children:o.jsx("div",{className:"flex flex-wrap gap-2",children:U.parts.map(function(ve,me){var pe=ve.image_url.url||ve.image_url;return o.jsx("a",{href:pe,target:"_blank",rel:"noopener noreferrer",children:o.jsx("img",{src:pe,alt:g("chat.attachment_with_index",{index:me+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ve.id||"img-"+me)})})},U.key))}return W(),Q}function Lo(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(Lo).join(""):h.isValidElement(e)?Lo(e.props.children):""}function YB(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 p=r.getMonth()+1,g=r.getDate();return p+"/"+g+" "+f}function QB(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,p=f===r;l.push(o.jsx("mark",{ref:function(g){a(f,g)},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: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 Jy(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:Jy(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 p=n+r.current,g=p===a;u.push(o.jsx("mark",{ref:function(y){i(p,y)},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: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===Bc)return e;if(e.props&&e.props.children!==void 0){var m=Jy(e.props.children,t,n,r,a,i);return h.cloneElement(e,void 0,m)}}return e}function XB({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 ZB=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:p,onRetry:g,onEditAndResend:m,onCancelQueued:y,hackerMode:v,mobileFrameless:x,hideThinking:b,sessionID:k,banners:N,bannerHidden:w,onToggleBanner:_,privateMessageIds:T,parentSessionID:A,onViewParentSession:D,compactionPinned:R,onUnpinCompaction:$,questionIdMap:F},G){const{t:P}=vt(),M=h.useRef(null),S=h.useRef(null),I=h.useRef(!0),B=h.useRef({}),[Q,C]=h.useState(!1);var K=function(){M.current&&M.current.scrollIntoView({behavior:"smooth"})};h.useImperativeHandle(G,function(){return{scrollToBottom:K,resetAutoScroll:function(){I.current=!0}}},[]);var W=h.useCallback(function(re,X){X?B.current[re]=X:delete B.current[re]},[]),j=h.useRef({}),U=h.useMemo(function(){if(!d)return{perMessage:{},total:0,_nextCache:{}};for(var re=d.toLowerCase(),X=0,Ne={},ve={},me=j.current,pe=0;pe<t.length;pe++){var Le=t[pe],Se=VB(Le.parts,n[Le.info.id],b),Te=Le.info.role==="assistant",Fe=Te?GB(Se):Se,fe=Fe.toLowerCase(),xe=Le.info.id,Ce=me[xe],ue;Ce&&Ce.text===fe&&Ce.query===re?ue=Ce.count:ue=JB(fe,re),ve[xe]={text:fe,query:re,count:ue},ue>0&&(Ne[Le.info.id]={offset:X,count:ue}),X+=ue}return{perMessage:Ne,total:X,_nextCache:ve}},[t,n,d,b]);h.useEffect(function(){j.current=U._nextCache},[U]);var le=h.useMemo(function(){return{perMessage:U.perMessage,total:U.total}},[U]);h.useEffect(function(){p&&p(le.total)},[le.total,p]),h.useEffect(function(){if(!(!d||le.total===0)){var re=requestAnimationFrame(function(){var X=B.current[f];X&&X.scrollIntoView({behavior:"smooth",block:"center"})});return function(){cancelAnimationFrame(re)}}},[f,d,le.total]),h.useEffect(function(){B.current={}},[d]),h.useEffect(function(){var re=S.current;if(re){var X=0,Ne=!1,ve=function(){X||(X=requestAnimationFrame(function(){if(X=0,!!S.current){var me=re.scrollTop,pe=re.scrollHeight,Le=re.clientHeight,Se=pe-me-Le;I.current=Se<80;var Te=Se>200;Te!==Ne&&(Ne=Te,C(Te))}}))};return re.addEventListener("scroll",ve),ve(),function(){re.removeEventListener("scroll",ve),X&&cancelAnimationFrame(X)}}},[]),h.useEffect(function(){!d&&I.current&&M.current&&M.current.scrollIntoView({behavior:"smooth"})},[t,n,d]);for(var Z=-1,ke=t.length-1;ke>=0;ke--)if(t[ke].info.role==="assistant"){Z=ke;break}return o.jsxs("div",{ref:S,className:"flex-1 overflow-y-auto overflow-x-hidden relative",children:[o.jsx(XB,{sessionID:k,banners:N,hidden:w,onToggle:_}),o.jsx(az,{sessionID:k,parentSessionID:A,onViewParentSession:D,compactionPinned:R,onUnpinCompaction:$,t:P}),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(re,X){var Ne=le.perMessage[re.info.id]||null,ve=X===Z,me=re.info.role==="user",pe=re.info.compactedOut===!0,Le=X>0&&t[X-1].info.compactedOut===!0,Se=Le&&!pe;return o.jsxs(h.Fragment,{children:[Se?o.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none",children:[o.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:P&&P("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),o.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]},re.info.id+"-boundary"):null,o.jsx(nT,{isCompactedOut:pe,message:re.info,parts:re.parts,streamingParts:n[re.info.id],user:u,searchQuery:d,matchOffset:Ne?Ne.offset:-1,matchCount:Ne?Ne.count:0,activeMatchIndex:f,registerMatchRef:W,isLast:ve,isBusy:a,sessionID:k,onRetry:ve&&!a&&!pe?g:void 0,onEditAndResend:me&&!a&&!pe&&!tz(re.parts)?m:void 0,onCancelQueued:pe?void 0:y,hackerMode:v,mobileFrameless:x,hideThinking:b,isPrivate:T&&T.has(re.info.id),questionIdMap:F},re.info.id)]},re.info.id)}),a&&(x?!0:!ez(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:nz(r.toolNames,P)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:rz(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:M})]})}),Q&&o.jsx("button",{onClick:K,"aria-label":P("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:P("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 JB(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 ez(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(p){return p.type==="reasoning"&&r?!1:(p.type==="text"||p.type==="reasoning")&&(p.text||p.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(p){return p.type==="reasoning"&&r?!1:(p.type==="text"||p.type==="reasoning")&&p.text}),f=(u.parts||[]).some(function(p){return p.type==="tool"});return d||a&&f}if(u.info.role==="user")break}return!1}function tz(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function nz(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 rz(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function az({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{}g(!0)},u=function(){n&&t&&n(t)},d=l(),f=h.useState(!d),p=f[0],g=f[1];return!t||p?null:o.jsx("div",{className:"px-2 sm:px-4 py-2 bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800/50",children:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2H7a2 2 0 00-2 2v2M9 11V7a3 3 0 016 0v4"})}),o.jsx("span",{className:"text-xs text-blue-700 dark:text-blue-300 flex-1 min-w-0",children:i&&i("compaction.banner_title")||"This session was compacted from a previous conversation."}),o.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:i&&i("compaction.view_original")||"View original"}),r?o.jsx("button",{type:"button",onClick:function(){a&&a(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:i&&i("chat.unpin_compacted")||"Unpin — go back to original"}):null,o.jsx("button",{type:"button",onClick:c,"aria-label":i&&i("compaction.dismiss")||"Dismiss",className:"text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-300 flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const Qu=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],rT=["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"],aT=[...Qu,...rT],xu=5,Jk=Math.floor(4*1024*1024/1.34),e_=5*1024*1024,t_=6*1024*1024,n_=Math.floor(4*1024*1024/1.34),iz=aT.join(",");function Lf(e){return e?Qu.indexOf(e.toLowerCase())!==-1:!1}class sz{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 oz={AudioRingBuffer:sz};class lz{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 cz={TranscriptionScheduler:lz};function uz(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 dz(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(uz(l,c)/s<=a)return t.slice(s)}return t}var fz={dedupOverlap:dz};const Qi=16e3,pz=10,gz=3,hz=3,mz=200,r_=3,Of=2,yz=1e3,a_=.01,xz=1500;function i_(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 bz(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 vz(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 kz({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,p]=h.useState(null),[g,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),w=h.useRef(null),_=h.useRef(null),T=h.useRef(null),A=h.useRef(null),D=h.useRef(null),R=h.useRef(0),$=h.useRef(!1),F=h.useRef(""),G=h.useRef(!1),P=h.useRef(null),M=h.useRef("idle"),S=h.useCallback(fe=>{M.current=fe,s(fe)},[]),I=h.useRef(e),B=h.useRef(t),Q=h.useRef(n),C=h.useRef(r),K=h.useRef(a);h.useEffect(()=>{I.current=e},[e]),h.useEffect(()=>{B.current=t},[t]),h.useEffect(()=>{Q.current=n},[n]),h.useEffect(()=>{C.current=r},[r]),h.useEffect(()=>{K.current=a},[a]),h.useEffect(()=>{T.current&&(M.current==="recording"||M.current==="paused")&&T.current.clearPrevText()},[r]);const W=h.useCallback(()=>A.current?Promise.resolve(A.current):(D.current||(D.current=Zy().then(fe=>(A.current=fe,fe)).catch(()=>{const fe={mode:"auto",backendAvailable:!1};return A.current=fe,fe})),D.current),[]);h.useEffect(()=>{W()},[W]);const j=h.useCallback(()=>{N.current&&(N.current.getTracks().forEach(fe=>fe.stop()),N.current=null)},[]),U=h.useCallback(()=>{y.current&&(y.current.terminate(),y.current=null)},[]),le=h.useCallback(()=>{const fe=x.current,xe=v.current,Ce=b.current;if(fe){try{fe.disconnect()}catch{}fe.onaudioprocess=null,x.current=null}if(xe){try{xe.disconnect()}catch{}v.current=null}if(Ce){try{Ce.disconnect()}catch{}b.current=null}k.current=!1,j(),w.current&&w.current.state!=="closed"&&(w.current.close().catch(()=>{}),w.current=null),U(),_.current&&_.current.clear(),T.current&&T.current.reset(),R.current=0},[j,U]),Z=h.useRef(null),ke=h.useRef(null),re=h.useRef(null),X=h.useRef(null),Ne=h.useRef(null),ve=h.useRef(null);Z.current=function(xe){const Ce=xe&&xe.text||"";xe&&xe.chunkId;const ue=T.current,he=xe&&xe._silent;ue&&ue.reportResult(Ce);const _e=fz.dedupOverlap(F.current,Ce);if(_e){const Pe=F.current+_e;F.current=Pe,m(Pe),I.current&&I.current(_e)}if(R.current=0,(he||Ce.trim()==="")&&F.current.trim()&&Q.current&&Q.current(),M.current==="draining"&&ue&&!ue.inflight){const Pe=_.current,Xe=ue.drain(Pe);Xe?X.current(Xe):ve.current();return}re.current()},ke.current=function(xe){const Ce=T.current;if(Ce&&Ce.reportResult(""),R.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",xe,"("+R.current+"/"+r_+")"),R.current>=r_){le(),S("idle"),B.current&&B.current("Voice transcription failed repeatedly. Please try again.");return}if(M.current==="draining"&&Ce&&!Ce.inflight){ve.current();return}re.current()},re.current=function(){const xe=T.current,Ce=_.current;if(!xe||!Ce)return;const ue=M.current;if(ue!=="recording"&&ue!=="paused"&&ue!=="draining")return;const he=xe.appendAndSchedule(Ce);if(he){X.current(he);return}if((ue==="paused"||ue==="draining")&&!xe.inflight){const _e=xe.drain(Ce);_e?X.current(_e):ue==="draining"&&ve.current()}},X.current=async function(xe){const Ce=i_(xe.audio);if(Ce<a_){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+Ce.toFixed(6)+")"),Z.current({text:"",chunkId:xe.chunkId,_silent:!0});return}const ue=A.current||{mode:"auto",backendAvailable:!1},he=ue.backendAvailable&&ue.mode!=="local-only",_e=ue.mode!=="backend-only",Pe=C.current,Xe=K.current;if(he&&!$.current){const te=vz(xe.audio,Qi),ce={};xe.initialPrompt&&(ce.initialPrompt=xe.initialPrompt);let je=null;for(let Be=0;Be<=Of;Be++)try{const Ke=await AB(te,Pe,Xe,ce);if(typeof Ke.text=="string"){p("backend"),Z.current({text:Ke.text,chunkId:xe.chunkId});return}}catch(Ke){je=Ke;const Ye=Ke.status;if((Ye===429||Ye===503)&&Be<Of){const ot=yz*2**Be;console.warn("[useContinuousVoiceInput] Backend "+Ye+", retrying in "+ot+"ms (attempt "+(Be+1)+"/"+Of+")"),await new Promise(Rt=>{setTimeout(Rt,ot)});continue}(Ye===429||Ye===503)&&($.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!_e){ke.current(je?je.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",je?je.message:"unknown")}if(!_e){ke.current("Backend transcription is not available and local mode is disabled.");return}const H=Ne.current();p("local");const z={type:"transcribe",audio:xe.audio};Pe&&(z.language=Pe),xe.initialPrompt&&(z.initialPrompt=xe.initialPrompt),xe.chunkId&&(z.chunkId=xe.chunkId),H.postMessage(z,[xe.audio.buffer])},Ne.current=function(){if(y.current)return y.current;const xe=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});return xe.onmessage=Ce=>{const ue=Ce.data;if(ue)switch(ue.type){case"loading":c(ue.progress||0),d(ue.file?ue.file.split("/").pop():null);break;case"ready":M.current==="loading"&&S("recording"),c(100),d(null);break;case"result":Z.current(ue);break;case"error":ke.current(ue.error||"Transcription failed");break}},xe.onerror=()=>{const Ce=T.current;Ce&&Ce.reportResult(""),R.current+=1,U();const ue=new Worker(new URL("/assets/whisper-worker-Dtk1MkQa.js",import.meta.url),{type:"module"});ue.onmessage=he=>{const _e=he.data;if(_e)switch(_e.type){case"loading":c(_e.progress||0),d(_e.file?_e.file.split("/").pop():null);break;case"ready":M.current==="loading"&&S("recording"),c(100),d(null),re.current();break;case"result":Z.current(_e);break;case"error":ke.current(_e.error||"Transcription failed");break}},ue.onerror=()=>{ue.terminate(),y.current=null,le(),S("idle"),F.current="",m(""),B.current&&B.current("Voice transcription worker crashed.")},y.current=ue},y.current=xe,xe},ve.current=function(){const xe=y.current;xe&&xe.postMessage({type:"unload"}),w.current&&w.current.state!=="closed"&&(w.current.close().catch(()=>{}),w.current=null),T.current&&T.current.reset(),_.current&&_.current.clear(),S("idle")};const me=h.useCallback(async()=>{if(M.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){B.current&&B.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){B.current&&B.current("Audio recording is not supported in this browser.");return}try{const fe=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:Qi,echoCancellation:!0,noiseSuppression:!0}});N.current=fe;const xe=await W(),Ce=xe.mode==="local-only"||!xe.backendAvailable&&xe.mode!=="backend-only",ue=window.AudioContext||window.webkitAudioContext;(!w.current||w.current.state==="closed")&&(w.current=new ue);const he=w.current;_.current=new oz.AudioRingBuffer({maxDuration:30,sampleRate:Qi}),T.current=new cz.TranscriptionScheduler({chunkDuration:pz,overlapDuration:gz,minChunkDuration:hz,sampleRate:Qi,maxInitialPrompt:mz}),F.current="",m(""),R.current=0,$.current=!1,G.current=!1,P.current=null;const _e=he.createMediaStreamSource(fe),Xe=he.createScriptProcessor(4096,1,1),H=he.createGain();H.gain.value=0,_e.connect(Xe),Xe.connect(H),H.connect(he.destination),v.current=_e,x.current=Xe,b.current=H,k.current=!1,Xe.onaudioprocess=z=>{if(k.current)return;const te=z.inputBuffer,ce=te.sampleRate,je=te.getChannelData(0);let Be;if(ce===Qi?Be=new Float32Array(je):Be=bz({sampleRate:ce,getChannelData:()=>je},Qi),Be.length===0)return;const Ke=_.current;Ke&&Ke.append(Be);const Ye=i_(Be),ot=performance.now();if(Ye>=a_)G.current=!0,P.current=null;else if(G.current){if(!P.current)P.current=ot;else if(ot-P.current>=xz){G.current=!1,P.current=null;const Rt=T.current;if(Rt&&!Rt.inflight&&Ke){const mt=Rt.drain(Ke);mt&&X.current(mt)}}}re.current()},Ce?(S("loading"),c(0),Ne.current().postMessage({type:"load"})):(S("recording"),c(100))}catch(fe){j(),S("idle");const xe=fe.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(fe.message||String(fe));B.current&&B.current(xe)}}},[W,j]),pe=h.useCallback(()=>{const fe=M.current;if(fe==="loading"){le(),U(),S("idle");return}if(fe!=="recording"&&fe!=="paused")return;const xe=x.current,Ce=v.current,ue=b.current;if(xe){try{xe.disconnect()}catch{}xe.onaudioprocess=null,x.current=null}if(Ce){try{Ce.disconnect()}catch{}v.current=null}if(ue){try{ue.disconnect()}catch{}b.current=null}j(),S("draining"),setTimeout(()=>{const he=T.current,_e=_.current;if(!he||!_e){ve.current();return}if(!he.inflight){const Pe=he.drain(_e);Pe?X.current(Pe):ve.current()}},0)},[j,le,U]),Le=h.useCallback(()=>{M.current==="recording"&&(k.current=!0,S("paused"),re.current())},[]),Se=h.useCallback(()=>{M.current==="paused"&&(k.current=!1,S("recording"))},[]),Te=h.useCallback(()=>{M.current!=="idle"&&(le(),U(),F.current="",m(""),S("idle"))},[le,U]),Fe=h.useCallback(()=>{if(M.current!=="idle"){B.current&&B.current("Cannot clear cache while recording.");return}S("loading"),c(0),U(),Ne.current().postMessage({type:"clearCache"})},[U]);return h.useEffect(()=>()=>{le(),U()},[le,U]),{state:i,progress:l,downloadingFile:u,transcriptionSource:f,transcriptText:g,startRecording:me,stopRecording:pe,pauseRecording:Le,resumeRecording:Se,cancelRecording:Te,clearModelCache:Fe}}function _z({skills:e,builtins:t,filter:n,onSelect:r,visible:a,selectedIndex:i,activeSkill:s,onBack:l}){const{t:c}=vt(),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 p=[],g=!1;if(s){g=!0;const m=e.find(v=>v.skill===s);p=(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}));p=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:[g&&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:g?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:p.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")}):p.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 zc=[{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 wz(){return zc.slice()}function Ez(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<zc.length;n++)if(zc[n].name===t)return zc[n];return null}function Nz(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=Ez(r);if(!a)return null;const i=(n[2]||"").trim();return{name:r,args:i,builtin:a}}const oi="pave-draft-",Sz=h.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:a,sessionId:i,queuedCount:s=0,onBuiltinCommand:l},c){const{t:u}=vt(),[d,f]=h.useState(""),[p,g]=h.useState([]),[m,y]=h.useState(!1);h.useEffect(()=>{const ae=()=>y(!1);return window.addEventListener("pave:plan-execute",ae),()=>window.removeEventListener("pave:plan-execute",ae)},[]);const[v,x]=h.useState(null),[b,k]=h.useState([]),[N,w]=h.useState(""),[_,T]=h.useState(!1),A=h.useRef(null),D=h.useRef([]),[R,$]=h.useState(-1),F="pave-asr-language",G=[{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(F)||"auto"}catch{return"auto"}}),[S,I]=h.useState(!1),B=h.useRef(null),Q=h.useRef(p),C=h.useRef(null),K=h.useRef(null),W=h.useRef(null),j=h.useRef(i),U=h.useRef(d),le=h.useRef(null),[Z,ke]=h.useState(!1),[re,X]=h.useState(""),[Ne,ve]=h.useState([]),[me,pe]=h.useState(0),[Le,Se]=h.useState(null),Te=h.useRef({data:null,time:0}),Fe=6e4,fe=h.useCallback(ae=>{x(ae),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>x(null),5e3)},[]);h.useEffect(()=>()=>{le.current&&clearTimeout(le.current)},[]),h.useLayoutEffect(()=>{U.current=d},[d]),h.useLayoutEffect(()=>{j.current=i,W.current&&(clearTimeout(W.current),W.current=null);let ae="";if(i)try{ae=localStorage.getItem(oi+i)||""}catch{}return f(ae),U.current=ae,g(Ie=>(Ie.forEach(De=>{De.preview&&URL.revokeObjectURL(De.preview)}),[])),()=>{W.current&&(clearTimeout(W.current),W.current=null);const Ie=j.current;if(Ie)try{U.current?localStorage.setItem(oi+Ie,U.current):localStorage.removeItem(oi+Ie)}catch{}}},[i]),h.useEffect(()=>{j.current&&(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{try{d?localStorage.setItem(oi+j.current,d):localStorage.removeItem(oi+j.current)}catch{}},300))},[d]);const xe=h.useCallback(async()=>{const ae=Te.current;if(ae.data&&Date.now()-ae.time<Fe){ve(ae.data);return}try{const Ie=await lB(),De=Array.isArray(Ie)?Ie:[];Te.current={data:De,time:Date.now()},ve(De)}catch{ve([])}},[]),Ce=h.useMemo(()=>wz(),[]),ue=h.useMemo(()=>{const ae=(re||"").trim().toLowerCase();if(Le){const Ve=Ne.find(et=>et.skill===Le);return(Ve&&Ve.commands||[]).filter(et=>ae?(et.name||"").toLowerCase().includes(ae)||(et.description||"").toLowerCase().includes(ae):!0).map(et=>({type:"command",skill:Le,name:et.name}))}const Ie=Ce.filter(Ve=>ae?(Ve.name||"").toLowerCase().includes(ae)||(Ve.description||"").toLowerCase().includes(ae):!0).map(Ve=>({type:"builtin",name:Ve.name})),De=Ne.filter(Ve=>ae?(Ve.skill||"").toLowerCase().includes(ae)||(Ve.description||"").toLowerCase().includes(ae)||(Ve.commands||[]).some(ft=>(ft.name||"").toLowerCase().includes(ae)||(ft.description||"").toLowerCase().includes(ae)):!0).map(Ve=>({type:"skill",skill:Ve.skill}));return Ie.concat(De)},[re,Le,Ne,Ce]),he=h.useCallback(()=>ue.length,[ue]),_e=h.useCallback(ae=>{if(f(ae),U.current=ae,ae.startsWith("/")){const Ie=ae.slice(1),De=Ie.split(/\s/)[0]||"";if(!De.includes("/")&&!De.includes(".")){if(Le){const Ve=Le+" ";Ie.startsWith(Ve)?(X(Ie.slice(Ve.length)),pe(0)):(Se(null),X(Ie),pe(0))}else X(Ie),pe(0);Z||(xe(),ke(!0),pe(0))}else ke(!1),X(""),Se(null),pe(0)}else ke(!1),X(""),Se(null),pe(0)},[Z,Le,xe]),Pe=h.useCallback((ae,Ie)=>{var De,Ve,ft;if(ae==="__builtin__"&&Ie){f("/"+Ie+" "),ke(!1),X(""),Se(null),pe(0),(De=C.current)==null||De.focus();return}if(!Ie)Se(ae),X(""),pe(0),f("/"+ae+" "),(Ve=C.current)==null||Ve.focus();else{const et="/"+ae+" "+Ie+" ";f(et),ke(!1),X(""),Se(null),pe(0),(ft=C.current)==null||ft.focus()}},[]),Xe=h.useCallback(()=>{var ae;Se(null),X(""),pe(0),f("/"),(ae=C.current)==null||ae.focus()},[]),H=h.useCallback(ae=>{f(Ie=>{const De=Ie&&!Ie.endsWith(" ")&&!Ie.endsWith(`
102
+ `)?" ":"";return Ie+De+ae})},[]),z=h.useRef(null),te=h.useCallback(()=>{setTimeout(()=>{z.current&&z.current()},50)},[]),{state:ce,progress:je,downloadingFile:Be,startRecording:Ke,stopRecording:Ye,resumeRecording:ot,cancelRecording:Rt}=kz({onTranscript:H,onError:fe,onAutoSubmit:te,model:N||void 0,language:P&&P!=="auto"?P:void 0});h.useEffect(()=>{try{P&&localStorage.setItem(F,P)}catch{}},[P]),h.useEffect(()=>{if(!S)return;const ae=Ie=>{B.current&&!B.current.contains(Ie.target)&&I(!1)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[S]),h.useEffect(()=>{let ae=!1;return Zy().then(Ie=>{ae||Ie&&Array.isArray(Ie.models)&&Ie.models.length>0&&(k(Ie.models),w(De=>De||Ie.models[0].name))}).catch(()=>{}),()=>{ae=!0}},[Zy]),h.useEffect(()=>{if(!_){$(-1);return}D.current.length=b.length;function ae(De){A.current&&!A.current.contains(De.target)&&T(!1)}function Ie(De){if(De.key==="Escape"){T(!1);return}De.key!=="ArrowDown"&&De.key!=="ArrowUp"&&De.key!=="Home"&&De.key!=="End"||(De.preventDefault(),$(Ve=>{const ft=D.current.length;if(!ft)return Ve;const et=typeof Ve=="number"?Ve:-1;let Qe=et;return De.key==="ArrowDown"?Qe=et<ft-1?et+1:0:De.key==="ArrowUp"?Qe=et>0?et-1:ft-1:De.key==="Home"?Qe=0:De.key==="End"&&(Qe=ft-1),D.current[Qe]&&D.current[Qe].focus(),Qe}))}return document.addEventListener("mousedown",ae),document.addEventListener("keydown",Ie),()=>{document.removeEventListener("mousedown",ae),document.removeEventListener("keydown",Ie)}},[_,b.length]),h.useEffect(()=>{const ae=C.current;ae&&(ae.style.height="auto",ae.style.height=Math.min(ae.scrollHeight,200)+"px")},[d]),h.useEffect(()=>{Q.current=p},[p]),h.useEffect(()=>{var ae;(ae=C.current)==null||ae.focus()},[]),h.useImperativeHandle(c,()=>({focus:()=>{var ae;(ae=C.current)==null||ae.focus()},setText:ae=>{f(typeof ae=="string"?ae:""),requestAnimationFrame(()=>{var Ie;return(Ie=C.current)==null?void 0:Ie.focus()})}}),[]);const mt=async()=>{const ae=d.trim();var Ie=p.filter(function(et){return Lf(et.type)}),De=p.filter(function(et){return!Lf(et.type)});const Ve=Nz(ae);if(Ve&&typeof l=="function"){const et=j.current;try{await l(Ve.name,Ve.args,{imageAttachments:Ie.length>0?Ie:void 0,fileAttachments:De.length>0?De:void 0})}catch{return}if(f(""),ke(!1),X(""),Se(null),pe(0),et)try{localStorage.removeItem(oi+et)}catch{}p.forEach(function(Qe){Qe.preview&&URL.revokeObjectURL(Qe.preview)}),g([]),C.current&&(C.current.style.height="auto");return}if(!ae&&Ie.length===0&&De.length===0)return;const ft=j.current;try{await t(ae,Ie.length>0?Ie:void 0,m?"plan":void 0,De.length>0?De:void 0)}catch{return}if(f(""),ke(!1),X(""),Se(null),pe(0),ft)try{localStorage.removeItem(oi+ft)}catch{}p.forEach(function(et){et.preview&&URL.revokeObjectURL(et.preview)}),g([]),C.current&&(C.current.style.height="auto")};z.current=mt;const Mt=ae=>{if(Z){const Ie=he();if(ae.key==="ArrowDown"){Ie>0&&(ae.preventDefault(),pe(De=>(De+1)%Ie));return}if(ae.key==="ArrowUp"){Ie>0&&(ae.preventDefault(),pe(De=>(De-1+Ie)%Ie));return}if(ae.key==="Enter"||ae.key==="Tab"){if(Ie>0){ae.preventDefault();const De=ue[me];De&&(De.type==="command"?Pe(De.skill,De.name):De.type==="builtin"?Pe("__builtin__",De.name):Pe(De.skill,null));return}if(ae.key==="Tab"){ke(!1),X(""),Se(null),pe(0);return}}if(ae.key==="Escape"){ae.preventDefault(),ke(!1),X(""),Se(null),pe(0);return}if(ae.key==="Backspace"&&Le){const De=d.slice(1),Ve=Le+" ";if(De===Ve||De===Le){ae.preventDefault(),Xe();return}}}ae.key==="Enter"&&!ae.shiftKey&&(ae.preventDefault(),mt())},de=ae=>{if(!a){var Ie=ae.clipboardData&&ae.clipboardData.items;if(Ie){for(var De=[],Ve=0;Ve<Ie.length;Ve++){var ft=(Ie[Ve].type||"").toLowerCase();if(Qu.indexOf(ft)!==-1){var et=Ie[Ve].getAsFile();et&&De.push(et)}}if(De.length!==0){for(var Qe=!1,Xt=0;Xt<Ie.length;Xt++)if(Ie[Xt].type&&Ie[Xt].type.startsWith("text/")){Qe=!0;break}Qe||ae.preventDefault();var oe=De.map(function(jt){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:jt,name:jt.name||"pasted-image.png",size:jt.size,type:jt.type,preview:null}});g(function(jt){var ct=xu-jt.length;if(ct<=0)return jt;for(var wt=oe.slice(0,ct),gt=0;gt<wt.length;gt++)wt[gt].preview=URL.createObjectURL(wt[gt].file);return jt.concat(wt)})}}}},We=ae=>{const Ie=Array.from(ae.target.files||[]);if(Ie.length===0)return;const De=Ie.filter(ft=>aT.indexOf(ft.type)!==-1);if(De.length===0){ae.target.value="";return}const Ve=De.map(ft=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:ft,name:ft.name,size:ft.size,type:ft.type,preview:null}));g(ft=>{var et=xu-ft.length;if(et<=0)return ft;for(var Qe=Ve.slice(0,et),Xt=0;Xt<Qe.length;Xt++)Qe[Xt].preview=Lf(Qe[Xt].file.type)?URL.createObjectURL(Qe[Xt].file):null;return[...ft,...Qe]}),ae.target.value=""},nt=ae=>{g(Ie=>{const De=Ie.find(Ve=>Ve.id===ae);return De!=null&&De.preview&&URL.revokeObjectURL(De.preview),Ie.filter(Ve=>Ve.id!==ae)})},yt=ae=>ae<1024?ae+" B":ae<1024*1024?(ae/1024).toFixed(1)+" KB":(ae/(1024*1024)).toFixed(1)+" MB";return h.useEffect(()=>()=>{Q.current.forEach(ae=>{ae.preview&&URL.revokeObjectURL(ae.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."})]}),p.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:p.map(ae=>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:[ae.preview?o.jsx("img",{src:ae.preview,alt:ae.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:ae.name}),o.jsx("p",{className:"text-xs text-gray-400",children:yt(ae.size)})]}),o.jsx("button",{onClick:()=>nt(ae.id),"aria-label":`Remove attachment ${ae.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"})})})]},ae.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(_z,{skills:Ne,builtins:Ce,filter:re,onSelect:Pe,visible:Z,selectedIndex:me,activeSkill:Le,onBack:Xe}),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 ae;return(ae=K.current)==null?void 0:ae.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:K,type:"file",multiple:!0,accept:iz,onChange:We,className:"hidden"}),o.jsx("button",{onClick:ce==="recording"?Ye:ce==="paused"?ot:ce==="loading"?Rt:Ke,disabled:ce==="draining"||(a||r)&&ce!=="recording"&&ce!=="loading"&&ce!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(ce==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":ce==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":ce==="loading"||ce==="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:ce==="recording"?u("voice.stop_recording")||"Stop recording":ce==="paused"?u("voice.resume_recording")||"Resume recording":ce==="loading"?u("voice.loading_model"):ce==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),"aria-label":ce==="recording"?u("voice.stop_recording")||"Stop recording":ce==="paused"?u("voice.resume_recording")||"Resume recording":ce==="loading"?u("voice.loading_model"):ce==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),children:ce==="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"})]}):ce==="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"})]}):ce==="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"})}):ce==="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"})})}),ce==="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:`${je}%`}})}),o.jsx("span",{children:Be?`${Be} ${je}%`:`${je}%`})]}),o.jsxs("div",{className:"relative flex-shrink-0",ref:B,children:[o.jsxs("button",{onClick:()=>I(ae=>!ae),disabled:ce==="recording"||ce==="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":S,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:(G.find(ae=>ae.code===P)||G[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"})})]}),S&&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:G.map(ae=>o.jsx("button",{role:"menuitemradio","aria-checked":ae.code===P,onClick:()=>{M(ae.code),I(!1),ae.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 "+(ae.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:ae.label},ae.code))})]}),b.length>1&&o.jsxs("div",{className:"relative flex-shrink-0",ref:A,children:[o.jsxs("button",{onClick:()=>T(ae=>!ae),disabled:ce==="recording"||ce==="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":_,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(ae=>ae.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"})})]}),_&&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((ae,Ie)=>o.jsxs("button",{ref:De=>{D.current[Ie]=De},role:"menuitemradio","aria-checked":ae.name===N,tabIndex:R===Ie?0:-1,onClick:()=>{w(ae.name),T(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(ae.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:[ae.label,ae.type!=="openai"&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",ae.type,")"]})]},`${ae.name}-${Ie}`))})]}),o.jsxs("button",{onClick:()=>y(ae=>!ae),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:C,value:d,onChange:ae=>_e(ae.target.value),onKeyDown:Mt,onPaste:de,placeholder:u("chat.send_placeholder"),disabled:a,rows:1,role:Z?"combobox":void 0,"aria-controls":Z?"slash-command-listbox":void 0,"aria-activedescendant":Z&&he()>0?"slash-item-"+me:void 0,"aria-expanded":Z||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:mt,disabled:!d.trim()&&p.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()&&p.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 Cz({darkMode:e,onToggleTheme:t}){const{t:n}=vt(),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),[p,g]=h.useState(!1);h.useEffect(()=>{fetch("/auth/membership/available").then(v=>v.json()).then(v=>g(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}),p&&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")})]}),p&&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 jz({user:e,onLogout:t,onSkillManagement:n,onAgentManagement:r,onPricingSettings:a,onDlpSettings:i,onSettings:s}){const{t:l}=vt(),[c,u]=h.useState(!1),d=h.useRef(null);if(h.useEffect(()=>{if(!c)return;function p(g){d.current&&!d.current.contains(g.target)&&u(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]),!e)return null;const f=(e.name||e.email||"?").split(" ").map(p=>p[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 iT({toolParts:e}){const{t}=vt();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(Tz,{part:n},n.id))})]})}function Tz({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=Az(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 Az(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+hc(t.filePath);case"Write":return"Writing "+hc(t.filePath);case"Edit":return"Editing "+hc(t.filePath);case"Bash":{const n=t.command||"";return s_(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+ex(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+ex(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return Rz(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+hc(t.filePath):t.command?s_(t.command):"Running "+e.toLowerCase()}}function hc(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 s_(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 "+ex(n,20)}function Rz(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 ex(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const tx=10,nx=24,o_=2,Mz=14,sT="pave-terminal-font-size";function Iz(){try{const e=localStorage.getItem(sT);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=tx&&t<=nx)return t}}catch{}return Mz}function oT({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=vt();const i=h.useRef(null),s=h.useRef(null),l=h.useRef(null),[c,u]=h.useState(Iz),d=h.useCallback(()=>{u(y=>Math.max(tx,y-o_))},[]),f=h.useCallback(()=>{u(y=>Math.min(nx,y+o_))},[]);h.useEffect(()=>{try{localStorage.setItem(sT,String(c))}catch{}},[c]);const p=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"},g=`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 A=y.parentElement;if(A&&A.clientWidth>0&&A.clientHeight>0){y.width=A.clientWidth,y.height=A.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 w="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",_=()=>{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 A=0;A<N.length;A++){const D=w.charAt(Math.floor(Math.random()*w.length));v.fillText(D,A*b,N[A]*b),N[A]*b>y.height&&Math.random()>.975&&(N[A]=0),N[A]++}l.current=requestAnimationFrame(_)},T=()=>{x(),k=Math.floor(y.width/b);const A=new Array(k).fill(0);for(let D=0;D<Math.min(N.length,A.length);D++)A[D]=N[D];N=A};return window.addEventListener("resize",T),l.current=requestAnimationFrame(_),()=>{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 ${p.bg} font-mono`,style:{fontSize:c+"px"},children:[o.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${p.headerBg} border-b ${p.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:`${p.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<=tx,className:g,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),o.jsx("button",{type:"button",onClick:f,disabled:c>=nx,className:g,"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(Oz,{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:p.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]}),o.jsx("p",{className:`${p.waitingText} mt-2`,children:"Awaiting commands..."})]}):o.jsxs(o.Fragment,{children:[e.map(y=>o.jsx(Lz,{part:y,theme:p},y.id)),o.jsxs("div",{className:p.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function Lz({part:e,theme:t}){var{t:n}=vt();const{tool:r,state:a}=e;if(!a)return null;const i=a.status||"running",l=Yu(r||a.title,a.input)||r||a.title||"unknown",c=a.output?_i(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?_i(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 Oz({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",i=Yu(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 Ib(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 Df,l_;function Dz(){if(l_)return Df;l_=1;function e(){this.__data__=[],this.size=0}return Df=e,Df}var Pf,c_;function Ps(){if(c_)return Pf;c_=1;function e(t,n){return t===n||t!==t&&n!==n}return Pf=e,Pf}var Ff,u_;function Xu(){if(u_)return Ff;u_=1;var e=Ps();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Ff=t,Ff}var Bf,d_;function Pz(){if(d_)return Bf;d_=1;var e=Xu(),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 Bf=r,Bf}var zf,f_;function Fz(){if(f_)return zf;f_=1;var e=Xu();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return zf=t,zf}var Uf,p_;function Bz(){if(p_)return Uf;p_=1;var e=Xu();function t(n){return e(this.__data__,n)>-1}return Uf=t,Uf}var qf,g_;function zz(){if(g_)return qf;g_=1;var e=Xu();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 qf=t,qf}var $f,h_;function Zu(){if(h_)return $f;h_=1;var e=Dz(),t=Pz(),n=Fz(),r=Bz(),a=zz();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,$f=i,$f}var Hf,m_;function Uz(){if(m_)return Hf;m_=1;var e=Zu();function t(){this.__data__=new e,this.size=0}return Hf=t,Hf}var Wf,y_;function qz(){if(y_)return Wf;y_=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Wf=e,Wf}var Vf,x_;function $z(){if(x_)return Vf;x_=1;function e(t){return this.__data__.get(t)}return Vf=e,Vf}var Gf,b_;function Hz(){if(b_)return Gf;b_=1;function e(t){return this.__data__.has(t)}return Gf=e,Gf}var Kf,v_;function lT(){if(v_)return Kf;v_=1;var e=typeof Da=="object"&&Da&&Da.Object===Object&&Da;return Kf=e,Kf}var Yf,k_;function Ir(){if(k_)return Yf;k_=1;var e=lT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Yf=n,Yf}var Qf,__;function Fs(){if(__)return Qf;__=1;var e=Ir(),t=e.Symbol;return Qf=t,Qf}var Xf,w_;function Wz(){if(w_)return Xf;w_=1;var e=Fs(),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 Xf=i,Xf}var Zf,E_;function Vz(){if(E_)return Zf;E_=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Zf=n,Zf}var Jf,N_;function Li(){if(N_)return Jf;N_=1;var e=Fs(),t=Wz(),n=Vz(),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 Jf=s,Jf}var ep,S_;function yr(){if(S_)return ep;S_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ep=e,ep}var tp,C_;function ml(){if(C_)return tp;C_=1;var e=Li(),t=yr(),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 tp=s,tp}var np,j_;function Gz(){if(j_)return np;j_=1;var e=Ir(),t=e["__core-js_shared__"];return np=t,np}var rp,T_;function Kz(){if(T_)return rp;T_=1;var e=Gz(),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 rp=n,rp}var ap,A_;function cT(){if(A_)return ap;A_=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 ap=n,ap}var ip,R_;function Yz(){if(R_)return ip;R_=1;var e=ml(),t=Kz(),n=yr(),r=cT(),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(p){if(!n(p)||t(p))return!1;var g=e(p)?d:i;return g.test(r(p))}return ip=f,ip}var sp,M_;function Qz(){if(M_)return sp;M_=1;function e(t,n){return t==null?void 0:t[n]}return sp=e,sp}var op,I_;function Oi(){if(I_)return op;I_=1;var e=Yz(),t=Qz();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return op=n,op}var lp,L_;function Lb(){if(L_)return lp;L_=1;var e=Oi(),t=Ir(),n=e(t,"Map");return lp=n,lp}var cp,O_;function Ju(){if(O_)return cp;O_=1;var e=Oi(),t=e(Object,"create");return cp=t,cp}var up,D_;function Xz(){if(D_)return up;D_=1;var e=Ju();function t(){this.__data__=e?e(null):{},this.size=0}return up=t,up}var dp,P_;function Zz(){if(P_)return dp;P_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return dp=e,dp}var fp,F_;function Jz(){if(F_)return fp;F_=1;var e=Ju(),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 fp=a,fp}var pp,B_;function eU(){if(B_)return pp;B_=1;var e=Ju(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return pp=r,pp}var gp,z_;function tU(){if(z_)return gp;z_=1;var e=Ju(),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 gp=n,gp}var hp,U_;function nU(){if(U_)return hp;U_=1;var e=Xz(),t=Zz(),n=Jz(),r=eU(),a=tU();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,hp=i,hp}var mp,q_;function rU(){if(q_)return mp;q_=1;var e=nU(),t=Zu(),n=Lb();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return mp=r,mp}var yp,$_;function aU(){if($_)return yp;$_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return yp=e,yp}var xp,H_;function ed(){if(H_)return xp;H_=1;var e=aU();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return xp=t,xp}var bp,W_;function iU(){if(W_)return bp;W_=1;var e=ed();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return bp=t,bp}var vp,V_;function sU(){if(V_)return vp;V_=1;var e=ed();function t(n){return e(this,n).get(n)}return vp=t,vp}var kp,G_;function oU(){if(G_)return kp;G_=1;var e=ed();function t(n){return e(this,n).has(n)}return kp=t,kp}var _p,K_;function lU(){if(K_)return _p;K_=1;var e=ed();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 _p=t,_p}var wp,Y_;function Ob(){if(Y_)return wp;Y_=1;var e=rU(),t=iU(),n=sU(),r=oU(),a=lU();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,wp=i,wp}var Ep,Q_;function cU(){if(Q_)return Ep;Q_=1;var e=Zu(),t=Lb(),n=Ob(),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 Ep=a,Ep}var Np,X_;function td(){if(X_)return Np;X_=1;var e=Zu(),t=Uz(),n=qz(),r=$z(),a=Hz(),i=cU();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,Np=s,Np}var Sp,Z_;function Db(){if(Z_)return Sp;Z_=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 Sp=e,Sp}var Cp,J_;function uT(){if(J_)return Cp;J_=1;var e=Oi(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return Cp=t,Cp}var jp,ew;function nd(){if(ew)return jp;ew=1;var e=uT();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return jp=t,jp}var Tp,tw;function rd(){if(tw)return Tp;tw=1;var e=nd(),t=Ps(),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 Tp=a,Tp}var Ap,nw;function yl(){if(nw)return Ap;nw=1;var e=rd(),t=nd();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 Ap=n,Ap}var Rp,rw;function uU(){if(rw)return Rp;rw=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Rp=e,Rp}var Mp,aw;function Kr(){if(aw)return Mp;aw=1;function e(t){return t!=null&&typeof t=="object"}return Mp=e,Mp}var Ip,iw;function dU(){if(iw)return Ip;iw=1;var e=Li(),t=Kr(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Ip=r,Ip}var Lp,sw;function xl(){if(sw)return Lp;sw=1;var e=dU(),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 Lp=i,Lp}var Op,ow;function sn(){if(ow)return Op;ow=1;var e=Array.isArray;return Op=e,Op}var go={exports:{}},Dp,lw;function fU(){if(lw)return Dp;lw=1;function e(){return!1}return Dp=e,Dp}go.exports;var cw;function Bs(){return cw||(cw=1,function(e,t){var n=Ir(),r=fU(),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}(go,go.exports)),go.exports}var Pp,uw;function ad(){if(uw)return Pp;uw=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 Pp=n,Pp}var Fp,dw;function Pb(){if(dw)return Fp;dw=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Fp=t,Fp}var Bp,fw;function pU(){if(fw)return Bp;fw=1;var e=Li(),t=Pb(),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]",p="[object RegExp]",g="[object Set]",m="[object String]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",N="[object Int8Array]",w="[object Int16Array]",_="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",D="[object Uint16Array]",R="[object Uint32Array]",$={};$[b]=$[k]=$[N]=$[w]=$[_]=$[T]=$[A]=$[D]=$[R]=!0,$[r]=$[a]=$[v]=$[i]=$[x]=$[s]=$[l]=$[c]=$[u]=$[d]=$[f]=$[p]=$[g]=$[m]=$[y]=!1;function F(G){return n(G)&&t(G.length)&&!!$[e(G)]}return Bp=F,Bp}var zp,pw;function id(){if(pw)return zp;pw=1;function e(t){return function(n){return t(n)}}return zp=e,zp}var ho={exports:{}};ho.exports;var gw;function Fb(){return gw||(gw=1,function(e,t){var n=lT(),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}(ho,ho.exports)),ho.exports}var Up,hw;function bl(){if(hw)return Up;hw=1;var e=pU(),t=id(),n=Fb(),r=n&&n.isTypedArray,a=r?t(r):e;return Up=a,Up}var qp,mw;function dT(){if(mw)return qp;mw=1;var e=uU(),t=xl(),n=sn(),r=Bs(),a=ad(),i=bl(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=n(u),p=!f&&t(u),g=!f&&!p&&r(u),m=!f&&!p&&!g&&i(u),y=f||p||g||m,v=y?e(u.length,String):[],x=v.length;for(var b in u)(d||l.call(u,b))&&!(y&&(b=="length"||g&&(b=="offset"||b=="parent")||m&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||a(b,x)))&&v.push(b);return v}return qp=c,qp}var $p,yw;function sd(){if(yw)return $p;yw=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return $p=t,$p}var Hp,xw;function fT(){if(xw)return Hp;xw=1;function e(t,n){return function(r){return t(n(r))}}return Hp=e,Hp}var Wp,bw;function gU(){if(bw)return Wp;bw=1;var e=fT(),t=e(Object.keys,Object);return Wp=t,Wp}var Vp,vw;function Bb(){if(vw)return Vp;vw=1;var e=sd(),t=gU(),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 Vp=a,Vp}var Gp,kw;function ya(){if(kw)return Gp;kw=1;var e=ml(),t=Pb();function n(r){return r!=null&&t(r.length)&&!e(r)}return Gp=n,Gp}var Kp,_w;function ri(){if(_w)return Kp;_w=1;var e=dT(),t=Bb(),n=ya();function r(a){return n(a)?e(a):t(a)}return Kp=r,Kp}var Yp,ww;function hU(){if(ww)return Yp;ww=1;var e=yl(),t=ri();function n(r,a){return r&&e(a,t(a),r)}return Yp=n,Yp}var Qp,Ew;function mU(){if(Ew)return Qp;Ew=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Qp=e,Qp}var Xp,Nw;function yU(){if(Nw)return Xp;Nw=1;var e=yr(),t=sd(),n=mU(),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 Xp=i,Xp}var Zp,Sw;function Di(){if(Sw)return Zp;Sw=1;var e=dT(),t=yU(),n=ya();function r(a){return n(a)?e(a,!0):t(a)}return Zp=r,Zp}var Jp,Cw;function xU(){if(Cw)return Jp;Cw=1;var e=yl(),t=Di();function n(r,a){return r&&e(a,t(a),r)}return Jp=n,Jp}var mo={exports:{}};mo.exports;var jw;function pT(){return jw||(jw=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,p=l?l(f):new u.constructor(f);return u.copy(p),p}e.exports=c}(mo,mo.exports)),mo.exports}var eg,Tw;function gT(){if(Tw)return eg;Tw=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 eg=e,eg}var tg,Aw;function hT(){if(Aw)return tg;Aw=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 tg=e,tg}var ng,Rw;function mT(){if(Rw)return ng;Rw=1;function e(){return[]}return ng=e,ng}var rg,Mw;function zb(){if(Mw)return rg;Mw=1;var e=hT(),t=mT(),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 rg=i,rg}var ag,Iw;function bU(){if(Iw)return ag;Iw=1;var e=yl(),t=zb();function n(r,a){return e(r,t(r),a)}return ag=n,ag}var ig,Lw;function Ub(){if(Lw)return ig;Lw=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 ig=e,ig}var sg,Ow;function od(){if(Ow)return sg;Ow=1;var e=fT(),t=e(Object.getPrototypeOf,Object);return sg=t,sg}var og,Dw;function yT(){if(Dw)return og;Dw=1;var e=Ub(),t=od(),n=zb(),r=mT(),a=Object.getOwnPropertySymbols,i=a?function(s){for(var l=[];s;)e(l,n(s)),s=t(s);return l}:r;return og=i,og}var lg,Pw;function vU(){if(Pw)return lg;Pw=1;var e=yl(),t=yT();function n(r,a){return e(r,t(r),a)}return lg=n,lg}var cg,Fw;function xT(){if(Fw)return cg;Fw=1;var e=Ub(),t=sn();function n(r,a,i){var s=a(r);return t(r)?s:e(s,i(r))}return cg=n,cg}var ug,Bw;function bT(){if(Bw)return ug;Bw=1;var e=xT(),t=zb(),n=ri();function r(a){return e(a,n,t)}return ug=r,ug}var dg,zw;function kU(){if(zw)return dg;zw=1;var e=xT(),t=yT(),n=Di();function r(a){return e(a,n,t)}return dg=r,dg}var fg,Uw;function _U(){if(Uw)return fg;Uw=1;var e=Oi(),t=Ir(),n=e(t,"DataView");return fg=n,fg}var pg,qw;function wU(){if(qw)return pg;qw=1;var e=Oi(),t=Ir(),n=e(t,"Promise");return pg=n,pg}var gg,$w;function vT(){if($w)return gg;$w=1;var e=Oi(),t=Ir(),n=e(t,"Set");return gg=n,gg}var hg,Hw;function EU(){if(Hw)return hg;Hw=1;var e=Oi(),t=Ir(),n=e(t,"WeakMap");return hg=n,hg}var mg,Ww;function zs(){if(Ww)return mg;Ww=1;var e=_U(),t=Lb(),n=wU(),r=vT(),a=EU(),i=Li(),s=cT(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",p="[object DataView]",g=s(e),m=s(t),y=s(n),v=s(r),x=s(a),b=i;return(e&&b(new e(new ArrayBuffer(1)))!=p||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),w=N==c?k.constructor:void 0,_=w?s(w):"";if(_)switch(_){case g:return p;case m:return l;case y:return u;case v:return d;case x:return f}return N}),mg=b,mg}var yg,Vw;function NU(){if(Vw)return yg;Vw=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 yg=n,yg}var xg,Gw;function kT(){if(Gw)return xg;Gw=1;var e=Ir(),t=e.Uint8Array;return xg=t,xg}var bg,Kw;function qb(){if(Kw)return bg;Kw=1;var e=kT();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return bg=t,bg}var vg,Yw;function SU(){if(Yw)return vg;Yw=1;var e=qb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return vg=t,vg}var kg,Qw;function CU(){if(Qw)return kg;Qw=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return kg=t,kg}var _g,Xw;function jU(){if(Xw)return _g;Xw=1;var e=Fs(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return _g=r,_g}var wg,Zw;function _T(){if(Zw)return wg;Zw=1;var e=qb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return wg=t,wg}var Eg,Jw;function TU(){if(Jw)return Eg;Jw=1;var e=qb(),t=SU(),n=CU(),r=jU(),a=_T(),i="[object Boolean]",s="[object Date]",l="[object Map]",c="[object Number]",u="[object RegExp]",d="[object Set]",f="[object String]",p="[object Symbol]",g="[object ArrayBuffer]",m="[object DataView]",y="[object Float32Array]",v="[object Float64Array]",x="[object Int8Array]",b="[object Int16Array]",k="[object Int32Array]",N="[object Uint8Array]",w="[object Uint8ClampedArray]",_="[object Uint16Array]",T="[object Uint32Array]";function A(D,R,$){var F=D.constructor;switch(R){case g:return e(D);case i:case s:return new F(+D);case m:return t(D,$);case y:case v:case x:case b:case k:case N:case w:case _:case T:return a(D,$);case l:return new F;case c:case f:return new F(D);case u:return n(D);case d:return new F;case p:return r(D)}}return Eg=A,Eg}var Ng,e2;function wT(){if(e2)return Ng;e2=1;var e=yr(),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 Ng=n,Ng}var Sg,t2;function ET(){if(t2)return Sg;t2=1;var e=wT(),t=od(),n=sd();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Sg=r,Sg}var Cg,n2;function AU(){if(n2)return Cg;n2=1;var e=zs(),t=Kr(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Cg=r,Cg}var jg,r2;function RU(){if(r2)return jg;r2=1;var e=AU(),t=id(),n=Fb(),r=n&&n.isMap,a=r?t(r):e;return jg=a,jg}var Tg,a2;function MU(){if(a2)return Tg;a2=1;var e=zs(),t=Kr(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return Tg=r,Tg}var Ag,i2;function IU(){if(i2)return Ag;i2=1;var e=MU(),t=id(),n=Fb(),r=n&&n.isSet,a=r?t(r):e;return Ag=a,Ag}var Rg,s2;function NT(){if(s2)return Rg;s2=1;var e=td(),t=Db(),n=rd(),r=hU(),a=xU(),i=pT(),s=gT(),l=bU(),c=vU(),u=bT(),d=kU(),f=zs(),p=NU(),g=TU(),m=ET(),y=sn(),v=Bs(),x=RU(),b=yr(),k=IU(),N=ri(),w=Di(),_=1,T=2,A=4,D="[object Arguments]",R="[object Array]",$="[object Boolean]",F="[object Date]",G="[object Error]",P="[object Function]",M="[object GeneratorFunction]",S="[object Map]",I="[object Number]",B="[object Object]",Q="[object RegExp]",C="[object Set]",K="[object String]",W="[object Symbol]",j="[object WeakMap]",U="[object ArrayBuffer]",le="[object DataView]",Z="[object Float32Array]",ke="[object Float64Array]",re="[object Int8Array]",X="[object Int16Array]",Ne="[object Int32Array]",ve="[object Uint8Array]",me="[object Uint8ClampedArray]",pe="[object Uint16Array]",Le="[object Uint32Array]",Se={};Se[D]=Se[R]=Se[U]=Se[le]=Se[$]=Se[F]=Se[Z]=Se[ke]=Se[re]=Se[X]=Se[Ne]=Se[S]=Se[I]=Se[B]=Se[Q]=Se[C]=Se[K]=Se[W]=Se[ve]=Se[me]=Se[pe]=Se[Le]=!0,Se[G]=Se[P]=Se[j]=!1;function Te(Fe,fe,xe,Ce,ue,he){var _e,Pe=fe&_,Xe=fe&T,H=fe&A;if(xe&&(_e=ue?xe(Fe,Ce,ue,he):xe(Fe)),_e!==void 0)return _e;if(!b(Fe))return Fe;var z=y(Fe);if(z){if(_e=p(Fe),!Pe)return s(Fe,_e)}else{var te=f(Fe),ce=te==P||te==M;if(v(Fe))return i(Fe,Pe);if(te==B||te==D||ce&&!ue){if(_e=Xe||ce?{}:m(Fe),!Pe)return Xe?c(Fe,a(_e,Fe)):l(Fe,r(_e,Fe))}else{if(!Se[te])return ue?Fe:{};_e=g(Fe,te,Pe)}}he||(he=new e);var je=he.get(Fe);if(je)return je;he.set(Fe,_e),k(Fe)?Fe.forEach(function(Ye){_e.add(Te(Ye,fe,xe,Ye,Fe,he))}):x(Fe)&&Fe.forEach(function(Ye,ot){_e.set(ot,Te(Ye,fe,xe,ot,Fe,he))});var Be=H?Xe?d:u:Xe?w:N,Ke=z?void 0:Be(Fe);return t(Ke||Fe,function(Ye,ot){Ke&&(ot=Ye,Ye=Fe[ot]),n(_e,ot,Te(Ye,fe,xe,ot,Fe,he))}),_e}return Rg=Te,Rg}var Mg,o2;function LU(){if(o2)return Mg;o2=1;var e=NT(),t=4;function n(r){return e(r,t)}return Mg=n,Mg}var Ig,l2;function $b(){if(l2)return Ig;l2=1;function e(t){return function(){return t}}return Ig=e,Ig}var Lg,c2;function OU(){if(c2)return Lg;c2=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 Lg=e,Lg}var Og,u2;function Hb(){if(u2)return Og;u2=1;var e=OU(),t=e();return Og=t,Og}var Dg,d2;function Wb(){if(d2)return Dg;d2=1;var e=Hb(),t=ri();function n(r,a){return r&&e(r,a,t)}return Dg=n,Dg}var Pg,f2;function DU(){if(f2)return Pg;f2=1;var e=ya();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 Pg=t,Pg}var Fg,p2;function ld(){if(p2)return Fg;p2=1;var e=Wb(),t=DU(),n=t(e);return Fg=n,Fg}var Bg,g2;function Pi(){if(g2)return Bg;g2=1;function e(t){return t}return Bg=e,Bg}var zg,h2;function ST(){if(h2)return zg;h2=1;var e=Pi();function t(n){return typeof n=="function"?n:e}return zg=t,zg}var Ug,m2;function CT(){if(m2)return Ug;m2=1;var e=Db(),t=ld(),n=ST(),r=sn();function a(i,s){var l=r(i)?e:t;return l(i,n(s))}return Ug=a,Ug}var qg,y2;function jT(){return y2||(y2=1,qg=CT()),qg}var $g,x2;function PU(){if(x2)return $g;x2=1;var e=ld();function t(n,r){var a=[];return e(n,function(i,s,l){r(i,s,l)&&a.push(i)}),a}return $g=t,$g}var Hg,b2;function FU(){if(b2)return Hg;b2=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Hg=t,Hg}var Wg,v2;function BU(){if(v2)return Wg;v2=1;function e(t){return this.__data__.has(t)}return Wg=e,Wg}var Vg,k2;function TT(){if(k2)return Vg;k2=1;var e=Ob(),t=FU(),n=BU();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,Vg=r,Vg}var Gg,_2;function zU(){if(_2)return Gg;_2=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 Gg=e,Gg}var Kg,w2;function AT(){if(w2)return Kg;w2=1;function e(t,n){return t.has(n)}return Kg=e,Kg}var Yg,E2;function RT(){if(E2)return Yg;E2=1;var e=TT(),t=zU(),n=AT(),r=1,a=2;function i(s,l,c,u,d,f){var p=c&r,g=s.length,m=l.length;if(g!=m&&!(p&&m>g))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<g;){var N=s[x],w=l[x];if(u)var _=p?u(w,N,x,l,s,f):u(N,w,x,s,l,f);if(_!==void 0){if(_)continue;b=!1;break}if(k){if(!t(l,function(T,A){if(!n(k,A)&&(N===T||d(N,T,c,u,f)))return k.push(A)})){b=!1;break}}else if(!(N===w||d(N,w,c,u,f))){b=!1;break}}return f.delete(s),f.delete(l),b}return Yg=i,Yg}var Qg,N2;function UU(){if(N2)return Qg;N2=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return Qg=e,Qg}var Xg,S2;function Vb(){if(S2)return Xg;S2=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return Xg=e,Xg}var Zg,C2;function qU(){if(C2)return Zg;C2=1;var e=Fs(),t=kT(),n=Ps(),r=RT(),a=UU(),i=Vb(),s=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",p="[object Number]",g="[object RegExp]",m="[object Set]",y="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",b="[object DataView]",k=e?e.prototype:void 0,N=k?k.valueOf:void 0;function w(_,T,A,D,R,$,F){switch(A){case b:if(_.byteLength!=T.byteLength||_.byteOffset!=T.byteOffset)return!1;_=_.buffer,T=T.buffer;case x:return!(_.byteLength!=T.byteLength||!$(new t(_),new t(T)));case c:case u:case p:return n(+_,+T);case d:return _.name==T.name&&_.message==T.message;case g:case y:return _==T+"";case f:var G=a;case m:var P=D&s;if(G||(G=i),_.size!=T.size&&!P)return!1;var M=F.get(_);if(M)return M==T;D|=l,F.set(_,T);var S=r(G(_),G(T),D,R,$,F);return F.delete(_),S;case v:if(N)return N.call(_)==N.call(T)}return!1}return Zg=w,Zg}var Jg,j2;function $U(){if(j2)return Jg;j2=1;var e=bT(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,s,l,c,u,d){var f=l&t,p=e(i),g=p.length,m=e(s),y=m.length;if(g!=y&&!f)return!1;for(var v=g;v--;){var x=p[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 w=f;++v<g;){x=p[v];var _=i[x],T=s[x];if(c)var A=f?c(T,_,x,s,i,d):c(_,T,x,i,s,d);if(!(A===void 0?_===T||u(_,T,l,c,d):A)){N=!1;break}w||(w=x=="constructor")}if(N&&!w){var D=i.constructor,R=s.constructor;D!=R&&"constructor"in i&&"constructor"in s&&!(typeof D=="function"&&D instanceof D&&typeof R=="function"&&R instanceof R)&&(N=!1)}return d.delete(i),d.delete(s),N}return Jg=a,Jg}var eh,T2;function HU(){if(T2)return eh;T2=1;var e=td(),t=RT(),n=qU(),r=$U(),a=zs(),i=sn(),s=Bs(),l=bl(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",p=Object.prototype,g=p.hasOwnProperty;function m(y,v,x,b,k,N){var w=i(y),_=i(v),T=w?d:a(y),A=_?d:a(v);T=T==u?f:T,A=A==u?f:A;var D=T==f,R=A==f,$=T==A;if($&&s(y)){if(!s(v))return!1;w=!0,D=!1}if($&&!D)return N||(N=new e),w||l(y)?t(y,v,x,b,k,N):n(y,v,T,x,b,k,N);if(!(x&c)){var F=D&&g.call(y,"__wrapped__"),G=R&&g.call(v,"__wrapped__");if(F||G){var P=F?y.value():y,M=G?v.value():v;return N||(N=new e),k(P,M,x,b,N)}}return $?(N||(N=new e),r(y,v,x,b,k,N)):!1}return eh=m,eh}var th,A2;function MT(){if(A2)return th;A2=1;var e=HU(),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 th=n,th}var nh,R2;function WU(){if(R2)return nh;R2=1;var e=td(),t=MT(),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 p=l[u];if(f&&p[2]?p[1]!==i[p[0]]:!(p[0]in i))return!1}for(;++u<d;){p=l[u];var g=p[0],m=i[g],y=p[1];if(f&&p[2]){if(m===void 0&&!(g in i))return!1}else{var v=new e;if(c)var x=c(m,y,g,i,s,v);if(!(x===void 0?t(y,m,n|r,c,v):x))return!1}}return!0}return nh=a,nh}var rh,M2;function IT(){if(M2)return rh;M2=1;var e=yr();function t(n){return n===n&&!e(n)}return rh=t,rh}var ah,I2;function VU(){if(I2)return ah;I2=1;var e=IT(),t=ri();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 ah=n,ah}var ih,L2;function LT(){if(L2)return ih;L2=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return ih=e,ih}var sh,O2;function GU(){if(O2)return sh;O2=1;var e=WU(),t=VU(),n=LT();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 sh=r,sh}var oh,D2;function Us(){if(D2)return oh;D2=1;var e=Li(),t=Kr(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return oh=r,oh}var lh,P2;function Gb(){if(P2)return lh;P2=1;var e=sn(),t=Us(),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 lh=a,lh}var ch,F2;function KU(){if(F2)return ch;F2=1;var e=Ob(),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,ch=n,ch}var uh,B2;function YU(){if(B2)return uh;B2=1;var e=KU(),t=500;function n(r){var a=e(r,function(s){return i.size===t&&i.clear(),s}),i=a.cache;return a}return uh=n,uh}var dh,z2;function QU(){if(z2)return dh;z2=1;var e=YU(),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 dh=r,dh}var fh,U2;function cd(){if(U2)return fh;U2=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 fh=e,fh}var ph,q2;function XU(){if(q2)return ph;q2=1;var e=Fs(),t=cd(),n=sn(),r=Us(),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 ph=s,ph}var gh,$2;function OT(){if($2)return gh;$2=1;var e=XU();function t(n){return n==null?"":e(n)}return gh=t,gh}var hh,H2;function ud(){if(H2)return hh;H2=1;var e=sn(),t=Gb(),n=QU(),r=OT();function a(i,s){return e(i)?i:t(i,s)?[i]:n(r(i))}return hh=a,hh}var mh,W2;function vl(){if(W2)return mh;W2=1;var e=Us();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return mh=t,mh}var yh,V2;function dd(){if(V2)return yh;V2=1;var e=ud(),t=vl();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 yh=n,yh}var xh,G2;function ZU(){if(G2)return xh;G2=1;var e=dd();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return xh=t,xh}var bh,K2;function JU(){if(K2)return bh;K2=1;function e(t,n){return t!=null&&n in Object(t)}return bh=e,bh}var vh,Y2;function DT(){if(Y2)return vh;Y2=1;var e=ud(),t=xl(),n=sn(),r=ad(),a=Pb(),i=vl();function s(l,c,u){c=e(c,l);for(var d=-1,f=c.length,p=!1;++d<f;){var g=i(c[d]);if(!(p=l!=null&&u(l,g)))break;l=l[g]}return p||++d!=f?p:(f=l==null?0:l.length,!!f&&a(f)&&r(g,f)&&(n(l)||t(l)))}return vh=s,vh}var kh,Q2;function PT(){if(Q2)return kh;Q2=1;var e=JU(),t=DT();function n(r,a){return r!=null&&t(r,a,e)}return kh=n,kh}var _h,X2;function eq(){if(X2)return _h;X2=1;var e=MT(),t=ZU(),n=PT(),r=Gb(),a=IT(),i=LT(),s=vl(),l=1,c=2;function u(d,f){return r(d)&&a(f)?i(s(d),f):function(p){var g=t(p,d);return g===void 0&&g===f?n(p,d):e(f,g,l|c)}}return _h=u,_h}var wh,Z2;function FT(){if(Z2)return wh;Z2=1;function e(t){return function(n){return n==null?void 0:n[t]}}return wh=e,wh}var Eh,J2;function tq(){if(J2)return Eh;J2=1;var e=dd();function t(n){return function(r){return e(r,n)}}return Eh=t,Eh}var Nh,eE;function nq(){if(eE)return Nh;eE=1;var e=FT(),t=tq(),n=Gb(),r=vl();function a(i){return n(i)?e(r(i)):t(i)}return Nh=a,Nh}var Sh,tE;function xa(){if(tE)return Sh;tE=1;var e=GU(),t=eq(),n=Pi(),r=sn(),a=nq();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 Sh=i,Sh}var Ch,nE;function BT(){if(nE)return Ch;nE=1;var e=hT(),t=PU(),n=xa(),r=sn();function a(i,s){var l=r(i)?e:t;return l(i,n(s,3))}return Ch=a,Ch}var jh,rE;function rq(){if(rE)return jh;rE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return jh=n,jh}var Th,aE;function zT(){if(aE)return Th;aE=1;var e=rq(),t=DT();function n(r,a){return r!=null&&t(r,a,e)}return Th=n,Th}var Ah,iE;function aq(){if(iE)return Ah;iE=1;var e=Bb(),t=zs(),n=xl(),r=sn(),a=ya(),i=Bs(),s=sd(),l=bl(),c="[object Map]",u="[object Set]",d=Object.prototype,f=d.hasOwnProperty;function p(g){if(g==null)return!0;if(a(g)&&(r(g)||typeof g=="string"||typeof g.splice=="function"||i(g)||l(g)||n(g)))return!g.length;var m=t(g);if(m==c||m==u)return!g.size;if(s(g))return!e(g).length;for(var y in g)if(f.call(g,y))return!1;return!0}return Ah=p,Ah}var Rh,sE;function UT(){if(sE)return Rh;sE=1;function e(t){return t===void 0}return Rh=e,Rh}var Mh,oE;function qT(){if(oE)return Mh;oE=1;var e=ld(),t=ya();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 Mh=n,Mh}var Ih,lE;function $T(){if(lE)return Ih;lE=1;var e=cd(),t=xa(),n=qT(),r=sn();function a(i,s){var l=r(i)?e:n;return l(i,t(s,3))}return Ih=a,Ih}var Lh,cE;function iq(){if(cE)return Lh;cE=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 Lh=e,Lh}var Oh,uE;function sq(){if(uE)return Oh;uE=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 Oh=e,Oh}var Dh,dE;function HT(){if(dE)return Dh;dE=1;var e=iq(),t=ld(),n=xa(),r=sq(),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 Dh=i,Dh}var Ph,fE;function oq(){if(fE)return Ph;fE=1;var e=Li(),t=sn(),n=Kr(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return Ph=a,Ph}var Fh,pE;function lq(){if(pE)return Fh;pE=1;var e=FT(),t=e("length");return Fh=t,Fh}var Bh,gE;function cq(){if(gE)return Bh;gE=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 Bh=c,Bh}var zh,hE;function uq(){if(hE)return zh;hE=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}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",m=u+"?",y="["+i+"]?",v="(?:"+g+"(?:"+[d,f,p].join("|")+")"+y+m+")*",x=y+m+v,b="(?:"+[d+l+"?",l,f,p,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+b+x,"g");function N(w){for(var _=k.lastIndex=0;k.test(w);)++_;return _}return zh=N,zh}var Uh,mE;function dq(){if(mE)return Uh;mE=1;var e=lq(),t=cq(),n=uq();function r(a){return t(a)?n(a):e(a)}return Uh=r,Uh}var qh,yE;function fq(){if(yE)return qh;yE=1;var e=Bb(),t=zs(),n=ya(),r=oq(),a=dq(),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 qh=l,qh}var $h,xE;function pq(){if(xE)return $h;xE=1;var e=Db(),t=wT(),n=Wb(),r=xa(),a=od(),i=sn(),s=Bs(),l=ml(),c=yr(),u=bl();function d(f,p,g){var m=i(f),y=m||s(f)||u(f);if(p=r(p,4),g==null){var v=f&&f.constructor;y?g=m?new v:[]:c(f)?g=l(v)?t(a(f)):{}:g={}}return(y?e:n)(f,function(x,b,k){return p(g,x,b,k)}),g}return $h=d,$h}var Hh,bE;function gq(){if(bE)return Hh;bE=1;var e=Fs(),t=xl(),n=sn(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return Hh=a,Hh}var Wh,vE;function Kb(){if(vE)return Wh;vE=1;var e=Ub(),t=gq();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 Wh=n,Wh}var Vh,kE;function hq(){if(kE)return Vh;kE=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 Vh=e,Vh}var Gh,_E;function WT(){if(_E)return Gh;_E=1;var e=hq(),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 Gh=n,Gh}var Kh,wE;function mq(){if(wE)return Kh;wE=1;var e=$b(),t=uT(),n=Pi(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Kh=r,Kh}var Yh,EE;function yq(){if(EE)return Yh;EE=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 Yh=r,Yh}var Qh,NE;function VT(){if(NE)return Qh;NE=1;var e=mq(),t=yq(),n=t(e);return Qh=n,Qh}var Xh,SE;function fd(){if(SE)return Xh;SE=1;var e=Pi(),t=WT(),n=VT();function r(a,i){return n(t(a,i,e),a+"")}return Xh=r,Xh}var Zh,CE;function GT(){if(CE)return Zh;CE=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 Zh=e,Zh}var Jh,jE;function xq(){if(jE)return Jh;jE=1;function e(t){return t!==t}return Jh=e,Jh}var em,TE;function bq(){if(TE)return em;TE=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 em=e,em}var tm,AE;function vq(){if(AE)return tm;AE=1;var e=GT(),t=xq(),n=bq();function r(a,i,s){return i===i?n(a,i,s):e(a,t,s)}return tm=r,tm}var nm,RE;function kq(){if(RE)return nm;RE=1;var e=vq();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return nm=t,nm}var rm,ME;function _q(){if(ME)return rm;ME=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 rm=e,rm}var am,IE;function wq(){if(IE)return am;IE=1;function e(){}return am=e,am}var im,LE;function Eq(){if(LE)return im;LE=1;var e=vT(),t=wq(),n=Vb(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return im=a,im}var sm,OE;function Nq(){if(OE)return sm;OE=1;var e=TT(),t=kq(),n=_q(),r=AT(),a=Eq(),i=Vb(),s=200;function l(c,u,d){var f=-1,p=t,g=c.length,m=!0,y=[],v=y;if(d)m=!1,p=n;else if(g>=s){var x=u?null:a(c);if(x)return i(x);m=!1,p=r,v=new e}else v=u?[]:y;e:for(;++f<g;){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 p(v,k,d)||(v!==y&&v.push(k),y.push(b))}return y}return sm=l,sm}var om,DE;function KT(){if(DE)return om;DE=1;var e=ya(),t=Kr();function n(r){return t(r)&&e(r)}return om=n,om}var lm,PE;function Sq(){if(PE)return lm;PE=1;var e=Kb(),t=fd(),n=Nq(),r=KT(),a=t(function(i){return n(e(i,1,r,!0))});return lm=a,lm}var cm,FE;function Cq(){if(FE)return cm;FE=1;var e=cd();function t(n,r){return e(r,function(a){return n[a]})}return cm=t,cm}var um,BE;function YT(){if(BE)return um;BE=1;var e=Cq(),t=ri();function n(r){return r==null?[]:e(r,t(r))}return um=n,um}var dm,zE;function xr(){if(zE)return dm;zE=1;var e;if(typeof Ib=="function")try{e={clone:LU(),constant:$b(),each:jT(),filter:BT(),has:zT(),isArray:sn(),isEmpty:aq(),isFunction:ml(),isUndefined:UT(),keys:ri(),map:$T(),reduce:HT(),size:fq(),transform:pq(),union:Sq(),values:YT()}}catch{}return e||(e=window._),dm=e,dm}var fm,UE;function Yb(){if(UE)return fm;UE=1;var e=xr();fm=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 p=arguments,g=this;return e.each(d,function(m){p.length>1?g.setNode(m,f):g.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 p=function(g){f.removeEdge(f._edgeObjs[g])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(g){f.setParent(g)}),delete this._children[d]),e.each(e.keys(this._in[d]),p),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),p),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 p=f;!e.isUndefined(p);p=this.parent(p))if(p===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 p=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,p.edge(y))});var g={};function m(y){var v=p.parent(y);return v===void 0||f.hasNode(v)?(g[y]=v,v):v in g?g[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 p=this,g=arguments;return e.reduce(d,function(m,y){return g.length>1?p.setEdge(m,y,f):p.setEdge(m,y),y}),this},a.prototype.setEdge=function(){var d,f,p,g,m=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(d=y.v,f=y.w,p=y.name,arguments.length===2&&(g=arguments[1],m=!0)):(d=y,f=arguments[1],p=arguments[3],arguments.length>2&&(g=arguments[2],m=!0)),d=""+d,f=""+f,e.isUndefined(p)||(p=""+p);var v=l(this._isDirected,d,f,p);if(e.has(this._edgeLabels,v))return m&&(this._edgeLabels[v]=g),this;if(!e.isUndefined(p)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(f),this._edgeLabels[v]=m?g:this._defaultEdgeLabelFn(d,f,p);var x=c(this._isDirected,d,f,p);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,p){var g=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,p);return this._edgeLabels[g]},a.prototype.hasEdge=function(d,f,p){var g=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,p);return e.has(this._edgeLabels,g)},a.prototype.removeEdge=function(d,f,p){var g=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,p),m=this._edgeObjs[g];return m&&(d=m.v,f=m.w,delete this._edgeLabels[g],delete this._edgeObjs[g],s(this._preds[f],d),s(this._sucs[d],f),delete this._in[f][g],delete this._out[d][g],this._edgeCount--),this},a.prototype.inEdges=function(d,f){var p=this._in[d];if(p){var g=e.values(p);return f?e.filter(g,function(m){return m.v===f}):g}},a.prototype.outEdges=function(d,f){var p=this._out[d];if(p){var g=e.values(p);return f?e.filter(g,function(m){return m.w===f}):g}},a.prototype.nodeEdges=function(d,f){var p=this.inEdges(d,f);if(p)return p.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,p,g){var m=""+f,y=""+p;if(!d&&m>y){var v=m;m=y,y=v}return m+r+y+r+(e.isUndefined(g)?t:g)}function c(d,f,p,g){var m=""+f,y=""+p;if(!d&&m>y){var v=m;m=y,y=v}var x={v:m,w:y};return g&&(x.name=g),x}function u(d,f){return l(d,f.v,f.w,f.name)}return fm}var pm,qE;function jq(){return qE||(qE=1,pm="2.1.8"),pm}var gm,$E;function Tq(){return $E||($E=1,gm={Graph:Yb(),version:jq()}),gm}var hm,HE;function Aq(){if(HE)return hm;HE=1;var e=xr(),t=Yb();hm={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 hm}var mm,WE;function Rq(){if(WE)return mm;WE=1;var e=xr();mm=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 mm}var ym,VE;function QT(){if(VE)return ym;VE=1;var e=xr();ym=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},ym}var xm,GE;function XT(){if(GE)return xm;GE=1;var e=xr(),t=QT();xm=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,p,g=function(m){var y=m.v!==f?m.v:m.w,v=u[y],x=l(m),b=p.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(),p=u[f],p.distance!==Number.POSITIVE_INFINITY);)c(f).forEach(g);return u}return xm}var bm,KE;function Mq(){if(KE)return bm;KE=1;var e=XT(),t=xr();bm=n;function n(r,a,i){return t.transform(r.nodes(),function(s,l){s[l]=e(r,l,a,i)},{})}return bm}var vm,YE;function ZT(){if(YE)return vm;YE=1;var e=xr();vm=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(p){e.has(i,p)?i[p].onStack&&(u.lowlink=Math.min(u.lowlink,i[p].index)):(l(p),u.lowlink=Math.min(u.lowlink,i[p].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 vm}var km,QE;function Iq(){if(QE)return km;QE=1;var e=xr(),t=ZT();km=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 km}var _m,XE;function Lq(){if(XE)return _m;XE=1;var e=xr();_m=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,p=i(d);l[u][f]={distance:p,predecessor:u}})}),c.forEach(function(u){var d=l[u];c.forEach(function(f){var p=l[f];c.forEach(function(g){var m=p[u],y=d[g],v=p[g],x=m.distance+y.distance;x<v.distance&&(v.distance=x,v.predecessor=y.predecessor)})})}),l}return _m}var wm,ZE;function JT(){if(ZE)return wm;ZE=1;var e=xr();wm=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,wm}var Em,JE;function Oq(){if(JE)return Em;JE=1;var e=JT();Em=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Em}var Nm,eN;function eA(){if(eN)return Nm;eN=1;var e=xr();Nm=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 Nm}var Sm,tN;function Dq(){if(tN)return Sm;tN=1;var e=eA();Sm=t;function t(n,r){return e(n,r,"post")}return Sm}var Cm,nN;function Pq(){if(nN)return Cm;nN=1;var e=eA();Cm=t;function t(n,r){return e(n,r,"pre")}return Cm}var jm,rN;function Fq(){if(rN)return jm;rN=1;var e=xr(),t=Yb(),n=QT();jm=r;function r(a,i){var s=new t,l={},c=new n,u;function d(p){var g=p.v===u?p.w:p.v,m=c.priority(g);if(m!==void 0){var y=i(p);y<m&&(l[g]=u,c.decrease(g,y))}}if(a.nodeCount()===0)return s;e.each(a.nodes(),function(p){c.add(p,Number.POSITIVE_INFINITY),s.setNode(p)}),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 jm}var Tm,aN;function Bq(){return aN||(aN=1,Tm={components:Rq(),dijkstra:XT(),dijkstraAll:Mq(),findCycles:Iq(),floydWarshall:Lq(),isAcyclic:Oq(),postorder:Dq(),preorder:Pq(),prim:Fq(),tarjan:ZT(),topsort:JT()}),Tm}var Am,iN;function zq(){if(iN)return Am;iN=1;var e=Tq();return Am={Graph:e.Graph,json:Aq(),alg:Bq(),version:e.version},Am}var bu;if(typeof Ib=="function")try{bu=zq()}catch{}bu||(bu=window.graphlib);var Lr=bu,Rm,sN;function Uq(){if(sN)return Rm;sN=1;var e=NT(),t=1,n=4;function r(a){return e(a,t|n)}return Rm=r,Rm}var Mm,oN;function pd(){if(oN)return Mm;oN=1;var e=Ps(),t=ya(),n=ad(),r=yr();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 Mm=a,Mm}var Im,lN;function qq(){if(lN)return Im;lN=1;var e=fd(),t=Ps(),n=pd(),r=Di(),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 p=c[u],g=r(p),m=-1,y=g.length;++m<y;){var v=g[m],x=l[v];(x===void 0||t(x,a[v])&&!i.call(l,v))&&(l[v]=p[v])}return l});return Im=s,Im}var Lm,cN;function $q(){if(cN)return Lm;cN=1;var e=xa(),t=ya(),n=ri();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 Lm=r,Lm}var Om,uN;function Hq(){if(uN)return Om;uN=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Om=t,Om}var Dm,dN;function Wq(){if(dN)return Dm;dN=1;var e=Hq(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Dm=n,Dm}var Pm,fN;function Vq(){if(fN)return Pm;fN=1;var e=Wq(),t=yr(),n=Us(),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 Pm=c,Pm}var Fm,pN;function tA(){if(pN)return Fm;pN=1;var e=Vq(),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 Fm=r,Fm}var Bm,gN;function Gq(){if(gN)return Bm;gN=1;var e=tA();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return Bm=t,Bm}var zm,hN;function Kq(){if(hN)return zm;hN=1;var e=GT(),t=xa(),n=Gq(),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 zm=a,zm}var Um,mN;function Yq(){if(mN)return Um;mN=1;var e=$q(),t=Kq(),n=e(t);return Um=n,Um}var qm,yN;function nA(){if(yN)return qm;yN=1;var e=Kb();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return qm=t,qm}var $m,xN;function Qq(){if(xN)return $m;xN=1;var e=Hb(),t=ST(),n=Di();function r(a,i){return a==null?a:e(a,t(i),n)}return $m=r,$m}var Hm,bN;function Xq(){if(bN)return Hm;bN=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Hm=e,Hm}var Wm,vN;function Zq(){if(vN)return Wm;vN=1;var e=nd(),t=Wb(),n=xa();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 Wm=r,Wm}var Vm,kN;function Qb(){if(kN)return Vm;kN=1;var e=Us();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 Vm=t,Vm}var Gm,_N;function Jq(){if(_N)return Gm;_N=1;function e(t,n){return t>n}return Gm=e,Gm}var Km,wN;function e$(){if(wN)return Km;wN=1;var e=Qb(),t=Jq(),n=Pi();function r(a){return a&&a.length?e(a,n,t):void 0}return Km=r,Km}var Ym,EN;function rA(){if(EN)return Ym;EN=1;var e=nd(),t=Ps();function n(r,a,i){(i!==void 0&&!t(r[a],i)||i===void 0&&!(a in r))&&e(r,a,i)}return Ym=n,Ym}var Qm,NN;function t$(){if(NN)return Qm;NN=1;var e=Li(),t=od(),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 p=l.call(f,"constructor")&&f.constructor;return typeof p=="function"&&p instanceof p&&s.call(p)==c}return Qm=u,Qm}var Xm,SN;function aA(){if(SN)return Xm;SN=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Xm=e,Xm}var Zm,CN;function n$(){if(CN)return Zm;CN=1;var e=yl(),t=Di();function n(r){return e(r,t(r))}return Zm=n,Zm}var Jm,jN;function r$(){if(jN)return Jm;jN=1;var e=rA(),t=pT(),n=_T(),r=gT(),a=ET(),i=xl(),s=sn(),l=KT(),c=Bs(),u=ml(),d=yr(),f=t$(),p=bl(),g=aA(),m=n$();function y(v,x,b,k,N,w,_){var T=g(v,b),A=g(x,b),D=_.get(A);if(D){e(v,b,D);return}var R=w?w(T,A,b+"",v,x,_):void 0,$=R===void 0;if($){var F=s(A),G=!F&&c(A),P=!F&&!G&&p(A);R=A,F||G||P?s(T)?R=T:l(T)?R=r(T):G?($=!1,R=t(A,!0)):P?($=!1,R=n(A,!0)):R=[]:f(A)||i(A)?(R=T,i(T)?R=m(T):(!d(T)||u(T))&&(R=a(A))):$=!1}$&&(_.set(A,R),N(R,A,k,w,_),_.delete(A)),e(v,b,R)}return Jm=y,Jm}var e0,TN;function a$(){if(TN)return e0;TN=1;var e=td(),t=rA(),n=Hb(),r=r$(),a=yr(),i=Di(),s=aA();function l(c,u,d,f,p){c!==u&&n(u,function(g,m){if(p||(p=new e),a(g))r(c,u,m,d,l,f,p);else{var y=f?f(s(c,m),g,m+"",c,u,p):void 0;y===void 0&&(y=g),t(c,m,y)}},i)}return e0=l,e0}var t0,AN;function i$(){if(AN)return t0;AN=1;var e=fd(),t=pd();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 t0=n,t0}var n0,RN;function s$(){if(RN)return n0;RN=1;var e=a$(),t=i$(),n=t(function(r,a,i){e(r,a,i)});return n0=n,n0}var r0,MN;function iA(){if(MN)return r0;MN=1;function e(t,n){return t<n}return r0=e,r0}var a0,IN;function o$(){if(IN)return a0;IN=1;var e=Qb(),t=iA(),n=Pi();function r(a){return a&&a.length?e(a,n,t):void 0}return a0=r,a0}var i0,LN;function l$(){if(LN)return i0;LN=1;var e=Qb(),t=xa(),n=iA();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return i0=r,i0}var s0,ON;function c$(){if(ON)return s0;ON=1;var e=Ir(),t=function(){return e.Date.now()};return s0=t,s0}var o0,DN;function u$(){if(DN)return o0;DN=1;var e=rd(),t=ud(),n=ad(),r=yr(),a=vl();function i(s,l,c,u){if(!r(s))return s;l=t(l,s);for(var d=-1,f=l.length,p=f-1,g=s;g!=null&&++d<f;){var m=a(l[d]),y=c;if(m==="__proto__"||m==="constructor"||m==="prototype")return s;if(d!=p){var v=g[m];y=u?u(v,m,g):void 0,y===void 0&&(y=r(v)?v:n(l[d+1])?[]:{})}e(g,m,y),g=g[m]}return s}return o0=i,o0}var l0,PN;function d$(){if(PN)return l0;PN=1;var e=dd(),t=u$(),n=ud();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 l0=r,l0}var c0,FN;function f$(){if(FN)return c0;FN=1;var e=d$(),t=PT();function n(r,a){return e(r,a,function(i,s){return t(r,s)})}return c0=n,c0}var u0,BN;function p$(){if(BN)return u0;BN=1;var e=nA(),t=WT(),n=VT();function r(a){return n(t(a,void 0,e),a+"")}return u0=r,u0}var d0,zN;function g$(){if(zN)return d0;zN=1;var e=f$(),t=p$(),n=t(function(r,a){return r==null?{}:e(r,a)});return d0=n,d0}var f0,UN;function h$(){if(UN)return f0;UN=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 f0=n,f0}var p0,qN;function m$(){if(qN)return p0;qN=1;var e=h$(),t=pd(),n=tA();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 p0=r,p0}var g0,$N;function y$(){if($N)return g0;$N=1;var e=m$(),t=e();return g0=t,g0}var h0,HN;function x$(){if(HN)return h0;HN=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return h0=e,h0}var m0,WN;function b$(){if(WN)return m0;WN=1;var e=Us();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 m0=t,m0}var y0,VN;function v$(){if(VN)return y0;VN=1;var e=b$();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 y0=t,y0}var x0,GN;function k$(){if(GN)return x0;GN=1;var e=cd(),t=dd(),n=xa(),r=qT(),a=x$(),i=id(),s=v$(),l=Pi(),c=sn();function u(d,f,p){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 g=-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:++g,value:y}});return a(m,function(y,v){return s(y,v,p)})}return x0=u,x0}var b0,KN;function _$(){if(KN)return b0;KN=1;var e=Kb(),t=k$(),n=fd(),r=pd(),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 b0=a,b0}var v0,YN;function w$(){if(YN)return v0;YN=1;var e=OT(),t=0;function n(r){var a=++t;return e(r)+a}return v0=n,v0}var k0,QN;function E$(){if(QN)return k0;QN=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 k0=e,k0}var _0,XN;function N$(){if(XN)return _0;XN=1;var e=rd(),t=E$();function n(r,a){return t(r||[],a||[],e)}return _0=n,_0}var vu;if(typeof Ib=="function")try{vu={cloneDeep:Uq(),constant:$b(),defaults:qq(),each:jT(),filter:BT(),find:Yq(),flatten:nA(),forEach:CT(),forIn:Qq(),has:zT(),isUndefined:UT(),last:Xq(),map:$T(),mapValues:Zq(),max:e$(),merge:s$(),min:o$(),minBy:l$(),now:c$(),pick:g$(),range:y$(),reduce:HT(),sortBy:_$(),uniqueId:w$(),values:YT(),zipObject:N$()}}catch{}vu||(vu=window._);var Wt=vu,S$=gd;function gd(){var e={};e._next=e._prev=e,this._sentinel=e}gd.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return sA(t),t};gd.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&sA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t};gd.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,C$)),n=n._prev;return"["+e.join(", ")+"]"};function sA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function C$(e,t){if(e!=="_next"&&e!=="_prev")return t}var sa=Wt,j$=Lr.Graph,T$=S$,A$=M$,R$=sa.constant(1);function M$(e,t){if(e.nodeCount()<=1)return[];var n=L$(e,t||R$),r=I$(n.graph,n.buckets,n.zeroIdx);return sa.flatten(sa.map(r,function(a){return e.outEdges(a.v,a.w)}),!0)}function I$(e,t,n){for(var r=[],a=t[t.length-1],i=t[0],s;e.nodeCount();){for(;s=i.dequeue();)w0(e,t,n,s);for(;s=a.dequeue();)w0(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(w0(e,t,n,s,!0));break}}}return r}function w0(e,t,n,r,a){var i=a?[]:void 0;return sa.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,rx(t,n,c)}),sa.forEach(e.outEdges(r.v),function(s){var l=e.edge(s),c=s.w,u=e.node(c);u.in-=l,rx(t,n,u)}),e.removeNode(r.v),i}function L$(e,t){var n=new j$,r=0,a=0;sa.forEach(e.nodes(),function(l){n.setNode(l,{v:l,in:0,out:0})}),sa.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=sa.range(a+r+3).map(function(){return new T$}),s=r+1;return sa.forEach(n.nodes(),function(l){rx(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function rx(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 yi=Wt,O$=A$,D$={run:P$,undo:B$};function P$(e){var t=e.graph().acyclicer==="greedy"?O$(e,n(e)):F$(e);yi.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,yi.uniqueId("rev"))});function n(r){return function(a){return r.edge(a).weight}}}function F$(e){var t=[],n={},r={};function a(i){yi.has(r,i)||(r[i]=!0,n[i]=!0,yi.forEach(e.outEdges(i),function(s){yi.has(n,s.w)?t.push(s):a(s.w)}),delete n[i])}return yi.forEach(e.nodes(),a),t}function B$(e){yi.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 St=Wt,oA=Lr.Graph,Vn={addDummyNode:lA,simplify:z$,asNonCompoundGraph:U$,successorWeights:q$,predecessorWeights:$$,intersectRect:H$,buildLayerMatrix:W$,normalizeRanks:V$,removeEmptyRanks:G$,addBorderNode:K$,maxRank:cA,partition:Y$,time:Q$,notime:X$};function lA(e,t,n,r){var a;do a=St.uniqueId(r);while(e.hasNode(a));return n.dummy=t,e.setNode(a,n),a}function z$(e){var t=new oA().setGraph(e.graph());return St.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),St.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 U$(e){var t=new oA({multigraph:e.isMultigraph()}).setGraph(e.graph());return St.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),St.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function q$(e){var t=St.map(e.nodes(),function(n){var r={};return St.forEach(e.outEdges(n),function(a){r[a.w]=(r[a.w]||0)+e.edge(a).weight}),r});return St.zipObject(e.nodes(),t)}function $$(e){var t=St.map(e.nodes(),function(n){var r={};return St.forEach(e.inEdges(n),function(a){r[a.v]=(r[a.v]||0)+e.edge(a).weight}),r});return St.zipObject(e.nodes(),t)}function H$(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 W$(e){var t=St.map(St.range(cA(e)+1),function(){return[]});return St.forEach(e.nodes(),function(n){var r=e.node(n),a=r.rank;St.isUndefined(a)||(t[a][r.order]=n)}),t}function V$(e){var t=St.min(St.map(e.nodes(),function(n){return e.node(n).rank}));St.forEach(e.nodes(),function(n){var r=e.node(n);St.has(r,"rank")&&(r.rank-=t)})}function G$(e){var t=St.min(St.map(e.nodes(),function(i){return e.node(i).rank})),n=[];St.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;St.forEach(n,function(i,s){St.isUndefined(i)&&s%a!==0?--r:r&&St.forEach(i,function(l){e.node(l).rank+=r})})}function K$(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),lA(e,"border",a,t)}function cA(e){return St.max(St.map(e.nodes(),function(t){var n=e.node(t).rank;if(!St.isUndefined(n))return n}))}function Y$(e,t){var n={lhs:[],rhs:[]};return St.forEach(e,function(r){t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Q$(e,t){var n=St.now();try{return t()}finally{console.log(e+" time: "+(St.now()-n)+"ms")}}function X$(e,t){return t()}var uA=Wt,Z$=Vn,J$={run:eH,undo:nH};function eH(e){e.graph().dummyChains=[],uA.forEach(e.edges(),function(t){tH(e,t)})}function tH(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=Z$.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 nH(e){uA.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 mc=Wt,hd={longestPath:rH,slack:aH};function rH(e){var t={};function n(r){var a=e.node(r);if(mc.has(t,r))return a.rank;t[r]=!0;var i=mc.min(mc.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}mc.forEach(e.sources(),n)}function aH(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var ku=Wt,iH=Lr.Graph,_u=hd.slack,dA=sH;function sH(e){var t=new iH({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var a,i;oH(t,e)<r;)a=lH(t,e),i=t.hasNode(a.v)?_u(e,a):-_u(e,a),cH(t,e,i);return t}function oH(e,t){function n(r){ku.forEach(t.nodeEdges(r),function(a){var i=a.v,s=r===i?a.w:i;!e.hasNode(s)&&!_u(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return ku.forEach(e.nodes(),n),e.nodeCount()}function lH(e,t){return ku.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return _u(t,n)})}function cH(e,t,n){ku.forEach(e.nodes(),function(r){t.node(r).rank+=n})}var ga=Wt,uH=dA,dH=hd.slack,fH=hd.longestPath,pH=Lr.alg.preorder,gH=Lr.alg.postorder,hH=Vn.simplify,mH=Fi;Fi.initLowLimValues=Zb;Fi.initCutValues=Xb;Fi.calcCutValue=fA;Fi.leaveEdge=gA;Fi.enterEdge=hA;Fi.exchangeEdges=mA;function Fi(e){e=hH(e),fH(e);var t=uH(e);Zb(t),Xb(t,e);for(var n,r;n=gA(t);)r=hA(t,e,n),mA(t,e,n,r)}function Xb(e,t){var n=gH(e,e.nodes());n=n.slice(0,n.length-1),ga.forEach(n,function(r){yH(e,t,r)})}function yH(e,t,n){var r=e.node(n),a=r.parent;e.edge(n,a).cutvalue=fA(e,t,n)}function fA(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,ga.forEach(t.nodeEdges(n),function(c){var u=c.v===n,d=u?c.w:c.v;if(d!==a){var f=u===i,p=t.edge(c).weight;if(l+=f?p:-p,bH(e,n,d)){var g=e.edge(n,d).cutvalue;l+=f?-g:g}}}),l}function Zb(e,t){arguments.length<2&&(t=e.nodes()[0]),pA(e,{},1,t)}function pA(e,t,n,r,a){var i=n,s=e.node(r);return t[r]=!0,ga.forEach(e.neighbors(r),function(l){ga.has(t,l)||(n=pA(e,t,n,l,r))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}function gA(e){return ga.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function hA(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=ga.filter(t.edges(),function(d){return c===ZN(e,e.node(d.v),l)&&c!==ZN(e,e.node(d.w),l)});return ga.minBy(u,function(d){return dH(t,d)})}function mA(e,t,n,r){var a=n.v,i=n.w;e.removeEdge(a,i),e.setEdge(r.v,r.w,{}),Zb(e),Xb(e,t),xH(e,t)}function xH(e,t){var n=ga.find(e.nodes(),function(a){return!t.node(a).parent}),r=pH(e,n);r=r.slice(1),ga.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 bH(e,t,n){return e.hasEdge(t,n)}function ZN(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var vH=hd,yA=vH.longestPath,kH=dA,_H=mH,wH=EH;function EH(e){switch(e.graph().ranker){case"network-simplex":JN(e);break;case"tight-tree":SH(e);break;case"longest-path":NH(e);break;default:JN(e)}}var NH=yA;function SH(e){yA(e),kH(e)}function JN(e){_H(e)}var ax=Wt,CH=jH;function jH(e){var t=AH(e);ax.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=TH(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 TH(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 AH(e){var t={},n=0;function r(a){var i=n;ax.forEach(e.children(a),r),t[a]={low:i,lim:n++}}return ax.forEach(e.children(),r),t}var oa=Wt,ix=Vn,RH={run:MH,cleanup:OH};function MH(e){var t=ix.addDummyNode(e,"root",{},"_root"),n=IH(e),r=oa.max(oa.values(n))-1,a=2*r+1;e.graph().nestingRoot=t,oa.forEach(e.edges(),function(s){e.edge(s).minlen*=a});var i=LH(e)+1;oa.forEach(e.children(),function(s){xA(e,t,a,i,r,n,s)}),e.graph().nodeRankFactor=a}function xA(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=ix.addBorderNode(e,"_bt"),u=ix.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(c,s),d.borderTop=c,e.setParent(u,s),d.borderBottom=u,oa.forEach(l,function(f){xA(e,t,n,r,a,i,f);var p=e.node(f),g=p.borderTop?p.borderTop:f,m=p.borderBottom?p.borderBottom:f,y=p.borderTop?r:2*r,v=g!==m?1:a-i[s]+1;e.setEdge(c,g,{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 IH(e){var t={};function n(r,a){var i=e.children(r);i&&i.length&&oa.forEach(i,function(s){n(s,a+1)}),t[r]=a}return oa.forEach(e.children(),function(r){n(r,1)}),t}function LH(e){return oa.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function OH(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,oa.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}var E0=Wt,DH=Vn,PH=FH;function FH(e){function t(n){var r=e.children(n),a=e.node(n);if(r.length&&E0.forEach(r,t),E0.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,s=a.maxRank+1;i<s;++i)eS(e,"borderLeft","_bl",n,a,i),eS(e,"borderRight","_br",n,a,i)}}E0.forEach(e.children(),t)}function eS(e,t,n,r,a,i){var s={width:0,height:0,rank:i,borderType:t},l=a[t][i-1],c=DH.addDummyNode(e,"border",s,n);a[t][i]=c,e.setParent(c,r),l&&e.setEdge(l,c,{weight:1})}var $r=Wt,BH={adjust:zH,undo:UH};function zH(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&bA(e)}function UH(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&qH(e),(t==="lr"||t==="rl")&&($H(e),bA(e))}function bA(e){$r.forEach(e.nodes(),function(t){tS(e.node(t))}),$r.forEach(e.edges(),function(t){tS(e.edge(t))})}function tS(e){var t=e.width;e.width=e.height,e.height=t}function qH(e){$r.forEach(e.nodes(),function(t){N0(e.node(t))}),$r.forEach(e.edges(),function(t){var n=e.edge(t);$r.forEach(n.points,N0),$r.has(n,"y")&&N0(n)})}function N0(e){e.y=-e.y}function $H(e){$r.forEach(e.nodes(),function(t){S0(e.node(t))}),$r.forEach(e.edges(),function(t){var n=e.edge(t);$r.forEach(n.points,S0),$r.has(n,"x")&&S0(n)})}function S0(e){var t=e.x;e.x=e.y,e.y=t}var ta=Wt,HH=WH;function WH(e){var t={},n=ta.filter(e.nodes(),function(l){return!e.children(l).length}),r=ta.max(ta.map(n,function(l){return e.node(l).rank})),a=ta.map(ta.range(r+1),function(){return[]});function i(l){if(!ta.has(t,l)){t[l]=!0;var c=e.node(l);a[c.rank].push(l),ta.forEach(e.successors(l),i)}}var s=ta.sortBy(n,function(l){return e.node(l).rank});return ta.forEach(s,i),a}var Ca=Wt,VH=GH;function GH(e,t){for(var n=0,r=1;r<t.length;++r)n+=KH(e,t[r-1],t[r]);return n}function KH(e,t,n){for(var r=Ca.zipObject(n,Ca.map(n,function(u,d){return d})),a=Ca.flatten(Ca.map(t,function(u){return Ca.sortBy(Ca.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=Ca.map(new Array(s),function(){return 0}),c=0;return Ca.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 nS=Wt,YH=QH;function QH(e,t){return nS.map(t,function(n){var r=e.inEdges(n);if(r.length){var a=nS.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 er=Wt,XH=ZH;function ZH(e,t){var n={};er.forEach(e,function(a,i){var s=n[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};er.isUndefined(a.barycenter)||(s.barycenter=a.barycenter,s.weight=a.weight)}),er.forEach(t.edges(),function(a){var i=n[a.v],s=n[a.w];!er.isUndefined(i)&&!er.isUndefined(s)&&(s.indegree++,i.out.push(n[a.w]))});var r=er.filter(n,function(a){return!a.indegree});return JH(r)}function JH(e){var t=[];function n(i){return function(s){s.merged||(er.isUndefined(s.barycenter)||er.isUndefined(i.barycenter)||s.barycenter>=i.barycenter)&&eW(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),er.forEach(a.in.reverse(),n(a)),er.forEach(a.out,r(a))}return er.map(er.filter(t,function(i){return!i.merged}),function(i){return er.pick(i,["vs","i","barycenter","weight"])})}function eW(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 yo=Wt,tW=Vn,nW=rW;function rW(e,t){var n=tW.partition(e,function(d){return yo.has(d,"barycenter")}),r=n.lhs,a=yo.sortBy(n.rhs,function(d){return-d.i}),i=[],s=0,l=0,c=0;r.sort(aW(!!t)),c=rS(i,a,c),yo.forEach(r,function(d){c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,l+=d.weight,c=rS(i,a,c)});var u={vs:yo.flatten(i,!0)};return l&&(u.barycenter=s/l,u.weight=l),u}function rS(e,t,n){for(var r;t.length&&(r=yo.last(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function aW(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 La=Wt,iW=YH,sW=XH,oW=nW,lW=vA;function vA(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=La.filter(a,function(m){return m!==s&&m!==l}));var u=iW(e,a);La.forEach(u,function(m){if(e.children(m.v).length){var y=vA(e,m.v,n,r);c[m.v]=y,La.has(y,"barycenter")&&uW(m,y)}});var d=sW(u,n);cW(d,c);var f=oW(d,r);if(s&&(f.vs=La.flatten([s,f.vs,l],!0),e.predecessors(s).length)){var p=e.node(e.predecessors(s)[0]),g=e.node(e.predecessors(l)[0]);La.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}return f}function cW(e,t){La.forEach(e,function(n){n.vs=La.flatten(n.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function uW(e,t){La.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 xo=Wt,dW=Lr.Graph,fW=pW;function pW(e,t,n){var r=gW(e),a=new dW({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(i){return e.node(i)});return xo.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),xo.forEach(e[n](i),function(c){var u=c.v===i?c.w:c.v,d=a.edge(u,i),f=xo.isUndefined(d)?0:d.weight;a.setEdge(u,i,{weight:e.edge(c).weight+f})}),xo.has(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),a}function gW(e){for(var t;e.hasNode(t=xo.uniqueId("_root")););return t}var hW=Wt,mW=yW;function yW(e,t,n){var r={},a;hW.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 Ya=Wt,xW=HH,bW=VH,vW=lW,kW=fW,_W=mW,wW=Lr.Graph,aS=Vn,EW=NW;function NW(e){var t=aS.maxRank(e),n=iS(e,Ya.range(1,t+1),"inEdges"),r=iS(e,Ya.range(t-1,-1,-1),"outEdges"),a=xW(e);sS(e,a);for(var i=Number.POSITIVE_INFINITY,s,l=0,c=0;c<4;++l,++c){SW(l%2?n:r,l%4>=2),a=aS.buildLayerMatrix(e);var u=bW(e,a);u<i&&(c=0,s=Ya.cloneDeep(a),i=u)}sS(e,s)}function iS(e,t,n){return Ya.map(t,function(r){return kW(e,r,n)})}function SW(e,t){var n=new wW;Ya.forEach(e,function(r){var a=r.graph().root,i=vW(r,a,n,t);Ya.forEach(i.vs,function(s,l){r.node(s).order=l}),_W(r,n,i.vs)})}function sS(e,t){Ya.forEach(t,function(n){Ya.forEach(n,function(r,a){e.node(r).order=a})})}var ut=Wt,CW=Lr.Graph,jW=Vn,TW={positionX:zW};function AW(e,t){var n={};function r(a,i){var s=0,l=0,c=a.length,u=ut.last(i);return ut.forEach(i,function(d,f){var p=MW(e,d),g=p?e.node(p).order:c;(p||d===u)&&(ut.forEach(i.slice(l,f+1),function(m){ut.forEach(e.predecessors(m),function(y){var v=e.node(y),x=v.order;(x<s||g<x)&&!(v.dummy&&e.node(m).dummy)&&kA(n,y,m)})}),l=f+1,s=g)}),i}return ut.reduce(t,r),n}function RW(e,t){var n={};function r(i,s,l,c,u){var d;ut.forEach(ut.range(s,l),function(f){d=i[f],e.node(d).dummy&&ut.forEach(e.predecessors(d),function(p){var g=e.node(p);g.dummy&&(g.order<c||g.order>u)&&kA(n,p,d)})})}function a(i,s){var l=-1,c,u=0;return ut.forEach(s,function(d,f){if(e.node(d).dummy==="border"){var p=e.predecessors(d);p.length&&(c=e.node(p[0]).order,r(s,u,f,l,c),u=f,l=c)}r(s,u,s.length,c,i.length)}),s}return ut.reduce(t,a),n}function MW(e,t){if(e.node(t).dummy)return ut.find(e.predecessors(t),function(n){return e.node(n).dummy})}function kA(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 IW(e,t,n){if(t>n){var r=t;t=n,n=r}return ut.has(e[t],n)}function LW(e,t,n,r){var a={},i={},s={};return ut.forEach(t,function(l){ut.forEach(l,function(c,u){a[c]=c,i[c]=c,s[c]=u})}),ut.forEach(t,function(l){var c=-1;ut.forEach(l,function(u){var d=r(u);if(d.length){d=ut.sortBy(d,function(y){return s[y]});for(var f=(d.length-1)/2,p=Math.floor(f),g=Math.ceil(f);p<=g;++p){var m=d[p];i[u]===u&&c<s[m]&&!IW(n,u,m)&&(i[m]=u,i[u]=a[u]=a[m],c=s[m])}}})}),{root:a,align:i}}function OW(e,t,n,r,a){var i={},s=DW(e,t,n,a),l=a?"borderLeft":"borderRight";function c(f,p){for(var g=s.nodes(),m=g.pop(),y={};m;)y[m]?f(m):(y[m]=!0,g.push(m),g=g.concat(p(m))),m=g.pop()}function u(f){i[f]=s.inEdges(f).reduce(function(p,g){return Math.max(p,i[g.v]+s.edge(g))},0)}function d(f){var p=s.outEdges(f).reduce(function(m,y){return Math.min(m,i[y.w]-s.edge(y))},Number.POSITIVE_INFINITY),g=e.node(f);p!==Number.POSITIVE_INFINITY&&g.borderType!==l&&(i[f]=Math.max(i[f],p))}return c(u,s.predecessors.bind(s)),c(d,s.successors.bind(s)),ut.forEach(r,function(f){i[f]=i[n[f]]}),i}function DW(e,t,n,r){var a=new CW,i=e.graph(),s=UW(i.nodesep,i.edgesep,r);return ut.forEach(t,function(l){var c;ut.forEach(l,function(u){var d=n[u];if(a.setNode(d),c){var f=n[c],p=a.edge(f,d);a.setEdge(f,d,Math.max(s(e,u,c),p||0))}c=u})}),a}function PW(e,t){return ut.minBy(ut.values(t),function(n){var r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return ut.forIn(n,function(i,s){var l=qW(e,s)/2;r=Math.max(i+l,r),a=Math.min(i-l,a)}),r-a})}function FW(e,t){var n=ut.values(t),r=ut.min(n),a=ut.max(n);ut.forEach(["u","d"],function(i){ut.forEach(["l","r"],function(s){var l=i+s,c=e[l],u;if(c!==t){var d=ut.values(c);u=s==="l"?r-ut.min(d):a-ut.max(d),u&&(e[l]=ut.mapValues(c,function(f){return f+u}))}})})}function BW(e,t){return ut.mapValues(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var a=ut.sortBy(ut.map(e,r));return(a[1]+a[2])/2})}function zW(e){var t=jW.buildLayerMatrix(e),n=ut.merge(AW(e,t),RW(e,t)),r={},a;ut.forEach(["u","d"],function(s){a=s==="u"?t:ut.values(t).reverse(),ut.forEach(["l","r"],function(l){l==="r"&&(a=ut.map(a,function(f){return ut.values(f).reverse()}));var c=(s==="u"?e.predecessors:e.successors).bind(e),u=LW(e,a,n,c),d=OW(e,a,u.root,u.align,l==="r");l==="r"&&(d=ut.mapValues(d,function(f){return-f})),r[s+l]=d})});var i=PW(e,r);return FW(r,i),BW(r,e.graph().align)}function UW(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,ut.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,ut.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 qW(e,t){return e.node(t).width}var bo=Wt,_A=Vn,$W=TW.positionX,HW=WW;function WW(e){e=_A.asNonCompoundGraph(e),VW(e),bo.forEach($W(e),function(t,n){e.node(n).x=t})}function VW(e){var t=_A.buildLayerMatrix(e),n=e.graph().ranksep,r=0;bo.forEach(t,function(a){var i=bo.max(bo.map(a,function(s){return e.node(s).height}));bo.forEach(a,function(s){e.node(s).y=r+i/2}),r+=i+n})}var ht=Wt,oS=D$,lS=J$,GW=wH,KW=Vn.normalizeRanks,YW=CH,QW=Vn.removeEmptyRanks,cS=RH,XW=PH,uS=BH,ZW=EW,JW=HW,Za=Vn,eV=Lr.Graph,tV=nV;function nV(e,t){var n=t&&t.debugTiming?Za.time:Za.notime;n("layout",function(){var r=n(" buildLayoutGraph",function(){return pV(e)});n(" runLayout",function(){rV(r,n)}),n(" updateInputGraph",function(){aV(e,r)})})}function rV(e,t){t(" makeSpaceForEdgeLabels",function(){gV(e)}),t(" removeSelfEdges",function(){wV(e)}),t(" acyclic",function(){oS.run(e)}),t(" nestingGraph.run",function(){cS.run(e)}),t(" rank",function(){GW(Za.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){hV(e)}),t(" removeEmptyRanks",function(){QW(e)}),t(" nestingGraph.cleanup",function(){cS.cleanup(e)}),t(" normalizeRanks",function(){KW(e)}),t(" assignRankMinMax",function(){mV(e)}),t(" removeEdgeLabelProxies",function(){yV(e)}),t(" normalize.run",function(){lS.run(e)}),t(" parentDummyChains",function(){YW(e)}),t(" addBorderSegments",function(){XW(e)}),t(" order",function(){ZW(e)}),t(" insertSelfEdges",function(){EV(e)}),t(" adjustCoordinateSystem",function(){uS.adjust(e)}),t(" position",function(){JW(e)}),t(" positionSelfEdges",function(){NV(e)}),t(" removeBorderNodes",function(){_V(e)}),t(" normalize.undo",function(){lS.undo(e)}),t(" fixupEdgeLabelCoords",function(){vV(e)}),t(" undoCoordinateSystem",function(){uS.undo(e)}),t(" translateGraph",function(){xV(e)}),t(" assignNodeIntersects",function(){bV(e)}),t(" reversePoints",function(){kV(e)}),t(" acyclic.undo",function(){oS.undo(e)})}function aV(e,t){ht.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))}),ht.forEach(e.edges(),function(n){var r=e.edge(n),a=t.edge(n);r.points=a.points,ht.has(a,"x")&&(r.x=a.x,r.y=a.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var iV=["nodesep","edgesep","ranksep","marginx","marginy"],sV={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},oV=["acyclicer","ranker","rankdir","align"],lV=["width","height"],cV={width:0,height:0},uV=["minlen","weight","width","height","labeloffset"],dV={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},fV=["labelpos"];function pV(e){var t=new eV({multigraph:!0,compound:!0}),n=j0(e.graph());return t.setGraph(ht.merge({},sV,C0(n,iV),ht.pick(n,oV))),ht.forEach(e.nodes(),function(r){var a=j0(e.node(r));t.setNode(r,ht.defaults(C0(a,lV),cV)),t.setParent(r,e.parent(r))}),ht.forEach(e.edges(),function(r){var a=j0(e.edge(r));t.setEdge(r,ht.merge({},dV,C0(a,uV),ht.pick(a,fV)))}),t}function gV(e){var t=e.graph();t.ranksep/=2,ht.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 hV(e){ht.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};Za.addDummyNode(e,"edge-proxy",i,"_ep")}})}function mV(e){var t=0;ht.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=ht.max(t,r.maxRank))}),e.graph().maxRank=t}function yV(e){ht.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 xV(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,p=u.width,g=u.height;t=Math.min(t,d-p/2),n=Math.max(n,d+p/2),r=Math.min(r,f-g/2),a=Math.max(a,f+g/2)}ht.forEach(e.nodes(),function(u){c(e.node(u))}),ht.forEach(e.edges(),function(u){var d=e.edge(u);ht.has(d,"x")&&c(d)}),t-=s,r-=l,ht.forEach(e.nodes(),function(u){var d=e.node(u);d.x-=t,d.y-=r}),ht.forEach(e.edges(),function(u){var d=e.edge(u);ht.forEach(d.points,function(f){f.x-=t,f.y-=r}),ht.has(d,"x")&&(d.x-=t),ht.has(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=a-r+l}function bV(e){ht.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(Za.intersectRect(r,i)),n.points.push(Za.intersectRect(a,s))})}function vV(e){ht.forEach(e.edges(),function(t){var n=e.edge(t);if(ht.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 kV(e){ht.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function _V(e){ht.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(ht.last(n.borderLeft)),s=e.node(ht.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}}),ht.forEach(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function wV(e){ht.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 EV(e){var t=Za.buildLayerMatrix(e);ht.forEach(t,function(n){var r=0;ht.forEach(n,function(a,i){var s=e.node(a);s.order=i+r,ht.forEach(s.selfEdges,function(l){Za.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 NV(e){ht.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 C0(e,t){return ht.mapValues(ht.pick(e,t),Number)}function j0(e){var t={};return ht.forEach(e,function(n,r){t[r.toLowerCase()]=n}),t}var yc=Wt,SV=Vn,CV=Lr.Graph,jV={debugOrdering:TV};function TV(e){var t=SV.buildLayerMatrix(e),n=new CV({compound:!0,multigraph:!0}).setGraph({});return yc.forEach(e.nodes(),function(r){n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),yc.forEach(e.edges(),function(r){n.setEdge(r.v,r.w,{},r.name)}),yc.forEach(t,function(r,a){var i="layer"+a;n.setNode(i,{rank:"same"}),yc.reduce(r,function(s,l){return n.setEdge(s,l,{style:"invis"}),l})}),n}var AV="0.8.5",RV={graphlib:Lr,layout:tV,debug:jV,util:{time:Vn.time,notime:Vn.notime},version:AV};const wu=il(RV),MV={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"}},IV={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 LV(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function dS(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function OV({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 F=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(F)&&F>.1)return F}return 1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(u))},[u]);const[f,p]=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[g,m]=h.useState(function(){if(typeof window<"u"){const F=localStorage.getItem("pave-map-rankdir");if(F==="LR"||F==="TB")return F}return"TB"});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",g)},[g]);const y=h.useMemo(function(){if(f)return n;const F=n.filter(function(P){return P.status!=="completed"}),G={};return F.forEach(function(P){G[P.id]=!0}),F.map(function(P){if(!P.blockedBy||!P.blockedBy.length)return P;const M=P.blockedBy.filter(function(S){return G[S]});return M.length===P.blockedBy.length?P:Object.assign({},P,{blockedBy:M})})},[n,f]);h.useEffect(function(){if(!i.current)return;function F(){i.current&&c(i.current.clientWidth||400)}F();const G=new ResizeObserver(F);return G.observe(i.current),function(){G.disconnect()}},[]);const v=h.useMemo(function(){if(!y.length)return{nodes:[],edges:[],width:0,height:0};const F=new wu.graphlib.Graph;F.setGraph({rankdir:g,nodesep:24,ranksep:36,marginx:16,marginy:16}),F.setDefaultEdgeLabel(function(){return{}});const G=180,P=56;y.forEach(function(I){F.setNode(String(I.id),{width:G,height:P,todo:I})}),y.forEach(function(I){(I.blockedBy||[]).forEach(function(Q){F.hasNode(String(Q))&&F.setEdge(String(Q),String(I.id))})}),wu.layout(F);const M=F.nodes().map(function(I){const B=F.node(I);return{id:I,x:B.x-G/2,y:B.y-P/2,w:G,h:P,todo:B.todo}}),S=F.edges().map(function(I){const B=F.edge(I);return{from:I.v,to:I.w,points:B.points}});return{nodes:M,edges:S,width:F.graph().width||G+32,height:F.graph().height||P+32}},[y,g]),x=t?IV:MV;if(!y.length){const F=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"})})}),F>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:[F," completed ",F===1?"todo is":"todos are"," hidden."]}),o.jsx("button",{type:"button",onClick:function(){p(!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(F){if(!F||F.length<2)return"";let G="M "+F[0].x+" "+F[0].y;for(let P=1;P<F.length;P++)G+=" L "+F[P].x+" "+F[P].y;return G}const k=n.reduce(function(F,G){const P=dS(G);return F[P]=(F[P]||0)+1,F},{}),N=k.completed||0,w=Math.max(v.width,100),_=Math.max(v.height,100),A=(w>l-24?1:(l-24)/w)*u,D=w*A,R=_*A;function $(F){(F.ctrlKey||F.metaKey)&&(F.preventDefault(),d(function(G){const P=F.deltaY<0?G*1.1:G/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(F){return F==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:g==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:g==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){d(function(F){return Math.max(.25,F/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),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(F){return Math.min(4,F*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),N>0?o.jsx("button",{type:"button",onClick:function(){p(function(F){return!F})},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:$,children:o.jsxs("svg",{viewBox:"0 0 "+w+" "+_,width:D,height:R,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(F,G){return o.jsx("path",{d:b(F.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+G)}),v.nodes.map(function(F){const G=dS(F.todo),P=x[G],M=G==="in_progress",S=r===F.id;return o.jsxs("g",{transform:"translate("+F.x+","+F.y+")",onMouseEnter:function(){a(F.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[o.jsx("rect",{width:F.w,height:F.h,rx:6,ry:6,fill:P.fill,stroke:P.stroke,strokeWidth:M||S?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:F.w/2,y:F.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:P.label,children:"#"+F.todo.id}),o.jsx("text",{x:F.w/2,y:F.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:LV(F.todo.text,26)}),S&&F.todo.text&&F.todo.text.length>26?o.jsx("title",{children:F.todo.text}):null]},F.id)})]})})]})}const DV={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"}},PV={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},FV={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},BV={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"}},zV={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},UV={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},qV={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},$V={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},ja={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function HV(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function WV(e,t){return e.kind==="thought"?t?$V:qV:e.status==="error"?t?UV:FV:(t?BV:DV)[e.tool]||(t?zV:PV)}function VV({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,p]=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[g,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",g)},[g]);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(S){return!S.hidden})),x||(M=M.filter(function(S){return S.kind!=="thought"})),M},[r,y,x]),N=h.useMemo(function(){const M={};return k.forEach(function(S){M[S.id]=!0}),a.filter(function(S){return M[S.from]&&M[S.to]})},[a,k]),w=h.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const M=new wu.graphlib.Graph;M.setGraph({rankdir:g,nodesep:18,ranksep:32,marginx:14,marginy:14}),M.setDefaultEdgeLabel(function(){return{}});const S=168,I=44,B=240,Q=60;k.forEach(function(W){W.kind==="thought"?M.setNode(W.id,{width:B,height:Q,node:W}):M.setNode(W.id,{width:S,height:I,node:W})}),N.forEach(function(W){M.hasNode(W.from)&&M.hasNode(W.to)&&M.setEdge(W.from,W.to,{kind:W.kind})}),wu.layout(M);const C=M.nodes().map(function(W){const j=M.node(W);return{id:W,x:j.x-j.width/2,y:j.y-j.height/2,w:j.width,h:j.height,node:j.node}}),K=M.edges().map(function(W){const j=M.edge(W);return{from:W.v,to:W.w,points:j.points||[],kind:j.kind||"seq"}});return{nodes:C,edges:K,width:M.graph().width||S+28,height:M.graph().height||I+28}},[k,N,g]);h.useEffect(function(){if(!i.current)return;function M(){i.current&&d(i.current.clientWidth||400)}M();const S=new ResizeObserver(M);return S.observe(i.current),function(){S.disconnect()}},[]);const _=h.useMemo(function(){const M={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(S){if(S.kind==="thought"){M.thoughts++;return}M.total++,S.hidden&&M.hidden++,S.status==="error"?M.error++:S.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."}),_.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 ",_.hidden," hidden"]}):null]});function T(M){if(!M||M.length<2)return"";let S="M "+M[0].x+" "+M[0].y;for(let I=1;I<M.length;I++)S+=" L "+M[I].x+" "+M[I].y;return S}const A=Math.max(w.width,100),D=Math.max(w.height,100),$=(A>u-24?1:(u-24)/A)*f,F=A*$,G=D*$;function P(M){(M.ctrlKey||M.metaKey)&&(M.preventDefault(),p(function(S){const I=M.deltaY<0?S*1.1:S/1.1;return Math.max(.25,Math.min(4,I))}))}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:[_.total," tools"]}),_.running?o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[_.running," live"]}):null,_.error?o.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[_.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:g==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:g==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){p(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(){p(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),o.jsx("button",{type:"button",onClick:function(){p(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:"+"})]}),_.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,_.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 ("+_.thoughts+" thoughts)",children:x?"💭 "+_.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 "+A+" "+D,width:F,height:G,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?ja.data.dark:ja.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?ja.file.dark:ja.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?ja.seq.dark:ja.seq.light})})]}),w.edges.map(function(M,S){const I=t?ja[M.kind].dark:ja[M.kind].light;return o.jsx("path",{d:T(M.points),fill:"none",stroke:I,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"+S)}),w.nodes.map(function(M){const S=M.node,I=WV(S,t),B=S.status==="running",Q=l===M.id;if(S.kind==="thought"){const K=S.label||"",W=32,j=3,U=K.split(/\s+/),le=[];let Z="";for(const ke of U){if(le.length===j-1&&(Z+" "+ke).length>W){le.push(Z);const re=U.slice(U.indexOf(ke)).join(" ");le.push(re.length>W?re.slice(0,W-1)+"…":re),Z="";break}if(!Z){Z=ke;continue}if((Z+" "+ke).length<=W?Z=Z+" "+ke:(le.push(Z),Z=ke),le.length>=j)break}return Z&&le.length<j&&le.push(Z),o.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){c(M.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(S)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:M.h/2,ry:M.h/2,fill:I.fill,stroke:I.stroke,strokeWidth:Q?1.75:1,strokeDasharray:S.source==="reasoning"?void 0:"4,2"}),o.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:I.label,children:le.map(function(ke,re){return o.jsx("tspan",{x:14,dy:re===0?14:11,children:(re===0?"💭 ":"")+ke},"ln"+re)})}),o.jsx("title",{children:(S.source==="reasoning"?"[reasoning] ":"[thought] ")+(S.fullText||S.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(S)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:5,ry:5,fill:I.fill,stroke:I.stroke,strokeWidth:B||Q?2:1.25,opacity:S.hidden?.55:1,children:B?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:I.label,children:S.tool}),o.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:HV(S.label,22)}),o.jsx("title",{children:S.tool+" · "+S.label+(S.status==="error"?" · ERROR":S.status==="running"?" · RUNNING":"")}),B?o.jsxs("g",{transform:"translate("+(M.w-9)+",9)",children:[o.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:I.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 fS(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 GV(e){if(Array.isArray(e))return e}function KV(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 YV(){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 QV(e,t){return GV(e)||KV(e,t)||XV(e,t)||YV()}function XV(e,t){if(e){if(typeof e=="string")return fS(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)?fS(e,t):void 0}}const wA=Object.entries,pS=Object.setPrototypeOf,ZV=Object.isFrozen,JV=Object.getPrototypeOf,eG=Object.getOwnPropertyDescriptor;let xn=Object.freeze,kn=Object.seal,rs=Object.create,EA=typeof Reflect<"u"&&Reflect,sx=EA.apply,ox=EA.construct;xn||(xn=function(t){return t});kn||(kn=function(t){return t});sx||(sx=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)});ox||(ox=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 Xi=an(Array.prototype.forEach),tG=an(Array.prototype.lastIndexOf),gS=an(Array.prototype.pop),Zi=an(Array.prototype.push),nG=an(Array.prototype.splice),Oa=Array.isArray,vo=an(String.prototype.toLowerCase),T0=an(String.prototype.toString),hS=an(String.prototype.match),oo=an(String.prototype.replace),mS=an(String.prototype.indexOf),rG=an(String.prototype.trim),aG=an(Number.prototype.toString),iG=an(Boolean.prototype.toString),yS=typeof BigInt>"u"?null:an(BigInt.prototype.toString),xS=typeof Symbol>"u"?null:an(Symbol.prototype.toString),fn=an(Object.prototype.hasOwnProperty),lo=an(Object.prototype.toString),dn=an(RegExp.prototype.test),li=sG(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 sx(e,t,r)}}function sG(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ox(e,n)}}function kt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;if(pS&&pS(e,null),!Oa(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(ZV(t)||(t[r]=i),a=i)}e[a]=!0}return e}function oG(e){for(let t=0;t<e.length;t++)fn(e,t)||(e[t]=null);return e}function En(e){const t=rs(null);for(const r of wA(e)){var n=QV(r,2);const a=n[0],i=n[1];fn(e,a)&&(Oa(i)?t[a]=oG(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=En(i):t[a]=i)}return t}function lG(e){switch(typeof e){case"string":return e;case"number":return aG(e);case"boolean":return iG(e);case"bigint":return yS?yS(e):"0";case"symbol":return xS?xS(e):"Symbol()";case"undefined":return lo(e);case"function":case"object":{if(e===null)return lo(e);const t=e,n=Er(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:lo(r)}return lo(e)}default:return lo(e)}}function Er(e,t){for(;e!==null;){const r=eG(e,t);if(r){if(r.get)return an(r.get);if(typeof r.value=="function")return an(r.value)}e=JV(e)}function n(){return null}return n}function cG(e){try{return dn(e,""),!0}catch{return!1}}const bS=xn(["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"]),A0=xn(["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"]),R0=xn(["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"]),uG=xn(["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"]),M0=xn(["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"]),dG=xn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vS=xn(["#text"]),kS=xn(["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"]),I0=xn(["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"]),_S=xn(["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"]),xc=xn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fG=kn(/{{[\w\W]*|^[\w\W]*}}/g),pG=kn(/<%[\w\W]*|^[\w\W]*%>/g),gG=kn(/\${[\w\W]*/g),hG=kn(/^data-[\-\w.\u00B7-\uFFFF]+$/),mG=kn(/^aria-[\-\w]+$/),wS=kn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yG=kn(/^(?:\w+script|data):/i),xG=kn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bG=kn(/^html$/i),vG=kn(/^[a-z][.\w]*(-[.\w]+)+$/i),ES=kn(/<[/\w!]/g),NS=kn(/<[/\w]/g),kG=kn(/<\/no(script|embed|frames)/i),_G=kn(/\/>/i),Xn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},wG=function(){return typeof window>"u"?null:window},EG=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}},SS=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ta=function(t,n,r,a){return fn(t,n)&&Oa(t[n])?kt(a.base?En(a.base):{},t[n],a.transform):r};function NA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wG();const t=Me=>NA(Me);if(t.version="3.4.13",t.removed=[],!e||!e.document||e.document.nodeType!==Xn.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,p=l.prototype,g=Er(p,"cloneNode"),m=Er(p,"remove"),y=Er(p,"nextSibling"),v=Er(p,"childNodes"),x=Er(p,"parentNode"),b=Er(p,"shadowRoot"),k=Er(p,"attributes"),N=s&&s.prototype?Er(s.prototype,"nodeType"):null,w=s&&s.prototype?Er(s.prototype,"nodeName"):null,_=s&&s.prototype?Er(s.prototype,"ownerDocument"):null;if(typeof i=="function"){const Me=n.createElement("template");Me.content&&Me.content.ownerDocument&&(n=Me.content.ownerDocument)}let T,A="",D,R=!1,$=0;const F=function(){if($>0)throw li('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.')},G=function(O){F(),$++;try{return T.createHTML(O)}finally{$--}},P=function(O){F(),$++;try{return T.createScriptURL(O)}finally{$--}},M=function(){return R||(D=EG(f,a),R=!0),D},S=n,I=S.implementation,B=S.createNodeIterator,Q=S.createDocumentFragment,C=S.getElementsByTagName,K=r.importNode;let W=SS();t.isSupported=typeof wA=="function"&&typeof x=="function"&&I&&I.createHTMLDocument!==void 0;const j=fG,U=pG,le=gG,Z=hG,ke=mG,re=yG,X=xG,Ne=vG;let ve=wS,me=null;const pe=kt({},[...bS,...A0,...R0,...M0,...vS]);let Le=null;const Se=kt({},[...kS,...I0,..._S,...xc]);let Te=Object.seal(rs(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}})),Fe=null,fe=null;const xe=Object.seal(rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ce=!0,ue=!0,he=!1,_e=!0,Pe=!1,Xe=!0,H=!1,z=!1,te=null,ce=null,je=!1,Be=!1,Ke=!1,Ye=!1,ot=!0,Rt=!1;const mt="user-content-";let Mt=!0,de=!1,We={},nt=null;const yt=kt({},["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 ae=null;const Ie=kt({},["audio","video","img","source","image","track"]);let De=null;const Ve=kt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",et="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Xt=Qe,oe=!1,jt=null;const ct=kt({},[ft,et,Qe],T0),wt=xn(["mi","mo","mn","ms","mtext"]);let gt=kt({},wt);const cn=xn(["annotation-xml"]);let Kn=kt({},cn);const or=kt({},["title","style","font","a","script"]);let we=null;const Ze=["application/xhtml+xml","text/html"],$t="text/html";let Ct=null,br=null;const Pn=n.createElement("form"),vr=function(O){return O instanceof RegExp||O instanceof Function},ba=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(br&&br===O)return;(!O||typeof O!="object")&&(O={}),O=En(O),we=Ze.indexOf(O.PARSER_MEDIA_TYPE)===-1?$t:O.PARSER_MEDIA_TYPE,Ct=we==="application/xhtml+xml"?T0:vo,me=Ta(O,"ALLOWED_TAGS",pe,{transform:Ct}),Le=Ta(O,"ALLOWED_ATTR",Se,{transform:Ct}),jt=Ta(O,"ALLOWED_NAMESPACES",ct,{transform:T0}),De=Ta(O,"ADD_URI_SAFE_ATTR",Ve,{transform:Ct,base:Ve}),ae=Ta(O,"ADD_DATA_URI_TAGS",Ie,{transform:Ct,base:Ie}),nt=Ta(O,"FORBID_CONTENTS",yt,{transform:Ct}),Fe=Ta(O,"FORBID_TAGS",En({}),{transform:Ct}),fe=Ta(O,"FORBID_ATTR",En({}),{transform:Ct}),We=fn(O,"USE_PROFILES")?O.USE_PROFILES&&typeof O.USE_PROFILES=="object"?En(O.USE_PROFILES):O.USE_PROFILES:!1,Ce=O.ALLOW_ARIA_ATTR!==!1,ue=O.ALLOW_DATA_ATTR!==!1,he=O.ALLOW_UNKNOWN_PROTOCOLS||!1,_e=O.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Pe=O.SAFE_FOR_TEMPLATES||!1,Xe=O.SAFE_FOR_XML!==!1,H=O.WHOLE_DOCUMENT||!1,Be=O.RETURN_DOM||!1,Ke=O.RETURN_DOM_FRAGMENT||!1,Ye=O.RETURN_TRUSTED_TYPE||!1,je=O.FORCE_BODY||!1,ot=O.SANITIZE_DOM!==!1,Rt=O.SANITIZE_NAMED_PROPS||!1,Mt=O.KEEP_CONTENT!==!1,de=O.IN_PLACE||!1,ve=cG(O.ALLOWED_URI_REGEXP)?O.ALLOWED_URI_REGEXP:wS,Xt=typeof O.NAMESPACE=="string"?O.NAMESPACE:Qe,gt=fn(O,"MATHML_TEXT_INTEGRATION_POINTS")&&O.MATHML_TEXT_INTEGRATION_POINTS&&typeof O.MATHML_TEXT_INTEGRATION_POINTS=="object"?En(O.MATHML_TEXT_INTEGRATION_POINTS):kt({},wt),Kn=fn(O,"HTML_INTEGRATION_POINTS")&&O.HTML_INTEGRATION_POINTS&&typeof O.HTML_INTEGRATION_POINTS=="object"?En(O.HTML_INTEGRATION_POINTS):kt({},cn);const ie=fn(O,"CUSTOM_ELEMENT_HANDLING")&&O.CUSTOM_ELEMENT_HANDLING&&typeof O.CUSTOM_ELEMENT_HANDLING=="object"?En(O.CUSTOM_ELEMENT_HANDLING):rs(null);if(Te=rs(null),fn(ie,"tagNameCheck")&&vr(ie.tagNameCheck)&&(Te.tagNameCheck=ie.tagNameCheck),fn(ie,"attributeNameCheck")&&vr(ie.attributeNameCheck)&&(Te.attributeNameCheck=ie.attributeNameCheck),fn(ie,"allowCustomizedBuiltInElements")&&typeof ie.allowCustomizedBuiltInElements=="boolean"&&(Te.allowCustomizedBuiltInElements=ie.allowCustomizedBuiltInElements),kn(Te),Pe&&(ue=!1),Ke&&(Be=!0),We&&(me=kt({},vS),Le=rs(null),We.html===!0&&(kt(me,bS),kt(Le,kS)),We.svg===!0&&(kt(me,A0),kt(Le,I0),kt(Le,xc)),We.svgFilters===!0&&(kt(me,R0),kt(Le,I0),kt(Le,xc)),We.mathMl===!0&&(kt(me,M0),kt(Le,_S),kt(Le,xc))),xe.tagCheck=null,xe.attributeCheck=null,fn(O,"ADD_TAGS")&&(typeof O.ADD_TAGS=="function"?xe.tagCheck=O.ADD_TAGS:Oa(O.ADD_TAGS)&&(me===pe&&(me=En(me)),kt(me,O.ADD_TAGS,Ct))),fn(O,"ADD_ATTR")&&(typeof O.ADD_ATTR=="function"?xe.attributeCheck=O.ADD_ATTR:Oa(O.ADD_ATTR)&&(Le===Se&&(Le=En(Le)),kt(Le,O.ADD_ATTR,Ct))),fn(O,"ADD_URI_SAFE_ATTR")&&Oa(O.ADD_URI_SAFE_ATTR)&&kt(De,O.ADD_URI_SAFE_ATTR,Ct),fn(O,"FORBID_CONTENTS")&&Oa(O.FORBID_CONTENTS)&&(nt===yt&&(nt=En(nt)),kt(nt,O.FORBID_CONTENTS,Ct)),fn(O,"ADD_FORBID_CONTENTS")&&Oa(O.ADD_FORBID_CONTENTS)&&(nt===yt&&(nt=En(nt)),kt(nt,O.ADD_FORBID_CONTENTS,Ct)),Mt&&(me["#text"]=!0),H&&kt(me,["html","head","body"]),me.table&&(kt(me,["tbody"]),delete Fe.tbody),O.TRUSTED_TYPES_POLICY){if(typeof O.TRUSTED_TYPES_POLICY.createHTML!="function")throw li('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof O.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw li('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ee=T;T=O.TRUSTED_TYPES_POLICY;try{A=G("")}catch($e){throw T=Ee,$e}}else O.TRUSTED_TYPES_POLICY===null?(T=void 0,A=""):(T===void 0&&(T=M()),T&&typeof A=="string"&&(A=G("")));xn&&xn(O),br=O},Fn=kt({},[...A0,...R0,...uG]),_l=kt({},[...M0,...dG]),va=function(O,ie,Ee){return ie.namespaceURI===Qe?O==="svg":ie.namespaceURI===ft?O==="svg"&&(Ee==="annotation-xml"||gt[Ee]):!!Fn[O]},Bi=function(O,ie,Ee){return ie.namespaceURI===Qe?O==="math":ie.namespaceURI===et?O==="math"&&Kn[Ee]:!!_l[O]},wl=function(O,ie,Ee){return ie.namespaceURI===et&&!Kn[Ee]||ie.namespaceURI===ft&&!gt[Ee]?!1:!_l[O]&&(or[O]||!Fn[O])},El=function(O){let ie=x(O);(!ie||!ie.tagName)&&(ie={namespaceURI:Xt,tagName:"template"});const Ee=vo(O.tagName),$e=vo(ie.tagName);return jt[O.namespaceURI]?O.namespaceURI===et?va(Ee,ie,$e):O.namespaceURI===ft?Bi(Ee,ie,$e):O.namespaceURI===Qe?wl(Ee,ie,$e):!!(we==="application/xhtml+xml"&&jt[O.namespaceURI]):!1},Yn=function(O){Zi(t.removed,{element:O});try{x(O).removeChild(O)}catch{if(m(O),!x(O))throw li("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},hn=function(O){ai(O);const ie=v(O);if(ie){const $e=[];Xi(ie,Ge=>{Zi($e,Ge)}),Xi($e,Ge=>{try{m(Ge)}catch{}})}const Ee=k(O);if(Ee)for(let $e=Ee.length-1;$e>=0;--$e){const Ge=Ee[$e],it=Ge&&Ge.name;if(typeof it=="string")try{O.removeAttribute(it)}catch{}}},Zt=function(O,ie){try{Zi(t.removed,{attribute:ie.getAttributeNode(O),from:ie})}catch{Zi(t.removed,{attribute:null,from:ie})}if(ie.removeAttribute(O),O==="is")if(Be||Ke)try{Yn(ie)}catch{}else try{ie.setAttribute(O,"")}catch{}},Nl=function(O){const ie=k(O);if(ie)for(let Ee=ie.length-1;Ee>=0;--Ee){const $e=ie[Ee],Ge=$e&&$e.name;if(!(typeof Ge!="string"||Le[Ct(Ge)]))try{O.removeAttribute(Ge)}catch{}}},ai=function(O){const ie=[O];for(;ie.length>0;){const Ee=ie.pop();(N?N(Ee):Ee.nodeType)===Xn.element&&Nl(Ee);const Ge=v(Ee);if(Ge)for(let it=Ge.length-1;it>=0;--it)ie.push(Ge[it])}},Or=function(O){if(!Xe)return;const ie=[O];for(;ie.length>0;){const Ee=ie.pop(),$e=N?N(Ee):Ee.nodeType;if($e===Xn.processingInstruction||$e===Xn.comment&&dn(NS,Ee.data)){try{m(Ee)}catch{}continue}if($e===Xn.element){const it=Ee,Et=Ct(w?w(Ee):Ee.nodeName);try{it.hasAttribute&&it.hasAttribute("patchsrc")&&it.removeAttribute("patchsrc"),it.hasAttribute&&it.hasAttribute("for")&&Et!=="label"&&Et!=="output"&&it.removeAttribute("for")}catch{}}const Ge=v(Ee);if(Ge)for(let it=Ge.length-1;it>=0;--it)ie.push(Ge[it])}},Sl=function(O){let ie=null,Ee=null;if(je)O="<remove></remove>"+O;else{const it=hS(O,/^[\r\n\t ]+/);Ee=it&&it[0]}we==="application/xhtml+xml"&&Xt===Qe&&(O='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+O+"</body></html>");const $e=T?G(O):O;if(Xt===Qe)try{ie=new d().parseFromString($e,we)}catch{}if(!ie||!ie.documentElement){ie=I.createDocument(Xt,"template",null);try{ie.documentElement.innerHTML=oe?A:$e}catch{}}const Ge=ie.body||ie.documentElement;return O&&Ee&&Ge.insertBefore(n.createTextNode(Ee),Ge.childNodes[0]||null),Xt===Qe?C.call(ie,H?"html":"body")[0]:H?ie.documentElement:Ge},zi=function(O){const ie=_?_(O):O.ownerDocument;return B.call(ie||O,O,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ui=function(O){return O=oo(O,j," "),O=oo(O,U," "),O=oo(O,le," "),O},ka=function(O){var ie;O.normalize();const Ee=_?_(O):O.ownerDocument,$e=B.call(Ee||O,O,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let Ge=$e.nextNode();for(;Ge;)Ge.data=Ui(Ge.data),Ge=$e.nextNode();const it=(ie=O.querySelectorAll)===null||ie===void 0?void 0:ie.call(O,"template");it&&Xi(it,Et=>{Yr(Et.content)&&ka(Et.content)})},qi=function(O){const ie=w?w(O):null;return typeof ie!="string"||Ct(ie)!=="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)},Yr=function(O){if(!N||typeof O!="object"||O===null)return!1;try{return N(O)===Xn.documentFragment}catch{return!1}},kr=function(O){if(!N||typeof O!="object"||O===null)return!1;try{return typeof N(O)=="number"}catch{return!1}};function Bn(Me,O,ie){Me.length!==0&&Xi(Me,Ee=>{Ee.call(t,O,ie,br)})}const yd=function(O,ie){return!!(Xe&&O.hasChildNodes()&&!kr(O.firstElementChild)&&dn(ES,O.textContent)&&dn(ES,O.innerHTML)||Xe&&O.namespaceURI===Qe&&ie==="style"&&kr(O.firstElementChild)||O.nodeType===Xn.processingInstruction||Xe&&O.nodeType===Xn.comment&&dn(NS,O.data))},ii=function(O,ie,Ee){if(!Fe[ie]&&Tl(ie)&&(Te.tagNameCheck instanceof RegExp&&dn(Te.tagNameCheck,ie)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(ie)))return!1;if(Mt&&!nt[ie]){const $e=x(O),Ge=v(O);if(Ge&&$e){const it=Ge.length;for(let Et=it-1;Et>=0;--Et){const Tt=O===Ee?g(Ge[Et],!0):Ge[Et];$e.insertBefore(Tt,y(O))}}}return Yn(O),!0},qs=function(O,ie,Ee,$e){return O.length===0?ie:ie===Ee||ie===$e?En(ie):ie},He=function(O,ie){if(Bn(W.beforeSanitizeElements,O,null),O!==ie&&x(O)===null)return de&&ai(O),!0;if(qi(O))return Yn(O),!0;const Ee=Ct(w?w(O):O.nodeName);if(me=qs(W.uponSanitizeElement,me,pe,te),Bn(W.uponSanitizeElement,O,{tagName:Ee,allowedTags:me}),O!==ie&&x(O)===null)return de&&ai(O),!0;if(yd(O,Ee))return Yn(O),!0;if(Fe[Ee]||!(xe.tagCheck instanceof Function&&xe.tagCheck(Ee))&&!me[Ee]){const Ge=ii(O,Ee,ie);return Ge===!1&&Bn(W.afterSanitizeElements,O,null),Ge}if((N?N(O):O.nodeType)===Xn.element&&!El(O)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&dn(kG,O.innerHTML))return Yn(O),!0;if(Pe&&O.nodeType===Xn.text){const Ge=Ui(O.textContent);O.textContent!==Ge&&(Zi(t.removed,{element:O.cloneNode()}),O.textContent=Ge)}return Bn(W.afterSanitizeElements,O,null),!1},Cl=function(O,ie,Ee){if(fe[ie]||Xe&&ie==="patchsrc"||Xe&&ie==="for"&&O!=="label"&&O!=="output"||ot&&(ie==="id"||ie==="name")&&(Ee in n||Ee in Pn))return!1;const $e=Le[ie]||xe.attributeCheck instanceof Function&&xe.attributeCheck(ie,O);if(!(ue&&dn(Z,ie))){if(!(Ce&&dn(ke,ie))){if($e){if(!De[ie]){if(!dn(ve,oo(Ee,X,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&O!=="script"&&mS(Ee,"data:")===0&&ae[O])){if(!(he&&!dn(re,oo(Ee,X,"")))){if(Ee)return!1}}}}}else if(!(Tl(O)&&(Te.tagNameCheck instanceof RegExp&&dn(Te.tagNameCheck,O)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(O))&&(Te.attributeNameCheck instanceof RegExp&&dn(Te.attributeNameCheck,ie)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(ie,O))||ie==="is"&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&dn(Te.tagNameCheck,Ee)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(Ee))))return!1}}return!0},jl=kt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Tl=function(O){return!jl[vo(O)]&&dn(Ne,O)},xd=function(O,ie,Ee,$e){if(T&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ee)switch(f.getAttributeType(O,ie)){case"TrustedHTML":return G($e);case"TrustedScriptURL":return P($e)}return $e},Al=function(O,ie,Ee,$e){try{Ee?O.setAttributeNS(Ee,ie,$e):O.setAttribute(ie,$e),qi(O)?Yn(O):gS(t.removed)}catch{Zt(ie,O)}},Rl=function(O){Bn(W.beforeSanitizeAttributes,O,null);const ie=O.attributes;if(!ie||qi(O))return;Le=qs(W.uponSanitizeAttribute,Le,Se,ce);const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Le,forceKeepAttr:void 0};let $e=ie.length;const Ge=Ct(O.nodeName);for(;$e--;){const it=ie[$e],Et=it.name,Tt=it.namespaceURI,Vt=it.value,Bt=Ct(Et),wa=Vt;let Jt=Et==="value"?wa:rG(wa);if(Ee.attrName=Bt,Ee.attrValue=Jt,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,Bn(W.uponSanitizeAttribute,O,Ee),Jt=Ee.attrValue,Rt&&(Bt==="id"||Bt==="name")&&mS(Jt,mt)!==0&&(Zt(Et,O),Jt=mt+Jt),Xe&&dn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Jt)){Zt(Et,O);continue}if(Bt==="attributename"&&hS(Jt,"href")){Zt(Et,O);continue}if(!Ee.forceKeepAttr){if(!Ee.keepAttr){Zt(Et,O);continue}if(!_e&&dn(_G,Jt)){Zt(Et,O);continue}if(Pe&&(Jt=Ui(Jt)),!Cl(Ge,Bt,Jt)){Zt(Et,O);continue}Jt=xd(Ge,Bt,Tt,Jt),Jt!==wa&&Al(O,Et,Tt,Jt)}}Bn(W.afterSanitizeAttributes,O,null)},_a=function(O){let ie=null;const Ee=zi(O);for(Bn(W.beforeSanitizeShadowDOM,O,null);ie=Ee.nextNode();)if(Bn(W.uponSanitizeShadowNode,ie,null),He(ie,O),Rl(ie),Yr(ie.content)&&_a(ie.content),(N?N(ie):ie.nodeType)===Xn.element){const Ge=b(ie);Yr(Ge)&&($s(Ge),_a(Ge))}Bn(W.afterSanitizeShadowDOM,O,null)},$s=function(O){const ie=[{node:O,shadow:null}];for(;ie.length>0;){const Ee=ie.pop();if(Ee.shadow){_a(Ee.shadow);continue}const $e=Ee.node,it=(N?N($e):$e.nodeType)===Xn.element,Et=v($e);if(Et)for(let Tt=Et.length-1;Tt>=0;--Tt)ie.push({node:Et[Tt],shadow:null});if(it){const Tt=w?w($e):null;if(typeof Tt=="string"&&Ct(Tt)==="template"){const Vt=$e.content;Yr(Vt)&&ie.push({node:Vt,shadow:null})}}if(it){const Tt=b($e);Yr(Tt)&&ie.push({node:null,shadow:Tt},{node:Tt,shadow:null})}}};return t.sanitize=function(Me){let O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,Ee=null,$e=null,Ge=null;if(oe=!Me,oe&&(Me="<!-->"),typeof Me!="string"&&!kr(Me)&&(Me=lG(Me),typeof Me!="string"))throw li("dirty is not a string, aborting");if(!t.isSupported)return Me;z?(me=te,Le=ce):ba(O),(W.uponSanitizeElement.length>0||W.uponSanitizeAttribute.length>0)&&(me=En(me)),W.uponSanitizeAttribute.length>0&&(Le=En(Le)),t.removed=[];const it=de&&typeof Me!="string"&&kr(Me);if(it){Or(Me);const Vt=w?w(Me):Me.nodeName;if(typeof Vt=="string"){const Bt=Ct(Vt);if(!me[Bt]||Fe[Bt])throw hn(Me),li("root node is forbidden and cannot be sanitized in-place")}if(qi(Me))throw hn(Me),li("root node is clobbered and cannot be sanitized in-place");try{$s(Me)}catch(Bt){throw hn(Me),Bt}}else if(kr(Me))ie=Sl("<!---->"),Ee=ie.ownerDocument.importNode(Me,!0),Ee.nodeType===Xn.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?ie=Ee:ie.appendChild(Ee),$s(Ee);else{if(!Be&&!Pe&&!H&&Me.indexOf("<")===-1)return T&&Ye?G(Me):Me;if(ie=Sl(Me),!ie)return Be?null:Ye?A:""}ie&&je&&Yn(ie.firstChild);const Et=it?Me:ie;try{const Vt=zi(Et);for(;$e=Vt.nextNode();)He($e,Et),Rl($e),Yr($e.content)&&_a($e.content)}catch(Vt){throw it&&(hn(Me),Xi(t.removed,Bt=>{Bt.element&&ai(Bt.element)})),Vt}if(it)return Xi(t.removed,Vt=>{Vt.element&&ai(Vt.element)}),Pe&&ka(Me),Me;if(Be){if(Pe&&ka(ie),Ke)for(Ge=Q.call(ie.ownerDocument);ie.firstChild;)Ge.appendChild(ie.firstChild);else Ge=ie;return(Le.shadowroot||Le.shadowrootmode)&&(Ge=K.call(r,Ge,!0)),Ge}let Tt=H?ie.outerHTML:ie.innerHTML;return H&&me["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&dn(bG,ie.ownerDocument.doctype.name)&&(Tt="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
104
+ `+Tt),Pe&&(Tt=Ui(Tt)),T&&Ye?G(Tt):Tt},t.setConfig=function(){let Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ba(Me),z=!0,te=me,ce=Le},t.clearConfig=function(){br=null,z=!1,te=null,ce=null,T=D,A=""},t.isValidAttribute=function(Me,O,ie){br||ba({});const Ee=Ct(Me),$e=Ct(O);return Cl(Ee,$e,ie)},t.addHook=function(Me,O){typeof O=="function"&&fn(W,Me)&&Zi(W[Me],O)},t.removeHook=function(Me,O){if(fn(W,Me)){if(O!==void 0){const ie=tG(W[Me],O);return ie===-1?void 0:nG(W[Me],ie,1)[0]}return gS(W[Me])}},t.removeHooks=function(Me){fn(W,Me)&&(W[Me]=[])},t.removeAllHooks=function(){W=SS()},t}var NG=NA();let L0=null;function SG(){return L0||(L0=uj(()=>import("./mermaid.core-D2L8Rtb7.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})),L0}function CS(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let jS=0;function CG(){return jS+=1,"pave-canvas-"+jS}function jG({source:e}){const t=h.useRef(null),n=h.useRef(CG()),[r,a]=h.useState(null),[i,s]=h.useState(CS());return h.useEffect(function(){if(typeof window>"u")return;const l=new MutationObserver(function(){const c=CS();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),SG().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 TG({source:e}){const t=h.useMemo(function(){return NG.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return o.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function AG({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 RG({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=o.jsx(jG,{source:e.source}):e.type==="svg"?t=o.jsx(TG,{source:e.source}):e.type==="katex"?t=o.jsx(AG,{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 TS({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 p=Math.min(Math.max(0,r),n.length-1),g=n[p],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,p-1)),disabled:p===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:[p+1,"/",n.length]}),o.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,p+1)),disabled:p===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:[g.title?o.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:g.title}):null,o.jsx("div",{style:{transform:`scale(${i})`,transformOrigin:"top left",width:i===1?"100%":`${100/i}%`},children:o.jsx(RG,{canvas:g})}),g.caption?o.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:g.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 MG(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function IG(e,t){const n=MG(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}const Jb={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function ev(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function tv(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}const AS={"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},LG=128e3;function O0(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,p=Math.min(f/s,1),g=1-Math.pow(1-p,3);n(Math.round(l+(c-l)*g)),p<1?i.current=requestAnimationFrame(u):n(c)};return i.current=requestAnimationFrame(u),()=>cancelAnimationFrame(i.current)},[e]),t}function OG({messages:e,isBusy:t,activeModel:n,sessionModel:r,isPrivateMode:a,registryEntries:i}){var K,W;var{t:s}=vt();const l=e.filter(j=>{var U;return((U=j.info)==null?void 0:U.role)==="user"}).length,c=e.filter(j=>{var U;return((U=j.info)==null?void 0:U.role)==="assistant"}).length;let u=0,d=0,f=0,p=null,g=null;for(let j=e.length-1;j>=0;j--){const U=e[j];if(((K=U.info)==null?void 0:K.role)==="assistant"&&((W=U.info)==null?void 0:W.mode)!=="compaction"){const le=U.info.tokens;if(le&&(le.input||le.output)){!p&&U.info.modelID&&(p=U.info.modelID),u=le.lastInput??le.input??0,d=le.lastOutput??le.output??0,f=le.lastReasoning??le.reasoning??0,U.info.contextLimit&&(g=U.info.contextLimit);break}}}const m=O0(u),y=O0(d),v=O0(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:w}=IG(k,p),_=null;if(a){N="privacy",w="privacy";let j=null;typeof r=="string"&&r?j=r.includes("/")?r.split("/").pop():r:r&&r.modelID&&(j=r.modelID),_=j||(n?String(n).split("/").pop():null)}else p&&w&&p!==w&&(_=p);const T=h.useMemo(()=>{const j={};if(i&&i.length>0){for(const U of i)if(U.limit&&typeof U.limit.context=="number"&&U.limit.context>0){j[U.key]=U.limit.context;const le=U.key.includes("/")?U.key.split("/").pop():U.key;le&&(j[le]=U.limit.context)}}return j},[i]),A=p||N,R=!!(p&&w&&p!==w)&&(T[k]||T[N]||AS[N])||g||T[A]||T[k]||AS[A]||LG,$=Math.min(100,Math.round(m/R*100));let F="bg-green-500";$>=90?F="bg-red-500":$>=75?F="bg-orange-500":$>=50&&(F="bg-yellow-500");const G="border-gray-200 dark:border-gray-800",P="text-gray-500 dark:text-gray-400",M="text-gray-500 dark:text-gray-400",S="text-gray-700 dark:text-gray-300",I="border-gray-100 dark:border-gray-800";return o.jsxs("div",{className:`p-4 border-t ${G}`,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 ${S}`,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 ${S} truncate ml-2 max-w-[140px]`,children:RS(N)})]}),_&&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:RS(_)})]}),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 ${S}`,children:s(t?"token_usage.generating":"token_usage.idle")})]})]}),b?o.jsx(o.Fragment,{children:o.jsxs("div",{className:`border-t ${I} 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:[$,"% of ",(R/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 ${F} transition-all duration-300`,style:{width:`${$}%`}})})]}),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 ${S} 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 ${S} 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 ${S} tabular-nums`,children:v.toLocaleString()})]}),o.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${I}`,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 RS(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 DG({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:i}){const{t:s}=vt(),[l,c]=h.useState(!1),u=h.useRef(null),[d,f]=h.useState(-1),p=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 w=p.current.length;if(!w)return N;const _=typeof N=="number"?N:-1;let T=_;return k.key==="ArrowDown"?T=_<w-1?_+1:0:k.key==="ArrowUp"?T=_>0?_-1:w-1:k.key==="Home"?T=0:k.key==="End"&&(T=w-1),p.current[T]&&p.current[T].focus(),T}))}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[l]);const g=typeof e=="string"&&e.trim()?e.trim():null,m=g!=null,y=Array.isArray(n)?n:[],v=PG(g,t,y,s),x=h.useCallback(b=>{r(b===t||g&&g===b?null:b),c(!1)},[g,t,r]);return p.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=g===b.key,w=!!t&&(b.key===t||b.target===t||b.url===t),_=b.builtin?b.key:b.displayName||b.key;return o.jsxs("button",{type:"button",ref:T=>{p.current[k]=T},tabIndex:d===k?0:-1,role:"menuitemradio","aria-checked":N||!m&&w,onClick:()=>x(b.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(N||!m&&w?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[o.jsx("span",{className:"font-medium",children:_}),w&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",s("model_selector.default_label"),")"]})]},b.key)})]})]})}function PG(e,t,n,r){return e?MS(e,n):t?MS(t,n):r("model_selector.default_label")}function FG(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 MS(e,t){if(!e)return"";const n=FG(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function BG(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],p=h.useState(!1),g=p[0],m=p[1],y=h.useRef(null),v=t instanceof Array?new Set(t):new Set,x=h.useCallback(async function(){m(!0);try{var _=await Rb();f(_||[])}catch{}finally{m(!1)}},[]);h.useEffect(function(){x()},[x]),h.useEffect(function(){if(!l)return;function _(T){y.current&&!y.current.contains(T.target)&&c(!1)}return document.addEventListener("mousedown",_),function(){document.removeEventListener("mousedown",_)}},[l]);var b=v.size,k=v.has("agent"),N=k?b-1:b,w=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"})}),w>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:w})]}),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")})]}),g?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(_){var T=v.has(_.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:_.name}),o.jsx("button",{onClick:function(){n(_.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")})})]},_.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 zG({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 UG({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 qG({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 $G({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 HG({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 WG({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 VG({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 GG({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 KG({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 YG({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 QG({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 XG({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 ZG({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 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:"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 eK({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 IS={gmail:UG,gdrive:qG,discord:$G,whatsapp:HG,wrike:WG,gtasks:VG,mailchimp:GG,bamboohr:KG,pandadoc:YG,exa:QG,dropbox:XG,freshbooks:ZG,gcal:JG,docx2md:eK};function tK(e){return Object.prototype.hasOwnProperty.call(IS,e)?IS[e]:zG}const LS={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 nK({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 rK({skill:e,onClose:t,onSaved:n}){var{t:r}=vt(),a=dl(),[i,s]=h.useState({}),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,p]=h.useState(null),[g,m]=h.useState(!1),[y,v]=h.useState(null);h.useEffect(function(){var A=!1;async function D(){try{var R=await uB(e.name);if(A)return;v(R);for(var $=Object.create(null),F=Object.keys(R.tokens||{}),G=0;G<F.length;G++){var P=F[G],M=R.tokens[P]||{},S=M.env||P;$[S]=""}s($),c(!1)}catch(I){A||(p(I.message),c(!1))}}return D(),function(){A=!0}},[e.name]);var x=h.useMemo(function(){if(!y||!y.tokens)return null;for(var A=Object.keys(y.tokens),D=0;D<A.length;D++){var R=y.tokens[A[D]]||{};if(R.description&&R.description.includes("OAuth")){for(var $=null,F=null,G=null,P=Object.entries(y.tokens),M=0;M<P.length;M++){var S=P[M][0];S.includes("REFRESH_TOKEN")&&($=S),(S.includes("CLIENT_ID")||S.includes("APP_KEY"))&&(F=S),(S.includes("CLIENT_SECRET")||S.includes("APP_SECRET"))&&(G=S)}if($&&F){var I=y.tokens[$]&&y.tokens[$].configured,B=y.tokens[F]&&y.tokens[F].configured,Q=G&&y.tokens[G]&&y.tokens[G].configured,C="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?C="Google":e.name==="dropbox"?C="Dropbox":e.name==="freshbooks"&&(C="FreshBooks"),{provider:C,canConnect:B&&Q&&!I,refreshConfigured:I,clientIdConfigured:B,clientSecretConfigured:Q}}}}return null},[y,e.name]),b=h.useCallback(async function(){p(null),m(!0);try{var A=await xB(e.name),D=600,R=700,$=(window.screen.width-D)/2,F=(window.screen.height-R)/2,G=window.open(A.authorizeUrl,"oauth_popup","width="+D+",height="+R+",left="+$+",top="+F+",scrollbars=yes");if(G)var P=setInterval(function(){G.closed&&(clearInterval(P),m(!1),n())},500);else p("Popup blocked. Please allow popups or visit: "+A.authorizeUrl),m(!1)}catch(M){p(M.message),m(!1)}},[e.name,n]),k=h.useCallback(async function(){p(null),d(!0);try{for(var A=Object.create(null),D=Object.keys(i),R=0;R<D.length;R++){var $=D[R];i[$]&&i[$].trim()&&(A[$]=i[$].trim())}if(Object.keys(A).length===0){p(r("skills.enter_token")),d(!1);return}await gB(e.name,A),n()}catch(F){p(F.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})){p(null),d(!0);try{await hB(e.name),n()}catch(A){p(A.message)}finally{d(!1)}}},[e.name,n,a,r]),w=h.useCallback(function(A,D){s(function(R){var $=Object.assign(Object.create(null),R);return $[A]=D,$})},[]),_=y?Object.entries(y.tokens||{}).map(function(A){var D=A[0],R=A[1],$=R&&R.env||D;return{name:D,env:$,description:R.description,configured:R.configured,maskedValue:R.maskedValue}}):[],T=h.useRef(null);return h.useEffect(function(){function A(D){D.key==="Escape"&&t()}return document.addEventListener("keydown",A),T.current&&T.current.focus(),function(){document.removeEventListener("keydown",A)}},[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(A){A.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&&_.length>0&&o.jsx("div",{className:"space-y-3 mb-4",children:_.map(function(A){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[A.env,A.configured&&o.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:A.maskedValue}),")"]})]}),A.description&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:A.description}),o.jsx("input",{type:"password",placeholder:A.configured?r("skills.leave_blank"):r("skills.enter_value"),value:i[A.env]||"",onChange:function(D){w(A.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"})]},A.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:g||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:g?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&&_.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&&_.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 aK({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:i,onUpdate:s,onUninstall:l,skillDefaultEnabled:c,onToggleDefault:u,t:d}){var f=tK(e.name),p=Object.prototype.hasOwnProperty.call(LS,e.name)?LS[e.name]:"#6B7280",[g,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:p}}),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:p+"15"},children:o.jsx(f,{className:"w-5 h-5",style:{color:p}})}),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(nK,{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:g,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:g?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 iK({onBack:e}){var{t}=vt(),[n,r]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(null),[p,g]=h.useState("all"),[m,y]=h.useState(""),[v,x]=h.useState(!1),[b,k]=h.useState(Object.create(null)),[N,w]=h.useState(null),[_,T]=h.useState(!1),[A,D]=h.useState(Object.create(null)),R=dl(),$=h.useCallback(async function(){l(!0),u(null),T(!1);try{var U=await Promise.allSettled([Rb(),cB(),eT()]),le=U[0].status==="fulfilled"?U[0].value:[],Z=U[1].status==="fulfilled"?U[1].value:[],ke=U[2].status==="fulfilled"?U[2].value.skillDefaults||{}:{};r(le),i(Z),D(ke);var re=[];U[0].status==="rejected"&&re.push(t("skills.load_installed_failed",{error:U[0].reason.message})),U[1].status==="rejected"&&re.push(t("skills.load_marketplace_failed",{error:U[1].reason.message})),re.length>0&&u(re.join("; "))}catch(X){u(X.message)}finally{l(!1)}},[t]);h.useEffect(function(){$()},[$]);var F=[],G=new Set(n.map(function(U){return U.name}));n.forEach(function(U){F.push(Object.assign({},U,{_installed:!0}))}),a.forEach(function(U){G.has(U.name)||F.push(Object.assign({},U,{_installed:!1,allTokensConfigured:!1}))});var P=F;if(p==="installed"?P=F.filter(function(U){return U._installed}):p==="available"&&(P=F.filter(function(U){return!U._installed})),m){var M=m.toLowerCase();P=P.filter(function(U){return U.name&&U.name.toLowerCase().indexOf(M)!==-1||U.description&&U.description.toLowerCase().indexOf(M)!==-1||U.category&&U.category.toLowerCase().indexOf(M)!==-1})}var S=h.useCallback(async function(U){try{await dB(U.name),$()}catch(le){u(t("skills.install_failed",{error:le.message}))}},[$,t]),I=h.useCallback(function(U){f(U)},[]),B=h.useCallback(async function(U){if(await R({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:U.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await mB(U.name),$()}catch(le){u(t("skills.uninstall_failed",{error:le.message}))}},[$,R,t]),Q=h.useCallback(function(){f(null),$()},[$]),C=h.useCallback(async function(U,le){D(function(ke){var re=Object.assign({},ke);return le?re[U]=!0:delete re[U],re});try{var Z={};Z[U]=le,await yB(Z)}catch(ke){D(function(re){var X=Object.assign({},re);return le?delete X[U]:X[U]=!0,X}),u(ke.message)}},[]),K=h.useCallback(async function(){x(!0),u(null);try{var U=await pB(),le=Object.create(null);(U.skills||[]).forEach(function(Z){le[Z.name]={hasUpdate:Z.hasUpdate,latestVersion:Z.latestVersion,currentVersion:Z.currentVersion}}),k(le),T(!0)}catch(Z){u(Z.message)}finally{x(!1)}},[]),W=h.useCallback(async function(U){w(U),u(null);try{var le=await fB(U);le.updated&&(k(function(Z){var ke=Object.assign(Object.create(null),Z);return ke[U]={hasUpdate:!1,latestVersion:Z[U]?Z[U].latestVersion:null,currentVersion:Z[U]?Z[U].currentVersion:null},ke}),$())}catch(Z){u(t("skills.update_failed")+": "+Z.message)}finally{w(null)}},[$,t]),j=Object.values(b).filter(function(U){return U&&U.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(U){return!G.has(U.name)}).length})})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:K,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})}),_&&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(U){return o.jsx("button",{onClick:function(){g(U)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(p===U?"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_"+U)},U)})})]})]}),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(U){y(U.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(U){return o.jsx(aK,{skill:U,installed:U._installed,updateInfo:b[U.name],updatingSkill:N,onConfigure:I,onInstall:S,onUpdate:W,onUninstall:U._installed?B:null,skillDefaultEnabled:!!A[U.name],onToggleDefault:U._installed?C:null,t},U.name)})})]}),d&&o.jsx(rK,{skill:d,onClose:function(){f(null)},onSaved:Q})]})}const Pt="";function Ft(e,t={}){return fetch(e,{credentials:"include",...t})}async function sK(){const e=await Ft(Pt+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function oK(e){const t=await Ft(Pt+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function lx(e){const t=await Ft(Pt+"/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 cx(e){const t=await Ft(Pt+"/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 Eu(e,t){const n={};t&&t.clean&&(n.clean=!0);const r=await Ft(Pt+"/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 ux(e,t){const n={};t&&t.level&&(n.level=t.level),t&&t.span&&(n.span=t.span);const r=await Ft(Pt+"/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 dx(e){const t=await Ft(Pt+"/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 lK(e,t,n,r){const a={message:t,priority:n};r!=null&&(a.replyToInbox=r);const i=await Ft(Pt+"/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 cK(e,t,n){const r={message:t};n!=null&&(r.replyToInbox=n);const a=await Ft(Pt+"/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 uK(e,t){let n=Pt+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(n+="?refresh=true");const r=await Ft(n);if(!r.ok)throw new Error("Failed to fetch agent messages: "+r.statusText);return r.json()}async function dK(){const e=await Ft(Pt+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function fK(e){const t=await Ft(Pt+"/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 pK(){const e=await Ft(Pt+"/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 gK(e,t=!1){const n=Pt+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),r=await Ft(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 hK(e){const t=await Ft(Pt+"/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 SA(){const e=await Ft(Pt+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function nv(){const e=await Ft(Pt+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function mK(e,t){const n=await Ft(Pt+"/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 yK(e){const t=await Ft(Pt+"/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 xK(e,t){const n=await Ft(Pt+"/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 CA(e){const t=await Ft(Pt+"/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 bK(e,t){const n=new URLSearchParams,r=n.toString()?"?"+n.toString():"",a=await Ft(Pt+"/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 D0(){const e=await Ft(Pt+"/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 vK(){const e=await Ft(Pt+"/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 OS(){const e=await Ft(Pt+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function DS(e,t){const n=await Ft(Pt+"/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 PS(e){const t=await Ft(Pt+"/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 jA(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 kK(e){const t=jA(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 bc(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function _K({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(p=>(p.input||0)+(p.output||0)+(p.cached||0)),1),l=a/e.length,c=Math.max(8,l*.6),u=(l-c)/2,d=p=>i-p/s*i,f=[0,.25,.5,.75,1].map(p=>Math.round(s*p));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((p,g)=>{const m=r.top+d(p);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:bc(p)})]},g)}),e.map((p,g)=>{const m=r.left+g*l+u,y=p.input||0,v=p.output||0,x=p.cached||0,b=y/s*i,k=v/s*i,N=x/s*i,w=r.top+i-b,_=w-k,T=_-N,A=jA(p.date),D=["S","M","T","W","T","F","S"][A.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:w,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:_,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)-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)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:kK(p.date)}),o.jsxs("text",{x:m+c/2,y:Math.min(T,_,w)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",bc(y)]}),o.jsxs("text",{x:m+c/2,y:Math.min(T,_,w)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",bc(v)]}),o.jsxs("text",{x:m+c/2,y:Math.min(T,_,w)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",bc(x)]})]})]},g)})]}),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 wK({agentName:e,onClose:t,onToolPartsChange:n,hackerMode:r}){var{t:a}=vt(),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(null),[f,p]=h.useState(!1),[g,m]=h.useState(""),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,N]=h.useState(!1),[w,_]=h.useState(!1),[T,A]=h.useState(!1),D=h.useRef(null),R=h.useRef(null),$=h.useRef(!0),F=h.useRef([]),G=h.useRef(null),P=h.useRef(null),M=h.useRef(null),S=h.useRef(null);h.useEffect(function(){F.current=i},[i]);var I=h.useCallback(async function(Z,ke){if(e){ke!==!1&&c(!0);try{var re=await uK(e,{refresh:!!Z}),X=re.messages||[],Ne=F.current,ve=X.length!==Ne.length;if(!ve&&X.length>0&&Ne.length>0){var me=X[X.length-1],pe=Ne[Ne.length-1];if(me.info.id!==pe.info.id&&(ve=!0),!ve){var Le=me.parts||[],Se=pe.parts||[];if(Le.length!==Se.length)ve=!0;else for(var Te=0;Te<Le.length&&!ve;Te++){var Fe=Le[Te]||{},fe=Se[Te]||{},xe=Fe.state?Fe.state.status:Fe.status,Ce=fe.state?fe.state.status:fe.status;(Fe.id!==fe.id||xe!==Ce)&&(ve=!0)}}}ve&&s(X.slice()),d(null)}catch(ue){console.error("Failed to load messages:",ue),d(ue.message)}finally{ke!==!1&&c(!1)}}},[e]);h.useEffect(function(){I(!0);var Z=setInterval(function(){I(!0,!1)},5e3);return function(){clearInterval(Z),P.current&&clearTimeout(P.current),S.current&&clearTimeout(S.current)}},[I]),h.useEffect(function(){$.current&&D.current&&D.current.scrollIntoView({behavior:"smooth"})},[i]);var B=h.useCallback(function(){var Z=R.current;Z&&($.current=Z.scrollHeight-Z.scrollTop-Z.clientHeight<50)},[]),Q=h.useMemo(function(){for(var Z=null,ke=i.length-1;ke>=0;ke--)if(i[ke].info&&i[ke].info.role==="assistant"){Z=i[ke];break}return Z?(Z.parts||[]).filter(function(re){return re.type==="tool"}):[]},[i]);h.useEffect(function(){n&&n(Q)},[Q,n]);var C=h.useCallback(async function(){if(!(!g.trim()||x)){b(!0),N(!1),_(!1),A(!1),d(null);try{await lK(e,g.trim(),"normal",y),m(""),N(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(function(){N(!1),p(!1),P.current=null},1500),S.current&&clearTimeout(S.current),S.current=setTimeout(function(){I(!0,!1),S.current=null},500)}catch(Z){d(Z.message)}finally{b(!1)}}},[e,g,y,x,I]),K=h.useCallback(async function(){if(!(!g.trim()||x)){if(!T){A(!0);return}b(!0),N(!1),_(!0),A(!1),d(null);try{await cK(e,g.trim(),y),m(""),N(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(function(){N(!1),p(!1),P.current=null},1500),S.current&&clearTimeout(S.current),S.current=setTimeout(function(){I(!0,!1),S.current=null},500)}catch(Z){d(Z.message)}finally{b(!1)}}},[e,g,x,T,y,I]),W=h.useCallback(function(){p(!1),A(!1),d(null),P.current&&(clearTimeout(P.current),P.current=null),S.current&&(clearTimeout(S.current),S.current=null),N(!1)},[]);h.useEffect(function(){if(!f)return;function Z(ke){ke.key==="Escape"&&!x&&W()}return document.addEventListener("keydown",Z),function(){document.removeEventListener("keydown",Z)}},[f,W,x]),h.useEffect(function(){if(!(!f||!M.current)){var Z=M.current;Z.contains(document.activeElement)||Z.focus()}},[f]);var j=h.useCallback(function(Z){Z.target===Z.currentTarget&&!x&&W()},[W,x]),U=h.useCallback(function(Z){Z.key==="Enter"&&!Z.shiftKey&&!T&&(Z.preventDefault(),C())},[C,T]),le=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(){$.current=!0,I(!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 ${w?"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:w?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(w?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),o.jsx("div",{ref:R,onScroll:B,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(Z){return o.jsx(nT,{message:Z.info,parts:Z.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:le,hackerMode:r,hideThinking:!1},Z.info.id)}),o.jsx("div",{ref:D})]})}),o.jsx("div",{className:"absolute bottom-6 right-6",children:o.jsxs("button",{onClick:function(){p(!0),A(!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:W,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(Z){v(Z.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:G,value:g,onChange:function(Z){m(Z.target.value)},onKeyDown:U,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(w?"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(){A(!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:K,disabled:!g.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&&w?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:K,disabled:!g.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:W,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:C,disabled:!g.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&&!w?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 EK({isOpen:e,agent:t,onClose:n,onUpdated:r,onDeleted:a}){const{t:i}=vt(),[s,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState(""),[p,g]=h.useState(""),[m,y]=h.useState(!1),[v,x]=h.useState([]),[b,k]=h.useState(!1),[N,w]=h.useState(""),[_,T]=h.useState(null),[A,D]=h.useState(!1),[R,$]=h.useState([]),[F,G]=h.useState([]),[P,M]=h.useState(!1),[S,I]=h.useState(!0),[B,Q]=h.useState(!1),[C,K]=h.useState(!1),[W,j]=h.useState(null),[U,le]=h.useState(!1),[Z,ke]=h.useState(!1),[re,X]=h.useState("general"),[Ne,ve]=h.useState(!1);h.useEffect(()=>{const ue={cancelled:!1};if(e&&t&&!Ne){me();const he=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";pe(ue,he),ve(!0)}return e||(ve(!1),y(!1),g(""),I(!0),G([])),()=>{ue.cancelled=!0}},[e,t==null?void 0:t.name]);const me=()=>{if(!t)return;l(t.displayName||t.name||""),u(t.cwd||"");const ue=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";f(ue),y(!1),g(""),x(Array.isArray(t.skills)?t.skills:[]),k(!!t.skipInitialPrompt)},pe=async(ue,he)=>{M(!0),I(!0),t!=null&&t.name&&Q(!0);const _e=[SA(),nv()];t!=null&&t.name&&_e.push(yK(t.name));const Pe=await Promise.allSettled(_e);if(ue.cancelled)return;const[Xe,H,z]=Pe;if(Xe.status==="fulfilled"?$(Xe.value):(console.error("Failed to load skills:",Xe.reason),$([])),M(!1),H.status==="fulfilled"){const te=H.value;G(te);const ce=he;te.find(je=>je.id===ce)||(y(!0),g(ce),f(ce))}else console.error("Failed to load models:",H.reason),G([]);if(I(!1),t!=null&&t.name&&z){if(z.status==="fulfilled"){const te=z.value;w(te.content||""),T(te.path||null),D(te.exists||!1)}else console.error("Failed to load AGENTS.md:",z.reason),w(""),T(null),D(!1);Q(!1)}},Le=ue=>{x(he=>he.includes(ue)?he.filter(_e=>_e!==ue):[...he,ue])},Se=()=>{v.length===R.length?x([]):x(R.map(ue=>ue.name))},Te=async ue=>{if(ue&&ue.preventDefault(),!!(t!=null&&t.name)){j(null),K(!0);try{await mK(t.name,{displayName:s.trim()||t.name,workspace:c.trim(),model:d,skipInitialPrompt:b,skills:v}),_&&N!==null&&!Ce&&await xK(t.name,N),r&&r(t.name),n()}catch(he){j(he.message)}finally{K(!1)}}},Fe=async()=>{if(t!=null&&t.name){ke(!0),j(null);try{await gK(t.name,!0),a&&a(t.name),n()}catch(ue){j(ue.message),le(!1)}finally{ke(!1)}}},fe=()=>{!C&&!Z&&(j(null),le(!1),X("general"),n())};if(!e||!t)return null;const xe=t.state==="working"||t.state==="idle"||t.state==="starting",Ce=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}),U&&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:()=>le(!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}),"?",xe&&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:()=>le(!1),disabled:Z,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:Fe,disabled:Z,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:Z?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,xe&&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:C||Z,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:()=>X("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${re==="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:()=>X("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${re==="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:ue=>ue.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[W&&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:W}),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"})})})]}),re==="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:ue=>l(ue.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")}),xe?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:ue=>u(ue.target.value),placeholder:i("agent_edit.working_dir_placeholder"),disabled:C||Z,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"}),xe?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")}),S?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")}):F.length===0?o.jsx("input",{type:"text",value:d,onChange:ue=>f(ue.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:ue=>{ue.target.value==="__custom__"?(y(!0),d&&d!=="__custom__"&&g(d)):(y(!1),f(ue.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 ue=tv(F);return Object.entries(ue).map(([he,_e])=>o.jsx("optgroup",{label:Jb[he]||he,children:_e.map(Pe=>o.jsxs("option",{value:Pe.id,children:[Pe.name,ev(Pe.tier)]},Pe.id))},he))})(),o.jsx("option",{value:"__custom__",children:i("agent_edit.custom_model")})]}),m&&o.jsx("input",{type:"text",value:p,onChange:ue=>{g(ue.target.value),f(ue.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:ue=>k(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: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:Se,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:v.length===R.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")}):R.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:R.map(ue=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${v.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:v.includes(ue.name),onChange:()=>Le(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:i("agent_edit.skills_selected",{count:v.length})})]})]}),re==="soul"&&o.jsxs("div",{className:"space-y-4",children:[_&&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:[_,!A&&o.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:i("agent_edit.will_be_created")})]}),!_&&!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")}),Ce&&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:ue=>w(ue.target.value),disabled:!_||Ce,rows:16,placeholder:i(B?"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:()=>le(!0),disabled:C||Z,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:C||Z,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:Te,disabled:C||Z,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:C?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 FS={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"},BS={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 NK({state:e}){const t=FS[e]||FS.stopped,n=BS[e]||BS.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 SK(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 P0({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 ci({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 CK({agent:e,onClose:t,onAction:n,onToolPartsChange:r,hackerMode:a}){const{t:i}=vt(),[s,l]=h.useState(e),[c,u]=h.useState(null),[d,f]=h.useState(null),[p,g]=h.useState(!1),[m,y]=h.useState(!1),v=h.useCallback(async()=>{if(e!=null&&e.name)try{const A=await oK(e.name);l(A),u(null)}catch(A){console.error("Failed to load agent:",A),u(A.message)}},[e==null?void 0:e.name]);h.useEffect(()=>{v();const A=setInterval(v,5e3);return()=>clearInterval(A)},[v]);const x=h.useCallback(async A=>{f(A),u(null);try{A==="start"?await lx(s.name):A==="stop"?await cx(s.name):A==="restart"?await Eu(s.name):A==="cleanRestart"?await Eu(s.name,{clean:!0}):A==="pause"?await ux(s.name,{level:"tools"}):A==="unpause"&&await dx(s.name),await v(),n&&n(s.name,A)}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",w=(s==null?void 0:s.tokens)||{input:0,output:0,cached:0,total:0},_=Math.max(w.input,w.output,w.cached,1),T=(s==null?void 0:s.cost)||{input:0,output:0,cached:0,total:0};return p?o.jsx(wK,{agentName:s==null?void 0:s.name,onClose:()=>{g(!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(NK,{state:(s==null?void 0:s.state)||"stopped"})]})]}),o.jsx(EK,{isOpen:m,agent:s,onClose:()=>y(!1),onUpdated:A=>{v(),n&&n(A,"updated")},onDeleted:A=>{n&&n(A,"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(ci,{label:i("agent_detail.model"),value:s==null?void 0:s.model,mono:!0}),o.jsx(ci,{label:i("agent_detail.port"),value:s==null?void 0:s.port,mono:!0}),o.jsx(ci,{label:i("agent_detail.pid"),value:s==null?void 0:s.pid,mono:!0}),o.jsx(ci,{label:i("agent_detail.session_id"),value:s!=null&&s.sessionId?s.sessionId.slice(0,12)+"...":null,mono:!0}),o.jsx(ci,{label:i("agent_detail.uptime"),value:SK(s==null?void 0:s.startedAt)}),o.jsx(ci,{label:i("agent_detail.iteration"),value:s==null?void 0:s.iteration}),o.jsx(ci,{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(P0,{label:i("agent_detail.token_input"),value:w.input,max:_,color:"bg-blue-500"}),o.jsx(P0,{label:i("agent_detail.token_output"),value:w.output,max:_,color:"bg-green-500"}),o.jsx(P0,{label:i("agent_detail.token_cached"),value:w.cached,max:_,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:w.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(_K,{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:()=>g(!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 CA(s.name)}catch(A){u(i("agents.export_error")+": "+A.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 vc=["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"],kc=["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 zS(e=[],t=100){const n=new Set(e.map(s=>s.toLowerCase()));for(let s=0;s<t;s++){const l=vc[Math.floor(Math.random()*vc.length)],c=kc[Math.floor(Math.random()*kc.length)],u=`${l}-${c}`;if(!n.has(u))return u}const r=vc[Math.floor(Math.random()*vc.length)],a=kc[Math.floor(Math.random()*kc.length)],i=Math.floor(Math.random()*1e3);return`${r}-${a}-${i}`}function US(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 jK(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const _c=`# 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 TK({isOpen:e,onClose:t,existingAgentNames:n=[],onCreated:r}){const{t:a}=vt(),[i,s]=h.useState(""),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,p]=h.useState("github-copilot/claude-opus-4.6"),[g,m]=h.useState(""),[y,v]=h.useState(!1),[x,b]=h.useState(_c),[k,N]=h.useState([]),[w,_]=h.useState(!1),[T,A]=h.useState([]),[D,R]=h.useState([]),[$,F]=h.useState(!1),[G,P]=h.useState(!0),[M,S]=h.useState({}),[I,B]=h.useState(!1),[Q,C]=h.useState(null);h.useEffect(()=>{const re={cancelled:!1};return e?(s(zS(n)),c(""),d(""),p("github-copilot/claude-opus-4.6"),m(""),v(!1),b(_c),N([]),_(!1),S({}),B(!1),C(null),K(re,"github-copilot/claude-opus-4.6")):(P(!0),R([])),()=>{re.cancelled=!0}},[e]);const K=async(re,X)=>{F(!0),P(!0);const[Ne,ve]=await Promise.allSettled([SA(),nv()]);if(!re.cancelled){if(Ne.status==="fulfilled"?A(Ne.value):(console.error("Failed to load skills:",Ne.reason),A([])),F(!1),ve.status==="fulfilled"){const me=ve.value;R(me),me.find(pe=>pe.id===X)||(v(!0),m(X))}else console.error("Failed to load models:",ve.reason),R([]);P(!1)}},W=()=>{const re=zS(n);s(re),S(X=>({...X,name:null}))},j=re=>{const X=re.target.value;s(X);const Ne=US(X,n);Ne.valid?S(ve=>({...ve,name:null})):S(ve=>({...ve,name:Ne.error}))},U=re=>{N(X=>X.includes(re)?X.filter(Ne=>Ne!==re):[...X,re])},le=()=>{k.length===T.length?N([]):N(T.map(re=>re.name))},Z=async re=>{re&&re.preventDefault(),C(null);const X={},Ne=US(i,n);if(Ne.valid||(X.name=Ne.error),u.trim()||(X.workspace=a("agent_create.validate_workspace")),f||(X.model=a("agent_create.validate_model")),Object.keys(X).length>0){S(X);return}B(!0);try{const ve={name:jK(i),displayName:l.trim()||null,workspace:u.trim(),model:f,soul:x.trim()||null,skills:k,skipInitialPrompt:w},me=await hK(ve);s(""),c(""),d(""),p("github-copilot/claude-opus-4.6"),b(_c),N([]),_(!1),S({}),r&&r(me.agent),t()}catch(ve){C(ve.message)}finally{B(!1)}},ke=()=>{I||(S({}),C(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:ke}),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:ke,disabled:I,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:re=>re.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:W,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:re=>c(re.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:re=>d(re.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")}),G?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:re=>p(re.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:re=>{re.target.value==="__custom__"?(v(!0),f&&f!=="__custom__"&&m(f)):(v(!1),p(re.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 re=tv(D);return Object.entries(re).map(([Ne,ve])=>o.jsx("optgroup",{label:Jb[Ne]||Ne,children:ve.map(me=>o.jsxs("option",{value:me.id,children:[me.name,ev(me.tier)]},me.id))},Ne))})(),o.jsx("option",{value:"__custom__",children:a("agent_create.custom_model")})]}),y&&o.jsx("input",{type:"text",value:g,onChange:re=>{m(re.target.value),p(re.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:w,onChange:re=>_(re.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:le,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:$?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(re=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${k.includes(re.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(re.name),onChange:()=>U(re.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:re.description,children:[re.icon&&o.jsx("span",{className:"mr-1",children:re.icon}),re.name]})]},re.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(_c),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:a("agent_create.reset_default")})]}),o.jsx("textarea",{value:x,onChange:re=>b(re.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:ke,disabled:I,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:Z,disabled:I||!!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:I?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 qS="pave-agents-panel-collapsed",$S={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"},HS={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"})})},AK="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",RK="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";function MK({state:e}){const t=$S[e]||$S.stopped,n=HS[e]||HS.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 IK(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 LK({agent:e,onAction:t,onSelect:n,onExport:r,actionLoading:a,isSelected:i,onToggleSelect:s}){const{t:l}=vt(),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:p=>{p.stopPropagation(),s&&s(e.name)},onClick:p=>p.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(MK,{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:IK(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:p=>{p.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:p=>{p.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:p=>{p.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:p=>{p.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:p=>{p.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:p=>{p.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:p=>{p.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:AK}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:RK})]})})]})]})}function OK({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 DK({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:p}=vt(),[g,m]=h.useState([]),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,N]=h.useState(null),[w,_]=h.useState(null),[T,A]=h.useState(null),[D,R]=h.useState(null),[$,F]=h.useState(!1),[G,P]=h.useState(new Set),[M,S]=h.useState(null),[I,B]=h.useState(()=>{if(typeof window>"u")return!1;try{return localStorage.getItem(qS)==="true"}catch{return!1}}),Q=h.useMemo(()=>Array.isArray(M)?M.length===0?M:!a&&M.every(te=>te.state&&te.state.status==="completed"||te.state&&te.state.status==="error")?[]:M:null,[M,a]),C=h.useRef(null),K=h.useRef(!0);h.useEffect(()=>()=>{K.current=!1,j.current&&clearTimeout(j.current)},[]),h.useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(qS,I?"true":"false")}catch{}},[I]);const W=h.useRef(!1),j=h.useRef(null),U=h.useCallback(async z=>{if(C.current)return z?(W.current=!0,C.current.then(()=>C.current||Promise.resolve())):C.current;const te=(async()=>{let ce=!1;try{const je=await sK();if(!K.current)return ce;const Be=Array.isArray(je)?je:[];m(Be),R(Ke=>Ke&&(Be.find(ot=>ot.name===Ke.name)||null)),_(null),ce=!0}catch(je){if(!K.current)return ce;console.error("Failed to load agents:",je),_(je.message)}finally{K.current&&v(!1),C.current=null,W.current&&K.current&&(W.current=!1,U())}return ce})();return C.current=te,te},[]),le=h.useCallback(async()=>{if(!K.current)return;b(!0),N(null),j.current&&(clearTimeout(j.current),j.current=null);let z=!1;try{const[te]=await Promise.all([U(!0),new Promise(ce=>{setTimeout(ce,400)})]);z=te===!0}catch{z=!1}finally{K.current&&(b(!1),N(z?"success":"error"),j.current=setTimeout(()=>{K.current&&N(null),j.current=null},1e3))}},[U]);h.useEffect(()=>{U();const z=setInterval(U,5e3);return()=>clearInterval(z)},[U]),h.useEffect(()=>{if(!n||g.length===0)return;const z=g.find(te=>te.name===n);z&&(R(z),S(null),t&&t(z),r&&r())},[n,g,t,r]);const Z=h.useCallback(async(z,te)=>{A({name:z,action:te}),_(null);try{te==="start"?await lx(z):te==="stop"?await cx(z):te==="restart"?await Eu(z):te==="pause"?await ux(z,{level:"iterations"}):te==="unpause"&&await dx(z),await U(!0)}catch(ce){_(ce.message)}finally{A(null)}},[U]),ke=g.reduce((z,te)=>{var ce;return z+(((ce=te.cost)==null?void 0:ce.total)||0)},0),re=h.useCallback(z=>{R(z),S(null),t&&t(z)},[t]),X=h.useCallback(()=>{R(null),S(null)},[]),Ne=h.useCallback(z=>{P(te=>{const ce=new Set(te);return ce.has(z)?ce.delete(z):ce.add(z),ce})},[]),ve=h.useCallback(()=>{P(new Set(g.map(z=>z.name)))},[g]),me=h.useCallback(()=>{P(new Set)},[]),pe=h.useCallback(async z=>{var ce;if(G.size===0)return;_(null);const te=[...G];try{const Be=(await Promise.allSettled(te.map(async Ke=>{z==="pause"?await ux(Ke,{level:"iterations"}):z==="unpause"?await dx(Ke):z==="stop"?await cx(Ke):z==="restart"?await Eu(Ke):z==="start"&&await lx(Ke)}))).filter(Ke=>Ke.status==="rejected");Be.length>0&&_(((ce=Be[0].reason)==null?void 0:ce.message)||"Some actions failed"),await U(!0)}catch(je){_(je.message)}},[G,U]),Le=h.useCallback(()=>{U(!0)},[U]),Se=h.useCallback(z=>{U(!0),z&&R(z)},[U]),[Te,Fe]=h.useState(!1),[fe,xe]=h.useState(null),Ce=h.useRef(null);h.useEffect(()=>()=>{Ce.current&&clearTimeout(Ce.current)},[]);const ue=h.useCallback(async z=>{try{await CA(z)}catch(te){_(p("agents.export_error")+": "+te.message)}},[p]),he=h.useCallback(async z=>{try{xe(null),await bK(z),xe({type:"success",message:p("agents.import_success")}),U(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>{xe(te=>te&&te.type==="success"?null:te),Ce.current=null},5e3)}catch(te){xe({type:"error",message:p("agents.import_error")+": "+te.message})}},[p,U]),_e=h.useCallback(()=>{const z=document.createElement("input");z.type="file",z.accept=".yaml,.yml",z.onchange=te=>{const ce=te&&te.target&&te.target.files,je=ce&&ce[0];if(!je)return;const Be=je.name.toLowerCase();if(!Be.endsWith(".yaml")&&!Be.endsWith(".yml")){xe({type:"error",message:p("agents.import_invalid_file")});return}if(je.size>10*1024*1024){xe({type:"error",message:p("agents.import_file_too_large")});return}const Ke=new FileReader;Ke.onload=Ye=>{const ot=Ye&&Ye.target?Ye.target.result:null;typeof ot=="string"&&he(ot)},Ke.onerror=()=>{xe({type:"error",message:p("agents.import_read_error")})},Ke.readAsText(je)},z.click()},[p,he]),Pe=h.useCallback(z=>{z.preventDefault(),z.stopPropagation(),Fe(!0)},[]),Xe=h.useCallback(z=>{z.preventDefault(),z.stopPropagation();const te=z.relatedTarget;(!te||!z.currentTarget.contains(te))&&Fe(!1)},[]),H=h.useCallback(z=>{z.preventDefault(),z.stopPropagation(),Fe(!1);const te=z.dataTransfer&&z.dataTransfer.files,ce=te&&te[0];if(!ce)return;const je=ce.name.toLowerCase();if(!je.endsWith(".yaml")&&!je.endsWith(".yml")){xe({type:"error",message:p("agents.import_invalid_file")});return}if(ce.size>10*1024*1024){xe({type:"error",message:p("agents.import_file_too_large")});return}const Be=new FileReader;Be.onload=Ke=>{const Ye=Ke&&Ke.target?Ke.target.result:null;typeof Ye=="string"&&he(Ye)},Be.onerror=()=>{xe({type:"error",message:p("agents.import_read_error")})},Be.readAsText(ce)},[p,he]);return D?o.jsxs("div",{className:"h-full flex",children:[o.jsxs("div",{className:`${I?"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:[I?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:p("agents.back_to_chat"),"aria-label":p("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:p("agents.title")})]}),o.jsx("button",{onClick:()=>B(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 ${I?"mx-auto":""}`,title:p(I?"agents.expand_panel":"agents.collapse_panel"),"aria-label":p(I?"agents.expand_panel":"agents.collapse_panel"),"aria-expanded":!I,"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:I?"M8.25 4.5l7.5 7.5-7.5 7.5":"M15.75 19.5L8.25 12l7.5-7.5"})})}),I?null:o.jsx("button",{onClick:le,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:p("agents.refresh"),"aria-label":p("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:I?o.jsx("div",{className:"py-2 flex flex-col items-center gap-1.5",children:g.map(z=>{const te=z.name===D.name,ce=z.state==="working"||z.state==="idle";return o.jsx("button",{onClick:()=>re(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 ${te?"ring-2 ring-primary-500 bg-primary-400":ce?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`})},z.name)})}):o.jsx("div",{className:"space-y-1",children:g.map(z=>{const te=z.name===D.name,ce=z.state==="working"||z.state==="idle";return o.jsx("button",{onClick:()=>re(z),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${te?"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 ${ce?"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(CK,{agent:D,onClose:X,onAction:Le,onToolPartsChange:S,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":p("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 te=z.clientX,ce=c,je=Ke=>{const Ye=te-Ke.clientX,ot=Math.min(f,Math.max(d,ce+Ye));u&&u(ot)},Be=()=>{document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",Be)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",Be)}}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:a?o.jsx(oT,{toolParts:Q,matrixMode:i,onToggleMatrix:l,darkMode:s}):o.jsx(iT,{toolParts:Q})})]})]}):o.jsxs("div",{className:"h-full flex flex-col relative",onDragOver:Pe,onDragLeave:Xe,onDrop:H,children:[Te&&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:p("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:p("agents.back_to_chat"),"aria-label":p("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:p("agents.title")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p("agents.subtitle")})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:le,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:p("agents.refresh"),"aria-label":p("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:_e,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:p("agents.import_button"),"aria-label":p("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"})}),p("agents.import_button")]}),o.jsxs("button",{onClick:()=>F(!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"})}),p("agents.spawn_button")]})]})]}),g.length>0&&o.jsx(OK,{agents:g,totalCost:ke}),w&&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:w}),o.jsx("button",{onClick:()=>_(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:()=>xe(null),"aria-label":p("common.close")||"Close",title:p("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&&g.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"})}):g.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:p("agents.no_agents_title")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:p("agents.no_agents_desc")}),o.jsxs("button",{onClick:()=>F(!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"})}),p("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:[G.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:p("agents.selected",{count:G.size})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>pe("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:p("agents.pauseAll")}),o.jsx("button",{onClick:()=>pe("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:p("agents.unpauseAll")}),o.jsx("button",{onClick:()=>pe("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:p("agents.stopAll")}),o.jsx("button",{onClick:()=>pe("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:p("agents.restartAll")}),o.jsx("button",{onClick:()=>pe("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:p("agents.startAll")})]}),o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsx("button",{onClick:ve,className:"px-2 py-1 text-xs text-primary-600 dark:text-primary-400 hover:underline",children:p("agents.selectAll")}),o.jsx("button",{onClick:me,className:"px-2 py-1 text-xs text-gray-500 dark:text-gray-400 hover:underline",children:p("agents.deselectAll")})]})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:g.map(z=>o.jsx(LK,{agent:z,onAction:Z,onSelect:re,onExport:ue,actionLoading:T,isSelected:G.has(z.name),onToggleSelect:Ne},z.name))})]})}),o.jsx(TK,{isOpen:$,onClose:()=>F(!1),existingAgentNames:g.map(z=>z.name),onCreated:Se})]})}let Nr=null;function TA(){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=TA()}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 AA(){let e;try{e=TA()}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 RA(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function PK(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const MA="pave-native-notifications";function kl(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function FK(){return kl()?Notification.permission:"unsupported"}function al(){if(!kl()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(MA)==="true"}catch{return!1}}function BK(e){try{localStorage.setItem(MA,e?"true":"false")}catch{}}async function zK(){if(!kl())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function IA({title:e,body:t,tag:n,icon:r,onClick:a}){if(!kl()||Notification.permission!=="granted"||!al())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 LA="pave-push-notifications",UK="/sw.js";function md(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function qK(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function $K(){try{return localStorage.getItem(LA)==="true"}catch{return!1}}function Nu(e){try{localStorage.setItem(LA,e?"true":"false")}catch{}}function F0(){return typeof Notification>"u"?"unsupported":Notification.permission}async function HK(){if(!md())return null;try{return await navigator.serviceWorker.register(UK,{scope:"/"})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function WK(){if(!md())return console.warn("[web-push] Not supported in this browser"),!1;const e=await HK();if(!e)return!1;if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return console.warn("[web-push] Notification permission denied"),!1;let t;try{const r=await fetch("/api/push/vapid-public-key",{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const a=await r.json();t=XK(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=QK(a,t)}if(r)return await WS(n),Nu(!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 WS(n),Nu(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function VK(){if(!md())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 Nu(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),Nu(!1),!1}}async function WS(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:VS(e.getKey("p256dh")),auth:VS(e.getKey("auth"))}},await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function GK(){const e=await fetch("/api/push/test",{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function KK(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 YK(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 QK(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 XK(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 VS(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 B0=["AI Model & Provider","Prefill Fallback","Models","LM Studio","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp"],GS={"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 ZK({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 JK=["__proto__","constructor","prototype"];function z0(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function eY(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 OA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function KS(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=OA(n);t[r]=n}return t}function YS(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 p(v){a(function(x){return Object.assign({},x,{cost:Object.assign({},x.cost||{},v)})})}var g="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=OA(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:g+" 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:g+" 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:g,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:g})]}),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:g})]}),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){p({input:parseFloat(v.target.value)||0})},className:g})]}),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){p({output:parseFloat(v.target.value)||0})},className:g})]})]})]})]}),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 tY({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,p]=h.useState(""),[g,m]=h.useState(z0()),[y,v]=h.useState(null),[x,b]=h.useState(!1),[k,N]=h.useState(null);h.useEffect(function(){var P=!1;return s(!0),OS().then(function(M){P||(a(M),s(!1))}).catch(function(M){P||(c(M.message),s(!1))}),function(){P=!0}},[]);var w=h.useCallback(function(){s(!0),c(null),OS().then(function(P){a(P),s(!1)}).catch(function(P){c(P.message),s(!1)})},[]);function _(P,M,S){var I=(P||"").trim();return I?JK.indexOf(I)!==-1?n("settings.model_registry.error_name_reserved",{name:I}):I!==S&&M.indexOf(I)!==-1?n("settings.model_registry.error_name_exists",{name:I}):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=_(f,P,null);if(M){N(M);return}b(!0),N(null);try{await DS(f.trim(),KS(g)),d(!1),p(""),m(z0()),w(),t&&t(e)}catch(S){N(S.message)}finally{b(!1)}}},[f,g,r,t,e,w]),A=h.useCallback(async function(P){b(!0),N(null);try{await PS(P),w(),t&&t(e)}catch(M){N(M.message)}finally{b(!1)}},[t,e,w]),D=h.useCallback(async function(){if(!(!y||!r)){var P=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),M=_(y.name,P,y.originalName);if(M){N(M);return}b(!0),N(null);try{var S=y.name.trim(),I=KS(y.config);if(await DS(S,I),S!==y.originalName)try{await PS(y.originalName)}catch(B){N(n("settings.model_registry.error_rename_cleanup",{error:B.message}))}v(null),w(),t&&t(e)}catch(B){N(B.message)}finally{b(!1)}}},[y,r,t,e,w]);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 R=r&&r.user?r.user:{},$=r&&r.builtin?r.builtin:{},F=Object.keys(R),G=Object.keys($);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}),G.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:G.map(function(P){var M=$[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),p(""),m(z0()),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")})]}),F.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:[F.map(function(P){var M=R[P];return y&&y.originalName===P?o.jsx(YS,{name:y.name,config:y.config,setName:function(S){v(function(I){return I&&Object.assign({},I,{name:S})})},setConfig:function(S){v(function(I){if(!I)return I;var B=typeof S=="function"?S(I.config):S;return Object.assign({},I,{config:B})})},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:eY(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}))&&A(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(YS,{name:f,config:g,setName:p,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 nY({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(p){return p.id===t});if(h.useEffect(function(){e.type!=="model-select"||!a||a.length===0||t&&a.find(function(p){return p.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 p=s||d,g=tv(a);return o.jsxs("div",{children:[o.jsxs("select",{value:p?"__custom__":t,onChange:function(m){m.target.value==="__custom__"?l(!0):(l(!1),n(m.target.value))},disabled:c,className:u,children:[Object.entries(g).map(function(m){var y=m[0],v=m[1];return o.jsx("optgroup",{label:Jb[y]||y,children:v.map(function(x){return o.jsxs("option",{value:x.id,children:[x.name,ev(x.tier)]},x.id)})},y)}),o.jsx("option",{value:"__custom__",children:i("settings.custom_model")})]}),p&&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 p=typeof t=="string"?t.toLowerCase():String(t),g=p==="true"||p==="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":g,"aria-label":e.label,disabled:c,onClick:function(){n(g?"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 "+(g?"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 "+(g?"translate-x-5":"translate-x-0")})}),o.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:i(g?"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(p){n(p.target.value)},disabled:c,className:u,children:(e.options||[]).map(function(p){var g=e.optionLabels&&e.optionLabels[p]||p;return o.jsx("option",{value:p,children:g},p)})}),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(p){n(p.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(p){n(p.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(tY,{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(p){n(p.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 rY({onBack:e,activeSessionId:t,mobileFrameless:n,onMobileFramelessChange:r}){const{t:a,locale:i,setLocale:s,availableLocales:l}=vt(),[c,u]=h.useState([]),[d,f]=h.useState({}),[p,g]=h.useState({}),[m,y]=h.useState(!0),[v,x]=h.useState(!1),[b,k]=h.useState(null),[N,w]=h.useState(null),[_,T]=h.useState([]),[A,D]=h.useState(()=>Io()||""),[R,$]=h.useState(()=>Io()||""),[F,G]=h.useState(""),[P,M]=h.useState(null),[S,I]=h.useState(!1),[B,Q]=h.useState(()=>RA()),[C]=h.useState(()=>kl()),[K,W]=h.useState(()=>FK()),[j,U]=h.useState(()=>al()),[le]=h.useState(()=>md()),[Z,ke]=h.useState(()=>$K()),[re,X]=h.useState(()=>F0()),[Ne,ve]=h.useState(!1),[me,pe]=h.useState("checking"),[Le,Se]=h.useState(null),[Te,Fe]=h.useState(null),[fe,xe]=h.useState(null),Ce=h.useCallback(function(){const de=!B;Q(de),PK(de),de&&AA()},[B]),ue=h.useCallback(async function(){if(!C)return;if(!j&&Notification.permission!=="granted"){const We=await zK();if(W(We),We!=="granted")return}const de=!j;U(de),BK(de)},[j,C]),he=h.useCallback(async function(){if(!(!le||Ne)){ve(!0);try{Z?(await VK(),ke(!1)):(await WK()&&ke(!0),X(F0()))}catch(de){console.error("[settings] Web push toggle failed:",de.message)}finally{ve(!1)}}},[Z,le,Ne]),_e=h.useCallback(async function(){if(!Ne){ve(!0);try{const de=await GK();de.sent>0?alert("Test push sent! Check your device."):de.failed>0?alert("Push delivery failed ("+de.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(de){alert("Test push failed: "+de.message)}finally{ve(!1)}}},[Ne]),Pe=h.useCallback(function(de){Se(de.currentVersion),Fe(de.latestVersion),de.error?(xe(de.error),pe("check-error")):de.updateAvailable?pe("update-available"):pe("no-updates")},[]),Xe=h.useCallback(async function(){pe("checking"),xe(null);try{const de=await D0();Pe(de)}catch(de){xe(de.message),pe("check-error")}},[Pe]),H=h.useCallback(async function(){pe("updating"),xe(null);try{await vK(),pe("success");try{const de=await D0();Se(de.currentVersion),Fe(de.latestVersion)}catch{}}catch(de){xe(de.message),pe("error")}},[]),z=h.useCallback(async function(){try{y(!0),w(null);const We=(await tT()).settings||[];u(We);const nt={};for(let yt=0;yt<We.length;yt++)nt[We[yt].key]=We[yt].value;f(nt),g({}),k(null);try{const yt=await Xy();G(yt.home||"")}catch{}}catch(de){w(de.message)}finally{y(!1)}},[]);h.useEffect(function(){z();var de=!1;return async function(){try{const nt=await nv();de||T(nt||[])}catch{}}(),function(){de=!0}},[z]),h.useEffect(function(){var de=!1;return pe("checking"),async function(){try{const nt=await D0();de||Pe(nt)}catch(nt){de||(xe(nt&&nt.message?nt.message:String(nt)),pe("check-error"))}}(),function(){de=!0}},[Pe]);const te=h.useCallback(function(de,We){f(function(nt){return{...nt,[de]:We}}),g(function(nt){if(!nt[de])return nt;const{[de]:yt,...ae}=nt;return ae}),k(null)},[]),ce=h.useCallback(async function(){x(!0),k(null);try{const de={};for(let yt=0;yt<c.length;yt++){const ae=c[yt];ae.source!=="env"&&d[ae.key]!==ae.value&&(de[ae.key]=d[ae.key])}if(Object.keys(de).length===0){k({type:"info",message:a("settings.no_changes")}),x(!1);return}const We=await _B(de),nt=Object.keys(We.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(de)}}))}catch{}if(nt.length>0?(g(We.errors),k({type:"warning",message:a("settings.partial_save")})):k({type:"success",message:a("settings.saved")}),We.settings){const yt=We.settings;u(yt);const ae={};for(let Ie=0;Ie<yt.length;Ie++)ae[yt[Ie].key]=yt[Ie].value;nt.length>0?f(function(Ie){const De={...ae};for(let Ve=0;Ve<nt.length;Ve++)Ie[nt[Ve]]!==void 0&&(De[nt[Ve]]=Ie[nt[Ve]]);return De}):f(ae)}}catch(de){k({type:"error",message:a("settings.save_failed",{error:de.message})})}finally{x(!1)}},[c,d,a]),je=h.useCallback(function(){const de={};for(let We=0;We<c.length;We++)de[c[We].key]=c[We].value;f(de),g({}),k(null),D(R),M(null)},[c,R]),Be=h.useCallback(function(de){D(de),M(null),k(null)},[]),Ke=h.useCallback(async function(){const de=A.trim();if(!de){if(Af(null),$(""),D(""),M(null),k({type:"success",message:a("settings.working_dir_reset")}),t)try{await cr(t,{directory:null})}catch(nt){console.warn("SettingsPage: failed to clear session directory:",nt.message)}return}I(!0),M(null);const We=Io();try{Af(de);const nt=await Xy();if($(de),D(de),k({type:"success",message:a("settings.working_dir_updated",{path:nt.cwd})}),t)try{await cr(t,{directory:de})}catch(yt){console.warn("SettingsPage: failed to update session directory:",yt.message)}}catch(nt){Af(We),D(R),M(a("settings.working_dir_invalid",{error:nt.message}))}finally{I(!1)}},[A,R,t]);let Ye=!1;for(let de=0;de<c.length;de++)if(c[de].source!=="env"&&d[c[de].key]!==c[de].value){Ye=!0;break}const ot=A!==R;Ye=Ye||ot;const Rt={};for(let de=0;de<c.length;de++){const We=c[de].category;Rt[We]||(Rt[We]=[]),Rt[We].push(c[de])}const mt=[];for(let de=0;de<B0.length;de++)Rt[B0[de]]&&mt.push(B0[de]);const Mt=Object.keys(Rt);for(let de=0;de<Mt.length;de++)mt.indexOf(Mt[de])<0&&mt.push(Mt[de]);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:[Ye&&o.jsx("button",{onClick:je,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:a("settings.reset")}),o.jsx("button",{onClick:ce,disabled:v||!Ye,className:"px-4 py-1.5 text-sm font-medium rounded-lg transition-colors "+(Ye&&!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(de){s(de.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(de){return o.jsxs("option",{value:de.code,children:[de.nativeName," (",de.name,")"]},de.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":B,onClick: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 "+(B?"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 "+(B?"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")}),K==="denied"&&o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:a("settings.native_notifications_blocked")}),K==="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")})]}),C?o.jsx("button",{id:"settings-native-notifications",type:"button",role:"switch","aria-checked":j,onClick:ue,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."}),le&&!qK()&&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."}),re==="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."}),Z&&o.jsx("button",{type:"button",onClick:_e,disabled:Ne,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:Ne?"Sending...":"Send test notification"})]}),le?o.jsx("button",{id:"settings-web-push",type:"button",role:"switch","aria-checked":Z,onClick:he,disabled:Ne,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 "+(Z?"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 "+(Z?"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:A,onChange:function(de){Be(de.target.value)},placeholder:F||"~ (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:Ke,disabled:S||!ot,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(ot&&!S?"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(S?"settings.validating":"settings.apply")})]}),P&&o.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:P}),R&&o.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:a("settings.currently_set_to",{path:R})})]})]}),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:Le||"--"})]}),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:me==="checking"?a("settings.checking_updates"):Te||"--"})]}),me==="update-available"&&o.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[a("settings.update_available")," (",Te,")"]}),me==="no-updates"&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("settings.no_updates")}),me==="success"&&o.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:a("settings.update_success")}),me==="check-error"&&fe&&o.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[a("settings.check_updates_failed"),": ",fe]}),me==="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:[(me==="idle"||me==="no-updates"||me==="error"||me==="check-error"||me==="success")&&o.jsx("button",{onClick:Xe,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")}),me==="update-available"&&o.jsx("button",{onClick:H,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")}),me==="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")}),me==="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")})]})]})})]}),mt.map(function(de){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:GS[de]?a(GS[de]):de}),o.jsx("div",{className:"space-y-4",children:Rt[de].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(ZK,{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(nY,{setting:We,value:d[We.key]!==void 0?d[We.key]:"",onChange:function(nt){te(We.key,nt)},error:p[We.key],models:_,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)})})]},de)})]})})]})}function aY({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 iY({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,p]=h.useState(""),g=m=>{m.preventDefault(),p("");const y=r.trim().toLowerCase();if(!y){p(n("pricing.model_required"));return}if(t.includes(y)){p(n("pricing.model_exists"));return}if(y==="default"){p(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:g,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 sY({onClose:e}){const{t}=vt(),n=dl(),[r,a]=h.useState(null),[i,s]=h.useState(!0),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,p]=h.useState(!1),g=h.useRef(null);h.useEffect(()=>{let w=!1;async function _(){try{const T=await dK();w||(a(T),s(!1))}catch(T){w||(d(T.message),s(!1))}}return _(),()=>{w=!0}},[]),h.useEffect(()=>{async function w(_){_.key==="Escape"&&(f?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",w),g.current&&g.current.focus(),()=>document.removeEventListener("keydown",w)},[e,f,n,t]);const m=h.useCallback((w,_,T)=>{a(A=>!A||!A.models?A:{...A,models:{...A.models,[w]:{...A.models[w],[_]:T}}}),p(!0)},[]),y=h.useCallback(async w=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:w}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(a(_=>{if(!_||!_.models)return _;const T={..._.models};return delete T[w],{..._,models:T}}),p(!0))},[n,t]),v=h.useCallback((w,_)=>{a(T=>T?{...T,models:{...T.models,[w]:_}}:{models:{[w]:_}}),p(!0)},[]),x=h.useCallback(async()=>{d(null),c(!0);try{await fK(r),p(!1),e()}catch(w){d(w.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 w=await pK();a(w.pricing),p(!1)}catch(w){d(w.message)}finally{c(!1)}}},[n,t]),k=h.useCallback(async()=>{f?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[f,e,n,t]),N=r!=null&&r.models?Object.entries(r.models).sort(([w],[_])=>w==="default"?1:_==="default"?-1:w.localeCompare(_)):[];return o.jsx("div",{ref:g,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:w=>w.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),o.jsx("button",{onClick:k,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[i&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),u&&o.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:u})}),!i&&r&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[o.jsx("span",{children:t("pricing.configured_count",{count:N.length})}),o.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),o.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[o.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),o.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),o.jsx("div",{className:"w-6"})]}),o.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:N.map(([w,_])=>o.jsx(aY,{modelName:w,rates:_,onChange:m,onDelete:y,isDefault:w==="default",t},w))})]}),o.jsx(iY,{onAdd:v,existingModels:N.map(([w])=>w),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 oY=[{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"}],lY=["low","medium","high"];function cY({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 QS({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(cY,{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 uY({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=g=>{if(t.includes(g.name)){d(n("dlp.pattern_exists",{name:g.name}));return}a(g.name),s(g.regex),c(g.severity),d("")},p=g=>{if(g.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:oY.map(g=>o.jsx("button",{onClick:()=>f(g),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:g.label},g.id))}),o.jsxs("form",{onSubmit:p,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:g=>a(g.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:g=>s(g.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:g=>c(g.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:lY.map(g=>o.jsx("option",{value:g,children:g},g))})]}),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 dY({onClose:e}){const{t}=vt(),n=dl(),[r,a]=h.useState(null),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,p]=h.useState(null),[g,m]=h.useState(!1),[y,v]=h.useState(!0),[x,b]=h.useState("ask"),[k,N]=h.useState([]),[w,_]=h.useState({}),[T,A]=h.useState("epm/privacy"),D=h.useRef(null);h.useEffect(()=>{let S=!1;async function I(){var B;try{const Q=await MB();S||(s(Q.builtins||[]),v(Q.enabled!==!1),b(Q.defaultAction||"ask"),N(Q.disabledBuiltins||[]),_(Q.patterns||{}),A(((B=Q.privateMode)==null?void 0:B.rerouteModel)||"epm/privacy"),a(Q),c(!1))}catch(Q){S||(p(Q.message),c(!1))}}return I(),()=>{S=!0}},[]),h.useEffect(()=>{async function S(I){I.key==="Escape"&&(g?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",S),D.current&&D.current.focus(),()=>document.removeEventListener("keydown",S)},[e,g,n,t]);const R=h.useCallback(S=>{N(I=>I.includes(S)?I.filter(B=>B!==S):[...I,S]),m(!0)},[]),$=h.useCallback((S,I,B)=>{_(Q=>({...Q,[S]:{regex:I,severity:B}})),m(!0)},[]),F=h.useCallback(S=>{_(I=>{const B={...I};return delete B[S],B}),m(!0)},[]),G=h.useCallback(async()=>{p(null),d(!0);try{const I=await IB({enabled:y,defaultAction:x,disabledBuiltins:k,privateMode:{rerouteModel:T},patterns:w});m(!1),a(I.policy),e()}catch(S){p(S.message)}finally{d(!1)}},[y,x,k,w,T,e]),P=h.useCallback(async()=>{g?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[g,e,n,t]),M=[...i.map(S=>S.name),...Object.keys(w)];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:S=>S.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:S=>{v(S.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:S=>{b(S.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:S=>{A(S.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(S=>o.jsx(QS,{name:S.name,regex:S.regex,severity:S.severity,enabled:!k.includes(S.name),builtin:!0,onToggle:R,onRemove:()=>{},t},S.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(w).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(w).map(([S,I])=>o.jsx(QS,{name:S,regex:I.regex,severity:I.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:F,t},S))})]}),o.jsx(uY,{onAdd:$,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:G,disabled:u||!g,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 fY(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 pY({request:e,onDismiss:t}){const{t:n}=vt(),[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 rB(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 aB(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]),p=e.action==="clear",g=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 ${p?"bg-red-100 dark:bg-red-900/30":g?"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 ${p?"text-red-600 dark:text-red-400":g?"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:fY(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 ${p?"bg-red-600 hover:bg-red-700":g?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:n(r==="allow"?"permission.allowing":"permission.allow")})]})]})}function gY({requests:e,onDismiss:t}){return!e||e.length===0?null:o.jsx(o.Fragment,{children:e.map(n=>o.jsx(pY,{request:n,onDismiss:t},n.id))})}var hY="https://account.openpave.ai/dashboard";function mY({open:e,onClose:t,upgradeUrl:n}){var{t:r}=vt(),a=h.useRef(null),i=h.useRef(null),s=h.useRef(t),l=hY;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 p=a.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(p.length!==0){var g=p[0],m=p[p.length-1];f.shiftKey?document.activeElement===g&&(f.preventDefault(),m.focus()):document.activeElement===m&&(f.preventDefault(),g.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 fx(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 yY=15e3;function xY({onNavigateToAgent:e}){const{t}=vt(),[n,r]=h.useState(!1),[a,i]=h.useState([]),[s,l]=h.useState(0),[c,u]=h.useState(!1),[d,f]=h.useState(null),p=h.useRef(null),g=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 K(){document.visibilityState==="visible"&&(v.current=!0)}return document.addEventListener("visibilitychange",K),()=>document.removeEventListener("visibilitychange",K)},[]);const k=h.useCallback(async K=>{const W=++x.current;try{let j,U=null;if(K){const le=await Yk();if(W!==x.current)return;U=le.messages||[],i(U),j=le.unread||0,l(j)}else{const le=await Yk({unreadOnly:!0,limit:1});if(W!==x.current)return;j=le.unread||0,l(j),al()&&j>0&&le.messages&&le.messages.length>0&&(U=le.messages)}if(y.current&&j>m.current&&!v.current&&RA()&&AA(),y.current&&j>m.current&&al()){const le=j-m.current,Z=U||b.current||[],ke=le===1&&Z.length>0?Z.find(me=>!me.read):null,re=ke&&ke.from?ke.from:"",Ne=!re||re==="__pave_webui__"||re==="unknown"?"PAVE":re,ve=ke&&ke.message?ke.message.slice(0,120).replace(/\n/g," "):le===1?"New inbox message":le+" new inbox messages";IA({title:Ne,body:ve,tag:"pave-inbox-"+Date.now(),onClick:function(){window.focus()}})}v.current=!1,m.current=j,y.current=!0}catch{}},[]);h.useEffect(()=>{k(n);const K=setInterval(()=>k(n),yY);return()=>clearInterval(K)},[k,n]),h.useEffect(()=>{if(!n)return;function K(W){p.current&&!p.current.contains(W.target)&&r(!1)}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[n]);const N=h.useRef(new Set),w=h.useCallback(async K=>{if(!(!K.filename||K.read)&&!N.current.has(K.filename)){N.current.add(K.filename);try{await wB(K.filename),i(W=>W.map(j=>j.filename===K.filename?{...j,read:!0}:j)),l(W=>Math.max(0,W-1)),f(W=>W&&W.filename===K.filename?{...W,read:!0}:W)}catch{}finally{N.current.delete(K.filename)}}},[]),_=h.useCallback(async()=>{u(!0);try{await SB(),i(K=>K.map(W=>({...W,read:!0}))),l(0)}catch{}finally{u(!1)}},[]),T=h.useCallback(async()=>{u(!0);try{await CB(),i([]),l(0)}catch{}finally{u(!1)}},[]),A=h.useCallback((K,W)=>{W.read||w(W),r(!1),f(null),e&&e(K)},[e,w]),D=h.useCallback(K=>{f(K),K.read||w(K)},[w]),R=h.useCallback(()=>{f(null)},[]),$=h.useRef(new Set),F=h.useCallback(async K=>{if(!(!K.filename||!K.read)&&!$.current.has(K.filename)){$.current.add(K.filename);try{await EB(K.filename),i(W=>{const j=W.map(le=>le.filename===K.filename?{...le,read:!1}:le),U=j.reduce((le,Z)=>le+(Z.read?0:1),0);return l(U),j}),f(W=>W&&W.filename===K.filename?{...W,read:!1}:W)}catch{}finally{$.current.delete(K.filename)}}},[]),G=h.useCallback(async K=>{if(K.filename)try{await NB(K.filename),i(W=>{const j=W.filter(le=>le.filename!==K.filename),U=j.reduce((le,Z)=>le+(Z.read?0:1),0);return l(U),j}),f(W=>W&&W.filename===K.filename?null:W)}catch{}},[]),P=h.useMemo(()=>[...a].sort((K,W)=>(W.timestamp||0)-(K.timestamp||0)),[a]),M=h.useCallback(()=>{if(!d)return;const K=P.findIndex(W=>W.filename===d.filename);if(K>0){const W=P[K-1];f(W),W.read||w(W)}},[d,P,w]),S=h.useCallback(()=>{if(!d)return;const K=P.findIndex(W=>W.filename===d.filename);if(K>=0&&K<P.length-1){const W=P[K+1];f(W),W.read||w(W)}},[d,P,w]),I=h.useMemo(()=>d?P.findIndex(K=>K.filename===d.filename):-1,[d,P]),B=I>0,Q=I>=0&&I<P.length-1,C=!!d;return h.useEffect(()=>{if(!C)return;function K(W){W.key==="Escape"&&f(null)}return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[C]),h.useEffect(()=>{C&&g.current&&g.current.focus()},[C]),o.jsxs("div",{className:"relative",ref:p,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:_,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((K,W)=>{const j=K.from||"unknown",U=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 "+(K.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:()=>{U&&A(j,K)},disabled:!U,className:"text-xs font-semibold truncate max-w-[60%] "+(U?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),title:U?t("user_inbox.view_agent")+": "+j:j,children:j}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[K.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:K.timestamp!=null?fx(K.timestamp):""}),!K.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(K),onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),D(K))},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(Jo,{remarkPlugins:[tl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:le,children:Z,href:ke,...re}){return o.jsx("a",{href:ke,...re,target:"_blank",rel:"noopener noreferrer",onClick:X=>X.stopPropagation(),children:Z})},p:function({node:le,children:Z,...ke}){return o.jsx("span",{...ke,children:Z})}},children:K.message})})})]},K.filename||W)})})]}),d&&o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:K=>{K.target===K.currentTarget&&R()},children:o.jsxs("div",{ref:g,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 K=d.from||"unknown";K!=="unknown"&&A(K,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?fx(d.timestamp):""})]}),o.jsx("button",{type:"button",onClick:R,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(Jo,{remarkPlugins:[tl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:K,children:W,href:j,...U}){return o.jsx("a",{href:j,...U,target:"_blank",rel:"noopener noreferrer",children:W})},p:function({node:K,children:W,...j}){return o.jsx("p",{...j,style:{whiteSpace:"pre-wrap"},children:W})}},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:!B,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:I>=0?`${I+1} / ${P.length}`:""}),o.jsx("button",{type:"button",onClick:S,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:()=>F(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:()=>w(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:()=>G(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:R,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 U0(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 bY(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function vY({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:a,sessions:i,busySessions:s={}}){const{t:l}=vt(),[c,u]=h.useState(""),[d,f]=h.useState(0),[p,g]=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),g(null),y(!1);const D=requestAnimationFrame(()=>{v.current&&v.current.focus()});return()=>cancelAnimationFrame(D)}},[e]),h.useEffect(()=>{let D=!1;const R=c?c.trim():"";if(b.current&&(clearTimeout(b.current),b.current=null),!e){g(null),y(!1);return}if(R.length<2){g(null),y(!1);return}return g(null),y(!0),b.current=setTimeout(()=>{Qy({q:R,limit:20}).then($=>{if(D)return;const F=Array.isArray($)?$:$.sessions||[];g(F),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 R=D.findIndex(G=>G.id===a);if(R<=0)return D;const $=D.slice(),[F]=$.splice(R,1);return $.unshift(F),$},[a]),w=h.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:l("spotlight.new_chat")}),[l]),_=h.useMemo(()=>{const D=i||[],R=!k||U0(k,"new chat")||U0(k,l("spotlight.new_chat")),$=P=>R&&r?a&&P.length>0&&P[0].id===a?[P[0],w,...P.slice(1)]:[w,...P]:P;if(!k)return $(N(D.slice(0,10)));const F=D.filter(P=>U0(k,P.title||""));let G;if(p){const P=new Set(F.map(S=>S.id)),M=p.filter(S=>!P.has(S.id));G=F.concat(M).slice(0,20)}else G=F.slice(0,20);return $(N(G))},[k,i,p,N,w,r,l,a]);h.useEffect(()=>{f(0)},[k]),h.useEffect(()=>{f(D=>_.length===0?0:D>=_.length?_.length-1:D)},[_.length]),h.useEffect(()=>{if(!x.current)return;const D=x.current.querySelectorAll('[role="option"]');D[d]&&D[d].scrollIntoView({block:"nearest"})},[d,_.length]);const T=h.useCallback(D=>{if(D&&D.isAction&&D.actionType==="new-chat"){r&&r(),t();return}const R=typeof D=="string"?D:D==null?void 0:D.id;R&&n(R),t()},[n,r,t]),A=h.useCallback(D=>{D.key==="ArrowDown"?(D.preventDefault(),f(R=>_.length===0?0:(R+1)%_.length)):D.key==="ArrowUp"?(D.preventDefault(),f(R=>_.length===0?0:(R-1+_.length)%_.length)):D.key==="Enter"?(D.preventDefault(),_[d]&&T(_[d])):D.key==="Escape"&&(D.preventDefault(),t())},[_,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:A,"aria-label":l("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":_[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&&_.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")}),_.map((D,R)=>{var $;return D.isAction&&D.actionType==="new-chat"?o.jsxs("div",{id:"spotlight-item-"+R,role:"option","aria-selected":R===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 ${R===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-"+R,role:"option","aria-selected":R===d,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${R===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:bY(D)}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:fx(($=D.time)==null?void 0:$.updated)})]})]},D.id)}),k&&_.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&&_.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 rv="pave_recent_directories",kY=10;function XS(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 av(){try{const e=localStorage.getItem(rv);return e?JSON.parse(e):[]}catch{return[]}}function _Y(e){try{let t=av();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,kY),localStorage.setItem(rv,JSON.stringify(t)),t}catch{return[e]}}function wY(e){try{let t=av();return t=t.filter(n=>n!==e),localStorage.setItem(rv,JSON.stringify(t)),t}catch{return[]}}function DA({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 EY({isOpen:e,onClose:t,sessionId:n,currentDirectory:r,homeDir:a,onDirectoryChange:i}){var{t:s}=vt(),l=h.useRef(null),c=h.useRef(null),[u,d]=h.useState(r||""),[f,p]=h.useState("idle"),[g,m]=h.useState(null),[y,v]=h.useState([]),[x,b]=h.useState(!1),[k,N]=h.useState(!1),[w,_]=h.useState(null),T=h.useRef(null),A=h.useRef(0);h.useEffect(function(){e&&(v(av()),d(r||""),p("idle"),m(null),_(null))},[e,r]),h.useEffect(function(){e&&l.current&&setTimeout(function(){l.current.focus(),l.current.select()},50)},[e]);var D=h.useCallback(function(I){if(!I||I.trim()===""){p("idle"),m(null);return}T.current&&clearTimeout(T.current),p("checking"),A.current+=1;var B=A.current;T.current=setTimeout(async function(){try{const Q=await Kk(I.trim());if(B!==A.current)return;m(Q),Q.exists&&Q.isDirectory?p("valid"):Q.exists?(p("error"),m({...Q,error:s("chat.working_directory_invalid")})):p("not_found")}catch(Q){if(B!==A.current)return;p("error"),m({error:Q.message})}},300)},[s]),R=h.useCallback(function(I){var B=I.target.value;d(B),_(null),D(B)},[D]),$=h.useCallback(function(I){d(I),_(null),D(I)},[D]),F=h.useCallback(function(I,B){I.stopPropagation(),v(wY(B))},[]),G=h.useCallback(async function(){if(u.trim()){b(!0),_(null);try{const I=await kB(u.trim());if(I.success)try{const B=await Kk(I.path);p("valid"),m(B)}catch{p("valid"),m({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:I.path})}}catch(I){_(s("chat.working_directory_create_failed",{error:I.message}))}finally{b(!1)}}},[u,s]),P=h.useCallback(async function(){if(!(!u.trim()||f!=="valid")){N(!0),_(null);try{const I=(g==null?void 0:g.path)||u.trim();await cr(n,{directory:I}),v(_Y(I)),i&&i(I),t()}catch(I){_(I.message)}finally{N(!1)}}},[u,f,g,n,i,t]);h.useEffect(function(){if(!e)return;function I(B){B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),t())}return document.addEventListener("keydown",I,!0),function(){document.removeEventListener("keydown",I,!0)}},[e,t]),h.useEffect(function(){if(!e)return;function I(B){B.key==="Enter"&&f==="valid"&&!k&&(B.preventDefault(),P())}return document.addEventListener("keydown",I),function(){document.removeEventListener("keydown",I)}},[e,f,k,P]),h.useEffect(function(){return function(){T.current&&clearTimeout(T.current)}},[]);var M=h.useMemo(function(){return XS(r,a)},[r,a]);if(!e)return null;var S=null;return f==="checking"?S=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"&&g?S=o.jsx("p",{className:"text-xs text-green-500 mt-1",children:g.hasAgentsMd?"✓ "+s("chat.working_directory_has_agents_md"):"✓ "+s("chat.working_directory_no_agents_md")}):f==="not_found"?S=o.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",s("chat.working_directory_not_found")]}):f==="error"&&(g!=null&&g.error)&&(S=o.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",g.error]})),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(I){I.target===I.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(DA,{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:R,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"}),S]}),w&&o.jsx("p",{className:"text-sm text-red-500",children:w}),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(I){return o.jsxs("div",{onClick:function(){$(I)},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:I,children:XS(I,a)}),o.jsx("button",{onClick:function(B){F(B,I)},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"})})})]},I)})})]})]}),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:G,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 NY(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function wc(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function Ec(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function Ji(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 SY(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,a=vt().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),p=f[0],g=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),w=N[0],_=N[1],T=h.useState(Gt.message),A=T[0],D=T[1],R=h.useState(String(Gt.intervalMs)),$=R[0],F=R[1],G=h.useState(String(Gt.maxInjections)),P=G[0],M=G[1],S=h.useState(Gt.timeout.enabled),I=S[0],B=S[1],Q=h.useState(String(Gt.timeout.thresholdMs)),C=Q[0],K=Q[1],W=h.useState(String(Gt.timeout.cooldownMs)),j=W[0],U=W[1],le=h.useState(Gt.mode),Z=le[0],ke=le[1],re=h.useState(String(Gt.waitMs)),X=re[0],Ne=re[1],ve=h.useRef(null),me=h.useState([]),pe=me[0],Le=me[1],Se=h.useState(!1),Te=Se[0],Fe=Se[1],fe=h.useState(!1),xe=fe[0],Ce=fe[1],ue=h.useState("9"),he=ue[0],_e=ue[1],Pe=h.useState("0"),Xe=Pe[0],H=Pe[1],z=h.useState("AM"),te=z[0],ce=z[1],je=h.useState("weekdays"),Be=je[0],Ke=je[1],Ye=h.useState([1,2,3,4,5]),ot=Ye[0],Rt=Ye[1],mt=h.useState(""),Mt=mt[0],de=mt[1],We="";try{We=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}h.useEffect(function(){return function(){ve.current&&clearTimeout(ve.current)}},[]);var nt=h.useCallback(function(){r&&(d(!0),v(null),J5(r).then(function(we){var Ze=we&&we.config?we.config:Gt;l(Ze),_(Ze.enabled||!1),D(Ze.message||Gt.message),F(wc(Ze.intervalMs!=null?Ze.intervalMs:Gt.intervalMs)),M(NY(Ze.maxInjections!=null?Ze.maxInjections:Gt.maxInjections)),B(Ze.timeout?Ze.timeout.enabled:Gt.timeout.enabled),K(wc(Ze.timeout&&Ze.timeout.thresholdMs!=null?Ze.timeout.thresholdMs:Gt.timeout.thresholdMs)),U(wc(Ze.timeout&&Ze.timeout.cooldownMs!=null?Ze.timeout.cooldownMs:Gt.timeout.cooldownMs)),ke(Ze.mode||Gt.mode),Ne(wc(Ze.waitMs!=null?Ze.waitMs:Gt.waitMs))}).catch(function(we){v(we.message||"Failed to load config")}).finally(function(){d(!1)}))},[r]);h.useEffect(function(){t&&nt()},[t,nt]);var yt=h.useCallback(function(){r&&KF(r).then(function(we){Le(we&&we.schedules?we.schedules:[])}).catch(function(){Le([])})},[r]);h.useEffect(function(){t&&yt()},[t,yt]),h.useEffect(function(){if(!t)return;function we(Ze){Ze.key==="Escape"&&n()}return document.addEventListener("keydown",we),function(){document.removeEventListener("keydown",we)}},[t,n]);function ae(){if(r){g(!0),v(null),k(null);var we={enabled:w,message:A.trim()||Gt.message,intervalMs:Ec($)||Gt.intervalMs,maxInjections:parseInt(P,10)||0,mode:Z||Gt.mode,waitMs:Ec(X),timeout:{enabled:I,thresholdMs:Ec(C)||Gt.timeout.thresholdMs,cooldownMs:Ec(j)||Gt.timeout.cooldownMs}};VF(r,we).then(function(){l(we),k(a("chat.idle_injection_saved")),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(function(){k(null)},3e3)}).catch(function(Ze){v(Ze.message||"Failed to save")}).finally(function(){g(!1)})}}function Ie(){r&&(g(!0),v(null),k(null),GF(r).then(function(){_(!1),l(null)}).catch(function(we){v(we.message||"Failed to disable")}).finally(function(){g(!1)}))}function De(we,Ze){var $t=parseInt(we,10);return Ze==="PM"&&$t!==12&&($t+=12),Ze==="AM"&&$t===12&&($t=0),$t}function Ve(we){return we===0?{h:12,ap:"AM"}:we<12?{h:we,ap:"AM"}:we===12?{h:12,ap:"PM"}:{h:we-12,ap:"PM"}}function ft(we,Ze){return we==="every_day"?[0,1,2,3,4,5,6]:we==="weekdays"?[1,2,3,4,5]:we==="weekends"?[0,6]:Ze.slice().sort()}function et(we){var Ze=Ve(we.hour),$t=String(we.minute).padStart(2,"0");return Ze.h+":"+$t+" "+Ze.ap}function Qe(we){var Ze=we.daysOfWeek||[],$t="";if(Ze.length===7)$t=a("scheduled_injection.repeat_every_day");else if(Ze.length===5&&Ze.indexOf(1)!==-1&&Ze.indexOf(5)!==-1)$t=a("scheduled_injection.repeat_weekdays");else if(Ze.length===2&&Ze.indexOf(0)!==-1&&Ze.indexOf(6)!==-1)$t=a("scheduled_injection.repeat_weekends");else{for(var Ct=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],br=[],Pn=0;Pn<7;Pn++)Ze.indexOf(Pn)!==-1&&br.push(a("scheduled_injection."+Ct[Pn]));$t=br.join(", ")}return we.timezone&&($t+=" ("+we.timezone+")"),$t}function Xt(){if(r){Ce(!0),v(null);var we={hour:De(he,te),minute:parseInt(Xe,10),daysOfWeek:ft(Be,ot),timezone:We||null,message:Mt.trim(),enabled:!0};YF(r,we).then(function(){Fe(!1),de(""),yt()}).catch(function(Ze){v(Ze.message||a("scheduled_injection.error_generic"))}).finally(function(){Ce(!1)})}}function oe(we,Ze){r&&QF(r,we,{enabled:!Ze}).then(function(){yt()}).catch(function($t){v($t.message||"Failed to toggle schedule")})}function jt(we){r&&XF(r,we).then(function(){yt()}).catch(function(Ze){v(Ze.message||"Failed to delete schedule")})}function ct(we){var Ze=ot.indexOf(we);Rt(Ze===-1?ot.concat([we]):ot.filter(function($t){return $t!==we}))}if(!t)return null;var wt="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",gt="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",cn="space-y-3",Kn=function(we){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(we?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},or=function(we){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(we?"translate-x-6":"translate-x-1")};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),o.jsxs("aside",{ref:i,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":a("chat.idle_injection_title"),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("chat.idle_injection_title")}),o.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":a("common.close"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:u?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):o.jsxs(o.Fragment,{children:[y&&o.jsx("div",{className:"px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm",children:y}),b&&o.jsx("div",{className:"px-3 py-2 rounded-lg bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 text-sm",children:b}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_toggle")}),o.jsx("button",{type:"button",onClick:function(){_(!w)},className:Kn(w),"aria-pressed":w,"aria-label":a("chat.idle_injection_toggle"),children:o.jsx("span",{className:or(w)})})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-message",children:a("chat.idle_injection_message")}),o.jsx("textarea",{id:"ii-message",value:A,onChange:function(we){D(we.target.value)},className:gt+" resize-none",rows:3,placeholder:a("chat.idle_injection_message_placeholder"),disabled:!w})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-interval",children:a("chat.idle_injection_interval")}),o.jsx("input",{id:"ii-interval",type:"number",value:$,onChange:function(we){F(we.target.value)},className:gt,min:.5,step:.5,disabled:!w}),o.jsx(Ji,{children:a("chat.idle_injection_interval_desc")})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-max",children:a("chat.idle_injection_max")}),o.jsx("input",{id:"ii-max",type:"number",value:P,onChange:function(we){M(we.target.value)},className:gt,min:0,disabled:!w}),o.jsx(Ji,{children:a("chat.idle_injection_max_desc")})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-mode",children:a("chat.idle_injection_mode")}),o.jsxs("select",{id:"ii-mode",value:Z,onChange:function(we){ke(we.target.value)},className:gt,disabled:!w,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(Ji,{children:a("chat.idle_injection_mode_desc")})]}),Z==="idle"&&o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-wait",children:a("chat.idle_injection_wait_ms")}),o.jsx("input",{id:"ii-wait",type:"number",value:X,onChange:function(we){Ne(we.target.value)},className:gt,min:0,step:.5,disabled:!w}),o.jsx(Ji,{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(){B(!I)},className:Kn(I),"aria-pressed":I,"aria-label":a("chat.idle_injection_timeout_toggle"),disabled:!w,children:o.jsx("span",{className:or(I)})})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-threshold",children:a("chat.idle_injection_timeout_threshold")}),o.jsx("input",{id:"ii-threshold",type:"number",value:C,onChange:function(we){K(we.target.value)},className:gt,min:1,step:.5,disabled:!w||!I}),o.jsx(Ji,{children:a("chat.idle_injection_timeout_threshold_desc")})]}),o.jsxs("div",{className:cn,children:[o.jsx("label",{className:wt,htmlFor:"ii-cooldown",children:a("chat.idle_injection_timeout_cooldown")}),o.jsx("input",{id:"ii-cooldown",type:"number",value:j,onChange:function(we){U(we.target.value)},className:gt,min:.5,step:.5,disabled:!w||!I}),o.jsx(Ji,{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:cn,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")})]}),pe.length===0&&!Te&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("scheduled_injection.empty")}),pe.map(function(we){return o.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(we.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:et(we)}),o.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Qe(we)})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("button",{type:"button",onClick:function(){oe(we.id,we.enabled)},className:Kn(we.enabled),"aria-pressed":we.enabled,"aria-label":a("scheduled_injection.enabled"),children:o.jsx("span",{className:or(we.enabled)})}),o.jsx("button",{type:"button",onClick:function(){jt(we.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"})})})]})]}),we.message&&o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',we.message,'"']})]},we.id)}),Te?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:wt,children:a("scheduled_injection.time")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("select",{value:he,onChange:function(we){_e(we.target.value)},className:gt+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(we){return o.jsx("option",{value:String(we),children:we},we)})}),o.jsx("span",{className:"text-gray-500",children:":"}),o.jsxs("select",{value:Xe,onChange:function(we){H(we.target.value)},className:gt+" 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:te,onChange:function(we){ce(we.target.value)},className:gt+" 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:wt,children:a("scheduled_injection.repeat")}),o.jsxs("select",{value:Be,onChange:function(we){Ke(we.target.value)},className:gt,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")})]})]}),Be==="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(we){var Ze=ot.indexOf(we.d)!==-1;return o.jsx("button",{type:"button",onClick:function(){ct(we.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(Ze?"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."+we.k)},we.d)})})}),We&&o.jsxs("div",{children:[o.jsx("label",{className:wt,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:wt,children:a("scheduled_injection.message")}),o.jsx("textarea",{value:Mt,onChange:function(we){de(we.target.value)},className:gt+" 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:Xt,disabled:xe||Be==="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(xe?"scheduled_injection.saving":"scheduled_injection.save")}),o.jsx("button",{type:"button",onClick:function(){Fe(!1)},disabled:xe,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(){Fe(!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:ae,disabled:p,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(p?"chat.idle_injection_saving":"chat.idle_injection_save")}),o.jsx("button",{onClick:Ie,disabled:p||!w,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(p?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function CY({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),p=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]),g=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(),w=N.splice(l,1)[0];N.splice(k,0,w),c(null);var _=N.filter(function(T){return T.status!=="dispatching"}).map(function(T){return T.id});r(_)},[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",w=l===k,_=u===k&&l!==k,T=!N&&!n;return o.jsxs("div",{draggable:T,onDragStart:T?function(A){p(A,k)}:void 0,onDragEnter:T?function(A){g(A,k)}:void 0,onDragOver:T?function(A){m(A,k)}:void 0,onDragLeave:T?y:void 0,onDrop:T?function(A){v(A,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 ")+(w?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(_?"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(A){(A.key==="Enter"||A.key===" ")&&(A.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(A){A.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 jY{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 dt=new jY;function TY(){var yv;const{t:e}=vt(),t=200,n=600,r=288,a="pave-active-session";function i(){try{return localStorage.getItem(a)||null}catch{return null}}function s(E){try{E?localStorage.setItem(a,E):localStorage.removeItem(a)}catch{}}function l(){try{localStorage.removeItem(a)}catch{}}const[c,u]=h.useState(()=>{if(typeof window<"u"){const E=localStorage.getItem("pave-theme");return E?E==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1});h.useEffect(()=>{const E=document.documentElement;c?(E.classList.add("dark"),E.style.colorScheme="dark"):(E.classList.remove("dark"),E.style.colorScheme="light"),localStorage.setItem("pave-theme",c?"dark":"light")},[c]);const[d,f]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1),[p,g]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1),[m,y]=h.useState(!1),[v,x]=h.useState(0),[b,k]=h.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",b)},[b]);const[N,w]=h.useState(!1),_=h.useRef(null),T=h.useRef(new Map),[A,D]=h.useState(()=>new Set),[R,$]=h.useState(()=>new Set),F=h.useRef(null),G=h.useRef("chat"),P=h.useRef(null),[M,S]=h.useState(()=>{if(typeof window<"u"){const E=localStorage.getItem("pave-terminal-width");if(E){const q=parseInt(E,10);if(!isNaN(q)&&q>=t&&q<=n)return q}}return r}),[I,B]=h.useState(()=>{if(typeof window<"u"){const E=localStorage.getItem("pave-right-pane-visible");return E===null?!0:E==="true"}return!0}),[Q,C]=h.useState(()=>typeof window<"u"?localStorage.getItem("pave-banner-hidden")==="true":!1),K=h.useCallback(()=>{C(E=>{const q=!E;try{localStorage.setItem("pave-banner-hidden",String(q))}catch{}return q})},[]),[W,j]=h.useState(""),U=h.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]),le=h.useRef(I);le.current=I;const Z=h.useCallback(()=>{const E=!le.current;B(E),j(e(E?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);h.useEffect(()=>{localStorage.setItem("pave-hacker",d?"true":"false")},[d]),h.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",p?"true":"false")},[p]),h.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",I?"true":"false")},[I]);const ke=h.useRef(M);ke.current=M,h.useEffect(()=>{const E=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(M))},200);return()=>clearTimeout(E)},[M]),h.useEffect(()=>{const E=()=>{localStorage.setItem("pave-terminal-width",String(ke.current))};return window.addEventListener("beforeunload",E),()=>{E(),window.removeEventListener("beforeunload",E)}},[]),h.useEffect(()=>{const E=Y=>{if(!(Y instanceof HTMLElement))return!1;const J=Y.tagName;return!!(J==="INPUT"||J==="TEXTAREA"||Y.isContentEditable)},q=Y=>{if(Y.repeat)return;const J=typeof Y.key=="string"?Y.key.toLowerCase():"";if((U?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&J==="k"){Y.preventDefault(),w(ne=>!ne);return}if((U?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&J==="b"){Y.preventDefault(),yt(ne=>!ne);return}const ge=(U?Y.metaKey:Y.ctrlKey)&&!Y.altKey&&!Y.shiftKey&&J==="j",st=window.matchMedia("(min-width: 1024px)").matches,se=G.current==="chat";if(ge&&F.current&&st&&se){Y.preventDefault(),Z();return}if(E(Y.target))return;const L=Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&J==="h",V=Y.ctrlKey&&Y.shiftKey&&!Y.altKey&&!Y.metaKey&&J==="m";(L||V)&&(Y.preventDefault(),f(ne=>!ne))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[e,U,Z]);const[re,X]=h.useState(!0),[Ne,ve]=h.useState(!1),[me,pe]=h.useState(null),[Le,Se]=h.useState("chat");G.current=Le;const[,Te]=h.useState(null),[Fe,fe]=h.useState(null),[xe,Ce]=h.useState(!1),[ue,he]=h.useState(!1),[_e,Pe]=h.useState([]),[Xe,H]=h.useState({});h.useEffect(()=>{eB().then(E=>{ve(E.enabled),E.authenticated&&E.user&&pe(E.user)}).catch(E=>{console.error("Failed to check auth status:",E)}).finally(()=>X(!1))},[]),h.useEffect(()=>{KK(()=>F.current)},[]);const z=h.useCallback(async()=>{try{await tB()}catch(E){console.error("Logout failed:",E);return}pe(null),window.location.reload()},[]),[te,ce]=h.useState(null),[je,Be]=h.useState(!1),[Ke,Ye]=h.useState([]),[ot,Rt]=h.useState([]),[mt,Mt]=h.useState({}),de=h.useRef(mt);h.useEffect(()=>{de.current=mt},[mt]);const We=h.useRef({}),[nt,yt]=h.useState(!0),[ae,Ie]=h.useState(!1),De=h.useRef(!1),Ve=h.useRef(null),ft=h.useRef(0);h.useEffect(function(){return function(){ft.current&&cancelAnimationFrame(ft.current)}},[]);const[et,Qe]=h.useState([]),Xt=h.useRef([]);Xt.current=et;const[oe,jt]=h.useState(null);F.current=oe,h.useEffect(()=>{s(oe)},[oe]),h.useEffect(()=>{oe&&YK(typeof document<"u"&&document.visibilityState==="visible",oe)},[oe]);const ct=h.useMemo(()=>oe&&et.find(E=>E.id===oe)||null,[oe,et]),[wt,gt]=h.useState([]),[cn,Kn]=h.useState(!1),[or,we]=h.useState({}),Ze=h.useRef(or);Ze.current=or;const[$t,Ct]=h.useState({}),[br,Pn]=h.useState(null),[vr,ba]=h.useState(null),Fn=h.useRef(null);h.useEffect(function(){return function(){Fn.current&&clearTimeout(Fn.current),hn.current&&clearTimeout(hn.current)}},[]);const[_l,va]=h.useState(null),[Bi,wl]=h.useState(null),[El,Yn]=h.useState(null),hn=h.useRef(null),Zt=h.useCallback((E,q)=>{if(E){const Y=!q&&!!Ze.current[E];Y&&E===rt.current&&(ba(null),Fn.current&&(clearTimeout(Fn.current),Fn.current=null)),we(J=>{const ee={...J},be=!!J[E];if(q?ee[E]=!0:delete ee[E],be&&!q&&Qn.current&&Qn.current[E]&&!Cd.current.has(E)){const ge=Qn.current[E];if(ge.length>0){const st=ge.shift();E===rt.current&&Sd(ge.length),Promise.resolve().then(()=>{try{Rd.current&&Rd.current(E,st.content,st.imageAttachments,st.agent,st.displayContent,st.queuedTempId,st.fileAttachments)}catch(se){console.error("[Queue] Drain dispatch failed:",se)}})}}return ee}),Y&&(Cd.current.delete(E),Mf(E).then(J=>{const ee=Array.isArray(J&&J.items)?J.items:[];Ct(be=>{const ge={...be};if(ee.length===0)if(ge[E])delete ge[E];else return be;else ge[E]=ee;return ge})}).catch(()=>{}))}E===rt.current&&Kn(q)},[]),Nl=h.useCallback(E=>{const q={};Object.keys(E).forEach(J=>{E[J]&&E[J].type==="busy"&&(q[J]=!0)}),we(J=>{const ee={...J};return Object.keys(q).forEach(be=>{ee[be]=!0}),Object.keys(E).forEach(be=>{E[be]&&E[be].type!=="busy"&&delete ee[be]}),ee});const Y=E[rt.current];Kn(!!(Y&&Y.type==="busy"))},[]),[ai,Or]=h.useState({}),[Sl,zi]=h.useState({}),[Ui,ka]=h.useState({});h.useEffect(()=>{b==="map"&&oe&&If(oe).then(E=>{E&&Array.isArray(E.todos)&&ka(q=>({...q,[oe]:E.todos}))}).catch(()=>{})},[b,oe]);const[qi,Yr]=h.useState({});h.useEffect(()=>{b==="tools"&&oe&&Zk(oe).then(E=>{E&&Yr(q=>({...q,[oe]:E}))}).catch(()=>{})},[b,oe]);const[kr,Bn]=h.useState(null),[yd,ii]=h.useState(null),[qs,He]=h.useState(null),[Cl,jl]=h.useState(!1),[Tl,xd]=h.useState(null),Al=50,[Rl,_a]=h.useState(!1),[$s,Me]=h.useState(0),O=h.useRef(0),[ie,Ee]=h.useState(!0),[$e,Ge]=h.useState(!1),[it,Et]=h.useState(""),[Tt,Vt]=h.useState(0),[Bt,wa]=h.useState(0),[Jt,$i]=h.useState(!1),bd=h.useRef(null),[Qr,PA]=h.useState(!1),[Xr,FA]=h.useState(""),[BA,vd]=h.useState(!1),[zA,UA]=h.useState(""),[qA,iv]=h.useState(!1),[Ml,sv]=h.useState(null),[$A,Il]=h.useState(!1),[kd,ov]=h.useState({}),_d=h.useRef({}),[wd,lv]=h.useState({}),Ed=h.useRef({}),[HA,WA]=h.useState({}),cv=h.useRef({}),Ll=h.useRef(new Set),Hi=h.useRef(null);h.useEffect(()=>{_d.current=kd},[kd]),h.useEffect(()=>{Ed.current=wd},[wd]),h.useEffect(()=>{if(!oe)return;const E=et.find(q=>q.id===oe);E&&(E.moe_top_k!=null&&_d.current[oe]===void 0&&ov(q=>q[oe]===void 0?{...q,[oe]:E.moe_top_k}:q),E.reasoning_effort&&Ed.current[oe]===void 0&&lv(q=>q[oe]===void 0?{...q,[oe]:E.reasoning_effort}:q))},[oe,et]);const uv=kd[oe]??null,VA=wd[oe]??"max",dv=HA[oe]??null,Hs=h.useCallback((E,q)=>{sv({text:E,type:q||"info"}),Hi.current&&clearTimeout(Hi.current),Hi.current=setTimeout(()=>{sv(null),Hi.current=null},3e3)},[]);h.useEffect(()=>{const E=()=>{tT().then(q=>{const J=(Array.isArray(q==null?void 0:q.settings)?q.settings:[]).find(be=>be&&be.key==="PAVE_WHATSAPP_CHAT_ID"),ee=J&&J.value||"";FA(ee)}).catch(q=>{console.error("[WhatsApp] Failed to load default chatId from settings:",q.message)})};return E(),window.addEventListener("pave:settings-updated",E),()=>window.removeEventListener("pave:settings-updated",E)},[]);const Ol=h.useRef(Qr),GA=h.useRef(Xr);h.useEffect(()=>{Ol.current=Qr,GA.current=Xr},[Qr,Xr]);const Nd=h.useRef({});h.useEffect(()=>{LB({enabled:Qr,sessionId:oe,chatId:Xr}).catch(E=>{console.error("[WhatsApp routing] Failed to update:",E.message)})},[Qr,oe,Xr]),h.useEffect(()=>{Jt&&bd.current&&bd.current.focus()},[Jt]),h.useEffect(()=>{const E=window.matchMedia("(min-width: 1024px)"),q=Y=>{Y.matches&&$i(!1)};return E.addEventListener("change",q),()=>E.removeEventListener("change",q)},[]);function fv(){const E=Ui[oe]||[],q=[];for(const ge of wt||[])for(const st of ge.parts||[]){if(st.type!=="tool")continue;const se=st.state&&st.state.output;if(!se)continue;let L=se;if(typeof se=="string")try{L=JSON.parse(se)}catch{continue}L&&L.canvas&&L.canvas.type&&L.canvas.source&&q.push(L.canvas)}const Y=oe?`pave-canvas-cleared:${oe}`:null;let J=new Set;if(Y&&typeof window<"u")try{const ge=localStorage.getItem(Y);ge&&(J=new Set(JSON.parse(ge)))}catch{}const ee=q.filter(ge=>!J.has(ge.type+":"+ge.source)),be=()=>{if(!Y||typeof window>"u")return;const ge=q.map(st=>st.type+":"+st.source);try{localStorage.setItem(Y,JSON.stringify(ge))}catch{}x(st=>st+1)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:d?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-end gap-1 px-2 py-1 border-b border-gray-200 dark:border-gray-700 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>k("map"),className:`px-2 py-0.5 rounded ${b==="map"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Strategy map (todos)","aria-label":"Strategy map view",children:"map"}),o.jsx("button",{type:"button",onClick:()=>k("tools"),className:`px-2 py-0.5 rounded ${b==="tools"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Tool-call DAG (execution)","aria-label":"Tool-call map view",children:"tools"}),o.jsxs("button",{type:"button",onClick:()=>k("canvas"),className:`px-2 py-0.5 rounded relative ${b==="canvas"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Canvas (diagrams & illustrations)","aria-label":"Canvas view",children:["canvas",ee.length>0?o.jsxs("span",{className:"ml-1 opacity-70",children:["(",ee.length,")"]}):null]}),o.jsx("button",{type:"button",onClick:()=>k("terminal"),className:`px-2 py-0.5 rounded ${b==="terminal"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Terminal","aria-label":"Terminal view",children:"terminal"})]}),o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:b==="map"?o.jsx(OV,{todos:E,darkMode:c}):b==="tools"?o.jsx(VV,{graph:qi[oe]||null,darkMode:c}):b==="canvas"?o.jsx(TS,{canvases:ee,onClear:ee.length?be:null}):o.jsx(oT,{toolParts:mR,matrixMode:m,onToggleMatrix:()=>y(ge=>!ge),darkMode:c})})]}):ee.length>0?o.jsx(TS,{canvases:ee,onClear:ee.length?be:null}):o.jsx(iT,{toolParts:hR})}),o.jsx(OG,{messages:wt,isBusy:cn,activeModel:te,sessionModel:mt[oe]||null,isPrivateMode:R.has(oe),registryEntries:ot})]})}h.useEffect(()=>{Ge(!1),Et(""),Vt(0),wa(0),$i(!1)},[oe]),h.useEffect(()=>{if(!oe)return;let E=!1;return RB(oe).then(q=>{if(E||!q)return;const Y=oe;q.privateMode&&$(J=>{if(J.has(Y))return J;const ee=new Set(J);return ee.add(Y),ee}),Array.isArray(q.messageIds)&&q.messageIds.length&&D(J=>{let ee=!1;const be=new Set(J);for(const ge of q.messageIds)be.has(ge)||(be.add(ge),ee=!0);return ee?be:J})}).catch(()=>{}),()=>{E=!0}},[oe]),h.useEffect(()=>{if(!oe){Il(!1);return}let E=!1;return J5(oe).then(q=>{if(E)return;const Y=q&&q.config?q.config:{};Il(!!Y.enabled)}).catch(()=>{}),()=>{E=!0}},[oe]),h.useEffect(()=>{if(!oe){Be(!1);return}const E=de.current[oe]||te;if(!E){Be(!1);return}let q=!1;return vB(E).then(Y=>{q||Be(!!(Y&&Y.adaptiveQuality))}).catch(()=>{q||Be(!1)}),()=>{q=!0}},[oe,te,mt]),h.useEffect(()=>{Bt>0&&Tt>=Bt?Vt(Bt-1):Bt===0&&Tt!==0&&Vt(0)},[Bt,Tt]);const Dl=h.useRef(new Set),Pl=h.useCallback(E=>{if(!E||!Dl.current.has(E))return;Dl.current.delete(E);const q=Xt.current.find(Y=>Y.id===E);q&&q.pinned||(Qe(Y=>Y.filter(J=>J.id!==E)),Wk(E).catch(Y=>{console.warn("Auto-cleanup of empty session failed:",E,Y)}))},[]),rt=h.useRef(oe);h.useEffect(()=>{rt.current=oe;const E=Qn.current[oe];Sd(E?E.length:0)},[oe]),h.useEffect(()=>{if(!oe)return;let E=!1;return Mf(oe).then(q=>{if(E)return;const Y=Array.isArray(q&&q.items)?q.items:[],J=oe;Ct(ee=>{const be={...ee};if(Y.length===0)if(be[J])delete be[J];else return ee;else be[J]=Y;return be})}).catch(q=>{console.warn("[queue] hydrate failed for",oe,q&&q.message)}),()=>{E=!0}},[oe]);const pv=h.useRef(b);h.useEffect(()=>{pv.current=b},[b]);const Qn=h.useRef({}),[KA,Sd]=h.useState(0),Cd=h.useRef(new Set),Wi=h.useCallback(E=>{if(E===rt.current){const q=Qn.current[E];Sd(q?q.length:0)}},[]),YA=h.useCallback(E=>{if(!E)return;const q=rt.current;if(!q)return;const Y=Qn.current[q];Array.isArray(Y)&&Y.length>0&&(Qn.current[q]=Y.filter(J=>J.queuedTempId!==E)),gt(J=>J.filter(ee=>ee.info.id!==E)),Wi(q)},[Wi]),Ea=!Ne||!!me;h.useEffect(()=>{!re&&Ea&&(Dr(),Qk().then(E=>{Nl(E)}).catch(E=>{console.error("Failed to fetch session status:",E)}))},[re,Ea]),h.useEffect(()=>{!re&&Ea&&(bB().then(E=>{E&&E.model&&ce(E.model)}).catch(E=>{console.error("Failed to fetch config:",E)}),ZF().then(E=>{E&&Array.isArray(E.providers)&&Ye(E.providers)}).catch(E=>{console.error("Failed to fetch providers:",E)}),JF().then(E=>{E&&Array.isArray(E.entries)&&Rt(E.entries)}).catch(E=>{console.error("Failed to fetch model registry:",E)}),Xy().then(E=>{E&&E.home&&UA(E.home)}).catch(E=>{console.error("Failed to fetch path info:",E)}))},[re,Ea]);const jd=h.useCallback(()=>{nB().then(E=>{const q=Array.isArray(E&&E.pending)?E.pending:[];Pe(q)}).catch(E=>{console.error("Failed to fetch pending permissions:",E)})},[]);h.useEffect(()=>{!re&&Ea&&jd()},[re,Ea,jd]),h.useEffect(()=>{const Y=setInterval(()=>{Pe(J=>{const ee=Date.now(),be=J.filter(ge=>ee-(ge.timestamp||0)<3e5);return be.length===J.length?J:be})},3e4);return()=>clearInterval(Y)},[]);const Dr=h.useCallback(async E=>{try{const q=E&&E.includeArchived||De.current,Y=O.current||0,J=Math.max(Al,Y),ee=await Qy({limit:J,offset:0,includeArchived:q});if(ee&&ee.sessions){const be=Array.isArray(ee.sessions)?ee.sessions:[];Qe(be),_a(!!ee.hasMore),Me(be.length),O.current=be.length}else{const be=Array.isArray(ee)?ee:[];Qe(be),_a(!1),Me(be.length),O.current=be.length}}catch(q){return console.error("Failed to load sessions:",q),!1}return!0},[]);h.useEffect(()=>{function E(){oe&&BF(oe).then(function(q){q&&q.sessionID&&(rt.current=q.sessionID,jt(q.sessionID),Dr())}).catch(function(q){console.error("Failed to create archive session:",q);const Y=(()=>{if(!q)return!1;if(q.status===404||q.response&&q.response.status===404)return!0;if(typeof q.message=="string"){const J=q.message.match(/^(\d{3})\s*:/);if(J&&parseInt(J[1],10)===404)return!0}return!1})();He(e(Y?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",E),()=>document.removeEventListener("navigateToArchiveSession",E)},[oe,Dr,e,He]);const QA=async()=>{try{const E=await Qy({limit:Al,offset:$s,includeArchived:De.current});if(E&&E.sessions){const q=Array.isArray(E.sessions)?E.sessions:[];Qe(Y=>{for(var J={},ee=0;ee<Y.length;ee++)J[Y[ee].id]=!0;for(var be=[],ge=0;ge<q.length;ge++)J[q[ge].id]||be.push(q[ge]);return Y.concat(be)}),_a(!!E.hasMore),Me(Y=>{var J=Y+q.length;return O.current=J,J})}}catch(E){console.error("Failed to load more sessions:",E)}},Zr=async E=>{try{const q=await UF(E);return rt.current!==E?null:Array.isArray(q)?(gt(Y=>{const J=q.some(V=>V.info.mode==="compaction"),ee=Array.isArray(Y)&&Y.some(V=>V.info&&V.info.mode==="compaction");if(J&&!ee)return q;const be=new Set(q.map(V=>V.info.id)),ge=Y.filter(V=>V.info.sessionID===E&&!be.has(V.info.id)&&!String(V.info.id).startsWith("temp-"));if(ge.length===0)return q;const st=[];let se=0,L=0;for(;se<q.length||L<ge.length;){const V=q[se],ne=ge[L],ye=V&&V.info.time&&typeof V.info.time.created=="number"?V.info.time.created:1/0,Oe=ne&&ne.info.time&&typeof ne.info.time.created=="number"?ne.info.time.created:1/0;se<q.length&&(L>=ge.length||ye<=Oe)?(st.push(V),se++):(st.push(ne),L++)}return st}),q):(gt([]),null)}catch(q){return console.error("Failed to load messages:",q),rt.current===E&&gt([]),null}};h.useEffect(()=>{if(!oe){gt([]),Or({}),ii(null),Ee(!0);return}gt([]),ii(null),Ee(!1),Bn(null),oe&&(Xk(oe).then(se=>{se&&Array.isArray(se.banners)&&zi(L=>({...L,[oe]:se.banners}))}).catch(()=>{}),If(oe).then(se=>{se&&Array.isArray(se.todos)&&ka(L=>({...L,[oe]:se.todos}))}).catch(()=>{})),dt.connect(oe);let E=!1,q=!1,Y=!1,J=!1;const ee=oe,be=se=>{if(rt.current!==ee)return;const L=new Map;if(Array.isArray(se))for(const V of se){if(!V||!V.info||!V.info.id||!Array.isArray(V.parts))continue;const ne=new Set;for(const ye of V.parts)ye&&(ye.type==="text"||ye.type==="reasoning")&&ne.add(ye.type);ne.size>0&&L.set(V.info.id,ne)}Or(V=>{const ne=V[ee];if(!ne||Object.keys(ne).length===0)return V;const ye={};let Oe=!1;for(const qe of Object.keys(ne)){const Je=ne[qe],at={};let pt=!1;const Tn=L.get(qe);for(const An of Object.keys(Je)){const Gi=Je[An];if(Gi._fromSnapshot){at[An]=Gi,pt=!0;continue}const Dd=Gi.type;if(Tn&&Tn.has(Dd)){Oe=!0;continue}at[An]=Je[An],pt=!0}pt?ye[qe]=at:Oe=!0}if(!Oe)return V;if(Object.keys(ye).length===0){const qe={...V};return delete qe[ee],qe}return{...V,[ee]:ye}})},ge=setTimeout(()=>{!E&&!q&&(q=!0,Zr(ee).then(se=>{Y=!0,be(se),J&&rt.current===ee&&Zr(ee).then(L=>{be(L)})}))},3e3),st=[dt.on("connected",()=>{E=!0,clearTimeout(ge),Ee(!0),jd(),Qk().then(se=>{Nl(se)}).catch(()=>{}),Mf(ee).then(se=>{const L=Array.isArray(se&&se.items)?se.items:[];Ct(V=>{const ne={...V};if(L.length===0)if(ne[ee])delete ne[ee];else return V;else ne[ee]=L;return ne})}).catch(()=>{}),Zr(ee).then(se=>{Y=!0,be(se),J&&rt.current===ee&&Zr(ee).then(L=>{be(L)})})}),dt.on("error",()=>{Ee(!1),!E&&!q&&(clearTimeout(ge),q=!0,Zr(ee).then(se=>{Y=!0,be(se),J&&rt.current===ee&&Zr(ee).then(L=>{be(L)})}))}),dt.on("session.status",se=>{var ne;const L=se.properties||se,V=((ne=L.status)==null?void 0:ne.type)==="busy";Zt(L.sessionID,V)}),dt.on("message.part.delta",se=>{const L=(se.properties||se).part;if(!L||!L.sessionID)return;T.current.has(L.sessionID)&&T.current.delete(L.sessionID);const{sessionID:V,messageID:ne}=L;if(Or(ye=>{const Oe=ye[V]||{},qe={...Oe[ne]||{}},Je=qe[L.id];return L.type==="text"||L.type==="reasoning"?qe[L.id]={...L,text:((Je==null?void 0:Je.text)||"")+(L.delta||"")}:qe[L.id]={...Je,...L},{...ye,[V]:{...Oe,[ne]:qe}}}),L.type==="text"&&L.delta){const ye=Nd.current;ye[V]||(ye[V]={}),ye[V][ne]=(ye[V][ne]||"")+L.delta,Ol.current&&console.log("[WhatsApp] Accumulating text delta:",L.delta.length,"chars, total:",ye[V][ne].length)}}),dt.on("streaming.snapshot",se=>{const L=se.properties||se,V=L.sessionID,ne=L.parts;!V||!Array.isArray(ne)||Or(ye=>{const Oe={...ye[V]||{}};for(const qe of ne){const Je={...Oe[qe.messageID]||{}};Je[qe.id]={id:qe.id,type:qe.type,text:qe.text,sessionID:V,messageID:qe.messageID,_fromSnapshot:!0},Oe[qe.messageID]=Je}return{...ye,[V]:Oe}})}),dt.on("message.progress",se=>{const L=se.properties||se;L.sessionID===rt.current&&ii({chunks:L.chunks||0,textLength:L.textLength||0,toolCalls:L.toolCalls||0,toolArgBytes:L.toolArgBytes||0,toolNames:L.toolNames||[]})}),dt.on("message.part.updated",se=>{const L=(se.properties||se).part;if(L){if(L.type==="text"||L.type==="reasoning"){const V=L.sessionID;Or(ne=>{const ye=ne[V];if(!ye)return ne;const Oe=ye[L.messageID];if(!Oe)return ne;const qe={};var Je=!1;for(const at of Object.keys(Oe))Oe[at].type!==L.type&&(qe[at]=Oe[at],Je=!0);if(!Je){const at={...ye};if(delete at[L.messageID],Object.keys(at).length===0){const pt={...ne};return delete pt[V],pt}return{...ne,[V]:at}}return{...ne,[V]:{...ye,[L.messageID]:qe}}})}if(L.sessionID===rt.current){if(!Y){L.sessionID===ee&&(J=!0);return}(L.type==="tool"||L.type==="tool-use")&&pv.current==="tools"&&Zk(L.sessionID).then(V=>{V&&Yr(ne=>({...ne,[L.sessionID]:V}))}).catch(()=>{}),gt(V=>V.map(ne=>{if(ne.info.id!==L.messageID)return ne;const ye=ne.parts.findIndex(Je=>Je.id===L.id);if(ye>=0)return{...ne,parts:ne.parts.map((Je,at)=>at===ye?L:Je)};const Oe=ne.parts.slice();let qe=Oe.length;for(let Je=Oe.length-1;Je>=0;Je--){if(Oe[Je].id<=L.id){qe=Je+1;break}Je===0&&(qe=0)}return Oe.splice(qe,0,L),{...ne,parts:Oe}}))}}}),dt.on("message.updated",se=>{const L=(se.properties||se).info;if(!(!L||L.sessionID!==rt.current)){if(!Y){L.sessionID===ee&&(J=!0);return}if(gt(V=>{const ne=V.findIndex(at=>at.info.id===L.id);if(ne>=0)return V.map((at,pt)=>pt===ne?{...at,info:L}:at);if(L.role==="user"){const at=V.findIndex(pt=>pt.info.id&&pt.info.id.startsWith("temp-")&&pt.info.role==="user");if(at>=0)return V.map((pt,Tn)=>Tn===at?{info:L,parts:[]}:pt)}const ye={info:L,parts:[]};if(!L.time||typeof L.time.created!="number")return[...V,ye];const Oe=L.time.created;let qe=V.length;for(let at=V.length-1;at>=0;at--){const pt=V[at].info.time;if(pt&&typeof pt.created=="number"&&pt.created<=Oe){qe=at+1;break}at===0&&(qe=0)}const Je=V.slice();return Je.splice(qe,0,ye),Je}),L.compactedOut!==!0&&L.finish){const V=L.sessionID;if(L.role==="assistant"&&Ol.current&&V===rt.current){const ne=Nd.current[V];ne&&ne[L.id]&&(delete ne[L.id],Object.keys(ne).length===0&&delete Nd.current[V]),OB(V).then(ye=>{if(ye&&ye.message)return console.log(`[WhatsApp] Processing queued message (${ye.remaining} remaining)`),pc(V,ye.message.text,null,de.current[V]||void 0)}).catch(ye=>{console.error("[WhatsApp] Failed to process queue:",ye)})}Or(ne=>{const ye=ne[V];if(!ye||!ye[L.id])return ne;const Oe={...ye};if(delete Oe[L.id],Object.keys(Oe).length===0){const qe={...ne};return delete qe[V],qe}return{...ne,[V]:Oe}}),ii(null),L.finish!=="compacted"&&Zt(V,!1),Zr(rt.current)}}}),dt.on("message.deleted",se=>{const L=se.properties||se,V=L.sessionID,ne=L.messageID;!V||!ne||V===rt.current&&(gt(ye=>ye.filter(Oe=>Oe.info.id!==ne)),Or(ye=>{if(!ye[V])return ye;const Oe=ye[V];if(!Oe[ne])return ye;const qe={...ye},Je={...Oe};return delete Je[ne],qe[V]=Je,qe}))}),dt.on("session.updated",se=>{const L=se.properties||se,V=L.info||L,ne=V&&(V.id||V.sessionID)||L.sessionID||L.id;if(!ne){Dr();return}const ye=V&&V.time&&typeof V.time.updated=="number",Oe=qe=>{Qe(Je=>{var at=!1,pt=Je.map(Tn=>Tn.id===ne?(at=!0,{...qe,ui:{...qe.ui,...Tn.ui}}):Tn);return at||(pt=[qe].concat(pt)),pt.sort((Tn,An)=>An.time.updated-Tn.time.updated),pt})};ye?(Oe(V),Mt(qe=>{let Je=qe;const at=V.model;return typeof at=="string"&&at||at&&typeof at=="object"&&at.providerID&&at.modelID?Je={...qe,[ne]:at}:qe[ne]&&(Je={...qe},delete Je[ne]),de.current=Je,Je})):Rf(ne).then(qe=>{Oe(qe),Mt(Je=>{let at=Je;const pt=qe&&qe.model;return typeof pt=="string"&&pt||pt&&typeof pt=="object"&&pt.providerID&&pt.modelID?at={...Je,[ne]:pt}:Je[ne]&&(at={...Je},delete at[ne]),de.current=at,at})}).catch(qe=>{console.error("Failed to fetch updated session, falling back to full reload:",qe),Dr()})}),dt.on("session.deleted",se=>{const L=se.properties||se,V=L.info||L,ne=V&&(V.id||V.sessionID)||L.sessionID||L.id;ne&&(Qe(ye=>ye.filter(Oe=>Oe.id!==ne)),jt(ye=>ye===ne?null:ye))}),dt.on("permission.request",se=>{const L=se.properties||se;L.requestId&&Pe(V=>V.some(ne=>ne.id===L.requestId)?V:[...V,{id:L.requestId,action:L.action,type:L.type,target:L.target,reason:L.reason,description:L.description,timestamp:Date.now()}])}),dt.on("permission.confirmed",se=>{const L=se.properties||se;L.requestId&&Pe(V=>V.filter(ne=>ne.id!==L.requestId))}),dt.on("permission.denied",se=>{const L=se.properties||se;L.requestId&&Pe(V=>V.filter(ne=>ne.id!==L.requestId))}),dt.on("question.asked",se=>{const L=se.properties||se;if(!L.id)return;const V=L.tool&&L.tool.callID?L.tool.callID:null;if(V&&H(ne=>({...ne,[V]:L.id})),al()){const ne=L.questions&&L.questions[0],ye=ne?ne.text:"A question needs your input.",Oe=L.sessionID||null;IA({title:"PAVE — Question",body:ye.length>200?ye.slice(0,200)+"…":ye,tag:"pave-question-"+L.id,onClick:Oe?function(){lr(Oe),window.focus()}:function(){window.focus()}})}}),dt.on("question.replied",se=>{const L=se.properties||se;L.requestId&&H(V=>{var ne={};for(var ye in V)V[ye]!==L.requestId&&(ne[ye]=V[ye]);return ne})}),dt.on("question.rejected",se=>{const L=se.properties||se;L.requestId&&H(V=>{var ne={};for(var ye in V)V[ye]!==L.requestId&&(ne[ye]=V[ye]);return ne})}),dt.on("quality.hint",se=>{const L=se.properties||se;if(!L.preset)return;const V=L.sessionID;V&&(WA(ne=>({...ne,[V]:L})),cv.current[V]=L)}),dt.on("dlp.cancelled",se=>{const V=(se.properties||se).sessionID;if(!V)return;const ne=T.current.get(V);ne&&(ne.tempId&&gt(ye=>ye.filter(Oe=>Oe.info.id!==ne.tempId)),V===rt.current&&_.current&&typeof _.current.setText=="function"&&_.current.setText(ne.text||""),T.current.delete(V)),Zt(V,!1)}),dt.on("dlp.private_message",se=>{const L=se.properties||se,V=L.sessionID,ne=L.messageID;!V||!ne||(D(ye=>{if(ye.has(ne))return ye;const Oe=new Set(ye);return Oe.add(ne),Oe}),$(ye=>{if(ye.has(V))return ye;const Oe=new Set(ye);return Oe.add(V),Oe}))}),dt.on("dlp.exited_private",se=>{const V=(se.properties||se).sessionID;V&&$(ne=>{if(!ne.has(V))return ne;const ye=new Set(ne);return ye.delete(V),ye})}),dt.on("session.error",se=>{const L=se.properties||se;if(L.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",L.source||""),He("Session expired. Please log in again."),pe(null),L.sessionID&&Zt(L.sessionID,!1);return}L.sessionID&&Zt(L.sessionID,!1),L.sessionID===rt.current&&(L.code==="insufficient_credits"?(He(null),xd(L.upgradeUrl||null),jl(!0)):He(L.error||"An error occurred"))}),dt.on("session.retry",se=>{const L=se.properties||se;L.reason==="rate_limit"&&L.sessionID===rt.current&&(ba({attempt:L.attempt,maxRetries:L.maxRetries,delayMs:L.delayMs,elapsedMs:L.elapsedMs||0,maxDurationMs:L.maxDurationMs||0}),Fn.current&&clearTimeout(Fn.current),Fn.current=setTimeout(()=>ba(null),1e4))}),dt.on("session.compacting",se=>{const L=se.properties||se;L.sessionID===rt.current&&Pn(V=>({...V,currentTokens:L.currentTokens??(V==null?void 0:V.currentTokens),threshold:L.threshold??(V==null?void 0:V.threshold),reason:L.reason??(V==null?void 0:V.reason),stage:L.stage??(V==null?void 0:V.stage),elapsedMs:L.elapsedMs??(V==null?void 0:V.elapsedMs),messageCount:L.messageCount??(V==null?void 0:V.messageCount),chunks:L.chunks??(V==null?void 0:V.chunks),textLength:L.textLength??(V==null?void 0:V.textLength)}))}),dt.on("session.compacted",se=>{const L=se.properties||se,V=rt.current;if(L.sessionID===V){if(Pn(null),va(null),L.newSessionID&&L.newSessionID!==V&&!L.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${V} → ${L.newSessionID}`),L.newSession){Fl(L.newSession);const Oe=L.newSession.model;(typeof Oe=="string"&&Oe||Oe&&typeof Oe=="object"&&Oe.providerID&&Oe.modelID)&&Mt(Je=>{const at={...Je,[L.newSessionID]:Oe};return de.current=at,at})}rt.current=L.newSessionID,jt(L.newSessionID),Kn(!0);return}if(L.source==="server"){const Oe=L.summary?L.summary.substring(0,200)+(L.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${L.deletedMessages} messages replaced, ${L.summaryTokens||"?"} summary tokens`),Oe&&console.log("[SERVER-COMPACT] Summary: "+Oe),va({source:"server",deletedMessages:L.deletedMessages||0,summaryTokens:L.summaryTokens||0,summary:Oe})}const ne=L.inPlace===!0,ye=!!Ze.current[V];ne&&ye?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(gt([]),Or(Oe=>{if(!Oe[V])return Oe;const qe={...Oe};return delete qe[V],qe}),ii(null),Zr(V).then(()=>{requestAnimationFrame(()=>{Ve.current&&rt.current===V&&Ve.current.scrollToBottom()})}))}}),dt.on("banner.updated",se=>{const L=se.properties||se;!L||!L.sessionID||(zi(V=>{const ne=V[L.sessionID]||[];if(ne.some(Oe=>Oe.timestamp===L.timestamp))return V;const ye=[{url:L.url,timestamp:L.timestamp,prompt:L.prompt,createdAt:new Date(L.timestamp).toISOString()},...ne];return{...V,[L.sessionID]:ye}}),L.sessionID===rt.current&&Bn(null))}),dt.on("banner.progress",se=>{const L=se.properties||se;if(!L||L.sessionID!==rt.current)return;const V=L.stage||"working";let ne=V;V==="queued"?ne="Banner queued":V==="summarizing"?ne="Banner: summarizing…":V==="rendering"?ne=L.line?"Banner: "+L.line.substring(0,80):"Banner: rendering…":V==="saved"?ne="Banner saved":V==="error"?ne="Banner error: "+(L.message||"unknown"):V==="skipped"&&(ne="Banner skipped: "+(L.reason||"")),Bn({stage:V,label:ne,ts:Date.now()}),V==="saved"&&L.sessionID&&Xk(L.sessionID).then(ye=>{ye&&Array.isArray(ye.banners)&&zi(Oe=>({...Oe,[L.sessionID]:ye.banners}))}).catch(()=>{})}),dt.on("todo.updated",se=>{const L=se.properties||se;!L||!L.sessionID||(Array.isArray(L.todos)?ka(V=>({...V,[L.sessionID]:L.todos})):If(L.sessionID).then(V=>{V&&Array.isArray(V.todos)&&ka(ne=>({...ne,[L.sessionID]:V.todos}))}).catch(()=>{}))}),dt.on("whatsapp.message",se=>{var V;const L=se.properties||se;L.sessionId===rt.current&&Ol.current&&(console.log("[WhatsApp] Injecting message:",(V=L.text)==null?void 0:V.substring(0,50)),pc(L.sessionId,L.text,null,de.current[L.sessionId]||void 0).catch(ne=>console.error("[WhatsApp] Failed to inject message:",ne)))}),dt.on("whatsapp.queued",se=>{const L=se.properties||se;L.sessionId===rt.current&&console.log(`[WhatsApp] Message queued from ${L.sender} (queue size: ${L.queueSize})`)}),dt.on("queue.updated",se=>{const L=se.properties||se;if(!L||!L.sessionID)return;const V=Array.isArray(L.items)?L.items:[];Ct(ne=>{const ye={...ne};return V.length===0?delete ye[L.sessionID]:ye[L.sessionID]=V,ye})}),dt.on("idle-injection.enabled",se=>{const L=se.properties||se;!L||L.sessionID!==ee||(Il(!0),Hs(e("chat.idle_injection_enabled_toast"),"success"))}),dt.on("idle-injection.disabled",se=>{const L=se.properties||se;!L||L.sessionID!==ee||(Il(!1),Hs(e("chat.idle_injection_disabled_toast"),"info"))}),dt.on("idle-injection.fired",se=>{const L=se.properties||se;!L||L.sessionID!==ee||Hs(e("chat.idle_injection_fired_toast"),"success")}),dt.on("idle-injection.timeout",se=>{const L=se.properties||se;!L||L.sessionID!==ee||Hs(e("chat.idle_injection_timeout_toast"),"warning")}),dt.on("scheduled-injection.fired",se=>{const L=se.properties||se;!L||L.sessionID!==ee||Hs(e("scheduled_injection.fired_toast"),"success")}),dt.on("scheduled-injection.added",se=>{const L=se.properties||se;!L||L.sessionID}),dt.on("scheduled-injection.removed",se=>{const L=se.properties||se;!L||L.sessionID}),dt.on("prefill.fallback",se=>{const L=se.properties||se;!L||L.sessionID!==ee||(Yn({originalModel:L.originalModel,fallbackModel:L.fallbackModel,reason:L.reason||"prefill_too_large"}),hn.current&&clearTimeout(hn.current),hn.current=setTimeout(()=>{Yn(null),hn.current=null},15e3))}),dt.on("auth.device_code",se=>{const L=se.properties||se;L.user_code&&L.verification_uri&&wl({verification_uri:L.verification_uri,user_code:L.user_code,expires_in:L.expires_in||300})})];return()=>{clearTimeout(ge),Hi.current&&clearTimeout(Hi.current),hn.current&&(clearTimeout(hn.current),hn.current=null),Yn(null),st.forEach(se=>se()),dt.disconnect()}},[oe]),h.useEffect(()=>{if(!oe)return;const E=setTimeout(()=>{var q;(q=_.current)==null||q.focus()},50);return()=>{clearTimeout(E)}},[oe]);function Fl(E){Qe(q=>{for(var Y=0;Y<q.length;Y++)if(q[Y].id===E.id)return q.map(J=>J.id===E.id?E:J);return[E,...q]})}const Td=h.useCallback(async()=>{try{const E=await Hk();Fl(E);const q=rt.current;q&&q!==E.id&&Pl(q),Dl.current.add(E.id),rt.current=E.id,jt(E.id)}catch(E){He("Failed to create session: "+E.message)}},[Pl]);P.current=Td;const lr=h.useCallback(async E=>{var Y;if(E===rt.current)return;const q=rt.current;q&&q!==E&&Pl(q),rt.current=E,jt(E),He(null),Kn(!!Ze.current[E]),Pn(null);try{const J=await Rf(E);if(rt.current!==E)return;((Y=J==null?void 0:J.status)==null?void 0:Y.type)==="busy"&&Kn(!0),Qe(ee=>{var L;if(!J)return ee;const be=ee.findIndex(V=>V.id===E),ge=((L=J.time)==null?void 0:L.updated)||0;if(be>=0){const V=ee[be],ne=ee.filter(qe=>qe.id!==E),ye={...J,ui:{...J.ui,...V.ui}},Oe=ne.findIndex(qe=>{var Je;return(((Je=qe.time)==null?void 0:Je.updated)||0)<=ge});return ne.splice(Oe<0?ne.length:Oe,0,ye),ne}const st=ee.findIndex(V=>{var ne;return(((ne=V.time)==null?void 0:ne.updated)||0)<=ge}),se=[...ee];return se.splice(st<0?se.length:st,0,J),se}),Mt(ee=>{if(J&&J.model)return{...ee,[E]:J.model};if(ee[E]){const be={...ee};return delete be[E],be}return ee})}catch(J){console.error("Failed to fetch session status for session",E,J)}},[Pl]),XA=h.useCallback(async E=>{try{await Wk(E),Qe(q=>q.filter(Y=>Y.id!==E)),oe===E&&(rt.current=null,jt(null))}catch(q){He("Failed to delete: "+q.message)}},[oe]),ZA=h.useCallback(async()=>{try{await zF(),await Dr(),rt.current=null,jt(E=>E&&null)}catch(E){He("Failed to delete sessions: "+E.message)}},[Dr]),JA=h.useCallback(async(E,q)=>{try{await cr(E,{title:q}),Qe(Y=>Y.map(J=>J.id===E?{...J,title:q}:J))}catch(Y){He("Failed to rename: "+Y.message)}},[]),eR=h.useCallback(async E=>{try{const q=await PF(E);q&&q.title&&Qe(Y=>Y.map(J=>J.id===E?{...J,title:q.title}:J))}catch(q){He("Failed to regenerate title: "+q.message)}},[]),tR=h.useCallback(async(E,q)=>{try{await cr(E,{pinned:q}),Qe(Y=>Y.map(J=>J.id===E?{...J,pinned:q}:J))}catch(Y){He("Failed to pin: "+Y.message)}},[]),nR=h.useCallback(async E=>{const q=et.find(J=>J.id===E);if(!q||!q.parentSessionID)return;const Y=q.parentSessionID;try{await HF(E),Qe(J=>J.map(ee=>ee.id===E?{...ee,compactionPinned:!1}:ee)),rt.current=Y,jt(Y)}catch(J){He("Failed to unpin: "+J.message)}},[et]),rR=h.useCallback(async(E,q)=>{try{await cr(E,{archived:q}),!De.current&&q?(Qe(Y=>Y.filter(J=>J.id!==E)),oe===E&&(rt.current=null,jt(null))):Qe(Y=>Y.map(J=>J.id===E?{...J,archived:q}:J))}catch(Y){He("Failed to archive: "+Y.message)}},[oe]),aR=h.useCallback(async({readOnly:E=!1}={})=>{if(!oe)return;let q,Y,J;if(Qe(ee=>{var ge;const be=ee.find(st=>st.id===oe);return q=((ge=be==null?void 0:be.ui)==null?void 0:ge.hideThinking)??!0,Y=!q,J=be==null?void 0:be.ui,ee.map(st=>st.id===oe?{...st,ui:{...st.ui,hideThinking:Y}}:st)}),!E)try{await cr(oe,{ui:{...J,hideThinking:Y}})}catch(ee){console.error("Failed to persist hideThinking:",ee),Qe(be=>be.map(ge=>ge.id===oe?{...ge,ui:{...ge.ui,hideThinking:q}}:ge)),He("Failed to save thinking visibility preference"+(ee!=null&&ee.message?": "+ee.message:""))}},[oe]),gv=h.useCallback(async E=>{try{await jB(E)}catch(q){He("Export failed: "+q.message)}},[]),Ad=h.useCallback(async E=>{try{const q=await TB(E);q&&q.id&&(await Dr(),lr(q.id))}catch(q){He("Import failed: "+q.message)}},[Dr,lr]),hv=h.useRef(!1);h.useEffect(()=>{if(!hv.current&&!(!Ea||et.length===0)){hv.current=!0;var E=null,q=!1;try{var Y=new URLSearchParams(window.location.search);E=Y.get("session"),q=!!E}catch{}if(E||(E=i()),!!E){if(et.some(function(J){return J.id===E})){lr(E);return}Rf(E).then(function(J){J&&J.id?lr(E):q||l()}).catch(function(){q||l()})}}},[Ea,et,lr]),h.useEffect(()=>{function E(q){var Y=q.data;!Y||Y.type!=="navigate-session"||Y.sessionId&&lr(Y.sessionId)}return window.addEventListener("message",E),function(){window.removeEventListener("message",E)}},[lr]),h.useEffect(()=>{function E(){try{var Y=indexedDB.open("pave-sw",1);Y.onupgradeneeded=function(){Y.result.createObjectStore("pave-pending-nav")},Y.onsuccess=function(){var J=Y.result;if(!J.objectStoreNames.contains("pave-pending-nav")){J.close();return}var ee=J.transaction("pave-pending-nav","readwrite"),be=ee.objectStore("pave-pending-nav"),ge=be.get("sessionId");ge.onsuccess=function(){var st=ge.result;be.delete("sessionId"),st&&st!==rt.current&&lr(st)},ee.oncomplete=function(){J.close()},ee.onerror=function(){J.close()}},Y.onerror=function(){}}catch{}}function q(){document.visibilityState==="visible"&&(E(),setTimeout(E,500),setTimeout(E,1500))}return document.addEventListener("visibilitychange",q),function(){document.removeEventListener("visibilitychange",q)}},[lr]);const iR=h.useCallback(async E=>{if(!oe)return;const q=We.current,Y=(q[oe]||0)+1;q[oe]=Y;const J=de.current[oe];Mt(ee=>{const be={...ee};return E?be[oe]=E:delete be[oe],de.current=be,be});try{const ee=await cr(oe,{model:E||null});if(q[oe]!==Y)return;ee&&(typeof ee.model=="string"&&ee.model||ee.model&&typeof ee.model=="object"&&ee.model.providerID&&ee.model.modelID)?Mt(be=>{const ge={...be,[oe]:ee.model};return de.current=ge,ge}):E||Mt(be=>{const ge={...be};return delete ge[oe],de.current=ge,ge})}catch(ee){if(q[oe]!==Y)return;Mt(be=>{const ge={...be};return J!==void 0?ge[oe]=J:delete ge[oe],de.current=ge,ge}),console.error("[ModelChange] PATCH failed for session",oe,ee),He("Failed to update session model: "+ee.message)}},[oe]),sR=h.useCallback(async function(E,q){if(oe){var Y=ct&&ct.disabledSkills||[],J;q?J=Y.filter(function(ee){return ee!==E}):J=Y.concat([E]),Qe(function(ee){return ee.map(function(be){return be.id===oe?{...be,disabledSkills:J}:be})});try{await cr(oe,{disabledSkills:J})}catch(ee){Qe(function(be){return be.map(function(ge){return ge.id===oe?{...ge,disabledSkills:Y}:ge})}),console.error("[SkillToggle] PATCH failed:",ee)}}},[oe,ct]),oR=h.useCallback(async function(){if(oe)try{var E=await eT(),q=E.skillDefaults||{},Y=await Rb(),J=["agent"];(Y||[]).forEach(function(ee){q[ee.name]||J.push(ee.name)}),Qe(function(ee){return ee.map(function(be){return be.id===oe?{...be,disabledSkills:J}:be})}),await cr(oe,{disabledSkills:J})}catch(ee){console.error("[SkillToggle] Reset to defaults failed:",ee)}},[oe]),lR=h.useCallback(E=>{Qe(q=>q.map(Y=>Y.id===oe?{...Y,directory:E}:Y)),vd(!1)},[oe]),cR=h.useCallback(async()=>{const E=!De.current;De.current=E,await Dr({includeArchived:E})?Ie(E):De.current=!E},[]),Ws=h.useCallback(async(E,q,Y,J,ee,be,ge)=>{const st=E===rt.current;be&&st&&gt(Lt=>Lt.filter(Pr=>Pr.info.id!==be));var se=(Y?Y.length:0)+(ge?ge.length:0);if(se>xu)throw He("Too many attachments. Maximum "+xu+" per message."),new Error("Too many attachments");var L=[],V=0;if(Y&&Y.length>0){for(var ne=0;ne<Y.length;ne++){var ye=(Y[ne].file.type||"").toLowerCase();if(Qu.indexOf(ye)===-1)throw He('Unsupported image type: "'+Y[ne].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(Y[ne].file.size>Jk){var Oe=Math.round(Y[ne].file.size/1024/1024*10)/10,qe=Math.round(Jk/1024/1024*10)/10;throw He('Image "'+Y[ne].name+'" ('+Oe+"MB) exceeds the "+qe+"MB size limit."),new Error("Image too large")}V+=Y[ne].file.size}if(V>n_){var Je=Math.round(V/1024/1024*10)/10,at=Math.round(n_/1024/1024*10)/10;throw He("Combined image size ("+Je+"MB) exceeds the "+at+"MB total image limit."),new Error("Combined image size too large")}try{L=await Promise.all(Y.map(function(Lt){return new Promise(function(Pr,mn){var un=new FileReader;un.onload=function(){if(typeof un.result!="string"){mn(new Error("FileReader did not produce a data URL for: "+Lt.name));return}Pr({type:"image_url",image_url:{url:un.result}})},un.onerror=function(){mn(new Error("Failed to read file: "+Lt.name))},un.readAsDataURL(Lt.file)})}))}catch(Lt){throw He("Failed to read image: "+Lt.message),Lt}}var pt=[],Tn=0;if(ge&&ge.length>0){for(var An=0;An<ge.length;An++){var Gi=(ge[An].file.type||"").toLowerCase();if(rT.indexOf(Gi)===-1)throw He('Unsupported file type: "'+ge[An].name+'" ('+(Gi||"unknown")+")."),new Error("Unsupported file type");if(ge[An].file.size>e_){var Dd=Math.round(ge[An].file.size/1024/1024*10)/10,_R=Math.round(e_/1024/1024*10)/10;throw He('File "'+ge[An].name+'" ('+Dd+"MB) exceeds the "+_R+"MB size limit."),new Error("File too large")}Tn+=ge[An].file.size}if(V+Tn>t_){var wR=Math.round((V+Tn)/1024/1024*10)/10,ER=Math.round(t_/1024/1024*10)/10;throw He("Combined attachment size ("+wR+"MB) exceeds the "+ER+"MB total limit."),new Error("Combined attachment size too large")}try{pt=await Promise.all(ge.map(function(Lt){return new Promise(function(Pr,mn){var un=new FileReader;un.onload=function(){if(typeof un.result!="string"){mn(new Error("FileReader did not produce a data URL for: "+Lt.name));return}Pr({type:"file",mime:Lt.file.type,filename:Lt.name,url:un.result})},un.onerror=function(){mn(new Error("Failed to read file: "+Lt.name))},un.readAsDataURL(Lt.file)})}))}catch(Lt){throw He("Failed to read file: "+Lt.message),Lt}}const ea="temp-"+Date.now();for(var Pd=[{id:ea+"-text",type:"text",text:ee}],Bl=0;Bl<L.length;Bl++)Pd.push({id:ea+"-img-"+Bl,type:"image_url",image_url:L[Bl].image_url});for(var Gs=0;Gs<pt.length;Gs++)Pd.push({id:ea+"-file-"+Gs,type:"file",mime:pt[Gs].mime,filename:pt[Gs].filename});const NR={info:{id:ea,sessionID:E,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:Pd};gt(Lt=>st?[...Lt,NR]:Lt),Zt(E,!0),T.current.set(E,{text:ee,tempId:ea});try{var xv=null;(L.length>0||pt.length>0)&&(xv=pt.concat(L));const Lt=_d.current[E]??null,Pr=Ed.current[E]??"max",mn=Lt===null&&!Ll.current.has(E),un=cv.current[E],Fd=mn&&un?un.moe_topk||null:Lt;await pc(E,q,xv,de.current[E]||void 0,J,{moeTopK:Fd,reasoningEffort:Pr,adaptiveQuality:mn})}catch(Lt){if(Lt.status===409)if(L.length>0||pt.length>0){const mn=ea;Qn.current[E]||(Qn.current[E]=[]),Qn.current[E].push({content:q,imageAttachments:Y,fileAttachments:ge,agent:J,displayContent:ee,queuedTempId:mn}),Wi(E),Zt(E,!1);return}else try{await Vk(E,q,{displayContent:ee,agent:J||void 0,model:de.current[E]||void 0,moeTopK:effectiveMoeTopK,reasoningEffort:sessReasoning,adaptiveQuality:isAutoMode}),gt(mn=>mn.filter(un=>un.info.id!==ea)),Zt(E,!1);return}catch(mn){throw He("Failed to queue message: "+mn.message),Zt(E,!1),gt(un=>un.filter(Fd=>Fd.info.id!==ea)),mn}throw He("Failed to send: "+Lt.message),Zt(E,!1),gt(Pr=>Pr.filter(mn=>mn.info.id!==ea)),Lt}},[Wi]),Rd=h.useRef(Ws);h.useEffect(()=>{Rd.current=Ws},[Ws]);const Jr=h.useCallback(async(E,q,Y,J)=>{He(null);const ee=E,be=E.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(be){const ne=be[1],ye=be[2],Oe=be[3]||"",qe=Oe||ne+" "+ye,Je=(ne+"_"+ye).replace(/-/g,"_").slice(0,128);E="[SKILL_HINT: User explicitly requested "+ne+"."+ye+(Oe?" with args: "+Oe:"")+". Call the "+Je+` tool with these parameters.]
120
+
121
+ `+qe}let ge=rt.current;if(!ge)try{const ne=await Hk();Fl(ne),rt.current=ne.id,jt(ne.id),ge=ne.id,await new Promise(ye=>setTimeout(ye,200))}catch(ne){throw He("Failed to create session: "+ne.message),ne}if(Dl.current.delete(ge),!!or[ge]){if(!(q&&q.length>0||J&&J.length>0)){try{await Vk(ge,E,{displayContent:ee,agent:Y||void 0,model:de.current[ge]||void 0})}catch(Je){He("Failed to queue message: "+Je.message)}return}const ye="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Oe=[{id:ye+"-text",type:"text",text:ee}];if(q&&q.length>0)for(var se=0;se<q.length;se++){var L=q[se].preview||"";Oe.push({id:ye+"-img-"+se,type:"image_url",image_url:{url:L}})}if(J&&J.length>0)for(var V=0;V<J.length;V++)Oe.push({id:ye+"-file-"+V,type:"file",mime:J[V].file.type,filename:J[V].name});const qe={info:{id:ye,sessionID:ge,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Oe};gt(Je=>[...Je,qe]),Qn.current[ge]||(Qn.current[ge]=[]),Qn.current[ge].push({content:E,imageAttachments:q,agent:Y,displayContent:ee,queuedTempId:ye,fileAttachments:J}),Wi(ge);return}await Ws(ge,E,q,Y,ee,null,J)},[or,Ws,Wi]);h.useEffect(()=>{const E=()=>{Jr(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",E),()=>window.removeEventListener("pave:plan-execute",E)},[Jr,e]);const uR=h.useCallback(async()=>{if(oe)try{const E=oe;Cd.current.add(E),await WF(E)}catch(E){console.error("Abort failed:",E)}},[oe]),dR=h.useCallback(async(E,q,Y)=>{if(He(null),E==="btw"){const J=rt.current;if(!J){He("No active session to fork.");return}let ee;try{ee=await FF(J)}catch(ge){throw He("Fork failed: "+(ge&&ge.message?ge.message:String(ge))),ge}if(!ee||!ee.id)throw He("Fork failed: server returned no session id."),new Error("Fork returned no session");Fl(ee),rt.current=ee.id,jt(ee.id),await new Promise(ge=>setTimeout(ge,200));const be=(q||"").trim();if(be)try{await Jr(be,Y&&Y.imageAttachments?Y.imageAttachments:void 0,void 0,Y&&Y.fileAttachments?Y.fileAttachments:void 0)}catch{}return}if(E==="compact"){const J=rt.current;if(!J){He("No active session to compact.");return}He(null),Pn({reason:"manual",stage:"starting"}),va(null),$F(J).then(ee=>{if(!ee||!ee.success){Pn(null),He("Compaction failed: "+(ee&&ee.error||"unknown error"));return}Zr(J),Pn(null),va(null)}).catch(ee=>{Pn(null),ee&&ee.status===409?He("Cannot compact while the session is busy. Wait for the current response to finish."):He("Compaction failed: "+(ee&&ee.message?ee.message:String(ee)))});return}He("Unknown built-in command: /"+E)},[Jr]),fR=h.useCallback(E=>{Pe(q=>q.filter(Y=>Y.id!==E))},[]),pR=h.useCallback(async()=>{for(var E=wt.length-1;E>=0;E--)if(wt[E].info.role==="user"){var q=wt[E].parts||[],Y=Mb(q,null),J=q.filter(function(ge){return ge.type==="image_url"&&ge.image_url});if(Y.trim()||J.length>0)if(J.length>0){var ee=oe;if(!ee)break;Zt(ee,!0),He(null);try{var be=J.map(function(ge){return{type:"image_url",image_url:ge.image_url}});await pc(ee,Y.trim(),be,de.current[ee]||void 0)}catch(ge){He("Failed to retry: "+ge.message),Zt(ee,!1)}}else try{await Jr(Y.trim())}catch(ge){He("Failed to retry: "+ge.message),Zt(oe,!1)}break}},[wt,Jr,oe]),gR=h.useCallback(async function(E){if(E&&E.trim()){He(null),Ve.current&&Ve.current.resetAutoScroll();try{await Jr(E.trim()),ft.current&&cancelAnimationFrame(ft.current),ft.current=requestAnimationFrame(function(){ft.current=0,Ve.current&&Ve.current.scrollToBottom()})}catch(q){He("Failed to resend: "+q.message),Zt(oe,!1)}}},[Jr]),_r=h.useMemo(()=>ct?ct.source==="tui"||ct.source==="legacy"||ct.source==="archive"||ct._readOnly===!0:!1,[ct]),Md=h.useMemo(()=>ct?ct._readOnly===!0&&ct.source!=="tui"&&ct.source!=="legacy"&&ct.source!=="archive":!1,[ct]),Id=h.useMemo(()=>{if(!Md||!ct||!et)return null;for(const E of et)if(E.parentSessionID===ct.id)return E.id;return null},[Md,ct,et]),hR=h.useMemo(()=>{var Y;let E=null;for(let J=wt.length-1;J>=0;J--)if(((Y=wt[J].info)==null?void 0:Y.role)==="assistant"){E=wt[J];break}if(!E)return[];const q=(E.parts||[]).filter(J=>J.type==="tool");return q.length===0?[]:!cn&&q.every(ee=>{var be,ge;return((be=ee.state)==null?void 0:be.status)==="completed"||((ge=ee.state)==null?void 0:ge.status)==="error"})?[]:q},[wt,cn]),mR=h.useMemo(()=>{var q;const E=[];for(const Y of wt)if(((q=Y.info)==null?void 0:q.role)==="assistant"){const J=(Y.parts||[]).filter(ee=>ee.type==="tool");E.push(...J)}return E},[wt]),Vi=h.useRef(0),[yR,Ld]=h.useState(!1),xR=h.useCallback(E=>{if(E.preventDefault(),E.stopPropagation(),Vi.current++,Vi.current===1){const q=E.dataTransfer;let Y=!1;q&&q.items&&q.items.length>0&&(Y=Array.from(q.items).some(J=>J.kind==="file")),Y&&Ld(!0)}},[]),bR=h.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Vi.current=Math.max(0,Vi.current-1),Vi.current===0&&Ld(!1)},[]),vR=h.useCallback(E=>{E.preventDefault(),E.stopPropagation()},[]),kR=h.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Vi.current=0,Ld(!1);const q=E.dataTransfer&&E.dataTransfer.files;if(!q||q.length===0)return;const Y=q[0],J=Y.name.toLowerCase();if(!J.endsWith(".yaml")&&!J.endsWith(".yml")){He(e("import.invalid_file_type"));return}const ee=10*1024*1024;if(Y.size>ee){He(e("import.file_too_large"));return}const be=new FileReader;be.onload=ge=>{const st=ge&&ge.target?ge.target.result:null;if(typeof st!="string"){He(e("import.read_error"));return}Ad(st)},be.onerror=()=>{He(e("import.read_error"))},be.readAsText(Y)},[Ad,He,e]);if(re)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(!me)return o.jsx(Cz,{darkMode:c,onToggleTheme:()=>u(!c)});const mv=ct==null?void 0:ct.title,Od=typeof mv=="string"?mv.trim():"",Vs=((yv=ct==null?void 0:ct.ui)==null?void 0:yv.hideThinking)??!0;return o.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:xR,onDragLeave:bR,onDragOver:vR,onDrop:kR,children:[yR&&o.jsx("div",{className:"fixed inset-0 z-50 bg-primary-500/20 dark:bg-primary-400/20 border-4 border-dashed border-primary-500 dark:border-primary-400 flex items-center justify-center pointer-events-none",children:o.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:o.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),o.jsxs("header",{className:"flex items-center justify-between px-4 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("img",{src:c?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-8"}),o.jsx("h1",{className:"sr-only",children:"PAVE"})]}),o.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[o.jsx("button",{onClick:()=>Se("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Le==="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:()=>Se("agents"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Le==="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:()=>Se("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Le==="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:()=>Se("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Le==="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(xY,{onNavigateToAgent:E=>{fe(E),Se("agents")}}),o.jsx("button",{onClick:()=>f(!d),className:`p-1.5 rounded-lg transition-colors ${d?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(d?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(d?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),oe&&Le==="chat"&&o.jsx("button",{onClick:Z,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${I?"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:U?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:U?"Cmd+J":"Ctrl+J"}),"aria-pressed":I,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(aI,{darkMode:c,onToggle:()=>u(!c)}),me&&o.jsx(jz,{user:me,onLogout:z,onSkillManagement:()=>Se("skills"),onAgentManagement:()=>Se("agents"),onPricingSettings:()=>Ce(!0),onDlpSettings:()=>he(!0),onSettings:()=>Se("settings")})]})]}),Le==="skills"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(iK,{onBack:()=>Se("chat")})}):Le==="agents"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(DK,{onBack:()=>Se("chat"),onSelectAgent:E=>{Te(E)},initialAgentName:Fe,onInitialAgentConsumed:()=>fe(null),hackerMode:d,matrixMode:m,darkMode:c,onToggleMatrix:()=>y(E=>!E),terminalWidth:M,onTerminalWidthChange:S,terminalMinWidth:t,terminalMaxWidth:n})}):Le==="settings"?o.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:o.jsx(rY,{onBack:()=>Se("chat"),activeSessionId:oe,mobileFrameless:p,onMobileFramelessChange:g})}):o.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[o.jsx(uI,{sessions:et,activeSessionId:oe,busySessions:or,onSelectSession:E=>{lr(E),window.innerWidth<768&&yt(!1)},onNewChat:Td,onDeleteSession:XA,onDeleteAllSessions:ZA,onRenameSession:JA,onRegenerateTitle:eR,onPinSession:tR,onArchiveSession:rR,onExportSession:gv,onImportSession:Ad,onImportError:E=>He(E),showArchived:ae,onToggleShowArchived:cR,isOpen:nt,onClose:()=>yt(!1),onToggle:()=>yt(E=>!E),hasMoreSessions:Rl,onLoadMoreSessions:QA}),o.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:oe?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 px-3 py-1.5 border-b border-gray-100 dark:border-gray-800/50 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(DG,{sessionModel:R.has(oe)?"epm/privacy":mt[oe]||null,activeModel:te,registryEntries:ot,onModelChange:iR,disabled:cn||R.has(oe),lockedReason:R.has(oe)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},oe),Od?o.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:Od,children:Od}):null,o.jsx("button",{onClick:()=>vd(!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(DA,{className:"w-4 h-4"})}),o.jsx(BG,{sessionId:oe,disabledSkills:ct?ct.disabledSkills:[],onToggle:sR,onResetToDefaults:oR,t:e,disabled:_r}),o.jsx("button",{onClick:()=>iv(!0),className:`p-1.5 rounded-lg transition-colors ${$A?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("chat.idle_injection_title"),"aria-label":e("chat.idle_injection_title"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),je&&o.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.moe_tooltip"),children:[{val:null,label:"Auto"},{val:8,label:"Quality"},{val:6,label:"Balanced"},{val:4,label:"Fast"}].map(E=>{const q=uv===null&&dv&&!Ll.current.has(oe)&&dv.moe_topk===E.val,Y=uv===E.val;return o.jsx("button",{onClick:()=>{E.val===null?Ll.current.delete(oe):Ll.current.add(oe),ov(J=>({...J,[oe]:E.val})),cr(oe,{moe_top_k:E.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${Y?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":q?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 ring-1 ring-blue-400 dark:ring-blue-600":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:E.label},E.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(E=>o.jsx("button",{onClick:()=>{lv(q=>({...q,[oe]:E.val})),cr(oe,{reasoning_effort:E.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${VA===E.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:E.label},E.val))})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>aR({readOnly:_r}),className:`p-1.5 rounded-lg transition-colors ${Vs?"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(Vs?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(Vs?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!Vs,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),o.jsx("button",{onClick:async()=>{if(oe)try{await DB(oe),He("Banner generation queued (~2 min)"),setTimeout(()=>He(null),4e3)}catch(E){He(`Banner: ${E.message||E}`)}},disabled:!oe,className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Generate session banner now","aria-label":"Generate session banner now",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),o.jsx("button",{onClick:K,className:`p-1.5 rounded-lg transition-colors ${Q?"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:Q?"Show banner":"Hide banner","aria-label":Q?"Show banner":"Hide banner","aria-pressed":!Q,children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Q?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"})]})})}),kr?o.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${kr.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":kr.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:kr.label,children:kr.label}):null,o.jsx("button",{onClick:()=>{if(!Xr){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}PA(E=>!E)},disabled:!Xr,className:`p-1.5 rounded-lg transition-colors ${Xr?Qr?"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:Xr?e(Qr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(Qr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":Qr,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:()=>$i(E=>!E),className:`p-1.5 rounded-lg transition-colors lg:hidden ${Jt?"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":Jt,"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:()=>gv(oe),className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:e("sidebar.export"),"aria-label":e("sidebar.export"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),o.jsx("button",{onClick:()=>{Ge(E=>!E),$e&&(Et(""),Vt(0),wa(0))},className:`p-1.5 rounded-lg transition-colors ${$e?"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"})})})]})]}),$e&&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:it,onChange:E=>{Et(E.target.value),Vt(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"}),it&&o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums",children:Bt>0?e("app.match_count",{current:Tt+1,total:Bt}):e("app.no_matches")}),it&&Bt>0&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>Vt(E=>(E-1+Bt)%Bt),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:()=>Vt(E=>(E+1)%Bt),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:()=>{Ge(!1),Et(""),Vt(0),wa(0)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.close_search"),"aria-label":e("app.close_search"),children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!ie&&o.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),o.jsx("span",{children:e("app.reconnecting")})]}),qs&&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:qs}),o.jsx("button",{onClick:()=>He(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"})})})]}),Ml&&o.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${Ml.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":Ml.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:Ml.text})]}),Bi&&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:Bi.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:Bi.verification_uri})," ","— ",o.jsx("span",{className:"font-mono font-bold text-base select-all",children:Bi.user_code})]}),o.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),o.jsx("button",{onClick:()=>wl(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"})})})]})}),vr&&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 ",vr.attempt,"/",vr.maxRetries,vr.maxDurationMs>0&&vr.elapsedMs>0&&o.jsxs(o.Fragment,{children:[" (",Math.round(vr.elapsedMs/1e3),"s / ",Math.round(vr.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(vr.delayMs/1e3),"s. Click Stop to cancel."]}),o.jsx("button",{onClick:()=>{ba(null),Fn.current&&(clearTimeout(Fn.current),Fn.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"})})})]}),El&&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: ",El.fallbackModel," (local model unavailable)"]}),o.jsx("button",{onClick:()=>{Yn(null),hn.current&&(clearTimeout(hn.current),hn.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(ZB,{ref:Ve,messages:wt,streamingParts:ai[oe]||{},streamingProgress:yd,isBusy:cn,compactingInfo:br,compactionResult:_l,onSwitchToCompactedSession:E=>{rt.current=E,jt(E),va(null)},onDismissCompactionResult:()=>va(null),parentSessionID:ct&&ct.parentSessionID,compactionPinned:ct&&ct.compactionPinned,onUnpinCompaction:nR,onViewParentSession:E=>{rt.current=E,jt(E),Qe(function(q){return q.map(function(Y){return Y.id===E?{...Y,_readOnly:!0}:Y})})},user:me,searchQuery:it,activeMatchIndex:Tt,onTotalMatchesChange:wa,onRetry:_r?void 0:pR,onEditAndResend:_r?void 0:gR,onCancelQueued:_r?void 0:YA,hackerMode:d,mobileFrameless:p,hideThinking:Vs,sessionID:oe,banners:Sl[oe]||[],bannerHidden:Q,onToggleBanner:K,privateMessageIds:A,questionIdMap:Xe}),($t[oe]||[]).length>0&&o.jsx(CY,{items:$t[oe]||[],sessionId:oe,isReadOnly:_r,onReorder:function(E){qF(oe,E).catch(function(q){He("Failed to reorder: "+q.message)})},onCancelItem:function(E){Gk(oe,E).catch(function(q){He("Failed to cancel: "+q.message)})},onEditItem:function(E){if(!(E.status==="dispatching"||_r)){Gk(oe,E.id).catch(function(){});var q=E.displayContent||E.text||"";q&&_.current&&typeof _.current.setText=="function"&&_.current.setText(q)}},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:Md?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"})}),Id?o.jsx("button",{onClick:()=>{rt.current=Id,jt(Id)},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:ct&&ct.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:ct&&ct.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):o.jsx(Sz,{ref:_,sessionId:oe,onSend:Jr,onBuiltinCommand:dR,onAbort:uR,isBusy:cn,queuedCount:KA+($t[oe]||[]).length})]}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[o.jsx("img",{src:c?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-16 mb-4"}),o.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),o.jsx("button",{onClick:Td,className:"py-2 px-6 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:e("app.new_chat")})]})}),oe&&o.jsxs("aside",{style:{width:M},className:`border-l hidden ${I?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${d?c?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[o.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":e("app.resize_terminal"),"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":M,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${d?c?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}`,onMouseDown:E=>{E.preventDefault();const q=E.clientX,Y=M,J=be=>{const ge=q-be.clientX,st=Math.min(n,Math.max(t,Y+ge));S(st)},ee=()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",J),document.addEventListener("mouseup",ee)}}),!Jt&&fv()]}),Jt&&oe&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>$i(!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:E=>{(E.key==="Escape"||E.key==="Esc")&&(E.stopPropagation(),$i(!1))},ref:bd,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:()=>$i(!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"})})})]}),fv()]})]})]}),xe&&o.jsx(sY,{onClose:()=>Ce(!1)}),ue&&o.jsx(dY,{onClose:()=>he(!1)}),o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:o.jsx(gY,{requests:_e,onDismiss:fR})}),o.jsx(mY,{open:Cl,onClose:()=>jl(!1),upgradeUrl:Tl}),o.jsx(EY,{isOpen:BA,onClose:()=>vd(!1),sessionId:oe,currentDirectory:(ct==null?void 0:ct.directory)||"",homeDir:zA,onDirectoryChange:lR}),o.jsx(SY,{isOpen:qA,onClose:()=>iv(!1),sessionId:oe}),o.jsx(vY,{isOpen:N,onClose:()=>{w(!1),setTimeout(()=>{var E;return(E=_.current)==null?void 0:E.focus()},0)},onSelectSession:E=>{lr(E)},onNewChat:()=>{typeof P.current=="function"&&P.current()},activeSessionId:oe,sessions:et,busySessions:or}),o.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:W})]})}const AY=rI();q0.createRoot(document.getElementById("root")).render(o.jsx(UR.StrictMode,{children:o.jsx(nI,{initialLocale:AY,children:o.jsx(sI,{children:o.jsx(TY,{})})})}));export{uj as _,Da as c,il as g,NG as p};