operatr 0.12.0

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -0
  3. package/bin/operator.js +14 -0
  4. package/package.json +49 -0
  5. package/public/assets/arc-C3oZj6HF.js +1 -0
  6. package/public/assets/architectureDiagram-3BPJPVTR-BFENfeP2.js +36 -0
  7. package/public/assets/blockDiagram-GPEHLZMM-C1A8KgJE.js +132 -0
  8. package/public/assets/c4Diagram-AAUBKEIU-03jekykM.js +10 -0
  9. package/public/assets/channel-BFxhh-e6.js +1 -0
  10. package/public/assets/chunk-2J33WTMH-Cd16JLFK.js +1 -0
  11. package/public/assets/chunk-4BX2VUAB-70lJk7KH.js +1 -0
  12. package/public/assets/chunk-55IACEB6-DzNNKRy6.js +1 -0
  13. package/public/assets/chunk-727SXJPM-CZjd3AP5.js +206 -0
  14. package/public/assets/chunk-AQP2D5EJ-B_48wDVV.js +231 -0
  15. package/public/assets/chunk-FMBD7UC4-u93wErxL.js +15 -0
  16. package/public/assets/chunk-ND2GUHAM-GWZJNHoC.js +1 -0
  17. package/public/assets/chunk-QZHKN3VN-BHGAVy4h.js +1 -0
  18. package/public/assets/classDiagram-4FO5ZUOK-BWxq3avf.js +1 -0
  19. package/public/assets/classDiagram-v2-Q7XG4LA2-BWxq3avf.js +1 -0
  20. package/public/assets/cose-bilkent-S5V4N54A-HdalsDiB.js +1 -0
  21. package/public/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
  22. package/public/assets/dagre-BM42HDAG-DlIcXTjT.js +4 -0
  23. package/public/assets/defaultLocale-DX6XiGOO.js +1 -0
  24. package/public/assets/diagram-2AECGRRQ-D0GHawOW.js +43 -0
  25. package/public/assets/diagram-5GNKFQAL-Cd36guSH.js +10 -0
  26. package/public/assets/diagram-KO2AKTUF-DtYM_ie4.js +3 -0
  27. package/public/assets/diagram-LMA3HP47-2KIpJ02P.js +24 -0
  28. package/public/assets/diagram-OG6HWLK6-DFwD1qiv.js +24 -0
  29. package/public/assets/erDiagram-TEJ5UH35-DslM2UDd.js +85 -0
  30. package/public/assets/flowDiagram-I6XJVG4X-DGGy4pet.js +162 -0
  31. package/public/assets/ganttDiagram-6RSMTGT7-CPWMAKNx.js +292 -0
  32. package/public/assets/gitGraphDiagram-PVQCEYII-DPlcGM7A.js +106 -0
  33. package/public/assets/graph-CAnANduQ.js +1 -0
  34. package/public/assets/index-C3Ld66t2.js +348 -0
  35. package/public/assets/index-CglXVmBD.css +32 -0
  36. package/public/assets/infoDiagram-5YYISTIA-BvfzdQ33.js +2 -0
  37. package/public/assets/init-Gi6I4Gst.js +1 -0
  38. package/public/assets/ishikawaDiagram-YF4QCWOH-BXBtXmNa.js +70 -0
  39. package/public/assets/journeyDiagram-JHISSGLW-0k6NYR9M.js +139 -0
  40. package/public/assets/kanban-definition-UN3LZRKU-Br-pJVoB.js +89 -0
  41. package/public/assets/katex-C5jXJg4s.js +257 -0
  42. package/public/assets/layout-DGIYPm2g.js +1 -0
  43. package/public/assets/linear-Dw294nF-.js +1 -0
  44. package/public/assets/mermaid.core-890uePvN.js +309 -0
  45. package/public/assets/mindmap-definition-RKZ34NQL-r7qhn-Fa.js +96 -0
  46. package/public/assets/ordinal-Cboi1Yqb.js +1 -0
  47. package/public/assets/pieDiagram-4H26LBE5-B4p_YihD.js +30 -0
  48. package/public/assets/quadrantDiagram-W4KKPZXB-DYJjK2r-.js +7 -0
  49. package/public/assets/requirementDiagram-4Y6WPE33-kRWJDus9.js +84 -0
  50. package/public/assets/sankeyDiagram-5OEKKPKP-Cs0dDmxJ.js +40 -0
  51. package/public/assets/sequenceDiagram-3UESZ5HK-e3s6dVA4.js +162 -0
  52. package/public/assets/stateDiagram-AJRCARHV-CpVW_jun.js +1 -0
  53. package/public/assets/stateDiagram-v2-BHNVJYJU-BZ88_i1s.js +1 -0
  54. package/public/assets/timeline-definition-PNZ67QCA-BXF5ufP-.js +120 -0
  55. package/public/assets/vennDiagram-CIIHVFJN-DhA6SmOv.js +34 -0
  56. package/public/assets/wardley-L42UT6IY-DwnN1FeQ.js +173 -0
  57. package/public/assets/wardleyDiagram-YWT4CUSO-C4y3XA-b.js +78 -0
  58. package/public/assets/xychartDiagram-2RQKCTM6-CrWgrBy2.js +7 -0
  59. package/public/index.html +19 -0
  60. package/public/operator-devtools.iife.js +416 -0
  61. package/public/operator-devtools.js +5870 -0
  62. package/server/index.js +9458 -0
  63. package/server/runner.js +3799 -0
@@ -0,0 +1,348 @@
1
+ var Z2=Object.defineProperty;var G2=(e,t,n)=>t in e?Z2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Lf=(e,t,n)=>G2(e,typeof t!="symbol"?t+"":t,n);function J2(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function ig(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Of={exports:{}},Bl={},jf={exports:{}},Ke={};/**
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 ny;function Q2(){if(ny)return Ke;ny=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.iterator;function v(H){return H===null||typeof H!="object"?null:(H=f&&H[f]||H["@@iterator"],typeof H=="function"?H:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function k(H,Q,L){this.props=H,this.context=Q,this.refs=S,this.updater=L||_}k.prototype.isReactComponent={},k.prototype.setState=function(H,Q){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,Q,"setState")},k.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function C(){}C.prototype=k.prototype;function T(H,Q,L){this.props=H,this.context=Q,this.refs=S,this.updater=L||_}var N=T.prototype=new C;N.constructor=T,x(N,k.prototype),N.isPureReactComponent=!0;var M=Array.isArray,B=Object.prototype.hasOwnProperty,A={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function $(H,Q,L){var Z,oe={},te=null,_e=null;if(Q!=null)for(Z in Q.ref!==void 0&&(_e=Q.ref),Q.key!==void 0&&(te=""+Q.key),Q)B.call(Q,Z)&&!D.hasOwnProperty(Z)&&(oe[Z]=Q[Z]);var ye=arguments.length-2;if(ye===1)oe.children=L;else if(1<ye){for(var Ce=Array(ye),ge=0;ge<ye;ge++)Ce[ge]=arguments[ge+2];oe.children=Ce}if(H&&H.defaultProps)for(Z in ye=H.defaultProps,ye)oe[Z]===void 0&&(oe[Z]=ye[Z]);return{$$typeof:e,type:H,key:te,ref:_e,props:oe,_owner:A.current}}function j(H,Q){return{$$typeof:e,type:H.type,key:Q,ref:H.ref,props:H.props,_owner:H._owner}}function R(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function U(H){var Q={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(L){return Q[L]})}var V=/\/+/g;function Y(H,Q){return typeof H=="object"&&H!==null&&H.key!=null?U(""+H.key):Q.toString(36)}function W(H,Q,L,Z,oe){var te=typeof H;(te==="undefined"||te==="boolean")&&(H=null);var _e=!1;if(H===null)_e=!0;else switch(te){case"string":case"number":_e=!0;break;case"object":switch(H.$$typeof){case e:case t:_e=!0}}if(_e)return _e=H,oe=oe(_e),H=Z===""?"."+Y(_e,0):Z,M(oe)?(L="",H!=null&&(L=H.replace(V,"$&/")+"/"),W(oe,Q,L,"",function(ge){return ge})):oe!=null&&(R(oe)&&(oe=j(oe,L+(!oe.key||_e&&_e.key===oe.key?"":(""+oe.key).replace(V,"$&/")+"/")+H)),Q.push(oe)),1;if(_e=0,Z=Z===""?".":Z+":",M(H))for(var ye=0;ye<H.length;ye++){te=H[ye];var Ce=Z+Y(te,ye);_e+=W(te,Q,L,Ce,oe)}else if(Ce=v(H),typeof Ce=="function")for(H=Ce.call(H),ye=0;!(te=H.next()).done;)te=te.value,Ce=Z+Y(te,ye++),_e+=W(te,Q,L,Ce,oe);else if(te==="object")throw Q=String(H),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return _e}function q(H,Q,L){if(H==null)return H;var Z=[],oe=0;return W(H,Z,"","",function(te){return Q.call(L,te,oe++)}),Z}function z(H){if(H._status===-1){var Q=H._result;Q=Q(),Q.then(function(L){(H._status===0||H._status===-1)&&(H._status=1,H._result=L)},function(L){(H._status===0||H._status===-1)&&(H._status=2,H._result=L)}),H._status===-1&&(H._status=0,H._result=Q)}if(H._status===1)return H._result.default;throw H._result}var J={current:null},I={transition:null},re={ReactCurrentDispatcher:J,ReactCurrentBatchConfig:I,ReactCurrentOwner:A};function P(){throw Error("act(...) is not supported in production builds of React.")}return Ke.Children={map:q,forEach:function(H,Q,L){q(H,function(){Q.apply(this,arguments)},L)},count:function(H){var Q=0;return q(H,function(){Q++}),Q},toArray:function(H){return q(H,function(Q){return Q})||[]},only:function(H){if(!R(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},Ke.Component=k,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=T,Ke.StrictMode=r,Ke.Suspense=h,Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=re,Ke.act=P,Ke.cloneElement=function(H,Q,L){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var Z=x({},H.props),oe=H.key,te=H.ref,_e=H._owner;if(Q!=null){if(Q.ref!==void 0&&(te=Q.ref,_e=A.current),Q.key!==void 0&&(oe=""+Q.key),H.type&&H.type.defaultProps)var ye=H.type.defaultProps;for(Ce in Q)B.call(Q,Ce)&&!D.hasOwnProperty(Ce)&&(Z[Ce]=Q[Ce]===void 0&&ye!==void 0?ye[Ce]:Q[Ce])}var Ce=arguments.length-2;if(Ce===1)Z.children=L;else if(1<Ce){ye=Array(Ce);for(var ge=0;ge<Ce;ge++)ye[ge]=arguments[ge+2];Z.children=ye}return{$$typeof:e,type:H.type,key:oe,ref:te,props:Z,_owner:_e}},Ke.createContext=function(H){return H={$$typeof:l,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:s,_context:H},H.Consumer=H},Ke.createElement=$,Ke.createFactory=function(H){var Q=$.bind(null,H);return Q.type=H,Q},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(H){return{$$typeof:c,render:H}},Ke.isValidElement=R,Ke.lazy=function(H){return{$$typeof:p,_payload:{_status:-1,_result:H},_init:z}},Ke.memo=function(H,Q){return{$$typeof:u,type:H,compare:Q===void 0?null:Q}},Ke.startTransition=function(H){var Q=I.transition;I.transition={};try{H()}finally{I.transition=Q}},Ke.unstable_act=P,Ke.useCallback=function(H,Q){return J.current.useCallback(H,Q)},Ke.useContext=function(H){return J.current.useContext(H)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(H){return J.current.useDeferredValue(H)},Ke.useEffect=function(H,Q){return J.current.useEffect(H,Q)},Ke.useId=function(){return J.current.useId()},Ke.useImperativeHandle=function(H,Q,L){return J.current.useImperativeHandle(H,Q,L)},Ke.useInsertionEffect=function(H,Q){return J.current.useInsertionEffect(H,Q)},Ke.useLayoutEffect=function(H,Q){return J.current.useLayoutEffect(H,Q)},Ke.useMemo=function(H,Q){return J.current.useMemo(H,Q)},Ke.useReducer=function(H,Q,L){return J.current.useReducer(H,Q,L)},Ke.useRef=function(H){return J.current.useRef(H)},Ke.useState=function(H){return J.current.useState(H)},Ke.useSyncExternalStore=function(H,Q,L){return J.current.useSyncExternalStore(H,Q,L)},Ke.useTransition=function(){return J.current.useTransition()},Ke.version="18.3.1",Ke}var ry;function sg(){return ry||(ry=1,jf.exports=Q2()),jf.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var iy;function eN(){if(iy)return Bl;iy=1;var e=sg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(c,h,u){var p,f={},v=null,_=null;u!==void 0&&(v=""+u),h.key!==void 0&&(v=""+h.key),h.ref!==void 0&&(_=h.ref);for(p in h)r.call(h,p)&&!s.hasOwnProperty(p)&&(f[p]=h[p]);if(c&&c.defaultProps)for(p in h=c.defaultProps,h)f[p]===void 0&&(f[p]=h[p]);return{$$typeof:t,type:c,key:v,ref:_,props:f,_owner:i.current}}return Bl.Fragment=n,Bl.jsx=l,Bl.jsxs=l,Bl}var sy;function tN(){return sy||(sy=1,Of.exports=eN()),Of.exports}var g=tN(),b=sg();const ot=ig(b),og=J2({__proto__:null,default:ot},[b]);var Jc={},If={exports:{}},Fn={},Bf={exports:{}},zf={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var oy;function nN(){return oy||(oy=1,(function(e){function t(I,re){var P=I.length;I.push(re);e:for(;0<P;){var H=P-1>>>1,Q=I[H];if(0<i(Q,re))I[H]=re,I[P]=Q,P=H;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var re=I[0],P=I.pop();if(P!==re){I[0]=P;e:for(var H=0,Q=I.length,L=Q>>>1;H<L;){var Z=2*(H+1)-1,oe=I[Z],te=Z+1,_e=I[te];if(0>i(oe,P))te<Q&&0>i(_e,oe)?(I[H]=_e,I[te]=P,H=te):(I[H]=oe,I[Z]=P,H=Z);else if(te<Q&&0>i(_e,P))I[H]=_e,I[te]=P,H=te;else break e}}return re}function i(I,re){var P=I.sortIndex-re.sortIndex;return P!==0?P:I.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var h=[],u=[],p=1,f=null,v=3,_=!1,x=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(I){for(var re=n(u);re!==null;){if(re.callback===null)r(u);else if(re.startTime<=I)r(u),re.sortIndex=re.expirationTime,t(h,re);else break;re=n(u)}}function M(I){if(S=!1,N(I),!x)if(n(h)!==null)x=!0,z(B);else{var re=n(u);re!==null&&J(M,re.startTime-I)}}function B(I,re){x=!1,S&&(S=!1,C($),$=-1),_=!0;var P=v;try{for(N(re),f=n(h);f!==null&&(!(f.expirationTime>re)||I&&!U());){var H=f.callback;if(typeof H=="function"){f.callback=null,v=f.priorityLevel;var Q=H(f.expirationTime<=re);re=e.unstable_now(),typeof Q=="function"?f.callback=Q:f===n(h)&&r(h),N(re)}else r(h);f=n(h)}if(f!==null)var L=!0;else{var Z=n(u);Z!==null&&J(M,Z.startTime-re),L=!1}return L}finally{f=null,v=P,_=!1}}var A=!1,D=null,$=-1,j=5,R=-1;function U(){return!(e.unstable_now()-R<j)}function V(){if(D!==null){var I=e.unstable_now();R=I;var re=!0;try{re=D(!0,I)}finally{re?Y():(A=!1,D=null)}}else A=!1}var Y;if(typeof T=="function")Y=function(){T(V)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,q=W.port2;W.port1.onmessage=V,Y=function(){q.postMessage(null)}}else Y=function(){k(V,0)};function z(I){D=I,A||(A=!0,Y())}function J(I,re){$=k(function(){I(e.unstable_now())},re)}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(I){I.callback=null},e.unstable_continueExecution=function(){x||_||(x=!0,z(B))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(I){switch(v){case 1:case 2:case 3:var re=3;break;default:re=v}var P=v;v=re;try{return I()}finally{v=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,re){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var P=v;v=I;try{return re()}finally{v=P}},e.unstable_scheduleCallback=function(I,re,P){var H=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?H+P:H):P=H,I){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=P+Q,I={id:p++,callback:re,priorityLevel:I,startTime:P,expirationTime:Q,sortIndex:-1},P>H?(I.sortIndex=P,t(u,I),n(h)===null&&I===n(u)&&(S?(C($),$=-1):S=!0,J(M,P-H))):(I.sortIndex=Q,t(h,I),x||_||(x=!0,z(B))),I},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(I){var re=v;return function(){var P=v;v=re;try{return I.apply(this,arguments)}finally{v=P}}}})(zf)),zf}var ly;function rN(){return ly||(ly=1,Bf.exports=nN()),Bf.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 ay;function iN(){if(ay)return Fn;ay=1;var e=sg(),t=rN();function n(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(o,a){l(o,a),l(o+"Capture",a)}function l(o,a){for(i[o]=a,o=0;o<a.length;o++)r.add(a[o])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function v(o){return h.call(f,o)?!0:h.call(p,o)?!1:u.test(o)?f[o]=!0:(p[o]=!0,!1)}function _(o,a,d,m){if(d!==null&&d.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function x(o,a,d,m){if(a===null||typeof a>"u"||_(o,a,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function S(o,a,d,m,y,w,E){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=d,this.propertyName=o,this.type=a,this.sanitizeURL=w,this.removeEmptyString=E}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){k[o]=new S(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var a=o[0];k[a]=new S(a,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){k[o]=new S(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){k[o]=new S(o,2,!1,o,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(o){k[o]=new S(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){k[o]=new S(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){k[o]=new S(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){k[o]=new S(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){k[o]=new S(o,5,!1,o.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function T(o){return o[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(o){var a=o.replace(C,T);k[a]=new S(a,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var a=o.replace(C,T);k[a]=new S(a,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var a=o.replace(C,T);k[a]=new S(a,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){k[o]=new S(o,1,!1,o.toLowerCase(),null,!1,!1)}),k.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){k[o]=new S(o,1,!1,o.toLowerCase(),null,!0,!0)});function N(o,a,d,m){var y=k.hasOwnProperty(a)?k[a]:null;(y!==null?y.type!==0:m||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(x(a,d,y,m)&&(d=null),m||y===null?v(a)&&(d===null?o.removeAttribute(a):o.setAttribute(a,""+d)):y.mustUseProperty?o[y.propertyName]=d===null?y.type===3?!1:"":d:(a=y.attributeName,m=y.attributeNamespace,d===null?o.removeAttribute(a):(y=y.type,d=y===3||y===4&&d===!0?"":""+d,m?o.setAttributeNS(m,a,d):o.setAttribute(a,d))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,B=Symbol.for("react.element"),A=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),U=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),I=Symbol.iterator;function re(o){return o===null||typeof o!="object"?null:(o=I&&o[I]||o["@@iterator"],typeof o=="function"?o:null)}var P=Object.assign,H;function Q(o){if(H===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);H=a&&a[1]||""}return`
34
+ `+H+o}var L=!1;function Z(o,a){if(!o||L)return"";L=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ee){var m=ee}Reflect.construct(o,[],a)}else{try{a.call()}catch(ee){m=ee}o.call(a.prototype)}else{try{throw Error()}catch(ee){m=ee}o()}}catch(ee){if(ee&&m&&typeof ee.stack=="string"){for(var y=ee.stack.split(`
35
+ `),w=m.stack.split(`
36
+ `),E=y.length-1,O=w.length-1;1<=E&&0<=O&&y[E]!==w[O];)O--;for(;1<=E&&0<=O;E--,O--)if(y[E]!==w[O]){if(E!==1||O!==1)do if(E--,O--,0>O||y[E]!==w[O]){var F=`
37
+ `+y[E].replace(" at new "," at ");return o.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",o.displayName)),F}while(1<=E&&0<=O);break}}}finally{L=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?Q(o):""}function oe(o){switch(o.tag){case 5:return Q(o.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return o=Z(o.type,!1),o;case 11:return o=Z(o.type.render,!1),o;case 1:return o=Z(o.type,!0),o;default:return""}}function te(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case D:return"Fragment";case A:return"Portal";case j:return"Profiler";case $:return"StrictMode";case Y:return"Suspense";case W:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case U:return(o.displayName||"Context")+".Consumer";case R:return(o._context.displayName||"Context")+".Provider";case V:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case q:return a=o.displayName||null,a!==null?a:te(o.type)||"Memo";case z:a=o._payload,o=o._init;try{return te(o(a))}catch{}}return null}function _e(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return te(a);case 8:return a===$?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function ye(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ce(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ge(o){var a=Ce(o)?"checked":"value",d=Object.getOwnPropertyDescriptor(o.constructor.prototype,a),m=""+o[a];if(!o.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,w=d.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(E){m=""+E,w.call(this,E)}}),Object.defineProperty(o,a,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(E){m=""+E},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function at(o){o._valueTracker||(o._valueTracker=ge(o))}function nt(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),m="";return o&&(m=Ce(o)?o.checked?"true":"false":o.value),o=m,o!==d?(a.setValue(o),!0):!1}function Ie(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function rt(o,a){var d=a.checked;return P({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function Lt(o,a){var d=a.defaultValue==null?"":a.defaultValue,m=a.checked!=null?a.checked:a.defaultChecked;d=ye(a.value!=null?a.value:d),o._wrapperState={initialChecked:m,initialValue:d,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function cn(o,a){a=a.checked,a!=null&&N(o,"checked",a,!1)}function Un(o,a){cn(o,a);var d=ye(a.value),m=a.type;if(d!=null)m==="number"?(d===0&&o.value===""||o.value!=d)&&(o.value=""+d):o.value!==""+d&&(o.value=""+d);else if(m==="submit"||m==="reset"){o.removeAttribute("value");return}a.hasOwnProperty("value")?un(o,a.type,d):a.hasOwnProperty("defaultValue")&&un(o,a.type,ye(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(o.defaultChecked=!!a.defaultChecked)}function kn(o,a,d){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var m=a.type;if(!(m!=="submit"&&m!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+o._wrapperState.initialValue,d||a===o.value||(o.value=a),o.defaultValue=a}d=o.name,d!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,d!==""&&(o.name=d)}function un(o,a,d){(a!=="number"||Ie(o.ownerDocument)!==o)&&(d==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+d&&(o.defaultValue=""+d))}var vt=Array.isArray;function hn(o,a,d,m){if(o=o.options,a){a={};for(var y=0;y<d.length;y++)a["$"+d[y]]=!0;for(d=0;d<o.length;d++)y=a.hasOwnProperty("$"+o[d].value),o[d].selected!==y&&(o[d].selected=y),y&&m&&(o[d].defaultSelected=!0)}else{for(d=""+ye(d),a=null,y=0;y<o.length;y++){if(o[y].value===d){o[y].selected=!0,m&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function or(o,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return P({},a,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function Sr(o,a){var d=a.value;if(d==null){if(d=a.children,a=a.defaultValue,d!=null){if(a!=null)throw Error(n(92));if(vt(d)){if(1<d.length)throw Error(n(93));d=d[0]}a=d}a==null&&(a=""),d=a}o._wrapperState={initialValue:ye(d)}}function br(o,a){var d=ye(a.value),m=ye(a.defaultValue);d!=null&&(d=""+d,d!==o.value&&(o.value=d),a.defaultValue==null&&o.defaultValue!==d&&(o.defaultValue=d)),m!=null&&(o.defaultValue=""+m)}function Bi(o){var a=o.textContent;a===o._wrapperState.initialValue&&a!==""&&a!==null&&(o.value=a)}function ne(o){switch(o){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 he(o,a){return o==null||o==="http://www.w3.org/1999/xhtml"?ne(a):o==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var Ae,se=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,d,m,y){MSApp.execUnsafeLocalFunction(function(){return o(a,d,m,y)})}:o})(function(o,a){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=a;else{for(Ae=Ae||document.createElement("div"),Ae.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Ae.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;a.firstChild;)o.appendChild(a.firstChild)}});function ve(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var Ue={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},dt=["Webkit","ms","Moz","O"];Object.keys(Ue).forEach(function(o){dt.forEach(function(a){a=a+o.charAt(0).toUpperCase()+o.substring(1),Ue[a]=Ue[o]})});function Kt(o,a,d){return a==null||typeof a=="boolean"||a===""?"":d||typeof a!="number"||a===0||Ue.hasOwnProperty(o)&&Ue[o]?(""+a).trim():a+"px"}function rn(o,a){o=o.style;for(var d in a)if(a.hasOwnProperty(d)){var m=d.indexOf("--")===0,y=Kt(d,a[d],m);d==="float"&&(d="cssFloat"),m?o.setProperty(d,y):o[d]=y}}var Vn=P({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ot(o,a){if(a){if(Vn[o]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function lr(o,a){if(o.indexOf("-")===-1)return typeof a.is=="string";switch(o){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 dn=null;function nl(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var rl=null,zi=null,xt=null;function fn(o){if(o=bl(o)){if(typeof rl!="function")throw Error(n(280));var a=o.stateNode;a&&(a=fc(a),rl(o.stateNode,o.type,a))}}function pn(o){zi?xt?xt.push(o):xt=[o]:zi=o}function kr(){if(zi){var o=zi,a=xt;if(xt=zi=null,fn(o),a)for(o=0;o<a.length;o++)fn(a[o])}}function Cn(o,a){return o(a)}function mn(){}var Ln=!1;function ui(o,a,d){if(Ln)return o(a,d);Ln=!0;try{return Cn(o,a,d)}finally{Ln=!1,(zi!==null||xt!==null)&&(mn(),kr())}}function wt(o,a){var d=o.stateNode;if(d===null)return null;var m=fc(d);if(m===null)return null;d=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(o=o.type,m=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!m;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(n(231,a,typeof d));return d}var ar=!1;if(c)try{var gn={};Object.defineProperty(gn,"passive",{get:function(){ar=!0}}),window.addEventListener("test",gn,gn),window.removeEventListener("test",gn,gn)}catch{ar=!1}function Cr(o,a,d,m,y,w,E,O,F){var ee=Array.prototype.slice.call(arguments,3);try{a.apply(d,ee)}catch(ae){this.onError(ae)}}var Er=!1,$r=null,qn=!1,hi=null,il={onError:function(o){Er=!0,$r=o}};function iE(o,a,d,m,y,w,E,O,F){Er=!1,$r=null,Cr.apply(il,arguments)}function sE(o,a,d,m,y,w,E,O,F){if(iE.apply(this,arguments),Er){if(Er){var ee=$r;Er=!1,$r=null}else throw Error(n(198));qn||(qn=!0,hi=ee)}}function bs(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function Cv(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function Ev(o){if(bs(o)!==o)throw Error(n(188))}function oE(o){var a=o.alternate;if(!a){if(a=bs(o),a===null)throw Error(n(188));return a!==o?null:o}for(var d=o,m=a;;){var y=d.return;if(y===null)break;var w=y.alternate;if(w===null){if(m=y.return,m!==null){d=m;continue}break}if(y.child===w.child){for(w=y.child;w;){if(w===d)return Ev(y),o;if(w===m)return Ev(y),a;w=w.sibling}throw Error(n(188))}if(d.return!==m.return)d=y,m=w;else{for(var E=!1,O=y.child;O;){if(O===d){E=!0,d=y,m=w;break}if(O===m){E=!0,m=y,d=w;break}O=O.sibling}if(!E){for(O=w.child;O;){if(O===d){E=!0,d=w,m=y;break}if(O===m){E=!0,m=w,d=y;break}O=O.sibling}if(!E)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:a}function Nv(o){return o=oE(o),o!==null?Rv(o):null}function Rv(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=Rv(o);if(a!==null)return a;o=o.sibling}return null}var Tv=t.unstable_scheduleCallback,Pv=t.unstable_cancelCallback,lE=t.unstable_shouldYield,aE=t.unstable_requestPaint,Pt=t.unstable_now,cE=t.unstable_getCurrentPriorityLevel,Qh=t.unstable_ImmediatePriority,Dv=t.unstable_UserBlockingPriority,Ka=t.unstable_NormalPriority,uE=t.unstable_LowPriority,Av=t.unstable_IdlePriority,Ya=null,Hr=null;function hE(o){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Ya,o,void 0,(o.current.flags&128)===128)}catch{}}var Nr=Math.clz32?Math.clz32:pE,dE=Math.log,fE=Math.LN2;function pE(o){return o>>>=0,o===0?32:31-(dE(o)/fE|0)|0}var Xa=64,Za=4194304;function sl(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Ga(o,a){var d=o.pendingLanes;if(d===0)return 0;var m=0,y=o.suspendedLanes,w=o.pingedLanes,E=d&268435455;if(E!==0){var O=E&~y;O!==0?m=sl(O):(w&=E,w!==0&&(m=sl(w)))}else E=d&~y,E!==0?m=sl(E):w!==0&&(m=sl(w));if(m===0)return 0;if(a!==0&&a!==m&&(a&y)===0&&(y=m&-m,w=a&-a,y>=w||y===16&&(w&4194240)!==0))return a;if((m&4)!==0&&(m|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=m;0<a;)d=31-Nr(a),y=1<<d,m|=o[d],a&=~y;return m}function mE(o,a){switch(o){case 1:case 2:case 4:return a+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 a+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 gE(o,a){for(var d=o.suspendedLanes,m=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes;0<w;){var E=31-Nr(w),O=1<<E,F=y[E];F===-1?((O&d)===0||(O&m)!==0)&&(y[E]=mE(O,a)):F<=a&&(o.expiredLanes|=O),w&=~O}}function ed(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Mv(){var o=Xa;return Xa<<=1,(Xa&4194240)===0&&(Xa=64),o}function td(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function ol(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Nr(a),o[a]=d}function vE(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0<d;){var y=31-Nr(d),w=1<<y;a[y]=0,m[y]=-1,o[y]=-1,d&=~w}}function nd(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var m=31-Nr(d),y=1<<m;y&a|o[m]&a&&(o[m]|=a),d&=~y}}var st=0;function Lv(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var Ov,rd,jv,Iv,Bv,id=!1,Ja=[],Fi=null,$i=null,Hi=null,ll=new Map,al=new Map,Wi=[],_E="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 zv(o,a){switch(o){case"focusin":case"focusout":Fi=null;break;case"dragenter":case"dragleave":$i=null;break;case"mouseover":case"mouseout":Hi=null;break;case"pointerover":case"pointerout":ll.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":al.delete(a.pointerId)}}function cl(o,a,d,m,y,w){return o===null||o.nativeEvent!==w?(o={blockedOn:a,domEventName:d,eventSystemFlags:m,nativeEvent:w,targetContainers:[y]},a!==null&&(a=bl(a),a!==null&&rd(a)),o):(o.eventSystemFlags|=m,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function yE(o,a,d,m,y){switch(a){case"focusin":return Fi=cl(Fi,o,a,d,m,y),!0;case"dragenter":return $i=cl($i,o,a,d,m,y),!0;case"mouseover":return Hi=cl(Hi,o,a,d,m,y),!0;case"pointerover":var w=y.pointerId;return ll.set(w,cl(ll.get(w)||null,o,a,d,m,y)),!0;case"gotpointercapture":return w=y.pointerId,al.set(w,cl(al.get(w)||null,o,a,d,m,y)),!0}return!1}function Fv(o){var a=ks(o.target);if(a!==null){var d=bs(a);if(d!==null){if(a=d.tag,a===13){if(a=Cv(d),a!==null){o.blockedOn=a,Bv(o.priority,function(){jv(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Qa(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=od(o.domEventName,o.eventSystemFlags,a[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var m=new d.constructor(d.type,d);dn=m,d.target.dispatchEvent(m),dn=null}else return a=bl(d),a!==null&&rd(a),o.blockedOn=d,!1;a.shift()}return!0}function $v(o,a,d){Qa(o)&&d.delete(a)}function xE(){id=!1,Fi!==null&&Qa(Fi)&&(Fi=null),$i!==null&&Qa($i)&&($i=null),Hi!==null&&Qa(Hi)&&(Hi=null),ll.forEach($v),al.forEach($v)}function ul(o,a){o.blockedOn===a&&(o.blockedOn=null,id||(id=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,xE)))}function hl(o){function a(y){return ul(y,o)}if(0<Ja.length){ul(Ja[0],o);for(var d=1;d<Ja.length;d++){var m=Ja[d];m.blockedOn===o&&(m.blockedOn=null)}}for(Fi!==null&&ul(Fi,o),$i!==null&&ul($i,o),Hi!==null&&ul(Hi,o),ll.forEach(a),al.forEach(a),d=0;d<Wi.length;d++)m=Wi[d],m.blockedOn===o&&(m.blockedOn=null);for(;0<Wi.length&&(d=Wi[0],d.blockedOn===null);)Fv(d),d.blockedOn===null&&Wi.shift()}var to=M.ReactCurrentBatchConfig,ec=!0;function wE(o,a,d,m){var y=st,w=to.transition;to.transition=null;try{st=1,sd(o,a,d,m)}finally{st=y,to.transition=w}}function SE(o,a,d,m){var y=st,w=to.transition;to.transition=null;try{st=4,sd(o,a,d,m)}finally{st=y,to.transition=w}}function sd(o,a,d,m){if(ec){var y=od(o,a,d,m);if(y===null)bd(o,a,m,tc,d),zv(o,m);else if(yE(y,o,a,d,m))m.stopPropagation();else if(zv(o,m),a&4&&-1<_E.indexOf(o)){for(;y!==null;){var w=bl(y);if(w!==null&&Ov(w),w=od(o,a,d,m),w===null&&bd(o,a,m,tc,d),w===y)break;y=w}y!==null&&m.stopPropagation()}else bd(o,a,m,null,d)}}var tc=null;function od(o,a,d,m){if(tc=null,o=nl(m),o=ks(o),o!==null)if(a=bs(o),a===null)o=null;else if(d=a.tag,d===13){if(o=Cv(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null);return tc=o,null}function Hv(o){switch(o){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(cE()){case Qh:return 1;case Dv:return 4;case Ka:case uE:return 16;case Av:return 536870912;default:return 16}default:return 16}}var Ui=null,ld=null,nc=null;function Wv(){if(nc)return nc;var o,a=ld,d=a.length,m,y="value"in Ui?Ui.value:Ui.textContent,w=y.length;for(o=0;o<d&&a[o]===y[o];o++);var E=d-o;for(m=1;m<=E&&a[d-m]===y[w-m];m++);return nc=y.slice(o,1<m?1-m:void 0)}function rc(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function ic(){return!0}function Uv(){return!1}function Kn(o){function a(d,m,y,w,E){this._reactName=d,this._targetInst=y,this.type=m,this.nativeEvent=w,this.target=E,this.currentTarget=null;for(var O in o)o.hasOwnProperty(O)&&(d=o[O],this[O]=d?d(w):w[O]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?ic:Uv,this.isPropagationStopped=Uv,this}return P(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=ic)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=ic)},persist:function(){},isPersistent:ic}),a}var no={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ad=Kn(no),dl=P({},no,{view:0,detail:0}),bE=Kn(dl),cd,ud,fl,sc=P({},dl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dd,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==fl&&(fl&&o.type==="mousemove"?(cd=o.screenX-fl.screenX,ud=o.screenY-fl.screenY):ud=cd=0,fl=o),cd)},movementY:function(o){return"movementY"in o?o.movementY:ud}}),Vv=Kn(sc),kE=P({},sc,{dataTransfer:0}),CE=Kn(kE),EE=P({},dl,{relatedTarget:0}),hd=Kn(EE),NE=P({},no,{animationName:0,elapsedTime:0,pseudoElement:0}),RE=Kn(NE),TE=P({},no,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),PE=Kn(TE),DE=P({},no,{data:0}),qv=Kn(DE),AE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ME={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"},LE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OE(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=LE[o])?!!a[o]:!1}function dd(){return OE}var jE=P({},dl,{key:function(o){if(o.key){var a=AE[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=rc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?ME[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dd,charCode:function(o){return o.type==="keypress"?rc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?rc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),IE=Kn(jE),BE=P({},sc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kv=Kn(BE),zE=P({},dl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dd}),FE=Kn(zE),$E=P({},no,{propertyName:0,elapsedTime:0,pseudoElement:0}),HE=Kn($E),WE=P({},sc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),UE=Kn(WE),VE=[9,13,27,32],fd=c&&"CompositionEvent"in window,pl=null;c&&"documentMode"in document&&(pl=document.documentMode);var qE=c&&"TextEvent"in window&&!pl,Yv=c&&(!fd||pl&&8<pl&&11>=pl),Xv=" ",Zv=!1;function Gv(o,a){switch(o){case"keyup":return VE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ro=!1;function KE(o,a){switch(o){case"compositionend":return Jv(a);case"keypress":return a.which!==32?null:(Zv=!0,Xv);case"textInput":return o=a.data,o===Xv&&Zv?null:o;default:return null}}function YE(o,a){if(ro)return o==="compositionend"||!fd&&Gv(o,a)?(o=Wv(),nc=ld=Ui=null,ro=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Yv&&a.locale!=="ko"?null:a.data;default:return null}}var XE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Qv(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!XE[o.type]:a==="textarea"}function e_(o,a,d,m){pn(m),a=uc(a,"onChange"),0<a.length&&(d=new ad("onChange","change",null,d,m),o.push({event:d,listeners:a}))}var ml=null,gl=null;function ZE(o){__(o,0)}function oc(o){var a=ao(o);if(nt(a))return o}function GE(o,a){if(o==="change")return a}var t_=!1;if(c){var pd;if(c){var md="oninput"in document;if(!md){var n_=document.createElement("div");n_.setAttribute("oninput","return;"),md=typeof n_.oninput=="function"}pd=md}else pd=!1;t_=pd&&(!document.documentMode||9<document.documentMode)}function r_(){ml&&(ml.detachEvent("onpropertychange",i_),gl=ml=null)}function i_(o){if(o.propertyName==="value"&&oc(gl)){var a=[];e_(a,gl,o,nl(o)),ui(ZE,a)}}function JE(o,a,d){o==="focusin"?(r_(),ml=a,gl=d,ml.attachEvent("onpropertychange",i_)):o==="focusout"&&r_()}function QE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return oc(gl)}function e2(o,a){if(o==="click")return oc(a)}function t2(o,a){if(o==="input"||o==="change")return oc(a)}function n2(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var Rr=typeof Object.is=="function"?Object.is:n2;function vl(o,a){if(Rr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),m=Object.keys(a);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var y=d[m];if(!h.call(a,y)||!Rr(o[y],a[y]))return!1}return!0}function s_(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function o_(o,a){var d=s_(o);o=0;for(var m;d;){if(d.nodeType===3){if(m=o+d.textContent.length,o<=a&&m>=a)return{node:d,offset:a-o};o=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=s_(d)}}function l_(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?l_(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function a_(){for(var o=window,a=Ie();a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=Ie(o.document)}return a}function gd(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}function r2(o){var a=a_(),d=o.focusedElem,m=o.selectionRange;if(a!==d&&d&&d.ownerDocument&&l_(d.ownerDocument.documentElement,d)){if(m!==null&&gd(d)){if(a=m.start,o=m.end,o===void 0&&(o=a),"selectionStart"in d)d.selectionStart=a,d.selectionEnd=Math.min(o,d.value.length);else if(o=(a=d.ownerDocument||document)&&a.defaultView||window,o.getSelection){o=o.getSelection();var y=d.textContent.length,w=Math.min(m.start,y);m=m.end===void 0?w:Math.min(m.end,y),!o.extend&&w>m&&(y=m,m=w,w=y),y=o_(d,w);var E=o_(d,m);y&&E&&(o.rangeCount!==1||o.anchorNode!==y.node||o.anchorOffset!==y.offset||o.focusNode!==E.node||o.focusOffset!==E.offset)&&(a=a.createRange(),a.setStart(y.node,y.offset),o.removeAllRanges(),w>m?(o.addRange(a),o.extend(E.node,E.offset)):(a.setEnd(E.node,E.offset),o.addRange(a)))}}for(a=[],o=d;o=o.parentNode;)o.nodeType===1&&a.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<a.length;d++)o=a[d],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var i2=c&&"documentMode"in document&&11>=document.documentMode,io=null,vd=null,_l=null,_d=!1;function c_(o,a,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;_d||io==null||io!==Ie(m)||(m=io,"selectionStart"in m&&gd(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),_l&&vl(_l,m)||(_l=m,m=uc(vd,"onSelect"),0<m.length&&(a=new ad("onSelect","select",null,a,d),o.push({event:a,listeners:m}),a.target=io)))}function lc(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var so={animationend:lc("Animation","AnimationEnd"),animationiteration:lc("Animation","AnimationIteration"),animationstart:lc("Animation","AnimationStart"),transitionend:lc("Transition","TransitionEnd")},yd={},u_={};c&&(u_=document.createElement("div").style,"AnimationEvent"in window||(delete so.animationend.animation,delete so.animationiteration.animation,delete so.animationstart.animation),"TransitionEvent"in window||delete so.transitionend.transition);function ac(o){if(yd[o])return yd[o];if(!so[o])return o;var a=so[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in u_)return yd[o]=a[d];return o}var h_=ac("animationend"),d_=ac("animationiteration"),f_=ac("animationstart"),p_=ac("transitionend"),m_=new Map,g_="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 Vi(o,a){m_.set(o,a),s(a,[o])}for(var xd=0;xd<g_.length;xd++){var wd=g_[xd],s2=wd.toLowerCase(),o2=wd[0].toUpperCase()+wd.slice(1);Vi(s2,"on"+o2)}Vi(h_,"onAnimationEnd"),Vi(d_,"onAnimationIteration"),Vi(f_,"onAnimationStart"),Vi("dblclick","onDoubleClick"),Vi("focusin","onFocus"),Vi("focusout","onBlur"),Vi(p_,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yl="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(" "),l2=new Set("cancel close invalid load scroll toggle".split(" ").concat(yl));function v_(o,a,d){var m=o.type||"unknown-event";o.currentTarget=d,sE(m,a,void 0,o),o.currentTarget=null}function __(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var m=o[d],y=m.event;m=m.listeners;e:{var w=void 0;if(a)for(var E=m.length-1;0<=E;E--){var O=m[E],F=O.instance,ee=O.currentTarget;if(O=O.listener,F!==w&&y.isPropagationStopped())break e;v_(y,O,ee),w=F}else for(E=0;E<m.length;E++){if(O=m[E],F=O.instance,ee=O.currentTarget,O=O.listener,F!==w&&y.isPropagationStopped())break e;v_(y,O,ee),w=F}}}if(qn)throw o=hi,qn=!1,hi=null,o}function pt(o,a){var d=a[Td];d===void 0&&(d=a[Td]=new Set);var m=o+"__bubble";d.has(m)||(y_(a,o,2,!1),d.add(m))}function Sd(o,a,d){var m=0;a&&(m|=4),y_(d,o,m,a)}var cc="_reactListening"+Math.random().toString(36).slice(2);function xl(o){if(!o[cc]){o[cc]=!0,r.forEach(function(d){d!=="selectionchange"&&(l2.has(d)||Sd(d,!1,o),Sd(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[cc]||(a[cc]=!0,Sd("selectionchange",!1,a))}}function y_(o,a,d,m){switch(Hv(a)){case 1:var y=wE;break;case 4:y=SE;break;default:y=sd}d=y.bind(null,a,d,o),y=void 0,!ar||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),m?y!==void 0?o.addEventListener(a,d,{capture:!0,passive:y}):o.addEventListener(a,d,!0):y!==void 0?o.addEventListener(a,d,{passive:y}):o.addEventListener(a,d,!1)}function bd(o,a,d,m,y){var w=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var E=m.tag;if(E===3||E===4){var O=m.stateNode.containerInfo;if(O===y||O.nodeType===8&&O.parentNode===y)break;if(E===4)for(E=m.return;E!==null;){var F=E.tag;if((F===3||F===4)&&(F=E.stateNode.containerInfo,F===y||F.nodeType===8&&F.parentNode===y))return;E=E.return}for(;O!==null;){if(E=ks(O),E===null)return;if(F=E.tag,F===5||F===6){m=w=E;continue e}O=O.parentNode}}m=m.return}ui(function(){var ee=w,ae=nl(d),ce=[];e:{var le=m_.get(o);if(le!==void 0){var be=ad,Re=o;switch(o){case"keypress":if(rc(d)===0)break e;case"keydown":case"keyup":be=IE;break;case"focusin":Re="focus",be=hd;break;case"focusout":Re="blur",be=hd;break;case"beforeblur":case"afterblur":be=hd;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Vv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=CE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=FE;break;case h_:case d_:case f_:be=RE;break;case p_:be=HE;break;case"scroll":be=bE;break;case"wheel":be=UE;break;case"copy":case"cut":case"paste":be=PE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=Kv}var Te=(a&4)!==0,Dt=!Te&&o==="scroll",X=Te?le!==null?le+"Capture":null:le;Te=[];for(var K=ee,G;K!==null;){G=K;var pe=G.stateNode;if(G.tag===5&&pe!==null&&(G=pe,X!==null&&(pe=wt(K,X),pe!=null&&Te.push(wl(K,pe,G)))),Dt)break;K=K.return}0<Te.length&&(le=new be(le,Re,null,d,ae),ce.push({event:le,listeners:Te}))}}if((a&7)===0){e:{if(le=o==="mouseover"||o==="pointerover",be=o==="mouseout"||o==="pointerout",le&&d!==dn&&(Re=d.relatedTarget||d.fromElement)&&(ks(Re)||Re[di]))break e;if((be||le)&&(le=ae.window===ae?ae:(le=ae.ownerDocument)?le.defaultView||le.parentWindow:window,be?(Re=d.relatedTarget||d.toElement,be=ee,Re=Re?ks(Re):null,Re!==null&&(Dt=bs(Re),Re!==Dt||Re.tag!==5&&Re.tag!==6)&&(Re=null)):(be=null,Re=ee),be!==Re)){if(Te=Vv,pe="onMouseLeave",X="onMouseEnter",K="mouse",(o==="pointerout"||o==="pointerover")&&(Te=Kv,pe="onPointerLeave",X="onPointerEnter",K="pointer"),Dt=be==null?le:ao(be),G=Re==null?le:ao(Re),le=new Te(pe,K+"leave",be,d,ae),le.target=Dt,le.relatedTarget=G,pe=null,ks(ae)===ee&&(Te=new Te(X,K+"enter",Re,d,ae),Te.target=G,Te.relatedTarget=Dt,pe=Te),Dt=pe,be&&Re)t:{for(Te=be,X=Re,K=0,G=Te;G;G=oo(G))K++;for(G=0,pe=X;pe;pe=oo(pe))G++;for(;0<K-G;)Te=oo(Te),K--;for(;0<G-K;)X=oo(X),G--;for(;K--;){if(Te===X||X!==null&&Te===X.alternate)break t;Te=oo(Te),X=oo(X)}Te=null}else Te=null;be!==null&&x_(ce,le,be,Te,!1),Re!==null&&Dt!==null&&x_(ce,Dt,Re,Te,!0)}}e:{if(le=ee?ao(ee):window,be=le.nodeName&&le.nodeName.toLowerCase(),be==="select"||be==="input"&&le.type==="file")var Pe=GE;else if(Qv(le))if(t_)Pe=t2;else{Pe=QE;var Le=JE}else(be=le.nodeName)&&be.toLowerCase()==="input"&&(le.type==="checkbox"||le.type==="radio")&&(Pe=e2);if(Pe&&(Pe=Pe(o,ee))){e_(ce,Pe,d,ae);break e}Le&&Le(o,le,ee),o==="focusout"&&(Le=le._wrapperState)&&Le.controlled&&le.type==="number"&&un(le,"number",le.value)}switch(Le=ee?ao(ee):window,o){case"focusin":(Qv(Le)||Le.contentEditable==="true")&&(io=Le,vd=ee,_l=null);break;case"focusout":_l=vd=io=null;break;case"mousedown":_d=!0;break;case"contextmenu":case"mouseup":case"dragend":_d=!1,c_(ce,d,ae);break;case"selectionchange":if(i2)break;case"keydown":case"keyup":c_(ce,d,ae)}var Oe;if(fd)e:{switch(o){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else ro?Gv(o,d)&&(Be="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Be="onCompositionStart");Be&&(Yv&&d.locale!=="ko"&&(ro||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&ro&&(Oe=Wv()):(Ui=ae,ld="value"in Ui?Ui.value:Ui.textContent,ro=!0)),Le=uc(ee,Be),0<Le.length&&(Be=new qv(Be,o,null,d,ae),ce.push({event:Be,listeners:Le}),Oe?Be.data=Oe:(Oe=Jv(d),Oe!==null&&(Be.data=Oe)))),(Oe=qE?KE(o,d):YE(o,d))&&(ee=uc(ee,"onBeforeInput"),0<ee.length&&(ae=new qv("onBeforeInput","beforeinput",null,d,ae),ce.push({event:ae,listeners:ee}),ae.data=Oe))}__(ce,a)})}function wl(o,a,d){return{instance:o,listener:a,currentTarget:d}}function uc(o,a){for(var d=a+"Capture",m=[];o!==null;){var y=o,w=y.stateNode;y.tag===5&&w!==null&&(y=w,w=wt(o,d),w!=null&&m.unshift(wl(o,w,y)),w=wt(o,a),w!=null&&m.push(wl(o,w,y))),o=o.return}return m}function oo(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function x_(o,a,d,m,y){for(var w=a._reactName,E=[];d!==null&&d!==m;){var O=d,F=O.alternate,ee=O.stateNode;if(F!==null&&F===m)break;O.tag===5&&ee!==null&&(O=ee,y?(F=wt(d,w),F!=null&&E.unshift(wl(d,F,O))):y||(F=wt(d,w),F!=null&&E.push(wl(d,F,O)))),d=d.return}E.length!==0&&o.push({event:a,listeners:E})}var a2=/\r\n?/g,c2=/\u0000|\uFFFD/g;function w_(o){return(typeof o=="string"?o:""+o).replace(a2,`
38
+ `).replace(c2,"")}function hc(o,a,d){if(a=w_(a),w_(o)!==a&&d)throw Error(n(425))}function dc(){}var kd=null,Cd=null;function Ed(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Nd=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,S_=typeof Promise=="function"?Promise:void 0,h2=typeof queueMicrotask=="function"?queueMicrotask:typeof S_<"u"?function(o){return S_.resolve(null).then(o).catch(d2)}:Nd;function d2(o){setTimeout(function(){throw o})}function Rd(o,a){var d=a,m=0;do{var y=d.nextSibling;if(o.removeChild(d),y&&y.nodeType===8)if(d=y.data,d==="/$"){if(m===0){o.removeChild(y),hl(a);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=y}while(d);hl(a)}function qi(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return o}function b_(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"){if(a===0)return o;a--}else d==="/$"&&a++}o=o.previousSibling}return null}var lo=Math.random().toString(36).slice(2),Wr="__reactFiber$"+lo,Sl="__reactProps$"+lo,di="__reactContainer$"+lo,Td="__reactEvents$"+lo,f2="__reactListeners$"+lo,p2="__reactHandles$"+lo;function ks(o){var a=o[Wr];if(a)return a;for(var d=o.parentNode;d;){if(a=d[di]||d[Wr]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=b_(o);o!==null;){if(d=o[Wr])return d;o=b_(o)}return a}o=d,d=o.parentNode}return null}function bl(o){return o=o[Wr]||o[di],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function ao(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function fc(o){return o[Sl]||null}var Pd=[],co=-1;function Ki(o){return{current:o}}function mt(o){0>co||(o.current=Pd[co],Pd[co]=null,co--)}function ft(o,a){co++,Pd[co]=o.current,o.current=a}var Yi={},vn=Ki(Yi),On=Ki(!1),Cs=Yi;function uo(o,a){var d=o.type.contextTypes;if(!d)return Yi;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var y={},w;for(w in d)y[w]=a[w];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=y),y}function jn(o){return o=o.childContextTypes,o!=null}function pc(){mt(On),mt(vn)}function k_(o,a,d){if(vn.current!==Yi)throw Error(n(168));ft(vn,a),ft(On,d)}function C_(o,a,d){var m=o.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var y in m)if(!(y in a))throw Error(n(108,_e(o)||"Unknown",y));return P({},d,m)}function mc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Yi,Cs=vn.current,ft(vn,o),ft(On,On.current),!0}function E_(o,a,d){var m=o.stateNode;if(!m)throw Error(n(169));d?(o=C_(o,a,Cs),m.__reactInternalMemoizedMergedChildContext=o,mt(On),mt(vn),ft(vn,o)):mt(On),ft(On,d)}var fi=null,gc=!1,Dd=!1;function N_(o){fi===null?fi=[o]:fi.push(o)}function m2(o){gc=!0,N_(o)}function Xi(){if(!Dd&&fi!==null){Dd=!0;var o=0,a=st;try{var d=fi;for(st=1;o<d.length;o++){var m=d[o];do m=m(!0);while(m!==null)}fi=null,gc=!1}catch(y){throw fi!==null&&(fi=fi.slice(o+1)),Tv(Qh,Xi),y}finally{st=a,Dd=!1}}return null}var ho=[],fo=0,vc=null,_c=0,cr=[],ur=0,Es=null,pi=1,mi="";function Ns(o,a){ho[fo++]=_c,ho[fo++]=vc,vc=o,_c=a}function R_(o,a,d){cr[ur++]=pi,cr[ur++]=mi,cr[ur++]=Es,Es=o;var m=pi;o=mi;var y=32-Nr(m)-1;m&=~(1<<y),d+=1;var w=32-Nr(a)+y;if(30<w){var E=y-y%5;w=(m&(1<<E)-1).toString(32),m>>=E,y-=E,pi=1<<32-Nr(a)+y|d<<y|m,mi=w+o}else pi=1<<w|d<<y|m,mi=o}function Ad(o){o.return!==null&&(Ns(o,1),R_(o,1,0))}function Md(o){for(;o===vc;)vc=ho[--fo],ho[fo]=null,_c=ho[--fo],ho[fo]=null;for(;o===Es;)Es=cr[--ur],cr[ur]=null,mi=cr[--ur],cr[ur]=null,pi=cr[--ur],cr[ur]=null}var Yn=null,Xn=null,_t=!1,Tr=null;function T_(o,a){var d=pr(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=o,a=o.deletions,a===null?(o.deletions=[d],o.flags|=16):a.push(d)}function P_(o,a){switch(o.tag){case 5:var d=o.type;return a=a.nodeType!==1||d.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(o.stateNode=a,Yn=o,Xn=qi(a.firstChild),!0):!1;case 6:return a=o.pendingProps===""||a.nodeType!==3?null:a,a!==null?(o.stateNode=a,Yn=o,Xn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(d=Es!==null?{id:pi,overflow:mi}:null,o.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=pr(18,null,null,0),d.stateNode=a,d.return=o,o.child=d,Yn=o,Xn=null,!0):!1;default:return!1}}function Ld(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Od(o){if(_t){var a=Xn;if(a){var d=a;if(!P_(o,a)){if(Ld(o))throw Error(n(418));a=qi(d.nextSibling);var m=Yn;a&&P_(o,a)?T_(m,d):(o.flags=o.flags&-4097|2,_t=!1,Yn=o)}}else{if(Ld(o))throw Error(n(418));o.flags=o.flags&-4097|2,_t=!1,Yn=o}}}function D_(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;Yn=o}function yc(o){if(o!==Yn)return!1;if(!_t)return D_(o),_t=!0,!1;var a;if((a=o.tag!==3)&&!(a=o.tag!==5)&&(a=o.type,a=a!=="head"&&a!=="body"&&!Ed(o.type,o.memoizedProps)),a&&(a=Xn)){if(Ld(o))throw A_(),Error(n(418));for(;a;)T_(o,a),a=qi(a.nextSibling)}if(D_(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"){if(a===0){Xn=qi(o.nextSibling);break e}a--}else d!=="$"&&d!=="$!"&&d!=="$?"||a++}o=o.nextSibling}Xn=null}}else Xn=Yn?qi(o.stateNode.nextSibling):null;return!0}function A_(){for(var o=Xn;o;)o=qi(o.nextSibling)}function po(){Xn=Yn=null,_t=!1}function jd(o){Tr===null?Tr=[o]:Tr.push(o)}var g2=M.ReactCurrentBatchConfig;function kl(o,a,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,o));var y=m,w=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===w?a.ref:(a=function(E){var O=y.refs;E===null?delete O[w]:O[w]=E},a._stringRef=w,a)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function xc(o,a){throw o=Object.prototype.toString.call(a),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function M_(o){var a=o._init;return a(o._payload)}function L_(o){function a(X,K){if(o){var G=X.deletions;G===null?(X.deletions=[K],X.flags|=16):G.push(K)}}function d(X,K){if(!o)return null;for(;K!==null;)a(X,K),K=K.sibling;return null}function m(X,K){for(X=new Map;K!==null;)K.key!==null?X.set(K.key,K):X.set(K.index,K),K=K.sibling;return X}function y(X,K){return X=rs(X,K),X.index=0,X.sibling=null,X}function w(X,K,G){return X.index=G,o?(G=X.alternate,G!==null?(G=G.index,G<K?(X.flags|=2,K):G):(X.flags|=2,K)):(X.flags|=1048576,K)}function E(X){return o&&X.alternate===null&&(X.flags|=2),X}function O(X,K,G,pe){return K===null||K.tag!==6?(K=Rf(G,X.mode,pe),K.return=X,K):(K=y(K,G),K.return=X,K)}function F(X,K,G,pe){var Pe=G.type;return Pe===D?ae(X,K,G.props.children,pe,G.key):K!==null&&(K.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===z&&M_(Pe)===K.type)?(pe=y(K,G.props),pe.ref=kl(X,K,G),pe.return=X,pe):(pe=Uc(G.type,G.key,G.props,null,X.mode,pe),pe.ref=kl(X,K,G),pe.return=X,pe)}function ee(X,K,G,pe){return K===null||K.tag!==4||K.stateNode.containerInfo!==G.containerInfo||K.stateNode.implementation!==G.implementation?(K=Tf(G,X.mode,pe),K.return=X,K):(K=y(K,G.children||[]),K.return=X,K)}function ae(X,K,G,pe,Pe){return K===null||K.tag!==7?(K=Os(G,X.mode,pe,Pe),K.return=X,K):(K=y(K,G),K.return=X,K)}function ce(X,K,G){if(typeof K=="string"&&K!==""||typeof K=="number")return K=Rf(""+K,X.mode,G),K.return=X,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case B:return G=Uc(K.type,K.key,K.props,null,X.mode,G),G.ref=kl(X,null,K),G.return=X,G;case A:return K=Tf(K,X.mode,G),K.return=X,K;case z:var pe=K._init;return ce(X,pe(K._payload),G)}if(vt(K)||re(K))return K=Os(K,X.mode,G,null),K.return=X,K;xc(X,K)}return null}function le(X,K,G,pe){var Pe=K!==null?K.key:null;if(typeof G=="string"&&G!==""||typeof G=="number")return Pe!==null?null:O(X,K,""+G,pe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case B:return G.key===Pe?F(X,K,G,pe):null;case A:return G.key===Pe?ee(X,K,G,pe):null;case z:return Pe=G._init,le(X,K,Pe(G._payload),pe)}if(vt(G)||re(G))return Pe!==null?null:ae(X,K,G,pe,null);xc(X,G)}return null}function be(X,K,G,pe,Pe){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return X=X.get(G)||null,O(K,X,""+pe,Pe);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case B:return X=X.get(pe.key===null?G:pe.key)||null,F(K,X,pe,Pe);case A:return X=X.get(pe.key===null?G:pe.key)||null,ee(K,X,pe,Pe);case z:var Le=pe._init;return be(X,K,G,Le(pe._payload),Pe)}if(vt(pe)||re(pe))return X=X.get(G)||null,ae(K,X,pe,Pe,null);xc(K,pe)}return null}function Re(X,K,G,pe){for(var Pe=null,Le=null,Oe=K,Be=K=0,Zt=null;Oe!==null&&Be<G.length;Be++){Oe.index>Be?(Zt=Oe,Oe=null):Zt=Oe.sibling;var Qe=le(X,Oe,G[Be],pe);if(Qe===null){Oe===null&&(Oe=Zt);break}o&&Oe&&Qe.alternate===null&&a(X,Oe),K=w(Qe,K,Be),Le===null?Pe=Qe:Le.sibling=Qe,Le=Qe,Oe=Zt}if(Be===G.length)return d(X,Oe),_t&&Ns(X,Be),Pe;if(Oe===null){for(;Be<G.length;Be++)Oe=ce(X,G[Be],pe),Oe!==null&&(K=w(Oe,K,Be),Le===null?Pe=Oe:Le.sibling=Oe,Le=Oe);return _t&&Ns(X,Be),Pe}for(Oe=m(X,Oe);Be<G.length;Be++)Zt=be(Oe,X,Be,G[Be],pe),Zt!==null&&(o&&Zt.alternate!==null&&Oe.delete(Zt.key===null?Be:Zt.key),K=w(Zt,K,Be),Le===null?Pe=Zt:Le.sibling=Zt,Le=Zt);return o&&Oe.forEach(function(is){return a(X,is)}),_t&&Ns(X,Be),Pe}function Te(X,K,G,pe){var Pe=re(G);if(typeof Pe!="function")throw Error(n(150));if(G=Pe.call(G),G==null)throw Error(n(151));for(var Le=Pe=null,Oe=K,Be=K=0,Zt=null,Qe=G.next();Oe!==null&&!Qe.done;Be++,Qe=G.next()){Oe.index>Be?(Zt=Oe,Oe=null):Zt=Oe.sibling;var is=le(X,Oe,Qe.value,pe);if(is===null){Oe===null&&(Oe=Zt);break}o&&Oe&&is.alternate===null&&a(X,Oe),K=w(is,K,Be),Le===null?Pe=is:Le.sibling=is,Le=is,Oe=Zt}if(Qe.done)return d(X,Oe),_t&&Ns(X,Be),Pe;if(Oe===null){for(;!Qe.done;Be++,Qe=G.next())Qe=ce(X,Qe.value,pe),Qe!==null&&(K=w(Qe,K,Be),Le===null?Pe=Qe:Le.sibling=Qe,Le=Qe);return _t&&Ns(X,Be),Pe}for(Oe=m(X,Oe);!Qe.done;Be++,Qe=G.next())Qe=be(Oe,X,Be,Qe.value,pe),Qe!==null&&(o&&Qe.alternate!==null&&Oe.delete(Qe.key===null?Be:Qe.key),K=w(Qe,K,Be),Le===null?Pe=Qe:Le.sibling=Qe,Le=Qe);return o&&Oe.forEach(function(X2){return a(X,X2)}),_t&&Ns(X,Be),Pe}function Dt(X,K,G,pe){if(typeof G=="object"&&G!==null&&G.type===D&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case B:e:{for(var Pe=G.key,Le=K;Le!==null;){if(Le.key===Pe){if(Pe=G.type,Pe===D){if(Le.tag===7){d(X,Le.sibling),K=y(Le,G.props.children),K.return=X,X=K;break e}}else if(Le.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===z&&M_(Pe)===Le.type){d(X,Le.sibling),K=y(Le,G.props),K.ref=kl(X,Le,G),K.return=X,X=K;break e}d(X,Le);break}else a(X,Le);Le=Le.sibling}G.type===D?(K=Os(G.props.children,X.mode,pe,G.key),K.return=X,X=K):(pe=Uc(G.type,G.key,G.props,null,X.mode,pe),pe.ref=kl(X,K,G),pe.return=X,X=pe)}return E(X);case A:e:{for(Le=G.key;K!==null;){if(K.key===Le)if(K.tag===4&&K.stateNode.containerInfo===G.containerInfo&&K.stateNode.implementation===G.implementation){d(X,K.sibling),K=y(K,G.children||[]),K.return=X,X=K;break e}else{d(X,K);break}else a(X,K);K=K.sibling}K=Tf(G,X.mode,pe),K.return=X,X=K}return E(X);case z:return Le=G._init,Dt(X,K,Le(G._payload),pe)}if(vt(G))return Re(X,K,G,pe);if(re(G))return Te(X,K,G,pe);xc(X,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,K!==null&&K.tag===6?(d(X,K.sibling),K=y(K,G),K.return=X,X=K):(d(X,K),K=Rf(G,X.mode,pe),K.return=X,X=K),E(X)):d(X,K)}return Dt}var mo=L_(!0),O_=L_(!1),wc=Ki(null),Sc=null,go=null,Id=null;function Bd(){Id=go=Sc=null}function zd(o){var a=wc.current;mt(wc),o._currentValue=a}function Fd(o,a,d){for(;o!==null;){var m=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),o===d)break;o=o.return}}function vo(o,a){Sc=o,Id=go=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&a)!==0&&(In=!0),o.firstContext=null)}function hr(o){var a=o._currentValue;if(Id!==o)if(o={context:o,memoizedValue:a,next:null},go===null){if(Sc===null)throw Error(n(308));go=o,Sc.dependencies={lanes:0,firstContext:o}}else go=go.next=o;return a}var Rs=null;function $d(o){Rs===null?Rs=[o]:Rs.push(o)}function j_(o,a,d,m){var y=a.interleaved;return y===null?(d.next=d,$d(a)):(d.next=y.next,y.next=d),a.interleaved=d,gi(o,m)}function gi(o,a){o.lanes|=a;var d=o.alternate;for(d!==null&&(d.lanes|=a),d=o,o=o.return;o!==null;)o.childLanes|=a,d=o.alternate,d!==null&&(d.childLanes|=a),d=o,o=o.return;return d.tag===3?d.stateNode:null}var Zi=!1;function Hd(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I_(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function vi(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function Gi(o,a,d){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(Ge&2)!==0){var y=m.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),m.pending=a,gi(o,d)}return y=m.interleaved,y===null?(a.next=a,$d(m)):(a.next=y.next,y.next=a),m.interleaved=a,gi(o,d)}function bc(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,nd(o,d)}}function B_(o,a){var d=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var y=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var E={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};w===null?y=w=E:w=w.next=E,d=d.next}while(d!==null);w===null?y=w=a:w=w.next=a}else y=w=a;d={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:m.shared,effects:m.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}function kc(o,a,d,m){var y=o.updateQueue;Zi=!1;var w=y.firstBaseUpdate,E=y.lastBaseUpdate,O=y.shared.pending;if(O!==null){y.shared.pending=null;var F=O,ee=F.next;F.next=null,E===null?w=ee:E.next=ee,E=F;var ae=o.alternate;ae!==null&&(ae=ae.updateQueue,O=ae.lastBaseUpdate,O!==E&&(O===null?ae.firstBaseUpdate=ee:O.next=ee,ae.lastBaseUpdate=F))}if(w!==null){var ce=y.baseState;E=0,ae=ee=F=null,O=w;do{var le=O.lane,be=O.eventTime;if((m&le)===le){ae!==null&&(ae=ae.next={eventTime:be,lane:0,tag:O.tag,payload:O.payload,callback:O.callback,next:null});e:{var Re=o,Te=O;switch(le=a,be=d,Te.tag){case 1:if(Re=Te.payload,typeof Re=="function"){ce=Re.call(be,ce,le);break e}ce=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Te.payload,le=typeof Re=="function"?Re.call(be,ce,le):Re,le==null)break e;ce=P({},ce,le);break e;case 2:Zi=!0}}O.callback!==null&&O.lane!==0&&(o.flags|=64,le=y.effects,le===null?y.effects=[O]:le.push(O))}else be={eventTime:be,lane:le,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ae===null?(ee=ae=be,F=ce):ae=ae.next=be,E|=le;if(O=O.next,O===null){if(O=y.shared.pending,O===null)break;le=O,O=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);if(ae===null&&(F=ce),y.baseState=F,y.firstBaseUpdate=ee,y.lastBaseUpdate=ae,a=y.shared.interleaved,a!==null){y=a;do E|=y.lane,y=y.next;while(y!==a)}else w===null&&(y.shared.lanes=0);Ds|=E,o.lanes=E,o.memoizedState=ce}}function z_(o,a,d){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var m=o[a],y=m.callback;if(y!==null){if(m.callback=null,m=d,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var Cl={},Ur=Ki(Cl),El=Ki(Cl),Nl=Ki(Cl);function Ts(o){if(o===Cl)throw Error(n(174));return o}function Wd(o,a){switch(ft(Nl,a),ft(El,o),ft(Ur,Cl),o=a.nodeType,o){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:he(null,"");break;default:o=o===8?a.parentNode:a,a=o.namespaceURI||null,o=o.tagName,a=he(a,o)}mt(Ur),ft(Ur,a)}function _o(){mt(Ur),mt(El),mt(Nl)}function F_(o){Ts(Nl.current);var a=Ts(Ur.current),d=he(a,o.type);a!==d&&(ft(El,o),ft(Ur,d))}function Ud(o){El.current===o&&(mt(Ur),mt(El))}var St=Ki(0);function Cc(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Vd=[];function qd(){for(var o=0;o<Vd.length;o++)Vd[o]._workInProgressVersionPrimary=null;Vd.length=0}var Ec=M.ReactCurrentDispatcher,Kd=M.ReactCurrentBatchConfig,Ps=0,bt=null,$t=null,Yt=null,Nc=!1,Rl=!1,Tl=0,v2=0;function _n(){throw Error(n(321))}function Yd(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!Rr(o[d],a[d]))return!1;return!0}function Xd(o,a,d,m,y,w){if(Ps=w,bt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Ec.current=o===null||o.memoizedState===null?w2:S2,o=d(m,y),Rl){w=0;do{if(Rl=!1,Tl=0,25<=w)throw Error(n(301));w+=1,Yt=$t=null,a.updateQueue=null,Ec.current=b2,o=d(m,y)}while(Rl)}if(Ec.current=Pc,a=$t!==null&&$t.next!==null,Ps=0,Yt=$t=bt=null,Nc=!1,a)throw Error(n(300));return o}function Zd(){var o=Tl!==0;return Tl=0,o}function Vr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?bt.memoizedState=Yt=o:Yt=Yt.next=o,Yt}function dr(){if($t===null){var o=bt.alternate;o=o!==null?o.memoizedState:null}else o=$t.next;var a=Yt===null?bt.memoizedState:Yt.next;if(a!==null)Yt=a,$t=o;else{if(o===null)throw Error(n(310));$t=o,o={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Yt===null?bt.memoizedState=Yt=o:Yt=Yt.next=o}return Yt}function Pl(o,a){return typeof a=="function"?a(o):a}function Gd(o){var a=dr(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var m=$t,y=m.baseQueue,w=d.pending;if(w!==null){if(y!==null){var E=y.next;y.next=w.next,w.next=E}m.baseQueue=y=w,d.pending=null}if(y!==null){w=y.next,m=m.baseState;var O=E=null,F=null,ee=w;do{var ae=ee.lane;if((Ps&ae)===ae)F!==null&&(F=F.next={lane:0,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),m=ee.hasEagerState?ee.eagerState:o(m,ee.action);else{var ce={lane:ae,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null};F===null?(O=F=ce,E=m):F=F.next=ce,bt.lanes|=ae,Ds|=ae}ee=ee.next}while(ee!==null&&ee!==w);F===null?E=m:F.next=O,Rr(m,a.memoizedState)||(In=!0),a.memoizedState=m,a.baseState=E,a.baseQueue=F,d.lastRenderedState=m}if(o=d.interleaved,o!==null){y=o;do w=y.lane,bt.lanes|=w,Ds|=w,y=y.next;while(y!==o)}else y===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function Jd(o){var a=dr(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var m=d.dispatch,y=d.pending,w=a.memoizedState;if(y!==null){d.pending=null;var E=y=y.next;do w=o(w,E.action),E=E.next;while(E!==y);Rr(w,a.memoizedState)||(In=!0),a.memoizedState=w,a.baseQueue===null&&(a.baseState=w),d.lastRenderedState=w}return[w,m]}function $_(){}function H_(o,a){var d=bt,m=dr(),y=a(),w=!Rr(m.memoizedState,y);if(w&&(m.memoizedState=y,In=!0),m=m.queue,Qd(V_.bind(null,d,m,o),[o]),m.getSnapshot!==a||w||Yt!==null&&Yt.memoizedState.tag&1){if(d.flags|=2048,Dl(9,U_.bind(null,d,m,y,a),void 0,null),Xt===null)throw Error(n(349));(Ps&30)!==0||W_(d,a,y)}return y}function W_(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=bt.updateQueue,a===null?(a={lastEffect:null,stores:null},bt.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function U_(o,a,d,m){a.value=d,a.getSnapshot=m,q_(a)&&K_(o)}function V_(o,a,d){return d(function(){q_(a)&&K_(o)})}function q_(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!Rr(o,d)}catch{return!0}}function K_(o){var a=gi(o,1);a!==null&&Mr(a,o,1,-1)}function Y_(o){var a=Vr();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pl,lastRenderedState:o},a.queue=o,o=o.dispatch=x2.bind(null,bt,o),[a.memoizedState,o]}function Dl(o,a,d,m){return o={tag:o,create:a,destroy:d,deps:m,next:null},a=bt.updateQueue,a===null?(a={lastEffect:null,stores:null},bt.updateQueue=a,a.lastEffect=o.next=o):(d=a.lastEffect,d===null?a.lastEffect=o.next=o:(m=d.next,d.next=o,o.next=m,a.lastEffect=o)),o}function X_(){return dr().memoizedState}function Rc(o,a,d,m){var y=Vr();bt.flags|=o,y.memoizedState=Dl(1|a,d,void 0,m===void 0?null:m)}function Tc(o,a,d,m){var y=dr();m=m===void 0?null:m;var w=void 0;if($t!==null){var E=$t.memoizedState;if(w=E.destroy,m!==null&&Yd(m,E.deps)){y.memoizedState=Dl(a,d,w,m);return}}bt.flags|=o,y.memoizedState=Dl(1|a,d,w,m)}function Z_(o,a){return Rc(8390656,8,o,a)}function Qd(o,a){return Tc(2048,8,o,a)}function G_(o,a){return Tc(4,2,o,a)}function J_(o,a){return Tc(4,4,o,a)}function Q_(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function e0(o,a,d){return d=d!=null?d.concat([o]):null,Tc(4,4,Q_.bind(null,a,o),d)}function ef(){}function t0(o,a){var d=dr();a=a===void 0?null:a;var m=d.memoizedState;return m!==null&&a!==null&&Yd(a,m[1])?m[0]:(d.memoizedState=[o,a],o)}function n0(o,a){var d=dr();a=a===void 0?null:a;var m=d.memoizedState;return m!==null&&a!==null&&Yd(a,m[1])?m[0]:(o=o(),d.memoizedState=[o,a],o)}function r0(o,a,d){return(Ps&21)===0?(o.baseState&&(o.baseState=!1,In=!0),o.memoizedState=d):(Rr(d,a)||(d=Mv(),bt.lanes|=d,Ds|=d,o.baseState=!0),a)}function _2(o,a){var d=st;st=d!==0&&4>d?d:4,o(!0);var m=Kd.transition;Kd.transition={};try{o(!1),a()}finally{st=d,Kd.transition=m}}function i0(){return dr().memoizedState}function y2(o,a,d){var m=ts(o);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},s0(o))o0(a,d);else if(d=j_(o,a,d,m),d!==null){var y=Nn();Mr(d,o,m,y),l0(d,a,m)}}function x2(o,a,d){var m=ts(o),y={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(s0(o))o0(a,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=a.lastRenderedReducer,w!==null))try{var E=a.lastRenderedState,O=w(E,d);if(y.hasEagerState=!0,y.eagerState=O,Rr(O,E)){var F=a.interleaved;F===null?(y.next=y,$d(a)):(y.next=F.next,F.next=y),a.interleaved=y;return}}catch{}finally{}d=j_(o,a,y,m),d!==null&&(y=Nn(),Mr(d,o,m,y),l0(d,a,m))}}function s0(o){var a=o.alternate;return o===bt||a!==null&&a===bt}function o0(o,a){Rl=Nc=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function l0(o,a,d){if((d&4194240)!==0){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,nd(o,d)}}var Pc={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},w2={readContext:hr,useCallback:function(o,a){return Vr().memoizedState=[o,a===void 0?null:a],o},useContext:hr,useEffect:Z_,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,Rc(4194308,4,Q_.bind(null,a,o),d)},useLayoutEffect:function(o,a){return Rc(4194308,4,o,a)},useInsertionEffect:function(o,a){return Rc(4,2,o,a)},useMemo:function(o,a){var d=Vr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var m=Vr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},m.queue=o,o=o.dispatch=y2.bind(null,bt,o),[m.memoizedState,o]},useRef:function(o){var a=Vr();return o={current:o},a.memoizedState=o},useState:Y_,useDebugValue:ef,useDeferredValue:function(o){return Vr().memoizedState=o},useTransition:function(){var o=Y_(!1),a=o[0];return o=_2.bind(null,o[1]),Vr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var m=bt,y=Vr();if(_t){if(d===void 0)throw Error(n(407));d=d()}else{if(d=a(),Xt===null)throw Error(n(349));(Ps&30)!==0||W_(m,a,d)}y.memoizedState=d;var w={value:d,getSnapshot:a};return y.queue=w,Z_(V_.bind(null,m,w,o),[o]),m.flags|=2048,Dl(9,U_.bind(null,m,w,d,a),void 0,null),d},useId:function(){var o=Vr(),a=Xt.identifierPrefix;if(_t){var d=mi,m=pi;d=(m&~(1<<32-Nr(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Tl++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=v2++,a=":"+a+"r"+d.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},S2={readContext:hr,useCallback:t0,useContext:hr,useEffect:Qd,useImperativeHandle:e0,useInsertionEffect:G_,useLayoutEffect:J_,useMemo:n0,useReducer:Gd,useRef:X_,useState:function(){return Gd(Pl)},useDebugValue:ef,useDeferredValue:function(o){var a=dr();return r0(a,$t.memoizedState,o)},useTransition:function(){var o=Gd(Pl)[0],a=dr().memoizedState;return[o,a]},useMutableSource:$_,useSyncExternalStore:H_,useId:i0,unstable_isNewReconciler:!1},b2={readContext:hr,useCallback:t0,useContext:hr,useEffect:Qd,useImperativeHandle:e0,useInsertionEffect:G_,useLayoutEffect:J_,useMemo:n0,useReducer:Jd,useRef:X_,useState:function(){return Jd(Pl)},useDebugValue:ef,useDeferredValue:function(o){var a=dr();return $t===null?a.memoizedState=o:r0(a,$t.memoizedState,o)},useTransition:function(){var o=Jd(Pl)[0],a=dr().memoizedState;return[o,a]},useMutableSource:$_,useSyncExternalStore:H_,useId:i0,unstable_isNewReconciler:!1};function Pr(o,a){if(o&&o.defaultProps){a=P({},a),o=o.defaultProps;for(var d in o)a[d]===void 0&&(a[d]=o[d]);return a}return a}function tf(o,a,d,m){a=o.memoizedState,d=d(m,a),d=d==null?a:P({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Dc={isMounted:function(o){return(o=o._reactInternals)?bs(o)===o:!1},enqueueSetState:function(o,a,d){o=o._reactInternals;var m=Nn(),y=ts(o),w=vi(m,y);w.payload=a,d!=null&&(w.callback=d),a=Gi(o,w,y),a!==null&&(Mr(a,o,y,m),bc(a,o,y))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var m=Nn(),y=ts(o),w=vi(m,y);w.tag=1,w.payload=a,d!=null&&(w.callback=d),a=Gi(o,w,y),a!==null&&(Mr(a,o,y,m),bc(a,o,y))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=Nn(),m=ts(o),y=vi(d,m);y.tag=2,a!=null&&(y.callback=a),a=Gi(o,y,m),a!==null&&(Mr(a,o,m,d),bc(a,o,m))}};function a0(o,a,d,m,y,w,E){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(m,w,E):a.prototype&&a.prototype.isPureReactComponent?!vl(d,m)||!vl(y,w):!0}function c0(o,a,d){var m=!1,y=Yi,w=a.contextType;return typeof w=="object"&&w!==null?w=hr(w):(y=jn(a)?Cs:vn.current,m=a.contextTypes,w=(m=m!=null)?uo(o,y):Yi),a=new a(d,w),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Dc,o.stateNode=a,a._reactInternals=o,m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=y,o.__reactInternalMemoizedMaskedChildContext=w),a}function u0(o,a,d,m){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,m),a.state!==o&&Dc.enqueueReplaceState(a,a.state,null)}function nf(o,a,d,m){var y=o.stateNode;y.props=d,y.state=o.memoizedState,y.refs={},Hd(o);var w=a.contextType;typeof w=="object"&&w!==null?y.context=hr(w):(w=jn(a)?Cs:vn.current,y.context=uo(o,w)),y.state=o.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(tf(o,a,w,d),y.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(a=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),a!==y.state&&Dc.enqueueReplaceState(y,y.state,null),kc(o,d,y,m),y.state=o.memoizedState),typeof y.componentDidMount=="function"&&(o.flags|=4194308)}function yo(o,a){try{var d="",m=a;do d+=oe(m),m=m.return;while(m);var y=d}catch(w){y=`
39
+ Error generating stack: `+w.message+`
40
+ `+w.stack}return{value:o,source:a,stack:y,digest:null}}function rf(o,a,d){return{value:o,source:null,stack:d??null,digest:a??null}}function sf(o,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var k2=typeof WeakMap=="function"?WeakMap:Map;function h0(o,a,d){d=vi(-1,d),d.tag=3,d.payload={element:null};var m=a.value;return d.callback=function(){Bc||(Bc=!0,xf=m),sf(o,a)},d}function d0(o,a,d){d=vi(-1,d),d.tag=3;var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var y=a.value;d.payload=function(){return m(y)},d.callback=function(){sf(o,a)}}var w=o.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(d.callback=function(){sf(o,a),typeof m!="function"&&(Qi===null?Qi=new Set([this]):Qi.add(this));var E=a.stack;this.componentDidCatch(a.value,{componentStack:E!==null?E:""})}),d}function f0(o,a,d){var m=o.pingCache;if(m===null){m=o.pingCache=new k2;var y=new Set;m.set(a,y)}else y=m.get(a),y===void 0&&(y=new Set,m.set(a,y));y.has(d)||(y.add(d),o=B2.bind(null,o,a,d),a.then(o,o))}function p0(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function m0(o,a,d,m,y){return(o.mode&1)===0?(o===a?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=vi(-1,1),a.tag=2,Gi(d,a,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=y,o)}var C2=M.ReactCurrentOwner,In=!1;function En(o,a,d,m){a.child=o===null?O_(a,null,d,m):mo(a,o.child,d,m)}function g0(o,a,d,m,y){d=d.render;var w=a.ref;return vo(a,y),m=Xd(o,a,d,m,w,y),d=Zd(),o!==null&&!In?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~y,_i(o,a,y)):(_t&&d&&Ad(a),a.flags|=1,En(o,a,m,y),a.child)}function v0(o,a,d,m,y){if(o===null){var w=d.type;return typeof w=="function"&&!Nf(w)&&w.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=w,_0(o,a,w,m,y)):(o=Uc(d.type,null,m,a,a.mode,y),o.ref=a.ref,o.return=a,a.child=o)}if(w=o.child,(o.lanes&y)===0){var E=w.memoizedProps;if(d=d.compare,d=d!==null?d:vl,d(E,m)&&o.ref===a.ref)return _i(o,a,y)}return a.flags|=1,o=rs(w,m),o.ref=a.ref,o.return=a,a.child=o}function _0(o,a,d,m,y){if(o!==null){var w=o.memoizedProps;if(vl(w,m)&&o.ref===a.ref)if(In=!1,a.pendingProps=m=w,(o.lanes&y)!==0)(o.flags&131072)!==0&&(In=!0);else return a.lanes=o.lanes,_i(o,a,y)}return of(o,a,d,m,y)}function y0(o,a,d){var m=a.pendingProps,y=m.children,w=o!==null?o.memoizedState:null;if(m.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},ft(wo,Zn),Zn|=d;else{if((d&1073741824)===0)return o=w!==null?w.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,ft(wo,Zn),Zn|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=w!==null?w.baseLanes:d,ft(wo,Zn),Zn|=m}else w!==null?(m=w.baseLanes|d,a.memoizedState=null):m=d,ft(wo,Zn),Zn|=m;return En(o,a,y,d),a.child}function x0(o,a){var d=a.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function of(o,a,d,m,y){var w=jn(d)?Cs:vn.current;return w=uo(a,w),vo(a,y),d=Xd(o,a,d,m,w,y),m=Zd(),o!==null&&!In?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~y,_i(o,a,y)):(_t&&m&&Ad(a),a.flags|=1,En(o,a,d,y),a.child)}function w0(o,a,d,m,y){if(jn(d)){var w=!0;mc(a)}else w=!1;if(vo(a,y),a.stateNode===null)Mc(o,a),c0(a,d,m),nf(a,d,m,y),m=!0;else if(o===null){var E=a.stateNode,O=a.memoizedProps;E.props=O;var F=E.context,ee=d.contextType;typeof ee=="object"&&ee!==null?ee=hr(ee):(ee=jn(d)?Cs:vn.current,ee=uo(a,ee));var ae=d.getDerivedStateFromProps,ce=typeof ae=="function"||typeof E.getSnapshotBeforeUpdate=="function";ce||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==m||F!==ee)&&u0(a,E,m,ee),Zi=!1;var le=a.memoizedState;E.state=le,kc(a,m,E,y),F=a.memoizedState,O!==m||le!==F||On.current||Zi?(typeof ae=="function"&&(tf(a,d,ae,m),F=a.memoizedState),(O=Zi||a0(a,d,O,m,le,F,ee))?(ce||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(a.flags|=4194308)):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=F),E.props=m,E.state=F,E.context=ee,m=O):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{E=a.stateNode,I_(o,a),O=a.memoizedProps,ee=a.type===a.elementType?O:Pr(a.type,O),E.props=ee,ce=a.pendingProps,le=E.context,F=d.contextType,typeof F=="object"&&F!==null?F=hr(F):(F=jn(d)?Cs:vn.current,F=uo(a,F));var be=d.getDerivedStateFromProps;(ae=typeof be=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==ce||le!==F)&&u0(a,E,m,F),Zi=!1,le=a.memoizedState,E.state=le,kc(a,m,E,y);var Re=a.memoizedState;O!==ce||le!==Re||On.current||Zi?(typeof be=="function"&&(tf(a,d,be,m),Re=a.memoizedState),(ee=Zi||a0(a,d,ee,m,le,Re,F)||!1)?(ae||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(m,Re,F),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(m,Re,F)),typeof E.componentDidUpdate=="function"&&(a.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof E.componentDidUpdate!="function"||O===o.memoizedProps&&le===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&le===o.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=Re),E.props=m,E.state=Re,E.context=F,m=ee):(typeof E.componentDidUpdate!="function"||O===o.memoizedProps&&le===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&le===o.memoizedState||(a.flags|=1024),m=!1)}return lf(o,a,d,m,w,y)}function lf(o,a,d,m,y,w){x0(o,a);var E=(a.flags&128)!==0;if(!m&&!E)return y&&E_(a,d,!1),_i(o,a,w);m=a.stateNode,C2.current=a;var O=E&&typeof d.getDerivedStateFromError!="function"?null:m.render();return a.flags|=1,o!==null&&E?(a.child=mo(a,o.child,null,w),a.child=mo(a,null,O,w)):En(o,a,O,w),a.memoizedState=m.state,y&&E_(a,d,!0),a.child}function S0(o){var a=o.stateNode;a.pendingContext?k_(o,a.pendingContext,a.pendingContext!==a.context):a.context&&k_(o,a.context,!1),Wd(o,a.containerInfo)}function b0(o,a,d,m,y){return po(),jd(y),a.flags|=256,En(o,a,d,m),a.child}var af={dehydrated:null,treeContext:null,retryLane:0};function cf(o){return{baseLanes:o,cachePool:null,transitions:null}}function k0(o,a,d){var m=a.pendingProps,y=St.current,w=!1,E=(a.flags&128)!==0,O;if((O=E)||(O=o!==null&&o.memoizedState===null?!1:(y&2)!==0),O?(w=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(y|=1),ft(St,y&1),o===null)return Od(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((a.mode&1)===0?a.lanes=1:o.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(E=m.children,o=m.fallback,w?(m=a.mode,w=a.child,E={mode:"hidden",children:E},(m&1)===0&&w!==null?(w.childLanes=0,w.pendingProps=E):w=Vc(E,m,0,null),o=Os(o,m,d,null),w.return=a,o.return=a,w.sibling=o,a.child=w,a.child.memoizedState=cf(d),a.memoizedState=af,o):uf(a,E));if(y=o.memoizedState,y!==null&&(O=y.dehydrated,O!==null))return E2(o,a,E,m,O,y,d);if(w){w=m.fallback,E=a.mode,y=o.child,O=y.sibling;var F={mode:"hidden",children:m.children};return(E&1)===0&&a.child!==y?(m=a.child,m.childLanes=0,m.pendingProps=F,a.deletions=null):(m=rs(y,F),m.subtreeFlags=y.subtreeFlags&14680064),O!==null?w=rs(O,w):(w=Os(w,E,d,null),w.flags|=2),w.return=a,m.return=a,m.sibling=w,a.child=m,m=w,w=a.child,E=o.child.memoizedState,E=E===null?cf(d):{baseLanes:E.baseLanes|d,cachePool:null,transitions:E.transitions},w.memoizedState=E,w.childLanes=o.childLanes&~d,a.memoizedState=af,m}return w=o.child,o=w.sibling,m=rs(w,{mode:"visible",children:m.children}),(a.mode&1)===0&&(m.lanes=d),m.return=a,m.sibling=null,o!==null&&(d=a.deletions,d===null?(a.deletions=[o],a.flags|=16):d.push(o)),a.child=m,a.memoizedState=null,m}function uf(o,a){return a=Vc({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function Ac(o,a,d,m){return m!==null&&jd(m),mo(a,o.child,null,d),o=uf(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function E2(o,a,d,m,y,w,E){if(d)return a.flags&256?(a.flags&=-257,m=rf(Error(n(422))),Ac(o,a,E,m)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(w=m.fallback,y=a.mode,m=Vc({mode:"visible",children:m.children},y,0,null),w=Os(w,y,E,null),w.flags|=2,m.return=a,w.return=a,m.sibling=w,a.child=m,(a.mode&1)!==0&&mo(a,o.child,null,E),a.child.memoizedState=cf(E),a.memoizedState=af,w);if((a.mode&1)===0)return Ac(o,a,E,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var O=m.dgst;return m=O,w=Error(n(419)),m=rf(w,m,void 0),Ac(o,a,E,m)}if(O=(E&o.childLanes)!==0,In||O){if(m=Xt,m!==null){switch(E&-E){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|E))!==0?0:y,y!==0&&y!==w.retryLane&&(w.retryLane=y,gi(o,y),Mr(m,o,y,-1))}return Ef(),m=rf(Error(n(421))),Ac(o,a,E,m)}return y.data==="$?"?(a.flags|=128,a.child=o.child,a=z2.bind(null,o),y._reactRetry=a,null):(o=w.treeContext,Xn=qi(y.nextSibling),Yn=a,_t=!0,Tr=null,o!==null&&(cr[ur++]=pi,cr[ur++]=mi,cr[ur++]=Es,pi=o.id,mi=o.overflow,Es=a),a=uf(a,m.children),a.flags|=4096,a)}function C0(o,a,d){o.lanes|=a;var m=o.alternate;m!==null&&(m.lanes|=a),Fd(o.return,a,d)}function hf(o,a,d,m,y){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:y}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=m,w.tail=d,w.tailMode=y)}function E0(o,a,d){var m=a.pendingProps,y=m.revealOrder,w=m.tail;if(En(o,a,m.children,d),m=St.current,(m&2)!==0)m=m&1|2,a.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&C0(o,d,a);else if(o.tag===19)C0(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}m&=1}if(ft(St,m),(a.mode&1)===0)a.memoizedState=null;else switch(y){case"forwards":for(d=a.child,y=null;d!==null;)o=d.alternate,o!==null&&Cc(o)===null&&(y=d),d=d.sibling;d=y,d===null?(y=a.child,a.child=null):(y=d.sibling,d.sibling=null),hf(a,!1,y,d,w);break;case"backwards":for(d=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Cc(o)===null){a.child=y;break}o=y.sibling,y.sibling=d,d=y,y=o}hf(a,!0,d,null,w);break;case"together":hf(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Mc(o,a){(a.mode&1)===0&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function _i(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),Ds|=a.lanes,(d&a.childLanes)===0)return null;if(o!==null&&a.child!==o.child)throw Error(n(153));if(a.child!==null){for(o=a.child,d=rs(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=rs(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function N2(o,a,d){switch(a.tag){case 3:S0(a),po();break;case 5:F_(a);break;case 1:jn(a.type)&&mc(a);break;case 4:Wd(a,a.stateNode.containerInfo);break;case 10:var m=a.type._context,y=a.memoizedProps.value;ft(wc,m._currentValue),m._currentValue=y;break;case 13:if(m=a.memoizedState,m!==null)return m.dehydrated!==null?(ft(St,St.current&1),a.flags|=128,null):(d&a.child.childLanes)!==0?k0(o,a,d):(ft(St,St.current&1),o=_i(o,a,d),o!==null?o.sibling:null);ft(St,St.current&1);break;case 19:if(m=(d&a.childLanes)!==0,(o.flags&128)!==0){if(m)return E0(o,a,d);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ft(St,St.current),m)break;return null;case 22:case 23:return a.lanes=0,y0(o,a,d)}return _i(o,a,d)}var N0,df,R0,T0;N0=function(o,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)o.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},df=function(){},R0=function(o,a,d,m){var y=o.memoizedProps;if(y!==m){o=a.stateNode,Ts(Ur.current);var w=null;switch(d){case"input":y=rt(o,y),m=rt(o,m),w=[];break;case"select":y=P({},y,{value:void 0}),m=P({},m,{value:void 0}),w=[];break;case"textarea":y=or(o,y),m=or(o,m),w=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(o.onclick=dc)}Ot(d,m);var E;d=null;for(ee in y)if(!m.hasOwnProperty(ee)&&y.hasOwnProperty(ee)&&y[ee]!=null)if(ee==="style"){var O=y[ee];for(E in O)O.hasOwnProperty(E)&&(d||(d={}),d[E]="")}else ee!=="dangerouslySetInnerHTML"&&ee!=="children"&&ee!=="suppressContentEditableWarning"&&ee!=="suppressHydrationWarning"&&ee!=="autoFocus"&&(i.hasOwnProperty(ee)?w||(w=[]):(w=w||[]).push(ee,null));for(ee in m){var F=m[ee];if(O=y!=null?y[ee]:void 0,m.hasOwnProperty(ee)&&F!==O&&(F!=null||O!=null))if(ee==="style")if(O){for(E in O)!O.hasOwnProperty(E)||F&&F.hasOwnProperty(E)||(d||(d={}),d[E]="");for(E in F)F.hasOwnProperty(E)&&O[E]!==F[E]&&(d||(d={}),d[E]=F[E])}else d||(w||(w=[]),w.push(ee,d)),d=F;else ee==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,O=O?O.__html:void 0,F!=null&&O!==F&&(w=w||[]).push(ee,F)):ee==="children"?typeof F!="string"&&typeof F!="number"||(w=w||[]).push(ee,""+F):ee!=="suppressContentEditableWarning"&&ee!=="suppressHydrationWarning"&&(i.hasOwnProperty(ee)?(F!=null&&ee==="onScroll"&&pt("scroll",o),w||O===F||(w=[])):(w=w||[]).push(ee,F))}d&&(w=w||[]).push("style",d);var ee=w;(a.updateQueue=ee)&&(a.flags|=4)}},T0=function(o,a,d,m){d!==m&&(a.flags|=4)};function Al(o,a){if(!_t)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:m.sibling=null}}function yn(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,m=0;if(a)for(var y=o.child;y!==null;)d|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)d|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=m,o.childLanes=d,a}function R2(o,a,d){var m=a.pendingProps;switch(Md(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yn(a),null;case 1:return jn(a.type)&&pc(),yn(a),null;case 3:return m=a.stateNode,_o(),mt(On),mt(vn),qd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(yc(a)?a.flags|=4:o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Tr!==null&&(bf(Tr),Tr=null))),df(o,a),yn(a),null;case 5:Ud(a);var y=Ts(Nl.current);if(d=a.type,o!==null&&a.stateNode!=null)R0(o,a,d,m,y),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!m){if(a.stateNode===null)throw Error(n(166));return yn(a),null}if(o=Ts(Ur.current),yc(a)){m=a.stateNode,d=a.type;var w=a.memoizedProps;switch(m[Wr]=a,m[Sl]=w,o=(a.mode&1)!==0,d){case"dialog":pt("cancel",m),pt("close",m);break;case"iframe":case"object":case"embed":pt("load",m);break;case"video":case"audio":for(y=0;y<yl.length;y++)pt(yl[y],m);break;case"source":pt("error",m);break;case"img":case"image":case"link":pt("error",m),pt("load",m);break;case"details":pt("toggle",m);break;case"input":Lt(m,w),pt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!w.multiple},pt("invalid",m);break;case"textarea":Sr(m,w),pt("invalid",m)}Ot(d,w),y=null;for(var E in w)if(w.hasOwnProperty(E)){var O=w[E];E==="children"?typeof O=="string"?m.textContent!==O&&(w.suppressHydrationWarning!==!0&&hc(m.textContent,O,o),y=["children",O]):typeof O=="number"&&m.textContent!==""+O&&(w.suppressHydrationWarning!==!0&&hc(m.textContent,O,o),y=["children",""+O]):i.hasOwnProperty(E)&&O!=null&&E==="onScroll"&&pt("scroll",m)}switch(d){case"input":at(m),kn(m,w,!0);break;case"textarea":at(m),Bi(m);break;case"select":case"option":break;default:typeof w.onClick=="function"&&(m.onclick=dc)}m=y,a.updateQueue=m,m!==null&&(a.flags|=4)}else{E=y.nodeType===9?y:y.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=ne(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=E.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof m.is=="string"?o=E.createElement(d,{is:m.is}):(o=E.createElement(d),d==="select"&&(E=o,m.multiple?E.multiple=!0:m.size&&(E.size=m.size))):o=E.createElementNS(o,d),o[Wr]=a,o[Sl]=m,N0(o,a,!1,!1),a.stateNode=o;e:{switch(E=lr(d,m),d){case"dialog":pt("cancel",o),pt("close",o),y=m;break;case"iframe":case"object":case"embed":pt("load",o),y=m;break;case"video":case"audio":for(y=0;y<yl.length;y++)pt(yl[y],o);y=m;break;case"source":pt("error",o),y=m;break;case"img":case"image":case"link":pt("error",o),pt("load",o),y=m;break;case"details":pt("toggle",o),y=m;break;case"input":Lt(o,m),y=rt(o,m),pt("invalid",o);break;case"option":y=m;break;case"select":o._wrapperState={wasMultiple:!!m.multiple},y=P({},m,{value:void 0}),pt("invalid",o);break;case"textarea":Sr(o,m),y=or(o,m),pt("invalid",o);break;default:y=m}Ot(d,y),O=y;for(w in O)if(O.hasOwnProperty(w)){var F=O[w];w==="style"?rn(o,F):w==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,F!=null&&se(o,F)):w==="children"?typeof F=="string"?(d!=="textarea"||F!=="")&&ve(o,F):typeof F=="number"&&ve(o,""+F):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(i.hasOwnProperty(w)?F!=null&&w==="onScroll"&&pt("scroll",o):F!=null&&N(o,w,F,E))}switch(d){case"input":at(o),kn(o,m,!1);break;case"textarea":at(o),Bi(o);break;case"option":m.value!=null&&o.setAttribute("value",""+ye(m.value));break;case"select":o.multiple=!!m.multiple,w=m.value,w!=null?hn(o,!!m.multiple,w,!1):m.defaultValue!=null&&hn(o,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(o.onclick=dc)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return yn(a),null;case 6:if(o&&a.stateNode!=null)T0(o,a,o.memoizedProps,m);else{if(typeof m!="string"&&a.stateNode===null)throw Error(n(166));if(d=Ts(Nl.current),Ts(Ur.current),yc(a)){if(m=a.stateNode,d=a.memoizedProps,m[Wr]=a,(w=m.nodeValue!==d)&&(o=Yn,o!==null))switch(o.tag){case 3:hc(m.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&hc(m.nodeValue,d,(o.mode&1)!==0)}w&&(a.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[Wr]=a,a.stateNode=m}return yn(a),null;case 13:if(mt(St),m=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(_t&&Xn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)A_(),po(),a.flags|=98560,w=!1;else if(w=yc(a),m!==null&&m.dehydrated!==null){if(o===null){if(!w)throw Error(n(318));if(w=a.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(n(317));w[Wr]=a}else po(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;yn(a),w=!1}else Tr!==null&&(bf(Tr),Tr=null),w=!0;if(!w)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=d,a):(m=m!==null,m!==(o!==null&&o.memoizedState!==null)&&m&&(a.child.flags|=8192,(a.mode&1)!==0&&(o===null||(St.current&1)!==0?Ht===0&&(Ht=3):Ef())),a.updateQueue!==null&&(a.flags|=4),yn(a),null);case 4:return _o(),df(o,a),o===null&&xl(a.stateNode.containerInfo),yn(a),null;case 10:return zd(a.type._context),yn(a),null;case 17:return jn(a.type)&&pc(),yn(a),null;case 19:if(mt(St),w=a.memoizedState,w===null)return yn(a),null;if(m=(a.flags&128)!==0,E=w.rendering,E===null)if(m)Al(w,!1);else{if(Ht!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(E=Cc(o),E!==null){for(a.flags|=128,Al(w,!1),m=E.updateQueue,m!==null&&(a.updateQueue=m,a.flags|=4),a.subtreeFlags=0,m=d,d=a.child;d!==null;)w=d,o=m,w.flags&=14680066,E=w.alternate,E===null?(w.childLanes=0,w.lanes=o,w.child=null,w.subtreeFlags=0,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=E.childLanes,w.lanes=E.lanes,w.child=E.child,w.subtreeFlags=0,w.deletions=null,w.memoizedProps=E.memoizedProps,w.memoizedState=E.memoizedState,w.updateQueue=E.updateQueue,w.type=E.type,o=E.dependencies,w.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return ft(St,St.current&1|2),a.child}o=o.sibling}w.tail!==null&&Pt()>So&&(a.flags|=128,m=!0,Al(w,!1),a.lanes=4194304)}else{if(!m)if(o=Cc(E),o!==null){if(a.flags|=128,m=!0,d=o.updateQueue,d!==null&&(a.updateQueue=d,a.flags|=4),Al(w,!0),w.tail===null&&w.tailMode==="hidden"&&!E.alternate&&!_t)return yn(a),null}else 2*Pt()-w.renderingStartTime>So&&d!==1073741824&&(a.flags|=128,m=!0,Al(w,!1),a.lanes=4194304);w.isBackwards?(E.sibling=a.child,a.child=E):(d=w.last,d!==null?d.sibling=E:a.child=E,w.last=E)}return w.tail!==null?(a=w.tail,w.rendering=a,w.tail=a.sibling,w.renderingStartTime=Pt(),a.sibling=null,d=St.current,ft(St,m?d&1|2:d&1),a):(yn(a),null);case 22:case 23:return Cf(),m=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==m&&(a.flags|=8192),m&&(a.mode&1)!==0?(Zn&1073741824)!==0&&(yn(a),a.subtreeFlags&6&&(a.flags|=8192)):yn(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function T2(o,a){switch(Md(a),a.tag){case 1:return jn(a.type)&&pc(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return _o(),mt(On),mt(vn),qd(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 5:return Ud(a),null;case 13:if(mt(St),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(n(340));po()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return mt(St),null;case 4:return _o(),null;case 10:return zd(a.type._context),null;case 22:case 23:return Cf(),null;case 24:return null;default:return null}}var Lc=!1,xn=!1,P2=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function xo(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Et(o,a,m)}else d.current=null}function ff(o,a,d){try{d()}catch(m){Et(o,a,m)}}var P0=!1;function D2(o,a){if(kd=ec,o=a_(),gd(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var y=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var E=0,O=-1,F=-1,ee=0,ae=0,ce=o,le=null;t:for(;;){for(var be;ce!==d||y!==0&&ce.nodeType!==3||(O=E+y),ce!==w||m!==0&&ce.nodeType!==3||(F=E+m),ce.nodeType===3&&(E+=ce.nodeValue.length),(be=ce.firstChild)!==null;)le=ce,ce=be;for(;;){if(ce===o)break t;if(le===d&&++ee===y&&(O=E),le===w&&++ae===m&&(F=E),(be=ce.nextSibling)!==null)break;ce=le,le=ce.parentNode}ce=be}d=O===-1||F===-1?null:{start:O,end:F}}else d=null}d=d||{start:0,end:0}}else d=null;for(Cd={focusedElem:o,selectionRange:d},ec=!1,Ee=a;Ee!==null;)if(a=Ee,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Ee=o;else for(;Ee!==null;){a=Ee;try{var Re=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Re!==null){var Te=Re.memoizedProps,Dt=Re.memoizedState,X=a.stateNode,K=X.getSnapshotBeforeUpdate(a.elementType===a.type?Te:Pr(a.type,Te),Dt);X.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var G=a.stateNode.containerInfo;G.nodeType===1?G.textContent="":G.nodeType===9&&G.documentElement&&G.removeChild(G.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(pe){Et(a,a.return,pe)}if(o=a.sibling,o!==null){o.return=a.return,Ee=o;break}Ee=a.return}return Re=P0,P0=!1,Re}function Ml(o,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&o)===o){var w=y.destroy;y.destroy=void 0,w!==void 0&&ff(a,d,w)}y=y.next}while(y!==m)}}function Oc(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function pf(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=d;break;default:o=d}typeof a=="function"?a(o):a.current=o}}function D0(o){var a=o.alternate;a!==null&&(o.alternate=null,D0(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&(delete a[Wr],delete a[Sl],delete a[Td],delete a[f2],delete a[p2])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function A0(o){return o.tag===5||o.tag===3||o.tag===4}function M0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||A0(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function mf(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?d.nodeType===8?d.parentNode.insertBefore(o,a):d.insertBefore(o,a):(d.nodeType===8?(a=d.parentNode,a.insertBefore(o,d)):(a=d,a.appendChild(o)),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=dc));else if(m!==4&&(o=o.child,o!==null))for(mf(o,a,d),o=o.sibling;o!==null;)mf(o,a,d),o=o.sibling}function gf(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(m!==4&&(o=o.child,o!==null))for(gf(o,a,d),o=o.sibling;o!==null;)gf(o,a,d),o=o.sibling}var sn=null,Dr=!1;function Ji(o,a,d){for(d=d.child;d!==null;)L0(o,a,d),d=d.sibling}function L0(o,a,d){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Ya,d)}catch{}switch(d.tag){case 5:xn||xo(d,a);case 6:var m=sn,y=Dr;sn=null,Ji(o,a,d),sn=m,Dr=y,sn!==null&&(Dr?(o=sn,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):sn.removeChild(d.stateNode));break;case 18:sn!==null&&(Dr?(o=sn,d=d.stateNode,o.nodeType===8?Rd(o.parentNode,d):o.nodeType===1&&Rd(o,d),hl(o)):Rd(sn,d.stateNode));break;case 4:m=sn,y=Dr,sn=d.stateNode.containerInfo,Dr=!0,Ji(o,a,d),sn=m,Dr=y;break;case 0:case 11:case 14:case 15:if(!xn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var w=y,E=w.destroy;w=w.tag,E!==void 0&&((w&2)!==0||(w&4)!==0)&&ff(d,a,E),y=y.next}while(y!==m)}Ji(o,a,d);break;case 1:if(!xn&&(xo(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(O){Et(d,a,O)}Ji(o,a,d);break;case 21:Ji(o,a,d);break;case 22:d.mode&1?(xn=(m=xn)||d.memoizedState!==null,Ji(o,a,d),xn=m):Ji(o,a,d);break;default:Ji(o,a,d)}}function O0(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new P2),a.forEach(function(m){var y=F2.bind(null,o,m);d.has(m)||(d.add(m),m.then(y,y))})}}function Ar(o,a){var d=a.deletions;if(d!==null)for(var m=0;m<d.length;m++){var y=d[m];try{var w=o,E=a,O=E;e:for(;O!==null;){switch(O.tag){case 5:sn=O.stateNode,Dr=!1;break e;case 3:sn=O.stateNode.containerInfo,Dr=!0;break e;case 4:sn=O.stateNode.containerInfo,Dr=!0;break e}O=O.return}if(sn===null)throw Error(n(160));L0(w,E,y),sn=null,Dr=!1;var F=y.alternate;F!==null&&(F.return=null),y.return=null}catch(ee){Et(y,a,ee)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)j0(a,o),a=a.sibling}function j0(o,a){var d=o.alternate,m=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Ar(a,o),qr(o),m&4){try{Ml(3,o,o.return),Oc(3,o)}catch(Te){Et(o,o.return,Te)}try{Ml(5,o,o.return)}catch(Te){Et(o,o.return,Te)}}break;case 1:Ar(a,o),qr(o),m&512&&d!==null&&xo(d,d.return);break;case 5:if(Ar(a,o),qr(o),m&512&&d!==null&&xo(d,d.return),o.flags&32){var y=o.stateNode;try{ve(y,"")}catch(Te){Et(o,o.return,Te)}}if(m&4&&(y=o.stateNode,y!=null)){var w=o.memoizedProps,E=d!==null?d.memoizedProps:w,O=o.type,F=o.updateQueue;if(o.updateQueue=null,F!==null)try{O==="input"&&w.type==="radio"&&w.name!=null&&cn(y,w),lr(O,E);var ee=lr(O,w);for(E=0;E<F.length;E+=2){var ae=F[E],ce=F[E+1];ae==="style"?rn(y,ce):ae==="dangerouslySetInnerHTML"?se(y,ce):ae==="children"?ve(y,ce):N(y,ae,ce,ee)}switch(O){case"input":Un(y,w);break;case"textarea":br(y,w);break;case"select":var le=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!w.multiple;var be=w.value;be!=null?hn(y,!!w.multiple,be,!1):le!==!!w.multiple&&(w.defaultValue!=null?hn(y,!!w.multiple,w.defaultValue,!0):hn(y,!!w.multiple,w.multiple?[]:"",!1))}y[Sl]=w}catch(Te){Et(o,o.return,Te)}}break;case 6:if(Ar(a,o),qr(o),m&4){if(o.stateNode===null)throw Error(n(162));y=o.stateNode,w=o.memoizedProps;try{y.nodeValue=w}catch(Te){Et(o,o.return,Te)}}break;case 3:if(Ar(a,o),qr(o),m&4&&d!==null&&d.memoizedState.isDehydrated)try{hl(a.containerInfo)}catch(Te){Et(o,o.return,Te)}break;case 4:Ar(a,o),qr(o);break;case 13:Ar(a,o),qr(o),y=o.child,y.flags&8192&&(w=y.memoizedState!==null,y.stateNode.isHidden=w,!w||y.alternate!==null&&y.alternate.memoizedState!==null||(yf=Pt())),m&4&&O0(o);break;case 22:if(ae=d!==null&&d.memoizedState!==null,o.mode&1?(xn=(ee=xn)||ae,Ar(a,o),xn=ee):Ar(a,o),qr(o),m&8192){if(ee=o.memoizedState!==null,(o.stateNode.isHidden=ee)&&!ae&&(o.mode&1)!==0)for(Ee=o,ae=o.child;ae!==null;){for(ce=Ee=ae;Ee!==null;){switch(le=Ee,be=le.child,le.tag){case 0:case 11:case 14:case 15:Ml(4,le,le.return);break;case 1:xo(le,le.return);var Re=le.stateNode;if(typeof Re.componentWillUnmount=="function"){m=le,d=le.return;try{a=m,Re.props=a.memoizedProps,Re.state=a.memoizedState,Re.componentWillUnmount()}catch(Te){Et(m,d,Te)}}break;case 5:xo(le,le.return);break;case 22:if(le.memoizedState!==null){z0(ce);continue}}be!==null?(be.return=le,Ee=be):z0(ce)}ae=ae.sibling}e:for(ae=null,ce=o;;){if(ce.tag===5){if(ae===null){ae=ce;try{y=ce.stateNode,ee?(w=y.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none"):(O=ce.stateNode,F=ce.memoizedProps.style,E=F!=null&&F.hasOwnProperty("display")?F.display:null,O.style.display=Kt("display",E))}catch(Te){Et(o,o.return,Te)}}}else if(ce.tag===6){if(ae===null)try{ce.stateNode.nodeValue=ee?"":ce.memoizedProps}catch(Te){Et(o,o.return,Te)}}else if((ce.tag!==22&&ce.tag!==23||ce.memoizedState===null||ce===o)&&ce.child!==null){ce.child.return=ce,ce=ce.child;continue}if(ce===o)break e;for(;ce.sibling===null;){if(ce.return===null||ce.return===o)break e;ae===ce&&(ae=null),ce=ce.return}ae===ce&&(ae=null),ce.sibling.return=ce.return,ce=ce.sibling}}break;case 19:Ar(a,o),qr(o),m&4&&O0(o);break;case 21:break;default:Ar(a,o),qr(o)}}function qr(o){var a=o.flags;if(a&2){try{e:{for(var d=o.return;d!==null;){if(A0(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(ve(y,""),m.flags&=-33);var w=M0(o);gf(o,w,y);break;case 3:case 4:var E=m.stateNode.containerInfo,O=M0(o);mf(o,O,E);break;default:throw Error(n(161))}}catch(F){Et(o,o.return,F)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function A2(o,a,d){Ee=o,I0(o)}function I0(o,a,d){for(var m=(o.mode&1)!==0;Ee!==null;){var y=Ee,w=y.child;if(y.tag===22&&m){var E=y.memoizedState!==null||Lc;if(!E){var O=y.alternate,F=O!==null&&O.memoizedState!==null||xn;O=Lc;var ee=xn;if(Lc=E,(xn=F)&&!ee)for(Ee=y;Ee!==null;)E=Ee,F=E.child,E.tag===22&&E.memoizedState!==null?F0(y):F!==null?(F.return=E,Ee=F):F0(y);for(;w!==null;)Ee=w,I0(w),w=w.sibling;Ee=y,Lc=O,xn=ee}B0(o)}else(y.subtreeFlags&8772)!==0&&w!==null?(w.return=y,Ee=w):B0(o)}}function B0(o){for(;Ee!==null;){var a=Ee;if((a.flags&8772)!==0){var d=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:xn||Oc(5,a);break;case 1:var m=a.stateNode;if(a.flags&4&&!xn)if(d===null)m.componentDidMount();else{var y=a.elementType===a.type?d.memoizedProps:Pr(a.type,d.memoizedProps);m.componentDidUpdate(y,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var w=a.updateQueue;w!==null&&z_(a,w,m);break;case 3:var E=a.updateQueue;if(E!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=a.child.stateNode;break;case 1:d=a.child.stateNode}z_(a,E,d)}break;case 5:var O=a.stateNode;if(d===null&&a.flags&4){d=O;var F=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":F.autoFocus&&d.focus();break;case"img":F.src&&(d.src=F.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ee=a.alternate;if(ee!==null){var ae=ee.memoizedState;if(ae!==null){var ce=ae.dehydrated;ce!==null&&hl(ce)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}xn||a.flags&512&&pf(a)}catch(le){Et(a,a.return,le)}}if(a===o){Ee=null;break}if(d=a.sibling,d!==null){d.return=a.return,Ee=d;break}Ee=a.return}}function z0(o){for(;Ee!==null;){var a=Ee;if(a===o){Ee=null;break}var d=a.sibling;if(d!==null){d.return=a.return,Ee=d;break}Ee=a.return}}function F0(o){for(;Ee!==null;){var a=Ee;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{Oc(4,a)}catch(F){Et(a,d,F)}break;case 1:var m=a.stateNode;if(typeof m.componentDidMount=="function"){var y=a.return;try{m.componentDidMount()}catch(F){Et(a,y,F)}}var w=a.return;try{pf(a)}catch(F){Et(a,w,F)}break;case 5:var E=a.return;try{pf(a)}catch(F){Et(a,E,F)}}}catch(F){Et(a,a.return,F)}if(a===o){Ee=null;break}var O=a.sibling;if(O!==null){O.return=a.return,Ee=O;break}Ee=a.return}}var M2=Math.ceil,jc=M.ReactCurrentDispatcher,vf=M.ReactCurrentOwner,fr=M.ReactCurrentBatchConfig,Ge=0,Xt=null,jt=null,on=0,Zn=0,wo=Ki(0),Ht=0,Ll=null,Ds=0,Ic=0,_f=0,Ol=null,Bn=null,yf=0,So=1/0,yi=null,Bc=!1,xf=null,Qi=null,zc=!1,es=null,Fc=0,jl=0,wf=null,$c=-1,Hc=0;function Nn(){return(Ge&6)!==0?Pt():$c!==-1?$c:$c=Pt()}function ts(o){return(o.mode&1)===0?1:(Ge&2)!==0&&on!==0?on&-on:g2.transition!==null?(Hc===0&&(Hc=Mv()),Hc):(o=st,o!==0||(o=window.event,o=o===void 0?16:Hv(o.type)),o)}function Mr(o,a,d,m){if(50<jl)throw jl=0,wf=null,Error(n(185));ol(o,d,m),((Ge&2)===0||o!==Xt)&&(o===Xt&&((Ge&2)===0&&(Ic|=d),Ht===4&&ns(o,on)),zn(o,m),d===1&&Ge===0&&(a.mode&1)===0&&(So=Pt()+500,gc&&Xi()))}function zn(o,a){var d=o.callbackNode;gE(o,a);var m=Ga(o,o===Xt?on:0);if(m===0)d!==null&&Pv(d),o.callbackNode=null,o.callbackPriority=0;else if(a=m&-m,o.callbackPriority!==a){if(d!=null&&Pv(d),a===1)o.tag===0?m2(H0.bind(null,o)):N_(H0.bind(null,o)),h2(function(){(Ge&6)===0&&Xi()}),d=null;else{switch(Lv(m)){case 1:d=Qh;break;case 4:d=Dv;break;case 16:d=Ka;break;case 536870912:d=Av;break;default:d=Ka}d=Z0(d,$0.bind(null,o))}o.callbackPriority=a,o.callbackNode=d}}function $0(o,a){if($c=-1,Hc=0,(Ge&6)!==0)throw Error(n(327));var d=o.callbackNode;if(bo()&&o.callbackNode!==d)return null;var m=Ga(o,o===Xt?on:0);if(m===0)return null;if((m&30)!==0||(m&o.expiredLanes)!==0||a)a=Wc(o,m);else{a=m;var y=Ge;Ge|=2;var w=U0();(Xt!==o||on!==a)&&(yi=null,So=Pt()+500,Ms(o,a));do try{j2();break}catch(O){W0(o,O)}while(!0);Bd(),jc.current=w,Ge=y,jt!==null?a=0:(Xt=null,on=0,a=Ht)}if(a!==0){if(a===2&&(y=ed(o),y!==0&&(m=y,a=Sf(o,y))),a===1)throw d=Ll,Ms(o,0),ns(o,m),zn(o,Pt()),d;if(a===6)ns(o,m);else{if(y=o.current.alternate,(m&30)===0&&!L2(y)&&(a=Wc(o,m),a===2&&(w=ed(o),w!==0&&(m=w,a=Sf(o,w))),a===1))throw d=Ll,Ms(o,0),ns(o,m),zn(o,Pt()),d;switch(o.finishedWork=y,o.finishedLanes=m,a){case 0:case 1:throw Error(n(345));case 2:Ls(o,Bn,yi);break;case 3:if(ns(o,m),(m&130023424)===m&&(a=yf+500-Pt(),10<a)){if(Ga(o,0)!==0)break;if(y=o.suspendedLanes,(y&m)!==m){Nn(),o.pingedLanes|=o.suspendedLanes&y;break}o.timeoutHandle=Nd(Ls.bind(null,o,Bn,yi),a);break}Ls(o,Bn,yi);break;case 4:if(ns(o,m),(m&4194240)===m)break;for(a=o.eventTimes,y=-1;0<m;){var E=31-Nr(m);w=1<<E,E=a[E],E>y&&(y=E),m&=~w}if(m=y,m=Pt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*M2(m/1960))-m,10<m){o.timeoutHandle=Nd(Ls.bind(null,o,Bn,yi),m);break}Ls(o,Bn,yi);break;case 5:Ls(o,Bn,yi);break;default:throw Error(n(329))}}}return zn(o,Pt()),o.callbackNode===d?$0.bind(null,o):null}function Sf(o,a){var d=Ol;return o.current.memoizedState.isDehydrated&&(Ms(o,a).flags|=256),o=Wc(o,a),o!==2&&(a=Bn,Bn=d,a!==null&&bf(a)),o}function bf(o){Bn===null?Bn=o:Bn.push.apply(Bn,o)}function L2(o){for(var a=o;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var y=d[m],w=y.getSnapshot;y=y.value;try{if(!Rr(w(),y))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ns(o,a){for(a&=~_f,a&=~Ic,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var d=31-Nr(a),m=1<<d;o[d]=-1,a&=~m}}function H0(o){if((Ge&6)!==0)throw Error(n(327));bo();var a=Ga(o,0);if((a&1)===0)return zn(o,Pt()),null;var d=Wc(o,a);if(o.tag!==0&&d===2){var m=ed(o);m!==0&&(a=m,d=Sf(o,m))}if(d===1)throw d=Ll,Ms(o,0),ns(o,a),zn(o,Pt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,Ls(o,Bn,yi),zn(o,Pt()),null}function kf(o,a){var d=Ge;Ge|=1;try{return o(a)}finally{Ge=d,Ge===0&&(So=Pt()+500,gc&&Xi())}}function As(o){es!==null&&es.tag===0&&(Ge&6)===0&&bo();var a=Ge;Ge|=1;var d=fr.transition,m=st;try{if(fr.transition=null,st=1,o)return o()}finally{st=m,fr.transition=d,Ge=a,(Ge&6)===0&&Xi()}}function Cf(){Zn=wo.current,mt(wo)}function Ms(o,a){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,u2(d)),jt!==null)for(d=jt.return;d!==null;){var m=d;switch(Md(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&pc();break;case 3:_o(),mt(On),mt(vn),qd();break;case 5:Ud(m);break;case 4:_o();break;case 13:mt(St);break;case 19:mt(St);break;case 10:zd(m.type._context);break;case 22:case 23:Cf()}d=d.return}if(Xt=o,jt=o=rs(o.current,null),on=Zn=a,Ht=0,Ll=null,_f=Ic=Ds=0,Bn=Ol=null,Rs!==null){for(a=0;a<Rs.length;a++)if(d=Rs[a],m=d.interleaved,m!==null){d.interleaved=null;var y=m.next,w=d.pending;if(w!==null){var E=w.next;w.next=y,m.next=E}d.pending=m}Rs=null}return o}function W0(o,a){do{var d=jt;try{if(Bd(),Ec.current=Pc,Nc){for(var m=bt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Nc=!1}if(Ps=0,Yt=$t=bt=null,Rl=!1,Tl=0,vf.current=null,d===null||d.return===null){Ht=1,Ll=a,jt=null;break}e:{var w=o,E=d.return,O=d,F=a;if(a=on,O.flags|=32768,F!==null&&typeof F=="object"&&typeof F.then=="function"){var ee=F,ae=O,ce=ae.tag;if((ae.mode&1)===0&&(ce===0||ce===11||ce===15)){var le=ae.alternate;le?(ae.updateQueue=le.updateQueue,ae.memoizedState=le.memoizedState,ae.lanes=le.lanes):(ae.updateQueue=null,ae.memoizedState=null)}var be=p0(E);if(be!==null){be.flags&=-257,m0(be,E,O,w,a),be.mode&1&&f0(w,ee,a),a=be,F=ee;var Re=a.updateQueue;if(Re===null){var Te=new Set;Te.add(F),a.updateQueue=Te}else Re.add(F);break e}else{if((a&1)===0){f0(w,ee,a),Ef();break e}F=Error(n(426))}}else if(_t&&O.mode&1){var Dt=p0(E);if(Dt!==null){(Dt.flags&65536)===0&&(Dt.flags|=256),m0(Dt,E,O,w,a),jd(yo(F,O));break e}}w=F=yo(F,O),Ht!==4&&(Ht=2),Ol===null?Ol=[w]:Ol.push(w),w=E;do{switch(w.tag){case 3:w.flags|=65536,a&=-a,w.lanes|=a;var X=h0(w,F,a);B_(w,X);break e;case 1:O=F;var K=w.type,G=w.stateNode;if((w.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||G!==null&&typeof G.componentDidCatch=="function"&&(Qi===null||!Qi.has(G)))){w.flags|=65536,a&=-a,w.lanes|=a;var pe=d0(w,O,a);B_(w,pe);break e}}w=w.return}while(w!==null)}q0(d)}catch(Pe){a=Pe,jt===d&&d!==null&&(jt=d=d.return);continue}break}while(!0)}function U0(){var o=jc.current;return jc.current=Pc,o===null?Pc:o}function Ef(){(Ht===0||Ht===3||Ht===2)&&(Ht=4),Xt===null||(Ds&268435455)===0&&(Ic&268435455)===0||ns(Xt,on)}function Wc(o,a){var d=Ge;Ge|=2;var m=U0();(Xt!==o||on!==a)&&(yi=null,Ms(o,a));do try{O2();break}catch(y){W0(o,y)}while(!0);if(Bd(),Ge=d,jc.current=m,jt!==null)throw Error(n(261));return Xt=null,on=0,Ht}function O2(){for(;jt!==null;)V0(jt)}function j2(){for(;jt!==null&&!lE();)V0(jt)}function V0(o){var a=X0(o.alternate,o,Zn);o.memoizedProps=o.pendingProps,a===null?q0(o):jt=a,vf.current=null}function q0(o){var a=o;do{var d=a.alternate;if(o=a.return,(a.flags&32768)===0){if(d=R2(d,a,Zn),d!==null){jt=d;return}}else{if(d=T2(d,a),d!==null){d.flags&=32767,jt=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{Ht=6,jt=null;return}}if(a=a.sibling,a!==null){jt=a;return}jt=a=o}while(a!==null);Ht===0&&(Ht=5)}function Ls(o,a,d){var m=st,y=fr.transition;try{fr.transition=null,st=1,I2(o,a,d,m)}finally{fr.transition=y,st=m}return null}function I2(o,a,d,m){do bo();while(es!==null);if((Ge&6)!==0)throw Error(n(327));d=o.finishedWork;var y=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var w=d.lanes|d.childLanes;if(vE(o,w),o===Xt&&(jt=Xt=null,on=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||zc||(zc=!0,Z0(Ka,function(){return bo(),null})),w=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||w){w=fr.transition,fr.transition=null;var E=st;st=1;var O=Ge;Ge|=4,vf.current=null,D2(o,d),j0(d,o),r2(Cd),ec=!!kd,Cd=kd=null,o.current=d,A2(d),aE(),Ge=O,st=E,fr.transition=w}else o.current=d;if(zc&&(zc=!1,es=o,Fc=y),w=o.pendingLanes,w===0&&(Qi=null),hE(d.stateNode),zn(o,Pt()),a!==null)for(m=o.onRecoverableError,d=0;d<a.length;d++)y=a[d],m(y.value,{componentStack:y.stack,digest:y.digest});if(Bc)throw Bc=!1,o=xf,xf=null,o;return(Fc&1)!==0&&o.tag!==0&&bo(),w=o.pendingLanes,(w&1)!==0?o===wf?jl++:(jl=0,wf=o):jl=0,Xi(),null}function bo(){if(es!==null){var o=Lv(Fc),a=fr.transition,d=st;try{if(fr.transition=null,st=16>o?16:o,es===null)var m=!1;else{if(o=es,es=null,Fc=0,(Ge&6)!==0)throw Error(n(331));var y=Ge;for(Ge|=4,Ee=o.current;Ee!==null;){var w=Ee,E=w.child;if((Ee.flags&16)!==0){var O=w.deletions;if(O!==null){for(var F=0;F<O.length;F++){var ee=O[F];for(Ee=ee;Ee!==null;){var ae=Ee;switch(ae.tag){case 0:case 11:case 15:Ml(8,ae,w)}var ce=ae.child;if(ce!==null)ce.return=ae,Ee=ce;else for(;Ee!==null;){ae=Ee;var le=ae.sibling,be=ae.return;if(D0(ae),ae===ee){Ee=null;break}if(le!==null){le.return=be,Ee=le;break}Ee=be}}}var Re=w.alternate;if(Re!==null){var Te=Re.child;if(Te!==null){Re.child=null;do{var Dt=Te.sibling;Te.sibling=null,Te=Dt}while(Te!==null)}}Ee=w}}if((w.subtreeFlags&2064)!==0&&E!==null)E.return=w,Ee=E;else e:for(;Ee!==null;){if(w=Ee,(w.flags&2048)!==0)switch(w.tag){case 0:case 11:case 15:Ml(9,w,w.return)}var X=w.sibling;if(X!==null){X.return=w.return,Ee=X;break e}Ee=w.return}}var K=o.current;for(Ee=K;Ee!==null;){E=Ee;var G=E.child;if((E.subtreeFlags&2064)!==0&&G!==null)G.return=E,Ee=G;else e:for(E=K;Ee!==null;){if(O=Ee,(O.flags&2048)!==0)try{switch(O.tag){case 0:case 11:case 15:Oc(9,O)}}catch(Pe){Et(O,O.return,Pe)}if(O===E){Ee=null;break e}var pe=O.sibling;if(pe!==null){pe.return=O.return,Ee=pe;break e}Ee=O.return}}if(Ge=y,Xi(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Ya,o)}catch{}m=!0}return m}finally{st=d,fr.transition=a}}return!1}function K0(o,a,d){a=yo(d,a),a=h0(o,a,1),o=Gi(o,a,1),a=Nn(),o!==null&&(ol(o,1,a),zn(o,a))}function Et(o,a,d){if(o.tag===3)K0(o,o,d);else for(;a!==null;){if(a.tag===3){K0(a,o,d);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Qi===null||!Qi.has(m))){o=yo(d,o),o=d0(a,o,1),a=Gi(a,o,1),o=Nn(),a!==null&&(ol(a,1,o),zn(a,o));break}}a=a.return}}function B2(o,a,d){var m=o.pingCache;m!==null&&m.delete(a),a=Nn(),o.pingedLanes|=o.suspendedLanes&d,Xt===o&&(on&d)===d&&(Ht===4||Ht===3&&(on&130023424)===on&&500>Pt()-yf?Ms(o,0):_f|=d),zn(o,a)}function Y0(o,a){a===0&&((o.mode&1)===0?a=1:(a=Za,Za<<=1,(Za&130023424)===0&&(Za=4194304)));var d=Nn();o=gi(o,a),o!==null&&(ol(o,a,d),zn(o,d))}function z2(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Y0(o,d)}function F2(o,a){var d=0;switch(o.tag){case 13:var m=o.stateNode,y=o.memoizedState;y!==null&&(d=y.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(a),Y0(o,d)}var X0;X0=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||On.current)In=!0;else{if((o.lanes&d)===0&&(a.flags&128)===0)return In=!1,N2(o,a,d);In=(o.flags&131072)!==0}else In=!1,_t&&(a.flags&1048576)!==0&&R_(a,_c,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Mc(o,a),o=a.pendingProps;var y=uo(a,vn.current);vo(a,d),y=Xd(null,a,m,o,y,d);var w=Zd();return a.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,jn(m)?(w=!0,mc(a)):w=!1,a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Hd(a),y.updater=Dc,a.stateNode=y,y._reactInternals=a,nf(a,m,o,d),a=lf(null,a,m,!0,w,d)):(a.tag=0,_t&&w&&Ad(a),En(null,a,y,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Mc(o,a),o=a.pendingProps,y=m._init,m=y(m._payload),a.type=m,y=a.tag=H2(m),o=Pr(m,o),y){case 0:a=of(null,a,m,o,d);break e;case 1:a=w0(null,a,m,o,d);break e;case 11:a=g0(null,a,m,o,d);break e;case 14:a=v0(null,a,m,Pr(m.type,o),d);break e}throw Error(n(306,m,""))}return a;case 0:return m=a.type,y=a.pendingProps,y=a.elementType===m?y:Pr(m,y),of(o,a,m,y,d);case 1:return m=a.type,y=a.pendingProps,y=a.elementType===m?y:Pr(m,y),w0(o,a,m,y,d);case 3:e:{if(S0(a),o===null)throw Error(n(387));m=a.pendingProps,w=a.memoizedState,y=w.element,I_(o,a),kc(a,m,null,d);var E=a.memoizedState;if(m=E.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=w,a.memoizedState=w,a.flags&256){y=yo(Error(n(423)),a),a=b0(o,a,m,d,y);break e}else if(m!==y){y=yo(Error(n(424)),a),a=b0(o,a,m,d,y);break e}else for(Xn=qi(a.stateNode.containerInfo.firstChild),Yn=a,_t=!0,Tr=null,d=O_(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(po(),m===y){a=_i(o,a,d);break e}En(o,a,m,d)}a=a.child}return a;case 5:return F_(a),o===null&&Od(a),m=a.type,y=a.pendingProps,w=o!==null?o.memoizedProps:null,E=y.children,Ed(m,y)?E=null:w!==null&&Ed(m,w)&&(a.flags|=32),x0(o,a),En(o,a,E,d),a.child;case 6:return o===null&&Od(a),null;case 13:return k0(o,a,d);case 4:return Wd(a,a.stateNode.containerInfo),m=a.pendingProps,o===null?a.child=mo(a,null,m,d):En(o,a,m,d),a.child;case 11:return m=a.type,y=a.pendingProps,y=a.elementType===m?y:Pr(m,y),g0(o,a,m,y,d);case 7:return En(o,a,a.pendingProps,d),a.child;case 8:return En(o,a,a.pendingProps.children,d),a.child;case 12:return En(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,y=a.pendingProps,w=a.memoizedProps,E=y.value,ft(wc,m._currentValue),m._currentValue=E,w!==null)if(Rr(w.value,E)){if(w.children===y.children&&!On.current){a=_i(o,a,d);break e}}else for(w=a.child,w!==null&&(w.return=a);w!==null;){var O=w.dependencies;if(O!==null){E=w.child;for(var F=O.firstContext;F!==null;){if(F.context===m){if(w.tag===1){F=vi(-1,d&-d),F.tag=2;var ee=w.updateQueue;if(ee!==null){ee=ee.shared;var ae=ee.pending;ae===null?F.next=F:(F.next=ae.next,ae.next=F),ee.pending=F}}w.lanes|=d,F=w.alternate,F!==null&&(F.lanes|=d),Fd(w.return,d,a),O.lanes|=d;break}F=F.next}}else if(w.tag===10)E=w.type===a.type?null:w.child;else if(w.tag===18){if(E=w.return,E===null)throw Error(n(341));E.lanes|=d,O=E.alternate,O!==null&&(O.lanes|=d),Fd(E,d,a),E=w.sibling}else E=w.child;if(E!==null)E.return=w;else for(E=w;E!==null;){if(E===a){E=null;break}if(w=E.sibling,w!==null){w.return=E.return,E=w;break}E=E.return}w=E}En(o,a,y.children,d),a=a.child}return a;case 9:return y=a.type,m=a.pendingProps.children,vo(a,d),y=hr(y),m=m(y),a.flags|=1,En(o,a,m,d),a.child;case 14:return m=a.type,y=Pr(m,a.pendingProps),y=Pr(m.type,y),v0(o,a,m,y,d);case 15:return _0(o,a,a.type,a.pendingProps,d);case 17:return m=a.type,y=a.pendingProps,y=a.elementType===m?y:Pr(m,y),Mc(o,a),a.tag=1,jn(m)?(o=!0,mc(a)):o=!1,vo(a,d),c0(a,m,y),nf(a,m,y,d),lf(null,a,m,!0,o,d);case 19:return E0(o,a,d);case 22:return y0(o,a,d)}throw Error(n(156,a.tag))};function Z0(o,a){return Tv(o,a)}function $2(o,a,d,m){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(o,a,d,m){return new $2(o,a,d,m)}function Nf(o){return o=o.prototype,!(!o||!o.isReactComponent)}function H2(o){if(typeof o=="function")return Nf(o)?1:0;if(o!=null){if(o=o.$$typeof,o===V)return 11;if(o===q)return 14}return 2}function rs(o,a){var d=o.alternate;return d===null?(d=pr(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function Uc(o,a,d,m,y,w){var E=2;if(m=o,typeof o=="function")Nf(o)&&(E=1);else if(typeof o=="string")E=5;else e:switch(o){case D:return Os(d.children,y,w,a);case $:E=8,y|=8;break;case j:return o=pr(12,d,a,y|2),o.elementType=j,o.lanes=w,o;case Y:return o=pr(13,d,a,y),o.elementType=Y,o.lanes=w,o;case W:return o=pr(19,d,a,y),o.elementType=W,o.lanes=w,o;case J:return Vc(d,y,w,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case R:E=10;break e;case U:E=9;break e;case V:E=11;break e;case q:E=14;break e;case z:E=16,m=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return a=pr(E,d,a,y),a.elementType=o,a.type=m,a.lanes=w,a}function Os(o,a,d,m){return o=pr(7,o,m,a),o.lanes=d,o}function Vc(o,a,d,m){return o=pr(22,o,m,a),o.elementType=J,o.lanes=d,o.stateNode={isHidden:!1},o}function Rf(o,a,d){return o=pr(6,o,null,a),o.lanes=d,o}function Tf(o,a,d){return a=pr(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function W2(o,a,d,m,y){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=td(0),this.expirationTimes=td(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=td(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Pf(o,a,d,m,y,w,E,O,F){return o=new W2(o,a,d,O,F),a===1?(a=1,w===!0&&(a|=8)):a=0,w=pr(3,null,null,a),o.current=w,w.stateNode=o,w.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hd(w),o}function U2(o,a,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:m==null?null:""+m,children:o,containerInfo:a,implementation:d}}function G0(o){if(!o)return Yi;o=o._reactInternals;e:{if(bs(o)!==o||o.tag!==1)throw Error(n(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(jn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(o.tag===1){var d=o.type;if(jn(d))return C_(o,d,a)}return a}function J0(o,a,d,m,y,w,E,O,F){return o=Pf(d,m,!0,o,y,w,E,O,F),o.context=G0(null),d=o.current,m=Nn(),y=ts(d),w=vi(m,y),w.callback=a??null,Gi(d,w,y),o.current.lanes=y,ol(o,y,m),zn(o,m),o}function qc(o,a,d,m){var y=a.current,w=Nn(),E=ts(y);return d=G0(d),a.context===null?a.context=d:a.pendingContext=d,a=vi(w,E),a.payload={element:o},m=m===void 0?null:m,m!==null&&(a.callback=m),o=Gi(y,a,E),o!==null&&(Mr(o,y,E,w),bc(o,y,E)),E}function Kc(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function Q0(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function Df(o,a){Q0(o,a),(o=o.alternate)&&Q0(o,a)}function V2(){return null}var ey=typeof reportError=="function"?reportError:function(o){console.error(o)};function Af(o){this._internalRoot=o}Yc.prototype.render=Af.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(n(409));qc(o,a,null,null)},Yc.prototype.unmount=Af.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;As(function(){qc(null,o,null,null)}),a[di]=null}};function Yc(o){this._internalRoot=o}Yc.prototype.unstable_scheduleHydration=function(o){if(o){var a=Iv();o={blockedOn:null,target:o,priority:a};for(var d=0;d<Wi.length&&a!==0&&a<Wi[d].priority;d++);Wi.splice(d,0,o),d===0&&Fv(o)}};function Mf(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Xc(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function ty(){}function q2(o,a,d,m,y){if(y){if(typeof m=="function"){var w=m;m=function(){var ee=Kc(E);w.call(ee)}}var E=J0(a,m,o,0,null,!1,!1,"",ty);return o._reactRootContainer=E,o[di]=E.current,xl(o.nodeType===8?o.parentNode:o),As(),E}for(;y=o.lastChild;)o.removeChild(y);if(typeof m=="function"){var O=m;m=function(){var ee=Kc(F);O.call(ee)}}var F=Pf(o,0,!1,null,null,!1,!1,"",ty);return o._reactRootContainer=F,o[di]=F.current,xl(o.nodeType===8?o.parentNode:o),As(function(){qc(a,F,d,m)}),F}function Zc(o,a,d,m,y){var w=d._reactRootContainer;if(w){var E=w;if(typeof y=="function"){var O=y;y=function(){var F=Kc(E);O.call(F)}}qc(a,E,o,y)}else E=q2(d,a,o,y,m);return Kc(E)}Ov=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var d=sl(a.pendingLanes);d!==0&&(nd(a,d|1),zn(a,Pt()),(Ge&6)===0&&(So=Pt()+500,Xi()))}break;case 13:As(function(){var m=gi(o,1);if(m!==null){var y=Nn();Mr(m,o,1,y)}}),Df(o,1)}},rd=function(o){if(o.tag===13){var a=gi(o,134217728);if(a!==null){var d=Nn();Mr(a,o,134217728,d)}Df(o,134217728)}},jv=function(o){if(o.tag===13){var a=ts(o),d=gi(o,a);if(d!==null){var m=Nn();Mr(d,o,a,m)}Df(o,a)}},Iv=function(){return st},Bv=function(o,a){var d=st;try{return st=o,a()}finally{st=d}},rl=function(o,a,d){switch(a){case"input":if(Un(o,d),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<d.length;a++){var m=d[a];if(m!==o&&m.form===o.form){var y=fc(m);if(!y)throw Error(n(90));nt(m),Un(m,y)}}}break;case"textarea":br(o,d);break;case"select":a=d.value,a!=null&&hn(o,!!d.multiple,a,!1)}},Cn=kf,mn=As;var K2={usingClientEntryPoint:!1,Events:[bl,ao,fc,pn,kr,kf]},Il={findFiberByHostInstance:ks,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Y2={bundleType:Il.bundleType,version:Il.version,rendererPackageName:Il.rendererPackageName,rendererConfig:Il.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=Nv(o),o===null?null:o.stateNode},findFiberByHostInstance:Il.findFiberByHostInstance||V2,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 Gc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gc.isDisabled&&Gc.supportsFiber)try{Ya=Gc.inject(Y2),Hr=Gc}catch{}}return Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K2,Fn.createPortal=function(o,a){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mf(a))throw Error(n(200));return U2(o,a,null,d)},Fn.createRoot=function(o,a){if(!Mf(o))throw Error(n(299));var d=!1,m="",y=ey;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onRecoverableError!==void 0&&(y=a.onRecoverableError)),a=Pf(o,1,!1,null,null,d,!1,m,y),o[di]=a.current,xl(o.nodeType===8?o.parentNode:o),new Af(a)},Fn.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=Nv(a),o=o===null?null:o.stateNode,o},Fn.flushSync=function(o){return As(o)},Fn.hydrate=function(o,a,d){if(!Xc(a))throw Error(n(200));return Zc(null,o,a,!0,d)},Fn.hydrateRoot=function(o,a,d){if(!Mf(o))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,y=!1,w="",E=ey;if(d!=null&&(d.unstable_strictMode===!0&&(y=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),a=J0(a,null,o,1,d??null,y,!1,w,E),o[di]=a.current,xl(o),m)for(o=0;o<m.length;o++)d=m[o],y=d._getVersion,y=y(d._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[d,y]:a.mutableSourceEagerHydrationData.push(d,y);return new Yc(a)},Fn.render=function(o,a,d){if(!Xc(a))throw Error(n(200));return Zc(null,o,a,!1,d)},Fn.unmountComponentAtNode=function(o){if(!Xc(o))throw Error(n(40));return o._reactRootContainer?(As(function(){Zc(null,null,o,!1,function(){o._reactRootContainer=null,o[di]=null})}),!0):!1},Fn.unstable_batchedUpdates=kf,Fn.unstable_renderSubtreeIntoContainer=function(o,a,d,m){if(!Xc(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Zc(o,a,d,!1,m)},Fn.version="18.3.1-next-f1338f8080-20240426",Fn}var cy;function NS(){if(cy)return If.exports;cy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),If.exports=iN(),If.exports}var uy;function sN(){if(uy)return Jc;uy=1;var e=NS();return Jc.createRoot=e.createRoot,Jc.hydrateRoot=e.hydrateRoot,Jc}var oN=sN();const hy=e=>{let t;const n=new Set,r=(u,p)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const v=t;t=p??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(_=>_(t,v))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>h,subscribe:u=>(n.add(u),()=>n.delete(u))},h=t=e(r,i,c);return c},lN=(e=>e?hy(e):hy),aN=e=>e;function cN(e,t=aN){const n=ot.useSyncExternalStore(e.subscribe,ot.useCallback(()=>t(e.getState()),[e,t]),ot.useCallback(()=>t(e.getInitialState()),[e,t]));return ot.useDebugValue(n),n}const dy=e=>{const t=lN(e),n=r=>cN(t,r);return Object.assign(n,t),n},uN=(e=>e?dy(e):dy);var Je;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const l of i)s[l]=l;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of s)l[c]=i[c];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&s.push(l);return s},e.find=(i,s)=>{for(const l of i)if(s(l))return l},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Je||(Je={}));var fy;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(fy||(fy={}));const Ne=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hs=e=>{switch(typeof e){case"undefined":return Ne.undefined;case"string":return Ne.string;case"number":return Number.isNaN(e)?Ne.nan:Ne.number;case"boolean":return Ne.boolean;case"function":return Ne.function;case"bigint":return Ne.bigint;case"symbol":return Ne.symbol;case"object":return Array.isArray(e)?Ne.array:e===null?Ne.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ne.promise:typeof Map<"u"&&e instanceof Map?Ne.map:typeof Set<"u"&&e instanceof Set?Ne.set:typeof Date<"u"&&e instanceof Date?Ne.date:Ne.object;default:return Ne.unknown}},fe=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ri extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,h=0;for(;h<l.path.length;){const u=l.path[h];h===l.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(n(l))):c[u]=c[u]||{_errors:[]},c=c[u],h++}}};return i(this),r}static assert(t){if(!(t instanceof Ri))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ri.create=e=>new Ri(e);const Ip=(e,t)=>{let n;switch(e.code){case fe.invalid_type:e.received===Ne.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Je.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${Je.joinValues(e.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Je.joinValues(e.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${Je.joinValues(e.options)}, received '${e.received}'`;break;case fe.invalid_arguments:n="Invalid function arguments";break;case fe.invalid_return_type:n="Invalid function return type";break;case fe.invalid_date:n="Invalid date";break;case fe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Je.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case fe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case fe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case fe.custom:n="Invalid input";break;case fe.invalid_intersection_types:n="Intersection results could not be merged";break;case fe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case fe.not_finite:n="Number must be finite";break;default:n=t.defaultError,Je.assertNever(e)}return{message:n}};let hN=Ip;function dN(){return hN}const fN=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const h=r.filter(u=>!!u).slice().reverse();for(const u of h)c=u(l,{data:t,defaultError:c}).message;return{...i,path:s,message:c}};function xe(e,t){const n=dN(),r=fN({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ip?void 0:Ip].filter(i=>!!i)});e.common.issues.push(r)}class Pn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Fe;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,l=await i.value;r.push({key:s,value:l})}return Pn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:l}=i;if(s.status==="aborted"||l.status==="aborted")return Fe;s.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[s.value]=l.value)}return{status:t.value,value:r}}}const Fe=Object.freeze({status:"aborted"}),Jl=e=>({status:"dirty",value:e}),wr=e=>({status:"valid",value:e}),py=e=>e.status==="aborted",my=e=>e.status==="dirty",zo=e=>e.status==="valid",Wu=e=>typeof Promise<"u"&&e instanceof Promise;var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));class si{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gy=(e,t)=>{if(zo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ri(e.common.issues);return this._error=n,this._error}}};function We(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(l,c)=>{const{message:h}=e;return l.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:h??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:h??n??c.defaultError}},description:i}}class Xe{get description(){return this._def.description}_getType(t){return hs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Pn,ctx:{common:t.parent.common,data:t.data,parsedType:hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Wu(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return gy(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return zo(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>zo(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Wu(i)?i:Promise.resolve(i));return gy(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const l=t(i),c=()=>s.addIssue({code:fe.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ks({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ci.create(this,this._def)}nullable(){return Ys.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ni.create(this)}promise(){return Xu.create(this,this._def)}or(t){return Vu.create([this,t],this._def)}and(t){return qu.create(this,t,this._def)}transform(t){return new Ks({...We(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Zu({...We(this._def),innerType:this,defaultValue:n,typeName:$e.ZodDefault})}brand(){return new DS({typeName:$e.ZodBranded,type:this,...We(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Gu({...We(this._def),innerType:this,catchValue:n,typeName:$e.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ag.create(this,t)}readonly(){return Ju.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pN=/^c[^\s-]{8,}$/i,mN=/^[0-9a-z]+$/,gN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_N=/^[a-z0-9_-]{21}$/i,yN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,SN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ff;const bN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,CN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,EN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,NN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,RN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RS="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",TN=new RegExp(`^${RS}$`);function TS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function PN(e){return new RegExp(`^${TS(e)}$`)}function DN(e){let t=`${RS}T${TS(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function AN(e,t){return!!((t==="v4"||!t)&&bN.test(e)||(t==="v6"||!t)&&CN.test(e))}function MN(e,t){if(!yN.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function LN(e,t){return!!((t==="v4"||!t)&&kN.test(e)||(t==="v6"||!t)&&EN.test(e))}class bi extends Xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ne.string){const s=this._getOrReturnCtx(t);return xe(s,{code:fe.invalid_type,expected:Ne.string,received:s.parsedType}),Fe}const r=new Pn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const l=t.data.length>s.value,c=t.data.length<s.value;(l||c)&&(i=this._getOrReturnCtx(t,i),l?xe(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&xe(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")wN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"email",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Ff||(Ff=new RegExp(SN,"u")),Ff.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"emoji",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")vN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"uuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")_N.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"nanoid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")pN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"cuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")mN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"cuid2",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")gN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"ulid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),xe(i,{validation:"url",code:fe.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"regex",code:fe.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?DN(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?TN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?PN(s).test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?xN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?AN(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"ip",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?MN(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"jwt",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?LN(t.data,s.version)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"cidr",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?NN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?RN.test(t.data)||(i=this._getOrReturnCtx(t,i),xe(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):Je.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:fe.invalid_string,...De.errToObj(r)})}_addCheck(t){return new bi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...De.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...De.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...De.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...De.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...De.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...De.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...De.errToObj(n)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new bi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}bi.create=e=>new bi({checks:[],typeName:$e.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...We(e)});function ON(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return s%l/10**i}class Fo extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ne.number){const s=this._getOrReturnCtx(t);return xe(s,{code:fe.invalid_type,expected:Ne.number,received:s.parsedType}),Fe}let r;const i=new Pn;for(const s of this._def.checks)s.kind==="int"?Je.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?ON(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.not_finite,message:s.message}),i.dirty()):Je.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,i){return new Fo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new Fo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Je.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Fo.create=e=>new Fo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...We(e)});class ga extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ne.bigint)return this._getInvalidInput(t);let r;const i=new Pn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),xe(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Je.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return xe(n,{code:fe.invalid_type,expected:Ne.bigint,received:n.parsedType}),Fe}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,i){return new ga({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new ga({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ga.create=e=>new ga({checks:[],typeName:$e.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...We(e)});class Bp extends Xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ne.boolean){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.boolean,received:r.parsedType}),Fe}return wr(t.data)}}Bp.create=e=>new Bp({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...We(e)});class Uu extends Xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ne.date){const s=this._getOrReturnCtx(t);return xe(s,{code:fe.invalid_type,expected:Ne.date,received:s.parsedType}),Fe}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return xe(s,{code:fe.invalid_date}),Fe}const r=new Pn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),xe(i,{code:fe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Je.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uu({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Uu.create=e=>new Uu({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...We(e)});class vy extends Xe{_parse(t){if(this._getType(t)!==Ne.symbol){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.symbol,received:r.parsedType}),Fe}return wr(t.data)}}vy.create=e=>new vy({typeName:$e.ZodSymbol,...We(e)});class zp extends Xe{_parse(t){if(this._getType(t)!==Ne.undefined){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.undefined,received:r.parsedType}),Fe}return wr(t.data)}}zp.create=e=>new zp({typeName:$e.ZodUndefined,...We(e)});class Fp extends Xe{_parse(t){if(this._getType(t)!==Ne.null){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.null,received:r.parsedType}),Fe}return wr(t.data)}}Fp.create=e=>new Fp({typeName:$e.ZodNull,...We(e)});class _y extends Xe{constructor(){super(...arguments),this._any=!0}_parse(t){return wr(t.data)}}_y.create=e=>new _y({typeName:$e.ZodAny,...We(e)});class $p extends Xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return wr(t.data)}}$p.create=e=>new $p({typeName:$e.ZodUnknown,...We(e)});class vs extends Xe{_parse(t){const n=this._getOrReturnCtx(t);return xe(n,{code:fe.invalid_type,expected:Ne.never,received:n.parsedType}),Fe}}vs.create=e=>new vs({typeName:$e.ZodNever,...We(e)});class yy extends Xe{_parse(t){if(this._getType(t)!==Ne.undefined){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.void,received:r.parsedType}),Fe}return wr(t.data)}}yy.create=e=>new yy({typeName:$e.ZodVoid,...We(e)});class ni extends Xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ne.array)return xe(n,{code:fe.invalid_type,expected:Ne.array,received:n.parsedType}),Fe;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(xe(n,{code:l?fe.too_big:fe.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(xe(n,{code:fe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(xe(n,{code:fe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>i.type._parseAsync(new si(n,l,n.path,c)))).then(l=>Pn.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new si(n,l,n.path,c)));return Pn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ni({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new ni({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new ni({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(t){return this.min(1,t)}}ni.create=(e,t)=>new ni({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...We(t)});function Do(e){if(e instanceof zt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ci.create(Do(r))}return new zt({...e._def,shape:()=>t})}else return e instanceof ni?new ni({...e._def,type:Do(e.element)}):e instanceof Ci?Ci.create(Do(e.unwrap())):e instanceof Ys?Ys.create(Do(e.unwrap())):e instanceof Vs?Vs.create(e.items.map(t=>Do(t))):e}class zt extends Xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Je.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ne.object){const u=this._getOrReturnCtx(t);return xe(u,{code:fe.invalid_type,expected:Ne.object,received:u.parsedType}),Fe}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof vs&&this._def.unknownKeys==="strip"))for(const u in i.data)l.includes(u)||c.push(u);const h=[];for(const u of l){const p=s[u],f=i.data[u];h.push({key:{status:"valid",value:u},value:p._parse(new si(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof vs){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of c)h.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(u==="strict")c.length>0&&(xe(i,{code:fe.unrecognized_keys,keys:c}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of c){const f=i.data[p];h.push({key:{status:"valid",value:p},value:u._parse(new si(i,f,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of h){const f=await p.key,v=await p.value;u.push({key:f,value:v,alwaysSet:p.alwaysSet})}return u}).then(u=>Pn.mergeObjectSync(r,u)):Pn.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,l;const i=((l=(s=this._def).errorMap)==null?void 0:l.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:De.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(t){return new zt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new zt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new zt({...this._def,catchall:t})}pick(t){const n={};for(const r of Je.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Je.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}deepPartial(){return Do(this)}partial(t){const n={};for(const r of Je.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new zt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Je.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ci;)s=s._def.innerType;n[r]=s}return new zt({...this._def,shape:()=>n})}keyof(){return PS(Je.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:vs.create(),typeName:$e.ZodObject,...We(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:vs.create(),typeName:$e.ZodObject,...We(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:vs.create(),typeName:$e.ZodObject,...We(t)});class Vu extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new Ri(c.ctx.common.issues));return xe(n,{code:fe.invalid_union,unionErrors:l}),Fe}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let s;const l=[];for(const h of r){const u={...n,common:{...n.common,issues:[]},parent:null},p=h._parseSync({data:n.data,path:n.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:u}),u.common.issues.length&&l.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(h=>new Ri(h));return xe(n,{code:fe.invalid_union,unionErrors:c}),Fe}}get options(){return this._def.options}}Vu.create=(e,t)=>new Vu({options:e,typeName:$e.ZodUnion,...We(t)});const wi=e=>e instanceof Wp?wi(e.schema):e instanceof Ks?wi(e.innerType()):e instanceof Yu?[e.value]:e instanceof qs?e.options:e instanceof Up?Je.objectValues(e.enum):e instanceof Zu?wi(e._def.innerType):e instanceof zp?[void 0]:e instanceof Fp?[null]:e instanceof Ci?[void 0,...wi(e.unwrap())]:e instanceof Ys?[null,...wi(e.unwrap())]:e instanceof DS||e instanceof Ju?wi(e.unwrap()):e instanceof Gu?wi(e._def.innerType):[];class lg extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ne.object)return xe(n,{code:fe.invalid_type,expected:Ne.object,received:n.parsedType}),Fe;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(xe(n,{code:fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const l=wi(s.shape[t]);if(!l.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of l){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,s)}}return new lg({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...We(r)})}}function Hp(e,t){const n=hs(e),r=hs(t);if(e===t)return{valid:!0,data:e};if(n===Ne.object&&r===Ne.object){const i=Je.objectKeys(t),s=Je.objectKeys(e).filter(c=>i.indexOf(c)!==-1),l={...e,...t};for(const c of s){const h=Hp(e[c],t[c]);if(!h.valid)return{valid:!1};l[c]=h.data}return{valid:!0,data:l}}else if(n===Ne.array&&r===Ne.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const l=e[s],c=t[s],h=Hp(l,c);if(!h.valid)return{valid:!1};i.push(h.data)}return{valid:!0,data:i}}else return n===Ne.date&&r===Ne.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class qu extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,l)=>{if(py(s)||py(l))return Fe;const c=Hp(s.value,l.value);return c.valid?((my(s)||my(l))&&n.dirty(),{status:n.value,value:c.data}):(xe(r,{code:fe.invalid_intersection_types}),Fe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>i(s,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qu.create=(e,t,n)=>new qu({left:e,right:t,typeName:$e.ZodIntersection,...We(n)});class Vs extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.array)return xe(r,{code:fe.invalid_type,expected:Ne.array,received:r.parsedType}),Fe;if(r.data.length<this._def.items.length)return xe(r,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fe;!this._def.rest&&r.data.length>this._def.items.length&&(xe(r,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new si(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>Pn.mergeArray(n,l)):Pn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Vs({...this._def,rest:t})}}Vs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vs({items:e,typeName:$e.ZodTuple,rest:null,...We(t)})};class Ku extends Xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.object)return xe(r,{code:fe.invalid_type,expected:Ne.object,received:r.parsedType}),Fe;const i=[],s=this._def.keyType,l=this._def.valueType;for(const c in r.data)i.push({key:s._parse(new si(r,c,r.path,c)),value:l._parse(new si(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?Pn.mergeObjectAsync(n,i):Pn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Xe?new Ku({keyType:t,valueType:n,typeName:$e.ZodRecord,...We(r)}):new Ku({keyType:bi.create(),valueType:t,typeName:$e.ZodRecord,...We(n)})}}class xy extends Xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.map)return xe(r,{code:fe.invalid_type,expected:Ne.map,received:r.parsedType}),Fe;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,h],u)=>({key:i._parse(new si(r,c,r.path,[u,"key"])),value:s._parse(new si(r,h,r.path,[u,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of l){const u=await h.key,p=await h.value;if(u.status==="aborted"||p.status==="aborted")return Fe;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(u.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const h of l){const u=h.key,p=h.value;if(u.status==="aborted"||p.status==="aborted")return Fe;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(u.value,p.value)}return{status:n.value,value:c}}}}xy.create=(e,t,n)=>new xy({valueType:t,keyType:e,typeName:$e.ZodMap,...We(n)});class va extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ne.set)return xe(r,{code:fe.invalid_type,expected:Ne.set,received:r.parsedType}),Fe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(xe(r,{code:fe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(xe(r,{code:fe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function l(h){const u=new Set;for(const p of h){if(p.status==="aborted")return Fe;p.status==="dirty"&&n.dirty(),u.add(p.value)}return{status:n.value,value:u}}const c=[...r.data.values()].map((h,u)=>s._parse(new si(r,h,r.path,u)));return r.common.async?Promise.all(c).then(h=>l(h)):l(c)}min(t,n){return new va({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new va({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}va.create=(e,t)=>new va({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...We(t)});class Wp extends Xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Wp.create=(e,t)=>new Wp({getter:e,typeName:$e.ZodLazy,...We(t)});class Yu extends Xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return xe(n,{received:n.data,code:fe.invalid_literal,expected:this._def.value}),Fe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Yu.create=(e,t)=>new Yu({value:e,typeName:$e.ZodLiteral,...We(t)});function PS(e,t){return new qs({values:e,typeName:$e.ZodEnum,...We(t)})}class qs extends Xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return xe(n,{expected:Je.joinValues(r),received:n.parsedType,code:fe.invalid_type}),Fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return xe(n,{received:n.data,code:fe.invalid_enum_value,options:r}),Fe}return wr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return qs.create(t,{...this._def,...n})}exclude(t,n=this._def){return qs.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}qs.create=PS;class Up extends Xe{_parse(t){const n=Je.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ne.string&&r.parsedType!==Ne.number){const i=Je.objectValues(n);return xe(r,{expected:Je.joinValues(i),received:r.parsedType,code:fe.invalid_type}),Fe}if(this._cache||(this._cache=new Set(Je.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Je.objectValues(n);return xe(r,{received:r.data,code:fe.invalid_enum_value,options:i}),Fe}return wr(t.data)}get enum(){return this._def.values}}Up.create=(e,t)=>new Up({values:e,typeName:$e.ZodNativeEnum,...We(t)});class Xu extends Xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ne.promise&&n.common.async===!1)return xe(n,{code:fe.invalid_type,expected:Ne.promise,received:n.parsedType}),Fe;const r=n.parsedType===Ne.promise?n.data:Promise.resolve(n.data);return wr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Xu.create=(e,t)=>new Xu({type:e,typeName:$e.ZodPromise,...We(t)});class Ks extends Xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:l=>{xe(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const l=i.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return Fe;const h=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return h.status==="aborted"?Fe:h.status==="dirty"||n.value==="dirty"?Jl(h.value):h});{if(n.value==="aborted")return Fe;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?Fe:c.status==="dirty"||n.value==="dirty"?Jl(c.value):c}}if(i.type==="refinement"){const l=c=>{const h=i.refinement(c,s);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Fe:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Fe:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!zo(l))return Fe;const c=i.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>zo(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):Fe);Je.assertNever(i)}}Ks.create=(e,t,n)=>new Ks({schema:e,typeName:$e.ZodEffects,effect:t,...We(n)});Ks.createWithPreprocess=(e,t,n)=>new Ks({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...We(n)});class Ci extends Xe{_parse(t){return this._getType(t)===Ne.undefined?wr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ci.create=(e,t)=>new Ci({innerType:e,typeName:$e.ZodOptional,...We(t)});class Ys extends Xe{_parse(t){return this._getType(t)===Ne.null?wr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ys.create=(e,t)=>new Ys({innerType:e,typeName:$e.ZodNullable,...We(t)});class Zu extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Zu.create=(e,t)=>new Zu({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...We(t)});class Gu extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Wu(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ri(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ri(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Gu.create=(e,t)=>new Gu({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...We(t)});class wy extends Xe{_parse(t){if(this._getType(t)!==Ne.nan){const r=this._getOrReturnCtx(t);return xe(r,{code:fe.invalid_type,expected:Ne.nan,received:r.parsedType}),Fe}return{status:"valid",value:t.data}}}wy.create=e=>new wy({typeName:$e.ZodNaN,...We(e)});class DS extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ag extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Fe:s.status==="dirty"?(n.dirty(),Jl(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Fe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new ag({in:t,out:n,typeName:$e.ZodPipeline})}}class Ju extends Xe{_parse(t){const n=this._def.innerType._parse(t),r=i=>(zo(i)&&(i.value=Object.freeze(i.value)),i);return Wu(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Ju.create=(e,t)=>new Ju({innerType:e,typeName:$e.ZodReadonly,...We(t)});var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const we=bi.create,_a=Fo.create,oi=Bp.create,cg=$p.create;vs.create;const Qu=ni.create,et=zt.create;Vu.create;const jN=lg.create;qu.create;Vs.create;const ya=Ku.create,Kr=Yu.create,it=qs.create;Xu.create;Ci.create;Ys.create;const nr=["backlog","discovery","architecture","implementation","local-testing","pr-review","ci","prod-testing","done"],AS=["backlog","discovery","architecture","implementation"],xa=[{id:"backlog",title:"Backlog",blurb:"Ideas and to-do. No agent yet.",automated:!1},{id:"discovery",title:"Design",blurb:"Product discovery for larger features: clarifying questions, draft descriptions, rough wireframes, approach trade-offs.",automated:!0},{id:"architecture",title:"Arch",blurb:"Agent proposes an implementation design.",automated:!0},{id:"implementation",title:"Build",blurb:"Agent implements in an isolated worktree.",automated:!0},{id:"local-testing",title:"Test",blurb:"Extensive local testing and polish.",automated:!0},{id:"pr-review",title:"Review",blurb:"Independent agent reviews, then opens a PR.",automated:!0},{id:"ci",title:"Merge",blurb:"Merge and babysit the pipeline to green.",automated:!0},{id:"prod-testing",title:"Verify",blurb:"Verify the feature live; nothing broke.",automated:!0},{id:"done",title:"Done",blurb:"Complete.",automated:!1}],Aa=["low","medium","high","xhigh","max"],ug=["xs","s","m","l","xl"],hg=["ask","policy","auto"],IN={never:"ask",decide:"policy",always:"auto"},MS={backlog:"policy",discovery:"policy",architecture:"policy",implementation:"policy","local-testing":"policy","pr-review":"policy",ci:"policy","prod-testing":"policy",done:"policy"},Ma=["default","acceptEdits","auto","plan","dontAsk","bypassPermissions"],LS=["startup","company","enterprise"],OS=["none","last-open","eager","all-active"],dg="eager",jS=et({key:we(),sessionId:we().catch(""),label:we().catch(""),createdAt:we().catch(""),model:we().optional().catch(void 0),effort:it(Aa).optional().catch(void 0),permissionMode:it(Ma).optional().catch(void 0),autonomous:oi().optional().catch(void 0)});et({id:we().optional().catch(void 0),title:we().optional().catch(void 0),shortDescription:we().optional().catch(void 0),order:_a().optional().catch(void 0),status:it(nr).optional().catch(void 0),sessionId:we().optional().catch(void 0),worktree:we().optional().catch(void 0),branch:we().optional().catch(void 0),model:we().optional().catch(void 0),effort:it(Aa).optional().catch(void 0),size:it(ug).optional().catch(void 0),permissionMode:it(Ma).optional().catch(void 0),autonomous:oi().optional().catch(void 0),forks:Qu(jS).optional().catch(void 0),prUrl:we().optional().catch(void 0),prNumber:_a().optional().catch(void 0),createdAt:we().optional().catch(void 0),doneAt:we().optional().catch(void 0),workflowEnteredAt:we().optional().catch(void 0),lastGroomedAt:we().optional().catch(void 0),lastDocUpdatedAt:we().optional().catch(void 0),pendingKickoff:it(nr).optional().catch(void 0),kickedLane:it(nr).optional().catch(void 0),proposedLane:it(nr).optional().catch(void 0),grooming:oi().optional().catch(void 0)}).passthrough();const BN=ya(we(),cg()).transform(e=>{const t={};for(const[n,r]of Object.entries(e)){const i=IN[r]??r;nr.includes(n)&&hg.includes(i)&&(t[n]=i)}return t}).catch({}),zN=ya(we(),cg()).transform(e=>{const t={};for(const[n,r]of Object.entries(e))nr.includes(n)&&typeof r=="string"&&r.trim()&&(t[n]=r.trim());return t}).catch({});et({trunk:we().optional().catch(void 0),reviewMode:it(["local","remote"]).catch("local"),autoExpand:oi().catch(!0),devSpeed:it(LS).catch("enterprise"),iframeCaching:it(OS).catch(dg),orchestratorSessionId:we().optional().catch(void 0),orchestratorModel:we().optional().catch(void 0),orchestratorEffort:it(Aa).optional().catch(void 0),orchestratorPermissionMode:it(Ma).optional().catch(void 0),orchestratorForks:Qu(jS).optional().catch(void 0),stepGates:BN.default({}),phaseHooks:zN.default({}),worktreeSetup:we().optional().catch(void 0),devCommand:we().optional().catch(void 0)}).passthrough();const IS=e=>`orch:${e}`,FN=e=>e.startsWith("orch:"),$N=["permission_request","clarification","ask_user_question","advance_proposal"];function fg(e){return $N.includes(e.type)}jN("kind",[et({kind:Kr("subscribe_agent"),taskId:we(),afterSeq:_a().int().nonnegative().optional()}),et({kind:Kr("subscribe_run"),taskId:we(),runId:we()}),et({kind:Kr("unsubscribe_run"),taskId:we(),runId:we()}),et({kind:Kr("subscribe_project"),projectId:we()}),et({kind:Kr("run_command"),taskId:we(),command:we()}),et({kind:Kr("kill_command"),taskId:we()}),et({kind:Kr("dictation_start")}),et({kind:Kr("dictation_audio"),audio:we()}),et({kind:Kr("dictation_stop")}),et({kind:Kr("devtools_result"),taskId:we(),commandId:we(),ok:oi(),result:cg().optional(),error:we().optional()})]);et({path:we().min(1),trunk:we().optional()}).strict();et({name:we().min(1).optional(),trunk:we().min(1).optional()}).strict();et({reviewMode:it(["local","remote"]).optional(),trunk:we().optional(),autoExpand:oi().optional(),devSpeed:it(LS).optional(),iframeCaching:it(OS).optional(),stepGates:ya(it(nr),it(hg)).optional(),phaseHooks:ya(it(nr),we()).optional(),worktreeSetup:we().optional()}).strict();const HN=["groom","orchestrator"];et({scope:it(["project","user"]),lane:it(nr).optional(),agent:it(HN).optional()}).strict().refine(e=>e.lane===void 0!=(e.agent===void 0),{message:"Provide exactly one of `lane` or `agent`."});et({title:we().default(""),shortDescription:we().default(""),toLane:it(AS).optional(),kickoff:oi().optional()}).strict();et({toLane:it(nr),toOrder:_a().int().nonnegative().optional(),userNote:we().max(4e3).optional()}).strict();et({text:we().min(1)}).strict();et({model:we().optional(),effort:it(Aa).optional(),size:it(ug).optional(),permissionMode:it(Ma).optional(),streamKey:we().optional()}).strict();et({requestId:we(),decision:it(["allow","deny"]),message:we().optional()}).strict();et({requestId:we(),answer:we()}).strict();et({requestId:we(),answers:ya(we()).optional()}).strict();et({requestId:we(),accept:oi(),toLane:it(nr).optional()}).strict();et({elevenLabsApiKey:we().optional(),passthroughUserSettings:oi().optional(),dictationSubmitKeywords:we().optional()}).strict();et({label:we().min(1),token:we().min(1)}).strict();et({key:we().min(1),draft:we().default(""),queue:Qu(we()).default([]),pending:Qu(we()).default([])}).strict();et({key:we().min(1)}).strict();et({sourceKey:we().optional(),message:we().optional(),blank:oi().optional()}).strict();et({name:we().trim().min(1)}).strict();et({toUuid:we().min(1),preview:we().optional(),index:_a().int().nonnegative().optional()}).strict();xa.filter(e=>e.automated).map(e=>e.id);function WN(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}const Sy=["hsl(182, 62%, 46%)","hsl(320, 68%, 62%)","hsl(228, 72%, 64%)","hsl(55, 68%, 56%)","hsl(310, 64%, 50%)","hsl(195, 78%, 52%)","hsl(248, 62%, 68%)","hsl(332, 62%, 58%)","hsl(185, 58%, 58%)","hsl(300, 52%, 58%)","hsl(212, 60%, 46%)","hsl(285, 56%, 60%)","hsl(205, 70%, 56%)","hsl(265, 58%, 64%)","hsl(178, 52%, 50%)","hsl(238, 52%, 58%)"];function BS(e){const t=WN(e)%Sy.length;return{index:t,hsl:Sy[t]}}const UN=new Set(["cat","head","tail","less","grep","rg","egrep","fgrep","ls","ll","find","fd","tree","wc","stat","file","pwd","whoami","env","printenv","du","df","date","cut","sort","uniq","diff","echo","which","type","basename","dirname","realpath","readlink","sed","awk","jq","column","nl","comm","cd"]),VN=new Set(["status","log","diff","show","branch","remote","describe","blame","ls-files","rev-parse","config","stash","shortlog","reflog"]);function zS(e){return e.replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''")}function qN(e){if(!e)return!1;const t=zS(e).split(/\||&&|;|\n/).map(n=>n.trim()).filter(Boolean);return t.length?t.every(n=>{if(/>>?\s*(?!&|\/dev\/null)\S/.test(n))return!1;const r=n.split(/\s+/);return r[0]==="git"?VN.has(r[1]??""):UN.has(r[0])}):!1}function by(e,t){return t==="backlog"?e.createdAt:t==="done"?e.doneAt??e.createdAt:e.workflowEnteredAt??e.createdAt}function FS(e,t,n){return by(n,e).localeCompare(by(t,e))||n.id.localeCompare(t.id)}const KN=[{key:"problem",heading:"Problem"},{key:"context",heading:"Context"},{key:"acceptance",heading:"Acceptance criteria"},{key:"expectedResult",heading:"Expected result"},{key:"affectedAreas",heading:"Affected areas"},{key:"clarifications",heading:"Clarifications"},{key:"notes",heading:"Notes"}];new Map(KN.map(e=>[e.heading.toLowerCase(),e.key]));function pg(e){return e.replace(/\/[^\s"']*?\/worktrees\/[^/\s"']+\//g,"")}function YN(e,t){const n=e.match(/\/worktrees\/[^/]+\/(.+)$/);return n?n[1]:t&&e.startsWith(t.endsWith("/")?t:t+"/")?e.slice(t.replace(/\/$/,"").length+1):e.split("/").slice(-2).join("/")}function Vp(e,t=120){try{const n=typeof e=="string"?e:JSON.stringify(e),r=pg(n);return r.length>t?r.slice(0,t)+"…":r}catch{return""}}function XN(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Ch(e){if(e&&typeof e=="object"){const t=e.command;if(typeof t=="string")return t}}function $S(e){if(e&&typeof e=="object"){const t=e,n=t.file_path??t.notebook_path??t.path;if(typeof n=="string")return n}}function ZN(e,t,n=140){let r;return e==="Bash"&&(r=Ch(t),r&&(r=r.replace(/^\s*cd\s+\S+\s*(?:&&|;|\n)\s*/,"").replace(/\s*\n\s*/g," "))),r==null&&(r=$S(t)),r==null?Vp(t,n):(r=pg(r).trim(),r.length>n?r.slice(0,n)+"…":r)}const GN={update_task_doc:"update doc",propose_advance:"propose advance",request_clarification:"ask clarification",ask_form:"ask question",attach_artifact:"attach artifact",render_mockup:"render mockup",render_diagram:"render diagram",report_pr:"report PR",set_size:"set size",start_run:"start run",stop_run:"stop run"};function JN(e,t){const n=t??{},r=i=>typeof n[i]=="string"?n[i]:"";return e==="start_run"||e==="stop_run"?r("name")||r("runId"):e==="propose_advance"?r("to_lane"):e==="set_size"?r("size"):e==="report_pr"?r("url"):e==="attach_artifact"||e==="render_mockup"||e==="render_diagram"?r("title"):""}function QN(e){const t=e.split(/\s+/);if(t[0]!=="git")return null;for(let n=1;n<t.length;n++){const r=t[n];if(r==="-C"||r==="-c"){n++;continue}if(!r.startsWith("-"))return/^[a-z-]+$/.test(r)?r:null}return null}function eR(e){var i,s;const t=e.replace(/\s+/g," ").trim(),n=QN(t);if(n){if(n==="commit"){const l=((s=(i=e.match(/-m\s+(['"])([\s\S]*?)\1/))==null?void 0:i[2])==null?void 0:s.trim())??"";return{kind:"commit",label:"commit",detail:l.length>120?l.slice(0,120).trimEnd()+"…":l}}return{kind:"git",label:`git ${n}`,detail:""}}const r=/\b(pnpm|npm|yarn|npx)\b/.test(t);return/\b(tsc|typecheck)\b/.test(t)?{kind:"typecheck",label:"typecheck",detail:""}:/\b(vitest|jest)\b/.test(t)||r&&/\btest\b/.test(t)?{kind:"test",label:"test",detail:""}:r&&/\b(install|add|i)\b/.test(t)?{kind:"install",label:"install",detail:""}:r&&/\bbuild\b/.test(t)?{kind:"build",label:"build",detail:""}:r&&/\b(dev|start)\b/.test(t)?{kind:"dev",label:"dev",detail:""}:null}function tR(e){const t=n=>n[0]+" ".repeat(n.length-2)+n[0];return e.replace(/"(?:[^"\\]|\\.)*"/g,t).replace(/'(?:[^'\\]|\\.)*'/g,t)}function nR(e){var c;const t=tR(e),n=/&&|\|\||;|\n|\|/g,r=[];let i=0,s;for(;s=n.exec(t);)r.push(e.slice(i,s.index)),i=s.index+s[0].length;r.push(e.slice(i));const l=[];for(const h of r){const u=eR(pg(h));u&&((c=l[l.length-1])==null?void 0:c.label)!==u.label&&l.push(u)}return l}function rR(e){if(e.type!=="tool_use")return[];if(e.name.startsWith("mcp__operator__")){const t=e.name.slice(15);return[{kind:"operator",label:`Operator · ${GN[t]??t}`,detail:JN(t,e.input)}]}return e.name==="Bash"?nR(Ch(e.input)??""):[]}const iR=new Set(["Edit","Write","MultiEdit","NotebookEdit"]);function HS(e){if(!e)return;const t=zS(e.split(`
41
+ `)[0]),n=new RegExp(`(?<![=\\-0-9])>>?\\s*([^\\s|&;<>(){}'"=]+)`,"g");let r,i;for(;r=n.exec(t);){const s=r[1];s&&s!=="/dev/null"&&(i=s)}return i}function sR(e){if(e.type!=="tool_use")return null;if(e.name==="Read"||e.name==="Grep"||e.name==="Glob")return"read";if(e.name==="Bash"){const t=Ch(e.input);return qN(t)?"read":HS(t)?"edit":null}return iR.has(e.name)?"edit":null}function oR(e){if(e.type==="tool_use")return e.name==="Bash"?HS(Ch(e.input)):$S(e.input)}function lR(e){const t=new Map;for(const l of e)if(l.type==="tool_use"){const c=sR(l);c&&t.set(l.id,c)}const n=[];let r=[],i=null;const s=()=>{if(r.length===0||!i){r=[],i=null;return}let l=0;const c=[];for(const h of r)if(h.type==="tool_use"&&(l++,i==="edit")){const u=oR(h);u&&c.push(u)}n.push({kind:"toolGroup",category:i,events:r,count:l,files:c}),r=[],i=null};for(const l of e){const c=l.type==="tool_use"||l.type==="tool_result"?l.id:void 0,h=c!=null?t.get(c):void 0;h?(i&&h!==i&&s(),i=h,r.push(l)):(s(),n.push({kind:"event",event:l}))}return s(),n}function ky(e,t){const n=e.count;if(e.category==="read"){const i=e.events.reduce((s,l)=>s+(l.type==="tool_result"&&l.images?l.images.length:0),0);return i>0?n===1?i===1?"image read":`image read (${i} images)`:`${n} reads · ${i} image${i===1?"":"s"}`:`${n} read${n===1?"":"s"}`}const r=[...new Set(e.files)];return r.length===1?`${n} edit${n===1?"":"s"} to ${YN(r[0],t)}`:r.length===0?`${n} edit${n===1?"":"s"}`:`${n} edits · ${r.length} files`}function qp(e){return e.type==="advance_auto"||e.type==="prompt_dismissed"?e.id:null}function Ql(e,t){return fg(e)?(t==null?void 0:t.has(e.id))??!1:!1}function WS(e,t){const n=e[e.length-1];return n&&fg(n)&&!Ql(n,t)?n:null}const aR=new TextEncoder;function cR(e,t){t!==void 0&&(e.seq=t)}function US(e,t){if(t===void 0)return;let n=t;for(let r=e.length-1;r>=0;r--){const i=e[r];if(i.seq!==void 0){n=i.seq;continue}n-=aR.encode(JSON.stringify(i)).length+1,i.seq=n}}function VS(e){const t=e.seq;return t!==void 0?t:e}function Cy(e,t){const n=[];for(let r=Math.max(0,t);r<e.length;r++)n.push(VS(e[r]));return n}function uR(e,t){return t.size===0?e:e.filter(n=>!t.has(VS(n)))}function hR(e){const t=/^\s*also\b[\s,:;.–—-]*/i.exec(e);return t?e.slice(t[0].length):null}function dR(e){const t=/^\s*fork\b[\s,:;.–—-]*/i.exec(e);return t?e.slice(t[0].length):null}function fR(e,t,n){const r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}const Ey={draft:"",queue:[],preview:null,pending:[]};function pR(e,t){return{draft:t.draft,queue:t.queue,pending:t.pending,preview:null}}function mg(e,t){if(e.preview&&e.queue[e.preview.index]!==t){const n=e.preview.index;return{...e,draft:t,queue:e.queue.map((r,i)=>i===n?t:r)}}return{...e,draft:t}}function mR(e,t){var r;if(((r=e.preview)==null?void 0:r.index)===t)return{...e,draft:e.preview.stash,preview:null};const n=e.preview?e.preview.stash:e.draft;return{...e,draft:e.queue[t]??"",preview:{index:t,stash:n}}}function gR(e,t){const n=e.queue[t];if(!(n!=null&&n.trim()))return{state:e,text:null};const r=e.queue.filter((l,c)=>c!==t),i=e.preview,s=i&&(i.index===t?null:i.index>t?{...i,index:i.index-1}:i);return{state:{...e,queue:r,preview:s},text:n}}function vR(e,t){const n=e.preview?{...e.preview,index:e.preview.index+1}:null;return{...e,queue:[t,...e.queue],preview:n}}function _R(e,t){const n=e.queue.filter((i,s)=>s!==t),r=e.preview;return r?r.index===t?{...e,queue:n,draft:r.stash,preview:null}:{...e,queue:n,preview:r.index>t?{...r,index:r.index-1}:r}:{...e,queue:n}}function yR(e,t,n){const r=e.queue.indexOf(t),i=e.queue.indexOf(n);if(r<0||i<0||r===i)return e;const s=e.preview?e.queue[e.preview.index]:null,l=fR(e.queue,r,i);let c=e.preview;if(s!=null&&c){const h=l.indexOf(s);c=h>=0?{...c,index:h}:null}return{...e,queue:l,preview:c}}function Ny(e,t){if(!e.draft.trim())return{kind:"noop",state:e};const n=e.draft;if(e.preview===null){if(t.allowFork){const s=dR(n);if(s!==null)return{kind:"fork",state:{...e,draft:""},text:s.trim()}}const i=hR(n);if(i!==null&&i.trim()){const s=i.trim(),l=e.queue.includes(s)?e.queue:[...e.queue,s];return{kind:"parked",state:{...e,queue:l,draft:""}}}}let r={...e,draft:"",preview:null};return e.preview&&(r={...r,queue:e.queue.filter((i,s)=>s!==e.preview.index),draft:e.preview.stash}),t.running&&!t.promptParked?{kind:"pending",state:{...r,pending:[...r.pending,n]}}:{kind:"send",state:r,text:n}}function zl(e,t){return mg(e,t)}function xR(e){return{state:{...e,pending:[]},texts:e.pending}}function Ry(e,t){return t.length?{...e,pending:[...t,...e.pending]}:e}function wR(e,t){const n=e.pending[t];if(n===void 0)return e;const r=e.pending.filter((s,l)=>l!==t),i=e.draft.trim()?`${e.draft}
42
+
43
+ ${n}`:n;return mg({...e,pending:r},i)}const SR=800;function Ty(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function bR(e){if(Ty(e.local.queue,e.remote.queue)&&Ty(e.local.pending,e.remote.pending))return{kind:"skip"};const t=SR-e.sinceLocalEditMs;return t>0?{kind:"defer",retryInMs:t}:{kind:"apply"}}function Py(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="session_init")return n.sessionId}}function kR(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r.type==="status")return r.state}return t}function CR(e,t,n){US(t,n);const r=Py(e.events),i=Py(t),s=r===i||i===void 0;if(s&&e.events.length>0&&t.length<=e.events.length)return{adopted:!1};const l=new Set(s?e.resolved:[]);for(const c of t){const h=qp(c);h&&l.add(h)}return{adopted:!0,events:t,resolved:l,sameSession:s}}function ER(e){return e?WS(e.events,e.resolved)?"input":e.status==="running"?"thinking":null:null}function NR(e){return e&&(e.flushed||e.empty)?"done":"restore"}const Si=encodeURIComponent,ss=(e,t)=>`/api/projects/${Si(e)}/tasks/${Si(t)}`,er={projects:()=>"/api/projects",task:ss,message:(e,t)=>`${ss(e,t)}/message`,forkMessage:(e,t,n)=>`${ss(e,t)}/forks/${Si(n)}/message`,interrupt:(e,t)=>`${ss(e,t)}/interrupt`,permission:(e,t)=>`${ss(e,t)}/permission`,clarify:(e,t)=>`${ss(e,t)}/clarify`,askQuestion:(e,t)=>`${ss(e,t)}/ask-question`,advanceDecision:(e,t)=>`${ss(e,t)}/advance-decision`,composer:(e,t)=>`/api/projects/${Si(e)}/composer${t!==void 0?`?key=${Si(t)}`:""}`,composerFlush:e=>`/api/projects/${Si(e)}/composer/flush`,composerClaimPending:e=>`/api/projects/${Si(e)}/composer/claim-pending`,asset:(e,t)=>`/api/projects/${Si(e)}/assets/${Si(t)}`};function Fl(...e){return e.map(t=>t.trim()).filter(Boolean).join(" ")}function RR(e){const t=new Int16Array(e.length);for(let i=0;i<e.length;i++){const s=Math.max(-1,Math.min(1,e[i]));t[i]=s<0?s*32768:s*32767}const n=new Uint8Array(t.buffer);let r="";for(let i=0;i<n.length;i++)r+=String.fromCharCode(n[i]);return btoa(r)}function Dy(e){const t=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=e.map(r=>r.trim().toLowerCase()).filter(Boolean).map(r=>r.split(/\s+/).map(t).join("[\\s.,!?]*"));return new RegExp(`(?:^|\\s)[.,!?]*(?:${n.join("|")})[.,!?]*\\s*$`,"i")}const TR=new Set(["thinking","status","session_init"]);function PR(e){let t=e.length-1;for(;t>=0&&e[t].type!=="user_message";t--);if(t<0)return null;let n=!0;for(let r=t+1;r<e.length;r++)TR.has(e[r].type)||(n=!1);return{text:e[t].text??"",onlyThought:n,index:t}}const DR=450;function AR(e){return e.rewindOpen?"ignored":e.sinceLastEscMs<DR?"rewind":e.running?"interrupt":"arm"}function MR(e){var n;if(!e.stoppable)return null;const t=e.pendingCount>0;return!t&&!e.draft.trim()&&((n=e.lastUserTurn)!=null&&n.onlyThought)&&e.lastUserTurn.text?{interrupt:!0,flush:t,restore:e.lastUserTurn.text,hideFromIndex:e.lastUserTurn.index}:{interrupt:!0,flush:t}}const Kp=7e3;function LR(e){return e.auto&&!e.running&&!e.awaitingUser&&e.pendingCount===0&&e.queueLength>0}function OR(e,t){const n=/^\/([\w:-]*)$/.exec(e);if(!n)return[];const r=n[1].toLowerCase();return t.filter(i=>i.name.toLowerCase().startsWith(r)||(i.aliases??[]).some(s=>s.toLowerCase().startsWith(r)))}async function Me(e,t={}){const n=await fetch(e,{...t,headers:{...t.body!=null?{"content-type":"application/json"}:{},...t.headers}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error??n.statusText);return r}const ke={listProjects:()=>Me("/api/projects"),stopAll:()=>Me("/api/stop-all",{method:"POST"}),listDir:e=>Me(`/api/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),openProject:(e,t)=>Me("/api/projects/open",{method:"POST",body:JSON.stringify({path:e,trunk:t})}),updateProject:(e,t)=>Me(`/api/projects/${e}`,{method:"PATCH",body:JSON.stringify(t)}),removeProject:e=>Me(`/api/projects/${e}`,{method:"DELETE"}),getGlobalSettings:()=>Me("/api/settings"),setGlobalSettings:e=>Me("/api/settings",{method:"POST",body:JSON.stringify(e)}),addAccount:(e,t)=>Me("/api/accounts",{method:"POST",body:JSON.stringify({label:e,token:t})}),removeAccount:e=>Me(`/api/accounts/${e}`,{method:"DELETE"}),activateAccount:e=>Me(`/api/accounts/${e}/activate`,{method:"POST"}),getBoard:e=>Me(`/api/projects/${e}/board`),customizePrompt:(e,t,n)=>Me(`/api/projects/${e}/prompts`,{method:"POST",body:JSON.stringify({...t,scope:n})}),setSettings:(e,t)=>Me(`/api/projects/${e}/settings`,{method:"POST",body:JSON.stringify(t)}),startProjectRun:(e,t)=>Me(`/api/projects/${e}/runs/start`,{method:"POST",body:JSON.stringify({configId:t})}),stopProjectRun:(e,t)=>Me(`/api/projects/${e}/runs/${t}/stop`,{method:"POST"}),restartProjectRun:(e,t)=>Me(`/api/projects/${e}/runs/${t}/restart`,{method:"POST"}),removeProjectRun:(e,t)=>Me(`/api/projects/${e}/runs/${t}`,{method:"DELETE"}),getTask:(e,t)=>Me(`/api/projects/${e}/tasks/${t}`),getTaskChanges:(e,t)=>Me(`/api/projects/${e}/tasks/${t}/changes`),getTaskFileDiff:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/diff?path=${encodeURIComponent(n)}`),getTaskMedia:(e,t)=>Me(`/api/projects/${e}/tasks/${t}/media`),createTask:(e,t,n,r,i)=>Me(`/api/projects/${e}/tasks`,{method:"POST",body:JSON.stringify({title:t,shortDescription:n,...r?{toLane:r}:{},...i!=null&&i.kickoff?{kickoff:!0}:{}})}),moveTask:(e,t,n,r,i)=>Me(`/api/projects/${e}/tasks/${t}/move`,{method:"POST",body:JSON.stringify({toLane:n,toOrder:r,...i!=null&&i.trim()?{userNote:i.trim()}:{}})}),sendMessage:(e,t,n)=>Me(er.message(e,t),{method:"POST",body:JSON.stringify({text:n})}),forkSession:(e,t,n,r)=>Me(`/api/projects/${e}/tasks/${t}/fork`,{method:"POST",body:JSON.stringify({sourceKey:n,message:r})}),newSession:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/fork`,{method:"POST",body:JSON.stringify({sourceKey:n,blank:!0})}),sendForkMessage:(e,t,n,r)=>Me(er.forkMessage(e,t,n),{method:"POST",body:JSON.stringify({text:r})}),closeFork:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/forks/${encodeURIComponent(n)}`,{method:"DELETE"}),renameFork:(e,t,n,r)=>Me(`/api/projects/${e}/tasks/${t}/forks/${encodeURIComponent(n)}/rename`,{method:"POST",body:JSON.stringify({name:r})}),orchestratorMessage:(e,t)=>Me(`/api/projects/${e}/orchestrator/message`,{method:"POST",body:JSON.stringify({text:t})}),forkOrchestrator:(e,t,n)=>Me(`/api/projects/${e}/orchestrator/fork`,{method:"POST",body:JSON.stringify({sourceKey:t,message:n})}),newOrchestratorSession:(e,t)=>Me(`/api/projects/${e}/orchestrator/fork`,{method:"POST",body:JSON.stringify({sourceKey:t,blank:!0})}),sendOrchestratorForkMessage:(e,t,n)=>Me(`/api/projects/${e}/orchestrator/forks/${encodeURIComponent(t)}/message`,{method:"POST",body:JSON.stringify({text:n})}),closeOrchestratorFork:(e,t)=>Me(`/api/projects/${e}/orchestrator/forks/${encodeURIComponent(t)}`,{method:"DELETE"}),renameOrchestratorFork:(e,t,n)=>Me(`/api/projects/${e}/orchestrator/forks/${encodeURIComponent(t)}/rename`,{method:"POST",body:JSON.stringify({name:n})}),setControls:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/controls`,{method:"POST",body:JSON.stringify(n)}),interrupt:(e,t)=>Me(er.interrupt(e,t),{method:"POST"}),listCheckpoints:(e,t)=>Me(`/api/projects/${e}/tasks/${t}/checkpoints`),rewind:(e,t,n,r,i)=>Me(`/api/projects/${e}/tasks/${t}/rewind`,{method:"POST",body:JSON.stringify({toUuid:n,preview:r,index:i})}),deleteTask:(e,t)=>Me(`/api/projects/${e}/tasks/${t}`,{method:"DELETE"}),resolvePermission:(e,t,n,r)=>Me(er.permission(e,t),{method:"POST",body:JSON.stringify({requestId:n,decision:r})}),answerClarification:(e,t,n,r)=>Me(er.clarify(e,t),{method:"POST",body:JSON.stringify({requestId:n,answer:r})}),answerAskQuestion:(e,t,n,r)=>Me(er.askQuestion(e,t),{method:"POST",body:JSON.stringify({requestId:n,answers:r??void 0})}),decideAdvance:(e,t,n,r,i)=>Me(er.advanceDecision(e,t),{method:"POST",body:JSON.stringify({requestId:n,accept:r,toLane:i})}),stopRun:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/runs/${n}/stop`,{method:"POST"}),restartRun:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/runs/${n}/restart`,{method:"POST"}),sendRunFeedback:(e,t,n,r)=>Me(`/api/projects/${e}/tasks/${t}/runs/${n}/feedback`,{method:"POST",body:JSON.stringify({text:r})}),renameRun:(e,t,n,r)=>Me(`/api/projects/${e}/tasks/${t}/runs/${n}/rename`,{method:"POST",body:JSON.stringify({name:r})}),removeRun:(e,t,n)=>Me(`/api/projects/${e}/tasks/${t}/runs/${n}`,{method:"DELETE"}),ensureCodeServer:()=>Me("/api/code-server/ensure",{method:"POST"}),getComposer:(e,t)=>Me(er.composer(e,t)),saveComposer:(e,t,n,r,i)=>Me(er.composer(e),{method:"PUT",body:JSON.stringify({key:t,draft:n,queue:r,pending:i})}),claimPending:(e,t)=>Me(er.composerClaimPending(e),{method:"POST",body:JSON.stringify({key:t})}),flushComposer:(e,t)=>Me(er.composerFlush(e),{method:"POST",body:JSON.stringify({key:t})})};function $f(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"project"}function qS(e){const t=new Map;for(const r of[...e].sort((i,s)=>i.path<s.path?-1:i.path>s.path?1:0)){const i=$f(r.name),s=t.get(i)??[];s.push(r),t.set(i,s)}const n=new Map;for(const r of t.values())r.forEach((i,s)=>n.set(i.id,s===0?$f(i.name):`${$f(i.name)}-${s+1}`));return n}function gg(e,t){return qS(e).get(t)}function jR(e,t){const n=qS(e);return e.find(r=>n.get(r.id)===t)}function KS(e=window.location.pathname){const t=e.split("/").filter(Boolean).map(decodeURIComponent);return{projectSlug:t[0],taskId:t[1]}}function IR(e,t){if(!e)return"/";const n=encodeURIComponent(e);return t?`/${n}/${encodeURIComponent(t)}`:`/${n}`}let Yp=!1;async function BR(e){Yp=!0;try{return await e()}finally{Yp=!1}}function eh(e,t){if(Yp)return;const n=IR(e,t);n!==window.location.pathname&&window.history.pushState(null,"",n)}function zR(e){const t=()=>e(KS());return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)}class FR{constructor(){Lf(this,"lastSeq",new Map);Lf(this,"buffering",new Map)}beginSubscribe(t){return this.buffering.set(t,[]),this.lastSeq.get(t)}onAgent(t,n){const r=this.buffering.get(t);return r?(r.push(n),"buffered"):this.accept(t,n)?"deliver":"dropped"}onHistory(t,n){const r=this.lastSeq.get(t),i=!!n.incremental&&n.lastSeq!==void 0&&r!==void 0&&n.lastSeq<=r;n.lastSeq!==void 0?this.lastSeq.set(t,n.incremental?Math.max(r??0,n.lastSeq):n.lastSeq):this.lastSeq.delete(t);const s=this.buffering.get(t)??[];this.buffering.delete(t);const l=s.filter(c=>this.accept(t,c));return{mode:n.incremental?"append":"replace",flushed:l,apply:!i}}forget(t){this.lastSeq.delete(t),this.buffering.delete(t)}accept(t,n){if(n.seq===void 0)return!0;const r=this.lastSeq.get(t);if(r!==void 0&&n.seq<r)return!1;const i=new TextEncoder().encode(JSON.stringify(n.event)).length+1;return this.lastSeq.set(t,n.seq+i),!0}}const Tu=new FR;let Ei=null;const oa=new Set,la=[],$R=200,YS=new Set(["run_command","kill_command","dictation_start","dictation_audio","dictation_stop","subscribe_run","unsubscribe_run","subscribe_agent","subscribe_project"]),XS=500,HR=15e3;let Qc=XS;const ZS=new Set,aa=new Set;let $s=null,Xp=null;const Zp=new Set;function GS(){if(Ei)return;const e=location.protocol==="https:"?"wss":"ws",t=new WebSocket(`${e}://${location.host}/ws`);Ei=t,t.onopen=()=>{Qc=XS,Xp&&t.send(JSON.stringify({kind:"subscribe_project",projectId:Xp})),aa.clear();for(const n of ZS){const r=Tu.beginSubscribe(n);aa.add(n),t.send(JSON.stringify({kind:"subscribe_agent",taskId:n,afterSeq:r}))}$s&&t.send(JSON.stringify({kind:"subscribe_run",...$s}));for(const n of la)YS.has(n.kind)||t.send(JSON.stringify(n));la.length=0;for(const n of Zp)n()},t.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r.kind==="agent"){if(Tu.onAgent(r.taskId,{event:r.event,seq:r.seq})!=="deliver")return}else if(r.kind==="agent_history"){const{flushed:i,apply:s}=Tu.onHistory(r.taskId,r);if(s)for(const l of oa)l(r);for(const l of i){const c={kind:"agent",taskId:r.taskId,event:l.event,seq:l.seq};for(const h of oa)h(c)}return}for(const i of oa)i(r)},t.onclose=()=>{Ei=null,aa.clear();const n=Math.random()*Qc;Qc=Math.min(Qc*2,HR),setTimeout(GS,n)}}function Ti(e){if(Ei&&Ei.readyState===WebSocket.OPEN){Ei.send(JSON.stringify(e));return}YS.has(e.kind)||(la.push(e),la.length>$R&&la.shift())}function wa(e){ZS.add(e),!aa.has(e)&&(Ei==null?void 0:Ei.readyState)===WebSocket.OPEN&&(aa.add(e),Ti({kind:"subscribe_agent",taskId:e,afterSeq:Tu.beginSubscribe(e)}))}function WR(e,t){$s={taskId:e,runId:t},Ti({kind:"subscribe_run",taskId:e,runId:t})}function UR(e,t){($s==null?void 0:$s.runId)===t&&($s=null),Ti({kind:"unsubscribe_run",taskId:e,runId:t})}function JS(e){Xp=e,Ti({kind:"subscribe_project",projectId:e})}function Eh(e){return oa.add(e),()=>oa.delete(e)}function Nh(e){return Zp.add(e),()=>Zp.delete(e)}const eu=()=>({events:[],resolved:new Set,status:"none",commands:[]}),Ay=2e3,Sa=50;function Pu(e,t){return!!(e.selectedTaskId&&(t===e.selectedTaskId||t.startsWith(`${e.selectedTaskId}::fork::`))||e.orchestratorOpen&&e.project&&t===IS(e.project.id))}function QS(e){return e.length>Sa?e.slice(-Sa):e}function My(e){let t=!1;const n={};for(const[r,i]of Object.entries(e.agents))!Pu(e,r)&&i.events.length>Sa?(n[r]={...i,events:QS(i.events)},t=!0):n[r]=i;return t?n:void 0}const ue=uN(e=>({projects:[],orchestratorOpen:!1,codeServerOpen:!1,agents:{},suppressed:{},usageLimits:(()=>{try{const t=localStorage.getItem("operator:usageLimits");return t?JSON.parse(t):[]}catch{return[]}})(),usageHistory:[],previewModal:null,toast:null,folds:{},foldPulse:{},setProjects:t=>e({projects:t}),setProject:t=>e({project:t}),clearProject:()=>{eh(void 0),e({project:void 0,board:void 0,selectedTaskId:void 0,codeServerOpen:!1,agents:{},suppressed:{}})},setBoard:t=>e(n=>{var s;const r=(s=n.board)==null?void 0:s.revision,i=t.revision;return n.board&&n.board.project.id===t.project.id&&r!==void 0&&i!==void 0&&i<r?n:{board:t}}),select:t=>e(n=>{const r=n.project?gg(n.projects,n.project.id):void 0;eh(r,t);const i=My({...n,selectedTaskId:t,orchestratorOpen:!1}),s=t?n.codeServerOpen:!1;return{selectedTaskId:t,orchestratorOpen:!1,codeServerOpen:s,...i?{agents:i}:{}}}),setOrchestratorOpen:t=>e(n=>{const r=My({...n,orchestratorOpen:t});return{orchestratorOpen:t,...r?{agents:r}:{}}}),setCodeServerOpen:t=>e({codeServerOpen:t}),setAgentHistory:(t,n,r)=>e(i=>{const s=i.agents[t]??eu(),l=CR(s,n,r);if(!l.adopted)return i;const c=kR(n,s.status),h=Pu(i,t)?l.events:QS(l.events);return{agents:{...i.agents,[t]:{events:h,resolved:l.resolved,status:c,commands:s.commands,composerSync:s.composerSync}}}}),appendAgentHistory:(t,n,r)=>e(i=>{if(!n.length)return i;US(n,r);const s=i.agents[t]??eu(),l=[...s.events,...n],c=Pu(i,t)?Ay:Sa,h=l.length>c?l.slice(-c):l;let u=s.status;for(const f of n)f.type==="status"&&(u=f.state);const p=new Set(s.resolved);for(const f of n){const v=qp(f);v&&p.add(v)}return{agents:{...i.agents,[t]:{events:h,resolved:p,status:u,commands:s.commands,composerSync:s.composerSync}}}}),pushAgent:(t,n,r)=>e(i=>{var v;const s=i.agents[t]??eu();if(n.type==="slash_commands")return{agents:{...i.agents,[t]:{...s,commands:n.commands}}};if(n.type==="composer_state"){const _=(((v=s.composerSync)==null?void 0:v.rev)??0)+1;return{agents:{...i.agents,[t]:{...s,composerSync:{queue:n.queue,pending:n.pending,rev:_}}}}}cR(n,r);const l=[...s.events,n],c=Pu(i,t)?Ay:Sa,h=l.length>c?l.slice(-c):l,u=qp(n),p=u?new Set([...s.resolved,u]):s.resolved,f={events:h,resolved:p,status:n.type==="status"?n.state:s.status,commands:s.commands};return{agents:{...i.agents,[t]:f}}}),markResolved:(t,n)=>e(r=>{const i=r.agents[t]??eu(),s=new Set(i.resolved);return s.add(n),{agents:{...r.agents,[t]:{...i,resolved:s}}}}),suppressPrompt:(t,n)=>e(r=>{const i=new Set(r.suppressed[t]??[]);return i.add(n),{suppressed:{...r.suppressed,[t]:i}}}),setUsageLimits:t=>{try{localStorage.setItem("operator:usageLimits",JSON.stringify(t))}catch{}e({usageLimits:t})},setUsageHistory:t=>e({usageHistory:t}),setSystemMetrics:t=>e({systemMetrics:t}),openPreviewModal:(t,n,r)=>e({previewModal:{kind:"url",url:t,taskName:n,taskId:r}}),openMockupModal:(t,n,r)=>e({previewModal:{kind:"mockup",mockup:t,taskName:n,taskId:r}}),closePreviewModal:()=>e({previewModal:null}),showToast:t=>e({toast:t}),clearToast:()=>e({toast:null}),beginFold:(t,n,r)=>e(i=>{var h;const s=(h=i.board)==null?void 0:h.tasks.find(u=>u.id===t);if(!s)return{};const l=s.title||s.shortDescription||"Untitled",c={...i.foldPulse};for(const u of n)c[u]=!0;return{folds:{...i.folds,[t]:{title:l,into:n,label:r}},foldPulse:c}}),clearFold:t=>e(n=>{const r=n.folds[t];if(!r)return{};const i={...n.folds};delete i[t];const s={...n.foldPulse};for(const l of r.into)Object.values(i).some(c=>c.into.includes(l))||delete s[l];return{folds:i,foldPulse:s}})}));function Rh(e){return ER(e)}function VR(e){let t=0,n=0;for(const r of e)r.type==="usage"&&(t+=(r.inputTokens??0)+(r.cacheReadTokens??0)+(r.cacheCreationTokens??0),n+=r.outputTokens??0);return{input:t,output:n,total:t+n}}function qR(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}async function vg(e){const{setProject:t,setBoard:n,setProjects:r}=ue.getState(),i=await ke.openProject(e.trim());t(i.project),JS(i.project.id),n(i.board);const s=await ke.listProjects();r(s.projects),eh(gg(s.projects,i.project.id))}async function Th(e){const{projects:t,setProject:n,setBoard:r}=ue.getState(),i=t.find(l=>l.id===e);if(!i)return;eh(gg(t,e)),ue.setState({selectedTaskId:void 0}),n(i),JS(e);const s=await ke.getBoard(e);r(s.board),n(s.board.project)}function Ly(e){return BR(async()=>{const{project:t,projects:n}=ue.getState(),r=e.projectSlug?jR(n,e.projectSlug):void 0;if(!r){t&&ue.getState().clearProject();return}r.id!==(t==null?void 0:t.id)&&await Th(r.id),ue.getState().select(e.taskId)})}async function KR(){const{project:e,setBoard:t,setProject:n}=ue.getState();if(!e)return;const r=await ke.getBoard(e.id),i=ue.getState().project;!i||i.id!==r.board.project.id||(t(r.board),n(r.board.project))}const Gp="operator:soundOnInput",eb="operator:soundType",tb=[{id:"double-beep",label:"Double beep"},{id:"single-beep",label:"Single beep"},{id:"chime",label:"Chime"},{id:"triple-beep",label:"Triple beep"}];function nb(){try{return localStorage.getItem(Gp)==="true"}catch{return!1}}function YR(e){try{e?localStorage.setItem(Gp,"true"):localStorage.removeItem(Gp)}catch{}}function rb(){try{const e=localStorage.getItem(eb);if(e&&tb.some(t=>t.id===e))return e}catch{}return"double-beep"}function XR(e){try{localStorage.setItem(eb,e)}catch{}}function tu(e,t,n,r=.12){for(let i=0;i<n.length;i++){const s=e.createOscillator(),l=e.createGain();s.connect(l),l.connect(e.destination),s.frequency.value=t[i]??t[t.length-1],s.type="sine";const c=e.currentTime+n[i];l.gain.setValueAtTime(0,c),l.gain.linearRampToValueAtTime(.18,c+.01),l.gain.linearRampToValueAtTime(0,c+r),s.start(c),s.stop(c+r+.01)}}function Jp(e){try{const t=new AudioContext;switch(e){case"single-beep":tu(t,[880],[0]),setTimeout(()=>t.close(),400);break;case"double-beep":tu(t,[880],[0,.18]),setTimeout(()=>t.close(),700);break;case"triple-beep":tu(t,[880],[0,.18,.36]),setTimeout(()=>t.close(),900);break;case"chime":tu(t,[523,659,784],[0,.18,.36],.2),setTimeout(()=>t.close(),900);break}}catch{}}function ZR(){Jp(rb())}function GR(e){var n,r;const t=ue.getState();switch(e.kind){case"board":((n=t.project)==null?void 0:n.id)===e.board.project.id&&(t.setBoard(e.board),t.setProject(e.board.project));break;case"agent_history":e.incremental?t.appendAgentHistory(e.taskId,e.events,e.lastSeq):t.setAgentHistory(e.taskId,e.events,e.lastSeq);break;case"agent":t.pushAgent(e.taskId,e.event,e.seq),nb()&&fg(e.event)&&ZR();break;case"usage_limit":t.setUsageLimits(e.limits);break;case"usage_history":t.setUsageHistory(e.samples);break;case"system_metrics":t.setSystemMetrics(e.metrics);break;case"task_folded":((r=t.project)==null?void 0:r.id)===e.projectId&&t.beginFold(e.from,e.into,e.label);break}}var Or=NS();function ms(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Oy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function JR(...e){return t=>{let n=!1;const r=e.map(i=>{const s=Oy(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():Oy(e[i],null)}}}}function xs(...e){return b.useCallback(JR(...e),e)}function ib(e,t=[]){let n=[];function r(s,l){const c=b.createContext(l);c.displayName=s+"Context";const h=n.length;n=[...n,l];const u=f=>{var C;const{scope:v,children:_,...x}=f,S=((C=v==null?void 0:v[e])==null?void 0:C[h])||c,k=b.useMemo(()=>x,Object.values(x));return g.jsx(S.Provider,{value:k,children:_})};u.displayName=s+"Provider";function p(f,v){var S;const _=((S=v==null?void 0:v[e])==null?void 0:S[h])||c,x=b.useContext(_);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,p]}const i=()=>{const s=n.map(l=>b.createContext(l));return function(c){const h=(c==null?void 0:c[e])||s;return b.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])}};return i.scopeName=e,[r,QR(i,...t)]}function QR(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const l=r.reduce((c,{useScope:h,scopeName:u})=>{const f=h(s)[`__scope${u}`];return{...c,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function sb(e){const t=b.forwardRef((n,r)=>{let{children:i,...s}=n,l=null,c=!1;const h=[];jy(i)&&typeof nu=="function"&&(i=nu(i._payload)),b.Children.forEach(i,v=>{var _;if(iT(v)){c=!0;const x=v;let S="child"in x.props?x.props.child:x.props.children;jy(S)&&typeof nu=="function"&&(S=nu(S._payload)),l=tT(x,S),h.push((_=l==null?void 0:l.props)==null?void 0:_.children)}else h.push(v)}),l?l=b.cloneElement(l,void 0,h):!c&&b.Children.count(i)===1&&b.isValidElement(i)&&(l=i);const u=l?rT(l):void 0,p=xs(r,u);if(!l){if(i||i===0)throw new Error(c?aT(e):lT(e));return i}const f=nT(s,l.props??{});return l.type!==b.Fragment&&(f.ref=r?p:u),b.cloneElement(l,f)});return t.displayName=`${e}.Slot`,t}var eT=Symbol.for("radix.slottable"),tT=(e,t)=>{if("child"in e.props){const n=e.props.child;return b.isValidElement(n)?b.cloneElement(n,void 0,e.props.children(n.props.children)):null}return b.isValidElement(t)?t:null};function nT(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...c)=>{const h=s(...c);return i(...c),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function rT(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function iT(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eT}var sT=Symbol.for("react.lazy");function jy(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===sT&&"_payload"in e&&oT(e._payload)}function oT(e){return typeof e=="object"&&e!==null&&"then"in e}var lT=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,aT=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,nu=og[" use ".trim().toString()],cT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mi=cT.reduce((e,t)=>{const n=sb(`Primitive.${t}`),r=b.forwardRef((i,s)=>{const{asChild:l,...c}=i,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function uT(e,t){e&&Or.flushSync(()=>e.dispatchEvent(t))}function $o(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function hT(e,t=globalThis==null?void 0:globalThis.document){const n=$o(e);b.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var dT="DismissableLayer",Qp="dismissableLayer.update",fT="dismissableLayer.pointerDownOutside",pT="dismissableLayer.focusOutside",Iy,ob=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lb=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...h}=e,u=b.useContext(ob),[p,f]=b.useState(null),v=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=b.useState({}),x=xs(t,D=>f(D)),S=Array.from(u.layers),[k]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(k),T=p?S.indexOf(p):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,M=T>=C,B=vT(D=>{const $=D.target,j=[...u.branches].some(R=>R.contains($));!M||j||(i==null||i(D),l==null||l(D),D.defaultPrevented||c==null||c())},v),A=_T(D=>{const $=D.target;[...u.branches].some(R=>R.contains($))||(s==null||s(D),l==null||l(D),D.defaultPrevented||c==null||c())},v);return hT(D=>{T===u.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},v),b.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Iy=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),By(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(p),u.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=Iy))}},[p,v,n,u]),b.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),By())},[p,u]),b.useEffect(()=>{const D=()=>_({});return document.addEventListener(Qp,D),()=>document.removeEventListener(Qp,D)},[]),g.jsx(Mi.div,{...h,ref:x,style:{pointerEvents:N?M?"auto":"none":void 0,...e.style},onFocusCapture:ms(e.onFocusCapture,A.onFocusCapture),onBlurCapture:ms(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ms(e.onPointerDownCapture,B.onPointerDownCapture)})});lb.displayName=dT;var mT="DismissableLayerBranch",gT=b.forwardRef((e,t)=>{const n=b.useContext(ob),r=b.useRef(null),i=xs(t,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(Mi.div,{...e,ref:i})});gT.displayName=mT;function vT(e,t=globalThis==null?void 0:globalThis.document){const n=$o(e),r=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let h=function(){ab(fT,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function _T(e,t=globalThis==null?void 0:globalThis.document){const n=$o(e),r=b.useRef(!1);return b.useEffect(()=>{const i=s=>{s.target&&!r.current&&ab(pT,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function By(){const e=new CustomEvent(Qp);document.dispatchEvent(e)}function ab(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?uT(i,s):i.dispatchEvent(s)}var ru=0,Yr=null;function yT(){b.useEffect(()=>{Yr||(Yr={start:zy(),end:zy()});const{start:e,end:t}=Yr;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ru++,()=>{ru===1&&(Yr==null||Yr.start.remove(),Yr==null||Yr.end.remove(),Yr=null),ru=Math.max(0,ru-1)}},[])}function zy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hf="focusScope.autoFocusOnMount",Wf="focusScope.autoFocusOnUnmount",Fy={bubbles:!1,cancelable:!0},xT="FocusScope",cb=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=e,[c,h]=b.useState(null),u=$o(i),p=$o(s),f=b.useRef(null),v=xs(t,S=>h(S)),_=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let S=function(N){if(_.paused||!c)return;const M=N.target;c.contains(M)?f.current=M:us(f.current,{select:!0})},k=function(N){if(_.paused||!c)return;const M=N.relatedTarget;M!==null&&(c.contains(M)||us(f.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const B of N)B.removedNodes.length>0&&us(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",k);const T=new MutationObserver(C);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",k),T.disconnect()}}},[r,c,_.paused]),b.useEffect(()=>{if(c){Hy.add(_);const S=document.activeElement;if(!c.contains(S)){const C=new CustomEvent(Hf,Fy);c.addEventListener(Hf,u),c.dispatchEvent(C),C.defaultPrevented||(wT(ET(ub(c)),{select:!0}),document.activeElement===S&&us(c))}return()=>{c.removeEventListener(Hf,u),setTimeout(()=>{const C=new CustomEvent(Wf,Fy);c.addEventListener(Wf,p),c.dispatchEvent(C),C.defaultPrevented||us(S??document.body,{select:!0}),c.removeEventListener(Wf,p),Hy.remove(_)},0)}}},[c,u,p,_]);const x=b.useCallback(S=>{if(!n&&!r||_.paused)return;const k=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(k&&C){const T=S.currentTarget,[N,M]=ST(T);N&&M?!S.shiftKey&&C===M?(S.preventDefault(),n&&us(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),n&&us(M,{select:!0})):C===T&&S.preventDefault()}},[n,r,_.paused]);return g.jsx(Mi.div,{tabIndex:-1,...l,ref:v,onKeyDown:x})});cb.displayName=xT;function wT(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(us(r,{select:t}),document.activeElement!==n)return}function ST(e){const t=ub(e),n=$y(t,e),r=$y(t.reverse(),e);return[n,r]}function ub(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $y(e,t){for(const n of e)if(!bT(n,{upTo:t}))return n}function bT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function kT(e){return e instanceof HTMLInputElement&&"select"in e}function us(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&kT(e)&&t&&e.select()}}var Hy=CT();function CT(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Wy(e,t),e.unshift(t)},remove(t){var n;e=Wy(e,t),(n=e[0])==null||n.resume()}}}function Wy(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ET(e){return e.filter(t=>t.tagName!=="A")}var Ni=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},NT=og[" useId ".trim().toString()]||(()=>{}),RT=0;function TT(e){const[t,n]=b.useState(NT());return Ni(()=>{n(r=>r??String(RT++))},[e]),e||(t?`radix-${t}`:"")}const PT=["top","right","bottom","left"],_s=Math.min,tr=Math.max,th=Math.round,iu=Math.floor,ri=e=>({x:e,y:e}),DT={left:"right",right:"left",bottom:"top",top:"bottom"};function em(e,t,n){return tr(e,_s(t,n))}function Pi(e,t){return typeof e=="function"?e(t):e}function Di(e){return e.split("-")[0]}function Ko(e){return e.split("-")[1]}function _g(e){return e==="x"?"y":"x"}function yg(e){return e==="y"?"height":"width"}function ei(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function xg(e){return _g(ei(e))}function AT(e,t,n){n===void 0&&(n=!1);const r=Ko(e),i=xg(e),s=yg(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=nh(l)),[l,nh(l)]}function MT(e){const t=nh(e);return[tm(e),t,tm(t)]}function tm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Uy=["left","right"],Vy=["right","left"],LT=["top","bottom"],OT=["bottom","top"];function jT(e,t,n){switch(e){case"top":case"bottom":return n?t?Vy:Uy:t?Uy:Vy;case"left":case"right":return t?LT:OT;default:return[]}}function IT(e,t,n,r){const i=Ko(e);let s=jT(Di(e),n==="start",r);return i&&(s=s.map(l=>l+"-"+i),t&&(s=s.concat(s.map(tm)))),s}function nh(e){const t=Di(e);return DT[t]+e.slice(t.length)}function BT(e){return{top:0,right:0,bottom:0,left:0,...e}}function hb(e){return typeof e!="number"?BT(e):{top:e,right:e,bottom:e,left:e}}function rh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function qy(e,t,n){let{reference:r,floating:i}=e;const s=ei(t),l=xg(t),c=yg(l),h=Di(t),u=s==="y",p=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,v=r[c]/2-i[c]/2;let _;switch(h){case"top":_={x:p,y:r.y-i.height};break;case"bottom":_={x:p,y:r.y+r.height};break;case"right":_={x:r.x+r.width,y:f};break;case"left":_={x:r.x-i.width,y:f};break;default:_={x:r.x,y:r.y}}switch(Ko(t)){case"start":_[l]-=v*(n&&u?-1:1);break;case"end":_[l]+=v*(n&&u?-1:1);break}return _}async function zT(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:l,elements:c,strategy:h}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:v=!1,padding:_=0}=Pi(t,e),x=hb(_),k=c[v?f==="floating"?"reference":"floating":f],C=rh(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(k)))==null||n?k:k.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:p,strategy:h})),T=f==="floating"?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),M=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},B=rh(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:N,strategy:h}):T);return{top:(C.top-B.top+x.top)/M.y,bottom:(B.bottom-C.bottom+x.bottom)/M.y,left:(C.left-B.left+x.left)/M.x,right:(B.right-C.right+x.right)/M.x}}const FT=50,$T=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:zT},h=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:f}=qy(u,r,h),v=r,_=0;const x={};for(let S=0;S<s.length;S++){const k=s[S];if(!k)continue;const{name:C,fn:T}=k,{x:N,y:M,data:B,reset:A}=await T({x:p,y:f,initialPlacement:r,placement:v,strategy:i,middlewareData:x,rects:u,platform:c,elements:{reference:e,floating:t}});p=N??p,f=M??f,x[C]={...x[C],...B},A&&_<FT&&(_++,typeof A=="object"&&(A.placement&&(v=A.placement),A.rects&&(u=A.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:p,y:f}=qy(u,v,h)),S=-1)}return{x:p,y:f,placement:v,strategy:i,middlewareData:x}},HT=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:l,elements:c,middlewareData:h}=t,{element:u,padding:p=0}=Pi(e,t)||{};if(u==null)return{};const f=hb(p),v={x:n,y:r},_=xg(i),x=yg(_),S=await l.getDimensions(u),k=_==="y",C=k?"top":"left",T=k?"bottom":"right",N=k?"clientHeight":"clientWidth",M=s.reference[x]+s.reference[_]-v[_]-s.floating[x],B=v[_]-s.reference[_],A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let D=A?A[N]:0;(!D||!await(l.isElement==null?void 0:l.isElement(A)))&&(D=c.floating[N]||s.floating[x]);const $=M/2-B/2,j=D/2-S[x]/2-1,R=_s(f[C],j),U=_s(f[T],j),V=R,Y=D-S[x]-U,W=D/2-S[x]/2+$,q=em(V,W,Y),z=!h.arrow&&Ko(i)!=null&&W!==q&&s.reference[x]/2-(W<V?R:U)-S[x]/2<0,J=z?W<V?W-V:W-Y:0;return{[_]:v[_]+J,data:{[_]:q,centerOffset:W-q-J,...z&&{alignmentOffset:J}},reset:z}}}),WT=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:l,initialPlacement:c,platform:h,elements:u}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:v,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...k}=Pi(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Di(i),T=ei(c),N=Di(c)===c,M=await(h.isRTL==null?void 0:h.isRTL(u.floating)),B=v||(N||!S?[nh(c)]:MT(c)),A=x!=="none";!v&&A&&B.push(...IT(c,S,x,M));const D=[c,...B],$=await h.detectOverflow(t,k),j=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&j.push($[C]),f){const W=AT(i,l,M);j.push($[W[0]],$[W[1]])}if(R=[...R,{placement:i,overflows:j}],!j.every(W=>W<=0)){var U,V;const W=(((U=s.flip)==null?void 0:U.index)||0)+1,q=D[W];if(q&&(!(f==="alignment"?T!==ei(q):!1)||R.every(I=>ei(I.placement)===T?I.overflows[0]>0:!0)))return{data:{index:W,overflows:R},reset:{placement:q}};let z=(V=R.filter(J=>J.overflows[0]<=0).sort((J,I)=>J.overflows[1]-I.overflows[1])[0])==null?void 0:V.placement;if(!z)switch(_){case"bestFit":{var Y;const J=(Y=R.filter(I=>{if(A){const re=ei(I.placement);return re===T||re==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(re=>re>0).reduce((re,P)=>re+P,0)]).sort((I,re)=>I[1]-re[1])[0])==null?void 0:Y[0];J&&(z=J);break}case"initialPlacement":z=c;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Ky(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yy(e){return PT.some(t=>e[t]>=0)}const UT=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Pi(e,t);switch(i){case"referenceHidden":{const l=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Ky(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Yy(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Ky(l,n.floating);return{data:{escapedOffsets:c,escaped:Yy(c)}}}default:return{}}}}},db=new Set(["left","top"]);async function VT(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=Di(n),c=Ko(n),h=ei(n)==="y",u=db.has(l)?-1:1,p=s&&h?-1:1,f=Pi(t,e);let{mainAxis:v,crossAxis:_,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof x=="number"&&(_=c==="end"?x*-1:x),h?{x:_*p,y:v*u}:{x:v*u,y:_*p}}const qT=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:l,middlewareData:c}=t,h=await VT(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+h.x,y:s+h.y,data:{...h,placement:l}}}}},KT=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:C=>{let{x:T,y:N}=C;return{x:T,y:N}}},...u}=Pi(e,t),p={x:n,y:r},f=await s.detectOverflow(t,u),v=ei(Di(i)),_=_g(v);let x=p[_],S=p[v];if(l){const C=_==="y"?"top":"left",T=_==="y"?"bottom":"right",N=x+f[C],M=x-f[T];x=em(N,x,M)}if(c){const C=v==="y"?"top":"left",T=v==="y"?"bottom":"right",N=S+f[C],M=S-f[T];S=em(N,S,M)}const k=h.fn({...t,[_]:x,[v]:S});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[_]:l,[v]:c}}}}}},YT=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:h=!0,crossAxis:u=!0}=Pi(e,t),p={x:n,y:r},f=ei(i),v=_g(f);let _=p[v],x=p[f];const S=Pi(c,t),k=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const N=v==="y"?"height":"width",M=s.reference[v]-s.floating[N]+k.mainAxis,B=s.reference[v]+s.reference[N]-k.mainAxis;_<M?_=M:_>B&&(_=B)}if(u){var C,T;const N=v==="y"?"width":"height",M=db.has(Di(i)),B=s.reference[f]-s.floating[N]+(M&&((C=l.offset)==null?void 0:C[f])||0)+(M?0:k.crossAxis),A=s.reference[f]+s.reference[N]+(M?0:((T=l.offset)==null?void 0:T[f])||0)-(M?k.crossAxis:0);x<B?x=B:x>A&&(x=A)}return{[v]:_,[f]:x}}}},XT=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:l,elements:c}=t,{apply:h=()=>{},...u}=Pi(e,t),p=await l.detectOverflow(t,u),f=Di(i),v=Ko(i),_=ei(i)==="y",{width:x,height:S}=s.floating;let k,C;f==="top"||f==="bottom"?(k=f,C=v===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(C=f,k=v==="end"?"top":"bottom");const T=S-p.top-p.bottom,N=x-p.left-p.right,M=_s(S-p[k],T),B=_s(x-p[C],N),A=!t.middlewareData.shift;let D=M,$=B;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!v){const R=tr(p.left,0),U=tr(p.right,0),V=tr(p.top,0),Y=tr(p.bottom,0);_?$=x-2*(R!==0||U!==0?R+U:tr(p.left,p.right)):D=S-2*(V!==0||Y!==0?V+Y:tr(p.top,p.bottom))}await h({...t,availableWidth:$,availableHeight:D});const j=await l.getDimensions(c.floating);return x!==j.width||S!==j.height?{reset:{rects:!0}}:{}}}};function Ph(){return typeof window<"u"}function Yo(e){return fb(e)?(e.nodeName||"").toLowerCase():"#document"}function ir(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ai(e){var t;return(t=(fb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fb(e){return Ph()?e instanceof Node||e instanceof ir(e).Node:!1}function Ir(e){return Ph()?e instanceof Element||e instanceof ir(e).Element:!1}function Li(e){return Ph()?e instanceof HTMLElement||e instanceof ir(e).HTMLElement:!1}function Xy(e){return!Ph()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ir(e).ShadowRoot}function La(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Br(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function ZT(e){return/^(table|td|th)$/.test(Yo(e))}function Dh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const GT=/transform|translate|scale|rotate|perspective|filter/,JT=/paint|layout|strict|content/,js=e=>!!e&&e!=="none";let Uf;function wg(e){const t=Ir(e)?Br(e):e;return js(t.transform)||js(t.translate)||js(t.scale)||js(t.rotate)||js(t.perspective)||!Sg()&&(js(t.backdropFilter)||js(t.filter))||GT.test(t.willChange||"")||JT.test(t.contain||"")}function QT(e){let t=ys(e);for(;Li(t)&&!Ho(t);){if(wg(t))return t;if(Dh(t))return null;t=ys(t)}return null}function Sg(){return Uf==null&&(Uf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Uf}function Ho(e){return/^(html|body|#document)$/.test(Yo(e))}function Br(e){return ir(e).getComputedStyle(e)}function Ah(e){return Ir(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ys(e){if(Yo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xy(e)&&e.host||ai(e);return Xy(t)?t.host:t}function pb(e){const t=ys(e);return Ho(t)?e.ownerDocument?e.ownerDocument.body:e.body:Li(t)&&La(t)?t:pb(t)}function ba(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=pb(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),l=ir(i);if(s){const c=nm(l);return t.concat(l,l.visualViewport||[],La(i)?i:[],c&&n?ba(c):[])}else return t.concat(i,ba(i,[],n))}function nm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mb(e){const t=Br(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Li(e),s=i?e.offsetWidth:n,l=i?e.offsetHeight:r,c=th(n)!==s||th(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function bg(e){return Ir(e)?e:e.contextElement}function Oo(e){const t=bg(e);if(!Li(t))return ri(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=mb(t);let l=(s?th(n.width):n.width)/r,c=(s?th(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const eP=ri(0);function gb(e){const t=ir(e);return!Sg()||!t.visualViewport?eP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tP(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ir(e)?!1:t}function Xs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=bg(e);let l=ri(1);t&&(r?Ir(r)&&(l=Oo(r)):l=Oo(e));const c=tP(s,n,r)?gb(s):ri(0);let h=(i.left+c.x)/l.x,u=(i.top+c.y)/l.y,p=i.width/l.x,f=i.height/l.y;if(s){const v=ir(s),_=r&&Ir(r)?ir(r):r;let x=v,S=nm(x);for(;S&&r&&_!==x;){const k=Oo(S),C=S.getBoundingClientRect(),T=Br(S),N=C.left+(S.clientLeft+parseFloat(T.paddingLeft))*k.x,M=C.top+(S.clientTop+parseFloat(T.paddingTop))*k.y;h*=k.x,u*=k.y,p*=k.x,f*=k.y,h+=N,u+=M,x=ir(S),S=nm(x)}}return rh({width:p,height:f,x:h,y:u})}function Mh(e,t){const n=Ah(e).scrollLeft;return t?t.left+n:Xs(ai(e)).left+n}function vb(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Mh(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function nP(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",l=ai(r),c=t?Dh(t.floating):!1;if(r===l||c&&s)return n;let h={scrollLeft:0,scrollTop:0},u=ri(1);const p=ri(0),f=Li(r);if((f||!f&&!s)&&((Yo(r)!=="body"||La(l))&&(h=Ah(r)),f)){const _=Xs(r);u=Oo(r),p.x=_.x+r.clientLeft,p.y=_.y+r.clientTop}const v=l&&!f&&!s?vb(l,h):ri(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-h.scrollLeft*u.x+p.x+v.x,y:n.y*u.y-h.scrollTop*u.y+p.y+v.y}}function rP(e){return Array.from(e.getClientRects())}function iP(e){const t=ai(e),n=Ah(e),r=e.ownerDocument.body,i=tr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=tr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Mh(e);const c=-n.scrollTop;return Br(r).direction==="rtl"&&(l+=tr(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:l,y:c}}const Zy=25;function sP(e,t){const n=ir(e),r=ai(e),i=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,h=0;if(i){s=i.width,l=i.height;const p=Sg();(!p||p&&t==="fixed")&&(c=i.offsetLeft,h=i.offsetTop)}const u=Mh(r);if(u<=0){const p=r.ownerDocument,f=p.body,v=getComputedStyle(f),_=p.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(r.clientWidth-f.clientWidth-_);x<=Zy&&(s-=x)}else u<=Zy&&(s+=u);return{width:s,height:l,x:c,y:h}}function oP(e,t){const n=Xs(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Li(e)?Oo(e):ri(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,h=i*s.x,u=r*s.y;return{width:l,height:c,x:h,y:u}}function Gy(e,t,n){let r;if(t==="viewport")r=sP(e,n);else if(t==="document")r=iP(ai(e));else if(Ir(t))r=oP(t,n);else{const i=gb(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return rh(r)}function _b(e,t){const n=ys(e);return n===t||!Ir(n)||Ho(n)?!1:Br(n).position==="fixed"||_b(n,t)}function lP(e,t){const n=t.get(e);if(n)return n;let r=ba(e,[],!1).filter(c=>Ir(c)&&Yo(c)!=="body"),i=null;const s=Br(e).position==="fixed";let l=s?ys(e):e;for(;Ir(l)&&!Ho(l);){const c=Br(l),h=wg(l);!h&&c.position==="fixed"&&(i=null),(s?!h&&!i:!h&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||La(l)&&!h&&_b(e,l))?r=r.filter(p=>p!==l):i=c,l=ys(l)}return t.set(e,r),r}function aP(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?Dh(t)?[]:lP(t,this._c):[].concat(n),r],c=Gy(t,l[0],i);let h=c.top,u=c.right,p=c.bottom,f=c.left;for(let v=1;v<l.length;v++){const _=Gy(t,l[v],i);h=tr(_.top,h),u=_s(_.right,u),p=_s(_.bottom,p),f=tr(_.left,f)}return{width:u-f,height:p-h,x:f,y:h}}function cP(e){const{width:t,height:n}=mb(e);return{width:t,height:n}}function uP(e,t,n){const r=Li(t),i=ai(t),s=n==="fixed",l=Xs(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const h=ri(0);function u(){h.x=Mh(i)}if(r||!r&&!s)if((Yo(t)!=="body"||La(i))&&(c=Ah(t)),r){const _=Xs(t,!0,s,t);h.x=_.x+t.clientLeft,h.y=_.y+t.clientTop}else i&&u();s&&!r&&i&&u();const p=i&&!r&&!s?vb(i,c):ri(0),f=l.left+c.scrollLeft-h.x-p.x,v=l.top+c.scrollTop-h.y-p.y;return{x:f,y:v,width:l.width,height:l.height}}function Vf(e){return Br(e).position==="static"}function Jy(e,t){if(!Li(e)||Br(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ai(e)===n&&(n=n.ownerDocument.body),n}function yb(e,t){const n=ir(e);if(Dh(e))return n;if(!Li(e)){let i=ys(e);for(;i&&!Ho(i);){if(Ir(i)&&!Vf(i))return i;i=ys(i)}return n}let r=Jy(e,t);for(;r&&ZT(r)&&Vf(r);)r=Jy(r,t);return r&&Ho(r)&&Vf(r)&&!wg(r)?n:r||QT(e)||n}const hP=async function(e){const t=this.getOffsetParent||yb,n=this.getDimensions,r=await n(e.floating);return{reference:uP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dP(e){return Br(e).direction==="rtl"}const fP={convertOffsetParentRelativeRectToViewportRelativeRect:nP,getDocumentElement:ai,getClippingRect:aP,getOffsetParent:yb,getElementRects:hP,getClientRects:rP,getDimensions:cP,getScale:Oo,isElement:Ir,isRTL:dP};function xb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pP(e,t){let n=null,r;const i=ai(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,h){c===void 0&&(c=!1),h===void 0&&(h=1),s();const u=e.getBoundingClientRect(),{left:p,top:f,width:v,height:_}=u;if(c||t(),!v||!_)return;const x=iu(f),S=iu(i.clientWidth-(p+v)),k=iu(i.clientHeight-(f+_)),C=iu(p),N={rootMargin:-x+"px "+-S+"px "+-k+"px "+-C+"px",threshold:tr(0,_s(1,h))||1};let M=!0;function B(A){const D=A[0].intersectionRatio;if(D!==h){if(!M)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!xb(u,e.getBoundingClientRect())&&l(),M=!1}try{n=new IntersectionObserver(B,{...N,root:i.ownerDocument})}catch{n=new IntersectionObserver(B,N)}n.observe(e)}return l(!0),s}function mP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,u=bg(e),p=i||s?[...u?ba(u):[],...t?ba(t):[]]:[];p.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const f=u&&c?pP(u,n):null;let v=-1,_=null;l&&(_=new ResizeObserver(C=>{let[T]=C;T&&T.target===u&&_&&t&&(_.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(t)})),n()}),u&&!h&&_.observe(u),t&&_.observe(t));let x,S=h?Xs(e):null;h&&k();function k(){const C=Xs(e);S&&!xb(S,C)&&n(),S=C,x=requestAnimationFrame(k)}return n(),()=>{var C;p.forEach(T=>{i&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),f==null||f(),(C=_)==null||C.disconnect(),_=null,h&&cancelAnimationFrame(x)}}const gP=qT,vP=KT,_P=WT,yP=XT,xP=UT,Qy=HT,wP=YT,SP=(e,t,n)=>{const r=new Map,i={platform:fP,...n},s={...i.platform,_c:r};return $T(e,t,{...i,platform:s})};var bP=typeof document<"u",kP=function(){},Du=bP?b.useLayoutEffect:kP;function ih(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ih(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!ih(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function wb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ex(e,t){const n=wb(e);return Math.round(t*n)/n}function qf(e){const t=b.useRef(e);return Du(()=>{t.current=e}),t}function CP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:h,open:u}=e,[p,f]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,_]=b.useState(r);ih(v,r)||_(r);const[x,S]=b.useState(null),[k,C]=b.useState(null),T=b.useCallback(I=>{I!==A.current&&(A.current=I,S(I))},[]),N=b.useCallback(I=>{I!==D.current&&(D.current=I,C(I))},[]),M=s||x,B=l||k,A=b.useRef(null),D=b.useRef(null),$=b.useRef(p),j=h!=null,R=qf(h),U=qf(i),V=qf(u),Y=b.useCallback(()=>{if(!A.current||!D.current)return;const I={placement:t,strategy:n,middleware:v};U.current&&(I.platform=U.current),SP(A.current,D.current,I).then(re=>{const P={...re,isPositioned:V.current!==!1};W.current&&!ih($.current,P)&&($.current=P,Or.flushSync(()=>{f(P)}))})},[v,t,n,U,V]);Du(()=>{u===!1&&$.current.isPositioned&&($.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[u]);const W=b.useRef(!1);Du(()=>(W.current=!0,()=>{W.current=!1}),[]),Du(()=>{if(M&&(A.current=M),B&&(D.current=B),M&&B){if(R.current)return R.current(M,B,Y);Y()}},[M,B,Y,R,j]);const q=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:N}),[T,N]),z=b.useMemo(()=>({reference:M,floating:B}),[M,B]),J=b.useMemo(()=>{const I={position:n,left:0,top:0};if(!z.floating)return I;const re=ex(z.floating,p.x),P=ex(z.floating,p.y);return c?{...I,transform:"translate("+re+"px, "+P+"px)",...wb(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:P}},[n,c,z.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:Y,refs:q,elements:z,floatingStyles:J}),[p,Y,q,z,J])}const EP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Qy({element:r.current,padding:i}).fn(n):{}:r?Qy({element:r,padding:i}).fn(n):{}}}},NP=(e,t)=>{const n=gP(e);return{name:n.name,fn:n.fn,options:[e,t]}},RP=(e,t)=>{const n=vP(e);return{name:n.name,fn:n.fn,options:[e,t]}},TP=(e,t)=>({fn:wP(e).fn,options:[e,t]}),PP=(e,t)=>{const n=_P(e);return{name:n.name,fn:n.fn,options:[e,t]}},DP=(e,t)=>{const n=yP(e);return{name:n.name,fn:n.fn,options:[e,t]}},AP=(e,t)=>{const n=xP(e);return{name:n.name,fn:n.fn,options:[e,t]}},MP=(e,t)=>{const n=EP(e);return{name:n.name,fn:n.fn,options:[e,t]}};var LP="Arrow",Sb=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return g.jsx(Mi.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});Sb.displayName=LP;var OP=Sb;function jP(e){const[t,n]=b.useState(void 0);return Ni(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let l,c;if("borderBoxSize"in s){const h=s.borderBoxSize,u=Array.isArray(h)?h[0]:h;l=u.inlineSize,c=u.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var kg="Popper",[bb,kb]=ib(kg),[IP,Cb]=bb(kg),Eb=e=>{const{__scopePopper:t,children:n}=e,[r,i]=b.useState(null),[s,l]=b.useState(void 0);return g.jsx(IP,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:l,children:n})};Eb.displayName=kg;var Nb="PopperAnchor",Rb=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=Cb(Nb,n),l=b.useRef(null),c=s.onAnchorChange,h=b.useCallback(x=>{l.current=x,x&&c(x)},[c]),u=xs(t,h),p=b.useRef(null);b.useEffect(()=>{if(!r)return;const x=p.current;p.current=r.current,x!==p.current&&c(p.current)});const f=s.placementState&&Eg(s.placementState),v=f==null?void 0:f[0],_=f==null?void 0:f[1];return r?null:g.jsx(Mi.div,{"data-radix-popper-side":v,"data-radix-popper-align":_,...i,ref:u})});Rb.displayName=Nb;var Cg="PopperContent",[BP,zP]=bb(Cg),Tb=b.forwardRef((e,t)=>{var ye,Ce,ge,at,nt,Ie;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:u,collisionPadding:p=0,sticky:f="partial",hideWhenDetached:v=!1,updatePositionStrategy:_="optimized",onPlaced:x,...S}=e,k=Cb(Cg,n),[C,T]=b.useState(null),N=xs(t,rt=>T(rt)),[M,B]=b.useState(null),A=jP(M),D=(A==null?void 0:A.width)??0,$=(A==null?void 0:A.height)??0,j=r+(s!=="center"?"-"+s:""),R=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=u?Array.isArray(u)?u:[u]:void 0,V=U!==void 0&&U.length>0,Y={padding:R,boundary:U==null?void 0:U.filter($P),altBoundary:V},{refs:W,floatingStyles:q,placement:z,isPositioned:J,middlewareData:I}=CP({strategy:"fixed",placement:j,whileElementsMounted:(...rt)=>mP(...rt,{animationFrame:_==="always"}),elements:{reference:k.anchor},middleware:[NP({mainAxis:i+$,alignmentAxis:l}),h&&RP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?TP():void 0,...Y}),h&&PP({...Y}),DP({...Y,apply:({elements:rt,rects:Lt,availableWidth:cn,availableHeight:Un})=>{const{width:kn,height:un}=Lt.reference,vt=rt.floating.style;vt.setProperty("--radix-popper-available-width",`${cn}px`),vt.setProperty("--radix-popper-available-height",`${Un}px`),vt.setProperty("--radix-popper-anchor-width",`${kn}px`),vt.setProperty("--radix-popper-anchor-height",`${un}px`)}}),M&&MP({element:M,padding:c}),HP({arrowWidth:D,arrowHeight:$}),v&&AP({strategy:"referenceHidden",...Y})]}),re=k.setPlacementState;Ni(()=>(re(z),()=>{re(void 0)}),[z,re]);const[P,H]=Eg(z),Q=$o(x);Ni(()=>{J&&(Q==null||Q())},[J,Q]);const L=(ye=I.arrow)==null?void 0:ye.x,Z=(Ce=I.arrow)==null?void 0:Ce.y,oe=((ge=I.arrow)==null?void 0:ge.centerOffset)!==0,[te,_e]=b.useState();return Ni(()=>{C&&_e(window.getComputedStyle(C).zIndex)},[C]),g.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:J?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(at=I.transformOrigin)==null?void 0:at.x,(nt=I.transformOrigin)==null?void 0:nt.y].join(" "),...((Ie=I.hide)==null?void 0:Ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(BP,{scope:n,placedSide:P,placedAlign:H,onArrowChange:B,arrowX:L,arrowY:Z,shouldHideArrow:oe,children:g.jsx(Mi.div,{"data-side":P,"data-align":H,...S,ref:N,style:{...S.style,animation:J?void 0:"none"}})})})});Tb.displayName=Cg;var Pb="PopperArrow",FP={top:"bottom",right:"left",bottom:"top",left:"right"},Db=b.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=zP(Pb,r),l=FP[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(OP,{...i,ref:n,style:{...i.style,display:"block"}})})});Db.displayName=Pb;function $P(e){return e!==null}var HP=e=>({name:"transformOrigin",options:e,fn(t){var k,C,T;const{placement:n,rects:r,middlewareData:i}=t,l=((k=i.arrow)==null?void 0:k.centerOffset)!==0,c=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[u,p]=Eg(n),f={start:"0%",center:"50%",end:"100%"}[p],v=(((C=i.arrow)==null?void 0:C.x)??0)+c/2,_=(((T=i.arrow)==null?void 0:T.y)??0)+h/2;let x="",S="";return u==="bottom"?(x=l?f:`${v}px`,S=`${-h}px`):u==="top"?(x=l?f:`${v}px`,S=`${r.floating.height+h}px`):u==="right"?(x=`${-h}px`,S=l?f:`${_}px`):u==="left"&&(x=`${r.floating.width+h}px`,S=l?f:`${_}px`),{data:{x,y:S}}}});function Eg(e){const[t,n="center"]=e.split("-");return[t,n]}var WP=Eb,Ab=Rb,UP=Tb,VP=Db,qP="Portal",Mb=b.forwardRef((e,t)=>{var c;const{container:n,...r}=e,[i,s]=b.useState(!1);Ni(()=>s(!0),[]);const l=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Or.createPortal(g.jsx(Mi.div,{...r,ref:t}),l):null});Mb.displayName=qP;function KP(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var Ng=e=>{const{present:t,children:n}=e,r=YP(t),i=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=XP(r.ref,ZP(i));return typeof n=="function"||r.isPresent?b.cloneElement(i,{ref:s}):null};Ng.displayName="Presence";function YP(e){const[t,n]=b.useState(),r=b.useRef(null),i=b.useRef(e),s=b.useRef("none"),l=e?"mounted":"unmounted",[c,h]=KP(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=su(r.current);s.current=c==="mounted"?u:"none"},[c]),Ni(()=>{const u=r.current,p=i.current;if(p!==e){const v=s.current,_=su(u);e?h("MOUNT"):_==="none"||(u==null?void 0:u.display)==="none"?h("UNMOUNT"):h(p&&v!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Ni(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,f=_=>{const S=su(r.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(h("ANIMATION_END"),!i.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},v=_=>{_.target===t&&(s.current=su(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function tx(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function XP(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(l=>{const c=tx(l,n);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let l=0;l<s.length;l++){const c=s[l];typeof c=="function"?c():tx(r[l],null)}}},[])}function su(e){return(e==null?void 0:e.animationName)||"none"}function ZP(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var GP=og[" useInsertionEffect ".trim().toString()]||Ni;function JP({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,l]=QP({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:i;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const f=p.current;f!==c&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=c},[c,r])}const u=b.useCallback(p=>{var f;if(c){const v=eD(p)?p(e):p;v!==e&&((f=l.current)==null||f.call(l,v))}else s(p)},[c,e,s,l]);return[h,u]}function QP({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),i=b.useRef(n),s=b.useRef(t);return GP(()=>{s.current=t},[t]),b.useEffect(()=>{var l;i.current!==n&&((l=s.current)==null||l.call(s,n),i.current=n)},[n,i]),[n,r,s]}function eD(e){return typeof e=="function"}var tD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ko=new WeakMap,ou=new WeakMap,lu={},Kf=0,Lb=function(e){return e&&(e.host||Lb(e.parentNode))},nD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Lb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},rD=function(e,t,n,r){var i=nD(t,Array.isArray(e)?e:[e]);lu[n]||(lu[n]=new WeakMap);var s=lu[n],l=[],c=new Set,h=new Set(i),u=function(f){!f||c.has(f)||(c.add(f),u(f.parentNode))};i.forEach(u);var p=function(f){!f||h.has(f)||Array.prototype.forEach.call(f.children,function(v){if(c.has(v))p(v);else try{var _=v.getAttribute(r),x=_!==null&&_!=="false",S=(ko.get(v)||0)+1,k=(s.get(v)||0)+1;ko.set(v,S),s.set(v,k),l.push(v),S===1&&x&&ou.set(v,!0),k===1&&v.setAttribute(n,"true"),x||v.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",v,C)}})};return p(t),c.clear(),Kf++,function(){l.forEach(function(f){var v=ko.get(f)-1,_=s.get(f)-1;ko.set(f,v),s.set(f,_),v||(ou.has(f)||f.removeAttribute(r),ou.delete(f)),_||f.removeAttribute(n)}),Kf--,Kf||(ko=new WeakMap,ko=new WeakMap,ou=new WeakMap,lu={})}},iD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=tD(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),rD(r,i,n,"aria-hidden")):function(){return null}},Qr=function(){return Qr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Qr.apply(this,arguments)};function Ob(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function sD(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Au="right-scroll-bar-position",Mu="width-before-scroll-bar",oD="with-scroll-bars-hidden",lD="--removed-body-scroll-bar-size";function Yf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function aD(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var cD=typeof window<"u"?b.useLayoutEffect:b.useEffect,nx=new WeakMap;function uD(e,t){var n=aD(null,function(r){return e.forEach(function(i){return Yf(i,r)})});return cD(function(){var r=nx.get(n);if(r){var i=new Set(r),s=new Set(e),l=n.current;i.forEach(function(c){s.has(c)||Yf(c,null)}),s.forEach(function(c){i.has(c)||Yf(c,l)})}nx.set(n,e)},[e]),n}function hD(e){return e}function dD(e,t){t===void 0&&(t=hD);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var l=t(s,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(r=!0;n.length;){var l=n;n=[],l.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(s),l=n}var h=function(){var p=l;l=[],p.forEach(s)},u=function(){return Promise.resolve().then(h)};u(),n={push:function(p){l.push(p),u()},filter:function(p){return l=l.filter(p),n}}}};return i}function fD(e){e===void 0&&(e={});var t=dD(null);return t.options=Qr({async:!0,ssr:!1},e),t}var jb=function(e){var t=e.sideCar,n=Ob(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Qr({},n))};jb.isSideCarExport=!0;function pD(e,t){return e.useMedium(t),jb}var Ib=fD(),Xf=function(){},Lh=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:Xf,onWheelCapture:Xf,onTouchMoveCapture:Xf}),i=r[0],s=r[1],l=e.forwardProps,c=e.children,h=e.className,u=e.removeScrollBar,p=e.enabled,f=e.shards,v=e.sideCar,_=e.noRelative,x=e.noIsolation,S=e.inert,k=e.allowPinchZoom,C=e.as,T=C===void 0?"div":C,N=e.gapMode,M=Ob(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),B=v,A=uD([n,t]),D=Qr(Qr({},M),i);return b.createElement(b.Fragment,null,p&&b.createElement(B,{sideCar:Ib,removeScrollBar:u,shards:f,noRelative:_,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!k,lockRef:n,gapMode:N}),l?b.cloneElement(b.Children.only(c),Qr(Qr({},D),{ref:A})):b.createElement(T,Qr({},D,{className:h,ref:A}),c))});Lh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lh.classNames={fullWidth:Mu,zeroRight:Au};var mD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=mD();return t&&e.setAttribute("nonce",t),e}function vD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _D(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=gD())&&(vD(t,n),_D(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xD=function(){var e=yD();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Bb=function(){var e=xD(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},wD={left:0,top:0,right:0,gap:0},Zf=function(e){return parseInt(e||"",10)||0},SD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Zf(n),Zf(r),Zf(i)]},bD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return wD;var t=SD(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},kD=Bb(),jo="data-scroll-locked",CD=function(e,t,n,r){var i=e.left,s=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
44
+ .`.concat(oD,` {
45
+ overflow: hidden `).concat(r,`;
46
+ padding-right: `).concat(c,"px ").concat(r,`;
47
+ }
48
+ body[`).concat(jo,`] {
49
+ overflow: hidden `).concat(r,`;
50
+ overscroll-behavior: contain;
51
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
52
+ padding-left: `.concat(i,`px;
53
+ padding-top: `).concat(s,`px;
54
+ padding-right: `).concat(l,`px;
55
+ margin-left:0;
56
+ margin-top:0;
57
+ margin-right: `).concat(c,"px ").concat(r,`;
58
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
59
+ }
60
+
61
+ .`).concat(Au,` {
62
+ right: `).concat(c,"px ").concat(r,`;
63
+ }
64
+
65
+ .`).concat(Mu,` {
66
+ margin-right: `).concat(c,"px ").concat(r,`;
67
+ }
68
+
69
+ .`).concat(Au," .").concat(Au,` {
70
+ right: 0 `).concat(r,`;
71
+ }
72
+
73
+ .`).concat(Mu," .").concat(Mu,` {
74
+ margin-right: 0 `).concat(r,`;
75
+ }
76
+
77
+ body[`).concat(jo,`] {
78
+ `).concat(lD,": ").concat(c,`px;
79
+ }
80
+ `)},rx=function(){var e=parseInt(document.body.getAttribute(jo)||"0",10);return isFinite(e)?e:0},ED=function(){b.useEffect(function(){return document.body.setAttribute(jo,(rx()+1).toString()),function(){var e=rx()-1;e<=0?document.body.removeAttribute(jo):document.body.setAttribute(jo,e.toString())}},[])},ND=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;ED();var s=b.useMemo(function(){return bD(i)},[i]);return b.createElement(kD,{styles:CD(s,!t,i,n?"":"!important")})},rm=!1;if(typeof window<"u")try{var au=Object.defineProperty({},"passive",{get:function(){return rm=!0,!0}});window.addEventListener("test",au,au),window.removeEventListener("test",au,au)}catch{rm=!1}var Co=rm?{passive:!1}:!1,RD=function(e){return e.tagName==="TEXTAREA"},zb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!RD(e)&&n[t]==="visible")},TD=function(e){return zb(e,"overflowY")},PD=function(e){return zb(e,"overflowX")},ix=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Fb(e,r);if(i){var s=$b(e,r),l=s[1],c=s[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},DD=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},AD=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Fb=function(e,t){return e==="v"?TD(t):PD(t)},$b=function(e,t){return e==="v"?DD(t):AD(t)},MD=function(e,t){return e==="h"&&t==="rtl"?-1:1},LD=function(e,t,n,r,i){var s=MD(e,window.getComputedStyle(t).direction),l=s*r,c=n.target,h=t.contains(c),u=!1,p=l>0,f=0,v=0;do{if(!c)break;var _=$b(e,c),x=_[0],S=_[1],k=_[2],C=S-k-s*x;(x||C)&&Fb(e,c)&&(f+=C,v+=x);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&c!==document.body||h&&(t.contains(c)||t===c));return(p&&Math.abs(f)<1||!p&&Math.abs(v)<1)&&(u=!0),u},cu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sx=function(e){return[e.deltaX,e.deltaY]},ox=function(e){return e&&"current"in e?e.current:e},OD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jD=function(e){return`
81
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
82
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
83
+ `)},ID=0,Eo=[];function BD(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),i=b.useState(ID++)[0],s=b.useState(Bb)[0],l=b.useRef(e);b.useEffect(function(){l.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=sD([e.lockRef.current],(e.shards||[]).map(ox),!0).filter(Boolean);return S.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var c=b.useCallback(function(S,k){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var C=cu(S),T=n.current,N="deltaX"in S?S.deltaX:T[0]-C[0],M="deltaY"in S?S.deltaY:T[1]-C[1],B,A=S.target,D=Math.abs(N)>Math.abs(M)?"h":"v";if("touches"in S&&D==="h"&&A.type==="range")return!1;var $=window.getSelection(),j=$&&$.anchorNode,R=j?j===A||j.contains(A):!1;if(R)return!1;var U=ix(D,A);if(!U)return!0;if(U?B=D:(B=D==="v"?"h":"v",U=ix(D,A)),!U)return!1;if(!r.current&&"changedTouches"in S&&(N||M)&&(r.current=B),!B)return!0;var V=r.current||B;return LD(V,k,S,V==="h"?N:M)},[]),h=b.useCallback(function(S){var k=S;if(!(!Eo.length||Eo[Eo.length-1]!==s)){var C="deltaY"in k?sx(k):cu(k),T=t.current.filter(function(B){return B.name===k.type&&(B.target===k.target||k.target===B.shadowParent)&&OD(B.delta,C)})[0];if(T&&T.should){k.cancelable&&k.preventDefault();return}if(!T){var N=(l.current.shards||[]).map(ox).filter(Boolean).filter(function(B){return B.contains(k.target)}),M=N.length>0?c(k,N[0]):!l.current.noIsolation;M&&k.cancelable&&k.preventDefault()}}},[]),u=b.useCallback(function(S,k,C,T){var N={name:S,delta:k,target:C,should:T,shadowParent:zD(C)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(M){return M!==N})},1)},[]),p=b.useCallback(function(S){n.current=cu(S),r.current=void 0},[]),f=b.useCallback(function(S){u(S.type,sx(S),S.target,c(S,e.lockRef.current))},[]),v=b.useCallback(function(S){u(S.type,cu(S),S.target,c(S,e.lockRef.current))},[]);b.useEffect(function(){return Eo.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Co),document.addEventListener("touchmove",h,Co),document.addEventListener("touchstart",p,Co),function(){Eo=Eo.filter(function(S){return S!==s}),document.removeEventListener("wheel",h,Co),document.removeEventListener("touchmove",h,Co),document.removeEventListener("touchstart",p,Co)}},[]);var _=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(s,{styles:jD(i)}):null,_?b.createElement(ND,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const FD=pD(Ib,BD);var Hb=b.forwardRef(function(e,t){return b.createElement(Lh,Qr({},e,{ref:t,sideCar:FD}))});Hb.classNames=Lh.classNames;var Oh="Popover",[Wb]=ib(Oh,[kb]),Oa=kb(),[$D,ws]=Wb(Oh),Ub=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:l=!1}=e,c=Oa(t),h=b.useRef(null),[u,p]=b.useState(!1),[f,v]=JP({prop:r,defaultProp:i??!1,onChange:s,caller:Oh});return g.jsx(WP,{...c,children:g.jsx($D,{scope:t,contentId:TT(),triggerRef:h,open:f,onOpenChange:v,onOpenToggle:b.useCallback(()=>v(_=>!_),[v]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>p(!0),[]),onCustomAnchorRemove:b.useCallback(()=>p(!1),[]),modal:l,children:n})})};Ub.displayName=Oh;var Vb="PopoverAnchor",HD=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ws(Vb,n),s=Oa(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=i;return b.useEffect(()=>(l(),()=>c()),[l,c]),g.jsx(Ab,{...s,...r,ref:t})});HD.displayName=Vb;var qb="PopoverTrigger",Kb=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ws(qb,n),s=Oa(n),l=xs(t,i.triggerRef),c=g.jsx(Mi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Qb(i.open),...r,ref:l,onClick:ms(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:g.jsx(Ab,{asChild:!0,...s,children:c})});Kb.displayName=qb;var Rg="PopoverPortal",[WD,UD]=Wb(Rg,{forceMount:void 0}),Yb=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=ws(Rg,t);return g.jsx(WD,{scope:t,forceMount:n,children:g.jsx(Ng,{present:n||s.open,children:g.jsx(Mb,{asChild:!0,container:i,children:r})})})};Yb.displayName=Rg;var Wo="PopoverContent",Xb=b.forwardRef((e,t)=>{const n=UD(Wo,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=ws(Wo,e.__scopePopover);return g.jsx(Ng,{present:r||s.open,children:s.modal?g.jsx(qD,{...i,ref:t}):g.jsx(KD,{...i,ref:t})})});Xb.displayName=Wo;var VD=sb("PopoverContent.RemoveScroll"),qD=b.forwardRef((e,t)=>{const n=ws(Wo,e.__scopePopover),r=b.useRef(null),i=xs(t,r),s=b.useRef(!1);return b.useEffect(()=>{const l=r.current;if(l)return iD(l)},[]),g.jsx(Hb,{as:VD,allowPinchZoom:!0,children:g.jsx(Zb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ms(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),s.current||(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ms(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,h=c.button===0&&c.ctrlKey===!0,u=c.button===2||h;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ms(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),KD=b.forwardRef((e,t)=>{const n=ws(Wo,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return g.jsx(Zb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var h,u;(h=e.onInteractOutside)==null||h.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),Zb=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:u,onInteractOutside:p,...f}=e,v=ws(Wo,n),_=Oa(n);return yT(),g.jsx(cb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(lb,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:p,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:u,onDismiss:()=>v.onOpenChange(!1),children:g.jsx(UP,{"data-state":Qb(v.open),role:"dialog",id:v.contentId,..._,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Gb="PopoverClose",Jb=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ws(Gb,n);return g.jsx(Mi.button,{type:"button",...r,ref:t,onClick:ms(e.onClick,()=>i.onOpenChange(!1))})});Jb.displayName=Gb;var YD="PopoverArrow",XD=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Oa(n);return g.jsx(VP,{...i,...r,ref:t})});XD.displayName=YD;function Qb(e){return e?"open":"closed"}var e1=Ub,t1=Kb,n1=Yb,r1=Xb,lx=Jb;/**
84
+ * @license lucide-react v1.17.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const i1=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
89
+ * @license lucide-react v1.17.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const ZD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
94
+ * @license lucide-react v1.17.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const GD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
99
+ * @license lucide-react v1.17.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const ax=e=>{const t=GD(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
104
+ * @license lucide-react v1.17.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */var Gf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
109
+ * @license lucide-react v1.17.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const JD=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},QD=b.createContext({}),eA=()=>b.useContext(QD),tA=b.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:s,iconNode:l,...c},h)=>{const{size:u=24,strokeWidth:p=2,absoluteStrokeWidth:f=!1,color:v="currentColor",className:_=""}=eA()??{},x=r??f?Number(n??p)*24/Number(t??u):n??p;return b.createElement("svg",{ref:h,...Gf,width:t??u??Gf.width,height:t??u??Gf.height,stroke:e??v,strokeWidth:x,className:i1("lucide",_,i),...!s&&!JD(c)&&{"aria-hidden":"true"},...c},[...l.map(([S,k])=>b.createElement(S,k)),...Array.isArray(s)?s:[s]])});/**
114
+ * @license lucide-react v1.17.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const ht=(e,t)=>{const n=b.forwardRef(({className:r,...i},s)=>b.createElement(tA,{ref:s,iconNode:t,className:i1(`lucide-${ZD(ax(e))}`,`lucide-${e}`,r),...i}));return n.displayName=ax(e),n};/**
119
+ * @license lucide-react v1.17.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const nA=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],rA=ht("check-check",nA);/**
124
+ * @license lucide-react v1.17.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const iA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],sA=ht("check",iA);/**
129
+ * @license lucide-react v1.17.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const oA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],lA=ht("chevron-left",oA);/**
134
+ * @license lucide-react v1.17.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const aA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],cA=ht("circle-check",aA);/**
139
+ * @license lucide-react v1.17.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const uA=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],hA=ht("code-xml",uA);/**
144
+ * @license lucide-react v1.17.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const dA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],fA=ht("copy",dA);/**
149
+ * @license lucide-react v1.17.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const pA=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],mA=ht("corner-down-right",pA);/**
154
+ * @license lucide-react v1.17.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const gA=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],vA=ht("cpu",gA);/**
159
+ * @license lucide-react v1.17.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const _A=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],yA=ht("flask-conical",_A);/**
164
+ * @license lucide-react v1.17.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const xA=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],wA=ht("folder-git-2",xA);/**
169
+ * @license lucide-react v1.17.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const SA=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],bA=ht("git-branch",SA);/**
174
+ * @license lucide-react v1.17.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const kA=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],CA=ht("git-commit-horizontal",kA);/**
179
+ * @license lucide-react v1.17.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const EA=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],NA=ht("hammer",EA);/**
184
+ * @license lucide-react v1.17.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const RA=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],TA=ht("inbox",RA);/**
189
+ * @license lucide-react v1.17.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const PA=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],DA=ht("layout-grid",PA);/**
194
+ * @license lucide-react v1.17.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const AA=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ka=ht("loader-circle",AA);/**
199
+ * @license lucide-react v1.17.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const MA=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],LA=ht("memory-stick",MA);/**
204
+ * @license lucide-react v1.17.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const OA=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],s1=ht("mic",OA);/**
209
+ * @license lucide-react v1.17.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const jA=[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]],IA=ht("package-check",jA);/**
214
+ * @license lucide-react v1.17.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const BA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],zA=ht("play",BA);/**
219
+ * @license lucide-react v1.17.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const FA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$A=ht("plus",FA);/**
224
+ * @license lucide-react v1.17.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const HA=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],WA=ht("rotate-cw",HA);/**
229
+ * @license lucide-react v1.17.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const UA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],VA=ht("search",UA);/**
234
+ * @license lucide-react v1.17.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const qA=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],KA=ht("sliders-horizontal",qA);/**
239
+ * @license lucide-react v1.17.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const YA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],o1=ht("sparkles",YA);/**
244
+ * @license lucide-react v1.17.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const XA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],l1=ht("square",XA);/**
249
+ * @license lucide-react v1.17.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const ZA=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],GA=ht("terminal",ZA);function JA(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const jh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tg(e){return"nodeType"in e}function Dn(e){var t,n;return e?Xo(e)?e:Tg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Pg(e){const{Document:t}=Dn(e);return e instanceof t}function ja(e){return Xo(e)?!1:e instanceof Dn(e).HTMLElement}function a1(e){return e instanceof Dn(e).SVGElement}function Zo(e){return e?Xo(e)?e.document:Tg(e)?Pg(e)?e:ja(e)||a1(e)?e.ownerDocument:document:document:document}const zr=jh?b.useLayoutEffect:b.useEffect;function Ih(e){const t=b.useRef(e);return zr(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function QA(){const e=b.useRef(null),t=b.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ca(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return zr(()=>{n.current!==e&&(n.current=e)},t),n}function Ia(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function sh(e){const t=Ih(e),n=b.useRef(null),r=b.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function oh(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let Jf={};function Ba(e,t){return b.useMemo(()=>{if(t)return t;const n=Jf[e]==null?0:Jf[e]+1;return Jf[e]=n,e+"-"+n},[e,t])}function c1(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,l)=>{const c=Object.entries(l);for(const[h,u]of c){const p=s[h];p!=null&&(s[h]=p+e*u)}return s},{...t})}}const Io=c1(1),lh=c1(-1);function eM(e){return"clientX"in e&&"clientY"in e}function Bh(e){if(!e)return!1;const{KeyboardEvent:t}=Dn(e.target);return t&&e instanceof t}function tM(e){if(!e)return!1;const{TouchEvent:t}=Dn(e.target);return t&&e instanceof t}function ah(e){if(tM(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return eM(e)?{x:e.clientX,y:e.clientY}:null}const Ai=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ai.Translate.toString(e),Ai.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),cx="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nM(e){return e.matches(cx)?e:e.querySelector(cx)}const rM={display:"none"};function iM(e){let{id:t,value:n}=e;return ot.createElement("div",{id:t,style:rM},n)}function sM(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ot.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function oM(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const u1=b.createContext(null);function lM(e){const t=b.useContext(u1);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function aM(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:i,event:s}=r;e.forEach(l=>{var c;return(c=l[i])==null?void 0:c.call(l,s)})},[e]),t]}const cM={draggable:`
254
+ To pick up a draggable item, press the space bar.
255
+ While dragging, use the arrow keys to move the item.
256
+ Press space again to drop the item in its new position, or press escape to cancel.
257
+ `},uM={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hM(e){let{announcements:t=uM,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=cM}=e;const{announce:s,announcement:l}=oM(),c=Ba("DndLiveRegion"),[h,u]=b.useState(!1);if(b.useEffect(()=>{u(!0)},[]),lM(b.useMemo(()=>({onDragStart(f){let{active:v}=f;s(t.onDragStart({active:v}))},onDragMove(f){let{active:v,over:_}=f;t.onDragMove&&s(t.onDragMove({active:v,over:_}))},onDragOver(f){let{active:v,over:_}=f;s(t.onDragOver({active:v,over:_}))},onDragEnd(f){let{active:v,over:_}=f;s(t.onDragEnd({active:v,over:_}))},onDragCancel(f){let{active:v,over:_}=f;s(t.onDragCancel({active:v,over:_}))}}),[s,t])),!h)return null;const p=ot.createElement(ot.Fragment,null,ot.createElement(iM,{id:r,value:i.draggable}),ot.createElement(sM,{id:c,announcement:l}));return n?Or.createPortal(p,n):p}var Vt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vt||(Vt={}));function ch(){}function Uo(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Dg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Fr=Object.freeze({x:0,y:0});function h1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dM(e,t){const n=ah(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function d1(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function fM(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pM(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function mM(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ux(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const f1=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=ux(t,t.left,t.top),s=[];for(const l of r){const{id:c}=l,h=n.get(c);if(h){const u=h1(ux(h),i);s.push({id:c,data:{droppableContainer:l,value:u}})}}return s.sort(d1)};function gM(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),l=i-r,c=s-n;if(r<i&&n<s){const h=t.width*t.height,u=e.width*e.height,p=l*c,f=p/(h+u-p);return Number(f.toFixed(4))}return 0}const vM=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const h=gM(c,t);h>0&&i.push({id:l,data:{droppableContainer:s,value:h}})}}return i.sort(fM)};function _M(e,t){const{top:n,left:r,bottom:i,right:s}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=s}const yM=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const s of t){const{id:l}=s,c=n.get(l);if(c&&_M(r,c)){const u=pM(c).reduce((f,v)=>f+h1(r,v),0),p=Number((u/4).toFixed(4));i.push({id:l,data:{droppableContainer:s,value:p}})}}return i.sort(d1)};function xM(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function p1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fr}function wM(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((l,c)=>({...l,top:l.top+e*c.y,bottom:l.bottom+e*c.y,left:l.left+e*c.x,right:l.right+e*c.x}),{...n})}}const SM=wM(1);function m1(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function bM(e,t,n){const r=m1(t);if(!r)return e;const{scaleX:i,scaleY:s,x:l,y:c}=r,h=e.left-l-(1-i)*parseFloat(n),u=e.top-c-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=i?e.width/i:e.width,f=s?e.height/s:e.height;return{width:p,height:f,top:u,right:h+p,bottom:u+f,left:h}}const kM={ignoreTransform:!1};function Go(e,t){t===void 0&&(t=kM);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:p}=Dn(e).getComputedStyle(e);u&&(n=bM(n,u,p))}const{top:r,left:i,width:s,height:l,bottom:c,right:h}=n;return{top:r,left:i,width:s,height:l,bottom:c,right:h}}function hx(e){return Go(e,{ignoreTransform:!0})}function CM(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function EM(e,t){return t===void 0&&(t=Dn(e).getComputedStyle(e)),t.position==="fixed"}function NM(e,t){t===void 0&&(t=Dn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function Ag(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Pg(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ja(i)||a1(i)||n.includes(i))return n;const s=Dn(e).getComputedStyle(i);return i!==e&&NM(i,s)&&n.push(i),EM(i,s)?n:r(i.parentNode)}return e?r(e):n}function g1(e){const[t]=Ag(e,1);return t??null}function Qf(e){return!jh||!e?null:Xo(e)?e:Tg(e)?Pg(e)||e===Zo(e).scrollingElement?window:ja(e)?e:null:null}function v1(e){return Xo(e)?e.scrollX:e.scrollLeft}function _1(e){return Xo(e)?e.scrollY:e.scrollTop}function im(e){return{x:v1(e),y:_1(e)}}var Jt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Jt||(Jt={}));function y1(e){return!jh||!e?!1:e===document.scrollingElement}function x1(e){const t={x:0,y:0},n=y1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:l,isRight:c,maxScroll:r,minScroll:t}}const RM={x:.2,y:.2};function TM(e,t,n,r,i){let{top:s,left:l,right:c,bottom:h}=n;r===void 0&&(r=10),i===void 0&&(i=RM);const{isTop:u,isBottom:p,isLeft:f,isRight:v}=x1(e),_={x:0,y:0},x={x:0,y:0},S={height:t.height*i.y,width:t.width*i.x};return!u&&s<=t.top+S.height?(_.y=Jt.Backward,x.y=r*Math.abs((t.top+S.height-s)/S.height)):!p&&h>=t.bottom-S.height&&(_.y=Jt.Forward,x.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!v&&c>=t.right-S.width?(_.x=Jt.Forward,x.x=r*Math.abs((t.right-S.width-c)/S.width)):!f&&l<=t.left+S.width&&(_.x=Jt.Backward,x.x=r*Math.abs((t.left+S.width-l)/S.width)),{direction:_,speed:x}}function PM(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:l}=window;return{top:0,left:0,right:s,bottom:l,width:s,height:l}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function w1(e){return e.reduce((t,n)=>Io(t,im(n)),Fr)}function DM(e){return e.reduce((t,n)=>t+v1(n),0)}function AM(e){return e.reduce((t,n)=>t+_1(n),0)}function S1(e,t){if(t===void 0&&(t=Go),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);g1(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const MM=[["x",["left","right"],DM],["y",["top","bottom"],AM]];class Mg{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ag(n),i=w1(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,l,c]of MM)for(const h of l)Object.defineProperty(this,h,{get:()=>{const u=c(r),p=i[s]-u;return this.rect[h]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ca{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function LM(e){const{EventTarget:t}=Dn(e);return e instanceof t?e:Zo(e)}function ep(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var vr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(vr||(vr={}));function dx(e){e.preventDefault()}function OM(e){e.stopPropagation()}var tt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(tt||(tt={}));const b1={start:[tt.Space,tt.Enter],cancel:[tt.Esc],end:[tt.Space,tt.Enter,tt.Tab]},jM=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case tt.Right:return{...n,x:n.x+25};case tt.Left:return{...n,x:n.x-25};case tt.Down:return{...n,y:n.y+25};case tt.Up:return{...n,y:n.y-25}}};class k1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ca(Zo(n)),this.windowListeners=new ca(Dn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(vr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&S1(r),n(Fr)}handleKeyDown(t){if(Bh(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=b1,coordinateGetter:l=jM,scrollBehavior:c="smooth"}=i,{code:h}=t;if(s.end.includes(h)){this.handleEnd(t);return}if(s.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:u}=r.current,p=u?{x:u.left,y:u.top}:Fr;this.referenceCoordinates||(this.referenceCoordinates=p);const f=l(t,{active:n,context:r.current,currentCoordinates:p});if(f){const v=lh(f,p),_={x:0,y:0},{scrollableAncestors:x}=r.current;for(const S of x){const k=t.code,{isTop:C,isRight:T,isLeft:N,isBottom:M,maxScroll:B,minScroll:A}=x1(S),D=PM(S),$={x:Math.min(k===tt.Right?D.right-D.width/2:D.right,Math.max(k===tt.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(k===tt.Down?D.bottom-D.height/2:D.bottom,Math.max(k===tt.Down?D.top:D.top+D.height/2,f.y))},j=k===tt.Right&&!T||k===tt.Left&&!N,R=k===tt.Down&&!M||k===tt.Up&&!C;if(j&&$.x!==f.x){const U=S.scrollLeft+v.x,V=k===tt.Right&&U<=B.x||k===tt.Left&&U>=A.x;if(V&&!v.y){S.scrollTo({left:U,behavior:c});return}V?_.x=S.scrollLeft-U:_.x=k===tt.Right?S.scrollLeft-B.x:S.scrollLeft-A.x,_.x&&S.scrollBy({left:-_.x,behavior:c});break}else if(R&&$.y!==f.y){const U=S.scrollTop+v.y,V=k===tt.Down&&U<=B.y||k===tt.Up&&U>=A.y;if(V&&!v.x){S.scrollTo({top:U,behavior:c});return}V?_.y=S.scrollTop-U:_.y=k===tt.Down?S.scrollTop-B.y:S.scrollTop-A.y,_.y&&S.scrollBy({top:-_.y,behavior:c});break}}this.handleMove(t,Io(lh(f,this.referenceCoordinates),_))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}k1.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=b1,onActivation:i}=t,{active:s}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function fx(e){return!!(e&&"distance"in e)}function px(e){return!!(e&&"delay"in e)}class Lg{constructor(t,n,r){var i;r===void 0&&(r=LM(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:l}=s;this.props=t,this.events=n,this.document=Zo(l),this.documentListeners=new ca(this.document),this.listeners=new ca(r),this.windowListeners=new ca(Dn(l)),this.initialCoordinates=(i=ah(s))!=null?i:Fr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.DragStart,dx),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),this.windowListeners.add(vr.ContextMenu,dx),this.documentListeners.add(vr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(px(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fx(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(vr.Click,OM,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(vr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:l,options:{activationConstraint:c}}=s;if(!i)return;const h=(n=ah(t))!=null?n:Fr,u=lh(i,h);if(!r&&c){if(fx(c)){if(c.tolerance!=null&&ep(u,c.tolerance))return this.handleCancel();if(ep(u,c.distance))return this.handleStart()}if(px(c)&&ep(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===tt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const IM={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Og extends Lg{constructor(t){const{event:n}=t,r=Zo(n.target);super(t,IM,r)}}Og.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const BM={move:{name:"mousemove"},end:{name:"mouseup"}};var sm;(function(e){e[e.RightClick=2]="RightClick"})(sm||(sm={}));class jg extends Lg{constructor(t){super(t,BM,Zo(t.event.target))}}jg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sm.RightClick?!1:(r==null||r({event:n}),!0)}}];const tp={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class zh extends Lg{constructor(t){super(t,tp)}static setup(){return window.addEventListener(tp.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tp.move.name,t)};function t(){}}}zh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var ua;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ua||(ua={}));var uh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(uh||(uh={}));function zM(e){let{acceleration:t,activator:n=ua.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:l=5,order:c=uh.TreeOrder,pointerCoordinates:h,scrollableAncestors:u,scrollableAncestorRects:p,delta:f,threshold:v}=e;const _=$M({delta:f,disabled:!s}),[x,S]=QA(),k=b.useRef({x:0,y:0}),C=b.useRef({x:0,y:0}),T=b.useMemo(()=>{switch(n){case ua.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case ua.DraggableRect:return i}},[n,i,h]),N=b.useRef(null),M=b.useCallback(()=>{const A=N.current;if(!A)return;const D=k.current.x*C.current.x,$=k.current.y*C.current.y;A.scrollBy(D,$)},[]),B=b.useMemo(()=>c===uh.TreeOrder?[...u].reverse():u,[c,u]);b.useEffect(()=>{if(!s||!u.length||!T){S();return}for(const A of B){if((r==null?void 0:r(A))===!1)continue;const D=u.indexOf(A),$=p[D];if(!$)continue;const{direction:j,speed:R}=TM(A,$,T,t,v);for(const U of["x","y"])_[U][j[U]]||(R[U]=0,j[U]=0);if(R.x>0||R.y>0){S(),N.current=A,x(M,l),k.current=R,C.current=j;return}}k.current={x:0,y:0},C.current={x:0,y:0},S()},[t,M,r,S,s,l,JSON.stringify(T),JSON.stringify(_),x,u,B,p,JSON.stringify(v)])}const FM={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function $M(e){let{delta:t,disabled:n}=e;const r=oh(t);return Ia(i=>{if(n||!r||!i)return FM;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Jt.Backward]:i.x[Jt.Backward]||s.x===-1,[Jt.Forward]:i.x[Jt.Forward]||s.x===1},y:{[Jt.Backward]:i.y[Jt.Backward]||s.y===-1,[Jt.Forward]:i.y[Jt.Forward]||s.y===1}}},[n,t,r])}function HM(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ia(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function WM(e,t){return b.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...s]},[]),[e,t])}var Ea;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ea||(Ea={}));var om;(function(e){e.Optimized="optimized"})(om||(om={}));const mx=new Map;function UM(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,l]=b.useState(null),{frequency:c,measure:h,strategy:u}=i,p=b.useRef(e),f=k(),v=Ca(f),_=b.useCallback(function(C){C===void 0&&(C=[]),!v.current&&l(T=>T===null?C:T.concat(C.filter(N=>!T.includes(N))))},[v]),x=b.useRef(null),S=Ia(C=>{if(f&&!n)return mx;if(!C||C===mx||p.current!==e||s!=null){const T=new Map;for(let N of e){if(!N)continue;if(s&&s.length>0&&!s.includes(N.id)&&N.rect.current){T.set(N.id,N.rect.current);continue}const M=N.node.current,B=M?new Mg(h(M),M):null;N.rect.current=B,B&&T.set(N.id,B)}return T}return C},[e,s,n,f,h]);return b.useEffect(()=>{p.current=e},[e]),b.useEffect(()=>{f||_()},[n,f]),b.useEffect(()=>{s&&s.length>0&&l(null)},[JSON.stringify(s)]),b.useEffect(()=>{f||typeof c!="number"||x.current!==null||(x.current=setTimeout(()=>{_(),x.current=null},c))},[c,f,_,...r]),{droppableRects:S,measureDroppableContainers:_,measuringScheduled:s!=null};function k(){switch(u){case Ea.Always:return!1;case Ea.BeforeDragging:return n;default:return!n}}}function Ig(e,t){return Ia(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function VM(e,t){return Ig(e,t)}function qM(e){let{callback:t,disabled:n}=e;const r=Ih(t),i=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return b.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Fh(e){let{callback:t,disabled:n}=e;const r=Ih(t),i=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return b.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function KM(e){return new Mg(Go(e),e)}function gx(e,t,n){t===void 0&&(t=KM);const[r,i]=b.useState(null);function s(){i(h=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=h??n)!=null?u:null}const p=t(e);return JSON.stringify(h)===JSON.stringify(p)?h:p})}const l=qM({callback(h){if(e)for(const u of h){const{type:p,target:f}=u;if(p==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),c=Fh({callback:s});return zr(()=>{s(),e?(c==null||c.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),l==null||l.disconnect())},[e]),r}function YM(e){const t=Ig(e);return p1(e,t)}const vx=[];function XM(e){const t=b.useRef(e),n=Ia(r=>e?r&&r!==vx&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ag(e):vx,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function ZM(e){const[t,n]=b.useState(null),r=b.useRef(e),i=b.useCallback(s=>{const l=Qf(s.target);l&&n(c=>c?(c.set(l,im(l)),new Map(c)):null)},[]);return b.useEffect(()=>{const s=r.current;if(e!==s){l(s);const c=e.map(h=>{const u=Qf(h);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,im(u)]):null}).filter(h=>h!=null);n(c.length?new Map(c):null),r.current=e}return()=>{l(e),l(s)};function l(c){c.forEach(h=>{const u=Qf(h);u==null||u.removeEventListener("scroll",i)})}},[i,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,l)=>Io(s,l),Fr):w1(e):Fr,[e,t])}function _x(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const r=e!==Fr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lh(e,n.current):Fr}function GM(e){b.useEffect(()=>{if(!jh)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function JM(e,t){return b.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=l=>{s(l,t)},n},{}),[e,t])}function C1(e){return b.useMemo(()=>e?CM(e):null,[e])}const yx=[];function QM(e,t){t===void 0&&(t=Go);const[n]=e,r=C1(n?Dn(n):null),[i,s]=b.useState(yx);function l(){s(()=>e.length?e.map(h=>y1(h)?r:new Mg(t(h),h)):yx)}const c=Fh({callback:l});return zr(()=>{c==null||c.disconnect(),l(),e.forEach(h=>c==null?void 0:c.observe(h))},[e]),i}function E1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ja(t)?t:e}function eL(e){let{measure:t}=e;const[n,r]=b.useState(null),i=b.useCallback(u=>{for(const{target:p}of u)if(ja(p)){r(f=>{const v=t(p);return f?{...f,width:v.width,height:v.height}:v});break}},[t]),s=Fh({callback:i}),l=b.useCallback(u=>{const p=E1(u);s==null||s.disconnect(),p&&(s==null||s.observe(p)),r(p?t(p):null)},[t,s]),[c,h]=sh(l);return b.useMemo(()=>({nodeRef:c,rect:n,setRef:h}),[n,c,h])}const tL=[{sensor:Og,options:{}},{sensor:k1,options:{}}],nL={current:{}},Lu={draggable:{measure:hx},droppable:{measure:hx,strategy:Ea.WhileDragging,frequency:om.Optimized},dragOverlay:{measure:Go}};class ha extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const rL={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ha,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ch},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Lu,measureDroppableContainers:ch,windowRect:null,measuringScheduled:!1},N1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ch,draggableNodes:new Map,over:null,measureDroppableContainers:ch},za=b.createContext(N1),R1=b.createContext(rL);function iL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ha}}}function sL(e,t){switch(t.type){case Vt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vt.DragEnd:case Vt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vt.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new ha(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vt.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const l=new ha(e.droppable.containers);return l.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case Vt.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new ha(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function oL(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=b.useContext(za),s=oh(r),l=oh(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!r&&s&&l!=null){if(!Bh(s)||document.activeElement===s.target)return;const c=i.get(l);if(!c)return;const{activatorNode:h,node:u}=c;if(!h.current&&!u.current)return;requestAnimationFrame(()=>{for(const p of[h.current,u.current]){if(!p)continue;const f=nM(p);if(f){f.focus();break}}})}},[r,t,i,l,s]),null}function T1(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function lL(e){return b.useMemo(()=>({draggable:{...Lu.draggable,...e==null?void 0:e.draggable},droppable:{...Lu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Lu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function aL(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=b.useRef(!1),{x:l,y:c}=typeof i=="boolean"?{x:i,y:i}:i;zr(()=>{if(!l&&!c||!t){s.current=!1;return}if(s.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const p=n(u),f=p1(p,r);if(l||(f.x=0),c||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const v=g1(u);v&&v.scrollBy({top:f.y,left:f.x})}},[t,l,c,r,n])}const $h=b.createContext({...Fr,scaleX:1,scaleY:1});var ds;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ds||(ds={}));const Bg=b.memo(function(t){var n,r,i,s;let{id:l,accessibility:c,autoScroll:h=!0,children:u,sensors:p=tL,collisionDetection:f=vM,measuring:v,modifiers:_,...x}=t;const S=b.useReducer(sL,void 0,iL),[k,C]=S,[T,N]=aM(),[M,B]=b.useState(ds.Uninitialized),A=M===ds.Initialized,{draggable:{active:D,nodes:$,translate:j},droppable:{containers:R}}=k,U=D!=null?$.get(D):null,V=b.useRef({initial:null,translated:null}),Y=b.useMemo(()=>{var xt;return D!=null?{id:D,data:(xt=U==null?void 0:U.data)!=null?xt:nL,rect:V}:null},[D,U]),W=b.useRef(null),[q,z]=b.useState(null),[J,I]=b.useState(null),re=Ca(x,Object.values(x)),P=Ba("DndDescribedBy",l),H=b.useMemo(()=>R.getEnabled(),[R]),Q=lL(v),{droppableRects:L,measureDroppableContainers:Z,measuringScheduled:oe}=UM(H,{dragging:A,dependencies:[j.x,j.y],config:Q.droppable}),te=HM($,D),_e=b.useMemo(()=>J?ah(J):null,[J]),ye=zi(),Ce=VM(te,Q.draggable.measure);aL({activeNode:D!=null?$.get(D):null,config:ye.layoutShiftCompensation,initialRect:Ce,measure:Q.draggable.measure});const ge=gx(te,Q.draggable.measure,Ce),at=gx(te?te.parentElement:null),nt=b.useRef({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ie=R.getNodeFor((n=nt.current.over)==null?void 0:n.id),rt=eL({measure:Q.dragOverlay.measure}),Lt=(r=rt.nodeRef.current)!=null?r:te,cn=A?(i=rt.rect)!=null?i:ge:null,Un=!!(rt.nodeRef.current&&rt.rect),kn=YM(Un?null:ge),un=C1(Lt?Dn(Lt):null),vt=XM(A?Ie??te:null),hn=QM(vt),or=T1(_,{transform:{x:j.x-kn.x,y:j.y-kn.y,scaleX:1,scaleY:1},activatorEvent:J,active:Y,activeNodeRect:ge,containerNodeRect:at,draggingNodeRect:cn,over:nt.current.over,overlayNodeRect:rt.rect,scrollableAncestors:vt,scrollableAncestorRects:hn,windowRect:un}),Sr=_e?Io(_e,j):null,br=ZM(vt),Bi=_x(br),ne=_x(br,[ge]),he=Io(or,Bi),Ae=cn?SM(cn,or):null,se=Y&&Ae?f({active:Y,collisionRect:Ae,droppableRects:L,droppableContainers:H,pointerCoordinates:Sr}):null,ve=mM(se,"id"),[Ue,dt]=b.useState(null),Kt=Un?or:Io(or,ne),rn=xM(Kt,(s=Ue==null?void 0:Ue.rect)!=null?s:null,ge),Vn=b.useRef(null),Ot=b.useCallback((xt,fn)=>{let{sensor:pn,options:kr}=fn;if(W.current==null)return;const Cn=$.get(W.current);if(!Cn)return;const mn=xt.nativeEvent,Ln=new pn({active:W.current,activeNode:Cn,event:mn,options:kr,context:nt,onAbort(wt){if(!$.get(wt))return;const{onDragAbort:gn}=re.current,Cr={id:wt};gn==null||gn(Cr),T({type:"onDragAbort",event:Cr})},onPending(wt,ar,gn,Cr){if(!$.get(wt))return;const{onDragPending:$r}=re.current,qn={id:wt,constraint:ar,initialCoordinates:gn,offset:Cr};$r==null||$r(qn),T({type:"onDragPending",event:qn})},onStart(wt){const ar=W.current;if(ar==null)return;const gn=$.get(ar);if(!gn)return;const{onDragStart:Cr}=re.current,Er={activatorEvent:mn,active:{id:ar,data:gn.data,rect:V}};Or.unstable_batchedUpdates(()=>{Cr==null||Cr(Er),B(ds.Initializing),C({type:Vt.DragStart,initialCoordinates:wt,active:ar}),T({type:"onDragStart",event:Er}),z(Vn.current),I(mn)})},onMove(wt){C({type:Vt.DragMove,coordinates:wt})},onEnd:ui(Vt.DragEnd),onCancel:ui(Vt.DragCancel)});Vn.current=Ln;function ui(wt){return async function(){const{active:gn,collisions:Cr,over:Er,scrollAdjustedTranslate:$r}=nt.current;let qn=null;if(gn&&$r){const{cancelDrop:hi}=re.current;qn={activatorEvent:mn,active:gn,collisions:Cr,delta:$r,over:Er},wt===Vt.DragEnd&&typeof hi=="function"&&await Promise.resolve(hi(qn))&&(wt=Vt.DragCancel)}W.current=null,Or.unstable_batchedUpdates(()=>{C({type:wt}),B(ds.Uninitialized),dt(null),z(null),I(null),Vn.current=null;const hi=wt===Vt.DragEnd?"onDragEnd":"onDragCancel";if(qn){const il=re.current[hi];il==null||il(qn),T({type:hi,event:qn})}})}}},[$]),lr=b.useCallback((xt,fn)=>(pn,kr)=>{const Cn=pn.nativeEvent,mn=$.get(kr);if(W.current!==null||!mn||Cn.dndKit||Cn.defaultPrevented)return;const Ln={active:mn};xt(pn,fn.options,Ln)===!0&&(Cn.dndKit={capturedBy:fn.sensor},W.current=kr,Ot(pn,fn))},[$,Ot]),dn=WM(p,lr);GM(p),zr(()=>{ge&&M===ds.Initializing&&B(ds.Initialized)},[ge,M]),b.useEffect(()=>{const{onDragMove:xt}=re.current,{active:fn,activatorEvent:pn,collisions:kr,over:Cn}=nt.current;if(!fn||!pn)return;const mn={active:fn,activatorEvent:pn,collisions:kr,delta:{x:he.x,y:he.y},over:Cn};Or.unstable_batchedUpdates(()=>{xt==null||xt(mn),T({type:"onDragMove",event:mn})})},[he.x,he.y]),b.useEffect(()=>{const{active:xt,activatorEvent:fn,collisions:pn,droppableContainers:kr,scrollAdjustedTranslate:Cn}=nt.current;if(!xt||W.current==null||!fn||!Cn)return;const{onDragOver:mn}=re.current,Ln=kr.get(ve),ui=Ln&&Ln.rect.current?{id:Ln.id,rect:Ln.rect.current,data:Ln.data,disabled:Ln.disabled}:null,wt={active:xt,activatorEvent:fn,collisions:pn,delta:{x:Cn.x,y:Cn.y},over:ui};Or.unstable_batchedUpdates(()=>{dt(ui),mn==null||mn(wt),T({type:"onDragOver",event:wt})})},[ve]),zr(()=>{nt.current={activatorEvent:J,active:Y,activeNode:te,collisionRect:Ae,collisions:se,droppableRects:L,draggableNodes:$,draggingNode:Lt,draggingNodeRect:cn,droppableContainers:R,over:Ue,scrollableAncestors:vt,scrollAdjustedTranslate:he},V.current={initial:cn,translated:Ae}},[Y,te,se,Ae,$,Lt,cn,L,R,Ue,vt,he]),zM({...ye,delta:j,draggingRect:Ae,pointerCoordinates:Sr,scrollableAncestors:vt,scrollableAncestorRects:hn});const nl=b.useMemo(()=>({active:Y,activeNode:te,activeNodeRect:ge,activatorEvent:J,collisions:se,containerNodeRect:at,dragOverlay:rt,draggableNodes:$,droppableContainers:R,droppableRects:L,over:Ue,measureDroppableContainers:Z,scrollableAncestors:vt,scrollableAncestorRects:hn,measuringConfiguration:Q,measuringScheduled:oe,windowRect:un}),[Y,te,ge,J,se,at,rt,$,R,L,Ue,Z,vt,hn,Q,oe,un]),rl=b.useMemo(()=>({activatorEvent:J,activators:dn,active:Y,activeNodeRect:ge,ariaDescribedById:{draggable:P},dispatch:C,draggableNodes:$,over:Ue,measureDroppableContainers:Z}),[J,dn,Y,ge,C,P,$,Ue,Z]);return ot.createElement(u1.Provider,{value:N},ot.createElement(za.Provider,{value:rl},ot.createElement(R1.Provider,{value:nl},ot.createElement($h.Provider,{value:rn},u)),ot.createElement(oL,{disabled:(c==null?void 0:c.restoreFocus)===!1})),ot.createElement(hM,{...c,hiddenTextDescribedById:P}));function zi(){const xt=(q==null?void 0:q.autoScrollEnabled)===!1,fn=typeof h=="object"?h.enabled===!1:h===!1,pn=A&&!xt&&!fn;return typeof h=="object"?{...h,enabled:pn}:{enabled:pn}}}),cL=b.createContext(null),xx="button",uL="Draggable";function P1(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=Ba(uL),{activators:l,activatorEvent:c,active:h,activeNodeRect:u,ariaDescribedById:p,draggableNodes:f,over:v}=b.useContext(za),{role:_=xx,roleDescription:x="draggable",tabIndex:S=0}=i??{},k=(h==null?void 0:h.id)===t,C=b.useContext(k?$h:cL),[T,N]=sh(),[M,B]=sh(),A=JM(l,t),D=Ca(n);zr(()=>(f.set(t,{id:t,key:s,node:T,activatorNode:M,data:D}),()=>{const j=f.get(t);j&&j.key===s&&f.delete(t)}),[f,t]);const $=b.useMemo(()=>({role:_,tabIndex:S,"aria-disabled":r,"aria-pressed":k&&_===xx?!0:void 0,"aria-roledescription":x,"aria-describedby":p.draggable}),[r,_,S,k,x,p.draggable]);return{active:h,activatorEvent:c,activeNodeRect:u,attributes:$,isDragging:k,listeners:r?void 0:A,node:T,over:v,setNodeRef:N,setActivatorNodeRef:B,transform:C}}function D1(){return b.useContext(R1)}const hL="Droppable",dL={timeout:25};function Hh(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=Ba(hL),{active:l,dispatch:c,over:h,measureDroppableContainers:u}=b.useContext(za),p=b.useRef({disabled:n}),f=b.useRef(!1),v=b.useRef(null),_=b.useRef(null),{disabled:x,updateMeasurementsFor:S,timeout:k}={...dL,...i},C=Ca(S??r),T=b.useCallback(()=>{if(!f.current){f.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{u(Array.isArray(C.current)?C.current:[C.current]),_.current=null},k)},[k]),N=Fh({callback:T,disabled:x||!l}),M=b.useCallback(($,j)=>{N&&(j&&(N.unobserve(j),f.current=!1),$&&N.observe($))},[N]),[B,A]=sh(M),D=Ca(t);return b.useEffect(()=>{!N||!B.current||(N.disconnect(),f.current=!1,N.observe(B.current))},[B,N]),b.useEffect(()=>(c({type:Vt.RegisterDroppable,element:{id:r,key:s,disabled:n,node:B,rect:v,data:D}}),()=>c({type:Vt.UnregisterDroppable,key:s,id:r})),[r]),b.useEffect(()=>{n!==p.current.disabled&&(c({type:Vt.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,c]),{active:l,rect:v,isOver:(h==null?void 0:h.id)===r,node:B,over:h,setNodeRef:A}}function fL(e){let{animation:t,children:n}=e;const[r,i]=b.useState(null),[s,l]=b.useState(null),c=oh(n);return!n&&!r&&c&&i(c),zr(()=>{if(!s)return;const h=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(h==null||u==null){i(null);return}Promise.resolve(t(u,s)).then(()=>{i(null)})},[t,r,s]),ot.createElement(ot.Fragment,null,n,r?b.cloneElement(r,{ref:l}):null)}const pL={x:0,y:0,scaleX:1,scaleY:1};function mL(e){let{children:t}=e;return ot.createElement(za.Provider,{value:N1},ot.createElement($h.Provider,{value:pL},t))}const gL={position:"fixed",touchAction:"none"},vL=e=>Bh(e)?"transform 250ms ease":void 0,_L=b.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:s,className:l,rect:c,style:h,transform:u,transition:p=vL}=e;if(!c)return null;const f=i?u:{...u,scaleX:1,scaleY:1},v={...gL,width:c.width,height:c.height,top:c.top,left:c.left,transform:Ai.Transform.toString(f),transformOrigin:i&&r?dM(r,c):void 0,transition:typeof p=="function"?p(r):p,...h};return ot.createElement(n,{className:l,style:v,ref:t},s)}),yL=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:s,className:l}=e;if(s!=null&&s.active)for(const[c,h]of Object.entries(s.active))h!==void 0&&(i[c]=n.node.style.getPropertyValue(c),n.node.style.setProperty(c,h));if(s!=null&&s.dragOverlay)for(const[c,h]of Object.entries(s.dragOverlay))h!==void 0&&r.node.style.setProperty(c,h);return l!=null&&l.active&&n.node.classList.add(l.active),l!=null&&l.dragOverlay&&r.node.classList.add(l.dragOverlay),function(){for(const[h,u]of Object.entries(i))n.node.style.setProperty(h,u);l!=null&&l.active&&n.node.classList.remove(l.active)}},xL=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ai.Transform.toString(t)},{transform:Ai.Transform.toString(n)}]},wL={duration:250,easing:"ease",keyframes:xL,sideEffects:yL({styles:{active:{opacity:"0"}}})};function SL(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Ih((s,l)=>{if(t===null)return;const c=n.get(s);if(!c)return;const h=c.node.current;if(!h)return;const u=E1(l);if(!u)return;const{transform:p}=Dn(l).getComputedStyle(l),f=m1(p);if(!f)return;const v=typeof t=="function"?t:bL(t);return S1(h,i.draggable.measure),v({active:{id:s,data:c.data,node:h,rect:i.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:l,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function bL(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...wL,...e};return s=>{let{active:l,dragOverlay:c,transform:h,...u}=s;if(!t)return;const p={x:c.rect.left-l.rect.left,y:c.rect.top-l.rect.top},f={scaleX:h.scaleX!==1?l.rect.width*h.scaleX/c.rect.width:1,scaleY:h.scaleY!==1?l.rect.height*h.scaleY/c.rect.height:1},v={x:h.x-p.x,y:h.y-p.y,...f},_=i({...u,active:l,dragOverlay:c,transform:{initial:h,final:v}}),[x]=_,S=_[_.length-1];if(JSON.stringify(x)===JSON.stringify(S))return;const k=r==null?void 0:r({active:l,dragOverlay:c,...u}),C=c.node.animate(_,{duration:t,easing:n,fill:"forwards"});return new Promise(T=>{C.onfinish=()=>{k==null||k(),T()}})}}let wx=0;function kL(e){return b.useMemo(()=>{if(e!=null)return wx++,wx},[e])}const CL=ot.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:s,modifiers:l,wrapperElement:c="div",className:h,zIndex:u=999}=e;const{activatorEvent:p,active:f,activeNodeRect:v,containerNodeRect:_,draggableNodes:x,droppableContainers:S,dragOverlay:k,over:C,measuringConfiguration:T,scrollableAncestors:N,scrollableAncestorRects:M,windowRect:B}=D1(),A=b.useContext($h),D=kL(f==null?void 0:f.id),$=T1(l,{activatorEvent:p,active:f,activeNodeRect:v,containerNodeRect:_,draggingNodeRect:k.rect,over:C,overlayNodeRect:k.rect,scrollableAncestors:N,scrollableAncestorRects:M,transform:A,windowRect:B}),j=Ig(v),R=SL({config:r,draggableNodes:x,droppableContainers:S,measuringConfiguration:T}),U=j?k.setRef:void 0;return ot.createElement(mL,null,ot.createElement(fL,{animation:R},f&&D?ot.createElement(_L,{key:D,id:f.id,ref:U,as:c,activatorEvent:p,adjustScale:t,className:h,transition:s,rect:j,style:{zIndex:u,...i},transform:$},n):null))});function zg(e,t){return e.filter(n=>n.status===t).sort((n,r)=>FS(t,n,r))}function EL(e,t,n){if(e.status==="backlog"||e.status==="done")return"detail";const r=e.forks??[],i=e.runs??[];if(e.needsInput||t(e.id)==="input")return"session";const s=r.find(l=>t(l.key)==="input");return s?s.key:n==="session"||n==="detail"||n&&(r.some(l=>l.key===n)||i.some(l=>l.id===n))?n:"session"}const np={input:{display:"pill",title:"Needs your input",icon:"⮐",label:"input",pillClass:"bg-amber-500/25 text-amber-300",borderClass:"border-amber-500/70"},throttled:{display:"pill",title:"Rate-limited — waiting to retry",icon:"⏳",label:"limit",pillClass:"bg-orange-500/25 text-orange-300",borderClass:"border-orange-500/70"},thinking:{display:"dot",title:"Thinking…",dotClass:"bg-emerald-400",borderClass:"border-ink-500"}};function NL(e){return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Sx(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:t<7*864e5?`${Math.floor(t/864e5)}d ago`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function RL(e,t,n="none"){if(e.needsInput||n==="input")return np.input;if(t==="throttled"){const r=np.throttled;return r.display==="pill"&&e.throttledUntil?{...r,title:`Usage limit reached — auto-resumes at ${new Date(e.throttledUntil).toLocaleString()}`,label:`resets ${NL(e.throttledUntil)}`}:r}if(t==="running"||n==="running")return np.thinking;if(e.status==="done"){const r=e.doneAt;return r?{display:"text",label:Sx(r),title:`Done ${new Date(r).toLocaleString()}`}:null}return e.status==="backlog"&&e.createdAt?{display:"text",borderClass:"border-ink-500",label:Sx(e.createdAt),title:`Added ${new Date(e.createdAt).toLocaleString()}`}:null}function TL(e){const t=(e??[]).filter(n=>n.status==="running"||n.status==="starting").length;return t===0?null:t}const A1=3,lm="5.5rem";function PL(e){const t=e?A1-1:0,n=e+t,r=n+1,i=e?`repeat(${e}, minmax(${lm}, 1fr))`:"",s=t?`repeat(${t}, ${lm})`:"",l=[i,s].filter(Boolean).join(" ");return{trailingCols:t,phaseTrackCols:n,spanEnd:r,gridTemplateColumns:l}}function M1(e,t){return Math.min(A1,Math.max(1,t-e))}function DL(e){return`calc(${e} * ${lm} + ${e-1} * 0.5rem)`}const hh="operator:draft:";function bx(e){try{return localStorage.getItem(hh+e)??""}catch{return""}}function AL(e,t){try{t?localStorage.setItem(hh+e,t):localStorage.removeItem(hh+e)}catch{}}function ML(e){try{localStorage.removeItem(hh+e)}catch{}}let Mt=null,ea=null,Bo=[];Eh(e=>{if(e.kind==="dictation_partial")Mt==null||Mt.onPartial(e.text);else if(e.kind==="dictation_final")Mt==null||Mt.onCommit(e.text);else if(e.kind==="dictation_error"){const t=Mt;Wh(),t==null||t.onError(e.message),t==null||t.onEnd()}});var bS;const LL=typeof navigator<"u"&&!!((bS=navigator.mediaDevices)!=null&&bS.getUserMedia)&&typeof AudioContext<"u"&&typeof AudioWorkletNode<"u",OL=`
258
+ class PCMTap extends AudioWorkletProcessor {
259
+ process(inputs) {
260
+ const ch = inputs[0] && inputs[0][0];
261
+ if (ch) this.port.postMessage(ch.slice(0));
262
+ return true;
263
+ }
264
+ }
265
+ registerProcessor('pcm-tap', PCMTap);
266
+ `;function L1(){Bo.length&&(Ti({kind:"dictation_audio",audio:RR(Bo)}),Bo=[])}async function jL(e,t){Mt&&Ou(),Mt={...e,owner:t};try{const n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),r=new AudioContext({sampleRate:16e3});ea={stream:n,ctx:r},await r.resume();const i=URL.createObjectURL(new Blob([OL],{type:"application/javascript"}));await r.audioWorklet.addModule(i),URL.revokeObjectURL(i);const s=new AudioWorkletNode(r,"pcm-tap");s.port.onmessage=l=>{const c=l.data;for(let h=0;h<c.length;h++)Bo.push(c[h]);Bo.length>=4096&&L1()},r.createMediaStreamSource(n).connect(s),s.connect(r.destination),Ti({kind:"dictation_start"})}catch(n){const r=Mt;Wh(),r==null||r.onError(n instanceof Error?n.message:String(n)),r==null||r.onEnd()}}function Ou(){L1(),Ti({kind:"dictation_stop"});const e=Mt;Wh(),e==null||e.onEnd()}function Wh(){ea&&(ea.stream.getTracks().forEach(e=>e.stop()),ea.ctx.close().catch(()=>{}),ea=null),Bo=[],Mt=null}let IL=0,Ao=null;async function BL(){if(Ao)return Ao;try{const{settings:e}=await ke.getGlobalSettings(),n=(e.dictationSubmitKeywords??"shazam").split(",").map(r=>r.trim()).filter(Boolean);Ao=Dy(n.length?n:["shazam"])}catch{Ao=Dy(["shazam"])}return Ao}function zL(){Ao=null}function Fg(e,t,n,r){const[i,s]=b.useState(!1),[l,c]=b.useState(!1),[h,u]=b.useState(null),[p]=b.useState(()=>++IL),f=b.useRef(null),v=b.useRef(null),_=6e4,x=()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{(Mt==null?void 0:Mt.owner)===p&&(Ou(),s(!1),M())},_)},S=()=>{v.current&&(clearTimeout(v.current),v.current=null)},k=b.useRef(""),C=b.useRef(e),T=b.useRef(t),N=b.useRef(n);C.current=e,T.current=t,N.current=n;const M=()=>{c(!1),f.current&&(clearTimeout(f.current),f.current=null)},B=()=>{c(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>c(!1),800)};b.useEffect(()=>()=>{(Mt==null?void 0:Mt.owner)===p&&Ou(),f.current&&clearTimeout(f.current),S()},[p,r]),b.useEffect(()=>Nh(()=>{(Mt==null?void 0:Mt.owner)===p&&Wh(),s(!1),M(),S()}),[p]);async function A(){if(i){Ou(),s(!1),M(),S();return}u(null);let D=C.current(),$="";k.current=D;const j=()=>{const W=C.current();W!==k.current&&(D=W,$="",k.current=W)},R=W=>{const q=Fl(D,$,W);k.current=q,T.current(q)};s(!0),x();let U=!1;const V=await BL(),Y=W=>{const q=W.replace(V,"").trimEnd();$="",D="",U=!0,k.current=q,T.current(q),N.current(q)};await jL({onPartial:W=>{if(B(),x(),j(),U){V.test(Fl(D,$,W))||(U=!1,R(W));return}const q=Fl(D,$,W);N.current&&V.test(q)?Y(q):R(W)},onCommit:W=>{if(B(),x(),j(),U){U=!1;return}$=Fl($,W);const q=Fl(D,$);N.current&&V.test(q)?Y(q):R("")},onError:W=>u(W),onEnd:()=>{s(!1),M(),S()}},p)}return{recording:i,inflight:l,error:h,toggle:A,supported:LL}}function FL(e){return b.useSyncExternalStore(t=>{const n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},()=>window.matchMedia(e).matches,()=>!1)}function $g(){return FL("(max-width: 767px)")}const $L=new Set(xa.filter(e=>e.automated).map(e=>e.id));function HL(e){const{tasks:t,moveTask:n,onMoveError:r}=e,[i,s]=b.useState(null),[l,c]=b.useState(null);async function h(_,x,S){try{await n(_,x,S)}catch(k){r(k)}}function u(_){s(String(_.active.id))}async function p(_){var C;s(null);const x=String(_.active.id),S=(C=_.over)==null?void 0:C.id,k=t().find(T=>T.id===x);if(!(!S||!k||k.status===S)){if($L.has(S)&&_.activatorEvent.metaKey){c({taskId:x,toLane:S,title:k.title||k.shortDescription||x});return}await h(x,S)}}function f(_){const x=l;c(null),x&&h(x.taskId,x.toLane,_!=null&&_.trim()?_:void 0)}function v(){c(null)}return{activeId:i,pendingMove:l,onDragStart:u,onDragEnd:p,onDragCancel:()=>s(null),submitNote:f,cancelNote:v}}const Hg=AS;function WL(){const e=ue(u=>u.board),t=ue(u=>u.project),n=$g();b.useEffect(()=>{if(e)for(const u of e.tasks)u.status!=="done"&&u.status!=="backlog"&&wa(u.id)},[e]);const r=Dg(Uo(jg,{activationConstraint:{distance:5}}),Uo(zh,{activationConstraint:{delay:200,tolerance:8}})),i=HL({tasks:()=>(e==null?void 0:e.tasks)??[],moveTask:(u,p,f)=>ke.moveTask(t.id,u,p,void 0,f),onMoveError:u=>alert(`Move failed: ${u instanceof Error?u.message:u}`)});if(!e||!t)return null;const s=i.activeId?e.tasks.find(u=>u.id===i.activeId):void 0,l=e.lanes.find(u=>u.id==="backlog"),c=e.lanes.find(u=>u.id==="done"),h=u=>zg(e.tasks,u);return g.jsxs(Bg,{sensors:r,collisionDetection:yM,onDragStart:i.onDragStart,onDragEnd:i.onDragEnd,onDragCancel:i.onDragCancel,children:[n?g.jsx(KL,{board:e}):g.jsxs("div",{className:"flex h-full gap-2 overflow-x-auto overflow-y-hidden px-3 pt-3 scrollbar-thin scrollbar-thumb-ink-500",children:[l&&g.jsx(Cx,{lane:l,side:"left",tasks:h("backlog")}),g.jsx("div",{className:"min-h-0 min-w-min flex-1 overflow-x-hidden overflow-y-auto",children:g.jsx(VL,{board:e})}),c&&g.jsx(Cx,{lane:c,side:"right",tasks:h("done")})]}),g.jsx(CL,{dropAnimation:null,children:s?g.jsx(j1,{task:s,overlay:!0}):null}),i.pendingMove&&g.jsx(UL,{title:i.pendingMove.title,toLane:i.pendingMove.toLane,onSubmit:i.submitNote,onCancel:i.cancelNote})]})}function UL({title:e,toLane:t,onSubmit:n,onCancel:r}){var c;const[i,s]=b.useState(""),l=((c=xa.find(h=>h.id===t))==null?void 0:c.title)??t;return g.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/40 pt-[20vh]",onMouseDown:h=>{h.target===h.currentTarget&&n(void 0)},children:g.jsxs("div",{className:"w-[28rem] max-w-[92vw] rounded-lg border border-ink-600 bg-ink-800 p-3 shadow-xl",children:[g.jsxs("div",{className:"mb-1 text-sm text-ink-200",children:["Moving ",g.jsx("span",{className:"font-medium text-ink-100",children:e})," →"," ",g.jsx("span",{className:"font-medium text-indigo-300",children:l})]}),g.jsx("div",{className:"mb-2 text-xs text-ink-400",children:"Instructions for this phase? (optional — Enter to move, Esc to cancel the move)"}),g.jsx("textarea",{autoFocus:!0,rows:2,value:i,onChange:h=>s(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing?(h.preventDefault(),n(i)):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r())},placeholder:"e.g. focus on the redirect logic; skip the tests for now",className:"w-full resize-none rounded bg-ink-700 p-2 text-sm text-ink-100 outline-none"}),g.jsxs("div",{className:"mt-2 flex justify-end gap-2 text-xs",children:[g.jsx("button",{onClick:r,className:"rounded bg-ink-700 px-3 py-1 text-ink-300 hover:bg-ink-600",children:"Cancel move"}),g.jsxs("button",{onClick:()=>n(i),className:"rounded bg-indigo-600 px-3 py-1 hover:bg-indigo-500",children:["Move",i.trim()?" with note":""]})]})]})})}function VL({board:e}){const t=e.lanes.filter(h=>h.id!=="backlog"&&h.id!=="done"),n=h=>t.findIndex(u=>u.id===h),r=h=>n(h)+1,i=e.tasks.filter(h=>n(h.status)!==-1).sort((h,u)=>FS(h.status,h,u)),{spanEnd:s,gridTemplateColumns:l}=PL(t.length),c=["auto","auto",...i.map(()=>"auto"),"1fr"].join(" ");return g.jsxs("div",{className:"grid min-h-full w-full min-w-min gap-x-2 gap-y-2",style:{gridTemplateColumns:l,gridTemplateRows:c},children:[t.map((h,u)=>g.jsx(ZL,{lane:h,col:u+1,spanEnd:s},h.id)),i.map((h,u)=>g.jsx(GL,{task:h,row:u+3,col:r(h.status),spanEnd:s},h.id))]})}const qL=[{id:"backlog",label:"Backlog",icon:TA},{id:"swimlanes",label:"Swimlanes",icon:DA},{id:"done",label:"Done",icon:cA}];function KL({board:e}){const[t,n]=b.useState("swimlanes"),r=c=>zg(e.tasks,c),i=e.lanes.find(c=>c.id==="backlog"),s=e.lanes.find(c=>c.id==="done"),l={backlog:r("backlog").length,done:r("done").length};return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"min-h-0 flex-1",children:[t==="backlog"&&i&&g.jsx(kx,{lane:i,tasks:r("backlog")}),t==="swimlanes"&&g.jsx(YL,{board:e}),t==="done"&&s&&g.jsx(kx,{lane:s,tasks:r("done")})]}),g.jsx("nav",{className:"shrink-0 border-t border-ink-700 bg-ink-900/95 px-3 pb-safe pt-1.5 backdrop-blur",children:g.jsx("div",{className:"mx-auto flex max-w-md items-center gap-1 rounded-full bg-ink-800 p-1",children:qL.map(c=>{const h=t===c.id,u=c.icon,p=l[c.id];return g.jsxs("button",{onClick:()=>n(c.id),"aria-current":h?"page":void 0,className:`flex flex-1 flex-col items-center gap-0.5 rounded-full py-1.5 text-[11px] font-medium transition-colors ${h?"bg-indigo-600 text-white":"text-ink-300"}`,children:[g.jsx(u,{size:18}),g.jsxs("span",{children:[c.label,p?` ${p}`:""]})]},c.id)})})})]})}function YL({board:e}){const t=e.lanes.filter(r=>r.id!=="backlog"&&r.id!=="done"),n=r=>zg(e.tasks,r);return g.jsx("div",{className:"h-full overflow-y-auto overscroll-contain px-3 pb-3",children:g.jsx("div",{className:"flex flex-col gap-3 py-3",children:t.map(r=>g.jsx(O1,{lane:r,tasks:n(r.id)},r.id))})})}function kx({lane:e,tasks:t}){return g.jsx("div",{className:"h-full overflow-y-auto overscroll-contain px-3 pb-3",children:g.jsx("div",{className:"py-3",children:g.jsx(O1,{lane:e,tasks:t})})})}function O1({lane:e,tasks:t}){const{setNodeRef:n,isOver:r}=Hh({id:e.id}),i=Hg.includes(e.id),s=t.length===0&&!i;return g.jsxs("section",{children:[g.jsxs(I1,{lane:e,className:"sticky top-0 z-[5] -mx-3 flex items-center gap-2 bg-ink-900/95 px-3 py-1.5 backdrop-blur",children:[g.jsx("span",{className:"text-sm font-semibold",children:e.title}),e.automated&&g.jsx("span",{className:"text-[11px] text-indigo-400",children:"●agent"}),g.jsx("span",{className:"ml-auto text-xs text-ink-400",children:t.length})]}),g.jsxs("div",{ref:n,className:s?`h-6 rounded-md border border-dashed transition-colors ${r?"border-indigo-500 bg-ink-700":"border-ink-700/60"}`:`flex flex-col gap-2 rounded-lg border p-2 transition-colors ${r?"border-indigo-500 bg-ink-700":"border-ink-600 bg-ink-800"}`,children:[i&&g.jsx(Ug,{lane:e.id}),t.map(l=>g.jsx(Wg,{task:l},l.id))]})]})}function XL({id:e,fold:t}){const n=ue(r=>r.clearFold);return b.useEffect(()=>{const r=window.setTimeout(()=>n(e),850);return()=>window.clearTimeout(r)},[e,n]),g.jsxs("div",{className:"animate-fold-out shrink-0 overflow-hidden rounded-md border border-indigo-500/60 bg-ink-700 p-2.5 text-sm shadow-sm",children:[g.jsx("div",{className:"line-clamp-1 text-ink-300",children:t.title}),g.jsxs("div",{className:"mt-1 flex items-center gap-1 text-[11px] font-medium text-indigo-300",children:[g.jsx(mA,{size:11}),g.jsxs("span",{className:"truncate",children:["merged into ",t.label??"existing task"]})]})]})}function Cx({lane:e,side:t,tasks:n}){const{setNodeRef:r,isOver:i}=Hh({id:e.id}),[s,l]=b.useState(""),[c,h]=b.useState(!1),u=b.useRef(null),p=s.trim().toLowerCase(),f=ue(T=>T.folds),v=e.id==="backlog"?Object.entries(f):[],_=new Set(v.map(([T])=>T)),S=(p?n.filter(T=>T.title.toLowerCase().includes(p)||T.shortDescription.toLowerCase().includes(p)):n).filter(T=>!_.has(T.id));function k(){h(!0),setTimeout(()=>{var T;return(T=u.current)==null?void 0:T.focus()},0)}function C(){h(!1),l("")}return g.jsxs("div",{className:`flex w-64 min-h-0 shrink-0 flex-col bg-ink-900 ${t==="left"?"pr-1":"pl-1"}`,children:[c?g.jsx("div",{className:"mb-2 px-1",children:g.jsx("input",{ref:u,type:"text",value:s,onChange:T=>l(T.target.value),onKeyDown:T=>T.key==="Escape"&&C(),onBlur:()=>{s||C()},placeholder:"Search…",className:"w-full rounded border border-ink-600 bg-ink-800 px-2 py-1 text-xs text-ink-200 placeholder-ink-500 outline-none focus:border-indigo-500"})}):g.jsxs("div",{className:"mb-2 flex items-center justify-between px-1 pb-1",children:[e.id==="backlog"||e.id==="done"?g.jsxs(e1,{children:[g.jsx(t1,{asChild:!0,children:g.jsx("button",{type:"button",className:"text-sm font-semibold cursor-pointer transition-colors hover:text-indigo-200 data-[state=open]:text-indigo-200",children:e.title})}),g.jsx(n1,{children:g.jsx(r1,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,className:"z-50 w-64 overflow-hidden rounded-md border border-ink-500 bg-ink-700 py-1 text-sm text-ink-100 shadow-lg focus:outline-none",children:g.jsx(B1,{lane:e})})})]}):g.jsxs("div",{className:"text-sm font-semibold",children:[e.title,e.automated&&g.jsx("span",{className:"ml-1.5 text-[11px] text-indigo-400",children:"●agent"})]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:k,className:"rounded p-0.5 text-ink-400 hover:text-ink-200 transition-colors",title:"Search",children:g.jsx(VA,{size:13})}),g.jsx("span",{className:"text-xs text-ink-400",children:n.length})]})]}),g.jsxs("div",{ref:r,className:`flex min-h-0 flex-1 flex-col py-2 gap-1 rounded-lg border transition-colors ${i?"border-indigo-500 bg-ink-700":"border-ink-600 bg-ink-800"}`,children:[Hg.includes(e.id)&&!p&&g.jsx("div",{className:"shrink-0 px-2",children:g.jsx(Ug,{lane:e.id})}),g.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-2 overflow-y-auto scrollbar-thin scrollbar-thumb-ink-500 scrollbar-track-transparent",children:[v.map(([T,N])=>g.jsx(XL,{id:T,fold:N},`fold-${T}`)),S.map(T=>g.jsx(Wg,{task:T},T.id))]})]})]})}function ZL({lane:e,col:t,spanEnd:n}){const{setNodeRef:r,isOver:i}=Hh({id:e.id}),s=ue(f=>{var v,_;return(((_=(v=f.project)==null?void 0:v.stepGates)==null?void 0:_[e.id])??MS[e.id])==="ask"}),[l,c]=b.useState(!1),h=M1(t,n),u=l?h:1,p=DL(h);return g.jsxs(g.Fragment,{children:[g.jsx(I1,{lane:e,style:{gridColumn:t,gridRow:1},className:"sticky top-0 z-[5] flex items-center justify-center gap-1.5 rounded bg-ink-900 pb-1 text-center",children:g.jsx("span",{className:"whitespace-nowrap text-xs font-semibold",children:e.title})}),g.jsx("div",{ref:r,style:{gridColumn:t,gridRow:"2 / -1"},className:`rounded-lg border-r border-dashed transition-colors ${s?"border-indigo-500/60":"border-ink-600/40"} ${i?"bg-ink-700/60":""}`}),Hg.includes(e.id)&&g.jsx("div",{style:{gridColumn:`${t} / span ${u}`,gridRow:2},className:`${l?"z-30":"z-20"} flex items-start px-1 pt-1`,children:g.jsx(Ug,{lane:e.id,onFocusedChange:c,collapsedWidth:p})})]})}function GL({task:e,row:t,col:n,spanEnd:r}){const i=M1(n,r);return g.jsx("div",{style:{gridColumn:`${n} / span ${i}`,gridRow:t},className:"z-10 self-center p-1",children:g.jsx(Wg,{task:e})})}function JL({status:e}){return e.display==="dot"?g.jsx("span",{title:e.title,className:`mt-1 h-2 w-2 animate-pulse rounded-full ${e.dotClass}`}):e.display==="text"?g.jsx("span",{title:e.title,className:"text-[11px] text-ink-300",children:e.label}):g.jsxs("span",{title:e.title,className:`rounded px-1 text-[11px] font-semibold ${e.pillClass}`,children:[e.icon," ",e.label]})}function Wg({task:e}){const{attributes:t,listeners:n,setNodeRef:r,isDragging:i}=P1({id:e.id}),s=ue(S=>S.select),l=ue(S=>S.selectedTaskId===e.id),[c,h]=b.useState(null);function u(S){S.preventDefault(),S.stopPropagation(),h({x:S.clientX,y:S.clientY})}const p=b.useRef(null),f=b.useRef(null);function v(){p.current!==null&&(window.clearTimeout(p.current),p.current=null)}function _(S){const k=S.touches[0];k&&(f.current={x:k.clientX,y:k.clientY},v(),p.current=window.setTimeout(()=>h({x:k.clientX,y:k.clientY}),500))}function x(S){const k=S.touches[0],C=f.current;!k||!C||Math.hypot(k.clientX-C.x,k.clientY-C.y)>10&&v()}return b.useEffect(()=>()=>v(),[]),g.jsx(j1,{task:e,dragging:i,selected:l,innerRef:r,handlers:{...n,...t,onClick:()=>s(e.id),onContextMenu:u,onTouchStart:_,onTouchMove:x,onTouchEnd:v,onTouchCancel:v},menu:c&&g.jsx(QL,{task:e,at:c,onClose:()=>h(null)})})}function j1({task:e,dragging:t,overlay:n,selected:r,innerRef:i,handlers:s,menu:l}){const c=ue(j=>j.openPreviewModal),h=ue(j=>j.openMockupModal),u=$g(),p=ue(j=>{var R;return(R=j.agents[e.id])==null?void 0:R.status}),f=p&&p!=="none"?p:e.sessionState,v=ue(j=>{let R=!1;for(const U of e.forks??[]){const V=Rh(j.agents[U.key]);if(V==="input")return"input";V==="thinking"&&(R=!0)}return R?"running":"none"}),_=RL(e,f,v),x=ue(j=>{var R;return(R=j.agents[e.id])==null?void 0:R.events}),S=ue(j=>{var R;return(R=j.agents[e.id])==null?void 0:R.resolved}),k=ue(j=>{var R;return(R=j.project)==null?void 0:R.id}),C=ue(j=>j.markResolved),T=x==null?void 0:x[x.length-1],N=!n&&(T==null?void 0:T.type)==="advance_proposal"&&!(S!=null&&S.has(T.id))?T:null,M=N&&nr.indexOf(N.toLane)-nr.indexOf(e.status)===1,B=(e.runs??[]).filter(j=>(j.status==="running"||j.status==="starting")&&j.url).at(-1),A=e.mockup??null,D=e.title||e.shortDescription||"Preview",$=ue(j=>!n&&!!j.foldPulse[e.id]);return g.jsxs("div",{ref:i,...s,className:`relative cursor-grab rounded-md border bg-ink-700 p-2.5 pb-4 text-sm shadow-sm hover:border-indigo-500 ${r?"border-indigo-400 ring-1 ring-indigo-400/50 bg-ink-600":(_==null?void 0:_.borderClass)??"border-ink-500"} ${t?"opacity-40":""} ${n?"rotate-1 cursor-grabbing shadow-lg":""} ${$?"animate-fold-pulse":""}`,children:[e.size&&g.jsx("span",{title:`Estimated size: ${e.size.toUpperCase()}`,className:"absolute top-0 right-0 rounded-bl rounded-tr-md bg-ink-600 px-1 py-0 text-[11px] font-semibold uppercase text-ink-300",children:e.size}),(_==null?void 0:_.display)==="text"&&g.jsx("span",{className:"absolute right-1.5 -bottom-0.5 text-[11px] text-ink-350",title:_.title,children:_.label}),g.jsxs("div",{className:"flex items-start gap-2",children:[e.status!=="backlog"&&e.status!=="done"&&g.jsx("span",{title:`Task ${e.id}`,className:"w-1.5 shrink-0 self-stretch rounded-full",style:{backgroundColor:e.colorMarker??BS(e.id).hsl}}),g.jsx("div",{className:"min-w-0 flex-1",children:g.jsx("div",{className:`leading-snug line-clamp-2 ${e.title?"font-medium":"text-ink-200"}`,children:e.title||e.shortDescription||"Untitled"})})]}),e.title&&e.shortDescription&&g.jsx("div",{className:"mt-1 line-clamp-2 text-xs text-ink-350",children:e.shortDescription}),(()=>{var V,Y;const j=TL(e.runs),R=N&&k?g.jsxs("button",{title:N.rationale??`→ ${N.toLane}`,className:`rounded px-2 py-1 text-xs font-medium leading-none text-white ${M?"bg-emerald-600 hover:bg-emerald-500":"bg-blue-600 hover:bg-blue-500"}`,onClick:async W=>{W.stopPropagation(),await ke.decideAdvance(k,e.id,N.id,!0,N.toLane),C(e.id,N.id)},onPointerDown:W=>W.stopPropagation(),children:["→ ",((V=xa.find(W=>W.id===N.toLane))==null?void 0:V.title)??N.toLane]}):!N&&e.proposedLane&&k?g.jsxs("button",{title:`Start in ${e.proposedLane}`,className:"rounded bg-emerald-600 px-2 py-1 text-xs font-medium leading-none text-white hover:bg-emerald-500",onClick:async W=>{W.stopPropagation(),await ke.moveTask(k,e.id,e.proposedLane)},onPointerDown:W=>W.stopPropagation(),children:["→ ",((Y=xa.find(W=>W.id===e.proposedLane))==null?void 0:Y.title)??e.proposedLane]}):null,U=(_==null?void 0:_.display)!=="text"?_:null;return j===null&&!U&&!R?null:g.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[j!==null&&g.jsxs("span",{title:`${j} run${j===1?"":"s"} active`,className:"rounded bg-emerald-500/25 px-1 text-[10px] font-semibold text-emerald-300",children:["⚙ ",j]}),U&&g.jsx(JL,{status:U}),R&&g.jsx("span",{className:"ml-auto",children:R})]})})(),e.grooming&&g.jsxs("div",{className:"mt-1.5 flex items-center gap-1 text-[11px] text-indigo-300/90",title:"The orchestrator is grooming this idea — deciding whether it's a new task, a clarification that folds into an existing one, or should be dropped.",children:[g.jsx(ka,{size:11,className:"shrink-0 animate-spin"}),g.jsx("span",{className:"truncate",children:"grooming…"})]}),e.status==="ci"&&e.mergeQueuePosition!==void 0&&g.jsx("div",{className:"mt-1.5 text-[11px] text-amber-400/80",children:e.mergeQueuePosition===0?"merging…":`#${e.mergeQueuePosition+1} in merge queue`}),e.runningHook&&g.jsxs("div",{className:"mt-1.5 flex items-center gap-1 text-[11px] text-sky-400/80",title:`Harness pre-flight running in the worktree — the agent starts when it finishes.
267
+
268
+ ${e.runningHook.command}`,children:[g.jsx(ka,{size:11,className:"shrink-0 animate-spin"}),g.jsxs("span",{className:"truncate",children:["running ",e.runningHook.lane," hook…"]})]}),e.prUrl&&g.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noreferrer",onClick:j=>j.stopPropagation(),onPointerDown:j=>j.stopPropagation(),className:"mt-1 inline-block rounded bg-emerald-900/50 px-1.5 py-0.5 text-[11px] text-emerald-300 hover:bg-emerald-800/60",children:["PR",e.prNumber?` #${e.prNumber}`:""," ↗"]}),((B==null?void 0:B.url)||A)&&g.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",onPointerDown:j=>j.stopPropagation(),children:[(B==null?void 0:B.url)&&g.jsxs("div",{className:"inline-flex min-w-16 items-stretch overflow-hidden rounded bg-indigo-900/50 text-xs text-indigo-200",children:[g.jsx("a",{href:B.url,target:"_blank",rel:"noreferrer",title:"Open in new tab",onClick:j=>j.stopPropagation(),className:"px-2 py-1 hover:bg-indigo-800/60",children:"↗"}),g.jsx("span",{className:"w-px bg-indigo-800/60"}),g.jsx("button",{title:B.url,onClick:j=>{j.stopPropagation(),u?window.open(B.url,"_blank","noreferrer"):c(B.url,D,e.id)},className:"px-2 py-1 hover:bg-indigo-800/60",children:B.url.replace(/^https?:\/\/(?:localhost|127\.0\.0\.1)/,"").replace(/\/.*$/,"")})]}),A&&g.jsx("button",{title:`Open mock: ${A.title}`,onClick:j=>{j.stopPropagation(),h({title:A.title,html:A.html,css:A.css},D,e.id)},className:"inline-flex items-center gap-1 rounded bg-indigo-900/50 px-2 py-1 text-xs text-indigo-200 hover:bg-indigo-800/60",children:"◫ mock"})]}),l]})}function QL({task:e,at:t,onClose:n}){const r=ue(f=>f.project),i=ue(f=>{var v;return((v=f.board)==null?void 0:v.lanes)??[]}),s=ue(f=>f.select),l=b.useRef(null),[c,h]=b.useState(t);b.useEffect(()=>{const f=v=>{v.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),b.useLayoutEffect(()=>{const f=l.current;if(!f)return;const{width:v,height:_}=f.getBoundingClientRect();h({x:Math.min(t.x,window.innerWidth-v-8),y:Math.min(t.y,window.innerHeight-_-8)})},[t]);async function u(f){if(n(),!(!r||e.status===f))try{await ke.moveTask(r.id,e.id,f)}catch(v){alert(`Move failed: ${v instanceof Error?v.message:v}`)}}async function p(){if(n(),!(!r||!window.confirm(`Delete "${e.title}"?
269
+
270
+ This stops its agent and permanently removes its worktree, branch checkout, history, and card. This cannot be undone.`)))try{await ke.deleteTask(r.id,e.id),ue.getState().selectedTaskId===e.id&&s(void 0)}catch(v){alert(`Delete failed: ${v instanceof Error?v.message:v}`)}}return g.jsx("div",{className:"fixed inset-0 z-50",onClick:n,onContextMenu:f=>{f.preventDefault(),n()},children:g.jsxs("div",{ref:l,style:{left:c.x,top:c.y},onClick:f=>f.stopPropagation(),className:"fixed min-w-44 overflow-hidden rounded-md border border-ink-500 bg-ink-700 py-1 text-sm shadow-lg",children:[g.jsx("div",{className:"px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-ink-400",children:"Move to"}),i.filter(f=>f.id!==e.status).map(f=>g.jsx("button",{onClick:()=>u(f.id),className:"block w-full px-3 py-1.5 text-left hover:bg-ink-600",children:f.title},f.id)),g.jsx("div",{className:"my-1 border-t border-ink-500"}),g.jsx("button",{onClick:p,className:"block w-full px-3 py-1.5 text-left text-red-400 hover:bg-ink-600",children:"Delete…"})]})})}function eO({title:e,items:t,at:n,onClose:r}){const i=ue(f=>f.project),s=ue(f=>f.showToast),l=b.useRef(null),[c,h]=b.useState(n),u=t.length===1;b.useEffect(()=>{const f=v=>{v.key==="Escape"&&r()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r]),b.useLayoutEffect(()=>{const f=l.current;if(!f)return;const{width:v,height:_}=f.getBoundingClientRect();h({x:Math.min(n.x,window.innerWidth-v-8),y:Math.min(n.y,window.innerHeight-_-8)})},[n]);async function p(f,v){if(r(),!!i)try{const{path:_,existed:x}=await ke.customizePrompt(i.id,f,v);s(`${x?"Opened existing":"Created"} prompt override: ${_}`)}catch(_){s(`Customize prompt failed: ${_ instanceof Error?_.message:_}`)}}return Or.createPortal(g.jsx("div",{className:"fixed inset-0 z-50",onClick:r,onContextMenu:f=>{f.preventDefault(),r()},children:g.jsxs("div",{ref:l,style:{left:c.x,top:c.y},onClick:f=>f.stopPropagation(),className:"fixed min-w-52 overflow-hidden rounded-md border border-ink-500 bg-ink-700 py-1 text-sm shadow-lg",children:[g.jsx("div",{className:"px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-ink-400",children:e}),t.map((f,v)=>g.jsxs(b.Fragment,{children:[f.label&&g.jsx("div",{className:"px-3 pt-1.5 text-[11px] font-medium text-ink-300",children:f.label}),g.jsx("button",{onClick:()=>p(f.target,"project"),className:"block w-full px-3 py-1.5 text-left hover:bg-ink-600",children:u?"Project (this repo)":"Project"}),g.jsx("button",{onClick:()=>p(f.target,"user"),className:"block w-full px-3 py-1.5 text-left hover:bg-ink-600",children:u?"User (all projects)":"User"})]},v))]})}),document.body)}function tO(){const[e,t]=b.useState(null),n=b.useRef(null);function r(){n.current!==null&&(window.clearTimeout(n.current),n.current=null)}return b.useEffect(()=>()=>r(),[]),{handlers:{onContextMenu:s=>{s.preventDefault(),s.stopPropagation(),t({x:s.clientX,y:s.clientY})},onTouchStart:s=>{const l=s.touches[0];l&&(r(),n.current=window.setTimeout(()=>t({x:l.clientX,y:l.clientY}),500))},onTouchMove:r,onTouchEnd:r,onTouchCancel:r},at:e,openAt:(s,l)=>t({x:s,y:l}),close:()=>t(null)}}const nO={ask:"Ask",policy:"Default",auto:"Auto"},rO={ask:"Always pause for you to confirm leaving this phase, even when the dev-speed would auto-advance.",policy:"Follow the project's dev-speed policy: auto-advance only when the agent is confident and the speed allows.",auto:"Always auto-advance when this phase finishes (still never silently skips a required lane like implementation or ci)."};function I1({lane:e,className:t,style:n,children:r}){return e.automated||e.id==="backlog"||e.id==="done"?g.jsxs(e1,{children:[g.jsx(t1,{asChild:!0,children:g.jsx("button",{type:"button",style:n,className:`${t} cursor-pointer transition-colors hover:bg-ink-700/70 hover:text-indigo-200 data-[state=open]:bg-ink-700/70 data-[state=open]:text-indigo-200`,children:r})}),g.jsx(n1,{children:g.jsx(r1,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,className:"z-50 w-64 overflow-hidden rounded-md border border-ink-500 bg-ink-700 py-1 text-sm text-ink-100 shadow-lg focus:outline-none",children:g.jsx(B1,{lane:e})})})]}):g.jsx("div",{className:t,style:n,children:r})}function B1({lane:e}){const t=ue(u=>u.project),n=ue(u=>u.showToast),r=e.automated;function i(u){t&&ke.setSettings(t.id,u).catch(()=>{})}async function s(u){if(!t)return;const p=r?{lane:e.id}:{agent:"groom"};try{const{path:f,existed:v}=await ke.customizePrompt(t.id,p,u);n(`${v?"Opened existing":"Created"} prompt override: ${f}`)}catch(f){n(`Customize prompt failed: ${f instanceof Error?f.message:f}`)}}const l=((t==null?void 0:t.stepGates)??{})[e.id]??MS[e.id],c=((t==null?void 0:t.phaseHooks)??{})[e.id]??"",h=r?"Customize prompt":"Customize grooming prompt";return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-ink-400",children:e.title}),r&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"px-3 pt-1.5 text-[11px] font-medium text-ink-300",children:"Auto-advance"}),g.jsx("div",{className:"px-3 pb-2 pt-1",children:g.jsx("div",{className:"flex items-center overflow-hidden rounded border border-ink-600 text-[12px]",children:hg.map(u=>g.jsx("button",{onClick:()=>i({stepGates:{[e.id]:u}}),title:rO[u],className:`flex-1 px-2 py-0.5 ${l===u?"bg-indigo-600 text-white":"bg-ink-800 text-ink-300"}`,children:nO[u]},u))})})]}),(r||e.id==="done")&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"px-3 pt-1.5 text-[11px] font-medium text-ink-300",children:"Phase hook"}),g.jsx("div",{className:"px-3 pb-2 pt-1",children:g.jsx("input",{type:"text",defaultValue:c,placeholder:"(none)",spellCheck:!1,title:"Shell command run in the task's worktree on phase entry, before the agent starts.",onBlur:u=>{const p=u.target.value.trim();p!==c&&i({phaseHooks:{[e.id]:p}})},className:"w-full rounded border border-ink-600 bg-ink-900 px-2 py-1 font-mono text-[12px] text-ink-100 placeholder:text-ink-500 focus:border-indigo-500 focus:outline-none"})})]}),e.id==="backlog"&&g.jsx("div",{className:"px-3 pt-2 pb-1",children:g.jsxs("button",{onClick:()=>i({autoExpand:!(t!=null&&t.autoExpand)}),className:"flex w-full items-center justify-between gap-3 text-left",children:[g.jsxs("span",{children:[g.jsx("span",{className:"block text-[12px] font-medium text-ink-100",children:"✨ Auto-expand"}),g.jsx("span",{className:"block text-[11px] text-ink-400",children:"Auto-refine new todos via the project agent."})]}),g.jsx("span",{className:`shrink-0 rounded border px-2 py-0.5 text-[11px] ${t!=null&&t.autoExpand?"border-indigo-500 bg-indigo-600/80 text-white":"border-ink-600 bg-ink-800 text-ink-300"}`,children:t!=null&&t.autoExpand?"On":"Off"})]})}),e.id!=="done"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"my-1 border-t border-ink-500"}),g.jsx("div",{className:"px-3 pt-0.5 text-[11px] font-medium text-ink-300",children:h}),g.jsx(lx,{asChild:!0,children:g.jsx("button",{onClick:()=>s("project"),className:"block w-full px-3 py-1.5 text-left hover:bg-ink-600",children:"Project (this repo)"})}),g.jsx(lx,{asChild:!0,children:g.jsx("button",{onClick:()=>s("user"),className:"block w-full px-3 py-1.5 text-left hover:bg-ink-600",children:"User (all projects)"})})]})]})}function Ug({lane:e,onFocusedChange:t,collapsedWidth:n}){const r=ue(N=>N.project),i=`newtask:${(r==null?void 0:r.id)??""}:${e}`,[s,l]=b.useState(()=>bx(i)),[c,h]=b.useState(!1),u=b.useRef(null),p=s.trim().length>0;b.useEffect(()=>t==null?void 0:t(c),[c,t]);const[f,v]=b.useState(()=>window.innerHeight);b.useEffect(()=>{const N=()=>v(window.innerHeight);return window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]);const _=!!n&&!c&&p;b.useLayoutEffect(()=>{const N=u.current;if(!N)return;N.style.height="auto";const M=Math.floor(f*.5);N.scrollHeight>M?(N.style.height=`${M}px`,N.style.overflowY="auto",N.scrollTop=N.scrollHeight):(N.style.height=`${N.scrollHeight}px`,N.style.overflowY="hidden")},[s,c,_,f]);const x=b.useRef(i);b.useEffect(()=>{x.current!==i&&(x.current=i,l(bx(i)))},[i]);function S(N){l(N),AL(i,N)}const k=Fg(()=>s,S,N=>void T(!1,N)),C=b.useRef(!1);async function T(N=!1,M){const B=(M??s).trim();if(!(!B||!r||C.current)){C.current=!0,l(""),ML(i);try{await ke.createTask(r.id,"",B,e==="backlog"?void 0:e,N&&e==="backlog"?{kickoff:!0}:void 0)}catch(A){S(B),alert(`Create failed: ${A instanceof Error?A.message:A}`)}finally{C.current=!1}}}return g.jsxs("div",{className:"relative w-full",children:[g.jsx("div",{className:_?"overflow-hidden [mask-image:linear-gradient(to_right,black_calc(100%-1.5rem),transparent)]":"",children:g.jsx("textarea",{ref:u,rows:1,style:_?{width:n}:void 0,className:"new-task-input w-full resize-none overflow-hidden rounded-md border border-dashed border-ink-500 bg-ink-900 pt-1.5 pb-2 px-2.5 text-sm leading-tight outline-none placeholder:text-ink-350 focus:border-indigo-500",placeholder:e==="backlog"?"+ New idea…":"+",title:e==="backlog"?"Enter to add to backlog":"New task here",value:s,onChange:N=>S(N.target.value),onFocus:()=>h(!0),onBlur:()=>h(!1),onKeyDown:N=>{if(!N.nativeEvent.isComposing){if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)){N.preventDefault(),T(!0);return}N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),T())}}})}),k.supported&&g.jsx("button",{type:"button",onMouseDown:N=>N.preventDefault(),onClick:()=>k.toggle(),"aria-label":k.recording?"Stop dictation":"Dictate",title:k.recording?k.inflight?"Processing…":"Stop dictation":"Dictate (ElevenLabs)",className:`absolute right-1 top-1 flex items-center rounded px-0 py-0.5 ${k.recording?`text-red-400 ${k.inflight?"":"animate-pulse"}`:"text-ink-350 hover:text-ink-200"}`,children:k.recording?k.inflight?g.jsx(ka,{size:14,className:"animate-spin"}):g.jsx(l1,{size:14,fill:"currentColor"}):g.jsx(s1,{size:14})}),k.error&&g.jsx("div",{className:"mt-1 text-xs text-red-400",children:k.error})]})}function Vg({onPick:e,onClose:t}){const[n,r]=b.useState(void 0),[i,s]=b.useState(null),[l,c]=b.useState(null);return b.useEffect(()=>{let h=!0;return ke.listDir(n).then(u=>h&&(s(u),c(null))).catch(u=>h&&c(u instanceof Error?u.message:String(u))),()=>{h=!1}},[n]),g.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/60 md:items-center",onClick:t,children:g.jsxs("div",{className:"flex h-[85vh] w-full flex-col rounded-t-2xl border border-ink-600 bg-ink-800 shadow-xl md:h-[70vh] md:w-[640px] md:rounded-lg",onClick:h=>h.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-ink-600 px-3 py-2",children:[g.jsx("span",{className:"font-semibold",children:"Open folder"}),g.jsx("button",{className:"ml-auto rounded px-2 py-1 text-ink-400 hover:text-white",onClick:t,children:"✕"})]}),g.jsxs("div",{className:"flex items-center gap-2 border-b border-ink-600 px-3 py-2 text-xs",children:[g.jsx("button",{className:"rounded bg-ink-700 px-2 py-1 disabled:opacity-40",disabled:!(i!=null&&i.parent),onClick:()=>(i==null?void 0:i.parent)&&r(i.parent),children:"↑ Up"}),g.jsx("span",{className:"truncate font-mono text-ink-300",children:(i==null?void 0:i.path)??"…"})]}),g.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[l&&g.jsx("div",{className:"p-2 text-sm text-red-400",children:l}),(i==null?void 0:i.entries.length)===0&&!l&&g.jsx("div",{className:"p-2 text-sm text-ink-400",children:"No subfolders."}),i==null?void 0:i.entries.map(h=>g.jsxs("button",{onDoubleClick:()=>r(h.path),onClick:()=>r(h.path),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm hover:bg-ink-700",children:[g.jsx("span",{children:"📁"}),g.jsx("span",{className:"truncate",children:h.name}),h.hasGit&&g.jsx("span",{className:"ml-auto rounded bg-indigo-900/60 px-1.5 text-[11px] text-indigo-300",children:"git"})]},h.path))]}),g.jsxs("div",{className:"flex items-center gap-2 border-t border-ink-600 px-3 py-2 pb-safe md:pb-2",children:[g.jsx("span",{className:"truncate font-mono text-xs text-ink-400",children:i==null?void 0:i.path}),g.jsx("button",{className:"ml-auto rounded bg-indigo-600 px-3 py-1.5 text-sm font-medium hover:bg-indigo-500 disabled:opacity-50",disabled:!(i!=null&&i.path),onClick:()=>(i==null?void 0:i.path)&&e(i.path),children:"Open this folder"})]})]})})}function z1(e){return e==null||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e)))}function F1(e){return e?e<1e12?e*1e3:e:null}function $1(e,t){const n=F1(e);if(n==null)return null;const r=n-t;if(r<=0)return"now";const i=Math.round(r/6e4);if(i<60)return`${i}m`;const s=Math.floor(i/60),l=i%60;return s<24?l?`${s}h ${l}m`:`${s}h`:`${Math.floor(s/24)}d ${s%24}h`}function iO(e,t){const n=F1(e);if(n==null)return"—";const r=n-t;if(r<=0)return"now";const i=Math.round(r/6e4);if(i<60)return`${i}m`;const s=Math.round(i/60);return s<24?`${s}h`:`${Math.ceil(s/24)}d`}function sO(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function H1(e,t){return(e==null?void 0:e.status)==="rejected"||(t??0)>=90?"high":(e==null?void 0:e.status)==="allowed_warning"||(t??0)>=75?"warn":"ok"}function oO(e,t){const n=H1(e,t);return{pct:n==="high"?"text-red-400":n==="warn"?"text-amber-400":"text-indigo-300",text:n==="high"?"text-red-300":n==="warn"?"text-amber-300":"text-ink-300"}}function lO(e,t){const n=H1(e,t);return n==="high"?"#ef4444":n==="warn"?"#f59e0b":"#10b981"}function aO(e,t){var c,h;const n=t.W-t.padL-t.padR,r=t.H-t.padT-t.padB,i=((c=e[0])==null?void 0:c.t)??0,s=((h=e[e.length-1])==null?void 0:h.t)??i,l=Math.max(1,s-i);return{t0:i,t1:s,x:u=>t.padL+(u-i)/l*n,y:u=>t.padT+(1-u/100)*r}}function cO(e,t,n){return e.filter(r=>r[t]!=null).map(r=>`${n.x(r.t).toFixed(1)},${n.y(r[t]).toFixed(1)}`).join(" ")}const uO=[["startup","🚀","Startup","Collapse to a minimal path; auto-accept permitted skips"],["company","🏢","Company","Trim verification (and review for small tasks)"],["enterprise","🏛","Enterprise","Full ceremony; no phase skipping"]],hO=[["local","Review & merge locally; no PR"],["remote","Open PRs, run CI, verify the deployment"]],dO=[["none","None","Keep nothing warm; only the open preview is live, dropped on close."],["last-open","Last open","Cache only the last opened preview, so close-and-reopen is instant."],["eager","Eager","Keep the last opened plus 1 precached preview not yet viewed."],["all-active","All active","Keep every running preview warm. Fastest, but heaviest on memory."]];function fO({onClose:e,defaultTab:t="projects"}){const[n,r]=b.useState(t),i=ue(s=>s.project);return g.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 md:items-center",onClick:e,children:g.jsxs("div",{className:"max-h-[90vh] w-full overflow-y-auto rounded-t-2xl border border-ink-600 bg-ink-800 pb-safe shadow-xl md:max-h-[85vh] md:w-[32rem] md:rounded-lg md:pb-0",onClick:s=>s.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-ink-700 px-4 pt-4 pb-0",children:[g.jsx("div",{className:"flex gap-1",children:["projects","settings"].map(s=>g.jsx("button",{onClick:()=>r(s),className:`rounded-t px-3 py-1.5 text-sm font-medium capitalize transition-colors ${n===s?"border-b-2 border-indigo-400 text-indigo-300":"text-ink-400 hover:text-ink-200"}`,children:s==="projects"?"Projects":"Settings"},s))}),g.jsx("button",{onClick:e,className:"mb-1 text-ink-400 hover:text-ink-200",children:"✕"})]}),g.jsx("div",{className:"p-4",children:n==="projects"?i?g.jsx(pO,{}):g.jsx("div",{className:"py-6 text-center text-sm text-ink-400",children:"No project selected."}):g.jsx(mO,{})})]})})}function pO(){const e=ue(n=>n.project);if(!e)return null;function t(n){e&&ke.setSettings(e.id,n).catch(()=>{})}return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mb-4 truncate text-xs text-ink-400",title:e.path,children:[e.name," · ",g.jsx("span",{className:"font-mono",children:e.path})]}),g.jsxs("section",{className:"mb-4",children:[g.jsx("div",{className:"mb-1 text-sm font-medium text-ink-100",children:"Review mode"}),g.jsx("div",{className:"mb-2 text-xs text-ink-400",children:"How completed work gets reviewed and landed."}),g.jsx("div",{className:"flex items-center overflow-hidden rounded border border-ink-600 text-xs",children:hO.map(([n,r])=>g.jsx("button",{onClick:()=>t({reviewMode:n}),title:r,className:`px-3 py-1 capitalize ${e.reviewMode===n?"bg-indigo-600 text-white":"bg-ink-700 text-ink-300"}`,children:n},n))})]}),g.jsxs("section",{className:"mb-4",children:[g.jsx("div",{className:"mb-1 text-sm font-medium text-ink-100",children:"Dev speed"}),g.jsx("div",{className:"mb-2 text-xs text-ink-400",children:"How aggressively tasks skip intermediate phases."}),g.jsx("div",{className:"flex items-center overflow-hidden rounded border border-ink-600 text-xs",children:uO.map(([n,r,i,s])=>g.jsxs("button",{onClick:()=>t({devSpeed:n}),title:s,className:`px-3 py-1 ${e.devSpeed===n?"bg-indigo-600 text-white":"bg-ink-700 text-ink-300"}`,children:[r," ",i]},n))})]}),g.jsxs("section",{className:"mb-4",children:[g.jsx("div",{className:"mb-1 text-sm font-medium text-ink-100",children:"Preview caching"}),g.jsx("div",{className:"mb-2 text-xs text-ink-400",children:"How many board preview iframes stay warm. Lighter modes cut UI lag on heavy projects."}),g.jsx("div",{className:"flex items-center overflow-hidden rounded border border-ink-600 text-xs",children:dO.map(([n,r,i])=>{const s=e.iframeCaching??dg;return g.jsx("button",{onClick:()=>t({iframeCaching:n}),title:i,className:`px-3 py-1 ${s===n?"bg-indigo-600 text-white":"bg-ink-700 text-ink-300"}`,children:r},n)})})]})]})}function mO(){const[e,t]=b.useState(null),[n,r]=b.useState(nb),[i,s]=b.useState(rb),[l,c]=b.useState(""),[h,u]=b.useState(""),[p,f]=b.useState(!1),[v,_]=b.useState(null),[x,S]=b.useState(""),[k,C]=b.useState("");b.useEffect(()=>{ke.getGlobalSettings().then(j=>{t(j.settings),u(j.settings.dictationSubmitKeywords??"shazam")}).catch(j=>_(j instanceof Error?j.message:String(j)))},[]);async function T(j){f(!0),_(null);try{const R=await j();t(R.settings)}catch(R){_(R instanceof Error?R.message:String(R))}finally{f(!1)}}async function N(j){await T(()=>ke.setGlobalSettings({elevenLabsApiKey:j})),c("")}async function M(){await T(()=>ke.setGlobalSettings({dictationSubmitKeywords:h.trim()||"shazam"})),zL()}async function B(){!x.trim()||!k.trim()||(await T(()=>ke.addAccount(x.trim(),k.trim())),S(""),C(""))}async function A(){const j=!(e!=null&&e.passthroughUserSettings);await T(()=>ke.setGlobalSettings({passthroughUserSettings:j}))}const D=e==null?void 0:e.elevenLabsApiKey,$=(e==null?void 0:e.claudeAccounts)??[];return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"mb-2 text-sm font-medium text-ink-200",children:"Claude accounts"}),g.jsxs("div",{className:"mb-2 text-xs text-ink-400",children:["Add two or more Claude Code accounts. When the active one hits its usage limit, Operator automatically switches running agents to a backup and switches back when an account resets. Use a token from ",g.jsx("span",{className:"font-mono",children:"claude setup-token"}),". Stored locally in"," ",g.jsx("span",{className:"font-mono",children:"~/.operator/settings.json"}),"."]}),$.length>0&&g.jsx("div",{className:"mb-2 divide-y divide-ink-700 rounded border border-ink-700",children:$.map(j=>g.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-sm",children:[g.jsx("span",{className:"truncate",children:j.label}),g.jsxs("span",{className:"font-mono text-xs text-ink-400",children:["••••",j.last4]}),j.active?g.jsx("span",{className:"rounded bg-emerald-600/30 px-1.5 py-0.5 text-[10px] text-emerald-300",children:"active"}):g.jsx("button",{disabled:p,onClick:()=>T(()=>ke.activateAccount(j.id)),className:"rounded border border-ink-600 px-1.5 py-0.5 text-[10px] text-ink-300 hover:bg-ink-700 disabled:opacity-50",children:"use"}),j.exhaustedUntil&&g.jsxs("span",{className:"rounded bg-amber-600/20 px-1.5 py-0.5 text-[10px] text-amber-300",children:["limit · resets ",sO(j.exhaustedUntil)]}),g.jsx("button",{disabled:p,onClick:()=>T(()=>ke.removeAccount(j.id)),className:"ml-auto text-xs text-red-400 hover:text-red-300 disabled:opacity-50",title:"Remove account",children:"✕"})]},j.id))}),g.jsxs("div",{className:"mb-1 flex gap-2",children:[g.jsx("input",{autoComplete:"off",className:"w-28 rounded bg-ink-700 px-2 py-1 text-sm outline-none placeholder:text-ink-400",placeholder:"Label",value:x,onChange:j=>S(j.target.value)}),g.jsx("input",{type:"password",autoComplete:"off",className:"flex-1 rounded bg-ink-700 px-2 py-1 text-sm outline-none placeholder:text-ink-400",placeholder:"sk-ant-oat… (OAuth token)",value:k,onChange:j=>C(j.target.value),onKeyDown:j=>j.key==="Enter"&&B()}),g.jsx("button",{disabled:p||!x.trim()||!k.trim(),onClick:B,className:"rounded bg-indigo-600 px-3 text-sm hover:bg-indigo-500 disabled:opacity-50",children:"Add"})]}),g.jsx("div",{className:"mt-5 mb-1 text-sm font-medium text-ink-200",children:"ElevenLabs API key"}),g.jsx("div",{className:"mb-1 text-xs text-ink-400",children:"Used for voice dictation (Scribe v2)."}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"password",autoComplete:"off",className:"flex-1 rounded bg-ink-700 px-2 py-1 text-sm outline-none placeholder:text-ink-400",placeholder:D!=null&&D.isSet?`Set ••••${D.last4??""} — enter to replace`:"xi-…",value:l,onChange:j=>c(j.target.value),onKeyDown:j=>j.key==="Enter"&&l.trim()&&N(l.trim())}),g.jsx("button",{disabled:p||!l.trim(),onClick:()=>N(l.trim()),className:"rounded bg-indigo-600 px-3 text-sm hover:bg-indigo-500 disabled:opacity-50",children:"Save"})]}),(D==null?void 0:D.isSet)&&g.jsx("button",{disabled:p,onClick:()=>N(""),className:"mt-2 text-xs text-red-400 hover:text-red-300 disabled:opacity-50",children:"Clear key"}),g.jsx("div",{className:"mt-5 mb-1 text-sm font-medium text-ink-200",children:"Voice submit keywords"}),g.jsx("div",{className:"mb-1 text-xs text-ink-400",children:"Comma-separated words/phrases — say one at the end of a dictated message to submit it. Punctuation between words is ignored."}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"text",className:"flex-1 rounded bg-ink-700 px-2 py-1 text-sm outline-none placeholder:text-ink-400",placeholder:"shazam",value:h,onChange:j=>u(j.target.value),onKeyDown:j=>j.key==="Enter"&&M()}),g.jsx("button",{disabled:p,onClick:M,className:"rounded bg-indigo-600 px-3 text-sm hover:bg-indigo-500 disabled:opacity-50",children:"Save"})]}),g.jsx("div",{className:"mt-5 mb-1 text-sm font-medium text-ink-200",children:"Agent settings passthrough"}),g.jsxs("div",{className:"mb-2 text-xs text-ink-400",children:["When on, agent sessions inherit your"," ",g.jsx("span",{className:"font-mono",children:"~/.claude"})," settings (model defaults, hooks, autoCompact…) via ",g.jsx("span",{className:"font-mono",children:"settingSources"}),". When off (default), only project/local sources load and autoCompact is forced on so agents self-manage their context window."]}),g.jsxs("button",{disabled:p,onClick:A,role:"switch","aria-checked":!!(e!=null&&e.passthroughUserSettings),className:"flex items-center gap-2 text-sm text-ink-200 disabled:opacity-50",children:[g.jsx("span",{className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${e!=null&&e.passthroughUserSettings?"bg-indigo-600":"bg-ink-600"}`,children:g.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e!=null&&e.passthroughUserSettings?"translate-x-4":"translate-x-0.5"}`})}),e!=null&&e.passthroughUserSettings?"On":"Off"]}),g.jsx("div",{className:"mt-5 mb-1 text-sm font-medium text-ink-200",children:"Browser preferences"}),g.jsxs("button",{onClick:()=>{const j=!n;r(j),YR(j),j&&Jp(i)},role:"switch","aria-checked":n,className:"flex items-center gap-2 text-sm text-ink-200",children:[g.jsx("span",{className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${n?"bg-indigo-600":"bg-ink-600"}`,children:g.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n?"translate-x-4":"translate-x-0.5"}`})}),"Sound on input needed"]}),g.jsx("div",{className:"mt-1 mb-2 text-xs text-ink-400",children:"Play a notification sound when a task needs your attention (permission, clarification, or advance)."}),n&&g.jsx("div",{className:"divide-y divide-ink-700 rounded border border-ink-700",children:tb.map(j=>g.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[g.jsx("input",{type:"radio",id:`sound-${j.id}`,name:"sound-type",checked:i===j.id,onChange:()=>{s(j.id),XR(j.id)},className:"accent-indigo-500"}),g.jsx("label",{htmlFor:`sound-${j.id}`,className:"flex-1 cursor-pointer text-sm text-ink-200",children:j.label}),g.jsx("button",{onClick:()=>Jp(j.id),className:"rounded border border-ink-600 px-1.5 py-0.5 text-[10px] text-ink-300 hover:bg-ink-700",title:"Preview",children:"▶"})]},j.id))}),v&&g.jsx("div",{className:"mt-2 text-xs text-red-400",children:v})]})}function gO({onClose:e}){const t=ue(D=>D.projects),n=ue(D=>D.project),r=ue(D=>D.setProjects),i=ue(D=>D.clearProject),[s,l]=b.useState(!1),[c,h]=b.useState(null),[u,p]=b.useState(""),[f,v]=b.useState(""),[_,x]=b.useState(!1),[S,k]=b.useState(null);async function C(){const D=await ke.listProjects();r(D.projects)}async function T(D){x(!0),k(null);try{await vg(D)}catch($){k($ instanceof Error?$.message:String($))}finally{x(!1)}}function N(D){h(D.id),p(D.name),v(D.trunk),k(null)}async function M(D){x(!0),k(null);try{await ke.updateProject(D.id,{name:u.trim(),trunk:f.trim()}),await C(),h(null)}catch($){k($ instanceof Error?$.message:String($))}finally{x(!1)}}async function B(D){await Th(D.id),e()}async function A(D){if(confirm(`Forget "${D.name}"? This won't touch the repo — only removes it from Operator.`)){x(!0),k(null);try{await ke.removeProject(D.id),(n==null?void 0:n.id)===D.id&&i(),await C()}catch($){k($ instanceof Error?$.message:String($))}finally{x(!1)}}}return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 md:items-center",onClick:e,children:g.jsxs("div",{className:"flex max-h-[90vh] w-full flex-col rounded-t-2xl border border-ink-600 bg-ink-800 shadow-xl md:max-h-[85vh] md:w-[40rem] md:rounded-lg",onClick:D=>D.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-ink-600 px-4 py-3",children:[g.jsx("div",{className:"font-semibold text-indigo-300",children:"Manage projects"}),g.jsx("button",{onClick:e,className:"text-ink-400 hover:text-ink-200",children:"✕"})]}),g.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:[t.length===0&&g.jsx("div",{className:"px-1 py-6 text-center text-sm text-ink-400",children:"No projects yet. Add one below."}),g.jsx("div",{className:"flex flex-col gap-2",children:t.map(D=>{const $=(n==null?void 0:n.id)===D.id,j=c===D.id;return g.jsx("div",{className:`rounded-lg border p-3 ${$?"border-indigo-500/60 bg-ink-700/40":"border-ink-600 bg-ink-700/20"}`,children:j?g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("label",{className:"flex flex-col gap-1 text-xs text-ink-400",children:["Name",g.jsx("input",{autoFocus:!0,className:"rounded bg-ink-900 px-2 py-1 text-sm text-ink-100 outline-none",value:u,onChange:R=>p(R.target.value)})]}),g.jsxs("label",{className:"flex flex-col gap-1 text-xs text-ink-400",children:["Trunk branch",g.jsx("input",{className:"rounded bg-ink-900 px-2 py-1 font-mono text-sm text-ink-100 outline-none",value:f,onChange:R=>v(R.target.value)})]}),g.jsx("div",{className:"truncate font-mono text-[12px] text-ink-500",title:D.path,children:D.path}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{disabled:_,onClick:()=>M(D),className:"rounded bg-indigo-600 px-3 py-1 text-xs font-medium hover:bg-indigo-500 disabled:opacity-50",children:"Save"}),g.jsx("button",{onClick:()=>h(null),className:"rounded border border-ink-600 bg-ink-700 px-3 py-1 text-xs text-ink-300 hover:bg-ink-600",children:"Cancel"})]})]}):g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"truncate text-sm font-medium text-ink-100",children:D.name}),$&&g.jsx("span",{className:"rounded bg-indigo-900/60 px-1.5 text-[11px] text-indigo-300",children:"open"}),g.jsx("span",{className:"rounded bg-ink-800 px-1.5 font-mono text-[11px] text-ink-400",children:D.trunk})]}),g.jsx("div",{className:"truncate font-mono text-[12px] text-ink-500",title:D.path,children:D.path})]}),g.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[g.jsx("button",{disabled:_||$,onClick:()=>B(D),className:"rounded bg-indigo-600 px-2.5 py-1 text-xs font-medium hover:bg-indigo-500 disabled:opacity-40",children:"Open"}),g.jsx("button",{onClick:()=>N(D),className:"rounded border border-ink-600 bg-ink-700 px-2.5 py-1 text-xs text-ink-300 hover:bg-ink-600",children:"Edit"}),g.jsx("button",{disabled:_,onClick:()=>A(D),title:"Forget this project (non-destructive)",className:"rounded border border-red-800 bg-red-950/40 px-2.5 py-1 text-xs text-red-300 hover:bg-red-900/50 disabled:opacity-50",children:"Remove"})]})]})},D.id)})})]}),g.jsxs("div",{className:"flex items-center gap-3 border-t border-ink-600 px-4 py-3 pb-safe md:pb-3",children:[g.jsx("button",{disabled:_,onClick:()=>l(!0),className:"rounded bg-indigo-600 px-3 py-1.5 text-sm font-medium hover:bg-indigo-500 disabled:opacity-50",children:"+ Add new project…"}),S&&g.jsx("span",{className:"truncate text-xs text-red-400",children:S})]})]})}),s&&g.jsx(Vg,{onClose:()=>l(!1),onPick:D=>{l(!1),T(D)}})]})}const vO=["queued","starting","running"],_O=e=>vO.includes(e.status);function yO(){const e=ue(u=>u.project),t=ue(u=>u.board),[n,r]=b.useState("");if(!e)return null;const i=e.runConfigs??[],s=(t==null?void 0:t.projectRuns)??[],l=i.find(u=>u.id===n)??i[0],c=l?s.filter(u=>u.name===l.name&&_O(u)).sort((u,p)=>u.startedAt.localeCompare(p.startedAt)).at(-1):void 0;async function h(){!e||!l||(c?await ke.stopProjectRun(e.id,c.id).catch(()=>{}):await ke.startProjectRun(e.id,l.id).catch(()=>{}))}return g.jsxs("div",{className:"flex items-center",children:[g.jsx("select",{value:(l==null?void 0:l.id)??"",onChange:u=>r(u.target.value),disabled:i.length===0,title:"Run configuration (defined as files in .operator/run-configs/)",className:"rounded-l border border-ink-600 bg-ink-700 px-2 py-1 text-xs text-ink-200 outline-none disabled:text-ink-500",children:i.length===0?g.jsx("option",{value:"",children:"No run configs"}):i.map(u=>g.jsx("option",{value:u.id,children:u.name},u.id))}),g.jsx("button",{onClick:h,disabled:!l,title:c?`Stop ${l==null?void 0:l.name}`:l?`Run ${l.name}`:"No run config",className:`-ml-px rounded-r border px-2 py-1 text-xs disabled:opacity-50 ${c?"border-red-800 bg-red-950/40 text-red-300 hover:bg-red-900/50":"border-ink-600 bg-ink-700 text-green-300 hover:bg-ink-600"}`,children:c?"◼":"▶"}),(c==null?void 0:c.url)&&g.jsx("a",{href:c.url,target:"_blank",rel:"noreferrer",title:c.url,className:"ml-1 rounded border border-ink-600 px-1.5 py-1 text-xs text-indigo-300 hover:bg-ink-600",children:"↗"})]})}function Ex({full:e,limit:t}){const n=z1(t==null?void 0:t.utilization),r=lO(t,n),i=$1(t==null?void 0:t.resetsAt,Date.now()),s=`${e}: ${n==null?"usage unknown yet":`${n}% used`}`+(i?` · resets in ${i}`:"")+((t==null?void 0:t.status)==="rejected"?" · limit reached":"");return g.jsx("div",{className:"metric-ring flex h-8 w-8 items-center justify-center rounded-full",style:{"--ring-pct":n??0,"--ring-hex":r},title:s,children:g.jsx("div",{className:"flex h-[26px] w-[26px] items-center justify-center rounded-full bg-ink-800 text-[8px] font-semibold tabular-nums text-ink-100",children:iO(t==null?void 0:t.resetsAt,Date.now())})})}function xO(){const e=ue(l=>l.usageLimits),[t,n]=b.useState(!1);if(!e.length)return null;const r=l=>e.find(c=>c.rateLimitType===l),i=r("five_hour"),s=r("seven_day")??r("seven_day_sonnet")??r("seven_day_opus");return g.jsxs(g.Fragment,{children:[g.jsxs("button",{onClick:()=>n(!0),title:"Account usage — click for history",className:"flex items-center gap-3 rounded hover:opacity-80",children:[g.jsx(Ex,{full:"Session usage (5-hour window)",limit:i}),g.jsx(Ex,{full:"Weekly usage (7-day window)",limit:s})]}),t&&g.jsx(wO,{session:i,week:s,onClose:()=>n(!1)})]})}function wO({session:e,week:t,onClose:n}){const r=ue(i=>i.usageHistory);return b.useEffect(()=>{const i=s=>s.key==="Escape"&&n();return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[n]),g.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 md:items-center",onClick:n,children:g.jsxs("div",{className:"max-h-[90vh] w-full overflow-y-auto rounded-t-2xl border border-ink-600 bg-ink-800 p-4 pb-safe shadow-xl md:w-[40rem] md:max-w-[92vw] md:rounded-lg md:pb-4",onClick:i=>i.stopPropagation(),children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsx("div",{className:"font-semibold text-indigo-300",children:"Usage over time"}),g.jsx("button",{onClick:n,className:"text-ink-400 hover:text-ink-200",children:"✕"})]}),g.jsxs("div",{className:"mb-3 flex gap-4 text-xs",children:[g.jsx(Nx,{label:"Session (5h)",limit:e}),g.jsx(Nx,{label:"Week (7d)",limit:t})]}),g.jsx(SO,{history:r}),g.jsxs("div",{className:"mt-2 flex items-center gap-4 text-[12px] text-ink-400",children:[g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{background:"#818cf8"}})," Session (5h)"]}),g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{background:"#fbbf24"}})," Week (7d)"]}),g.jsxs("span",{className:"ml-auto",children:[r.length," samples"]})]})]})})}function Nx({label:e,limit:t}){const n=z1(t==null?void 0:t.utilization),{text:r}=oO(t,n),i=$1(t==null?void 0:t.resetsAt,Date.now());return g.jsxs("div",{className:"flex items-baseline gap-1.5",children:[g.jsx("span",{className:"text-ink-400",children:e}),g.jsx("span",{className:`text-base font-semibold tabular-nums ${r}`,children:n==null?"—":`${n}%`}),i&&g.jsxs("span",{className:"text-ink-500",children:["resets ",i]})]})}function SO({history:e}){if(e.length<2)return g.jsx("div",{style:{height:220},className:"flex items-center justify-center rounded border border-ink-700 bg-ink-900 text-sm text-ink-500",children:"Collecting usage history… (one sample per minute)"});const{t0:c,t1:h,x:u,y:p}=aO(e,{W:600,H:220,padL:28,padR:8,padT:8,padB:20}),f=_=>cO(e,_,{x:u,y:p}),v=_=>new Date(_).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return g.jsxs("svg",{viewBox:"0 0 600 220",className:"w-full rounded border border-ink-700 bg-ink-900",role:"img",children:[[0,25,50,75,100].map(_=>g.jsxs("g",{children:[g.jsx("line",{x1:28,x2:592,y1:p(_),y2:p(_),stroke:"#2a2f3a",strokeWidth:1}),g.jsx("text",{x:4,y:p(_)+3,fontSize:9,fill:"#6b7280",children:_})]},_)),g.jsx("text",{x:28,y:214,fontSize:9,fill:"#6b7280",children:v(c)}),g.jsx("text",{x:592,y:214,fontSize:9,fill:"#6b7280",textAnchor:"end",children:v(h)}),g.jsx("polyline",{points:f("sevenDay"),fill:"none",stroke:"#fbbf24",strokeWidth:1.5}),g.jsx("polyline",{points:f("fiveHour"),fill:"none",stroke:"#818cf8",strokeWidth:1.5})]})}const bO=1024*1024*1024,kO=e=>e/bO,$l=e=>`${kO(e).toFixed(1)}`;function CO(){const e=ue(t=>t.systemMetrics);return e?g.jsx(EO,{m:e}):null}function EO({m:e}){const t=NO(e.usedBytes/e.totalBytes*100);let n;e.memoryPressure?n=e.memoryPressure:n=e.freeBytes<e.reserveBytes?"critical":e.freeBytes<e.reserveBytes*1.5?"warning":"normal";const r=n==="critical",i=r?"#ef4444":n==="warning"?"#f59e0b":"#10b981",s=e.testsRunning>0||e.testsQueued>0,l=e.memoryPressure?`
271
+ Memory pressure: ${e.memoryPressure}`:"",c=`System memory: ${$l(e.usedBytes)} / ${$l(e.totalBytes)} GB used (${Math.round(t)}%), ${$l(e.freeBytes)} GB free`+l+`
272
+ Operator: ~${$l(e.operatorBytes)} GB
273
+ Test gate reserve: ${$l(e.reserveBytes)} GB free required
274
+ Tests: ${e.testsRunning} running, ${e.testsQueued} queued`;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("div",{className:`metric-ring flex h-8 w-8 items-center justify-center rounded-full ${r?"animate-pulse":""}`,style:{"--ring-pct":t,"--ring-hex":i},title:c,children:g.jsx("div",{className:"flex h-[26px] w-[26px] items-center justify-center rounded-full bg-ink-800",children:g.jsx(LA,{size:13,className:"text-ink-100"})})}),s&&g.jsxs("span",{className:`flex items-center gap-1 rounded-full px-1.5 py-px text-[10px] tabular-nums ${e.testsQueued>0?"bg-amber-950/50 text-amber-300":"bg-ink-700 text-ink-300"}`,title:`Memory-gated test runs: ${e.testsRunning} running, ${e.testsQueued} waiting for memory`,children:["🧪 ",e.testsRunning," · ",e.testsQueued]})]})}function NO(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function RO(){const e=ue(i=>{var s;return(s=i.systemMetrics)==null?void 0:s.cpuPct});if(e==null)return null;const t=Math.max(0,Math.min(100,Math.round(e))),n=t>=95,r=n?"#ef4444":t>=80?"#f59e0b":"#10b981";return g.jsx("div",{className:`metric-ring flex h-8 w-8 items-center justify-center rounded-full ${n?"animate-pulse":""}`,style:{"--ring-pct":t,"--ring-hex":r},title:`CPU: ${t}% (avg across cores)`,children:g.jsx("div",{className:"flex h-[26px] w-[26px] items-center justify-center rounded-full bg-ink-800",children:g.jsx(vA,{size:13,className:"text-ink-100"})})})}const Rx="__add__",Tx="__manage__",TO=[{label:"Orchestrator system prompt",target:{agent:"orchestrator"}}];function PO(){const e=ue(D=>D.projects),t=ue(D=>D.project),n=ue(D=>D.board),r=ue(D=>D.orchestratorOpen),i=ue(D=>D.setOrchestratorOpen),s=(n==null?void 0:n.accounts)??[],l=s.find(D=>D.active),[c,h]=b.useState(null),[u,p]=b.useState(!1),[f,v]=b.useState(!1),[_,x]=b.useState("projects"),[S,k]=b.useState(!1),[C,T]=b.useState(!1),N=tO();async function M(){if(!confirm("Stop ALL running agents across every project?"))return;const D=await ke.stopAll().catch(()=>({stopped:0,runs:0}));alert(`Stopped ${D.stopped} agent${D.stopped===1?"":"s"} and ${D.runs} process${D.runs===1?"":"es"}.`)}async function B(D){if(D.trim()){h(null);try{await vg(D)}catch($){h($ instanceof Error?$.message:String($))}}}function A(D){D===Rx?p(!0):D===Tx?k(!0):Th(D)}return g.jsxs("header",{className:"flex items-center gap-2 border-b border-ink-600 bg-ink-800 px-3 py-2 pt-safe md:gap-3 md:px-4 md:py-2.5",children:[g.jsxs("button",{onClick:()=>{x(t?"projects":"settings"),v(!0)},title:s.length>1&&l?"Settings · active account: "+l.label+`
275
+ `+s.map(D=>`${D.active?"● ":"○ "}${D.label}${D.exhaustedUntil?` — limit, resets ${new Date(D.exhaustedUntil).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}`).join(`
276
+ `):"Settings",className:"shrink-0 text-left leading-none hover:opacity-80",children:[g.jsx("span",{className:"block font-semibold tracking-tight text-indigo-300",children:"Operator"}),s.length>1&&l&&g.jsxs("span",{className:`mt-0.5 hidden max-w-[10rem] truncate text-[10px] md:block ${s.some(D=>D.exhaustedUntil)?"text-amber-300":"text-ink-200"}`,children:[l.label,s.some(D=>D.exhaustedUntil)&&" ⏳"]})]}),g.jsxs("select",{className:"min-w-0 flex-1 rounded bg-ink-700 px-2 py-1.5 text-sm outline-none md:flex-none md:py-1",value:(t==null?void 0:t.id)??"",onChange:D=>A(D.target.value),children:[g.jsx("option",{value:"",disabled:!0,children:"Select project…"}),e.map(D=>g.jsx("option",{value:D.id,children:D.name},D.id)),g.jsx("option",{disabled:!0,children:"──────────"}),g.jsx("option",{value:Rx,children:"+ Add new project…"}),g.jsx("option",{value:Tx,children:"⚙ Manage projects…"})]}),t&&g.jsx("button",{onClick:()=>i(!r),...N.handlers,title:"Project agent — ask about the project, create or refine tasks (right-click to customize its prompts)",className:`hidden rounded border border-ink-600 px-2 py-1 text-xs md:block ${r?"bg-indigo-600 text-white":"bg-ink-700 text-indigo-300"}`,children:"✦ Project agent"}),g.jsxs("div",{className:"ml-auto hidden items-center gap-3 md:flex",children:[g.jsx(RO,{}),g.jsx(CO,{}),t&&g.jsx(yO,{}),g.jsx(xO,{}),g.jsx("button",{onClick:M,"aria-label":"Stop all agents",title:"Stop every running agent (they otherwise keep running independently of Operator)",className:"flex h-8 w-8 items-center justify-center rounded-full border border-red-600 bg-red-900/60 text-sm text-red-200 hover:bg-red-800/70",children:"⏹"})]}),g.jsxs("div",{className:"relative ml-auto md:hidden",children:[g.jsx("button",{onClick:()=>T(D=>!D),"aria-label":"Menu","aria-expanded":C,className:"rounded border border-ink-600 bg-ink-700 px-3 py-1.5 text-base leading-none text-ink-200",children:"⋯"}),C&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>T(!1)}),g.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-56 overflow-hidden rounded-lg border border-ink-600 bg-ink-800 py-1 shadow-xl",children:[t&&g.jsx(uu,{onClick:()=>{i(!r),T(!1)},children:"✦ Project agent"}),t&&g.jsx(uu,{onClick:()=>{T(!1),N.openAt(Math.max(8,window.innerWidth-224),56)},children:"✦ Customize agent prompt…"}),g.jsx(uu,{onClick:()=>{x("settings"),v(!0),T(!1)},children:"⚙ Settings"}),g.jsx(uu,{danger:!0,onClick:()=>{T(!1),M()},children:"⏹ Stop all agents"})]})]})]}),N.at&&g.jsx(eO,{title:"Customize agent prompt",items:TO,at:N.at,onClose:N.close}),c&&g.jsx("span",{className:"text-sm text-red-400",children:c}),f&&g.jsx(fO,{defaultTab:_,onClose:()=>v(!1)}),S&&g.jsx(gO,{onClose:()=>k(!1)}),u&&g.jsx(Vg,{onClose:()=>p(!1),onPick:D=>{p(!1),B(D)}})]})}function uu({children:e,onClick:t,danger:n}){return g.jsx("button",{onClick:t,className:`block w-full px-3 py-2.5 text-left text-sm hover:bg-ink-700 ${n?"text-red-300":"text-ink-200"}`,children:e})}function DO({taskId:e}){const t=ue(h=>{var u,p;return(p=(u=h.board)==null?void 0:u.tasks.find(f=>f.id===e))==null?void 0:p.worktree}),[n,r]=b.useState("starting"),[i,s]=b.useState(""),[l,c]=b.useState(!1);return b.useEffect(()=>c(!1),[t]),b.useEffect(()=>{let h=!1;return r("starting"),ke.ensureCodeServer().then(u=>{h||(u.status==="running"?r("running"):u.status==="missing-binary"?(s(u.installHint??""),r("missing")):r("error"))}).catch(()=>!h&&r("error")),()=>{h=!0}},[]),b.useEffect(()=>{if(n!=="running"||l)return;const h=setTimeout(()=>r("error"),25e3);return()=>clearTimeout(h)},[n,l,t]),g.jsx("div",{className:"relative h-full w-full bg-ink-900",children:t?n==="missing"?g.jsxs(rp,{children:[g.jsx("div",{className:"text-ink-200",children:"code-server isn't installed"}),g.jsx("pre",{className:"max-w-lg whitespace-pre-wrap rounded bg-ink-800 px-3 py-2 text-left text-xs text-ink-300",children:i}),g.jsx(Px,{onClick:()=>location.reload()})]}):n==="error"?g.jsxs(rp,{children:[g.jsx("div",{className:"text-ink-200",children:"Couldn't start the editor."}),g.jsx(Px,{onClick:()=>location.reload()})]}):g.jsxs(g.Fragment,{children:[n==="running"&&g.jsx("iframe",{title:"VS Code",src:`/code-server/?folder=${encodeURIComponent(t)}`,onLoad:()=>c(!0),onError:()=>r("error"),className:"h-full w-full border-0"},t),(n==="starting"||!l)&&g.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-3 bg-ink-900 text-sm",children:[g.jsx(ka,{size:20,className:"animate-spin text-ink-400"}),g.jsx("div",{className:"text-ink-300",children:n==="starting"?"Starting editor…":"Loading editor…"})]})]}):g.jsxs(rp,{children:[g.jsx("div",{className:"text-ink-300",children:"No worktree for this task yet."}),g.jsx("div",{className:"text-xs text-ink-500",children:"Send a message to start the agent — a worktree is created on first run."})]})})}function rp({children:e}){return g.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center text-sm",children:e})}function Px({onClick:e}){return g.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 rounded bg-indigo-600 px-3 py-1.5 text-sm text-white hover:bg-indigo-500",children:[g.jsx(WA,{size:14})," Retry"]})}const W1="operator:lasttab:";function U1(e){try{return localStorage.getItem(W1+e)??void 0}catch{return}}function V1(e,t){try{localStorage.setItem(W1+e,t)}catch{}}const q1="operator:taborder:";function dh(e){try{const t=localStorage.getItem(q1+e),n=t?JSON.parse(t):null;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function K1(e,t){try{localStorage.setItem(q1+e,JSON.stringify(t))}catch{}}function Dx(e){const n=e.replace(/-\d{8}$/,"").split("-").slice(1);if(n.length===0)return e;const[r,...i]=n,s=i.join("."),l=r.charAt(0).toUpperCase()+r.slice(1);return s?`${l} ${s}`:l}const AO={default:"Default",acceptEdits:"Accept Edits",auto:"Auto",plan:"Plan Mode",dontAsk:"Don't Ask",bypassPermissions:"Bypass Permissions"};function fh({task:e,fork:t}){var _;const n=ue(x=>x.project),r=(t==null?void 0:t.key)??e.id,i=ue(x=>{var S;return(S=x.agents[r])==null?void 0:S.events}),s=b.useMemo(()=>VR(i??[]),[i]),l=t?t.model:e.model,c=ue(x=>{var S,k,C;return(C=(k=(S=x.board)==null?void 0:S.accounts)==null?void 0:k.find(T=>T.active))==null?void 0:C.availableModels}),h=b.useMemo(()=>{if(!c)return[];const x=c.filter(S=>S.startsWith("claude-")).map(S=>({id:S,label:Dx(S)}));return l&&!x.find(S=>S.id===l)&&x.push({id:l,label:`${Dx(l)} (unavailable)`}),x},[c,l]);if(!n)return null;const u=t?t.effort:e.effort,p=t?t.permissionMode:e.permissionMode,f=x=>ke.setControls(n.id,e.id,t?{...x,streamKey:t.key}:x).catch(()=>{}),v=FN(e.id);return g.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-ink-600 bg-ink-800 px-3 py-2 text-xs",children:[g.jsx(hu,{label:"Model",children:g.jsxs("select",{className:"rounded bg-ink-700 px-1.5 py-1 outline-none disabled:opacity-50",disabled:h.length===0,value:l??((_=h[0])==null?void 0:_.id)??"",onChange:x=>f({model:x.target.value}),children:[h.length===0&&g.jsx("option",{value:"",children:"Loading…"}),h.map(x=>g.jsx("option",{value:x.id,children:x.label},x.id))]})}),!t&&!v&&g.jsx(hu,{label:"Size",title:"Task scope — set by the evaluator; drives which phases run and how diligently. Click to override.",children:g.jsx("div",{className:"flex overflow-hidden rounded border border-ink-500",children:ug.map(x=>g.jsx("button",{onClick:()=>f({size:x}),className:`px-2 py-1 uppercase ${e.size===x?"bg-indigo-600 text-white":"bg-ink-700"}`,children:x},x))})}),g.jsx(hu,{label:"Effort",title:"Per-step reasoning effort — auto-scaled each phase from the task size (nothing highlighted = auto). Click to pin a value.",children:g.jsx("div",{className:"flex overflow-hidden rounded border border-ink-500",children:Aa.map(x=>g.jsx("button",{onClick:()=>f({effort:x}),className:`px-2 py-1 capitalize ${u===x?"bg-indigo-600 text-white":"bg-ink-700"}`,children:x},x))})}),g.jsx(hu,{label:"Permission",children:g.jsx("select",{className:"rounded bg-ink-700 px-1.5 py-1 outline-none",value:p??"default",onChange:x=>f({permissionMode:x.target.value}),children:Ma.map(x=>g.jsx("option",{value:x,children:AO[x]??x},x))})}),s.total>0&&g.jsxs("span",{className:"ml-auto tabular-nums text-ink-400",title:`Tokens this session — input ${s.input.toLocaleString()} · output ${s.output.toLocaleString()}`,children:[qR(s.total)," tok"]})]})}function hu({label:e,title:t,children:n}){return g.jsxs("label",{className:"flex items-center gap-1.5",title:t,children:[g.jsx("span",{className:"text-ink-400",children:e}),n]})}const Ax=120,MO=200,LO=600;function OO(e,t){const n=Math.max(0,e-t);return{start:n,visibleCount:e-n,hasEarlier:n>0}}function jO(e,t){return Math.min(e,t+MO)}function IO(e){return e<LO}function BO(e,t){return e-t}function zO(e,t){return e-t}async function FO(e,t){try{const n=await ke.getComposer(e,t);return{draft:n.draft??"",queue:n.queue??[],pending:n.pending??[]}}catch{return{draft:"",queue:[],pending:[]}}}const ip=new Map;function $O(e,t,n){const r=`${e}::${t}`,i=ip.get(r);i&&clearTimeout(i),ip.set(r,setTimeout(()=>{ip.delete(r),ke.saveComposer(e,t,n.draft,n.queue,n.pending).catch(()=>{})},400))}function HO(e){var D;const{projectId:t,streamKey:n,running:r,promptParked:i,onSend:s,onFork:l}=e,[c,h]=b.useState(Ey),u=b.useRef(c);u.current=c;const p=b.useRef("");p.current=`${t}::${n}`;const f=b.useRef(0);function v($){f.current=Date.now(),h($)}const _=b.useRef(!1),[x,S]=b.useState(0),k=b.useRef(0);b.useEffect(()=>{var j,R;_.current=!1,k.current=((R=(j=ue.getState().agents[n])==null?void 0:j.composerSync)==null?void 0:R.rev)??0,h(Ey);let $=!0;return FO(t,n).then(U=>{$&&(h(V=>pR(V,U)),_.current=!0,S(V=>V+1))}),()=>{$=!1}},[n,t]);const C=ue($=>{var j;return(j=$.agents[n])==null?void 0:j.composerSync});b.useEffect(()=>{if(!C||!_.current||C.rev<=k.current)return;let $;const j=()=>{const R=bR({local:{queue:u.current.queue,pending:u.current.pending},remote:{queue:C.queue,pending:C.pending},sinceLocalEditMs:Date.now()-f.current});R.kind==="apply"?h(U=>({...U,queue:C.queue,pending:C.pending,preview:null})):R.kind==="defer"&&($=setTimeout(j,R.retryInMs))};return j(),()=>clearTimeout($)},[C==null?void 0:C.rev,n,x]),b.useEffect(()=>Nh(()=>{ke.getComposer(t,n).then($=>{ue.getState().pushAgent(n,{type:"composer_state",queue:$.queue??[],pending:$.pending??[]})}).catch(()=>{})}),[t,n]),b.useEffect(()=>{_.current&&$O(t,n,{draft:c.draft,queue:c.queue,pending:c.pending})},[c.draft,c.queue,c.pending,n,t]);function T($){v(j=>mg(j,$))}async function N($){const{state:j,text:R}=gR(u.current,$);if(R===null)return;const U=p.current;h(j),await s(R).catch(()=>{p.current===U&&v(V=>vR(V,R))})}function M(){const{state:$,texts:j}=xR(u.current);if(j.length===0)return!1;u.current=$,h($);const R=p.current;return ke.flushComposer(t,n).then(U=>{NR(U)==="restore"&&p.current===R&&v(V=>Ry(V,j))}).catch(()=>{p.current===R&&v(U=>Ry(U,j))}),!0}async function B($){const j=p.current,R=Ny({...u.current,draft:$},{running:r,allowFork:!!l,promptParked:i});v(()=>R.state),R.kind==="fork"?await Promise.resolve(l(R.text)).catch(()=>{p.current===j&&v(U=>zl(U,$))}):R.kind==="send"&&await s(R.text).catch(()=>{p.current===j&&v(U=>zl(U,R.text))})}async function A(){const $=u.current.draft,j=p.current,R=Ny(u.current,{running:r,allowFork:!!l,promptParked:i});v(()=>R.state),R.kind==="fork"?await Promise.resolve(l(R.text)).catch(()=>{p.current===j&&v(U=>zl(U,$))}):R.kind==="send"&&await s(R.text).catch(()=>{p.current===j&&v(U=>zl(U,R.text))})}return{draft:c.draft,queue:c.queue,pending:c.pending,previewIndex:((D=c.preview)==null?void 0:D.index)??null,edit:T,submit:A,submitText:B,sendQueued:N,flushPending:M,toggleChip:$=>v(j=>mR(j,$)),removeChip:$=>v(j=>_R(j,$)),removePending:$=>v(j=>wR(j,$)),restoreDraft:$=>v(j=>zl(j,$)),onChipDragEnd:$=>{const{active:j,over:R}=$;!R||j.id===R.id||v(U=>yR(U,String(j.id),String(R.id)))}}}const am="operator:auto:";function WO(e){try{return localStorage.getItem(am+e)==="1"}catch{return!1}}function UO(e,t){try{t?localStorage.setItem(am+e,"1"):localStorage.removeItem(am+e)}catch{}}function VO({value:e,onChange:t,onSubmit:n,onClose:r}){const i=b.useRef(null);return b.useEffect(()=>{const s=i.current;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))},[]),g.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/50 p-4",onMouseDown:r,children:g.jsxs("div",{className:"flex h-[70%] w-full max-w-2xl flex-col rounded-lg border border-ink-600 bg-ink-900 shadow-xl",onMouseDown:s=>s.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-ink-600 px-3 py-2 text-xs text-ink-400",children:[g.jsx("span",{children:"Expanded composer"}),g.jsx("span",{children:"Cmd/Ctrl+Enter to send · Esc to close"})]}),g.jsx("textarea",{ref:i,className:"min-h-0 flex-1 resize-none bg-transparent p-3 text-sm outline-none",placeholder:"Compose a longer message…",value:e,onChange:s=>t(s.target.value),onKeyDown:s=>{s.key==="Escape"?(s.preventDefault(),r()):s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),n())}}),g.jsxs("div",{className:"flex justify-end gap-2 border-t border-ink-600 px-3 py-2",children:[g.jsx("button",{onClick:r,className:"rounded bg-ink-700 px-3 py-1 text-sm hover:bg-ink-600",children:"Close"}),g.jsx("button",{onClick:n,className:"rounded bg-indigo-600 px-3 py-1 text-sm hover:bg-indigo-500",children:"Send"})]})]})})}function qO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const KO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XO={};function Mx(e,t){return(XO.jsx?YO:KO).test(e)}const ZO=/[ \t\n\f\r]/g;function GO(e){return typeof e=="object"?e.type==="text"?Lx(e.value):!1:Lx(e)}function Lx(e){return e.replace(ZO,"")===""}class Fa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Fa.prototype.normal={};Fa.prototype.property={};Fa.prototype.space=void 0;function Y1(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Fa(n,r,t)}function cm(e){return e.toLowerCase()}class Wn{constructor(t,n){this.attribute=n,this.property=t}}Wn.prototype.attribute="";Wn.prototype.booleanish=!1;Wn.prototype.boolean=!1;Wn.prototype.commaOrSpaceSeparated=!1;Wn.prototype.commaSeparated=!1;Wn.prototype.defined=!1;Wn.prototype.mustUseProperty=!1;Wn.prototype.number=!1;Wn.prototype.overloadedBoolean=!1;Wn.prototype.property="";Wn.prototype.spaceSeparated=!1;Wn.prototype.space=void 0;let JO=0;const He=Qs(),It=Qs(),um=Qs(),de=Qs(),ct=Qs(),Ws=Qs(),Qn=Qs();function Qs(){return 2**++JO}const hm=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:It,commaOrSpaceSeparated:Qn,commaSeparated:Ws,number:de,overloadedBoolean:um,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),sp=Object.keys(hm);class qg extends Wn{constructor(t,n,r,i){let s=-1;if(super(t,n),Ox(this,"space",i),typeof r=="number")for(;++s<sp.length;){const l=sp[s];Ox(this,sp[s],(r&hm[l])===hm[l])}}}qg.prototype.defined=!0;function Ox(e,t,n){n&&(e[t]=n)}function Jo(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new qg(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[cm(r)]=r,n[cm(s.attribute)]=r}return new Fa(t,n,e.space)}const X1=Jo({properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:It,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:ct,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:de,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:ct,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:It,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Z1(e,t){return t in e?e[t]:t}function G1(e,t){return Z1(e,t.toLowerCase())}const QO=Jo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ws,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alpha:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:ct,autoFocus:He,autoPlay:He,blocking:ct,capture:null,charSet:null,checked:He,cite:null,className:ct,closedBy:null,colorSpace:null,cols:de,colSpan:de,command:null,commandFor:null,content:null,contentEditable:It,controls:He,controlsList:ct,coords:de|Ws,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:um,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:ct,height:de,hidden:um,high:de,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:ct,itemRef:ct,itemScope:He,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,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:He,optimum:de,pattern:null,ping:ct,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:ct,required:He,reversed:He,rows:de,rowSpan:de,sandbox:ct,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootCustomElementRegistry:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shadowRootSerializable:He,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:He,useMap:null,value:It,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:He,disablePictureInPicture:He,disableRemotePlayback:He,exportParts:Ws,part:ct,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:G1}),e5=Jo({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:Qn,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:ct,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:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:He,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,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:Ws,g2:Ws,glyphName:Ws,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:Qn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,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:de,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:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qn,rev:Qn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qn,requiredFeatures:Qn,requiredFonts:Qn,requiredFormats:Qn,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:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:Qn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qn,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Z1}),J1=Jo({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()}}),Q1=Jo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:G1}),ek=Jo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),t5={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"},n5=/[A-Z]/g,jx=/-[a-z]/g,r5=/^data[-\w.:]+$/i;function i5(e,t){const n=cm(t);let r=t,i=Wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&r5.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(jx,o5);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!jx.test(s)){let l=s.replace(n5,s5);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=qg}return new i(r,t)}function s5(e){return"-"+e.toLowerCase()}function o5(e){return e.charAt(1).toUpperCase()}const l5=Y1([X1,QO,J1,Q1,ek],"html"),Kg=Y1([X1,e5,J1,Q1,ek],"svg");function a5(e){return e.join(" ").trim()}var No={},op,Ix;function c5(){if(Ix)return op;Ix=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,h=`
277
+ `,u="/",p="*",f="",v="comment",_="declaration";function x(k,C){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];C=C||{};var T=1,N=1;function M(W){var q=W.match(t);q&&(T+=q.length);var z=W.lastIndexOf(h);N=~z?W.length-z:N+W.length}function B(){var W={line:T,column:N};return function(q){return q.position=new A(W),j(),q}}function A(W){this.start=W,this.end={line:T,column:N},this.source=C.source}A.prototype.content=k;function D(W){var q=new Error(C.source+":"+T+":"+N+": "+W);if(q.reason=W,q.filename=C.source,q.line=T,q.column=N,q.source=k,!C.silent)throw q}function $(W){var q=W.exec(k);if(q){var z=q[0];return M(z),k=k.slice(z.length),q}}function j(){$(n)}function R(W){var q;for(W=W||[];q=U();)q!==!1&&W.push(q);return W}function U(){var W=B();if(!(u!=k.charAt(0)||p!=k.charAt(1))){for(var q=2;f!=k.charAt(q)&&(p!=k.charAt(q)||u!=k.charAt(q+1));)++q;if(q+=2,f===k.charAt(q-1))return D("End of comment missing");var z=k.slice(2,q-2);return N+=2,M(z),k=k.slice(q),N+=2,W({type:v,comment:z})}}function V(){var W=B(),q=$(r);if(q){if(U(),!$(i))return D("property missing ':'");var z=$(s),J=W({type:_,property:S(q[0].replace(e,f)),value:z?S(z[0].replace(e,f)):f});return $(l),J}}function Y(){var W=[];R(W);for(var q;q=V();)q!==!1&&(W.push(q),R(W));return W}return j(),Y()}function S(k){return k?k.replace(c,f):f}return op=x,op}var Bx;function u5(){if(Bx)return No;Bx=1;var e=No&&No.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(No,"__esModule",{value:!0}),No.default=n;const t=e(c5());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,t.default)(r),c=typeof i=="function";return l.forEach(h=>{if(h.type!=="declaration")return;const{property:u,value:p}=h;c?i(u,p,h):p&&(s=s||{},s[u]=p)}),s}return No}var Hl={},zx;function h5(){if(zx)return Hl;zx=1,Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},l=function(u,p){return p.toUpperCase()},c=function(u,p){return"".concat(p,"-")},h=function(u,p){return p===void 0&&(p={}),s(u)?u:(u=u.toLowerCase(),p.reactCompat?u=u.replace(i,c):u=u.replace(r,c),u.replace(t,l))};return Hl.camelCase=h,Hl}var Wl,Fx;function d5(){if(Fx)return Wl;Fx=1;var e=Wl&&Wl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(u5()),n=h5();function r(i,s){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(c,h){c&&h&&(l[(0,n.camelCase)(c,s)]=h)}),l}return r.default=r,Wl=r,Wl}var f5=d5();const p5=ig(f5),tk=nk("end"),Yg=nk("start");function nk(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 m5(e){const t=Yg(e),n=tk(e);if(t&&n)return{start:t,end:n}}function da(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$x(e.position):"start"in e||"end"in e?$x(e):"line"in e||"column"in e?dm(e):""}function dm(e){return Hx(e&&e.line)+":"+Hx(e&&e.column)}function $x(e){return dm(e&&e.start)+"-"+dm(e&&e.end)}function Hx(e){return e&&typeof e=="number"?e:1}class bn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(l=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?s.ruleId=r:(s.source=r.slice(0,h),s.ruleId=r.slice(h+1))}if(!s.place&&s.ancestors&&s.ancestors){const h=s.ancestors[s.ancestors.length-1];h&&(s.place=h.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=da(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bn.prototype.file="";bn.prototype.name="";bn.prototype.reason="";bn.prototype.message="";bn.prototype.stack="";bn.prototype.column=void 0;bn.prototype.line=void 0;bn.prototype.ancestors=void 0;bn.prototype.cause=void 0;bn.prototype.fatal=void 0;bn.prototype.place=void 0;bn.prototype.ruleId=void 0;bn.prototype.source=void 0;const Xg={}.hasOwnProperty,g5=new Map,v5=/[A-Z]/g,_5=new Set(["table","tbody","thead","tfoot","tr"]),y5=new Set(["td","th"]),rk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function x5(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=R5(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=N5(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Kg:l5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ik(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ik(e,t,n){if(t.type==="element")return w5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return S5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return k5(e,t,n);if(t.type==="mdxjsEsm")return b5(e,t);if(t.type==="root")return C5(e,t,n);if(t.type==="text")return E5(e,t)}function w5(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Kg,e.schema=i),e.ancestors.push(t);const s=ok(e,t.tagName,!1),l=T5(e,t);let c=Gg(e,t);return _5.has(t.tagName)&&(c=c.filter(function(h){return typeof h=="string"?!GO(h):!0})),sk(e,l,s,t),Zg(l,c),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function S5(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)}Na(e,t.position)}function b5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Na(e,t.position)}function k5(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Kg,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ok(e,t.name,!0),l=P5(e,t),c=Gg(e,t);return sk(e,l,s,t),Zg(l,c),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function C5(e,t,n){const r={};return Zg(r,Gg(e,t)),e.create(t,e.Fragment,r,n)}function E5(e,t){return t.value}function sk(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function N5(e,t,n){return r;function r(i,s,l,c){const u=Array.isArray(l.children)?n:t;return c?u(s,l,c):u(s,l)}}function R5(e,t){return n;function n(r,i,s,l){const c=Array.isArray(s.children),h=Yg(r);return t(i,s,l,c,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function T5(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Xg.call(t.properties,i)){const s=D5(e,i,t.properties[i]);if(s){const[l,c]=s;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&y5.has(t.tagName)?r=c:n[l]=c}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function P5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else Na(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,s=e.evaluater.evaluateExpression(c.expression)}else Na(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Gg(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:g5;for(;++r<t.children.length;){const s=t.children[r];let l;if(e.passKeys){const h=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(h){const u=i.get(h)||0;l=h+"-"+u,i.set(h,u+1)}}const c=ik(e,s,l);c!==void 0&&n.push(c)}return n}function D5(e,t,n){const r=i5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qO(n):a5(n)),r.property==="style"){let i=typeof n=="object"?n:A5(e,String(n));return e.stylePropertyNameCase==="css"&&(i=M5(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?t5[r.property]||r.property:r.attribute,n]}}function A5(e,t){try{return p5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new bn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=rk+"#cannot-parse-style-attribute",i}}function ok(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,l;for(;++s<i.length;){const c=Mx(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=l}else r=Mx(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Xg.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Na(e)}function Na(e,t){const n=new bn("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=rk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M5(e){const t={};let n;for(n in e)Xg.call(e,n)&&(t[L5(n)]=e[n]);return t}function L5(e){let t=e.replace(v5,O5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function O5(e){return"-"+e.toLowerCase()}const lp={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"]},j5={};function Jg(e,t){const n=j5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lk(e,r,i)}function lk(e,t,n){if(I5(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 Wx(e.children,t,n)}return Array.isArray(e)?Wx(e,t,n):""}function Wx(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=lk(e[i],t,n);return r.join("")}function I5(e){return!!(e&&typeof e=="object")}const Ux=document.createElement("i");function Qg(e){const t="&"+e+";";Ux.innerHTML=t;const n=Ux.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sr(e,t,n,r){const i=e.length;let s=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(t,0),e.splice(...l),s+=1e4,t+=1e4}function yr(e,t){return e.length>0?(sr(e,e.length,0,t),e):t}const Vx={}.hasOwnProperty;function ak(e){const t={};let n=-1;for(;++n<e.length;)B5(t,e[n]);return t}function B5(e,t){let n;for(n in t){const i=(Vx.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let l;if(s)for(l in s){Vx.call(i,l)||(i[l]=[]);const c=s[l];z5(i[l],Array.isArray(c)?c:c?[c]:[])}}}function z5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sr(e,0,0,r)}function ck(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 jr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tn=Ss(/[A-Za-z]/),Sn=Ss(/[\dA-Za-z]/),F5=Ss(/[#-'*+\--9=?A-Z^-~]/);function ph(e){return e!==null&&(e<32||e===127)}const fm=Ss(/\d/),$5=Ss(/[\dA-Fa-f]/),H5=Ss(/[!-/:-@[-`{-~]/);function je(e){return e!==null&&e<-2}function ut(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const Uh=Ss(new RegExp("\\p{P}|\\p{S}","u")),Zs=Ss(/\s/);function Ss(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Qo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let l="";if(s===37&&Sn(e.charCodeAt(n+1))&&Sn(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const c=e.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(l=String.fromCharCode(s,c),i=1):l="�"}else l=String.fromCharCode(s);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ze(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(h){return Ye(h)?(e.enter(n),c(h)):t(h)}function c(h){return Ye(h)&&s++<i?(e.consume(h),c):(e.exit(n),t(h))}}const W5={tokenize:U5};function U5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ze(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),s(c)}function s(c){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return je(c)?(e.consume(c),e.exit("chunkText"),s):(e.consume(c),l)}}const V5={tokenize:q5},qx={tokenize:K5};function q5(e){const t=this,n=[];let r=0,i,s,l;return c;function c(N){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,h,u)(N)}return u(N)}function h(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&T();const M=t.events.length;let B=M,A;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){A=t.events[B][1].end;break}C(r);let D=M;for(;D<t.events.length;)t.events[D][1].end={...A},D++;return sr(t.events,B+1,0,t.events.slice(M)),t.events.length=D,u(N)}return c(N)}function u(N){if(r===n.length){if(!i)return v(N);if(i.currentConstruct&&i.currentConstruct.concrete)return x(N);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qx,p,f)(N)}function p(N){return i&&T(),C(r),v(N)}function f(N){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(N)}function v(N){return t.containerState={},e.attempt(qx,_,x)(N)}function _(N){return r++,n.push([t.currentConstruct,t.containerState]),v(N)}function x(N){if(N===null){i&&T(),C(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),S(N)}function S(N){if(N===null){k(e.exit("chunkFlow"),!0),C(0),e.consume(N);return}return je(N)?(e.consume(N),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(N),S)}function k(N,M){const B=t.sliceStream(N);if(M&&B.push(null),N.previous=s,s&&(s.next=N),s=N,i.defineSkip(N.start),i.write(B),t.parser.lazy[N.start.line]){let A=i.events.length;for(;A--;)if(i.events[A][1].start.offset<l&&(!i.events[A][1].end||i.events[A][1].end.offset>l))return;const D=t.events.length;let $=D,j,R;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(j){R=t.events[$][1].end;break}j=!0}for(C(r),A=D;A<t.events.length;)t.events[A][1].end={...R},A++;sr(t.events,$+1,0,t.events.slice(D)),t.events.length=A}}function C(N){let M=n.length;for(;M-- >N;){const B=n[M];t.containerState=B[1],B[0].exit.call(t,e)}n.length=N}function T(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function K5(e,t,n){return Ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vo(e){if(e===null||ut(e)||Zs(e))return 1;if(Uh(e))return 2}function Vh(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const pm={name:"attention",resolveAll:Y5,tokenize:X5};function Y5(e,t){let n=-1,r,i,s,l,c,h,u,p;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;h=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},v={...e[n][1].start};Kx(f,-h),Kx(v,h),l={type:h>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},c={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},s={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:h>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=yr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yr(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",s,t]]),u=yr(u,Vh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yr(u,[["exit",s,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=yr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,sr(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function X5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Vo(r);let s;return l;function l(h){return s=h,e.enter("attentionSequence"),c(h)}function c(h){if(h===s)return e.consume(h),c;const u=e.exit("attentionSequence"),p=Vo(h),f=!p||p===2&&i||n.includes(h),v=!i||i===2&&p||n.includes(r);return u._open=!!(s===42?f:f&&(i||!v)),u._close=!!(s===42?v:v&&(p||!f)),t(h)}}function Kx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Z5={name:"autolink",tokenize:G5};function G5(e,t,n){let r=0;return i;function i(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(_){return Tn(_)?(e.consume(_),l):_===64?n(_):u(_)}function l(_){return _===43||_===45||_===46||Sn(_)?(r=1,c(_)):u(_)}function c(_){return _===58?(e.consume(_),r=0,h):(_===43||_===45||_===46||Sn(_))&&r++<32?(e.consume(_),c):(r=0,u(_))}function h(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),t):_===null||_===32||_===60||ph(_)?n(_):(e.consume(_),h)}function u(_){return _===64?(e.consume(_),p):F5(_)?(e.consume(_),u):n(_)}function p(_){return Sn(_)?f(_):n(_)}function f(_){return _===46?(e.consume(_),r=0,p):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),t):v(_)}function v(_){if((_===45||Sn(_))&&r++<63){const x=_===45?v:f;return e.consume(_),x}return n(_)}}const $a={partial:!0,tokenize:J5};function J5(e,t,n){return r;function r(s){return Ye(s)?Ze(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||je(s)?t(s):n(s)}}const uk={continuation:{tokenize:ej},exit:tj,name:"blockQuote",tokenize:Q5};function Q5(e,t,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),s}return n(l)}function s(l){return Ye(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function ej(e,t,n){const r=this;return i;function i(l){return Ye(l)?Ze(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return e.attempt(uk,t,n)(l)}}function tj(e){e.exit("blockQuote")}const hk={name:"characterEscape",tokenize:nj};function nj(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return H5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const dk={name:"characterReference",tokenize:rj};function rj(e,t,n){const r=this;let i=0,s,l;return c;function c(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),h}function h(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,l=Sn,p(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,l=$5,p):(e.enter("characterReferenceValue"),s=7,l=fm,p(f))}function p(f){if(f===59&&i){const v=e.exit("characterReferenceValue");return l===Sn&&!Qg(r.sliceSerialize(v))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(f)&&i++<s?(e.consume(f),p):n(f)}}const Yx={partial:!0,tokenize:sj},Xx={concrete:!0,name:"codeFenced",tokenize:ij};function ij(e,t,n){const r=this,i={partial:!0,tokenize:B};let s=0,l=0,c;return h;function h(A){return u(A)}function u(A){const D=r.events[r.events.length-1];return s=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,c=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===c?(l++,e.consume(A),p):l<3?n(A):(e.exit("codeFencedFenceSequence"),Ye(A)?Ze(e,f,"whitespace")(A):f(A))}function f(A){return A===null||je(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Yx,S,M)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(A))}function v(A){return A===null||je(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(A)):Ye(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ze(e,_,"whitespace")(A)):A===96&&A===c?n(A):(e.consume(A),v)}function _(A){return A===null||je(A)?f(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(A))}function x(A){return A===null||je(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(A)):A===96&&A===c?n(A):(e.consume(A),x)}function S(A){return e.attempt(i,M,k)(A)}function k(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),C}function C(A){return s>0&&Ye(A)?Ze(e,T,"linePrefix",s+1)(A):T(A)}function T(A){return A===null||je(A)?e.check(Yx,S,M)(A):(e.enter("codeFlowValue"),N(A))}function N(A){return A===null||je(A)?(e.exit("codeFlowValue"),T(A)):(e.consume(A),N)}function M(A){return e.exit("codeFenced"),t(A)}function B(A,D,$){let j=0;return R;function R(q){return A.enter("lineEnding"),A.consume(q),A.exit("lineEnding"),U}function U(q){return A.enter("codeFencedFence"),Ye(q)?Ze(A,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):V(q)}function V(q){return q===c?(A.enter("codeFencedFenceSequence"),Y(q)):$(q)}function Y(q){return q===c?(j++,A.consume(q),Y):j>=l?(A.exit("codeFencedFenceSequence"),Ye(q)?Ze(A,W,"whitespace")(q):W(q)):$(q)}function W(q){return q===null||je(q)?(A.exit("codeFencedFence"),D(q)):$(q)}}}function sj(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const ap={name:"codeIndented",tokenize:lj},oj={partial:!0,tokenize:aj};function lj(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Ze(e,s,"linePrefix",5)(u)}function s(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(u):n(u)}function l(u){return u===null?h(u):je(u)?e.attempt(oj,l,h)(u):(e.enter("codeFlowValue"),c(u))}function c(u){return u===null||je(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),c)}function h(u){return e.exit("codeIndented"),t(u)}}function aj(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):je(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):Ze(e,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):je(l)?i(l):n(l)}}const cj={name:"codeText",previous:hj,resolve:uj,tokenize:dj};function uj(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function hj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dj(e,t,n){let r=0,i,s;return l;function l(f){return e.enter("codeText"),e.enter("codeTextSequence"),c(f)}function c(f){return f===96?(e.consume(f),r++,c):(e.exit("codeTextSequence"),h(f))}function h(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),h):f===96?(s=e.enter("codeTextSequence"),i=0,p(f)):je(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||je(f)?(e.exit("codeTextData"),h(f)):(e.consume(f),u)}function p(f){return f===96?(e.consume(f),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class fj{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ul(this.left,r),s.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),Ul(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ul(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);Ul(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ul(this.left,n.reverse())}}}function Ul(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 fk(e){const t={};let n=-1,r,i,s,l,c,h,u;const p=new fj(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,s=0,s<h.length&&h[s][1].type==="lineEndingBlank"&&(s+=2),s<h.length&&h[s][1].type==="content"))for(;++s<h.length&&h[s][1].type!=="content";)h[s][1].type==="chunkText"&&(h[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,pj(p,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=p.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return sr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function pj(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,h=[],u={};let p,f,v=-1,_=n,x=0,S=0;const k=[S];for(;_;){for(;e.get(++i)[1]!==_;);s.push(i),_._tokenizer||(p=r.sliceStream(_),_.next||p.push(null),f&&l.defineSkip(_.start),_._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),_._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),f=_,_=_.next}for(_=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(S=v+1,k.push(S),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(l.events=[],_?(_._tokenizer=void 0,_.previous=void 0):k.pop(),v=k.length;v--;){const C=c.slice(k[v],k[v+1]),T=s.pop();h.push([T,T+C.length-1]),e.splice(T,2,C)}for(h.reverse(),v=-1;++v<h.length;)u[x+h[v][0]]=x+h[v][1],x+=h[v][1]-h[v][0]-1;return u}const mj={resolve:vj,tokenize:_j},gj={partial:!0,tokenize:yj};function vj(e){return fk(e),e}function _j(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?s(c):je(c)?e.check(gj,l,s)(c):(e.consume(c),i)}function s(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function yj(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ze(e,s,"linePrefix")}function s(l){if(l===null||je(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function pk(e,t,n,r,i,s,l,c,h){const u=h||Number.POSITIVE_INFINITY;let p=0;return f;function f(C){return C===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(C),e.exit(s),v):C===null||C===32||C===41||ph(C)?n(C):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(C))}function v(C){return C===62?(e.enter(s),e.consume(C),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),_(C))}function _(C){return C===62?(e.exit("chunkString"),e.exit(c),v(C)):C===null||C===60||je(C)?n(C):(e.consume(C),C===92?x:_)}function x(C){return C===60||C===62||C===92?(e.consume(C),_):_(C)}function S(C){return!p&&(C===null||C===41||ut(C))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(C)):p<u&&C===40?(e.consume(C),p++,S):C===41?(e.consume(C),p--,S):C===null||C===32||C===40||ph(C)?n(C):(e.consume(C),C===92?k:S)}function k(C){return C===40||C===41||C===92?(e.consume(C),S):S(C)}}function mk(e,t,n,r,i,s){const l=this;let c=0,h;return u;function u(_){return e.enter(r),e.enter(i),e.consume(_),e.exit(i),e.enter(s),p}function p(_){return c>999||_===null||_===91||_===93&&!h||_===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(_):_===93?(e.exit(s),e.enter(i),e.consume(_),e.exit(i),e.exit(r),t):je(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===null||_===91||_===93||je(_)||c++>999?(e.exit("chunkString"),p(_)):(e.consume(_),h||(h=!Ye(_)),_===92?v:f)}function v(_){return _===91||_===92||_===93?(e.consume(_),c++,f):f(_)}}function gk(e,t,n,r,i,s){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(r),e.enter(i),e.consume(v),e.exit(i),l=v===40?41:v,h):n(v)}function h(v){return v===l?(e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):(e.enter(s),u(v))}function u(v){return v===l?(e.exit(s),h(l)):v===null?n(v):je(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===l||v===null||je(v)?(e.exit("chunkString"),u(v)):(e.consume(v),v===92?f:p)}function f(v){return v===l||v===92?(e.consume(v),p):p(v)}}function fa(e,t){let n;return r;function r(i){return je(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ye(i)?Ze(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const xj={name:"definition",tokenize:Sj},wj={partial:!0,tokenize:bj};function Sj(e,t,n){const r=this;let i;return s;function s(_){return e.enter("definition"),l(_)}function l(_){return mk.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function c(_){return i=jr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),h):n(_)}function h(_){return ut(_)?fa(e,u)(_):u(_)}function u(_){return pk(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function p(_){return e.attempt(wj,f,f)(_)}function f(_){return Ye(_)?Ze(e,v,"whitespace")(_):v(_)}function v(_){return _===null||je(_)?(e.exit("definition"),r.parser.defined.push(i),t(_)):n(_)}}function bj(e,t,n){return r;function r(c){return ut(c)?fa(e,i)(c):n(c)}function i(c){return gk(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return Ye(c)?Ze(e,l,"whitespace")(c):l(c)}function l(c){return c===null||je(c)?t(c):n(c)}}const kj={name:"hardBreakEscape",tokenize:Cj};function Cj(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return je(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Ej={name:"headingAtx",resolve:Nj,tokenize:Rj};function Nj(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},sr(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Rj(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),s(p)}function s(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||ut(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),h(p)):p===null||je(p)?(e.exit("atxHeading"),t(p)):Ye(p)?Ze(e,c,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function h(p){return p===35?(e.consume(p),h):(e.exit("atxHeadingSequence"),c(p))}function u(p){return p===null||p===35||ut(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),u)}}const Tj=["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"],Zx=["pre","script","style","textarea"],Pj={concrete:!0,name:"htmlFlow",resolveTo:Mj,tokenize:Lj},Dj={partial:!0,tokenize:jj},Aj={partial:!0,tokenize:Oj};function Mj(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 Lj(e,t,n){const r=this;let i,s,l,c,h;return u;function u(L){return p(L)}function p(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),v):L===47?(e.consume(L),s=!0,S):L===63?(e.consume(L),i=3,r.interrupt?t:P):Tn(L)?(e.consume(L),l=String.fromCharCode(L),k):n(L)}function v(L){return L===45?(e.consume(L),i=2,_):L===91?(e.consume(L),i=5,c=0,x):Tn(L)?(e.consume(L),i=4,r.interrupt?t:P):n(L)}function _(L){return L===45?(e.consume(L),r.interrupt?t:P):n(L)}function x(L){const Z="CDATA[";return L===Z.charCodeAt(c++)?(e.consume(L),c===Z.length?r.interrupt?t:V:x):n(L)}function S(L){return Tn(L)?(e.consume(L),l=String.fromCharCode(L),k):n(L)}function k(L){if(L===null||L===47||L===62||ut(L)){const Z=L===47,oe=l.toLowerCase();return!Z&&!s&&Zx.includes(oe)?(i=1,r.interrupt?t(L):V(L)):Tj.includes(l.toLowerCase())?(i=6,Z?(e.consume(L),C):r.interrupt?t(L):V(L)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):s?T(L):N(L))}return L===45||Sn(L)?(e.consume(L),l+=String.fromCharCode(L),k):n(L)}function C(L){return L===62?(e.consume(L),r.interrupt?t:V):n(L)}function T(L){return Ye(L)?(e.consume(L),T):R(L)}function N(L){return L===47?(e.consume(L),R):L===58||L===95||Tn(L)?(e.consume(L),M):Ye(L)?(e.consume(L),N):R(L)}function M(L){return L===45||L===46||L===58||L===95||Sn(L)?(e.consume(L),M):B(L)}function B(L){return L===61?(e.consume(L),A):Ye(L)?(e.consume(L),B):N(L)}function A(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),h=L,D):Ye(L)?(e.consume(L),A):$(L)}function D(L){return L===h?(e.consume(L),h=null,j):L===null||je(L)?n(L):(e.consume(L),D)}function $(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||ut(L)?B(L):(e.consume(L),$)}function j(L){return L===47||L===62||Ye(L)?N(L):n(L)}function R(L){return L===62?(e.consume(L),U):n(L)}function U(L){return L===null||je(L)?V(L):Ye(L)?(e.consume(L),U):n(L)}function V(L){return L===45&&i===2?(e.consume(L),z):L===60&&i===1?(e.consume(L),J):L===62&&i===4?(e.consume(L),H):L===63&&i===3?(e.consume(L),P):L===93&&i===5?(e.consume(L),re):je(L)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Dj,Q,Y)(L)):L===null||je(L)?(e.exit("htmlFlowData"),Y(L)):(e.consume(L),V)}function Y(L){return e.check(Aj,W,Q)(L)}function W(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),q}function q(L){return L===null||je(L)?Y(L):(e.enter("htmlFlowData"),V(L))}function z(L){return L===45?(e.consume(L),P):V(L)}function J(L){return L===47?(e.consume(L),l="",I):V(L)}function I(L){if(L===62){const Z=l.toLowerCase();return Zx.includes(Z)?(e.consume(L),H):V(L)}return Tn(L)&&l.length<8?(e.consume(L),l+=String.fromCharCode(L),I):V(L)}function re(L){return L===93?(e.consume(L),P):V(L)}function P(L){return L===62?(e.consume(L),H):L===45&&i===2?(e.consume(L),P):V(L)}function H(L){return L===null||je(L)?(e.exit("htmlFlowData"),Q(L)):(e.consume(L),H)}function Q(L){return e.exit("htmlFlow"),t(L)}}function Oj(e,t,n){const r=this;return i;function i(l){return je(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function jj(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt($a,t,n)}}const Ij={name:"htmlText",tokenize:Bj};function Bj(e,t,n){const r=this;let i,s,l;return c;function c(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),h}function h(P){return P===33?(e.consume(P),u):P===47?(e.consume(P),B):P===63?(e.consume(P),N):Tn(P)?(e.consume(P),$):n(P)}function u(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),s=0,x):Tn(P)?(e.consume(P),T):n(P)}function p(P){return P===45?(e.consume(P),_):n(P)}function f(P){return P===null?n(P):P===45?(e.consume(P),v):je(P)?(l=f,J(P)):(e.consume(P),f)}function v(P){return P===45?(e.consume(P),_):f(P)}function _(P){return P===62?z(P):P===45?v(P):f(P)}function x(P){const H="CDATA[";return P===H.charCodeAt(s++)?(e.consume(P),s===H.length?S:x):n(P)}function S(P){return P===null?n(P):P===93?(e.consume(P),k):je(P)?(l=S,J(P)):(e.consume(P),S)}function k(P){return P===93?(e.consume(P),C):S(P)}function C(P){return P===62?z(P):P===93?(e.consume(P),C):S(P)}function T(P){return P===null||P===62?z(P):je(P)?(l=T,J(P)):(e.consume(P),T)}function N(P){return P===null?n(P):P===63?(e.consume(P),M):je(P)?(l=N,J(P)):(e.consume(P),N)}function M(P){return P===62?z(P):N(P)}function B(P){return Tn(P)?(e.consume(P),A):n(P)}function A(P){return P===45||Sn(P)?(e.consume(P),A):D(P)}function D(P){return je(P)?(l=D,J(P)):Ye(P)?(e.consume(P),D):z(P)}function $(P){return P===45||Sn(P)?(e.consume(P),$):P===47||P===62||ut(P)?j(P):n(P)}function j(P){return P===47?(e.consume(P),z):P===58||P===95||Tn(P)?(e.consume(P),R):je(P)?(l=j,J(P)):Ye(P)?(e.consume(P),j):z(P)}function R(P){return P===45||P===46||P===58||P===95||Sn(P)?(e.consume(P),R):U(P)}function U(P){return P===61?(e.consume(P),V):je(P)?(l=U,J(P)):Ye(P)?(e.consume(P),U):j(P)}function V(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),i=P,Y):je(P)?(l=V,J(P)):Ye(P)?(e.consume(P),V):(e.consume(P),W)}function Y(P){return P===i?(e.consume(P),i=void 0,q):P===null?n(P):je(P)?(l=Y,J(P)):(e.consume(P),Y)}function W(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||ut(P)?j(P):(e.consume(P),W)}function q(P){return P===47||P===62||ut(P)?j(P):n(P)}function z(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function J(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),I}function I(P){return Ye(P)?Ze(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):re(P)}function re(P){return e.enter("htmlTextData"),l(P)}}const ev={name:"labelEnd",resolveAll:Hj,resolveTo:Wj,tokenize:Uj},zj={tokenize:Vj},Fj={tokenize:qj},$j={tokenize:Kj};function Hj(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&sr(e,0,e.length,n),e}function Wj(e,t){let n=e.length,r=0,i,s,l,c;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const h={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[l][1].end}},p={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",h,t],["enter",u,t]],c=yr(c,e.slice(s+1,s+r+3)),c=yr(c,[["enter",p,t]]),c=yr(c,Vh(t.parser.constructs.insideSpan.null,e.slice(s+r+4,l-3),t)),c=yr(c,[["exit",p,t],e[l-2],e[l-1],["exit",u,t]]),c=yr(c,e.slice(l+1)),c=yr(c,[["exit",h,t]]),sr(e,s,e.length,c),e}function Uj(e,t,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(v){return s?s._inactive?f(v):(l=r.parser.defined.includes(jr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),h):n(v)}function h(v){return v===40?e.attempt(zj,p,l?p:f)(v):v===91?e.attempt(Fj,p,l?u:f)(v):l?p(v):f(v)}function u(v){return e.attempt($j,p,f)(v)}function p(v){return t(v)}function f(v){return s._balanced=!0,n(v)}}function Vj(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return ut(f)?fa(e,s)(f):s(f)}function s(f){return f===41?p(f):pk(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function l(f){return ut(f)?fa(e,h)(f):p(f)}function c(f){return n(f)}function h(f){return f===34||f===39||f===40?gk(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function u(f){return ut(f)?fa(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function qj(e,t,n){const r=this;return i;function i(c){return mk.call(r,e,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(jr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function Kj(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Yj={name:"labelStartImage",resolveAll:ev.resolveAll,tokenize:Xj};function Xj(e,t,n){const r=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),s}function s(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Zj={name:"labelStartLink",resolveAll:ev.resolveAll,tokenize:Gj};function Gj(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const cp={name:"lineEnding",tokenize:Jj};function Jj(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ze(e,t,"linePrefix")}}const ju={name:"thematicBreak",tokenize:Qj};function Qj(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,c(u)}function c(u){return u===i?(e.enter("thematicBreakSequence"),h(u)):r>=3&&(u===null||je(u))?(e.exit("thematicBreak"),t(u)):n(u)}function h(u){return u===i?(e.consume(u),r++,h):(e.exit("thematicBreakSequence"),Ye(u)?Ze(e,c,"whitespace")(u):c(u))}}const Hn={continuation:{tokenize:r4},exit:s4,name:"list",tokenize:n4},e4={partial:!0,tokenize:o4},t4={partial:!0,tokenize:i4};function n4(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(_){const x=r.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||_===r.containerState.marker:fm(_)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(ju,n,u)(_):u(_);if(!r.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(_)}return n(_)}function h(_){return fm(_)&&++l<10?(e.consume(_),h):(!r.interrupt||l<2)&&(r.containerState.marker?_===r.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),u(_)):n(_)}function u(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||_,e.check($a,r.interrupt?n:p,e.attempt(e4,v,f))}function p(_){return r.containerState.initialBlankLine=!0,s++,v(_)}function f(_){return Ye(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),v):n(_)}function v(_){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(_)}}function r4(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check($a,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ze(e,t,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!Ye(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(t4,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ze(e,e.attempt(Hn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function i4(e,t,n){const r=this;return Ze(e,i,"listItemIndent",r.containerState.size+1);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(s):n(s)}}function s4(e){e.exit(this.containerState.type)}function o4(e,t,n){const r=this;return Ze(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!Ye(s)&&l&&l[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Gx={name:"setextUnderline",resolveTo:l4,tokenize:a4};function l4(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",l,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function a4(e,t,n){const r=this;let i;return s;function s(u){let p=r.events.length,f;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){f=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,l(u)):n(u)}function l(u){return e.enter("setextHeadingLineSequence"),c(u)}function c(u){return u===i?(e.consume(u),c):(e.exit("setextHeadingLineSequence"),Ye(u)?Ze(e,h,"lineSuffix")(u):h(u))}function h(u){return u===null||je(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const c4={tokenize:u4};function u4(e){const t=this,n=e.attempt($a,r,e.attempt(this.parser.constructs.flowInitial,i,Ze(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mj,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const h4={resolveAll:_k()},d4=vk("string"),f4=vk("text");function vk(e){return{resolveAll:_k(e==="text"?p4:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,l,c);return l;function l(p){return u(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),h}function h(p){return u(p)?(n.exit("data"),s(p)):(n.consume(p),h)}function u(p){if(p===null)return!0;const f=i[p];let v=-1;if(f)for(;++v<f.length;){const _=f[v];if(!_.previous||_.previous.call(r,r.previous))return!0}return!1}}}function _k(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function p4(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],i=t.sliceStream(r);let s=i.length,l=-1,c=0,h;for(;s--;){const u=i[s];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(u===-2)h=!0,c++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const u={type:n===e.length||h||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},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 m4={42:Hn,43:Hn,45:Hn,48:Hn,49:Hn,50:Hn,51:Hn,52:Hn,53:Hn,54:Hn,55:Hn,56:Hn,57:Hn,62:uk},g4={91:xj},v4={[-2]:ap,[-1]:ap,32:ap},_4={35:Ej,42:ju,45:[Gx,ju],60:Pj,61:Gx,95:ju,96:Xx,126:Xx},y4={38:dk,92:hk},x4={[-5]:cp,[-4]:cp,[-3]:cp,33:Yj,38:dk,42:pm,60:[Z5,Ij],91:Zj,92:[kj,hk],93:ev,95:pm,96:cj},w4={null:[pm,h4]},S4={null:[42,95]},b4={null:[]},k4=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:S4,contentInitial:g4,disable:b4,document:m4,flow:_4,flowInitial:v4,insideSpan:w4,string:y4,text:x4},Symbol.toStringTag,{value:"Module"}));function C4(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],c=[];const h={attempt:D(B),check:D(A),consume:T,enter:N,exit:M,interrupt:D(A,{interrupt:!0})},u={code:null,containerState:{},defineSkip:S,events:[],now:x,parser:e,previous:null,sliceSerialize:v,sliceStream:_,write:f};let p=t.tokenize.call(u,h);return t.resolveAll&&s.push(t),u;function f(U){return l=yr(l,U),k(),l[l.length-1]!==null?[]:($(t,0),u.events=Vh(s,u.events,u),u.events)}function v(U,V){return N4(_(U),V)}function _(U){return E4(l,U)}function x(){const{_bufferIndex:U,_index:V,line:Y,column:W,offset:q}=r;return{_bufferIndex:U,_index:V,line:Y,column:W,offset:q}}function S(U){i[U.line]=U.column,R()}function k(){let U;for(;r._index<l.length;){const V=l[r._index];if(typeof V=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<V.length;)C(V.charCodeAt(r._bufferIndex));else C(V)}}function C(U){p=p(U)}function T(U){je(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,R()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=U}function N(U,V){const Y=V||{};return Y.type=U,Y.start=x(),u.events.push(["enter",Y,u]),c.push(Y),Y}function M(U){const V=c.pop();return V.end=x(),u.events.push(["exit",V,u]),V}function B(U,V){$(U,V.from)}function A(U,V){V.restore()}function D(U,V){return Y;function Y(W,q,z){let J,I,re,P;return Array.isArray(W)?Q(W):"tokenize"in W?Q([W]):H(W);function H(te){return _e;function _e(ye){const Ce=ye!==null&&te[ye],ge=ye!==null&&te.null,at=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return Q(at)(ye)}}function Q(te){return J=te,I=0,te.length===0?z:L(te[I])}function L(te){return _e;function _e(ye){return P=j(),re=te,te.partial||(u.currentConstruct=te),te.name&&u.parser.constructs.disable.null.includes(te.name)?oe():te.tokenize.call(V?Object.assign(Object.create(u),V):u,h,Z,oe)(ye)}}function Z(te){return U(re,P),q}function oe(te){return P.restore(),++I<J.length?L(J[I]):z}}}function $(U,V){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&sr(u.events,V,u.events.length-V,U.resolve(u.events.slice(V),u)),U.resolveTo&&(u.events=U.resolveTo(u.events,u))}function j(){const U=x(),V=u.previous,Y=u.currentConstruct,W=u.events.length,q=Array.from(c);return{from:W,restore:z};function z(){r=U,u.previous=V,u.currentConstruct=Y,u.events.length=W,c=q,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function E4(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,s)];else{if(l=e.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}s>0&&l.push(e[i].slice(0,s))}return l}function N4(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
278
+ `;break}case-3:{l=`\r
279
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function R4(e){const r={constructs:ak([k4,...(e||{}).extensions||[]]),content:i(W5),defined:[],document:i(V5),flow:i(c4),lazy:{},string:i(d4),text:i(f4)};return r;function i(s){return l;function l(c){return C4(r,s,c)}}}function T4(e){for(;!fk(e););return e}const Jx=/[\0\t\n\r]/g;function P4(){let e=1,t="",n=!0,r;return i;function i(s,l,c){const h=[];let u,p,f,v,_;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Jx.lastIndex=f,u=Jx.exec(s),v=u&&u.index!==void 0?u.index:s.length,_=s.charCodeAt(v),!u){t=s.slice(f);break}if(_===10&&f===v&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),f<v&&(h.push(s.slice(f,v)),e+=v-f),_){case 0:{h.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,h.push(-2);e++<p;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}f=v+1}return c&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const D4=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function A4(e){return e.replace(D4,M4)}function M4(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return ck(n.slice(s?2:1),s?16:10)}return Qg(n)||e}const yk={}.hasOwnProperty;function L4(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),O4(n)(T4(R4(n).document().write(P4()(e,t,!0))))}function O4(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(un),autolinkProtocol:j,autolinkEmail:j,atxHeading:s(Lt),blockQuote:s(ge),characterEscape:j,characterReference:j,codeFenced:s(at),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(at,l),codeText:s(nt,l),codeTextData:j,data:j,codeFlowValue:j,definition:s(Ie),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(rt),hardBreakEscape:s(cn),hardBreakTrailing:s(cn),htmlFlow:s(Un,l),htmlFlowData:j,htmlText:s(Un,l),htmlTextData:j,image:s(kn),label:l,link:s(un),listItem:s(hn),listItemValue:v,listOrdered:s(vt,f),listUnordered:s(vt),paragraph:s(or),reference:L,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Lt),strong:s(Sr),thematicBreak:s(Bi)},exit:{atxHeading:h(),atxHeadingSequence:B,autolink:h(),autolinkEmail:Ce,autolinkProtocol:ye,blockQuote:h(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:te,characterReference:_e,codeFenced:h(k),codeFencedFence:S,codeFencedFenceInfo:_,codeFencedFenceMeta:x,codeFlowValue:R,codeIndented:h(C),codeText:h(q),codeTextData:R,data:R,definition:h(),definitionDestinationString:M,definitionLabelString:T,definitionTitleString:N,emphasis:h(),hardBreakEscape:h(V),hardBreakTrailing:h(V),htmlFlow:h(Y),htmlFlowData:R,htmlText:h(W),htmlTextData:R,image:h(J),label:re,labelText:I,lineEnding:U,link:h(z),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:Z,resourceDestinationString:P,resourceTitleString:H,resource:Q,setextHeading:h($),setextHeadingLineSequence:D,setextHeadingText:A,strong:h(),thematicBreak:h()}};xk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let he={type:"root",children:[]};const Ae={stack:[he],tokenStack:[],config:t,enter:c,exit:u,buffer:l,resume:p,data:n},se=[];let ve=-1;for(;++ve<ne.length;)if(ne[ve][1].type==="listOrdered"||ne[ve][1].type==="listUnordered")if(ne[ve][0]==="enter")se.push(ve);else{const Ue=se.pop();ve=i(ne,Ue,ve)}for(ve=-1;++ve<ne.length;){const Ue=t[ne[ve][0]];yk.call(Ue,ne[ve][1].type)&&Ue[ne[ve][1].type].call(Object.assign({sliceSerialize:ne[ve][2].sliceSerialize},Ae),ne[ve][1])}if(Ae.tokenStack.length>0){const Ue=Ae.tokenStack[Ae.tokenStack.length-1];(Ue[1]||Qx).call(Ae,void 0,Ue[0])}for(he.position={start:os(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:os(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<t.transforms.length;)he=t.transforms[ve](he)||he;return he}function i(ne,he,Ae){let se=he-1,ve=-1,Ue=!1,dt,Kt,rn,Vn;for(;++se<=Ae;){const Ot=ne[se];switch(Ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ot[0]==="enter"?ve++:ve--,Vn=void 0;break}case"lineEndingBlank":{Ot[0]==="enter"&&(dt&&!Vn&&!ve&&!rn&&(rn=se),Vn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vn=void 0}if(!ve&&Ot[0]==="enter"&&Ot[1].type==="listItemPrefix"||ve===-1&&Ot[0]==="exit"&&(Ot[1].type==="listUnordered"||Ot[1].type==="listOrdered")){if(dt){let lr=se;for(Kt=void 0;lr--;){const dn=ne[lr];if(dn[1].type==="lineEnding"||dn[1].type==="lineEndingBlank"){if(dn[0]==="exit")continue;Kt&&(ne[Kt][1].type="lineEndingBlank",Ue=!0),dn[1].type="lineEnding",Kt=lr}else if(!(dn[1].type==="linePrefix"||dn[1].type==="blockQuotePrefix"||dn[1].type==="blockQuotePrefixWhitespace"||dn[1].type==="blockQuoteMarker"||dn[1].type==="listItemIndent"))break}rn&&(!Kt||rn<Kt)&&(dt._spread=!0),dt.end=Object.assign({},Kt?ne[Kt][1].start:Ot[1].end),ne.splice(Kt||se,0,["exit",dt,Ot[2]]),se++,Ae++}if(Ot[1].type==="listItemPrefix"){const lr={type:"listItem",_spread:!1,start:Object.assign({},Ot[1].start),end:void 0};dt=lr,ne.splice(se,0,["enter",lr,Ot[2]]),se++,Ae++,rn=void 0,Vn=!0}}}return ne[he][1]._spread=Ue,Ae}function s(ne,he){return Ae;function Ae(se){c.call(this,ne(se),se),he&&he.call(this,se)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(ne,he,Ae){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([he,Ae||void 0]),ne.position={start:os(he.start),end:void 0}}function h(ne){return he;function he(Ae){ne&&ne.call(this,Ae),u.call(this,Ae)}}function u(ne,he){const Ae=this.stack.pop(),se=this.tokenStack.pop();if(se)se[0].type!==ne.type&&(he?he.call(this,ne,se[0]):(se[1]||Qx).call(this,ne,se[0]));else throw new Error("Cannot close `"+ne.type+"` ("+da({start:ne.start,end:ne.end})+"): it’s not open");Ae.position.end=os(ne.end)}function p(){return Jg(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function v(ne){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.lang=ne}function x(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.meta=ne}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/(\r?\n|\r)$/g,"")}function T(ne){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=he,Ae.identifier=jr(this.sliceSerialize(ne)).toLowerCase()}function N(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function M(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function B(ne){const he=this.stack[this.stack.length-1];if(!he.depth){const Ae=this.sliceSerialize(ne).length;he.depth=Ae}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function D(ne){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function j(ne){const Ae=this.stack[this.stack.length-1].children;let se=Ae[Ae.length-1];(!se||se.type!=="text")&&(se=br(),se.position={start:os(ne.start),end:void 0},Ae.push(se)),this.stack.push(se)}function R(ne){const he=this.stack.pop();he.value+=this.sliceSerialize(ne),he.position.end=os(ne.end)}function U(ne){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=he.children[he.children.length-1];Ae.position.end=os(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(j.call(this,ne),R.call(this,ne))}function V(){this.data.atHardBreak=!0}function Y(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function W(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function q(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function z(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function J(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function I(ne){const he=this.sliceSerialize(ne),Ae=this.stack[this.stack.length-2];Ae.label=A4(he),Ae.identifier=jr(he).toLowerCase()}function re(){const ne=this.stack[this.stack.length-1],he=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const se=ne.children;Ae.children=se}else Ae.alt=he}function P(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function H(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function Q(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function Z(ne){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=he,Ae.identifier=jr(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function oe(ne){this.data.characterReferenceType=ne.type}function te(ne){const he=this.sliceSerialize(ne),Ae=this.data.characterReferenceType;let se;Ae?(se=ck(he,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):se=Qg(he);const ve=this.stack[this.stack.length-1];ve.value+=se}function _e(ne){const he=this.stack.pop();he.position.end=os(ne.end)}function ye(ne){R.call(this,ne);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(ne)}function Ce(ne){R.call(this,ne);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(ne)}function ge(){return{type:"blockquote",children:[]}}function at(){return{type:"code",lang:null,meta:null,value:""}}function nt(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function rt(){return{type:"emphasis",children:[]}}function Lt(){return{type:"heading",depth:0,children:[]}}function cn(){return{type:"break"}}function Un(){return{type:"html",value:""}}function kn(){return{type:"image",title:null,url:"",alt:null}}function un(){return{type:"link",title:null,url:"",children:[]}}function vt(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function hn(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function or(){return{type:"paragraph",children:[]}}function Sr(){return{type:"strong",children:[]}}function br(){return{type:"text",value:""}}function Bi(){return{type:"thematicBreak"}}}function os(e){return{line:e.line,column:e.column,offset:e.offset}}function xk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?xk(e,r):j4(e,r)}}function j4(e,t){let n;for(n in t)if(yk.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 Qx(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+da({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+da({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+da({start:t.start,end:t.end})+") is still open")}function I4(e){const t=this;t.parser=n;function n(r){return L4(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function B4(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 z4(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
280
+ `}]}function F4(e,t){const n=t.value?t.value+`
281
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function $4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function H4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function W4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Qo(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let l,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=s+1,c+=1,e.footnoteCounts.set(r,c);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,h);const u={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,u),e.applyData(t,u)}function U4(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 V4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function wk(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function q4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wk(e,t);const i={src:Qo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function K4(e,t){const n={src:Qo(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 Y4(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 X4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wk(e,t);const i={href:Qo(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Z4(e,t){const n={href:Qo(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 G4(e,t,n){const r=e.all(t),i=n?J4(n):Sk(t),s={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(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:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
282
+ `}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const h=r[r.length-1];h&&(i||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
283
+ `});const u={type:"element",tagName:"li",properties:s,children:l};return e.patch(t,u),e.applyData(t,u)}function J4(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=Sk(n[r])}return t}function Sk(e){const t=e.spread;return t??e.children.length>1}function Q4(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function e3(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function t3(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function n3(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function r3(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=Yg(t.children[1]),h=tk(t.children[t.children.length-1]);c&&h&&(l.position={start:c,end:h}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function i3(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:t.children.length;let h=-1;const u=[];for(;++h<c;){const f=t.children[h],v={},_=l?l[h]:void 0;_&&(v.align=_);let x={type:"element",tagName:s,properties:v,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),u.push(x)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function s3(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ew=9,tw=32;function o3(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(nw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(nw(t.slice(i),i>0,!1)),s.join("")}function nw(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===ew||s===tw;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===ew||s===tw;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function l3(e,t){const n={type:"text",value:o3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function a3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const c3={blockquote:B4,break:z4,code:F4,delete:$4,emphasis:H4,footnoteReference:W4,heading:U4,html:V4,imageReference:q4,image:K4,inlineCode:Y4,linkReference:X4,link:Z4,listItem:G4,list:Q4,paragraph:e3,root:t3,strong:n3,table:r3,tableCell:s3,tableRow:i3,text:l3,thematicBreak:a3,toml:du,yaml:du,definition:du,footnoteDefinition:du};function du(){}const bk=-1,qh=0,pa=1,mh=2,tv=3,nv=4,rv=5,iv=6,kk=7,Ck=8,u3=typeof self=="object"?self:globalThis,rw=(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 u3[e](t)},h3=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,l]=t[i];switch(s){case qh:case bk:return n(l,i);case pa:{const c=n([],i);for(const h of l)c.push(r(h));return c}case mh:{const c=n({},i);for(const[h,u]of l)c[r(h)]=r(u);return c}case tv:return n(new Date(l),i);case nv:{const{source:c,flags:h}=l;return n(new RegExp(c,h),i)}case rv:{const c=n(new Map,i);for(const[h,u]of l)c.set(r(h),r(u));return c}case iv:{const c=n(new Set,i);for(const h of l)c.add(r(h));return c}case kk:{const{name:c,message:h}=l;return n(rw(c,h),i)}case Ck:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(rw(s,l),i)};return r},iw=e=>h3(new Map,e)(0),Ro="",{toString:d3}={},{keys:f3}=Object,Vl=e=>{const t=typeof e;if(t!=="object"||!e)return[qh,t];const n=d3.call(e).slice(8,-1);switch(n){case"Array":return[pa,Ro];case"Object":return[mh,Ro];case"Date":return[tv,Ro];case"RegExp":return[nv,Ro];case"Map":return[rv,Ro];case"Set":return[iv,Ro];case"DataView":return[pa,n]}return n.includes("Array")?[pa,n]:n.includes("Error")?[kk,n]:[mh,n]},fu=([e,t])=>e===qh&&(t==="function"||t==="symbol"),p3=(e,t,n,r)=>{const i=(l,c)=>{const h=r.push(l)-1;return n.set(c,h),h},s=l=>{if(n.has(l))return n.get(l);let[c,h]=Vl(l);switch(c){case qh:{let p=l;switch(h){case"bigint":c=Ck,p=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);p=null;break;case"undefined":return i([bk],l)}return i([c,p],l)}case pa:{if(h){let v=l;return h==="DataView"?v=new Uint8Array(l.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(l)),i([h,[...v]],l)}const p=[],f=i([c,p],l);for(const v of l)p.push(s(v));return f}case mh:{if(h)switch(h){case"BigInt":return i([h,l.toString()],l);case"Boolean":case"Number":case"String":return i([h,l.valueOf()],l)}if(t&&"toJSON"in l)return s(l.toJSON());const p=[],f=i([c,p],l);for(const v of f3(l))(e||!fu(Vl(l[v])))&&p.push([s(v),s(l[v])]);return f}case tv:return i([c,l.toISOString()],l);case nv:{const{source:p,flags:f}=l;return i([c,{source:p,flags:f}],l)}case rv:{const p=[],f=i([c,p],l);for(const[v,_]of l)(e||!(fu(Vl(v))||fu(Vl(_))))&&p.push([s(v),s(_)]);return f}case iv:{const p=[],f=i([c,p],l);for(const v of l)(e||!fu(Vl(v)))&&p.push(s(v));return f}}const{message:u}=l;return i([c,{name:h,message:u}],l)};return s},sw=(e,{json:t,lossy:n}={})=>{const r=[];return p3(!(t||n),!!t,new Map,r)(e),r},gh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?iw(sw(e,t)):structuredClone(e):(e,t)=>iw(sw(e,t));function m3(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 g3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function v3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||m3,r=e.options.footnoteBackLabel||g3,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let h=-1;for(;++h<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[h]);if(!u)continue;const p=e.all(u),f=String(u.identifier).toUpperCase(),v=Qo(f.toLowerCase());let _=0;const x=[],S=e.footnoteCounts.get(f);for(;S!==void 0&&++_<=S;){x.length>0&&x.push({type:"text",value:" "});let T=typeof n=="string"?n:n(h,_);typeof T=="string"&&(T={type:"text",value:T}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,_),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const T=k.children[k.children.length-1];T&&T.type==="text"?T.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...x)}else p.push(...x);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(p,!0)};e.patch(u,C),c.push(C)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...gh(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
284
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
285
+ `}]}}const Kh=(function(e){if(e==null)return w3;if(typeof e=="function")return Yh(e);if(typeof e=="object")return Array.isArray(e)?_3(e):y3(e);if(typeof e=="string")return x3(e);throw new Error("Expected function, string, or object as test")});function _3(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Kh(e[n]);return Yh(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function y3(e){const t=e;return Yh(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function x3(e){return Yh(t);function t(n){return n&&n.type===e}}function Yh(e){return t;function t(n,r,i){return!!(S3(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function w3(){return!0}function S3(e){return e!==null&&typeof e=="object"&&"type"in e}const Ek=[],b3=!0,mm=!1,k3="skip";function Nk(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Kh(i),l=r?-1:1;c(e,void 0,[])();function c(h,u,p){const f=h&&typeof h=="object"?h:{};if(typeof f.type=="string"){const _=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(_?"<"+_+">":""))+")"})}return v;function v(){let _=Ek,x,S,k;if((!t||s(h,u,p[p.length-1]||void 0))&&(_=C3(n(h,p)),_[0]===mm))return _;if("children"in h&&h.children){const C=h;if(C.children&&_[0]!==k3)for(S=(r?C.children.length:-1)+l,k=p.concat(C);S>-1&&S<C.children.length;){const T=C.children[S];if(x=c(T,S,k)(),x[0]===mm)return x;S=typeof x[1]=="number"?x[1]:S+l}}return _}}}function C3(e){return Array.isArray(e)?e:typeof e=="number"?[b3,e]:e==null?Ek:[e]}function sv(e,t,n,r){let i,s,l;typeof t=="function"&&typeof n!="function"?(s=void 0,l=t,i=n):(s=t,l=n,i=r),Nk(e,s,c,i);function c(h,u){const p=u[u.length-1],f=p?p.children.indexOf(h):void 0;return l(h,f,p)}}const gm={}.hasOwnProperty,E3={};function N3(e,t){const n=t||E3,r=new Map,i=new Map,s=new Map,l={...c3,...n.handlers},c={all:u,applyData:T3,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:h,options:n,patch:R3,wrap:D3};return sv(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?r:i,v=String(p.identifier).toUpperCase();f.has(v)||f.set(v,p)}}),c;function h(p,f){const v=p.type,_=c.handlers[v];if(gm.call(c.handlers,v)&&_)return _(c,p,f);if(c.options.passThrough&&c.options.passThrough.includes(v)){if("children"in p){const{children:S,...k}=p,C=gh(k);return C.children=c.all(p),C}return gh(p)}return(c.options.unknownHandler||P3)(c,p,f)}function u(p){const f=[];if("children"in p){const v=p.children;let _=-1;for(;++_<v.length;){const x=c.one(v[_],p);if(x){if(_&&v[_-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=ow(x.value)),!Array.isArray(x)&&x.type==="element")){const S=x.children[0];S&&S.type==="text"&&(S.value=ow(S.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function R3(e,t){e.position&&(t.position=m5(e))}function T3(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,gh(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function P3(e,t){const n=t.data||{},r="value"in t&&!(gm.call(n,"hProperties")||gm.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 D3(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
286
+ `});++r<e.length;)r&&n.push({type:"text",value:`
287
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
288
+ `}),n}function ow(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function lw(e,t){const n=N3(e,t),r=n.one(e,void 0),i=v3(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
289
+ `},i),s}function A3(e,t){return e&&"run"in e?async function(n,r){const i=lw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return lw(n,{file:r,...e||t})}}function aw(e){if(e)throw e}var up,cw;function M3(){if(cw)return up;cw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var p=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!p&&!f)return!1;var v;for(v in u);return typeof v>"u"||e.call(u,v)},l=function(u,p){n&&p.name==="__proto__"?n(u,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):u[p.name]=p.newValue},c=function(u,p){if(p==="__proto__")if(e.call(u,p)){if(r)return r(u,p).value}else return;return u[p]};return up=function h(){var u,p,f,v,_,x,S=arguments[0],k=1,C=arguments.length,T=!1;for(typeof S=="boolean"&&(T=S,S=arguments[1]||{},k=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});k<C;++k)if(u=arguments[k],u!=null)for(p in u)f=c(S,p),v=c(u,p),S!==v&&(T&&v&&(s(v)||(_=i(v)))?(_?(_=!1,x=f&&i(f)?f:[]):x=f&&s(f)?f:{},l(S,{name:p,newValue:h(T,x,v)})):typeof v<"u"&&l(S,{name:p,newValue:v}));return S},up}var L3=M3();const hp=ig(L3);function vm(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 O3(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(h,...u){const p=e[++s];let f=-1;if(h){l(h);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,p?j3(p,c)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function j3(e,t){let n;return r;function r(...l){const c=e.length>l.length;let h;c&&l.push(i);try{h=e.apply(this,l)}catch(u){const p=u;if(c&&n)throw p;return i(p)}c||(h&&h.then&&typeof h.then=="function"?h.then(s,i):h instanceof Error?i(h):s(h))}function i(l,...c){n||(n=!0,t(l,...c))}function s(l){i(null,l)}}const Jr={basename:I3,dirname:B3,extname:z3,join:F3,sep:"/"};function I3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ha(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function B3(e){if(Ha(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 z3(e){Ha(e);let t=e.length,n=-1,r=0,i=-1,s=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function F3(...e){let t=-1,n;for(;++t<e.length;)Ha(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$3(n)}function $3(e){Ha(e);const t=e.codePointAt(0)===47;let n=H3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function H3(e,t){let n="",r=0,i=-1,s=0,l=-1,c,h;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,s=0}else c===46&&s>-1?s++:s=-1}return n}function Ha(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const W3={cwd:U3};function U3(){return"/"}function _m(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function V3(e){if(typeof e=="string")e=new URL(e);else if(!_m(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 q3(e)}function q3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const dp=["history","path","basename","stem","extname","dirname"];class Rk{constructor(t){let n;t?_m(t)?n={path:t}:typeof t=="string"||K3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<dp.length;){const s=dp[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)dp.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Jr.basename(this.path):void 0}set basename(t){pp(t,"basename"),fp(t,"basename"),this.path=Jr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Jr.dirname(this.path):void 0}set dirname(t){uw(this.basename,"dirname"),this.path=Jr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Jr.extname(this.path):void 0}set extname(t){if(fp(t,"extname"),uw(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=Jr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_m(t)&&(t=V3(t)),pp(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Jr.basename(this.path,this.extname):void 0}set stem(t){pp(t,"stem"),fp(t,"stem"),this.path=Jr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new bn(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function fp(e,t){if(e&&e.includes(Jr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Jr.sep+"`")}function pp(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function K3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y3=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),X3={}.hasOwnProperty;class ov extends Y3{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=O3()}copy(){const t=new ov;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hp(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(vp("data",this.frozen),this.namespace[t]=n,this):X3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=pu(t),r=this.parser||this.Parser;return mp("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),mp("process",this.parser||this.Parser),gp("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=pu(t),h=r.parse(c);r.run(h,c,function(p,f,v){if(p||!f||!v)return u(p);const _=f,x=r.stringify(_,v);J3(x)?v.value=x:v.result=x,u(p,v)});function u(p,f){p||!f?l(p):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),mp("processSync",this.parser||this.Parser),gp("processSync",this.compiler||this.Compiler),this.process(t,i),dw("processSync","process",n),r;function i(s,l){n=!0,aw(s),r=l}}run(t,n,r){hw(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,c){const h=pu(n);i.run(t,h,u);function u(p,f,v){const _=f||t;p?c(p):l?l(_):r(void 0,_,v)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),dw("runSync","run",r),i;function s(l,c){aw(l),i=c,r=!0}}stringify(t,n){this.freeze();const r=pu(n),i=this.compiler||this.Compiler;return gp("stringify",i),hw(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(vp("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")h(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...f]=u;h(p,f)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(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");c(u.plugins),u.settings&&(i.settings=hp(!0,i.settings,u.settings))}function c(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const f=u[p];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function h(u,p){let f=-1,v=-1;for(;++f<r.length;)if(r[f][0]===u){v=f;break}if(v===-1)r.push([u,...p]);else if(p.length>0){let[_,...x]=p;const S=r[v][1];vm(S)&&vm(_)&&(_=hp(!0,S,_)),r[v]=[u,_,...x]}}}}const Z3=new ov().freeze();function mp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vp(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 hw(e){if(!vm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pu(e){return G3(e)?e:new Rk(e)}function G3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function J3(e){return typeof e=="string"||Q3(e)}function Q3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fw=[],pw={allowDangerousHtml:!0},tI=/^(https?|ircs?|mailto|xmpp)$/i,nI=[{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:"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 rI(e){const t=iI(e),n=sI(e);return oI(t.runSync(t.parse(n),n),e)}function iI(e){const t=e.rehypePlugins||fw,n=e.remarkPlugins||fw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pw}:pw;return Z3().use(I4).use(n).use(A3,r).use(t)}function sI(e){const t=e.children||"",n=new Rk;return typeof t=="string"&&(n.value=t),n}function oI(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,h=t.urlTransform||lI;for(const p of nI)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+eI+p.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),sv(e,u),x5(e,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function u(p,f,v){if(p.type==="raw"&&v&&typeof f=="number")return l?v.children.splice(f,1):v.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let _;for(_ in lp)if(Object.hasOwn(lp,_)&&Object.hasOwn(p.properties,_)){const x=p.properties[_],S=lp[_];(S===null||S.includes(p.tagName))&&(p.properties[_]=h(String(x||""),_,p))}}if(p.type==="element"){let _=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!_&&r&&typeof f=="number"&&(_=!r(p,f,v)),_&&v&&typeof f=="number")return c&&p.children?v.children.splice(f,1,...p.children):v.children.splice(f,1),f}}}function lI(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||tI.test(e.slice(0,t))?e:""}function mw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function aI(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Tk(e,t,n){const i=Kh((n||{}).ignore||[]),s=cI(t);let l=-1;for(;++l<s.length;)Nk(e,"text",c);function c(u,p){let f=-1,v;for(;++f<p.length;){const _=p[f],x=v?v.children:void 0;if(i(_,x?x.indexOf(_):void 0,v))return;v=_}if(v)return h(u,p)}function h(u,p){const f=p[p.length-1],v=s[l][0],_=s[l][1];let x=0;const k=f.children.indexOf(u);let C=!1,T=[];v.lastIndex=0;let N=v.exec(u.value);for(;N;){const M=N.index,B={index:N.index,input:N.input,stack:[...p,u]};let A=_(...N,B);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?v.lastIndex=M+1:(x!==M&&T.push({type:"text",value:u.value.slice(x,M)}),Array.isArray(A)?T.push(...A):A&&T.push(A),x=M+N[0].length,C=!0),!v.global)break;N=v.exec(u.value)}return C?(x<u.value.length&&T.push({type:"text",value:u.value.slice(x)}),f.children.splice(k,1,...T)):T=[u],k+T.length}}function cI(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 i=n[r];t.push([uI(i[0]),hI(i[1])])}return t}function uI(e){return typeof e=="string"?new RegExp(aI(e),"g"):e}function hI(e){return typeof e=="function"?e:function(){return e}}const _p="phrasing",yp=["autolink","link","image","label"];function dI(){return{transforms:[yI],enter:{literalAutolink:pI,literalAutolinkEmail:xp,literalAutolinkHttp:xp,literalAutolinkWww:xp},exit:{literalAutolink:_I,literalAutolinkEmail:vI,literalAutolinkHttp:mI,literalAutolinkWww:gI}}}function fI(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_p,notInConstruct:yp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_p,notInConstruct:yp},{character:":",before:"[ps]",after:"\\/",inConstruct:_p,notInConstruct:yp}]}}function pI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xp(e){this.config.enter.autolinkProtocol.call(this,e)}function mI(e){this.config.exit.autolinkProtocol.call(this,e)}function gI(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 vI(e){this.config.exit.autolinkEmail.call(this,e)}function _I(e){this.exit(e)}function yI(e){Tk(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),wI]],{ignore:["link","linkReference"]})}function xI(e,t,n,r,i){let s="";if(!Pk(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!SI(n)))return!1;const l=bI(n+r);if(!l[0])return!1;const c={type:"link",title:null,url:s+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function wI(e,t,n,r){return!Pk(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function SI(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 bI(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=mw(e,"(");let s=mw(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Pk(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Zs(n)||Uh(n))&&(!t||n!==47)}Dk.peek=AI;function kI(){this.buffer()}function CI(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function EI(){this.buffer()}function NI(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function RI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function TI(e){this.exit(e)}function PI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function DI(e){this.exit(e)}function AI(){return"["}function Dk(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),c(),l(),s+=i.move("]"),s}function MI(){return{enter:{gfmFootnoteCallString:kI,gfmFootnoteCall:CI,gfmFootnoteDefinitionLabelString:EI,gfmFootnoteDefinition:NI},exit:{gfmFootnoteCallString:RI,gfmFootnoteCall:TI,gfmFootnoteDefinitionLabelString:PI,gfmFootnoteDefinition:DI}}}function LI(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Dk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,l){const c=s.createTracker(l);let h=c.move("[^");const u=s.enter("footnoteDefinition"),p=s.enter("label");return h+=c.move(s.safe(s.associationId(r),{before:h,after:"]"})),p(),h+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),h+=c.move((t?`
290
+ `:" ")+s.indentLines(s.containerFlow(r,c.current()),t?Ak:OI))),u(),h}}function OI(e,t,n){return t===0?e:Ak(e,t,n)}function Ak(e,t,n){return(n?"":" ")+e}const jI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Mk.peek=$I;function II(){return{canContainEols:["delete"],enter:{strikethrough:zI},exit:{strikethrough:FI}}}function BI(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:jI}],handlers:{delete:Mk}}}function zI(e){this.enter({type:"delete",children:[]},e)}function FI(e){this.exit(e)}function Mk(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),s(),l}function $I(){return"~"}function HI(e){return e.length}function WI(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||HI,s=[],l=[],c=[],h=[];let u=0,p=-1;for(;++p<e.length;){const S=[],k=[];let C=-1;for(e[p].length>u&&(u=e[p].length);++C<e[p].length;){const T=UI(e[p][C]);if(n.alignDelimiters!==!1){const N=i(T);k[C]=N,(h[C]===void 0||N>h[C])&&(h[C]=N)}S.push(T)}l[p]=S,c[p]=k}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=gw(r[f]);else{const S=gw(r);for(;++f<u;)s[f]=S}f=-1;const v=[],_=[];for(;++f<u;){const S=s[f];let k="",C="";S===99?(k=":",C=":"):S===108?k=":":S===114&&(C=":");let T=n.alignDelimiters===!1?1:Math.max(1,h[f]-k.length-C.length);const N=k+"-".repeat(T)+C;n.alignDelimiters!==!1&&(T=k.length+T+C.length,T>h[f]&&(h[f]=T),_[f]=T),v[f]=N}l.splice(1,0,v),c.splice(1,0,_),p=-1;const x=[];for(;++p<l.length;){const S=l[p],k=c[p];f=-1;const C=[];for(;++f<u;){const T=S[f]||"";let N="",M="";if(n.alignDelimiters!==!1){const B=h[f]-(k[f]||0),A=s[f];A===114?N=" ".repeat(B):A===99?B%2?(N=" ".repeat(B/2+.5),M=" ".repeat(B/2-.5)):(N=" ".repeat(B/2),M=N):M=" ".repeat(B)}n.delimiterStart!==!1&&!f&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||f)&&C.push(" "),n.alignDelimiters!==!1&&C.push(N),C.push(T),n.alignDelimiters!==!1&&C.push(M),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&C.push("|")}x.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return x.join(`
291
+ `)}function UI(e){return e==null?"":String(e)}function gw(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 VI(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const l=n.indentLines(n.containerFlow(e,s.current()),qI);return i(),l}function qI(e,t,n){return">"+(n?"":" ")+e}function KI(e,t){return vw(e,t.inConstruct,!0)&&!vw(e,t.notInConstruct,!1)}function vw(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 _w(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
292
+ `&&KI(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
293
+ `}function YI(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>l&&(l=s):s=1,i=r+t.length,r=n.indexOf(t,i);return l}function XI(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 ZI(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 GI(e,t,n,r){const i=ZI(n),s=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(XI(e,n)){const f=n.enter("codeIndented"),v=n.indentLines(s,JI);return f(),v}const c=n.createTracker(r),h=i.repeat(Math.max(YI(s,i)+1,3)),u=n.enter("codeFenced");let p=c.move(h);if(e.lang){const f=n.enter(`codeFencedLang${l}`);p+=c.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...c.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${l}`);p+=c.move(" "),p+=c.move(n.safe(e.meta,{before:p,after:`
294
+ `,encode:["`"],...c.current()})),f()}return p+=c.move(`
295
+ `),s&&(p+=c.move(s+`
296
+ `)),p+=c.move(h),u(),p}function JI(e,t,n){return(n?"":" ")+e}function lv(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 QI(e,t,n,r){const i=lv(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const h=n.createTracker(r);let u=h.move("[");return u+=h.move(n.safe(n.associationId(e),{before:u,after:"]",...h.current()})),u+=h.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=h.move("<"),u+=h.move(n.safe(e.url,{before:u,after:">",...h.current()})),u+=h.move(">")):(c=n.enter("destinationRaw"),u+=h.move(n.safe(e.url,{before:u,after:e.title?" ":`
297
+ `,...h.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=h.move(" "+i),u+=h.move(n.safe(e.title,{before:u,after:i,...h.current()})),u+=h.move(i),c()),l(),u}function eB(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 Ra(e){return"&#x"+e.toString(16).toUpperCase()+";"}function vh(e,t,n){const r=Vo(e),i=Vo(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Lk.peek=tB;function Lk(e,t,n,r){const i=eB(n),s=n.enter("emphasis"),l=n.createTracker(r),c=l.move(i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const u=h.charCodeAt(0),p=vh(r.before.charCodeAt(r.before.length-1),u,i);p.inside&&(h=Ra(u)+h.slice(1));const f=h.charCodeAt(h.length-1),v=vh(r.after.charCodeAt(0),f,i);v.inside&&(h=h.slice(0,-1)+Ra(f));const _=l.move(i);return s(),n.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},c+h+_}function tB(e,t,n){return n.options.emphasis||"*"}function nB(e,t){let n=!1;return sv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,mm}),!!((!e.depth||e.depth<3)&&Jg(e)&&(t.options.setext||n))}function rB(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(nB(e,n)){const p=n.enter("headingSetext"),f=n.enter("phrasing"),v=n.containerPhrasing(e,{...s.current(),before:`
298
+ `,after:`
299
+ `});return f(),p(),v+`
300
+ `+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
301
+ `))+1))}const l="#".repeat(i),c=n.enter("headingAtx"),h=n.enter("phrasing");s.move(l+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
302
+ `,...s.current()});return/^[\t ]/.test(u)&&(u=Ra(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,n.options.closeAtx&&(u+=" "+l),h(),c(),u}Ok.peek=iB;function Ok(e){return e.value||""}function iB(){return"<"}jk.peek=sB;function jk(e,t,n,r){const i=lv(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const h=n.createTracker(r);let u=h.move("![");return u+=h.move(n.safe(e.alt,{before:u,after:"]",...h.current()})),u+=h.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=h.move("<"),u+=h.move(n.safe(e.url,{before:u,after:">",...h.current()})),u+=h.move(">")):(c=n.enter("destinationRaw"),u+=h.move(n.safe(e.url,{before:u,after:e.title?" ":")",...h.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=h.move(" "+i),u+=h.move(n.safe(e.title,{before:u,after:i,...h.current()})),u+=h.move(i),c()),u+=h.move(")"),l(),u}function sB(){return"!"}Ik.peek=oB;function Ik(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");const u=n.safe(e.alt,{before:h,after:"]",...c.current()});h+=c.move(u+"]["),l();const p=n.stack;n.stack=[],l=n.enter("reference");const f=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=p,s(),i==="full"||!u||u!==f?h+=c.move(f+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function oB(){return"!"}Bk.peek=lB;function Bk(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const l=n.unsafe[s],c=n.compilePattern(l);let h;if(l.atBreak)for(;h=c.exec(r);){let u=h.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(h.index+1)}}return i+r+i}function lB(){return"`"}function zk(e,t){const n=Jg(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))}Fk.peek=aB;function Fk(e,t,n,r){const i=lv(n),s=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,h;if(zk(e,n)){const p=n.stack;n.stack=[],c=n.enter("autolink");let f=l.move("<");return f+=l.move(n.containerPhrasing(e,{before:f,after:">",...l.current()})),f+=l.move(">"),c(),n.stack=p,f}c=n.enter("link"),h=n.enter("label");let u=l.move("[");return u+=l.move(n.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(h=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),h(),e.title&&(h=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),h()),u+=l.move(")"),c(),u}function aB(e,t,n){return zk(e,n)?"<":"["}$k.peek=cB;function $k(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");const u=n.containerPhrasing(e,{before:h,after:"]",...c.current()});h+=c.move(u+"]["),l();const p=n.stack;n.stack=[],l=n.enter("reference");const f=n.safe(n.associationId(e),{before:h,after:"]",...c.current()});return l(),n.stack=p,s(),i==="full"||!u||u!==f?h+=c.move(f+"]"):i==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function cB(){return"["}function av(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 uB(e){const t=av(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 hB(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 Hk(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 dB(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let l=e.ordered?hB(n):av(n);const c=e.ordered?l==="."?")":".":uB(n);let h=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),Hk(n)===l&&p){let f=-1;for(;++f<e.children.length;){const v=e.children[f];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=c),n.bulletCurrent=l;const u=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=s,i(),u}function fB(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 pB(e,t,n,r){const i=fB(n);let s=n.bulletCurrent||av(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let l=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(s+" ".repeat(l-s.length)),c.shift(l);const h=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,c.current()),p);return h(),u;function p(f,v,_){return v?(_?"":" ".repeat(l))+f:(_?s:s+" ".repeat(l-s.length))+f}}function mB(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(e,r);return s(),i(),l}const gB=Kh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vB(e,t,n,r){return(e.children.some(function(l){return gB(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function _B(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Wk.peek=yB;function Wk(e,t,n,r){const i=_B(n),s=n.enter("strong"),l=n.createTracker(r),c=l.move(i+i);let h=l.move(n.containerPhrasing(e,{after:i,before:c,...l.current()}));const u=h.charCodeAt(0),p=vh(r.before.charCodeAt(r.before.length-1),u,i);p.inside&&(h=Ra(u)+h.slice(1));const f=h.charCodeAt(h.length-1),v=vh(r.after.charCodeAt(0),f,i);v.inside&&(h=h.slice(0,-1)+Ra(f));const _=l.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},c+h+_}function yB(e,t,n){return n.options.strong||"*"}function xB(e,t,n,r){return n.safe(e.value,r)}function wB(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 SB(e,t,n){const r=(Hk(n)+(n.options.ruleSpaces?" ":"")).repeat(wB(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Uk={blockquote:VI,break:_w,code:GI,definition:QI,emphasis:Lk,hardBreak:_w,heading:rB,html:Ok,image:jk,imageReference:Ik,inlineCode:Bk,link:Fk,linkReference:$k,list:dB,listItem:pB,paragraph:mB,root:vB,strong:Wk,text:xB,thematicBreak:SB};function bB(){return{enter:{table:kB,tableData:yw,tableHeader:yw,tableRow:EB},exit:{codeText:NB,table:CB,tableData:wp,tableHeader:wp,tableRow:wp}}}function kB(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 CB(e){this.exit(e),this.data.inTable=void 0}function EB(e){this.enter({type:"tableRow",children:[]},e)}function wp(e){this.exit(e)}function yw(e){this.enter({type:"tableCell",children:[]},e)}function NB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,RB));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function RB(e,t){return t==="|"?t:e}function TB(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
303
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:l,tableCell:h,tableRow:c}};function l(_,x,S,k){return u(p(_,S,k),_.align)}function c(_,x,S,k){const C=f(_,S,k),T=u([C]);return T.slice(0,T.indexOf(`
304
+ `))}function h(_,x,S,k){const C=S.enter("tableCell"),T=S.enter("phrasing"),N=S.containerPhrasing(_,{...k,before:s,after:s});return T(),C(),N}function u(_,x){return WI(_,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function p(_,x,S){const k=_.children;let C=-1;const T=[],N=x.enter("table");for(;++C<k.length;)T[C]=f(k[C],x,S);return N(),T}function f(_,x,S){const k=_.children;let C=-1;const T=[],N=x.enter("tableRow");for(;++C<k.length;)T[C]=h(k[C],_,x,S);return N(),T}function v(_,x,S){let k=Uk.inlineCode(_,x,S);return S.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function PB(){return{exit:{taskListCheckValueChecked:xw,taskListCheckValueUnchecked:xw,paragraph:AB}}}function DB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:MB}}}function xw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function AB(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,l;for(;++s<i.length;){const c=i[s];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function MB(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);s&&c.move(l);let h=Uk.listItem(e,t,n,{...r,...c.current()});return s&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),h;function u(p){return p+l}}function LB(){return[dI(),MI(),II(),bB(),PB()]}function OB(e){return{extensions:[fI(),LI(e),BI(),TB(e),DB()]}}const jB={tokenize:HB,partial:!0},Vk={tokenize:WB,partial:!0},qk={tokenize:UB,partial:!0},Kk={tokenize:VB,partial:!0},IB={tokenize:qB,partial:!0},Yk={name:"wwwAutolink",tokenize:FB,previous:Zk},Xk={name:"protocolAutolink",tokenize:$B,previous:Gk},Oi={name:"emailAutolink",tokenize:zB,previous:Jk},ci={};function BB(){return{text:ci}}let Is=48;for(;Is<123;)ci[Is]=Oi,Is++,Is===58?Is=65:Is===91&&(Is=97);ci[43]=Oi;ci[45]=Oi;ci[46]=Oi;ci[95]=Oi;ci[72]=[Oi,Xk];ci[104]=[Oi,Xk];ci[87]=[Oi,Yk];ci[119]=[Oi,Yk];function zB(e,t,n){const r=this;let i,s;return l;function l(f){return!ym(f)||!Jk.call(r,r.previous)||cv(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(f))}function c(f){return ym(f)?(e.consume(f),c):f===64?(e.consume(f),h):n(f)}function h(f){return f===46?e.check(IB,p,u)(f):f===45||f===95||Sn(f)?(s=!0,e.consume(f),h):p(f)}function u(f){return e.consume(f),i=!0,h}function p(f){return s&&i&&Tn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function FB(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!Zk.call(r,r.previous)||cv(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(jB,e.attempt(Vk,e.attempt(qk,s),n),n)(l))}function s(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function $B(e,t,n){const r=this;let i="",s=!1;return l;function l(f){return(f===72||f===104)&&Gk.call(r,r.previous)&&!cv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),c):n(f)}function c(f){if(Tn(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),c;if(f===58){const v=i.toLowerCase();if(v==="http"||v==="https")return e.consume(f),h}return n(f)}function h(f){return f===47?(e.consume(f),s?u:(s=!0,h)):n(f)}function u(f){return f===null||ph(f)||ut(f)||Zs(f)||Uh(f)?n(f):e.attempt(Vk,e.attempt(qk,p),n)(f)}function p(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function HB(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),s):n(l)}function s(l){return l===null?n(l):t(l)}}function WB(e,t,n){let r,i,s;return l;function l(u){return u===46||u===95?e.check(Kk,h,c)(u):u===null||ut(u)||Zs(u)||u!==45&&Uh(u)?h(u):(s=!0,e.consume(u),l)}function c(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function h(u){return i||r||!s?n(u):t(u)}}function UB(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Kk,t,s)(l):l===null||ut(l)||Zs(l)?t(l):(e.consume(l),i)}function s(l){return l===41&&r++,e.consume(l),i}}function VB(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),s):c===93?(e.consume(c),i):c===60||c===null||ut(c)||Zs(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||ut(c)||Zs(c)?t(c):r(c)}function s(c){return Tn(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),r):Tn(c)?(e.consume(c),l):n(c)}}function qB(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Sn(s)?n(s):t(s)}}function Zk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ut(e)}function Gk(e){return!Tn(e)}function Jk(e){return!(e===47||ym(e))}function ym(e){return e===43||e===45||e===46||e===95||Sn(e)}function cv(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 KB={tokenize:t6,partial:!0};function YB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JB,continuation:{tokenize:QB},exit:e6}},text:{91:{name:"gfmFootnoteCall",tokenize:GB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:XB,resolveTo:ZB}}}}function XB(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const h=r.events[i][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const u=jr(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function ZB(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function GB(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return c;function c(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),h}function h(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(s>999||f===93&&!l||f===null||f===91||ut(f))return n(f);if(f===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return i.includes(jr(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ut(f)||(l=!0),s++,e.consume(f),f===92?p:u}function p(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function JB(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,c;return h;function h(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(x)}function p(x){if(l>999||x===93&&!c||x===null||x===91||ut(x))return n(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return s=jr(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return ut(x)||(c=!0),l++,e.consume(x),x===92?f:p}function f(x){return x===91||x===92||x===93?(e.consume(x),l++,p):p(x)}function v(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ze(e,_,"gfmFootnoteDefinitionWhitespace")):n(x)}function _(x){return t(x)}}function QB(e,t,n){return e.check($a,t,e.attempt(KB,t,n))}function e6(e){e.exit("gfmFootnoteDefinition")}function t6(e,t,n){const r=this;return Ze(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(s):n(s)}}function n6(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let u=h;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[h][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[h][1].end)},f={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[h][1].start)},v=[["enter",p,c],["enter",l[u][1],c],["exit",l[u][1],c],["enter",f,c]],_=c.parser.constructs.insideSpan.null;_&&sr(v,v.length,0,Vh(_,l.slice(u+1,h),c)),sr(v,v.length,0,[["exit",f,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",p,c]]),sr(l,u-1,h-u+3,v),h=u+v.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function s(l,c,h){const u=this.previous,p=this.events;let f=0;return v;function v(x){return u===126&&p[p.length-1][1].type!=="characterEscape"?h(x):(l.enter("strikethroughSequenceTemporary"),_(x))}function _(x){const S=Vo(u);if(x===126)return f>1?h(x):(l.consume(x),f++,_);if(f<2&&!n)return h(x);const k=l.exit("strikethroughSequenceTemporary"),C=Vo(x);return k._open=!C||C===2&&!!S,k._close=!S||S===2&&!!C,c(x)}}}class r6{constructor(){this.map=[]}add(t,n,r){i6(this,t,n,r)}consume(t){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function i6(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function s6(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function o6(){return{flow:{null:{name:"table",tokenize:l6,resolveAll:a6}}}}function l6(e,t,n){const r=this;let i=0,s=0,l;return c;function c(R){let U=r.events.length-1;for(;U>-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,Y=V==="tableHead"||V==="tableRow"?A:h;return Y===A&&r.parser.lazy[r.now().line]?n(R):Y(R)}function h(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(l=!0,s+=1),p(R)}function p(R){return R===null?n(R):je(R)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),_):n(R):Ye(R)?Ze(e,p,"whitespace")(R):(s+=1,l&&(l=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),f(R)))}function f(R){return R===null||R===124||ut(R)?(e.exit("data"),p(R)):(e.consume(R),R===92?v:f)}function v(R){return R===92||R===124?(e.consume(R),f):f(R)}function _(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),l=!1,Ye(R)?Ze(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):x(R))}function x(R){return R===45||R===58?k(R):R===124?(l=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),S):B(R)}function S(R){return Ye(R)?Ze(e,k,"whitespace")(R):k(R)}function k(R){return R===58?(s+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),C):R===45?(s+=1,C(R)):R===null||je(R)?M(R):B(R)}function C(R){return R===45?(e.enter("tableDelimiterFiller"),T(R)):B(R)}function T(R){return R===45?(e.consume(R),T):R===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(R))}function N(R){return Ye(R)?Ze(e,M,"whitespace")(R):M(R)}function M(R){return R===124?x(R):R===null||je(R)?!l||i!==s?B(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):B(R)}function B(R){return n(R)}function A(R){return e.enter("tableRow"),D(R)}function D(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),D):R===null||je(R)?(e.exit("tableRow"),t(R)):Ye(R)?Ze(e,D,"whitespace")(R):(e.enter("data"),$(R))}function $(R){return R===null||R===124||ut(R)?(e.exit("data"),D(R)):(e.consume(R),R===92?j:$)}function j(R){return R===92||R===124?(e.consume(R),$):$(R)}}function a6(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,u,p,f;const v=new r6;for(;++n<e.length;){const _=e[n],x=_[1];_[0]==="enter"?x.type==="tableHead"?(c=!1,h!==0&&(ww(v,t,h,u,p),p=void 0,h=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,f=void 0,s=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(n,0,[["enter",p,t]])),i=x.type==="tableDelimiterRow"?2:p?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],f=mu(v,t,s,i,void 0,f),s=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],f=mu(v,t,s,i,void 0,f)),s=l,l=[s[1],n,0,0])):x.type==="tableHead"?(c=!0,h=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(h=n,s[1]!==0?(l[0]=l[1],f=mu(v,t,s,i,n,f)):l[1]!==0&&(f=mu(v,t,l,i,n,f)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&ww(v,t,h,u,p),v.consume(t.events),n=-1;++n<t.events.length;){const _=t.events[n];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=s6(t.events,n))}return e}function mu(e,t,n,r,i,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(s.end=Object.assign({},Mo(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const h=Mo(t.events,n[1]);if(s={type:l,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Mo(t.events,n[2]),p=Mo(t.events,n[3]),f={type:c,start:Object.assign({},u),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const v=t.events[n[2]],_=t.events[n[3]];if(v[1].end=Object.assign({},_[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,S=n[3]-n[2]-1;e.add(x,S,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},Mo(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function ww(e,t,n,r,i){const s=[],l=Mo(t.events,n);i&&(i.end=Object.assign({},l),s.push(["exit",i,t])),r.end=Object.assign({},l),s.push(["exit",r,t]),e.add(n+1,0,s)}function Mo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const c6={name:"tasklistCheck",tokenize:h6};function u6(){return{text:{91:c6}}}function h6(e,t,n){const r=this;return i;function i(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),s)}function s(h){return ut(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(h)}function c(h){return je(h)?t(h):Ye(h)?e.check({tokenize:d6},t,n)(h):n(h)}}function d6(e,t,n){return Ze(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function f6(e){return ak([BB(),YB(),n6(e),o6(),u6()])}const p6={};function m6(e){const t=this,n=e||p6,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(f6(n)),s.push(LB()),l.push(OB(n))}function g6(e){Tk(e,[/\r?\n|\r/g,v6])}function v6(){return{type:"break"}}function _6(){return function(e){g6(e)}}function uv({src:e,alt:t,className:n,caption:r}){const[i,s]=b.useState(!1);return b.useEffect(()=>{if(!i)return;const l=c=>c.key==="Escape"&&s(!1);return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),g.jsxs(g.Fragment,{children:[g.jsx("img",{src:e,alt:t,loading:"lazy",decoding:"async",onClick:l=>{l.stopPropagation(),s(!0)},className:`${n??""} cursor-zoom-in`}),i&&Or.createPortal(g.jsx("div",{onClick:()=>s(!1),className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 p-6",children:g.jsxs("div",{className:"flex max-h-full max-w-full flex-col items-center gap-2",children:[g.jsx("img",{src:e,alt:t,className:"max-h-[85vh] max-w-full rounded"}),r&&g.jsx("div",{className:"font-mono text-xs text-ink-300",children:r})]})}),document.body)]})}const y6=[m6,_6];function Nt({node:e,...t}){return t}const x6={img:e=>{const{src:t,alt:n}=Nt(e);return g.jsx(uv,{src:t??"",alt:n,className:"my-2 max-h-80 max-w-full rounded"})},h1:e=>g.jsx("h1",{...Nt(e),className:"mb-1.5 mt-3 text-[17px] font-bold text-ink-100 first:mt-0"}),h2:e=>g.jsx("h2",{...Nt(e),className:"mb-1.5 mt-3 text-sm font-semibold text-ink-100 first:mt-0"}),h3:e=>g.jsx("h3",{...Nt(e),className:"mb-1 mt-2.5 text-sm font-semibold text-ink-200 first:mt-0"}),h4:e=>g.jsx("h4",{...Nt(e),className:"mb-1 mt-2 text-xs font-semibold uppercase tracking-wide text-ink-300 first:mt-0"}),h5:e=>g.jsx("h5",{...Nt(e),className:"mb-1 mt-2 text-xs font-semibold uppercase tracking-wide text-ink-300 first:mt-0"}),h6:e=>g.jsx("h6",{...Nt(e),className:"mb-1 mt-2 text-xs font-semibold uppercase tracking-wide text-ink-300 first:mt-0"}),p:e=>g.jsx("p",{...Nt(e),className:"my-2 leading-relaxed first:mt-0 last:mb-0"}),a:e=>g.jsx("a",{...Nt(e),target:"_blank",rel:"noreferrer noopener",className:"break-words font-medium text-indigo-300 underline decoration-indigo-300/40 underline-offset-2 hover:decoration-indigo-300"}),strong:e=>g.jsx("strong",{...Nt(e),className:"font-semibold text-ink-100"}),em:e=>g.jsx("em",{...Nt(e),className:"italic"}),ul:e=>g.jsx("ul",{...Nt(e),className:"my-2 list-disc space-y-1 pl-5 marker:text-ink-300 first:mt-0 last:mb-0"}),ol:e=>g.jsx("ol",{...Nt(e),className:"my-2 list-decimal space-y-1 pl-5 marker:text-ink-300 first:mt-0 last:mb-0"}),li:e=>g.jsx("li",{...Nt(e),className:"leading-relaxed [&>ol]:mt-1 [&>p]:my-0 [&>ul]:mt-1"}),blockquote:e=>g.jsx("blockquote",{...Nt(e),className:"my-2 border-l-2 border-ink-500 pl-3 italic text-ink-300"}),hr:e=>g.jsx("hr",{...Nt(e),className:"my-3 border-ink-600"}),pre:e=>g.jsx("pre",{...Nt(e),className:"my-2 overflow-x-auto rounded-md bg-ink-900 p-3 text-[13px] leading-snug [&>code]:bg-transparent [&>code]:p-0 [&>code]:text-ink-100"}),code:e=>g.jsx("code",{...Nt(e),className:"break-words rounded bg-ink-900 px-1 py-0.5 font-mono text-[13px] text-amber-200"}),table:e=>g.jsx("div",{className:"my-2 overflow-x-auto",children:g.jsx("table",{...Nt(e),className:"w-full border-collapse text-xs"})}),thead:e=>g.jsx("thead",{...Nt(e),className:"bg-ink-800"}),th:e=>g.jsx("th",{...Nt(e),className:"border border-ink-600 px-2 py-1 text-left font-semibold text-ink-200"}),td:e=>g.jsx("td",{...Nt(e),className:"border border-ink-600 px-2 py-1 align-top"})};function xm({text:e}){return g.jsx("div",{className:"text-sm leading-relaxed [overflow-wrap:anywhere]",children:g.jsx(rI,{remarkPlugins:y6,components:x6,children:e})})}const w6="modulepreload",S6=function(e){return"/"+e},Sw={},b6=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(p=>Promise.resolve(p).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),h=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(u=>{if(u=S6(u),u in Sw)return;Sw[u]=!0;const p=u.endsWith(".css"),f=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":w6,p||(v.as="script"),v.crossOrigin="",v.href=u,h&&v.setAttribute("nonce",h),document.head.appendChild(v),p)return new Promise((_,x)=>{v.addEventListener("load",_),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};let Sp=null;function k6(){return Sp||(Sp=b6(()=>import("./mermaid.core-890uePvN.js").then(e=>e.bm),[]).then(e=>(e.default.initialize({startOnLoad:!1,theme:"dark",securityLevel:"strict"}),e.default))),Sp}function Qk(e,t){return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:;"><style>html,body{margin:0;padding:12px;font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#111;box-sizing:border-box}*{box-sizing:border-box}${t??""}</style></head><body>${e}</body></html>`}function C6({title:e,html:t,css:n}){const[r,i]=b.useState(!1),s=Qk(t,n);return g.jsxs("div",{className:"overflow-hidden rounded-md border border-indigo-700 bg-indigo-950/30",children:[g.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[g.jsxs("div",{className:"text-xs font-medium text-indigo-300",children:[g.jsx("span",{className:"opacity-70",children:"mockup:"})," ",e]}),g.jsx("button",{onClick:()=>i(l=>!l),className:"rounded bg-ink-700 px-1.5 py-0.5 text-[11px] text-ink-300 hover:bg-ink-600",children:r?"Collapse":"Expand"})]}),g.jsx("iframe",{title:e,sandbox:"",srcDoc:s,className:"w-full resize-y border-0 bg-white",style:{height:r?600:320}})]})}function E6({id:e,title:t,source:n}){const[r,i]=b.useState(null),[s,l]=b.useState(null);return b.useEffect(()=>{let c=!1;return k6().then(h=>h.render(`mmd-${e}`,n)).then(({svg:h})=>{c||(i(h),l(null))}).catch(h=>{c||l(h instanceof Error?h.message:String(h))}),()=>{c=!0}},[e,n]),g.jsxs("div",{className:"overflow-hidden rounded-md border border-indigo-700 bg-indigo-950/30",children:[g.jsxs("div",{className:"px-2.5 py-1.5 text-xs font-medium text-indigo-300",children:[g.jsx("span",{className:"opacity-70",children:"diagram:"})," ",t??"Mermaid"]}),s?g.jsxs("div",{className:"px-2.5 pb-2.5 text-xs",children:[g.jsxs("div",{className:"mb-1 text-red-400",children:["Couldn’t render diagram: ",s]}),g.jsx("pre",{className:"overflow-auto rounded bg-ink-900 p-2 text-[12px] text-ink-300",children:n})]}):g.jsx("div",{className:"flex justify-center overflow-auto bg-white p-2 [&_svg]:max-w-full",dangerouslySetInnerHTML:r?{__html:r}:void 0})]})}function eC({dictation:e,positionClass:t="right-2 top-2"}){return e.supported?g.jsx("button",{type:"button",onMouseDown:n=>n.preventDefault(),onClick:()=>e.toggle(),"aria-label":e.recording?"Stop dictation":"Dictate",title:e.recording?e.inflight?"Processing…":"Recording — say your submit keyword to send":"Dictate (ElevenLabs)",className:`absolute z-10 flex items-center rounded bg-ink-700/80 px-1 py-1 ${t} ${e.recording?`text-red-400 ${e.inflight?"":"animate-pulse"}`:"text-ink-400 hover:text-ink-200"}`,children:e.recording?e.inflight?g.jsx(ka,{size:14,className:"animate-spin"}):g.jsx(l1,{size:14,fill:"currentColor"}):g.jsx(s1,{size:14})}):null}function tC({value:e,onChange:t,placeholder:n,autoFocus:r,onKeyDown:i,className:s=""}){const l=Fg(()=>e,t);return g.jsxs("div",{className:"relative flex-1",children:[g.jsx("input",{autoFocus:r,className:`w-full rounded bg-ink-700 px-2 py-1 text-xs outline-none ${l.supported?"pr-8":""} ${s}`,placeholder:n,value:e,onChange:c=>{l.recording&&l.inflight||t(c.target.value)},onKeyDown:c=>{if(c.key==="Escape"&&l.recording){c.preventDefault(),c.stopPropagation(),l.toggle();return}i==null||i(c)}}),g.jsx(eC,{dictation:l,positionClass:"right-1.5 top-1/2 -translate-y-1/2"}),l.error&&g.jsx("div",{className:"mt-1 text-xs text-red-400",children:l.error})]})}const N6={commit:{Icon:CA,accent:"text-emerald-300"},git:{Icon:bA,accent:"text-sky-300"},typecheck:{Icon:rA,accent:"text-sky-300"},test:{Icon:yA,accent:"text-amber-300"},install:{Icon:IA,accent:"text-fuchsia-300"},build:{Icon:NA,accent:"text-orange-300"},dev:{Icon:zA,accent:"text-emerald-300"},operator:{Icon:o1,accent:"text-indigo-300"}},nC=b.memo(function({e:t,taskId:n,projectId:r}){const i=ue(S=>{var k;return(k=S.agents[n])==null?void 0:k.resolved}),s=ue(S=>S.markResolved),l=ue(S=>S.suppressed[n]),c=ue(S=>S.suppressPrompt),h=ue(S=>S.openPreviewModal),u=$g(),[p,f]=b.useState(!1);async function v(S,k){if(!p){f(!0);try{await S(),s(n,k)}catch{f(!1)}}}const _=ue(S=>{var T,N;const k=(N=(T=S.board)==null?void 0:T.tasks.find(M=>M.id===n))==null?void 0:N.runs,C=k==null?void 0:k.filter(M=>(M.status==="running"||M.status==="starting")&&M.url);return C&&C.length?C[C.length-1].url:void 0}),x=ue(S=>{var C;const k=(C=S.board)==null?void 0:C.tasks.find(T=>T.id===n);return(k==null?void 0:k.title)||(k==null?void 0:k.shortDescription)||"Preview"});switch(t.type){case"user_message":return g.jsx("div",{className:"flex justify-end",children:g.jsx("div",{className:"min-w-0 max-w-[92%] overflow-hidden rounded bg-indigo-600/30 p-2.5 text-ink-100",children:g.jsx(xm,{text:t.text})})});case"assistant_text":return g.jsx("div",{className:"overflow-hidden px-0.5 text-ink-100",children:g.jsx(xm,{text:t.text})});case"thinking":return g.jsxs("details",{className:"rounded bg-ink-800/60 p-2 text-xs text-ink-300",children:[g.jsx("summary",{className:"cursor-pointer",children:"thinking"}),g.jsx("div",{className:"whitespace-pre-wrap",children:t.text})]});case"tool_use":{const S=rR(t);if(S.length>0){const k=S.map(C=>C.detail).filter(Boolean);return g.jsxs("div",{className:"overflow-hidden rounded border border-ink-600 bg-ink-800 px-2 py-1 text-xs [overflow-wrap:anywhere]",children:[g.jsx("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5",children:S.map((C,T)=>{const{Icon:N,accent:M}=N6[C.kind];return g.jsxs("span",{className:"flex items-center gap-1",children:[T>0&&g.jsx("span",{className:"text-ink-600",children:"·"}),g.jsx(N,{size:13,className:`shrink-0 ${M}`}),g.jsx("span",{className:`font-medium ${M}`,children:C.label})]},T)})}),k.length>0&&g.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-ink-300",children:k.join(`
305
+ `)})]})}return g.jsxs("details",{className:"overflow-hidden rounded border border-ink-600 bg-ink-800 px-2 py-1 text-xs [overflow-wrap:anywhere]",children:[g.jsxs("summary",{className:"cursor-pointer",children:[g.jsx("span",{className:"font-mono text-amber-300",children:t.name})," ",g.jsx("span",{className:"text-ink-400",children:ZN(t.name,t.input)})]}),g.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-ink-300",children:Vp(t.input,2e3)})]})}case"tool_result":return g.jsxs("div",{className:`overflow-hidden pl-2 text-xs [overflow-wrap:anywhere] ${t.isError?"text-red-400":"text-ink-300"}`,children:["↳ ",t.summary&&XN(t.summary)||(t.isError?"error":"ok"),t.images&&t.images.length>0&&g.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:t.images.map(S=>g.jsx(uv,{src:er.asset(r,S.file),alt:"tool output image",className:"max-h-80 max-w-full rounded border border-ink-600"},S.file))})]});case"clarification":return Ql(t,i)?null:g.jsxs(gu,{title:"Clarification needed",children:[g.jsx("div",{className:"mb-2",children:t.question}),g.jsx(R6,{options:t.options,busy:p,onSubmit:S=>v(()=>ke.answerClarification(r,n,t.id,S),t.id)})]});case"ask_user_question":return Ql(t,i)?null:g.jsx(gu,{title:t.questions.length>1?"The agent has questions":"The agent has a question",children:g.jsx(T6,{questions:t.questions,onSubmit:async S=>{await ke.answerAskQuestion(r,n,t.id,S),s(n,t.id)},onCancel:async()=>{await ke.answerAskQuestion(r,n,t.id,null),s(n,t.id)}})});case"advance_proposal":return Ql(t,i)||l!=null&&l.has(t.id)?null:g.jsxs(gu,{title:`Agent proposes → ${t.toLane}`,children:[t.rationale&&g.jsx("div",{className:"mb-2 text-ink-300",children:t.rationale}),_&&g.jsxs("div",{className:"mb-2 inline-flex min-w-16 items-stretch overflow-hidden rounded bg-indigo-900/50 text-xs text-indigo-200",children:[g.jsx("a",{href:_,target:"_blank",rel:"noreferrer",title:"Open in new tab",className:"px-3 py-1 hover:bg-indigo-800/60",children:"↗"}),g.jsx("span",{className:"w-px bg-indigo-800/60"}),g.jsx("button",{title:_,onClick:()=>u?window.open(_,"_blank","noreferrer"):h(_,x,n),className:"px-3 py-1 hover:bg-indigo-800/60",children:_.replace(/^https?:\/\/(?:localhost|127\.0\.0\.1)/,"").replace(/\/.*$/,"")})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{className:"rounded bg-emerald-600 px-3 py-1 text-xs disabled:opacity-40",disabled:p,onClick:()=>void v(()=>ke.decideAdvance(r,n,t.id,!0,t.toLane),t.id),children:"Accept & move"}),g.jsx("button",{className:"rounded bg-ink-600 px-3 py-1 text-xs disabled:opacity-40",disabled:p,onClick:()=>{c(n,t.id)},children:"Give feedback"})]})]});case"permission_request":return Ql(t,i)?null:g.jsxs(gu,{title:`Allow ${t.toolName}?`,children:[g.jsx("pre",{className:"mb-2 max-h-32 overflow-y-auto whitespace-pre-wrap rounded bg-ink-900 p-2 text-[12px] [overflow-wrap:anywhere]",children:Vp(t.input,600)}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{className:"rounded bg-emerald-600 px-3 py-1 text-xs disabled:opacity-40",disabled:p,onClick:()=>void v(()=>ke.resolvePermission(r,n,t.id,"allow"),t.id),children:"Allow"}),g.jsx("button",{className:"rounded bg-red-700 px-3 py-1 text-xs disabled:opacity-40",disabled:p,onClick:()=>void v(()=>ke.resolvePermission(r,n,t.id,"deny"),t.id),children:"Deny"})]})]});case"artifact":return g.jsxs("div",{className:"overflow-hidden rounded border border-indigo-700 bg-indigo-950/40 p-2 text-xs [overflow-wrap:anywhere]",children:[g.jsxs("div",{className:"font-medium text-indigo-300",children:[t.kind,": ",t.title]}),t.path&&g.jsx("div",{className:"font-mono text-ink-400",children:t.path})]});case"mockup":return g.jsx(C6,{title:t.title,html:t.html,css:t.css});case"diagram":return g.jsx(E6,{id:t.id,title:t.title,source:t.source});case"rewound":return g.jsxs("div",{className:"my-1 flex items-center gap-2 text-[11px] text-amber-400/80",children:[g.jsx("div",{className:"h-px flex-1 bg-amber-500/25"}),g.jsxs("span",{className:"shrink-0",children:["↩ rewound",t.preview?` to “${t.preview.slice(0,60)}”`:""]}),g.jsx("div",{className:"h-px flex-1 bg-amber-500/25"})]});case"result":return g.jsx("div",{className:"border-t border-ink-700 pt-1 text-[12px] text-ink-500",children:t.isError?"Stopped":"Turn complete"});case"error":return g.jsxs("div",{className:"overflow-hidden rounded border border-red-600/60 bg-red-950/20 px-2 py-1 text-xs text-red-300 [overflow-wrap:anywhere]",children:["⚠️ ",t.message||"Agent error (no details provided)."]});case"throttled":return g.jsxs("div",{className:"rounded border border-orange-600/60 bg-orange-950/20 px-2 py-1 text-[12px] text-orange-300",children:["⏳ ",t.resetsAt?"Usage limit reached":"Rate-limited",t.attempt>1?` (attempt ${t.attempt})`:"",t.limitType?` [${t.limitType.replace(/_/g," ")}]`:""," —"," ",t.resetsAt?`auto-resumes at ${new Date(t.resetsAt).toLocaleString()}.`:"waiting for a coordinated retry."]});default:return null}});function gu({title:e,children:t}){return g.jsxs("div",{className:"rounded-md border border-amber-600/60 bg-amber-950/20 p-2.5",children:[g.jsx("div",{className:"mb-1 text-xs font-semibold text-amber-300",children:e}),t]})}function R6({options:e,onSubmit:t,busy:n}){const[r,i]=b.useState(""),s=l=>{!n&&l.trim()&&t(l)};return g.jsxs("div",{className:"space-y-2",children:[e&&e.length>0&&g.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(l=>g.jsx("button",{disabled:n,onClick:()=>s(l),className:"rounded bg-ink-600 px-2 py-1 text-xs hover:bg-indigo-600 disabled:opacity-40",children:l},l))}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(tC,{placeholder:"Type an answer…",value:r,onChange:i,onKeyDown:l=>l.key==="Enter"&&s(r)}),g.jsx("button",{disabled:n,onClick:()=>s(r),className:"rounded bg-indigo-600 px-2 py-1 text-xs disabled:opacity-40",children:"Send"})]})]})}const vu="__other__";function T6({questions:e,onSubmit:t,onCancel:n}){const[r,i]=b.useState({}),[s,l]=b.useState({}),[c,h]=b.useState(!1);function u(_){return(r[_]??[]).map(k=>{var C;return k===vu?((C=s[_])==null?void 0:C.trim())??"":k}).filter(Boolean).join(", ")}const p=e.every((_,x)=>u(x).length>0);function f(_,x,S){i(k=>{const C=k[x]??[];return _.multiSelect?{...k,[x]:C.includes(S)?C.filter(T=>T!==S):[...C,S]}:{...k,[x]:C[0]===S?[]:[S]}})}async function v(){if(!p||c)return;h(!0);const _={};e.forEach((x,S)=>_[x.question]=u(S));try{await t(_)}catch{h(!1)}}return g.jsxs("div",{className:"space-y-3",children:[e.map((_,x)=>{const S=r[x]??[];return g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex items-baseline gap-2",children:[_.header&&g.jsx("span",{className:"rounded bg-ink-700 px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-ink-300",children:_.header}),g.jsx("span",{className:"text-xs font-medium",children:_.question})]}),g.jsxs("div",{className:"flex flex-col gap-1",children:[_.options.map(k=>{const C=S.includes(k.label);return g.jsxs("button",{onClick:()=>f(_,x,k.label),className:`rounded border px-2 py-1 text-left text-xs ${C?"border-indigo-500 bg-indigo-600/30":"border-ink-600 bg-ink-700 hover:border-indigo-600"}`,children:[g.jsx("span",{className:"font-medium",children:k.label}),k.description&&g.jsxs("span",{className:"ml-1.5 text-ink-400",children:["— ",k.description]})]},k.label)}),g.jsx("button",{onClick:()=>f(_,x,vu),className:`rounded border px-2 py-1 text-left text-xs ${S.includes(vu)?"border-indigo-500 bg-indigo-600/30":"border-ink-600 bg-ink-700 hover:border-indigo-600"}`,children:g.jsx("span",{className:"font-medium",children:"Other…"})}),S.includes(vu)&&g.jsx(tC,{autoFocus:!0,placeholder:"Type your answer…",value:s[x]??"",onChange:k=>l(C=>({...C,[x]:k}))})]})]},x)}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{disabled:!p||c,onClick:v,className:"rounded bg-indigo-600 px-3 py-1 text-xs disabled:opacity-40",children:"Submit"}),g.jsx("button",{disabled:c,onClick:n,className:"rounded bg-ink-600 px-3 py-1 text-xs disabled:opacity-40",children:"Cancel"})]})]})}function P6(e){const t=e.events[0];return t&&(t.type==="tool_use"||t.type==="tool_result")?t.id:void 0}function D6({item:e,allExpanded:t,overrides:n,taskId:r,projectId:i}){const s=P6(e),[l,c]=b.useState(()=>(s!==void 0?n.get(s):void 0)??t),h=ue(v=>{var _;return(_=v.project)==null?void 0:_.path}),u=b.useRef(!1);b.useEffect(()=>{if(!u.current){u.current=!0;return}c(t)},[t]);const p=v=>{s!==void 0&&n.set(s,v),c(v)},f=e.events.flatMap(v=>v.type==="tool_result"&&v.images?v.images:[]);return l?g.jsxs("div",{className:"space-y-1",children:[g.jsxs("button",{onClick:()=>p(!1),className:"w-full text-left text-xs text-ink-300 hover:text-ink-200",children:["▾ ",ky(e,h)]}),e.events.map((v,_)=>g.jsx(nC,{e:v,taskId:r,projectId:i},_))]}):g.jsxs("div",{className:"space-y-1",children:[g.jsxs("button",{onClick:()=>p(!0),title:"Expand tool calls (or press Ctrl+O)",className:"w-full rounded border border-ink-600 bg-ink-800 px-2 py-1 text-left text-xs text-ink-300 hover:text-ink-200",children:["▸ ",ky(e,h)]}),f.length>0&&g.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(v=>g.jsx(uv,{src:er.asset(i,v.file),alt:"tool output image",className:"max-h-80 max-w-full rounded border border-ink-600"},v.file))})]})}function A6({windowItems:e,windowStart:t,toolsExpanded:n,toolOpenOverrides:r,taskId:i,projectId:s,todos:l,working:c,pending:h,onPendingRemove:u,scrollRef:p,onScroll:f,onContentLoad:v}){return g.jsx("div",{ref:p,onScroll:f,onLoadCapture:v,className:"h-full overflow-y-auto overflow-x-hidden overscroll-contain text-sm",children:g.jsxs("div",{className:"flex min-h-full flex-col justify-end",children:[e.map((_,x)=>g.jsx("div",{className:"px-3 py-1",children:_.kind==="toolGroup"?g.jsx(D6,{item:_,allExpanded:n,overrides:r,taskId:i,projectId:s}):g.jsx(nC,{e:_.event,taskId:i,projectId:s})},t+x)),g.jsx(M6,{items:l,working:c}),h.map((_,x)=>g.jsx("div",{className:"px-3 py-1",children:g.jsx("div",{className:"flex justify-end",children:g.jsxs("div",{className:"min-w-0 max-w-[92%] rounded p-2.5 text-ink-300 ring-1 ring-inset ring-indigo-500/30 [overflow-wrap:anywhere]",children:[g.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[10px] uppercase tracking-wide text-indigo-300/70",children:[g.jsx("span",{children:"queued"}),g.jsx("button",{onClick:()=>u(x,_),"aria-label":"Move queued message back to the composer",title:"Back to composer",className:"ml-auto rounded px-1 leading-none text-ink-400 hover:text-ink-100",children:"×"})]}),g.jsx("div",{className:"whitespace-pre-wrap",children:_})]})})},`pending-${x}`))]})})}function M6({items:e,working:t}){return g.jsxs("div",{className:"space-y-2 px-3 py-1 pb-3",children:[e&&g.jsx(O6,{items:e}),t&&g.jsx(L6,{})]})}function L6(){return g.jsxs("div",{role:"status",className:"flex items-center gap-2 text-xs text-ink-400",children:[g.jsxs("span",{"aria-hidden":!0,className:"flex gap-1",children:[g.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ink-400 [animation-delay:-0.3s]"}),g.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ink-400 [animation-delay:-0.15s]"}),g.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ink-400"})]}),"thinking…"]})}function O6({items:e}){return g.jsxs("div",{className:"rounded border border-ink-600 bg-ink-800 p-2 text-xs",children:[g.jsx("div",{className:"mb-1 font-semibold text-ink-300",children:"Plan"}),e.map((t,n)=>g.jsxs("div",{className:"flex gap-1.5",children:[g.jsx("span",{children:t.status==="completed"?"✓":t.status==="in_progress"?"▸":"○"}),g.jsx("span",{className:t.status==="completed"?"text-ink-400 line-through":"",children:t.content})]},n))]})}function j6(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="todos")return n.items}return null}function hv(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function I6(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function _u(e){return e!==null&&e>=0}function B6(e,t){if(e===t)return!0;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 z6(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const yu={scaleX:1,scaleY:1},F6=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:s,index:l}=e;const c=(t=n[i])!=null?t:r;if(!c)return null;const h=$6(n,l,i);if(l===i){const u=n[s];return u?{x:i<s?u.left+u.width-(c.left+c.width):u.left-c.left,y:0,...yu}:null}return l>i&&l<=s?{x:-c.width-h,y:0,...yu}:l<i&&l>=s?{x:c.width+h,y:0,...yu}:{x:0,y:0,...yu}};function $6(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return!r||!i&&!s?0:n<t?i?r.left-(i.left+i.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(i.left+i.width)}const dv=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=hv(t,r,n),l=t[i],c=s[i];return!c||!l?null:{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}},rC="Sortable",iC=ot.createContext({activeIndex:-1,containerId:rC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:dv,disabled:{draggable:!1,droppable:!1}});function sC(e){let{children:t,id:n,items:r,strategy:i=dv,disabled:s=!1}=e;const{active:l,dragOverlay:c,droppableRects:h,over:u,measureDroppableContainers:p}=D1(),f=Ba(rC,n),v=c.rect!==null,_=b.useMemo(()=>r.map(A=>typeof A=="object"&&"id"in A?A.id:A),[r]),x=l!=null,S=l?_.indexOf(l.id):-1,k=u?_.indexOf(u.id):-1,C=b.useRef(_),T=!B6(_,C.current),N=k!==-1&&S===-1||T,M=z6(s);zr(()=>{T&&x&&p(_)},[T,_,x,p]),b.useEffect(()=>{C.current=_},[_]);const B=b.useMemo(()=>({activeIndex:S,containerId:f,disabled:M,disableTransforms:N,items:_,overIndex:k,useDragOverlay:v,sortedRects:I6(_,h),strategy:i}),[S,f,M.draggable,M.droppable,N,_,k,h,v,i]);return ot.createElement(iC.Provider,{value:B},t)}const H6=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return hv(n,r,i).indexOf(t)},W6=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:l,previousItems:c,previousContainerId:h,transition:u}=e;return!u||!r||c!==s&&i===l?!1:n?!0:l!==i&&t===h},U6={duration:200,easing:"ease"},oC="transform",V6=Ai.Transition.toString({property:oC,duration:0,easing:"linear"}),q6={roleDescription:"sortable"};function K6(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,l]=b.useState(null),c=b.useRef(n);return zr(()=>{if(!t&&n!==c.current&&r.current){const h=i.current;if(h){const u=Go(r.current,{ignoreTransform:!0}),p={x:h.left-u.left,y:h.top-u.top,scaleX:h.width/u.width,scaleY:h.height/u.height};(p.x||p.y)&&l(p)}}n!==c.current&&(c.current=n)},[t,n,r,i]),b.useEffect(()=>{s&&l(null)},[s]),s}function lC(e){let{animateLayoutChanges:t=W6,attributes:n,disabled:r,data:i,getNewIndex:s=H6,id:l,strategy:c,resizeObserverConfig:h,transition:u=U6}=e;const{items:p,containerId:f,activeIndex:v,disabled:_,disableTransforms:x,sortedRects:S,overIndex:k,useDragOverlay:C,strategy:T}=b.useContext(iC),N=Y6(r,_),M=p.indexOf(l),B=b.useMemo(()=>({sortable:{containerId:f,index:M,items:p},...i}),[f,i,M,p]),A=b.useMemo(()=>p.slice(p.indexOf(l)),[p,l]),{rect:D,node:$,isOver:j,setNodeRef:R}=Hh({id:l,data:B,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...h}}),{active:U,activatorEvent:V,activeNodeRect:Y,attributes:W,setNodeRef:q,listeners:z,isDragging:J,over:I,setActivatorNodeRef:re,transform:P}=P1({id:l,data:B,attributes:{...q6,...n},disabled:N.draggable}),H=JA(R,q),Q=!!U,L=Q&&!x&&_u(v)&&_u(k),Z=!C&&J,oe=Z&&L?P:null,_e=L?oe??(c??T)({rects:S,activeNodeRect:Y,activeIndex:v,overIndex:k,index:M}):null,ye=_u(v)&&_u(k)?s({id:l,items:p,activeIndex:v,overIndex:k}):M,Ce=U==null?void 0:U.id,ge=b.useRef({activeId:Ce,items:p,newIndex:ye,containerId:f}),at=p!==ge.current.items,nt=t({active:U,containerId:f,isDragging:J,isSorting:Q,id:l,index:M,items:p,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:u,wasDragging:ge.current.activeId!=null}),Ie=K6({disabled:!nt,index:M,node:$,rect:D});return b.useEffect(()=>{Q&&ge.current.newIndex!==ye&&(ge.current.newIndex=ye),f!==ge.current.containerId&&(ge.current.containerId=f),p!==ge.current.items&&(ge.current.items=p)},[Q,ye,f,p]),b.useEffect(()=>{if(Ce===ge.current.activeId)return;if(Ce!=null&&ge.current.activeId==null){ge.current.activeId=Ce;return}const Lt=setTimeout(()=>{ge.current.activeId=Ce},50);return()=>clearTimeout(Lt)},[Ce]),{active:U,activeIndex:v,attributes:W,data:B,rect:D,index:M,newIndex:ye,items:p,isOver:j,isSorting:Q,isDragging:J,listeners:z,node:$,overIndex:k,over:I,setNodeRef:H,setActivatorNodeRef:re,setDroppableNodeRef:R,setDraggableNodeRef:q,transform:Ie??_e,transition:rt()};function rt(){if(Ie||at&&ge.current.newIndex===M)return V6;if(!(Z&&!Bh(V)||!u)&&(Q||nt))return Ai.Transition.toString({...u,property:oC})}}function Y6(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}tt.Down,tt.Right,tt.Up,tt.Left;const X6=e=>{let{transform:t}=e;return{...t,y:0}};function Z6(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const aC=e=>{let{containerNodeRect:t,draggingNodeRect:n,transform:r}=e;return!n||!t?r:Z6(r,n,t)};function G6({commands:e,activeIndex:t,onPick:n,onHover:r}){const i=b.useRef(null);return b.useEffect(()=>{var s;(s=i.current)==null||s.scrollIntoView({block:"nearest"})},[t]),g.jsx("div",{className:"absolute bottom-full left-0 right-0 z-10 mb-1 max-h-60 overflow-y-auto rounded-md border border-ink-600 bg-ink-800 py-1 shadow-lg",children:e.map((s,l)=>g.jsxs("button",{ref:l===t?i:void 0,onMouseDown:c=>{c.preventDefault(),n(s)},onMouseEnter:()=>r(l),className:`flex w-full items-baseline gap-2 px-2.5 py-1 text-left text-xs ${l===t?"bg-indigo-600/30":"hover:bg-ink-700"}`,children:[g.jsxs("span",{className:"font-mono text-amber-300",children:["/",s.name]}),s.argumentHint&&g.jsx("span",{className:"font-mono text-ink-500",children:s.argumentHint}),s.description&&g.jsx("span",{className:"truncate text-ink-400",children:s.description})]},s.name))})}function J6({draft:e,onDraftChange:t,onSubmit:n,inputRef:r,backdropRef:i,allowFork:s,menu:l,dictation:c,queue:h,previewIndex:u,onChipClick:p,onChipRemove:f,onChipDragEnd:v,rewind:_,onRewindPick:x,onRewindClose:S,running:k,stoppable:C,onInterrupt:T,auto:N,autoRemaining:M,onToggleAuto:B}){const A=Dg(Uo(Og,{activationConstraint:{distance:5}}),Uo(zh,{activationConstraint:{delay:200,tolerance:8}}));return g.jsxs("div",{className:"relative border-t border-ink-600 p-2 pb-safe md:pb-2",children:[l.open&&g.jsx("div",{className:"absolute bottom-full left-2 right-2",children:g.jsx(G6,{commands:l.matches,activeIndex:l.index,onPick:l.onAccept,onHover:l.onIndexChange})}),h.length>0&&g.jsx(Bg,{sensors:A,collisionDetection:f1,modifiers:[aC],onDragEnd:v,children:g.jsx(sC,{items:h,strategy:dv,children:g.jsx("div",{className:"mb-1.5 grid gap-1",style:{gridTemplateColumns:"repeat(auto-fit, minmax(12rem, 1fr))"},children:h.map((D,$)=>g.jsx(Q6,{item:D,index:$,active:u===$,onClick:p,onRemove:f},D))})})}),_?g.jsx(ez,{checkpoints:_,onPick:x,onClose:S}):g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("div",{className:"relative min-h-[3.5rem] flex-1 rounded bg-ink-700",children:[g.jsx(eC,{dictation:c,positionClass:"right-3 top-2"}),g.jsx("div",{ref:i,"aria-hidden":!0,className:"pointer-events-none absolute inset-0 max-h-[50vh] overflow-hidden whitespace-pre-wrap break-words p-2 text-sm text-ink-100",children:tz(e,s)}),g.jsx("textarea",{ref:r,rows:1,className:"new-task-input relative block max-h-[50vh] min-h-[3.5rem] w-full resize-none overflow-y-auto bg-transparent p-2 text-sm text-transparent caret-ink-100 outline-none",placeholder:"Message… (Enter to send, Shift+Enter for newline, Ctrl+O for detail, / for commands)",value:e,onChange:D=>{c.recording&&c.inflight||t(D.target.value)},onScroll:D=>{i.current&&(i.current.scrollTop=D.currentTarget.scrollTop)},onKeyDown:D=>{if(l.open){if(D.key==="ArrowDown"){D.preventDefault(),l.onIndexChange((l.index+1)%l.matches.length);return}if(D.key==="ArrowUp"){D.preventDefault(),l.onIndexChange((l.index-1+l.matches.length)%l.matches.length);return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),l.onAccept(l.matches[l.index]);return}if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),l.onDismiss();return}}if(D.key==="Escape"&&c.recording){D.preventDefault(),D.stopPropagation(),c.toggle();return}D.key==="Enter"&&!D.shiftKey&&!D.nativeEvent.isComposing&&(D.preventDefault(),n())}})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("button",{onClick:n,className:"rounded bg-indigo-600 px-3 text-sm hover:bg-indigo-500",children:"Send"}),C&&g.jsx("button",{onClick:T,title:k?"Interrupt the agent (or press Esc)":"Cancel the queued retry (or press Esc)",className:"rounded bg-red-700 px-3 text-sm text-white hover:bg-red-600",children:"Stop"}),h.length>0&&g.jsxs("button",{onClick:B,"aria-pressed":N,title:N?"Auto-continue on — fires the next queued “also” item ~7s after the agent goes idle. Click to turn off.":"Auto-continue — fire queued “also” items automatically after the agent goes idle",className:`relative flex items-center justify-center gap-1 overflow-hidden rounded px-3 text-sm ${N?"bg-indigo-600/30 text-indigo-200 ring-1 ring-inset ring-indigo-500/50":"bg-ink-700 text-ink-300 hover:bg-ink-600"}`,children:[M!=null&&g.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 bg-indigo-500/40 transition-[width] duration-100 ease-linear",style:{width:`${M/Kp*100}%`}}),g.jsx(o1,{size:14,className:"relative shrink-0"}),g.jsx("span",{className:"relative tabular-nums",children:M!=null?`${Math.ceil(M/1e3)}s`:"Auto"})]})]})]}),c.error&&!_&&g.jsx("div",{className:"mt-1 text-xs text-red-400",children:c.error})]})}function Q6({item:e,index:t,active:n,onClick:r,onRemove:i}){const{attributes:s,listeners:l,setNodeRef:c,transform:h,transition:u,isDragging:p}=lC({id:e});return g.jsxs("span",{ref:c,style:{transform:Ai.Transform.toString(h),transition:u,opacity:p?.5:1},...s,...l,className:`group flex min-w-0 touch-none items-center gap-1 rounded-full py-0.5 pl-2 pr-1 text-xs transition-colors ${n?"bg-indigo-600 text-white":"bg-ink-700 text-ink-200 hover:bg-ink-600"}`,title:`${e}
306
+
307
+ Click to preview · ${navigator.platform.startsWith("Mac")?"⌘":"Ctrl"}+click to send · drag to reorder`,children:[g.jsx("button",{type:"button",onClick:f=>r(t,f),className:"min-w-0 flex-1 truncate text-left",children:e}),g.jsx("button",{type:"button",onClick:()=>i(t),"aria-label":"Move queued message back to the composer",className:"shrink-0 rounded-full px-1 leading-none text-ink-400 hover:text-ink-100",children:"×"})]})}function ez({checkpoints:e,onPick:t,onClose:n}){const[r,i]=b.useState(e.length-1),s=b.useRef(null);return b.useEffect(()=>{function l(c){c.key==="Escape"?(c.preventDefault(),n()):c.key==="ArrowUp"?(c.preventDefault(),i(h=>Math.max(0,h-1))):c.key==="ArrowDown"?(c.preventDefault(),i(h=>Math.min(e.length-1,h+1))):c.key==="Enter"&&(c.preventDefault(),t(e[r],r))}return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[r,e,t,n]),b.useEffect(()=>{var l,c;(c=(l=s.current)==null?void 0:l.querySelector(`[data-i="${r}"]`))==null||c.scrollIntoView({block:"nearest"})},[r]),g.jsxs("div",{className:"rounded bg-ink-700",children:[g.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[11px] text-ink-400",children:[g.jsx("span",{children:"Rewind to a previous message — restores files + conversation (↑/↓, Enter)"}),g.jsx("button",{onClick:n,className:"ml-auto rounded px-1 hover:text-ink-100","aria-label":"Close",children:"Esc ✕"})]}),g.jsx("div",{ref:s,className:"max-h-48 overflow-y-auto px-1 pb-1",children:e.map((l,c)=>g.jsxs("button",{"data-i":c,onClick:()=>t(l,c),onMouseEnter:()=>i(c),className:`flex w-full items-start gap-2 rounded px-2 py-1.5 text-left text-sm [overflow-wrap:anywhere] ${c===r?"bg-indigo-600 text-white":"text-ink-200 hover:bg-ink-600"}`,children:[g.jsx("span",{className:"mt-0.5 w-3 shrink-0 text-center",children:c===r?"✓":""}),g.jsx("span",{className:"line-clamp-2",children:l.text})]},l.uuid))})]})}function tz(e,t){const n=/^(\s*)(also)\b([\s\S]*)$/i.exec(e);if(n){const[,r,i,s]=n;return g.jsxs(g.Fragment,{children:[r,g.jsx("span",{className:"bg-gradient-to-r from-fuchsia-400 via-amber-300 to-cyan-400 bg-clip-text font-semibold text-transparent",children:i}),s]})}if(t){const r=/^(\s*)(fork)\b([\s\S]*)$/i.exec(e);if(r){const[,i,s,l]=r;return g.jsxs(g.Fragment,{children:[i,g.jsx("span",{className:"bg-[linear-gradient(to_right,#f87171,#fbbf24,#34d399,#60a5fa,#a78bfa)] bg-clip-text font-semibold text-transparent",children:s}),l]})}}return e}function _h({taskId:e,projectId:t,onSend:n,onFork:r,emptyHint:i}){const s=ue(se=>se.agents[e]),l=(s==null?void 0:s.events)??[],c=(s==null?void 0:s.status)==="running",h=b.useMemo(()=>WS(l,s==null?void 0:s.resolved)!==null,[l,s==null?void 0:s.resolved]),u=HO({projectId:t,streamKey:e,running:!!c,promptParked:h,onSend:n,onFork:r}),{draft:p,queue:f,pending:v}=u,[_,x]=b.useState(()=>new Set),[S,k]=b.useState(!1),[C,T]=b.useState(null);function N(){k(se=>{const ve=!se;return UO(e,ve),ve||T(null),ve})}b.useEffect(()=>{x(new Set),oe(Ax),k(WO(e)),T(null)},[e,t]);const M=(s==null?void 0:s.commands)??[],[B,A]=b.useState(0),[D,$]=b.useState(!1),[j,R]=b.useState(!1),[U,V]=b.useState(!1),Y=b.useRef(new Map);function W(se){u.edit(se),$(!1)}const q=Fg(()=>p,W,se=>void u.submitText(se),`${t}::${e}`),z=b.useRef(q);z.current=q;const J=b.useMemo(()=>OR(p,M),[p,M]),I=J.length>0&&!D;b.useEffect(()=>{A(se=>se>=J.length?0:se)},[J.length]);function re(se){var ve;W(`/${se.name} `),(ve=kn.current)==null||ve.focus()}const P=b.useMemo(()=>j6(l),[l]),H=h,Q=(s==null?void 0:s.status)==="running"&&!H,L=b.useMemo(()=>lR(uR(l,_)),[l,_]),[Z,oe]=b.useState(Ax),{start:te,hasEarlier:_e}=OO(L.length,Z),ye=b.useMemo(()=>L.slice(te),[L,te]);b.useEffect(()=>{function se(ve){!(ve.ctrlKey||ve.metaKey)||ve.key!=="o"&&ve.key!=="O"||(ve.preventDefault(),ve.shiftKey?R(!0):(Y.current.clear(),V(Ue=>!Ue)))}return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[]);const Ce=b.useRef(null),ge=b.useRef(!0),[at,nt]=b.useState(!0),Ie=b.useRef(!1),rt=b.useRef(null),Lt=()=>{const se=Ce.current;se&&(se.scrollTop=se.scrollHeight)},cn=()=>{const se=Ce.current;!se||!_e||Ie.current||(Ie.current=!0,rt.current=BO(se.scrollHeight,se.scrollTop),oe(ve=>jO(L.length,ve)))};function Un(){const se=Ce.current;if(!se)return;const ve=se.scrollHeight-se.scrollTop-se.clientHeight<64;ge.current=ve,ve!==at&&nt(ve),IO(se.scrollTop)&&cn()}const kn=b.useRef(null),un=b.useRef(null);b.useLayoutEffect(()=>{const se=kn.current;se&&(se.style.height="auto",se.style.height=`${se.scrollHeight}px`,un.current&&(un.current.scrollTop=se.scrollTop))},[p]);const vt=l.length>0;b.useLayoutEffect(()=>{Lt(),ge.current=!0,nt(!0),Y.current.clear()},[e]),b.useLayoutEffect(()=>{if(Ie.current){Ie.current=!1;const se=Ce.current;se&&rt.current!=null&&(se.scrollTop=zO(se.scrollHeight,rt.current)),rt.current=null;return}ge.current&&Lt()},[ye,Q,P,v]);const hn=c||(s==null?void 0:s.status)==="throttled";b.useEffect(()=>{!c&&v.length>0&&u.flushPending()},[c,v.length]);function or(){const se=MR({stoppable:hn,pendingCount:v.length,draft:p,lastUserTurn:PR(l)});if(!se)return!1;const ve=ke.interrupt(t,e).catch(()=>{});if(se.flush&&ve.then(()=>u.flushPending()),se.restore!==void 0){W(se.restore);const Ue=Cy(l,se.hideFromIndex);x(dt=>new Set([...dt,...Ue]))}return!0}const[Sr,br]=b.useState(null);async function Bi(){var se;try{const ve=await ke.listCheckpoints(t,e);(se=ve.checkpoints)!=null&&se.length&&br(ve.checkpoints)}catch{}}function ne(se,ve){br(null),ke.rewind(t,e,se.uuid,se.text.slice(0,120),ve).catch(()=>{});const Ue=ve+2;let dt=0,Kt=-1;for(let rn=0;rn<l.length;rn++)if(l[rn].type==="user_message"&&++dt===Ue){Kt=rn;break}if(Kt>=0){const rn=Cy(l,Kt+1);x(Vn=>new Set([...Vn,...rn]))}}const he=b.useRef(0);b.useEffect(()=>{function se(ve){if(ve.key!=="Escape")return;const Ue=Date.now(),dt=AR({sinceLastEscMs:Ue-he.current,rewindOpen:!!Sr,running:c});if(dt!=="ignored"){if(z.current.recording){ve.preventDefault(),z.current.toggle();return}he.current=Ue,dt==="rewind"?(ve.preventDefault(),Bi()):dt==="interrupt"&&(ve.preventDefault(),or())}}return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[c,Sr,t,e,v.length,p,l]),b.useEffect(()=>{if(!LR({auto:S,running:c,awaitingUser:H,pendingCount:v.length,queueLength:f.length})){T(null);return}const ve=Date.now();T(Kp);const Ue=setInterval(()=>{const dt=Kp-(Date.now()-ve);dt<=0?(clearInterval(Ue),T(null),u.sendQueued(0)):T(dt)},100);return()=>clearInterval(Ue)},[S,c,H,v.length,f.length]);function Ae(se,ve){var dt;if(ve.metaKey||ve.ctrlKey){u.sendQueued(se);return}const Ue=u.previewIndex!==se;u.toggleChip(se),$(!1),Ue&&((dt=kn.current)==null||dt.focus())}return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"relative min-h-0 flex-1",children:[l.length===0?g.jsx("div",{className:"p-3 text-sm text-ink-400",children:i}):g.jsx(A6,{windowItems:ye,windowStart:te,toolsExpanded:U,toolOpenOverrides:Y.current,taskId:e,projectId:t,todos:P,working:Q,pending:v,onPendingRemove:se=>{var ve;u.removePending(se),$(!1),(ve=kn.current)==null||ve.focus()},scrollRef:Ce,onScroll:Un,onContentLoad:()=>{ge.current&&Lt()}}),!at&&vt&&g.jsx("button",{onClick:Lt,className:"absolute bottom-2 right-3 rounded-full bg-indigo-600 px-3 py-1 text-xs shadow hover:bg-indigo-500",children:"↓ Latest"})]}),g.jsx(J6,{draft:p,onDraftChange:W,onSubmit:()=>void u.submit(),inputRef:kn,backdropRef:un,allowFork:!!r,menu:{open:I,matches:J,index:B,onIndexChange:A,onAccept:re,onDismiss:()=>$(!0)},dictation:q,queue:f,previewIndex:u.previewIndex,onChipClick:Ae,onChipRemove:u.removeChip,onChipDragEnd:u.onChipDragEnd,rewind:Sr,onRewindPick:ne,onRewindClose:()=>br(null),running:!!c,stoppable:!!hn,onInterrupt:()=>ke.interrupt(t,e).catch(()=>{}),auto:S,autoRemaining:C,onToggleAuto:N}),j&&g.jsx(VO,{value:p,onChange:W,onSubmit:()=>{u.submit(),R(!1)},onClose:()=>R(!1)})]})}function nz({title:e,badge:t,children:n}){const[r,i]=b.useState(!1);return g.jsxs("div",{className:"border-t border-ink-600 bg-ink-800/40 text-xs",children:[g.jsxs("button",{onClick:()=>i(s=>!s),className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-ink-400 hover:text-ink-200",children:[g.jsx("span",{className:"text-[11px]",children:r?"▾":"▸"}),g.jsx("span",{children:e}),t]}),r&&g.jsx("div",{className:"space-y-1.5 px-3 pb-2",children:n})]})}/**
308
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
309
+ * @license MIT
310
+ *
311
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
312
+ * @license MIT
313
+ *
314
+ * Originally forked from (with the author's permission):
315
+ * Fabrice Bellard's javascript vt100 for jslinux:
316
+ * http://bellard.org/jslinux/
317
+ * Copyright (c) 2011 Fabrice Bellard
318
+ */var cC=Object.defineProperty,rz=Object.getOwnPropertyDescriptor,iz=(e,t)=>{for(var n in t)cC(e,n,{get:t[n],enumerable:!0})},Tt=(e,t,n,r)=>{for(var i=r>1?void 0:r?rz(t,n):t,s=e.length-1,l;s>=0;s--)(l=e[s])&&(i=(r?l(t,n,i):l(i))||i);return r&&i&&cC(t,n,i),i},Se=(e,t)=>(n,r)=>t(n,r,e),bw="Terminal input",wm={get:()=>bw,set:e=>bw=e},kw="Too much output to announce, navigate to rows manually to read",Sm={get:()=>kw,set:e=>kw=e};function sz(e){return e.replace(/\r?\n/g,"\r")}function oz(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function lz(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function az(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");uC(i,t,n,r)}}function uC(e,t,n,r){e=sz(e),e=oz(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function hC(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function Cw(e,t,n,r,i){hC(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function fs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Xh(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var cz=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let l=e.charCodeAt(s);if(55296<=l&&l<=56319){if(++s>=n)return this._interim=l,r;let c=e.charCodeAt(s);56320<=c&&c<=57343?t[r++]=(l-55296)*1024+c-56320+65536:(t[r++]=l,t[r++]=c);continue}l!==65279&&(t[r++]=l)}return r}},uz=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,l,c,h=0,u=0;if(this.interim[0]){let v=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let x=0,S;for(;(S=this.interim[++x]&63)&&x<4;)_<<=6,_|=S;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=k-x;for(;u<C;){if(u>=n)return 0;if(S=e[u++],(S&192)!==128){u--,v=!0;break}else this.interim[x++]=S,_<<=6,_|=S&63}v||(k===2?_<128?u--:t[r++]=_:k===3?_<2048||_>=55296&&_<=57343||_===65279||(t[r++]=_):_<65536||_>1114111||(t[r++]=_)),this.interim.fill(0)}let p=n-4,f=u;for(;f<n;){for(;f<p&&!((i=e[f])&128)&&!((s=e[f+1])&128)&&!((l=e[f+2])&128)&&!((c=e[f+3])&128);)t[r++]=i,t[r++]=s,t[r++]=l,t[r++]=c,f+=4;if(i=e[f++],i<128)t[r++]=i;else if((i&224)===192){if(f>=n)return this.interim[0]=i,r;if(s=e[f++],(s&192)!==128){f--;continue}if(h=(i&31)<<6|s&63,h<128){f--;continue}t[r++]=h}else if((i&240)===224){if(f>=n)return this.interim[0]=i,r;if(s=e[f++],(s&192)!==128){f--;continue}if(f>=n)return this.interim[0]=i,this.interim[1]=s,r;if(l=e[f++],(l&192)!==128){f--;continue}if(h=(i&15)<<12|(s&63)<<6|l&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((i&248)===240){if(f>=n)return this.interim[0]=i,r;if(s=e[f++],(s&192)!==128){f--;continue}if(f>=n)return this.interim[0]=i,this.interim[1]=s,r;if(l=e[f++],(l&192)!==128){f--;continue}if(f>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=l,r;if(c=e[f++],(c&192)!==128){f--;continue}if(h=(i&7)<<18|(s&63)<<12|(l&63)<<6|c&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},dC="",ps=" ",Wa=class fC{constructor(){this.fg=0,this.bg=0,this.extended=new yh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new fC;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},yh=class pC{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new pC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},xr=class mC extends Wa{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yh,this.combinedData=""}static fromCharData(t){let n=new mC;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fs(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ew="di$target",bm="di$dependencies",bp=new Map;function hz(e){return e[bm]||[]}function nn(e){if(bp.has(e))return bp.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");dz(t,n,i)};return t._id=e,bp.set(e,t),t}function dz(e,t,n){t[Ew]===t?t[bm].push({id:e,index:n}):(t[bm]=[{id:e,index:n}],t[Ew]=t)}var An=nn("BufferService"),gC=nn("CoreMouseService"),eo=nn("CoreService"),fz=nn("CharsetService"),fv=nn("InstantiationService"),vC=nn("LogService"),Mn=nn("OptionsService"),_C=nn("OscLinkService"),pz=nn("UnicodeService"),Ua=nn("DecorationService"),km=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var p;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new xr,l=n.getTrimmedLength(),c=-1,h=-1,u=!1;for(let f=0;f<l;f++)if(!(h===-1&&!n.hasContent(f))){if(n.loadCell(f,s),s.hasExtendedAttrs()&&s.extended.urlId)if(h===-1){h=f,c=s.extended.urlId;continue}else u=s.extended.urlId!==c;else h!==-1&&(u=!0);if(u||h!==-1&&f===l-1){let v=(p=this._oscLinkService.getLinkData(c))==null?void 0:p.uri;if(v){let _={start:{x:h+1,y:e},end:{x:f+(!u&&f===l-1?1:0),y:e}},x=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let S=new URL(v);["http:","https:"].includes(S.protocol)||(x=!0)}catch{x=!0}x||r.push({text:v,range:_,activate:(S,k)=>i?i.activate(S,k,_):mz(S,k),hover:(S,k)=>{var C;return(C=i==null?void 0:i.hover)==null?void 0:C.call(i,S,k,_)},leave:(S,k)=>{var C;return(C=i==null?void 0:i.leave)==null?void 0:C.call(i,S,k,_)}})}u=!1,s.hasExtendedAttrs()&&s.extended.urlId?(h=f,c=s.extended.urlId):(h=-1,c=-1)}}t(r)}};km=Tt([Se(0,An),Se(1,Mn),Se(2,_C)],km);function mz(e,t){if(confirm(`Do you want to navigate to ${t}?
319
+
320
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Zh=nn("CharSizeService"),ji=nn("CoreBrowserService"),pv=nn("MouseService"),Ii=nn("RenderService"),gz=nn("SelectionService"),yC=nn("CharacterJoinerService"),el=nn("ThemeService"),xC=nn("LinkProviderService"),vz=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Nw.isErrorNoTelemetry(e)?new Nw(e.message+`
321
+
322
+ `+e.stack):new Error(e.message+`
323
+
324
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},_z=new vz;function Iu(e){yz(e)||_z.onUnexpectedError(e)}var Cm="Canceled";function yz(e){return e instanceof xz?!0:e instanceof Error&&e.name===Cm&&e.message===Cm}var xz=class extends Error{constructor(){super(Cm),this.name=this.message}};function wz(e){return new Error(`Illegal argument: ${e}`)}var Nw=class Em extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Em)return t;let n=new Em;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Nm=class wC extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,wC.prototype)}};function Gn(e,t=0){return e[e.length-(1+t)]}var Sz;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Sz||(Sz={}));function bz(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var SC;(e=>{function t(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(M){yield M}e.single=i;function s(M){return t(M)?M:i(M)}e.wrap=s;function l(M){return M||n}e.from=l;function*c(M){for(let B=M.length-1;B>=0;B--)yield M[B]}e.reverse=c;function h(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=h;function u(M){return M[Symbol.iterator]().next().value}e.first=u;function p(M,B){let A=0;for(let D of M)if(B(D,A++))return!0;return!1}e.some=p;function f(M,B){for(let A of M)if(B(A))return A}e.find=f;function*v(M,B){for(let A of M)B(A)&&(yield A)}e.filter=v;function*_(M,B){let A=0;for(let D of M)yield B(D,A++)}e.map=_;function*x(M,B){let A=0;for(let D of M)yield*B(D,A++)}e.flatMap=x;function*S(...M){for(let B of M)yield*B}e.concat=S;function k(M,B,A){let D=A;for(let $ of M)D=B(D,$);return D}e.reduce=k;function*C(M,B,A=M.length){for(B<0&&(B+=M.length),A<0?A+=M.length:A>M.length&&(A=M.length);B<A;B++)yield M[B]}e.slice=C;function T(M,B=Number.POSITIVE_INFINITY){let A=[];if(B===0)return[A,M];let D=M[Symbol.iterator]();for(let $=0;$<B;$++){let j=D.next();if(j.done)return[A,e.empty()];A.push(j.value)}return[A,{[Symbol.iterator](){return D}}]}e.consume=T;async function N(M){let B=[];for await(let A of M)B.push(A);return Promise.resolve(B)}e.asyncToArray=N})(SC||(SC={}));function Gs(e){if(SC.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function kz(...e){return yt(()=>Gs(e))}function yt(e){return{dispose:bz(()=>{e()})}}var bC=class kC{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Gs(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?kC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};bC.DISABLE_DISPOSED_WARNING=!1;var gs=bC,qe=class{constructor(){this._store=new gs,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};qe.None=Object.freeze({dispose(){}});var qo=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},ki=typeof window=="object"?window:globalThis,Rm=class Tm{constructor(t){this.element=t,this.next=Tm.Undefined,this.prev=Tm.Undefined}};Rm.Undefined=new Rm(void 0);var kt=Rm,Rw=class{constructor(){this._first=kt.Undefined,this._last=kt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===kt.Undefined}clear(){let e=this._first;for(;e!==kt.Undefined;){let t=e.next;e.prev=kt.Undefined,e.next=kt.Undefined,e=t}this._first=kt.Undefined,this._last=kt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new kt(e);if(this._first===kt.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==kt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==kt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==kt.Undefined&&e.next!==kt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===kt.Undefined&&e.next===kt.Undefined?(this._first=kt.Undefined,this._last=kt.Undefined):e.next===kt.Undefined?(this._last=this._last.prev,this._last.next=kt.Undefined):e.prev===kt.Undefined&&(this._first=this._first.next,this._first.prev=kt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==kt.Undefined;)yield e.element,e=e.next}},Cz=globalThis.performance&&typeof globalThis.performance.now=="function",Ez=class CC{static create(t){return new CC(t)}constructor(t){this._now=Cz&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},an;(e=>{e.None=()=>qe.None;function t(V,Y){return f(V,()=>{},0,void 0,!0,void 0,Y)}e.defer=t;function n(V){return(Y,W=null,q)=>{let z=!1,J;return J=V(I=>{if(!z)return J?J.dispose():z=!0,Y.call(W,I)},null,q),z&&J.dispose(),J}}e.once=n;function r(V,Y,W){return u((q,z=null,J)=>V(I=>q.call(z,Y(I)),null,J),W)}e.map=r;function i(V,Y,W){return u((q,z=null,J)=>V(I=>{Y(I),q.call(z,I)},null,J),W)}e.forEach=i;function s(V,Y,W){return u((q,z=null,J)=>V(I=>Y(I)&&q.call(z,I),null,J),W)}e.filter=s;function l(V){return V}e.signal=l;function c(...V){return(Y,W=null,q)=>{let z=kz(...V.map(J=>J(I=>Y.call(W,I))));return p(z,q)}}e.any=c;function h(V,Y,W,q){let z=W;return r(V,J=>(z=Y(z,J),z),q)}e.reduce=h;function u(V,Y){let W,q={onWillAddFirstListener(){W=V(z.fire,z)},onDidRemoveLastListener(){W==null||W.dispose()}},z=new me(q);return Y==null||Y.add(z),z.event}function p(V,Y){return Y instanceof Array?Y.push(V):Y&&Y.add(V),V}function f(V,Y,W=100,q=!1,z=!1,J,I){let re,P,H,Q=0,L,Z={leakWarningThreshold:J,onWillAddFirstListener(){re=V(te=>{Q++,P=Y(P,te),q&&!H&&(oe.fire(P),P=void 0),L=()=>{let _e=P;P=void 0,H=void 0,(!q||Q>1)&&oe.fire(_e),Q=0},typeof W=="number"?(clearTimeout(H),H=setTimeout(L,W)):H===void 0&&(H=0,queueMicrotask(L))})},onWillRemoveListener(){z&&Q>0&&(L==null||L())},onDidRemoveLastListener(){L=void 0,re.dispose()}},oe=new me(Z);return I==null||I.add(oe),oe.event}e.debounce=f;function v(V,Y=0,W){return e.debounce(V,(q,z)=>q?(q.push(z),q):[z],Y,void 0,!0,void 0,W)}e.accumulate=v;function _(V,Y=(q,z)=>q===z,W){let q=!0,z;return s(V,J=>{let I=q||!Y(J,z);return q=!1,z=J,I},W)}e.latch=_;function x(V,Y,W){return[e.filter(V,Y,W),e.filter(V,q=>!Y(q),W)]}e.split=x;function S(V,Y=!1,W=[],q){let z=W.slice(),J=V(P=>{z?z.push(P):re.fire(P)});q&&q.add(J);let I=()=>{z==null||z.forEach(P=>re.fire(P)),z=null},re=new me({onWillAddFirstListener(){J||(J=V(P=>re.fire(P)),q&&q.add(J))},onDidAddFirstListener(){z&&(Y?setTimeout(I):I())},onDidRemoveLastListener(){J&&J.dispose(),J=null}});return q&&q.add(re),re.event}e.buffer=S;function k(V,Y){return(W,q,z)=>{let J=Y(new T);return V(function(I){let re=J.evaluate(I);re!==C&&W.call(q,re)},void 0,z)}}e.chain=k;let C=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(Y){return this.steps.push(Y),this}forEach(Y){return this.steps.push(W=>(Y(W),W)),this}filter(Y){return this.steps.push(W=>Y(W)?W:C),this}reduce(Y,W){let q=W;return this.steps.push(z=>(q=Y(q,z),q)),this}latch(Y=(W,q)=>W===q){let W=!0,q;return this.steps.push(z=>{let J=W||!Y(z,q);return W=!1,q=z,J?z:C}),this}evaluate(Y){for(let W of this.steps)if(Y=W(Y),Y===C)break;return Y}}function N(V,Y,W=q=>q){let q=(...re)=>I.fire(W(...re)),z=()=>V.on(Y,q),J=()=>V.removeListener(Y,q),I=new me({onWillAddFirstListener:z,onDidRemoveLastListener:J});return I.event}e.fromNodeEventEmitter=N;function M(V,Y,W=q=>q){let q=(...re)=>I.fire(W(...re)),z=()=>V.addEventListener(Y,q),J=()=>V.removeEventListener(Y,q),I=new me({onWillAddFirstListener:z,onDidRemoveLastListener:J});return I.event}e.fromDOMEventEmitter=M;function B(V){return new Promise(Y=>n(V)(Y))}e.toPromise=B;function A(V){let Y=new me;return V.then(W=>{Y.fire(W)},()=>{Y.fire(void 0)}).finally(()=>{Y.dispose()}),Y.event}e.fromPromise=A;function D(V,Y){return V(W=>Y.fire(W))}e.forward=D;function $(V,Y,W){return Y(W),V(q=>Y(q))}e.runAndSubscribe=$;class j{constructor(Y,W){this._observable=Y,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{Y.addObserver(this)},onDidRemoveLastListener:()=>{Y.removeObserver(this)}};this.emitter=new me(q),W&&W.add(this.emitter)}beginUpdate(Y){this._counter++}handlePossibleChange(Y){}handleChange(Y,W){this._hasChanged=!0}endUpdate(Y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(V,Y){return new j(V,Y).emitter.event}e.fromObservable=R;function U(V){return(Y,W,q)=>{let z=0,J=!1,I={beginUpdate(){z++},endUpdate(){z--,z===0&&(V.reportChanges(),J&&(J=!1,Y.call(W)))},handlePossibleChange(){},handleChange(){J=!0}};V.addObserver(I),V.reportChanges();let re={dispose(){V.removeObserver(I)}};return q instanceof gs?q.add(re):Array.isArray(q)&&q.push(re),re}}e.fromObservableLight=U})(an||(an={}));var Pm=class Dm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Dm._idPool++}`,Dm.all.add(this)}start(t){this._stopWatch=new Ez,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Pm.all=new Set,Pm._idPool=0;var Nz=Pm,Rz=-1,EC=class NC{constructor(t,n,r=(NC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[s,l]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(c),console.warn(s);let h=new Dz(c,s);this._errorHandler(h)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};EC._idPool=1;var Tz=EC,Pz=class RC{constructor(t){this.value=t}static create(){let t=new Error;return new RC(t.stack??"")}print(){console.warn(this.value.split(`
325
+ `).slice(2).join(`
326
+ `))}},Dz=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Az=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Mz=0,kp=class{constructor(e){this.value=e,this.id=Mz++}},Lz=2,Oz,me=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Tz((e==null?void 0:e.onListenerError)??Iu,((n=this._options)==null?void 0:n.leakWarningThreshold)??Rz):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Nz(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var l,c,h,u,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let v=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new Az(`${f}. HINT: Stack shows most frequent listener (${v[1]}-times)`,v[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Iu)(_),qe.None}if(this._disposed)return qe.None;t&&(e=e.bind(t));let r=new kp(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Pz.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof kp?(this._deliveryQueue??(this._deliveryQueue=new jz),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||h.call(c,this),this._listeners=r,(p=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||p.call(u,this)),this._size++;let s=yt(()=>{i==null||i(),this._removeListener(r)});return n instanceof gs?n.add(s):Array.isArray(n)&&n.push(s),s}),this._event}_removeListener(e){var i,s,l,c;if((s=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||s.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Lz<=t.length){let h=0;for(let u=0;u<t.length;u++)t[u]?t[h++]=t[u]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Iu;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof kp)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},jz=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Am=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new me,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Am.INSTANCE=new Am;var mv=Am;function Iz(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}mv.INSTANCE.onDidChangeZoomLevel;function Bz(e){return mv.INSTANCE.getZoomFactor(e)}mv.INSTANCE.onDidChangeFullscreen;var tl=typeof navigator=="object"?navigator.userAgent:"",Mm=tl.indexOf("Firefox")>=0,zz=tl.indexOf("AppleWebKit")>=0,gv=tl.indexOf("Chrome")>=0,Fz=!gv&&tl.indexOf("Safari")>=0;tl.indexOf("Electron/")>=0;tl.indexOf("Android")>=0;var Cp=!1;if(typeof ki.matchMedia=="function"){let e=ki.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ki.matchMedia("(display-mode: fullscreen)");Cp=e.matches,Iz(ki,e,({matches:n})=>{Cp&&t.matches||(Cp=n)})}var Lo="en",Lm=!1,Om=!1,Bu=!1,TC=!1,xu,zu=Lo,Tw=Lo,$z,Lr,Us=globalThis,ln,kS;typeof Us.vscode<"u"&&typeof Us.vscode.process<"u"?ln=Us.vscode.process:typeof process<"u"&&typeof((kS=process==null?void 0:process.versions)==null?void 0:kS.node)=="string"&&(ln=process);var CS,Hz=typeof((CS=ln==null?void 0:ln.versions)==null?void 0:CS.electron)=="string",Wz=Hz&&(ln==null?void 0:ln.type)==="renderer",ES;if(typeof ln=="object"){Lm=ln.platform==="win32",Om=ln.platform==="darwin",Bu=ln.platform==="linux",Bu&&ln.env.SNAP&&ln.env.SNAP_REVISION,ln.env.CI||ln.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xu=Lo,zu=Lo;let e=ln.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);xu=t.userLocale,Tw=t.osLocale,zu=t.resolvedLanguage||Lo,$z=(ES=t.languagePack)==null?void 0:ES.translationsConfigFile}catch{}TC=!0}else typeof navigator=="object"&&!Wz?(Lr=navigator.userAgent,Lm=Lr.indexOf("Windows")>=0,Om=Lr.indexOf("Macintosh")>=0,(Lr.indexOf("Macintosh")>=0||Lr.indexOf("iPad")>=0||Lr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Bu=Lr.indexOf("Linux")>=0,(Lr==null?void 0:Lr.indexOf("Mobi"))>=0,zu=globalThis._VSCODE_NLS_LANGUAGE||Lo,xu=navigator.language.toLowerCase(),Tw=xu):console.error("Unable to resolve platform.");var PC=Lm,ii=Om,Uz=Bu,Pw=TC,li=Lr,ls=zu,Vz;(e=>{function t(){return ls}e.value=t;function n(){return ls.length===2?ls==="en":ls.length>=3?ls[0]==="e"&&ls[1]==="n"&&ls[2]==="-":!1}e.isDefaultVariant=n;function r(){return ls==="en"}e.isDefault=r})(Vz||(Vz={}));var qz=typeof Us.postMessage=="function"&&!Us.importScripts;(()=>{if(qz){let e=[];Us.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Us.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var Kz=!!(li&&li.indexOf("Chrome")>=0);li&&li.indexOf("Firefox")>=0;!Kz&&li&&li.indexOf("Safari")>=0;li&&li.indexOf("Edg/")>=0;li&&li.indexOf("Android")>=0;var To=typeof navigator=="object"?navigator:{};Pw||document.queryCommandSupported&&document.queryCommandSupported("copy")||To&&To.clipboard&&To.clipboard.writeText,Pw||To&&To.clipboard&&To.clipboard.readText;var vv=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ep=new vv,Dw=new vv,Aw=new vv,Yz=new Array(230),DC;(e=>{function t(c){return Ep.keyCodeToStr(c)}e.toString=t;function n(c){return Ep.strToKeyCode(c)}e.fromString=n;function r(c){return Dw.keyCodeToStr(c)}e.toUserSettingsUS=r;function i(c){return Aw.keyCodeToStr(c)}e.toUserSettingsGeneral=i;function s(c){return Dw.strToKeyCode(c)||Aw.strToKeyCode(c)}e.fromUserSettings=s;function l(c){if(c>=98&&c<=113)return null;switch(c){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ep.keyCodeToStr(c)}e.toElectronAccelerator=l})(DC||(DC={}));var Xz=class AC{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof AC&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Zz([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Zz=class{constructor(e){if(e.length===0)throw wz("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Gz(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return DC.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Mm)switch(t){case 59:return 85;case 60:if(Uz)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ii)return 57;break}else if(zz&&(ii&&t===93||!ii&&t===92))return 57;return Yz[t]||0}var Jz=ii?256:2048,Qz=512,eF=1024,tF=ii?2048:256,Mw=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=Gz(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Jz),this.altKey&&(t|=Qz),this.shiftKey&&(t|=eF),this.metaKey&&(t|=tF),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Xz(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Lw=new WeakMap;function nF(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var rF=class{static getSameOriginWindowChain(e){let t=Lw.get(e);if(!t){t=[],Lw.set(e,t);let n=e,r;do r=nF(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let l=s.window.deref();if(n+=(l==null?void 0:l.scrollY)??0,r+=(l==null?void 0:l.scrollX)??0,l===t||!s.iframeElement)break;let c=s.iframeElement.getBoundingClientRect();n+=c.top,r+=c.left}return{top:n,left:r}}},wu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=rF.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ow=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(gv){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,l=e,c=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*c):this.deltaY=s.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?Mm&&!ii?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")Fz&&PC?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*c):this.deltaX=s.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?Mm&&!ii?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},MC=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),iF;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof sF?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:an.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:MC})})(iF||(iF={}));var sF=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?MC:(this._emitter||(this._emitter=new me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_v=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Nm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Nm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},oF=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Nm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=yt(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},lF;(e=>{async function t(r){let i,s=await Promise.all(r.map(l=>l.then(c=>c,c=>{i||(i=c)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(l){s(l)}})}e.withAsyncBody=n})(lF||(lF={}));var jw=class gr{static fromArray(t){return new gr(n=>{n.emitMany(t)})}static fromPromise(t){return new gr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new gr(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new gr(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new me,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await an.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new gr(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return gr.map(this,t)}static filter(t,n){return new gr(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return gr.filter(this,t)}static coalesce(t){return gr.filter(t,n=>!!n)}coalesce(){return gr.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return gr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};jw.EMPTY=jw.fromArray([]);var{getWindow:ti,getWindowId:aF,onDidRegisterWindow:cF}=(function(){let e=new Map,t={window:ki,disposables:new gs};e.set(ki.vscodeWindowId,t);let n=new me,r=new me,i=new me;function s(l,c){return(typeof l=="number"?e.get(l):void 0)??(c?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(l){if(e.has(l.vscodeWindowId))return qe.None;let c=new gs,h={window:l,disposables:c.add(new gs)};return e.set(l.vscodeWindowId,h),c.add(yt(()=>{e.delete(l.vscodeWindowId),r.fire(l)})),c.add(ze(l,Gt.BEFORE_UNLOAD,()=>{i.fire(l)})),n.fire(h),c},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:s,getWindow(l){var u;let c=l;if((u=c==null?void 0:c.ownerDocument)!=null&&u.defaultView)return c.ownerDocument.defaultView.window;let h=l;return h!=null&&h.view?h.view.window:ki},getDocument(l){return ti(l).document}}})(),uF=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ze(e,t,n,r){return new uF(e,t,n,r)}var Iw=function(e,t,n,r){return ze(e,t,n,r)},yv,hF=class extends oF{constructor(e){super(),this.defaultTarget=e&&ti(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Bw=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Iu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let l=e.get(s)??[];for(t.set(s,l),e.set(s,[]),r.set(s,!0);l.length>0;)l.sort(Bw.sort),l.shift().execute();r.set(s,!1)};yv=(s,l,c=0)=>{let h=aF(s),u=new Bw(l,c),p=e.get(h);return p||(p=[],e.set(h,p)),p.push(u),n.get(h)||(n.set(h,!0),s.requestAnimationFrame(()=>i(h))),u}})();function dF(e){let t=e.getBoundingClientRect(),n=ti(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Gt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},fF=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=$n(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=$n(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=$n(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=$n(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=$n(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=$n(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=$n(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=$n(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=$n(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=$n(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=$n(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=$n(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=$n(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=$n(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function $n(e){return typeof e=="number"?`${e}px`:e}function ma(e){return new fF(e)}var LC=class{constructor(){this._hooks=new gs,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(yt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=ti(e)}this._hooks.add(ze(s,Gt.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(ze(s,Gt.POINTER_UP,l=>this.stopMonitoring(!0)))}};function pF(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...l){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,l)}),this[s]}}var Gr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Gr||(Gr={}));var ta=class wn extends qe{constructor(){super(),this.dispatched=!1,this.targets=new Rw,this.ignoreTargets=new Rw,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(an.runAndSubscribe(cF,({window:t,disposables:n})=>{n.add(ze(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(ze(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(ze(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ki,disposables:this._store}))}static addTarget(t){if(!wn.isTouchDevice())return qe.None;wn.INSTANCE||(wn.INSTANCE=new wn);let n=wn.INSTANCE.targets.push(t);return yt(n)}static ignoreTarget(t){if(!wn.isTouchDevice())return qe.None;wn.INSTANCE||(wn.INSTANCE=new wn);let n=wn.INSTANCE.ignoreTargets.push(t);return yt(n)}static isTouchDevice(){return"ontouchstart"in ki||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let l=this.newGestureEvent(Gr.Start,s.target);l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,l=n.changedTouches.length;s<l;s++){let c=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("move of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],u=Date.now()-h.initialTimeStamp;if(u<wn.HOLD_DELAY&&Math.abs(h.initialPageX-Gn(h.rollingPageX))<30&&Math.abs(h.initialPageY-Gn(h.rollingPageY))<30){let p=this.newGestureEvent(Gr.Tap,h.initialTarget);p.pageX=Gn(h.rollingPageX),p.pageY=Gn(h.rollingPageY),this.dispatchEvent(p)}else if(u>=wn.HOLD_DELAY&&Math.abs(h.initialPageX-Gn(h.rollingPageX))<30&&Math.abs(h.initialPageY-Gn(h.rollingPageY))<30){let p=this.newGestureEvent(Gr.Contextmenu,h.initialTarget);p.pageX=Gn(h.rollingPageX),p.pageY=Gn(h.rollingPageY),this.dispatchEvent(p)}else if(i===1){let p=Gn(h.rollingPageX),f=Gn(h.rollingPageY),v=Gn(h.rollingTimestamps)-h.rollingTimestamps[0],_=p-h.rollingPageX[0],x=f-h.rollingPageY[0],S=[...this.targets].filter(k=>h.initialTarget instanceof Node&&k.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(_)/v,_>0?1:-1,p,Math.abs(x)/v,x>0?1:-1,f)}this.dispatchEvent(this.newGestureEvent(Gr.End,h.initialTarget)),delete this.activeTouches[c.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Gr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>wn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Gr.Change||t.type===Gr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,l,c,h,u){this.handle=yv(t,()=>{let p=Date.now(),f=p-r,v=0,_=0,x=!0;i+=wn.SCROLL_FRICTION*f,c+=wn.SCROLL_FRICTION*f,i>0&&(x=!1,v=s*i*f),c>0&&(x=!1,_=h*c*f);let S=this.newGestureEvent(Gr.Change);S.translationX=v,S.translationY=_,n.forEach(k=>k.dispatchEvent(S)),x||this.inertia(t,n,p,i,s,l+v,c,h,u+_)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let l=this.activeTouches[s.identifier],c=this.newGestureEvent(Gr.Change,l.initialTarget);c.translationX=s.pageX-Gn(l.rollingPageX),c.translationY=s.pageY-Gn(l.rollingPageY),c.pageX=s.pageX,c.pageY=s.pageY,this.dispatchEvent(c),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(s.pageX),l.rollingPageY.push(s.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ta.SCROLL_FRICTION=-.005,ta.HOLD_DELAY=700,ta.CLEAR_TAP_COUNT_TIME=400,Tt([pF],ta,"isTouchDevice",1);var mF=ta,xv=class extends qe{onclick(e,t){this._register(ze(e,Gt.CLICK,n=>t(new wu(ti(e),n))))}onmousedown(e,t){this._register(ze(e,Gt.MOUSE_DOWN,n=>t(new wu(ti(e),n))))}onmouseover(e,t){this._register(ze(e,Gt.MOUSE_OVER,n=>t(new wu(ti(e),n))))}onmouseleave(e,t){this._register(ze(e,Gt.MOUSE_LEAVE,n=>t(new wu(ti(e),n))))}onkeydown(e,t){this._register(ze(e,Gt.KEY_DOWN,n=>t(new Mw(n))))}onkeyup(e,t){this._register(ze(e,Gt.KEY_UP,n=>t(new Mw(n))))}oninput(e,t){this._register(ze(e,Gt.INPUT,t))}onblur(e,t){this._register(ze(e,Gt.BLUR,t))}onfocus(e,t){this._register(ze(e,Gt.FOCUS,t))}onchange(e,t){this._register(ze(e,Gt.CHANGE,t))}ignoreGesture(e){return mF.ignoreTarget(e)}},zw=11,gF=class extends xv{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=zw+"px",this.domNode.style.height=zw+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new LC),this._register(Iw(this.bgDomNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Iw(this.domNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new hF),this._pointerdownScheduleRepeatTimer=this._register(new _v)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ti(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},vF=class jm{constructor(t,n,r,i,s,l,c){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,l=l|0,c=c|0),this.rawScrollLeft=i,this.rawScrollTop=c,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),c+s>l&&(c=l-s),c<0&&(c=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=l,this.scrollTop=c}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new jm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new jm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,c=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:l,scrollHeightChanged:c,scrollTopChanged:h}}},_F=class extends qe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new vF(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new $w(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=$w.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Fw=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Np(e,t){let n=t-e;return function(r){return e+n*wF(r)}}function yF(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var $w=class Im{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),yF(Np(t,i),Np(s,n),.33)}return Np(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new Fw(r,i,!1)}return new Fw(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Im.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Im(t,n,i,r)}};function xF(e){return Math.pow(e,3)}function wF(e){return 1-xF(1-e)}var SF=class extends qe{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _v)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},bF=140,OC=class extends xv{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new SF(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new LC),this._shouldRender=!0,this.domNode=ma(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ze(this.domNode.domNode,Gt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new gF(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=ma(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ze(this.slider.domNode,Gt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=dF(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),l=Math.abs(s-n);if(PC&&l>bF){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let c=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},jC=class Bm{constructor(t,n,r,i,s,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Bm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let l=Math.max(0,r-t),c=Math.max(0,l-2*n),h=i>0&&i>r;if(!h)return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(c),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(r*c/i))),p=(c-u)/(i-r),f=s*p;return{computedAvailableSize:Math.round(l),computedIsNeeded:h,computedSliderSize:Math.round(u),computedSliderRatio:p,computedSliderPosition:Math.round(f)}}_refreshComputedValues(){let t=Bm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},kF=class extends OC{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jC(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},CF=class extends OC{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jC(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},EF=500,Hw=50,NF=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},zm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(gv){let n=ti(t.browserEvent),r=Bz(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new NF(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),l=Math.abs(n.deltaX),c=Math.abs(n.deltaY),h=Math.max(Math.min(i,l),1),u=Math.max(Math.min(s,c),1),p=Math.max(i,l),f=Math.max(s,c);p%h===0&&f%u===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};zm.INSTANCE=new zm;var RF=zm,TF=class extends xv{constructor(e,t,n){super(),this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new me),this.onWillScroll=this._onWillScroll.event,this._options=DF(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new CF(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new kF(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ma(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ma(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ma(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new _v),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Gs(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ii&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ow(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Gs(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Ow(n))};this._mouseWheelToDispose.push(ze(this._listenOnDomNode,Gt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=RF.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+s===0?l=s=0:Math.abs(s)>=Math.abs(l)?l=0:s=0),this._options.flipAxes&&([s,l]=[l,s]);let c=!ii&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!l&&(l=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),u={};if(s){let p=Hw*s,f=h.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(u,f)}if(l){let p=Hw*l,f=h.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(u,f)}u=this._scrollable.validateScrollPosition(u),(h.scrollLeft!==u.scrollLeft||h.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),EF)}},PF=class extends TF{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function DF(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,ii&&(t.className+=" mac"),t}var Fm=class extends qe{constructor(e,t,n,r,i,s,l,c){super(),this._bufferService=n,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new _F({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>yv(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new PF(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(an.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(yt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(yt(()=>this._styleElement.remove())),this._register(an.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
327
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Fm=Tt([Se(2,An),Se(3,ji),Se(4,gC),Se(5,el),Se(6,Mn),Se(7,Ii)],Fm);var $m=class extends qe{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(yt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};$m=Tt([Se(1,An),Se(2,ji),Se(3,Ua),Se(4,Ii)],$m);var AF=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Xr={full:0,left:0,center:0,right:0},as={full:0,left:0,center:0,right:0},ql={full:0,left:0,center:0,right:0},xh=class extends qe{constructor(e,t,n,r,i,s,l,c){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new AF,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(yt(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);as.full=this._canvas.width,as.left=e,as.center=t,as.right=e,this._refreshDrawHeightConstants(),ql.full=1,ql.left=1,ql.center=1+as.left,ql.right=1+as.left+as.center}_refreshDrawHeightConstants(){Xr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Xr.left=t,Xr.center=t,Xr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ql[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Xr[e.position||"full"]/2),as[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Xr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};xh=Tt([Se(2,An),Se(3,Ua),Se(4,Ii),Se(5,Mn),Se(6,el),Se(7,ji)],xh);var ie;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
328
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ie||(ie={}));var Fu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Fu||(Fu={}));var IC;(e=>e.ST=`${ie.ESC}\\`)(IC||(IC={}));var Hm=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ie.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Hm=Tt([Se(2,An),Se(3,Mn),Se(4,eo),Se(5,Ii)],Hm);var Qt=0,en=0,tn=0,Rt=0,Ww={css:"#00000000",rgba:0},Ft;(e=>{function t(i,s,l,c){return c!==void 0?`#${Bs(i)}${Bs(s)}${Bs(l)}${Bs(c)}`:`#${Bs(i)}${Bs(s)}${Bs(l)}`}e.toCss=t;function n(i,s,l,c=255){return(i<<24|s<<16|l<<8|c)>>>0}e.toRgba=n;function r(i,s,l,c){return{css:e.toCss(i,s,l,c),rgba:e.toRgba(i,s,l,c)}}e.toColor=r})(Ft||(Ft={}));var gt;(e=>{function t(h,u){if(Rt=(u.rgba&255)/255,Rt===1)return{css:u.css,rgba:u.rgba};let p=u.rgba>>24&255,f=u.rgba>>16&255,v=u.rgba>>8&255,_=h.rgba>>24&255,x=h.rgba>>16&255,S=h.rgba>>8&255;Qt=_+Math.round((p-_)*Rt),en=x+Math.round((f-x)*Rt),tn=S+Math.round((v-S)*Rt);let k=Ft.toCss(Qt,en,tn),C=Ft.toRgba(Qt,en,tn);return{css:k,rgba:C}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,u,p){let f=$u.ensureContrastRatio(h.rgba,u.rgba,p);if(f)return Ft.toColor(f>>24&255,f>>16&255,f>>8&255)}e.ensureContrastRatio=r;function i(h){let u=(h.rgba|255)>>>0;return[Qt,en,tn]=$u.toChannels(u),{css:Ft.toCss(Qt,en,tn),rgba:u}}e.opaque=i;function s(h,u){return Rt=Math.round(u*255),[Qt,en,tn]=$u.toChannels(h.rgba),{css:Ft.toCss(Qt,en,tn,Rt),rgba:Ft.toRgba(Qt,en,tn,Rt)}}e.opacity=s;function l(h,u){return Rt=h.rgba&255,s(h,Rt*u/255)}e.multiplyOpacity=l;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(gt||(gt={}));var Ct;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Qt=parseInt(i.slice(1,2).repeat(2),16),en=parseInt(i.slice(2,3).repeat(2),16),tn=parseInt(i.slice(3,4).repeat(2),16),Ft.toColor(Qt,en,tn);case 5:return Qt=parseInt(i.slice(1,2).repeat(2),16),en=parseInt(i.slice(2,3).repeat(2),16),tn=parseInt(i.slice(3,4).repeat(2),16),Rt=parseInt(i.slice(4,5).repeat(2),16),Ft.toColor(Qt,en,tn,Rt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Qt=parseInt(s[1]),en=parseInt(s[2]),tn=parseInt(s[3]),Rt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Ft.toColor(Qt,en,tn,Rt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Qt,en,tn,Rt]=t.getImageData(0,0,1,1).data,Rt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ft.toRgba(Qt,en,tn,Rt),css:i}}e.toColor=r})(Ct||(Ct={}));var Rn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let l=r/255,c=i/255,h=s/255,u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),p=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),f=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return u*.2126+p*.7152+f*.0722}e.relativeLuminance2=n})(Rn||(Rn={}));var $u;(e=>{function t(l,c){if(Rt=(c&255)/255,Rt===1)return c;let h=c>>24&255,u=c>>16&255,p=c>>8&255,f=l>>24&255,v=l>>16&255,_=l>>8&255;return Qt=f+Math.round((h-f)*Rt),en=v+Math.round((u-v)*Rt),tn=_+Math.round((p-_)*Rt),Ft.toRgba(Qt,en,tn)}e.blend=t;function n(l,c,h){let u=Rn.relativeLuminance(l>>8),p=Rn.relativeLuminance(c>>8);if(xi(u,p)<h){if(p<u){let _=r(l,c,h),x=xi(u,Rn.relativeLuminance(_>>8));if(x<h){let S=i(l,c,h),k=xi(u,Rn.relativeLuminance(S>>8));return x>k?_:S}return _}let f=i(l,c,h),v=xi(u,Rn.relativeLuminance(f>>8));if(v<h){let _=r(l,c,h),x=xi(u,Rn.relativeLuminance(_>>8));return v>x?f:_}return f}}e.ensureContrastRatio=n;function r(l,c,h){let u=l>>24&255,p=l>>16&255,f=l>>8&255,v=c>>24&255,_=c>>16&255,x=c>>8&255,S=xi(Rn.relativeLuminance2(v,_,x),Rn.relativeLuminance2(u,p,f));for(;S<h&&(v>0||_>0||x>0);)v-=Math.max(0,Math.ceil(v*.1)),_-=Math.max(0,Math.ceil(_*.1)),x-=Math.max(0,Math.ceil(x*.1)),S=xi(Rn.relativeLuminance2(v,_,x),Rn.relativeLuminance2(u,p,f));return(v<<24|_<<16|x<<8|255)>>>0}e.reduceLuminance=r;function i(l,c,h){let u=l>>24&255,p=l>>16&255,f=l>>8&255,v=c>>24&255,_=c>>16&255,x=c>>8&255,S=xi(Rn.relativeLuminance2(v,_,x),Rn.relativeLuminance2(u,p,f));for(;S<h&&(v<255||_<255||x<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),S=xi(Rn.relativeLuminance2(v,_,x),Rn.relativeLuminance2(u,p,f));return(v<<24|_<<16|x<<8|255)>>>0}e.increaseLuminance=i;function s(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=s})($u||($u={}));function Bs(e){let t=e.toString(16);return t.length<2?"0"+t:t}function xi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var MF=class extends Wa{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},wh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new xr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,l=0,c=t.getFg(0),h=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==h){if(u-i>1){let p=this._getJoinedRanges(r,l,s,t,i);for(let f=0;f<p.length;f++)n.push(p[f])}i=u,l=s,c=this._workCell.fg,h=this._workCell.bg}s+=this._workCell.getChars().length||ps.length}if(this._bufferService.cols-i>1){let u=this._getJoinedRanges(r,l,s,t,i);for(let p=0;p<u.length;p++)n.push(u[p])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(s)}catch(c){console.error(c)}for(let c=1;c<this._characterJoiners.length;c++)try{let h=this._characterJoiners[c].handler(s);for(let u=0;u<h.length;u++)wh._mergeRanges(l,h[u])}catch(h){console.error(h)}return this._stringRangesToCellRanges(l,r,i),l}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,l=e[r];if(l){for(let c=n;c<this._bufferService.cols;c++){let h=t.getWidth(c),u=t.getString(c).length||ps.length;if(h!==0){if(!i&&l[0]<=s&&(l[0]=c,i=!0),l[1]<=s){if(l[1]=c,l=e[++r],!l)break;l[0]<=s?(l[0]=c,i=!0):i=!1}s+=u}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};wh=Tt([Se(0,An)],wh);function LF(e){return 57508<=e&&e<=57558}function OF(e){return 9472<=e&&e<=9631}function jF(e){return LF(e)||OF(e)}function IF(){return{css:{canvas:Su(),cell:Su()},device:{canvas:Su(),cell:Su(),char:{width:0,height:0,left:0,top:0}}}}function Su(){return{width:0,height:0}}var Wm=class{constructor(e,t,n,r,i,s,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=l,this._workCell=new xr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,l,c,h,u,p){let f=[],v=this._characterJoinerService.getJoinedCharacters(t),_=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S,k=0,C="",T=0,N=0,M=0,B=0,A=!1,D=0,$=!1,j=0,R=0,U=[],V=u!==-1&&p!==-1;for(let Y=0;Y<x;Y++){e.loadCell(Y,this._workCell);let W=this._workCell.getWidth();if(W===0)continue;let q=!1,z=Y>=R,J=Y,I=this._workCell;if(v.length>0&&Y===v[0][0]&&z){let Ie=v.shift(),rt=this._isCellInSelection(Ie[0],t);for(T=Ie[0]+1;T<Ie[1];T++)z&&(z=rt===this._isCellInSelection(T,t));z&&(z=!n||s<Ie[0]||s>=Ie[1]),z?(q=!0,I=new MF(this._workCell,e.translateToString(!0,Ie[0],Ie[1]),Ie[1]-Ie[0]),J=Ie[1]-1,W=I.getWidth()):R=Ie[1]}let re=this._isCellInSelection(Y,t),P=n&&Y===s,H=V&&Y>=u&&Y<=p,Q=!1;this._decorationService.forEachDecorationAtCell(Y,t,void 0,Ie=>{Q=!0});let L=I.getChars()||ps;if(L===" "&&(I.isUnderline()||I.isOverline())&&(L=" "),j=W*c-h.get(L,I.isBold(),I.isItalic()),!S)S=this._document.createElement("span");else if(k&&(re&&$||!re&&!$&&I.bg===N)&&(re&&$&&_.selectionForeground||I.fg===M)&&I.extended.ext===B&&H===A&&j===D&&!P&&!q&&!Q&&z){I.isInvisible()?C+=ps:C+=L,k++;continue}else k&&(S.textContent=C),S=this._document.createElement("span"),k=0,C="";if(N=I.bg,M=I.fg,B=I.extended.ext,A=H,D=j,$=re,q&&s>=Y&&s<=J&&(s=Y),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&U.push("xterm-cursor-blink"),U.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(I.isBold()&&U.push("xterm-bold"),I.isItalic()&&U.push("xterm-italic"),I.isDim()&&U.push("xterm-dim"),I.isInvisible()?C=ps:C=I.getChars()||ps,I.isUnderline()&&(U.push(`xterm-underline-${I.extended.underlineStyle}`),C===" "&&(C=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Wa.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let Ie=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&Ie<8&&(Ie+=8),S.style.textDecorationColor=_.ansi[Ie].css}I.isOverline()&&(U.push("xterm-overline"),C===" "&&(C=" ")),I.isStrikethrough()&&U.push("xterm-strikethrough"),H&&(S.style.textDecoration="underline");let Z=I.getFgColor(),oe=I.getFgColorMode(),te=I.getBgColor(),_e=I.getBgColorMode(),ye=!!I.isInverse();if(ye){let Ie=Z;Z=te,te=Ie;let rt=oe;oe=_e,_e=rt}let Ce,ge,at=!1;this._decorationService.forEachDecorationAtCell(Y,t,void 0,Ie=>{Ie.options.layer!=="top"&&at||(Ie.backgroundColorRGB&&(_e=50331648,te=Ie.backgroundColorRGB.rgba>>8&16777215,Ce=Ie.backgroundColorRGB),Ie.foregroundColorRGB&&(oe=50331648,Z=Ie.foregroundColorRGB.rgba>>8&16777215,ge=Ie.foregroundColorRGB),at=Ie.options.layer==="top")}),!at&&re&&(Ce=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,te=Ce.rgba>>8&16777215,_e=50331648,at=!0,_.selectionForeground&&(oe=50331648,Z=_.selectionForeground.rgba>>8&16777215,ge=_.selectionForeground)),at&&U.push("xterm-decoration-top");let nt;switch(_e){case 16777216:case 33554432:nt=_.ansi[te],U.push(`xterm-bg-${te}`);break;case 50331648:nt=Ft.toColor(te>>16,te>>8&255,te&255),this._addStyle(S,`background-color:#${Uw((te>>>0).toString(16),"0",6)}`);break;case 0:default:ye?(nt=_.foreground,U.push("xterm-bg-257")):nt=_.background}switch(Ce||I.isDim()&&(Ce=gt.multiplyOpacity(nt,.5)),oe){case 16777216:case 33554432:I.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(S,nt,_.ansi[Z],I,Ce,void 0)||U.push(`xterm-fg-${Z}`);break;case 50331648:let Ie=Ft.toColor(Z>>16&255,Z>>8&255,Z&255);this._applyMinimumContrast(S,nt,Ie,I,Ce,ge)||this._addStyle(S,`color:#${Uw(Z.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,nt,_.foreground,I,Ce,ge)||ye&&U.push("xterm-fg-257")}U.length&&(S.className=U.join(" "),U.length=0),!P&&!q&&!Q&&z?k++:S.textContent=C,j!==this.defaultSpacing&&(S.style.letterSpacing=`${j}px`),f.push(S),Y=J}return S&&k&&(S.textContent=C),f}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||jF(r.getCode()))return!1;let l=this._getContrastCache(r),c;if(!i&&!s&&(c=l.getColor(t.rgba,n.rgba)),c===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);c=gt.ensureContrastRatio(i||t,s||n,h),l.setColor((i||t).rgba,(s||n).rgba,c??null)}return c?(this._addStyle(e,`color:${c.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Wm=Tt([Se(1,yC),Se(2,Mn),Se(3,ji),Se(4,eo),Se(5,Ua),Se(6,el)],Wm);function Uw(e,t,n){for(;e.length<n;)e=t+e;return e}var BF=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let l=0;t&&(l|=1),n&&(l|=2),s=this._measure(e,l),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},zF=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,l=n[1]-i,c=Math.max(s,0),h=Math.min(l,e.rows-1);if(c>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function FF(){return new zF}var Rp="xterm-dom-renderer-owner-",mr="xterm-rows",bu="xterm-fg-",Vw="xterm-bg-",Kl="xterm-focus",ku="xterm-selection",$F=1,Um=class extends qe{constructor(e,t,n,r,i,s,l,c,h,u,p,f,v,_){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=l,this._charSizeService=h,this._optionsService=u,this._bufferService=p,this._coreService=f,this._coreBrowserService=v,this._themeService=_,this._terminalClass=$F++,this._rowElements=[],this._selectionRenderModel=FF(),this.onRequestRedraw=this._register(new me).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(mr),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ku),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=IF(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=c.createInstance(Wm,document),this._element.classList.add(Rp+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(yt(()=>{this._element.classList.remove(Rp+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new BF(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${mr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${mr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${mr} .xterm-dim { color: ${gt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${mr}.${Kl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Kl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Kl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ku} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ku} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ku} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,l]of e.ansi.entries())t+=`${this._terminalSelector} .${bu}${s} { color: ${l.css}; }${this._terminalSelector} .${bu}${s}.xterm-dim { color: ${gt.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${Vw}${s} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${bu}257 { color: ${gt.opaque(e.background).css}; }${this._terminalSelector} .${bu}257.xterm-dim { color: ${gt.multiplyOpacity(gt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Vw}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Kl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Kl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];c.appendChild(this._createSelectionElement(s,h?t[0]:e[0],h?e[0]:t[0],l-s+1))}else{let h=r===s?e[0]:0,u=s===i?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(s,h,u));let p=l-s-1;if(c.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,p)),s!==l){let f=i===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,f))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return s+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${l}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let u=h+n.ydisp,p=this._rowElements[h],f=n.lines.get(u);if(!p||!f)break;p.replaceChildren(...this._rowFactory.createRow(f,u,u===r,l,c,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Rp}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),r=Math.max(Math.min(r,l),0),i=Math.min(i,this._bufferService.cols);let c=this._bufferService.buffer,h=c.ybase+c.y,u=Math.min(c.x,i-1),p=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=n;_<=r;++_){let x=_+c.ydisp,S=this._rowElements[_],k=c.lines.get(x);if(!S||!k)break;S.replaceChildren(...this._rowFactory.createRow(k,x,x===h,f,v,u,p,this.dimensions.css.cell.width,this._widthCache,s?_===n?e:0:-1,s?(_===r?t:i)-1:-1))}}};Um=Tt([Se(7,fv),Se(8,Zh),Se(9,Mn),Se(10,An),Se(11,eo),Se(12,ji),Se(13,el)],Um);var Vm=class extends qe{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new me),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new WF(this._optionsService))}catch{this._measureStrategy=this._register(new HF(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Vm=Tt([Se(2,Mn)],Vm);var BC=class extends qe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},HF=class extends BC{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},WF=class extends BC{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},UF=class extends qe{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new VF(this._window)),this._onDprChange=this._register(new me),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new me),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(an.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ze(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ze(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},VF=class extends qe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new qo),this._onDprChange=this._register(new me),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(yt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ze(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},qF=class extends qe{constructor(){super(),this.linkProviders=[],this._register(yt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function wv(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),l=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-l]}function KF(e,t,n,r,i,s,l,c,h){if(!s)return;let u=wv(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(h?l/2:0))/l),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),r+(h?1:0)),u[1]=Math.min(Math.max(u[1],1),i),u}var qm=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return KF(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=wv(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};qm=Tt([Se(0,Ii),Se(1,Zh)],qm);var YF=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},zC={};iz(zC,{getSafariVersion:()=>ZF,isChromeOS:()=>WC,isFirefox:()=>FC,isIpad:()=>GF,isIphone:()=>JF,isLegacyEdge:()=>XF,isLinux:()=>Sv,isMac:()=>Sh,isNode:()=>Gh,isSafari:()=>$C,isWindows:()=>HC});var Gh=typeof process<"u"&&"title"in process,Va=Gh?"node":navigator.userAgent,qa=Gh?"node":navigator.platform,FC=Va.includes("Firefox"),XF=Va.includes("Edge"),$C=/^((?!chrome|android).)*safari/i.test(Va);function ZF(){if(!$C)return 0;let e=Va.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Sh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(qa),GF=qa==="iPad",JF=qa==="iPhone",HC=["Windows","Win16","Win32","WinCE"].includes(qa),Sv=qa.indexOf("Linux")>=0,WC=/\bCrOS\b/.test(Va),UC=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},QF=class extends UC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},e$=class extends UC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},bh=!Gh&&"requestIdleCallback"in window?e$:QF,t$=class{constructor(){this._queue=new bh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Km=class extends qe{constructor(e,t,n,r,i,s,l,c,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=c,this._renderer=this._register(new qo),this._pausedResizeTask=new t$,this._observerDisposable=this._register(new qo),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new me),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new me),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new me),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new me),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new YF((u,p)=>this._renderRows(u,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new n$(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(yt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=yt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Km=Tt([Se(2,Mn),Se(3,Zh),Se(4,eo),Se(5,Ua),Se(6,An),Se(7,ji),Se(8,el)],Km);var n$=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function r$(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return o$(i,s,e,t,n,r)+Jh(s,t,n,r)+l$(i,s,e,t,n,r);let l;if(s===t)return l=i>e?"D":"C",Pa(Math.abs(i-e),Ta(l,r));l=s>t?"D":"C";let c=Math.abs(s-t),h=s$(s>t?e:i,n)+(c-1)*n.cols+1+i$(s>t?i:e);return Pa(h,Ta(l,r))}function i$(e,t){return e-1}function s$(e,t){return t.cols-e}function o$(e,t,n,r,i,s){return Jh(t,r,i,s).length===0?"":Pa(qC(e,t,e,t-Js(t,i),!1,i).length,Ta("D",s))}function Jh(e,t,n,r){let i=e-Js(e,n),s=t-Js(t,n),l=Math.abs(i-s)-a$(e,t,n);return Pa(l,Ta(VC(e,t),r))}function l$(e,t,n,r,i,s){let l;Jh(t,r,i,s).length>0?l=r-Js(r,i):l=t;let c=r,h=c$(e,t,n,r,i,s);return Pa(qC(e,l,n,c,h==="C",i).length,Ta(h,s))}function a$(e,t,n){var l;let r=0,i=e-Js(e,n),s=t-Js(t,n);for(let c=0;c<Math.abs(i-s);c++){let h=VC(e,t)==="A"?-1:1;(l=n.buffer.lines.get(i+h*c))!=null&&l.isWrapped&&r++}return r}function Js(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function c$(e,t,n,r,i,s){let l;return Jh(n,r,i,s).length>0?l=r-Js(r,i):l=t,e<n&&l<=r||e>=n&&l<r?"C":"D"}function VC(e,t){return e>t?"A":"B"}function qC(e,t,n,r,i,s){let l=e,c=t,h="";for(;(l!==n||c!==r)&&c>=0&&c<s.buffer.lines.length;)l+=i?1:-1,i&&l>s.cols-1?(h+=s.buffer.translateBufferLineToString(c,!1,e,l),l=0,e=0,c++):!i&&l<0&&(h+=s.buffer.translateBufferLineToString(c,!1,0,e+1),l=s.cols-1,e=l,c--);return h+s.buffer.translateBufferLineToString(c,!1,e,l)}function Ta(e,t){let n=t?"O":"[";return ie.ESC+n+e}function Pa(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var u$=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function qw(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Tp=50,h$=15,d$=50,f$=500,p$=" ",m$=new RegExp(p$,"g"),Ym=class extends qe{constructor(e,t,n,r,i,s,l,c,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=l,this._renderService=c,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new xr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new me),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new me),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new me),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new u$(this._bufferService),this._activeSelectionMode=0,this._register(yt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let c=n.translateBufferLineToString(l,!0,i,s);r.push(c)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let l=n.lines.get(s),c=n.translateBufferLineToString(s,!0);l!=null&&l.isWrapped?r[r.length-1]+=c:r.push(c)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(i=>i.replace(m$," ")).join(HC?`\r
329
+ `:`
330
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Sv&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=qw(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=wv(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Tp),Tp),t/=Tp,t/Math.abs(t)+Math.round(t*(h$-1)))}shouldForceSelection(e){return Sh?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),d$)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Sh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<f$&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=r$(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let l=i.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(s,e[0]),h=c,u=e[0]-c,p=0,f=0,v=0,_=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;h<l.length&&l.charAt(h+1)===" ";)h++}else{let k=e[0],C=e[0];s.getWidth(k)===0&&(p++,k--),s.getWidth(C)===2&&(f++,C++);let T=s.getString(C).length;for(T>1&&(_+=T-1,h+=T-1);k>0&&c>0&&!this._isCharWordSeparator(s.loadCell(k-1,this._workCell));){s.loadCell(k-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,k--):N>1&&(v+=N-1,c-=N-1),c--,k--}for(;C<s.length&&h+1<l.length&&!this._isCharWordSeparator(s.loadCell(C+1,this._workCell));){s.loadCell(C+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(f++,C++):N>1&&(_+=N-1,h+=N-1),h++,C++}}h++;let x=c+u-p+v,S=Math.min(this._bufferService.cols,h-c+p+f-v-_);if(!(!t&&l.slice(c,h).trim()==="")){if(n&&x===0&&s.getCodePoint(0)!==32){let k=i.lines.get(e[1]-1);if(k&&s.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let T=this._bufferService.cols-C.start;x-=T,S+=T}}}if(r&&x+S===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let k=i.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(S+=C.length)}}return{start:x,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=qw(n,this._bufferService.cols)}};Ym=Tt([Se(3,An),Se(4,eo),Se(5,pv),Se(6,Mn),Se(7,Ii),Se(8,ji)],Ym);var Kw=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yw=class{constructor(){this._color=new Kw,this._css=new Kw}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Wt=Object.freeze((()=>{let e=[Ct.toColor("#2e3436"),Ct.toColor("#cc0000"),Ct.toColor("#4e9a06"),Ct.toColor("#c4a000"),Ct.toColor("#3465a4"),Ct.toColor("#75507b"),Ct.toColor("#06989a"),Ct.toColor("#d3d7cf"),Ct.toColor("#555753"),Ct.toColor("#ef2929"),Ct.toColor("#8ae234"),Ct.toColor("#fce94f"),Ct.toColor("#729fcf"),Ct.toColor("#ad7fa8"),Ct.toColor("#34e2e2"),Ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:Ft.toCss(r,i,s),rgba:Ft.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Ft.toCss(r,r,r),rgba:Ft.toRgba(r,r,r)})}return e})()),zs=Ct.toColor("#ffffff"),na=Ct.toColor("#000000"),Xw=Ct.toColor("#ffffff"),Zw=na,Yl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},g$=zs,Xm=class extends qe{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yw,this._halfContrastCache=new Yw,this._onChangeColors=this._register(new me),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:zs,background:na,cursor:Xw,cursorAccent:Zw,selectionForeground:void 0,selectionBackgroundTransparent:Yl,selectionBackgroundOpaque:gt.blend(na,Yl),selectionInactiveBackgroundTransparent:Yl,selectionInactiveBackgroundOpaque:gt.blend(na,Yl),scrollbarSliderBackground:gt.opacity(zs,.2),scrollbarSliderHoverBackground:gt.opacity(zs,.4),scrollbarSliderActiveBackground:gt.opacity(zs,.5),overviewRulerBorder:zs,ansi:Wt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=lt(e.foreground,zs),t.background=lt(e.background,na),t.cursor=gt.blend(t.background,lt(e.cursor,Xw)),t.cursorAccent=gt.blend(t.background,lt(e.cursorAccent,Zw)),t.selectionBackgroundTransparent=lt(e.selectionBackground,Yl),t.selectionBackgroundOpaque=gt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=lt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=gt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?lt(e.selectionForeground,Ww):void 0,t.selectionForeground===Ww&&(t.selectionForeground=void 0),gt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=gt.opacity(t.selectionBackgroundTransparent,.3)),gt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=gt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=lt(e.scrollbarSliderBackground,gt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=lt(e.scrollbarSliderHoverBackground,gt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=lt(e.scrollbarSliderActiveBackground,gt.opacity(t.foreground,.5)),t.overviewRulerBorder=lt(e.overviewRulerBorder,g$),t.ansi=Wt.slice(),t.ansi[0]=lt(e.black,Wt[0]),t.ansi[1]=lt(e.red,Wt[1]),t.ansi[2]=lt(e.green,Wt[2]),t.ansi[3]=lt(e.yellow,Wt[3]),t.ansi[4]=lt(e.blue,Wt[4]),t.ansi[5]=lt(e.magenta,Wt[5]),t.ansi[6]=lt(e.cyan,Wt[6]),t.ansi[7]=lt(e.white,Wt[7]),t.ansi[8]=lt(e.brightBlack,Wt[8]),t.ansi[9]=lt(e.brightRed,Wt[9]),t.ansi[10]=lt(e.brightGreen,Wt[10]),t.ansi[11]=lt(e.brightYellow,Wt[11]),t.ansi[12]=lt(e.brightBlue,Wt[12]),t.ansi[13]=lt(e.brightMagenta,Wt[13]),t.ansi[14]=lt(e.brightCyan,Wt[14]),t.ansi[15]=lt(e.brightWhite,Wt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=lt(e.extendedAnsi[r],Wt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Xm=Tt([Se(0,Mn)],Xm);function lt(e,t){if(e!==void 0)try{return Ct.toColor(e)}catch{}return t}var v$=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},_$=class{constructor(){this._services=new v$,this._services.set(fv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=hz(e).sort((s,l)=>s.index-l.index),r=[];for(let s of n){let l=this._services.get(s.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(l)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},y$={trace:0,debug:1,info:2,warn:3,error:4,off:5},x$="xterm.js: ",Zm=class extends qe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=y$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":x$)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Zm=Tt([Se(0,Mn)],Zm);var Gw=class extends qe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new me),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new me),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new me),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ve=3,Bt=Object.freeze(new Wa),Cu=0,Pp=2,ra=class KC{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ve);let i=n||xr.fromCharData([0,dC,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*Ve+0],r=n&2097151;return[this._data[t*Ve+1],n&2097152?this._combined[t]:r?fs(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Ve+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ve+0]=t|2097152|n[2]<<22):this._data[t*Ve+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ve+0]>>22}hasWidth(t){return this._data[t*Ve+0]&12582912}getFg(t){return this._data[t*Ve+1]}getBg(t){return this._data[t*Ve+2]}hasContent(t){return this._data[t*Ve+0]&4194303}getCodePoint(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ve+0]&2097152}getString(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t]:n&2097151?fs(n&2097151):""}isProtected(t){return this._data[t*Ve+2]&536870912}loadCell(t,n){return Cu=t*Ve,n.content=this._data[Cu+0],n.fg=this._data[Cu+1],n.bg=this._data[Cu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ve+0]=n.content,this._data[t*Ve+1]=n.fg,this._data[t*Ve+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ve+0]=n|r<<22,this._data[t*Ve+1]=i.fg,this._data[t*Ve+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*Ve+0];i&2097152?this._combined[t]+=fs(n):i&2097151?(this._combined[t]=fs(i&2097151)+fs(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*Ve+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new xr;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new xr;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Pp<this._data.buffer.byteLength;let r=t*Ve;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let l=0;l<i.length;l++){let c=parseInt(i[l],10);c>=t&&delete this._combined[c]}let s=Object.keys(this._extendedAttrs);for(let l=0;l<s.length;l++){let c=parseInt(s[l],10);c>=t&&delete this._extendedAttrs[c]}}return this.length=t,r*4*Pp<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Pp<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new KC(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303)return t+(this._data[t*Ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303||this._data[t*Ve+2]&50331648)return t+(this._data[t*Ve+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let l=t._data;if(s)for(let h=i-1;h>=0;h--){for(let u=0;u<Ve;u++)this._data[(r+h)*Ve+u]=l[(n+h)*Ve+u];l[(n+h)*Ve+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<i;h++){for(let u=0;u<Ve;u++)this._data[(r+h)*Ve+u]=l[(n+h)*Ve+u];l[(n+h)*Ve+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let c=Object.keys(t._combined);for(let h=0;h<c.length;h++){let u=parseInt(c[h],10);u>=n&&(this._combined[u-n+r]=t._combined[u])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let l=this._data[n*Ve+0],c=l&2097151,h=l&2097152?this._combined[n]:c?fs(c):ps;if(s+=h,i)for(let u=0;u<h.length;++u)i.push(n);n+=l>>22||1}return i&&i.push(n),s}};function w$(e,t,n,r,i,s){let l=[];for(let c=0;c<e.length-1;c++){let h=c,u=e.get(++h);if(!u.isWrapped)continue;let p=[e.get(c)];for(;h<e.length&&u.isWrapped;)p.push(u),u=e.get(++h);if(!s&&r>=c&&r<h){c+=p.length-1;continue}let f=0,v=Da(p,f,t),_=1,x=0;for(;_<p.length;){let k=Da(p,_,t),C=k-x,T=n-v,N=Math.min(C,T);p[f].copyCellsFrom(p[_],x,v,N,!1),v+=N,v===n&&(f++,v=0),x+=N,x===k&&(_++,x=0),v===0&&f!==0&&p[f-1].getWidth(n-1)===2&&(p[f].copyCellsFrom(p[f-1],n-1,v++,1,!1),p[f-1].setCell(n-1,i))}p[f].replaceCells(v,n,i);let S=0;for(let k=p.length-1;k>0&&(k>f||p[k].getTrimmedLength()===0);k--)S++;S>0&&(l.push(c+p.length-S),l.push(S)),c+=p.length-1}return l}function S$(e,t){let n=[],r=0,i=t[r],s=0;for(let l=0;l<e.length;l++)if(i===l){let c=t[++r];e.onDeleteEmitter.fire({index:l-s,amount:c}),l+=c-1,s+=c,i=t[++r]}else n.push(l);return{layout:n,countRemoved:s}}function b$(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function k$(e,t,n){let r=[],i=e.map((h,u)=>Da(e,u,t)).reduce((h,u)=>h+u),s=0,l=0,c=0;for(;c<i;){if(i-c<n){r.push(i-c);break}s+=n;let h=Da(e,l,t);s>h&&(s-=h,l++);let u=e[l].getWidth(s-1)===2;u&&s--;let p=u?n-1:n;r.push(p),c+=p}return r}function Da(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var YC=class XC{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=XC._nextId++,this._onDispose=this.register(new me),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Gs(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};YC._nextId=1;var C$=YC,qt={},Fs=qt.B;qt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};qt.A={"#":"£"};qt.B=void 0;qt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};qt.C=qt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};qt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};qt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};qt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};qt.E=qt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};qt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};qt.H=qt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};qt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Jw=4294967295,Qw=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Bt.clone(),this.savedCharset=Fs,this.markers=[],this._nullCell=xr.fromCharData([0,dC,1,0]),this._whitespaceCell=xr.fromCharData([0,ps,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new bh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Gw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new yh),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new yh),this._whitespaceCell}getBlankLine(e,t){return new ra(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Jw?Jw:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Bt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Gw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Bt),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);let s=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ra(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new ra(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let l=this.lines.length-i;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=w$(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Bt),n);if(r.length>0){let i=S$(this.lines,r);b$(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Bt),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ra(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Bt),i=[],s=0;for(let l=this.lines.length-1;l>=0;l--){let c=this.lines.get(l);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let h=[c];for(;c.isWrapped&&l>0;)c=this.lines.get(--l),h.unshift(c);if(!n){let N=this.ybase+this.y;if(N>=l&&N<l+h.length)continue}let u=h[h.length-1].getTrimmedLength(),p=k$(h,this._cols,e),f=p.length-h.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+f):v=Math.max(0,this.lines.length-this.lines.maxLength+f);let _=[];for(let N=0;N<f;N++){let M=this.getBlankLine(Bt,!0);_.push(M)}_.length>0&&(i.push({start:l+h.length+s,newLines:_}),s+=_.length),h.push(..._);let x=p.length-1,S=p[x];S===0&&(x--,S=p[x]);let k=h.length-f-1,C=u;for(;k>=0;){let N=Math.min(C,S);if(h[x]===void 0)break;if(h[x].copyCellsFrom(h[k],C-N,S-N,N,!0),S-=N,S===0&&(x--,S=p[x]),C-=N,C===0){k--;let M=Math.max(k,0);C=Da(h,M,this._cols)}}for(let N=0;N<h.length;N++)p[N]<e&&h[N].setCell(p[N],r);let T=f-v;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(i.length>0){let l=[],c=[];for(let S=0;S<this.lines.length;S++)c.push(this.lines.get(S));let h=this.lines.length,u=h-1,p=0,f=i[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let v=0;for(let S=Math.min(this.lines.maxLength-1,h+s-1);S>=0;S--)if(f&&f.start>u+v){for(let k=f.newLines.length-1;k>=0;k--)this.lines.set(S--,f.newLines[k]);S++,l.push({index:u+1,amount:f.newLines.length}),v+=f.newLines.length,f=i[++p]}else this.lines.set(S,c[u--]);let _=0;for(let S=l.length-1;S>=0;S--)l[S].index+=_,this.lines.onInsertEmitter.fire(l[S]),_+=l[S].amount;let x=Math.max(0,h+s-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new C$(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},E$=class extends qe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new me),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Qw(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Qw(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ZC=2,GC=1,Gm=class extends qe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new me),this.onResize=this._onResize.event,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ZC),this.rows=Math.max(e.rawOptions.rows||0,GC),this.buffers=this._register(new E$(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;s===n.lines.length-1?l?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=s-i+1;n.lines.shiftElements(i+1,l-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Gm=Tt([Se(0,Mn)],Gm);var Po={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Sh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},N$=["normal","bold","100","200","300","400","500","600","700","800","900"],R$=class extends qe{constructor(e){super(),this._onOptionChange=this._register(new me),this.onOptionChange=this._onOptionChange.event;let t={...Po};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(yt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Po))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Po))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Po[e]),!T$(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Po[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=N$.includes(t)?t:Po[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function T$(e){return e==="block"||e==="underline"||e==="bar"}function ia(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&ia(e[r],t-1);return n}var eS=Object.freeze({insertMode:!1}),tS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Jm=class extends qe{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new me),this.onData=this._onData.event,this._onUserInput=this._register(new me),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new me),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new me),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ia(eS),this.decPrivateModes=ia(tS)}reset(){this.modes=ia(eS),this.decPrivateModes=ia(tS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Jm=Tt([Se(0,An),Se(1,vC),Se(2,Mn)],Jm);var nS={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Dp(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Ap=String.fromCharCode,rS={DEFAULT:e=>{let t=[Dp(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ap(t[0])}${Ap(t[1])}${Ap(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Dp(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Dp(e,!0)};${e.x};${e.y}${t}`}},Qm=class extends qe{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new me),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(nS))this.addProtocol(r,nS[r]);for(let r of Object.keys(rS))this.addEncoding(r,rS[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Qm=Tt([Se(0,An),Se(1,eo),Se(2,Mn)],Qm);var Mp=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],P$=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Ut;function D$(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var A$=class{constructor(){if(this.version="6",!Ut){Ut=new Uint8Array(65536),Ut.fill(1),Ut[0]=0,Ut.fill(0,1,32),Ut.fill(0,127,160),Ut.fill(2,4352,4448),Ut[9001]=2,Ut[9002]=2,Ut.fill(2,11904,42192),Ut[12351]=1,Ut.fill(2,44032,55204),Ut.fill(2,63744,64256),Ut.fill(2,65040,65050),Ut.fill(2,65072,65136),Ut.fill(2,65280,65377),Ut.fill(2,65504,65511);for(let e=0;e<Mp.length;++e)Ut.fill(0,Mp[e][0],Mp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ut[e]:D$(e,P$)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=Hs.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return Hs.createPropertyValue(0,n,r)}},Hs=class Hu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new me,this.onChange=this._onChange.event;let t=new A$;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let l=t.charCodeAt(s);if(55296<=l&&l<=56319){if(++s>=i)return n+this.wcwidth(l);let u=t.charCodeAt(s);56320<=u&&u<=57343?l=(l-55296)*1024+u-56320+65536:n+=this.wcwidth(u)}let c=this.charProperties(l,r),h=Hu.extractWidth(c);Hu.extractShouldJoin(c)&&(h-=Hu.extractWidth(r)),n+=h,r=c}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},M$=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function iS(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Xl=2147483647,L$=256,JC=class eg{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>L$)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new eg;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new eg(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Xl?Xl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Xl?Xl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Xl):t}},Zl=[],O$=class{constructor(){this._state=0,this._active=Zl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Zl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Zl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Zl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Xh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Zl,this._id=-1,this._state=0}}},Jn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Xh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Gl=[],j$=class{constructor(){this._handlers=Object.create(null),this._active=Gl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Gl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Xh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Gl,this._ident=0}},sa=new JC;sa.addParam(0);var sS=class{constructor(e){this._handler=e,this._data="",this._params=sa,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sa,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Xh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=sa,this._data="",this._hitLimit=!1,n));return this._params=sa,this._data="",this._hitLimit=!1,t}},I$=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},_r=160,B$=(function(){let e=new I$(4095),t=Array.apply(null,Array(256)).map((c,h)=>h),n=(c,h)=>t.slice(c,h),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),l;e.setDefault(1,0),e.addMany(r,0,2,0);for(l in s)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(_r,0,2,0),e.add(_r,8,5,8),e.add(_r,6,0,6),e.add(_r,11,0,11),e.add(_r,13,13,13),e})(),z$=class extends qe{constructor(e=B$){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new JC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(yt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new O$),this._dcsParser=this._register(new j$),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,s=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(l=c[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&h>-1){for(;h>=0&&(l=c[h](),l!==!0);h--)if(l instanceof Promise)return this._parseStack.handlerPos=h,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,n),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,n),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=s;c<t;++c){switch(r=e[c],i=this._transitions.table[this.currentState<<8|(r<160?r:_r)],i>>4){case 2:for(let v=c+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<_r){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<_r){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<_r){this._printHandler(e,c,v),c=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<_r){this._printHandler(e,c,v),c=v-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],u=h?h.length-1:-1;for(;u>=0&&(l=h[u](this._params),l!==!0);u--)if(l instanceof Promise)return this._preserveStack(3,h,u,i,c),l;u<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++c<t&&(r=e[c])>47&&r<60);c--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let p=this._escHandlers[this._collect<<8|r],f=p?p.length-1:-1;for(;f>=0&&(l=p[f](),l!==!0);f--)if(l instanceof Promise)return this._preserveStack(4,p,f,i,c),l;f<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let v=c+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<_r){this._dcsParser.put(e,c,v),c=v-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,i,c),l;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let v=c+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<_r){this._oscParser.put(e,c,v),c=v-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,i,c),l;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},F$=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,$$=/^[\da-f]+$/;function oS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=F$.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),$$.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function Lp(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function H$(e,t=16){let[n,r,i]=e;return`rgb:${Lp(n,t)}/${Lp(r,t)}/${Lp(i,t)}`}var W$={"(":0,")":1,"*":2,"+":3,"-":1,".":2},cs=131072,lS=10;function aS(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var cS=5e3,uS=0,U$=class extends qe{constructor(e,t,n,r,i,s,l,c,h=new z$){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=l,this._unicodeService=c,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new cz,this._utf8Decoder=new uz,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Bt.clone(),this._eraseAttrDataInternal=Bt.clone(),this._onRequestBell=this._register(new me),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new me),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new me),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new me),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new me),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new me),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new me),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new me),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new me),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new me),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new me),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new me),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new tg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:p.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,p,f)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:p,data:f})}),this._parser.setDcsHandlerFallback((u,p,f)=>{p==="HOOK"&&(f=f.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:p,payload:f})}),this._parser.setPrintHandler((u,p,f)=>this.print(u,p,f)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(ie.BEL,()=>this.bell()),this._parser.setExecuteHandler(ie.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ie.BS,()=>this.backspace()),this._parser.setExecuteHandler(ie.HT,()=>this.tab()),this._parser.setExecuteHandler(ie.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ie.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Fu.IND,()=>this.index()),this._parser.setExecuteHandler(Fu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Fu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jn(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new Jn(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new Jn(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new Jn(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new Jn(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new Jn(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new Jn(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new Jn(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new Jn(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new Jn(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new Jn(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new Jn(u=>this.restoreCursorColor(u))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let u in qt)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new sS((u,p)=>this.requestStatusString(u,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),cS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${cS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>cs&&(s=this._parseStack.position+cs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(u=>u.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<cs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,cs))),l||this._dirtyRowTracker.clearRange(),e.length>cs)for(let u=s;u<e.length;u+=cs){let p=u+cs<e.length?u+cs:e.length,f=typeof e=="string"?this._stringDecoder.decode(e.substring(u,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,p),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(r,i,f,u),this._logSlowResolvingAsync(n),n}else if(!l){let u=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,i,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let c=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(c,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,c=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,p=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&f.getWidth(this._activeBuffer.x-1)===2&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let v=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&s){let C=s[String.fromCharCode(r)];C&&(r=C.charCodeAt(0))}let x=this._unicodeService.charProperties(r,v);i=Hs.extractWidth(x);let S=Hs.extractShouldJoin(x),k=S?Hs.extractWidth(v):0;if(v=x,l&&this._onA11yChar.fire(fs(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-k>c){if(h){let C=f,T=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&f instanceof ra&&f.copyCellsFrom(C,T,0,k,!1);T<c;)C.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=c-1,i===2)continue}if(S&&this._activeBuffer.x){let C=f.getWidth(this._activeBuffer.x-1)?1:2;f.addCodepointToCell(this._activeBuffer.x-C,r,i);for(let T=i-k;--T>=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(u&&(f.insertCells(this._activeBuffer.x,i-k,this._activeBuffer.getNullCell(p)),f.getWidth(c-1)===2&&f.setCellFromCodepoint(c-1,0,1,p)),f.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=v,this._activeBuffer.x<c&&n-t>0&&f.getWidth(this._activeBuffer.x)===0&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>aS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new sS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Jn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Bt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Hs.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),l=new Uint32Array(s.length*n),c=0;for(let u=0;u<s.length;){let p=s.codePointAt(u)||0;l[c++]=p,u+=p>65535?2:1}let h=c;for(let u=1;u<n;++u)l.copyWithin(h,0,c),h+=c;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ie.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ie.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ie.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ie.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ie.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Fs),this._charsetService.setgCharset(1,Fs),this._charsetService.setgCharset(2,Fs),this._charsetService.setgCharset(3,Fs);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:u,alt:p}=c,f=this._optionsService.rawOptions,v=(S,k)=>(l.triggerDataEvent(`${ie.ESC}[${t?"":"?"}${S};${k}$y`),!0),_=S=>S?1:2,x=e.params[0];return t?x===2?v(x,4):x===4?v(x,_(l.modes.insertMode)):x===12?v(x,3):x===20?v(x,_(f.convertEol)):v(x,0):x===1?v(x,_(r.applicationCursorKeys)):x===3?v(x,f.windowOptions.setWinLines?h===80?2:h===132?1:0:0):x===6?v(x,_(r.origin)):x===7?v(x,_(r.wraparound)):x===8?v(x,3):x===9?v(x,_(i==="X10")):x===12?v(x,_(f.cursorBlink)):x===25?v(x,_(!l.isCursorHidden)):x===45?v(x,_(r.reverseWraparound)):x===66?v(x,_(r.applicationKeypad)):x===67?v(x,4):x===1e3?v(x,_(i==="VT200")):x===1002?v(x,_(i==="DRAG")):x===1003?v(x,_(i==="ANY")):x===1004?v(x,_(r.sendFocus)):x===1005?v(x,4):x===1006?v(x,_(s==="SGR")):x===1015?v(x,4):x===1016?v(x,_(s==="SGR_PIXELS")):x===1048?v(x,1):x===47||x===1047||x===1049?v(x,_(u===p)):x===2004?v(x,_(r.bracketedPasteMode)):x===2026?v(x,_(r.synchronizedOutput)):v(x,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Wa.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let l=e.getSubParams(t+s),c=0;do r[1]===5&&(i=1),r[s+c+1+i]=l[c];while(++c<l.length&&c+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let l=2;l<r.length;++l)r[l]===-1&&(r[l]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Bt.fg,e.bg=Bt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Bt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Bt.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Bt.fg&16777215,r.bg&=-67108864,r.bg|=Bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ie.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Bt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!aS(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ie.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>lS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>lS&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(hS(s))if(i==="?")t.push({type:0,index:s});else{let l=oS(i);l&&t.push({type:1,index:s,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=oS(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);hS(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Fs),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(W$[e[0]],qt[e[1]]||Fs),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Bt.clone(),this._eraseAttrDataInternal=Bt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new xr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=l=>(this._coreService.triggerDataEvent(`${ie.ESC}${l}${ie.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},tg=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(uS=e,e=t,t=uS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};tg=Tt([Se(0,An)],tg);function hS(e){return 0<=e&&e<256}var V$=5e7,dS=12,q$=50,K$=class extends qe{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new me),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>V$)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let l=c=>performance.now()-n>=dS?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(n,c);i.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=dS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>q$&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ng=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let c=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(l,s)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ng=Tt([Se(0,An)],ng);var fS=!1,Y$=class extends qe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new qo),this._onBinary=this._register(new me),this.onBinary=this._onBinary.event,this._onData=this._register(new me),this.onData=this._onData.event,this._onLineFeed=this._register(new me),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new me),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new me),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new me),this._instantiationService=new _$,this.optionsService=this._register(new R$(e)),this._instantiationService.setService(Mn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Gm)),this._instantiationService.setService(An,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Zm)),this._instantiationService.setService(vC,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Jm)),this._instantiationService.setService(eo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Qm)),this._instantiationService.setService(gC,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Hs)),this._instantiationService.setService(pz,this.unicodeService),this._charsetService=this._instantiationService.createInstance(M$),this._instantiationService.setService(fz,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ng),this._instantiationService.setService(_C,this._oscLinkService),this._inputHandler=this._register(new U$(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(an.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(an.forward(this._bufferService.onResize,this._onResize)),this._register(an.forward(this.coreService.onData,this._onData)),this._register(an.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new K$((t,n)=>this._inputHandler.parse(t,n))),this._register(an.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new me),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!fS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fS=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,ZC),t=Math.max(t,GC),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(iS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(iS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=yt(()=>{for(let t of e)t.dispose()})}}},X$={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Z$(e,t,n,r){var l;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=ie.ESC+"OA":i.key=ie.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=ie.ESC+"OD":i.key=ie.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=ie.ESC+"OC":i.key=ie.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=ie.ESC+"OB":i.key=ie.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":ie.DEL,e.altKey&&(i.key=ie.ESC+i.key);break;case 9:if(e.shiftKey){i.key=ie.ESC+"[Z";break}i.key=ie.HT,i.cancel=!0;break;case 13:i.key=e.altKey?ie.ESC+ie.CR:ie.CR,i.cancel=!0;break;case 27:i.key=ie.ESC,e.altKey&&(i.key=ie.ESC+ie.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=ie.ESC+"[1;"+(s+1)+"D":t?i.key=ie.ESC+"OD":i.key=ie.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=ie.ESC+"[1;"+(s+1)+"C":t?i.key=ie.ESC+"OC":i.key=ie.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=ie.ESC+"[1;"+(s+1)+"A":t?i.key=ie.ESC+"OA":i.key=ie.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=ie.ESC+"[1;"+(s+1)+"B":t?i.key=ie.ESC+"OB":i.key=ie.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=ie.ESC+"[2~");break;case 46:s?i.key=ie.ESC+"[3;"+(s+1)+"~":i.key=ie.ESC+"[3~";break;case 36:s?i.key=ie.ESC+"[1;"+(s+1)+"H":t?i.key=ie.ESC+"OH":i.key=ie.ESC+"[H";break;case 35:s?i.key=ie.ESC+"[1;"+(s+1)+"F":t?i.key=ie.ESC+"OF":i.key=ie.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=ie.ESC+"[5;"+(s+1)+"~":i.key=ie.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=ie.ESC+"[6;"+(s+1)+"~":i.key=ie.ESC+"[6~";break;case 112:s?i.key=ie.ESC+"[1;"+(s+1)+"P":i.key=ie.ESC+"OP";break;case 113:s?i.key=ie.ESC+"[1;"+(s+1)+"Q":i.key=ie.ESC+"OQ";break;case 114:s?i.key=ie.ESC+"[1;"+(s+1)+"R":i.key=ie.ESC+"OR";break;case 115:s?i.key=ie.ESC+"[1;"+(s+1)+"S":i.key=ie.ESC+"OS";break;case 116:s?i.key=ie.ESC+"[15;"+(s+1)+"~":i.key=ie.ESC+"[15~";break;case 117:s?i.key=ie.ESC+"[17;"+(s+1)+"~":i.key=ie.ESC+"[17~";break;case 118:s?i.key=ie.ESC+"[18;"+(s+1)+"~":i.key=ie.ESC+"[18~";break;case 119:s?i.key=ie.ESC+"[19;"+(s+1)+"~":i.key=ie.ESC+"[19~";break;case 120:s?i.key=ie.ESC+"[20;"+(s+1)+"~":i.key=ie.ESC+"[20~";break;case 121:s?i.key=ie.ESC+"[21;"+(s+1)+"~":i.key=ie.ESC+"[21~";break;case 122:s?i.key=ie.ESC+"[23;"+(s+1)+"~":i.key=ie.ESC+"[23~";break;case 123:s?i.key=ie.ESC+"[24;"+(s+1)+"~":i.key=ie.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=ie.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=ie.DEL:e.keyCode===219?i.key=ie.ESC:e.keyCode===220?i.key=ie.FS:e.keyCode===221&&(i.key=ie.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let c=(l=X$[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(c)i.key=ie.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,u=String.fromCharCode(h);e.shiftKey&&(u=u.toUpperCase()),i.key=ie.ESC+u}else if(e.keyCode===32)i.key=ie.ESC+(e.ctrlKey?ie.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),i.key=ie.ESC+h,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=ie.US),e.key==="@"&&(i.key=ie.NUL));break}return i}var At=0,G$=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new bh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new bh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(At=this._search(t),At===-1)||this._getKey(this._array[At])!==t)return!1;do if(this._array[At]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(At),!0;while(++At<this._array.length&&this._getKey(this._array[At])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(At=this._search(e),!(At<0||At>=this._array.length)&&this._getKey(this._array[At])===e))do yield this._array[At];while(++At<this._array.length&&this._getKey(this._array[At])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(At=this._search(e),!(At<0||At>=this._array.length)&&this._getKey(this._array[At])===e))do t(this._array[At]);while(++At<this._array.length&&this._getKey(this._array[At])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Op=0,pS=0,J$=class extends qe{constructor(){super(),this._decorations=new G$(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new me),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new me),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(yt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Q$(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Op=i.options.x??0,pS=Op+(i.options.width??1),e>=Op&&e<pS&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},Q$=class extends gs{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new me),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new me),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},e8=1e3,t8=class{constructor(e,t=e8){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},mS=20,kh=class extends qe{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new t8(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
331
+ `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ze(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(yt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<mS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
332
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===mS+1&&(this._liveRegion.textContent+=Sm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),l=[],c=(s==null?void 0:s.translateToString(!0,void 0,void 0,l))||"",h=(n.ydisp+i+1).toString(),u=this._rowElements[i];u&&(c.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=c,this._rowColumns.set(u,l)),u.setAttribute("aria-posinset",h),u.setAttribute("aria-setsize",r),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let l,c;if(t===0?(l=n,c=this._rowElements.pop(),this._rowContainer.removeChild(c)):(l=this._rowElements.shift(),c=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),c.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var c;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((c=r.textContent)==null?void 0:c.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:h,offset:u})=>{let p=h instanceof Text?h.parentNode:h,f=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(f))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(p);if(!v)return console.warn("columns is null. Race condition?"),null;let _=u<v.length?v[u]:v.slice(-1)[0]+1;return _>=this._terminal.cols&&(++f,_=0),{row:f,column:_}},s=i(t),l=i(n);if(!(!s||!l)){if(s.row>l.row||s.row===l.row&&s.column>=l.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(l.row-s.row)*this._terminal.cols-s.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};kh=Tt([Se(1,fv),Se(2,ji),Se(3,Ii)],kh);var rg=class extends qe{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new me),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new me),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(yt(()=>{var s;Gs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ze(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ze(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ze(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ze(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,l]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):l.provideLinks(e.y,c=>{var u,p;if(this._isMouseOut)return;let h=c==null?void 0:c.map(f=>({link:f}));(u=this._activeProviderReplies)==null||u.set(s,h),n=this._checkLinkProviderResult(s,e,n),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let l=i[s],c=l.link.range.start.y<e?0:l.link.range.start.x,h=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let u=c;u<=h;u++){if(n.has(u)){i.splice(s--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(i=!0);if(!i&&r){let l=r.find(c=>this._linkAtPosition(c.link,t));l&&(n=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let l=0;l<this._activeProviderReplies.size;l++){let c=(s=this._activeProviderReplies.get(l))==null?void 0:s.find(h=>this._linkAtPosition(h.link,t));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&n8(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Gs(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};rg=Tt([Se(1,pv),Se(2,Ii),Se(3,An),Se(4,xC)],rg);function n8(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var r8=class extends Y${constructor(e={}){super(e),this._linkifier=this._register(new qo),this.browser=zC,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new qo),this._onCursorMove=this._register(new me),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new me),this.onKey=this._onKey.event,this._onRender=this._register(new me),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new me),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new me),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new me),this.onBell=this._onBell.event,this._onFocus=this._register(new me),this._onBlur=this._register(new me),this._onA11yCharEmitter=this._register(new me),this._onA11yTabEmitter=this._register(new me),this._onWillOpen=this._register(new me),this._setup(),this._decorationService=this._instantiationService.createInstance(J$),this._instantiationService.setService(Ua,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(qF),this._instantiationService.setService(xC,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(km)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(an.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(an.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(an.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(an.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(yt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=gt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ie.ESC}]${r};${H$(i)}${IC.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Ft.toColor(...t.color));else{let s=n;this._themeService.modifyColors(l=>l[s]=Ft.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(kh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ze(this.element,"copy",t=>{this.hasSelection()&&lz(t,this._selectionService)}));let e=t=>az(t,this.textarea,this.coreService,this.optionsService);this._register(ze(this.textarea,"paste",e)),this._register(ze(this.element,"paste",e)),FC?this._register(ze(this.element,"mousedown",t=>{t.button===2&&Cw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ze(this.element,"contextmenu",t=>{Cw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Sv&&this._register(ze(this.element,"auxclick",t=>{t.button===1&&hC(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ze(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ze(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ze(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ze(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ze(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ze(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ze(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(ze(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",wm.get()),WC||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(UF,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ji,this._coreBrowserService),this._register(ze(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(ze(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Vm,this._document,this._helperContainer),this._instantiationService.setService(Zh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Xm),this._instantiationService.setService(el,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(wh),this._instantiationService.setService(yC,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Km,this.rows,this.screenElement)),this._instantiationService.setService(Ii,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Hm,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(qm),this._instantiationService.setService(pv,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rg,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Fm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ym,this.element,this.screenElement,r)),this._instantiationService.setService(gz,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(an.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance($m,this.screenElement)),this._register(ze(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(kh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Um,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var u,p,f,v,_;let l=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!l)return!1;let c,h;switch(s.overrideType||s.type){case"mousemove":h=32,s.buttons===void 0?(c=3,s.button!==void 0&&(c=s.button<3?s.button:3)):c=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":h=0,c=s.button<3?s.button:3;break;case"mousedown":h=1,c=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let x=s.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(s,(v=(f=(p=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:p.device)==null?void 0:f.cell)==null?void 0:v.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return!1;h=x<0?0:1,c=4;break;default:return!1}return h===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:h,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ze(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(ze(t,"wheel",s=>{var l,c,h,u,p;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(u=(h=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:h.cell)==null?void 0:u.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(s,!0);let f=ie.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(f,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){uC(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=Z$(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ie.ETX||n.key===ie.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(i8(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Bt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ie.ESC+"[I"):this.coreService.triggerDataEvent(ie.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function i8(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var s8=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},o8=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new xr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},gS=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new o8(t)}getNullCell(){return new xr}},l8=class extends qe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new me),this.onBufferChange=this._onBufferChange.event,this._normal=new gS(this._core.buffers.normal,"normal"),this._alternate=new gS(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},a8=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},c8=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},u8=["cols","rows"],Zr=0,h8=class extends qe{constructor(e){super(),this._core=this._register(new r8(e)),this._addonManager=this._register(new s8),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(u8.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new a8(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c8(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new l8(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
333
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return wm.get()},set promptLabel(e){wm.set(e)},get tooMuchOutput(){return Sm.get()},set tooMuchOutput(e){Sm.set(e)}}}_verifyIntegers(...e){for(Zr of e)if(Zr===1/0||isNaN(Zr)||Zr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Zr of e)if(Zr&&(Zr===1/0||isNaN(Zr)||Zr%1!==0||Zr<0))throw new Error("This API only accepts positive integers")}};/**
334
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
335
+ * @license MIT
336
+ *
337
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
338
+ * @license MIT
339
+ *
340
+ * Originally forked from (with the author's permission):
341
+ * Fabrice Bellard's javascript vt100 for jslinux:
342
+ * http://bellard.org/jslinux/
343
+ * Copyright (c) 2011 Fabrice Bellard
344
+ */var d8=2,f8=1,p8=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var f;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((f=this._terminal.options.overviewRuler)==null?void 0:f.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),l={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},c=l.top+l.bottom,h=l.right+l.left,u=r-c,p=i-h-t;return{cols:Math.max(d8,Math.floor(p/e.css.cell.width)),rows:Math.max(f8,Math.floor(u/e.css.cell.height))}}};const QC=b.forwardRef(function({className:t,onReady:n},r){const i=b.useRef(null),s=b.useRef(null),l=b.useRef(!0),c=b.useRef(null);return b.useEffect(()=>{const h=i.current;if(!h)return;const u=new h8({convertEol:!0,disableStdin:!0,cursorInactiveStyle:"none",fontSize:11,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",scrollback:1e4,theme:{background:"#0b0d12",foreground:"#d6d9e3",cursor:"#0b0d12"}}),p=new p8;u.loadAddon(p),u.open(h),s.current=u;const f=()=>{try{p.fit()}catch{}};f();const v=new ResizeObserver(f);v.observe(h);const _=u.onScroll(S=>{l.current=S>=u.buffer.active.baseY-1}),x={write:S=>u.write(S,()=>{l.current&&u.scrollToBottom()}),clear:()=>u.clear()};return c.current=x,n==null||n(x),()=>{_.dispose(),v.disconnect(),u.dispose(),s.current=null,c.current=null}},[]),b.useImperativeHandle(r,()=>({write:h=>{var u;return(u=c.current)==null?void 0:u.write(h)},clear:()=>{var h;return(h=c.current)==null?void 0:h.clear()}})),g.jsx("div",{ref:i,className:t})});function m8({taskId:e}){const[t,n]=b.useState(""),[r,i]=b.useState(!1),[s,l]=b.useState(!1),c=b.useRef(null),h=b.useRef(""),u=v=>{var _;h.current=(h.current+v).slice(-2e5),(_=c.current)==null||_.write(v)};b.useEffect(()=>{const v=Eh(x=>{x.kind==="exec_output"&&x.taskId===e?u(x.data):x.kind==="exec_exit"&&x.taskId===e&&(l(!1),u(`\r
345
+ [exited ${x.code}]\r
346
+ `))}),_=Nh(()=>l(!1));return()=>{v(),_()}},[e]),b.useEffect(()=>{var v;n(""),i(!1),l(!1),h.current="",(v=c.current)==null||v.clear()},[e]);function p(){const v=t.trim();!v||s||(i(!0),l(!0),n(""),u(`$ ${v}\r
347
+ `),Ti({kind:"run_command",taskId:e,command:v}))}function f(){l(!1),Ti({kind:"kill_command",taskId:e})}return g.jsxs(nz,{title:"Run a command",badge:s?g.jsx("span",{className:"text-amber-300",children:"· running…"}):void 0,children:[r&&g.jsx(QC,{ref:c,onReady:v=>{h.current&&v.write(h.current)},className:"h-48 w-full rounded bg-[#0b0d12] p-1"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{className:"flex-1 rounded bg-ink-700 px-2 py-1 font-mono outline-none",placeholder:"e.g. git status, pnpm test…",value:t,onChange:v=>n(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),p())}}),s?g.jsx("button",{onClick:f,className:"rounded bg-red-700 px-3 hover:bg-red-600",children:"Stop"}):g.jsx("button",{onClick:p,className:"rounded bg-indigo-600 px-3 hover:bg-indigo-500",children:"Run"})]})]})}function g8({projectId:e,taskId:t}){return g.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[g.jsx(v8,{projectId:e,taskId:t}),g.jsx(x8,{projectId:e,taskId:t}),g.jsx(b8,{projectId:e,taskId:t})]})}function bv(e,t){const[n,r]=b.useState(null),[i,s]=b.useState(!1);return b.useEffect(()=>{let l=!0;return r(null),s(!1),e().then(c=>l&&r(c),()=>l&&s(!0)),()=>{l=!1}},t),{data:n,error:i}}function kv({title:e,badge:t,children:n}){return g.jsxs("section",{className:"border-b border-ink-600 px-3 py-3",children:[g.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-ink-400",children:[g.jsx("span",{children:e}),t!=null&&g.jsx("span",{className:"font-normal normal-case text-ink-500",children:t})]}),n]})}function rr({children:e}){return g.jsx("div",{className:"px-0.5 py-1 text-xs text-ink-500",children:e})}function v8({projectId:e,taskId:t}){const{data:n,error:r}=bv(()=>ke.getTask(e,t),[e,t]);return g.jsx(kv,{title:"Description",children:r?g.jsx(rr,{children:"Failed to load."}):n==null?g.jsx(rr,{children:"Loading…"}):n.body.trim()?g.jsx("div",{className:"text-sm",children:g.jsx(xm,{text:n.body})}):g.jsx(rr,{children:"No description yet."})})}const _8={added:"text-emerald-400",modified:"text-amber-300",deleted:"text-red-400",renamed:"text-indigo-300"},y8={added:"A",modified:"M",deleted:"D",renamed:"R"};function x8({projectId:e,taskId:t}){const{data:n,error:r}=bv(()=>ke.getTaskChanges(e,t),[e,t]),i=ue(c=>{var h,u;return(u=(h=c.board)==null?void 0:h.tasks.find(p=>p.id===t))==null?void 0:u.mergedCommit}),s=(n==null?void 0:n.files)??null,l=s?s.reduce((c,h)=>({add:c.add+h.additions,del:c.del+h.deletions}),{add:0,del:0}):null;return g.jsxs(kv,{title:"Changes",badge:r||!s?void 0:s.length===0?"none":`${s.length} file${s.length===1?"":"s"} · +${l.add} −${l.del}`,children:[i&&g.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs",children:[g.jsx("span",{className:"text-ink-500",children:"Merged as"}),g.jsx("span",{className:"font-mono text-indigo-300",title:i,children:i.slice(0,7)})]}),r?g.jsx(rr,{children:"Failed to load changes."}):s?s.length===0?g.jsx(rr,{children:i?"Worktree merged and cleaned up.":"No file changes vs trunk."}):g.jsx("div",{className:"space-y-0.5",children:s.map(c=>g.jsx(w8,{projectId:e,taskId:t,file:c},c.path))}):g.jsx(rr,{children:"Loading…"})]})}function w8({projectId:e,taskId:t,file:n}){const[r,i]=b.useState(!1),[s,l]=b.useState(null),[c,h]=b.useState(!1);function u(){const p=!r;i(p),p&&s==null&&!c&&!n.binary&&ke.getTaskFileDiff(e,t,n.path).then(f=>l(f.patch),()=>h(!0))}return g.jsxs("div",{children:[g.jsxs("button",{onClick:u,className:"flex w-full items-center gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-ink-800",children:[g.jsx("span",{className:"text-[11px] text-ink-500",children:r?"▾":"▸"}),g.jsx("span",{className:`w-3 font-mono ${_8[n.status]}`,children:y8[n.status]}),g.jsx("span",{className:"flex-1 truncate font-mono text-ink-200",children:n.path}),n.binary?g.jsx("span",{className:"text-ink-500",children:"bin"}):g.jsxs("span",{className:"font-mono text-[12px]",children:[g.jsxs("span",{className:"text-emerald-400",children:["+",n.additions]})," ",g.jsxs("span",{className:"text-red-400",children:["−",n.deletions]})]})]}),r&&g.jsx("div",{className:"my-1 overflow-x-auto rounded border border-ink-600 bg-ink-900",children:n.binary?g.jsx(rr,{children:"Binary file."}):c?g.jsx(rr,{children:"Failed to load diff."}):s==null?g.jsx(rr,{children:"Loading…"}):s.trim()?g.jsx(S8,{patch:s}):g.jsx(rr,{children:"New file (no diff against trunk)."})})]})}function S8({patch:e}){return g.jsx("pre",{className:"px-2 py-1.5 font-mono text-[12px] leading-snug",children:e.split(`
348
+ `).map((t,n)=>{let r="text-ink-300";return t.startsWith("+")&&!t.startsWith("+++")?r="text-emerald-300":t.startsWith("-")&&!t.startsWith("---")?r="text-red-300":t.startsWith("@@")?r="text-indigo-300":(t.startsWith("diff ")||t.startsWith("index "))&&(r="text-ink-500"),g.jsx("div",{className:r,children:t||" "},n)})})}function b8({projectId:e,taskId:t}){const{data:n,error:r}=bv(()=>ke.getTaskMedia(e,t),[e,t]),i=(n==null?void 0:n.items)??null,[s,l]=b.useState(null);return b.useEffect(()=>{if(!s)return;const c=h=>h.key==="Escape"&&l(null);return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),g.jsxs(kv,{title:"Media",badge:r||!i?void 0:String(i.length),children:[r?g.jsx(rr,{children:"Failed to load media."}):i?i.length===0?g.jsx(rr,{children:"No images yet."}):g.jsx("div",{className:"grid grid-cols-3 gap-2",children:i.map(c=>g.jsxs("button",{onClick:()=>l(c),title:c.name,className:"group relative aspect-square overflow-hidden rounded border border-ink-600 bg-ink-900",children:[g.jsx("img",{src:c.url,alt:c.name,loading:"lazy",className:"h-full w-full object-cover"}),g.jsx("span",{className:"absolute bottom-0 left-0 rounded-tr bg-ink-900/80 px-1 text-[10px] uppercase text-ink-300",children:c.source})]},c.url))}):g.jsx(rr,{children:"Loading…"}),s&&g.jsx("div",{onClick:()=>l(null),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-6",children:g.jsxs("div",{className:"flex max-h-full max-w-full flex-col items-center gap-2",children:[g.jsx("img",{src:s.url,alt:s.name,className:"max-h-[85vh] max-w-full rounded"}),g.jsx("div",{className:"font-mono text-xs text-ink-300",children:s.name})]})})]})}function eE({tabs:e,activeId:t,onSelect:n,onClose:r,onRename:i,onReorder:s,onNew:l}){const[c,h]=b.useState(null),[u,p]=b.useState(""),f=b.useRef(null),v=Dg(Uo(jg,{activationConstraint:{distance:5}}),Uo(zh,{activationConstraint:{delay:200,tolerance:8}}));b.useEffect(()=>{var C;c&&((C=f.current)==null||C.select())},[c]);function _(C){C.renamable&&(p(C.label),h(C.id))}function x(){c&&u.trim()&&(i==null||i(c,u.trim())),h(null)}const S=e.filter(C=>C.reorderable).map(C=>C.id);function k(C){const{active:T,over:N}=C;if(!N||T.id===N.id||!s)return;const M=S.indexOf(String(T.id)),B=S.indexOf(String(N.id));M<0||B<0||s(hv(S,M,B))}return g.jsx(Bg,{sensors:v,collisionDetection:f1,modifiers:[X6,aC],onDragEnd:k,children:g.jsx(sC,{items:S,strategy:F6,children:g.jsxs("div",{className:"flex shrink-0 gap-1 overflow-x-auto overflow-y-hidden border-b border-ink-600 px-2 pt-1.5 text-xs",children:[e.map(C=>g.jsx(k8,{tab:C,active:C.id===t,editing:c===C.id,draggable:!!C.reorderable&&!!s,draft:u,inputRef:f,onSelect:n,onStartEdit:_,onClose:r,onDraftChange:p,onCommit:x,onCancel:()=>h(null)},C.id)),l&&g.jsx("button",{onClick:l,"aria-label":"New session",title:"New session (⌘T)",className:"-mb-px flex shrink-0 items-center rounded-t border-b-2 border-transparent px-2 py-1.5 text-base leading-none text-ink-500 hover:text-ink-100",children:"+"})]})})})}function k8({tab:e,active:t,editing:n,draggable:r,draft:i,inputRef:s,onSelect:l,onStartEdit:c,onClose:h,onDraftChange:u,onCommit:p,onCancel:f}){const{attributes:v,listeners:_,setNodeRef:x,transform:S,transition:k,isDragging:C}=lC({id:e.id,disabled:!r||n});return g.jsxs("div",{ref:x,style:r?{transform:Ai.Transform.toString(S),transition:k}:void 0,...r&&!n?v:{},...r&&!n?_:{},onClick:n?void 0:()=>l(e.id),onDoubleClick:n?void 0:()=>c(e),title:e.renamable?"Double-click to rename":void 0,className:`-mb-px flex shrink-0 touch-none select-none items-center gap-1.5 rounded-t border-b-2 px-3 py-1.5 ${t?"border-indigo-500 text-white":"border-transparent text-ink-400 hover:text-ink-200"} ${C?"opacity-40":""} ${r&&!n?"cursor-grab active:cursor-grabbing":"cursor-pointer"}`,children:[e.dot&&g.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${e.dot} ${e.pulse?"animate-pulse":""}`}),n?g.jsx("input",{ref:s,value:i,onChange:T=>u(T.target.value),onClick:T=>T.stopPropagation(),onBlur:p,onKeyDown:T=>{T.key==="Enter"?p():T.key==="Escape"&&f()},className:"w-24 rounded bg-ink-700 px-1 text-white outline-none"}):g.jsx("span",{className:`max-w-[10rem] truncate ${e.tint??""}`,children:e.label}),e.closable&&h&&!n&&g.jsx("button",{onClick:T=>{T.stopPropagation(),h(e.id)},onPointerDown:T=>T.stopPropagation(),"aria-label":"Close run (stops it)",title:"Close — stops the run",className:"shrink-0 rounded px-0.5 leading-none text-ink-500 hover:text-ink-100",children:"×"})]})}function C8({taskId:e,runId:t}){const n=b.useRef(null);return b.useEffect(()=>{const r=Eh(i=>{var s,l,c;i.kind==="run_history"&&i.runId===t?((s=n.current)==null||s.clear(),(l=n.current)==null||l.write(i.log)):i.kind==="run_log"&&i.runId===t&&((c=n.current)==null||c.write(i.chunk))});return WR(e,t),()=>{r(),UR(e,t)}},[e,t]),g.jsx(QC,{ref:n,className:"h-full w-full bg-[#0b0d12] p-1"})}const E8={queued:"bg-amber-400",starting:"bg-emerald-400",running:"bg-emerald-400",exited:"bg-ink-400",failed:"bg-red-400",stopped:"bg-ink-500",orphaned:"bg-amber-400"},N8=e=>e==="running"||e==="starting";function R8({run:e,projectId:t,taskId:n}){const[r,i]=b.useState(""),[s,l]=b.useState(!1),[c,h]=b.useState(!1),u=N8(e.status),p=e.status==="queued",f=async _=>{h(!0);try{await _()}catch{}finally{h(!1)}},v=async()=>{const _=r.trim();_&&(await f(()=>ke.sendRunFeedback(t,n,e.id,_)),i(""),l(!1))};return g.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[g.jsxs("div",{className:"shrink-0 border-b border-ink-700 px-3 py-2",children:[g.jsx("div",{className:"break-all font-mono text-[10px] text-ink-500",title:e.command,children:e.command}),p&&g.jsx("div",{className:"mt-1.5 rounded bg-amber-950/40 px-2 py-1 text-[11px] text-amber-300",children:"⏳ Queued — waiting for free system memory before this test run starts."}),g.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5 text-[11px]",children:[(u||p)&&g.jsx("button",{disabled:c,onClick:()=>f(()=>ke.stopRun(t,n,e.id)),className:"rounded bg-ink-700 px-1.5 py-0.5 text-ink-200 hover:bg-ink-600 disabled:opacity-50",children:p?"Cancel":"Stop"}),e.url&&g.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded bg-indigo-900/50 px-1.5 py-0.5 text-indigo-300 hover:bg-indigo-800/60",children:["↗ Open ",e.url.replace(/^https?:\/\//,"")]}),g.jsx("button",{disabled:c,onClick:()=>f(()=>ke.restartRun(t,n,e.id)),className:"rounded bg-ink-700 px-1.5 py-0.5 text-ink-200 hover:bg-ink-600 disabled:opacity-50",children:"Restart"}),g.jsx("button",{onClick:()=>l(_=>!_),className:"rounded bg-ink-700 px-1.5 py-0.5 text-ink-200 hover:bg-ink-600",children:"💬 Feedback"})]}),s&&g.jsxs("div",{className:"mt-1.5",children:[g.jsx("textarea",{value:r,onChange:_=>i(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.metaKey||_.ctrlKey)&&v()},placeholder:"What did you try? What should change? (⌘↵ to send to the agent)",className:"h-16 w-full resize-none rounded border border-ink-600 bg-ink-900 px-2 py-1 text-xs outline-none focus:border-indigo-500"}),g.jsx("div",{className:"mt-1 flex justify-end",children:g.jsx("button",{disabled:c||!r.trim(),onClick:()=>void v(),className:"rounded bg-indigo-600 px-2 py-0.5 text-xs hover:bg-indigo-500 disabled:opacity-50",children:"Send → agent"})})]})]}),g.jsx("div",{className:"min-h-0 flex-1",children:g.jsx(C8,{taskId:n,runId:e.id},e.id)})]})}const vS="operator:panelWidth",T8=380,P8=1100,_S=560,yS=e=>Math.max(T8,Math.min(P8,e));function tE(){const[e,t]=b.useState(()=>{try{const r=parseInt(localStorage.getItem(vS)||"",10);return Number.isFinite(r)?yS(r):_S}catch{return _S}}),n=b.useCallback(r=>{const i=yS(r);t(i);try{localStorage.setItem(vS,String(i))}catch{}},[]);return[e,n]}function nE({onResize:e}){function t(n){n.preventDefault();const r=s=>e(window.innerWidth-s.clientX),i=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i),document.body.style.cursor="",document.body.style.userSelect=""};window.addEventListener("pointermove",r),window.addEventListener("pointerup",i),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}return g.jsx("div",{onPointerDown:t,role:"separator","aria-orientation":"vertical",title:"Drag to resize",className:"group absolute left-0 top-0 z-20 hidden h-full w-2 -translate-x-1/2 cursor-col-resize md:block",children:g.jsx("div",{className:"mx-auto h-full w-0.5 transition-colors group-hover:bg-indigo-500/60"})})}function D8(e,t){const n=e.trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function A8({taskId:e}){const t=ue(z=>z.board),n=ue(z=>z.project),r=ue(z=>z.select),i=ue(z=>z.codeServerOpen),s=ue(z=>z.setCodeServerOpen),l=ue(z=>z.agents[e]),c=ue(z=>z.agents),h=t==null?void 0:t.tasks.find(z=>z.id===e),u=(h==null?void 0:h.runs)??[],p=(h==null?void 0:h.forks)??[],[f,v]=b.useState(()=>h?xS(h):"session"),[_,x]=b.useState(()=>dh(e)),[S,k]=b.useState(!1),[C,T]=tE();b.useEffect(()=>{wa(e)},[e]);const N=b.useRef(h?e:null);b.useEffect(()=>{h&&N.current!==e&&(N.current=e,v(xS(h)),x(dh(e)))},[h,e]),b.useEffect(()=>{h&&V1(e,f)},[f,e,h]);const M=p.map(z=>z.key).join(",");if(b.useEffect(()=>{for(const z of M?M.split(","):[])wa(z)},[M]),b.useEffect(()=>{const z=()=>{const{project:I}=ue.getState();if(!I)return;const re=p.some(P=>P.key===f)?f:void 0;ke.newSession(I.id,e,re).then(P=>v(P.fork.key)).catch(()=>{})},J=I=>{(I.metaKey||I.ctrlKey)&&!I.shiftKey&&!I.altKey&&(I.key==="t"||I.key==="T")&&(I.preventDefault(),z())};return window.addEventListener("keydown",J),window.addEventListener("operator:new-session",z),()=>{window.removeEventListener("keydown",J),window.removeEventListener("operator:new-session",z)}},[e,f,M]),b.useEffect(()=>{f!=="session"&&f!=="detail"&&!u.some(z=>z.id===f)&&!p.some(z=>z.key===f)&&v("session")},[u,p,f]),!h||!n)return null;const B=(z,J)=>{const I=Rh(c[z]);if(!I)return{};const re=J===void 0?M8:Eu[J%Eu.length];return I==="thinking"?{dot:re.thinking,pulse:!0}:{dot:re.input}},A=[...p.map((z,J)=>({id:z.key,label:z.label,closable:!0,renamable:!0,reorderable:!0,tint:Eu[J%Eu.length].tint,...B(z.key,J)})),...u.map(z=>({id:z.id,label:z.name,closable:!0,renamable:!0,reorderable:!0,dot:E8[z.status],pulse:z.status==="running"}))],D=new Map(_.map((z,J)=>[z,J]));A.sort((z,J)=>(D.get(z.id)??1/0)-(D.get(J.id)??1/0));const $=[{id:"session",label:"Session",...B(e)},{id:"detail",label:"Detail"},...A],j=u.find(z=>z.id===f),R=p.find(z=>z.key===f),U=z=>{f===z&&v("session"),p.some(J=>J.key===z)?ke.closeFork(n.id,e,z).catch(()=>{}):ke.removeRun(n.id,e,z).catch(()=>{})},V=(z,J)=>{p.some(I=>I.key===z)?ke.renameFork(n.id,e,z,J).catch(()=>{}):ke.renameRun(n.id,e,z,J).catch(()=>{})},Y=z=>{x(z),K1(e,z)},W=(z,J)=>ke.forkSession(n.id,e,z===e?void 0:z,J||void 0).then(I=>v(I.fork.key)),q=()=>ke.newSession(n.id,e,R==null?void 0:R.key).then(z=>v(z.fork.key)).catch(()=>{});return g.jsxs("aside",{style:{"--panel-w":`${C}px`},className:"fixed inset-0 z-40 flex flex-col bg-ink-900 md:relative md:z-auto md:w-[var(--panel-w,560px)] md:shrink-0 md:border-l md:border-ink-600",children:[g.jsx(nE,{onResize:T}),g.jsxs("div",{className:"flex items-start gap-2 border-b border-ink-600 px-3 py-2.5 pt-safe md:pt-2.5",children:[g.jsx("button",{onClick:()=>r(void 0),"aria-label":"Back",className:"-ml-1 rounded p-1.5 text-ink-300 hover:text-white md:hidden",children:g.jsx(lA,{size:22})}),g.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[g.jsx("div",{className:"font-semibold [overflow-wrap:anywhere]",children:h.title||D8(h.shortDescription,140)||"Untitled"}),g.jsxs("div",{className:"text-xs text-ink-400",children:[h.status,l!=null&&l.status&&l.status!=="none"?` · ${l.status}`:""]})]}),h.worktree&&g.jsx("button",{onClick:()=>s(!i),"aria-label":"Open in VS Code","aria-pressed":i,title:i?"Close VS Code":"Open in VS Code",className:`hidden rounded p-1.5 hover:text-white md:block ${i?"text-indigo-400":"text-ink-400"}`,children:g.jsx(hA,{size:18})}),(h.worktree||h.sessionId)&&g.jsx(L8,{task:h}),g.jsx("button",{onClick:()=>k(z=>!z),"aria-label":"Session settings","aria-expanded":S,title:"Toggle session settings",className:`rounded p-1.5 hover:text-white ${S?"text-indigo-400":"text-ink-400"}`,children:g.jsx(KA,{size:18})}),g.jsx("button",{onClick:()=>r(void 0),"aria-label":"Close",className:"hidden rounded px-2 py-1 text-ink-400 hover:text-white md:block",children:"✕"})]}),g.jsx(eE,{tabs:$,activeId:f,onSelect:v,onClose:U,onRename:V,onReorder:Y,onNew:q}),f==="session"?g.jsxs(g.Fragment,{children:[S&&g.jsx(fh,{task:h}),g.jsx(_h,{taskId:e,projectId:n.id,emptyHint:"No agent activity yet. Move this task into an automated lane, or send a message.",onSend:z=>ke.sendMessage(n.id,e,z),onFork:z=>W(e,z)}),g.jsx(m8,{taskId:e})]}):f==="detail"?g.jsx(g8,{projectId:n.id,taskId:e}):R?g.jsxs(g.Fragment,{children:[S&&g.jsx(fh,{task:h,fork:R}),g.jsx(_h,{taskId:R.key,projectId:n.id,emptyHint:"Forked session — send a message to continue from the copied context.",onSend:z=>ke.sendForkMessage(n.id,e,R.key,z),onFork:z=>W(R.key,z)},R.key)]}):j?g.jsx(R8,{run:j,projectId:n.id,taskId:e}):null]})}const M8={thinking:"bg-emerald-400",input:"bg-amber-400"},Eu=[{thinking:"bg-cyan-400",input:"bg-orange-400",tint:"text-cyan-300"},{thinking:"bg-violet-400",input:"bg-rose-400",tint:"text-violet-300"},{thinking:"bg-sky-400",input:"bg-fuchsia-400",tint:"text-sky-300"},{thinking:"bg-teal-400",input:"bg-pink-400",tint:"text-teal-300"},{thinking:"bg-lime-400",input:"bg-purple-400",tint:"text-lime-300"}];function xS(e){const{agents:t}=ue.getState();return EL(e,n=>Rh(t[n]),U1(e.id))}function L8({task:e}){const[t,n]=b.useState(!1);return g.jsxs("div",{className:"relative hidden md:block",children:[g.jsx("button",{onClick:()=>n(r=>!r),"aria-label":"Take over in a terminal",title:"Take over in a terminal",className:`rounded p-1.5 hover:text-white ${t?"text-indigo-400":"text-ink-400"}`,children:g.jsx(GA,{size:18})}),t&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>n(!1)}),g.jsxs("div",{className:"absolute right-0 z-20 mt-1 w-72 space-y-1.5 rounded-lg border border-ink-600 bg-ink-900 p-2 text-xs shadow-xl",children:[g.jsx("div",{className:"px-0.5 text-[11px] text-ink-400",children:"Take over in a terminal"}),e.worktree&&g.jsx(wS,{label:"Worktree",value:`cd ${e.worktree}`}),e.sessionId?g.jsx(wS,{label:"Resume",value:`claude --resume ${e.sessionId}`}):g.jsx("div",{className:"px-0.5 text-ink-500",children:"No agent session yet — send a message to start one."})]})]})]})}function wS({label:e,value:t}){const[n,r]=b.useState(!1);return g.jsxs("button",{onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1200)},()=>{})},title:`Copy: ${t}`,className:"flex w-full items-center justify-between gap-2 rounded bg-ink-800 px-2 py-1.5 text-left hover:bg-ink-700",children:[g.jsx("span",{children:e}),n?g.jsx(sA,{size:14,className:"shrink-0 text-emerald-400"}):g.jsx(fA,{size:14,className:"shrink-0 text-ink-200"})]})}const O8={thinking:"bg-emerald-400",input:"bg-amber-400"},Nu=[{thinking:"bg-cyan-400",input:"bg-orange-400",tint:"text-cyan-300"},{thinking:"bg-violet-400",input:"bg-rose-400",tint:"text-violet-300"},{thinking:"bg-sky-400",input:"bg-fuchsia-400",tint:"text-sky-300"},{thinking:"bg-teal-400",input:"bg-pink-400",tint:"text-teal-300"},{thinking:"bg-lime-400",input:"bg-purple-400",tint:"text-lime-300"}];function j8(){const e=ue(R=>R.project),t=ue(R=>R.setOrchestratorOpen),n=ue(R=>R.agents),r=e?IS(e.id):"",i=ue(R=>R.agents[r]),[s,l]=tE(),c=(e==null?void 0:e.orchestratorForks)??[],[h,u]=b.useState("session"),[p,f]=b.useState(!1),[v,_]=b.useState(()=>r?dh(r):[]);b.useEffect(()=>{r&&(wa(r),_(dh(r)))},[r]);const x=c.map(R=>R.key).join(",");if(b.useEffect(()=>{for(const R of x?x.split(","):[])wa(R)},[x]),b.useEffect(()=>{r&&V1(r,h)},[h,r]),b.useEffect(()=>{if(!r)return;const R=U1(r);R&&(R==="session"||c.some(U=>U.key===R))&&u(R)},[r]),b.useEffect(()=>{const R=()=>{const{project:V}=ue.getState();if(!V)return;const Y=c.some(W=>W.key===h)?h:void 0;ke.newOrchestratorSession(V.id,Y).then(W=>u(W.fork.key)).catch(()=>{})},U=V=>{(V.metaKey||V.ctrlKey)&&!V.shiftKey&&!V.altKey&&(V.key==="t"||V.key==="T")&&(V.preventDefault(),R())};return window.addEventListener("keydown",U),window.addEventListener("operator:new-session",R),()=>{window.removeEventListener("keydown",U),window.removeEventListener("operator:new-session",R)}},[h,x]),b.useEffect(()=>{h!=="session"&&!c.some(R=>R.key===h)&&u("session")},[x,h]),!e)return null;const S=(R,U)=>{const V=Rh(n[R]);if(!V)return{};const Y=U===void 0?O8:Nu[U%Nu.length];return V==="thinking"?{dot:Y.thinking,pulse:!0}:{dot:Y.input}},k={id:r,title:"Orchestrator",shortDescription:"",status:"backlog",order:0,hasDoc:!0,model:e.orchestratorModel??"claude-opus-4-8",effort:e.orchestratorEffort,permissionMode:e.orchestratorPermissionMode??"default",createdAt:""},C=c.map((R,U)=>({id:R.key,label:R.label,closable:!0,renamable:!0,reorderable:!0,tint:Nu[U%Nu.length].tint,...S(R.key,U)})),T=new Map(v.map((R,U)=>[R,U]));C.sort((R,U)=>(T.get(R.id)??1/0)-(T.get(U.id)??1/0));const N=[{id:"session",label:"Main",...S(r)},...C],M=c.find(R=>R.key===h),B=R=>{h===R&&u("session"),ke.closeOrchestratorFork(e.id,R).catch(()=>{})},A=(R,U)=>ke.renameOrchestratorFork(e.id,R,U).catch(()=>{}),D=R=>{_(R),K1(r,R)},$=(R,U)=>ke.forkOrchestrator(e.id,R===r?void 0:R,U||void 0).then(V=>u(V.fork.key)),j=()=>ke.newOrchestratorSession(e.id,M==null?void 0:M.key).then(R=>u(R.fork.key)).catch(()=>{});return g.jsxs("aside",{style:{"--panel-w":`${s}px`},className:"fixed inset-0 z-40 flex flex-col bg-ink-900 md:relative md:z-auto md:w-[var(--panel-w,560px)] md:shrink-0 md:border-l md:border-ink-600",children:[g.jsx(nE,{onResize:l}),g.jsxs("div",{className:"flex items-center gap-2 border-b border-ink-600 px-3 py-2.5 pt-safe md:pt-2.5",children:[g.jsx("button",{onClick:()=>t(!1),"aria-label":"Back",className:"-ml-1 rounded p-1.5 text-ink-300 hover:text-white md:hidden",children:"‹ Back"}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("div",{className:"truncate font-semibold text-indigo-300",children:"✦ Project agent"}),g.jsxs("div",{className:"text-xs text-ink-400",children:[e.name,i!=null&&i.status&&i.status!=="none"?` · ${i.status}`:""]})]}),g.jsx("button",{onClick:()=>f(R=>!R),"aria-label":"Session settings","aria-expanded":p,title:"Toggle session settings",className:`rounded p-1.5 hover:text-white ${p?"text-indigo-400":"text-ink-400"}`,children:g.jsx("span",{className:"text-sm",children:"⚙"})}),g.jsx("button",{onClick:()=>t(!1),"aria-label":"Close",className:"hidden rounded px-2 py-1 text-ink-400 hover:text-white md:block",children:"✕"})]}),g.jsx(eE,{tabs:N,activeId:h,onSelect:u,onClose:B,onRename:A,onReorder:D,onNew:j}),M?g.jsxs(g.Fragment,{children:[p&&g.jsx(fh,{task:k,fork:M}),g.jsx(_h,{taskId:M.key,projectId:e.id,emptyHint:"Side session — send a message to continue from the copied context.",onSend:R=>ke.sendOrchestratorForkMessage(e.id,M.key,R),onFork:R=>$(M.key,R)},M.key)]}):g.jsxs(g.Fragment,{children:[p&&g.jsx(fh,{task:k}),g.jsx(_h,{taskId:r,projectId:e.id,emptyHint:"Ask about this project, or ask me to create, refine, or move tasks. Type `fork` to start a side session.",onSend:R=>ke.orchestratorMessage(e.id,R),onFork:R=>$(r,R)})]})]})}function I8(e){return e.replace(/^https?:\/\/(?:localhost|127\.0\.0\.1)/,"").replace(/\/.*$/,"")}function B8(e,t){if(t)try{const n=new URL(e);if(n.port)return`/api/preview/${n.port}${n.pathname}${n.search}${n.hash}`}catch{}return`/api/preview?url=${encodeURIComponent(e)}`}function z8(e,t){if(!t)return e;try{const n=new URL(e);return n.port?`/api/preview/${n.port}${n.pathname}${n.search}${n.hash}`:e}catch{return e}}function F8(e,t,n=8){return[t,...e.filter(r=>r!==t)].slice(0,n)}function $8(e){const t=new Set;for(const n of e??[])for(const r of n.runs??[])(r.status==="running"||r.status==="starting")&&r.url&&t.add(r.url);return t}function H8(e){const{mode:t,live:n,recent:r,activeUrl:i}=e;if(t==="all-active"){const c=[...n];return i&&!c.includes(i)&&c.unshift(i),c}const s=t==="none"?0:1;let l=r.filter(c=>n.has(c)).slice(0,s);if(i&&!l.includes(i)&&(l=[i,...l]),t==="eager"){const c=[...n].find(h=>!l.includes(h));c&&(l=[...l,c])}return l}const W8=3,SS=[400,1500,3e3],U8=15e3;function V8(e){return e>W8?{kind:"fatal"}:{kind:"retry",delayMs:SS[Math.min(e-1,SS.length-1)]}}function q8(e,t){const n=new Map(e),r=new Set;for(const i of t??[])for(const s of i.runs??[]){if(s.status!=="running"&&s.status!=="starting"||!s.url)continue;const l=n.get(s.url);l&&(l.runId!==s.id||l.status==="running"&&s.status==="starting")&&r.add(s.url),n.set(s.url,{runId:s.id,status:s.status})}return{stale:[...r],next:n}}const K8=8e3,rE=typeof window<"u"&&window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1",Y8=e=>B8(e,rE),jp=e=>z8(e,rE);function Ru(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function X8(){const e=ue(Z=>Z.previewModal),t=ue(Z=>Z.closePreviewModal),n=ue(Z=>Z.board),r=ue(Z=>{var oe;return(oe=Z.project)==null?void 0:oe.id}),i=ue(Z=>Z.markResolved),s=(e==null?void 0:e.kind)==="url"?e:null,l=ue(Z=>{var ye,Ce;const oe=(ye=Z.previewModal)==null?void 0:ye.taskId;if(!oe)return null;const te=Z.agents[oe],_e=te==null?void 0:te.events[te.events.length-1];return(_e==null?void 0:_e.type)==="advance_proposal"&&!((Ce=te==null?void 0:te.resolved)!=null&&Ce.has(_e.id))?_e:null}),c=(n==null?void 0:n.project.iframeCaching)??dg,[h,u]=b.useState([]);b.useEffect(()=>{if(!(s!=null&&s.url))return;const Z=s.url;u(oe=>F8(oe,Z))},[s==null?void 0:s.url]);const p=b.useMemo(()=>H8({mode:c,live:$8(n==null?void 0:n.tasks),recent:h,activeUrl:s==null?void 0:s.url}),[n,s==null?void 0:s.url,h,c]),[f,v]=b.useState({}),[_,x]=b.useState(!1),[S,k]=b.useState({}),[C,T]=b.useState({}),[N,M]=b.useState({}),B=b.useRef(new Map),A=b.useRef(new Map),D=b.useRef(new Map),$=b.useRef(new Map),j=Z=>v(oe=>oe[Z]?oe:{...oe,[Z]:!0}),R=Z=>{const oe=D.current.get(Z);oe!=null&&(clearTimeout(oe),D.current.delete(Z)),T(te=>Ru(te,Z)),M(te=>Ru(te,Z)),v(te=>Ru(te,Z)),k(te=>({...te,[Z]:(te[Z]??0)+1}))},U=Z=>{A.current.delete(Z),R(Z)},V=b.useRef(p);V.current=p;const Y=b.useRef(s==null?void 0:s.url);Y.current=s==null?void 0:s.url;const W=(Z,oe)=>{const te=(A.current.get(Z)??0)+1;A.current.set(Z,te);const _e=V8(te),ye=D.current.get(Z);if(ye!=null&&(clearTimeout(ye),D.current.delete(Z)),_e.kind==="fatal"){M(ge=>Ru(ge,Z)),T(ge=>ge[Z]===oe?ge:{...ge,[Z]:oe});return}M(ge=>ge[Z]===oe?ge:{...ge,[Z]:oe});const Ce=window.setTimeout(()=>{D.current.delete(Z),R(Z)},_e.delayMs);D.current.set(Z,Ce)};b.useEffect(()=>{const Z=new Set(p),oe=te=>{const _e={};for(const ye of p)ye in te&&(_e[ye]=te[ye]);return Object.keys(_e).length===Object.keys(te).length?te:_e};v(oe),T(oe),M(oe);for(const te of[D.current,$.current])for(const[_e,ye]of te)Z.has(_e)||(clearTimeout(ye),te.delete(_e));for(const te of[...A.current.keys()])Z.has(te)||A.current.delete(te)},[p]);const q=b.useRef(new Map);b.useEffect(()=>{const{stale:Z,next:oe}=q8(q.current,n==null?void 0:n.tasks);q.current=oe;for(const te of Z)U(te)},[n]),b.useEffect(()=>{const Z=oe=>{const te=oe.data;if(!te||te.type!=="operator-preview-fatal")return;let _e;for(const[Ce,ge]of B.current)if(ge.contentWindow&&ge.contentWindow===oe.source){_e=Ce;break}if(_e||(_e=Y.current),!_e||!V.current.includes(_e))return;const ye=typeof te.message=="string"&&te.message?te.message:"Unknown error";W(_e,ye)};return window.addEventListener("message",Z),()=>window.removeEventListener("message",Z)},[]),b.useEffect(()=>{for(const Z of p){const oe=$.current.has(Z);if(f[Z]&&A.current.has(Z)&&!D.current.has(Z)&&!oe){const te=window.setTimeout(()=>{$.current.delete(Z),A.current.delete(Z)},U8);$.current.set(Z,te)}else!f[Z]&&oe&&(clearTimeout($.current.get(Z)),$.current.delete(Z))}},[f,p]),b.useEffect(()=>()=>{for(const Z of[D.current,$.current]){for(const oe of Z.values())clearTimeout(oe);Z.clear()}},[]);const z=s?!!f[s.url]:!1,J=s?S[s.url]??0:0,I=s?C[s.url]:void 0,re=s&&!I?N[s.url]:void 0;if(b.useEffect(()=>{if(x(!1),!s||z)return;const Z=s.url,oe=()=>{var Ce;const ye=B.current.get(Z);if(ye)try{const ge=(Ce=ye.contentDocument)==null?void 0:Ce.readyState;(ge==="interactive"||ge==="complete")&&j(Z)}catch{j(Z)}};oe();const te=setInterval(oe,150),_e=setTimeout(()=>x(!0),K8);return()=>{clearInterval(te),clearTimeout(_e)}},[s==null?void 0:s.url,z,J]),b.useEffect(()=>{if(!e)return;const Z=oe=>{oe.key==="Escape"&&t()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[e,t]),p.length===0&&!e)return null;const P=s?I8(s.url):(e==null?void 0:e.kind)==="mockup"?"mockup":"",H=e!=null&&e.taskId?n==null?void 0:n.tasks.find(Z=>Z.id===e.taskId):void 0,Q=H?H.colorMarker??BS(H.id).hsl:void 0,L=Q?{"--task-accent":Q,background:`color-mix(in srgb, ${Q} 16%, transparent)`}:void 0;return Or.createPortal(g.jsx("div",{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-3 ${e?"":"pointer-events-none opacity-0"}`,onClick:t,"aria-hidden":!e,children:g.jsxs("div",{className:"flex h-full w-full max-w-[96vw] flex-col overflow-hidden rounded-lg border border-ink-600 bg-ink-900 shadow-2xl",onClick:Z=>Z.stopPropagation(),children:[g.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-ink-700 px-3 py-2",style:L,children:[g.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-ink-100",children:e==null?void 0:e.taskName}),g.jsx("span",{className:"shrink-0 font-mono text-xs text-ink-400",children:P}),l&&r&&(e==null?void 0:e.taskId)&&g.jsxs("button",{title:l.rationale??`Accept & move → ${l.toLane}`,onClick:async()=>{const Z=e.taskId;await ke.decideAdvance(r,Z,l.id,!0,l.toLane),i(Z,l.id),t()},className:"shrink-0 rounded bg-emerald-600 px-2 py-1 text-xs font-medium text-white hover:bg-emerald-500",children:["✓ Accept & move → ",l.toLane]}),s&&g.jsx("button",{title:"Reload preview (fresh document, no stale modules)",onClick:()=>U(s.url),className:"shrink-0 rounded bg-ink-700 px-2 py-1 text-xs text-ink-300 hover:bg-ink-600 hover:text-ink-100",children:"↻ refresh"}),s&&g.jsx("a",{href:jp(s.url),target:"_blank",rel:"noreferrer",className:"shrink-0 rounded bg-ink-700 px-2 py-1 text-xs text-indigo-300 hover:bg-ink-600",children:"↗ open in tab"}),g.jsx("button",{onClick:t,className:"shrink-0 rounded bg-ink-700 px-2 py-1 text-xs text-ink-400 hover:bg-ink-600 hover:text-ink-100",children:"✕"})]}),g.jsxs("div",{className:"relative min-h-0 flex-1",children:[p.map(Z=>g.jsx("iframe",{ref:oe=>{oe?B.current.set(Z,oe):B.current.delete(Z)},src:Y8(Z),className:`absolute inset-0 h-full w-full border-0 bg-white ${(s==null?void 0:s.url)===Z?"":"invisible"}`,title:Z,onLoad:()=>j(Z)},`${Z}#${S[Z]??0}`)),(e==null?void 0:e.kind)==="mockup"&&g.jsx("iframe",{title:e.mockup.title,sandbox:"",srcDoc:Qk(e.mockup.html,e.mockup.css),className:"absolute inset-0 h-full w-full border-0 bg-white"}),s&&!z&&g.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-4 bg-ink-900",children:_?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-sm text-ink-300",children:"Preview didn't load."}),g.jsx("span",{className:"text-xs text-ink-500",children:"The server may still be starting up."}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>U(s.url),className:"rounded bg-indigo-700 px-3 py-1.5 text-xs text-white hover:bg-indigo-600",children:"Reload preview"}),g.jsxs("a",{href:jp(s.url),target:"_blank",rel:"noreferrer",className:"rounded bg-ink-700 px-3 py-1.5 text-xs text-indigo-300 hover:bg-ink-600",children:["↗ open ",P," in tab"]})]})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-ink-600 border-t-indigo-400"}),g.jsxs("span",{className:"text-xs text-ink-500",children:["Loading ",P,"…"]})]})}),s&&!I&&re&&g.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-4 bg-ink-900",children:[g.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-ink-600 border-t-indigo-400"}),g.jsx("span",{className:"text-xs text-ink-500",children:"Recovering preview…"})]}),s&&I&&g.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 bg-ink-900",children:[g.jsx("span",{className:"text-sm text-ink-300",children:"Preview crashed"}),g.jsx("span",{title:I,className:"max-w-[80%] truncate font-mono text-xs text-ink-500",children:I}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>U(s.url),className:"rounded bg-indigo-700 px-3 py-1.5 text-xs text-white hover:bg-indigo-600",children:"Reload preview"}),g.jsx("a",{href:jp(s.url),target:"_blank",rel:"noreferrer",className:"rounded bg-ink-700 px-3 py-1.5 text-xs text-indigo-300 hover:bg-ink-600",children:"↗ open in tab"})]})]})]})]})}),document.body)}function Z8(){const e=ue(u=>u.projects),[t,n]=b.useState(!1),[r,i]=b.useState(!1),[s,l]=b.useState(null);async function c(u){i(!0),l(null);try{await Th(u)}catch(p){l(p instanceof Error?p.message:String(p)),i(!1)}}async function h(u){i(!0),l(null);try{await vg(u)}catch(p){l(p instanceof Error?p.message:String(p)),i(!1)}}return g.jsxs("div",{className:"flex h-full flex-col items-center overflow-y-auto px-6 py-12",children:[g.jsxs("div",{className:"w-full max-w-3xl",children:[g.jsx("h1",{className:"mb-1 text-lg font-semibold text-ink-100",children:e.length?"Open a project":"Add your first project"}),g.jsx("p",{className:"mb-6 text-sm text-ink-400",children:e.length?"Pick up where you left off, or add another.":"Point Operator at a git repo to start a board."}),g.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[e.map(u=>g.jsxs("button",{disabled:r,onClick:()=>c(u.id),className:"group flex flex-col gap-2 rounded-lg border border-ink-600 bg-ink-700/20 p-4 text-left transition hover:border-indigo-500/60 hover:bg-ink-700/40 disabled:opacity-50",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(wA,{className:"h-4 w-4 shrink-0 text-indigo-300"}),g.jsx("span",{className:"truncate text-sm font-medium text-ink-100",children:u.name})]}),g.jsx("div",{className:"truncate font-mono text-[12px] text-ink-500",title:u.path,children:u.path}),g.jsx("span",{className:"mt-auto w-fit rounded bg-ink-800 px-1.5 font-mono text-[11px] text-ink-400",children:u.trunk})]},u.id)),g.jsxs("button",{disabled:r,onClick:()=>n(!0),className:"flex min-h-[7rem] flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-ink-600 bg-ink-800/30 p-4 text-ink-400 transition hover:border-indigo-500/60 hover:text-indigo-300 disabled:opacity-50",children:[g.jsx($A,{className:"h-6 w-6"}),g.jsx("span",{className:"text-sm font-medium",children:"Add project"})]})]}),s&&g.jsx("div",{className:"mt-4 text-sm text-red-400",children:s})]}),t&&g.jsx(Vg,{onClose:()=>n(!1),onPick:u=>{n(!1),h(u)}})]})}function G8(){const e=ue(n=>n.toast),t=ue(n=>n.clearToast);return b.useEffect(()=>{if(!e)return;const n=setTimeout(t,5e3);return()=>clearTimeout(n)},[e,t]),e?g.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-4 z-[60] flex justify-center px-4",children:g.jsx("button",{onClick:t,className:"pointer-events-auto max-w-xl truncate rounded-md border border-ink-500 bg-ink-700 px-4 py-2 text-sm text-ink-100 shadow-lg",title:e,children:e})}):null}function J8(){const e=ue(h=>h.setProjects),t=ue(h=>h.project),n=ue(h=>h.selectedTaskId),r=ue(h=>h.orchestratorOpen),i=ue(h=>h.codeServerOpen),[s,l]=b.useState("loading"),c=b.useCallback(async()=>{l("loading");try{const h=await ke.listProjects();e(h.projects),l("ready"),Ly(KS()).catch(()=>{})}catch{l("error")}},[e]);return b.useEffect(()=>{c();const h=Eh(GR),u=Nh(()=>{KR().catch(()=>{})}),p=zR(f=>{Ly(f).catch(()=>{})});return()=>{h(),u(),p()}},[c]),g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx(X8,{}),g.jsx(G8,{}),g.jsx(PO,{}),g.jsxs("div",{className:"flex min-h-0 flex-1",children:[g.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:t?i&&n?g.jsx(DO,{taskId:n}):g.jsx(WL,{}):g.jsx(Q8,{loadState:s,onRetry:c})}),r?g.jsx(j8,{}):n&&g.jsx(A8,{taskId:n},n)]})]})}function Q8({loadState:e,onRetry:t}){return e==="loading"?g.jsx("div",{className:"flex h-full items-center justify-center text-ink-400",children:"Loading…"}):e==="error"?g.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-center text-ink-400",children:[g.jsx("div",{children:"Couldn't reach the server."}),g.jsx("button",{onClick:t,className:"rounded bg-indigo-600 px-3 py-1.5 text-sm text-white hover:bg-indigo-500",children:"Retry"})]}):g.jsx(Z8,{})}GS();oN.createRoot(document.getElementById("root")).render(g.jsx(ot.StrictMode,{children:g.jsx(J8,{})}));export{b6 as _,ig as g};