@growthub/cli 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/dist/index.js.map +2 -2
- package/dist/runtime/server/dist/app.d.ts.map +1 -1
- package/dist/runtime/server/dist/app.js +26 -0
- package/dist/runtime/server/dist/app.js.map +1 -1
- package/dist/runtime/server/dist/config-file.d.ts +1 -0
- package/dist/runtime/server/dist/config-file.d.ts.map +1 -1
- package/dist/runtime/server/dist/config-file.js +9 -0
- package/dist/runtime/server/dist/config-file.js.map +1 -1
- package/dist/runtime/server/dist/routes/gtm.d.ts.map +1 -1
- package/dist/runtime/server/dist/routes/gtm.js +78 -1
- package/dist/runtime/server/dist/routes/gtm.js.map +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/meta/_journal.json +0 -7
- package/dist/runtime/server/node_modules/@paperclipai/plugin-sdk/dist/dev-cli.js +0 -0
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/config-schema.d.ts +20 -0
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/config-schema.d.ts.map +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/config-schema.js +2 -0
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/config-schema.js.map +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/surface-runtime.js +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/shared/dist/surface-runtime.js.map +1 -1
- package/dist/runtime/server/ui-dist/assets/{OnboardingWizard-YBAYuFOd.js → OnboardingWizard-B6t7W0wI.js} +6 -6
- package/dist/runtime/server/ui-dist/assets/{_basePickBy-B8UrX2hL.js → _basePickBy-AK_SWane.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{_baseUniq-DOhMK8lp.js → _baseUniq-Ce_AndV1.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{arc-10jgYADb.js → arc-s2YdnNJl.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{architectureDiagram-VXUJARFQ-DbCtn2UE.js → architectureDiagram-VXUJARFQ-BcfuW_eB.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{blockDiagram-VD42YOAC-YtLYE53a.js → blockDiagram-VD42YOAC-BMTE1VUZ.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{c4Diagram-YG6GDRKO-BlzFyB6Y.js → c4Diagram-YG6GDRKO-B-NXglhR.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/channel-DA_OM8-V.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{chunk-4BX2VUAB-COnjASPn.js → chunk-4BX2VUAB-D-7wJtkB.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-55IACEB6-BmJwChhg.js → chunk-55IACEB6-Duej5TeT.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-B4BG7PRW-CuawKc00.js → chunk-B4BG7PRW-BoPmWIN4.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-DI55MBZ5-C3k6CdNt.js → chunk-DI55MBZ5-C3HY62-t.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-FMBD7UC4-DtNSJvYF.js → chunk-FMBD7UC4-CVNH703m.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-QN33PNHL-CzGZlwo6.js → chunk-QN33PNHL-DA7w4NyY.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-QZHKN3VN-Dgh7hVRp.js → chunk-QZHKN3VN-SFQMSZap.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{chunk-TZMSLE5B-kg0OIMru.js → chunk-TZMSLE5B-BiEhEwtG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-2ON5EDUG-Cf6Zhi-x.js +1 -0
- package/dist/runtime/server/ui-dist/assets/classDiagram-v2-WZHVMYZB-Cf6Zhi-x.js +1 -0
- package/dist/runtime/server/ui-dist/assets/clone-KxtiqD4L.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{cose-bilkent-S5V4N54A-BfHcPe_O.js → cose-bilkent-S5V4N54A-vRH8NlIE.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{dagre-6UL2VRFP-D6TEDjP0.js → dagre-6UL2VRFP-CzSFYyZ_.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-PSM6KHXK-BF4TtDyz.js → diagram-PSM6KHXK-CKcj_yeO.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-QEK2KX5R-CCSKCUCX.js → diagram-QEK2KX5R-h0Roaj0i.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{diagram-S2PKOQOG-BOZoxKMd.js → diagram-S2PKOQOG-DCSBAsRf.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{dx-root-EQ4PsOjO.js → dx-root-B0w_gPhT.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{erDiagram-Q2GNP2WA-Cc9RRS70.js → erDiagram-Q2GNP2WA-DpWT9dJS.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{flowDiagram-NV44I4VS-Dvo-uQQ_.js → flowDiagram-NV44I4VS-BisMBMKb.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{ganttDiagram-JELNMOA3-BLWVsOPr.js → ganttDiagram-JELNMOA3-CmekAzdE.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{gitGraphDiagram-V2S2FVAM-CeFU4k7I.js → gitGraphDiagram-V2S2FVAM-Br_qlrxw.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{graph-DqRLUTIb.js → graph-D-V_UoCw.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/gtm-root-D-OVTmcg.js +11 -0
- package/dist/runtime/server/ui-dist/assets/{index-PKGVc0k8.js → index-B7EJswmR.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BIDIndTd.js → index-BFQEyPDo.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CUSefK9m.js → index-BL5lcbji.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-DVaYozZI.js → index-BL7iND8Y.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BIjAaMNk.js → index-BheLWZ0d.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CoW269dz.js → index-Bn3GeDyS.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-Dd66DjY-.js → index-CAU5OZcp.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-C52kqTEK.js → index-COGi5Wb7.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BGxHNnyR.js → index-COe0-YYa.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CdSePG6E.js → index-CSgPEZIf.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-Ckx8JYkK.js → index-CTAGezRr.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CwneuYjr.css → index-ClbnJMz6.css} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-BQZO50JG.js → index-CwPfxt9_.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-ng0s4tQG.js → index-D2G9ZSV4.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-C2TZTl_N.js → index-D9rVjAIH.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CLTXrXZH.js → index-DS6VElYc.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CEEBMxnv.js → index-DdaDZR2v.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-DGGohXwz.js → index-DlgNqdiq.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-D2FFUjfA.js → index-Durw9xRw.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CMLLY6ho.js → index-Dwmb9KgG.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-CM49tscV.js → index-XVREjU0u.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-DMu9cBdQ.js → index-eCHfIyqy.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{index-DqWbN5EN.js → index-hB0NRj8J.js} +2 -2
- package/dist/runtime/server/ui-dist/assets/{index-BsiHFIJm.js → index-zRyuq4cJ.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{infoDiagram-HS3SLOUP-DdXyV0ot.js → infoDiagram-HS3SLOUP-BXSSUIic.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{journeyDiagram-XKPGCS4Q-B8-Wmt2W.js → journeyDiagram-XKPGCS4Q-plV2BdJI.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{kanban-definition-3W4ZIXB7-KgOa0HXt.js → kanban-definition-3W4ZIXB7-C_-AwmSZ.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{layout-BiGfXX8z.js → layout-5aphL7em.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{linear-D2Y90ye7.js → linear-CUh-S_3C.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{mermaid.core-DCIPpHcK.js → mermaid.core-BRfo14rF.js} +4 -4
- package/dist/runtime/server/ui-dist/assets/{mindmap-definition-VGOIOE7T-Chwpr2Am.js → mindmap-definition-VGOIOE7T-C1A43zg5.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{pieDiagram-ADFJNKIX-CxpRuO4m.js → pieDiagram-ADFJNKIX-CKDydAai.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{quadrantDiagram-AYHSOK5B-CFZovzr9.js → quadrantDiagram-AYHSOK5B-CgicP7a2.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{requirementDiagram-UZGBJVZJ-CUSifhRm.js → requirementDiagram-UZGBJVZJ-CgUaakqy.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{sankeyDiagram-TZEHDZUN-BKKmFiR7.js → sankeyDiagram-TZEHDZUN-D5ZOuvY3.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{sequenceDiagram-WL72ISMW-B6PPDHsF.js → sequenceDiagram-WL72ISMW-BY_eD4WY.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{stateDiagram-FKZM4ZOC-DKduxlG7.js → stateDiagram-FKZM4ZOC-C1PJa9GA.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/stateDiagram-v2-4FDKWEC3-C5p_b2GK.js +1 -0
- package/dist/runtime/server/ui-dist/assets/{timeline-definition-IT6M3QCI-8lWL14Ks.js → timeline-definition-IT6M3QCI-mnsvrXms.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{treemap-GDKQZRPO-BMya5DTd.js → treemap-GDKQZRPO-CrhnH0yt.js} +1 -1
- package/dist/runtime/server/ui-dist/assets/{xychartDiagram-PRI3JC2R-BJX4yvXF.js → xychartDiagram-PRI3JC2R-D0-VyuWz.js} +1 -1
- package/dist/runtime/server/ui-dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/runtime/server/node_modules/@paperclipai/db/dist/migrations/0040_ticket_meta.sql +0 -3
- package/dist/runtime/server/ui-dist/assets/channel-rqG6VLEX.js +0 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-2ON5EDUG-CHsU9Jjm.js +0 -1
- package/dist/runtime/server/ui-dist/assets/classDiagram-v2-WZHVMYZB-CHsU9Jjm.js +0 -1
- package/dist/runtime/server/ui-dist/assets/clone-Cvoe6Nf_.js +0 -1
- package/dist/runtime/server/ui-dist/assets/gtm-root-DRTHNQB3.js +0 -11
- package/dist/runtime/server/ui-dist/assets/stateDiagram-v2-4FDKWEC3-BmqmO02m.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var YU=Object.defineProperty;var DN=t=>{throw TypeError(t)};var XU=(t,e,n)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Or=(t,e,n)=>XU(t,typeof e!="symbol"?e+"":e,n),S1=(t,e,n)=>e.has(t)||DN("Cannot "+n);var Q=(t,e,n)=>(S1(t,e,"read from private field"),n?n.call(t):e.get(t)),ut=(t,e,n)=>e.has(t)?DN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Be=(t,e,n,r)=>(S1(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(S1(t,e,"access private method"),n);var Qm=(t,e,n,r)=>({set _(s){Be(t,e,s,n)},get _(){return Q(t,e,r)}});import{g as em,c as eW,r as x,j as d,a as j,R as nP,d as tW,_ as me,e as FN}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D9rVjAIH.js","assets/index-B7EJswmR.js","assets/index-hB0NRj8J.js","assets/index-ClbnJMz6.css","assets/index-DdaDZR2v.js","assets/index-CSgPEZIf.js","assets/index-zRyuq4cJ.js","assets/index-CTAGezRr.js","assets/index-D2G9ZSV4.js","assets/index-Bn3GeDyS.js","assets/index-BFQEyPDo.js","assets/index-BL5lcbji.js","assets/index-BheLWZ0d.js","assets/index-BL7iND8Y.js","assets/index-eCHfIyqy.js","assets/index-CwPfxt9_.js","assets/index-DS6VElYc.js","assets/index-COe0-YYa.js","assets/index-Durw9xRw.js","assets/index-DlgNqdiq.js","assets/index-COGi5Wb7.js","assets/index-XVREjU0u.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LdVXkNf5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-Dwmb9KgG.js","assets/index-CAU5OZcp.js","assets/mermaid.core-BRfo14rF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var YU=Object.defineProperty;var DN=t=>{throw TypeError(t)};var XU=(t,e,n)=>e in t?YU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Or=(t,e,n)=>XU(t,typeof e!="symbol"?e+"":e,n),S1=(t,e,n)=>e.has(t)||DN("Cannot "+n);var Q=(t,e,n)=>(S1(t,e,"read from private field"),n?n.call(t):e.get(t)),ut=(t,e,n)=>e.has(t)?DN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Be=(t,e,n,r)=>(S1(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),St=(t,e,n)=>(S1(t,e,"access private method"),n);var Qm=(t,e,n,r)=>({set _(s){Be(t,e,s,n)},get _(){return Q(t,e,r)}});import{g as em,c as eW,r as x,j as d,a as j,R as nP,d as tW,_ as me,e as FN}from"./index-hB0NRj8J.js";function nW(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Rl=eW();const rP=em(Rl),RRe=nW({__proto__:null,default:rP},[Rl]);/**
|
|
3
3
|
* react-router v7.13.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
@@ -62,7 +62,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var gT;function oJ(){if(gT)return D1;gT=1;var t=tW();function e(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function a(f,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),g=m[0].inst,y=m[1];return i(function(){g.value=p,g.getSnapshot=h,l(g)&&y({inst:g})},[f,p,h]),s(function(){return l(g)&&y({inst:g}),f(function(){l(g)&&y({inst:g})})},[f]),o(p),p}function l(f){var h=f.getSnapshot;f=f.value;try{var p=h();return!n(f,p)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return D1.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,D1}var xT;function aJ(){return xT||(xT=1,L1.exports=oJ()),L1.exports}var lJ=aJ();function cJ(){return lJ.useSyncExternalStore(uJ,()=>!0,()=>!1)}function uJ(){return()=>{}}var O_="Avatar",[dJ]=cs(O_),[fJ,CO]=dJ(O_),_O=x.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=x.useState("idle");return d.jsx(fJ,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:d.jsx(it.span,{...r,ref:e})})});_O.displayName=O_;var SO="AvatarImage",EO=x.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,o=CO(SO,n),a=hJ(r,i),l=hr(c=>{s(c),o.onImageLoadingStatusChange(c)});return Un(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?d.jsx(it.img,{...i,ref:e,src:r}):null});EO.displayName=SO;var NO="AvatarFallback",TO=x.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=CO(NO,n),[o,a]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&i.imageLoadingStatus!=="loaded"?d.jsx(it.span,{...s,ref:e}):null});TO.displayName=NO;function yT(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function hJ(t,{referrerPolicy:e,crossOrigin:n}){const r=cJ(),s=x.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[o,a]=x.useState(()=>yT(i,t));return Un(()=>{a(yT(i,t))},[i,t]),Un(()=>{const l=f=>()=>{a(f)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,e]),o}var pJ=_O,mJ=EO,gJ=TO;function xJ(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function yJ(t){const[e,n]=x.useState(void 0);return Un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const bJ=["top","right","bottom","left"],Pl=Math.min,js=Math.max,Jx=Math.round,og=Math.floor,Ao=t=>({x:t,y:t}),vJ={left:"right",right:"left",bottom:"top",top:"bottom"},wJ={start:"end",end:"start"};function lk(t,e,n){return js(t,Pl(e,n))}function Ta(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function _f(t){return t.split("-")[1]}function L_(t){return t==="x"?"y":"x"}function D_(t){return t==="y"?"height":"width"}const kJ=new Set(["top","bottom"]);function ko(t){return kJ.has(Aa(t))?"y":"x"}function F_(t){return L_(ko(t))}function CJ(t,e,n){n===void 0&&(n=!1);const r=_f(t),s=F_(t),i=D_(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Zx(o)),[o,Zx(o)]}function _J(t){const e=Zx(t);return[ck(t),e,ck(e)]}function ck(t){return t.replace(/start|end/g,e=>wJ[e])}const bT=["left","right"],vT=["right","left"],SJ=["top","bottom"],EJ=["bottom","top"];function NJ(t,e,n){switch(t){case"top":case"bottom":return n?e?vT:bT:e?bT:vT;case"left":case"right":return e?SJ:EJ;default:return[]}}function TJ(t,e,n,r){const s=_f(t);let i=NJ(Aa(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(ck)))),i}function Zx(t){return t.replace(/left|right|bottom|top/g,e=>vJ[e])}function AJ(t){return{top:0,right:0,bottom:0,left:0,...t}}function AO(t){return typeof t!="number"?AJ(t):{top:t,right:t,bottom:t,left:t}}function Qx(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function wT(t,e,n){let{reference:r,floating:s}=t;const i=ko(e),o=F_(e),a=D_(o),l=Aa(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-s.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(_f(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}async function IJ(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Ta(e,t),m=AO(p),y=a[h?f==="floating"?"reference":"floating":f],v=Qx(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Qx(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-C.top+m.top)/k.y,bottom:(C.bottom-v.bottom+m.bottom)/k.y,left:(v.left-C.left+m.left)/k.x,right:(C.right-v.right+m.right)/k.x}}const jJ=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:f}=wT(c,r,l),h=r,p={},m=0;for(let y=0;y<a.length;y++){var g;const{name:v,fn:b}=a[y],{x:w,y:k,data:C,reset:_}=await b({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:p,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:IJ},elements:{reference:t,floating:e}});u=w??u,f=k??f,p={...p,[v]:{...p[v],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(c=_.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):_.rects),{x:u,y:f}=wT(c,h,l)),y=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:p}},RJ=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ta(t,e)||{};if(c==null)return{};const f=AO(u),h={x:n,y:r},p=F_(s),m=D_(p),g=await o.getDimensions(c),y=p==="y",v=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[p]-h[p]-i.floating[m],C=h[p]-i.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=_?_[w]:0;(!S||!await(o.isElement==null?void 0:o.isElement(_)))&&(S=a.floating[w]||i.floating[m]);const E=k/2-C/2,N=S/2-g[m]/2-1,T=Pl(f[v],N),O=Pl(f[b],N),L=T,I=S-g[m]-O,M=S/2-g[m]/2+E,V=lk(L,M,I),G=!l.arrow&&_f(s)!=null&&M!==V&&i.reference[m]/2-(M<L?T:O)-g[m]/2<0,D=G?M<L?M-L:M-I:0;return{[p]:h[p]+D,data:{[p]:V,centerOffset:M-V-D,...G&&{alignmentOffset:D}},reset:G}}}),MJ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Ta(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Aa(s),b=ko(a),w=Aa(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(w||!g?[Zx(a)]:_J(a)),_=m!=="none";!h&&_&&C.push(...TJ(a,g,m,k));const S=[a,...C],E=await l.detectOverflow(e,y),N=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(E[v]),f){const M=CJ(s,o,k);N.push(E[M[0]],E[M[1]])}if(T=[...T,{placement:s,overflows:N}],!N.every(M=>M<=0)){var O,L;const M=(((O=i.flip)==null?void 0:O.index)||0)+1,V=S[M];if(V&&(!(f==="alignment"?b!==ko(V):!1)||T.every(B=>ko(B.placement)===b?B.overflows[0]>0:!0)))return{data:{index:M,overflows:T},reset:{placement:V}};let G=(L=T.filter(D=>D.overflows[0]<=0).sort((D,B)=>D.overflows[1]-B.overflows[1])[0])==null?void 0:L.placement;if(!G)switch(p){case"bestFit":{var I;const D=(I=T.filter(B=>{if(_){const F=ko(B.placement);return F===b||F==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(F=>F>0).reduce((F,R)=>F+R,0)]).sort((B,F)=>B[1]-F[1])[0])==null?void 0:I[0];D&&(G=D);break}case"initialPlacement":G=a;break}if(s!==G)return{reset:{placement:G}}}return{}}}};function kT(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function CT(t){return bJ.some(e=>t[e]>=0)}const PJ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=Ta(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),a=kT(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:CT(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),a=kT(o,n.floating);return{data:{escapedOffsets:a,escaped:CT(a)}}}default:return{}}}}},IO=new Set(["left","top"]);async function OJ(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Aa(n),a=_f(n),l=ko(n)==="y",c=IO.has(o)?-1:1,u=i&&l?-1:1,f=Ta(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const LJ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await OJ(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},DJ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Ta(t,e),u={x:n,y:r},f=await i.detectOverflow(e,c),h=ko(Aa(s)),p=L_(h);let m=u[p],g=u[h];if(o){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=m+f[v],k=m-f[b];m=lk(w,m,k)}if(a){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=g+f[v],k=g-f[b];g=lk(w,g,k)}const y=l.fn({...e,[p]:m,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:o,[h]:a}}}}}},FJ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ta(t,e),u={x:n,y:r},f=ko(s),h=L_(f);let p=u[h],m=u[f];const g=Ta(a,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=h==="y"?"height":"width",k=i.reference[h]-i.floating[w]+y.mainAxis,C=i.reference[h]+i.reference[w]-y.mainAxis;p<k?p=k:p>C&&(p=C)}if(c){var v,b;const w=h==="y"?"width":"height",k=IO.has(Aa(s)),C=i.reference[f]-i.floating[w]+(k&&((v=o.offset)==null?void 0:v[f])||0)+(k?0:y.crossAxis),_=i.reference[f]+i.reference[w]+(k?0:((b=o.offset)==null?void 0:b[f])||0)-(k?y.crossAxis:0);m<C?m=C:m>_&&(m=_)}return{[h]:p,[f]:m}}}},$J=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:a}=e,{apply:l=()=>{},...c}=Ta(t,e),u=await o.detectOverflow(e,c),f=Aa(s),h=_f(s),p=ko(s)==="y",{width:m,height:g}=i.floating;let y,v;f==="top"||f==="bottom"?(y=f,v=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,y=h==="end"?"top":"bottom");const b=g-u.top-u.bottom,w=m-u.left-u.right,k=Pl(g-u[y],b),C=Pl(m-u[v],w),_=!e.middlewareData.shift;let S=k,E=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=b),_&&!h){const T=js(u.left,0),O=js(u.right,0),L=js(u.top,0),I=js(u.bottom,0);p?E=m-2*(T!==0||O!==0?T+O:js(u.left,u.right)):S=g-2*(L!==0||I!==0?L+I:js(u.top,u.bottom))}await l({...e,availableWidth:E,availableHeight:S});const N=await o.getDimensions(a.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Gy(){return typeof window<"u"}function Sf(t){return jO(t)?(t.nodeName||"").toLowerCase():"#document"}function Fs(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zo(t){var e;return(e=(jO(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function jO(t){return Gy()?t instanceof Node||t instanceof Fs(t).Node:!1}function zi(t){return Gy()?t instanceof Element||t instanceof Fs(t).Element:!1}function Po(t){return Gy()?t instanceof HTMLElement||t instanceof Fs(t).HTMLElement:!1}function _T(t){return!Gy()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fs(t).ShadowRoot}const BJ=new Set(["inline","contents"]);function im(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Hi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!BJ.has(s)}const VJ=new Set(["table","td","th"]);function zJ(t){return VJ.has(Sf(t))}const HJ=[":popover-open",":modal"];function Jy(t){return HJ.some(e=>{try{return t.matches(e)}catch{return!1}})}const UJ=["transform","translate","scale","rotate","perspective"],WJ=["transform","translate","scale","rotate","perspective","filter"],KJ=["paint","layout","strict","content"];function $_(t){const e=B_(),n=zi(t)?Hi(t):t;return UJ.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||WJ.some(r=>(n.willChange||"").includes(r))||KJ.some(r=>(n.contain||"").includes(r))}function qJ(t){let e=Ol(t);for(;Po(e)&&!qd(e);){if($_(e))return e;if(Jy(e))return null;e=Ol(e)}return null}function B_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const GJ=new Set(["html","body","#document"]);function qd(t){return GJ.has(Sf(t))}function Hi(t){return Fs(t).getComputedStyle(t)}function Zy(t){return zi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ol(t){if(Sf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_T(t)&&t.host||zo(t);return _T(e)?e.host:e}function RO(t){const e=Ol(t);return qd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Po(e)&&im(e)?e:RO(e)}function Qh(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=RO(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Fs(s);if(i){const a=uk(o);return e.concat(o,o.visualViewport||[],im(s)?s:[],a&&n?Qh(a):[])}return e.concat(s,Qh(s,[],n))}function uk(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function MO(t){const e=Hi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Po(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,a=Jx(n)!==i||Jx(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function V_(t){return zi(t)?t:t.contextElement}function bd(t){const e=V_(t);if(!Po(e))return Ao(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=MO(e);let o=(i?Jx(n.width):n.width)/r,a=(i?Jx(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JJ=Ao(0);function PO(t){const e=Fs(t);return!B_()||!e.visualViewport?JJ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZJ(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fs(t)?!1:e}function Yc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=V_(t);let o=Ao(1);e&&(r?zi(r)&&(o=bd(r)):o=bd(t));const a=ZJ(i,n,r)?PO(i):Ao(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const h=Fs(i),p=r&&zi(r)?Fs(r):r;let m=h,g=uk(m);for(;g&&r&&p!==m;){const y=bd(g),v=g.getBoundingClientRect(),b=Hi(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,k=v.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=w,c+=k,m=Fs(g),g=uk(m)}}return Qx({width:u,height:f,x:l,y:c})}function Qy(t,e){const n=Zy(t).scrollLeft;return e?e.left+n:Yc(zo(t)).left+n}function OO(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Qy(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function QJ(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=zo(r),a=e?Jy(e.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ao(1);const u=Ao(0),f=Po(r);if((f||!f&&!i)&&((Sf(r)!=="body"||im(o))&&(l=Zy(r)),Po(r))){const p=Yc(r);c=bd(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=o&&!f&&!i?OO(o,l):Ao(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function YJ(t){return Array.from(t.getClientRects())}function XJ(t){const e=zo(t),n=Zy(t),r=t.ownerDocument.body,s=js(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=js(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Qy(t);const a=-n.scrollTop;return Hi(r).direction==="rtl"&&(o+=js(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const ST=25;function eZ(t,e){const n=Fs(t),r=zo(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const u=B_();(!u||u&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const c=Qy(r);if(c<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=ST&&(i-=m)}else c<=ST&&(i+=c);return{width:i,height:o,x:a,y:l}}const tZ=new Set(["absolute","fixed"]);function nZ(t,e){const n=Yc(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Po(t)?bd(t):Ao(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function ET(t,e,n){let r;if(e==="viewport")r=eZ(t,n);else if(e==="document")r=XJ(zo(t));else if(zi(e))r=nZ(e,n);else{const s=PO(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Qx(r)}function LO(t,e){const n=Ol(t);return n===e||!zi(n)||qd(n)?!1:Hi(n).position==="fixed"||LO(n,e)}function rZ(t,e){const n=e.get(t);if(n)return n;let r=Qh(t,[],!1).filter(a=>zi(a)&&Sf(a)!=="body"),s=null;const i=Hi(t).position==="fixed";let o=i?Ol(t):t;for(;zi(o)&&!qd(o);){const a=Hi(o),l=$_(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&tZ.has(s.position)||im(o)&&!l&&LO(t,o))?r=r.filter(u=>u!==o):s=a,o=Ol(o)}return e.set(t,r),r}function sZ(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?Jy(e)?[]:rZ(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=ET(e,u,s);return c.top=js(f.top,c.top),c.right=Pl(f.right,c.right),c.bottom=Pl(f.bottom,c.bottom),c.left=js(f.left,c.left),c},ET(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function iZ(t){const{width:e,height:n}=MO(t);return{width:e,height:n}}function oZ(t,e,n){const r=Po(e),s=zo(e),i=n==="fixed",o=Yc(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Ao(0);function c(){l.x=Qy(s)}if(r||!r&&!i)if((Sf(e)!=="body"||im(s))&&(a=Zy(e)),r){const p=Yc(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&c();i&&!r&&s&&c();const u=s&&!r&&!i?OO(s,a):Ao(0),f=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function F1(t){return Hi(t).position==="static"}function NT(t,e){if(!Po(t)||Hi(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return zo(t)===n&&(n=n.ownerDocument.body),n}function DO(t,e){const n=Fs(t);if(Jy(t))return n;if(!Po(t)){let s=Ol(t);for(;s&&!qd(s);){if(zi(s)&&!F1(s))return s;s=Ol(s)}return n}let r=NT(t,e);for(;r&&zJ(r)&&F1(r);)r=NT(r,e);return r&&qd(r)&&F1(r)&&!$_(r)?n:r||qJ(t)||n}const aZ=async function(t){const e=this.getOffsetParent||DO,n=this.getDimensions,r=await n(t.floating);return{reference:oZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lZ(t){return Hi(t).direction==="rtl"}const cZ={convertOffsetParentRelativeRectToViewportRelativeRect:QJ,getDocumentElement:zo,getClippingRect:sZ,getOffsetParent:DO,getElementRects:aZ,getClientRects:YJ,getDimensions:iZ,getScale:bd,isElement:zi,isRTL:lZ};function FO(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function uZ(t,e){let n=null,r;const s=zo(t);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=c;if(a||e(),!h||!p)return;const m=og(f),g=og(s.clientWidth-(u+h)),y=og(s.clientHeight-(f+p)),v=og(u),w={rootMargin:-m+"px "+-g+"px "+-y+"px "+-v+"px",threshold:js(0,Pl(1,l))||1};let k=!0;function C(_){const S=_[0].intersectionRatio;if(S!==l){if(!k)return o();S?o(!1,S):r=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!FO(c,t.getBoundingClientRect())&&o(),k=!1}try{n=new IntersectionObserver(C,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(t)}return o(!0),i}function dZ(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=V_(t),u=s||i?[...c?Qh(c):[],...Qh(e)]:[];u.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=c&&a?uZ(c,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),c&&!l&&p.observe(c),p.observe(e));let m,g=l?Yc(t):null;l&&y();function y(){const v=Yc(t);g&&!FO(g,v)&&n(),g=v,m=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),f==null||f(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const fZ=LJ,hZ=DJ,pZ=MJ,mZ=$J,gZ=PJ,TT=RJ,xZ=FJ,yZ=(t,e,n)=>{const r=new Map,s={platform:cZ,...n},i={...s.platform,_c:r};return jJ(t,e,{...s,platform:i})};var bZ=typeof document<"u",vZ=function(){},mx=bZ?x.useLayoutEffect:vZ;function Yx(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Yx(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Yx(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function $O(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function AT(t,e){const n=$O(t);return Math.round(e*n)/n}function $1(t){const e=x.useRef(t);return mx(()=>{e.current=t}),e}function wZ(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,f]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=x.useState(r);Yx(h,r)||p(r);const[m,g]=x.useState(null),[y,v]=x.useState(null),b=x.useCallback(B=>{B!==_.current&&(_.current=B,g(B))},[]),w=x.useCallback(B=>{B!==S.current&&(S.current=B,v(B))},[]),k=i||m,C=o||y,_=x.useRef(null),S=x.useRef(null),E=x.useRef(u),N=l!=null,T=$1(l),O=$1(s),L=$1(c),I=x.useCallback(()=>{if(!_.current||!S.current)return;const B={placement:e,strategy:n,middleware:h};O.current&&(B.platform=O.current),yZ(_.current,S.current,B).then(F=>{const R={...F,isPositioned:L.current!==!1};M.current&&!Yx(E.current,R)&&(E.current=R,Rl.flushSync(()=>{f(R)}))})},[h,e,n,O,L]);mx(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[c]);const M=x.useRef(!1);mx(()=>(M.current=!0,()=>{M.current=!1}),[]),mx(()=>{if(k&&(_.current=k),C&&(S.current=C),k&&C){if(T.current)return T.current(k,C,I);I()}},[k,C,I,T,N]);const V=x.useMemo(()=>({reference:_,floating:S,setReference:b,setFloating:w}),[b,w]),G=x.useMemo(()=>({reference:k,floating:C}),[k,C]),D=x.useMemo(()=>{const B={position:n,left:0,top:0};if(!G.floating)return B;const F=AT(G.floating,u.x),R=AT(G.floating,u.y);return a?{...B,transform:"translate("+F+"px, "+R+"px)",...$O(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:R}},[n,a,G.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:I,refs:V,elements:G,floatingStyles:D}),[u,I,V,G,D])}const kZ=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TT({element:r.current,padding:s}).fn(n):{}:r?TT({element:r,padding:s}).fn(n):{}}}},CZ=(t,e)=>({...fZ(t),options:[t,e]}),_Z=(t,e)=>({...hZ(t),options:[t,e]}),SZ=(t,e)=>({...xZ(t),options:[t,e]}),EZ=(t,e)=>({...pZ(t),options:[t,e]}),NZ=(t,e)=>({...mZ(t),options:[t,e]}),TZ=(t,e)=>({...gZ(t),options:[t,e]}),AZ=(t,e)=>({...kZ(t),options:[t,e]});var IZ="Arrow",BO=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return d.jsx(it.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});BO.displayName=IZ;var jZ=BO,z_="Popper",[VO,Ql]=cs(z_),[RZ,zO]=VO(z_),HO=t=>{const{__scopePopper:e,children:n}=t,[r,s]=x.useState(null);return d.jsx(RZ,{scope:e,anchor:r,onAnchorChange:s,children:n})};HO.displayName=z_;var UO="PopperAnchor",WO=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=zO(UO,n),o=x.useRef(null),a=Rt(e,o),l=x.useRef(null);return x.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&i.onAnchorChange(l.current)}),r?null:d.jsx(it.div,{...s,ref:a})});WO.displayName=UO;var H_="PopperContent",[MZ,PZ]=VO(H_),KO=x.forwardRef((t,e)=>{var Y,H,ne,de,xe,Oe;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...g}=t,y=zO(H_,n),[v,b]=x.useState(null),w=Rt(e,Ze=>b(Ze)),[k,C]=x.useState(null),_=yJ(k),S=(_==null?void 0:_.width)??0,E=(_==null?void 0:_.height)??0,N=r+(i!=="center"?"-"+i:""),T=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(c)?c:[c],L=O.length>0,I={padding:T,boundary:O.filter(LZ),altBoundary:L},{refs:M,floatingStyles:V,placement:G,isPositioned:D,middlewareData:B}=wZ({strategy:"fixed",placement:N,whileElementsMounted:(...Ze)=>dZ(...Ze,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[CZ({mainAxis:s+E,alignmentAxis:o}),l&&_Z({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?SZ():void 0,...I}),l&&EZ({...I}),NZ({...I,apply:({elements:Ze,rects:ot,availableWidth:pt,availableHeight:ye})=>{const{width:Qe,height:z}=ot.reference,te=Ze.floating.style;te.setProperty("--radix-popper-available-width",`${pt}px`),te.setProperty("--radix-popper-available-height",`${ye}px`),te.setProperty("--radix-popper-anchor-width",`${Qe}px`),te.setProperty("--radix-popper-anchor-height",`${z}px`)}}),k&&AZ({element:k,padding:a}),DZ({arrowWidth:S,arrowHeight:E}),h&&TZ({strategy:"referenceHidden",...I})]}),[F,R]=JO(G),U=hr(m);Un(()=>{D&&(U==null||U())},[D,U]);const J=(Y=B.arrow)==null?void 0:Y.x,P=(H=B.arrow)==null?void 0:H.y,ie=((ne=B.arrow)==null?void 0:ne.centerOffset)!==0,[ge,ae]=x.useState();return Un(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:D?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(de=B.transformOrigin)==null?void 0:de.x,(xe=B.transformOrigin)==null?void 0:xe.y].join(" "),...((Oe=B.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(MZ,{scope:n,placedSide:F,onArrowChange:C,arrowX:J,arrowY:P,shouldHideArrow:ie,children:d.jsx(it.div,{"data-side":F,"data-align":R,...g,ref:w,style:{...g.style,animation:D?void 0:"none"}})})})});KO.displayName=H_;var qO="PopperArrow",OZ={top:"bottom",right:"left",bottom:"top",left:"right"},GO=x.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=PZ(qO,r),o=OZ[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(jZ,{...s,ref:n,style:{...s.style,display:"block"}})})});GO.displayName=qO;function LZ(t){return t!==null}var DZ=t=>({name:"transformOrigin",options:t,fn(e){var y,v,b;const{placement:n,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=JO(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((v=s.arrow)==null?void 0:v.x)??0)+a/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+l/2;let m="",g="";return c==="bottom"?(m=o?f:`${h}px`,g=`${-l}px`):c==="top"?(m=o?f:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,g=o?f:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,g=o?f:`${p}px`),{data:{x:m,y:g}}}});function JO(t){const[e,n="center"]=t.split("-");return[e,n]}var Yy=HO,om=WO,Xy=KO,eb=GO,B1="rovingFocusGroup.onEntryFocus",FZ={bubbles:!1,cancelable:!0},am="RovingFocusGroup",[dk,ZO,$Z]=C_(am),[BZ,Yl]=cs(am,[$Z]),[VZ,zZ]=BZ(am),QO=x.forwardRef((t,e)=>d.jsx(dk.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(dk.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(HZ,{...t,ref:e})})}));QO.displayName=am;var HZ=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=t,h=x.useRef(null),p=Rt(e,h),m=Eu(i),[g,y]=ui({prop:o,defaultProp:a??null,onChange:l,caller:am}),[v,b]=x.useState(!1),w=hr(c),k=ZO(n),C=x.useRef(!1),[_,S]=x.useState(0);return x.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(B1,w),()=>E.removeEventListener(B1,w)},[w]),d.jsx(VZ,{scope:n,orientation:r,dir:m,loop:s,currentTabStopId:g,onItemFocus:x.useCallback(E=>y(E),[y]),onItemShiftTab:x.useCallback(()=>b(!0),[]),onFocusableItemAdd:x.useCallback(()=>S(E=>E+1),[]),onFocusableItemRemove:x.useCallback(()=>S(E=>E-1),[]),children:d.jsx(it.div,{tabIndex:v||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Le(t.onMouseDown,()=>{C.current=!0}),onFocus:Le(t.onFocus,E=>{const N=!C.current;if(E.target===E.currentTarget&&N&&!v){const T=new CustomEvent(B1,FZ);if(E.currentTarget.dispatchEvent(T),!T.defaultPrevented){const O=k().filter(G=>G.focusable),L=O.find(G=>G.active),I=O.find(G=>G.id===g),V=[L,I,...O].filter(Boolean).map(G=>G.ref.current);e9(V,u)}}C.current=!1}),onBlur:Le(t.onBlur,()=>b(!1))})})}),YO="RovingFocusGroupItem",XO=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...a}=t,l=Ds(),c=i||l,u=zZ(YO,n),f=u.currentTabStopId===c,h=ZO(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:g}=u;return x.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),d.jsx(dk.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:d.jsx(it.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:Le(t.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:Le(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:Le(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=KZ(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=h().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const k=w.indexOf(y.currentTarget);w=u.loop?qZ(w,k+1):w.slice(k+1)}setTimeout(()=>e9(w))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});XO.displayName=YO;var UZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WZ(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function KZ(t,e,n){const r=WZ(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return UZ[r]}function e9(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function qZ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var tb=QO,lm=XO,fk=["Enter"," "],GZ=["ArrowDown","PageUp","Home"],t9=["ArrowUp","PageDown","End"],JZ=[...GZ,...t9],ZZ={ltr:[...fk,"ArrowRight"],rtl:[...fk,"ArrowLeft"]},QZ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cm="Menu",[Yh,YZ,XZ]=C_(cm),[Nu,n9]=cs(cm,[XZ,Ql,Yl]),nb=Ql(),r9=Yl(),[eQ,Tu]=Nu(cm),[tQ,um]=Nu(cm),s9=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=t,a=nb(e),[l,c]=x.useState(null),u=x.useRef(!1),f=hr(i),h=Eu(s);return x.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),d.jsx(Yy,{...a,children:d.jsx(eQ,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:c,children:d.jsx(tQ,{scope:e,onClose:x.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};s9.displayName=cm;var nQ="MenuAnchor",U_=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=nb(n);return d.jsx(om,{...s,...r,ref:e})});U_.displayName=nQ;var W_="MenuPortal",[rQ,i9]=Nu(W_,{forceMount:void 0}),o9=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Tu(W_,e);return d.jsx(rQ,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};o9.displayName=W_;var ii="MenuContent",[sQ,K_]=Nu(ii),a9=x.forwardRef((t,e)=>{const n=i9(ii,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Tu(ii,t.__scopeMenu),o=um(ii,t.__scopeMenu);return d.jsx(Yh.Provider,{scope:t.__scopeMenu,children:d.jsx(br,{present:r||i.open,children:d.jsx(Yh.Slot,{scope:t.__scopeMenu,children:o.modal?d.jsx(iQ,{...s,ref:e}):d.jsx(oQ,{...s,ref:e})})})})}),iQ=x.forwardRef((t,e)=>{const n=Tu(ii,t.__scopeMenu),r=x.useRef(null),s=Rt(e,r);return x.useEffect(()=>{const i=r.current;if(i)return Wy(i)},[]),d.jsx(q_,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),oQ=x.forwardRef((t,e)=>{const n=Tu(ii,t.__scopeMenu);return d.jsx(q_,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),aQ=Ml("MenuContent.ScrollLock"),q_=x.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...g}=t,y=Tu(ii,n),v=um(ii,n),b=nb(n),w=r9(n),k=YZ(n),[C,_]=x.useState(null),S=x.useRef(null),E=Rt(e,S,y.onContentChange),N=x.useRef(0),T=x.useRef(""),O=x.useRef(0),L=x.useRef(null),I=x.useRef("right"),M=x.useRef(0),V=m?sm:x.Fragment,G=m?{as:aQ,allowPinchZoom:!0}:void 0,D=F=>{var Y,H;const R=T.current+F,U=k().filter(ne=>!ne.disabled),J=document.activeElement,P=(Y=U.find(ne=>ne.ref.current===J))==null?void 0:Y.textValue,ie=U.map(ne=>ne.textValue),ge=bQ(ie,R,P),ae=(H=U.find(ne=>ne.textValue===ge))==null?void 0:H.ref.current;(function ne(de){T.current=de,window.clearTimeout(N.current),de!==""&&(N.current=window.setTimeout(()=>ne(""),1e3))})(R),ae&&setTimeout(()=>ae.focus())};x.useEffect(()=>()=>window.clearTimeout(N.current),[]),Hy();const B=x.useCallback(F=>{var U,J;return I.current===((U=L.current)==null?void 0:U.side)&&wQ(F,(J=L.current)==null?void 0:J.area)},[]);return d.jsx(sQ,{scope:n,searchRef:T,onItemEnter:x.useCallback(F=>{B(F)&&F.preventDefault()},[B]),onItemLeave:x.useCallback(F=>{var R;B(F)||((R=S.current)==null||R.focus(),_(null))},[B]),onTriggerLeave:x.useCallback(F=>{B(F)&&F.preventDefault()},[B]),pointerGraceTimerRef:O,onPointerGraceIntentChange:x.useCallback(F=>{L.current=F},[]),children:d.jsx(V,{...G,children:d.jsx(rm,{asChild:!0,trapped:s,onMountAutoFocus:Le(i,F=>{var R;F.preventDefault(),(R=S.current)==null||R.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:d.jsx(tb,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Le(l,F=>{v.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Xy,{role:"menu","aria-orientation":"vertical","data-state":C9(y.open),"data-radix-menu-content":"",dir:v.dir,...b,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:Le(g.onKeyDown,F=>{const U=F.target.closest("[data-radix-menu-content]")===F.currentTarget,J=F.ctrlKey||F.altKey||F.metaKey,P=F.key.length===1;U&&(F.key==="Tab"&&F.preventDefault(),!J&&P&&D(F.key));const ie=S.current;if(F.target!==ie||!JZ.includes(F.key))return;F.preventDefault();const ae=k().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);t9.includes(F.key)&&ae.reverse(),xQ(ae)}),onBlur:Le(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(N.current),T.current="")}),onPointerMove:Le(t.onPointerMove,Xh(F=>{const R=F.target,U=M.current!==F.clientX;if(F.currentTarget.contains(R)&&U){const J=F.clientX>M.current?"right":"left";I.current=J,M.current=F.clientX}}))})})})})})})});a9.displayName=ii;var lQ="MenuGroup",G_=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{role:"group",...r,ref:e})});G_.displayName=lQ;var cQ="MenuLabel",l9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{...r,ref:e})});l9.displayName=cQ;var Xx="MenuItem",IT="menu.itemSelect",rb=x.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=x.useRef(null),o=um(Xx,t.__scopeMenu),a=K_(Xx,t.__scopeMenu),l=Rt(e,i),c=x.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(IT,{bubbles:!0,cancelable:!0});f.addEventListener(IT,p=>r==null?void 0:r(p),{once:!0}),VP(f,h),h.defaultPrevented?c.current=!1:o.onClose()}};return d.jsx(c9,{...s,ref:l,disabled:n,onClick:Le(t.onClick,u),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),c.current=!0},onPointerUp:Le(t.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Le(t.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||fk.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});rb.displayName=Xx;var c9=x.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,o=K_(Xx,n),a=r9(n),l=x.useRef(null),c=Rt(e,l),[u,f]=x.useState(!1),[h,p]=x.useState("");return x.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),d.jsx(Yh.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:d.jsx(lm,{asChild:!0,...a,focusable:!r,children:d.jsx(it.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:Le(t.onPointerMove,Xh(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(t.onPointerLeave,Xh(m=>o.onItemLeave(m))),onFocus:Le(t.onFocus,()=>f(!0)),onBlur:Le(t.onBlur,()=>f(!1))})})})}),uQ="MenuCheckboxItem",u9=x.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return d.jsx(m9,{scope:t.__scopeMenu,checked:n,children:d.jsx(rb,{role:"menuitemcheckbox","aria-checked":e0(n)?"mixed":n,...s,ref:e,"data-state":Z_(n),onSelect:Le(s.onSelect,()=>r==null?void 0:r(e0(n)?!0:!n),{checkForDefaultPrevented:!1})})})});u9.displayName=uQ;var d9="MenuRadioGroup",[dQ,fQ]=Nu(d9,{value:void 0,onValueChange:()=>{}}),f9=x.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=hr(r);return d.jsx(dQ,{scope:t.__scopeMenu,value:n,onValueChange:i,children:d.jsx(G_,{...s,ref:e})})});f9.displayName=d9;var h9="MenuRadioItem",p9=x.forwardRef((t,e)=>{const{value:n,...r}=t,s=fQ(h9,t.__scopeMenu),i=n===s.value;return d.jsx(m9,{scope:t.__scopeMenu,checked:i,children:d.jsx(rb,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Z_(i),onSelect:Le(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});p9.displayName=h9;var J_="MenuItemIndicator",[m9,hQ]=Nu(J_,{checked:!1}),g9=x.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=hQ(J_,n);return d.jsx(br,{present:r||e0(i.checked)||i.checked===!0,children:d.jsx(it.span,{...s,ref:e,"data-state":Z_(i.checked)})})});g9.displayName=J_;var pQ="MenuSeparator",x9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});x9.displayName=pQ;var mQ="MenuArrow",y9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=nb(n);return d.jsx(eb,{...s,...r,ref:e})});y9.displayName=mQ;var gQ="MenuSub",[URe,b9]=Nu(gQ),gh="MenuSubTrigger",v9=x.forwardRef((t,e)=>{const n=Tu(gh,t.__scopeMenu),r=um(gh,t.__scopeMenu),s=b9(gh,t.__scopeMenu),i=K_(gh,t.__scopeMenu),o=x.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:t.__scopeMenu},u=x.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return x.useEffect(()=>u,[u]),x.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),d.jsx(U_,{asChild:!0,...c,children:d.jsx(c9,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":C9(n.open),...t,ref:Vy(e,s.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(t.onPointerMove,Xh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Le(t.onPointerLeave,Xh(f=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const g=(m=n.content)==null?void 0:m.dataset.side,y=g==="right",v=y?-5:5,b=h[y?"left":"right"],w=h[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:b,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:b,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Le(t.onKeyDown,f=>{var p;const h=i.searchRef.current!=="";t.disabled||h&&f.key===" "||ZZ[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});v9.displayName=gh;var w9="MenuSubContent",k9=x.forwardRef((t,e)=>{const n=i9(ii,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Tu(ii,t.__scopeMenu),o=um(ii,t.__scopeMenu),a=b9(w9,t.__scopeMenu),l=x.useRef(null),c=Rt(e,l);return d.jsx(Yh.Provider,{scope:t.__scopeMenu,children:d.jsx(br,{present:r||i.open,children:d.jsx(Yh.Slot,{scope:t.__scopeMenu,children:d.jsx(q_,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Le(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Le(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Le(t.onKeyDown,u=>{var p;const f=u.currentTarget.contains(u.target),h=QZ[o.dir].includes(u.key);f&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});k9.displayName=w9;function C9(t){return t?"open":"closed"}function e0(t){return t==="indeterminate"}function Z_(t){return e0(t)?"indeterminate":t?"checked":"unchecked"}function xQ(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function yQ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bQ(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=yQ(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function vQ(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(s=!s)}return s}function wQ(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return vQ(n,e)}function Xh(t){return e=>e.pointerType==="mouse"?t(e):void 0}var kQ=s9,CQ=U_,_Q=o9,SQ=a9,EQ=G_,NQ=l9,TQ=rb,AQ=u9,IQ=f9,jQ=p9,RQ=g9,MQ=x9,PQ=y9,OQ=v9,LQ=k9,sb="DropdownMenu",[DQ]=cs(sb,[n9]),us=n9(),[FQ,_9]=DQ(sb),S9=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=t,l=us(e),c=x.useRef(null),[u,f]=ui({prop:s,defaultProp:i??!1,onChange:o,caller:sb});return d.jsx(FQ,{scope:e,triggerId:Ds(),triggerRef:c,contentId:Ds(),open:u,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(h=>!h),[f]),modal:a,children:d.jsx(kQ,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};S9.displayName=sb;var E9="DropdownMenuTrigger",N9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,i=_9(E9,n),o=us(n);return d.jsx(CQ,{asChild:!0,...o,children:d.jsx(it.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Vy(e,i.triggerRef),onPointerDown:Le(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Le(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});N9.displayName=E9;var $Q="DropdownMenuPortal",T9=t=>{const{__scopeDropdownMenu:e,...n}=t,r=us(e);return d.jsx(_Q,{...r,...n})};T9.displayName=$Q;var A9="DropdownMenuContent",I9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=_9(A9,n),i=us(n),o=x.useRef(!1);return d.jsx(SQ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:Le(t.onCloseAutoFocus,a=>{var l;o.current||(l=s.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Le(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!s.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});I9.displayName=A9;var BQ="DropdownMenuGroup",VQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(EQ,{...s,...r,ref:e})});VQ.displayName=BQ;var zQ="DropdownMenuLabel",HQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(NQ,{...s,...r,ref:e})});HQ.displayName=zQ;var UQ="DropdownMenuItem",j9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(TQ,{...s,...r,ref:e})});j9.displayName=UQ;var WQ="DropdownMenuCheckboxItem",R9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(AQ,{...s,...r,ref:e})});R9.displayName=WQ;var KQ="DropdownMenuRadioGroup",qQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(IQ,{...s,...r,ref:e})});qQ.displayName=KQ;var GQ="DropdownMenuRadioItem",JQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(jQ,{...s,...r,ref:e})});JQ.displayName=GQ;var ZQ="DropdownMenuItemIndicator",M9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(RQ,{...s,...r,ref:e})});M9.displayName=ZQ;var QQ="DropdownMenuSeparator",P9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(MQ,{...s,...r,ref:e})});P9.displayName=QQ;var YQ="DropdownMenuArrow",XQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(PQ,{...s,...r,ref:e})});XQ.displayName=YQ;var eY="DropdownMenuSubTrigger",tY=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(OQ,{...s,...r,ref:e})});tY.displayName=eY;var nY="DropdownMenuSubContent",rY=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(LQ,{...s,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rY.displayName=nY;var sY=S9,iY=N9,oY=T9,aY=I9,lY=j9,cY=R9,uY=M9,dY=P9;function hk(t,[e,n]){return Math.min(n,Math.max(e,t))}var ib="Popover",[O9]=cs(ib,[Ql]),dm=Ql(),[fY,Xl]=O9(ib),L9=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,a=dm(e),l=x.useRef(null),[c,u]=x.useState(!1),[f,h]=ui({prop:r,defaultProp:s??!1,onChange:i,caller:ib});return d.jsx(Yy,{...a,children:d.jsx(fY,{scope:e,contentId:Ds(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:x.useCallback(()=>u(!0),[]),onCustomAnchorRemove:x.useCallback(()=>u(!1),[]),modal:o,children:n})})};L9.displayName=ib;var D9="PopoverAnchor",F9=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl(D9,n),i=dm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return x.useEffect(()=>(o(),()=>a()),[o,a]),d.jsx(om,{...i,...r,ref:e})});F9.displayName=D9;var $9="PopoverTrigger",ob=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl($9,n),i=dm(n),o=Rt(e,s.triggerRef),a=d.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":U9(s.open),...r,ref:o,onClick:Le(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:d.jsx(om,{asChild:!0,...i,children:a})});ob.displayName=$9;var Q_="PopoverPortal",[hY,pY]=O9(Q_,{forceMount:void 0}),B9=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Xl(Q_,e);return d.jsx(hY,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};B9.displayName=Q_;var Gd="PopoverContent",ab=x.forwardRef((t,e)=>{const n=pY(Gd,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Xl(Gd,t.__scopePopover);return d.jsx(br,{present:r||i.open,children:i.modal?d.jsx(gY,{...s,ref:e}):d.jsx(xY,{...s,ref:e})})});ab.displayName=Gd;var mY=Ml("PopoverContent.RemoveScroll"),gY=x.forwardRef((t,e)=>{const n=Xl(Gd,t.__scopePopover),r=x.useRef(null),s=Rt(e,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return Wy(o)},[]),d.jsx(sm,{as:mY,allowPinchZoom:!0,children:d.jsx(V9,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Le(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Le(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),xY=x.forwardRef((t,e)=>{const n=Xl(Gd,t.__scopePopover),r=x.useRef(!1),s=x.useRef(!1);return d.jsx(V9,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),V9=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=t,h=Xl(Gd,n),p=dm(n);return Hy(),d.jsx(rm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(Xy,{"data-state":U9(h.open),role:"dialog",id:h.contentId,...p,...f,ref:e,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)"}})})})}),z9="PopoverClose",yY=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl(z9,n);return d.jsx(it.button,{type:"button",...r,ref:e,onClick:Le(t.onClick,()=>s.onOpenChange(!1))})});yY.displayName=z9;var bY="PopoverArrow",H9=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=dm(n);return d.jsx(eb,{...s,...r,ref:e})});H9.displayName=bY;function U9(t){return t?"open":"closed"}var lb=L9,vY=F9,wY=ob,cb=B9,W9=ab,Y_=H9;function kY(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var X_="ScrollArea",[K9]=cs(X_),[CY,mi]=K9(X_),q9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=t,[a,l]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState(null),[p,m]=x.useState(null),[g,y]=x.useState(null),[v,b]=x.useState(0),[w,k]=x.useState(0),[C,_]=x.useState(!1),[S,E]=x.useState(!1),N=Rt(e,O=>l(O)),T=Eu(s);return d.jsx(CY,{scope:n,type:r,dir:T,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:S,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:k,children:d.jsx(it.div,{dir:T,...o,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});q9.displayName=X_;var G9="ScrollAreaViewport",J9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,o=mi(G9,n),a=x.useRef(null),l=Rt(e,a,o.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),d.jsx(it.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});J9.displayName=G9;var Ho="ScrollAreaScrollbar",Z9=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,a=t.orientation==="horizontal";return x.useEffect(()=>(a?i(!0):o(!0),()=>{a?i(!1):o(!1)}),[a,i,o]),s.type==="hover"?d.jsx(_Y,{...r,ref:e,forceMount:n}):s.type==="scroll"?d.jsx(SY,{...r,ref:e,forceMount:n}):s.type==="auto"?d.jsx(Q9,{...r,ref:e,forceMount:n}):s.type==="always"?d.jsx(eS,{...r,ref:e}):null});Z9.displayName=Ho;var _Y=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),[i,o]=x.useState(!1);return x.useEffect(()=>{const a=s.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),d.jsx(br,{present:n||i,children:d.jsx(Q9,{"data-state":i?"visible":"hidden",...r,ref:e})})}),SY=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),i=t.orientation==="horizontal",o=db(()=>l("SCROLL_END"),100),[a,l]=kY("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return x.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,s.scrollHideDelay,l]),x.useEffect(()=>{const c=s.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const p=c[u];f!==p&&(l("SCROLL"),o()),f=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[s.viewport,i,l,o]),d.jsx(br,{present:n||a!=="hidden",children:d.jsx(eS,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Le(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Q9=x.forwardRef((t,e)=>{const n=mi(Ho,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,o]=x.useState(!1),a=t.orientation==="horizontal",l=db(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:u)}},10);return Jd(n.viewport,l),Jd(n.content,l),d.jsx(br,{present:r||i,children:d.jsx(eS,{"data-state":i?"visible":"hidden",...s,ref:e})})}),eS=x.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,s=mi(Ho,t.__scopeScrollArea),i=x.useRef(null),o=x.useRef(0),[a,l]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=nL(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return jY(h,o.current,a,p)}return n==="horizontal"?d.jsx(EY,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollLeft,p=jT(h,a,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?d.jsx(NY,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollTop,p=jT(h,a);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),EY=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=mi(Ho,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Rt(e,l,i.onScrollbarXChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(X9,{"data-orientation":"horizontal",...s,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ub(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+u.deltaX;t.onWheelScroll(h),sL(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:n0(o.paddingLeft),paddingEnd:n0(o.paddingRight)}})}})}),NY=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=mi(Ho,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Rt(e,l,i.onScrollbarYChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(X9,{"data-orientation":"vertical",...s,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ub(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollTop+u.deltaY;t.onWheelScroll(h),sL(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:n0(o.paddingTop),paddingEnd:n0(o.paddingBottom)}})}})}),[TY,Y9]=K9(Ho),X9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=t,p=mi(Ho,n),[m,g]=x.useState(null),y=Rt(e,N=>g(N)),v=x.useRef(null),b=x.useRef(""),w=p.viewport,k=r.content-r.viewport,C=hr(u),_=hr(l),S=db(f,10);function E(N){if(v.current){const T=N.clientX-v.current.left,O=N.clientY-v.current.top;c({x:T,y:O})}}return x.useEffect(()=>{const N=T=>{const O=T.target;(m==null?void 0:m.contains(O))&&C(T,k)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[w,m,k,C]),x.useEffect(_,[r,_]),Jd(m,S),Jd(p.content,S),d.jsx(TY,{scope:n,scrollbar:m,hasThumb:s,onThumbChange:hr(i),onThumbPointerUp:hr(o),onThumbPositionChange:_,onThumbPointerDown:hr(a),children:d.jsx(it.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:Le(t.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),v.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),E(N))}),onPointerMove:Le(t.onPointerMove,E),onPointerUp:Le(t.onPointerUp,N=>{const T=N.target;T.hasPointerCapture(N.pointerId)&&T.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),v.current=null})})})}),t0="ScrollAreaThumb",eL=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Y9(t0,t.__scopeScrollArea);return d.jsx(br,{present:n||s.hasThumb,children:d.jsx(AY,{ref:e,...r})})}),AY=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=mi(t0,n),o=Y9(t0,n),{onThumbPositionChange:a}=o,l=Rt(e,f=>o.onThumbChange(f)),c=x.useRef(void 0),u=db(()=>{c.current&&(c.current(),c.current=void 0)},100);return x.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(u(),!c.current){const p=RY(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,u,a]),d.jsx(it.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Le(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),m=f.clientX-p.left,g=f.clientY-p.top;o.onThumbPointerDown({x:m,y:g})}),onPointerUp:Le(t.onPointerUp,o.onThumbPointerUp)})});eL.displayName=t0;var tS="ScrollAreaCorner",tL=x.forwardRef((t,e)=>{const n=mi(tS,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(IY,{...t,ref:e}):null});tL.displayName=tS;var IY=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=mi(tS,n),[i,o]=x.useState(0),[a,l]=x.useState(0),c=!!(i&&a);return Jd(s.scrollbarX,()=>{var f;const u=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(u),l(u)}),Jd(s.scrollbarY,()=>{var f;const u=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(u),o(u)}),c?d.jsx(it.div,{...r,ref:e,style:{width:i,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function n0(t){return t?parseInt(t,10):0}function nL(t,e){const n=t/e;return isNaN(n)?0:n}function ub(t){const e=nL(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function jY(t,e,n,r="ltr"){const s=ub(n),i=s/2,o=e||i,a=s-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return rL([l,c],f)(t)}function jT(t,e,n="ltr"){const r=ub(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,o=e.content-e.viewport,a=i-r,l=n==="ltr"?[0,o]:[o*-1,0],c=hk(t,l);return rL([0,o],[0,a])(c)}function rL(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function sL(t,e){return t>0&&t<e}var RY=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},o=n.left!==i.left,a=n.top!==i.top;(o||a)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function db(t,e){const n=hr(t),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Jd(t,e){const n=hr(e);Un(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var MY=q9,PY=J9,OY=tL,LY=[" ","Enter","ArrowUp","ArrowDown"],DY=[" ","Enter"],Xc="Select",[fb,hb,FY]=C_(Xc),[Ef]=cs(Xc,[FY,Ql]),pb=Ql(),[$Y,ec]=Ef(Xc),[BY,VY]=Ef(Xc),iL=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:p,form:m}=t,g=pb(e),[y,v]=x.useState(null),[b,w]=x.useState(null),[k,C]=x.useState(!1),_=Eu(c),[S,E]=ui({prop:r,defaultProp:s??!1,onChange:i,caller:Xc}),[N,T]=ui({prop:o,defaultProp:a,onChange:l,caller:Xc}),O=x.useRef(null),L=y?m||!!y.closest("form"):!0,[I,M]=x.useState(new Set),V=Array.from(I).map(G=>G.props.value).join(";");return d.jsx(Yy,{...g,children:d.jsxs($Y,{required:p,scope:e,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Ds(),value:N,onValueChange:T,open:S,onOpenChange:E,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[d.jsx(fb.Provider,{scope:e,children:d.jsx(BY,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(G=>{M(D=>new Set(D).add(G))},[]),onNativeOptionRemove:x.useCallback(G=>{M(D=>{const B=new Set(D);return B.delete(G),B})},[]),children:n})}),L?d.jsxs(TL,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:N,onChange:G=>T(G.target.value),disabled:h,form:m,children:[N===void 0?d.jsx("option",{value:""}):null,Array.from(I)]},V):null]})})};iL.displayName=Xc;var oL="SelectTrigger",aL=x.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=pb(n),o=ec(oL,n),a=o.disabled||r,l=Rt(e,o.onTriggerChange),c=hb(n),u=x.useRef("touch"),[f,h,p]=IL(g=>{const y=c().filter(w=>!w.disabled),v=y.find(w=>w.value===o.value),b=jL(y,g,v);b!==void 0&&o.onValueChange(b.value)}),m=g=>{a||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return d.jsx(om,{asChild:!0,...i,children:d.jsx(it.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":AL(o.value)?"":void 0,...s,ref:l,onClick:Le(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&m(g)}),onPointerDown:Le(s.onPointerDown,g=>{u.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:Le(s.onKeyDown,g=>{const y=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(y&&g.key===" ")&&LY.includes(g.key)&&(m(),g.preventDefault())})})})});aL.displayName=oL;var lL="SelectValue",cL=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=t,l=ec(lL,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=Rt(e,l.onValueNodeChange);return Un(()=>{c(u)},[c,u]),d.jsx(it.span,{...a,ref:f,style:{pointerEvents:"none"},children:AL(l.value)?d.jsx(d.Fragment,{children:o}):i})});cL.displayName=lL;var zY="SelectIcon",uL=x.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return d.jsx(it.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});uL.displayName=zY;var HY="SelectPortal",dL=t=>d.jsx(Cf,{asChild:!0,...t});dL.displayName=HY;var eu="SelectContent",fL=x.forwardRef((t,e)=>{const n=ec(eu,t.__scopeSelect),[r,s]=x.useState();if(Un(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Rl.createPortal(d.jsx(hL,{scope:t.__scopeSelect,children:d.jsx(fb.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),i):null}return d.jsx(pL,{...t,ref:e})});fL.displayName=eu;var Ci=10,[hL,tc]=Ef(eu),UY="SelectContentImpl",WY=Ml("SelectContent.RemoveScroll"),pL=x.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y,...v}=t,b=ec(eu,n),[w,k]=x.useState(null),[C,_]=x.useState(null),S=Rt(e,Y=>k(Y)),[E,N]=x.useState(null),[T,O]=x.useState(null),L=hb(n),[I,M]=x.useState(!1),V=x.useRef(!1);x.useEffect(()=>{if(w)return Wy(w)},[w]),Hy();const G=x.useCallback(Y=>{const[H,...ne]=L().map(Oe=>Oe.ref.current),[de]=ne.slice(-1),xe=document.activeElement;for(const Oe of Y)if(Oe===xe||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===H&&C&&(C.scrollTop=0),Oe===de&&C&&(C.scrollTop=C.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==xe))return},[L,C]),D=x.useCallback(()=>G([E,w]),[G,E,w]);x.useEffect(()=>{I&&D()},[I,D]);const{onOpenChange:B,triggerPointerDownPosRef:F}=b;x.useEffect(()=>{if(w){let Y={x:0,y:0};const H=de=>{var xe,Oe;Y={x:Math.abs(Math.round(de.pageX)-(((xe=F.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(de.pageY)-(((Oe=F.current)==null?void 0:Oe.y)??0))}},ne=de=>{Y.x<=10&&Y.y<=10?de.preventDefault():w.contains(de.target)||B(!1),document.removeEventListener("pointermove",H),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",ne,{capture:!0})}}},[w,B,F]),x.useEffect(()=>{const Y=()=>B(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[B]);const[R,U]=IL(Y=>{const H=L().filter(xe=>!xe.disabled),ne=H.find(xe=>xe.ref.current===document.activeElement),de=jL(H,Y,ne);de&&setTimeout(()=>de.ref.current.focus())}),J=x.useCallback((Y,H,ne)=>{const de=!V.current&&!ne;(b.value!==void 0&&b.value===H||de)&&(N(Y),de&&(V.current=!0))},[b.value]),P=x.useCallback(()=>w==null?void 0:w.focus(),[w]),ie=x.useCallback((Y,H,ne)=>{const de=!V.current&&!ne;(b.value!==void 0&&b.value===H||de)&&O(Y)},[b.value]),ge=r==="popper"?pk:mL,ae=ge===pk?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y}:{};return d.jsx(hL,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:J,selectedItem:E,onItemLeave:P,itemTextRefCallback:ie,focusSelectedItem:D,selectedItemText:T,position:r,isPositioned:I,searchRef:R,children:d.jsx(sm,{as:WY,allowPinchZoom:!0,children:d.jsx(rm,{asChild:!0,trapped:b.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Le(s,Y=>{var H;(H=b.trigger)==null||H.focus({preventScroll:!0}),Y.preventDefault()}),children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:d.jsx(ge,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:Y=>Y.preventDefault(),...v,...ae,onPlaced:()=>M(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Le(v.onKeyDown,Y=>{const H=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!H&&Y.key.length===1&&U(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let de=L().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const xe=Y.target,Oe=de.indexOf(xe);de=de.slice(Oe+1)}setTimeout(()=>G(de)),Y.preventDefault()}})})})})})})});pL.displayName=UY;var KY="SelectItemAlignedPosition",mL=x.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=ec(eu,n),o=tc(eu,n),[a,l]=x.useState(null),[c,u]=x.useState(null),f=Rt(e,S=>u(S)),h=hb(n),p=x.useRef(!1),m=x.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=o,w=x.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&y&&v){const S=i.trigger.getBoundingClientRect(),E=c.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(i.dir!=="rtl"){const xe=T.left-E.left,Oe=N.left-xe,Ze=S.left-Oe,ot=S.width+Ze,pt=Math.max(ot,E.width),ye=window.innerWidth-Ci,Qe=hk(Oe,[Ci,Math.max(Ci,ye-pt)]);a.style.minWidth=ot+"px",a.style.left=Qe+"px"}else{const xe=E.right-T.right,Oe=window.innerWidth-N.right-xe,Ze=window.innerWidth-S.right-Oe,ot=S.width+Ze,pt=Math.max(ot,E.width),ye=window.innerWidth-Ci,Qe=hk(Oe,[Ci,Math.max(Ci,ye-pt)]);a.style.minWidth=ot+"px",a.style.right=Qe+"px"}const O=h(),L=window.innerHeight-Ci*2,I=g.scrollHeight,M=window.getComputedStyle(c),V=parseInt(M.borderTopWidth,10),G=parseInt(M.paddingTop,10),D=parseInt(M.borderBottomWidth,10),B=parseInt(M.paddingBottom,10),F=V+G+I+B+D,R=Math.min(y.offsetHeight*5,F),U=window.getComputedStyle(g),J=parseInt(U.paddingTop,10),P=parseInt(U.paddingBottom,10),ie=S.top+S.height/2-Ci,ge=L-ie,ae=y.offsetHeight/2,Y=y.offsetTop+ae,H=V+G+Y,ne=F-H;if(H<=ie){const xe=O.length>0&&y===O[O.length-1].ref.current;a.style.bottom="0px";const Oe=c.clientHeight-g.offsetTop-g.offsetHeight,Ze=Math.max(ge,ae+(xe?P:0)+Oe+D),ot=H+Ze;a.style.height=ot+"px"}else{const xe=O.length>0&&y===O[0].ref.current;a.style.top="0px";const Ze=Math.max(ie,V+g.offsetTop+(xe?J:0)+ae)+ne;a.style.height=Ze+"px",g.scrollTop=H-ie+g.offsetTop}a.style.margin=`${Ci}px 0`,a.style.minHeight=R+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,g,y,v,i.dir,r]);Un(()=>w(),[w]);const[k,C]=x.useState();Un(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const _=x.useCallback(S=>{S&&m.current===!0&&(w(),b==null||b(),m.current=!1)},[w,b]);return d.jsx(GY,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:d.jsx(it.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});mL.displayName=KY;var qY="SelectPopperPosition",pk=x.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Ci,...i}=t,o=pb(n);return d.jsx(Xy,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pk.displayName=qY;var[GY,nS]=Ef(eu,{}),mk="SelectViewport",gL=x.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=tc(mk,n),o=nS(mk,n),a=Rt(e,i.onViewportChange),l=x.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(fb.Slot,{scope:n,children:d.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Le(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Ci*2,g=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),v=Math.max(g,y);if(v<m){const b=v+p,w=Math.min(m,b),k=b-w;f.style.height=w+"px",f.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});gL.displayName=mk;var xL="SelectGroup",[JY,ZY]=Ef(xL),QY=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ds();return d.jsx(JY,{scope:n,id:s,children:d.jsx(it.div,{role:"group","aria-labelledby":s,...r,ref:e})})});QY.displayName=xL;var yL="SelectLabel",YY=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=ZY(yL,n);return d.jsx(it.div,{id:s.id,...r,ref:e})});YY.displayName=yL;var r0="SelectItem",[XY,bL]=Ef(r0),vL=x.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,a=ec(r0,n),l=tc(r0,n),c=a.value===r,[u,f]=x.useState(i??""),[h,p]=x.useState(!1),m=Rt(e,b=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,b,r,s)}),g=Ds(),y=x.useRef("touch"),v=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(XY,{scope:n,value:r,disabled:s,textId:g,isSelected:c,onItemTextChange:x.useCallback(b=>{f(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:d.jsx(fb.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:d.jsx(it.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:Le(o.onFocus,()=>p(!0)),onBlur:Le(o.onBlur,()=>p(!1)),onClick:Le(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:Le(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:Le(o.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Le(o.onPointerMove,b=>{var w;y.current=b.pointerType,s?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Le(o.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Le(o.onKeyDown,b=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&b.key===" "||(DY.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});vL.displayName=r0;var xh="SelectItemText",wL=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=ec(xh,n),a=tc(xh,n),l=bL(xh,n),c=VY(xh,n),[u,f]=x.useState(null),h=Rt(e,v=>f(v),l.onItemTextChange,v=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,v,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=x.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=c;return Un(()=>(g(m),()=>y(m)),[g,y,m]),d.jsxs(d.Fragment,{children:[d.jsx(it.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Rl.createPortal(i.children,o.valueNode):null]})});wL.displayName=xh;var kL="SelectItemIndicator",CL=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return bL(kL,n).isSelected?d.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});CL.displayName=kL;var gk="SelectScrollUpButton",_L=x.forwardRef((t,e)=>{const n=tc(gk,t.__scopeSelect),r=nS(gk,t.__scopeSelect),[s,i]=x.useState(!1),o=Rt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?d.jsx(EL,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_L.displayName=gk;var xk="SelectScrollDownButton",SL=x.forwardRef((t,e)=>{const n=tc(xk,t.__scopeSelect),r=nS(xk,t.__scopeSelect),[s,i]=x.useState(!1),o=Rt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?d.jsx(EL,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});SL.displayName=xk;var EL=x.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=tc("SelectScrollButton",n),o=x.useRef(null),a=hb(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),Un(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(it.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:Le(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Le(s.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Le(s.onPointerLeave,()=>{l()})})}),eX="SelectSeparator",NL=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});NL.displayName=eX;var yk="SelectArrow",tX=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=pb(n),i=ec(yk,n),o=tc(yk,n);return i.open&&o.position==="popper"?d.jsx(eb,{...s,...r,ref:e}):null});tX.displayName=yk;var nX="SelectBubbleInput",TL=x.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=x.useRef(null),i=Rt(r,s),o=xJ(e);return x.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const f=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(f)}},[o,e]),d.jsx(it.select,{...n,style:{...zP,...n.style},ref:i,defaultValue:e})});TL.displayName=nX;function AL(t){return t===""||t===void 0}function IL(t){const e=hr(t),n=x.useRef(""),r=x.useRef(0),s=x.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),i=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function jL(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=rX(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function rX(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var sX=iL,iX=aL,oX=cL,aX=uL,lX=dL,cX=fL,uX=gL,dX=vL,fX=wL,WRe=CL,KRe=_L,qRe=SL,hX=NL,pX="Separator",RT="horizontal",mX=["horizontal","vertical"],RL=x.forwardRef((t,e)=>{const{decorative:n,orientation:r=RT,...s}=t,i=gX(r)?r:RT,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return d.jsx(it.div,{"data-orientation":i,...a,...s,ref:e})});RL.displayName=pX;function gX(t){return mX.includes(t)}var ML=RL,mb="Tabs",[xX]=cs(mb,[Yl]),PL=Yl(),[yX,rS]=xX(mb),OL=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=t,u=Eu(a),[f,h]=ui({prop:r,onChange:s,defaultProp:i??"",caller:mb});return d.jsx(yX,{scope:n,baseId:Ds(),value:f,onValueChange:h,orientation:o,dir:u,activationMode:l,children:d.jsx(it.div,{dir:u,"data-orientation":o,...c,ref:e})})});OL.displayName=mb;var LL="TabsList",DL=x.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=rS(LL,n),o=PL(n);return d.jsx(tb,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:d.jsx(it.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});DL.displayName=LL;var FL="TabsTrigger",$L=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,o=rS(FL,n),a=PL(n),l=zL(o.baseId,r),c=HL(o.baseId,r),u=r===o.value;return d.jsx(lm,{asChild:!0,...a,focusable:!s,active:u,children:d.jsx(it.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...i,ref:e,onMouseDown:Le(t.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Le(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Le(t.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!s&&f&&o.onValueChange(r)})})})});$L.displayName=FL;var BL="TabsContent",VL=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=t,a=rS(BL,n),l=zL(a.baseId,r),c=HL(a.baseId,r),u=r===a.value,f=x.useRef(u);return x.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),d.jsx(br,{present:s||u,children:({present:h})=>d.jsx(it.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});VL.displayName=BL;function zL(t,e){return`${t}-trigger-${e}`}function HL(t,e){return`${t}-content-${e}`}var bX=OL,vX=DL,wX=$L,kX=VL,UL="Toggle",WL=x.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:s,...i}=t,[o,a]=ui({prop:n,onChange:s,defaultProp:r??!1,caller:UL});return d.jsx(it.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:Le(t.onClick,()=>{t.disabled||a(!o)})})});WL.displayName=UL;var nc="ToggleGroup",[KL,qL]=cs(nc,[Yl]),GL=Yl(),sS=j.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const s=r;return d.jsx(CX,{...s,ref:e})}if(n==="multiple"){const s=r;return d.jsx(_X,{...s,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${nc}\``)});sS.displayName=nc;var[JL,ZL]=KL(nc),CX=j.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,a]=ui({prop:n,defaultProp:r??"",onChange:s,caller:nc});return d.jsx(JL,{scope:t.__scopeToggleGroup,type:"single",value:j.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:j.useCallback(()=>a(""),[a]),children:d.jsx(QL,{...i,ref:e})})}),_X=j.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,a]=ui({prop:n,defaultProp:r??[],onChange:s,caller:nc}),l=j.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=j.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(JL,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:d.jsx(QL,{...i,ref:e})})});sS.displayName=nc;var[SX,EX]=KL(nc),QL=j.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:a=!0,...l}=t,c=GL(n),u=Eu(o),f={role:"group",dir:u,...l};return d.jsx(SX,{scope:n,rovingFocus:s,disabled:r,children:s?d.jsx(tb,{asChild:!0,...c,orientation:i,dir:u,loop:a,children:d.jsx(it.div,{...f,ref:e})}):d.jsx(it.div,{...f,ref:e})})}),s0="ToggleGroupItem",YL=j.forwardRef((t,e)=>{const n=ZL(s0,t.__scopeToggleGroup),r=EX(s0,t.__scopeToggleGroup),s=GL(t.__scopeToggleGroup),i=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:i,disabled:o},l=j.useRef(null);return r.rovingFocus?d.jsx(lm,{asChild:!0,...s,focusable:!o,active:i,ref:l,children:d.jsx(MT,{...a,ref:e})}):d.jsx(MT,{...a,ref:e})});YL.displayName=s0;var MT=j.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...s}=t,i=ZL(s0,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return d.jsx(WL,{...a,...s,ref:e,onPressedChange:l=>{l?i.onItemActivate(r):i.onItemDeactivate(r)}})}),NX=sS,TX=YL,iS="Toolbar",[AX]=cs(iS,[Yl,qL]),oS=Yl(),XL=qL(),[IX,eD]=AX(iS),tD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,orientation:r="horizontal",dir:s,loop:i=!0,...o}=t,a=oS(n),l=Eu(s);return d.jsx(IX,{scope:n,orientation:r,dir:l,children:d.jsx(tb,{asChild:!0,...a,orientation:r,dir:l,loop:i,children:d.jsx(it.div,{role:"toolbar","aria-orientation":r,dir:l,...o,ref:e})})})});tD.displayName=iS;var nD="ToolbarSeparator",rD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=eD(nD,n);return d.jsx(ML,{orientation:s.orientation==="horizontal"?"vertical":"horizontal",...r,ref:e})});rD.displayName=nD;var jX="ToolbarButton",aS=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=oS(n);return d.jsx(lm,{asChild:!0,...s,focusable:!t.disabled,children:d.jsx(it.button,{type:"button",...r,ref:e})})});aS.displayName=jX;var RX="ToolbarLink",MX=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=oS(n);return d.jsx(lm,{asChild:!0,...s,focusable:!0,children:d.jsx(it.a,{...r,ref:e,onKeyDown:Le(t.onKeyDown,i=>{i.key===" "&&i.currentTarget.click()})})})});MX.displayName=RX;var sD="ToolbarToggleGroup",iD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=eD(sD,n),i=XL(n);return d.jsx(NX,{"data-orientation":s.orientation,dir:s.dir,...i,...r,ref:e,rovingFocus:!1})});iD.displayName=sD;var PX="ToolbarToggleItem",oD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=XL(n),i={__scopeToolbar:t.__scopeToolbar};return d.jsx(aS,{asChild:!0,...i,children:d.jsx(TX,{...s,...r,ref:e})})});oD.displayName=PX;var aD=tD,OX=rD,vd=aS,LX=iD,V1=oD,[gb]=cs("Tooltip",[Ql]),xb=Ql(),lD="TooltipProvider",DX=700,bk="tooltip.open",[FX,lS]=gb(lD),cD=t=>{const{__scopeTooltip:e,delayDuration:n=DX,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(FX,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})};cD.displayName=lD;var ep="Tooltip",[$X,fm]=gb(ep),uD=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=lS(ep,t.__scopeTooltip),c=xb(e),[u,f]=x.useState(null),h=Ds(),p=x.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,y=x.useRef(!1),[v,b]=ui({prop:r,defaultProp:s??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(bk))):l.onClose(),i==null||i(S)},caller:ep}),w=x.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),k=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),_=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},g)},[g,b]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),d.jsx(Yy,{...c,children:d.jsx($X,{scope:e,contentId:h,open:v,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?_():k()},[l.isOpenDelayedRef,_,k]),onTriggerLeave:x.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:k,onClose:C,disableHoverableContent:m,children:n})})};uD.displayName=ep;var vk="TooltipTrigger",dD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=fm(vk,n),i=lS(vk,n),o=xb(n),a=x.useRef(null),l=Rt(e,a,s.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),f=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),d.jsx(om,{asChild:!0,...o,children:d.jsx(it.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:Le(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Le(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Le(t.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Le(t.onFocus,()=>{c.current||s.onOpen()}),onBlur:Le(t.onBlur,s.onClose),onClick:Le(t.onClick,s.onClose)})})});dD.displayName=vk;var cS="TooltipPortal",[BX,VX]=gb(cS,{forceMount:void 0}),fD=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=fm(cS,e);return d.jsx(BX,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};fD.displayName=cS;var Zd="TooltipContent",hD=x.forwardRef((t,e)=>{const n=VX(Zd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=fm(Zd,t.__scopeTooltip);return d.jsx(br,{present:r||o.open,children:o.disableHoverableContent?d.jsx(pD,{side:s,...i,ref:e}):d.jsx(zX,{side:s,...i,ref:e})})}),zX=x.forwardRef((t,e)=>{const n=fm(Zd,t.__scopeTooltip),r=lS(Zd,t.__scopeTooltip),s=x.useRef(null),i=Rt(e,s),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:f}=r,h=x.useCallback(()=>{a(null),f(!1)},[f]),p=x.useCallback((m,g)=>{const y=m.currentTarget,v={x:m.clientX,y:m.clientY},b=KX(v,y.getBoundingClientRect()),w=qX(v,b),k=GX(g.getBoundingClientRect()),C=ZX([...w,...k]);a(C),f(!0)},[f]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(l&&u){const m=y=>p(y,u),g=y=>p(y,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,p,h]),x.useEffect(()=>{if(o){const m=g=>{const y=g.target,v={x:g.clientX,y:g.clientY},b=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),w=!JX(v,o);b?h():w&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,h]),d.jsx(pD,{...t,ref:i})}),[HX,UX]=gb(ep,{isInside:!1}),WX=Tq("TooltipContent"),pD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,l=fm(Zd,n),c=xb(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(bk,u),()=>document.removeEventListener(bk,u)),[u]),x.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:d.jsxs(Xy,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(WX,{children:r}),d.jsx(HX,{scope:n,isInside:!0,children:d.jsx(Pq,{id:l.contentId,role:"tooltip",children:s||r})})]})})});hD.displayName=Zd;var mD="TooltipArrow",gD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=xb(n);return UX(mD,n).isInside?null:d.jsx(eb,{...s,...r,ref:e})});gD.displayName=mD;function KX(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function qX(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function GX(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function JX(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(s=!s)}return s}function ZX(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),QX(e)}function QX(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var uS=cD,dS=uD,fS=dD,hS=fD,pS=hD,xD=gD;function yD(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=yD(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function bD(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=yD(t))&&(r&&(r+=" "),r+=e);return r}const YX=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},XX=(t,e)=>({classGroupId:t,validator:e}),vD=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),i0="-",PT=[],eee="arbitrary..",tee=t=>{const e=ree(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return nee(o);const a=o.split(i0),l=a[0]===""&&a.length>1?1:0;return wD(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?YX(c,l):l:c||PT}return n[o]||PT}}},wD=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const c=wD(t,e+1,i);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(i0):t.slice(e).join(i0),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},nee=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?eee+r:void 0})(),ree=t=>{const{theme:e,classGroups:n}=t;return see(n,e)},see=(t,e)=>{const n=vD();for(const r in t){const s=t[r];mS(s,n,r,e)}return n},mS=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const o=t[i];iee(o,e,n,r)}},iee=(t,e,n,r)=>{if(typeof t=="string"){oee(t,e,n);return}if(typeof t=="function"){aee(t,e,n,r);return}lee(t,e,n,r)},oee=(t,e,n)=>{const r=t===""?e:kD(e,t);r.classGroupId=n},aee=(t,e,n,r)=>{if(cee(t)){mS(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(XX(n,t))},lee=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[a,l]=s[o];mS(l,kD(e,a),n,r)}},kD=(t,e)=>{let n=t;const r=e.split(i0),s=r.length;for(let i=0;i<s;i++){const o=r[i];let a=n.nextPart.get(o);a||(a=vD(),n.nextPart.set(o,a)),n=a}return n},cee=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,uee=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},wk="!",OT=":",dee=[],LT=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),fee=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let o=0,a=0,l=0,c;const u=s.length;for(let g=0;g<u;g++){const y=s[g];if(o===0&&a===0){if(y===OT){i.push(s.slice(l,g)),l=g+1;continue}if(y==="/"){c=g;continue}}y==="["?o++:y==="]"?o--:y==="("?a++:y===")"&&a--}const f=i.length===0?s:s.slice(l);let h=f,p=!1;f.endsWith(wk)?(h=f.slice(0,-1),p=!0):f.startsWith(wk)&&(h=f.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return LT(i,p,h,m)};if(e){const s=e+OT,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):LT(dee,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},hee=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",l=e.has(o);a||l?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},pee=t=>({cache:uee(t.cacheSize),parseClassName:fee(t),sortModifiers:hee(t),...tee(t)}),mee=/\s+/,gee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,o=[],a=t.trim().split(mee);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(u);if(f){l=u+(l.length>0?" "+l:l);continue}let y=!!g,v=r(y?m.substring(0,g):m);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=r(m),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const b=h.length===0?"":h.length===1?h[0]:i(h).join(":"),w=p?b+wk:b,k=w+v;if(o.indexOf(k)>-1)continue;o.push(k);const C=s(v,y);for(let _=0;_<C.length;++_){const S=C[_];o.push(w+S)}l=u+(l.length>0?" "+l:l)}return l},xee=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=CD(n))&&(s&&(s+=" "),s+=r);return s},CD=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=CD(t[r]))&&(n&&(n+=" "),n+=e);return n},yee=(t,...e)=>{let n,r,s,i;const o=l=>{const c=e.reduce((u,f)=>f(u),t());return n=pee(c),r=n.cache.get,s=n.cache.set,i=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=gee(l,n);return s(l,u),u};return i=o,(...l)=>i(xee(...l))},bee=[],or=t=>{const e=n=>n[t]||bee;return e.isThemeGetter=!0,e},_D=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,SD=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vee=/^\d+\/\d+$/,wee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Cee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_ee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,See=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ku=t=>vee.test(t),Tt=t=>!!t&&!Number.isNaN(Number(t)),Qa=t=>!!t&&Number.isInteger(Number(t)),z1=t=>t.endsWith("%")&&Tt(t.slice(0,-1)),Jo=t=>wee.test(t),ED=()=>!0,Eee=t=>kee.test(t)&&!Cee.test(t),gS=()=>!1,Nee=t=>_ee.test(t),Tee=t=>See.test(t),Aee=t=>!Xe(t)&&!et(t),Iee=t=>rc(t,AD,gS),Xe=t=>_D.test(t),pc=t=>rc(t,ID,Eee),DT=t=>rc(t,Fee,Tt),jee=t=>rc(t,RD,ED),Ree=t=>rc(t,jD,gS),FT=t=>rc(t,ND,gS),Mee=t=>rc(t,TD,Tee),ag=t=>rc(t,MD,Nee),et=t=>SD.test(t),Kf=t=>Au(t,ID),Pee=t=>Au(t,jD),$T=t=>Au(t,ND),Oee=t=>Au(t,AD),Lee=t=>Au(t,TD),lg=t=>Au(t,MD,!0),Dee=t=>Au(t,RD,!0),rc=(t,e,n)=>{const r=_D.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Au=(t,e,n=!1)=>{const r=SD.exec(t);return r?r[1]?e(r[1]):n:!1},ND=t=>t==="position"||t==="percentage",TD=t=>t==="image"||t==="url",AD=t=>t==="length"||t==="size"||t==="bg-size",ID=t=>t==="length",Fee=t=>t==="number",jD=t=>t==="family-name",RD=t=>t==="number"||t==="weight",MD=t=>t==="shadow",$ee=()=>{const t=or("color"),e=or("font"),n=or("text"),r=or("font-weight"),s=or("tracking"),i=or("leading"),o=or("breakpoint"),a=or("container"),l=or("spacing"),c=or("radius"),u=or("shadow"),f=or("inset-shadow"),h=or("text-shadow"),p=or("drop-shadow"),m=or("blur"),g=or("perspective"),y=or("aspect"),v=or("ease"),b=or("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...k(),et,Xe],_=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],E=()=>[et,Xe,l],N=()=>[Ku,"full","auto",...E()],T=()=>[Qa,"none","subgrid",et,Xe],O=()=>["auto",{span:["full",Qa,et,Xe]},Qa,et,Xe],L=()=>[Qa,"auto",et,Xe],I=()=>["auto","min","max","fr",et,Xe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...E()],D=()=>[Ku,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],B=()=>[t,et,Xe],F=()=>[...k(),$T,FT,{position:[et,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Oee,Iee,{size:[et,Xe]}],J=()=>[z1,Kf,pc],P=()=>["","none","full",c,et,Xe],ie=()=>["",Tt,Kf,pc],ge=()=>["solid","dashed","dotted","double"],ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Tt,z1,$T,FT],H=()=>["","none",m,et,Xe],ne=()=>["none",Tt,et,Xe],de=()=>["none",Tt,et,Xe],xe=()=>[Tt,et,Xe],Oe=()=>[Ku,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jo],breakpoint:[Jo],color:[ED],container:[Jo],"drop-shadow":[Jo],ease:["in","out","in-out"],font:[Aee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jo],shadow:[Jo],spacing:["px",Tt],text:[Jo],"text-shadow":[Jo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ku,Xe,et,y]}],container:["container"],columns:[{columns:[Tt,Xe,et,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Qa,"auto",et,Xe]}],basis:[{basis:[Ku,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Tt,Ku,"auto","initial","none",Xe]}],grow:[{grow:["",Tt,et,Xe]}],shrink:[{shrink:["",Tt,et,Xe]}],order:[{order:[Qa,"first","last","none",et,Xe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,Kf,pc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Dee,jee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",z1,Xe]}],"font-family":[{font:[Pee,Ree,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,et,Xe]}],"line-clamp":[{"line-clamp":[Tt,"none",et,DT]}],leading:[{leading:[i,...E()]}],"list-image":[{"list-image":["none",et,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Tt,"from-font","auto",et,pc]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Tt,"auto",et,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qa,et,Xe],radial:["",et,Xe],conic:[Qa,et,Xe]},Lee,Mee]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Tt,et,Xe]}],"outline-w":[{outline:["",Tt,Kf,pc]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",u,lg,ag]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,lg,ag]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Tt,pc]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,lg,ag]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Tt,et,Xe]}],"mix-blend":[{"mix-blend":[...ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[et,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Xe]}],filter:[{filter:["","none",et,Xe]}],blur:[{blur:H()}],brightness:[{brightness:[Tt,et,Xe]}],contrast:[{contrast:[Tt,et,Xe]}],"drop-shadow":[{"drop-shadow":["","none",p,lg,ag]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Tt,et,Xe]}],"hue-rotate":[{"hue-rotate":[Tt,et,Xe]}],invert:[{invert:["",Tt,et,Xe]}],saturate:[{saturate:[Tt,et,Xe]}],sepia:[{sepia:["",Tt,et,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Xe]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Tt,et,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Tt,et,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Tt,et,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tt,et,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Tt,et,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Tt,et,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Tt,et,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Tt,et,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Tt,"initial",et,Xe]}],ease:[{ease:["linear","initial",v,et,Xe]}],delay:[{delay:[Tt,et,Xe]}],animate:[{animate:["none",b,et,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,et,Xe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[et,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,Xe]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Tt,Kf,pc,DT]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Bee=yee($ee),Vee=["active","paused","archived"],zee=["local_trusted","authenticated"],Hee=["private","public"],Uee=["dx","gtm"],Wee=["auto","explicit"],Kee=["active","paused","idle","running","error","pending_approval","terminated"],hm=["process","http","claude_local","codex_local","opencode_local","pi_local","cursor","openclaw_gateway","hermes_local"],qee=["ceo","cto","cmo","cfo","engineer","designer","pm","qa","devops","researcher","general"],Gee={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",engineer:"Engineer",designer:"Designer",pm:"PM",qa:"QA",devops:"DevOps",researcher:"Researcher",general:"General"},xS=["bot","cpu","brain","zap","rocket","code","terminal","shield","eye","search","wrench","hammer","lightbulb","sparkles","star","heart","flame","bug","cog","database","globe","lock","mail","message-square","file-code","git-branch","package","puzzle","target","wand","atom","circuit-board","radar","swords","telescope","microscope","crown","gem","hexagon","pentagon","fingerprint"],Jee=["active","paused","done","cancelled"],PD=["backlog","todo","in_progress","in_review","done","blocked","cancelled"],Zee=["critical","high","medium","low"],Qee=["company","team","agent","task"],Yee=["planned","active","achieved","cancelled"],Xee=["backlog","planned","in_progress","completed","cancelled"],GRe=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"],ete=["hire_agent","approve_ceo_strategy","budget_override_required"],OD=["local_encrypted","aws_secrets_manager","gcp_secret_manager","vault"],tte=["local_disk","s3"],nte=["metered_api","subscription_included","subscription_overage","credits","fixed","unknown"],rte=["inference_charge","platform_fee","credit_purchase","credit_refund","credit_expiry","byok_fee","gateway_overhead","log_storage_charge","logpush_charge","provisioned_capacity_charge","training_charge","custom_model_import_charge","custom_model_storage_charge","manual_adjustment"],ste=["debit","credit"],ite=["input_token","output_token","cached_input_token","request","credit_usd","credit_unit","model_unit_minute","model_unit_hour","gb_month","train_token","unknown"],ote=["company","agent","project"],ate=["billed_cents"],lte=["calendar_month_utc","lifetime"],cte=["keep_paused","raise_budget_and_resume"],ute=["human","agent","both"],LD=["human","agent"],dte=["pending_approval","approved","rejected"],fte=["agents:create","users:invite","users:manage_permissions","tasks:assign","tasks:assign_scope","joins:approve"],hte=["installed","ready","disabled","error","upgrade_pending","uninstalled"],pte=["connector","workspace","automation","ui"],mte=["companies.read","projects.read","project.workspaces.read","issues.read","issue.comments.read","issue.documents.read","agents.read","goals.read","goals.create","goals.update","activity.read","costs.read","issues.create","issues.update","issue.comments.create","issue.documents.write","agents.pause","agents.resume","agents.invoke","agent.sessions.create","agent.sessions.list","agent.sessions.send","agent.sessions.close","activity.log.write","metrics.write","plugin.state.read","plugin.state.write","events.subscribe","events.emit","jobs.schedule","webhooks.receive","http.outbound","secrets.read-ref","agent.tools.register","instance.settings.register","ui.sidebar.register","ui.page.register","ui.detailTab.register","ui.dashboardWidget.register","ui.commentAnnotation.register","ui.action.register"],gte=["page","detailTab","taskDetailView","dashboardWidget","sidebar","sidebarPanel","projectSidebarItem","globalToolbarButton","toolbarButton","contextMenuItem","commentAnnotation","commentContextMenuItem","settingsPage"],xte=["dashboard","onboarding","companies","company","settings","plugins","org","agents","projects","tickets","issues","goals","approvals","costs","activity","inbox","design-guide","tests"],yte=["page","detailTab","taskDetailView","dashboardWidget","sidebar","sidebarPanel","projectSidebarItem","globalToolbarButton","toolbarButton","contextMenuItem","commentAnnotation","commentContextMenuItem","settingsPage"],bte=["navigate","openModal","openDrawer","openPopover","performAction","deepLink"],DD=["inline","compact","default","wide","full"],vte=["hostInline","hostOverlay","hostRoute","external","iframe"],FD=["project","issue","agent","goal","run","comment"],yS=["instance","company","project","project_workspace","agent","issue","goal","run"];var Ut;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ut||(Ut={}));var BT;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(BT||(BT={}));const Je=Ut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ol=t=>{switch(typeof t){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return Number.isNaN(t)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(t)?Je.array:t===null?Je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Je.promise:typeof Map<"u"&&t instanceof Map?Je.map:typeof Set<"u"&&t instanceof Set?Je.set:typeof Date<"u"&&t instanceof Date?Je.date:Je.object;default:return Je.unknown}},ve=Ut.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 Ia extends Error{get errors(){return this.issues}constructor(e){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=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Ia))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ut.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ia.create=t=>new Ia(t);const kk=(t,e)=>{let n;switch(t.code){case ve.invalid_type:t.received===Je.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ut.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ut.joinValues(t.keys,", ")}`;break;case ve.invalid_union:n="Invalid input";break;case ve.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ut.joinValues(t.options)}`;break;case ve.invalid_enum_value:n=`Invalid enum value. Expected ${Ut.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:n="Invalid function arguments";break;case ve.invalid_return_type:n="Invalid function return type";break;case ve.invalid_date:n="Invalid date";break;case ve.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ut.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ve.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ve.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ve.custom:n="Invalid input";break;case ve.invalid_intersection_types:n="Intersection results could not be merged";break;case ve.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ut.assertNever(t)}return{message:n}};let wte=kk;function kte(){return wte}const Cte=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ze(t,e){const n=kte(),r=Cte({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===kk?void 0:kk].filter(s=>!!s)});t.common.issues.push(r)}class is{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return gt;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return is.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return gt;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const gt=Object.freeze({status:"aborted"}),yh=t=>({status:"dirty",value:t}),gi=t=>({status:"valid",value:t}),VT=t=>t.status==="aborted",zT=t=>t.status==="dirty",Qd=t=>t.status==="valid",o0=t=>typeof Promise<"u"&&t instanceof Promise;var rt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(rt||(rt={}));class Oo{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 HT=(t,e)=>{if(Qd(e))return{success:!0,data:e.value};if(!t.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 Ia(t.common.issues);return this._error=n,this._error}}};function _t(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Lt{get description(){return this._def.description}_getType(e){return ol(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new is,ctx:{common:e.parent.common,data:e.data,parsedType:ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(o0(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,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:e,parsedType:ol(e)},s=this._parseSync({data:e,path:r.path,parent:r});return HT(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ol(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Qd(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Qd(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,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:e,parsedType:ol(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(o0(s)?s:Promise.resolve(s));return HT(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ve.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Dl({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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 Ca.create(this,this._def)}nullable(){return ru.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Io.create(this)}promise(){return f0.create(this,this._def)}or(e){return l0.create([this,e],this._def)}and(e){return c0.create(this,e,this._def)}transform(e){return new Dl({..._t(this._def),schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new h0({..._t(this._def),innerType:this,defaultValue:n,typeName:xt.ZodDefault})}brand(){return new zD({typeName:xt.ZodBranded,type:this,..._t(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new p0({..._t(this._def),innerType:this,catchValue:n,typeName:xt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return vS.create(this,e)}readonly(){return m0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _te=/^c[^\s-]{8,}$/i,Ste=/^[0-9a-z]+$/,Ete=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nte=/^[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,Tte=/^[a-z0-9_-]{21}$/i,Ate=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ite=/^[-+]?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)?)??$/,jte=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rte="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let H1;const Mte=/^(?:(?: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])$/,Pte=/^(?:(?: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])$/,Ote=/^(([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]))$/,Lte=/^(([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])$/,Dte=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fte=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$D="((\\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])))",$te=new RegExp(`^${$D}$`);function BD(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Bte(t){return new RegExp(`^${BD(t)}$`)}function Vte(t){let e=`${$D}T${BD(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function zte(t,e){return!!((e==="v4"||!e)&&Mte.test(t)||(e==="v6"||!e)&&Ote.test(t))}function Hte(t,e){if(!Ate.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ute(t,e){return!!((e==="v4"||!e)&&Pte.test(t)||(e==="v6"||!e)&&Lte.test(t))}class ma extends Lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Je.string){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.string,received:i.parsedType}),gt}const r=new is;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ze(s,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ze(s,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")jte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"email",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")H1||(H1=new RegExp(Rte,"u")),H1.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"emoji",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Nte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"uuid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Tte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"nanoid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")_te.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cuid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Ste.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cuid2",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Ete.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"ulid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ze(s,{validation:"url",code:ve.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"regex",code:ve.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Vte(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?$te.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Bte(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Ite.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"duration",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?zte(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"ip",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Hte(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"jwt",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ute(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cidr",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Dte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"base64",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Fte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"base64url",code:ve.invalid_string,message:i.message}),r.dirty()):Ut.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ve.invalid_string,...rt.errToObj(r)})}_addCheck(e){return new ma({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...rt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...rt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...rt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...rt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...rt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...rt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...rt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...rt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...rt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...rt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...rt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...rt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...rt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...rt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...rt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...rt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...rt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...rt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...rt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...rt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...rt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...rt.errToObj(n)})}nonempty(e){return this.min(1,rt.errToObj(e))}trim(){return new ma({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ma({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ma({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ma.create=t=>new ma({checks:[],typeName:xt.ZodString,coerce:(t==null?void 0:t.coerce)??!1,..._t(t)});function Wte(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Yd extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Je.number){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.number,received:i.parsedType}),gt}let r;const s=new is;for(const i of this._def.checks)i.kind==="int"?Ut.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Wte(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_finite,message:i.message}),s.dirty()):Ut.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,rt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,rt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,rt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,rt.toString(n))}setLimit(e,n,r,s){return new Yd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:rt.toString(s)}]})}_addCheck(e){return new Yd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:rt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:rt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ut.isInteger(e.value))}get isFinite(){let e=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"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Yd.create=t=>new Yd({checks:[],typeName:xt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,..._t(t)});class tp extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Je.bigint)return this._getInvalidInput(e);let r;const s=new is;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ut.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ze(n,{code:ve.invalid_type,expected:Je.bigint,received:n.parsedType}),gt}gte(e,n){return this.setLimit("min",e,!0,rt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,rt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,rt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,rt.toString(n))}setLimit(e,n,r,s){return new tp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:rt.toString(s)}]})}_addCheck(e){return new tp({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}tp.create=t=>new tp({checks:[],typeName:xt.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,..._t(t)});class Ck extends Lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Je.boolean){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.boolean,received:r.parsedType}),gt}return gi(e.data)}}Ck.create=t=>new Ck({typeName:xt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,..._t(t)});class a0 extends Lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Je.date){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.date,received:i.parsedType}),gt}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_date}),gt}const r=new is;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ut.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a0({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:rt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:rt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}a0.create=t=>new a0({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:xt.ZodDate,..._t(t)});class UT extends Lt{_parse(e){if(this._getType(e)!==Je.symbol){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.symbol,received:r.parsedType}),gt}return gi(e.data)}}UT.create=t=>new UT({typeName:xt.ZodSymbol,..._t(t)});class _k extends Lt{_parse(e){if(this._getType(e)!==Je.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.undefined,received:r.parsedType}),gt}return gi(e.data)}}_k.create=t=>new _k({typeName:xt.ZodUndefined,..._t(t)});class Sk extends Lt{_parse(e){if(this._getType(e)!==Je.null){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.null,received:r.parsedType}),gt}return gi(e.data)}}Sk.create=t=>new Sk({typeName:xt.ZodNull,..._t(t)});class WT extends Lt{constructor(){super(...arguments),this._any=!0}_parse(e){return gi(e.data)}}WT.create=t=>new WT({typeName:xt.ZodAny,..._t(t)});class Ek extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gi(e.data)}}Ek.create=t=>new Ek({typeName:xt.ZodUnknown,..._t(t)});class Ll extends Lt{_parse(e){const n=this._getOrReturnCtx(e);return ze(n,{code:ve.invalid_type,expected:Je.never,received:n.parsedType}),gt}}Ll.create=t=>new Ll({typeName:xt.ZodNever,..._t(t)});class KT extends Lt{_parse(e){if(this._getType(e)!==Je.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.void,received:r.parsedType}),gt}return gi(e.data)}}KT.create=t=>new KT({typeName:xt.ZodVoid,..._t(t)});class Io extends Lt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Je.array)return ze(n,{code:ve.invalid_type,expected:Je.array,received:n.parsedType}),gt;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ze(n,{code:o?ve.too_big:ve.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ze(n,{code:ve.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ze(n,{code:ve.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Oo(n,o,n.path,a)))).then(o=>is.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Oo(n,o,n.path,a)));return is.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Io({...this._def,minLength:{value:e,message:rt.toString(n)}})}max(e,n){return new Io({...this._def,maxLength:{value:e,message:rt.toString(n)}})}length(e,n){return new Io({...this._def,exactLength:{value:e,message:rt.toString(n)}})}nonempty(e){return this.min(1,e)}}Io.create=(t,e)=>new Io({type:t,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,..._t(e)});function nd(t){if(t instanceof Jn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ca.create(nd(r))}return new Jn({...t._def,shape:()=>e})}else return t instanceof Io?new Io({...t._def,type:nd(t.element)}):t instanceof Ca?Ca.create(nd(t.unwrap())):t instanceof ru?ru.create(nd(t.unwrap())):t instanceof tu?tu.create(t.items.map(e=>nd(e))):t}class Jn extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Ut.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Je.object){const c=this._getOrReturnCtx(e);return ze(c,{code:ve.invalid_type,expected:Je.object,received:c.parsedType}),gt}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ll&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Oo(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ll){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(ze(s,{code:ve.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Oo(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>is.mergeObjectSync(r,c)):is.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return rt.errToObj,new Jn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:rt.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Jn({...this._def,unknownKeys:"strip"})}passthrough(){return new Jn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Jn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Jn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Jn({...this._def,catchall:e})}pick(e){const n={};for(const r of Ut.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Jn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Ut.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Jn({...this._def,shape:()=>n})}deepPartial(){return nd(this)}partial(e){const n={};for(const r of Ut.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Jn({...this._def,shape:()=>n})}required(e){const n={};for(const r of Ut.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ca;)i=i._def.innerType;n[r]=i}return new Jn({...this._def,shape:()=>n})}keyof(){return VD(Ut.objectKeys(this.shape))}}Jn.create=(t,e)=>new Jn({shape:()=>t,unknownKeys:"strip",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});Jn.strictCreate=(t,e)=>new Jn({shape:()=>t,unknownKeys:"strict",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});Jn.lazycreate=(t,e)=>new Jn({shape:t,unknownKeys:"strip",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});class l0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ia(a.ctx.common.issues));return ze(n,{code:ve.invalid_union,unionErrors:o}),gt}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ia(l));return ze(n,{code:ve.invalid_union,unionErrors:a}),gt}}get options(){return this._def.options}}l0.create=(t,e)=>new l0({options:t,typeName:xt.ZodUnion,..._t(e)});const ra=t=>t instanceof Tk?ra(t.schema):t instanceof Dl?ra(t.innerType()):t instanceof d0?[t.value]:t instanceof nu?t.options:t instanceof Ak?Ut.objectValues(t.enum):t instanceof h0?ra(t._def.innerType):t instanceof _k?[void 0]:t instanceof Sk?[null]:t instanceof Ca?[void 0,...ra(t.unwrap())]:t instanceof ru?[null,...ra(t.unwrap())]:t instanceof zD||t instanceof m0?ra(t.unwrap()):t instanceof p0?ra(t._def.innerType):[];class bS extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Je.object)return ze(n,{code:ve.invalid_type,expected:Je.object,received:n.parsedType}),gt;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),gt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=ra(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new bS({typeName:xt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,..._t(r)})}}function Nk(t,e){const n=ol(t),r=ol(e);if(t===e)return{valid:!0,data:t};if(n===Je.object&&r===Je.object){const s=Ut.objectKeys(e),i=Ut.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Nk(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Je.array&&r===Je.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Nk(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Je.date&&r===Je.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class c0 extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(VT(i)||VT(o))return gt;const a=Nk(i.value,o.value);return a.valid?((zT(i)||zT(o))&&n.dirty(),{status:n.value,value:a.data}):(ze(r,{code:ve.invalid_intersection_types}),gt)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}c0.create=(t,e,n)=>new c0({left:t,right:e,typeName:xt.ZodIntersection,..._t(n)});class tu extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.array)return ze(r,{code:ve.invalid_type,expected:Je.array,received:r.parsedType}),gt;if(r.data.length<this._def.items.length)return ze(r,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),gt;!this._def.rest&&r.data.length>this._def.items.length&&(ze(r,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Oo(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>is.mergeArray(n,o)):is.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new tu({...this._def,rest:e})}}tu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tu({items:t,typeName:xt.ZodTuple,rest:null,..._t(e)})};class u0 extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.object)return ze(r,{code:ve.invalid_type,expected:Je.object,received:r.parsedType}),gt;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Oo(r,a,r.path,a)),value:o._parse(new Oo(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?is.mergeObjectAsync(n,s):is.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Lt?new u0({keyType:e,valueType:n,typeName:xt.ZodRecord,..._t(r)}):new u0({keyType:ma.create(),valueType:e,typeName:xt.ZodRecord,..._t(n)})}}class qT extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.map)return ze(r,{code:ve.invalid_type,expected:Je.map,received:r.parsedType}),gt;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Oo(r,a,r.path,[c,"key"])),value:i._parse(new Oo(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return gt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return gt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}qT.create=(t,e,n)=>new qT({valueType:e,keyType:t,typeName:xt.ZodMap,..._t(n)});class np extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.set)return ze(r,{code:ve.invalid_type,expected:Je.set,received:r.parsedType}),gt;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ze(r,{code:ve.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ze(r,{code:ve.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return gt;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Oo(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new np({...this._def,minSize:{value:e,message:rt.toString(n)}})}max(e,n){return new np({...this._def,maxSize:{value:e,message:rt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}np.create=(t,e)=>new np({valueType:t,minSize:null,maxSize:null,typeName:xt.ZodSet,..._t(e)});class Tk extends Lt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Tk.create=(t,e)=>new Tk({getter:t,typeName:xt.ZodLazy,..._t(e)});class d0 extends Lt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ze(n,{received:n.data,code:ve.invalid_literal,expected:this._def.value}),gt}return{status:"valid",value:e.data}}get value(){return this._def.value}}d0.create=(t,e)=>new d0({value:t,typeName:xt.ZodLiteral,..._t(e)});function VD(t,e){return new nu({values:t,typeName:xt.ZodEnum,..._t(e)})}class nu extends Lt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{expected:Ut.joinValues(r),received:n.parsedType,code:ve.invalid_type}),gt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{received:n.data,code:ve.invalid_enum_value,options:r}),gt}return gi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return nu.create(e,{...this._def,...n})}exclude(e,n=this._def){return nu.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}nu.create=VD;class Ak extends Lt{_parse(e){const n=Ut.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Je.string&&r.parsedType!==Je.number){const s=Ut.objectValues(n);return ze(r,{expected:Ut.joinValues(s),received:r.parsedType,code:ve.invalid_type}),gt}if(this._cache||(this._cache=new Set(Ut.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Ut.objectValues(n);return ze(r,{received:r.data,code:ve.invalid_enum_value,options:s}),gt}return gi(e.data)}get enum(){return this._def.values}}Ak.create=(t,e)=>new Ak({values:t,typeName:xt.ZodNativeEnum,..._t(e)});class f0 extends Lt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Je.promise&&n.common.async===!1)return ze(n,{code:ve.invalid_type,expected:Je.promise,received:n.parsedType}),gt;const r=n.parsedType===Je.promise?n.data:Promise.resolve(n.data);return gi(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}f0.create=(t,e)=>new f0({type:t,typeName:xt.ZodPromise,..._t(e)});class Dl extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ze(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return gt;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?gt:l.status==="dirty"||n.value==="dirty"?yh(l.value):l});{if(n.value==="aborted")return gt;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?gt:a.status==="dirty"||n.value==="dirty"?yh(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?gt:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?gt:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Qd(o))return gt;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Qd(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):gt);Ut.assertNever(s)}}Dl.create=(t,e,n)=>new Dl({schema:t,typeName:xt.ZodEffects,effect:e,..._t(n)});Dl.createWithPreprocess=(t,e,n)=>new Dl({schema:e,effect:{type:"preprocess",transform:t},typeName:xt.ZodEffects,..._t(n)});class Ca extends Lt{_parse(e){return this._getType(e)===Je.undefined?gi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ca.create=(t,e)=>new Ca({innerType:t,typeName:xt.ZodOptional,..._t(e)});class ru extends Lt{_parse(e){return this._getType(e)===Je.null?gi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ru.create=(t,e)=>new ru({innerType:t,typeName:xt.ZodNullable,..._t(e)});class h0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Je.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}h0.create=(t,e)=>new h0({innerType:t,typeName:xt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._t(e)});class p0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return o0(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ia(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ia(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}p0.create=(t,e)=>new p0({innerType:t,typeName:xt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._t(e)});class GT extends Lt{_parse(e){if(this._getType(e)!==Je.nan){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.nan,received:r.parsedType}),gt}return{status:"valid",value:e.data}}}GT.create=t=>new GT({typeName:xt.ZodNaN,..._t(t)});class zD extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class vS extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?gt:i.status==="dirty"?(n.dirty(),yh(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?gt:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new vS({in:e,out:n,typeName:xt.ZodPipeline})}}class m0 extends Lt{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Qd(s)&&(s.value=Object.freeze(s.value)),s);return o0(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}m0.create=(t,e)=>new m0({innerType:t,typeName:xt.ZodReadonly,..._t(e)});var xt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(xt||(xt={}));const K=ma.create,jn=Yd.create,on=Ck.create,Gt=Ek.create,Kte=Ll.create,An=Io.create,Ne=Jn.create,wS=l0.create,HD=bS.create;c0.create;tu.create;const Wt=u0.create,Li=d0.create,Ge=nu.create;f0.create;Ca.create;ru.create;const qte=Dl.createWithPreprocess,Gte=Ne({enableIsolatedWorkspaces:on().default(!1)}).strict();Gte.partial();Ne({scopeType:Ge(ote),scopeId:K().uuid(),metric:Ge(ate).optional().default("billed_cents"),windowKind:Ge(lte).optional().default("calendar_month_utc"),amount:jn().int().nonnegative(),warnPercent:jn().int().min(1).max(99).optional().default(80),hardStopEnabled:on().optional().default(!0),notifyEnabled:on().optional().default(!0),isActive:on().optional().default(!0)});Ne({action:Ge(cte),amount:jn().int().nonnegative().optional(),decisionNote:K().optional().nullable()}).superRefine((t,e)=>{t.action==="raise_budget_and_resume"&&typeof t.amount!="number"&&e.addIssue({code:ve.custom,message:"amount is required when raising a budget",path:["amount"]})});const UD=K().uuid().nullable().optional(),Jte=Ne({name:K().min(1),description:K().optional().nullable(),budgetMonthlyCents:jn().int().nonnegative().optional().default(0)});Jte.partial().extend({status:Ge(Vee).optional(),spentMonthlyCents:jn().int().nonnegative().optional(),requireBoardApprovalForNewAgents:on().optional(),brandColor:K().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),logoAssetId:UD});Ne({name:K().min(1).optional(),description:K().nullable().optional(),brandColor:K().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),logoAssetId:UD});const WD=Ne({company:on().optional(),agents:on().optional()}).partial(),Zte=Ne({key:K().min(1),description:K().nullable(),agentSlug:K().min(1).nullable(),providerHint:K().nullable()}),Qte=Ne({path:K().min(1),name:K().min(1),description:K().nullable(),brandColor:K().nullable(),requireBoardApprovalForNewAgents:on()}),Yte=Ne({slug:K().min(1),name:K().min(1),path:K().min(1),role:K().min(1),title:K().nullable(),icon:K().nullable(),capabilities:K().nullable(),reportsToSlug:K().min(1).nullable(),adapterType:K().min(1),adapterConfig:Wt(Gt()),runtimeConfig:Wt(Gt()),permissions:Wt(Gt()),budgetMonthlyCents:jn().int().nonnegative(),metadata:Wt(Gt()).nullable()}),Xte=Ne({schemaVersion:jn().int().positive(),generatedAt:K().datetime(),source:Ne({companyId:K().uuid(),companyName:K().min(1)}).nullable(),includes:Ne({company:on(),agents:on()}),company:Qte.nullable(),agents:An(Yte),requiredSecrets:An(Zte).default([])}),ene=HD("type",[Ne({type:Li("inline"),manifest:Xte,files:Wt(K())}),Ne({type:Li("url"),url:K().url()}),Ne({type:Li("github"),url:K().url()})]),tne=HD("mode",[Ne({mode:Li("new_company"),newCompanyName:K().min(1).optional().nullable()}),Ne({mode:Li("existing_company"),companyId:K().uuid()})]),nne=wS([Li("all"),An(K().min(1))]),rne=Ge(["rename","skip","replace"]);Ne({include:WD.optional()});Ne({source:ene,include:WD.optional(),target:tne,agents:nne.optional(),collisionStrategy:rne.optional()});const sne=Ne({type:Li("plain"),value:K()}),ine=Ne({type:Li("secret_ref"),secretId:K().uuid(),version:wS([Li("latest"),jn().int().positive()]).optional()}),one=wS([K(),sne,ine]),ane=Wt(one);Ne({name:K().min(1),provider:Ge(OD).optional(),value:K().min(1),description:K().optional().nullable(),externalRef:K().optional().nullable()});Ne({value:K().min(1),externalRef:K().optional().nullable()});Ne({name:K().min(1).optional(),description:K().optional().nullable(),externalRef:K().optional().nullable()});const lne=Ne({canCreateAgents:on().optional().default(!1)}),KD=Wt(Gt()).superRefine((t,e)=>{const n=t.env;if(n===void 0)return;ane.safeParse(n).success||e.addIssue({code:ve.custom,message:"adapterConfig.env must be a map of valid env bindings",path:["env"]})}),qD=Ne({name:K().min(1),role:Ge(qee).optional().default("general"),title:K().optional().nullable(),icon:Ge(xS).optional().nullable(),reportsTo:K().uuid().optional().nullable(),capabilities:K().optional().nullable(),adapterType:Ge(hm).optional().default("process"),adapterConfig:KD.optional().default({}),runtimeConfig:Wt(Gt()).optional().default({}),budgetMonthlyCents:jn().int().nonnegative().optional().default(0),permissions:lne.optional(),metadata:Wt(Gt()).optional().nullable()});qD.extend({sourceIssueId:K().uuid().optional().nullable(),sourceIssueIds:An(K().uuid()).optional()});qD.omit({permissions:!0}).partial().extend({permissions:Kte().optional(),status:Ge(Kee).optional(),spentMonthlyCents:jn().int().nonnegative().optional()});Ne({path:K().trim().min(1).nullable(),adapterConfigKey:K().trim().min(1).optional()});Ne({name:K().min(1).default("default")});Ne({source:Ge(["timer","assignment","on_demand","automation"]).optional().default("on_demand"),triggerDetail:Ge(["manual","ping","callback","system"]).optional(),reason:K().optional().nullable(),payload:Wt(Gt()).optional().nullable(),idempotencyKey:K().optional().nullable(),forceFreshSession:qte(t=>t===null?void 0:t,on().optional().default(!1))});Ne({taskKey:K().min(1).optional().nullable()});Ne({adapterConfig:KD.optional().default({})});Ne({canCreateAgents:on(),canAssignTasks:on()});const cne=Ne({type:Ge(["project_primary","git_worktree","adapter_managed","cloud_sandbox"]).optional(),baseRef:K().optional().nullable(),branchTemplate:K().optional().nullable(),worktreeParentDir:K().optional().nullable(),provisionCommand:K().optional().nullable(),teardownCommand:K().optional().nullable()}).strict(),une=Ne({enabled:on(),defaultMode:Ge(["shared_workspace","isolated_workspace","operator_branch","adapter_default"]).optional(),allowIssueOverride:on().optional(),defaultProjectWorkspaceId:K().uuid().optional().nullable(),workspaceStrategy:cne.optional().nullable(),workspaceRuntime:Wt(Gt()).optional().nullable(),branchPolicy:Wt(Gt()).optional().nullable(),pullRequestPolicy:Wt(Gt()).optional().nullable(),runtimePolicy:Wt(Gt()).optional().nullable(),cleanupPolicy:Wt(Gt()).optional().nullable()}).strict(),dne=Ge(["local_path","git_repo","remote_managed","non_git_path"]),fne=Ge(["default","advanced"]),GD={name:K().min(1).optional(),sourceType:dne.optional(),cwd:K().min(1).optional().nullable(),repoUrl:K().url().optional().nullable(),repoRef:K().optional().nullable(),defaultRef:K().optional().nullable(),visibility:fne.optional(),setupCommand:K().optional().nullable(),cleanupCommand:K().optional().nullable(),remoteProvider:K().optional().nullable(),remoteWorkspaceRef:K().optional().nullable(),sharedWorkspaceKey:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable()};function hne(t,e){const n=t.sourceType??"local_path",r=typeof t.cwd=="string"&&t.cwd.trim().length>0,s=typeof t.repoUrl=="string"&&t.repoUrl.trim().length>0,i=typeof t.remoteWorkspaceRef=="string"&&t.remoteWorkspaceRef.trim().length>0;if(n==="remote_managed"){!i&&!s&&e.addIssue({code:ve.custom,message:"Remote-managed workspace requires remoteWorkspaceRef or repoUrl.",path:["remoteWorkspaceRef"]});return}!r&&!s&&e.addIssue({code:ve.custom,message:"Workspace requires at least one of cwd or repoUrl.",path:["cwd"]})}const pne=Ne({...GD,isPrimary:on().optional().default(!1)}).superRefine(hne);Ne({...GD,isPrimary:on().optional()}).partial();const JD={goalId:K().uuid().optional().nullable(),goalIds:An(K().uuid()).optional(),name:K().min(1),description:K().optional().nullable(),status:Ge(Xee).optional().default("backlog"),leadAgentId:K().uuid().optional().nullable(),targetDate:K().optional().nullable(),color:K().optional().nullable(),executionWorkspacePolicy:une.optional().nullable(),archivedAt:K().datetime().optional().nullable()};Ne({...JD,workspace:pne.optional()});Ne(JD).partial();const mne=Ne({type:Ge(["project_primary","git_worktree","adapter_managed","cloud_sandbox"]).optional(),baseRef:K().optional().nullable(),branchTemplate:K().optional().nullable(),worktreeParentDir:K().optional().nullable(),provisionCommand:K().optional().nullable(),teardownCommand:K().optional().nullable()}).strict(),gne=Ne({mode:Ge(["inherit","shared_workspace","isolated_workspace","operator_branch","reuse_existing","agent_default"]).optional(),workspaceStrategy:mne.optional().nullable(),workspaceRuntime:Wt(Gt()).optional().nullable()}).strict(),xne=Ne({adapterConfig:Wt(Gt()).optional(),useProjectWorkspace:on().optional()}).strict(),ZD=Ne({ticketId:K().uuid().optional().nullable(),ticketStage:K().optional().nullable(),projectId:K().uuid().optional().nullable(),projectWorkspaceId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),parentId:K().uuid().optional().nullable(),title:K().min(1),description:K().optional().nullable(),status:Ge(PD).optional().default("backlog"),priority:Ge(Zee).optional().default("medium"),assigneeAgentId:K().uuid().optional().nullable(),assigneeUserId:K().optional().nullable(),requestDepth:jn().int().nonnegative().optional().default(0),billingCode:K().optional().nullable(),assigneeAdapterOverrides:xne.optional().nullable(),executionWorkspaceId:K().uuid().optional().nullable(),executionWorkspacePreference:Ge(["inherit","shared_workspace","isolated_workspace","operator_branch","reuse_existing","agent_default"]).optional().nullable(),executionWorkspaceSettings:gne.optional().nullable(),labelIds:An(K().uuid()).optional()});Ne({issues:An(ZD).min(1).max(50)});Ne({name:K().trim().min(1).max(48),color:K().regex(/^#(?:[0-9a-fA-F]{6})$/,"Color must be a 6-digit hex value")});ZD.partial().extend({comment:K().min(1).optional(),hiddenAt:K().datetime().nullable().optional()});Ne({agentId:K().uuid(),expectedStatuses:An(Ge(PD)).nonempty()});Ne({body:K().min(1),reopen:on().optional(),interrupt:on().optional()});Ne({approvalId:K().uuid()});Ne({issueCommentId:K().uuid().optional().nullable()});const yne=["markdown"],bne=Ge(yne);K().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/,"Document key must be lowercase letters, numbers, _ or -");Ne({title:K().trim().max(200).nullable().optional(),format:bne,body:K().max(524288),changeSummary:K().trim().max(500).nullable().optional(),baseRevisionId:K().uuid().nullable().optional()});const vne=Ge(["preview_url","runtime_service","pull_request","branch","commit","artifact","document"]),wne=Ge(["active","ready_for_review","approved","changes_requested","merged","closed","failed","archived","draft"]),kne=Ge(["none","needs_board_review","approved","changes_requested"]),Cne=Ne({projectId:K().uuid().optional().nullable(),executionWorkspaceId:K().uuid().optional().nullable(),runtimeServiceId:K().uuid().optional().nullable(),type:vne,provider:K().min(1),externalId:K().optional().nullable(),title:K().min(1),url:K().url().optional().nullable(),status:wne.default("active"),reviewState:kne.optional().default("none"),isPrimary:on().optional().default(!1),healthStatus:Ge(["unknown","healthy","unhealthy"]).optional().default("unknown"),summary:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable(),createdByRunId:K().uuid().optional().nullable()});Cne.partial();const _ne=Ge(["active","idle","in_review","archived","cleanup_failed"]);Ne({status:_ne.optional(),cleanupEligibleAt:K().datetime().optional().nullable(),cleanupReason:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable()}).strict();Ne({title:K().min(1).max(500),description:K().optional(),stageOrder:An(K().min(1)).optional(),metadata:Wt(Gt()).optional(),instructions:K().optional(),leadAgentId:K().uuid().nullable().optional()});Ne({title:K().min(1).max(500).optional(),description:K().nullable().optional(),status:Ge(Jee).optional(),currentStage:K().min(1).optional(),stageOrder:An(K().min(1)).optional(),metadata:Wt(Gt()).optional(),instructions:K().optional(),leadAgentId:K().uuid().nullable().optional()});Ne({});const Sne=Ne({title:K().min(1),description:K().optional().nullable(),level:Ge(Qee).optional().default("task"),status:Ge(Yee).optional().default("planned"),parentId:K().uuid().optional().nullable(),ownerAgentId:K().uuid().optional().nullable()});Sne.partial();Ne({type:Ge(ete),requestedByAgentId:K().uuid().optional().nullable(),payload:Wt(Gt()),issueIds:An(K().uuid()).optional()});Ne({decisionNote:K().optional().nullable(),decidedByUserId:K().optional().default("board")});Ne({decisionNote:K().optional().nullable(),decidedByUserId:K().optional().default("board")});Ne({payload:Wt(Gt()).optional()});Ne({body:K().min(1)});Ne({agentId:K().uuid(),issueId:K().uuid().optional().nullable(),projectId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),heartbeatRunId:K().uuid().optional().nullable(),billingCode:K().optional().nullable(),provider:K().min(1),biller:K().min(1).optional(),billingType:Ge(nte).optional().default("unknown"),model:K().min(1),inputTokens:jn().int().nonnegative().optional().default(0),cachedInputTokens:jn().int().nonnegative().optional().default(0),outputTokens:jn().int().nonnegative().optional().default(0),costCents:jn().int().nonnegative(),occurredAt:K().datetime()}).transform(t=>({...t,biller:t.biller??t.provider}));Ne({budgetMonthlyCents:jn().int().nonnegative()});Ne({agentId:K().uuid().optional().nullable(),issueId:K().uuid().optional().nullable(),projectId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),heartbeatRunId:K().uuid().optional().nullable(),costEventId:K().uuid().optional().nullable(),billingCode:K().optional().nullable(),description:K().max(500).optional().nullable(),eventKind:Ge(rte),direction:Ge(ste).optional().default("debit"),biller:K().min(1),provider:K().min(1).optional().nullable(),executionAdapterType:Ge(hm).optional().nullable(),pricingTier:K().min(1).optional().nullable(),region:K().min(1).optional().nullable(),model:K().min(1).optional().nullable(),quantity:jn().int().nonnegative().optional().nullable(),unit:Ge(ite).optional().nullable(),amountCents:jn().int().nonnegative(),currency:K().length(3).optional().default("USD"),estimated:on().optional().default(!1),externalInvoiceId:K().optional().nullable(),metadataJson:Wt(K(),Gt()).optional().nullable(),occurredAt:K().datetime()}).transform(t=>({...t,currency:t.currency.toUpperCase()}));Ne({namespace:K().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()});Ne({allowedJoinTypes:Ge(ute).default("both"),defaultsPayload:Wt(K(),Gt()).optional().nullable(),agentMessage:K().max(4e3).optional().nullable()});Ne({agentMessage:K().max(4e3).optional().nullable()});Ne({requestType:Ge(LD),agentName:K().min(1).max(120).optional(),adapterType:Ge(hm).optional(),capabilities:K().max(4e3).optional().nullable(),agentDefaultsPayload:Wt(K(),Gt()).optional().nullable(),responsesWebhookUrl:K().max(4e3).optional().nullable(),responsesWebhookMethod:K().max(32).optional().nullable(),responsesWebhookHeaders:Wt(K(),Gt()).optional().nullable(),paperclipApiUrl:K().max(4e3).optional().nullable(),webhookAuthHeader:K().max(4e3).optional().nullable()});Ne({status:Ge(dte).optional(),requestType:Ge(LD).optional()});Ne({claimSecret:K().min(16).max(256)});Ne({grants:An(Ne({permissionKey:Ge(fte),scope:Wt(K(),Gt()).optional().nullable()}))});Ne({companyIds:An(K().uuid()).default([])});const QD=Wt(Gt()).refine(t=>Object.keys(t).length===0?!0:typeof t.type=="string"||t.$ref!==void 0||t.oneOf!==void 0||t.anyOf!==void 0||t.allOf!==void 0,{message:"Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)"}),Ene=/^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;function Nne(t){const e=t.trim();if(!e)return!1;const n=e.split(/\s+/);return n.length!==5?!1:n.every(r=>Ene.test(r))}const Tne=Ne({jobKey:K().min(1),displayName:K().min(1),description:K().optional(),schedule:K().refine(t=>Nne(t),{message:"schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')"}).optional()}),Ane=Ne({endpointKey:K().min(1),displayName:K().min(1),description:K().optional()}),Ine=Ne({name:K().min(1),displayName:K().min(1),description:K().min(1),parametersSchema:QD}),jne=Ne({type:Ge(gte),id:K().min(1),displayName:K().min(1),exportName:K().min(1),entityTypes:An(Ge(FD)).optional(),routePath:K().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"}).optional(),order:jn().int().optional()}).superRefine((t,e)=>{["detailTab","taskDetailView","contextMenuItem","commentAnnotation","commentContextMenuItem","projectSidebarItem"].includes(t.type)&&(!t.entityTypes||t.entityTypes.length===0)&&e.addIssue({code:ve.custom,message:`${t.type} slots require at least one entityType`,path:["entityTypes"]}),t.type==="projectSidebarItem"&&t.entityTypes&&!t.entityTypes.includes("project")&&e.addIssue({code:ve.custom,message:'projectSidebarItem slots require entityTypes to include "project"',path:["entityTypes"]}),t.type==="commentAnnotation"&&t.entityTypes&&!t.entityTypes.includes("comment")&&e.addIssue({code:ve.custom,message:'commentAnnotation slots require entityTypes to include "comment"',path:["entityTypes"]}),t.type==="commentContextMenuItem"&&t.entityTypes&&!t.entityTypes.includes("comment")&&e.addIssue({code:ve.custom,message:'commentContextMenuItem slots require entityTypes to include "comment"',path:["entityTypes"]}),t.routePath&&t.type!=="page"&&e.addIssue({code:ve.custom,message:"routePath is only supported for page slots",path:["routePath"]}),t.routePath&&xte.includes(t.routePath)&&e.addIssue({code:ve.custom,message:`routePath "${t.routePath}" is reserved by the host`,path:["routePath"]})}),Rne=["detailTab","taskDetailView","contextMenuItem","commentAnnotation","commentContextMenuItem","projectSidebarItem"],Mne={hostInline:["inline","compact","default"],hostOverlay:["compact","default","wide","full"],hostRoute:["default","wide","full"],external:[],iframe:["compact","default","wide","full"]},Pne=Ne({type:Ge(bte),target:K().min(1),params:Wt(Gt()).optional()}).superRefine((t,e)=>{t.type==="performAction"&&t.target.includes("/")&&e.addIssue({code:ve.custom,message:"performAction launchers must target an action key, not a route or URL",path:["target"]}),t.type==="navigate"&&/^https?:\/\//.test(t.target)&&e.addIssue({code:ve.custom,message:"navigate launchers must target a host route, not an absolute URL",path:["target"]})}),One=Ne({environment:Ge(vte),bounds:Ge(DD).optional()}).superRefine((t,e)=>{if(!t.bounds)return;Mne[t.environment].includes(t.bounds)||e.addIssue({code:ve.custom,message:`bounds "${t.bounds}" is not supported for render environment "${t.environment}"`,path:["bounds"]})}),JT=Ne({id:K().min(1),displayName:K().min(1),description:K().optional(),placementZone:Ge(yte),exportName:K().min(1).optional(),entityTypes:An(Ge(FD)).optional(),order:jn().int().optional(),action:Pne,render:One.optional()}).superRefine((t,e)=>{var n,r;Rne.some(s=>s===t.placementZone)&&(!t.entityTypes||t.entityTypes.length===0)&&e.addIssue({code:ve.custom,message:`${t.placementZone} launchers require at least one entityType`,path:["entityTypes"]}),t.placementZone==="projectSidebarItem"&&t.entityTypes&&!t.entityTypes.includes("project")&&e.addIssue({code:ve.custom,message:'projectSidebarItem launchers require entityTypes to include "project"',path:["entityTypes"]}),t.action.type==="performAction"&&t.render&&e.addIssue({code:ve.custom,message:"performAction launchers cannot declare render hints",path:["render"]}),["openModal","openDrawer","openPopover"].includes(t.action.type)&&!t.render&&e.addIssue({code:ve.custom,message:`${t.action.type} launchers require render metadata`,path:["render"]}),t.action.type==="openModal"&&((n=t.render)==null?void 0:n.environment)==="hostInline"&&e.addIssue({code:ve.custom,message:"openModal launchers cannot use the hostInline render environment",path:["render","environment"]}),t.action.type==="openDrawer"&&t.render&&!["hostOverlay","iframe"].includes(t.render.environment)&&e.addIssue({code:ve.custom,message:"openDrawer launchers must use hostOverlay or iframe render environments",path:["render","environment"]}),t.action.type==="openPopover"&&((r=t.render)==null?void 0:r.environment)==="hostRoute"&&e.addIssue({code:ve.custom,message:"openPopover launchers cannot use the hostRoute render environment",path:["render","environment"]})});Ne({id:K().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/,"Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"),apiVersion:Li(1),version:K().min(1).regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"),displayName:K().min(1).max(100),description:K().min(1).max(500),author:K().min(1).max(200),categories:An(Ge(pte)).min(1),minimumHostVersion:K().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"minimumHostVersion must follow semver (e.g. 1.0.0)").optional(),minimumPaperclipVersion:K().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"minimumPaperclipVersion must follow semver (e.g. 1.0.0)").optional(),capabilities:An(Ge(mte)).min(1),entrypoints:Ne({worker:K().min(1),ui:K().min(1).optional()}),instanceConfigSchema:QD.optional(),jobs:An(Tne).optional(),webhooks:An(Ane).optional(),tools:An(Ine).optional(),launchers:An(JT).optional(),ui:Ne({slots:An(jne).min(1).optional(),launchers:An(JT).optional()}).optional()}).superRefine((t,e)=>{var i,o,a,l,c,u;const n=(((o=(i=t.ui)==null?void 0:i.slots)==null?void 0:o.length)??0)>0,r=(((l=(a=t.ui)==null?void 0:a.launchers)==null?void 0:l.length)??0)>0;if((n||r)&&!t.entrypoints.ui&&e.addIssue({code:ve.custom,message:"entrypoints.ui is required when ui.slots or ui.launchers are declared",path:["entrypoints","ui"]}),t.minimumHostVersion&&t.minimumPaperclipVersion&&t.minimumHostVersion!==t.minimumPaperclipVersion&&e.addIssue({code:ve.custom,message:"minimumHostVersion and minimumPaperclipVersion must match when both are declared",path:["minimumHostVersion"]}),t.tools&&t.tools.length>0&&(t.capabilities.includes("agent.tools.register")||e.addIssue({code:ve.custom,message:"Capability 'agent.tools.register' is required when tools are declared",path:["capabilities"]})),t.jobs&&t.jobs.length>0&&(t.capabilities.includes("jobs.schedule")||e.addIssue({code:ve.custom,message:"Capability 'jobs.schedule' is required when jobs are declared",path:["capabilities"]})),t.webhooks&&t.webhooks.length>0&&(t.capabilities.includes("webhooks.receive")||e.addIssue({code:ve.custom,message:"Capability 'webhooks.receive' is required when webhooks are declared",path:["capabilities"]})),t.jobs){const f=t.jobs.map(p=>p.jobKey),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate job keys: ${[...new Set(h)].join(", ")}`,path:["jobs"]})}if(t.webhooks){const f=t.webhooks.map(p=>p.endpointKey),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate webhook endpoint keys: ${[...new Set(h)].join(", ")}`,path:["webhooks"]})}if(t.tools){const f=t.tools.map(p=>p.name),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate tool names: ${[...new Set(h)].join(", ")}`,path:["tools"]})}if(t.ui&&t.ui.slots){const f=t.ui.slots.map(p=>p.id),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate UI slot ids: ${[...new Set(h)].join(", ")}`,path:["ui","slots"]})}const s=[...t.launchers??[],...((c=t.ui)==null?void 0:c.launchers)??[]];if(s.length>0){const f=s.map(p=>p.id),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate launcher ids: ${[...new Set(h)].join(", ")}`,path:(u=t.ui)!=null&&u.launchers?["ui","launchers"]:["launchers"]})}});Ne({packageName:K().min(1),version:K().min(1).optional(),packagePath:K().min(1).optional()});Ne({configJson:Wt(Gt())});Ne({configJson:Wt(Gt())});Ne({status:Ge(hte),lastError:K().nullable().optional()});Ne({removeData:on().optional().default(!1)});Ne({scopeKind:Ge(yS),scopeId:K().min(1).optional(),namespace:K().min(1).optional(),stateKey:K().min(1)});Ne({scopeKind:Ge(yS),scopeId:K().min(1).optional(),namespace:K().min(1).optional(),stateKey:K().min(1),value:Gt()});Ne({scopeKind:Ge(yS).optional(),scopeId:K().min(1).optional(),namespace:K().min(1).optional()});const Lne=/[^a-z0-9]+/g,Dne=/^-+|-+$/g,Fne=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function YD(t){return typeof t!="string"?!1:Fne.test(t.trim())}function g0(t){if(typeof t!="string")return null;const e=t.trim().toLowerCase().replace(Lne,"-").replace(Dne,"");return e.length>0?e:null}function $ne(t,e){return g0(t)??g0(e)??"agent"}const Bne=/[^a-z0-9]+/g,Vne=/^-+|-+$/g;function ZT(t){if(typeof t!="string")return null;const e=t.trim().toLowerCase().replace(Bne,"-").replace(Vne,"");return e.length>0?e:null}function zne(t,e){return ZT(t)??ZT(e)??"project"}const Ik="project://",Hne=/^[0-9a-f]{6}$/i,Une=/^[0-9a-f]{3}$/i,Wne=/^#[0-9a-f]{6}$/i,Kne=/^#[0-9a-f]{3}$/i;function XD(t){if(!t)return null;const e=t.trim();if(!e)return null;if(Wne.test(e))return e.toLowerCase();if(Hne.test(e))return`#${e.toLowerCase()}`;if(Kne.test(e)){const n=e.slice(1).toLowerCase();return`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}if(Une.test(e)){const n=e.toLowerCase();return`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}return null}function qne(t,e){const n=t.trim(),r=XD(e??null);return r?`${Ik}${n}?c=${encodeURIComponent(r.slice(1))}`:`${Ik}${n}`}function e6(t){if(!t.startsWith(Ik))return null;let e;try{e=new URL(t)}catch{return null}if(e.protocol!=="project:")return null;const n=`${e.hostname}${e.pathname}`.replace(/^\/+/,"").trim();if(!n)return null;const r=XD(e.searchParams.get("c")??e.searchParams.get("color"));return{projectId:n,color:r}}const Gne=Ne({version:Li(1),updatedAt:K(),source:Ge(["onboard","configure","doctor"])}),Jne=Ne({provider:Ge(["claude","openai"]),apiKey:K().optional()}),Zne=Ne({enabled:on().default(!0),intervalMinutes:jn().int().min(1).max(10080).default(60),retentionDays:jn().int().min(1).max(3650).default(30),dir:K().default("~/.paperclip/instances/default/data/backups")}),Qne=Ne({mode:Ge(["embedded-postgres","postgres"]).default("embedded-postgres"),connectionString:K().optional(),embeddedPostgresDataDir:K().default("~/.paperclip/instances/default/db"),embeddedPostgresPort:jn().int().min(1).max(65535).default(54329),backup:Zne.default({enabled:!0,intervalMinutes:60,retentionDays:30,dir:"~/.paperclip/instances/default/data/backups"})}),Yne=Ne({mode:Ge(["file","cloud"]),logDir:K().default("~/.paperclip/instances/default/logs")}),Xne=Ne({deploymentMode:Ge(zee).default("local_trusted"),exposure:Ge(Hee).default("private"),host:K().default("127.0.0.1"),port:jn().int().min(1).max(65535).default(3100),allowedHostnames:An(K().min(1)).default([]),serveUi:on().default(!0)}),ere=Ne({baseUrlMode:Ge(Wee).default("auto"),publicBaseUrl:K().url().optional(),disableSignUp:on().default(!1)}),tre=Ne({profile:Ge(Uee).default("dx")}),nre=Ne({baseDir:K().default("~/.paperclip/instances/default/data/storage")}),rre=Ne({bucket:K().min(1).default("paperclip"),region:K().min(1).default("us-east-1"),endpoint:K().optional(),prefix:K().default(""),forcePathStyle:on().default(!1)}),sre=Ne({provider:Ge(tte).default("local_disk"),localDisk:nre.default({baseDir:"~/.paperclip/instances/default/data/storage"}),s3:rre.default({bucket:"paperclip",region:"us-east-1",prefix:"",forcePathStyle:!1})}),ire=Ne({keyFilePath:K().default("~/.paperclip/instances/default/secrets/master.key")}),ore=Ne({provider:Ge(OD).default("local_encrypted"),strictMode:on().default(!1),localEncrypted:ire.default({keyFilePath:"~/.paperclip/instances/default/secrets/master.key"})});Ne({$meta:Gne,llm:Jne.optional(),database:Qne,logging:Yne,server:Xne,auth:ere.default({baseUrlMode:"auto",disableSignUp:!1}),surface:tre.default({profile:"dx"}),storage:sre.default({provider:"local_disk",localDisk:{baseDir:"~/.paperclip/instances/default/data/storage"},s3:{bucket:"paperclip",region:"us-east-1",prefix:"",forcePathStyle:!1}}),secrets:ore.default({provider:"local_encrypted",strictMode:!1,localEncrypted:{keyFilePath:"~/.paperclip/instances/default/secrets/master.key"}})}).superRefine((t,e)=>{if(t.server.deploymentMode==="local_trusted"){t.server.exposure!=="private"&&e.addIssue({code:ve.custom,message:"server.exposure must be private when deploymentMode is local_trusted",path:["server","exposure"]});return}t.auth.baseUrlMode==="explicit"&&!t.auth.publicBaseUrl&&e.addIssue({code:ve.custom,message:"auth.publicBaseUrl is required when auth.baseUrlMode is explicit",path:["auth","publicBaseUrl"]}),t.server.exposure==="public"&&t.auth.baseUrlMode!=="explicit"&&e.addIssue({code:ve.custom,message:"auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",path:["auth","baseUrlMode"]}),t.server.exposure==="public"&&!t.auth.publicBaseUrl&&e.addIssue({code:ve.custom,message:"auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",path:["auth","publicBaseUrl"]})});function Z(...t){return Bee(bD(t))}function rd(t){return`$${(t/100).toFixed(2)}`}function Al(t){return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function kS(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Ui(t){const e=Date.now(),n=new Date(t).getTime(),r=Math.round((e-n)/1e3);if(r<60)return"just now";const s=Math.round(r/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);if(i<24)return`${i}h ago`;const o=Math.round(i/24);return o<30?`${o}d ago`:Al(t)}function Sr(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function JRe(t){return{anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter",chatgpt:"ChatGPT",google:"Google",cursor:"Cursor",jetbrains:"JetBrains AI"}[t.toLowerCase()]??t}function ZRe(t){return{metered_api:"Metered API",subscription_included:"Subscription",subscription_overage:"Subscription overage",credits:"Credits",fixed:"Fixed",unknown:"Unknown"}[t]}function QRe(t){return{"anthropic-oauth":"Anthropic OAuth","claude-cli":"Claude CLI","codex-rpc":"Codex app server","codex-wham":"ChatGPT WHAM"}[t]??t}function QT(t){return t==="metered_api"||t==="subscription_included"||t==="subscription_overage"||t==="credits"||t==="fixed"||t==="unknown"?t:null}function YT(t){if(!t)return 0;for(const e of["costUsd","cost_usd","total_cost_usd"]){const n=t[e];if(typeof n=="number"&&Number.isFinite(n))return n}return 0}function t6(t,e=null){return(QT(t==null?void 0:t.billingType)??QT(e==null?void 0:e.billingType))==="subscription_included"?0:YT(t)||YT(e)}function YRe(t){return{inference_charge:"Inference charge",platform_fee:"Platform fee",credit_purchase:"Credit purchase",credit_refund:"Credit refund",credit_expiry:"Credit expiry",byok_fee:"BYOK fee",gateway_overhead:"Gateway overhead",log_storage_charge:"Log storage",logpush_charge:"Logpush",provisioned_capacity_charge:"Provisioned capacity",training_charge:"Training",custom_model_import_charge:"Custom model import",custom_model_storage_charge:"Custom model storage",manual_adjustment:"Manual adjustment"}[t]}function XRe(t){return t==="credit"?"Credit":"Debit"}function n6(t){return t.urlKey??$ne(t.name,t.id)}function eMe(t){return`/agents/${n6(t)}`}function are(t){return t.urlKey??zne(t.name,t.id)}function lre(t){return`/projects/${are(t)}`}function tMe({delayDuration:t=0,...e}){return d.jsx(uS,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function cre({...t}){return d.jsx(dS,{"data-slot":"tooltip",...t})}function ure({...t}){return d.jsx(fS,{"data-slot":"tooltip-trigger",...t})}function dre({className:t,sideOffset:e=0,children:n,...r}){return d.jsx(hS,{children:d.jsxs(pS,{"data-slot":"tooltip-content",sideOffset:e,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,d.jsx(xD,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const r6=x.createContext(null);function nMe({children:t}){const[e,n]=x.useState([]),r=x.useCallback(s=>{n(s)},[]);return x.useEffect(()=>{if(e.length===0)document.title="Growthub";else{const s=[...e].reverse().map(i=>i.label);document.title=`${s.join(" · ")} · Growthub`}},[e]),d.jsx(r6.Provider,{value:{breadcrumbs:e,setBreadcrumbs:r},children:t})}function pm(){const t=x.useContext(r6);if(!t)throw new Error("useBreadcrumbs must be used within BreadcrumbProvider");return t}const s6=x.createContext(null),U1=768;function rMe({children:t}){const[e,n]=x.useState(()=>window.innerWidth<U1),[r,s]=x.useState(()=>window.innerWidth>=U1);x.useEffect(()=>{const o=window.matchMedia(`(max-width: ${U1-1}px)`),a=l=>{n(l.matches),s(!l.matches)};return o.addEventListener("change",a),()=>o.removeEventListener("change",a)},[]);const i=x.useCallback(()=>s(o=>!o),[]);return d.jsx(s6.Provider,{value:{sidebarOpen:r,setSidebarOpen:s,toggleSidebar:i,isMobile:e},children:t})}function yb(){const t=x.useContext(s6);if(!t)throw new Error("useSidebar must be used within SidebarProvider");return t}const i6=x.createContext(null);function sMe({children:t}){const[e,n]=x.useState(!1),[r,s]=x.useState({}),[i,o]=x.useState(!1),[a,l]=x.useState(!1),[c,u]=x.useState({}),[f,h]=x.useState(!1),[p,m]=x.useState(!1),[g,y]=x.useState({}),v=x.useCallback((O={})=>{s(O),n(!0)},[]),b=x.useCallback(()=>{n(!1),s({})},[]),w=x.useCallback(()=>{o(!0)},[]),k=x.useCallback(()=>{o(!1)},[]),C=x.useCallback((O={})=>{u(O),l(!0)},[]),_=x.useCallback(()=>{l(!1),u({})},[]),S=x.useCallback(()=>{h(!0)},[]),E=x.useCallback(()=>{h(!1)},[]),N=x.useCallback((O={})=>{y(O),m(!0)},[]),T=x.useCallback(()=>{m(!1),y({})},[]);return d.jsx(i6.Provider,{value:{newIssueOpen:e,newIssueDefaults:r,openNewIssue:v,closeNewIssue:b,newProjectOpen:i,openNewProject:w,closeNewProject:k,newGoalOpen:a,newGoalDefaults:c,openNewGoal:C,closeNewGoal:_,newAgentOpen:f,openNewAgent:S,closeNewAgent:E,onboardingOpen:p,onboardingOptions:g,openOnboarding:N,closeOnboarding:T},children:t})}function CS(){const t=x.useContext(i6);if(!t)throw new Error("useDialog must be used within DialogProvider");return t}const fre={info:4e3,success:3500,warn:8e3,error:1e4},hre=1500,pre=15e3,mre=5,gre=3500,xre=2e4,o6=x.createContext(null);function yre(t,e){const n=fre[e];return typeof t!="number"||!Number.isFinite(t)?n:Math.max(hre,Math.min(pre,Math.floor(t)))}function bre(){return`toast_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function iMe({children:t}){const[e,n]=x.useState([]),r=x.useRef(new Map),s=x.useRef(new Map),i=x.useCallback(u=>{const f=r.current.get(u);f!==void 0&&(window.clearTimeout(f),r.current.delete(u))},[]),o=x.useCallback(u=>{i(u),n(f=>f.filter(h=>h.id!==u))},[i]),a=x.useCallback(()=>{for(const u of r.current.values())window.clearTimeout(u);r.current.clear(),n([])},[]),l=x.useCallback(u=>{var b;const f=Date.now(),h=u.tone??"info",p=yre(u.ttlMs,h),m=u.dedupeKey??u.id??`${h}|${u.title}|${u.body??""}|${((b=u.action)==null?void 0:b.href)??""}`;for(const[w,k]of s.current.entries())f-k>xre&&s.current.delete(w);const g=s.current.get(m);if(g&&f-g<gre)return null;s.current.set(m,f);const y=u.id??bre();i(y),n(w=>{const k={id:y,title:u.title,body:u.body,tone:h,ttlMs:p,action:u.action,createdAt:f},C=w.filter(_=>_.id!==y);return[k,...C].slice(0,mre)});const v=window.setTimeout(()=>{o(y)},p);return r.current.set(y,v),y},[i,o]);x.useEffect(()=>()=>{for(const u of r.current.values())window.clearTimeout(u);r.current.clear()},[]);const c=x.useMemo(()=>({toasts:e,pushToast:l,dismissToast:o,clearToasts:a}),[e,l,o,a]);return d.jsx(o6.Provider,{value:c,children:t})}function mm(){const t=x.useContext(o6);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}function XT(t){if(!t||typeof t!="object")return null;const e=t,n=e.session,r=e.user;if(!n||typeof n!="object"||!r||typeof r!="object")return null;const s=n,i=r;return typeof s.id!="string"||typeof s.userId!="string"||typeof i.id!="string"?null:{session:{id:s.id,userId:s.userId},user:{id:i.id,email:typeof i.email=="string"?i.email:null,name:typeof i.name=="string"?i.name:null}}}async function W1(t,e){var s;const n=await fetch(`/api/auth${t}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json().catch(()=>null);if(!n.ok){const i=r!=null&&r.error&&typeof r.error=="object"?((s=r.error)==null?void 0:s.message)??`Request failed: ${n.status}`:(r==null?void 0:r.error)??`Request failed: ${n.status}`;throw new Error(i)}return r}const Di={getSession:async()=>{const t=await fetch("/api/auth/get-session",{credentials:"include",headers:{Accept:"application/json"}});if(t.status===401)return null;const e=await t.json().catch(()=>null);if(!t.ok)throw new Error(`Failed to load session (${t.status})`);const n=XT(e);return n||(e&&typeof e=="object"?XT(e.data):null)},signInEmail:async t=>{await W1("/sign-in/email",t)},signUpEmail:async t=>{await W1("/sign-up/email",t)},signOut:async()=>{await W1("/sign-out",{})}},vre=1e4,wre=3,kre=2e3;function qt(t){return typeof t=="string"&&t.length>0?t:null}function _S(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function bb(t){return t.slice(0,8)}function a6(t,e,n){const r=t.getQueryData(re.agents.list(e));if(!r)return null;const s=r.find(i=>i.id===n);return(s==null?void 0:s.name)??null}function kc(t,e){return t.length<=e?t:t.slice(0,e-1)+"…"}function Cre(t,e,n,r){return n==="agent"&&r?a6(t,e,r)??`Agent ${bb(r)}`:n==="system"?"System":n==="user"&&r?"Board":"Someone"}function l6(t,e,n,r){const s=new Set([n]),i=t.getQueryData(re.issues.detail(n)),o=t.getQueryData(re.issues.list(e)),a=qt(r==null?void 0:r.identifier)??qt(r==null?void 0:r.issueIdentifier);a&&s.add(a),i!=null&&i.id&&s.add(i.id),i!=null&&i.identifier&&s.add(i.identifier);const l=o==null?void 0:o.find(c=>!!(c.id===n||c.identifier&&c.identifier===n||a&&c.identifier===a));return l!=null&&l.id&&s.add(l.id),l!=null&&l.identifier&&s.add(l.identifier),Array.from(s)}function _re(t,e,n,r){var u;const s=l6(t,e,n,r),i=s.map(f=>t.getQueryData(re.issues.detail(f))).find(f=>!!f),o=(u=t.getQueryData(re.issues.list(e)))==null?void 0:u.find(f=>s.some(h=>f.id===h||f.identifier===h)),a=i??o??null,l=qt(r==null?void 0:r.identifier)??qt(r==null?void 0:r.issueIdentifier)??(a==null?void 0:a.identifier)??`Issue ${bb(n)}`,c=qt(r==null?void 0:r.title)??qt(r==null?void 0:r.issueTitle)??(a==null?void 0:a.title)??null;return{ref:l,title:c,label:c?`${l} - ${kc(c,72)}`:l,href:`/issues/${(a==null?void 0:a.identifier)??n}`}}const Sre=new Set(["issue.created","issue.updated","issue.comment_added"]),Ere=new Set(["running","error"]),Nre=new Set(["succeeded","failed","timed_out","cancelled"]);function Tre(t){if(!t)return null;const e=[];if(typeof t.status=="string"&&e.push(`status -> ${t.status.replace(/_/g," ")}`),typeof t.priority=="string"&&e.push(`priority -> ${t.priority}`),typeof t.assigneeAgentId=="string"||typeof t.assigneeUserId=="string"?e.push("reassigned"):(t.assigneeAgentId===null||t.assigneeUserId===null)&&e.push("unassigned"),t.reopened===!0){const n=qt(t.reopenedFrom);e.push(n?`reopened from ${n.replace(/_/g," ")}`:"reopened")}return typeof t.title=="string"&&e.push("title changed"),typeof t.description=="string"&&e.push("description changed"),e.length>0?e.join(", "):null}function Are(t,e,n,r){const s=qt(n.entityType),i=qt(n.entityId),o=qt(n.action),a=_S(n.details),l=qt(n.actorId),c=qt(n.actorType);if(s!=="issue"||!i||!o||!Sre.has(o))return null;const u=_re(t,e,i,a),f=Cre(t,e,c,l);if(c==="user"&&!!r.userId&&l===r.userId||c==="agent"&&!1)return null;if(o==="issue.created")return{title:`${f} created ${u.ref}`,body:u.title?kc(u.title,96):void 0,tone:"success",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}`};if(o==="issue.updated"){if(qt(a==null?void 0:a.source)==="comment")return null;const C=Tre(a),_=C?u.title?`${kc(u.title,64)} - ${C}`:C:u.title?kc(u.title,96):u.label;return{title:`${f} updated ${u.ref}`,body:kc(_,100),tone:"info",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}`}}const p=qt(a==null?void 0:a.commentId),m=qt(a==null?void 0:a.bodySnippet),g=(a==null?void 0:a.reopened)===!0,y=(a==null?void 0:a.updated)===!0,v=qt(a==null?void 0:a.reopenedFrom),b=g?v?`reopened from ${v.replace(/_/g," ")}`:"reopened":null,w=g?`${f} reopened and commented on ${u.ref}`:y?`${f} commented and updated ${u.ref}`:`${f} commented on ${u.ref}`,k=m?b?`${b} - ${m.replace(/^#+\s*/m,"").replace(/\n/g," ")}`:m.replace(/^#+\s*/m,"").replace(/\n/g," "):b?u.title?`${b} - ${u.title}`:b:u.title??void 0;return{title:w,body:k?kc(k,96):void 0,tone:"info",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}:${p??"na"}`}}function Ire(t){const e=qt(t.entityType),n=qt(t.action),r=qt(t.entityId),s=_S(t.details);return e!=="join_request"||!n||!r||n!=="join.requested"&&n!=="join.request_replayed"?null:{title:`${qt(s==null?void 0:s.requestType)==="agent"?"Agent":"Someone"} wants to join`,body:"A new join request is waiting for approval.",tone:"info",action:{label:"View inbox",href:"/inbox/unread"},dedupeKey:`join-request:${r}`}}function jre(t,e,n,r){const s=qt(t.agentId),i=qt(t.status);if(!s||!i||!Ere.has(i))return null;const o=i==="error"?"error":"info",a=e(s)??`Agent ${bb(s)}`,l=i==="running"?`${a} started`:`${a} errored`,c=n.getQueryData(re.agents.list(r)),u=c==null?void 0:c.find(h=>h.id===s),f=(u==null?void 0:u.title)??void 0;return{title:l,body:f,tone:o,action:{label:"View agent",href:`/agents/${s}`},dedupeKey:`agent-status:${s}:${i}`}}function Rre(t,e){const n=qt(t.runId),r=qt(t.agentId),s=qt(t.status);if(!n||!r||!s||!Nre.has(s))return null;const i=qt(t.error),o=qt(t.triggerDetail),a=e(r)??`Agent ${bb(r)}`,l=s==="succeeded"?"success":s==="cancelled"?"warn":"error",u=`${a} run ${s==="succeeded"?"succeeded":s==="failed"?"failed":s==="timed_out"?"timed out":"cancelled"}`;let f;return i?f=kc(i,100):o&&(f=`Trigger: ${o}`),{title:u,body:f,tone:l,ttlMs:s==="succeeded"?5e3:7e3,action:{label:"View run",href:`/agents/${r}/runs/${n}`},dedupeKey:`run-status:${n}:${s}`}}function Mre(t,e,n){t.invalidateQueries({queryKey:re.liveRuns(e)}),t.invalidateQueries({queryKey:re.heartbeats(e)}),t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.costs(e)}),t.invalidateQueries({queryKey:re.sidebarBadges(e)});const r=qt(n.agentId);r&&(t.invalidateQueries({queryKey:re.agents.detail(r)}),t.invalidateQueries({queryKey:re.heartbeats(e,r)}))}function Pre(t,e,n){t.invalidateQueries({queryKey:re.activity(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.sidebarBadges(e)});const r=qt(n.entityType),s=qt(n.entityId);if(r==="issue"){if(t.invalidateQueries({queryKey:re.issues.list(e)}),s){const i=_S(n.details),o=l6(t,e,s,i);for(const a of o)t.invalidateQueries({queryKey:re.issues.detail(a)}),t.invalidateQueries({queryKey:re.issues.comments(a)}),t.invalidateQueries({queryKey:re.issues.activity(a)}),t.invalidateQueries({queryKey:re.issues.runs(a)}),t.invalidateQueries({queryKey:re.issues.documents(a)}),t.invalidateQueries({queryKey:re.issues.attachments(a)}),t.invalidateQueries({queryKey:re.issues.approvals(a)}),t.invalidateQueries({queryKey:re.issues.liveRuns(a)}),t.invalidateQueries({queryKey:re.issues.activeRun(a)})}return}if(r==="agent"){t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.org(e)}),s&&(t.invalidateQueries({queryKey:re.agents.detail(s)}),t.invalidateQueries({queryKey:re.heartbeats(e,s)}));return}if(r==="project"){t.invalidateQueries({queryKey:re.projects.list(e)}),s&&t.invalidateQueries({queryKey:re.projects.detail(s)});return}if(r==="goal"){t.invalidateQueries({queryKey:re.goals.list(e)}),s&&t.invalidateQueries({queryKey:re.goals.detail(s)});return}if(r==="approval"){t.invalidateQueries({queryKey:re.approvals.list(e)});return}if(r==="join_request"){t.invalidateQueries({queryKey:re.access.joinRequests(e)});return}if(r==="cost_event"){t.invalidateQueries({queryKey:re.costs(e)}),t.invalidateQueries({queryKey:re.usageByProvider(e)}),t.invalidateQueries({queryKey:re.usageWindowSpend(e)});return}r==="company"&&t.invalidateQueries({queryKey:re.companies.all})}function Ore(t,e){const n=Date.now();if(n<t.suppressUntil)return!0;const r=t.cooldownHits.get(e);if(!r)return!1;const s=r.filter(i=>n-i<vre);return t.cooldownHits.set(e,s),s.length>=wre}function Lre(t,e){const n=Date.now(),r=t.cooldownHits.get(e)??[];r.push(n),t.cooldownHits.set(e,r)}function K1(t,e,n,r){if(Ore(t,n))return;e(r)!==null&&Lre(t,n)}function Dre(t,e,n,r,s,i){if(n.companyId!==e)return;const o=l=>a6(t,e,l),a=n.payload??{};if(n.type!=="heartbeat.run.log"){if(n.type==="heartbeat.run.queued"||n.type==="heartbeat.run.status"){if(Mre(t,e,a),n.type==="heartbeat.run.status"){const l=Rre(a,o);l&&K1(s,r,"run-status",l)}return}if(n.type!=="heartbeat.run.event"){if(n.type==="agent.status"){t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.org(e)});const l=qt(a.agentId);l&&t.invalidateQueries({queryKey:re.agents.detail(l)});const c=jre(a,o,t,e);c&&K1(s,r,"agent-status",c);return}if(n.type==="activity.logged"){Pre(t,e,a);const l=qt(a.action),c=Are(t,e,a,i)??Ire(a);c&&K1(s,r,`activity:${l??"unknown"}`,c)}}}}function oMe({children:t}){var a,l;const{selectedCompanyId:e}=Qi(),n=rr(),{pushToast:r}=mm(),s=x.useRef({cooldownHits:new Map,suppressUntil:0}),{data:i}=st({queryKey:re.auth.session,queryFn:()=>Di.getSession(),retry:!1}),o=((a=i==null?void 0:i.user)==null?void 0:a.id)??((l=i==null?void 0:i.session)==null?void 0:l.userId)??null;return x.useEffect(()=>{if(!e)return;let c=!1,u=0,f=null,h=null;const p=()=>{f!==null&&(window.clearTimeout(f),f=null)},m=()=>{if(c)return;u+=1;const y=Math.min(15e3,1e3*2**Math.min(u-1,4));f=window.setTimeout(()=>{f=null,g()},y)},g=()=>{if(c)return;const v=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/companies/${encodeURIComponent(e)}/events/ws`;h=new WebSocket(v),h.onopen=()=>{u>0&&(s.current.suppressUntil=Date.now()+kre),u=0},h.onmessage=b=>{const w=typeof b.data=="string"?b.data:"";if(w)try{const k=JSON.parse(w);Dre(n,e,k,r,s.current,{userId:o,agentId:null})}catch{}},h.onerror=()=>{h==null||h.close()},h.onclose=()=>{c||m()}};return g(),()=>{c=!0,p(),h&&(h.onopen=null,h.onmessage=null,h.onerror=null,h.onclose=null,h.close(1e3,"provider_unmount"))}},[n,e,r,o]),d.jsx(d.Fragment,{children:t})}const c6="paperclip:panel-visible",u6=x.createContext(null);function Fre(){try{const t=localStorage.getItem(c6);return t===null?!0:t==="true"}catch{return!0}}function eA(t){try{localStorage.setItem(c6,String(t))}catch{}}function aMe({children:t}){const[e,n]=x.useState(null),[r,s]=x.useState(Fre),i=x.useCallback(c=>{n(c)},[]),o=x.useCallback(()=>{n(null)},[]),a=x.useCallback(c=>{s(c),eA(c)},[]),l=x.useCallback(()=>{s(c=>{const u=!c;return eA(u),u})},[]);return d.jsx(u6.Provider,{value:{panelContent:e,panelVisible:r,openPanel:i,closePanel:o,setPanelVisible:a,togglePanelVisible:l},children:t})}function d6(){const t=x.useContext(u6);if(!t)throw new Error("usePanel must be used within PanelProvider");return t}const gm={list:t=>le.get(`/plugins${t?`?status=${t}`:""}`),listExamples:()=>le.get("/plugins/examples"),get:t=>le.get(`/plugins/${t}`),install:t=>le.post("/plugins/install",t),uninstall:(t,e)=>le.delete(`/plugins/${t}${e?"?purge=true":""}`),enable:t=>le.post(`/plugins/${t}/enable`,{}),disable:(t,e)=>le.post(`/plugins/${t}/disable`,e?{reason:e}:{}),health:t=>le.get(`/plugins/${t}/health`),dashboard:t=>le.get(`/plugins/${t}/dashboard`),logs:(t,e)=>{const n=new URLSearchParams;e!=null&&e.limit&&n.set("limit",String(e.limit)),e!=null&&e.level&&n.set("level",e.level),e!=null&&e.since&&n.set("since",e.since);const r=n.toString();return le.get(`/plugins/${t}/logs${r?`?${r}`:""}`)},upgrade:(t,e)=>le.post(`/plugins/${t}/upgrade`,e?{version:e}:{}),listUiContributions:()=>le.get("/plugins/ui-contributions"),getConfig:t=>le.get(`/plugins/${t}/config`),saveConfig:(t,e)=>le.post(`/plugins/${t}/config`,{configJson:e}),testConfig:(t,e)=>le.post(`/plugins/${t}/config/test`,{configJson:e}),bridgeGetData:(t,e,n,r,s)=>le.post(`/plugins/${t}/data/${encodeURIComponent(e)}`,{companyId:r??void 0,params:n,renderEnvironment:s??void 0}),bridgePerformAction:(t,e,n,r,s)=>le.post(`/plugins/${t}/actions/${encodeURIComponent(e)}`,{companyId:r??void 0,params:n,renderEnvironment:s??void 0})},SS=x.createContext(null);function vb(){const t=x.useContext(SS);if(!t)throw new Error("Plugin bridge hook called outside of a <PluginBridgeContext.Provider>. Ensure the plugin component is rendered within a PluginBridgeScope.");return t}function f6(t){if(t instanceof wf&&t.body&&typeof t.body=="object"){const e=t.body;if(typeof e.code=="string"&&typeof e.message=="string")return{code:e.code,message:e.message,details:e.details};if(typeof e.error=="string")return{code:"UNKNOWN",message:e.error}}return{code:"UNKNOWN",message:t instanceof Error?t.message:String(t)}}function $re(t){if(!t)return"";try{return JSON.stringify(t,Object.keys(t).sort())}catch{return""}}function h6(t){return t?{environment:t.environment,launcherId:t.launcherId,bounds:t.bounds}:null}function Bre(t){return t?JSON.stringify(t):""}function Vre(t,e){const{pluginId:n,hostContext:r}=vb(),s=r.companyId,i=h6(r.renderEnvironment),o=Bre(i),[a,l]=x.useState(null),[c,u]=x.useState(!0),[f,h]=x.useState(null),[p,m]=x.useState(0),g=$re(e);x.useEffect(()=>{let v=!1,b=null,w=0;const k=2,C=["WORKER_UNAVAILABLE","TIMEOUT"];u(!0);const _=()=>{gm.bridgeGetData(n,t,e,s,i).then(S=>{v||(l(S.data),h(null),u(!1))}).catch(S=>{if(v)return;const E=f6(S);if(C.includes(E.code)&&w<k){w+=1,b=setTimeout(()=>{b=null,v||_()},150*w);return}h(E),l(null),u(!1)})};return _(),()=>{v=!0,b&&clearTimeout(b)}},[n,t,g,p,s,o]);const y=x.useCallback(()=>{m(v=>v+1)},[]);return{data:a,loading:c,error:f,refresh:y}}function zre(t){const e=vb(),n=x.useRef(e);return n.current=e,x.useCallback(async r=>{const{pluginId:s,hostContext:i}=n.current,o=i.companyId,a=h6(i.renderEnvironment);try{return(await gm.bridgePerformAction(s,t,r,o,a)).data}catch(l){throw f6(l)}},[t])}function Hre(){const{hostContext:t}=vb();return t}function Ure(){const{pushToast:t}=mm();return x.useCallback(e=>t(e),[t])}function Wre(t,e){const{pluginId:n,hostContext:r}=vb(),s=(e==null?void 0:e.companyId)??r.companyId??void 0,[i,o]=x.useState([]),[a,l]=x.useState(null),[c,u]=x.useState(!!s),[f,h]=x.useState(!1),[p,m]=x.useState(null),g=x.useRef(null),y=x.useCallback(()=>{var v;(v=g.current)==null||v.close(),g.current=null,u(!1),h(!1)},[]);return x.useEffect(()=>{if(o([]),l(null),m(null),!s){y();return}const v=new URLSearchParams({companyId:s}),b=new EventSource(`/api/plugins/${encodeURIComponent(n)}/bridge/stream/${encodeURIComponent(t)}?${v.toString()}`,{withCredentials:!0});return g.current=b,u(!0),h(!1),b.onopen=()=>{u(!1),h(!0),m(null)},b.onmessage=w=>{try{const k=JSON.parse(w.data);o(C=>[...C,k]),l(k)}catch(k){m(k instanceof Error?k:new Error(String(k)))}},b.addEventListener("close",()=>{b.close(),g.current===b&&(g.current=null),u(!1),h(!1)}),b.onerror=()=>{u(!1),h(!1),m(new Error(`Failed to connect to plugin stream "${t}"`)),b.close(),g.current===b&&(g.current=null)},()=>{b.close(),g.current===b&&(g.current=null)}},[t,y,s,n]),{events:i,lastEvent:a,connecting:c,connected:f,error:p,close:y}}function lMe(t,e){globalThis.__paperclipPluginBridge__={react:t,reactDom:e,sdkUi:{usePluginData:Vre,usePluginAction:zre,useHostContext:Hre,usePluginStream:Wre,usePluginToast:Ure}}}const tA=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,nA=bD,ES=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return nA(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=tA(u)||tA(f);return s[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...i,...a}[g]):{...i,...a}[g]===y})?[...c,f,h]:c},[]);return nA(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Kre=ES("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,opacity] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-9 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-10","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-9","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Fe({className:t,variant:e="default",size:n="default",asChild:r=!1,...s}){const i=r?k_:"button";return d.jsx(i,{"data-slot":"button","data-variant":e,"data-size":n,className:Z(Kre({variant:e,size:n,className:t})),...s})}const wb=new Map;function kb(t,e){return`${t}:${e}`}function qre(t){return t==="detailTab"||t==="taskDetailView"||t==="contextMenuItem"||t==="commentAnnotation"||t==="commentContextMenuItem"||t==="projectSidebarItem"||t==="toolbarButton"}function Gre(t){return t instanceof Error&&t.message?t.message:"Unknown error"}function Jre(t,e,n){wb.set(kb(t,e),{kind:"react",component:n})}function Zre(t,e,n){wb.set(kb(t,e),{kind:"web-component",tagName:n})}function Qre(t){return wb.get(kb(t.pluginKey,t.exportName))??null}function rA(t,e){return wb.get(kb(t,e))??null}const Cc=new Map,bh=new Map;function NS(t){const e=t.updatedAt??t.version??"0";return`${t.pluginId}:${e}`}function Yre(t){const e=encodeURIComponent(t.updatedAt??t.version??"0");return`/_plugins/${encodeURIComponent(t.pluginId)}/ui/${t.uiEntryFile}?v=${e}`}const q1={};function Xre(t,e){return e===void 0?t??{}:{...t??{},key:e}}function Us(t){if(q1[t])return q1[t];let e;switch(t){case"react":e=`
|
|
65
|
+
*/var gT;function oJ(){if(gT)return D1;gT=1;var t=tW();function e(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function a(f,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),g=m[0].inst,y=m[1];return i(function(){g.value=p,g.getSnapshot=h,l(g)&&y({inst:g})},[f,p,h]),s(function(){return l(g)&&y({inst:g}),f(function(){l(g)&&y({inst:g})})},[f]),o(p),p}function l(f){var h=f.getSnapshot;f=f.value;try{var p=h();return!n(f,p)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return D1.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,D1}var xT;function aJ(){return xT||(xT=1,L1.exports=oJ()),L1.exports}var lJ=aJ();function cJ(){return lJ.useSyncExternalStore(uJ,()=>!0,()=>!1)}function uJ(){return()=>{}}var O_="Avatar",[dJ]=cs(O_),[fJ,CO]=dJ(O_),_O=x.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=x.useState("idle");return d.jsx(fJ,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:d.jsx(it.span,{...r,ref:e})})});_O.displayName=O_;var SO="AvatarImage",EO=x.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,o=CO(SO,n),a=hJ(r,i),l=hr(c=>{s(c),o.onImageLoadingStatusChange(c)});return Un(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?d.jsx(it.img,{...i,ref:e,src:r}):null});EO.displayName=SO;var NO="AvatarFallback",TO=x.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=CO(NO,n),[o,a]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&i.imageLoadingStatus!=="loaded"?d.jsx(it.span,{...s,ref:e}):null});TO.displayName=NO;function yT(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function hJ(t,{referrerPolicy:e,crossOrigin:n}){const r=cJ(),s=x.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[o,a]=x.useState(()=>yT(i,t));return Un(()=>{a(yT(i,t))},[i,t]),Un(()=>{const l=f=>()=>{a(f)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,e]),o}var pJ=_O,mJ=EO,gJ=TO;function xJ(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function yJ(t){const[e,n]=x.useState(void 0);return Un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const bJ=["top","right","bottom","left"],Pl=Math.min,js=Math.max,Jx=Math.round,og=Math.floor,Ao=t=>({x:t,y:t}),vJ={left:"right",right:"left",bottom:"top",top:"bottom"},wJ={start:"end",end:"start"};function lk(t,e,n){return js(t,Pl(e,n))}function Ta(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function _f(t){return t.split("-")[1]}function L_(t){return t==="x"?"y":"x"}function D_(t){return t==="y"?"height":"width"}const kJ=new Set(["top","bottom"]);function ko(t){return kJ.has(Aa(t))?"y":"x"}function F_(t){return L_(ko(t))}function CJ(t,e,n){n===void 0&&(n=!1);const r=_f(t),s=F_(t),i=D_(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Zx(o)),[o,Zx(o)]}function _J(t){const e=Zx(t);return[ck(t),e,ck(e)]}function ck(t){return t.replace(/start|end/g,e=>wJ[e])}const bT=["left","right"],vT=["right","left"],SJ=["top","bottom"],EJ=["bottom","top"];function NJ(t,e,n){switch(t){case"top":case"bottom":return n?e?vT:bT:e?bT:vT;case"left":case"right":return e?SJ:EJ;default:return[]}}function TJ(t,e,n,r){const s=_f(t);let i=NJ(Aa(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(ck)))),i}function Zx(t){return t.replace(/left|right|bottom|top/g,e=>vJ[e])}function AJ(t){return{top:0,right:0,bottom:0,left:0,...t}}function AO(t){return typeof t!="number"?AJ(t):{top:t,right:t,bottom:t,left:t}}function Qx(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function wT(t,e,n){let{reference:r,floating:s}=t;const i=ko(e),o=F_(e),a=D_(o),l=Aa(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-s.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(_f(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}async function IJ(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Ta(e,t),m=AO(p),y=a[h?f==="floating"?"reference":"floating":f],v=Qx(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Qx(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-C.top+m.top)/k.y,bottom:(C.bottom-v.bottom+m.bottom)/k.y,left:(v.left-C.left+m.left)/k.x,right:(C.right-v.right+m.right)/k.x}}const jJ=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:f}=wT(c,r,l),h=r,p={},m=0;for(let y=0;y<a.length;y++){var g;const{name:v,fn:b}=a[y],{x:w,y:k,data:C,reset:_}=await b({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:p,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:IJ},elements:{reference:t,floating:e}});u=w??u,f=k??f,p={...p,[v]:{...p[v],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(c=_.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):_.rects),{x:u,y:f}=wT(c,h,l)),y=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:p}},RJ=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ta(t,e)||{};if(c==null)return{};const f=AO(u),h={x:n,y:r},p=F_(s),m=D_(p),g=await o.getDimensions(c),y=p==="y",v=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[p]-h[p]-i.floating[m],C=h[p]-i.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=_?_[w]:0;(!S||!await(o.isElement==null?void 0:o.isElement(_)))&&(S=a.floating[w]||i.floating[m]);const E=k/2-C/2,N=S/2-g[m]/2-1,T=Pl(f[v],N),O=Pl(f[b],N),L=T,I=S-g[m]-O,M=S/2-g[m]/2+E,V=lk(L,M,I),G=!l.arrow&&_f(s)!=null&&M!==V&&i.reference[m]/2-(M<L?T:O)-g[m]/2<0,D=G?M<L?M-L:M-I:0;return{[p]:h[p]+D,data:{[p]:V,centerOffset:M-V-D,...G&&{alignmentOffset:D}},reset:G}}}),MJ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Ta(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Aa(s),b=ko(a),w=Aa(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(w||!g?[Zx(a)]:_J(a)),_=m!=="none";!h&&_&&C.push(...TJ(a,g,m,k));const S=[a,...C],E=await l.detectOverflow(e,y),N=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(E[v]),f){const M=CJ(s,o,k);N.push(E[M[0]],E[M[1]])}if(T=[...T,{placement:s,overflows:N}],!N.every(M=>M<=0)){var O,L;const M=(((O=i.flip)==null?void 0:O.index)||0)+1,V=S[M];if(V&&(!(f==="alignment"?b!==ko(V):!1)||T.every(B=>ko(B.placement)===b?B.overflows[0]>0:!0)))return{data:{index:M,overflows:T},reset:{placement:V}};let G=(L=T.filter(D=>D.overflows[0]<=0).sort((D,B)=>D.overflows[1]-B.overflows[1])[0])==null?void 0:L.placement;if(!G)switch(p){case"bestFit":{var I;const D=(I=T.filter(B=>{if(_){const F=ko(B.placement);return F===b||F==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(F=>F>0).reduce((F,R)=>F+R,0)]).sort((B,F)=>B[1]-F[1])[0])==null?void 0:I[0];D&&(G=D);break}case"initialPlacement":G=a;break}if(s!==G)return{reset:{placement:G}}}return{}}}};function kT(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function CT(t){return bJ.some(e=>t[e]>=0)}const PJ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=Ta(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),a=kT(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:CT(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),a=kT(o,n.floating);return{data:{escapedOffsets:a,escaped:CT(a)}}}default:return{}}}}},IO=new Set(["left","top"]);async function OJ(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Aa(n),a=_f(n),l=ko(n)==="y",c=IO.has(o)?-1:1,u=i&&l?-1:1,f=Ta(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const LJ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await OJ(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},DJ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Ta(t,e),u={x:n,y:r},f=await i.detectOverflow(e,c),h=ko(Aa(s)),p=L_(h);let m=u[p],g=u[h];if(o){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=m+f[v],k=m-f[b];m=lk(w,m,k)}if(a){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=g+f[v],k=g-f[b];g=lk(w,g,k)}const y=l.fn({...e,[p]:m,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:o,[h]:a}}}}}},FJ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ta(t,e),u={x:n,y:r},f=ko(s),h=L_(f);let p=u[h],m=u[f];const g=Ta(a,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=h==="y"?"height":"width",k=i.reference[h]-i.floating[w]+y.mainAxis,C=i.reference[h]+i.reference[w]-y.mainAxis;p<k?p=k:p>C&&(p=C)}if(c){var v,b;const w=h==="y"?"width":"height",k=IO.has(Aa(s)),C=i.reference[f]-i.floating[w]+(k&&((v=o.offset)==null?void 0:v[f])||0)+(k?0:y.crossAxis),_=i.reference[f]+i.reference[w]+(k?0:((b=o.offset)==null?void 0:b[f])||0)-(k?y.crossAxis:0);m<C?m=C:m>_&&(m=_)}return{[h]:p,[f]:m}}}},$J=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:a}=e,{apply:l=()=>{},...c}=Ta(t,e),u=await o.detectOverflow(e,c),f=Aa(s),h=_f(s),p=ko(s)==="y",{width:m,height:g}=i.floating;let y,v;f==="top"||f==="bottom"?(y=f,v=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,y=h==="end"?"top":"bottom");const b=g-u.top-u.bottom,w=m-u.left-u.right,k=Pl(g-u[y],b),C=Pl(m-u[v],w),_=!e.middlewareData.shift;let S=k,E=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=b),_&&!h){const T=js(u.left,0),O=js(u.right,0),L=js(u.top,0),I=js(u.bottom,0);p?E=m-2*(T!==0||O!==0?T+O:js(u.left,u.right)):S=g-2*(L!==0||I!==0?L+I:js(u.top,u.bottom))}await l({...e,availableWidth:E,availableHeight:S});const N=await o.getDimensions(a.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Gy(){return typeof window<"u"}function Sf(t){return jO(t)?(t.nodeName||"").toLowerCase():"#document"}function Fs(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zo(t){var e;return(e=(jO(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function jO(t){return Gy()?t instanceof Node||t instanceof Fs(t).Node:!1}function zi(t){return Gy()?t instanceof Element||t instanceof Fs(t).Element:!1}function Po(t){return Gy()?t instanceof HTMLElement||t instanceof Fs(t).HTMLElement:!1}function _T(t){return!Gy()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fs(t).ShadowRoot}const BJ=new Set(["inline","contents"]);function im(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Hi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!BJ.has(s)}const VJ=new Set(["table","td","th"]);function zJ(t){return VJ.has(Sf(t))}const HJ=[":popover-open",":modal"];function Jy(t){return HJ.some(e=>{try{return t.matches(e)}catch{return!1}})}const UJ=["transform","translate","scale","rotate","perspective"],WJ=["transform","translate","scale","rotate","perspective","filter"],KJ=["paint","layout","strict","content"];function $_(t){const e=B_(),n=zi(t)?Hi(t):t;return UJ.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||WJ.some(r=>(n.willChange||"").includes(r))||KJ.some(r=>(n.contain||"").includes(r))}function qJ(t){let e=Ol(t);for(;Po(e)&&!qd(e);){if($_(e))return e;if(Jy(e))return null;e=Ol(e)}return null}function B_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const GJ=new Set(["html","body","#document"]);function qd(t){return GJ.has(Sf(t))}function Hi(t){return Fs(t).getComputedStyle(t)}function Zy(t){return zi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ol(t){if(Sf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_T(t)&&t.host||zo(t);return _T(e)?e.host:e}function RO(t){const e=Ol(t);return qd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Po(e)&&im(e)?e:RO(e)}function Qh(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=RO(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Fs(s);if(i){const a=uk(o);return e.concat(o,o.visualViewport||[],im(s)?s:[],a&&n?Qh(a):[])}return e.concat(s,Qh(s,[],n))}function uk(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function MO(t){const e=Hi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Po(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,a=Jx(n)!==i||Jx(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function V_(t){return zi(t)?t:t.contextElement}function bd(t){const e=V_(t);if(!Po(e))return Ao(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=MO(e);let o=(i?Jx(n.width):n.width)/r,a=(i?Jx(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JJ=Ao(0);function PO(t){const e=Fs(t);return!B_()||!e.visualViewport?JJ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZJ(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fs(t)?!1:e}function Yc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=V_(t);let o=Ao(1);e&&(r?zi(r)&&(o=bd(r)):o=bd(t));const a=ZJ(i,n,r)?PO(i):Ao(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const h=Fs(i),p=r&&zi(r)?Fs(r):r;let m=h,g=uk(m);for(;g&&r&&p!==m;){const y=bd(g),v=g.getBoundingClientRect(),b=Hi(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,k=v.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=w,c+=k,m=Fs(g),g=uk(m)}}return Qx({width:u,height:f,x:l,y:c})}function Qy(t,e){const n=Zy(t).scrollLeft;return e?e.left+n:Yc(zo(t)).left+n}function OO(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Qy(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function QJ(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=zo(r),a=e?Jy(e.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ao(1);const u=Ao(0),f=Po(r);if((f||!f&&!i)&&((Sf(r)!=="body"||im(o))&&(l=Zy(r)),Po(r))){const p=Yc(r);c=bd(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=o&&!f&&!i?OO(o,l):Ao(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function YJ(t){return Array.from(t.getClientRects())}function XJ(t){const e=zo(t),n=Zy(t),r=t.ownerDocument.body,s=js(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=js(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Qy(t);const a=-n.scrollTop;return Hi(r).direction==="rtl"&&(o+=js(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const ST=25;function eZ(t,e){const n=Fs(t),r=zo(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const u=B_();(!u||u&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const c=Qy(r);if(c<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=ST&&(i-=m)}else c<=ST&&(i+=c);return{width:i,height:o,x:a,y:l}}const tZ=new Set(["absolute","fixed"]);function nZ(t,e){const n=Yc(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Po(t)?bd(t):Ao(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function ET(t,e,n){let r;if(e==="viewport")r=eZ(t,n);else if(e==="document")r=XJ(zo(t));else if(zi(e))r=nZ(e,n);else{const s=PO(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Qx(r)}function LO(t,e){const n=Ol(t);return n===e||!zi(n)||qd(n)?!1:Hi(n).position==="fixed"||LO(n,e)}function rZ(t,e){const n=e.get(t);if(n)return n;let r=Qh(t,[],!1).filter(a=>zi(a)&&Sf(a)!=="body"),s=null;const i=Hi(t).position==="fixed";let o=i?Ol(t):t;for(;zi(o)&&!qd(o);){const a=Hi(o),l=$_(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&tZ.has(s.position)||im(o)&&!l&&LO(t,o))?r=r.filter(u=>u!==o):s=a,o=Ol(o)}return e.set(t,r),r}function sZ(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?Jy(e)?[]:rZ(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=ET(e,u,s);return c.top=js(f.top,c.top),c.right=Pl(f.right,c.right),c.bottom=Pl(f.bottom,c.bottom),c.left=js(f.left,c.left),c},ET(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function iZ(t){const{width:e,height:n}=MO(t);return{width:e,height:n}}function oZ(t,e,n){const r=Po(e),s=zo(e),i=n==="fixed",o=Yc(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Ao(0);function c(){l.x=Qy(s)}if(r||!r&&!i)if((Sf(e)!=="body"||im(s))&&(a=Zy(e)),r){const p=Yc(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&c();i&&!r&&s&&c();const u=s&&!r&&!i?OO(s,a):Ao(0),f=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function F1(t){return Hi(t).position==="static"}function NT(t,e){if(!Po(t)||Hi(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return zo(t)===n&&(n=n.ownerDocument.body),n}function DO(t,e){const n=Fs(t);if(Jy(t))return n;if(!Po(t)){let s=Ol(t);for(;s&&!qd(s);){if(zi(s)&&!F1(s))return s;s=Ol(s)}return n}let r=NT(t,e);for(;r&&zJ(r)&&F1(r);)r=NT(r,e);return r&&qd(r)&&F1(r)&&!$_(r)?n:r||qJ(t)||n}const aZ=async function(t){const e=this.getOffsetParent||DO,n=this.getDimensions,r=await n(t.floating);return{reference:oZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lZ(t){return Hi(t).direction==="rtl"}const cZ={convertOffsetParentRelativeRectToViewportRelativeRect:QJ,getDocumentElement:zo,getClippingRect:sZ,getOffsetParent:DO,getElementRects:aZ,getClientRects:YJ,getDimensions:iZ,getScale:bd,isElement:zi,isRTL:lZ};function FO(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function uZ(t,e){let n=null,r;const s=zo(t);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=c;if(a||e(),!h||!p)return;const m=og(f),g=og(s.clientWidth-(u+h)),y=og(s.clientHeight-(f+p)),v=og(u),w={rootMargin:-m+"px "+-g+"px "+-y+"px "+-v+"px",threshold:js(0,Pl(1,l))||1};let k=!0;function C(_){const S=_[0].intersectionRatio;if(S!==l){if(!k)return o();S?o(!1,S):r=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!FO(c,t.getBoundingClientRect())&&o(),k=!1}try{n=new IntersectionObserver(C,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(t)}return o(!0),i}function dZ(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=V_(t),u=s||i?[...c?Qh(c):[],...Qh(e)]:[];u.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=c&&a?uZ(c,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),c&&!l&&p.observe(c),p.observe(e));let m,g=l?Yc(t):null;l&&y();function y(){const v=Yc(t);g&&!FO(g,v)&&n(),g=v,m=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),f==null||f(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const fZ=LJ,hZ=DJ,pZ=MJ,mZ=$J,gZ=PJ,TT=RJ,xZ=FJ,yZ=(t,e,n)=>{const r=new Map,s={platform:cZ,...n},i={...s.platform,_c:r};return jJ(t,e,{...s,platform:i})};var bZ=typeof document<"u",vZ=function(){},mx=bZ?x.useLayoutEffect:vZ;function Yx(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Yx(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Yx(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function $O(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function AT(t,e){const n=$O(t);return Math.round(e*n)/n}function $1(t){const e=x.useRef(t);return mx(()=>{e.current=t}),e}function wZ(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,f]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=x.useState(r);Yx(h,r)||p(r);const[m,g]=x.useState(null),[y,v]=x.useState(null),b=x.useCallback(B=>{B!==_.current&&(_.current=B,g(B))},[]),w=x.useCallback(B=>{B!==S.current&&(S.current=B,v(B))},[]),k=i||m,C=o||y,_=x.useRef(null),S=x.useRef(null),E=x.useRef(u),N=l!=null,T=$1(l),O=$1(s),L=$1(c),I=x.useCallback(()=>{if(!_.current||!S.current)return;const B={placement:e,strategy:n,middleware:h};O.current&&(B.platform=O.current),yZ(_.current,S.current,B).then(F=>{const R={...F,isPositioned:L.current!==!1};M.current&&!Yx(E.current,R)&&(E.current=R,Rl.flushSync(()=>{f(R)}))})},[h,e,n,O,L]);mx(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[c]);const M=x.useRef(!1);mx(()=>(M.current=!0,()=>{M.current=!1}),[]),mx(()=>{if(k&&(_.current=k),C&&(S.current=C),k&&C){if(T.current)return T.current(k,C,I);I()}},[k,C,I,T,N]);const V=x.useMemo(()=>({reference:_,floating:S,setReference:b,setFloating:w}),[b,w]),G=x.useMemo(()=>({reference:k,floating:C}),[k,C]),D=x.useMemo(()=>{const B={position:n,left:0,top:0};if(!G.floating)return B;const F=AT(G.floating,u.x),R=AT(G.floating,u.y);return a?{...B,transform:"translate("+F+"px, "+R+"px)",...$O(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:R}},[n,a,G.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:I,refs:V,elements:G,floatingStyles:D}),[u,I,V,G,D])}const kZ=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TT({element:r.current,padding:s}).fn(n):{}:r?TT({element:r,padding:s}).fn(n):{}}}},CZ=(t,e)=>({...fZ(t),options:[t,e]}),_Z=(t,e)=>({...hZ(t),options:[t,e]}),SZ=(t,e)=>({...xZ(t),options:[t,e]}),EZ=(t,e)=>({...pZ(t),options:[t,e]}),NZ=(t,e)=>({...mZ(t),options:[t,e]}),TZ=(t,e)=>({...gZ(t),options:[t,e]}),AZ=(t,e)=>({...kZ(t),options:[t,e]});var IZ="Arrow",BO=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return d.jsx(it.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});BO.displayName=IZ;var jZ=BO,z_="Popper",[VO,Ql]=cs(z_),[RZ,zO]=VO(z_),HO=t=>{const{__scopePopper:e,children:n}=t,[r,s]=x.useState(null);return d.jsx(RZ,{scope:e,anchor:r,onAnchorChange:s,children:n})};HO.displayName=z_;var UO="PopperAnchor",WO=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=zO(UO,n),o=x.useRef(null),a=Rt(e,o),l=x.useRef(null);return x.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&i.onAnchorChange(l.current)}),r?null:d.jsx(it.div,{...s,ref:a})});WO.displayName=UO;var H_="PopperContent",[MZ,PZ]=VO(H_),KO=x.forwardRef((t,e)=>{var Y,H,ne,de,xe,Oe;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...g}=t,y=zO(H_,n),[v,b]=x.useState(null),w=Rt(e,Ze=>b(Ze)),[k,C]=x.useState(null),_=yJ(k),S=(_==null?void 0:_.width)??0,E=(_==null?void 0:_.height)??0,N=r+(i!=="center"?"-"+i:""),T=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(c)?c:[c],L=O.length>0,I={padding:T,boundary:O.filter(LZ),altBoundary:L},{refs:M,floatingStyles:V,placement:G,isPositioned:D,middlewareData:B}=wZ({strategy:"fixed",placement:N,whileElementsMounted:(...Ze)=>dZ(...Ze,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[CZ({mainAxis:s+E,alignmentAxis:o}),l&&_Z({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?SZ():void 0,...I}),l&&EZ({...I}),NZ({...I,apply:({elements:Ze,rects:ot,availableWidth:pt,availableHeight:ye})=>{const{width:Qe,height:z}=ot.reference,te=Ze.floating.style;te.setProperty("--radix-popper-available-width",`${pt}px`),te.setProperty("--radix-popper-available-height",`${ye}px`),te.setProperty("--radix-popper-anchor-width",`${Qe}px`),te.setProperty("--radix-popper-anchor-height",`${z}px`)}}),k&&AZ({element:k,padding:a}),DZ({arrowWidth:S,arrowHeight:E}),h&&TZ({strategy:"referenceHidden",...I})]}),[F,R]=JO(G),U=hr(m);Un(()=>{D&&(U==null||U())},[D,U]);const J=(Y=B.arrow)==null?void 0:Y.x,P=(H=B.arrow)==null?void 0:H.y,ie=((ne=B.arrow)==null?void 0:ne.centerOffset)!==0,[ge,ae]=x.useState();return Un(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:D?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(de=B.transformOrigin)==null?void 0:de.x,(xe=B.transformOrigin)==null?void 0:xe.y].join(" "),...((Oe=B.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(MZ,{scope:n,placedSide:F,onArrowChange:C,arrowX:J,arrowY:P,shouldHideArrow:ie,children:d.jsx(it.div,{"data-side":F,"data-align":R,...g,ref:w,style:{...g.style,animation:D?void 0:"none"}})})})});KO.displayName=H_;var qO="PopperArrow",OZ={top:"bottom",right:"left",bottom:"top",left:"right"},GO=x.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=PZ(qO,r),o=OZ[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(jZ,{...s,ref:n,style:{...s.style,display:"block"}})})});GO.displayName=qO;function LZ(t){return t!==null}var DZ=t=>({name:"transformOrigin",options:t,fn(e){var y,v,b;const{placement:n,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=JO(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((v=s.arrow)==null?void 0:v.x)??0)+a/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+l/2;let m="",g="";return c==="bottom"?(m=o?f:`${h}px`,g=`${-l}px`):c==="top"?(m=o?f:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,g=o?f:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,g=o?f:`${p}px`),{data:{x:m,y:g}}}});function JO(t){const[e,n="center"]=t.split("-");return[e,n]}var Yy=HO,om=WO,Xy=KO,eb=GO,B1="rovingFocusGroup.onEntryFocus",FZ={bubbles:!1,cancelable:!0},am="RovingFocusGroup",[dk,ZO,$Z]=C_(am),[BZ,Yl]=cs(am,[$Z]),[VZ,zZ]=BZ(am),QO=x.forwardRef((t,e)=>d.jsx(dk.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(dk.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(HZ,{...t,ref:e})})}));QO.displayName=am;var HZ=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=t,h=x.useRef(null),p=Rt(e,h),m=Eu(i),[g,y]=ui({prop:o,defaultProp:a??null,onChange:l,caller:am}),[v,b]=x.useState(!1),w=hr(c),k=ZO(n),C=x.useRef(!1),[_,S]=x.useState(0);return x.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(B1,w),()=>E.removeEventListener(B1,w)},[w]),d.jsx(VZ,{scope:n,orientation:r,dir:m,loop:s,currentTabStopId:g,onItemFocus:x.useCallback(E=>y(E),[y]),onItemShiftTab:x.useCallback(()=>b(!0),[]),onFocusableItemAdd:x.useCallback(()=>S(E=>E+1),[]),onFocusableItemRemove:x.useCallback(()=>S(E=>E-1),[]),children:d.jsx(it.div,{tabIndex:v||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Le(t.onMouseDown,()=>{C.current=!0}),onFocus:Le(t.onFocus,E=>{const N=!C.current;if(E.target===E.currentTarget&&N&&!v){const T=new CustomEvent(B1,FZ);if(E.currentTarget.dispatchEvent(T),!T.defaultPrevented){const O=k().filter(G=>G.focusable),L=O.find(G=>G.active),I=O.find(G=>G.id===g),V=[L,I,...O].filter(Boolean).map(G=>G.ref.current);e9(V,u)}}C.current=!1}),onBlur:Le(t.onBlur,()=>b(!1))})})}),YO="RovingFocusGroupItem",XO=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...a}=t,l=Ds(),c=i||l,u=zZ(YO,n),f=u.currentTabStopId===c,h=ZO(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:g}=u;return x.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),d.jsx(dk.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:d.jsx(it.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:Le(t.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:Le(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:Le(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=KZ(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=h().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const k=w.indexOf(y.currentTarget);w=u.loop?qZ(w,k+1):w.slice(k+1)}setTimeout(()=>e9(w))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});XO.displayName=YO;var UZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WZ(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function KZ(t,e,n){const r=WZ(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return UZ[r]}function e9(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function qZ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var tb=QO,lm=XO,fk=["Enter"," "],GZ=["ArrowDown","PageUp","Home"],t9=["ArrowUp","PageDown","End"],JZ=[...GZ,...t9],ZZ={ltr:[...fk,"ArrowRight"],rtl:[...fk,"ArrowLeft"]},QZ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cm="Menu",[Yh,YZ,XZ]=C_(cm),[Nu,n9]=cs(cm,[XZ,Ql,Yl]),nb=Ql(),r9=Yl(),[eQ,Tu]=Nu(cm),[tQ,um]=Nu(cm),s9=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=t,a=nb(e),[l,c]=x.useState(null),u=x.useRef(!1),f=hr(i),h=Eu(s);return x.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),d.jsx(Yy,{...a,children:d.jsx(eQ,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:c,children:d.jsx(tQ,{scope:e,onClose:x.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};s9.displayName=cm;var nQ="MenuAnchor",U_=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=nb(n);return d.jsx(om,{...s,...r,ref:e})});U_.displayName=nQ;var W_="MenuPortal",[rQ,i9]=Nu(W_,{forceMount:void 0}),o9=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Tu(W_,e);return d.jsx(rQ,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};o9.displayName=W_;var ii="MenuContent",[sQ,K_]=Nu(ii),a9=x.forwardRef((t,e)=>{const n=i9(ii,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Tu(ii,t.__scopeMenu),o=um(ii,t.__scopeMenu);return d.jsx(Yh.Provider,{scope:t.__scopeMenu,children:d.jsx(br,{present:r||i.open,children:d.jsx(Yh.Slot,{scope:t.__scopeMenu,children:o.modal?d.jsx(iQ,{...s,ref:e}):d.jsx(oQ,{...s,ref:e})})})})}),iQ=x.forwardRef((t,e)=>{const n=Tu(ii,t.__scopeMenu),r=x.useRef(null),s=Rt(e,r);return x.useEffect(()=>{const i=r.current;if(i)return Wy(i)},[]),d.jsx(q_,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),oQ=x.forwardRef((t,e)=>{const n=Tu(ii,t.__scopeMenu);return d.jsx(q_,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),aQ=Ml("MenuContent.ScrollLock"),q_=x.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...g}=t,y=Tu(ii,n),v=um(ii,n),b=nb(n),w=r9(n),k=YZ(n),[C,_]=x.useState(null),S=x.useRef(null),E=Rt(e,S,y.onContentChange),N=x.useRef(0),T=x.useRef(""),O=x.useRef(0),L=x.useRef(null),I=x.useRef("right"),M=x.useRef(0),V=m?sm:x.Fragment,G=m?{as:aQ,allowPinchZoom:!0}:void 0,D=F=>{var Y,H;const R=T.current+F,U=k().filter(ne=>!ne.disabled),J=document.activeElement,P=(Y=U.find(ne=>ne.ref.current===J))==null?void 0:Y.textValue,ie=U.map(ne=>ne.textValue),ge=bQ(ie,R,P),ae=(H=U.find(ne=>ne.textValue===ge))==null?void 0:H.ref.current;(function ne(de){T.current=de,window.clearTimeout(N.current),de!==""&&(N.current=window.setTimeout(()=>ne(""),1e3))})(R),ae&&setTimeout(()=>ae.focus())};x.useEffect(()=>()=>window.clearTimeout(N.current),[]),Hy();const B=x.useCallback(F=>{var U,J;return I.current===((U=L.current)==null?void 0:U.side)&&wQ(F,(J=L.current)==null?void 0:J.area)},[]);return d.jsx(sQ,{scope:n,searchRef:T,onItemEnter:x.useCallback(F=>{B(F)&&F.preventDefault()},[B]),onItemLeave:x.useCallback(F=>{var R;B(F)||((R=S.current)==null||R.focus(),_(null))},[B]),onTriggerLeave:x.useCallback(F=>{B(F)&&F.preventDefault()},[B]),pointerGraceTimerRef:O,onPointerGraceIntentChange:x.useCallback(F=>{L.current=F},[]),children:d.jsx(V,{...G,children:d.jsx(rm,{asChild:!0,trapped:s,onMountAutoFocus:Le(i,F=>{var R;F.preventDefault(),(R=S.current)==null||R.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:d.jsx(tb,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Le(l,F=>{v.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Xy,{role:"menu","aria-orientation":"vertical","data-state":C9(y.open),"data-radix-menu-content":"",dir:v.dir,...b,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:Le(g.onKeyDown,F=>{const U=F.target.closest("[data-radix-menu-content]")===F.currentTarget,J=F.ctrlKey||F.altKey||F.metaKey,P=F.key.length===1;U&&(F.key==="Tab"&&F.preventDefault(),!J&&P&&D(F.key));const ie=S.current;if(F.target!==ie||!JZ.includes(F.key))return;F.preventDefault();const ae=k().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);t9.includes(F.key)&&ae.reverse(),xQ(ae)}),onBlur:Le(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(N.current),T.current="")}),onPointerMove:Le(t.onPointerMove,Xh(F=>{const R=F.target,U=M.current!==F.clientX;if(F.currentTarget.contains(R)&&U){const J=F.clientX>M.current?"right":"left";I.current=J,M.current=F.clientX}}))})})})})})})});a9.displayName=ii;var lQ="MenuGroup",G_=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{role:"group",...r,ref:e})});G_.displayName=lQ;var cQ="MenuLabel",l9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{...r,ref:e})});l9.displayName=cQ;var Xx="MenuItem",IT="menu.itemSelect",rb=x.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=x.useRef(null),o=um(Xx,t.__scopeMenu),a=K_(Xx,t.__scopeMenu),l=Rt(e,i),c=x.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(IT,{bubbles:!0,cancelable:!0});f.addEventListener(IT,p=>r==null?void 0:r(p),{once:!0}),VP(f,h),h.defaultPrevented?c.current=!1:o.onClose()}};return d.jsx(c9,{...s,ref:l,disabled:n,onClick:Le(t.onClick,u),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),c.current=!0},onPointerUp:Le(t.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Le(t.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||fk.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});rb.displayName=Xx;var c9=x.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,o=K_(Xx,n),a=r9(n),l=x.useRef(null),c=Rt(e,l),[u,f]=x.useState(!1),[h,p]=x.useState("");return x.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),d.jsx(Yh.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:d.jsx(lm,{asChild:!0,...a,focusable:!r,children:d.jsx(it.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:Le(t.onPointerMove,Xh(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(t.onPointerLeave,Xh(m=>o.onItemLeave(m))),onFocus:Le(t.onFocus,()=>f(!0)),onBlur:Le(t.onBlur,()=>f(!1))})})})}),uQ="MenuCheckboxItem",u9=x.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return d.jsx(m9,{scope:t.__scopeMenu,checked:n,children:d.jsx(rb,{role:"menuitemcheckbox","aria-checked":e0(n)?"mixed":n,...s,ref:e,"data-state":Z_(n),onSelect:Le(s.onSelect,()=>r==null?void 0:r(e0(n)?!0:!n),{checkForDefaultPrevented:!1})})})});u9.displayName=uQ;var d9="MenuRadioGroup",[dQ,fQ]=Nu(d9,{value:void 0,onValueChange:()=>{}}),f9=x.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=hr(r);return d.jsx(dQ,{scope:t.__scopeMenu,value:n,onValueChange:i,children:d.jsx(G_,{...s,ref:e})})});f9.displayName=d9;var h9="MenuRadioItem",p9=x.forwardRef((t,e)=>{const{value:n,...r}=t,s=fQ(h9,t.__scopeMenu),i=n===s.value;return d.jsx(m9,{scope:t.__scopeMenu,checked:i,children:d.jsx(rb,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Z_(i),onSelect:Le(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});p9.displayName=h9;var J_="MenuItemIndicator",[m9,hQ]=Nu(J_,{checked:!1}),g9=x.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=hQ(J_,n);return d.jsx(br,{present:r||e0(i.checked)||i.checked===!0,children:d.jsx(it.span,{...s,ref:e,"data-state":Z_(i.checked)})})});g9.displayName=J_;var pQ="MenuSeparator",x9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});x9.displayName=pQ;var mQ="MenuArrow",y9=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=nb(n);return d.jsx(eb,{...s,...r,ref:e})});y9.displayName=mQ;var gQ="MenuSub",[URe,b9]=Nu(gQ),gh="MenuSubTrigger",v9=x.forwardRef((t,e)=>{const n=Tu(gh,t.__scopeMenu),r=um(gh,t.__scopeMenu),s=b9(gh,t.__scopeMenu),i=K_(gh,t.__scopeMenu),o=x.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:t.__scopeMenu},u=x.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return x.useEffect(()=>u,[u]),x.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),d.jsx(U_,{asChild:!0,...c,children:d.jsx(c9,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":C9(n.open),...t,ref:Vy(e,s.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(t.onPointerMove,Xh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Le(t.onPointerLeave,Xh(f=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const g=(m=n.content)==null?void 0:m.dataset.side,y=g==="right",v=y?-5:5,b=h[y?"left":"right"],w=h[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:b,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:b,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Le(t.onKeyDown,f=>{var p;const h=i.searchRef.current!=="";t.disabled||h&&f.key===" "||ZZ[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});v9.displayName=gh;var w9="MenuSubContent",k9=x.forwardRef((t,e)=>{const n=i9(ii,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Tu(ii,t.__scopeMenu),o=um(ii,t.__scopeMenu),a=b9(w9,t.__scopeMenu),l=x.useRef(null),c=Rt(e,l);return d.jsx(Yh.Provider,{scope:t.__scopeMenu,children:d.jsx(br,{present:r||i.open,children:d.jsx(Yh.Slot,{scope:t.__scopeMenu,children:d.jsx(q_,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Le(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Le(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Le(t.onKeyDown,u=>{var p;const f=u.currentTarget.contains(u.target),h=QZ[o.dir].includes(u.key);f&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});k9.displayName=w9;function C9(t){return t?"open":"closed"}function e0(t){return t==="indeterminate"}function Z_(t){return e0(t)?"indeterminate":t?"checked":"unchecked"}function xQ(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function yQ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bQ(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=yQ(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function vQ(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(s=!s)}return s}function wQ(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return vQ(n,e)}function Xh(t){return e=>e.pointerType==="mouse"?t(e):void 0}var kQ=s9,CQ=U_,_Q=o9,SQ=a9,EQ=G_,NQ=l9,TQ=rb,AQ=u9,IQ=f9,jQ=p9,RQ=g9,MQ=x9,PQ=y9,OQ=v9,LQ=k9,sb="DropdownMenu",[DQ]=cs(sb,[n9]),us=n9(),[FQ,_9]=DQ(sb),S9=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=t,l=us(e),c=x.useRef(null),[u,f]=ui({prop:s,defaultProp:i??!1,onChange:o,caller:sb});return d.jsx(FQ,{scope:e,triggerId:Ds(),triggerRef:c,contentId:Ds(),open:u,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(h=>!h),[f]),modal:a,children:d.jsx(kQ,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};S9.displayName=sb;var E9="DropdownMenuTrigger",N9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,i=_9(E9,n),o=us(n);return d.jsx(CQ,{asChild:!0,...o,children:d.jsx(it.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Vy(e,i.triggerRef),onPointerDown:Le(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Le(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});N9.displayName=E9;var $Q="DropdownMenuPortal",T9=t=>{const{__scopeDropdownMenu:e,...n}=t,r=us(e);return d.jsx(_Q,{...r,...n})};T9.displayName=$Q;var A9="DropdownMenuContent",I9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=_9(A9,n),i=us(n),o=x.useRef(!1);return d.jsx(SQ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:Le(t.onCloseAutoFocus,a=>{var l;o.current||(l=s.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Le(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!s.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});I9.displayName=A9;var BQ="DropdownMenuGroup",VQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(EQ,{...s,...r,ref:e})});VQ.displayName=BQ;var zQ="DropdownMenuLabel",HQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(NQ,{...s,...r,ref:e})});HQ.displayName=zQ;var UQ="DropdownMenuItem",j9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(TQ,{...s,...r,ref:e})});j9.displayName=UQ;var WQ="DropdownMenuCheckboxItem",R9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(AQ,{...s,...r,ref:e})});R9.displayName=WQ;var KQ="DropdownMenuRadioGroup",qQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(IQ,{...s,...r,ref:e})});qQ.displayName=KQ;var GQ="DropdownMenuRadioItem",JQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(jQ,{...s,...r,ref:e})});JQ.displayName=GQ;var ZQ="DropdownMenuItemIndicator",M9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(RQ,{...s,...r,ref:e})});M9.displayName=ZQ;var QQ="DropdownMenuSeparator",P9=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(MQ,{...s,...r,ref:e})});P9.displayName=QQ;var YQ="DropdownMenuArrow",XQ=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(PQ,{...s,...r,ref:e})});XQ.displayName=YQ;var eY="DropdownMenuSubTrigger",tY=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(OQ,{...s,...r,ref:e})});tY.displayName=eY;var nY="DropdownMenuSubContent",rY=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=us(n);return d.jsx(LQ,{...s,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rY.displayName=nY;var sY=S9,iY=N9,oY=T9,aY=I9,lY=j9,cY=R9,uY=M9,dY=P9;function hk(t,[e,n]){return Math.min(n,Math.max(e,t))}var ib="Popover",[O9]=cs(ib,[Ql]),dm=Ql(),[fY,Xl]=O9(ib),L9=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,a=dm(e),l=x.useRef(null),[c,u]=x.useState(!1),[f,h]=ui({prop:r,defaultProp:s??!1,onChange:i,caller:ib});return d.jsx(Yy,{...a,children:d.jsx(fY,{scope:e,contentId:Ds(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:x.useCallback(()=>u(!0),[]),onCustomAnchorRemove:x.useCallback(()=>u(!1),[]),modal:o,children:n})})};L9.displayName=ib;var D9="PopoverAnchor",F9=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl(D9,n),i=dm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return x.useEffect(()=>(o(),()=>a()),[o,a]),d.jsx(om,{...i,...r,ref:e})});F9.displayName=D9;var $9="PopoverTrigger",ob=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl($9,n),i=dm(n),o=Rt(e,s.triggerRef),a=d.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":U9(s.open),...r,ref:o,onClick:Le(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:d.jsx(om,{asChild:!0,...i,children:a})});ob.displayName=$9;var Q_="PopoverPortal",[hY,pY]=O9(Q_,{forceMount:void 0}),B9=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Xl(Q_,e);return d.jsx(hY,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};B9.displayName=Q_;var Gd="PopoverContent",ab=x.forwardRef((t,e)=>{const n=pY(Gd,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Xl(Gd,t.__scopePopover);return d.jsx(br,{present:r||i.open,children:i.modal?d.jsx(gY,{...s,ref:e}):d.jsx(xY,{...s,ref:e})})});ab.displayName=Gd;var mY=Ml("PopoverContent.RemoveScroll"),gY=x.forwardRef((t,e)=>{const n=Xl(Gd,t.__scopePopover),r=x.useRef(null),s=Rt(e,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return Wy(o)},[]),d.jsx(sm,{as:mY,allowPinchZoom:!0,children:d.jsx(V9,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Le(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Le(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),xY=x.forwardRef((t,e)=>{const n=Xl(Gd,t.__scopePopover),r=x.useRef(!1),s=x.useRef(!1);return d.jsx(V9,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),V9=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=t,h=Xl(Gd,n),p=dm(n);return Hy(),d.jsx(rm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(Xy,{"data-state":U9(h.open),role:"dialog",id:h.contentId,...p,...f,ref:e,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)"}})})})}),z9="PopoverClose",yY=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Xl(z9,n);return d.jsx(it.button,{type:"button",...r,ref:e,onClick:Le(t.onClick,()=>s.onOpenChange(!1))})});yY.displayName=z9;var bY="PopoverArrow",H9=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=dm(n);return d.jsx(eb,{...s,...r,ref:e})});H9.displayName=bY;function U9(t){return t?"open":"closed"}var lb=L9,vY=F9,wY=ob,cb=B9,W9=ab,Y_=H9;function kY(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var X_="ScrollArea",[K9]=cs(X_),[CY,mi]=K9(X_),q9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=t,[a,l]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState(null),[p,m]=x.useState(null),[g,y]=x.useState(null),[v,b]=x.useState(0),[w,k]=x.useState(0),[C,_]=x.useState(!1),[S,E]=x.useState(!1),N=Rt(e,O=>l(O)),T=Eu(s);return d.jsx(CY,{scope:n,type:r,dir:T,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:S,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:k,children:d.jsx(it.div,{dir:T,...o,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});q9.displayName=X_;var G9="ScrollAreaViewport",J9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,o=mi(G9,n),a=x.useRef(null),l=Rt(e,a,o.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),d.jsx(it.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});J9.displayName=G9;var Ho="ScrollAreaScrollbar",Z9=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,a=t.orientation==="horizontal";return x.useEffect(()=>(a?i(!0):o(!0),()=>{a?i(!1):o(!1)}),[a,i,o]),s.type==="hover"?d.jsx(_Y,{...r,ref:e,forceMount:n}):s.type==="scroll"?d.jsx(SY,{...r,ref:e,forceMount:n}):s.type==="auto"?d.jsx(Q9,{...r,ref:e,forceMount:n}):s.type==="always"?d.jsx(eS,{...r,ref:e}):null});Z9.displayName=Ho;var _Y=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),[i,o]=x.useState(!1);return x.useEffect(()=>{const a=s.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),d.jsx(br,{present:n||i,children:d.jsx(Q9,{"data-state":i?"visible":"hidden",...r,ref:e})})}),SY=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=mi(Ho,t.__scopeScrollArea),i=t.orientation==="horizontal",o=db(()=>l("SCROLL_END"),100),[a,l]=kY("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return x.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,s.scrollHideDelay,l]),x.useEffect(()=>{const c=s.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const p=c[u];f!==p&&(l("SCROLL"),o()),f=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[s.viewport,i,l,o]),d.jsx(br,{present:n||a!=="hidden",children:d.jsx(eS,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Le(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Q9=x.forwardRef((t,e)=>{const n=mi(Ho,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,o]=x.useState(!1),a=t.orientation==="horizontal",l=db(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:u)}},10);return Jd(n.viewport,l),Jd(n.content,l),d.jsx(br,{present:r||i,children:d.jsx(eS,{"data-state":i?"visible":"hidden",...s,ref:e})})}),eS=x.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,s=mi(Ho,t.__scopeScrollArea),i=x.useRef(null),o=x.useRef(0),[a,l]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=nL(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return jY(h,o.current,a,p)}return n==="horizontal"?d.jsx(EY,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollLeft,p=jT(h,a,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?d.jsx(NY,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollTop,p=jT(h,a);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),EY=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=mi(Ho,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Rt(e,l,i.onScrollbarXChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(X9,{"data-orientation":"horizontal",...s,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ub(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+u.deltaX;t.onWheelScroll(h),sL(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:n0(o.paddingLeft),paddingEnd:n0(o.paddingRight)}})}})}),NY=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=mi(Ho,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Rt(e,l,i.onScrollbarYChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(X9,{"data-orientation":"vertical",...s,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ub(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollTop+u.deltaY;t.onWheelScroll(h),sL(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:n0(o.paddingTop),paddingEnd:n0(o.paddingBottom)}})}})}),[TY,Y9]=K9(Ho),X9=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=t,p=mi(Ho,n),[m,g]=x.useState(null),y=Rt(e,N=>g(N)),v=x.useRef(null),b=x.useRef(""),w=p.viewport,k=r.content-r.viewport,C=hr(u),_=hr(l),S=db(f,10);function E(N){if(v.current){const T=N.clientX-v.current.left,O=N.clientY-v.current.top;c({x:T,y:O})}}return x.useEffect(()=>{const N=T=>{const O=T.target;(m==null?void 0:m.contains(O))&&C(T,k)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[w,m,k,C]),x.useEffect(_,[r,_]),Jd(m,S),Jd(p.content,S),d.jsx(TY,{scope:n,scrollbar:m,hasThumb:s,onThumbChange:hr(i),onThumbPointerUp:hr(o),onThumbPositionChange:_,onThumbPointerDown:hr(a),children:d.jsx(it.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:Le(t.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),v.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),E(N))}),onPointerMove:Le(t.onPointerMove,E),onPointerUp:Le(t.onPointerUp,N=>{const T=N.target;T.hasPointerCapture(N.pointerId)&&T.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),v.current=null})})})}),t0="ScrollAreaThumb",eL=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Y9(t0,t.__scopeScrollArea);return d.jsx(br,{present:n||s.hasThumb,children:d.jsx(AY,{ref:e,...r})})}),AY=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=mi(t0,n),o=Y9(t0,n),{onThumbPositionChange:a}=o,l=Rt(e,f=>o.onThumbChange(f)),c=x.useRef(void 0),u=db(()=>{c.current&&(c.current(),c.current=void 0)},100);return x.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(u(),!c.current){const p=RY(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,u,a]),d.jsx(it.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Le(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),m=f.clientX-p.left,g=f.clientY-p.top;o.onThumbPointerDown({x:m,y:g})}),onPointerUp:Le(t.onPointerUp,o.onThumbPointerUp)})});eL.displayName=t0;var tS="ScrollAreaCorner",tL=x.forwardRef((t,e)=>{const n=mi(tS,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(IY,{...t,ref:e}):null});tL.displayName=tS;var IY=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=mi(tS,n),[i,o]=x.useState(0),[a,l]=x.useState(0),c=!!(i&&a);return Jd(s.scrollbarX,()=>{var f;const u=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(u),l(u)}),Jd(s.scrollbarY,()=>{var f;const u=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(u),o(u)}),c?d.jsx(it.div,{...r,ref:e,style:{width:i,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function n0(t){return t?parseInt(t,10):0}function nL(t,e){const n=t/e;return isNaN(n)?0:n}function ub(t){const e=nL(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function jY(t,e,n,r="ltr"){const s=ub(n),i=s/2,o=e||i,a=s-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return rL([l,c],f)(t)}function jT(t,e,n="ltr"){const r=ub(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,o=e.content-e.viewport,a=i-r,l=n==="ltr"?[0,o]:[o*-1,0],c=hk(t,l);return rL([0,o],[0,a])(c)}function rL(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function sL(t,e){return t>0&&t<e}var RY=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},o=n.left!==i.left,a=n.top!==i.top;(o||a)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function db(t,e){const n=hr(t),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Jd(t,e){const n=hr(e);Un(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var MY=q9,PY=J9,OY=tL,LY=[" ","Enter","ArrowUp","ArrowDown"],DY=[" ","Enter"],Xc="Select",[fb,hb,FY]=C_(Xc),[Ef]=cs(Xc,[FY,Ql]),pb=Ql(),[$Y,ec]=Ef(Xc),[BY,VY]=Ef(Xc),iL=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:p,form:m}=t,g=pb(e),[y,v]=x.useState(null),[b,w]=x.useState(null),[k,C]=x.useState(!1),_=Eu(c),[S,E]=ui({prop:r,defaultProp:s??!1,onChange:i,caller:Xc}),[N,T]=ui({prop:o,defaultProp:a,onChange:l,caller:Xc}),O=x.useRef(null),L=y?m||!!y.closest("form"):!0,[I,M]=x.useState(new Set),V=Array.from(I).map(G=>G.props.value).join(";");return d.jsx(Yy,{...g,children:d.jsxs($Y,{required:p,scope:e,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Ds(),value:N,onValueChange:T,open:S,onOpenChange:E,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[d.jsx(fb.Provider,{scope:e,children:d.jsx(BY,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(G=>{M(D=>new Set(D).add(G))},[]),onNativeOptionRemove:x.useCallback(G=>{M(D=>{const B=new Set(D);return B.delete(G),B})},[]),children:n})}),L?d.jsxs(TL,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:N,onChange:G=>T(G.target.value),disabled:h,form:m,children:[N===void 0?d.jsx("option",{value:""}):null,Array.from(I)]},V):null]})})};iL.displayName=Xc;var oL="SelectTrigger",aL=x.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=pb(n),o=ec(oL,n),a=o.disabled||r,l=Rt(e,o.onTriggerChange),c=hb(n),u=x.useRef("touch"),[f,h,p]=IL(g=>{const y=c().filter(w=>!w.disabled),v=y.find(w=>w.value===o.value),b=jL(y,g,v);b!==void 0&&o.onValueChange(b.value)}),m=g=>{a||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return d.jsx(om,{asChild:!0,...i,children:d.jsx(it.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":AL(o.value)?"":void 0,...s,ref:l,onClick:Le(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&m(g)}),onPointerDown:Le(s.onPointerDown,g=>{u.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:Le(s.onKeyDown,g=>{const y=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(y&&g.key===" ")&&LY.includes(g.key)&&(m(),g.preventDefault())})})})});aL.displayName=oL;var lL="SelectValue",cL=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=t,l=ec(lL,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=Rt(e,l.onValueNodeChange);return Un(()=>{c(u)},[c,u]),d.jsx(it.span,{...a,ref:f,style:{pointerEvents:"none"},children:AL(l.value)?d.jsx(d.Fragment,{children:o}):i})});cL.displayName=lL;var zY="SelectIcon",uL=x.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return d.jsx(it.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});uL.displayName=zY;var HY="SelectPortal",dL=t=>d.jsx(Cf,{asChild:!0,...t});dL.displayName=HY;var eu="SelectContent",fL=x.forwardRef((t,e)=>{const n=ec(eu,t.__scopeSelect),[r,s]=x.useState();if(Un(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Rl.createPortal(d.jsx(hL,{scope:t.__scopeSelect,children:d.jsx(fb.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),i):null}return d.jsx(pL,{...t,ref:e})});fL.displayName=eu;var Ci=10,[hL,tc]=Ef(eu),UY="SelectContentImpl",WY=Ml("SelectContent.RemoveScroll"),pL=x.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y,...v}=t,b=ec(eu,n),[w,k]=x.useState(null),[C,_]=x.useState(null),S=Rt(e,Y=>k(Y)),[E,N]=x.useState(null),[T,O]=x.useState(null),L=hb(n),[I,M]=x.useState(!1),V=x.useRef(!1);x.useEffect(()=>{if(w)return Wy(w)},[w]),Hy();const G=x.useCallback(Y=>{const[H,...ne]=L().map(Oe=>Oe.ref.current),[de]=ne.slice(-1),xe=document.activeElement;for(const Oe of Y)if(Oe===xe||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===H&&C&&(C.scrollTop=0),Oe===de&&C&&(C.scrollTop=C.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==xe))return},[L,C]),D=x.useCallback(()=>G([E,w]),[G,E,w]);x.useEffect(()=>{I&&D()},[I,D]);const{onOpenChange:B,triggerPointerDownPosRef:F}=b;x.useEffect(()=>{if(w){let Y={x:0,y:0};const H=de=>{var xe,Oe;Y={x:Math.abs(Math.round(de.pageX)-(((xe=F.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(de.pageY)-(((Oe=F.current)==null?void 0:Oe.y)??0))}},ne=de=>{Y.x<=10&&Y.y<=10?de.preventDefault():w.contains(de.target)||B(!1),document.removeEventListener("pointermove",H),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",ne,{capture:!0})}}},[w,B,F]),x.useEffect(()=>{const Y=()=>B(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[B]);const[R,U]=IL(Y=>{const H=L().filter(xe=>!xe.disabled),ne=H.find(xe=>xe.ref.current===document.activeElement),de=jL(H,Y,ne);de&&setTimeout(()=>de.ref.current.focus())}),J=x.useCallback((Y,H,ne)=>{const de=!V.current&&!ne;(b.value!==void 0&&b.value===H||de)&&(N(Y),de&&(V.current=!0))},[b.value]),P=x.useCallback(()=>w==null?void 0:w.focus(),[w]),ie=x.useCallback((Y,H,ne)=>{const de=!V.current&&!ne;(b.value!==void 0&&b.value===H||de)&&O(Y)},[b.value]),ge=r==="popper"?pk:mL,ae=ge===pk?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y}:{};return d.jsx(hL,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:J,selectedItem:E,onItemLeave:P,itemTextRefCallback:ie,focusSelectedItem:D,selectedItemText:T,position:r,isPositioned:I,searchRef:R,children:d.jsx(sm,{as:WY,allowPinchZoom:!0,children:d.jsx(rm,{asChild:!0,trapped:b.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Le(s,Y=>{var H;(H=b.trigger)==null||H.focus({preventScroll:!0}),Y.preventDefault()}),children:d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:d.jsx(ge,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:Y=>Y.preventDefault(),...v,...ae,onPlaced:()=>M(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Le(v.onKeyDown,Y=>{const H=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!H&&Y.key.length===1&&U(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let de=L().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const xe=Y.target,Oe=de.indexOf(xe);de=de.slice(Oe+1)}setTimeout(()=>G(de)),Y.preventDefault()}})})})})})})});pL.displayName=UY;var KY="SelectItemAlignedPosition",mL=x.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=ec(eu,n),o=tc(eu,n),[a,l]=x.useState(null),[c,u]=x.useState(null),f=Rt(e,S=>u(S)),h=hb(n),p=x.useRef(!1),m=x.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=o,w=x.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&y&&v){const S=i.trigger.getBoundingClientRect(),E=c.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(i.dir!=="rtl"){const xe=T.left-E.left,Oe=N.left-xe,Ze=S.left-Oe,ot=S.width+Ze,pt=Math.max(ot,E.width),ye=window.innerWidth-Ci,Qe=hk(Oe,[Ci,Math.max(Ci,ye-pt)]);a.style.minWidth=ot+"px",a.style.left=Qe+"px"}else{const xe=E.right-T.right,Oe=window.innerWidth-N.right-xe,Ze=window.innerWidth-S.right-Oe,ot=S.width+Ze,pt=Math.max(ot,E.width),ye=window.innerWidth-Ci,Qe=hk(Oe,[Ci,Math.max(Ci,ye-pt)]);a.style.minWidth=ot+"px",a.style.right=Qe+"px"}const O=h(),L=window.innerHeight-Ci*2,I=g.scrollHeight,M=window.getComputedStyle(c),V=parseInt(M.borderTopWidth,10),G=parseInt(M.paddingTop,10),D=parseInt(M.borderBottomWidth,10),B=parseInt(M.paddingBottom,10),F=V+G+I+B+D,R=Math.min(y.offsetHeight*5,F),U=window.getComputedStyle(g),J=parseInt(U.paddingTop,10),P=parseInt(U.paddingBottom,10),ie=S.top+S.height/2-Ci,ge=L-ie,ae=y.offsetHeight/2,Y=y.offsetTop+ae,H=V+G+Y,ne=F-H;if(H<=ie){const xe=O.length>0&&y===O[O.length-1].ref.current;a.style.bottom="0px";const Oe=c.clientHeight-g.offsetTop-g.offsetHeight,Ze=Math.max(ge,ae+(xe?P:0)+Oe+D),ot=H+Ze;a.style.height=ot+"px"}else{const xe=O.length>0&&y===O[0].ref.current;a.style.top="0px";const Ze=Math.max(ie,V+g.offsetTop+(xe?J:0)+ae)+ne;a.style.height=Ze+"px",g.scrollTop=H-ie+g.offsetTop}a.style.margin=`${Ci}px 0`,a.style.minHeight=R+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,g,y,v,i.dir,r]);Un(()=>w(),[w]);const[k,C]=x.useState();Un(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const _=x.useCallback(S=>{S&&m.current===!0&&(w(),b==null||b(),m.current=!1)},[w,b]);return d.jsx(GY,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:d.jsx(it.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});mL.displayName=KY;var qY="SelectPopperPosition",pk=x.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Ci,...i}=t,o=pb(n);return d.jsx(Xy,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pk.displayName=qY;var[GY,nS]=Ef(eu,{}),mk="SelectViewport",gL=x.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=tc(mk,n),o=nS(mk,n),a=Rt(e,i.onViewportChange),l=x.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(fb.Slot,{scope:n,children:d.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Le(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Ci*2,g=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),v=Math.max(g,y);if(v<m){const b=v+p,w=Math.min(m,b),k=b-w;f.style.height=w+"px",f.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});gL.displayName=mk;var xL="SelectGroup",[JY,ZY]=Ef(xL),QY=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ds();return d.jsx(JY,{scope:n,id:s,children:d.jsx(it.div,{role:"group","aria-labelledby":s,...r,ref:e})})});QY.displayName=xL;var yL="SelectLabel",YY=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=ZY(yL,n);return d.jsx(it.div,{id:s.id,...r,ref:e})});YY.displayName=yL;var r0="SelectItem",[XY,bL]=Ef(r0),vL=x.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,a=ec(r0,n),l=tc(r0,n),c=a.value===r,[u,f]=x.useState(i??""),[h,p]=x.useState(!1),m=Rt(e,b=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,b,r,s)}),g=Ds(),y=x.useRef("touch"),v=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(XY,{scope:n,value:r,disabled:s,textId:g,isSelected:c,onItemTextChange:x.useCallback(b=>{f(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:d.jsx(fb.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:d.jsx(it.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:Le(o.onFocus,()=>p(!0)),onBlur:Le(o.onBlur,()=>p(!1)),onClick:Le(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:Le(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:Le(o.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Le(o.onPointerMove,b=>{var w;y.current=b.pointerType,s?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Le(o.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Le(o.onKeyDown,b=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&b.key===" "||(DY.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});vL.displayName=r0;var xh="SelectItemText",wL=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=ec(xh,n),a=tc(xh,n),l=bL(xh,n),c=VY(xh,n),[u,f]=x.useState(null),h=Rt(e,v=>f(v),l.onItemTextChange,v=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,v,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=x.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=c;return Un(()=>(g(m),()=>y(m)),[g,y,m]),d.jsxs(d.Fragment,{children:[d.jsx(it.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Rl.createPortal(i.children,o.valueNode):null]})});wL.displayName=xh;var kL="SelectItemIndicator",CL=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return bL(kL,n).isSelected?d.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});CL.displayName=kL;var gk="SelectScrollUpButton",_L=x.forwardRef((t,e)=>{const n=tc(gk,t.__scopeSelect),r=nS(gk,t.__scopeSelect),[s,i]=x.useState(!1),o=Rt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?d.jsx(EL,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_L.displayName=gk;var xk="SelectScrollDownButton",SL=x.forwardRef((t,e)=>{const n=tc(xk,t.__scopeSelect),r=nS(xk,t.__scopeSelect),[s,i]=x.useState(!1),o=Rt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?d.jsx(EL,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});SL.displayName=xk;var EL=x.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=tc("SelectScrollButton",n),o=x.useRef(null),a=hb(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),Un(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(it.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:Le(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Le(s.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Le(s.onPointerLeave,()=>{l()})})}),eX="SelectSeparator",NL=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});NL.displayName=eX;var yk="SelectArrow",tX=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=pb(n),i=ec(yk,n),o=tc(yk,n);return i.open&&o.position==="popper"?d.jsx(eb,{...s,...r,ref:e}):null});tX.displayName=yk;var nX="SelectBubbleInput",TL=x.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=x.useRef(null),i=Rt(r,s),o=xJ(e);return x.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const f=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(f)}},[o,e]),d.jsx(it.select,{...n,style:{...zP,...n.style},ref:i,defaultValue:e})});TL.displayName=nX;function AL(t){return t===""||t===void 0}function IL(t){const e=hr(t),n=x.useRef(""),r=x.useRef(0),s=x.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),i=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function jL(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=rX(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function rX(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var sX=iL,iX=aL,oX=cL,aX=uL,lX=dL,cX=fL,uX=gL,dX=vL,fX=wL,WRe=CL,KRe=_L,qRe=SL,hX=NL,pX="Separator",RT="horizontal",mX=["horizontal","vertical"],RL=x.forwardRef((t,e)=>{const{decorative:n,orientation:r=RT,...s}=t,i=gX(r)?r:RT,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return d.jsx(it.div,{"data-orientation":i,...a,...s,ref:e})});RL.displayName=pX;function gX(t){return mX.includes(t)}var ML=RL,mb="Tabs",[xX]=cs(mb,[Yl]),PL=Yl(),[yX,rS]=xX(mb),OL=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=t,u=Eu(a),[f,h]=ui({prop:r,onChange:s,defaultProp:i??"",caller:mb});return d.jsx(yX,{scope:n,baseId:Ds(),value:f,onValueChange:h,orientation:o,dir:u,activationMode:l,children:d.jsx(it.div,{dir:u,"data-orientation":o,...c,ref:e})})});OL.displayName=mb;var LL="TabsList",DL=x.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=rS(LL,n),o=PL(n);return d.jsx(tb,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:d.jsx(it.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});DL.displayName=LL;var FL="TabsTrigger",$L=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,o=rS(FL,n),a=PL(n),l=zL(o.baseId,r),c=HL(o.baseId,r),u=r===o.value;return d.jsx(lm,{asChild:!0,...a,focusable:!s,active:u,children:d.jsx(it.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...i,ref:e,onMouseDown:Le(t.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Le(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Le(t.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!s&&f&&o.onValueChange(r)})})})});$L.displayName=FL;var BL="TabsContent",VL=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=t,a=rS(BL,n),l=zL(a.baseId,r),c=HL(a.baseId,r),u=r===a.value,f=x.useRef(u);return x.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),d.jsx(br,{present:s||u,children:({present:h})=>d.jsx(it.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});VL.displayName=BL;function zL(t,e){return`${t}-trigger-${e}`}function HL(t,e){return`${t}-content-${e}`}var bX=OL,vX=DL,wX=$L,kX=VL,UL="Toggle",WL=x.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:s,...i}=t,[o,a]=ui({prop:n,onChange:s,defaultProp:r??!1,caller:UL});return d.jsx(it.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:Le(t.onClick,()=>{t.disabled||a(!o)})})});WL.displayName=UL;var nc="ToggleGroup",[KL,qL]=cs(nc,[Yl]),GL=Yl(),sS=j.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const s=r;return d.jsx(CX,{...s,ref:e})}if(n==="multiple"){const s=r;return d.jsx(_X,{...s,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${nc}\``)});sS.displayName=nc;var[JL,ZL]=KL(nc),CX=j.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,a]=ui({prop:n,defaultProp:r??"",onChange:s,caller:nc});return d.jsx(JL,{scope:t.__scopeToggleGroup,type:"single",value:j.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:j.useCallback(()=>a(""),[a]),children:d.jsx(QL,{...i,ref:e})})}),_X=j.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,a]=ui({prop:n,defaultProp:r??[],onChange:s,caller:nc}),l=j.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=j.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(JL,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:d.jsx(QL,{...i,ref:e})})});sS.displayName=nc;var[SX,EX]=KL(nc),QL=j.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:a=!0,...l}=t,c=GL(n),u=Eu(o),f={role:"group",dir:u,...l};return d.jsx(SX,{scope:n,rovingFocus:s,disabled:r,children:s?d.jsx(tb,{asChild:!0,...c,orientation:i,dir:u,loop:a,children:d.jsx(it.div,{...f,ref:e})}):d.jsx(it.div,{...f,ref:e})})}),s0="ToggleGroupItem",YL=j.forwardRef((t,e)=>{const n=ZL(s0,t.__scopeToggleGroup),r=EX(s0,t.__scopeToggleGroup),s=GL(t.__scopeToggleGroup),i=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:i,disabled:o},l=j.useRef(null);return r.rovingFocus?d.jsx(lm,{asChild:!0,...s,focusable:!o,active:i,ref:l,children:d.jsx(MT,{...a,ref:e})}):d.jsx(MT,{...a,ref:e})});YL.displayName=s0;var MT=j.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...s}=t,i=ZL(s0,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return d.jsx(WL,{...a,...s,ref:e,onPressedChange:l=>{l?i.onItemActivate(r):i.onItemDeactivate(r)}})}),NX=sS,TX=YL,iS="Toolbar",[AX]=cs(iS,[Yl,qL]),oS=Yl(),XL=qL(),[IX,eD]=AX(iS),tD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,orientation:r="horizontal",dir:s,loop:i=!0,...o}=t,a=oS(n),l=Eu(s);return d.jsx(IX,{scope:n,orientation:r,dir:l,children:d.jsx(tb,{asChild:!0,...a,orientation:r,dir:l,loop:i,children:d.jsx(it.div,{role:"toolbar","aria-orientation":r,dir:l,...o,ref:e})})})});tD.displayName=iS;var nD="ToolbarSeparator",rD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=eD(nD,n);return d.jsx(ML,{orientation:s.orientation==="horizontal"?"vertical":"horizontal",...r,ref:e})});rD.displayName=nD;var jX="ToolbarButton",aS=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=oS(n);return d.jsx(lm,{asChild:!0,...s,focusable:!t.disabled,children:d.jsx(it.button,{type:"button",...r,ref:e})})});aS.displayName=jX;var RX="ToolbarLink",MX=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=oS(n);return d.jsx(lm,{asChild:!0,...s,focusable:!0,children:d.jsx(it.a,{...r,ref:e,onKeyDown:Le(t.onKeyDown,i=>{i.key===" "&&i.currentTarget.click()})})})});MX.displayName=RX;var sD="ToolbarToggleGroup",iD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=eD(sD,n),i=XL(n);return d.jsx(NX,{"data-orientation":s.orientation,dir:s.dir,...i,...r,ref:e,rovingFocus:!1})});iD.displayName=sD;var PX="ToolbarToggleItem",oD=x.forwardRef((t,e)=>{const{__scopeToolbar:n,...r}=t,s=XL(n),i={__scopeToolbar:t.__scopeToolbar};return d.jsx(aS,{asChild:!0,...i,children:d.jsx(TX,{...s,...r,ref:e})})});oD.displayName=PX;var aD=tD,OX=rD,vd=aS,LX=iD,V1=oD,[gb]=cs("Tooltip",[Ql]),xb=Ql(),lD="TooltipProvider",DX=700,bk="tooltip.open",[FX,lS]=gb(lD),cD=t=>{const{__scopeTooltip:e,delayDuration:n=DX,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(FX,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})};cD.displayName=lD;var ep="Tooltip",[$X,fm]=gb(ep),uD=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=lS(ep,t.__scopeTooltip),c=xb(e),[u,f]=x.useState(null),h=Ds(),p=x.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,y=x.useRef(!1),[v,b]=ui({prop:r,defaultProp:s??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(bk))):l.onClose(),i==null||i(S)},caller:ep}),w=x.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),k=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),_=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},g)},[g,b]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),d.jsx(Yy,{...c,children:d.jsx($X,{scope:e,contentId:h,open:v,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?_():k()},[l.isOpenDelayedRef,_,k]),onTriggerLeave:x.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:k,onClose:C,disableHoverableContent:m,children:n})})};uD.displayName=ep;var vk="TooltipTrigger",dD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=fm(vk,n),i=lS(vk,n),o=xb(n),a=x.useRef(null),l=Rt(e,a,s.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),f=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),d.jsx(om,{asChild:!0,...o,children:d.jsx(it.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:Le(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Le(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Le(t.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Le(t.onFocus,()=>{c.current||s.onOpen()}),onBlur:Le(t.onBlur,s.onClose),onClick:Le(t.onClick,s.onClose)})})});dD.displayName=vk;var cS="TooltipPortal",[BX,VX]=gb(cS,{forceMount:void 0}),fD=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=fm(cS,e);return d.jsx(BX,{scope:e,forceMount:n,children:d.jsx(br,{present:n||i.open,children:d.jsx(Cf,{asChild:!0,container:s,children:r})})})};fD.displayName=cS;var Zd="TooltipContent",hD=x.forwardRef((t,e)=>{const n=VX(Zd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=fm(Zd,t.__scopeTooltip);return d.jsx(br,{present:r||o.open,children:o.disableHoverableContent?d.jsx(pD,{side:s,...i,ref:e}):d.jsx(zX,{side:s,...i,ref:e})})}),zX=x.forwardRef((t,e)=>{const n=fm(Zd,t.__scopeTooltip),r=lS(Zd,t.__scopeTooltip),s=x.useRef(null),i=Rt(e,s),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:f}=r,h=x.useCallback(()=>{a(null),f(!1)},[f]),p=x.useCallback((m,g)=>{const y=m.currentTarget,v={x:m.clientX,y:m.clientY},b=KX(v,y.getBoundingClientRect()),w=qX(v,b),k=GX(g.getBoundingClientRect()),C=ZX([...w,...k]);a(C),f(!0)},[f]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(l&&u){const m=y=>p(y,u),g=y=>p(y,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,p,h]),x.useEffect(()=>{if(o){const m=g=>{const y=g.target,v={x:g.clientX,y:g.clientY},b=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),w=!JX(v,o);b?h():w&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,h]),d.jsx(pD,{...t,ref:i})}),[HX,UX]=gb(ep,{isInside:!1}),WX=Tq("TooltipContent"),pD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,l=fm(Zd,n),c=xb(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(bk,u),()=>document.removeEventListener(bk,u)),[u]),x.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),d.jsx(kf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:d.jsxs(Xy,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(WX,{children:r}),d.jsx(HX,{scope:n,isInside:!0,children:d.jsx(Pq,{id:l.contentId,role:"tooltip",children:s||r})})]})})});hD.displayName=Zd;var mD="TooltipArrow",gD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=xb(n);return UX(mD,n).isInside?null:d.jsx(eb,{...s,...r,ref:e})});gD.displayName=mD;function KX(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function qX(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function GX(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function JX(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(s=!s)}return s}function ZX(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),QX(e)}function QX(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var uS=cD,dS=uD,fS=dD,hS=fD,pS=hD,xD=gD;function yD(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=yD(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function bD(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=yD(t))&&(r&&(r+=" "),r+=e);return r}const YX=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},XX=(t,e)=>({classGroupId:t,validator:e}),vD=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),i0="-",PT=[],eee="arbitrary..",tee=t=>{const e=ree(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return nee(o);const a=o.split(i0),l=a[0]===""&&a.length>1?1:0;return wD(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?YX(c,l):l:c||PT}return n[o]||PT}}},wD=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const c=wD(t,e+1,i);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(i0):t.slice(e).join(i0),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},nee=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?eee+r:void 0})(),ree=t=>{const{theme:e,classGroups:n}=t;return see(n,e)},see=(t,e)=>{const n=vD();for(const r in t){const s=t[r];mS(s,n,r,e)}return n},mS=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const o=t[i];iee(o,e,n,r)}},iee=(t,e,n,r)=>{if(typeof t=="string"){oee(t,e,n);return}if(typeof t=="function"){aee(t,e,n,r);return}lee(t,e,n,r)},oee=(t,e,n)=>{const r=t===""?e:kD(e,t);r.classGroupId=n},aee=(t,e,n,r)=>{if(cee(t)){mS(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(XX(n,t))},lee=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[a,l]=s[o];mS(l,kD(e,a),n,r)}},kD=(t,e)=>{let n=t;const r=e.split(i0),s=r.length;for(let i=0;i<s;i++){const o=r[i];let a=n.nextPart.get(o);a||(a=vD(),n.nextPart.set(o,a)),n=a}return n},cee=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,uee=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},wk="!",OT=":",dee=[],LT=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),fee=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let o=0,a=0,l=0,c;const u=s.length;for(let g=0;g<u;g++){const y=s[g];if(o===0&&a===0){if(y===OT){i.push(s.slice(l,g)),l=g+1;continue}if(y==="/"){c=g;continue}}y==="["?o++:y==="]"?o--:y==="("?a++:y===")"&&a--}const f=i.length===0?s:s.slice(l);let h=f,p=!1;f.endsWith(wk)?(h=f.slice(0,-1),p=!0):f.startsWith(wk)&&(h=f.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return LT(i,p,h,m)};if(e){const s=e+OT,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):LT(dee,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},hee=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",l=e.has(o);a||l?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},pee=t=>({cache:uee(t.cacheSize),parseClassName:fee(t),sortModifiers:hee(t),...tee(t)}),mee=/\s+/,gee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,o=[],a=t.trim().split(mee);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(u);if(f){l=u+(l.length>0?" "+l:l);continue}let y=!!g,v=r(y?m.substring(0,g):m);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=r(m),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const b=h.length===0?"":h.length===1?h[0]:i(h).join(":"),w=p?b+wk:b,k=w+v;if(o.indexOf(k)>-1)continue;o.push(k);const C=s(v,y);for(let _=0;_<C.length;++_){const S=C[_];o.push(w+S)}l=u+(l.length>0?" "+l:l)}return l},xee=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=CD(n))&&(s&&(s+=" "),s+=r);return s},CD=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=CD(t[r]))&&(n&&(n+=" "),n+=e);return n},yee=(t,...e)=>{let n,r,s,i;const o=l=>{const c=e.reduce((u,f)=>f(u),t());return n=pee(c),r=n.cache.get,s=n.cache.set,i=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=gee(l,n);return s(l,u),u};return i=o,(...l)=>i(xee(...l))},bee=[],or=t=>{const e=n=>n[t]||bee;return e.isThemeGetter=!0,e},_D=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,SD=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vee=/^\d+\/\d+$/,wee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Cee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_ee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,See=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ku=t=>vee.test(t),Tt=t=>!!t&&!Number.isNaN(Number(t)),Qa=t=>!!t&&Number.isInteger(Number(t)),z1=t=>t.endsWith("%")&&Tt(t.slice(0,-1)),Jo=t=>wee.test(t),ED=()=>!0,Eee=t=>kee.test(t)&&!Cee.test(t),gS=()=>!1,Nee=t=>_ee.test(t),Tee=t=>See.test(t),Aee=t=>!Xe(t)&&!et(t),Iee=t=>rc(t,AD,gS),Xe=t=>_D.test(t),pc=t=>rc(t,ID,Eee),DT=t=>rc(t,Fee,Tt),jee=t=>rc(t,RD,ED),Ree=t=>rc(t,jD,gS),FT=t=>rc(t,ND,gS),Mee=t=>rc(t,TD,Tee),ag=t=>rc(t,MD,Nee),et=t=>SD.test(t),Kf=t=>Au(t,ID),Pee=t=>Au(t,jD),$T=t=>Au(t,ND),Oee=t=>Au(t,AD),Lee=t=>Au(t,TD),lg=t=>Au(t,MD,!0),Dee=t=>Au(t,RD,!0),rc=(t,e,n)=>{const r=_D.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Au=(t,e,n=!1)=>{const r=SD.exec(t);return r?r[1]?e(r[1]):n:!1},ND=t=>t==="position"||t==="percentage",TD=t=>t==="image"||t==="url",AD=t=>t==="length"||t==="size"||t==="bg-size",ID=t=>t==="length",Fee=t=>t==="number",jD=t=>t==="family-name",RD=t=>t==="number"||t==="weight",MD=t=>t==="shadow",$ee=()=>{const t=or("color"),e=or("font"),n=or("text"),r=or("font-weight"),s=or("tracking"),i=or("leading"),o=or("breakpoint"),a=or("container"),l=or("spacing"),c=or("radius"),u=or("shadow"),f=or("inset-shadow"),h=or("text-shadow"),p=or("drop-shadow"),m=or("blur"),g=or("perspective"),y=or("aspect"),v=or("ease"),b=or("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...k(),et,Xe],_=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],E=()=>[et,Xe,l],N=()=>[Ku,"full","auto",...E()],T=()=>[Qa,"none","subgrid",et,Xe],O=()=>["auto",{span:["full",Qa,et,Xe]},Qa,et,Xe],L=()=>[Qa,"auto",et,Xe],I=()=>["auto","min","max","fr",et,Xe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...E()],D=()=>[Ku,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],B=()=>[t,et,Xe],F=()=>[...k(),$T,FT,{position:[et,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Oee,Iee,{size:[et,Xe]}],J=()=>[z1,Kf,pc],P=()=>["","none","full",c,et,Xe],ie=()=>["",Tt,Kf,pc],ge=()=>["solid","dashed","dotted","double"],ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Tt,z1,$T,FT],H=()=>["","none",m,et,Xe],ne=()=>["none",Tt,et,Xe],de=()=>["none",Tt,et,Xe],xe=()=>[Tt,et,Xe],Oe=()=>[Ku,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jo],breakpoint:[Jo],color:[ED],container:[Jo],"drop-shadow":[Jo],ease:["in","out","in-out"],font:[Aee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jo],shadow:[Jo],spacing:["px",Tt],text:[Jo],"text-shadow":[Jo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ku,Xe,et,y]}],container:["container"],columns:[{columns:[Tt,Xe,et,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Qa,"auto",et,Xe]}],basis:[{basis:[Ku,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Tt,Ku,"auto","initial","none",Xe]}],grow:[{grow:["",Tt,et,Xe]}],shrink:[{shrink:["",Tt,et,Xe]}],order:[{order:[Qa,"first","last","none",et,Xe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,Kf,pc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Dee,jee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",z1,Xe]}],"font-family":[{font:[Pee,Ree,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,et,Xe]}],"line-clamp":[{"line-clamp":[Tt,"none",et,DT]}],leading:[{leading:[i,...E()]}],"list-image":[{"list-image":["none",et,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Tt,"from-font","auto",et,pc]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Tt,"auto",et,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qa,et,Xe],radial:["",et,Xe],conic:[Qa,et,Xe]},Lee,Mee]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Tt,et,Xe]}],"outline-w":[{outline:["",Tt,Kf,pc]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",u,lg,ag]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,lg,ag]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Tt,pc]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,lg,ag]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Tt,et,Xe]}],"mix-blend":[{"mix-blend":[...ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[et,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Xe]}],filter:[{filter:["","none",et,Xe]}],blur:[{blur:H()}],brightness:[{brightness:[Tt,et,Xe]}],contrast:[{contrast:[Tt,et,Xe]}],"drop-shadow":[{"drop-shadow":["","none",p,lg,ag]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Tt,et,Xe]}],"hue-rotate":[{"hue-rotate":[Tt,et,Xe]}],invert:[{invert:["",Tt,et,Xe]}],saturate:[{saturate:[Tt,et,Xe]}],sepia:[{sepia:["",Tt,et,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Xe]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Tt,et,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Tt,et,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Tt,et,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tt,et,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Tt,et,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Tt,et,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Tt,et,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Tt,et,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Tt,"initial",et,Xe]}],ease:[{ease:["linear","initial",v,et,Xe]}],delay:[{delay:[Tt,et,Xe]}],animate:[{animate:["none",b,et,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,et,Xe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[et,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,Xe]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Tt,Kf,pc,DT]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Bee=yee($ee),Vee=["active","paused","archived"],zee=["local_trusted","authenticated"],Hee=["private","public"],Uee=["dx","gtm"],Wee=["auto","explicit"],Kee=["active","paused","idle","running","error","pending_approval","terminated"],hm=["process","http","claude_local","codex_local","opencode_local","pi_local","cursor","openclaw_gateway","hermes_local"],qee=["ceo","cto","cmo","cfo","engineer","designer","pm","qa","devops","researcher","general"],Gee={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",engineer:"Engineer",designer:"Designer",pm:"PM",qa:"QA",devops:"DevOps",researcher:"Researcher",general:"General"},xS=["bot","cpu","brain","zap","rocket","code","terminal","shield","eye","search","wrench","hammer","lightbulb","sparkles","star","heart","flame","bug","cog","database","globe","lock","mail","message-square","file-code","git-branch","package","puzzle","target","wand","atom","circuit-board","radar","swords","telescope","microscope","crown","gem","hexagon","pentagon","fingerprint"],Jee=["active","paused","done","cancelled"],PD=["backlog","todo","in_progress","in_review","done","blocked","cancelled"],Zee=["critical","high","medium","low"],Qee=["company","team","agent","task"],Yee=["planned","active","achieved","cancelled"],Xee=["backlog","planned","in_progress","completed","cancelled"],GRe=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"],ete=["hire_agent","approve_ceo_strategy","budget_override_required"],OD=["local_encrypted","aws_secrets_manager","gcp_secret_manager","vault"],tte=["local_disk","s3"],nte=["metered_api","subscription_included","subscription_overage","credits","fixed","unknown"],rte=["inference_charge","platform_fee","credit_purchase","credit_refund","credit_expiry","byok_fee","gateway_overhead","log_storage_charge","logpush_charge","provisioned_capacity_charge","training_charge","custom_model_import_charge","custom_model_storage_charge","manual_adjustment"],ste=["debit","credit"],ite=["input_token","output_token","cached_input_token","request","credit_usd","credit_unit","model_unit_minute","model_unit_hour","gb_month","train_token","unknown"],ote=["company","agent","project"],ate=["billed_cents"],lte=["calendar_month_utc","lifetime"],cte=["keep_paused","raise_budget_and_resume"],ute=["human","agent","both"],LD=["human","agent"],dte=["pending_approval","approved","rejected"],fte=["agents:create","users:invite","users:manage_permissions","tasks:assign","tasks:assign_scope","joins:approve"],hte=["installed","ready","disabled","error","upgrade_pending","uninstalled"],pte=["connector","workspace","automation","ui"],mte=["companies.read","projects.read","project.workspaces.read","issues.read","issue.comments.read","issue.documents.read","agents.read","goals.read","goals.create","goals.update","activity.read","costs.read","issues.create","issues.update","issue.comments.create","issue.documents.write","agents.pause","agents.resume","agents.invoke","agent.sessions.create","agent.sessions.list","agent.sessions.send","agent.sessions.close","activity.log.write","metrics.write","plugin.state.read","plugin.state.write","events.subscribe","events.emit","jobs.schedule","webhooks.receive","http.outbound","secrets.read-ref","agent.tools.register","instance.settings.register","ui.sidebar.register","ui.page.register","ui.detailTab.register","ui.dashboardWidget.register","ui.commentAnnotation.register","ui.action.register"],gte=["page","detailTab","taskDetailView","dashboardWidget","sidebar","sidebarPanel","projectSidebarItem","globalToolbarButton","toolbarButton","contextMenuItem","commentAnnotation","commentContextMenuItem","settingsPage"],xte=["dashboard","onboarding","companies","company","settings","plugins","org","agents","projects","tickets","issues","goals","approvals","costs","activity","inbox","design-guide","tests"],yte=["page","detailTab","taskDetailView","dashboardWidget","sidebar","sidebarPanel","projectSidebarItem","globalToolbarButton","toolbarButton","contextMenuItem","commentAnnotation","commentContextMenuItem","settingsPage"],bte=["navigate","openModal","openDrawer","openPopover","performAction","deepLink"],DD=["inline","compact","default","wide","full"],vte=["hostInline","hostOverlay","hostRoute","external","iframe"],FD=["project","issue","agent","goal","run","comment"],yS=["instance","company","project","project_workspace","agent","issue","goal","run"];var Ut;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ut||(Ut={}));var BT;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(BT||(BT={}));const Je=Ut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ol=t=>{switch(typeof t){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return Number.isNaN(t)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(t)?Je.array:t===null?Je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Je.promise:typeof Map<"u"&&t instanceof Map?Je.map:typeof Set<"u"&&t instanceof Set?Je.set:typeof Date<"u"&&t instanceof Date?Je.date:Je.object;default:return Je.unknown}},ve=Ut.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 Ia extends Error{get errors(){return this.issues}constructor(e){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=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Ia))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ut.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ia.create=t=>new Ia(t);const kk=(t,e)=>{let n;switch(t.code){case ve.invalid_type:t.received===Je.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ut.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ut.joinValues(t.keys,", ")}`;break;case ve.invalid_union:n="Invalid input";break;case ve.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ut.joinValues(t.options)}`;break;case ve.invalid_enum_value:n=`Invalid enum value. Expected ${Ut.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:n="Invalid function arguments";break;case ve.invalid_return_type:n="Invalid function return type";break;case ve.invalid_date:n="Invalid date";break;case ve.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ut.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ve.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ve.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ve.custom:n="Invalid input";break;case ve.invalid_intersection_types:n="Intersection results could not be merged";break;case ve.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ut.assertNever(t)}return{message:n}};let wte=kk;function kte(){return wte}const Cte=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ze(t,e){const n=kte(),r=Cte({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===kk?void 0:kk].filter(s=>!!s)});t.common.issues.push(r)}class is{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return gt;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return is.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return gt;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const gt=Object.freeze({status:"aborted"}),yh=t=>({status:"dirty",value:t}),gi=t=>({status:"valid",value:t}),VT=t=>t.status==="aborted",zT=t=>t.status==="dirty",Qd=t=>t.status==="valid",o0=t=>typeof Promise<"u"&&t instanceof Promise;var rt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(rt||(rt={}));class Oo{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 HT=(t,e)=>{if(Qd(e))return{success:!0,data:e.value};if(!t.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 Ia(t.common.issues);return this._error=n,this._error}}};function _t(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Lt{get description(){return this._def.description}_getType(e){return ol(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new is,ctx:{common:e.parent.common,data:e.data,parsedType:ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(o0(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,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:e,parsedType:ol(e)},s=this._parseSync({data:e,path:r.path,parent:r});return HT(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ol(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Qd(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Qd(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,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:e,parsedType:ol(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(o0(s)?s:Promise.resolve(s));return HT(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ve.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Dl({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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 Ca.create(this,this._def)}nullable(){return ru.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Io.create(this)}promise(){return f0.create(this,this._def)}or(e){return l0.create([this,e],this._def)}and(e){return c0.create(this,e,this._def)}transform(e){return new Dl({..._t(this._def),schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new h0({..._t(this._def),innerType:this,defaultValue:n,typeName:xt.ZodDefault})}brand(){return new zD({typeName:xt.ZodBranded,type:this,..._t(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new p0({..._t(this._def),innerType:this,catchValue:n,typeName:xt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return vS.create(this,e)}readonly(){return m0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _te=/^c[^\s-]{8,}$/i,Ste=/^[0-9a-z]+$/,Ete=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nte=/^[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,Tte=/^[a-z0-9_-]{21}$/i,Ate=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ite=/^[-+]?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)?)??$/,jte=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rte="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let H1;const Mte=/^(?:(?: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])$/,Pte=/^(?:(?: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])$/,Ote=/^(([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]))$/,Lte=/^(([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])$/,Dte=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fte=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$D="((\\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])))",$te=new RegExp(`^${$D}$`);function BD(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Bte(t){return new RegExp(`^${BD(t)}$`)}function Vte(t){let e=`${$D}T${BD(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function zte(t,e){return!!((e==="v4"||!e)&&Mte.test(t)||(e==="v6"||!e)&&Ote.test(t))}function Hte(t,e){if(!Ate.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ute(t,e){return!!((e==="v4"||!e)&&Pte.test(t)||(e==="v6"||!e)&&Lte.test(t))}class ma extends Lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Je.string){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.string,received:i.parsedType}),gt}const r=new is;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ze(s,{code:ve.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ze(s,{code:ve.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")jte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"email",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")H1||(H1=new RegExp(Rte,"u")),H1.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"emoji",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Nte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"uuid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Tte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"nanoid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")_te.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cuid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Ste.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cuid2",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Ete.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"ulid",code:ve.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ze(s,{validation:"url",code:ve.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"regex",code:ve.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Vte(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?$te.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Bte(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Ite.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"duration",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?zte(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"ip",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Hte(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"jwt",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ute(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"cidr",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Dte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"base64",code:ve.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Fte.test(e.data)||(s=this._getOrReturnCtx(e,s),ze(s,{validation:"base64url",code:ve.invalid_string,message:i.message}),r.dirty()):Ut.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ve.invalid_string,...rt.errToObj(r)})}_addCheck(e){return new ma({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...rt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...rt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...rt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...rt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...rt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...rt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...rt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...rt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...rt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...rt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...rt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...rt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...rt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...rt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...rt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...rt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...rt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...rt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...rt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...rt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...rt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...rt.errToObj(n)})}nonempty(e){return this.min(1,rt.errToObj(e))}trim(){return new ma({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ma({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ma({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ma.create=t=>new ma({checks:[],typeName:xt.ZodString,coerce:(t==null?void 0:t.coerce)??!1,..._t(t)});function Wte(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Yd extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Je.number){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.number,received:i.parsedType}),gt}let r;const s=new is;for(const i of this._def.checks)i.kind==="int"?Ut.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Wte(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_finite,message:i.message}),s.dirty()):Ut.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,rt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,rt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,rt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,rt.toString(n))}setLimit(e,n,r,s){return new Yd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:rt.toString(s)}]})}_addCheck(e){return new Yd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:rt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:rt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ut.isInteger(e.value))}get isFinite(){let e=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"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Yd.create=t=>new Yd({checks:[],typeName:xt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,..._t(t)});class tp extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Je.bigint)return this._getInvalidInput(e);let r;const s=new is;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:ve.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ut.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ze(n,{code:ve.invalid_type,expected:Je.bigint,received:n.parsedType}),gt}gte(e,n){return this.setLimit("min",e,!0,rt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,rt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,rt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,rt.toString(n))}setLimit(e,n,r,s){return new tp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:rt.toString(s)}]})}_addCheck(e){return new tp({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}tp.create=t=>new tp({checks:[],typeName:xt.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,..._t(t)});class Ck extends Lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Je.boolean){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.boolean,received:r.parsedType}),gt}return gi(e.data)}}Ck.create=t=>new Ck({typeName:xt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,..._t(t)});class a0 extends Lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Je.date){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_type,expected:Je.date,received:i.parsedType}),gt}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ze(i,{code:ve.invalid_date}),gt}const r=new is;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ze(s,{code:ve.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ut.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a0({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:rt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:rt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}a0.create=t=>new a0({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:xt.ZodDate,..._t(t)});class UT extends Lt{_parse(e){if(this._getType(e)!==Je.symbol){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.symbol,received:r.parsedType}),gt}return gi(e.data)}}UT.create=t=>new UT({typeName:xt.ZodSymbol,..._t(t)});class _k extends Lt{_parse(e){if(this._getType(e)!==Je.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.undefined,received:r.parsedType}),gt}return gi(e.data)}}_k.create=t=>new _k({typeName:xt.ZodUndefined,..._t(t)});class Sk extends Lt{_parse(e){if(this._getType(e)!==Je.null){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.null,received:r.parsedType}),gt}return gi(e.data)}}Sk.create=t=>new Sk({typeName:xt.ZodNull,..._t(t)});class WT extends Lt{constructor(){super(...arguments),this._any=!0}_parse(e){return gi(e.data)}}WT.create=t=>new WT({typeName:xt.ZodAny,..._t(t)});class Ek extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gi(e.data)}}Ek.create=t=>new Ek({typeName:xt.ZodUnknown,..._t(t)});class Ll extends Lt{_parse(e){const n=this._getOrReturnCtx(e);return ze(n,{code:ve.invalid_type,expected:Je.never,received:n.parsedType}),gt}}Ll.create=t=>new Ll({typeName:xt.ZodNever,..._t(t)});class KT extends Lt{_parse(e){if(this._getType(e)!==Je.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.void,received:r.parsedType}),gt}return gi(e.data)}}KT.create=t=>new KT({typeName:xt.ZodVoid,..._t(t)});class Io extends Lt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Je.array)return ze(n,{code:ve.invalid_type,expected:Je.array,received:n.parsedType}),gt;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ze(n,{code:o?ve.too_big:ve.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ze(n,{code:ve.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ze(n,{code:ve.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Oo(n,o,n.path,a)))).then(o=>is.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Oo(n,o,n.path,a)));return is.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Io({...this._def,minLength:{value:e,message:rt.toString(n)}})}max(e,n){return new Io({...this._def,maxLength:{value:e,message:rt.toString(n)}})}length(e,n){return new Io({...this._def,exactLength:{value:e,message:rt.toString(n)}})}nonempty(e){return this.min(1,e)}}Io.create=(t,e)=>new Io({type:t,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,..._t(e)});function nd(t){if(t instanceof Jn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ca.create(nd(r))}return new Jn({...t._def,shape:()=>e})}else return t instanceof Io?new Io({...t._def,type:nd(t.element)}):t instanceof Ca?Ca.create(nd(t.unwrap())):t instanceof ru?ru.create(nd(t.unwrap())):t instanceof tu?tu.create(t.items.map(e=>nd(e))):t}class Jn extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Ut.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Je.object){const c=this._getOrReturnCtx(e);return ze(c,{code:ve.invalid_type,expected:Je.object,received:c.parsedType}),gt}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ll&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Oo(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ll){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(ze(s,{code:ve.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Oo(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>is.mergeObjectSync(r,c)):is.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return rt.errToObj,new Jn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:rt.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Jn({...this._def,unknownKeys:"strip"})}passthrough(){return new Jn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Jn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Jn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Jn({...this._def,catchall:e})}pick(e){const n={};for(const r of Ut.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Jn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Ut.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Jn({...this._def,shape:()=>n})}deepPartial(){return nd(this)}partial(e){const n={};for(const r of Ut.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Jn({...this._def,shape:()=>n})}required(e){const n={};for(const r of Ut.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ca;)i=i._def.innerType;n[r]=i}return new Jn({...this._def,shape:()=>n})}keyof(){return VD(Ut.objectKeys(this.shape))}}Jn.create=(t,e)=>new Jn({shape:()=>t,unknownKeys:"strip",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});Jn.strictCreate=(t,e)=>new Jn({shape:()=>t,unknownKeys:"strict",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});Jn.lazycreate=(t,e)=>new Jn({shape:t,unknownKeys:"strip",catchall:Ll.create(),typeName:xt.ZodObject,..._t(e)});class l0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ia(a.ctx.common.issues));return ze(n,{code:ve.invalid_union,unionErrors:o}),gt}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ia(l));return ze(n,{code:ve.invalid_union,unionErrors:a}),gt}}get options(){return this._def.options}}l0.create=(t,e)=>new l0({options:t,typeName:xt.ZodUnion,..._t(e)});const ra=t=>t instanceof Tk?ra(t.schema):t instanceof Dl?ra(t.innerType()):t instanceof d0?[t.value]:t instanceof nu?t.options:t instanceof Ak?Ut.objectValues(t.enum):t instanceof h0?ra(t._def.innerType):t instanceof _k?[void 0]:t instanceof Sk?[null]:t instanceof Ca?[void 0,...ra(t.unwrap())]:t instanceof ru?[null,...ra(t.unwrap())]:t instanceof zD||t instanceof m0?ra(t.unwrap()):t instanceof p0?ra(t._def.innerType):[];class bS extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Je.object)return ze(n,{code:ve.invalid_type,expected:Je.object,received:n.parsedType}),gt;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),gt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=ra(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new bS({typeName:xt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,..._t(r)})}}function Nk(t,e){const n=ol(t),r=ol(e);if(t===e)return{valid:!0,data:t};if(n===Je.object&&r===Je.object){const s=Ut.objectKeys(e),i=Ut.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Nk(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Je.array&&r===Je.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Nk(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Je.date&&r===Je.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class c0 extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(VT(i)||VT(o))return gt;const a=Nk(i.value,o.value);return a.valid?((zT(i)||zT(o))&&n.dirty(),{status:n.value,value:a.data}):(ze(r,{code:ve.invalid_intersection_types}),gt)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}c0.create=(t,e,n)=>new c0({left:t,right:e,typeName:xt.ZodIntersection,..._t(n)});class tu extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.array)return ze(r,{code:ve.invalid_type,expected:Je.array,received:r.parsedType}),gt;if(r.data.length<this._def.items.length)return ze(r,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),gt;!this._def.rest&&r.data.length>this._def.items.length&&(ze(r,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Oo(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>is.mergeArray(n,o)):is.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new tu({...this._def,rest:e})}}tu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tu({items:t,typeName:xt.ZodTuple,rest:null,..._t(e)})};class u0 extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.object)return ze(r,{code:ve.invalid_type,expected:Je.object,received:r.parsedType}),gt;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Oo(r,a,r.path,a)),value:o._parse(new Oo(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?is.mergeObjectAsync(n,s):is.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Lt?new u0({keyType:e,valueType:n,typeName:xt.ZodRecord,..._t(r)}):new u0({keyType:ma.create(),valueType:e,typeName:xt.ZodRecord,..._t(n)})}}class qT extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.map)return ze(r,{code:ve.invalid_type,expected:Je.map,received:r.parsedType}),gt;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Oo(r,a,r.path,[c,"key"])),value:i._parse(new Oo(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return gt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return gt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}qT.create=(t,e,n)=>new qT({valueType:e,keyType:t,typeName:xt.ZodMap,..._t(n)});class np extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Je.set)return ze(r,{code:ve.invalid_type,expected:Je.set,received:r.parsedType}),gt;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ze(r,{code:ve.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ze(r,{code:ve.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return gt;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Oo(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new np({...this._def,minSize:{value:e,message:rt.toString(n)}})}max(e,n){return new np({...this._def,maxSize:{value:e,message:rt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}np.create=(t,e)=>new np({valueType:t,minSize:null,maxSize:null,typeName:xt.ZodSet,..._t(e)});class Tk extends Lt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Tk.create=(t,e)=>new Tk({getter:t,typeName:xt.ZodLazy,..._t(e)});class d0 extends Lt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ze(n,{received:n.data,code:ve.invalid_literal,expected:this._def.value}),gt}return{status:"valid",value:e.data}}get value(){return this._def.value}}d0.create=(t,e)=>new d0({value:t,typeName:xt.ZodLiteral,..._t(e)});function VD(t,e){return new nu({values:t,typeName:xt.ZodEnum,..._t(e)})}class nu extends Lt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{expected:Ut.joinValues(r),received:n.parsedType,code:ve.invalid_type}),gt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{received:n.data,code:ve.invalid_enum_value,options:r}),gt}return gi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return nu.create(e,{...this._def,...n})}exclude(e,n=this._def){return nu.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}nu.create=VD;class Ak extends Lt{_parse(e){const n=Ut.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Je.string&&r.parsedType!==Je.number){const s=Ut.objectValues(n);return ze(r,{expected:Ut.joinValues(s),received:r.parsedType,code:ve.invalid_type}),gt}if(this._cache||(this._cache=new Set(Ut.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Ut.objectValues(n);return ze(r,{received:r.data,code:ve.invalid_enum_value,options:s}),gt}return gi(e.data)}get enum(){return this._def.values}}Ak.create=(t,e)=>new Ak({values:t,typeName:xt.ZodNativeEnum,..._t(e)});class f0 extends Lt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Je.promise&&n.common.async===!1)return ze(n,{code:ve.invalid_type,expected:Je.promise,received:n.parsedType}),gt;const r=n.parsedType===Je.promise?n.data:Promise.resolve(n.data);return gi(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}f0.create=(t,e)=>new f0({type:t,typeName:xt.ZodPromise,..._t(e)});class Dl extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ze(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return gt;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?gt:l.status==="dirty"||n.value==="dirty"?yh(l.value):l});{if(n.value==="aborted")return gt;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?gt:a.status==="dirty"||n.value==="dirty"?yh(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?gt:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?gt:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Qd(o))return gt;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Qd(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):gt);Ut.assertNever(s)}}Dl.create=(t,e,n)=>new Dl({schema:t,typeName:xt.ZodEffects,effect:e,..._t(n)});Dl.createWithPreprocess=(t,e,n)=>new Dl({schema:e,effect:{type:"preprocess",transform:t},typeName:xt.ZodEffects,..._t(n)});class Ca extends Lt{_parse(e){return this._getType(e)===Je.undefined?gi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ca.create=(t,e)=>new Ca({innerType:t,typeName:xt.ZodOptional,..._t(e)});class ru extends Lt{_parse(e){return this._getType(e)===Je.null?gi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ru.create=(t,e)=>new ru({innerType:t,typeName:xt.ZodNullable,..._t(e)});class h0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Je.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}h0.create=(t,e)=>new h0({innerType:t,typeName:xt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._t(e)});class p0 extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return o0(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ia(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ia(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}p0.create=(t,e)=>new p0({innerType:t,typeName:xt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._t(e)});class GT extends Lt{_parse(e){if(this._getType(e)!==Je.nan){const r=this._getOrReturnCtx(e);return ze(r,{code:ve.invalid_type,expected:Je.nan,received:r.parsedType}),gt}return{status:"valid",value:e.data}}}GT.create=t=>new GT({typeName:xt.ZodNaN,..._t(t)});class zD extends Lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class vS extends Lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?gt:i.status==="dirty"?(n.dirty(),yh(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?gt:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new vS({in:e,out:n,typeName:xt.ZodPipeline})}}class m0 extends Lt{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Qd(s)&&(s.value=Object.freeze(s.value)),s);return o0(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}m0.create=(t,e)=>new m0({innerType:t,typeName:xt.ZodReadonly,..._t(e)});var xt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(xt||(xt={}));const K=ma.create,jn=Yd.create,on=Ck.create,Gt=Ek.create,Kte=Ll.create,An=Io.create,Ne=Jn.create,wS=l0.create,HD=bS.create;c0.create;tu.create;const Wt=u0.create,Li=d0.create,Ge=nu.create;f0.create;Ca.create;ru.create;const qte=Dl.createWithPreprocess,Gte=Ne({enableIsolatedWorkspaces:on().default(!1)}).strict();Gte.partial();Ne({scopeType:Ge(ote),scopeId:K().uuid(),metric:Ge(ate).optional().default("billed_cents"),windowKind:Ge(lte).optional().default("calendar_month_utc"),amount:jn().int().nonnegative(),warnPercent:jn().int().min(1).max(99).optional().default(80),hardStopEnabled:on().optional().default(!0),notifyEnabled:on().optional().default(!0),isActive:on().optional().default(!0)});Ne({action:Ge(cte),amount:jn().int().nonnegative().optional(),decisionNote:K().optional().nullable()}).superRefine((t,e)=>{t.action==="raise_budget_and_resume"&&typeof t.amount!="number"&&e.addIssue({code:ve.custom,message:"amount is required when raising a budget",path:["amount"]})});const UD=K().uuid().nullable().optional(),Jte=Ne({name:K().min(1),description:K().optional().nullable(),budgetMonthlyCents:jn().int().nonnegative().optional().default(0)});Jte.partial().extend({status:Ge(Vee).optional(),spentMonthlyCents:jn().int().nonnegative().optional(),requireBoardApprovalForNewAgents:on().optional(),brandColor:K().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),logoAssetId:UD});Ne({name:K().min(1).optional(),description:K().nullable().optional(),brandColor:K().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),logoAssetId:UD});const WD=Ne({company:on().optional(),agents:on().optional()}).partial(),Zte=Ne({key:K().min(1),description:K().nullable(),agentSlug:K().min(1).nullable(),providerHint:K().nullable()}),Qte=Ne({path:K().min(1),name:K().min(1),description:K().nullable(),brandColor:K().nullable(),requireBoardApprovalForNewAgents:on()}),Yte=Ne({slug:K().min(1),name:K().min(1),path:K().min(1),role:K().min(1),title:K().nullable(),icon:K().nullable(),capabilities:K().nullable(),reportsToSlug:K().min(1).nullable(),adapterType:K().min(1),adapterConfig:Wt(Gt()),runtimeConfig:Wt(Gt()),permissions:Wt(Gt()),budgetMonthlyCents:jn().int().nonnegative(),metadata:Wt(Gt()).nullable()}),Xte=Ne({schemaVersion:jn().int().positive(),generatedAt:K().datetime(),source:Ne({companyId:K().uuid(),companyName:K().min(1)}).nullable(),includes:Ne({company:on(),agents:on()}),company:Qte.nullable(),agents:An(Yte),requiredSecrets:An(Zte).default([])}),ene=HD("type",[Ne({type:Li("inline"),manifest:Xte,files:Wt(K())}),Ne({type:Li("url"),url:K().url()}),Ne({type:Li("github"),url:K().url()})]),tne=HD("mode",[Ne({mode:Li("new_company"),newCompanyName:K().min(1).optional().nullable()}),Ne({mode:Li("existing_company"),companyId:K().uuid()})]),nne=wS([Li("all"),An(K().min(1))]),rne=Ge(["rename","skip","replace"]);Ne({include:WD.optional()});Ne({source:ene,include:WD.optional(),target:tne,agents:nne.optional(),collisionStrategy:rne.optional()});const sne=Ne({type:Li("plain"),value:K()}),ine=Ne({type:Li("secret_ref"),secretId:K().uuid(),version:wS([Li("latest"),jn().int().positive()]).optional()}),one=wS([K(),sne,ine]),ane=Wt(one);Ne({name:K().min(1),provider:Ge(OD).optional(),value:K().min(1),description:K().optional().nullable(),externalRef:K().optional().nullable()});Ne({value:K().min(1),externalRef:K().optional().nullable()});Ne({name:K().min(1).optional(),description:K().optional().nullable(),externalRef:K().optional().nullable()});const lne=Ne({canCreateAgents:on().optional().default(!1)}),KD=Wt(Gt()).superRefine((t,e)=>{const n=t.env;if(n===void 0)return;ane.safeParse(n).success||e.addIssue({code:ve.custom,message:"adapterConfig.env must be a map of valid env bindings",path:["env"]})}),qD=Ne({name:K().min(1),role:Ge(qee).optional().default("general"),title:K().optional().nullable(),icon:Ge(xS).optional().nullable(),reportsTo:K().uuid().optional().nullable(),capabilities:K().optional().nullable(),adapterType:Ge(hm).optional().default("process"),adapterConfig:KD.optional().default({}),runtimeConfig:Wt(Gt()).optional().default({}),budgetMonthlyCents:jn().int().nonnegative().optional().default(0),permissions:lne.optional(),metadata:Wt(Gt()).optional().nullable()});qD.extend({sourceIssueId:K().uuid().optional().nullable(),sourceIssueIds:An(K().uuid()).optional()});qD.omit({permissions:!0}).partial().extend({permissions:Kte().optional(),status:Ge(Kee).optional(),spentMonthlyCents:jn().int().nonnegative().optional()});Ne({path:K().trim().min(1).nullable(),adapterConfigKey:K().trim().min(1).optional()});Ne({name:K().min(1).default("default")});Ne({source:Ge(["timer","assignment","on_demand","automation"]).optional().default("on_demand"),triggerDetail:Ge(["manual","ping","callback","system"]).optional(),reason:K().optional().nullable(),payload:Wt(Gt()).optional().nullable(),idempotencyKey:K().optional().nullable(),forceFreshSession:qte(t=>t===null?void 0:t,on().optional().default(!1))});Ne({taskKey:K().min(1).optional().nullable()});Ne({adapterConfig:KD.optional().default({})});Ne({canCreateAgents:on(),canAssignTasks:on()});const cne=Ne({type:Ge(["project_primary","git_worktree","adapter_managed","cloud_sandbox"]).optional(),baseRef:K().optional().nullable(),branchTemplate:K().optional().nullable(),worktreeParentDir:K().optional().nullable(),provisionCommand:K().optional().nullable(),teardownCommand:K().optional().nullable()}).strict(),une=Ne({enabled:on(),defaultMode:Ge(["shared_workspace","isolated_workspace","operator_branch","adapter_default"]).optional(),allowIssueOverride:on().optional(),defaultProjectWorkspaceId:K().uuid().optional().nullable(),workspaceStrategy:cne.optional().nullable(),workspaceRuntime:Wt(Gt()).optional().nullable(),branchPolicy:Wt(Gt()).optional().nullable(),pullRequestPolicy:Wt(Gt()).optional().nullable(),runtimePolicy:Wt(Gt()).optional().nullable(),cleanupPolicy:Wt(Gt()).optional().nullable()}).strict(),dne=Ge(["local_path","git_repo","remote_managed","non_git_path"]),fne=Ge(["default","advanced"]),GD={name:K().min(1).optional(),sourceType:dne.optional(),cwd:K().min(1).optional().nullable(),repoUrl:K().url().optional().nullable(),repoRef:K().optional().nullable(),defaultRef:K().optional().nullable(),visibility:fne.optional(),setupCommand:K().optional().nullable(),cleanupCommand:K().optional().nullable(),remoteProvider:K().optional().nullable(),remoteWorkspaceRef:K().optional().nullable(),sharedWorkspaceKey:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable()};function hne(t,e){const n=t.sourceType??"local_path",r=typeof t.cwd=="string"&&t.cwd.trim().length>0,s=typeof t.repoUrl=="string"&&t.repoUrl.trim().length>0,i=typeof t.remoteWorkspaceRef=="string"&&t.remoteWorkspaceRef.trim().length>0;if(n==="remote_managed"){!i&&!s&&e.addIssue({code:ve.custom,message:"Remote-managed workspace requires remoteWorkspaceRef or repoUrl.",path:["remoteWorkspaceRef"]});return}!r&&!s&&e.addIssue({code:ve.custom,message:"Workspace requires at least one of cwd or repoUrl.",path:["cwd"]})}const pne=Ne({...GD,isPrimary:on().optional().default(!1)}).superRefine(hne);Ne({...GD,isPrimary:on().optional()}).partial();const JD={goalId:K().uuid().optional().nullable(),goalIds:An(K().uuid()).optional(),name:K().min(1),description:K().optional().nullable(),status:Ge(Xee).optional().default("backlog"),leadAgentId:K().uuid().optional().nullable(),targetDate:K().optional().nullable(),color:K().optional().nullable(),executionWorkspacePolicy:une.optional().nullable(),archivedAt:K().datetime().optional().nullable()};Ne({...JD,workspace:pne.optional()});Ne(JD).partial();const mne=Ne({type:Ge(["project_primary","git_worktree","adapter_managed","cloud_sandbox"]).optional(),baseRef:K().optional().nullable(),branchTemplate:K().optional().nullable(),worktreeParentDir:K().optional().nullable(),provisionCommand:K().optional().nullable(),teardownCommand:K().optional().nullable()}).strict(),gne=Ne({mode:Ge(["inherit","shared_workspace","isolated_workspace","operator_branch","reuse_existing","agent_default"]).optional(),workspaceStrategy:mne.optional().nullable(),workspaceRuntime:Wt(Gt()).optional().nullable()}).strict(),xne=Ne({adapterConfig:Wt(Gt()).optional(),useProjectWorkspace:on().optional()}).strict(),ZD=Ne({ticketId:K().uuid().optional().nullable(),ticketStage:K().optional().nullable(),projectId:K().uuid().optional().nullable(),projectWorkspaceId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),parentId:K().uuid().optional().nullable(),title:K().min(1),description:K().optional().nullable(),status:Ge(PD).optional().default("backlog"),priority:Ge(Zee).optional().default("medium"),assigneeAgentId:K().uuid().optional().nullable(),assigneeUserId:K().optional().nullable(),requestDepth:jn().int().nonnegative().optional().default(0),billingCode:K().optional().nullable(),assigneeAdapterOverrides:xne.optional().nullable(),executionWorkspaceId:K().uuid().optional().nullable(),executionWorkspacePreference:Ge(["inherit","shared_workspace","isolated_workspace","operator_branch","reuse_existing","agent_default"]).optional().nullable(),executionWorkspaceSettings:gne.optional().nullable(),labelIds:An(K().uuid()).optional()});Ne({issues:An(ZD).min(1).max(50)});Ne({name:K().trim().min(1).max(48),color:K().regex(/^#(?:[0-9a-fA-F]{6})$/,"Color must be a 6-digit hex value")});ZD.partial().extend({comment:K().min(1).optional(),hiddenAt:K().datetime().nullable().optional()});Ne({agentId:K().uuid(),expectedStatuses:An(Ge(PD)).nonempty()});Ne({body:K().min(1),reopen:on().optional(),interrupt:on().optional()});Ne({approvalId:K().uuid()});Ne({issueCommentId:K().uuid().optional().nullable()});const yne=["markdown"],bne=Ge(yne);K().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/,"Document key must be lowercase letters, numbers, _ or -");Ne({title:K().trim().max(200).nullable().optional(),format:bne,body:K().max(524288),changeSummary:K().trim().max(500).nullable().optional(),baseRevisionId:K().uuid().nullable().optional()});const vne=Ge(["preview_url","runtime_service","pull_request","branch","commit","artifact","document"]),wne=Ge(["active","ready_for_review","approved","changes_requested","merged","closed","failed","archived","draft"]),kne=Ge(["none","needs_board_review","approved","changes_requested"]),Cne=Ne({projectId:K().uuid().optional().nullable(),executionWorkspaceId:K().uuid().optional().nullable(),runtimeServiceId:K().uuid().optional().nullable(),type:vne,provider:K().min(1),externalId:K().optional().nullable(),title:K().min(1),url:K().url().optional().nullable(),status:wne.default("active"),reviewState:kne.optional().default("none"),isPrimary:on().optional().default(!1),healthStatus:Ge(["unknown","healthy","unhealthy"]).optional().default("unknown"),summary:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable(),createdByRunId:K().uuid().optional().nullable()});Cne.partial();const _ne=Ge(["active","idle","in_review","archived","cleanup_failed"]);Ne({status:_ne.optional(),cleanupEligibleAt:K().datetime().optional().nullable(),cleanupReason:K().optional().nullable(),metadata:Wt(Gt()).optional().nullable()}).strict();Ne({title:K().min(1).max(500),description:K().optional(),stageOrder:An(K().min(1)).optional(),metadata:Wt(Gt()).optional(),instructions:K().optional(),leadAgentId:K().uuid().nullable().optional()});Ne({title:K().min(1).max(500).optional(),description:K().nullable().optional(),status:Ge(Jee).optional(),currentStage:K().min(1).optional(),stageOrder:An(K().min(1)).optional(),metadata:Wt(Gt()).optional(),instructions:K().optional(),leadAgentId:K().uuid().nullable().optional()});Ne({});const Sne=Ne({title:K().min(1),description:K().optional().nullable(),level:Ge(Qee).optional().default("task"),status:Ge(Yee).optional().default("planned"),parentId:K().uuid().optional().nullable(),ownerAgentId:K().uuid().optional().nullable()});Sne.partial();Ne({type:Ge(ete),requestedByAgentId:K().uuid().optional().nullable(),payload:Wt(Gt()),issueIds:An(K().uuid()).optional()});Ne({decisionNote:K().optional().nullable(),decidedByUserId:K().optional().default("board")});Ne({decisionNote:K().optional().nullable(),decidedByUserId:K().optional().default("board")});Ne({payload:Wt(Gt()).optional()});Ne({body:K().min(1)});Ne({agentId:K().uuid(),issueId:K().uuid().optional().nullable(),projectId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),heartbeatRunId:K().uuid().optional().nullable(),billingCode:K().optional().nullable(),provider:K().min(1),biller:K().min(1).optional(),billingType:Ge(nte).optional().default("unknown"),model:K().min(1),inputTokens:jn().int().nonnegative().optional().default(0),cachedInputTokens:jn().int().nonnegative().optional().default(0),outputTokens:jn().int().nonnegative().optional().default(0),costCents:jn().int().nonnegative(),occurredAt:K().datetime()}).transform(t=>({...t,biller:t.biller??t.provider}));Ne({budgetMonthlyCents:jn().int().nonnegative()});Ne({agentId:K().uuid().optional().nullable(),issueId:K().uuid().optional().nullable(),projectId:K().uuid().optional().nullable(),goalId:K().uuid().optional().nullable(),heartbeatRunId:K().uuid().optional().nullable(),costEventId:K().uuid().optional().nullable(),billingCode:K().optional().nullable(),description:K().max(500).optional().nullable(),eventKind:Ge(rte),direction:Ge(ste).optional().default("debit"),biller:K().min(1),provider:K().min(1).optional().nullable(),executionAdapterType:Ge(hm).optional().nullable(),pricingTier:K().min(1).optional().nullable(),region:K().min(1).optional().nullable(),model:K().min(1).optional().nullable(),quantity:jn().int().nonnegative().optional().nullable(),unit:Ge(ite).optional().nullable(),amountCents:jn().int().nonnegative(),currency:K().length(3).optional().default("USD"),estimated:on().optional().default(!1),externalInvoiceId:K().optional().nullable(),metadataJson:Wt(K(),Gt()).optional().nullable(),occurredAt:K().datetime()}).transform(t=>({...t,currency:t.currency.toUpperCase()}));Ne({namespace:K().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()});Ne({allowedJoinTypes:Ge(ute).default("both"),defaultsPayload:Wt(K(),Gt()).optional().nullable(),agentMessage:K().max(4e3).optional().nullable()});Ne({agentMessage:K().max(4e3).optional().nullable()});Ne({requestType:Ge(LD),agentName:K().min(1).max(120).optional(),adapterType:Ge(hm).optional(),capabilities:K().max(4e3).optional().nullable(),agentDefaultsPayload:Wt(K(),Gt()).optional().nullable(),responsesWebhookUrl:K().max(4e3).optional().nullable(),responsesWebhookMethod:K().max(32).optional().nullable(),responsesWebhookHeaders:Wt(K(),Gt()).optional().nullable(),paperclipApiUrl:K().max(4e3).optional().nullable(),webhookAuthHeader:K().max(4e3).optional().nullable()});Ne({status:Ge(dte).optional(),requestType:Ge(LD).optional()});Ne({claimSecret:K().min(16).max(256)});Ne({grants:An(Ne({permissionKey:Ge(fte),scope:Wt(K(),Gt()).optional().nullable()}))});Ne({companyIds:An(K().uuid()).default([])});const QD=Wt(Gt()).refine(t=>Object.keys(t).length===0?!0:typeof t.type=="string"||t.$ref!==void 0||t.oneOf!==void 0||t.anyOf!==void 0||t.allOf!==void 0,{message:"Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)"}),Ene=/^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;function Nne(t){const e=t.trim();if(!e)return!1;const n=e.split(/\s+/);return n.length!==5?!1:n.every(r=>Ene.test(r))}const Tne=Ne({jobKey:K().min(1),displayName:K().min(1),description:K().optional(),schedule:K().refine(t=>Nne(t),{message:"schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')"}).optional()}),Ane=Ne({endpointKey:K().min(1),displayName:K().min(1),description:K().optional()}),Ine=Ne({name:K().min(1),displayName:K().min(1),description:K().min(1),parametersSchema:QD}),jne=Ne({type:Ge(gte),id:K().min(1),displayName:K().min(1),exportName:K().min(1),entityTypes:An(Ge(FD)).optional(),routePath:K().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"}).optional(),order:jn().int().optional()}).superRefine((t,e)=>{["detailTab","taskDetailView","contextMenuItem","commentAnnotation","commentContextMenuItem","projectSidebarItem"].includes(t.type)&&(!t.entityTypes||t.entityTypes.length===0)&&e.addIssue({code:ve.custom,message:`${t.type} slots require at least one entityType`,path:["entityTypes"]}),t.type==="projectSidebarItem"&&t.entityTypes&&!t.entityTypes.includes("project")&&e.addIssue({code:ve.custom,message:'projectSidebarItem slots require entityTypes to include "project"',path:["entityTypes"]}),t.type==="commentAnnotation"&&t.entityTypes&&!t.entityTypes.includes("comment")&&e.addIssue({code:ve.custom,message:'commentAnnotation slots require entityTypes to include "comment"',path:["entityTypes"]}),t.type==="commentContextMenuItem"&&t.entityTypes&&!t.entityTypes.includes("comment")&&e.addIssue({code:ve.custom,message:'commentContextMenuItem slots require entityTypes to include "comment"',path:["entityTypes"]}),t.routePath&&t.type!=="page"&&e.addIssue({code:ve.custom,message:"routePath is only supported for page slots",path:["routePath"]}),t.routePath&&xte.includes(t.routePath)&&e.addIssue({code:ve.custom,message:`routePath "${t.routePath}" is reserved by the host`,path:["routePath"]})}),Rne=["detailTab","taskDetailView","contextMenuItem","commentAnnotation","commentContextMenuItem","projectSidebarItem"],Mne={hostInline:["inline","compact","default"],hostOverlay:["compact","default","wide","full"],hostRoute:["default","wide","full"],external:[],iframe:["compact","default","wide","full"]},Pne=Ne({type:Ge(bte),target:K().min(1),params:Wt(Gt()).optional()}).superRefine((t,e)=>{t.type==="performAction"&&t.target.includes("/")&&e.addIssue({code:ve.custom,message:"performAction launchers must target an action key, not a route or URL",path:["target"]}),t.type==="navigate"&&/^https?:\/\//.test(t.target)&&e.addIssue({code:ve.custom,message:"navigate launchers must target a host route, not an absolute URL",path:["target"]})}),One=Ne({environment:Ge(vte),bounds:Ge(DD).optional()}).superRefine((t,e)=>{if(!t.bounds)return;Mne[t.environment].includes(t.bounds)||e.addIssue({code:ve.custom,message:`bounds "${t.bounds}" is not supported for render environment "${t.environment}"`,path:["bounds"]})}),JT=Ne({id:K().min(1),displayName:K().min(1),description:K().optional(),placementZone:Ge(yte),exportName:K().min(1).optional(),entityTypes:An(Ge(FD)).optional(),order:jn().int().optional(),action:Pne,render:One.optional()}).superRefine((t,e)=>{var n,r;Rne.some(s=>s===t.placementZone)&&(!t.entityTypes||t.entityTypes.length===0)&&e.addIssue({code:ve.custom,message:`${t.placementZone} launchers require at least one entityType`,path:["entityTypes"]}),t.placementZone==="projectSidebarItem"&&t.entityTypes&&!t.entityTypes.includes("project")&&e.addIssue({code:ve.custom,message:'projectSidebarItem launchers require entityTypes to include "project"',path:["entityTypes"]}),t.action.type==="performAction"&&t.render&&e.addIssue({code:ve.custom,message:"performAction launchers cannot declare render hints",path:["render"]}),["openModal","openDrawer","openPopover"].includes(t.action.type)&&!t.render&&e.addIssue({code:ve.custom,message:`${t.action.type} launchers require render metadata`,path:["render"]}),t.action.type==="openModal"&&((n=t.render)==null?void 0:n.environment)==="hostInline"&&e.addIssue({code:ve.custom,message:"openModal launchers cannot use the hostInline render environment",path:["render","environment"]}),t.action.type==="openDrawer"&&t.render&&!["hostOverlay","iframe"].includes(t.render.environment)&&e.addIssue({code:ve.custom,message:"openDrawer launchers must use hostOverlay or iframe render environments",path:["render","environment"]}),t.action.type==="openPopover"&&((r=t.render)==null?void 0:r.environment)==="hostRoute"&&e.addIssue({code:ve.custom,message:"openPopover launchers cannot use the hostRoute render environment",path:["render","environment"]})});Ne({id:K().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/,"Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"),apiVersion:Li(1),version:K().min(1).regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"),displayName:K().min(1).max(100),description:K().min(1).max(500),author:K().min(1).max(200),categories:An(Ge(pte)).min(1),minimumHostVersion:K().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"minimumHostVersion must follow semver (e.g. 1.0.0)").optional(),minimumPaperclipVersion:K().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,"minimumPaperclipVersion must follow semver (e.g. 1.0.0)").optional(),capabilities:An(Ge(mte)).min(1),entrypoints:Ne({worker:K().min(1),ui:K().min(1).optional()}),instanceConfigSchema:QD.optional(),jobs:An(Tne).optional(),webhooks:An(Ane).optional(),tools:An(Ine).optional(),launchers:An(JT).optional(),ui:Ne({slots:An(jne).min(1).optional(),launchers:An(JT).optional()}).optional()}).superRefine((t,e)=>{var i,o,a,l,c,u;const n=(((o=(i=t.ui)==null?void 0:i.slots)==null?void 0:o.length)??0)>0,r=(((l=(a=t.ui)==null?void 0:a.launchers)==null?void 0:l.length)??0)>0;if((n||r)&&!t.entrypoints.ui&&e.addIssue({code:ve.custom,message:"entrypoints.ui is required when ui.slots or ui.launchers are declared",path:["entrypoints","ui"]}),t.minimumHostVersion&&t.minimumPaperclipVersion&&t.minimumHostVersion!==t.minimumPaperclipVersion&&e.addIssue({code:ve.custom,message:"minimumHostVersion and minimumPaperclipVersion must match when both are declared",path:["minimumHostVersion"]}),t.tools&&t.tools.length>0&&(t.capabilities.includes("agent.tools.register")||e.addIssue({code:ve.custom,message:"Capability 'agent.tools.register' is required when tools are declared",path:["capabilities"]})),t.jobs&&t.jobs.length>0&&(t.capabilities.includes("jobs.schedule")||e.addIssue({code:ve.custom,message:"Capability 'jobs.schedule' is required when jobs are declared",path:["capabilities"]})),t.webhooks&&t.webhooks.length>0&&(t.capabilities.includes("webhooks.receive")||e.addIssue({code:ve.custom,message:"Capability 'webhooks.receive' is required when webhooks are declared",path:["capabilities"]})),t.jobs){const f=t.jobs.map(p=>p.jobKey),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate job keys: ${[...new Set(h)].join(", ")}`,path:["jobs"]})}if(t.webhooks){const f=t.webhooks.map(p=>p.endpointKey),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate webhook endpoint keys: ${[...new Set(h)].join(", ")}`,path:["webhooks"]})}if(t.tools){const f=t.tools.map(p=>p.name),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate tool names: ${[...new Set(h)].join(", ")}`,path:["tools"]})}if(t.ui&&t.ui.slots){const f=t.ui.slots.map(p=>p.id),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate UI slot ids: ${[...new Set(h)].join(", ")}`,path:["ui","slots"]})}const s=[...t.launchers??[],...((c=t.ui)==null?void 0:c.launchers)??[]];if(s.length>0){const f=s.map(p=>p.id),h=f.filter((p,m)=>f.indexOf(p)!==m);h.length>0&&e.addIssue({code:ve.custom,message:`Duplicate launcher ids: ${[...new Set(h)].join(", ")}`,path:(u=t.ui)!=null&&u.launchers?["ui","launchers"]:["launchers"]})}});Ne({packageName:K().min(1),version:K().min(1).optional(),packagePath:K().min(1).optional()});Ne({configJson:Wt(Gt())});Ne({configJson:Wt(Gt())});Ne({status:Ge(hte),lastError:K().nullable().optional()});Ne({removeData:on().optional().default(!1)});Ne({scopeKind:Ge(yS),scopeId:K().min(1).optional(),namespace:K().min(1).optional(),stateKey:K().min(1)});Ne({scopeKind:Ge(yS),scopeId:K().min(1).optional(),namespace:K().min(1).optional(),stateKey:K().min(1),value:Gt()});Ne({scopeKind:Ge(yS).optional(),scopeId:K().min(1).optional(),namespace:K().min(1).optional()});const Lne=/[^a-z0-9]+/g,Dne=/^-+|-+$/g,Fne=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function YD(t){return typeof t!="string"?!1:Fne.test(t.trim())}function g0(t){if(typeof t!="string")return null;const e=t.trim().toLowerCase().replace(Lne,"-").replace(Dne,"");return e.length>0?e:null}function $ne(t,e){return g0(t)??g0(e)??"agent"}const Bne=/[^a-z0-9]+/g,Vne=/^-+|-+$/g;function ZT(t){if(typeof t!="string")return null;const e=t.trim().toLowerCase().replace(Bne,"-").replace(Vne,"");return e.length>0?e:null}function zne(t,e){return ZT(t)??ZT(e)??"project"}const Ik="project://",Hne=/^[0-9a-f]{6}$/i,Une=/^[0-9a-f]{3}$/i,Wne=/^#[0-9a-f]{6}$/i,Kne=/^#[0-9a-f]{3}$/i;function XD(t){if(!t)return null;const e=t.trim();if(!e)return null;if(Wne.test(e))return e.toLowerCase();if(Hne.test(e))return`#${e.toLowerCase()}`;if(Kne.test(e)){const n=e.slice(1).toLowerCase();return`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}if(Une.test(e)){const n=e.toLowerCase();return`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`}return null}function qne(t,e){const n=t.trim(),r=XD(e??null);return r?`${Ik}${n}?c=${encodeURIComponent(r.slice(1))}`:`${Ik}${n}`}function e6(t){if(!t.startsWith(Ik))return null;let e;try{e=new URL(t)}catch{return null}if(e.protocol!=="project:")return null;const n=`${e.hostname}${e.pathname}`.replace(/^\/+/,"").trim();if(!n)return null;const r=XD(e.searchParams.get("c")??e.searchParams.get("color"));return{projectId:n,color:r}}const Gne=Ne({version:Li(1),updatedAt:K(),source:Ge(["onboard","configure","doctor"])}),Jne=Ne({provider:Ge(["claude","openai"]),apiKey:K().optional()}),Zne=Ne({enabled:on().default(!0),intervalMinutes:jn().int().min(1).max(10080).default(60),retentionDays:jn().int().min(1).max(3650).default(30),dir:K().default("~/.paperclip/instances/default/data/backups")}),Qne=Ne({mode:Ge(["embedded-postgres","postgres"]).default("embedded-postgres"),connectionString:K().optional(),embeddedPostgresDataDir:K().default("~/.paperclip/instances/default/db"),embeddedPostgresPort:jn().int().min(1).max(65535).default(54329),backup:Zne.default({enabled:!0,intervalMinutes:60,retentionDays:30,dir:"~/.paperclip/instances/default/data/backups"})}),Yne=Ne({mode:Ge(["file","cloud"]),logDir:K().default("~/.paperclip/instances/default/logs")}),Xne=Ne({deploymentMode:Ge(zee).default("local_trusted"),exposure:Ge(Hee).default("private"),host:K().default("127.0.0.1"),port:jn().int().min(1).max(65535).default(3100),allowedHostnames:An(K().min(1)).default([]),serveUi:on().default(!0)}),ere=Ne({baseUrlMode:Ge(Wee).default("auto"),publicBaseUrl:K().url().optional(),disableSignUp:on().default(!1),token:K().min(1).optional(),growthubBaseUrl:K().url().optional()}),tre=Ne({profile:Ge(Uee).default("dx")}),nre=Ne({baseDir:K().default("~/.paperclip/instances/default/data/storage")}),rre=Ne({bucket:K().min(1).default("paperclip"),region:K().min(1).default("us-east-1"),endpoint:K().optional(),prefix:K().default(""),forcePathStyle:on().default(!1)}),sre=Ne({provider:Ge(tte).default("local_disk"),localDisk:nre.default({baseDir:"~/.paperclip/instances/default/data/storage"}),s3:rre.default({bucket:"paperclip",region:"us-east-1",prefix:"",forcePathStyle:!1})}),ire=Ne({keyFilePath:K().default("~/.paperclip/instances/default/secrets/master.key")}),ore=Ne({provider:Ge(OD).default("local_encrypted"),strictMode:on().default(!1),localEncrypted:ire.default({keyFilePath:"~/.paperclip/instances/default/secrets/master.key"})});Ne({$meta:Gne,llm:Jne.optional(),database:Qne,logging:Yne,server:Xne,auth:ere.default({baseUrlMode:"auto",disableSignUp:!1}),surface:tre.default({profile:"dx"}),storage:sre.default({provider:"local_disk",localDisk:{baseDir:"~/.paperclip/instances/default/data/storage"},s3:{bucket:"paperclip",region:"us-east-1",prefix:"",forcePathStyle:!1}}),secrets:ore.default({provider:"local_encrypted",strictMode:!1,localEncrypted:{keyFilePath:"~/.paperclip/instances/default/secrets/master.key"}})}).superRefine((t,e)=>{if(t.server.deploymentMode==="local_trusted"){t.server.exposure!=="private"&&e.addIssue({code:ve.custom,message:"server.exposure must be private when deploymentMode is local_trusted",path:["server","exposure"]});return}t.auth.baseUrlMode==="explicit"&&!t.auth.publicBaseUrl&&e.addIssue({code:ve.custom,message:"auth.publicBaseUrl is required when auth.baseUrlMode is explicit",path:["auth","publicBaseUrl"]}),t.server.exposure==="public"&&t.auth.baseUrlMode!=="explicit"&&e.addIssue({code:ve.custom,message:"auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",path:["auth","baseUrlMode"]}),t.server.exposure==="public"&&!t.auth.publicBaseUrl&&e.addIssue({code:ve.custom,message:"auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",path:["auth","publicBaseUrl"]})});function Z(...t){return Bee(bD(t))}function rd(t){return`$${(t/100).toFixed(2)}`}function Al(t){return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function kS(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Ui(t){const e=Date.now(),n=new Date(t).getTime(),r=Math.round((e-n)/1e3);if(r<60)return"just now";const s=Math.round(r/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);if(i<24)return`${i}h ago`;const o=Math.round(i/24);return o<30?`${o}d ago`:Al(t)}function Sr(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function JRe(t){return{anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter",chatgpt:"ChatGPT",google:"Google",cursor:"Cursor",jetbrains:"JetBrains AI"}[t.toLowerCase()]??t}function ZRe(t){return{metered_api:"Metered API",subscription_included:"Subscription",subscription_overage:"Subscription overage",credits:"Credits",fixed:"Fixed",unknown:"Unknown"}[t]}function QRe(t){return{"anthropic-oauth":"Anthropic OAuth","claude-cli":"Claude CLI","codex-rpc":"Codex app server","codex-wham":"ChatGPT WHAM"}[t]??t}function QT(t){return t==="metered_api"||t==="subscription_included"||t==="subscription_overage"||t==="credits"||t==="fixed"||t==="unknown"?t:null}function YT(t){if(!t)return 0;for(const e of["costUsd","cost_usd","total_cost_usd"]){const n=t[e];if(typeof n=="number"&&Number.isFinite(n))return n}return 0}function t6(t,e=null){return(QT(t==null?void 0:t.billingType)??QT(e==null?void 0:e.billingType))==="subscription_included"?0:YT(t)||YT(e)}function YRe(t){return{inference_charge:"Inference charge",platform_fee:"Platform fee",credit_purchase:"Credit purchase",credit_refund:"Credit refund",credit_expiry:"Credit expiry",byok_fee:"BYOK fee",gateway_overhead:"Gateway overhead",log_storage_charge:"Log storage",logpush_charge:"Logpush",provisioned_capacity_charge:"Provisioned capacity",training_charge:"Training",custom_model_import_charge:"Custom model import",custom_model_storage_charge:"Custom model storage",manual_adjustment:"Manual adjustment"}[t]}function XRe(t){return t==="credit"?"Credit":"Debit"}function n6(t){return t.urlKey??$ne(t.name,t.id)}function eMe(t){return`/agents/${n6(t)}`}function are(t){return t.urlKey??zne(t.name,t.id)}function lre(t){return`/projects/${are(t)}`}function tMe({delayDuration:t=0,...e}){return d.jsx(uS,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function cre({...t}){return d.jsx(dS,{"data-slot":"tooltip",...t})}function ure({...t}){return d.jsx(fS,{"data-slot":"tooltip-trigger",...t})}function dre({className:t,sideOffset:e=0,children:n,...r}){return d.jsx(hS,{children:d.jsxs(pS,{"data-slot":"tooltip-content",sideOffset:e,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,d.jsx(xD,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const r6=x.createContext(null);function nMe({children:t}){const[e,n]=x.useState([]),r=x.useCallback(s=>{n(s)},[]);return x.useEffect(()=>{if(e.length===0)document.title="Growthub";else{const s=[...e].reverse().map(i=>i.label);document.title=`${s.join(" · ")} · Growthub`}},[e]),d.jsx(r6.Provider,{value:{breadcrumbs:e,setBreadcrumbs:r},children:t})}function pm(){const t=x.useContext(r6);if(!t)throw new Error("useBreadcrumbs must be used within BreadcrumbProvider");return t}const s6=x.createContext(null),U1=768;function rMe({children:t}){const[e,n]=x.useState(()=>window.innerWidth<U1),[r,s]=x.useState(()=>window.innerWidth>=U1);x.useEffect(()=>{const o=window.matchMedia(`(max-width: ${U1-1}px)`),a=l=>{n(l.matches),s(!l.matches)};return o.addEventListener("change",a),()=>o.removeEventListener("change",a)},[]);const i=x.useCallback(()=>s(o=>!o),[]);return d.jsx(s6.Provider,{value:{sidebarOpen:r,setSidebarOpen:s,toggleSidebar:i,isMobile:e},children:t})}function yb(){const t=x.useContext(s6);if(!t)throw new Error("useSidebar must be used within SidebarProvider");return t}const i6=x.createContext(null);function sMe({children:t}){const[e,n]=x.useState(!1),[r,s]=x.useState({}),[i,o]=x.useState(!1),[a,l]=x.useState(!1),[c,u]=x.useState({}),[f,h]=x.useState(!1),[p,m]=x.useState(!1),[g,y]=x.useState({}),v=x.useCallback((O={})=>{s(O),n(!0)},[]),b=x.useCallback(()=>{n(!1),s({})},[]),w=x.useCallback(()=>{o(!0)},[]),k=x.useCallback(()=>{o(!1)},[]),C=x.useCallback((O={})=>{u(O),l(!0)},[]),_=x.useCallback(()=>{l(!1),u({})},[]),S=x.useCallback(()=>{h(!0)},[]),E=x.useCallback(()=>{h(!1)},[]),N=x.useCallback((O={})=>{y(O),m(!0)},[]),T=x.useCallback(()=>{m(!1),y({})},[]);return d.jsx(i6.Provider,{value:{newIssueOpen:e,newIssueDefaults:r,openNewIssue:v,closeNewIssue:b,newProjectOpen:i,openNewProject:w,closeNewProject:k,newGoalOpen:a,newGoalDefaults:c,openNewGoal:C,closeNewGoal:_,newAgentOpen:f,openNewAgent:S,closeNewAgent:E,onboardingOpen:p,onboardingOptions:g,openOnboarding:N,closeOnboarding:T},children:t})}function CS(){const t=x.useContext(i6);if(!t)throw new Error("useDialog must be used within DialogProvider");return t}const fre={info:4e3,success:3500,warn:8e3,error:1e4},hre=1500,pre=15e3,mre=5,gre=3500,xre=2e4,o6=x.createContext(null);function yre(t,e){const n=fre[e];return typeof t!="number"||!Number.isFinite(t)?n:Math.max(hre,Math.min(pre,Math.floor(t)))}function bre(){return`toast_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function iMe({children:t}){const[e,n]=x.useState([]),r=x.useRef(new Map),s=x.useRef(new Map),i=x.useCallback(u=>{const f=r.current.get(u);f!==void 0&&(window.clearTimeout(f),r.current.delete(u))},[]),o=x.useCallback(u=>{i(u),n(f=>f.filter(h=>h.id!==u))},[i]),a=x.useCallback(()=>{for(const u of r.current.values())window.clearTimeout(u);r.current.clear(),n([])},[]),l=x.useCallback(u=>{var b;const f=Date.now(),h=u.tone??"info",p=yre(u.ttlMs,h),m=u.dedupeKey??u.id??`${h}|${u.title}|${u.body??""}|${((b=u.action)==null?void 0:b.href)??""}`;for(const[w,k]of s.current.entries())f-k>xre&&s.current.delete(w);const g=s.current.get(m);if(g&&f-g<gre)return null;s.current.set(m,f);const y=u.id??bre();i(y),n(w=>{const k={id:y,title:u.title,body:u.body,tone:h,ttlMs:p,action:u.action,createdAt:f},C=w.filter(_=>_.id!==y);return[k,...C].slice(0,mre)});const v=window.setTimeout(()=>{o(y)},p);return r.current.set(y,v),y},[i,o]);x.useEffect(()=>()=>{for(const u of r.current.values())window.clearTimeout(u);r.current.clear()},[]);const c=x.useMemo(()=>({toasts:e,pushToast:l,dismissToast:o,clearToasts:a}),[e,l,o,a]);return d.jsx(o6.Provider,{value:c,children:t})}function mm(){const t=x.useContext(o6);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}function XT(t){if(!t||typeof t!="object")return null;const e=t,n=e.session,r=e.user;if(!n||typeof n!="object"||!r||typeof r!="object")return null;const s=n,i=r;return typeof s.id!="string"||typeof s.userId!="string"||typeof i.id!="string"?null:{session:{id:s.id,userId:s.userId},user:{id:i.id,email:typeof i.email=="string"?i.email:null,name:typeof i.name=="string"?i.name:null}}}async function W1(t,e){var s;const n=await fetch(`/api/auth${t}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json().catch(()=>null);if(!n.ok){const i=r!=null&&r.error&&typeof r.error=="object"?((s=r.error)==null?void 0:s.message)??`Request failed: ${n.status}`:(r==null?void 0:r.error)??`Request failed: ${n.status}`;throw new Error(i)}return r}const Di={getSession:async()=>{const t=await fetch("/api/auth/get-session",{credentials:"include",headers:{Accept:"application/json"}});if(t.status===401)return null;const e=await t.json().catch(()=>null);if(!t.ok)throw new Error(`Failed to load session (${t.status})`);const n=XT(e);return n||(e&&typeof e=="object"?XT(e.data):null)},signInEmail:async t=>{await W1("/sign-in/email",t)},signUpEmail:async t=>{await W1("/sign-up/email",t)},signOut:async()=>{await W1("/sign-out",{})}},vre=1e4,wre=3,kre=2e3;function qt(t){return typeof t=="string"&&t.length>0?t:null}function _S(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function bb(t){return t.slice(0,8)}function a6(t,e,n){const r=t.getQueryData(re.agents.list(e));if(!r)return null;const s=r.find(i=>i.id===n);return(s==null?void 0:s.name)??null}function kc(t,e){return t.length<=e?t:t.slice(0,e-1)+"…"}function Cre(t,e,n,r){return n==="agent"&&r?a6(t,e,r)??`Agent ${bb(r)}`:n==="system"?"System":n==="user"&&r?"Board":"Someone"}function l6(t,e,n,r){const s=new Set([n]),i=t.getQueryData(re.issues.detail(n)),o=t.getQueryData(re.issues.list(e)),a=qt(r==null?void 0:r.identifier)??qt(r==null?void 0:r.issueIdentifier);a&&s.add(a),i!=null&&i.id&&s.add(i.id),i!=null&&i.identifier&&s.add(i.identifier);const l=o==null?void 0:o.find(c=>!!(c.id===n||c.identifier&&c.identifier===n||a&&c.identifier===a));return l!=null&&l.id&&s.add(l.id),l!=null&&l.identifier&&s.add(l.identifier),Array.from(s)}function _re(t,e,n,r){var u;const s=l6(t,e,n,r),i=s.map(f=>t.getQueryData(re.issues.detail(f))).find(f=>!!f),o=(u=t.getQueryData(re.issues.list(e)))==null?void 0:u.find(f=>s.some(h=>f.id===h||f.identifier===h)),a=i??o??null,l=qt(r==null?void 0:r.identifier)??qt(r==null?void 0:r.issueIdentifier)??(a==null?void 0:a.identifier)??`Issue ${bb(n)}`,c=qt(r==null?void 0:r.title)??qt(r==null?void 0:r.issueTitle)??(a==null?void 0:a.title)??null;return{ref:l,title:c,label:c?`${l} - ${kc(c,72)}`:l,href:`/issues/${(a==null?void 0:a.identifier)??n}`}}const Sre=new Set(["issue.created","issue.updated","issue.comment_added"]),Ere=new Set(["running","error"]),Nre=new Set(["succeeded","failed","timed_out","cancelled"]);function Tre(t){if(!t)return null;const e=[];if(typeof t.status=="string"&&e.push(`status -> ${t.status.replace(/_/g," ")}`),typeof t.priority=="string"&&e.push(`priority -> ${t.priority}`),typeof t.assigneeAgentId=="string"||typeof t.assigneeUserId=="string"?e.push("reassigned"):(t.assigneeAgentId===null||t.assigneeUserId===null)&&e.push("unassigned"),t.reopened===!0){const n=qt(t.reopenedFrom);e.push(n?`reopened from ${n.replace(/_/g," ")}`:"reopened")}return typeof t.title=="string"&&e.push("title changed"),typeof t.description=="string"&&e.push("description changed"),e.length>0?e.join(", "):null}function Are(t,e,n,r){const s=qt(n.entityType),i=qt(n.entityId),o=qt(n.action),a=_S(n.details),l=qt(n.actorId),c=qt(n.actorType);if(s!=="issue"||!i||!o||!Sre.has(o))return null;const u=_re(t,e,i,a),f=Cre(t,e,c,l);if(c==="user"&&!!r.userId&&l===r.userId||c==="agent"&&!1)return null;if(o==="issue.created")return{title:`${f} created ${u.ref}`,body:u.title?kc(u.title,96):void 0,tone:"success",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}`};if(o==="issue.updated"){if(qt(a==null?void 0:a.source)==="comment")return null;const C=Tre(a),_=C?u.title?`${kc(u.title,64)} - ${C}`:C:u.title?kc(u.title,96):u.label;return{title:`${f} updated ${u.ref}`,body:kc(_,100),tone:"info",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}`}}const p=qt(a==null?void 0:a.commentId),m=qt(a==null?void 0:a.bodySnippet),g=(a==null?void 0:a.reopened)===!0,y=(a==null?void 0:a.updated)===!0,v=qt(a==null?void 0:a.reopenedFrom),b=g?v?`reopened from ${v.replace(/_/g," ")}`:"reopened":null,w=g?`${f} reopened and commented on ${u.ref}`:y?`${f} commented and updated ${u.ref}`:`${f} commented on ${u.ref}`,k=m?b?`${b} - ${m.replace(/^#+\s*/m,"").replace(/\n/g," ")}`:m.replace(/^#+\s*/m,"").replace(/\n/g," "):b?u.title?`${b} - ${u.title}`:b:u.title??void 0;return{title:w,body:k?kc(k,96):void 0,tone:"info",action:{label:`View ${u.ref}`,href:u.href},dedupeKey:`activity:${o}:${i}:${p??"na"}`}}function Ire(t){const e=qt(t.entityType),n=qt(t.action),r=qt(t.entityId),s=_S(t.details);return e!=="join_request"||!n||!r||n!=="join.requested"&&n!=="join.request_replayed"?null:{title:`${qt(s==null?void 0:s.requestType)==="agent"?"Agent":"Someone"} wants to join`,body:"A new join request is waiting for approval.",tone:"info",action:{label:"View inbox",href:"/inbox/unread"},dedupeKey:`join-request:${r}`}}function jre(t,e,n,r){const s=qt(t.agentId),i=qt(t.status);if(!s||!i||!Ere.has(i))return null;const o=i==="error"?"error":"info",a=e(s)??`Agent ${bb(s)}`,l=i==="running"?`${a} started`:`${a} errored`,c=n.getQueryData(re.agents.list(r)),u=c==null?void 0:c.find(h=>h.id===s),f=(u==null?void 0:u.title)??void 0;return{title:l,body:f,tone:o,action:{label:"View agent",href:`/agents/${s}`},dedupeKey:`agent-status:${s}:${i}`}}function Rre(t,e){const n=qt(t.runId),r=qt(t.agentId),s=qt(t.status);if(!n||!r||!s||!Nre.has(s))return null;const i=qt(t.error),o=qt(t.triggerDetail),a=e(r)??`Agent ${bb(r)}`,l=s==="succeeded"?"success":s==="cancelled"?"warn":"error",u=`${a} run ${s==="succeeded"?"succeeded":s==="failed"?"failed":s==="timed_out"?"timed out":"cancelled"}`;let f;return i?f=kc(i,100):o&&(f=`Trigger: ${o}`),{title:u,body:f,tone:l,ttlMs:s==="succeeded"?5e3:7e3,action:{label:"View run",href:`/agents/${r}/runs/${n}`},dedupeKey:`run-status:${n}:${s}`}}function Mre(t,e,n){t.invalidateQueries({queryKey:re.liveRuns(e)}),t.invalidateQueries({queryKey:re.heartbeats(e)}),t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.costs(e)}),t.invalidateQueries({queryKey:re.sidebarBadges(e)});const r=qt(n.agentId);r&&(t.invalidateQueries({queryKey:re.agents.detail(r)}),t.invalidateQueries({queryKey:re.heartbeats(e,r)}))}function Pre(t,e,n){t.invalidateQueries({queryKey:re.activity(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.sidebarBadges(e)});const r=qt(n.entityType),s=qt(n.entityId);if(r==="issue"){if(t.invalidateQueries({queryKey:re.issues.list(e)}),s){const i=_S(n.details),o=l6(t,e,s,i);for(const a of o)t.invalidateQueries({queryKey:re.issues.detail(a)}),t.invalidateQueries({queryKey:re.issues.comments(a)}),t.invalidateQueries({queryKey:re.issues.activity(a)}),t.invalidateQueries({queryKey:re.issues.runs(a)}),t.invalidateQueries({queryKey:re.issues.documents(a)}),t.invalidateQueries({queryKey:re.issues.attachments(a)}),t.invalidateQueries({queryKey:re.issues.approvals(a)}),t.invalidateQueries({queryKey:re.issues.liveRuns(a)}),t.invalidateQueries({queryKey:re.issues.activeRun(a)})}return}if(r==="agent"){t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.org(e)}),s&&(t.invalidateQueries({queryKey:re.agents.detail(s)}),t.invalidateQueries({queryKey:re.heartbeats(e,s)}));return}if(r==="project"){t.invalidateQueries({queryKey:re.projects.list(e)}),s&&t.invalidateQueries({queryKey:re.projects.detail(s)});return}if(r==="goal"){t.invalidateQueries({queryKey:re.goals.list(e)}),s&&t.invalidateQueries({queryKey:re.goals.detail(s)});return}if(r==="approval"){t.invalidateQueries({queryKey:re.approvals.list(e)});return}if(r==="join_request"){t.invalidateQueries({queryKey:re.access.joinRequests(e)});return}if(r==="cost_event"){t.invalidateQueries({queryKey:re.costs(e)}),t.invalidateQueries({queryKey:re.usageByProvider(e)}),t.invalidateQueries({queryKey:re.usageWindowSpend(e)});return}r==="company"&&t.invalidateQueries({queryKey:re.companies.all})}function Ore(t,e){const n=Date.now();if(n<t.suppressUntil)return!0;const r=t.cooldownHits.get(e);if(!r)return!1;const s=r.filter(i=>n-i<vre);return t.cooldownHits.set(e,s),s.length>=wre}function Lre(t,e){const n=Date.now(),r=t.cooldownHits.get(e)??[];r.push(n),t.cooldownHits.set(e,r)}function K1(t,e,n,r){if(Ore(t,n))return;e(r)!==null&&Lre(t,n)}function Dre(t,e,n,r,s,i){if(n.companyId!==e)return;const o=l=>a6(t,e,l),a=n.payload??{};if(n.type!=="heartbeat.run.log"){if(n.type==="heartbeat.run.queued"||n.type==="heartbeat.run.status"){if(Mre(t,e,a),n.type==="heartbeat.run.status"){const l=Rre(a,o);l&&K1(s,r,"run-status",l)}return}if(n.type!=="heartbeat.run.event"){if(n.type==="agent.status"){t.invalidateQueries({queryKey:re.agents.list(e)}),t.invalidateQueries({queryKey:re.dashboard(e)}),t.invalidateQueries({queryKey:re.org(e)});const l=qt(a.agentId);l&&t.invalidateQueries({queryKey:re.agents.detail(l)});const c=jre(a,o,t,e);c&&K1(s,r,"agent-status",c);return}if(n.type==="activity.logged"){Pre(t,e,a);const l=qt(a.action),c=Are(t,e,a,i)??Ire(a);c&&K1(s,r,`activity:${l??"unknown"}`,c)}}}}function oMe({children:t}){var a,l;const{selectedCompanyId:e}=Qi(),n=rr(),{pushToast:r}=mm(),s=x.useRef({cooldownHits:new Map,suppressUntil:0}),{data:i}=st({queryKey:re.auth.session,queryFn:()=>Di.getSession(),retry:!1}),o=((a=i==null?void 0:i.user)==null?void 0:a.id)??((l=i==null?void 0:i.session)==null?void 0:l.userId)??null;return x.useEffect(()=>{if(!e)return;let c=!1,u=0,f=null,h=null;const p=()=>{f!==null&&(window.clearTimeout(f),f=null)},m=()=>{if(c)return;u+=1;const y=Math.min(15e3,1e3*2**Math.min(u-1,4));f=window.setTimeout(()=>{f=null,g()},y)},g=()=>{if(c)return;const v=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/companies/${encodeURIComponent(e)}/events/ws`;h=new WebSocket(v),h.onopen=()=>{u>0&&(s.current.suppressUntil=Date.now()+kre),u=0},h.onmessage=b=>{const w=typeof b.data=="string"?b.data:"";if(w)try{const k=JSON.parse(w);Dre(n,e,k,r,s.current,{userId:o,agentId:null})}catch{}},h.onerror=()=>{h==null||h.close()},h.onclose=()=>{c||m()}};return g(),()=>{c=!0,p(),h&&(h.onopen=null,h.onmessage=null,h.onerror=null,h.onclose=null,h.close(1e3,"provider_unmount"))}},[n,e,r,o]),d.jsx(d.Fragment,{children:t})}const c6="paperclip:panel-visible",u6=x.createContext(null);function Fre(){try{const t=localStorage.getItem(c6);return t===null?!0:t==="true"}catch{return!0}}function eA(t){try{localStorage.setItem(c6,String(t))}catch{}}function aMe({children:t}){const[e,n]=x.useState(null),[r,s]=x.useState(Fre),i=x.useCallback(c=>{n(c)},[]),o=x.useCallback(()=>{n(null)},[]),a=x.useCallback(c=>{s(c),eA(c)},[]),l=x.useCallback(()=>{s(c=>{const u=!c;return eA(u),u})},[]);return d.jsx(u6.Provider,{value:{panelContent:e,panelVisible:r,openPanel:i,closePanel:o,setPanelVisible:a,togglePanelVisible:l},children:t})}function d6(){const t=x.useContext(u6);if(!t)throw new Error("usePanel must be used within PanelProvider");return t}const gm={list:t=>le.get(`/plugins${t?`?status=${t}`:""}`),listExamples:()=>le.get("/plugins/examples"),get:t=>le.get(`/plugins/${t}`),install:t=>le.post("/plugins/install",t),uninstall:(t,e)=>le.delete(`/plugins/${t}${e?"?purge=true":""}`),enable:t=>le.post(`/plugins/${t}/enable`,{}),disable:(t,e)=>le.post(`/plugins/${t}/disable`,e?{reason:e}:{}),health:t=>le.get(`/plugins/${t}/health`),dashboard:t=>le.get(`/plugins/${t}/dashboard`),logs:(t,e)=>{const n=new URLSearchParams;e!=null&&e.limit&&n.set("limit",String(e.limit)),e!=null&&e.level&&n.set("level",e.level),e!=null&&e.since&&n.set("since",e.since);const r=n.toString();return le.get(`/plugins/${t}/logs${r?`?${r}`:""}`)},upgrade:(t,e)=>le.post(`/plugins/${t}/upgrade`,e?{version:e}:{}),listUiContributions:()=>le.get("/plugins/ui-contributions"),getConfig:t=>le.get(`/plugins/${t}/config`),saveConfig:(t,e)=>le.post(`/plugins/${t}/config`,{configJson:e}),testConfig:(t,e)=>le.post(`/plugins/${t}/config/test`,{configJson:e}),bridgeGetData:(t,e,n,r,s)=>le.post(`/plugins/${t}/data/${encodeURIComponent(e)}`,{companyId:r??void 0,params:n,renderEnvironment:s??void 0}),bridgePerformAction:(t,e,n,r,s)=>le.post(`/plugins/${t}/actions/${encodeURIComponent(e)}`,{companyId:r??void 0,params:n,renderEnvironment:s??void 0})},SS=x.createContext(null);function vb(){const t=x.useContext(SS);if(!t)throw new Error("Plugin bridge hook called outside of a <PluginBridgeContext.Provider>. Ensure the plugin component is rendered within a PluginBridgeScope.");return t}function f6(t){if(t instanceof wf&&t.body&&typeof t.body=="object"){const e=t.body;if(typeof e.code=="string"&&typeof e.message=="string")return{code:e.code,message:e.message,details:e.details};if(typeof e.error=="string")return{code:"UNKNOWN",message:e.error}}return{code:"UNKNOWN",message:t instanceof Error?t.message:String(t)}}function $re(t){if(!t)return"";try{return JSON.stringify(t,Object.keys(t).sort())}catch{return""}}function h6(t){return t?{environment:t.environment,launcherId:t.launcherId,bounds:t.bounds}:null}function Bre(t){return t?JSON.stringify(t):""}function Vre(t,e){const{pluginId:n,hostContext:r}=vb(),s=r.companyId,i=h6(r.renderEnvironment),o=Bre(i),[a,l]=x.useState(null),[c,u]=x.useState(!0),[f,h]=x.useState(null),[p,m]=x.useState(0),g=$re(e);x.useEffect(()=>{let v=!1,b=null,w=0;const k=2,C=["WORKER_UNAVAILABLE","TIMEOUT"];u(!0);const _=()=>{gm.bridgeGetData(n,t,e,s,i).then(S=>{v||(l(S.data),h(null),u(!1))}).catch(S=>{if(v)return;const E=f6(S);if(C.includes(E.code)&&w<k){w+=1,b=setTimeout(()=>{b=null,v||_()},150*w);return}h(E),l(null),u(!1)})};return _(),()=>{v=!0,b&&clearTimeout(b)}},[n,t,g,p,s,o]);const y=x.useCallback(()=>{m(v=>v+1)},[]);return{data:a,loading:c,error:f,refresh:y}}function zre(t){const e=vb(),n=x.useRef(e);return n.current=e,x.useCallback(async r=>{const{pluginId:s,hostContext:i}=n.current,o=i.companyId,a=h6(i.renderEnvironment);try{return(await gm.bridgePerformAction(s,t,r,o,a)).data}catch(l){throw f6(l)}},[t])}function Hre(){const{hostContext:t}=vb();return t}function Ure(){const{pushToast:t}=mm();return x.useCallback(e=>t(e),[t])}function Wre(t,e){const{pluginId:n,hostContext:r}=vb(),s=(e==null?void 0:e.companyId)??r.companyId??void 0,[i,o]=x.useState([]),[a,l]=x.useState(null),[c,u]=x.useState(!!s),[f,h]=x.useState(!1),[p,m]=x.useState(null),g=x.useRef(null),y=x.useCallback(()=>{var v;(v=g.current)==null||v.close(),g.current=null,u(!1),h(!1)},[]);return x.useEffect(()=>{if(o([]),l(null),m(null),!s){y();return}const v=new URLSearchParams({companyId:s}),b=new EventSource(`/api/plugins/${encodeURIComponent(n)}/bridge/stream/${encodeURIComponent(t)}?${v.toString()}`,{withCredentials:!0});return g.current=b,u(!0),h(!1),b.onopen=()=>{u(!1),h(!0),m(null)},b.onmessage=w=>{try{const k=JSON.parse(w.data);o(C=>[...C,k]),l(k)}catch(k){m(k instanceof Error?k:new Error(String(k)))}},b.addEventListener("close",()=>{b.close(),g.current===b&&(g.current=null),u(!1),h(!1)}),b.onerror=()=>{u(!1),h(!1),m(new Error(`Failed to connect to plugin stream "${t}"`)),b.close(),g.current===b&&(g.current=null)},()=>{b.close(),g.current===b&&(g.current=null)}},[t,y,s,n]),{events:i,lastEvent:a,connecting:c,connected:f,error:p,close:y}}function lMe(t,e){globalThis.__paperclipPluginBridge__={react:t,reactDom:e,sdkUi:{usePluginData:Vre,usePluginAction:zre,useHostContext:Hre,usePluginStream:Wre,usePluginToast:Ure}}}const tA=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,nA=bD,ES=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return nA(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=tA(u)||tA(f);return s[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...i,...a}[g]):{...i,...a}[g]===y})?[...c,f,h]:c},[]);return nA(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Kre=ES("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,opacity] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-9 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-10","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-9","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Fe({className:t,variant:e="default",size:n="default",asChild:r=!1,...s}){const i=r?k_:"button";return d.jsx(i,{"data-slot":"button","data-variant":e,"data-size":n,className:Z(Kre({variant:e,size:n,className:t})),...s})}const wb=new Map;function kb(t,e){return`${t}:${e}`}function qre(t){return t==="detailTab"||t==="taskDetailView"||t==="contextMenuItem"||t==="commentAnnotation"||t==="commentContextMenuItem"||t==="projectSidebarItem"||t==="toolbarButton"}function Gre(t){return t instanceof Error&&t.message?t.message:"Unknown error"}function Jre(t,e,n){wb.set(kb(t,e),{kind:"react",component:n})}function Zre(t,e,n){wb.set(kb(t,e),{kind:"web-component",tagName:n})}function Qre(t){return wb.get(kb(t.pluginKey,t.exportName))??null}function rA(t,e){return wb.get(kb(t,e))??null}const Cc=new Map,bh=new Map;function NS(t){const e=t.updatedAt??t.version??"0";return`${t.pluginId}:${e}`}function Yre(t){const e=encodeURIComponent(t.updatedAt??t.version??"0");return`/_plugins/${encodeURIComponent(t.pluginId)}/ui/${t.uiEntryFile}?v=${e}`}const q1={};function Xre(t,e){return e===void 0?t??{}:{...t??{},key:e}}function Us(t){if(q1[t])return q1[t];let e;switch(t){case"react":e=`
|
|
66
66
|
const R = globalThis.__paperclipPluginBridge__?.react;
|
|
67
67
|
export default R;
|
|
68
68
|
const { useState, useEffect, useCallback, useMemo, useRef, useContext,
|
|
@@ -769,7 +769,7 @@ ${l}`.trim();return[o,{kind:"tool_result",ts:e,toolUseId:_r(n.callID)||_r(n.id,r
|
|
|
769
769
|
`))};if((We.mac||We.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:l,insert:Yt.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);IE(e,f,Ce.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(ht.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:ZB.of(ht.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Rp(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,o,a,l,c)=>{if(r)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class He{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||_we(e.parent)||document,this.viewState=new sR(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(Pg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(md).map(s=>new Dv(s));for(let s of this.plugins)s.update(this);this.observer=new qke(this),this.inputState=new gke(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Wj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Qn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let h of e){if(h.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=h.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;e.some(h=>h.annotation(fV))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=hV(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=uy.create(this,i,e),s.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:p}=h.state.selection;f=new Id(p.empty?p:Ce.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of h.effects)p.is(Pg)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=my.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Sh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Bg)!=s.state.facet(Bg)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let h of this.state.facet(b2))try{h(s)}catch(p){vs(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!iV(this,u)&&c.force&&Ad(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new sR(e),this.plugins=e.facet(md).map(r=>new Dv(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Wj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(md),r=e.state.facet(md);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new Dv(i));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){vs(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(MB(r))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(m){return vs(this.state,m),cR}}),f=uy.create(this,this.state,[]),h=!1;f.flags|=l,n?n.flags|=l:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(u[p]!=cR)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){vs(this.state,m)}if(h&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(m>1||m<-1){s=s+m,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(b2))a(n)}get themeClasses(){return S2+" "+(this.state.facet(_2)?xV:gV)+" "+this.state.facet(Bg)}updateAttrs(){let e=uR(this,QB,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(pa)?"true":"false",class:"cm-content",style:`${We.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),uR(this,NE,n);let r=this.observer.ignore(()=>{let s=$j(this.contentDOM,this.contentAttrs,n),i=$j(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(He.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Sh);let e=this.state.facet(He.cspNonce);Ul.mount(this.root,this.styleModules.concat(Wke).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Vv(this,e,Kj(this,e,n,r))}moveByGroup(e,n){return Vv(this,e,Kj(this,e,n,r=>oke(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return ike(this,e,n,r)}moveVertically(e,n,r){return Vv(this,e,ake(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=k2(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),k2(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),o=i[So.find(i,e-s.from,-1,n)];return cy(r,o.dir==mn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(qB)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Zke)return $B(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||FB(i.isolates,r=zj(this,e))))return i.order;r||(r=zj(this,e));let s=Rwe(e.text,n,r);return this.bidiCache.push(new my(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||We.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{RB(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Pg.of(new Id(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Pg.of(new Id(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return nr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return nr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Ul.newName(),s=[Bg.of(r),Sh.of(E2(`.${r}`,e))];return n&&n.dark&&s.push(_2.of(!0)),s}static baseTheme(e){return lc.lowest(Sh.of(E2("."+S2,e,yV)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&tr.get(r)||tr.get(e);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}He.styleModule=Sh;He.inputHandler=WB;He.clipboardInputFilter=SE;He.clipboardOutputFilter=EE;He.scrollHandler=JB;He.focusChangeEffect=KB;He.perLineTextDirection=qB;He.exceptionSink=UB;He.updateListener=b2;He.editable=pa;He.mouseSelectionStyle=HB;He.dragMovesSelection=zB;He.clickAddsSelectionRange=VB;He.decorations=u1;He.blockWrappers=YB;He.outerDecorations=TE;He.atomicRanges=$m;He.bidiIsolatedRanges=XB;He.scrollMargins=eV;He.darkTheme=_2;He.cspNonce=Ue.define({combine:t=>t.length?t[0]:""});He.contentAttributes=NE;He.editorAttributes=QB;He.lineWrapping=He.contentAttributes.of({class:"cm-lineWrapping"});He.announce=yt.define();const Zke=4096,cR={};class my{constructor(e,n,r,s,i,o){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:mn.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new my(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function uR(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(t):i;o&&kE(o,n)}return n}const Qke=We.mac?"mac":We.windows?"win":We.linux?"linux":"key";function Yke(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Vg(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Xke=lc.default(He.domEventHandlers({keydown(t,e){return vV(bV(e.state),t,e,"editor")}})),Bm=Ue.define({enables:Xke}),dR=new WeakMap;function bV(t){let e=t.facet(Bm),n=dR.get(e);return n||dR.set(e,n=nCe(e.reduce((r,s)=>r.concat(s),[]))),n}function eCe(t,e,n){return vV(bV(t.state),e,t,n)}let ul=null;const tCe=4e3;function nCe(t,e=Qke){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,u)=>{var f,h;let p=n[o]||(n[o]=Object.create(null)),m=a.split(/ (?!$)/).map(v=>Yke(v,e));for(let v=1;v<m.length;v++){let b=m.slice(0,v).join(" ");s(b,!0),p[b]||(p[b]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=ul={view:w,prefix:b,scope:o};return setTimeout(()=>{ul==k&&(ul=null)},tCe),!0}]})}let g=m.join(" ");s(g,!1);let y=p[g]||(p[g]={preventDefault:!1,stopPropagation:!1,run:((h=(f=p._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});l&&y.run.push(l),c&&(y.preventDefault=!0),u&&(y.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let h in u)u[h].run.push(p=>f(p,N2))}let l=o[e]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let N2=null;function vV(t,e,n,r){N2=e;let s=mwe(e),i=xs(s,0),o=vo(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;ul&&ul.view==n&&ul.scope==r&&(a=ul.prefix+" ",lV.indexOf(e.keyCode)<0&&(c=!0,ul=null));let f=new Set,h=y=>{if(y){for(let v of y.run)if(!f.has(v)&&(f.add(v),v(n)))return y.stopPropagation&&(u=!0),!0;y.preventDefault&&(y.stopPropagation&&(u=!0),c=!0)}return!1},p=t[r],m,g;return p&&(h(p[a+Vg(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(We.windows&&e.ctrlKey&&e.altKey)&&!(We.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=Wl[e.keyCode])&&m!=s?(h(p[a+Vg(m,e,!0)])||e.shiftKey&&(g=Ip[e.keyCode])!=s&&g!=m&&h(p[a+Vg(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&h(p[a+Vg(s,e,!0)])&&(l=!0),!l&&h(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),N2=null,l}class Vm{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=wV(e);return[new Vm(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return rCe(e,n,r)}}function wV(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==mn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function fR(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:i.left+1,y:o}),l=t.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function rCe(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==mn.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=wV(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=a.right-(u?parseInt(u.paddingRight):0),p=w2(t,r,1),m=w2(t,s,-1),g=p.type==jr.Text?p:null,y=m.type==jr.Text?m:null;if(g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=fR(t,r,1,g)),y&&(t.lineWrapping||m.widgetLineBreaks)&&(y=fR(t,s,-1,y)),g&&y&&g.from==y.from&&g.to==y.to)return b(w(n.from,n.to,g));{let C=g?w(n.from,null,g):k(p,!1),_=y?w(null,n.to,y):k(m,!0),S=[];return(g||p).to<(y||m).from-(g&&y?1:0)||p.widgetLineBreaks>1&&C.bottom+t.defaultLineHeight/2<_.top?S.push(v(f,C.bottom,h,_.top)):C.bottom<_.top&&t.elementAtHeight((C.bottom+_.top)/2).type==jr.Text&&(C.bottom=_.top=(C.bottom+_.top)/2),b(C).concat(S).concat(b(_))}function v(C,_,S,E){return new Vm(e,C-l.left,_-l.top,Math.max(0,S-C),E-_)}function b({top:C,bottom:_,horizontal:S}){let E=[];for(let N=0;N<S.length;N+=2)E.push(v(S[N],C,S[N+1],_));return E}function w(C,_,S){let E=1e9,N=-1e9,T=[];function O(M,V,G,D,B){let F=t.coordsAtPos(M,M==S.to?-2:2),R=t.coordsAtPos(G,G==S.from?2:-2);!F||!R||(E=Math.min(F.top,R.top,E),N=Math.max(F.bottom,R.bottom,N),B==mn.LTR?T.push(i&&V?f:F.left,i&&D?h:R.right):T.push(!i&&D?f:R.left,!i&&V?h:F.right))}let L=C??S.from,I=_??S.to;for(let M of t.visibleRanges)if(M.to>L&&M.from<I)for(let V=Math.max(M.from,L),G=Math.min(M.to,I);;){let D=t.state.doc.lineAt(V);for(let B of t.bidiSpans(D)){let F=B.from+D.from,R=B.to+D.from;if(F>=G)break;R>V&&O(Math.max(F,V),C==null&&F<=L,Math.min(R,G),_==null&&R>=I,B.dir)}if(V=D.to+1,V>=G)break}return T.length==0&&O(L,C==null,I,_==null,t.textDirection),{top:E,bottom:N,horizontal:T}}function k(C,_){let S=a.top+(_?C.top:C.bottom);return{top:S,bottom:S,horizontal:[]}}}function sCe(t,e){return t.constructor==e.constructor&&t.eq(e)}class iCe{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Fx)!=e.state.facet(Fx)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Fx);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!sCe(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,We.safari&&We.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Fx=Ue.define();function kV(t){return[nr.define(e=>new iCe(e,t)),Fx.of(t)]}const Pp=Ue.define({combine(t){return Wo(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function oCe(t={}){return[Pp.of(t),aCe,lCe,cCe,GB.of(!0)]}function CV(t){return t.startState.facet(Pp)!=t.state.facet(Pp)}const aCe=kV({above:!0,markers(t){let{state:e}=t,n=e.facet(Pp),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let l of Vm.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=CV(t);return n&&hR(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){hR(e.state,t)},class:"cm-cursorLayer"});function hR(t,e){e.style.animationDuration=t.facet(Pp).cursorBlinkRate+"ms"}const lCe=kV({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Vm.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||CV(t)},class:"cm-selectionLayer"}),cCe=lc.highest(He.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),_V=yt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Th=vr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(_V)?r.value:n,t)}}),uCe=nr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Th);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Th)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Th),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Th)!=t&&this.view.dispatch({effects:_V.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dCe(){return[Th,uCe]}function pR(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=e.exec(i.value);)s(o+a.index,a)}function fCe(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class hCe{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let f=r(a,l,c);f&&u(c,c+a[0].length,f)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let n=new La,r=n.add.bind(n);for(let{from:s,to:i}of fCe(e,this.maxLength))pR(e.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),f=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){f=a;break}}let h=[],p,m=(g,y,v)=>h.push(v.range(g,y));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<f-l.from;)this.addMatch(p,e,p.index+l.from,m);else pR(e.state.doc,this.regexp,u,f,(g,y)=>this.addMatch(y,e,g,m));n=n.update({filterFrom:u,filterTo:f,filter:(g,y)=>g<u||y>f,add:h})}}return n}}const T2=/x/.unicode!=null?"gu":"g",pCe=new RegExp(`[\0-\b
|
|
770
770
|
--\u2028\u2029\uFEFF-]`,T2),mCe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Uv=null;function gCe(){var t;if(Uv==null&&typeof document<"u"&&document.body){let e=document.body.style;Uv=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Uv||!1}const $x=Ue.define({combine(t){let e=Wo(t,{render:null,specialChars:pCe,addSpecialChars:null});return(e.replaceTabs=!gCe())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,T2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,T2)),e}});function xCe(t={}){return[$x.of(t),yCe()]}let mR=null;function yCe(){return mR||(mR=nr.fromClass(class{constructor(t){this.view=t,this.decorations=ht.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet($x)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new hCe({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=xs(e[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=$f(o.text,a,r-o.from);return ht.replace({widget:new kCe((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ht.replace({widget:new wCe(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet($x);t.startState.facet($x)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const bCe="•";function vCe(t){return t>=32?bCe:t==10?"":String.fromCharCode(9216+t)}class wCe extends Ko{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=vCe(this.code),r=e.state.phrase("Control character")+" "+(mCe[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class kCe extends Ko{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function CCe(){return SCe}const _Ce=ht.line({class:"cm-activeLine"}),SCe=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(_Ce.range(s.from)),e=s.from)}return ht.set(n)}},{decorations:t=>t.decorations}),A2=2e3;function ECe(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>A2||n.off>A2||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=s;l++){let c=t.doc.line(l);c.length<=a&&i.push(Ce.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=s;l++){let c=t.doc.line(l),u=l2(c.text,o,t.tabSize,!0);if(u<0)i.push(Ce.cursor(c.to));else{let f=l2(c.text,a,t.tabSize);i.push(Ce.range(c.from+u,c.from+f))}}}return i}function NCe(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function gR(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>A2?-1:s==r.length?NCe(t,e.clientX):$f(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function TCe(t,e){let n=gR(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let a=gR(t,s);if(!a)return r;let l=ECe(t.state,n,a);return l.length?o?Ce.create(l.concat(r.ranges)):Ce.create(l):r}}:null}function ACe(t){let e=(n=>n.altKey&&n.button==0);return He.mouseSelectionStyle.of((n,r)=>e(r)?TCe(n,r):null)}const ICe={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},jCe={style:"cursor: crosshair"};function RCe(t={}){let[e,n]=ICe[t.key||"Alt"],r=nr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,He.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?jCe:null})]}const zg="-10000px";class SV{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],u=-1;if(c){for(let f=0;f<this.tooltips.length;f++){let h=this.tooltips[f];h&&h.create==c.create&&(u=f)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let f=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),f.update&&f.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function MCe(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Wv=Ue.define({combine:t=>{var e,n,r;return{position:We.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||MCe}}}),xR=new WeakMap,ME=nr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Wv);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new SV(t,PE,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Wv);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=zg,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(We.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=AE(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Wv).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,f=t.pos[a],h=t.size[a];if(!f||l.clip!==!1&&(f.bottom<=Math.max(n.top,r.top)||f.top>=Math.min(n.bottom,r.bottom)||f.right<Math.max(n.left,r.left)-.1||f.left>Math.min(n.right,r.right)+.1)){u.style.top=zg;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,g=h.right-h.left,y=(e=xR.get(c))!==null&&e!==void 0?e:h.bottom-h.top,v=c.offset||OCe,b=this.view.textDirection==mn.LTR,w=h.width>r.right-r.left?b?r.left:r.right-h.width:b?Math.max(r.left,Math.min(f.left-(p?14:0)+v.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(p?14:0)-v.x),r.right-g),k=this.above[a];!l.strictSide&&(k?f.top-y-m-v.y<r.top:f.bottom+y+m+v.y>r.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[a]=!k);let C=(k?f.top-r.top:r.bottom-f.bottom)-m;if(C<y&&c.resize!==!1){if(C<this.view.defaultLineHeight){u.style.top=zg;continue}xR.set(c,y),u.style.height=(y=C)/i+"px"}else u.style.height&&(u.style.height="");let _=k?f.top-y-m-v.y:f.bottom+m+v.y,S=w+g;if(c.overlap!==!0)for(let E of o)E.left<S&&E.right>w&&E.top<_+y&&E.bottom>_&&(_=k?E.top-y-2-m:E.bottom+m+2);if(this.position=="absolute"?(u.style.top=(_-t.parent.top)/i+"px",yR(u,(w-t.parent.left)/s)):(u.style.top=_/i+"px",yR(u,w/s)),p){let E=f.left+(b?v.x:-v.x)-(w+14-7);p.style.left=E/s+"px"}c.overlap!==!0&&o.push({left:w,top:_,right:S,bottom:_+y}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=zg}},{eventObservers:{scroll(){this.maybeMeasure()}}});function yR(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const PCe=He.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),OCe={x:0,y:0},PE=Ue.define({enables:[ME,PCe]}),gy=Ue.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class p1{static create(e){return new p1(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new SV(e,gy,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const LCe=PE.compute([gy],t=>{let e=t.facet(gy);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:p1.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class DCe{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let a=e.coordsAtPos(s);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),c=l&&l.dir==mn.RTL?-1:1;i=n.x<a.left?-c:c}let o=this.source(e,s,i);if(o!=null&&o.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>vs(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(ME),n=e?e.manager.tooltips.findIndex(r=>r.create==p1.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!FCe(i.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!$Ce(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Hg=4;function FCe(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return e.clientX>=n-Hg&&e.clientX<=r+Hg&&e.clientY>=s-Hg&&e.clientY<=i+Hg}function $Ce(t,e,n,r,s,i){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=t.posAtCoords({x:r,y:s},!1);return l>=e&&l<=n}function BCe(t,e={}){let n=yt.define(),r=vr.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let a of s){let l=i.changes.mapPos(a.pos,-1,Ar.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=i.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of i.effects)o.is(n)&&(s=o.value),o.is(VCe)&&(s=[]);return s},provide:s=>gy.from(s)});return{active:r,extension:[r,nr.define(s=>new DCe(s,t,r,n,e.hoverTime||300)),LCe]}}function EV(t,e){let n=t.plugin(ME);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const VCe=yt.define(),bR=Ue.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function OE(t,e){let n=t.plugin(NV),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const NV=nr.fromClass(class{constructor(t){this.input=t.state.facet(Op),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(bR);this.top=new Ug(t,!0,e.topContainer),this.bottom=new Ug(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(bR);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ug(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ug(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Op);if(n!=this.input){let r=n.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),s.push(u),(u.top?i:o).push(u)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>He.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ug{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=vR(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=vR(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function vR(t){let e=t.nextSibling;return t.remove(),e}const Op=Ue.define({enables:NV});function zCe(t,e){let n,r=new Promise(o=>n=o),s=o=>HCe(o,e,n);t.state.field(Kv,!1)?t.dispatch({effects:TV.of(s)}):t.dispatch({effects:yt.appendConfig.of(Kv.init(()=>[s]))});let i=AV.of(s);return{close:i,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(Kv).indexOf(s)>-1&&t.dispatch({effects:i})}),o))}}const Kv=vr.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(TV)?t=[n.value].concat(t):n.is(AV)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>Op.computeN([t],e=>e.field(t))}),TV=yt.define(),AV=yt.define();function HCe(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=ln("form"),e.input){let a=ln("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(ln("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(ln("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<s.length;a++){let l=s[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let i=ln("div",r,ln("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(i.className=e.class),i.classList.add("cm-dialog");function o(a){i.contains(i.ownerDocument.activeElement)&&t.focus(),n(a)}return{dom:i,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Fa extends Hl{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Fa.prototype.elementClass="";Fa.prototype.toDOM=void 0;Fa.prototype.mapMode=Ar.TrackBefore;Fa.prototype.startSide=Fa.prototype.endSide=-1;Fa.prototype.point=!0;const Bx=Ue.define(),UCe=Ue.define(),WCe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Pt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qh=Ue.define();function KCe(t){return[IV(),qh.of({...WCe,...t})]}const wR=Ue.define({combine:t=>t.some(e=>e)});function IV(t){return[qCe]}const qCe=nr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(qh).map(e=>new CR(t,e)),this.fixed=!t.state.facet(wR);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(wR)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Pt.iter(this.view.state.facet(Bx),this.view.viewport.from),r=[],s=this.gutters.map(i=>new GCe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==jr.Text&&o){I2(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==jr.Text){I2(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(qh),n=t.state.facet(qh),r=t.docChanged||t.heightChanged||t.viewportChanged||!Pt.eq(t.startState.facet(Bx),t.state.facet(Bx),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=e.indexOf(i);o<0?s.push(new CR(this.view,i)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>He.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==mn.LTR?{left:r,right:s}:{right:r,left:s}})});function kR(t){return Array.isArray(t)?t:[t]}function I2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class GCe{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Pt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==s.elements.length){let a=new jV(e,o,i,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];I2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(UCe)){let o=i(e,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class CR{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=kR(n.markers(e)),n.initialSpacer&&(this.spacer=new jV(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=kR(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Pt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class jV{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),JCe(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(l)){a=f,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!l)break;l.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function JCe(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const ZCe=Ue.define(),QCe=Ue.define(),gd=Ue.define({combine(t){return Wo(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,c)=>i(a,l,c)||o(a,l,c):o}return r}})}});class qv extends Fa{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gv(t,e){return t.state.facet(gd).formatNumber(e,t.state)}const YCe=qh.compute([gd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(ZCe)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new qv(Gv(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(QCe)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(gd)!=e.state.facet(gd),initialSpacer(e){return new qv(Gv(e,_R(e.state.doc.lines)))},updateSpacer(e,n){let r=Gv(n.view,_R(n.view.state.doc.lines));return r==e.number?e:new qv(r)},domEventHandlers:t.facet(gd).domEventHandlers,side:"before"}));function RV(t={}){return[gd.of(t),IV(),YCe]}function _R(t){let e=9;for(;e<t;)e=e*10+9;return e}const XCe=new class extends Fa{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},e2e=Bx.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(XCe.range(s)))}return Pt.of(e)});function t2e(){return e2e}const n2e=1024;let r2e=0,ti=class{constructor(e,n){this.from=e,this.to=n}};class jt{constructor(e={}){this.id=r2e++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ls.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}jt.closedBy=new jt({deserialize:t=>t.split(" ")});jt.openedBy=new jt({deserialize:t=>t.split(" ")});jt.group=new jt({deserialize:t=>t.split(" ")});jt.isolate=new jt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});jt.contextHash=new jt({perNode:!0});jt.lookAhead=new jt({perNode:!0});jt.mounted=new jt({perNode:!0});class jd{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[jt.mounted.id]}}const s2e=Object.create(null);class ls{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):s2e,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ls(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(jt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(jt.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}ls.none=new ls("",Object.create(null),0,8);class LE{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let o=i(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}n.push(s?new ls(r.name,s,r.id,r.flags):r)}return new LE(n)}}const Wg=new WeakMap,SR=new WeakMap;var pn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(pn||(pn={}));class gn{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=jd.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new xy(this.topNode,e)}cursorAt(e,n=0,r=0){let s=Wg.get(this)||this.topNode,i=new xy(s);return i.moveTo(e,n),Wg.set(this,i._tree),i}get topNode(){return new Hr(this,0,0,null)}resolve(e,n=0){let r=Lp(Wg.get(this)||this.topNode,e,n,!1);return Wg.set(this,r),r}resolveInner(e,n=0){let r=Lp(SR.get(this)||this.topNode,e,n,!0);return SR.set(this,r),r}resolveStack(e,n=0){return a2e(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,o=e.mode||0,a=(o&pn.IncludeAnonymous)>0;for(let l=this.cursor(o|pn.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:$E(ls.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new gn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new gn(ls.none,n,r,s)))}static build(e){return l2e(e)}}gn.empty=new gn(ls.none,[],[],0);class DE{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new DE(this.buffer,this.index)}}class ql{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ls.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(MV(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-e,o=Math.max(o,c)}return new ql(i,o,this.set)}}function MV(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Lp(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Hr&&t.index<0?null:t.parent;if(!o)return t;t=o}let i=r?0:pn.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Hr&&o.index<0&&((s=a.enter(e,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,i);if(!o)return t;t=o}}class PV{cursor(e=0){return new xy(this,e)}getChild(e,n=null,r=null){let s=ER(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return ER(this,e,n,r)}resolve(e,n=0){return Lp(this,e,n,!1)}resolveInner(e,n=0){return Lp(this,e,n,!0)}matchContext(e){return j2(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class Hr extends PV{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],f=l[e]+o.from,h;if(!(!(i&pn.EnterBracketed&&u instanceof gn&&(h=jd.get(u))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+u.length)&&!MV(s,r,f,f+u.length))){if(u instanceof ql){if(i&pn.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,s);if(p>-1)return new Eo(new i2e(o,u,e,f),null,p)}else if(i&pn.IncludeAnonymous||!u.type.isAnonymous||FE(u)){let p;if(!(i&pn.IgnoreMounts)&&(p=jd.get(u))&&!p.overlay)return new Hr(p.tree,f,e,o);let m=new Hr(u,f,e,o);return i&pn.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&pn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let s;if(!(r&pn.IgnoreOverlays)&&(s=jd.get(this._tree))&&s.overlay){let i=e-this.from,o=r&pn.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Hr(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ER(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function j2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class i2e{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Eo extends PV{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new Eo(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&pn.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Eo(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Eo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Eo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];e.push(r.slice(s,i,o)),n.push(0)}return new gn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function OV(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let o=t[i];(o.from>n.from||o.to<n.to)&&(n=o,e=i)}let r=n instanceof Hr&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new o2e(s,n)}class o2e{constructor(e,n){this.heads=e,this.node=n}get next(){return OV(this.heads)}}function a2e(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof Hr?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(e,n)),i=o}else{let o=jd.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Hr(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Lp(a,e,n,!1))}}return s?OV(s):r}class xy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~pn.EnterBracketed,e instanceof Hr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Hr?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&pn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&pn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,o=e<0?-1:r._tree.children.length;i!=o;i+=e){let a=r._tree.children[i];if(this.mode&pn.IncludeAnonymous||a instanceof ql||!a.type.isAnonymous||FE(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new Eo(this.buffer,n,this.stack[s]);return this.bufferNode=new Eo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return j2(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return j2(this._tree,e,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function FE(t){return t.children.some(e=>e instanceof ql||!e.type.isAnonymous||FE(e))}function l2e(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=n2e,reused:i=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new DE(n,n.length):n,l=r.types,c=0,u=0;function f(C,_,S,E,N,T){let{id:O,start:L,end:I,size:M}=a,V=u,G=c;if(M<0)if(a.next(),M==-1){let U=i[O];S.push(U),E.push(L-C);return}else if(M==-3){c=O;return}else if(M==-4){u=O;return}else throw new RangeError(`Unrecognized record size: ${M}`);let D=l[O],B,F,R=L-C;if(I-L<=s&&(F=y(a.pos-_,N))){let U=new Uint16Array(F.size-F.skip),J=a.pos-F.size,P=U.length;for(;a.pos>J;)P=v(F.start,U,P);B=new ql(U,I-F.start,r),R=F.start-C}else{let U=a.pos-M;a.next();let J=[],P=[],ie=O>=o?O:-1,ge=0,ae=I;for(;a.pos>U;)ie>=0&&a.id==ie&&a.size>=0?(a.end<=ae-s&&(m(J,P,L,ge,a.end,ae,ie,V,G),ge=J.length,ae=a.end),a.next()):T>2500?h(L,U,J,P):f(L,U,J,P,ie,T+1);if(ie>=0&&ge>0&&ge<J.length&&m(J,P,L,ge,L,ae,ie,V,G),J.reverse(),P.reverse(),ie>-1&&ge>0){let Y=p(D,G);B=$E(D,J,P,0,J.length,0,I-L,Y,Y)}else B=g(D,J,P,I-L,V-I,G)}S.push(B),E.push(R)}function h(C,_,S,E){let N=[],T=0,O=-1;for(;a.pos>_;){let{id:L,start:I,end:M,size:V}=a;if(V>4)a.next();else{if(O>-1&&I<O)break;O<0&&(O=M-s),N.push(L,I,M),T++,a.next()}}if(T){let L=new Uint16Array(T*4),I=N[N.length-2];for(let M=N.length-3,V=0;M>=0;M-=3)L[V++]=N[M],L[V++]=N[M+1]-I,L[V++]=N[M+2]-I,L[V++]=V;S.push(new ql(L,N[2]-I,r)),E.push(I-C)}}function p(C,_){return(S,E,N)=>{let T=0,O=S.length-1,L,I;if(O>=0&&(L=S[O])instanceof gn){if(!O&&L.type==C&&L.length==N)return L;(I=L.prop(jt.lookAhead))&&(T=E[O]+L.length+I)}return g(C,S,E,N,T,_)}}function m(C,_,S,E,N,T,O,L,I){let M=[],V=[];for(;C.length>E;)M.push(C.pop()),V.push(_.pop()+S-N);C.push(g(r.types[O],M,V,T-N,L-T,I)),_.push(N-S)}function g(C,_,S,E,N,T,O){if(T){let L=[jt.contextHash,T];O=O?[L].concat(O):[L]}if(N>25){let L=[jt.lookAhead,N];O=O?[L].concat(O):[L]}return new gn(C,_,S,E,O)}function y(C,_){let S=a.fork(),E=0,N=0,T=0,O=S.end-s,L={size:0,start:0,skip:0};e:for(let I=S.pos-C;S.pos>I;){let M=S.size;if(S.id==_&&M>=0){L.size=E,L.start=N,L.skip=T,T+=4,E+=4,S.next();continue}let V=S.pos-M;if(M<0||V<I||S.start<O)break;let G=S.id>=o?4:0,D=S.start;for(S.next();S.pos>V;){if(S.size<0)if(S.size==-3||S.size==-4)G+=4;else break e;else S.id>=o&&(G+=4);S.next()}N=D,E+=M,T+=G}return(_<0||E==C)&&(L.size=E,L.start=N,L.skip=T),L.size>4?L:void 0}function v(C,_,S){let{id:E,start:N,end:T,size:O}=a;if(a.next(),O>=0&&E<o){let L=S;if(O>4){let I=a.pos-(O-4);for(;a.pos>I;)S=v(C,_,S)}_[--S]=L,_[--S]=T-C,_[--S]=N-C,_[--S]=E}else O==-3?c=E:O==-4&&(u=E);return S}let b=[],w=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,b,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new gn(l[t.topID],b.reverse(),w.reverse(),k)}const NR=new WeakMap;function Vx(t,e){if(!t.isAnonymous||e instanceof ql||e.type!=t)return 1;let n=NR.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof gn)){n=1;break}n+=Vx(t,r)}NR.set(e,n)}return n}function $E(t,e,n,r,s,i,o,a,l){let c=0;for(let m=r;m<s;m++)c+=Vx(t,e[m]);let u=Math.ceil(c*1.5/8),f=[],h=[];function p(m,g,y,v,b){for(let w=y;w<v;){let k=w,C=g[w],_=Vx(t,m[w]);for(w++;w<v;w++){let S=Vx(t,m[w]);if(_+S>=u)break;_+=S}if(w==k+1){if(_>u){let S=m[k];p(S.children,S.positions,0,S.children.length,g[k]+b);continue}f.push(m[k])}else{let S=g[w-1]+m[w-1].length-C;f.push($E(t,m,g,k,w,C,S,null,l))}h.push(C+b-i)}}return p(e,n,r,s,0),(a||l)(f,h,o)}class RMe{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Eo?this.setBuffer(e.context.buffer,e.index,n):e instanceof Hr&&this.map.set(e.tree,n)}get(e){return e instanceof Eo?this.getBuffer(e.context.buffer,e.index):e instanceof Hr?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Sa{constructor(e,n,r,s,i=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Sa(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;o&&o.from<f;){let h=o;if(l>=h.from||f<=h.to||c){let p=Math.max(h.from,l)-c,m=Math.min(h.to,f)-c;h=p>=m?null:new Sa(p,m,h.tree,h.offset+c,a>0,!!u)}if(h&&s.push(h),o.to>f)break;o=i<e.length?e[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class LV{startParse(e,n,r){return typeof e=="string"&&(e=new c2e(e)),r=r?r.length?r.map(s=>new ti(s.from,s.to)):[new ti(0,0)]:[new ti(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}}class c2e{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function MMe(t){return(e,n,r,s)=>new d2e(e,t,n,r,s)}class TR{constructor(e,n,r,s,i,o){this.parser=e,this.parse=n,this.overlay=r,this.bracketed=s,this.target=i,this.from=o}}function AR(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class u2e{constructor(e,n,r,s,i,o,a,l){this.parser=e,this.predicate=n,this.mounts=r,this.index=s,this.start=i,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const R2=new jt({perNode:!0});class d2e{constructor(e,n,r,s,i){this.nest=n,this.input=r,this.fragments=s,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new gn(r.type,r.children,r.positions,r.length,r.propValues.concat([[R2,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[jt.mounted.id]=new jd(n,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new p2e(this.fragments),n=null,r=null,s=new xy(new Hr(this.baseTree,this.ranges[0].from,0,null),pn.IncludeAnonymous|pn.IgnoreMounts);e:for(let i,o;;){let a=!0,l;if(this.stoppedAt!=null&&s.from>=this.stoppedAt)a=!1;else if(e.hasNode(s)){if(n){let c=n.mounts.find(u=>u.frag.from<=s.from&&u.frag.to>=s.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,h=u.to+c.pos;f>=s.from&&h<=s.to&&!n.ranges.some(p=>p.from<h&&p.to>f)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(o=f2e(r.ranges,s.from,s.to)))a=o!=2;else if(!s.type.isAnonymous&&(i=this.nest(s,this.input))&&(s.from<s.to||!i.overlay)){s.tree||(h2e(s),n&&n.depth++,r&&r.depth++);let c=e.findMounts(s.from,i.parser);if(typeof i.overlay=="function")n=new u2e(i.parser,i.overlay,c,this.inner.length,s.from,!!i.bracketed,s.tree,n);else{let u=RR(this.ranges,i.overlay||(s.from<s.to?[new ti(s.from,s.to)]:[]));u.length&&AR(u),(u.length||!i.overlay)&&this.inner.push(new TR(i.parser,u.length?i.parser.startParse(this.input,MR(c,u),u):i.parser.startParse(""),i.overlay?i.overlay.map(f=>new ti(f.from-s.from,f.to-s.from)):null,!!i.bracketed,s.tree,u.length?u[0].from:s.from)),i.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(s))&&(l===!0&&(l=new ti(s.from,s.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&s.firstChild())n&&n.depth++,r&&r.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(n&&!--n.depth){let c=RR(this.ranges,n.ranges);c.length&&(AR(c),this.inner.splice(n.index,0,new TR(n.parser,n.parser.startParse(this.input,MR(n.mounts,c),c),n.ranges.map(u=>new ti(u.from-n.start,u.to-n.start)),n.bracketed,n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function f2e(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function IR(t,e,n,r,s,i){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),s.push(o-i)}}function h2e(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let s=t.tree,i=s.children.indexOf(r),o=s.children[i],a=o.buffer,l=[i];function c(u,f,h,p,m,g){let y=n[g],v=[],b=[];IR(o,u,y,v,b,p);let w=a[y+1],k=a[y+2];l.push(v.length);let C=g?c(y+4,a[y+3],o.set.types[a[y]],w,k-w,g-1):e.toTree();return v.push(C),b.push(w-p),IR(o,a[y+3],f,v,b,p),new gn(h,v,b,m)}s.children[i]=c(0,a.length,ls.none,0,o.length,n.length-1);for(let u of l){let f=t.tree.children[u],h=t.tree.positions[u];t.yield(new Hr(f,h+t.from,u,t._tree))}}class jR{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(pn.IncludeAnonymous|pn.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,pn.IgnoreOverlays|pn.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof gn)n=n.children[0];else break}return!1}}class p2e{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(R2))!==null&&n!==void 0?n:r.to,this.inner=new jR(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(R2))!==null&&e!==void 0?e:n.to,this.inner=new jR(n.tree,-n.offset)}}findMounts(e,n){var r;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(r=i.tree)===null||r===void 0?void 0:r.prop(jt.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=i.to)break;l.tree==this.curFrag.tree&&s.push({frag:l,pos:i.from-l.offset,mount:o})}}}return s}}function RR(t,e){let n=null,r=e;for(let s=1,i=0;s<t.length;s++){let o=t[s-1].to,a=t[s].from;for(;i<r.length;i++){let l=r[i];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[i]=new ti(l.from,o),l.to>a&&n.splice(i+1,0,new ti(a,l.to))):l.to>a?n[i--]=new ti(a,l.to):n.splice(i--,1))}}return r}function m2e(t,e,n,r){let s=0,i=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=s==t.length?1e9:o?t[s].to:t[s].from,f=i==e.length?1e9:a?e[i].to:e[i].from;if(o!=a){let h=Math.max(l,n),p=Math.min(u,f,r);h<p&&c.push(new ti(h,p))}if(l=Math.min(u,f),l==1e9)break;u==l&&(o?(o=!1,s++):o=!0),f==l&&(a?(a=!1,i++):a=!0)}return c}function MR(t,e){let n=[];for(let{pos:r,mount:s,frag:i}of t){let o=r+(s.overlay?s.overlay[0].from:0),a=o+s.tree.length,l=Math.max(i.from,o),c=Math.min(i.to,a);if(s.overlay){let u=s.overlay.map(h=>new ti(h.from+r,h.to+r)),f=m2e(e,u,l,c);for(let h=0,p=l;;h++){let m=h==f.length,g=m?c:f[h].from;if(g>p&&n.push(new Sa(p,g,s.tree,-o,i.from>=p||i.openStart,i.to<=g||i.openEnd)),m)break;p=f[h].to}}else n.push(new Sa(l,c,s.tree,-o,i.from>=o||i.openStart,i.to<=a||i.openEnd))}return n}let g2e=0;class Qs{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=g2e++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Qs&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new Qs(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new yy(e);return r=>r.modified.indexOf(n)>-1?r:yy.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let x2e=0;class yy{constructor(e){this.name=e,this.instances=[],this.id=x2e++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&y2e(n,a.modified));if(r)return r;let s=[],i=new Qs(e.name,s,e,n);for(let a of n)a.instances.push(i);let o=b2e(n);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(yy.get(a,l));return i}}function y2e(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function b2e(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function v2e(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let f=0;;){if(a=="..."&&f>0&&f+3==s.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+s);if(i.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(f)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new Dp(r,o,l>0?i.slice(0,l):null);e[c]=u.sort(e[c])}}return DV.add(e)}const DV=new jt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Dp(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Dp{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Dp.empty=new Dp([],2,null);function FV(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function w2e(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function k2e(t,e,n,r=0,s=t.length){let i=new C2e(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class C2e{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=s,u=_2e(e)||Dp.empty,f=w2e(i,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(n,a),c),u.opaque)return;let h=e.tree&&e.tree.prop(jt.mounted);if(h&&h.overlay){let p=e.node.enter(h.overlay[0].from+a,1),m=this.highlighters.filter(y=>!y.scope||y.scope(h.tree.type)),g=e.firstChild();for(let y=0,v=a;;y++){let b=y<h.overlay.length?h.overlay[y]:null,w=b?b.from+a:l,k=Math.max(n,v),C=Math.min(r,w);if(k<C&&g)for(;e.from<C&&(this.highlightRange(e,k,C,s,i),this.startSpan(Math.min(C,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;v=b.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,b.from+a),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){h&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function _2e(t){let e=t.type.prop(DV);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const De=Qs.define,Kg=De(),al=De(),PR=De(al),OR=De(al),ll=De(),qg=De(ll),Jv=De(ll),co=De(),xc=De(co),ao=De(),lo=De(),M2=De(),ih=De(M2),Gg=De(),pe={comment:Kg,lineComment:De(Kg),blockComment:De(Kg),docComment:De(Kg),name:al,variableName:De(al),typeName:PR,tagName:De(PR),propertyName:OR,attributeName:De(OR),className:De(al),labelName:De(al),namespace:De(al),macroName:De(al),literal:ll,string:qg,docString:De(qg),character:De(qg),attributeValue:De(qg),number:Jv,integer:De(Jv),float:De(Jv),bool:De(ll),regexp:De(ll),escape:De(ll),color:De(ll),url:De(ll),keyword:ao,self:De(ao),null:De(ao),atom:De(ao),unit:De(ao),modifier:De(ao),operatorKeyword:De(ao),controlKeyword:De(ao),definitionKeyword:De(ao),moduleKeyword:De(ao),operator:lo,derefOperator:De(lo),arithmeticOperator:De(lo),logicOperator:De(lo),bitwiseOperator:De(lo),compareOperator:De(lo),updateOperator:De(lo),definitionOperator:De(lo),typeOperator:De(lo),controlOperator:De(lo),punctuation:M2,separator:De(M2),bracket:ih,angleBracket:De(ih),squareBracket:De(ih),paren:De(ih),brace:De(ih),content:co,heading:xc,heading1:De(xc),heading2:De(xc),heading3:De(xc),heading4:De(xc),heading5:De(xc),heading6:De(xc),contentSeparator:De(co),list:De(co),quote:De(co),emphasis:De(co),strong:De(co),link:De(co),monospace:De(co),strikethrough:De(co),inserted:De(),deleted:De(),changed:De(),invalid:De(),meta:Gg,documentMeta:De(Gg),annotation:De(Gg),processingInstruction:De(Gg),definition:Qs.defineModifier("definition"),constant:Qs.defineModifier("constant"),function:Qs.defineModifier("function"),standard:Qs.defineModifier("standard"),local:Qs.defineModifier("local"),special:Qs.defineModifier("special")};for(let t in pe){let e=pe[t];e instanceof Qs&&(e.name=t)}FV([{tag:pe.link,class:"tok-link"},{tag:pe.heading,class:"tok-heading"},{tag:pe.emphasis,class:"tok-emphasis"},{tag:pe.strong,class:"tok-strong"},{tag:pe.keyword,class:"tok-keyword"},{tag:pe.atom,class:"tok-atom"},{tag:pe.bool,class:"tok-bool"},{tag:pe.url,class:"tok-url"},{tag:pe.labelName,class:"tok-labelName"},{tag:pe.inserted,class:"tok-inserted"},{tag:pe.deleted,class:"tok-deleted"},{tag:pe.literal,class:"tok-literal"},{tag:pe.string,class:"tok-string"},{tag:pe.number,class:"tok-number"},{tag:[pe.regexp,pe.escape,pe.special(pe.string)],class:"tok-string2"},{tag:pe.variableName,class:"tok-variableName"},{tag:pe.local(pe.variableName),class:"tok-variableName tok-local"},{tag:pe.definition(pe.variableName),class:"tok-variableName tok-definition"},{tag:pe.special(pe.variableName),class:"tok-variableName2"},{tag:pe.definition(pe.propertyName),class:"tok-propertyName tok-definition"},{tag:pe.typeName,class:"tok-typeName"},{tag:pe.namespace,class:"tok-namespace"},{tag:pe.className,class:"tok-className"},{tag:pe.macroName,class:"tok-macroName"},{tag:pe.propertyName,class:"tok-propertyName"},{tag:pe.operator,class:"tok-operator"},{tag:pe.comment,class:"tok-comment"},{tag:pe.meta,class:"tok-meta"},{tag:pe.invalid,class:"tok-invalid"},{tag:pe.punctuation,class:"tok-punctuation"}]);var Zv;const jc=new jt;function $V(t){return Ue.define({combine:t?e=>e.concat(t):void 0})}const S2e=new jt;class ni{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return Rr(this)}}),this.parser=n,this.extension=[Gl.of(this),Vt.languageData.of((i,o,a)=>{let l=LR(i,o,a),c=l.type.prop(jc);if(!c)return[];let u=i.facet(c),f=l.type.prop(S2e);if(f){let h=l.resolve(o-l.from,a);for(let p of f)if(p.test(h,i)){let m=i.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return LR(e,n,r).type.prop(jc)==this.data}findRegions(e){let n=e.facet(Gl);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(jc)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(jt.mounted);if(a){if(a.tree.prop(jc)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof gn&&s(c,i.positions[l]+o)}};return s(Rr(e),0),r}get allowsNesting(){return!0}}ni.setState=yt.define();function LR(t,e,n){let r=t.facet(Gl),s=Rr(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,pn.ExcludeBuffers|pn.EnterBracketed))i.type.isTop&&(s=i);return s}class P2 extends ni{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=$V(e.languageData);return new P2(n,e.parser.configure({props:[jc.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new P2(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Rr(t){let e=t.field(ni.state,!1);return e?e.tree:gn.empty}class E2e{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let oh=null;class hf{constructor(e,n,r=[],s,i,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new hf(e,n,[],gn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new E2e(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=gn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Sa.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Sa.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=oh;oh=this;try{return e()}finally{oh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=DR(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,h)=>l.push({fromA:c,toA:u,fromB:f,toB:h})),r=Sa.applyChanges(r,l),s=gn.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);u<f&&a.push({from:u,to:f})}}}return new hf(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=DR(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends LV{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=oh;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new gn(ls.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return oh}}function DR(t,e,n){return Sa.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pf{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pf(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=hf.create(e.facet(Gl).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pf(r)}}ni.state=vr.define({create:pf.init,update(t,e){for(let n of e.effects)if(n.is(ni.setState))return n.value;return e.startState.facet(Gl)!=e.state.facet(Gl)?pf.init(e.state):t.apply(e)}});let BV=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(BV=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Qv=typeof navigator<"u"&&(!((Zv=navigator.scheduling)===null||Zv===void 0)&&Zv.isInputPending)?()=>navigator.scheduling.isInputPending():null,N2e=nr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(ni.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(ni.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=BV(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(ni.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Qv?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>Qv&&Qv()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:ni.setState.of(new pf(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vs(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Gl=Ue.define({combine(t){return t.length?t[0]:null},enables:t=>[ni.state,N2e,He.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class T2e{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class ue{constructor(e,n,r,s,i,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=s,this.loadFunc=i,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new ue(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let s of e)if(s.filename&&s.filename.test(n))return s;let r=/\.([^.]+)$/.exec(n);if(r){for(let s of e)if(s.extensions.indexOf(r[1])>-1)return s}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let s of e)if(s.alias.some(i=>i==n))return s;if(r)for(let s of e)for(let i of s.alias){let o=n.indexOf(i);if(o>-1&&(i.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+i.length])))return s}return null}}const A2e=Ue.define(),m1=Ue.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function wu(t){let e=t.facet(m1);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fp(t,e){let n="",r=t.tabSize,s=t.facet(m1)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function BE(t,e){t instanceof Vt&&(t=new g1(t));for(let r of t.state.facet(A2e)){let s=r(t,e);if(s!==void 0)return s}let n=Rr(t.state);return n.length>=e?I2e(t,n,e):null}class g1{constructor(e,n={}){this.state=e,this.options=n,this.unit=wu(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return $f(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const VV=new jt;function I2e(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return zV(r,t,n)}function zV(t,e,n){for(let r=t;r;r=r.next){let s=R2e(r.node);if(s)return s(VE.create(e,n,r))}return 0}function j2e(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function R2e(t){let e=t.type.prop(VV);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(jt.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>HV(o,!0,1,void 0,i&&!j2e(o)?s.from:void 0)}return t.parent==null?M2e:null}function M2e(){return 0}class VE extends g1{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new VE(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(P2e(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return zV(this.context.next,this.base,this.pos)}}function P2e(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function O2e(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function OMe({closing:t,align:e=!0,units:n=1}){return r=>HV(r,e,n,t)}function HV(t,e,n,r,s){let i=t.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==t.pos+o,l=e?O2e(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const LMe=t=>t.baseIndent;function DMe({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const L2e=200;function D2e(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+L2e)return t;let i=n.sliceString(s.from,r);if(!e.some(c=>c.test(i)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let f=BE(o,u.from);if(f==null)continue;let h=/^\s*/.exec(u.text)[0],p=Fp(o,f);h!=p&&l.push({from:u.from,to:u.from+h.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const F2e=Ue.define(),$2e=new jt;function FMe(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function B2e(t,e,n){let r=Rr(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<e)break;let l=a.type.prop($2e);if(l&&(a.to<r.length-50||r.length==t.doc.length||!V2e(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(i=c)}}return i}function V2e(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function by(t,e,n){for(let r of t.facet(F2e)){let s=r(t,e,n);if(s)return s}return B2e(t,e,n)}function UV(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const x1=yt.define({map:UV}),zm=yt.define({map:UV});function WV(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const ku=vr.define({create(){return ht.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=FR(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(x1)&&!z2e(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(GV),s=r?ht.replace({widget:new J2e(r(e.state,n.value))}):$R;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(zm)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=FR(t,e.selection.main.head)),t},provide:t=>He.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push($R.range(r,s))}return ht.set(e,!0)}});function FR(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function vy(t,e,n){var r;let s=null;return(r=t.field(ku,!1))===null||r===void 0||r.between(e,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function z2e(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function KV(t,e){return t.field(ku,!1)?e:e.concat(yt.appendConfig.of(JV()))}const H2e=t=>{for(let e of WV(t)){let n=by(t.state,e.from,e.to);if(n)return t.dispatch({effects:KV(t.state,[x1.of(n),qV(t,n)])}),!0}return!1},U2e=t=>{if(!t.state.field(ku,!1))return!1;let e=[];for(let n of WV(t)){let r=vy(t.state,n.from,n.to);r&&e.push(zm.of(r),qV(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function qV(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return He.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const W2e=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=by(e,s.from,s.to);i&&n.push(x1.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:KV(t.state,n)}),!!n.length},K2e=t=>{let e=t.state.field(ku,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(zm.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},q2e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:H2e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:U2e},{key:"Ctrl-Alt-[",run:W2e},{key:"Ctrl-Alt-]",run:K2e}],G2e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},GV=Ue.define({combine(t){return Wo(t,G2e)}});function JV(t){return[ku,Y2e]}function ZV(t,e){let{state:n}=t,r=n.facet(GV),s=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=vy(t.state,a.from,a.to);l&&t.dispatch({effects:zm.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const $R=ht.replace({widget:new class extends Ko{toDOM(t){return ZV(t,null)}}});class J2e extends Ko{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ZV(e,this.value)}}const Z2e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Yv extends Fa{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Q2e(t={}){let e={...Z2e,...t},n=new Yv(e,!0),r=new Yv(e,!1),s=nr.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Gl)!=o.state.facet(Gl)||o.startState.field(ku,!1)!=o.state.field(ku,!1)||Rr(o.startState)!=Rr(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new La;for(let l of o.viewportLineBlocks){let c=vy(o.state,l.from,l.to)?r:by(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:i}=e;return[s,KCe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Pt.empty},initialSpacer(){return new Yv(e,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let c=vy(o.state,a.from,a.to);if(c)return o.dispatch({effects:zm.of(c)}),!0;let u=by(o.state,a.from,a.to);return u?(o.dispatch({effects:x1.of(u)}),!0):!1}}}),JV()]}const Y2e=He.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Hm{constructor(e,n){this.specs=e;let r;function s(a){let l=Ul.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof ni?a=>a.prop(jc)==o.data:o?a=>a==o:void 0,this.style=FV(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Ul(r):null,this.themeType=n.themeType}static define(e,n){return new Hm(e,n||{})}}const O2=Ue.define(),QV=Ue.define({combine(t){return t.length?[t[0]]:null}});function Xv(t){let e=t.facet(O2);return e.length?e:t.facet(QV)}function YV(t,e){let n=[e_e],r;return t instanceof Hm&&(t.module&&n.push(He.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(QV.of(t)):r?n.push(O2.computeN([He.darkTheme],s=>s.facet(He.darkTheme)==(r=="dark")?[t]:[])):n.push(O2.of(t)),n}class X2e{constructor(e){this.markCache=Object.create(null),this.tree=Rr(e.state),this.decorations=this.buildDeco(e,Xv(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Rr(e.state),r=Xv(e.state),s=r!=Xv(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ht.none;let r=new La;for(let{from:s,to:i}of e.visibleRanges)k2e(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ht.mark({class:l})))},s,i);return r.finish()}}const e_e=lc.high(nr.fromClass(X2e,{decorations:t=>t.decorations})),t_e=Hm.define([{tag:pe.meta,color:"#404740"},{tag:pe.link,textDecoration:"underline"},{tag:pe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:pe.emphasis,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold"},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.keyword,color:"#708"},{tag:[pe.atom,pe.bool,pe.url,pe.contentSeparator,pe.labelName],color:"#219"},{tag:[pe.literal,pe.inserted],color:"#164"},{tag:[pe.string,pe.deleted],color:"#a11"},{tag:[pe.regexp,pe.escape,pe.special(pe.string)],color:"#e40"},{tag:pe.definition(pe.variableName),color:"#00f"},{tag:pe.local(pe.variableName),color:"#30a"},{tag:[pe.typeName,pe.namespace],color:"#085"},{tag:pe.className,color:"#167"},{tag:[pe.special(pe.variableName),pe.macroName],color:"#256"},{tag:pe.definition(pe.propertyName),color:"#00c"},{tag:pe.comment,color:"#940"},{tag:pe.invalid,color:"#f00"}]),n_e=He.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),XV=1e4,ez="()[]{}",tz=Ue.define({combine(t){return Wo(t,{afterCursor:!0,brackets:ez,maxScanDistance:XV,renderMatch:i_e})}}),r_e=ht.mark({class:"cm-matchingBracket"}),s_e=ht.mark({class:"cm-nonmatchingBracket"});function i_e(t){let e=[],n=t.matched?r_e:s_e;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const o_e=vr.define({create(){return ht.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(tz);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=No(e.state,s.head,-1,r)||s.head>0&&No(e.state,s.head-1,1,r)||r.afterCursor&&(No(e.state,s.head,1,r)||s.head<e.state.doc.length&&No(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return ht.set(n,!0)},provide:t=>He.decorations.from(t)}),a_e=[o_e,n_e];function l_e(t={}){return[tz.of(t),a_e]}const c_e=new jt;function L2(t,e,n){let r=t.prop(e<0?jt.openedBy:jt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function D2(t){let e=t.type.prop(c_e);return e?e(t.node):t}function No(t,e,n,r={}){let s=r.maxScanDistance||XV,i=r.brackets||ez,o=Rr(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=L2(l.type,n,i);if(c&&l.from<l.to){let u=D2(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return u_e(t,e,n,l,u,c,i)}}return d_e(t,e,n,o,a.type,s,i)}function u_e(t,e,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let f=D2(u);return{start:l,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(L2(u.type,n,o))c++;else if(L2(u.type,-n,o)){if(c==0){let f=D2(u);return{start:l,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function d_e(t,e,n,r,s,i,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!u.next().done&&h<=i;){let p=u.value;n<0&&(h+=p.length);let m=e+h*n;for(let g=n>0?0:p.length-1,y=n>0?p.length:-1;g!=y;g+=n){let v=o.indexOf(p[g]);if(!(v<0||r.resolveInner(m+g,1).type!=s))if(v%2==0==n>0)f++;else{if(f==1)return{start:c,end:{from:m+g,to:m+g+1},matched:v>>1==l>>1};f--}}n>0&&(h+=p.length)}return u.done?{start:c,matched:!1}:null}function BR(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let o=r;o<e;o++)t.charCodeAt(o)==9?i+=n-i%n:i++;return i}class nz{constructor(e,n,r,s){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=s,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=BR(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:BR(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let s=o=>r?o.toLowerCase():o,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function f_e(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||h_e,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||UE,mergeTokens:t.mergeTokens!==!1}}function h_e(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const VR=new WeakMap;class zE extends ni{constructor(e){let n=$V(e.languageData),r=f_e(e),s,i=new class extends LV{createParse(o,a,l){return new m_e(s,o,a,l)}};super(n,i,[],e.name),this.topNode=y_e(n,this),s=this,this.streamParser=r,this.stateAfter=new jt({perNode:!0}),this.tokenTable=e.tokenTable?new oz(r.tokenTable):x_e}static define(e){return new zE(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=VR.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let s=HE(this,e.node.tree,e.node.from,e.node.from,n??e.pos),i,o;if(s?(o=s.state,i=s.pos+1):(o=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let l=e.state.doc.lineAt(i),c=Math.min(e.pos,l.to);if(l.length){let u=r?r(l.from):-1,f=new nz(l.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;f.pos<c-l.from;)sz(this.streamParser.token,f,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;i=l.to+1}let a=e.lineAt(e.pos);return r&&n==null&&VR.set(e.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],e)}get allowsNesting(){return!1}}function HE(t,e,n,r,s){let i=n>=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=n+e.positions[o],c=a instanceof gn&&l<s&&HE(t,a,l,r,s);if(c)return c}return null}function rz(t,e,n,r,s){if(s&&n<=0&&r>=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let o=e.positions[i],a=e.children[i],l;if(o<r&&a instanceof gn){if(!(l=rz(t,a,n-o,r-o,s)))break;return s?new gn(e.type,e.children.slice(0,i).concat(l),e.positions.slice(0,i+1),o+l.length):l}}return null}function p_e(t,e,n,r,s){for(let i of e){let o=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),l=o<=n&&a>n&&HE(t,i.tree,0-i.offset,n,a),c;if(l&&l.pos<=r&&(c=rz(t,i.tree,n+i.offset,l.pos+i.offset,!1)))return{state:l.state,tree:c}}return{state:t.streamParser.startState(s?wu(s):4),tree:gn.empty}}class m_e{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=hf.get(),o=s[0].from,{state:a,tree:l}=p_e(e,r,o,this.to,i==null?void 0:i.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);i&&this.parsedPos<i.viewport.from-1e5&&s.some(c=>c.from<=i.viewport.from&&c.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(wu(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=hf.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==`
|
|
771
771
|
`&&(n="");else{let r=n.indexOf(`
|
|
772
|
-
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,a=this.lineAfter(o);n+=a,r=o+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let o=this.ranges[++this.rangeIndex].from;n+=o-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let a=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==n?this.chunk[o+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,o=new nz(n,e?e.state.tabSize:4,e?wu(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=sz(i.token,o,this.state);if(a&&(s=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=gn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:g_e,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new gn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new gn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function sz(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const UE=Object.create(null),$p=[ls.none],g_e=new LE($p),zR=[],HR=Object.create(null),iz=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])iz[t]=az(UE,e);class oz{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),iz)}resolve(e){return e?this.table[e]||(this.table[e]=az(this.extra,e)):0}}const x_e=new oz(UE);function ew(t,e){zR.indexOf(t)>-1||(zR.push(t),console.warn(e))}function az(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||pe[c];u?typeof u=="function"?l.length?l=l.map(u):ew(c,`Modifier ${c} used at start of tag`):l.length?ew(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:ew(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=HR[s];if(i)return i.id;let o=HR[s]=ls.define({id:$p.length,name:r,props:[v2e({[r]:n})]});return $p.push(o),o.id}function y_e(t,e){let n=ls.define({id:$p.length,name:"Document",props:[jc.add(()=>t),VV.add(()=>r=>e.getIndent(r))],top:!0});return $p.push(n),n}mn.RTL,mn.LTR;class lz{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Rr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(cz(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function UR(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function b_e(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=UR(e)+UR(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function v_e(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:b_e(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function $Me(t,e){return n=>{for(let r=Rr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class WR{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function qc(t){return t.selection.main.from}function cz(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const WE=Ga.define();function w_e(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Ce.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const KR=new WeakMap;function k_e(t){if(!Array.isArray(t))return t;let e=KR.get(t);return e||KR.set(t,e=v_e(t)),e}const wy=yt.define(),Bp=yt.define();class C_e{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=xs(e,n),s=vo(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(xs(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let b=xs(e,0),w=vo(b),k=w==e.length?0:-100;if(b!=n[0])if(b==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,w=Math.min(e.length,200);b<w&&c<l;){let k=xs(e,b);(k==n[c]||k==r[c])&&(s[c++]=b),b+=vo(k)}if(c<l)return null}let u=0,f=0,h=!1,p=0,m=-1,g=-1,y=/[a-z]/.test(e),v=!0;for(let b=0,w=Math.min(e.length,200),k=0;b<w&&f<l;){let C=xs(e,b);a<0&&(u<l&&C==n[u]&&(i[u++]=b),p<l&&(C==n[p]||C==r[p]?(p==0&&(m=b),g=b+1,p++):p=0));let _,S=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(_=xE(C))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!b||S==1&&y||k==0&&S!=0)&&(n[f]==C||r[f]==C&&(h=!0)?o[f++]=b:o.length&&(v=!1)),k=S,b+=vo(C)}return f==l&&o[0]==0&&v?this.result(-100+(h?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?vo(xs(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class __e{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const xr=Ue.define({combine(t){return Wo(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:S_e,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>qR(e(r),n(r)),optionClass:(e,n)=>r=>qR(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function qR(t,e){return t?e?t+" "+e:t:e}function S_e(t,e,n,r,s,i){let o=t.textDirection==mn.RTL,a=o,l=!1,c="top",u,f,h=e.left-s.left,p=s.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(a&&h<Math.min(m,p)?a=!1:!a&&p<Math.min(m,h)&&(a=!0),m<=(a?h:p))u=Math.max(s.top,Math.min(n.top,s.bottom-g))-e.top,f=Math.min(400,a?h:p);else{l=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=g||b>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let y=(e.bottom-e.top)/i.offsetHeight,v=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function E_e(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],f=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(u,f))),h.className="cm-completionMatchedText",l=f}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function tw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class N_e{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(xr);this.optionContent=E_e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=tw(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(xr).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bp.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=tw(i.length,o,e.state.facet(xr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=tw(n.options.length,n.selected,this.view.state.facet(xr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>vs(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&A_e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(xr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let h=typeof c=="string"?c:c.name;if(h!=i&&(o>r.from||r.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=h}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let h of this.optionContent){let p=h(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function T_e(t,e){return n=>new N_e(n,t,e)}function A_e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function GR(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function I_e(t,e){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},o=e.facet(xr);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)i(new WR(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),p,m=o.filterStrict?new __e(h):new C_e(h);for(let g of u.result.options)if(p=m.match(g.label)){let y=g.displayLabel?f?f(g,p.matched):[]:p.matched,v=p.score+(g.boost||0);if(i(new WR(g,u.source,y,v)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:b}=g.section;s||(s=Object.create(null)),s[b]=Math.max(v,s[b]||-1e9)}}}}if(r){let u=Object.create(null),f=0,h=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(h))f-=1e5,u[p.name]=f;for(let p of n){let{section:m}=p.completion;m&&(p.score+=u[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||c(f.completion,h.completion))){let f=u.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(u):GR(u.completion)>GR(l)&&(a[a.length-1]=u),l=u.completion}return a}class xd{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new xd(this.options,JR(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=I_e(e,n);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(xr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new xd(a,JR(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:L_e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new xd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ky{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new ky(P_e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(xr),i=(r.override||n.languageDataAt("autocomplete",qc(n)).map(k_e)).map(l=>(this.active.find(u=>u.source==l)||new ri(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(KE));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!j_e(i,this.active)||a?o=xd.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new ri(l.source,0):l));for(let l of e.effects)l.is(dz)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new ky(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?R_e:M_e}}function j_e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const R_e={"aria-autocomplete":"list"},M_e={};function JR(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const P_e=[];function uz(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(WE);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ri{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=uz(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ri(s.source,0)),r&4&&s.state==0&&(s=new ri(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(wy))s=new ri(s.source,1,i.value);else if(i.is(Bp))s=new ri(s.source,0);else if(i.is(KE))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(qc(e.state))}}class Rd extends ri{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=qc(e.state);if(a>o||!s||n&2&&(qc(e.startState)==this.from||a<this.limit))return new ri(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return O_e(s.validFor,e.state,i,o)?new Rd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new lz(e.state,a,!1)))?new Rd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:qc(e.state)):new ri(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rd(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ri(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function O_e(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):cz(t,!0).test(s)}const KE=yt.define({map(t,e){return t.map(n=>n.map(e))}}),dz=yt.define(),ys=vr.define({create(){return ky.start()},update(t,e){return t.update(e)},provide:t=>[PE.from(t,e=>e.tooltip),He.contentAttributes.from(t,e=>e.attrs)]});function qE(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ys).active.find(s=>s.source==e.source);return r instanceof Rd?(typeof n=="string"?t.dispatch({...w_e(t.state,n,r.from,r.to),annotations:WE.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const L_e=T_e(ys,qE);function Jg(t,e="option"){return n=>{let r=n.state.field(ys,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(xr).interactionDelay)return!1;let s=1,i;e=="page"&&(i=EV(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:dz.of(a)}),!0}}const D_e=t=>{let e=t.state.field(ys,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(xr).interactionDelay?!1:qE(t,e.open.options[e.open.selected])},nw=t=>t.state.field(ys,!1)?(t.dispatch({effects:wy.of(!0)}),!0):!1,F_e=t=>{let e=t.state.field(ys,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Bp.of(null)}),!0)};class $_e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const B_e=50,V_e=1e3,z_e=nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ys).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ys),n=t.state.facet(xr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ys)==e)return;let r=t.transactions.some(i=>{let o=uz(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>B_e&&Date.now()-o.time>V_e){for(let a of o.context.abortListeners)try{a()}catch(l){vs(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(wy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ys);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=qc(e),r=new lz(e,n,t.explicit,this.view),s=new $_e(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Bp.of(null)}),vs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(xr),r=this.view.state.field(ys);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=qc(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Rd(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new ri(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:KE.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ys,!1);if(e&&e.tooltip&&this.view.state.facet(xr).closeOnBlur){let n=e.open&&EV(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Bp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wy.of(!1)}),20),this.composing=0}}}),H_e=typeof navigator=="object"&&/Win/.test(navigator.platform),U_e=lc.highest(He.domEventHandlers({keydown(t,e){let n=e.state.field(ys,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(H_e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&qE(e,r),!1}})),fz=He.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class W_e{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class GE{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ar.TrackDel),r=e.mapPos(this.to,1,Ar.TrackDel);return n==null||r==null?null:new GE(this.field,n,r)}}class JE{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(m1);s.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new GE(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1,u=l.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<n.length;f++)(a!=null?n[f].seq==a:u&&n[f].name==u)&&(c=f);if(c<0){let f=0;for(;f<n.length&&(a==null||n[f].seq!=null&&n[f].seq<a);)f++;n.splice(f,0,{seq:a,name:u}),c=f;for(let h of s)h.field>=c&&h.field++}for(let f of s)if(f.line==r.length&&f.from>i.index){let h=i[2]?3+(i[1]||"").length:2;f.from-=h,f.to-=h}s.push(new W_e(c,r.length,i.index,i.index+u.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of s)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new JE(r,s)}}let K_e=ht.widget({widget:new class extends Ko{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),q_e=ht.mark({class:"cm-snippetField"});class Bf{constructor(e,n){this.ranges=e,this.active=n,this.deco=ht.set(e.map(r=>(r.from==r.to?K_e:q_e).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Bf(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const Um=yt.define({map(t,e){return t&&t.map(e)}}),G_e=yt.define(),Vp=vr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Um))return n.value;if(n.is(G_e)&&t)return new Bf(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>He.decorations.from(t,e=>e?e.deco:ht.none)});function ZE(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function J_e(t){let e=JE.parse(t);return(n,r,s,i)=>{let{text:o,ranges:a}=e.instantiate(n.state,s),{main:l}=n.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:Yt.of(o)},scrollIntoView:!0,annotations:r?[WE.of(r),Qn.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=ZE(a,0)),a.some(u=>u.field>0)){let u=new Bf(a,0),f=c.effects=[Um.of(u)];n.state.field(Vp,!1)===void 0&&f.push(yt.appendConfig.of([Vp,eSe,tSe,fz]))}n.dispatch(n.state.update(c))}}function hz(t){return({state:e,dispatch:n})=>{let r=e.field(Vp,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(o=>o.field==s+t);return n(e.update({selection:ZE(r.ranges,s),effects:Um.of(i?null:new Bf(r.ranges,s)),scrollIntoView:!0})),!0}}const Z_e=({state:t,dispatch:e})=>t.field(Vp,!1)?(e(t.update({effects:Um.of(null)})),!0):!1,Q_e=hz(1),Y_e=hz(-1),X_e=[{key:"Tab",run:Q_e,shift:Y_e},{key:"Escape",run:Z_e}],ZR=Ue.define({combine(t){return t.length?t[0]:X_e}}),eSe=lc.highest(Bm.compute([ZR],t=>t.facet(ZR)));function BMe(t,e){return{...e,apply:J_e(t)}}const tSe=He.domEventHandlers({mousedown(t,e){let n=e.state.field(Vp,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:ZE(n.ranges,s.field),effects:Um.of(n.ranges.some(i=>i.field>s.field)?new Bf(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),zp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Rc=yt.define({map(t,e){let n=e.mapPos(t,-1,Ar.TrackAfter);return n??void 0}}),QE=new class extends Hl{};QE.startSide=1;QE.endSide=-1;const pz=vr.define({create(){return Pt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Rc)&&(t=t.update({add:[QE.range(n.value,n.value+1)]}));return t}});function nSe(){return[sSe,pz]}const rw="()[]{}<>«»»«[]{}";function mz(t){for(let e=0;e<rw.length;e+=2)if(rw.charCodeAt(e)==t)return rw.charAt(e+1);return xE(t<128?t:t+1)}function gz(t,e){return t.languageDataAt("closeBrackets",e)[0]||zp}const rSe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sSe=He.inputHandler.of((t,e,n,r)=>{if((rSe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&vo(xs(r,0))==1||e!=s.from||n!=s.to)return!1;let i=aSe(t.state,r);return i?(t.dispatch(i),!0):!1}),iSe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=gz(t,t.selection.main.head).brackets||zp.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=lSe(t.doc,o.head);for(let l of r)if(l==a&&y1(t.doc,o.head)==mz(xs(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Ce.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},oSe=[{key:"Backspace",run:iSe}];function aSe(t,e){let n=gz(t,t.selection.main.head),r=n.brackets||zp.brackets;for(let s of r){let i=mz(xs(s,0));if(e==s)return i==s?dSe(t,s,r.indexOf(s+s+s)>-1,n):cSe(t,s,i,n.before||zp.before);if(e==i&&xz(t,t.selection.main.from))return uSe(t,s,i)}return null}function xz(t,e){let n=!1;return t.field(pz).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function y1(t,e){let n=t.sliceString(e,e+2);return n.slice(0,vo(xs(n,0)))}function lSe(t,e){let n=t.sliceString(e-2,e);return vo(xs(n,0))==n.length?n:n.slice(1)}function cSe(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Rc.of(o.to+e.length),range:Ce.range(o.anchor+e.length,o.head+e.length)};let a=y1(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Rc.of(o.head+e.length),range:Ce.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function uSe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&y1(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function dSe(t,e,n,r){let s=r.stringPrefixes||zp.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Rc.of(a.to+e.length),range:Ce.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=y1(t.doc,l),u;if(c==e){if(QR(t,l))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(xz(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:Ce.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=YR(t,l-2*e.length,s))>-1&&QR(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Mn.Word&&YR(t,l,s)>-1&&!fSe(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function QR(t,e){let n=Rr(t).resolveInner(e+1);return n.parent&&n.from==e}function fSe(t,e,n,r){let s=Rr(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function YR(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Mn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Mn.Word)return i}return-1}function hSe(t={}){return[U_e,ys,xr.of(t),z_e,pSe,fz]}const yz=[{key:"Ctrl-Space",run:nw},{mac:"Alt-`",run:nw},{mac:"Alt-i",run:nw},{key:"Escape",run:F_e},{key:"ArrowDown",run:Jg(!0)},{key:"ArrowUp",run:Jg(!1)},{key:"PageDown",run:Jg(!0,"page")},{key:"PageUp",run:Jg(!1,"page")},{key:"Enter",run:D_e}],pSe=lc.highest(Bm.computeN([xr],t=>t.facet(xr).defaultKeymap?[yz]:[])),mSe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=XE(t.state,n.from);return r.line?gSe(t):r.block?ySe(t):!1};function YE(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const gSe=YE(wSe,0),xSe=YE(bz,0),ySe=YE((t,e)=>bz(t,e,vSe(e)),0);function XE(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const ah=50;function bSe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-ah,r),o=t.sliceDoc(s,s+ah),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,f;s-r<=2*ah?u=f=t.sliceDoc(r,s):(u=t.sliceDoc(r,r+ah),f=t.sliceDoc(s-ah,s));let h=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return u.slice(h,h+e.length)==e&&f.slice(m,m+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function vSe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function bz(t,e,n=e.selection.ranges){let r=n.map(i=>XE(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>bSe(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function wSe(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let f=e.doc.lineAt(u);if(c==null&&(c=XE(e,f.from).line,!c))continue e;if(f.from>s&&(i==o||o>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<l&&(l=h),r.push({line:f,comment:m,token:c,indent:h,empty:p,single:!1})}u=f.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:a.from+c,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const F2=Ga.define(),kSe=Ga.define(),CSe=Ue.define(),vz=Ue.define({combine(t){return Wo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),wz=vr.define({create(){return To.empty},update(t,e){let n=e.state.facet(vz),r=e.annotation(F2);if(r){let l=ws.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=Cy(u,u.length,n.minDepth,l):u=_z(u,e.startState.selection),new To(c==0?r.rest:u,c==0?u:r.rest)}let s=e.annotation(kSe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Qn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ws.fromTransaction(e),o=e.annotation(Qn.time),a=e.annotation(Qn.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new To(t.done.map(ws.fromJSON),t.undone.map(ws.fromJSON))}});function _Se(t={}){return[wz,vz.of(t),He.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?kz:e.inputType=="historyRedo"?$2:null;return r?(e.preventDefault(),r(n)):!1}})]}function b1(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(wz,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const kz=b1(0,!1),$2=b1(1,!1),SSe=b1(0,!0),ESe=b1(1,!0);class ws{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ws(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ws(e.changes&&ar.fromJSON(e.changes),[],e.mapped&&Mo.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=si;for(let s of e.startState.facet(CSe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ws(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,si)}static selection(e){return new ws(void 0,si,void 0,void 0,e)}}function Cy(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function NSe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function TSe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Cz(t,e){return t.length?e.length?t.concat(e):t:e}const si=[],ASe=200;function _z(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ASe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Cy(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ws.selection([e])]}function ISe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function sw(t,e){if(!t.length)return t;let n=t.length,r=si;for(;n;){let s=jSe(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ws.selection(r)]:si}function jSe(t,e,n){let r=Cz(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):si,n);if(!t.changes)return ws.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new ws(s,yt.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const RSe=/^(input\.type|delete)($|\.)/;class To{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new To(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||RSe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,NSe(a.changes,e.changes))||r=="input.type.compose")?o=Cy(o,o.length-1,s.minDepth,new ws(e.changes.compose(a.changes),Cz(yt.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,si)):o=Cy(o,o.length,s.minDepth,e),new To(o,si,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:si;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&TSe(i[i.length-1],e)?this:new To(_z(this.done,e),this.undone,n,r)}addMapping(e){return new To(sw(this.done,e),sw(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:F2.of({side:e,rest:ISe(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?si:s.slice(0,s.length-1);return i.mapped&&(a=sw(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:F2.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}To.empty=new To(si,si);const MSe=[{key:"Mod-z",run:kz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$2,preventDefault:!0},{key:"Mod-u",run:SSe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ESe,preventDefault:!0}];function Vf(t,e){return Ce.create(t.ranges.map(e),t.mainIndex)}function to(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function no({state:t,dispatch:e},n){let r=Vf(t.selection,n);return r.eq(t.selection,!0)?!1:(e(to(t,r)),!0)}function v1(t,e){return Ce.cursor(e?t.to:t.from)}function Sz(t,e){return no(t,n=>n.empty?t.moveByChar(n,e):v1(n,e))}function Kr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const Ez=t=>Sz(t,!Kr(t)),Nz=t=>Sz(t,Kr(t));function Tz(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):v1(n,e))}const PSe=t=>Tz(t,!Kr(t)),OSe=t=>Tz(t,Kr(t));function LSe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function w1(t,e,n){let r=Rr(t).resolveInner(e.head),s=n?jt.closedBy:jt.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;LSe(t,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?No(t,r.from,1):No(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Ce.cursor(a,n?-1:1)}const DSe=t=>no(t,e=>w1(t.state,e,!Kr(t))),FSe=t=>no(t,e=>w1(t.state,e,Kr(t)));function Az(t,e){return no(t,n=>{if(!n.empty)return v1(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Iz=t=>Az(t,!1),jz=t=>Az(t,!0);function Rz(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(He.scrollMargins)){let o=i(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function Mz(t,e){let n=Rz(t),{state:r}=t,s=Vf(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):v1(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=He.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(to(r,s),{effects:i}),!0}const XR=t=>Mz(t,!1),B2=t=>Mz(t,!0);function cc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const $Se=t=>no(t,e=>cc(t,e,!0)),BSe=t=>no(t,e=>cc(t,e,!1)),VSe=t=>no(t,e=>cc(t,e,!Kr(t))),zSe=t=>no(t,e=>cc(t,e,Kr(t))),HSe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),USe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function WSe(t,e,n){let r=!1,s=Vf(t.selection,i=>{let o=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.head<t.doc.length&&No(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ce.cursor(a)});return r?(e(to(t,s)),!0):!1}const KSe=({state:t,dispatch:e})=>WSe(t,e);function yi(t,e){let n=Vf(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function Pz(t,e){return yi(t,n=>t.moveByChar(n,e))}const Oz=t=>Pz(t,!Kr(t)),Lz=t=>Pz(t,Kr(t));function Dz(t,e){return yi(t,n=>t.moveByGroup(n,e))}const qSe=t=>Dz(t,!Kr(t)),GSe=t=>Dz(t,Kr(t)),JSe=t=>yi(t,e=>w1(t.state,e,!Kr(t))),ZSe=t=>yi(t,e=>w1(t.state,e,Kr(t)));function Fz(t,e){return yi(t,n=>t.moveVertically(n,e))}const $z=t=>Fz(t,!1),Bz=t=>Fz(t,!0);function Vz(t,e){return yi(t,n=>t.moveVertically(n,e,Rz(t).height))}const eM=t=>Vz(t,!1),tM=t=>Vz(t,!0),QSe=t=>yi(t,e=>cc(t,e,!0)),YSe=t=>yi(t,e=>cc(t,e,!1)),XSe=t=>yi(t,e=>cc(t,e,!Kr(t))),e5e=t=>yi(t,e=>cc(t,e,Kr(t))),t5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),n5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),nM=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),rM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),sM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),iM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),r5e=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),s5e=({state:t,dispatch:e})=>{let n=k1(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},i5e=({state:t,dispatch:e})=>{let n=Vf(t.selection,r=>{let s=Rr(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Ce.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function zz(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Ce.create(s,s.length-1))),!0)}const o5e=t=>zz(t,!1),a5e=t=>zz(t,!0),l5e=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Wm(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=Zg(t,l,!1)):l>o&&(n="delete.forward",l=Zg(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Zg(t,o,!1),a=Zg(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ce.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?He.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zg(t,e,n){if(t instanceof He)for(let r of t.state.facet(He.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const Hz=(t,e,n)=>Wm(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=$f(a,i.tabSize),u=c%wu(i)||wu(i);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;l=s}else l=yr(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=yr(o.text,l-o.from,!1,!1)+o.from);return l}),V2=t=>Hz(t,!1,!0),Uz=t=>Hz(t,!0,!1),Wz=(t,e)=>Wm(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=yr(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),Kz=t=>Wz(t,!1),c5e=t=>Wz(t,!0),u5e=t=>Wm(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),d5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),f5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),h5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Yt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},p5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:yr(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:yr(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:Ce.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function k1(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function qz(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of k1(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(Ce.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(Ce.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const m5e=({state:t,dispatch:e})=>qz(t,e,!1),g5e=({state:t,dispatch:e})=>qz(t,e,!0);function Gz(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of k1(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const x5e=({state:t,dispatch:e})=>Gz(t,e,!1),y5e=({state:t,dispatch:e})=>Gz(t,e,!0),b5e=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(k1(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Vf(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function v5e(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Rr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(jt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const oM=Jz(!1),w5e=Jz(!0);function Jz(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&v5e(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new g1(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=BE(c,i);for(u==null&&(u=$f(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let f=["",Fp(e,u)];return l&&f.push(Fp(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Yt.of(f)},range:Ce.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eN(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const k5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new g1(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=eN(t,(i,o,a)=>{let l=BE(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Fp(t,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Zz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{r.push({from:n.from,insert:t.facet(m1)})}),{userEvent:"input.indent"})),!0),Qz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=$f(s,t.tabSize),o=0,a=Fp(t,Math.max(0,i-wu(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),C5e=t=>(t.setTabFocusMode(),!0),_5e=[{key:"Ctrl-b",run:Ez,shift:Oz,preventDefault:!0},{key:"Ctrl-f",run:Nz,shift:Lz},{key:"Ctrl-p",run:Iz,shift:$z},{key:"Ctrl-n",run:jz,shift:Bz},{key:"Ctrl-a",run:HSe,shift:t5e},{key:"Ctrl-e",run:USe,shift:n5e},{key:"Ctrl-d",run:Uz},{key:"Ctrl-h",run:V2},{key:"Ctrl-k",run:u5e},{key:"Ctrl-Alt-h",run:Kz},{key:"Ctrl-o",run:h5e},{key:"Ctrl-t",run:p5e},{key:"Ctrl-v",run:B2}],S5e=[{key:"ArrowLeft",run:Ez,shift:Oz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:PSe,shift:qSe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:VSe,shift:XSe,preventDefault:!0},{key:"ArrowRight",run:Nz,shift:Lz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:OSe,shift:GSe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zSe,shift:e5e,preventDefault:!0},{key:"ArrowUp",run:Iz,shift:$z,preventDefault:!0},{mac:"Cmd-ArrowUp",run:nM,shift:sM},{mac:"Ctrl-ArrowUp",run:XR,shift:eM},{key:"ArrowDown",run:jz,shift:Bz,preventDefault:!0},{mac:"Cmd-ArrowDown",run:rM,shift:iM},{mac:"Ctrl-ArrowDown",run:B2,shift:tM},{key:"PageUp",run:XR,shift:eM},{key:"PageDown",run:B2,shift:tM},{key:"Home",run:BSe,shift:YSe,preventDefault:!0},{key:"Mod-Home",run:nM,shift:sM},{key:"End",run:$Se,shift:QSe,preventDefault:!0},{key:"Mod-End",run:rM,shift:iM},{key:"Enter",run:oM,shift:oM},{key:"Mod-a",run:r5e},{key:"Backspace",run:V2,shift:V2,preventDefault:!0},{key:"Delete",run:Uz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:c5e,preventDefault:!0},{mac:"Mod-Backspace",run:d5e,preventDefault:!0},{mac:"Mod-Delete",run:f5e,preventDefault:!0}].concat(_5e.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),E5e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:DSe,shift:JSe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:FSe,shift:ZSe},{key:"Alt-ArrowUp",run:m5e},{key:"Shift-Alt-ArrowUp",run:x5e},{key:"Alt-ArrowDown",run:g5e},{key:"Shift-Alt-ArrowDown",run:y5e},{key:"Mod-Alt-ArrowUp",run:o5e},{key:"Mod-Alt-ArrowDown",run:a5e},{key:"Escape",run:l5e},{key:"Mod-Enter",run:w5e},{key:"Alt-l",mac:"Ctrl-l",run:s5e},{key:"Mod-i",run:i5e,preventDefault:!0},{key:"Mod-[",run:Qz},{key:"Mod-]",run:Zz},{key:"Mod-Alt-\\",run:k5e},{key:"Shift-Mod-k",run:b5e},{key:"Shift-Mod-\\",run:KSe},{key:"Mod-/",run:mSe},{key:"Alt-A",run:xSe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:C5e}].concat(S5e),N5e={key:"Tab",run:Zz,shift:Qz};function T5e(t,e,n,r){const s=Lo(Rn),i=Ms(MF),o=j.useRef(null),{lexicalNode:a}=JC(),l=j.useRef(!1),c=j.useRef(!1),u=j.useCallback(()=>{i({editorType:e,rootNode:a,editorRef:o.current})},[e,a,i]),f=j.useCallback(h=>{var p,m,g,y,v,b;if(h.key==="ArrowDown"){const w=(m=(p=o.current)==null?void 0:p.getCodemirror())==null?void 0:m.state;if(w){const k=w.doc.length,C=w.selection.ranges[0].to;k===C&&(l.current?(s==null||s.update(()=>{var _,S;const E=un(t);E.getNextSibling()?((S=(_=o.current)==null?void 0:_.getCodemirror())==null||S.contentDOM.blur(),E.selectNext()):E.insertAfter(Zt())}),l.current=!1):l.current=!0)}}else if(h.key==="ArrowUp"){const w=(y=(g=o.current)==null?void 0:g.getCodemirror())==null?void 0:y.state;w&&w.selection.ranges[0].from===0&&(c.current?(s==null||s.update(()=>{var C,_;const S=un(t);S.getPreviousSibling()&&((_=(C=o.current)==null?void 0:C.getCodemirror())==null||_.contentDOM.blur(),S.selectPrevious())}),c.current=!1):c.current=!0)}else if(h.key==="Enter")h.stopPropagation();else if(h.key==="Backspace"||h.key==="Delete"){const w=(b=(v=o.current)==null?void 0:v.getCodemirror())==null?void 0:b.state;(w==null?void 0:w.doc.length)===0&&(s==null||s.update(()=>{un(t).remove()}))}},[s,t]);return j.useEffect(()=>{const h=o.current;return setTimeout(()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.addEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.addEventListener("keydown",f)},300),()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.removeEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.removeEventListener("keydown",f)}},[o,u,f,n]),j.useEffect(()=>{r.subscribe(()=>{var h,p;(p=(h=o.current)==null?void 0:h.getCodemirror())==null||p.focus(),u()})},[r,o,t,u]),o}function Se(t){return new T2e(zE.define(t))}function tl(t){return me(()=>import("./index-C2TZTl_N.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const A5e=[ue.of({name:"C",extensions:["c","h","ino"],load(){return me(()=>import("./index-CEEBMxnv.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return me(()=>import("./index-CEEBMxnv.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return tl("Cassandra")}}),ue.of({name:"CSS",extensions:["css"],load(){return me(()=>import("./index-CdSePG6E.js"),__vite__mapDeps([5,1,2,3])).then(t=>t.css())}}),ue.of({name:"Go",extensions:["go"],load(){return me(()=>import("./index-BsiHFIJm.js"),__vite__mapDeps([6,1,2,3])).then(t=>t.go())}}),ue.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return me(()=>import("./index-Ckx8JYkK.js"),__vite__mapDeps([7,1,5,2,3,8])).then(t=>t.html())}}),ue.of({name:"Java",extensions:["java"],load(){return me(()=>import("./index-CoW269dz.js"),__vite__mapDeps([9,1,2,3])).then(t=>t.java())}}),ue.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return me(()=>import("./index-ng0s4tQG.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript())}}),ue.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return me(()=>import("./index-BIDIndTd.js"),__vite__mapDeps([10,7,1,5,2,3,8])).then(t=>t.jinja())}}),ue.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return me(()=>import("./index-CUSefK9m.js"),__vite__mapDeps([11,1,2,3])).then(t=>t.json())}}),ue.of({name:"JSX",extensions:["jsx"],load(){return me(()=>import("./index-ng0s4tQG.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0}))}}),ue.of({name:"LESS",extensions:["less"],load(){return me(()=>import("./index-BIjAaMNk.js"),__vite__mapDeps([12,5,1,2,3])).then(t=>t.less())}}),ue.of({name:"Liquid",extensions:["liquid"],load(){return me(()=>import("./index-DVaYozZI.js"),__vite__mapDeps([13,7,1,5,2,3,8])).then(t=>t.liquid())}}),ue.of({name:"MariaDB SQL",load(){return tl("MariaSQL")}}),ue.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return me(()=>import("./index-DMu9cBdQ.js"),__vite__mapDeps([14,7,1,5,2,3,8])).then(t=>t.markdown())}}),ue.of({name:"MS SQL",load(){return tl("MSSQL")}}),ue.of({name:"MySQL",load(){return tl("MySQL")}}),ue.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return me(()=>import("./index-BQZO50JG.js"),__vite__mapDeps([15,1,7,5,2,3,8])).then(t=>t.php())}}),ue.of({name:"PLSQL",extensions:["pls"],load(){return tl("PLSQL")}}),ue.of({name:"PostgreSQL",load(){return tl("PostgreSQL")}}),ue.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return me(()=>import("./index-CLTXrXZH.js"),__vite__mapDeps([16,1,2,3])).then(t=>t.python())}}),ue.of({name:"Rust",extensions:["rs"],load(){return me(()=>import("./index-BGxHNnyR.js"),__vite__mapDeps([17,1,2,3])).then(t=>t.rust())}}),ue.of({name:"Sass",extensions:["sass"],load(){return me(()=>import("./index-D2FFUjfA.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass({indented:!0}))}}),ue.of({name:"SCSS",extensions:["scss"],load(){return me(()=>import("./index-D2FFUjfA.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass())}}),ue.of({name:"SQL",extensions:["sql"],load(){return tl("StandardSQL")}}),ue.of({name:"SQLite",load(){return tl("SQLite")}}),ue.of({name:"TSX",extensions:["tsx"],load(){return me(()=>import("./index-ng0s4tQG.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),ue.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return me(()=>import("./index-ng0s4tQG.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({typescript:!0}))}}),ue.of({name:"WebAssembly",extensions:["wat","wast"],load(){return me(()=>import("./index-DGGohXwz.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),ue.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return me(()=>import("./index-C52kqTEK.js"),__vite__mapDeps([20,1,2,3])).then(t=>t.xml())}}),ue.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return me(()=>import("./index-CM49tscV.js"),__vite__mapDeps([21,1,2,3])).then(t=>t.yaml())}}),ue.of({name:"APL",extensions:["dyalog","apl"],load(){return me(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>Se(t.apl))}}),ue.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return me(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>Se(t.asciiArmor))}}),ue.of({name:"ASN.1",extensions:["asn","asn1"],load(){return me(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>Se(t.asn1({})))}}),ue.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return me(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>Se(t.asterisk))}}),ue.of({name:"Brainfuck",extensions:["b","bf"],load(){return me(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>Se(t.brainfuck))}}),ue.of({name:"Cobol",extensions:["cob","cpy"],load(){return me(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>Se(t.cobol))}}),ue.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.csharp))}}),ue.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"ClojureScript",extensions:["cljs"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return me(()=>import("./css-BnMrqG3P.js"),[]).then(t=>Se(t.gss))}}),ue.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return me(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>Se(t.cmake))}}),ue.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return me(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>Se(t.coffeeScript))}}),ue.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return me(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>Se(t.commonLisp))}}),ue.of({name:"Cypher",extensions:["cyp","cypher"],load(){return me(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>Se(t.cypher))}}),ue.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return me(()=>import("./python-BuPzkPfP.js"),[]).then(t=>Se(t.cython))}}),ue.of({name:"Crystal",extensions:["cr"],load(){return me(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>Se(t.crystal))}}),ue.of({name:"D",extensions:["d"],load(){return me(()=>import("./d-pRatUO7H.js"),[]).then(t=>Se(t.d))}}),ue.of({name:"Dart",extensions:["dart"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.dart))}}),ue.of({name:"diff",extensions:["diff","patch"],load(){return me(()=>import("./diff-DbItnlRl.js"),[]).then(t=>Se(t.diff))}}),ue.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return me(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([22,23])).then(t=>Se(t.dockerFile))}}),ue.of({name:"DTD",extensions:["dtd"],load(){return me(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>Se(t.dtd))}}),ue.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return me(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>Se(t.dylan))}}),ue.of({name:"EBNF",load(){return me(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>Se(t.ebnf))}}),ue.of({name:"ECL",extensions:["ecl"],load(){return me(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>Se(t.ecl))}}),ue.of({name:"edn",extensions:["edn"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Eiffel",extensions:["e"],load(){return me(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>Se(t.eiffel))}}),ue.of({name:"Elm",extensions:["elm"],load(){return me(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>Se(t.elm))}}),ue.of({name:"Erlang",extensions:["erl"],load(){return me(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>Se(t.erlang))}}),ue.of({name:"Esper",load(){return me(()=>import("./sql-D0XecflT.js"),[]).then(t=>Se(t.esper))}}),ue.of({name:"Factor",extensions:["factor"],load(){return me(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([24,23])).then(t=>Se(t.factor))}}),ue.of({name:"FCL",load(){return me(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>Se(t.fcl))}}),ue.of({name:"Forth",extensions:["forth","fth","4th"],load(){return me(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>Se(t.forth))}}),ue.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return me(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>Se(t.fortran))}}),ue.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.fSharp))}}),ue.of({name:"Gas",extensions:["s"],load(){return me(()=>import("./gas-Bneqetm1.js"),[]).then(t=>Se(t.gas))}}),ue.of({name:"Gherkin",extensions:["feature"],load(){return me(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>Se(t.gherkin))}}),ue.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return me(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>Se(t.groovy))}}),ue.of({name:"Haskell",extensions:["hs"],load(){return me(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>Se(t.haskell))}}),ue.of({name:"Haxe",extensions:["hx"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.haxe))}}),ue.of({name:"HXML",extensions:["hxml"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.hxml))}}),ue.of({name:"HTTP",load(){return me(()=>import("./http-DBlCnlav.js"),[]).then(t=>Se(t.http))}}),ue.of({name:"IDL",extensions:["pro"],load(){return me(()=>import("./idl-BEugSyMb.js"),[]).then(t=>Se(t.idl))}}),ue.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return me(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>Se(t.jsonld))}}),ue.of({name:"Julia",extensions:["jl"],load(){return me(()=>import("./julia-DuME0IfC.js"),[]).then(t=>Se(t.julia))}}),ue.of({name:"Kotlin",extensions:["kt","kts"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.kotlin))}}),ue.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return me(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>Se(t.liveScript))}}),ue.of({name:"Lua",extensions:["lua"],load(){return me(()=>import("./lua-BgMRiT3U.js"),[]).then(t=>Se(t.lua))}}),ue.of({name:"mIRC",extensions:["mrc"],load(){return me(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>Se(t.mirc))}}),ue.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return me(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>Se(t.mathematica))}}),ue.of({name:"Modelica",extensions:["mo"],load(){return me(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>Se(t.modelica))}}),ue.of({name:"MUMPS",extensions:["mps"],load(){return me(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>Se(t.mumps))}}),ue.of({name:"Mbox",extensions:["mbox"],load(){return me(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>Se(t.mbox))}}),ue.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return me(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>Se(t.nginx))}}),ue.of({name:"NSIS",extensions:["nsh","nsi"],load(){return me(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([25,23])).then(t=>Se(t.nsis))}}),ue.of({name:"NTriples",extensions:["nt","nq"],load(){return me(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>Se(t.ntriples))}}),ue.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveC))}}),ue.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveCpp))}}),ue.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.oCaml))}}),ue.of({name:"Octave",extensions:["m"],load(){return me(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>Se(t.octave))}}),ue.of({name:"Oz",extensions:["oz"],load(){return me(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>Se(t.oz))}}),ue.of({name:"Pascal",extensions:["p","pas"],load(){return me(()=>import("./pascal--L3eBynH.js"),[]).then(t=>Se(t.pascal))}}),ue.of({name:"Perl",extensions:["pl","pm"],load(){return me(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>Se(t.perl))}}),ue.of({name:"Pig",extensions:["pig"],load(){return me(()=>import("./pig-CevX1Tat.js"),[]).then(t=>Se(t.pig))}}),ue.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return me(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>Se(t.powerShell))}}),ue.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return me(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>Se(t.properties))}}),ue.of({name:"ProtoBuf",extensions:["proto"],load(){return me(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>Se(t.protobuf))}}),ue.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return me(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([26,27])).then(t=>Se(t.pug))}}),ue.of({name:"Puppet",extensions:["pp"],load(){return me(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>Se(t.puppet))}}),ue.of({name:"Q",extensions:["q"],load(){return me(()=>import("./q-pXgVlZs6.js"),[]).then(t=>Se(t.q))}}),ue.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return me(()=>import("./r-B6wPVr8A.js"),[]).then(t=>Se(t.r))}}),ue.of({name:"RPM Changes",load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmChanges))}}),ue.of({name:"RPM Spec",extensions:["spec"],load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmSpec))}}),ue.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return me(()=>import("./ruby-B2Rjki9n.js"),[]).then(t=>Se(t.ruby))}}),ue.of({name:"SAS",extensions:["sas"],load(){return me(()=>import("./sas-B4kiWyti.js"),[]).then(t=>Se(t.sas))}}),ue.of({name:"Scala",extensions:["scala"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.scala))}}),ue.of({name:"Scheme",extensions:["scm","ss"],load(){return me(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>Se(t.scheme))}}),ue.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return me(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>Se(t.shell))}}),ue.of({name:"Sieve",extensions:["siv","sieve"],load(){return me(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>Se(t.sieve))}}),ue.of({name:"Smalltalk",extensions:["st"],load(){return me(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>Se(t.smalltalk))}}),ue.of({name:"Solr",load(){return me(()=>import("./solr-DehyRSwq.js"),[]).then(t=>Se(t.solr))}}),ue.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.sml))}}),ue.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return me(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>Se(t.sparql))}}),ue.of({name:"Spreadsheet",alias:["excel","formula"],load(){return me(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>Se(t.spreadsheet))}}),ue.of({name:"Squirrel",extensions:["nut"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.squirrel))}}),ue.of({name:"Stylus",extensions:["styl"],load(){return me(()=>import("./stylus-B533Al4x.js"),[]).then(t=>Se(t.stylus))}}),ue.of({name:"Swift",extensions:["swift"],load(){return me(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>Se(t.swift))}}),ue.of({name:"sTeX",load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"Tcl",extensions:["tcl"],load(){return me(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>Se(t.tcl))}}),ue.of({name:"Textile",extensions:["textile"],load(){return me(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>Se(t.textile))}}),ue.of({name:"TiddlyWiki",load(){return me(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>Se(t.tiddlyWiki))}}),ue.of({name:"Tiki wiki",load(){return me(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>Se(t.tiki))}}),ue.of({name:"TOML",extensions:["toml"],load(){return me(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>Se(t.toml))}}),ue.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return me(()=>import("./troff-wAsdV37c.js"),[]).then(t=>Se(t.troff))}}),ue.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return me(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>Se(t.ttcn))}}),ue.of({name:"TTCN_CFG",extensions:["cfg"],load(){return me(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>Se(t.ttcnCfg))}}),ue.of({name:"Turtle",extensions:["ttl"],load(){return me(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>Se(t.turtle))}}),ue.of({name:"Web IDL",extensions:["webidl"],load(){return me(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>Se(t.webIDL))}}),ue.of({name:"VB.NET",extensions:["vb"],load(){return me(()=>import("./vb-CmGdzxic.js"),[]).then(t=>Se(t.vb))}}),ue.of({name:"VBScript",extensions:["vbs"],load(){return me(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>Se(t.vbScript))}}),ue.of({name:"Velocity",extensions:["vtl"],load(){return me(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>Se(t.velocity))}}),ue.of({name:"Verilog",extensions:["v"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return me(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>Se(t.vhdl))}}),ue.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return me(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>Se(t.xQuery))}}),ue.of({name:"Yacas",extensions:["ys"],load(){return me(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>Se(t.yacas))}}),ue.of({name:"Z80",extensions:["z80"],load(){return me(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>Se(t.z80))}}),ue.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.mscgen))}}),ue.of({name:"Xù",extensions:["xu"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.xu))}}),ue.of({name:"MsGenny",extensions:["msgenny"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.msgenny))}}),ue.of({name:"Vue",extensions:["vue"],load(){return me(()=>import("./index-CMLLY6ho.js"),__vite__mapDeps([28,7,1,5,2,3,8])).then(t=>t.vue())}}),ue.of({name:"Angular Template",load(){return me(()=>import("./index-Dd66DjY-.js"),__vite__mapDeps([29,7,1,5,2,3,8])).then(t=>t.angular())}})],aM="#2e3440",tN="#3b4252",lM="#434c5e",Qg="#4c566a",cM="#e5e9f0",z2="#eceff4",iw="#8fbcbb",uM="#88c0d0",I5e="#81a1c1",ki="#5e81ac",j5e="#bf616a",Qu="#d08770",ow="#ebcb8b",dM="#a3be8c",R5e="#b48ead",fM="#d30102",nN=z2,aw=nN,M5e="#ffffff",lw=tN,P5e=nN,hM=tN,O5e=He.theme({"&":{color:aM,backgroundColor:M5e},".cm-content":{caretColor:hM},".cm-cursor, .cm-dropCursor":{borderLeftColor:hM},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:P5e},".cm-panels":{backgroundColor:nN,color:Qg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Qg}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:cM},".cm-activeLine":{backgroundColor:aw},".cm-selectionMatch":{backgroundColor:cM},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Qg}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:z2},".cm-gutters":{backgroundColor:z2,color:aM,border:"none"},".cm-activeLineGutter":{backgroundColor:aw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lw,borderBottomColor:lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aw,color:Qg}}},{dark:!1}),L5e=Hm.define([{tag:pe.keyword,color:ki},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:Qu},{tag:[pe.variableName],color:Qu},{tag:[pe.function(pe.variableName)],color:ki},{tag:[pe.labelName],color:I5e},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:ki},{tag:[pe.definition(pe.name),pe.separator],color:dM},{tag:[pe.brace],color:iw},{tag:[pe.annotation],color:fM},{tag:[pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:uM},{tag:[pe.typeName,pe.className],color:ow},{tag:[pe.operator,pe.operatorKeyword],color:dM},{tag:[pe.tagName],color:R5e},{tag:[pe.squareBracket],color:j5e},{tag:[pe.angleBracket],color:Qu},{tag:[pe.attributeName],color:ow},{tag:[pe.regexp],color:ki},{tag:[pe.quote],color:tN},{tag:[pe.string],color:Qu},{tag:pe.link,color:iw,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[pe.url,pe.escape,pe.special(pe.string)],color:Qu},{tag:[pe.meta],color:uM},{tag:[pe.comment],color:lM,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold",color:ki},{tag:pe.emphasis,fontStyle:"italic",color:ki},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.heading,fontWeight:"bold",color:ki},{tag:pe.special(pe.heading1),fontWeight:"bold",color:ki},{tag:pe.heading1,fontWeight:"bold",color:ki},{tag:[pe.heading2,pe.heading3,pe.heading4],fontWeight:"bold",color:ki},{tag:[pe.heading5,pe.heading6],color:ki},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:Qu},{tag:[pe.processingInstruction,pe.inserted],color:iw},{tag:[pe.contentSeparator],color:ow},{tag:pe.invalid,color:lM,borderBottom:`1px dotted ${fM}`}]),D5e=[O5e,YV(L5e)],pM=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class mf{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(pM(a)):pM,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return xs(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=xE(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=vo(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(mf.prototype[Symbol.iterator]=function(){return this});const Yz={from:-1,to:-1,match:/.*/.exec("")},rN="gm"+(/x/.unicode==null?"":"u");class Xz{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Yz,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new eH(e,n,r,s,i);this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=_y(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=_y(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const cw=new WeakMap;class Md{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=cw.get(e);if(!s||s.from>=r||s.to<=n){let a=new Md(n,e.sliceString(n,r));return cw.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),cw.set(e,new Md(o,i)),new Md(n,i.slice(n-o,r-o))}}class eH{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=Yz,this.matchPos=_y(e,s),this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Md.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=_y(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Md.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xz.prototype[Symbol.iterator]=eH.prototype[Symbol.iterator]=function(){return this});function F5e(t){try{return new RegExp(t,rN),!0}catch{return!1}}function _y(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const $5e=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:s}=zCe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,f]=o,h=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let y=p/100;l&&(y=y*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*y)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),g=Ce.cursor(m.from+Math.max(0,Math.min(h,m.length)));t.dispatch({effects:[r,He.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},B5e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V5e=Ue.define({combine(t){return Wo(t,B5e,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function z5e(t){return[q5e,K5e]}const H5e=ht.mark({class:"cm-selectionMatch"}),U5e=ht.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function mM(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Mn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Mn.Word)}function W5e(t,e,n,r){return t(e.sliceDoc(n,n+1))==Mn.Word&&t(e.sliceDoc(r-1,r))==Mn.Word}const K5e=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(V5e),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ht.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ht.none;let l=n.wordAt(s.head);if(!l)return ht.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ht.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(mM(o,n,s.from,s.to)&&W5e(o,n,s.from,s.to)))return ht.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ht.none}let a=[];for(let l of t.visibleRanges){let c=new mf(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!o||mM(o,n,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(U5e.range(u,f)):(u>=s.to||f<=s.from)&&a.push(H5e.range(u,f)),a.length>e.maxMatches))return ht.none}}return ht.set(a)}},{decorations:t=>t.decorations}),q5e=He.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),G5e=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function J5e(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new mf(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new mf(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Z5e=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return G5e({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=J5e(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:He.scrollIntoView(s.to)})),!0):!1},zf=Ue.define({combine(t){return Wo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uEe(e),scrollToMatch:e=>He.scrollIntoView(e)})}});class tH{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||F5e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
772
|
+
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,a=this.lineAfter(o);n+=a,r=o+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let o=this.ranges[++this.rangeIndex].from;n+=o-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let a=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==n?this.chunk[o+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,o=new nz(n,e?e.state.tabSize:4,e?wu(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=sz(i.token,o,this.state);if(a&&(s=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=gn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:g_e,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new gn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new gn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function sz(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const UE=Object.create(null),$p=[ls.none],g_e=new LE($p),zR=[],HR=Object.create(null),iz=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])iz[t]=az(UE,e);class oz{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),iz)}resolve(e){return e?this.table[e]||(this.table[e]=az(this.extra,e)):0}}const x_e=new oz(UE);function ew(t,e){zR.indexOf(t)>-1||(zR.push(t),console.warn(e))}function az(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||pe[c];u?typeof u=="function"?l.length?l=l.map(u):ew(c,`Modifier ${c} used at start of tag`):l.length?ew(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:ew(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=HR[s];if(i)return i.id;let o=HR[s]=ls.define({id:$p.length,name:r,props:[v2e({[r]:n})]});return $p.push(o),o.id}function y_e(t,e){let n=ls.define({id:$p.length,name:"Document",props:[jc.add(()=>t),VV.add(()=>r=>e.getIndent(r))],top:!0});return $p.push(n),n}mn.RTL,mn.LTR;class lz{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Rr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(cz(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function UR(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function b_e(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=UR(e)+UR(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function v_e(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:b_e(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function $Me(t,e){return n=>{for(let r=Rr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class WR{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function qc(t){return t.selection.main.from}function cz(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const WE=Ga.define();function w_e(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Ce.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const KR=new WeakMap;function k_e(t){if(!Array.isArray(t))return t;let e=KR.get(t);return e||KR.set(t,e=v_e(t)),e}const wy=yt.define(),Bp=yt.define();class C_e{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=xs(e,n),s=vo(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(xs(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let b=xs(e,0),w=vo(b),k=w==e.length?0:-100;if(b!=n[0])if(b==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,w=Math.min(e.length,200);b<w&&c<l;){let k=xs(e,b);(k==n[c]||k==r[c])&&(s[c++]=b),b+=vo(k)}if(c<l)return null}let u=0,f=0,h=!1,p=0,m=-1,g=-1,y=/[a-z]/.test(e),v=!0;for(let b=0,w=Math.min(e.length,200),k=0;b<w&&f<l;){let C=xs(e,b);a<0&&(u<l&&C==n[u]&&(i[u++]=b),p<l&&(C==n[p]||C==r[p]?(p==0&&(m=b),g=b+1,p++):p=0));let _,S=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(_=xE(C))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!b||S==1&&y||k==0&&S!=0)&&(n[f]==C||r[f]==C&&(h=!0)?o[f++]=b:o.length&&(v=!1)),k=S,b+=vo(C)}return f==l&&o[0]==0&&v?this.result(-100+(h?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?vo(xs(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class __e{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const xr=Ue.define({combine(t){return Wo(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:S_e,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>qR(e(r),n(r)),optionClass:(e,n)=>r=>qR(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function qR(t,e){return t?e?t+" "+e:t:e}function S_e(t,e,n,r,s,i){let o=t.textDirection==mn.RTL,a=o,l=!1,c="top",u,f,h=e.left-s.left,p=s.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(a&&h<Math.min(m,p)?a=!1:!a&&p<Math.min(m,h)&&(a=!0),m<=(a?h:p))u=Math.max(s.top,Math.min(n.top,s.bottom-g))-e.top,f=Math.min(400,a?h:p);else{l=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let b=s.bottom-e.bottom;b>=g||b>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let y=(e.bottom-e.top)/i.offsetHeight,v=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function E_e(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],f=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(u,f))),h.className="cm-completionMatchedText",l=f}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function tw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class N_e{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(xr);this.optionContent=E_e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=tw(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(xr).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bp.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=tw(i.length,o,e.state.facet(xr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=tw(n.options.length,n.selected,this.view.state.facet(xr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>vs(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&A_e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(xr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let h=typeof c=="string"?c:c.name;if(h!=i&&(o>r.from||r.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=h}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let h of this.optionContent){let p=h(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function T_e(t,e){return n=>new N_e(n,t,e)}function A_e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function GR(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function I_e(t,e){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},o=e.facet(xr);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)i(new WR(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),p,m=o.filterStrict?new __e(h):new C_e(h);for(let g of u.result.options)if(p=m.match(g.label)){let y=g.displayLabel?f?f(g,p.matched):[]:p.matched,v=p.score+(g.boost||0);if(i(new WR(g,u.source,y,v)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:b}=g.section;s||(s=Object.create(null)),s[b]=Math.max(v,s[b]||-1e9)}}}}if(r){let u=Object.create(null),f=0,h=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(h))f-=1e5,u[p.name]=f;for(let p of n){let{section:m}=p.completion;m&&(p.score+=u[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||c(f.completion,h.completion))){let f=u.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(u):GR(u.completion)>GR(l)&&(a[a.length-1]=u),l=u.completion}return a}class xd{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new xd(this.options,JR(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=I_e(e,n);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(xr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new xd(a,JR(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:L_e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new xd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ky{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new ky(P_e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(xr),i=(r.override||n.languageDataAt("autocomplete",qc(n)).map(k_e)).map(l=>(this.active.find(u=>u.source==l)||new ri(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(KE));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!j_e(i,this.active)||a?o=xd.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new ri(l.source,0):l));for(let l of e.effects)l.is(dz)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new ky(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?R_e:M_e}}function j_e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const R_e={"aria-autocomplete":"list"},M_e={};function JR(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const P_e=[];function uz(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(WE);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ri{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=uz(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ri(s.source,0)),r&4&&s.state==0&&(s=new ri(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(wy))s=new ri(s.source,1,i.value);else if(i.is(Bp))s=new ri(s.source,0);else if(i.is(KE))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(qc(e.state))}}class Rd extends ri{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=qc(e.state);if(a>o||!s||n&2&&(qc(e.startState)==this.from||a<this.limit))return new ri(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return O_e(s.validFor,e.state,i,o)?new Rd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new lz(e.state,a,!1)))?new Rd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:qc(e.state)):new ri(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rd(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ri(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function O_e(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):cz(t,!0).test(s)}const KE=yt.define({map(t,e){return t.map(n=>n.map(e))}}),dz=yt.define(),ys=vr.define({create(){return ky.start()},update(t,e){return t.update(e)},provide:t=>[PE.from(t,e=>e.tooltip),He.contentAttributes.from(t,e=>e.attrs)]});function qE(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ys).active.find(s=>s.source==e.source);return r instanceof Rd?(typeof n=="string"?t.dispatch({...w_e(t.state,n,r.from,r.to),annotations:WE.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const L_e=T_e(ys,qE);function Jg(t,e="option"){return n=>{let r=n.state.field(ys,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(xr).interactionDelay)return!1;let s=1,i;e=="page"&&(i=EV(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:dz.of(a)}),!0}}const D_e=t=>{let e=t.state.field(ys,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(xr).interactionDelay?!1:qE(t,e.open.options[e.open.selected])},nw=t=>t.state.field(ys,!1)?(t.dispatch({effects:wy.of(!0)}),!0):!1,F_e=t=>{let e=t.state.field(ys,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Bp.of(null)}),!0)};class $_e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const B_e=50,V_e=1e3,z_e=nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ys).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ys),n=t.state.facet(xr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ys)==e)return;let r=t.transactions.some(i=>{let o=uz(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>B_e&&Date.now()-o.time>V_e){for(let a of o.context.abortListeners)try{a()}catch(l){vs(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(wy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ys);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=qc(e),r=new lz(e,n,t.explicit,this.view),s=new $_e(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Bp.of(null)}),vs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(xr),r=this.view.state.field(ys);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=qc(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Rd(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new ri(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:KE.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ys,!1);if(e&&e.tooltip&&this.view.state.facet(xr).closeOnBlur){let n=e.open&&EV(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Bp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wy.of(!1)}),20),this.composing=0}}}),H_e=typeof navigator=="object"&&/Win/.test(navigator.platform),U_e=lc.highest(He.domEventHandlers({keydown(t,e){let n=e.state.field(ys,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(H_e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&qE(e,r),!1}})),fz=He.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class W_e{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class GE{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ar.TrackDel),r=e.mapPos(this.to,1,Ar.TrackDel);return n==null||r==null?null:new GE(this.field,n,r)}}class JE{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(m1);s.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new GE(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1,u=l.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<n.length;f++)(a!=null?n[f].seq==a:u&&n[f].name==u)&&(c=f);if(c<0){let f=0;for(;f<n.length&&(a==null||n[f].seq!=null&&n[f].seq<a);)f++;n.splice(f,0,{seq:a,name:u}),c=f;for(let h of s)h.field>=c&&h.field++}for(let f of s)if(f.line==r.length&&f.from>i.index){let h=i[2]?3+(i[1]||"").length:2;f.from-=h,f.to-=h}s.push(new W_e(c,r.length,i.index,i.index+u.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of s)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new JE(r,s)}}let K_e=ht.widget({widget:new class extends Ko{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),q_e=ht.mark({class:"cm-snippetField"});class Bf{constructor(e,n){this.ranges=e,this.active=n,this.deco=ht.set(e.map(r=>(r.from==r.to?K_e:q_e).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Bf(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const Um=yt.define({map(t,e){return t&&t.map(e)}}),G_e=yt.define(),Vp=vr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Um))return n.value;if(n.is(G_e)&&t)return new Bf(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>He.decorations.from(t,e=>e?e.deco:ht.none)});function ZE(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function J_e(t){let e=JE.parse(t);return(n,r,s,i)=>{let{text:o,ranges:a}=e.instantiate(n.state,s),{main:l}=n.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:Yt.of(o)},scrollIntoView:!0,annotations:r?[WE.of(r),Qn.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=ZE(a,0)),a.some(u=>u.field>0)){let u=new Bf(a,0),f=c.effects=[Um.of(u)];n.state.field(Vp,!1)===void 0&&f.push(yt.appendConfig.of([Vp,eSe,tSe,fz]))}n.dispatch(n.state.update(c))}}function hz(t){return({state:e,dispatch:n})=>{let r=e.field(Vp,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(o=>o.field==s+t);return n(e.update({selection:ZE(r.ranges,s),effects:Um.of(i?null:new Bf(r.ranges,s)),scrollIntoView:!0})),!0}}const Z_e=({state:t,dispatch:e})=>t.field(Vp,!1)?(e(t.update({effects:Um.of(null)})),!0):!1,Q_e=hz(1),Y_e=hz(-1),X_e=[{key:"Tab",run:Q_e,shift:Y_e},{key:"Escape",run:Z_e}],ZR=Ue.define({combine(t){return t.length?t[0]:X_e}}),eSe=lc.highest(Bm.compute([ZR],t=>t.facet(ZR)));function BMe(t,e){return{...e,apply:J_e(t)}}const tSe=He.domEventHandlers({mousedown(t,e){let n=e.state.field(Vp,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:ZE(n.ranges,s.field),effects:Um.of(n.ranges.some(i=>i.field>s.field)?new Bf(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),zp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Rc=yt.define({map(t,e){let n=e.mapPos(t,-1,Ar.TrackAfter);return n??void 0}}),QE=new class extends Hl{};QE.startSide=1;QE.endSide=-1;const pz=vr.define({create(){return Pt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Rc)&&(t=t.update({add:[QE.range(n.value,n.value+1)]}));return t}});function nSe(){return[sSe,pz]}const rw="()[]{}<>«»»«[]{}";function mz(t){for(let e=0;e<rw.length;e+=2)if(rw.charCodeAt(e)==t)return rw.charAt(e+1);return xE(t<128?t:t+1)}function gz(t,e){return t.languageDataAt("closeBrackets",e)[0]||zp}const rSe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sSe=He.inputHandler.of((t,e,n,r)=>{if((rSe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&vo(xs(r,0))==1||e!=s.from||n!=s.to)return!1;let i=aSe(t.state,r);return i?(t.dispatch(i),!0):!1}),iSe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=gz(t,t.selection.main.head).brackets||zp.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=lSe(t.doc,o.head);for(let l of r)if(l==a&&y1(t.doc,o.head)==mz(xs(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Ce.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},oSe=[{key:"Backspace",run:iSe}];function aSe(t,e){let n=gz(t,t.selection.main.head),r=n.brackets||zp.brackets;for(let s of r){let i=mz(xs(s,0));if(e==s)return i==s?dSe(t,s,r.indexOf(s+s+s)>-1,n):cSe(t,s,i,n.before||zp.before);if(e==i&&xz(t,t.selection.main.from))return uSe(t,s,i)}return null}function xz(t,e){let n=!1;return t.field(pz).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function y1(t,e){let n=t.sliceString(e,e+2);return n.slice(0,vo(xs(n,0)))}function lSe(t,e){let n=t.sliceString(e-2,e);return vo(xs(n,0))==n.length?n:n.slice(1)}function cSe(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Rc.of(o.to+e.length),range:Ce.range(o.anchor+e.length,o.head+e.length)};let a=y1(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Rc.of(o.head+e.length),range:Ce.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function uSe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&y1(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function dSe(t,e,n,r){let s=r.stringPrefixes||zp.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Rc.of(a.to+e.length),range:Ce.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=y1(t.doc,l),u;if(c==e){if(QR(t,l))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(xz(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:Ce.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=YR(t,l-2*e.length,s))>-1&&QR(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Mn.Word&&YR(t,l,s)>-1&&!fSe(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Rc.of(l+e.length),range:Ce.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function QR(t,e){let n=Rr(t).resolveInner(e+1);return n.parent&&n.from==e}function fSe(t,e,n,r){let s=Rr(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function YR(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Mn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Mn.Word)return i}return-1}function hSe(t={}){return[U_e,ys,xr.of(t),z_e,pSe,fz]}const yz=[{key:"Ctrl-Space",run:nw},{mac:"Alt-`",run:nw},{mac:"Alt-i",run:nw},{key:"Escape",run:F_e},{key:"ArrowDown",run:Jg(!0)},{key:"ArrowUp",run:Jg(!1)},{key:"PageDown",run:Jg(!0,"page")},{key:"PageUp",run:Jg(!1,"page")},{key:"Enter",run:D_e}],pSe=lc.highest(Bm.computeN([xr],t=>t.facet(xr).defaultKeymap?[yz]:[])),mSe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=XE(t.state,n.from);return r.line?gSe(t):r.block?ySe(t):!1};function YE(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const gSe=YE(wSe,0),xSe=YE(bz,0),ySe=YE((t,e)=>bz(t,e,vSe(e)),0);function XE(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const ah=50;function bSe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-ah,r),o=t.sliceDoc(s,s+ah),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,f;s-r<=2*ah?u=f=t.sliceDoc(r,s):(u=t.sliceDoc(r,r+ah),f=t.sliceDoc(s-ah,s));let h=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return u.slice(h,h+e.length)==e&&f.slice(m,m+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function vSe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function bz(t,e,n=e.selection.ranges){let r=n.map(i=>XE(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>bSe(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function wSe(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let f=e.doc.lineAt(u);if(c==null&&(c=XE(e,f.from).line,!c))continue e;if(f.from>s&&(i==o||o>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<l&&(l=h),r.push({line:f,comment:m,token:c,indent:h,empty:p,single:!1})}u=f.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:a.from+c,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const F2=Ga.define(),kSe=Ga.define(),CSe=Ue.define(),vz=Ue.define({combine(t){return Wo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),wz=vr.define({create(){return To.empty},update(t,e){let n=e.state.facet(vz),r=e.annotation(F2);if(r){let l=ws.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=Cy(u,u.length,n.minDepth,l):u=_z(u,e.startState.selection),new To(c==0?r.rest:u,c==0?u:r.rest)}let s=e.annotation(kSe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Qn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ws.fromTransaction(e),o=e.annotation(Qn.time),a=e.annotation(Qn.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new To(t.done.map(ws.fromJSON),t.undone.map(ws.fromJSON))}});function _Se(t={}){return[wz,vz.of(t),He.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?kz:e.inputType=="historyRedo"?$2:null;return r?(e.preventDefault(),r(n)):!1}})]}function b1(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(wz,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const kz=b1(0,!1),$2=b1(1,!1),SSe=b1(0,!0),ESe=b1(1,!0);class ws{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ws(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ws(e.changes&&ar.fromJSON(e.changes),[],e.mapped&&Mo.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=si;for(let s of e.startState.facet(CSe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ws(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,si)}static selection(e){return new ws(void 0,si,void 0,void 0,e)}}function Cy(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function NSe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function TSe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Cz(t,e){return t.length?e.length?t.concat(e):t:e}const si=[],ASe=200;function _z(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ASe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Cy(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ws.selection([e])]}function ISe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function sw(t,e){if(!t.length)return t;let n=t.length,r=si;for(;n;){let s=jSe(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ws.selection(r)]:si}function jSe(t,e,n){let r=Cz(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):si,n);if(!t.changes)return ws.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new ws(s,yt.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const RSe=/^(input\.type|delete)($|\.)/;class To{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new To(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||RSe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,NSe(a.changes,e.changes))||r=="input.type.compose")?o=Cy(o,o.length-1,s.minDepth,new ws(e.changes.compose(a.changes),Cz(yt.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,si)):o=Cy(o,o.length,s.minDepth,e),new To(o,si,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:si;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&TSe(i[i.length-1],e)?this:new To(_z(this.done,e),this.undone,n,r)}addMapping(e){return new To(sw(this.done,e),sw(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:F2.of({side:e,rest:ISe(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?si:s.slice(0,s.length-1);return i.mapped&&(a=sw(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:F2.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}To.empty=new To(si,si);const MSe=[{key:"Mod-z",run:kz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$2,preventDefault:!0},{key:"Mod-u",run:SSe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ESe,preventDefault:!0}];function Vf(t,e){return Ce.create(t.ranges.map(e),t.mainIndex)}function to(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function no({state:t,dispatch:e},n){let r=Vf(t.selection,n);return r.eq(t.selection,!0)?!1:(e(to(t,r)),!0)}function v1(t,e){return Ce.cursor(e?t.to:t.from)}function Sz(t,e){return no(t,n=>n.empty?t.moveByChar(n,e):v1(n,e))}function Kr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const Ez=t=>Sz(t,!Kr(t)),Nz=t=>Sz(t,Kr(t));function Tz(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):v1(n,e))}const PSe=t=>Tz(t,!Kr(t)),OSe=t=>Tz(t,Kr(t));function LSe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function w1(t,e,n){let r=Rr(t).resolveInner(e.head),s=n?jt.closedBy:jt.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;LSe(t,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?No(t,r.from,1):No(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Ce.cursor(a,n?-1:1)}const DSe=t=>no(t,e=>w1(t.state,e,!Kr(t))),FSe=t=>no(t,e=>w1(t.state,e,Kr(t)));function Az(t,e){return no(t,n=>{if(!n.empty)return v1(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Iz=t=>Az(t,!1),jz=t=>Az(t,!0);function Rz(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(He.scrollMargins)){let o=i(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function Mz(t,e){let n=Rz(t),{state:r}=t,s=Vf(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):v1(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=He.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(to(r,s),{effects:i}),!0}const XR=t=>Mz(t,!1),B2=t=>Mz(t,!0);function cc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const $Se=t=>no(t,e=>cc(t,e,!0)),BSe=t=>no(t,e=>cc(t,e,!1)),VSe=t=>no(t,e=>cc(t,e,!Kr(t))),zSe=t=>no(t,e=>cc(t,e,Kr(t))),HSe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),USe=t=>no(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function WSe(t,e,n){let r=!1,s=Vf(t.selection,i=>{let o=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.head<t.doc.length&&No(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ce.cursor(a)});return r?(e(to(t,s)),!0):!1}const KSe=({state:t,dispatch:e})=>WSe(t,e);function yi(t,e){let n=Vf(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function Pz(t,e){return yi(t,n=>t.moveByChar(n,e))}const Oz=t=>Pz(t,!Kr(t)),Lz=t=>Pz(t,Kr(t));function Dz(t,e){return yi(t,n=>t.moveByGroup(n,e))}const qSe=t=>Dz(t,!Kr(t)),GSe=t=>Dz(t,Kr(t)),JSe=t=>yi(t,e=>w1(t.state,e,!Kr(t))),ZSe=t=>yi(t,e=>w1(t.state,e,Kr(t)));function Fz(t,e){return yi(t,n=>t.moveVertically(n,e))}const $z=t=>Fz(t,!1),Bz=t=>Fz(t,!0);function Vz(t,e){return yi(t,n=>t.moveVertically(n,e,Rz(t).height))}const eM=t=>Vz(t,!1),tM=t=>Vz(t,!0),QSe=t=>yi(t,e=>cc(t,e,!0)),YSe=t=>yi(t,e=>cc(t,e,!1)),XSe=t=>yi(t,e=>cc(t,e,!Kr(t))),e5e=t=>yi(t,e=>cc(t,e,Kr(t))),t5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),n5e=t=>yi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),nM=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),rM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),sM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),iM=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),r5e=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),s5e=({state:t,dispatch:e})=>{let n=k1(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},i5e=({state:t,dispatch:e})=>{let n=Vf(t.selection,r=>{let s=Rr(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Ce.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function zz(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Ce.create(s,s.length-1))),!0)}const o5e=t=>zz(t,!1),a5e=t=>zz(t,!0),l5e=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Wm(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=Zg(t,l,!1)):l>o&&(n="delete.forward",l=Zg(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Zg(t,o,!1),a=Zg(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ce.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?He.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zg(t,e,n){if(t instanceof He)for(let r of t.state.facet(He.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const Hz=(t,e,n)=>Wm(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=$f(a,i.tabSize),u=c%wu(i)||wu(i);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;l=s}else l=yr(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=yr(o.text,l-o.from,!1,!1)+o.from);return l}),V2=t=>Hz(t,!1,!0),Uz=t=>Hz(t,!0,!1),Wz=(t,e)=>Wm(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=yr(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),Kz=t=>Wz(t,!1),c5e=t=>Wz(t,!0),u5e=t=>Wm(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),d5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),f5e=t=>Wm(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),h5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Yt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},p5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:yr(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:yr(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:Ce.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function k1(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function qz(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of k1(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(Ce.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(Ce.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const m5e=({state:t,dispatch:e})=>qz(t,e,!1),g5e=({state:t,dispatch:e})=>qz(t,e,!0);function Gz(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of k1(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const x5e=({state:t,dispatch:e})=>Gz(t,e,!1),y5e=({state:t,dispatch:e})=>Gz(t,e,!0),b5e=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(k1(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Vf(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function v5e(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Rr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(jt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const oM=Jz(!1),w5e=Jz(!0);function Jz(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&v5e(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new g1(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=BE(c,i);for(u==null&&(u=$f(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let f=["",Fp(e,u)];return l&&f.push(Fp(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Yt.of(f)},range:Ce.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eN(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const k5e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new g1(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=eN(t,(i,o,a)=>{let l=BE(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Fp(t,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Zz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{r.push({from:n.from,insert:t.facet(m1)})}),{userEvent:"input.indent"})),!0),Qz=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(eN(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=$f(s,t.tabSize),o=0,a=Fp(t,Math.max(0,i-wu(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),C5e=t=>(t.setTabFocusMode(),!0),_5e=[{key:"Ctrl-b",run:Ez,shift:Oz,preventDefault:!0},{key:"Ctrl-f",run:Nz,shift:Lz},{key:"Ctrl-p",run:Iz,shift:$z},{key:"Ctrl-n",run:jz,shift:Bz},{key:"Ctrl-a",run:HSe,shift:t5e},{key:"Ctrl-e",run:USe,shift:n5e},{key:"Ctrl-d",run:Uz},{key:"Ctrl-h",run:V2},{key:"Ctrl-k",run:u5e},{key:"Ctrl-Alt-h",run:Kz},{key:"Ctrl-o",run:h5e},{key:"Ctrl-t",run:p5e},{key:"Ctrl-v",run:B2}],S5e=[{key:"ArrowLeft",run:Ez,shift:Oz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:PSe,shift:qSe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:VSe,shift:XSe,preventDefault:!0},{key:"ArrowRight",run:Nz,shift:Lz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:OSe,shift:GSe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zSe,shift:e5e,preventDefault:!0},{key:"ArrowUp",run:Iz,shift:$z,preventDefault:!0},{mac:"Cmd-ArrowUp",run:nM,shift:sM},{mac:"Ctrl-ArrowUp",run:XR,shift:eM},{key:"ArrowDown",run:jz,shift:Bz,preventDefault:!0},{mac:"Cmd-ArrowDown",run:rM,shift:iM},{mac:"Ctrl-ArrowDown",run:B2,shift:tM},{key:"PageUp",run:XR,shift:eM},{key:"PageDown",run:B2,shift:tM},{key:"Home",run:BSe,shift:YSe,preventDefault:!0},{key:"Mod-Home",run:nM,shift:sM},{key:"End",run:$Se,shift:QSe,preventDefault:!0},{key:"Mod-End",run:rM,shift:iM},{key:"Enter",run:oM,shift:oM},{key:"Mod-a",run:r5e},{key:"Backspace",run:V2,shift:V2,preventDefault:!0},{key:"Delete",run:Uz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:c5e,preventDefault:!0},{mac:"Mod-Backspace",run:d5e,preventDefault:!0},{mac:"Mod-Delete",run:f5e,preventDefault:!0}].concat(_5e.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),E5e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:DSe,shift:JSe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:FSe,shift:ZSe},{key:"Alt-ArrowUp",run:m5e},{key:"Shift-Alt-ArrowUp",run:x5e},{key:"Alt-ArrowDown",run:g5e},{key:"Shift-Alt-ArrowDown",run:y5e},{key:"Mod-Alt-ArrowUp",run:o5e},{key:"Mod-Alt-ArrowDown",run:a5e},{key:"Escape",run:l5e},{key:"Mod-Enter",run:w5e},{key:"Alt-l",mac:"Ctrl-l",run:s5e},{key:"Mod-i",run:i5e,preventDefault:!0},{key:"Mod-[",run:Qz},{key:"Mod-]",run:Zz},{key:"Mod-Alt-\\",run:k5e},{key:"Shift-Mod-k",run:b5e},{key:"Shift-Mod-\\",run:KSe},{key:"Mod-/",run:mSe},{key:"Alt-A",run:xSe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:C5e}].concat(S5e),N5e={key:"Tab",run:Zz,shift:Qz};function T5e(t,e,n,r){const s=Lo(Rn),i=Ms(MF),o=j.useRef(null),{lexicalNode:a}=JC(),l=j.useRef(!1),c=j.useRef(!1),u=j.useCallback(()=>{i({editorType:e,rootNode:a,editorRef:o.current})},[e,a,i]),f=j.useCallback(h=>{var p,m,g,y,v,b;if(h.key==="ArrowDown"){const w=(m=(p=o.current)==null?void 0:p.getCodemirror())==null?void 0:m.state;if(w){const k=w.doc.length,C=w.selection.ranges[0].to;k===C&&(l.current?(s==null||s.update(()=>{var _,S;const E=un(t);E.getNextSibling()?((S=(_=o.current)==null?void 0:_.getCodemirror())==null||S.contentDOM.blur(),E.selectNext()):E.insertAfter(Zt())}),l.current=!1):l.current=!0)}}else if(h.key==="ArrowUp"){const w=(y=(g=o.current)==null?void 0:g.getCodemirror())==null?void 0:y.state;w&&w.selection.ranges[0].from===0&&(c.current?(s==null||s.update(()=>{var C,_;const S=un(t);S.getPreviousSibling()&&((_=(C=o.current)==null?void 0:C.getCodemirror())==null||_.contentDOM.blur(),S.selectPrevious())}),c.current=!1):c.current=!0)}else if(h.key==="Enter")h.stopPropagation();else if(h.key==="Backspace"||h.key==="Delete"){const w=(b=(v=o.current)==null?void 0:v.getCodemirror())==null?void 0:b.state;(w==null?void 0:w.doc.length)===0&&(s==null||s.update(()=>{un(t).remove()}))}},[s,t]);return j.useEffect(()=>{const h=o.current;return setTimeout(()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.addEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.addEventListener("keydown",f)},300),()=>{var p,m;(p=h==null?void 0:h.getCodemirror())==null||p.contentDOM.removeEventListener("focus",u),(m=h==null?void 0:h.getCodemirror())==null||m.contentDOM.removeEventListener("keydown",f)}},[o,u,f,n]),j.useEffect(()=>{r.subscribe(()=>{var h,p;(p=(h=o.current)==null?void 0:h.getCodemirror())==null||p.focus(),u()})},[r,o,t,u]),o}function Se(t){return new T2e(zE.define(t))}function tl(t){return me(()=>import("./index-D9rVjAIH.js"),__vite__mapDeps([0,1,2,3])).then(e=>e.sql({dialect:e[t]}))}const A5e=[ue.of({name:"C",extensions:["c","h","ino"],load(){return me(()=>import("./index-DdaDZR2v.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return me(()=>import("./index-DdaDZR2v.js"),__vite__mapDeps([4,1,2,3])).then(t=>t.cpp())}}),ue.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return tl("Cassandra")}}),ue.of({name:"CSS",extensions:["css"],load(){return me(()=>import("./index-CSgPEZIf.js"),__vite__mapDeps([5,1,2,3])).then(t=>t.css())}}),ue.of({name:"Go",extensions:["go"],load(){return me(()=>import("./index-zRyuq4cJ.js"),__vite__mapDeps([6,1,2,3])).then(t=>t.go())}}),ue.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return me(()=>import("./index-CTAGezRr.js"),__vite__mapDeps([7,1,5,2,3,8])).then(t=>t.html())}}),ue.of({name:"Java",extensions:["java"],load(){return me(()=>import("./index-Bn3GeDyS.js"),__vite__mapDeps([9,1,2,3])).then(t=>t.java())}}),ue.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript())}}),ue.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return me(()=>import("./index-BFQEyPDo.js"),__vite__mapDeps([10,7,1,5,2,3,8])).then(t=>t.jinja())}}),ue.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return me(()=>import("./index-BL5lcbji.js"),__vite__mapDeps([11,1,2,3])).then(t=>t.json())}}),ue.of({name:"JSX",extensions:["jsx"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0}))}}),ue.of({name:"LESS",extensions:["less"],load(){return me(()=>import("./index-BheLWZ0d.js"),__vite__mapDeps([12,5,1,2,3])).then(t=>t.less())}}),ue.of({name:"Liquid",extensions:["liquid"],load(){return me(()=>import("./index-BL7iND8Y.js"),__vite__mapDeps([13,7,1,5,2,3,8])).then(t=>t.liquid())}}),ue.of({name:"MariaDB SQL",load(){return tl("MariaSQL")}}),ue.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return me(()=>import("./index-eCHfIyqy.js"),__vite__mapDeps([14,7,1,5,2,3,8])).then(t=>t.markdown())}}),ue.of({name:"MS SQL",load(){return tl("MSSQL")}}),ue.of({name:"MySQL",load(){return tl("MySQL")}}),ue.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return me(()=>import("./index-CwPfxt9_.js"),__vite__mapDeps([15,1,7,5,2,3,8])).then(t=>t.php())}}),ue.of({name:"PLSQL",extensions:["pls"],load(){return tl("PLSQL")}}),ue.of({name:"PostgreSQL",load(){return tl("PostgreSQL")}}),ue.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return me(()=>import("./index-DS6VElYc.js"),__vite__mapDeps([16,1,2,3])).then(t=>t.python())}}),ue.of({name:"Rust",extensions:["rs"],load(){return me(()=>import("./index-COe0-YYa.js"),__vite__mapDeps([17,1,2,3])).then(t=>t.rust())}}),ue.of({name:"Sass",extensions:["sass"],load(){return me(()=>import("./index-Durw9xRw.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass({indented:!0}))}}),ue.of({name:"SCSS",extensions:["scss"],load(){return me(()=>import("./index-Durw9xRw.js"),__vite__mapDeps([18,1,5,2,3])).then(t=>t.sass())}}),ue.of({name:"SQL",extensions:["sql"],load(){return tl("StandardSQL")}}),ue.of({name:"SQLite",load(){return tl("SQLite")}}),ue.of({name:"TSX",extensions:["tsx"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),ue.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return me(()=>import("./index-D2G9ZSV4.js"),__vite__mapDeps([8,1,2,3])).then(t=>t.javascript({typescript:!0}))}}),ue.of({name:"WebAssembly",extensions:["wat","wast"],load(){return me(()=>import("./index-DlgNqdiq.js"),__vite__mapDeps([19,1,2,3])).then(t=>t.wast())}}),ue.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return me(()=>import("./index-COGi5Wb7.js"),__vite__mapDeps([20,1,2,3])).then(t=>t.xml())}}),ue.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return me(()=>import("./index-XVREjU0u.js"),__vite__mapDeps([21,1,2,3])).then(t=>t.yaml())}}),ue.of({name:"APL",extensions:["dyalog","apl"],load(){return me(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>Se(t.apl))}}),ue.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return me(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>Se(t.asciiArmor))}}),ue.of({name:"ASN.1",extensions:["asn","asn1"],load(){return me(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>Se(t.asn1({})))}}),ue.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return me(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>Se(t.asterisk))}}),ue.of({name:"Brainfuck",extensions:["b","bf"],load(){return me(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>Se(t.brainfuck))}}),ue.of({name:"Cobol",extensions:["cob","cpy"],load(){return me(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>Se(t.cobol))}}),ue.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.csharp))}}),ue.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"ClojureScript",extensions:["cljs"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return me(()=>import("./css-BnMrqG3P.js"),[]).then(t=>Se(t.gss))}}),ue.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return me(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>Se(t.cmake))}}),ue.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return me(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>Se(t.coffeeScript))}}),ue.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return me(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>Se(t.commonLisp))}}),ue.of({name:"Cypher",extensions:["cyp","cypher"],load(){return me(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>Se(t.cypher))}}),ue.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return me(()=>import("./python-BuPzkPfP.js"),[]).then(t=>Se(t.cython))}}),ue.of({name:"Crystal",extensions:["cr"],load(){return me(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>Se(t.crystal))}}),ue.of({name:"D",extensions:["d"],load(){return me(()=>import("./d-pRatUO7H.js"),[]).then(t=>Se(t.d))}}),ue.of({name:"Dart",extensions:["dart"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.dart))}}),ue.of({name:"diff",extensions:["diff","patch"],load(){return me(()=>import("./diff-DbItnlRl.js"),[]).then(t=>Se(t.diff))}}),ue.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return me(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([22,23])).then(t=>Se(t.dockerFile))}}),ue.of({name:"DTD",extensions:["dtd"],load(){return me(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>Se(t.dtd))}}),ue.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return me(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>Se(t.dylan))}}),ue.of({name:"EBNF",load(){return me(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>Se(t.ebnf))}}),ue.of({name:"ECL",extensions:["ecl"],load(){return me(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>Se(t.ecl))}}),ue.of({name:"edn",extensions:["edn"],load(){return me(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Se(t.clojure))}}),ue.of({name:"Eiffel",extensions:["e"],load(){return me(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>Se(t.eiffel))}}),ue.of({name:"Elm",extensions:["elm"],load(){return me(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>Se(t.elm))}}),ue.of({name:"Erlang",extensions:["erl"],load(){return me(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>Se(t.erlang))}}),ue.of({name:"Esper",load(){return me(()=>import("./sql-D0XecflT.js"),[]).then(t=>Se(t.esper))}}),ue.of({name:"Factor",extensions:["factor"],load(){return me(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([24,23])).then(t=>Se(t.factor))}}),ue.of({name:"FCL",load(){return me(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>Se(t.fcl))}}),ue.of({name:"Forth",extensions:["forth","fth","4th"],load(){return me(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>Se(t.forth))}}),ue.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return me(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>Se(t.fortran))}}),ue.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.fSharp))}}),ue.of({name:"Gas",extensions:["s"],load(){return me(()=>import("./gas-Bneqetm1.js"),[]).then(t=>Se(t.gas))}}),ue.of({name:"Gherkin",extensions:["feature"],load(){return me(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>Se(t.gherkin))}}),ue.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return me(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>Se(t.groovy))}}),ue.of({name:"Haskell",extensions:["hs"],load(){return me(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>Se(t.haskell))}}),ue.of({name:"Haxe",extensions:["hx"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.haxe))}}),ue.of({name:"HXML",extensions:["hxml"],load(){return me(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Se(t.hxml))}}),ue.of({name:"HTTP",load(){return me(()=>import("./http-DBlCnlav.js"),[]).then(t=>Se(t.http))}}),ue.of({name:"IDL",extensions:["pro"],load(){return me(()=>import("./idl-BEugSyMb.js"),[]).then(t=>Se(t.idl))}}),ue.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return me(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>Se(t.jsonld))}}),ue.of({name:"Julia",extensions:["jl"],load(){return me(()=>import("./julia-DuME0IfC.js"),[]).then(t=>Se(t.julia))}}),ue.of({name:"Kotlin",extensions:["kt","kts"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.kotlin))}}),ue.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return me(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>Se(t.liveScript))}}),ue.of({name:"Lua",extensions:["lua"],load(){return me(()=>import("./lua-BgMRiT3U.js"),[]).then(t=>Se(t.lua))}}),ue.of({name:"mIRC",extensions:["mrc"],load(){return me(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>Se(t.mirc))}}),ue.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return me(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>Se(t.mathematica))}}),ue.of({name:"Modelica",extensions:["mo"],load(){return me(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>Se(t.modelica))}}),ue.of({name:"MUMPS",extensions:["mps"],load(){return me(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>Se(t.mumps))}}),ue.of({name:"Mbox",extensions:["mbox"],load(){return me(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>Se(t.mbox))}}),ue.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return me(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>Se(t.nginx))}}),ue.of({name:"NSIS",extensions:["nsh","nsi"],load(){return me(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([25,23])).then(t=>Se(t.nsis))}}),ue.of({name:"NTriples",extensions:["nt","nq"],load(){return me(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>Se(t.ntriples))}}),ue.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveC))}}),ue.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.objectiveCpp))}}),ue.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.oCaml))}}),ue.of({name:"Octave",extensions:["m"],load(){return me(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>Se(t.octave))}}),ue.of({name:"Oz",extensions:["oz"],load(){return me(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>Se(t.oz))}}),ue.of({name:"Pascal",extensions:["p","pas"],load(){return me(()=>import("./pascal--L3eBynH.js"),[]).then(t=>Se(t.pascal))}}),ue.of({name:"Perl",extensions:["pl","pm"],load(){return me(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>Se(t.perl))}}),ue.of({name:"Pig",extensions:["pig"],load(){return me(()=>import("./pig-CevX1Tat.js"),[]).then(t=>Se(t.pig))}}),ue.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return me(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>Se(t.powerShell))}}),ue.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return me(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>Se(t.properties))}}),ue.of({name:"ProtoBuf",extensions:["proto"],load(){return me(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>Se(t.protobuf))}}),ue.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return me(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([26,27])).then(t=>Se(t.pug))}}),ue.of({name:"Puppet",extensions:["pp"],load(){return me(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>Se(t.puppet))}}),ue.of({name:"Q",extensions:["q"],load(){return me(()=>import("./q-pXgVlZs6.js"),[]).then(t=>Se(t.q))}}),ue.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return me(()=>import("./r-B6wPVr8A.js"),[]).then(t=>Se(t.r))}}),ue.of({name:"RPM Changes",load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmChanges))}}),ue.of({name:"RPM Spec",extensions:["spec"],load(){return me(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Se(t.rpmSpec))}}),ue.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return me(()=>import("./ruby-B2Rjki9n.js"),[]).then(t=>Se(t.ruby))}}),ue.of({name:"SAS",extensions:["sas"],load(){return me(()=>import("./sas-B4kiWyti.js"),[]).then(t=>Se(t.sas))}}),ue.of({name:"Scala",extensions:["scala"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.scala))}}),ue.of({name:"Scheme",extensions:["scm","ss"],load(){return me(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>Se(t.scheme))}}),ue.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return me(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>Se(t.shell))}}),ue.of({name:"Sieve",extensions:["siv","sieve"],load(){return me(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>Se(t.sieve))}}),ue.of({name:"Smalltalk",extensions:["st"],load(){return me(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>Se(t.smalltalk))}}),ue.of({name:"Solr",load(){return me(()=>import("./solr-DehyRSwq.js"),[]).then(t=>Se(t.solr))}}),ue.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return me(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Se(t.sml))}}),ue.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return me(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>Se(t.sparql))}}),ue.of({name:"Spreadsheet",alias:["excel","formula"],load(){return me(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>Se(t.spreadsheet))}}),ue.of({name:"Squirrel",extensions:["nut"],load(){return me(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Se(t.squirrel))}}),ue.of({name:"Stylus",extensions:["styl"],load(){return me(()=>import("./stylus-B533Al4x.js"),[]).then(t=>Se(t.stylus))}}),ue.of({name:"Swift",extensions:["swift"],load(){return me(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>Se(t.swift))}}),ue.of({name:"sTeX",load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return me(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Se(t.stex))}}),ue.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"Tcl",extensions:["tcl"],load(){return me(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>Se(t.tcl))}}),ue.of({name:"Textile",extensions:["textile"],load(){return me(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>Se(t.textile))}}),ue.of({name:"TiddlyWiki",load(){return me(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>Se(t.tiddlyWiki))}}),ue.of({name:"Tiki wiki",load(){return me(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>Se(t.tiki))}}),ue.of({name:"TOML",extensions:["toml"],load(){return me(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>Se(t.toml))}}),ue.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return me(()=>import("./troff-wAsdV37c.js"),[]).then(t=>Se(t.troff))}}),ue.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return me(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>Se(t.ttcn))}}),ue.of({name:"TTCN_CFG",extensions:["cfg"],load(){return me(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>Se(t.ttcnCfg))}}),ue.of({name:"Turtle",extensions:["ttl"],load(){return me(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>Se(t.turtle))}}),ue.of({name:"Web IDL",extensions:["webidl"],load(){return me(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>Se(t.webIDL))}}),ue.of({name:"VB.NET",extensions:["vb"],load(){return me(()=>import("./vb-CmGdzxic.js"),[]).then(t=>Se(t.vb))}}),ue.of({name:"VBScript",extensions:["vbs"],load(){return me(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>Se(t.vbScript))}}),ue.of({name:"Velocity",extensions:["vtl"],load(){return me(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>Se(t.velocity))}}),ue.of({name:"Verilog",extensions:["v"],load(){return me(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Se(t.verilog))}}),ue.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return me(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>Se(t.vhdl))}}),ue.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return me(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>Se(t.xQuery))}}),ue.of({name:"Yacas",extensions:["ys"],load(){return me(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>Se(t.yacas))}}),ue.of({name:"Z80",extensions:["z80"],load(){return me(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>Se(t.z80))}}),ue.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.mscgen))}}),ue.of({name:"Xù",extensions:["xu"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.xu))}}),ue.of({name:"MsGenny",extensions:["msgenny"],load(){return me(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Se(t.msgenny))}}),ue.of({name:"Vue",extensions:["vue"],load(){return me(()=>import("./index-Dwmb9KgG.js"),__vite__mapDeps([28,7,1,5,2,3,8])).then(t=>t.vue())}}),ue.of({name:"Angular Template",load(){return me(()=>import("./index-CAU5OZcp.js"),__vite__mapDeps([29,7,1,5,2,3,8])).then(t=>t.angular())}})],aM="#2e3440",tN="#3b4252",lM="#434c5e",Qg="#4c566a",cM="#e5e9f0",z2="#eceff4",iw="#8fbcbb",uM="#88c0d0",I5e="#81a1c1",ki="#5e81ac",j5e="#bf616a",Qu="#d08770",ow="#ebcb8b",dM="#a3be8c",R5e="#b48ead",fM="#d30102",nN=z2,aw=nN,M5e="#ffffff",lw=tN,P5e=nN,hM=tN,O5e=He.theme({"&":{color:aM,backgroundColor:M5e},".cm-content":{caretColor:hM},".cm-cursor, .cm-dropCursor":{borderLeftColor:hM},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:P5e},".cm-panels":{backgroundColor:nN,color:Qg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Qg}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:cM},".cm-activeLine":{backgroundColor:aw},".cm-selectionMatch":{backgroundColor:cM},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Qg}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:z2},".cm-gutters":{backgroundColor:z2,color:aM,border:"none"},".cm-activeLineGutter":{backgroundColor:aw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lw,borderBottomColor:lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aw,color:Qg}}},{dark:!1}),L5e=Hm.define([{tag:pe.keyword,color:ki},{tag:[pe.name,pe.deleted,pe.character,pe.propertyName,pe.macroName],color:Qu},{tag:[pe.variableName],color:Qu},{tag:[pe.function(pe.variableName)],color:ki},{tag:[pe.labelName],color:I5e},{tag:[pe.color,pe.constant(pe.name),pe.standard(pe.name)],color:ki},{tag:[pe.definition(pe.name),pe.separator],color:dM},{tag:[pe.brace],color:iw},{tag:[pe.annotation],color:fM},{tag:[pe.number,pe.changed,pe.annotation,pe.modifier,pe.self,pe.namespace],color:uM},{tag:[pe.typeName,pe.className],color:ow},{tag:[pe.operator,pe.operatorKeyword],color:dM},{tag:[pe.tagName],color:R5e},{tag:[pe.squareBracket],color:j5e},{tag:[pe.angleBracket],color:Qu},{tag:[pe.attributeName],color:ow},{tag:[pe.regexp],color:ki},{tag:[pe.quote],color:tN},{tag:[pe.string],color:Qu},{tag:pe.link,color:iw,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[pe.url,pe.escape,pe.special(pe.string)],color:Qu},{tag:[pe.meta],color:uM},{tag:[pe.comment],color:lM,fontStyle:"italic"},{tag:pe.strong,fontWeight:"bold",color:ki},{tag:pe.emphasis,fontStyle:"italic",color:ki},{tag:pe.strikethrough,textDecoration:"line-through"},{tag:pe.heading,fontWeight:"bold",color:ki},{tag:pe.special(pe.heading1),fontWeight:"bold",color:ki},{tag:pe.heading1,fontWeight:"bold",color:ki},{tag:[pe.heading2,pe.heading3,pe.heading4],fontWeight:"bold",color:ki},{tag:[pe.heading5,pe.heading6],color:ki},{tag:[pe.atom,pe.bool,pe.special(pe.variableName)],color:Qu},{tag:[pe.processingInstruction,pe.inserted],color:iw},{tag:[pe.contentSeparator],color:ow},{tag:pe.invalid,color:lM,borderBottom:`1px dotted ${fM}`}]),D5e=[O5e,YV(L5e)],pM=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class mf{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(pM(a)):pM,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return xs(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=xE(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=vo(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(mf.prototype[Symbol.iterator]=function(){return this});const Yz={from:-1,to:-1,match:/.*/.exec("")},rN="gm"+(/x/.unicode==null?"":"u");class Xz{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Yz,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new eH(e,n,r,s,i);this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=_y(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=_y(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const cw=new WeakMap;class Md{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=cw.get(e);if(!s||s.from>=r||s.to<=n){let a=new Md(n,e.sliceString(n,r));return cw.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),cw.set(e,new Md(o,i)),new Md(n,i.slice(n-o,r-o))}}class eH{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=Yz,this.matchPos=_y(e,s),this.re=new RegExp(n,rN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Md.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=_y(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Md.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xz.prototype[Symbol.iterator]=eH.prototype[Symbol.iterator]=function(){return this});function F5e(t){try{return new RegExp(t,rN),!0}catch{return!1}}function _y(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const $5e=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:s}=zCe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,f]=o,h=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let y=p/100;l&&(y=y*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*y)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),g=Ce.cursor(m.from+Math.max(0,Math.min(h,m.length)));t.dispatch({effects:[r,He.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},B5e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V5e=Ue.define({combine(t){return Wo(t,B5e,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function z5e(t){return[q5e,K5e]}const H5e=ht.mark({class:"cm-selectionMatch"}),U5e=ht.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function mM(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Mn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Mn.Word)}function W5e(t,e,n,r){return t(e.sliceDoc(n,n+1))==Mn.Word&&t(e.sliceDoc(r-1,r))==Mn.Word}const K5e=nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(V5e),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ht.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ht.none;let l=n.wordAt(s.head);if(!l)return ht.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ht.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(mM(o,n,s.from,s.to)&&W5e(o,n,s.from,s.to)))return ht.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ht.none}let a=[];for(let l of t.visibleRanges){let c=new mf(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!o||mM(o,n,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(U5e.range(u,f)):(u>=s.to||f<=s.from)&&a.push(H5e.range(u,f)),a.length>e.maxMatches))return ht.none}}return ht.set(a)}},{decorations:t=>t.decorations}),q5e=He.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),G5e=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function J5e(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new mf(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new mf(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Z5e=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return G5e({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=J5e(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:He.scrollIntoView(s.to)})),!0):!1},zf=Ue.define({combine(t){return Wo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uEe(e),scrollToMatch:e=>He.scrollIntoView(e)})}});class tH{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||F5e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
773
773
|
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new nEe(this):new X5e(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?ud(this,s,n,r):cd(this,s,n,r)}}class nH{constructor(e){this.spec=e}}function Q5e(t,e,n){return(r,s,i,o)=>{if(n&&!n(r,s,i,o))return!1;let a=r>=o&&s<=o+i.length?i.slice(r-o,s-o):e.doc.sliceString(r,s);return t(a,e,r,s)}}function cd(t,e,n,r){let s;return t.wholeWord&&(s=Y5e(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=Q5e(t.test,e,s)),new mf(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),s)}function Y5e(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(Sy(s,n-i))!=Mn.Word||e(Ey(s,n-i))!=Mn.Word)&&(e(Ey(s,r-i))!=Mn.Word||e(Sy(s,r-i))!=Mn.Word))}class X5e extends nH{constructor(e){super(e)}nextMatch(e,n,r){let s=cd(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=cd(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=cd(this.spec,e,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=cd(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=cd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function eEe(t,e,n){return(r,s,i)=>(!n||n(r,s,i))&&t(i[0],e,r,s)}function ud(t,e,n,r){let s;return t.wholeWord&&(s=tEe(e.charCategorizer(e.selection.main.head))),t.test&&(s=eEe(t.test,e,s)),new Xz(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},n,r)}function Sy(t,e){return t.slice(yr(t,e,!1),e)}function Ey(t,e){return t.slice(e,yr(t,e))}function tEe(t){return(e,n,r)=>!r[0].length||(t(Sy(r.input,r.index))!=Mn.Word||t(Ey(r.input,r.index))!=Mn.Word)&&(t(Ey(r.input,r.index+r[0].length))!=Mn.Word||t(Sy(r.input,r.index+r[0].length))!=Mn.Word)}class nEe extends nH{nextMatch(e,n,r){let s=ud(this.spec,e,r,e.doc.length).next();return s.done&&(s=ud(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=ud(this.spec,e,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=ud(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=ud(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Hp=yt.define(),sN=yt.define(),jl=vr.define({create(t){return new uw(H2(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Hp)?t=new uw(n.value.create(),t.panel):n.is(sN)&&(t=new uw(t.query,n.value?iN:null));return t},provide:t=>Op.from(t,e=>e.panel)});class uw{constructor(e,n){this.query=e,this.panel=n}}const rEe=ht.mark({class:"cm-searchMatch"}),sEe=ht.mark({class:"cm-searchMatch cm-searchMatch-selected"}),iEe=nr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(jl))}update(t){let e=t.state.field(jl);(e!=t.startState.field(jl)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ht.none;let{view:n}=this,r=new La;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-500;)l=i[++s].to;t.highlight(n.state,a,l,(c,u)=>{let f=n.state.selection.ranges.some(h=>h.from==c&&h.to==u);r.add(c,u,f?sEe:rEe)})}return r.finish()}},{decorations:t=>t.decorations});function Km(t){return e=>{let n=e.state.field(jl,!1);return n&&n.query.spec.valid?t(e,n):iH(e)}}const Ny=Km((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(zf);return t.dispatch({selection:s,effects:[oN(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),sH(t),!0}),Ty=Km((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),o=t.state.facet(zf);return t.dispatch({selection:i,effects:[oN(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),sH(t),!0}),oEe=Km((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),aEe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new mf(t.doc,t.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(Ce.range(a.value.from,a.value.to))}return e(t.update({selection:Ce.create(i,o),userEvent:"select.search.matches"})),!0},gM=Km((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,c,u=[];o.from==r&&o.to==s&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),u.push(He.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=t.state.changes(a);return o&&(l=Ce.single(o.from,o.to).map(f),u.push(oN(t,o)),u.push(n.facet(zf).scrollToMatch(l.main,t))),t.dispatch({changes:f,selection:l,effects:u,userEvent:"input.replace"}),!0}),lEe=Km((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:o}=s;return{from:i,to:o,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:He.announce.of(r),userEvent:"input.replace.all"}),!0});function iN(t){return t.state.facet(zf).createPanel(t)}function H2(t,e){var n,r,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(zf);return new tH({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(i=e==null?void 0:e.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function rH(t){let e=OE(t,iN);return e&&e.dom.querySelector("[main-field]")}function sH(t){let e=rH(t);e&&e==t.root.activeElement&&e.select()}const iH=t=>{let e=t.state.field(jl,!1);if(e&&e.panel){let n=rH(t);if(n&&n!=t.root.activeElement){let r=H2(t.state,e.query.spec);r.valid&&t.dispatch({effects:Hp.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[sN.of(!0),e?Hp.of(H2(t.state,e.query.spec)):yt.appendConfig.of(fEe)]});return!0},oH=t=>{let e=t.state.field(jl,!1);if(!e||!e.panel)return!1;let n=OE(t,iN);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:sN.of(!1)}),!0},cEe=[{key:"Mod-f",run:iH,scope:"editor search-panel"},{key:"F3",run:Ny,shift:Ty,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ny,shift:Ty,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oH,scope:"editor search-panel"},{key:"Mod-Shift-l",run:aEe},{key:"Mod-Alt-g",run:$5e},{key:"Mod-d",run:Z5e,preventDefault:!0}];class uEe{constructor(e){this.view=e;let n=this.query=e.state.field(jl).query.spec;this.commit=this.commit.bind(this),this.searchField=ln("input",{value:n.search,placeholder:Ns(e,"Find"),"aria-label":Ns(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ln("input",{value:n.replace,placeholder:Ns(e,"Replace"),"aria-label":Ns(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ln("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ln("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ln("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return ln("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=ln("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Ny(e),[Ns(e,"next")]),r("prev",()=>Ty(e),[Ns(e,"previous")]),r("select",()=>oEe(e),[Ns(e,"all")]),ln("label",null,[this.caseField,Ns(e,"match case")]),ln("label",null,[this.reField,Ns(e,"regexp")]),ln("label",null,[this.wordField,Ns(e,"by word")]),...e.state.readOnly?[]:[ln("br"),this.replaceField,r("replace",()=>gM(e),[Ns(e,"replace")]),r("replaceAll",()=>lEe(e),[Ns(e,"replace all")])],ln("button",{name:"close",onclick:()=>oH(e),"aria-label":Ns(e,"close"),type:"button"},["×"])])}commit(){let e=new tH({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Hp.of(e)}))}keydown(e){eCe(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ty:Ny)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),gM(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Hp)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(zf).top}}function Ns(t,e){return t.state.phrase(e)}const Yg=30,Xg=/[\s\.,:;?!]/;function oN(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Yg),o=Math.min(s,n+Yg),a=t.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;l<Yg;l++)if(!Xg.test(a[l+1])&&Xg.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Yg;l--)if(!Xg.test(a[l-1])&&Xg.test(a[l])){a=a.slice(0,l);break}}return He.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const dEe=He.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),fEe=[jl,lc.low(iEe),dEe];class xM{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Ec{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(Up).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new La,a=[],l=0,c=r.doc.iter(),u=0,f=r.doc.length;for(let p=0;;){let m=p==i.length?null:i[p];if(!m&&!a.length)break;let g,y;if(a.length)g=l,y=a.reduce((w,k)=>Math.min(w,k.to),m&&m.from>g?m.from:1e8);else{if(g=m.from,g>f)break;y=m.to,a.push(m),p++}for(;p<i.length;){let w=i[p];if(w.from==g&&(w.to>w.from||w.to==g))a.push(w),p++,y=Math.min(w.to,y);else{y=Math.min(w.from,y);break}}y=Math.min(y,f);let v=!1;if(a.some(w=>w.from==g&&(w.to==y||y==f))&&(v=g==y,!v&&y-g<10)){let w=g-(u+c.value.length);w>0&&(c.next(w),u=g);for(let k=g;;){if(k>=y){v=!0;break}if(!c.lineBreak&&u+c.value.length>k)break;k=u+c.value.length,u+=c.value.length,c.next()}}let b=SEe(a);if(v)o.add(g,g,ht.widget({widget:new wEe(b),diagnostics:a.slice()}));else{let w=a.reduce((k,C)=>C.markClass?k+" "+C.markClass:k,"");o.add(g,y,ht.mark({class:"cm-lintRange cm-lintRange-"+b+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>y)}))}if(l=y,l==f)break;for(let w=0;w<a.length;w++)a[w].to<=l&&a.splice(w--,1)}let h=o.finish();return new Ec(h,n,Jl(h))}}function Jl(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new xM(s,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new xM(r.from,i,r.diagnostic)}}),r}function hEe(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(Up).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(aH))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function pEe(t,e){return t.field(Ls,!1)?e:e.concat(yt.appendConfig.of(EEe))}const aH=yt.define(),aN=yt.define(),lH=yt.define(),Ls=vr.define({create(){return new Ec(ht.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Jl(n,t.selected.diagnostic,i)||Jl(n,null,i)}!n.size&&s&&e.state.facet(Up).autoPanel&&(s=null),t=new Ec(n,s,r)}for(let n of e.effects)if(n.is(aH)){let r=e.state.facet(Up).autoPanel?n.value.length?Wp.open:null:t.panel;t=Ec.init(n.value,r,e.state)}else n.is(aN)?t=new Ec(t.diagnostics,n.value?Wp.open:null,t.selected):n.is(lH)&&(t=new Ec(t.diagnostics,t.panel,n.value));return t},provide:t=>[Op.from(t,e=>e.panel),He.decorations.from(t,e=>e.diagnostics)]}),mEe=ht.mark({class:"cm-lintRange cm-lintRange-active"});function gEe(t,e,n){let{diagnostics:r}=t.state.field(Ls),s,i=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return s=u.diagnostics,i=l,o=c,!1});let a=t.state.facet(Up).tooltipFilter;return s&&a&&(s=a(s,t.state)),s?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:xEe(t,s)}}}:null}function xEe(t,e){return ln("ul",{class:"cm-tooltip-lint"},e.map(n=>uH(t,n,!1)))}const yEe=t=>{let e=t.state.field(Ls,!1);(!e||!e.panel)&&t.dispatch({effects:pEe(t.state,[aN.of(!0)])});let n=OE(t,Wp.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},yM=t=>{let e=t.state.field(Ls,!1);return!e||!e.panel?!1:(t.dispatch({effects:aN.of(!1)}),!0)},bEe=t=>{let e=t.state.field(Ls,!1);if(!e)return!1;let n=t.state.selection.main,r=Jl(e.diagnostics,null,n.to+1);return!r&&(r=Jl(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},vEe=[{key:"Mod-Shift-m",run:yEe,preventDefault:!0},{key:"F8",run:bEe}],Up=Ue.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Wo(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bM,tooltipFilter:bM,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function bM(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function cH(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function uH(t,e,n){var r;let s=n?cH(e.actions):[];return ln("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ln("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=Jl(t.state.field(Ls).diagnostics,e);m&&i.apply(t,m.from,m.to)},{name:c}=i,u=s[o]?c.indexOf(s[o]):-1,f=u<0?c:[c.slice(0,u),ln("u",c.slice(u,u+1)),c.slice(u+1)],h=i.markClass?" "+i.markClass:"";return ln("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&ln("div",{class:"cm-diagnosticSource"},e.source))}class wEe extends Ko{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ln("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class vM{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=uH(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wp{constructor(e){this.view=e,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)yM(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=cH(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Jl(this.view.state.field(Ls).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()}},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=ln("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ln("div",{class:"cm-panel-lint"},this.list,ln("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>yM(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ls).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Ls),r=0,s=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let f=-1,h;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==u){f=p;break}f<0?(h=new vM(this.view,u),this.items.splice(r,0,h),s=!0):(h=this.items[f],f>r&&(this.items.splice(r,f-r),s=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),i=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new vM(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ls),r=Jl(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:lH.of(r)})}static open(e){return new Wp(e)}}function kEe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function ex(t){return kEe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const CEe=He.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ex("#d11")},".cm-lintRange-warning":{backgroundImage:ex("orange")},".cm-lintRange-info":{backgroundImage:ex("#999")},".cm-lintRange-hint":{backgroundImage:ex("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function _Ee(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function SEe(t){let e="hint",n=1;for(let r of t){let s=_Ee(r.severity);s>n&&(n=s,e=r.severity)}return e}const EEe=[Ls,He.decorations.compute([Ls],t=>{let{selected:e,panel:n}=t.field(Ls);return!e||!n||e.from==e.to?ht.none:ht.set([mEe.range(e.from,e.to)])}),BCe(gEe,{hideOn:hEe}),CEe],NEe=[RV(),t2e(),xCe(),_Se(),Q2e(),oCe(),dCe(),Vt.allowMultipleSelections.of(!0),D2e(),YV(t_e,{fallback:!0}),l_e(),nSe(),hSe(),ACe(),RCe(),CCe(),z5e(),Bm.of([...oSe,...E5e,...cEe,...MSe,...q2e,...yz,...vEe])],TEe=j.forwardRef(({title:t,children:e},n)=>{const r=Lo(Ou);return j.createElement(uS,{delayDuration:100},j.createElement(dS,null,j.createElement(fS,{ref:n,asChild:!0},j.createElement("span",{className:Ae.tooltipTrigger},e)),j.createElement(hS,{container:r==null?void 0:r.current},j.createElement(pS,{className:cn(Ae.tooltipContent),sideOffset:10},t))))}),AEe=j.forwardRef(({children:t,className:e,...n},r)=>j.createElement(dX,{...n,ref:r,className:cn(e,Ae.selectItem)},j.createElement(fX,null,t))),IEe=({title:t,placeholder:e,className:n})=>{const[r,s]=Xi(Ji,Ha);return j.createElement(TEe,{title:t},j.createElement(iX,{"aria-label":e,className:cn(Ae.selectTrigger,n),"data-toolbar-item":!0,disabled:r},j.createElement(oX,{placeholder:e}),j.createElement(aX,{className:Ae.selectDropdownArrow},s("arrow_drop_down"))))},jEe=({children:t,className:e=Ae.selectContainer})=>{const n=Lo(Ou);return j.createElement(lX,{container:n==null?void 0:n.current},j.createElement(cX,{className:cn(e,"mdxeditor-select-content"),onCloseAutoFocus:r=>{r.preventDefault()},position:"popper"},j.createElement(uX,{"data-editor-dropdown":!0},t)))},REe=t=>j.createElement(sX,{value:t.value||"",onValueChange:t.onChange,disabled:t.disabled},j.createElement(IEe,{title:t.triggerTitle,placeholder:t.placeholder}),j.createElement(jEe,null,t.items.map((e,n)=>e==="separator"?j.createElement(hX,{key:n}):j.createElement(AEe,{key:n,value:e.value},e.label)))),wM="__EMPTY_VALUE__",dH=({language:t,nodeKey:e,code:n,focusEmitter:r})=>{const s=Ua(),{parentEditor:i,lexicalNode:o}=JC(),[a,l,c,u,f]=Xi(Ji,W2,K2,Ha,U2),h=T5e(e,"codeblock",t,r),{setCode:p}=JC(),m=j.useRef(null),g=j.useRef(null),y=j.useRef(p);return y.current=p,h.current={getCodemirror:()=>m.current},j.useEffect(()=>{const v=g.current;return(async()=>{const b=[...l,NEe,D5e,RV(),Bm.of([N5e]),He.lineWrapping,He.updateListener.of(({state:w})=>{y.current(w.doc.toString())}),He.domEventHandlers({focus:()=>{i.update(()=>{Bn(null)})}})];if(a&&b.push(Vt.readOnly.of(!0)),t!==""&&c){const w=A5e.find(k=>k.name===t||k.alias.includes(t)||k.extensions.includes(t));if(w)try{const k=await w.load();b.push(k.extension)}catch{console.warn("failed to load language support for",t)}}v.innerHTML="",m.current=new He({parent:v,state:Vt.create({doc:n,extensions:b})}),v.addEventListener("keydown",kM)})(),()=>{var b;(b=m.current)==null||b.destroy(),m.current=null,v.removeEventListener("keydown",kM)}},[a,t,...l]),j.createElement("div",{className:Ae.codeMirrorWrapper},j.createElement("div",{className:Ae.codeMirrorToolbar},j.createElement(REe,{disabled:a,value:t,onChange:v=>{i.update(()=>{o.setLanguage(v===wM?"":v),setTimeout(()=>{i.update(()=>{o.getLatest().select()})})})},triggerTitle:s("codeBlock.selectLanguage","Select code block language"),placeholder:s("codeBlock.inlineLanguage","Language"),items:Object.entries(f).map(([v,b])=>({value:v||wM,label:b}))}),j.createElement("button",{className:Ae.iconButton,type:"button",disabled:a,title:s("codeblock.delete","Delete code block"),onClick:v=>{v.preventDefault(),i.update(()=>{o.remove()})}},u("delete_small"))),j.createElement("div",{ref:g}))};function kM(t){t.stopPropagation()}const U2=qe({js:"JavaScript",ts:"TypeScript",tsx:"TypeScript (React)",jsx:"JavaScript (React)",css:"CSS"}),MEe=Wn(t=>{t.link(t.pipe(MEe,$l(({language:e,code:n})=>({code:n,language:e,meta:""}))),aB)}),W2=qe([]),K2=qe(!0),PEe=xi({update(t,e){t.pubIn({[U2]:e==null?void 0:e.codeBlockLanguages,[W2]:(e==null?void 0:e.codeMirrorExtensions)??[],[K2]:(e==null?void 0:e.autoLoadLanguageSupport)??!0})},init(t,e){t.pubIn({[U2]:e==null?void 0:e.codeBlockLanguages,[W2]:(e==null?void 0:e.codeMirrorExtensions)??[],[Wve]:OEe((e==null?void 0:e.codeBlockLanguages)??{}),[K2]:(e==null?void 0:e.autoLoadLanguageSupport)??!0})}});function OEe(t){return{match(e,n){return Object.hasOwn(t,e??"")&&!n},priority:1,Editor:dH}}function LEe({url:t,title:e,text:n,onSubmit:r,onCancel:s,linkAutocompleteSuggestions:i,showLinkTitleField:o,showAnchorTextField:a}){const{register:l,handleSubmit:c,control:u,setValue:f,reset:h}=L$({values:{url:t,title:e,text:n}}),p=Ua();return j.createElement("form",{onSubmit:m=>{c(r)(m),m.stopPropagation(),m.preventDefault()},onReset:m=>{m.stopPropagation(),s()},onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),s())},className:cn(Ae.multiFieldForm,Ae.linkDialogEditForm)},j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-url"},p("createLink.url","URL")),j.createElement(eB,{register:l,initialInputValue:t,inputName:"url",suggestions:i,setValue:f,control:u,placeholder:p("createLink.urlPlaceholder","Select or paste an URL"),autofocus:!0})),a?j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-text",title:p("createLink.textTooltip","The text to be displayed for the link")},p("createLink.text","Anchor text")),j.createElement("input",{id:"link-text",className:Ae.textInput,size:40,...l("text")})):null,o?j.createElement("div",{className:Ae.formField},j.createElement("label",{htmlFor:"link-title",title:p("createLink.titleTooltip","The link's title attribute, shown on hover")},p("createLink.title","Link title")),j.createElement("input",{id:"link-title",className:Ae.textInput,size:40,...l("title")})):null,j.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--spacing-2)"}},j.createElement("button",{type:"submit",title:p("createLink.saveTooltip","Set URL"),"aria-label":p("createLink.saveTooltip","Set URL"),className:cn(Ae.primaryButton)},p("dialogControls.save","Save")),j.createElement("button",{type:"reset",title:p("createLink.cancelTooltip","Cancel change"),"aria-label":p("createLink.cancelTooltip","Cancel change"),className:cn(Ae.secondaryButton)},p("dialogControls.cancel","Cancel"))))}const DEe=()=>{const[t,e,n,r,s,i,o]=Xi(Ou,Rn,Ha,fs,yH,bH,wH),a=Ms(fH),l=Ms(hH),c=Ms(pH),u=Ms(mH),f=Ms(gH);j.useEffect(()=>{const v=()=>{e==null||e.getEditorState().read(()=>{a(!0)})};return window.addEventListener("resize",v),window.addEventListener("scroll",v),()=>{window.removeEventListener("resize",v),window.removeEventListener("scroll",v)}},[e,a]);const[h,p]=j.useState(!1),m=Ua();if(r.type==="inactive")return null;const g=r.rectangle,y=r.type==="preview"&&r.url.startsWith("http");return j.createElement(lb,{open:!0},j.createElement(vY,{"data-visible":r.type==="edit",className:Ae.linkDialogAnchor,style:{top:`${g.top}px`,left:`${g.left}px`,width:`${g.width}px`,height:`${g.height}px`}}),j.createElement(cb,{container:t==null?void 0:t.current},j.createElement(W9,{className:cn(Ae.linkDialogPopoverContent),sideOffset:5,onOpenAutoFocus:v=>{v.preventDefault()},key:r.linkNodeKey},r.type==="edit"&&j.createElement(LEe,{url:r.url,title:r.title,text:r.text,onSubmit:l,onCancel:c.bind(null),linkAutocompleteSuggestions:s,showLinkTitleField:o,showAnchorTextField:r.withAnchorText}),r.type==="preview"&&j.createElement(j.Fragment,null,j.createElement("a",{className:Ae.linkDialogPreviewAnchor,href:r.url,...y?{target:"_blank",rel:"noreferrer"}:{},onClick:v=>{i!==null&&(v.preventDefault(),i(r.url))},title:y?m("linkPreview.open","Open {{url}} in new window",{url:r.url}):r.url},j.createElement("span",null,r.url),y&&n("open_in_new")),j.createElement(dw,{onClick:()=>{u()},title:m("linkPreview.edit","Edit link URL"),"aria-label":m("linkPreview.edit","Edit link URL")},n("edit")),j.createElement(uS,null,j.createElement(dS,{open:h},j.createElement(fS,{asChild:!0},j.createElement(dw,{title:m("linkPreview.copyToClipboard","Copy to clipboard"),"aria-label":m("linkPreview.copyToClipboard","Copy to clipboard"),onClick:()=>{window.navigator.clipboard.writeText(r.url).then(()=>{p(!0),setTimeout(()=>{p(!1)},1e3)})}},n(h?"check":"content_copy"))),j.createElement(hS,{container:t==null?void 0:t.current},j.createElement(pS,{className:cn(Ae.tooltipContent),sideOffset:5},m("linkPreview.copied","Copied!"),j.createElement(xD,null))))),j.createElement(dw,{title:m("linkPreview.remove","Remove link"),"aria-label":m("linkPreview.remove","Remove link"),onClick:()=>{f()}},n("link_off"))),j.createElement(Y_,{className:Ae.popoverArrow}))))},dw=j.forwardRef(({className:t,...e},n)=>j.createElement("button",{className:cn(Ae.actionButton,t),ref:n,...e}));function q2(t){if(!t)return null;const e=xye(t);if(e===null)return null;const n=e.getParent();return gs(n)?n:gs(e)?e:null}const fH=Wn(),fs=qe({type:"inactive"},t=>{t.pub(kp,e=>e.registerCommand(vm,()=>t.getValue(fs).type==="preview"?(t.pub(fs,{type:"inactive"}),!0):!1,_n)),t.sub(t.pipe(Cp),e=>{e!=="rich-text"&&t.pub(fs,{type:"inactive"})}),t.pub(kp,e=>e.registerCommand(qS,n=>{if(n.key==="k"&&(a$?n.metaKey:n.ctrlKey)&&!t.getValue(Ji)){const r=Ie();return _e(r)?(t.pub(xH),n.stopPropagation(),n.preventDefault(),!0):!1}return!1},nC)),t.sub(t.pipe(mH,Fn(fs,Rn)),([,e,n])=>{if(e.type==="preview")setTimeout(()=>{n==null||n.getEditorState().read(()=>{const r=un(e.linkNodeKey),s=gs(r)?r.getTextContent().length>0&&r.getChildrenSize()<=1:!1,i=s&&r?r.getTextContent():"";t.pub(fs,{type:"edit",initialUrl:e.url,url:e.url,title:e.title,text:i,withAnchorText:s,linkNodeKey:e.linkNodeKey,rectangle:e.rectangle})})});else throw new Error("Cannot switch to edit mode when not in preview mode")}),t.sub(t.pipe(hH,Fn(Rn,fs,of)),([e,n,r,s])=>{var i,o,a;const l=((i=e.text)==null?void 0:i.trim())??"",c=((o=e.url)==null?void 0:o.trim())??"",u=((a=e.title)==null?void 0:a.trim())??"";if(c!==""){if(s!=null&&s.isCollapsed()){const f=l||u||c;n==null||n.update(()=>{const h=q2(s);if(h)if(Ii(h)){const p=Oa(c,{title:u});p.append(fn(l)),h.replace(p),p.select()}else h.setURL(c),h.setTitle(u),CM(h.getFirstChild(),l);else{const p=Oa(c,{title:u});p.append(fn(f)),If([p]),p.select()}},{discrete:!0})}else n==null||n.update(()=>{CM(s==null?void 0:s.anchor.getNode(),l)}),n==null||n.dispatchCommand(af,{url:c,title:u});t.pub(fs,{type:"preview",linkNodeKey:r.linkNodeKey,rectangle:r.rectangle,title:u,url:c})}else r.type==="edit"&&r.initialUrl!==""&&(n==null||n.dispatchCommand(af,null)),t.pub(fs,{type:"inactive"})}),t.link(t.pipe(pH,Fn(fs,Rn),$l(([,e,n])=>{if(e.type==="edit")return n==null||n.focus(),e.initialUrl===""?{type:"inactive"}:{type:"preview",url:e.initialUrl,linkNodeKey:e.linkNodeKey,rectangle:e.rectangle};throw new Error("Cannot cancel edit when not in edit mode")})),fs),t.link(t.pipe(t.combine(of,fH),Fn(Rn,fs,Ji),$l(([[e],n,r,s])=>{if(_e(e)&&n&&!s){const i=q2(e);if(!e.isCollapsed())return{type:"inactive"};if(i){const o=s$(n);return o?{type:"preview",url:i.getURL(),linkNodeKey:i.getKey(),title:i.getTitle(),rectangle:o}:{type:"inactive"}}else return{type:"inactive"}}else return{type:"inactive"}})),fs)}),hH=Wn(),pH=sc();sc();const mH=sc(),gH=sc(t=>{t.sub(t.pipe(gH,Fn(Rn)),([,e])=>{e==null||e.dispatchCommand(af,null)})}),xH=sc(t=>{t.sub(t.pipe(xH,Fn(of,Rn),ym(([,e])=>_e(e))),([,e,n])=>{n==null||n.focus(()=>{setTimeout(()=>{n.getEditorState().read(()=>{const r=q2(e),s=s$(n),i=(r==null?void 0:r.getURL())??"",o=(r==null?void 0:r.getURL())??"",a=(r==null?void 0:r.getTitle())??"",l=(r==null?void 0:r.getKey())??"",c=r?r.getTextContent().length>0&&r.getChildrenSize()<=1:!!(e!=null&&e.isCollapsed()),u=c&&r?r.getTextContent():"";t.pub(fs,{type:"edit",initialUrl:i,url:o,title:a,text:u,withAnchorText:c,linkNodeKey:l,rectangle:s})})})})})}),yH=qe([]),bH=qe(null),vH=qe(null,t=>{t.pub(kp,e=>{function n(r){const[s,i]=t.getValues([Ji,vH]);!s||i===null||e.update(()=>{const o=Fo(r.target);if(o!==null){const a=Bi(o,l=>l instanceof Wa);a!==null&&i(r,a,a.getURL())}})}return e.registerRootListener((r,s)=>{r&&r.addEventListener("click",n),s&&s.removeEventListener("click",n)})})});function CM(t,e){Re(t)&&e&&(t.setTextContent(e),t.selectStart())}const wH=qe(!0),FEe=xi({init(t,e){t.pub(Lu,(e==null?void 0:e.LinkDialog)??DEe),t.pub(bH,(e==null?void 0:e.onClickLinkCallback)??null),t.pub(vH,(e==null?void 0:e.onReadOnlyClickLinkCallback)??null),t.pub(wH,(e==null?void 0:e.showLinkTitleField)??!0)},update(t,e={}){t.pub(yH,e.linkAutocompleteSuggestions??[])}});var fw={exports:{}},_M;function $Ee(){return _M||(_M=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
774
774
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
775
775
|
*
|
|
@@ -801,7 +801,7 @@ ${l}`.trim();return[o,{kind:"tool_result",ts:e,toolUseId:_r(n.callID)||_r(n.id,r
|
|
|
801
801
|
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
802
802
|
`}),n}function t4(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function n4(t,e){const n=pAe(t,e),r=n.one(t,void 0),s=fAe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
803
803
|
`},s),i}function bAe(t,e){return t&&"run"in t?async function(n,r){const s=n4(n,{file:r,...e});await t.run(s,r)}:function(n,r){return n4(n,{file:r,...t||e})}}function r4(t){if(t)throw t}var vw,s4;function vAe(){if(s4)return vw;s4=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},i=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),f=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!f)return!1;var h;for(h in c);return typeof h>"u"||t.call(c,h)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return vw=function l(){var c,u,f,h,p,m,g=arguments[0],y=1,v=arguments.length,b=!1;for(typeof g=="boolean"&&(b=g,g=arguments[1]||{},y=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});y<v;++y)if(c=arguments[y],c!=null)for(u in c)f=a(g,u),h=a(c,u),g!==h&&(b&&h&&(i(h)||(p=s(h)))?(p?(p=!1,m=f&&s(f)?f:[]):m=f&&i(f)?f:{},o(g,{name:u,newValue:l(b,m,h)})):typeof h<"u"&&o(g,{name:u,newValue:h}));return g},vw}var wAe=vAe();const ww=em(wAe);function e_(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function kAe(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=t[++i];let f=-1;if(l){o(l);return}for(;++f<s.length;)(c[f]===null||c[f]===void 0)&&(c[f]=s[f]);s=c,u?CAe(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function CAe(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(s);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,e(o,...a))}function i(o){s(null,o)}}const ho={basename:_Ae,dirname:SAe,extname:EAe,join:NAe,sep:"/"};function _Ae(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Jm(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function SAe(t){if(Jm(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function EAe(t){Jm(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function NAe(...t){let e=-1,n;for(;++e<t.length;)Jm(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":TAe(n)}function TAe(t){Jm(t);const e=t.codePointAt(0)===47;let n=AAe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function AAe(t,e){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Jm(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const IAe={cwd:jAe};function jAe(){return"/"}function t_(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function RAe(t){if(typeof t=="string")t=new URL(t);else if(!t_(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return MAe(t)}function MAe(t){if(t.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 e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const kw=["history","path","basename","stem","extname","dirname"];class lU{constructor(e){let n;e?t_(e)?n={path:e}:typeof e=="string"||PAe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":IAe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<kw.length;){const i=kw[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)kw.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ho.basename(this.path):void 0}set basename(e){_w(e,"basename"),Cw(e,"basename"),this.path=ho.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ho.dirname(this.path):void 0}set dirname(e){i4(this.basename,"dirname"),this.path=ho.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ho.extname(this.path):void 0}set extname(e){if(Cw(e,"extname"),i4(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ho.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){t_(e)&&(e=RAe(e)),_w(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ho.basename(this.path,this.extname):void 0}set stem(e){_w(e,"stem"),Cw(e,"stem"),this.path=ho.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Qt(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Cw(t,e){if(t&&t.includes(ho.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ho.sep+"`")}function _w(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function i4(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function PAe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const OAe=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),LAe={}.hasOwnProperty;class kN extends OAe{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=kAe()}copy(){const e=new kN;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(ww(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Nw("data",this.frozen),this.namespace[e]=n,this):LAe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Nw("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=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 s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=ix(e),r=this.parser||this.Parser;return Sw("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Sw("process",this.parser||this.Parser),Ew("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=ix(e),l=r.parse(a);r.run(l,a,function(u,f,h){if(u||!f||!h)return c(u);const p=f,m=r.stringify(p,h);$Ae(m)?h.value=m:h.result=m,c(u,h)});function c(u,f){u||!f?o(u):i?i(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),Sw("processSync",this.parser||this.Parser),Ew("processSync",this.compiler||this.Compiler),this.process(e,s),a4("processSync","process",n),r;function s(i,o){n=!0,r4(i),r=o}}run(e,n,r){o4(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=ix(n);s.run(e,l,c);function c(u,f,h){const p=f||e;u?a(u):o?o(p):r(void 0,p,h)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),a4("runSync","run",r),s;function i(o,a){r4(o),s=a,r=!0}}stringify(e,n){this.freeze();const r=ix(n),s=this.compiler||this.Compiler;return Ew("stringify",s),o4(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(Nw("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...f]=c;l(u,f)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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");a(c.plugins),c.settings&&(s.settings=ww(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const f=c[u];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const g=r[h][1];e_(g)&&e_(p)&&(p=ww(!0,g,p)),r[h]=[c,p,...m]}}}}const DAe=new kN().freeze();function Sw(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ew(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Nw(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function o4(t){if(!e_(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function a4(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ix(t){return FAe(t)?t:new lU(t)}function FAe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function $Ae(t){return typeof t=="string"||BAe(t)}function BAe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const VAe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",l4=[],c4={allowDangerousHtml:!0},zAe=/^(https?|ircs?|mailto|xmpp)$/i,HAe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function UAe(t){const e=WAe(t),n=KAe(t);return qAe(e.runSync(e.parse(n),n),t)}function WAe(t){const e=t.rehypePlugins||l4,n=t.remarkPlugins||l4,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...c4}:c4;return DAe().use(MTe).use(n).use(bAe,r).use(e)}function KAe(t){const e=t.children||"",n=new lU;return typeof e=="string"&&(n.value=e),n}function qAe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||GAe;for(const u of HAe)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+VAe+u.id,void 0);return T5(t,c),xTe(t,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,f,h){if(u.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:u.value},f;if(u.type==="element"){let p;for(p in bw)if(Object.hasOwn(bw,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],g=bw[p];(g===null||g.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(u,f,h)),p&&h&&typeof f=="number")return a&&u.children?h.children.splice(f,1,...u.children):h.children.splice(f,1),f}}}function GAe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||zAe.test(t.slice(0,e))?t:""}function JAe(t,e,n){const s=e1((n||{}).ignore||[]),i=ZAe(e);let o=-1;for(;++o<i.length;)U7(t,"text",a);function a(c,u){let f=-1,h;for(;++f<u.length;){const p=u[f],m=h?h.children:void 0;if(s(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return l(c,u)}function l(c,u){const f=u[u.length-1],h=i[o][0],p=i[o][1];let m=0;const y=f.children.indexOf(c);let v=!1,b=[];h.lastIndex=0;let w=h.exec(c.value);for(;w;){const k=w.index,C={index:w.index,input:w.input,stack:[...u,c]};let _=p(...w,C);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=k+1:(m!==k&&b.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(_)?b.push(..._):_&&b.push(_),m=k+w[0].length,v=!0),!h.global)break;w=h.exec(c.value)}return v?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),f.children.splice(y,1,...b)):b=[c],y+b.length}}function ZAe(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([QAe(s[0]),YAe(s[1])])}return e}function QAe(t){return typeof t=="string"?new RegExp(Mve(t),"g"):t}function YAe(t){return typeof t=="function"?t:function(){return t}}const Tw="phrasing",Aw=["autolink","link","image","label"];function XAe(){return{transforms:[o3e],enter:{literalAutolink:t3e,literalAutolinkEmail:Iw,literalAutolinkHttp:Iw,literalAutolinkWww:Iw},exit:{literalAutolink:i3e,literalAutolinkEmail:s3e,literalAutolinkHttp:n3e,literalAutolinkWww:r3e}}}function e3e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tw,notInConstruct:Aw},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tw,notInConstruct:Aw},{character:":",before:"[ps]",after:"\\/",inConstruct:Tw,notInConstruct:Aw}]}}function t3e(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Iw(t){this.config.enter.autolinkProtocol.call(this,t)}function n3e(t){this.config.exit.autolinkProtocol.call(this,t)}function r3e(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function s3e(t){this.config.exit.autolinkEmail.call(this,t)}function i3e(t){this.exit(t)}function o3e(t){JAe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,a3e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),l3e]],{ignore:["link","linkReference"]})}function a3e(t,e,n,r,s){let i="";if(!cU(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!c3e(n)))return!1;const o=u3e(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function l3e(t,e,n,r){return!cU(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function c3e(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function u3e(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=H0(t,"(");let i=H0(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function cU(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Zr(n)||Xb(n))&&(!e||n!==47)}uU.peek=b3e;function d3e(){this.buffer()}function f3e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function h3e(){this.buffer()}function p3e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function m3e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function g3e(t){this.exit(t)}function x3e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function y3e(t){this.exit(t)}function b3e(){return"["}function uU(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function v3e(){return{enter:{gfmFootnoteCallString:d3e,gfmFootnoteCall:f3e,gfmFootnoteDefinitionLabelString:h3e,gfmFootnoteDefinition:p3e},exit:{gfmFootnoteCallString:m3e,gfmFootnoteCall:g3e,gfmFootnoteDefinitionLabelString:x3e,gfmFootnoteDefinition:y3e}}}function w3e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:uU},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
|
|
804
|
-
`:" ")+i.indentLines(i.containerFlow(r,a.current()),e?dU:k3e))),c(),l}}function k3e(t,e,n){return e===0?t:dU(t,e,n)}function dU(t,e,n){return(n?"":" ")+t}function C3e(){return[XAe(),v3e(),_7(),m$(),h$()]}function _3e(t){return{extensions:[e3e(),w3e(t),S7(),g$(t),p$()]}}const S3e={tokenize:j3e,partial:!0},fU={tokenize:R3e,partial:!0},hU={tokenize:M3e,partial:!0},pU={tokenize:P3e,partial:!0},E3e={tokenize:O3e,partial:!0},mU={name:"wwwAutolink",tokenize:A3e,previous:xU},gU={name:"protocolAutolink",tokenize:I3e,previous:yU},Ja={name:"emailAutolink",tokenize:T3e,previous:bU},qo={};function N3e(){return{text:qo}}let yc=48;for(;yc<123;)qo[yc]=Ja,yc++,yc===58?yc=65:yc===91&&(yc=97);qo[43]=Ja;qo[45]=Ja;qo[46]=Ja;qo[95]=Ja;qo[72]=[Ja,gU];qo[104]=[Ja,gU];qo[87]=[Ja,mU];qo[119]=[Ja,mU];function T3e(t,e,n){const r=this;let s,i;return o;function o(f){return!n_(f)||!bU.call(r,r.previous)||CN(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(f))}function a(f){return n_(f)?(t.consume(f),a):f===64?(t.consume(f),l):n(f)}function l(f){return f===46?t.check(E3e,u,c)(f):f===45||f===95||Br(f)?(i=!0,t.consume(f),l):u(f)}function c(f){return t.consume(f),s=!0,l}function u(f){return i&&s&&Yr(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function A3e(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!xU.call(r,r.previous)||CN(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(S3e,t.attempt(fU,t.attempt(hU,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function I3e(t,e,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&yU.call(r,r.previous)&&!CN(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),t.consume(f),a):n(f)}function a(f){if(Yr(f)&&s.length<5)return s+=String.fromCodePoint(f),t.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return t.consume(f),l}return n(f)}function l(f){return f===47?(t.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||z0(f)||zt(f)||Zr(f)||Xb(f)?n(f):t.attempt(fU,t.attempt(hU,u),n)(f)}function u(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function j3e(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function R3e(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(pU,l,a)(c):c===null||zt(c)||Zr(c)||c!==45&&Xb(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function M3e(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(pU,e,i)(o):o===null||zt(o)||Zr(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function P3e(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),i):a===93?(t.consume(a),s):a===60||a===null||zt(a)||Zr(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||zt(a)||Zr(a)?e(a):r(a)}function i(a){return Yr(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Yr(a)?(t.consume(a),o):n(a)}}function O3e(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Br(i)?n(i):e(i)}}function xU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function yU(t){return!Yr(t)}function bU(t){return!(t===47||n_(t))}function n_(t){return t===43||t===45||t===46||t===95||Br(t)}function CN(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const L3e={tokenize:U3e,partial:!0};function D3e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:V3e,continuation:{tokenize:z3e},exit:H3e}},text:{91:{name:"gfmFootnoteCall",tokenize:B3e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:F3e,resolveTo:$3e}}}}function F3e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Vi(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function $3e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function B3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!o||f===null||f===91||zt(f))return n(f);if(f===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return s.includes(Vi(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return zt(f)||(o=!0),i++,t.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(t.consume(f),i++,c):c(f)}}function V3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||zt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Vi(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return zt(m)||(a=!0),o++,t.consume(m),m===92?f:u}function f(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ot(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function z3e(t,e,n){return t.check(Im,e,t.attempt(L3e,e,n))}function H3e(t){t.exit("gfmFootnoteDefinition")}function U3e(t,e,n){const r=this;return Ot(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function W3e(t){return cF([N3e(),D3e(),C7(t),x$(),f$()])}const K3e={};function q3e(t){const e=this,n=t||K3e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(W3e(n)),i.push(C3e()),o.push(_3e(n))}let jw=null;function G3e(){return jw||(jw=me(()=>import("./mermaid.core-DCIPpHcK.js").then(t=>t.bC),__vite__mapDeps([30,2,3])).then(t=>t.default)),jw}function vU(t){return t==null?"":typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(e=>vU(e)).join(""):""}function J3e(t){if(!x.isValidElement(t))return null;const e=t.props;return typeof e.className!="string"||!/\blanguage-mermaid\b/i.test(e.className)?null:vU(e.children).replace(/\n$/,"")}function Z3e(t){const e=/^#([0-9a-f]{6})$/i.exec(t.trim());if(!e)return null;const n=e[1];return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16)}}function Q3e(t){if(!t)return;const e=Z3e(t);if(!e)return;const n=(.299*e.r+.587*e.g+.114*e.b)/255;return{borderColor:t,backgroundColor:`rgba(${e.r}, ${e.g}, ${e.b}, 0.22)`,color:n>.55?"#111827":"#f8fafc"}}function Y3e({source:t,darkMode:e}){const n=x.useId().replace(/[^a-zA-Z0-9_-]/g,""),[r,s]=x.useState(null),[i,o]=x.useState(null);return x.useEffect(()=>{let a=!0;return s(null),o(null),G3e().then(async l=>{l.initialize({startOnLoad:!1,securityLevel:"strict",theme:e?"dark":"default",fontFamily:"inherit",suppressErrorRendering:!0});const c=await l.render(`paperclip-mermaid-${n}`,t);a&&s(c.svg)}).catch(l=>{if(!a)return;const c=l instanceof Error&&l.message?l.message:"Failed to render Mermaid diagram.";o(c)}),()=>{a=!1}},[e,n,t]),d.jsx("div",{className:"paperclip-mermaid",children:r?d.jsx("div",{dangerouslySetInnerHTML:{__html:r}}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:Z("paperclip-mermaid-status",i&&"paperclip-mermaid-status-error"),children:i?`Unable to render Mermaid diagram: ${i}`:"Rendering Mermaid diagram..."}),d.jsx("pre",{className:"paperclip-mermaid-source",children:d.jsx("code",{className:"language-mermaid",children:t})})]})})}function Zm({children:t,className:e}){const{theme:n}=Eq();return d.jsx("div",{className:Z("paperclip-markdown prose prose-sm max-w-none break-words overflow-hidden",n==="dark"&&"prose-invert",e),children:d.jsx(UAe,{remarkPlugins:[q3e],components:{pre:({node:r,children:s,...i})=>{const o=J3e(s);return o?d.jsx(Y3e,{source:o,darkMode:n==="dark"}):d.jsx("pre",{...i,children:s})},a:({href:r,children:s})=>{const i=r?e6(r):null;if(i){const o=s;return d.jsx("a",{href:`/projects/${i.projectId}`,className:"paperclip-project-mention-chip",style:Q3e(i.color),children:o})}return d.jsx("a",{href:r,rel:"noreferrer",children:s})}},children:t})})}function u4({text:t,children:e,className:n,copiedLabel:r="Copied!"}){const[s,i]=x.useState(!1),[o,a]=x.useState(r),l=x.useRef(void 0),c=x.useRef(null),u=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),a(r)}catch{a("Copy failed")}clearTimeout(l.current),i(!0),l.current=setTimeout(()=>i(!1),1500)},[r,t]);return d.jsxs("span",{className:"relative inline-flex",children:[d.jsx("button",{ref:c,type:"button",className:Z("cursor-copy hover:text-foreground transition-colors",n),onClick:u,children:e??t}),d.jsx("span",{role:"status","aria-live":"polite",className:Z("pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 rounded-md bg-foreground text-background px-2 py-1 text-xs whitespace-nowrap transition-opacity duration-300",s?"opacity-100":"opacity-0"),children:o})]})}function X3e({leading:t,identifier:e,title:n,subtitle:r,trailing:s,selected:i,to:o,onClick:a,className:l}){const u=Z("flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors",!!(o||a)&&"cursor-pointer hover:bg-accent/50",i&&"bg-accent/30",l),f=d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[e&&d.jsx("span",{className:"text-xs text-muted-foreground font-mono shrink-0 relative top-[1px]",children:e}),d.jsx("span",{className:"truncate",children:n})]}),r&&d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r})]}),s&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:s})]});return o?d.jsx(en,{to:o,className:Z(u,"no-underline text-inherit"),onClick:a,children:f}):d.jsx("div",{className:u,onClick:a,children:f})}function Nt({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:Z("bg-accent/75 rounded-md",t),...e})}function wU({variant:t="list"}){return t==="dashboard"?d.jsxs("div",{className:"space-y-6",children:[d.jsx(Nt,{className:"h-32 w-full border border-border"}),d.jsx("div",{className:"grid grid-cols-2 gap-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-24 w-full"},n))}),d.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-44 w-full"},n))}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="approvals"?d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsx(Nt,{className:"h-9 w-44"})}),d.jsx("div",{className:"grid gap-3",children:Array.from({length:3}).map((e,n)=>d.jsx(Nt,{className:"h-36 w-full"},n))})]}):t==="costs"?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Array.from({length:6}).map((e,n)=>d.jsx(Nt,{className:"h-9 w-28"},n))}),d.jsx(Nt,{className:"h-40 w-full"}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="inbox"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Nt,{className:"h-9 w-56"}),d.jsx(Nt,{className:"h-8 w-40"})]}),d.jsx("div",{className:"space-y-5",children:Array.from({length:3}).map((e,n)=>d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1 border border-border",children:Array.from({length:3}).map((r,s)=>d.jsx(Nt,{className:"h-14 w-full rounded-none"},s))})]},n))})]}):t==="org-chart"?d.jsx("div",{className:"space-y-4",children:d.jsx(Nt,{className:"h-[calc(100vh-4rem)] w-full rounded-lg border border-border"})}):t==="detail"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-3 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-7 w-48"})]}),d.jsx(Nt,{className:"h-4 w-40"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-10 w-full"}),d.jsx(Nt,{className:"h-32 w-full"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"})]}),d.jsx(Nt,{className:"h-24 w-full"}),d.jsx(Nt,{className:"h-24 w-full"})]})]}):t==="issues-list"?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1",children:Array.from({length:8}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})]}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-44"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-20"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsx("div",{className:"space-y-1",children:Array.from({length:7}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})}function d4(t){return(t/100).toFixed(2)}function eIe(t){const e=t.trim();if(e.length===0)return 0;const n=Number(e);return!Number.isFinite(n)||n<0?null:Math.round(n*100)}function f4(t){return t==="lifetime"?"Lifetime budget":"Monthly UTC budget"}function tIe(t){return t==="hard_stop"?"text-red-300 border-red-500/30 bg-red-500/10":t==="warning"?"text-amber-200 border-amber-500/30 bg-amber-500/10":"text-emerald-200 border-emerald-500/30 bg-emerald-500/10"}function nIe({summary:t,onSave:e,isSaving:n,compact:r=!1,variant:s="card"}){const[i,o]=x.useState(d4(t.amount));x.useEffect(()=>{o(d4(t.amount))},[t.amount]);const a=eIe(i),l=typeof a=="number"&&a!==t.amount&&!!e,c=t.amount>0?Math.min(100,t.utilizationPercent):0,u=t.status==="hard_stop"?Koe:t.status==="warning"?_b:vae,f=s==="plain",h=f?d.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}):d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}),p=d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[d.jsx("span",{children:"Remaining"}),d.jsx("span",{children:t.amount>0?rd(t.remainingAmount):"Unlimited"})]}),d.jsx("div",{className:Z("h-2 overflow-hidden rounded-full",f?"bg-border/70":"bg-muted/70"),children:d.jsx("div",{className:Z("h-full rounded-full transition-[width,background-color] duration-200",t.status==="hard_stop"?"bg-red-400":t.status==="warning"?"bg-amber-300":"bg-emerald-300"),style:{width:`${c}%`}})})]}),m=t.paused?d.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-100",children:[d.jsx(aie,{className:"mt-0.5 h-4 w-4 shrink-0"}),d.jsx("div",{children:t.scopeType==="project"?"Execution is paused for this project until the budget is raised or the incident is dismissed.":"Heartbeats are paused for this scope until the budget is raised or the incident is dismissed."})]}):null,g=e?d.jsxs("div",{className:Z("flex flex-col gap-3 sm:flex-row sm:items-end",f?"":"rounded-xl border border-border/70 bg-background/50 p-3"),children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("label",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget (USD)"}),d.jsx(wd,{value:i,onChange:y=>o(y.target.value),className:"mt-2",inputMode:"decimal",placeholder:"0.00"})]}),d.jsx(Fe,{onClick:()=>{typeof a=="number"&&e&&e(a)},disabled:!l||n||a===null,children:n?"Saving...":t.amount>0?"Update budget":"Set budget"})]}):null;return f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-start justify-between gap-6",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx("div",{className:"mt-2 text-xl font-semibold",children:t.scopeName}),d.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em]",t.status==="hard_stop"?"text-red-300":t.status==="warning"?"text-amber-200":"text-muted-foreground"),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]}),h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]}):d.jsxs(jae,{className:Z("overflow-hidden border-border/70 bg-card/80",r?"":"shadow-[0_20px_80px_-40px_rgba(0,0,0,0.55)]"),children:[d.jsx(Rae,{className:Z("gap-3",r?"px-4 pt-4 pb-2":"px-5 pt-5 pb-3"),children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx(Mae,{className:"mt-1 text-base",children:t.scopeName}),d.jsx(Pae,{className:"mt-1",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] uppercase tracking-[0.18em]",tIe(t.status)),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]})}),d.jsxs(Oae,{className:Z("space-y-4",r?"px-4 pb-4 pt-0":"px-5 pb-5 pt-0"),children:[h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]})]})}function h4(){const t=document.getElementById("main-content");if(t instanceof HTMLElement){const e=window.getComputedStyle(t).overflowY;if((e==="auto"||e==="scroll"||e==="overlay")&&t.scrollHeight>t.clientHeight+1)return{type:"element",element:t}}return{type:"window"}}function rIe(t){return t.type==="element"?t.element.scrollHeight-t.element.scrollTop-t.element.clientHeight:(document.scrollingElement??document.documentElement).scrollHeight-window.scrollY-window.innerHeight}function kU(){const[t,e]=x.useState(!1);x.useEffect(()=>{const r=()=>{e(rIe(h4())>300)},s=document.getElementById("main-content");return r(),s==null||s.addEventListener("scroll",r,{passive:!0}),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{s==null||s.removeEventListener("scroll",r),window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[]);const n=x.useCallback(()=>{const r=h4();if(r.type==="element"){r.element.scrollTo({top:r.element.scrollHeight,behavior:"smooth"});return}const s=document.scrollingElement??document.documentElement;window.scrollTo({top:s.scrollHeight,behavior:"smooth"})},[]);return t?d.jsx("button",{onClick:n,className:"fixed bottom-[calc(1.5rem+5rem+env(safe-area-inset-bottom))] right-6 z-40 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background shadow-md hover:bg-accent transition-colors md:bottom-6","aria-label":"Scroll to bottom",children:d.jsx(AS,{className:"h-4 w-4"})}):null}const r_={bot:vh,cpu:kie,brain:Wse,zap:O6,rocket:Rk,code:N6,terminal:v0,shield:Goe,eye:RS,search:zoe,wrench:P6,hammer:Gie,lightbulb:toe,sparkles:PS,star:nae,heart:wh,flame:Bie,bug:Gse,cog:xie,database:Eie,globe:Kie,lock:aoe,mail:coe,"message-square":j6,"file-code":Oie,"git-branch":Uie,package:Eoe,puzzle:Loe,target:lae,wand:kae,atom:zse,"circuit-board":hie,radar:Foe,swords:iae,telescope:uae,microscope:goe,crown:_ie,gem:I6,hexagon:y0,pentagon:Roe,fingerprint:Fie},CU="bot";function sIe(t){return t&&xS.includes(t)?r_[t]:r_[CU]}function gf({icon:t,className:e}){const n=sIe(t);return d.jsx(n,{className:e})}function iIe({value:t,onChange:e,children:n}){const[r,s]=x.useState(!1),[i,o]=x.useState(""),a=x.useMemo(()=>{const l=xS.map(u=>[u,r_[u]]);if(!i)return l;const c=i.toLowerCase();return l.filter(([u])=>u.includes(c))},[i]);return d.jsxs(es,{open:r,onOpenChange:s,children:[d.jsx(ts,{asChild:!0,children:n}),d.jsxs(ns,{className:"w-72 p-3",align:"start",children:[d.jsx(wd,{placeholder:"Search icons...",value:i,onChange:l=>o(l.target.value),className:"mb-2 h-8 text-sm",autoFocus:!0}),d.jsxs("div",{className:"grid grid-cols-7 gap-1 max-h-48 overflow-y-auto",children:[a.map(([l,c])=>d.jsx("button",{onClick:()=>{e(l),s(!1),o("")},className:Z("flex items-center justify-center h-8 w-8 rounded hover:bg-accent transition-colors",(t??CU)===l&&"bg-accent ring-1 ring-primary"),title:l,children:d.jsx(c,{className:"h-4 w-4"})},l)),a.length===0&&d.jsx("p",{className:"col-span-7 text-xs text-muted-foreground text-center py-2",children:"No icons match"})]})]})]})}function _N(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Vo(t){return t.replace(/\s+/g," ").trim()}function Ni(t,e){return t.length>e?`${t.slice(0,Math.max(0,e-1))}…`:t}function _U(t){return t.replace(/[_-]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function p4(t){const e=Vo(t),n=e.match(/^(?:(?:\/bin\/)?(?:zsh|bash|sh)|cmd(?:\.exe)?(?:\s+\/d)?(?:\s+\/s)?(?:\s+\/c)?)\s+(?:-lc|\/c)\s+(.+)$/i),r=(n==null?void 0:n[1])??e,s=r.match(/^(['"])([\s\S]*)\1$/);return Vo((s==null?void 0:s[2])??r)}function SU(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}function qp(t){if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return SU(t)}function oIe(t){const e=_N(t);if(!e)return;const n=[e.toolUseId,e.tool_use_id,e.callId,e.call_id,e.id];for(const r of n)if(typeof r=="string"&&r.trim())return r}function m4(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return Ni(Vo(r),120)}return null}function s_(t,e,n){const r=n==="compact"?72:120;if(typeof e=="string"){const l=Gp(t,e)?p4(e):Vo(e);return Ni(l,r)}const s=_N(e);if(!s){const l=Vo(SU(e));return l?Ni(l,r):`Inspect ${t} input`}const i=typeof s.command=="string"?s.command:typeof s.cmd=="string"?s.cmd:null;if(i&&Gp(t,s))return Ni(p4(i),r);const o=m4(s,["command","cmd","path","filePath","file_path","query","url","prompt","message"])??m4(s,["pattern","name","title","target","tool"])??null;if(o)return Ni(o,r);if(Array.isArray(s.paths)&&s.paths.length>0){const l=s.paths.find(c=>typeof c=="string"&&c.trim().length>0);if(l)return Ni(`${s.paths.length} paths, starting with ${l}`,r)}const a=Object.keys(s);return a.length===0?`No ${t} input`:a.length===1?Ni(`${a[0]} payload`,r):Ni(`${a.length} fields: ${a.slice(0,3).join(", ")}`,r)}function EU(t){var i;if(!t)return null;const e=t.split(/\r?\n/),n=new Map;let r=e.findIndex(o=>o.trim()==="");r===-1&&(r=e.length);for(let o=0;o<r;o+=1){const a=(i=e[o])==null?void 0:i.match(/^([a-z_]+):\s*(.+)$/i);a&&n.set(a[1].toLowerCase(),Vo(a[2]))}const s=e.slice(Math.min(r+1,e.length)).map(o=>Vo(o)).filter(Boolean).join(`
|
|
804
|
+
`:" ")+i.indentLines(i.containerFlow(r,a.current()),e?dU:k3e))),c(),l}}function k3e(t,e,n){return e===0?t:dU(t,e,n)}function dU(t,e,n){return(n?"":" ")+t}function C3e(){return[XAe(),v3e(),_7(),m$(),h$()]}function _3e(t){return{extensions:[e3e(),w3e(t),S7(),g$(t),p$()]}}const S3e={tokenize:j3e,partial:!0},fU={tokenize:R3e,partial:!0},hU={tokenize:M3e,partial:!0},pU={tokenize:P3e,partial:!0},E3e={tokenize:O3e,partial:!0},mU={name:"wwwAutolink",tokenize:A3e,previous:xU},gU={name:"protocolAutolink",tokenize:I3e,previous:yU},Ja={name:"emailAutolink",tokenize:T3e,previous:bU},qo={};function N3e(){return{text:qo}}let yc=48;for(;yc<123;)qo[yc]=Ja,yc++,yc===58?yc=65:yc===91&&(yc=97);qo[43]=Ja;qo[45]=Ja;qo[46]=Ja;qo[95]=Ja;qo[72]=[Ja,gU];qo[104]=[Ja,gU];qo[87]=[Ja,mU];qo[119]=[Ja,mU];function T3e(t,e,n){const r=this;let s,i;return o;function o(f){return!n_(f)||!bU.call(r,r.previous)||CN(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(f))}function a(f){return n_(f)?(t.consume(f),a):f===64?(t.consume(f),l):n(f)}function l(f){return f===46?t.check(E3e,u,c)(f):f===45||f===95||Br(f)?(i=!0,t.consume(f),l):u(f)}function c(f){return t.consume(f),s=!0,l}function u(f){return i&&s&&Yr(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function A3e(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!xU.call(r,r.previous)||CN(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(S3e,t.attempt(fU,t.attempt(hU,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function I3e(t,e,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&yU.call(r,r.previous)&&!CN(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),t.consume(f),a):n(f)}function a(f){if(Yr(f)&&s.length<5)return s+=String.fromCodePoint(f),t.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return t.consume(f),l}return n(f)}function l(f){return f===47?(t.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||z0(f)||zt(f)||Zr(f)||Xb(f)?n(f):t.attempt(fU,t.attempt(hU,u),n)(f)}function u(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function j3e(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function R3e(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(pU,l,a)(c):c===null||zt(c)||Zr(c)||c!==45&&Xb(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function M3e(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(pU,e,i)(o):o===null||zt(o)||Zr(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function P3e(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),i):a===93?(t.consume(a),s):a===60||a===null||zt(a)||Zr(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||zt(a)||Zr(a)?e(a):r(a)}function i(a){return Yr(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Yr(a)?(t.consume(a),o):n(a)}}function O3e(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Br(i)?n(i):e(i)}}function xU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function yU(t){return!Yr(t)}function bU(t){return!(t===47||n_(t))}function n_(t){return t===43||t===45||t===46||t===95||Br(t)}function CN(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const L3e={tokenize:U3e,partial:!0};function D3e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:V3e,continuation:{tokenize:z3e},exit:H3e}},text:{91:{name:"gfmFootnoteCall",tokenize:B3e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:F3e,resolveTo:$3e}}}}function F3e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Vi(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function $3e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function B3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!o||f===null||f===91||zt(f))return n(f);if(f===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return s.includes(Vi(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return zt(f)||(o=!0),i++,t.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(t.consume(f),i++,c):c(f)}}function V3e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||zt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Vi(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return zt(m)||(a=!0),o++,t.consume(m),m===92?f:u}function f(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ot(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function z3e(t,e,n){return t.check(Im,e,t.attempt(L3e,e,n))}function H3e(t){t.exit("gfmFootnoteDefinition")}function U3e(t,e,n){const r=this;return Ot(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function W3e(t){return cF([N3e(),D3e(),C7(t),x$(),f$()])}const K3e={};function q3e(t){const e=this,n=t||K3e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(W3e(n)),i.push(C3e()),o.push(_3e(n))}let jw=null;function G3e(){return jw||(jw=me(()=>import("./mermaid.core-BRfo14rF.js").then(t=>t.bC),__vite__mapDeps([30,2,3])).then(t=>t.default)),jw}function vU(t){return t==null?"":typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(e=>vU(e)).join(""):""}function J3e(t){if(!x.isValidElement(t))return null;const e=t.props;return typeof e.className!="string"||!/\blanguage-mermaid\b/i.test(e.className)?null:vU(e.children).replace(/\n$/,"")}function Z3e(t){const e=/^#([0-9a-f]{6})$/i.exec(t.trim());if(!e)return null;const n=e[1];return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16)}}function Q3e(t){if(!t)return;const e=Z3e(t);if(!e)return;const n=(.299*e.r+.587*e.g+.114*e.b)/255;return{borderColor:t,backgroundColor:`rgba(${e.r}, ${e.g}, ${e.b}, 0.22)`,color:n>.55?"#111827":"#f8fafc"}}function Y3e({source:t,darkMode:e}){const n=x.useId().replace(/[^a-zA-Z0-9_-]/g,""),[r,s]=x.useState(null),[i,o]=x.useState(null);return x.useEffect(()=>{let a=!0;return s(null),o(null),G3e().then(async l=>{l.initialize({startOnLoad:!1,securityLevel:"strict",theme:e?"dark":"default",fontFamily:"inherit",suppressErrorRendering:!0});const c=await l.render(`paperclip-mermaid-${n}`,t);a&&s(c.svg)}).catch(l=>{if(!a)return;const c=l instanceof Error&&l.message?l.message:"Failed to render Mermaid diagram.";o(c)}),()=>{a=!1}},[e,n,t]),d.jsx("div",{className:"paperclip-mermaid",children:r?d.jsx("div",{dangerouslySetInnerHTML:{__html:r}}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:Z("paperclip-mermaid-status",i&&"paperclip-mermaid-status-error"),children:i?`Unable to render Mermaid diagram: ${i}`:"Rendering Mermaid diagram..."}),d.jsx("pre",{className:"paperclip-mermaid-source",children:d.jsx("code",{className:"language-mermaid",children:t})})]})})}function Zm({children:t,className:e}){const{theme:n}=Eq();return d.jsx("div",{className:Z("paperclip-markdown prose prose-sm max-w-none break-words overflow-hidden",n==="dark"&&"prose-invert",e),children:d.jsx(UAe,{remarkPlugins:[q3e],components:{pre:({node:r,children:s,...i})=>{const o=J3e(s);return o?d.jsx(Y3e,{source:o,darkMode:n==="dark"}):d.jsx("pre",{...i,children:s})},a:({href:r,children:s})=>{const i=r?e6(r):null;if(i){const o=s;return d.jsx("a",{href:`/projects/${i.projectId}`,className:"paperclip-project-mention-chip",style:Q3e(i.color),children:o})}return d.jsx("a",{href:r,rel:"noreferrer",children:s})}},children:t})})}function u4({text:t,children:e,className:n,copiedLabel:r="Copied!"}){const[s,i]=x.useState(!1),[o,a]=x.useState(r),l=x.useRef(void 0),c=x.useRef(null),u=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),a(r)}catch{a("Copy failed")}clearTimeout(l.current),i(!0),l.current=setTimeout(()=>i(!1),1500)},[r,t]);return d.jsxs("span",{className:"relative inline-flex",children:[d.jsx("button",{ref:c,type:"button",className:Z("cursor-copy hover:text-foreground transition-colors",n),onClick:u,children:e??t}),d.jsx("span",{role:"status","aria-live":"polite",className:Z("pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 rounded-md bg-foreground text-background px-2 py-1 text-xs whitespace-nowrap transition-opacity duration-300",s?"opacity-100":"opacity-0"),children:o})]})}function X3e({leading:t,identifier:e,title:n,subtitle:r,trailing:s,selected:i,to:o,onClick:a,className:l}){const u=Z("flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors",!!(o||a)&&"cursor-pointer hover:bg-accent/50",i&&"bg-accent/30",l),f=d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[e&&d.jsx("span",{className:"text-xs text-muted-foreground font-mono shrink-0 relative top-[1px]",children:e}),d.jsx("span",{className:"truncate",children:n})]}),r&&d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r})]}),s&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:s})]});return o?d.jsx(en,{to:o,className:Z(u,"no-underline text-inherit"),onClick:a,children:f}):d.jsx("div",{className:u,onClick:a,children:f})}function Nt({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:Z("bg-accent/75 rounded-md",t),...e})}function wU({variant:t="list"}){return t==="dashboard"?d.jsxs("div",{className:"space-y-6",children:[d.jsx(Nt,{className:"h-32 w-full border border-border"}),d.jsx("div",{className:"grid grid-cols-2 gap-2 xl:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-24 w-full"},n))}),d.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:4}).map((e,n)=>d.jsx(Nt,{className:"h-44 w-full"},n))}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="approvals"?d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsx(Nt,{className:"h-9 w-44"})}),d.jsx("div",{className:"grid gap-3",children:Array.from({length:3}).map((e,n)=>d.jsx(Nt,{className:"h-36 w-full"},n))})]}):t==="costs"?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Array.from({length:6}).map((e,n)=>d.jsx(Nt,{className:"h-9 w-28"},n))}),d.jsx(Nt,{className:"h-40 w-full"}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsx(Nt,{className:"h-72 w-full"}),d.jsx(Nt,{className:"h-72 w-full"})]})]}):t==="inbox"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Nt,{className:"h-9 w-56"}),d.jsx(Nt,{className:"h-8 w-40"})]}),d.jsx("div",{className:"space-y-5",children:Array.from({length:3}).map((e,n)=>d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1 border border-border",children:Array.from({length:3}).map((r,s)=>d.jsx(Nt,{className:"h-14 w-full rounded-none"},s))})]},n))})]}):t==="org-chart"?d.jsx("div",{className:"space-y-4",children:d.jsx(Nt,{className:"h-[calc(100vh-4rem)] w-full rounded-lg border border-border"})}):t==="detail"?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-3 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-6 w-6"}),d.jsx(Nt,{className:"h-7 w-48"})]}),d.jsx(Nt,{className:"h-4 w-40"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(Nt,{className:"h-10 w-full"}),d.jsx(Nt,{className:"h-32 w-full"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"}),d.jsx(Nt,{className:"h-8 w-24"})]}),d.jsx(Nt,{className:"h-24 w-full"}),d.jsx(Nt,{className:"h-24 w-full"})]})]}):t==="issues-list"?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-64"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-16"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Nt,{className:"h-4 w-40"}),d.jsx("div",{className:"space-y-1",children:Array.from({length:8}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})]}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[d.jsx(Nt,{className:"h-9 w-44"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Nt,{className:"h-8 w-20"}),d.jsx(Nt,{className:"h-8 w-24"})]})]}),d.jsx("div",{className:"space-y-1",children:Array.from({length:7}).map((e,n)=>d.jsx(Nt,{className:"h-11 w-full rounded-none"},n))})]})}function d4(t){return(t/100).toFixed(2)}function eIe(t){const e=t.trim();if(e.length===0)return 0;const n=Number(e);return!Number.isFinite(n)||n<0?null:Math.round(n*100)}function f4(t){return t==="lifetime"?"Lifetime budget":"Monthly UTC budget"}function tIe(t){return t==="hard_stop"?"text-red-300 border-red-500/30 bg-red-500/10":t==="warning"?"text-amber-200 border-amber-500/30 bg-amber-500/10":"text-emerald-200 border-emerald-500/30 bg-emerald-500/10"}function nIe({summary:t,onSave:e,isSaving:n,compact:r=!1,variant:s="card"}){const[i,o]=x.useState(d4(t.amount));x.useEffect(()=>{o(d4(t.amount))},[t.amount]);const a=eIe(i),l=typeof a=="number"&&a!==t.amount&&!!e,c=t.amount>0?Math.min(100,t.utilizationPercent):0,u=t.status==="hard_stop"?Koe:t.status==="warning"?_b:vae,f=s==="plain",h=f?d.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}):d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Observed"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:rd(t.observedAmount)}),d.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.amount>0?`${t.utilizationPercent}% of limit`:"No cap configured"})]}),d.jsxs("div",{className:"rounded-xl border border-border/70 bg-black/[0.18] px-4 py-3",children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget"}),d.jsx("div",{className:"mt-2 text-xl font-semibold tabular-nums",children:t.amount>0?rd(t.amount):"Disabled"}),d.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Soft alert at ",t.warnPercent,"%",t.paused&&t.pauseReason?` · ${t.pauseReason} pause`:""]})]})]}),p=d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[d.jsx("span",{children:"Remaining"}),d.jsx("span",{children:t.amount>0?rd(t.remainingAmount):"Unlimited"})]}),d.jsx("div",{className:Z("h-2 overflow-hidden rounded-full",f?"bg-border/70":"bg-muted/70"),children:d.jsx("div",{className:Z("h-full rounded-full transition-[width,background-color] duration-200",t.status==="hard_stop"?"bg-red-400":t.status==="warning"?"bg-amber-300":"bg-emerald-300"),style:{width:`${c}%`}})})]}),m=t.paused?d.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-100",children:[d.jsx(aie,{className:"mt-0.5 h-4 w-4 shrink-0"}),d.jsx("div",{children:t.scopeType==="project"?"Execution is paused for this project until the budget is raised or the incident is dismissed.":"Heartbeats are paused for this scope until the budget is raised or the incident is dismissed."})]}):null,g=e?d.jsxs("div",{className:Z("flex flex-col gap-3 sm:flex-row sm:items-end",f?"":"rounded-xl border border-border/70 bg-background/50 p-3"),children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("label",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Budget (USD)"}),d.jsx(wd,{value:i,onChange:y=>o(y.target.value),className:"mt-2",inputMode:"decimal",placeholder:"0.00"})]}),d.jsx(Fe,{onClick:()=>{typeof a=="number"&&e&&e(a)},disabled:!l||n||a===null,children:n?"Saving...":t.amount>0?"Update budget":"Set budget"})]}):null;return f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-start justify-between gap-6",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx("div",{className:"mt-2 text-xl font-semibold",children:t.scopeName}),d.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em]",t.status==="hard_stop"?"text-red-300":t.status==="warning"?"text-amber-200":"text-muted-foreground"),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]}),h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]}):d.jsxs(jae,{className:Z("overflow-hidden border-border/70 bg-card/80",r?"":"shadow-[0_20px_80px_-40px_rgba(0,0,0,0.55)]"),children:[d.jsx(Rae,{className:Z("gap-3",r?"px-4 pt-4 pb-2":"px-5 pt-5 pb-3"),children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] uppercase tracking-[0.22em] text-muted-foreground",children:t.scopeType}),d.jsx(Mae,{className:"mt-1 text-base",children:t.scopeName}),d.jsx(Pae,{className:"mt-1",children:f4(t.windowKind)})]}),d.jsxs("div",{className:Z("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] uppercase tracking-[0.18em]",tIe(t.status)),children:[d.jsx(u,{className:"h-3.5 w-3.5"}),t.paused?"Paused":t.status==="warning"?"Warning":t.status==="hard_stop"?"Hard stop":"Healthy"]})]})}),d.jsxs(Oae,{className:Z("space-y-4",r?"px-4 pb-4 pt-0":"px-5 pb-5 pt-0"),children:[h,p,m,g,a===null?d.jsx("p",{className:"text-xs text-destructive",children:"Enter a valid non-negative dollar amount."}):null]})]})}function h4(){const t=document.getElementById("main-content");if(t instanceof HTMLElement){const e=window.getComputedStyle(t).overflowY;if((e==="auto"||e==="scroll"||e==="overlay")&&t.scrollHeight>t.clientHeight+1)return{type:"element",element:t}}return{type:"window"}}function rIe(t){return t.type==="element"?t.element.scrollHeight-t.element.scrollTop-t.element.clientHeight:(document.scrollingElement??document.documentElement).scrollHeight-window.scrollY-window.innerHeight}function kU(){const[t,e]=x.useState(!1);x.useEffect(()=>{const r=()=>{e(rIe(h4())>300)},s=document.getElementById("main-content");return r(),s==null||s.addEventListener("scroll",r,{passive:!0}),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{s==null||s.removeEventListener("scroll",r),window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[]);const n=x.useCallback(()=>{const r=h4();if(r.type==="element"){r.element.scrollTo({top:r.element.scrollHeight,behavior:"smooth"});return}const s=document.scrollingElement??document.documentElement;window.scrollTo({top:s.scrollHeight,behavior:"smooth"})},[]);return t?d.jsx("button",{onClick:n,className:"fixed bottom-[calc(1.5rem+5rem+env(safe-area-inset-bottom))] right-6 z-40 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background shadow-md hover:bg-accent transition-colors md:bottom-6","aria-label":"Scroll to bottom",children:d.jsx(AS,{className:"h-4 w-4"})}):null}const r_={bot:vh,cpu:kie,brain:Wse,zap:O6,rocket:Rk,code:N6,terminal:v0,shield:Goe,eye:RS,search:zoe,wrench:P6,hammer:Gie,lightbulb:toe,sparkles:PS,star:nae,heart:wh,flame:Bie,bug:Gse,cog:xie,database:Eie,globe:Kie,lock:aoe,mail:coe,"message-square":j6,"file-code":Oie,"git-branch":Uie,package:Eoe,puzzle:Loe,target:lae,wand:kae,atom:zse,"circuit-board":hie,radar:Foe,swords:iae,telescope:uae,microscope:goe,crown:_ie,gem:I6,hexagon:y0,pentagon:Roe,fingerprint:Fie},CU="bot";function sIe(t){return t&&xS.includes(t)?r_[t]:r_[CU]}function gf({icon:t,className:e}){const n=sIe(t);return d.jsx(n,{className:e})}function iIe({value:t,onChange:e,children:n}){const[r,s]=x.useState(!1),[i,o]=x.useState(""),a=x.useMemo(()=>{const l=xS.map(u=>[u,r_[u]]);if(!i)return l;const c=i.toLowerCase();return l.filter(([u])=>u.includes(c))},[i]);return d.jsxs(es,{open:r,onOpenChange:s,children:[d.jsx(ts,{asChild:!0,children:n}),d.jsxs(ns,{className:"w-72 p-3",align:"start",children:[d.jsx(wd,{placeholder:"Search icons...",value:i,onChange:l=>o(l.target.value),className:"mb-2 h-8 text-sm",autoFocus:!0}),d.jsxs("div",{className:"grid grid-cols-7 gap-1 max-h-48 overflow-y-auto",children:[a.map(([l,c])=>d.jsx("button",{onClick:()=>{e(l),s(!1),o("")},className:Z("flex items-center justify-center h-8 w-8 rounded hover:bg-accent transition-colors",(t??CU)===l&&"bg-accent ring-1 ring-primary"),title:l,children:d.jsx(c,{className:"h-4 w-4"})},l)),a.length===0&&d.jsx("p",{className:"col-span-7 text-xs text-muted-foreground text-center py-2",children:"No icons match"})]})]})]})}function _N(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Vo(t){return t.replace(/\s+/g," ").trim()}function Ni(t,e){return t.length>e?`${t.slice(0,Math.max(0,e-1))}…`:t}function _U(t){return t.replace(/[_-]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function p4(t){const e=Vo(t),n=e.match(/^(?:(?:\/bin\/)?(?:zsh|bash|sh)|cmd(?:\.exe)?(?:\s+\/d)?(?:\s+\/s)?(?:\s+\/c)?)\s+(?:-lc|\/c)\s+(.+)$/i),r=(n==null?void 0:n[1])??e,s=r.match(/^(['"])([\s\S]*)\1$/);return Vo((s==null?void 0:s[2])??r)}function SU(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}function qp(t){if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return SU(t)}function oIe(t){const e=_N(t);if(!e)return;const n=[e.toolUseId,e.tool_use_id,e.callId,e.call_id,e.id];for(const r of n)if(typeof r=="string"&&r.trim())return r}function m4(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return Ni(Vo(r),120)}return null}function s_(t,e,n){const r=n==="compact"?72:120;if(typeof e=="string"){const l=Gp(t,e)?p4(e):Vo(e);return Ni(l,r)}const s=_N(e);if(!s){const l=Vo(SU(e));return l?Ni(l,r):`Inspect ${t} input`}const i=typeof s.command=="string"?s.command:typeof s.cmd=="string"?s.cmd:null;if(i&&Gp(t,s))return Ni(p4(i),r);const o=m4(s,["command","cmd","path","filePath","file_path","query","url","prompt","message"])??m4(s,["pattern","name","title","target","tool"])??null;if(o)return Ni(o,r);if(Array.isArray(s.paths)&&s.paths.length>0){const l=s.paths.find(c=>typeof c=="string"&&c.trim().length>0);if(l)return Ni(`${s.paths.length} paths, starting with ${l}`,r)}const a=Object.keys(s);return a.length===0?`No ${t} input`:a.length===1?Ni(`${a[0]} payload`,r):Ni(`${a.length} fields: ${a.slice(0,3).join(", ")}`,r)}function EU(t){var i;if(!t)return null;const e=t.split(/\r?\n/),n=new Map;let r=e.findIndex(o=>o.trim()==="");r===-1&&(r=e.length);for(let o=0;o<r;o+=1){const a=(i=e[o])==null?void 0:i.match(/^([a-z_]+):\s*(.+)$/i);a&&n.set(a[1].toLowerCase(),Vo(a[2]))}const s=e.slice(Math.min(r+1,e.length)).map(o=>Vo(o)).filter(Boolean).join(`
|
|
805
805
|
`);return{command:n.get("command")??null,status:n.get("status")??null,exitCode:n.get("exit_code")??null,body:s}}function Gp(t,e){if(t==="command_execution"||t==="shell"||t==="shellToolCall"||t==="bash")return!0;if(typeof e=="string")return/\b(?:bash|zsh|sh|cmd|powershell)\b/i.test(e);const n=_N(e);return!!(n&&(typeof n.command=="string"||typeof n.cmd=="string"))}function aIe(t,e){return Gp(t,e)?"Executing command":_U(t)}function lIe(t,e,n){if(!t)return e?"Tool failed":"Waiting for result";const r=EU(t);if(r){if(r.body)return Ni(r.body.split(`
|
|
806
806
|
`)[0]??r.body,n==="compact"?84:140);if(r.status==="completed")return"Completed";if(r.status==="failed"||r.status==="error")return r.exitCode?`Failed with exit code ${r.exitCode}`:"Failed"}const i=t.split(/\r?\n/).map(o=>Vo(o)).filter(Boolean)[0]??t;return Ni(i,n==="compact"?84:140)}function cIe(t){const e=t.match(/^item (started|completed):\s*([a-z0-9_-]+)(?:\s+\(id=([^)]+)\))?$/i);return e?{status:e[1].toLowerCase()==="started"?"running":"completed",name:_U(e[2]??"Activity"),activityId:e[3]||void 0}:null}function uIe(t){return Vo(t).toLowerCase().startsWith("[paperclip] skipping saved session resume")}function dIe(t){const e=[];let n=[],r=null,s;const i=()=>{n.length===0||!r||(e.push({type:"command_group",ts:r,endTs:s,items:n}),n=[],r=null,s=void 0)};for(const o of t){if(o.type==="tool"&&Gp(o.name,o.input)){r||(r=o.ts),s=o.endTs??o.ts,n.push({ts:o.ts,endTs:o.endTs,input:o.input,result:o.result,isError:o.isError,status:o.status});continue}i(),e.push(o)}return i(),e}function fIe(t,e){const n=[],r=new Map,s=new Map;for(const i of t){const o=n[n.length-1];if(i.kind==="assistant"||i.kind==="user"){const l=e&&i.kind==="assistant"&&i.delta===!0;(o==null?void 0:o.type)==="message"&&o.role===i.kind?(o.text+=o.text.endsWith(`
|
|
807
807
|
`)||i.text.startsWith(`
|
|
@@ -831,4 +831,4 @@ https://github.com/paperclipai/companies/blob/main/default/ceo/AGENTS.md
|
|
|
831
831
|
|
|
832
832
|
Ensure you have a folder agents/ceo and then download this AGENTS.md, and sibling HEARTBEAT.md, SOUL.md, and TOOLS.md. and set that AGENTS.md as the path to your agents instruction file
|
|
833
833
|
|
|
834
|
-
After that, hire yourself a Founding Engineer agent and then plan the roadmap and tasks for your new company.`;function s4e(){const{onboardingOpen:t,onboardingOptions:e,closeOnboarding:n}=CS(),{companies:r,setSelectedCompanyId:s,loading:i}=Qi(),o=rr(),a=Su(),l=Mr(),{companyPrefix:c}=_u(),[u,f]=x.useState(!1),h=c&&i?null:Fae({pathname:l.pathname,companyPrefix:c,companies:r}),p=t||h!==null&&!u,m=t?e:h??{},g=m.initialStep??1,y=m.companyId,[v,b]=x.useState(g),[w,k]=x.useState(!1),[C,_]=x.useState(null),[S,E]=x.useState(!1),[N,T]=x.useState(""),[O,L]=x.useState(""),[I,M]=x.useState(""),[V,G]=x.useState("CEO"),[D,B]=x.useState("claude_local"),[F,R]=x.useState(""),[U,J]=x.useState(""),[P,ie]=x.useState(""),[ge,ae]=x.useState(""),[Y,H]=x.useState(""),[ne,de]=x.useState(null),[xe,Oe]=x.useState(null),[Ze,ot]=x.useState(!1),[pt,ye]=x.useState(!1),[Qe,z]=x.useState(!1),[te,ke]=x.useState(!1),[$,X]=x.useState("Create your CEO HEARTBEAT.md"),[se,he]=x.useState(U4),be=x.useRef(null),W=x.useCallback(()=>{const we=be.current;we&&(we.style.height="auto",we.style.height=we.scrollHeight+"px")},[]),[ee,A]=x.useState(y??null),[ce,Me]=x.useState(null),[at,Xt]=x.useState(null),[Ht,sr]=x.useState(null);x.useEffect(()=>{f(!1)},[l.pathname]),x.useEffect(()=>{if(!p)return;const we=m.companyId??null;b(m.initialStep??1),A(we),Me(null)},[p,m.companyId,m.initialStep]),x.useEffect(()=>{if(!p||!ee||ce)return;const we=r.find($e=>$e.id===ee);we&&Me(we.issuePrefix)},[p,ee,ce,r]),x.useEffect(()=>{v===3&&W()},[v,se,W]);const{data:ur,error:Sn,isLoading:Dt,isFetching:dr}=st({queryKey:ee?re.agents.adapterModels(ee,D):["agents","none","adapter-models",D],queryFn:()=>Bt.adapterModels(ee,D),enabled:!!ee&&p&&v===2}),bi=D==="claude_local"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"||D==="cursor",vi=P.trim()||(D==="codex_local"?"codex":D==="gemini_local"?"gemini":D==="cursor"?"agent":D==="opencode_local"?"opencode":"claude");x.useEffect(()=>{v===2&&(de(null),Oe(null))},[v,D,F,U,P,ge,Y]);const uc=(ur??[]).find(we=>we.id===U),$u=(ne==null?void 0:ne.checks.some(we=>we.code==="claude_anthropic_api_key_overrides_subscription"))??!1,dc=D==="claude_local"&&(ne==null?void 0:ne.status)==="fail"&&$u,oe=x.useMemo(()=>{const we=N.trim().toLowerCase();return(ur??[]).filter($e=>{if(!we)return!0;const Ln=jh($e.id,"");return $e.id.toLowerCase().includes(we)||$e.label.toLowerCase().includes(we)||Ln.toLowerCase().includes(we)})},[ur,N]),lt=x.useMemo(()=>{if(D!=="opencode_local")return[{provider:"models",entries:[...oe].sort(($e,Ln)=>$e.id.localeCompare(Ln.id))}];const we=new Map;for(const $e of oe){const Ln=jh($e.id),so=we.get(Ln)??[];so.push($e),we.set(Ln,so)}return Array.from(we.entries()).sort(([$e],[Ln])=>$e.localeCompare(Ln)).map(([$e,Ln])=>({provider:$e,entries:[...Ln].sort((so,Bu)=>so.id.localeCompare(Bu.id))}))},[oe,D]);function Ye(){b(1),k(!1),_(null),L(""),M(""),G("CEO"),B("claude_local"),R(""),J(""),ie(""),ae(""),H(""),de(null),Oe(null),ot(!1),ye(!1),z(!1),X("Create your CEO HEARTBEAT.md"),he(U4),A(null),Me(null),Xt(null),sr(null)}function xn(){Ye(),n()}function Pr(){const $e=up(D).buildAdapterConfig({...Dk,adapterType:D,cwd:F,model:D==="codex_local"?U||ip:D==="gemini_local"?U||ap:D==="cursor"?U||op:U,command:P,args:ge,url:Y,dangerouslySkipPermissions:D==="claude_local",dangerouslyBypassSandbox:D==="codex_local"?w0:Dk.dangerouslyBypassSandbox});if(D==="claude_local"&&pt){const Ln=typeof $e.env=="object"&&$e.env!==null&&!Array.isArray($e.env)?{...$e.env}:{};Ln.ANTHROPIC_API_KEY={type:"plain",value:""},$e.env=Ln}return $e}async function Es(we){if(!ee)return Oe("Create or select a company before testing adapter environment."),null;ot(!0),Oe(null);try{const $e=await Bt.testEnvironment(ee,D,{adapterConfig:we??Pr()});return de($e),$e}catch($e){return Oe($e instanceof Error?$e.message:"Adapter environment test failed"),null}finally{ot(!1)}}async function Go(){k(!0),_(null);try{const we=await ik.create({name:O.trim()});if(A(we.id),Me(we.issuePrefix),s(we.id),o.invalidateQueries({queryKey:re.companies.all}),I.trim()){const $e=TRe(I);await NRe.create(we.id,{title:$e.title,...$e.description?{description:$e.description}:{},level:"company",status:"active"}),o.invalidateQueries({queryKey:re.goals.list(we.id)})}b(2)}catch(we){_(we instanceof Error?we.message:"Failed to create company")}finally{k(!1)}}async function Hs(){if(ee){k(!0),_(null);try{if(D==="opencode_local"){const $e=U.trim();if(!$e){_("OpenCode requires an explicit model in provider/model format.");return}if(Sn){_(Sn instanceof Error?Sn.message:"Failed to load OpenCode models.");return}if(Dt||dr){_("OpenCode models are still loading. Please wait and try again.");return}const Ln=ur??[];if(!Ln.some(so=>so.id===$e)){_(Ln.length===0?"No OpenCode models discovered. Run `opencode models` and authenticate providers.":`Configured OpenCode model is unavailable: ${$e}`);return}}if(bi&&!(ne??await Es()))return;const we=await Bt.create(ee,{name:V.trim(),role:"ceo",adapterType:D,adapterConfig:Pr(),runtimeConfig:{heartbeat:{enabled:!0,intervalSec:3600,wakeOnDemand:!0,cooldownSec:10,maxConcurrentRuns:1}}});Xt(we.id),o.invalidateQueries({queryKey:re.agents.list(ee)}),b(3)}catch(we){_(we instanceof Error?we.message:"Failed to create agent")}finally{k(!1)}}}async function Uf(){if(!ee||Qe)return;z(!0),_(null),Oe(null),ye(!0);const we=(()=>{const $e=Pr(),Ln=typeof $e.env=="object"&&$e.env!==null&&!Array.isArray($e.env)?{...$e.env}:{};return Ln.ANTHROPIC_API_KEY={type:"plain",value:""},$e.env=Ln,$e})();try{at&&(await Bt.update(at,{adapterConfig:we},ee),o.invalidateQueries({queryKey:re.agents.list(ee)}));const $e=await Es(we);($e==null?void 0:$e.status)==="fail"&&_("Retried with ANTHROPIC_API_KEY unset in adapter config, but the environment test is still failing.")}catch($e){_($e instanceof Error?$e.message:"Failed to unset ANTHROPIC_API_KEY and retry.")}finally{z(!1)}}async function Za(){!ee||!at||(_(null),b(4))}async function ro(){if(!(!ee||!at)){k(!0),_(null);try{let we=Ht;if(!we){const $e=await sn.create(ee,{title:$.trim(),...se.trim()?{description:se.trim()}:{},assigneeAgentId:at,status:"todo"});we=$e.identifier??$e.id,sr(we),o.invalidateQueries({queryKey:re.issues.list(ee)})}s(ee),Ye(),n(),a(ce?`/${ce}/issues/${we}`:`/issues/${we}`)}catch(we){_(we instanceof Error?we.message:"Failed to create task")}finally{k(!1)}}}function fc(we){we.key==="Enter"&&(we.metaKey||we.ctrlKey)&&(we.preventDefault(),v===1&&O.trim()?Go():v===2&&V.trim()?Hs():v===3&&$.trim()?Za():v===4&&ro())}return p?d.jsx(OS,{open:p,onOpenChange:we=>{we||(f(!0),xn())},children:d.jsxs(L6,{children:[d.jsx("div",{className:"fixed inset-0 z-50 bg-background"}),d.jsxs("div",{className:"fixed inset-0 z-50 flex",onKeyDown:fc,children:[d.jsxs("button",{onClick:xn,className:"absolute top-4 left-4 z-10 rounded-sm p-1.5 text-muted-foreground/60 hover:text-foreground transition-colors",children:[d.jsx(Bs,{className:"h-5 w-5"}),d.jsx("span",{className:"sr-only",children:"Close"})]}),d.jsx("div",{className:Z("w-full flex flex-col overflow-y-auto transition-[width] duration-500 ease-in-out",v===1?"md:w-1/2":"md:w-full"),children:d.jsxs("div",{className:"w-full max-w-md mx-auto my-auto px-8 py-12 shrink-0",children:[d.jsx("div",{className:"flex items-center gap-0 mb-8 border-b border-border",children:[{step:1,label:"Company",icon:G1},{step:2,label:"Agent",icon:vh},{step:3,label:"Task",icon:J1},{step:4,label:"Launch",icon:Rk}].map(({step:we,label:$e,icon:Ln})=>d.jsxs("button",{type:"button",onClick:()=>b(we),className:Z("flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 -mb-px transition-colors cursor-pointer",we===v?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground/70 hover:border-border"),children:[d.jsx(Ln,{className:"h-3.5 w-3.5"}),$e]},we))}),v===1&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(G1,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Name your company"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"This is the organization your agents will work for."})]})]}),d.jsxs("div",{className:"mt-3 group",children:[d.jsx("label",{className:Z("text-xs mb-1 block transition-colors",O.trim()?"text-foreground":"text-muted-foreground group-focus-within:text-foreground"),children:"Company name"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"Acme Corp",value:O,onChange:we=>L(we.target.value),autoFocus:!0})]}),d.jsxs("div",{className:"group",children:[d.jsx("label",{className:Z("text-xs mb-1 block transition-colors",I.trim()?"text-foreground":"text-muted-foreground group-focus-within:text-foreground"),children:"Mission / goal (optional)"}),d.jsx("textarea",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50 resize-none min-h-[60px]",placeholder:"What is this company trying to achieve?",value:I,onChange:we=>M(we.target.value)})]})]}),v===2&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(vh,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Create your first agent"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose how this agent will run tasks."})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Agent name"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"CEO",value:V,onChange:we=>G(we.target.value),autoFocus:!0})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-2 block",children:"Adapter type"}),d.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"claude_local",label:"Claude Code",icon:PS,desc:"Local Claude agent",recommended:!0},{value:"codex_local",label:"Codex",icon:N6,desc:"Local Codex agent",recommended:!0}].map(we=>d.jsxs("button",{className:Z("flex flex-col items-center gap-1.5 rounded-md border p-3 text-xs transition-colors relative",D===we.value?"border-foreground bg-accent":"border-border hover:bg-accent/50"),onClick:()=>{const $e=we.value;B($e),$e==="codex_local"&&!U&&J(ip),$e!=="codex_local"&&J("")},children:[we.recommended&&d.jsx("span",{className:"absolute -top-1.5 right-1.5 bg-green-500 text-white text-[9px] font-semibold px-1.5 py-0.5 rounded-full leading-none",children:"Recommended"}),d.jsx(we.icon,{className:"h-4 w-4"}),d.jsx("span",{className:"font-medium",children:we.label}),d.jsx("span",{className:"text-muted-foreground text-[10px]",children:we.desc})]},we.value))}),d.jsxs("button",{className:"flex items-center gap-1.5 mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>ke(we=>!we),children:[d.jsx(os,{className:Z("h-3 w-3 transition-transform",te?"rotate-0":"-rotate-90")}),"More Agent Adapter Types"]}),te&&d.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[{value:"gemini_local",label:"Gemini CLI",icon:I6,desc:"Local Gemini agent"},{value:"process",label:"Process",icon:v0,desc:"Run a local command"},{value:"opencode_local",label:"OpenCode",icon:J2,desc:"Local multi-provider agent"},{value:"pi_local",label:"Pi",icon:v0,desc:"Local Pi agent"},{value:"cursor",label:"Cursor",icon:_oe,desc:"Local Cursor agent"},{value:"openclaw_gateway",label:"OpenClaw Gateway",icon:vh,desc:"Invoke OpenClaw via gateway protocol",comingSoon:!0,disabledLabel:"Configure OpenClaw within the App"}].map(we=>d.jsxs("button",{disabled:!!we.comingSoon,className:Z("flex flex-col items-center gap-1.5 rounded-md border p-3 text-xs transition-colors relative",we.comingSoon?"border-border opacity-40 cursor-not-allowed":D===we.value?"border-foreground bg-accent":"border-border hover:bg-accent/50"),onClick:()=>{if(we.comingSoon)return;const $e=we.value;if(B($e),$e==="gemini_local"&&!U){J(ap);return}if($e==="cursor"&&!U){J(op);return}if($e==="opencode_local"){U.includes("/")||J("");return}J("")},children:[d.jsx(we.icon,{className:"h-4 w-4"}),d.jsx("span",{className:"font-medium",children:we.label}),d.jsx("span",{className:"text-muted-foreground text-[10px]",children:we.comingSoon?we.disabledLabel??"Coming soon":we.desc})]},we.value))})]}),(D==="claude_local"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"||D==="pi_local"||D==="cursor")&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[d.jsx("label",{className:"text-xs text-muted-foreground",children:"Working directory"}),d.jsx(lp,{text:"Growthub works best if you create a new folder for your agents to keep their memories and stay organized. Create a new folder and put the path here."})]}),d.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border px-2.5 py-1.5",children:[d.jsx(A6,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),d.jsx("input",{className:"w-full bg-transparent outline-none text-sm font-mono placeholder:text-muted-foreground/50",placeholder:"/path/to/project",value:F,onChange:we=>R(we.target.value)}),d.jsx(Wi,{})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Model"}),d.jsxs(es,{open:S,onOpenChange:we=>{E(we),we||T("")},children:[d.jsx(ts,{asChild:!0,children:d.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-sm hover:bg-accent/50 transition-colors w-full justify-between",children:[d.jsx("span",{className:Z(!U&&"text-muted-foreground"),children:uc?uc.label:U||(D==="opencode_local"?"Select model (required)":"Default")}),d.jsx(os,{className:"h-3 w-3 text-muted-foreground"})]})}),d.jsxs(ns,{className:"w-[var(--radix-popover-trigger-width)] p-1",align:"start",children:[d.jsx("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-border mb-1 placeholder:text-muted-foreground/50",placeholder:"Search models...",value:N,onChange:we=>T(we.target.value),autoFocus:!0}),D!=="opencode_local"&&d.jsx("button",{className:Z("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent/50",!U&&"bg-accent"),onClick:()=>{J(""),E(!1)},children:"Default"}),d.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:lt.map(we=>d.jsxs("div",{className:"mb-1 last:mb-0",children:[D==="opencode_local"&&d.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:[we.provider," (",we.entries.length,")"]}),we.entries.map($e=>d.jsx("button",{className:Z("flex items-center w-full px-2 py-1.5 text-sm rounded hover:bg-accent/50",$e.id===U&&"bg-accent"),onClick:()=>{J($e.id),E(!1)},children:d.jsx("span",{className:"block w-full text-left truncate",title:$e.id,children:D==="opencode_local"?z6($e.id):$e.label})},$e.id))]},we.provider))}),oe.length===0&&d.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models discovered."})]})]})]})]}),bi&&d.jsxs("div",{className:"space-y-2 rounded-md border border-border p-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-medium",children:"Adapter environment check"}),d.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Runs a live probe that asks the adapter CLI to respond with hello."})]}),d.jsx(Fe,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs",disabled:Ze,onClick:()=>void Es(),children:Ze?"Testing...":"Test now"})]}),xe&&d.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-[11px] text-destructive",children:xe}),ne&&ne.status==="pass"?d.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-green-300 dark:border-green-500/40 bg-green-50 dark:bg-green-500/10 px-3 py-2 text-xs text-green-700 dark:text-green-300 animate-in fade-in slide-in-from-bottom-1 duration-300",children:[d.jsx(Ir,{className:"h-3.5 w-3.5 shrink-0"}),d.jsx("span",{className:"font-medium",children:"Passed"})]}):ne?d.jsx(ARe,{result:ne}):null,dc&&d.jsxs("div",{className:"rounded-md border border-amber-300/60 bg-amber-50/40 px-2.5 py-2 space-y-2",children:[d.jsxs("p",{className:"text-[11px] text-amber-900/90 leading-relaxed",children:["Claude failed while"," ",d.jsx("span",{className:"font-mono",children:"ANTHROPIC_API_KEY"})," ","is set. You can clear it in this CEO adapter config and retry the probe."]}),d.jsx(Fe,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs",disabled:Ze||Qe,onClick:()=>void Uf(),children:Qe?"Retrying...":"Unset ANTHROPIC_API_KEY"})]}),ne&&ne.status==="fail"&&d.jsxs("div",{className:"rounded-md border border-border/70 bg-muted/20 px-2.5 py-2 text-[11px] space-y-1.5",children:[d.jsx("p",{className:"font-medium",children:"Manual debug"}),d.jsx("p",{className:"text-muted-foreground font-mono break-all",children:D==="cursor"?`${vi} -p --mode ask --output-format json "Respond with hello."`:D==="codex_local"?`${vi} exec --json -`:D==="gemini_local"?`${vi} --output-format json "Respond with hello."`:D==="opencode_local"?`${vi} run --format json "Respond with hello."`:`${vi} --print - --output-format stream-json --verbose`}),d.jsxs("p",{className:"text-muted-foreground",children:["Prompt:"," ",d.jsx("span",{className:"font-mono",children:"Respond with hello."})]}),D==="cursor"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"?d.jsxs("p",{className:"text-muted-foreground",children:["If auth fails, set"," ",d.jsx("span",{className:"font-mono",children:D==="cursor"?"CURSOR_API_KEY":D==="gemini_local"?"GEMINI_API_KEY":"OPENAI_API_KEY"})," ","in env or run"," ",d.jsx("span",{className:"font-mono",children:D==="cursor"?"agent login":D==="codex_local"?"codex login":D==="gemini_local"?"gemini auth":"opencode auth login"}),"."]}):d.jsxs("p",{className:"text-muted-foreground",children:["If login is required, run"," ",d.jsx("span",{className:"font-mono",children:"claude login"})," ","and retry."]})]})]}),D==="process"&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Command"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. node, python",value:P,onChange:we=>ie(we.target.value)})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Args (comma-separated)"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. script.js, --flag",value:ge,onChange:we=>ae(we.target.value)})]})]}),(D==="http"||D==="openclaw_gateway")&&d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:D==="openclaw_gateway"?"Gateway URL":"Webhook URL"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:D==="openclaw_gateway"?"ws://127.0.0.1:18789":"https://...",value:Y,onChange:we=>H(we.target.value)})]})]}),v===3&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(J1,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Give it something to do"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Give your agent a small task to start with — a bug fix, a research question, writing a script."})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Task title"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. Research competitor pricing",value:$,onChange:we=>X(we.target.value),autoFocus:!0})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Description (optional)"}),d.jsx("textarea",{ref:be,className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50 resize-none min-h-[120px] max-h-[300px] overflow-y-auto",placeholder:"Add more detail about what the agent should do...",value:se,onChange:we=>he(we.target.value)})]})]}),v===4&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(Rk,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Ready to launch"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Everything is set up. Launching now will create the starter task, wake the agent, and open the issue."})]})]}),d.jsxs("div",{className:"border border-border divide-y divide-border",children:[d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(G1,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:O}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Company"})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]}),d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(vh,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:V}),d.jsx("p",{className:"text-xs text-muted-foreground",children:up(D).label})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]}),d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(J1,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:$}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Task"})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]})]})]}),C&&d.jsx("div",{className:"mt-3",children:d.jsx("p",{className:"text-xs text-destructive",children:C})}),d.jsxs("div",{className:"flex items-center justify-between mt-8",children:[d.jsx("div",{children:v>1&&v>(e.initialStep??1)&&d.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>b(v-1),disabled:w,children:[d.jsx(k6,{className:"h-3.5 w-3.5 mr-1"}),"Back"]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[v===1&&d.jsxs(Fe,{size:"sm",disabled:!O.trim()||w,onClick:Go,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===2&&d.jsxs(Fe,{size:"sm",disabled:!V.trim()||w||Ze,onClick:Hs,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===3&&d.jsxs(Fe,{size:"sm",disabled:!$.trim()||w,onClick:Za,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===4&&d.jsxs(Fe,{size:"sm",disabled:w,onClick:ro,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Create & Open Issue"]})]})]})]})}),d.jsx("div",{className:Z("hidden md:block overflow-hidden bg-[#1d1d1d] transition-[width,opacity] duration-500 ease-in-out",v===1?"w-1/2 opacity-100":"w-0 opacity-0"),children:d.jsx($6,{})})]})]})}):null}function ARe({result:t}){const e=t.status==="pass"?"Passed":t.status==="warn"?"Warnings":"Failed",n=t.status==="pass"?"text-green-700 dark:text-green-300 border-green-300 dark:border-green-500/40 bg-green-50 dark:bg-green-500/10":t.status==="warn"?"text-amber-700 dark:text-amber-300 border-amber-300 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-500/10":"text-red-700 dark:text-red-300 border-red-300 dark:border-red-500/40 bg-red-50 dark:bg-red-500/10";return d.jsxs("div",{className:`rounded-md border px-2.5 py-2 text-[11px] ${n}`,children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"font-medium",children:e}),d.jsx("span",{className:"opacity-80",children:new Date(t.testedAt).toLocaleTimeString()})]}),d.jsx("div",{className:"mt-1.5 space-y-1",children:t.checks.map((r,s)=>d.jsxs("div",{className:"leading-relaxed break-words",children:[d.jsx("span",{className:"font-medium uppercase tracking-wide opacity-80",children:r.level}),d.jsx("span",{className:"mx-1 opacity-60",children:"·"}),d.jsx("span",{children:r.message}),r.detail&&d.jsxs("span",{className:"block opacity-75 break-all",children:["(",r.detail,")"]}),r.hint&&d.jsxs("span",{className:"block opacity-90 break-words",children:["Hint: ",r.hint]})]},`${r.code}-${s}`))})]})}export{_u as $,Vt as A,jc as B,lz as C,n2e as D,He as E,ue as F,hf as G,c_e as H,pn as I,S2e as J,Ee as K,P2 as L,le as M,LE as N,tK as O,LV as P,vq as Q,PRe as R,kMe as S,gn as T,CMe as U,_Me as V,SMe as W,Qi as X,Mr as Y,wMe as Z,CS as _,T2e as a,nMe as a$,Fe as a0,HMe as a1,UMe as a2,XMe as a3,Eq as a4,yb as a5,dMe as a6,mMe as a7,gMe as a8,fMe as a9,wd as aA,yMe as aB,Co as aC,gx as aD,Bt as aE,cg as aF,uMe as aG,pr as aH,t4e as aI,$je as aJ,Ry as aK,Cu as aL,os as aM,Zl as aN,Ui as aO,jie as aP,re as aQ,Lae as aR,Di as aS,FRe as aT,DRe as aU,zRe as aV,$Re as aW,iMe as aX,oMe as aY,ORe as aZ,tMe as a_,G1 as aa,Uoe as ab,pMe as ac,hMe as ad,en as ae,Z as af,e4e as ag,MRe as ah,n4e as ai,st as aj,mm as ak,rr as al,wt as am,jae as an,Rae as ao,bMe as ap,Mae as aq,Pae as ar,P6 as as,sp as at,Oae as au,OS as av,D6 as aw,Nae as ax,Tae as ay,Aae as az,$Me as b,j_ as b$,rMe as b0,aMe as b1,cMe as b2,sMe as b3,r4e as b4,s4e as b5,lMe as b6,RRe as b7,vf as b8,lr as b9,VRe as bA,TS as bB,TN as bC,Uje as bD,Wje as bE,$s as bF,Kje as bG,are as bH,m6 as bI,NN as bJ,gf as bK,n6 as bL,eMe as bM,dd as bN,wf as bO,sn as bP,zoe as bQ,rp as bR,aA as bS,lae as bT,Loe as bU,gm as bV,d6 as bW,Bs as bX,Xje as bY,Ds as bZ,I_ as b_,Wx as ba,_P as bb,QK as bc,iq as bd,lq as be,fq as bf,cq as bg,uq as bh,Jr as bi,pq as bj,tT as bk,dq as bl,br as bm,it as bn,ui as bo,Rt as bp,Le as bq,xJ as br,yJ as bs,cs as bt,Rl as bu,Su as bv,cre as bw,ure as bx,Fl as by,dre as bz,DMe as c,Al as c$,R_ as c0,M_ as c1,Vy as c2,qy as c3,y0 as c4,vh as c5,Oi as c6,lre as c7,V6 as c8,yoe as c9,Uie as cA,pm as cB,aie as cC,rd as cD,dg as cE,Kae as cF,qae as cG,Jae as cH,Zae as cI,Ok as cJ,ik as cK,R6 as cL,Aje as cM,Ije as cN,xm as cO,jje as cP,S4 as cQ,Rje as cR,Iu as cS,wU as cT,zH as cU,VNe as cV,lA as cW,X3e as cX,Gee as cY,VMe as cZ,zMe as c_,doe as ca,va as cb,cie as cc,Wi as cd,es as ce,ts as cf,ns as cg,oA as ch,GRe as ci,NRe as cj,Yee as ck,Qee as cl,PS as cm,k6 as cn,N6 as co,I6 as cp,J2 as cq,v0 as cr,_oe as cs,FP as ct,BRe as cu,qx as cv,zne as cw,O6 as cx,Ir as cy,vl as cz,v_e as d,lRe as d$,In as d0,_4 as d1,BU as d2,UNe as d3,WNe as d4,E6 as d5,LU as d6,nje as d7,sd as d8,YD as d9,aX as dA,oX as dB,lX as dC,cX as dD,uX as dE,dX as dF,WRe as dG,fX as dH,KRe as dI,IS as dJ,qRe as dK,_b as dL,Mk as dM,Et as dN,cp as dO,lp as dP,JMe as dQ,GMe as dR,qje as dS,ZMe as dT,Zje as dU,Qje as dV,Yje as dW,YMe as dX,QMe as dY,oRe as dZ,aRe as d_,fA as da,v6 as db,nIe as dc,kP as dd,WMe as de,OU as df,HH as dg,Ih as dh,nx as di,Koe as dj,toe as dk,die as dl,jS as dm,Zm as dn,JRe as dp,Sr as dq,ZRe as dr,jk as ds,YRe as dt,XRe as du,kS as dv,QRe as dw,Nt as dx,sX as dy,iX as dz,Rr as e,cRe as e0,dRe as e1,uRe as e2,vMe as e3,hje as e4,mje as e5,KMe as e6,qMe as e7,xMe as e8,J1 as e9,coe as ea,x0 as eb,RS as ec,kie as ed,SN as ee,Dk as ef,Qae as eg,Goe as eh,qee as ei,RNe as ej,ip as ek,w0 as el,ap as em,op as en,up as eo,$2e as f,Ce as g,OMe as h,VV as i,FMe as j,ls as k,jt as l,LMe as m,BMe as n,RMe as o,MMe as p,Qs as q,$f as r,v2e as s,pe as t,lc as u,Bm as v,ni as w,m1 as x,F2e as y,$V as z};
|
|
834
|
+
After that, hire yourself a Founding Engineer agent and then plan the roadmap and tasks for your new company.`;function s4e(){const{onboardingOpen:t,onboardingOptions:e,closeOnboarding:n}=CS(),{companies:r,setSelectedCompanyId:s,loading:i}=Qi(),o=rr(),a=Su(),l=Mr(),{companyPrefix:c}=_u(),[u,f]=x.useState(!1),h=c&&i?null:Fae({pathname:l.pathname,companyPrefix:c,companies:r}),p=t||h!==null&&!u,m=t?e:h??{},g=m.initialStep??1,y=m.companyId,[v,b]=x.useState(g),[w,k]=x.useState(!1),[C,_]=x.useState(null),[S,E]=x.useState(!1),[N,T]=x.useState(""),[O,L]=x.useState(""),[I,M]=x.useState(""),[V,G]=x.useState("CEO"),[D,B]=x.useState("claude_local"),[F,R]=x.useState(""),[U,J]=x.useState(""),[P,ie]=x.useState(""),[ge,ae]=x.useState(""),[Y,H]=x.useState(""),[ne,de]=x.useState(null),[xe,Oe]=x.useState(null),[Ze,ot]=x.useState(!1),[pt,ye]=x.useState(!1),[Qe,z]=x.useState(!1),[te,ke]=x.useState(!1),[$,X]=x.useState("Create your CEO HEARTBEAT.md"),[se,he]=x.useState(U4),be=x.useRef(null),W=x.useCallback(()=>{const we=be.current;we&&(we.style.height="auto",we.style.height=we.scrollHeight+"px")},[]),[ee,A]=x.useState(y??null),[ce,Me]=x.useState(null),[at,Xt]=x.useState(null),[Ht,sr]=x.useState(null);x.useEffect(()=>{f(!1)},[l.pathname]),x.useEffect(()=>{if(!p)return;const we=m.companyId??null;b(m.initialStep??1),A(we),Me(null)},[p,m.companyId,m.initialStep]),x.useEffect(()=>{if(!p||!ee||ce)return;const we=r.find($e=>$e.id===ee);we&&Me(we.issuePrefix)},[p,ee,ce,r]),x.useEffect(()=>{v===3&&W()},[v,se,W]);const{data:ur,error:Sn,isLoading:Dt,isFetching:dr}=st({queryKey:ee?re.agents.adapterModels(ee,D):["agents","none","adapter-models",D],queryFn:()=>Bt.adapterModels(ee,D),enabled:!!ee&&p&&v===2}),bi=D==="claude_local"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"||D==="cursor",vi=P.trim()||(D==="codex_local"?"codex":D==="gemini_local"?"gemini":D==="cursor"?"agent":D==="opencode_local"?"opencode":"claude");x.useEffect(()=>{v===2&&(de(null),Oe(null))},[v,D,F,U,P,ge,Y]);const uc=(ur??[]).find(we=>we.id===U),$u=(ne==null?void 0:ne.checks.some(we=>we.code==="claude_anthropic_api_key_overrides_subscription"))??!1,dc=D==="claude_local"&&(ne==null?void 0:ne.status)==="fail"&&$u,oe=x.useMemo(()=>{const we=N.trim().toLowerCase();return(ur??[]).filter($e=>{if(!we)return!0;const Ln=jh($e.id,"");return $e.id.toLowerCase().includes(we)||$e.label.toLowerCase().includes(we)||Ln.toLowerCase().includes(we)})},[ur,N]),lt=x.useMemo(()=>{if(D!=="opencode_local")return[{provider:"models",entries:[...oe].sort(($e,Ln)=>$e.id.localeCompare(Ln.id))}];const we=new Map;for(const $e of oe){const Ln=jh($e.id),so=we.get(Ln)??[];so.push($e),we.set(Ln,so)}return Array.from(we.entries()).sort(([$e],[Ln])=>$e.localeCompare(Ln)).map(([$e,Ln])=>({provider:$e,entries:[...Ln].sort((so,Bu)=>so.id.localeCompare(Bu.id))}))},[oe,D]);function Ye(){b(1),k(!1),_(null),L(""),M(""),G("CEO"),B("claude_local"),R(""),J(""),ie(""),ae(""),H(""),de(null),Oe(null),ot(!1),ye(!1),z(!1),X("Create your CEO HEARTBEAT.md"),he(U4),A(null),Me(null),Xt(null),sr(null)}function xn(){Ye(),n()}function Pr(){const $e=up(D).buildAdapterConfig({...Dk,adapterType:D,cwd:F,model:D==="codex_local"?U||ip:D==="gemini_local"?U||ap:D==="cursor"?U||op:U,command:P,args:ge,url:Y,dangerouslySkipPermissions:D==="claude_local",dangerouslyBypassSandbox:D==="codex_local"?w0:Dk.dangerouslyBypassSandbox});if(D==="claude_local"&&pt){const Ln=typeof $e.env=="object"&&$e.env!==null&&!Array.isArray($e.env)?{...$e.env}:{};Ln.ANTHROPIC_API_KEY={type:"plain",value:""},$e.env=Ln}return $e}async function Es(we){if(!ee)return Oe("Create or select a company before testing adapter environment."),null;ot(!0),Oe(null);try{const $e=await Bt.testEnvironment(ee,D,{adapterConfig:we??Pr()});return de($e),$e}catch($e){return Oe($e instanceof Error?$e.message:"Adapter environment test failed"),null}finally{ot(!1)}}async function Go(){k(!0),_(null);try{const we=await ik.create({name:O.trim()});if(A(we.id),Me(we.issuePrefix),s(we.id),o.invalidateQueries({queryKey:re.companies.all}),I.trim()){const $e=TRe(I);await NRe.create(we.id,{title:$e.title,...$e.description?{description:$e.description}:{},level:"company",status:"active"}),o.invalidateQueries({queryKey:re.goals.list(we.id)})}b(2)}catch(we){_(we instanceof Error?we.message:"Failed to create company")}finally{k(!1)}}async function Hs(){if(ee){k(!0),_(null);try{if(D==="opencode_local"){const $e=U.trim();if(!$e){_("OpenCode requires an explicit model in provider/model format.");return}if(Sn){_(Sn instanceof Error?Sn.message:"Failed to load OpenCode models.");return}if(Dt||dr){_("OpenCode models are still loading. Please wait and try again.");return}const Ln=ur??[];if(!Ln.some(so=>so.id===$e)){_(Ln.length===0?"No OpenCode models discovered. Run `opencode models` and authenticate providers.":`Configured OpenCode model is unavailable: ${$e}`);return}}if(bi&&!(ne??await Es()))return;const we=await Bt.create(ee,{name:V.trim(),role:"ceo",adapterType:D,adapterConfig:Pr(),runtimeConfig:{heartbeat:{enabled:!0,intervalSec:3600,wakeOnDemand:!0,cooldownSec:10,maxConcurrentRuns:1}}});Xt(we.id),o.invalidateQueries({queryKey:re.agents.list(ee)}),b(3)}catch(we){_(we instanceof Error?we.message:"Failed to create agent")}finally{k(!1)}}}async function Uf(){if(!ee||Qe)return;z(!0),_(null),Oe(null),ye(!0);const we=(()=>{const $e=Pr(),Ln=typeof $e.env=="object"&&$e.env!==null&&!Array.isArray($e.env)?{...$e.env}:{};return Ln.ANTHROPIC_API_KEY={type:"plain",value:""},$e.env=Ln,$e})();try{at&&(await Bt.update(at,{adapterConfig:we},ee),o.invalidateQueries({queryKey:re.agents.list(ee)}));const $e=await Es(we);($e==null?void 0:$e.status)==="fail"&&_("Retried with ANTHROPIC_API_KEY unset in adapter config, but the environment test is still failing.")}catch($e){_($e instanceof Error?$e.message:"Failed to unset ANTHROPIC_API_KEY and retry.")}finally{z(!1)}}async function Za(){!ee||!at||(_(null),b(4))}async function ro(){if(!(!ee||!at)){k(!0),_(null);try{let we=Ht;if(!we){const $e=await sn.create(ee,{title:$.trim(),...se.trim()?{description:se.trim()}:{},assigneeAgentId:at,status:"todo"});we=$e.identifier??$e.id,sr(we),o.invalidateQueries({queryKey:re.issues.list(ee)})}s(ee),Ye(),n(),a(ce?`/${ce}/issues/${we}`:`/issues/${we}`)}catch(we){_(we instanceof Error?we.message:"Failed to create task")}finally{k(!1)}}}function fc(we){we.key==="Enter"&&(we.metaKey||we.ctrlKey)&&(we.preventDefault(),v===1&&O.trim()?Go():v===2&&V.trim()?Hs():v===3&&$.trim()?Za():v===4&&ro())}return p?d.jsx(OS,{open:p,onOpenChange:we=>{we||(f(!0),xn())},children:d.jsxs(L6,{children:[d.jsx("div",{className:"fixed inset-0 z-50 bg-background"}),d.jsxs("div",{className:"fixed inset-0 z-50 flex",onKeyDown:fc,children:[d.jsxs("button",{onClick:xn,className:"absolute top-4 left-4 z-10 rounded-sm p-1.5 text-muted-foreground/60 hover:text-foreground transition-colors",children:[d.jsx(Bs,{className:"h-5 w-5"}),d.jsx("span",{className:"sr-only",children:"Close"})]}),d.jsx("div",{className:Z("w-full flex flex-col overflow-y-auto transition-[width] duration-500 ease-in-out",v===1?"md:w-1/2":"md:w-full"),children:d.jsxs("div",{className:"w-full max-w-md mx-auto my-auto px-8 py-12 shrink-0",children:[d.jsx("div",{className:"flex items-center gap-0 mb-8 border-b border-border",children:[{step:1,label:"Company",icon:G1},{step:2,label:"Agent",icon:vh},{step:3,label:"Task",icon:J1},{step:4,label:"Launch",icon:Rk}].map(({step:we,label:$e,icon:Ln})=>d.jsxs("button",{type:"button",onClick:()=>b(we),className:Z("flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 -mb-px transition-colors cursor-pointer",we===v?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground/70 hover:border-border"),children:[d.jsx(Ln,{className:"h-3.5 w-3.5"}),$e]},we))}),v===1&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(G1,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Name your company"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"This is the organization your agents will work for."})]})]}),d.jsxs("div",{className:"mt-3 group",children:[d.jsx("label",{className:Z("text-xs mb-1 block transition-colors",O.trim()?"text-foreground":"text-muted-foreground group-focus-within:text-foreground"),children:"Company name"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"Acme Corp",value:O,onChange:we=>L(we.target.value),autoFocus:!0})]}),d.jsxs("div",{className:"group",children:[d.jsx("label",{className:Z("text-xs mb-1 block transition-colors",I.trim()?"text-foreground":"text-muted-foreground group-focus-within:text-foreground"),children:"Mission / goal (optional)"}),d.jsx("textarea",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50 resize-none min-h-[60px]",placeholder:"What is this company trying to achieve?",value:I,onChange:we=>M(we.target.value)})]})]}),v===2&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(vh,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Create your first agent"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose how this agent will run tasks."})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Agent name"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"CEO",value:V,onChange:we=>G(we.target.value),autoFocus:!0})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-2 block",children:"Adapter type"}),d.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"claude_local",label:"Claude Code",icon:PS,desc:"Local Claude agent",recommended:!0},{value:"codex_local",label:"Codex",icon:N6,desc:"Local Codex agent",recommended:!0}].map(we=>d.jsxs("button",{className:Z("flex flex-col items-center gap-1.5 rounded-md border p-3 text-xs transition-colors relative",D===we.value?"border-foreground bg-accent":"border-border hover:bg-accent/50"),onClick:()=>{const $e=we.value;B($e),$e==="codex_local"&&!U&&J(ip),$e!=="codex_local"&&J("")},children:[we.recommended&&d.jsx("span",{className:"absolute -top-1.5 right-1.5 bg-green-500 text-white text-[9px] font-semibold px-1.5 py-0.5 rounded-full leading-none",children:"Recommended"}),d.jsx(we.icon,{className:"h-4 w-4"}),d.jsx("span",{className:"font-medium",children:we.label}),d.jsx("span",{className:"text-muted-foreground text-[10px]",children:we.desc})]},we.value))}),d.jsxs("button",{className:"flex items-center gap-1.5 mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>ke(we=>!we),children:[d.jsx(os,{className:Z("h-3 w-3 transition-transform",te?"rotate-0":"-rotate-90")}),"More Agent Adapter Types"]}),te&&d.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[{value:"gemini_local",label:"Gemini CLI",icon:I6,desc:"Local Gemini agent"},{value:"process",label:"Process",icon:v0,desc:"Run a local command"},{value:"opencode_local",label:"OpenCode",icon:J2,desc:"Local multi-provider agent"},{value:"pi_local",label:"Pi",icon:v0,desc:"Local Pi agent"},{value:"cursor",label:"Cursor",icon:_oe,desc:"Local Cursor agent"},{value:"openclaw_gateway",label:"OpenClaw Gateway",icon:vh,desc:"Invoke OpenClaw via gateway protocol",comingSoon:!0,disabledLabel:"Configure OpenClaw within the App"}].map(we=>d.jsxs("button",{disabled:!!we.comingSoon,className:Z("flex flex-col items-center gap-1.5 rounded-md border p-3 text-xs transition-colors relative",we.comingSoon?"border-border opacity-40 cursor-not-allowed":D===we.value?"border-foreground bg-accent":"border-border hover:bg-accent/50"),onClick:()=>{if(we.comingSoon)return;const $e=we.value;if(B($e),$e==="gemini_local"&&!U){J(ap);return}if($e==="cursor"&&!U){J(op);return}if($e==="opencode_local"){U.includes("/")||J("");return}J("")},children:[d.jsx(we.icon,{className:"h-4 w-4"}),d.jsx("span",{className:"font-medium",children:we.label}),d.jsx("span",{className:"text-muted-foreground text-[10px]",children:we.comingSoon?we.disabledLabel??"Coming soon":we.desc})]},we.value))})]}),(D==="claude_local"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"||D==="pi_local"||D==="cursor")&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[d.jsx("label",{className:"text-xs text-muted-foreground",children:"Working directory"}),d.jsx(lp,{text:"Growthub works best if you create a new folder for your agents to keep their memories and stay organized. Create a new folder and put the path here."})]}),d.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border px-2.5 py-1.5",children:[d.jsx(A6,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),d.jsx("input",{className:"w-full bg-transparent outline-none text-sm font-mono placeholder:text-muted-foreground/50",placeholder:"/path/to/project",value:F,onChange:we=>R(we.target.value)}),d.jsx(Wi,{})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Model"}),d.jsxs(es,{open:S,onOpenChange:we=>{E(we),we||T("")},children:[d.jsx(ts,{asChild:!0,children:d.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-sm hover:bg-accent/50 transition-colors w-full justify-between",children:[d.jsx("span",{className:Z(!U&&"text-muted-foreground"),children:uc?uc.label:U||(D==="opencode_local"?"Select model (required)":"Default")}),d.jsx(os,{className:"h-3 w-3 text-muted-foreground"})]})}),d.jsxs(ns,{className:"w-[var(--radix-popover-trigger-width)] p-1",align:"start",children:[d.jsx("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-border mb-1 placeholder:text-muted-foreground/50",placeholder:"Search models...",value:N,onChange:we=>T(we.target.value),autoFocus:!0}),D!=="opencode_local"&&d.jsx("button",{className:Z("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent/50",!U&&"bg-accent"),onClick:()=>{J(""),E(!1)},children:"Default"}),d.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:lt.map(we=>d.jsxs("div",{className:"mb-1 last:mb-0",children:[D==="opencode_local"&&d.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:[we.provider," (",we.entries.length,")"]}),we.entries.map($e=>d.jsx("button",{className:Z("flex items-center w-full px-2 py-1.5 text-sm rounded hover:bg-accent/50",$e.id===U&&"bg-accent"),onClick:()=>{J($e.id),E(!1)},children:d.jsx("span",{className:"block w-full text-left truncate",title:$e.id,children:D==="opencode_local"?z6($e.id):$e.label})},$e.id))]},we.provider))}),oe.length===0&&d.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models discovered."})]})]})]})]}),bi&&d.jsxs("div",{className:"space-y-2 rounded-md border border-border p-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-medium",children:"Adapter environment check"}),d.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Runs a live probe that asks the adapter CLI to respond with hello."})]}),d.jsx(Fe,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs",disabled:Ze,onClick:()=>void Es(),children:Ze?"Testing...":"Test now"})]}),xe&&d.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-[11px] text-destructive",children:xe}),ne&&ne.status==="pass"?d.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-green-300 dark:border-green-500/40 bg-green-50 dark:bg-green-500/10 px-3 py-2 text-xs text-green-700 dark:text-green-300 animate-in fade-in slide-in-from-bottom-1 duration-300",children:[d.jsx(Ir,{className:"h-3.5 w-3.5 shrink-0"}),d.jsx("span",{className:"font-medium",children:"Passed"})]}):ne?d.jsx(ARe,{result:ne}):null,dc&&d.jsxs("div",{className:"rounded-md border border-amber-300/60 bg-amber-50/40 px-2.5 py-2 space-y-2",children:[d.jsxs("p",{className:"text-[11px] text-amber-900/90 leading-relaxed",children:["Claude failed while"," ",d.jsx("span",{className:"font-mono",children:"ANTHROPIC_API_KEY"})," ","is set. You can clear it in this CEO adapter config and retry the probe."]}),d.jsx(Fe,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs",disabled:Ze||Qe,onClick:()=>void Uf(),children:Qe?"Retrying...":"Unset ANTHROPIC_API_KEY"})]}),ne&&ne.status==="fail"&&d.jsxs("div",{className:"rounded-md border border-border/70 bg-muted/20 px-2.5 py-2 text-[11px] space-y-1.5",children:[d.jsx("p",{className:"font-medium",children:"Manual debug"}),d.jsx("p",{className:"text-muted-foreground font-mono break-all",children:D==="cursor"?`${vi} -p --mode ask --output-format json "Respond with hello."`:D==="codex_local"?`${vi} exec --json -`:D==="gemini_local"?`${vi} --output-format json "Respond with hello."`:D==="opencode_local"?`${vi} run --format json "Respond with hello."`:`${vi} --print - --output-format stream-json --verbose`}),d.jsxs("p",{className:"text-muted-foreground",children:["Prompt:"," ",d.jsx("span",{className:"font-mono",children:"Respond with hello."})]}),D==="cursor"||D==="codex_local"||D==="gemini_local"||D==="opencode_local"?d.jsxs("p",{className:"text-muted-foreground",children:["If auth fails, set"," ",d.jsx("span",{className:"font-mono",children:D==="cursor"?"CURSOR_API_KEY":D==="gemini_local"?"GEMINI_API_KEY":"OPENAI_API_KEY"})," ","in env or run"," ",d.jsx("span",{className:"font-mono",children:D==="cursor"?"agent login":D==="codex_local"?"codex login":D==="gemini_local"?"gemini auth":"opencode auth login"}),"."]}):d.jsxs("p",{className:"text-muted-foreground",children:["If login is required, run"," ",d.jsx("span",{className:"font-mono",children:"claude login"})," ","and retry."]})]})]}),D==="process"&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Command"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. node, python",value:P,onChange:we=>ie(we.target.value)})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Args (comma-separated)"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. script.js, --flag",value:ge,onChange:we=>ae(we.target.value)})]})]}),(D==="http"||D==="openclaw_gateway")&&d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:D==="openclaw_gateway"?"Gateway URL":"Webhook URL"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm font-mono outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:D==="openclaw_gateway"?"ws://127.0.0.1:18789":"https://...",value:Y,onChange:we=>H(we.target.value)})]})]}),v===3&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(J1,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Give it something to do"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Give your agent a small task to start with — a bug fix, a research question, writing a script."})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Task title"}),d.jsx("input",{className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50",placeholder:"e.g. Research competitor pricing",value:$,onChange:we=>X(we.target.value),autoFocus:!0})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Description (optional)"}),d.jsx("textarea",{ref:be,className:"w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50 resize-none min-h-[120px] max-h-[300px] overflow-y-auto",placeholder:"Add more detail about what the agent should do...",value:se,onChange:we=>he(we.target.value)})]})]}),v===4&&d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("div",{className:"bg-muted/50 p-2",children:d.jsx(Rk,{className:"h-5 w-5 text-muted-foreground"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Ready to launch"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Everything is set up. Launching now will create the starter task, wake the agent, and open the issue."})]})]}),d.jsxs("div",{className:"border border-border divide-y divide-border",children:[d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(G1,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:O}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Company"})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]}),d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(vh,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:V}),d.jsx("p",{className:"text-xs text-muted-foreground",children:up(D).label})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]}),d.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[d.jsx(J1,{className:"h-4 w-4 text-muted-foreground shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:$}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Task"})]}),d.jsx(Ir,{className:"h-4 w-4 text-green-500 shrink-0"})]})]})]}),C&&d.jsx("div",{className:"mt-3",children:d.jsx("p",{className:"text-xs text-destructive",children:C})}),d.jsxs("div",{className:"flex items-center justify-between mt-8",children:[d.jsx("div",{children:v>1&&v>(e.initialStep??1)&&d.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>b(v-1),disabled:w,children:[d.jsx(k6,{className:"h-3.5 w-3.5 mr-1"}),"Back"]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[v===1&&d.jsxs(Fe,{size:"sm",disabled:!O.trim()||w,onClick:Go,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===2&&d.jsxs(Fe,{size:"sm",disabled:!V.trim()||w||Ze,onClick:Hs,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===3&&d.jsxs(Fe,{size:"sm",disabled:!$.trim()||w,onClick:Za,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Next"]}),v===4&&d.jsxs(Fe,{size:"sm",disabled:w,onClick:ro,children:[w?d.jsx(Co,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):d.jsx(vl,{className:"h-3.5 w-3.5 mr-1"}),w?"Creating...":"Create & Open Issue"]})]})]})]})}),d.jsx("div",{className:Z("hidden md:block overflow-hidden bg-[#1d1d1d] transition-[width,opacity] duration-500 ease-in-out",v===1?"w-1/2 opacity-100":"w-0 opacity-0"),children:d.jsx($6,{})})]})]})}):null}function ARe({result:t}){const e=t.status==="pass"?"Passed":t.status==="warn"?"Warnings":"Failed",n=t.status==="pass"?"text-green-700 dark:text-green-300 border-green-300 dark:border-green-500/40 bg-green-50 dark:bg-green-500/10":t.status==="warn"?"text-amber-700 dark:text-amber-300 border-amber-300 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-500/10":"text-red-700 dark:text-red-300 border-red-300 dark:border-red-500/40 bg-red-50 dark:bg-red-500/10";return d.jsxs("div",{className:`rounded-md border px-2.5 py-2 text-[11px] ${n}`,children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"font-medium",children:e}),d.jsx("span",{className:"opacity-80",children:new Date(t.testedAt).toLocaleTimeString()})]}),d.jsx("div",{className:"mt-1.5 space-y-1",children:t.checks.map((r,s)=>d.jsxs("div",{className:"leading-relaxed break-words",children:[d.jsx("span",{className:"font-medium uppercase tracking-wide opacity-80",children:r.level}),d.jsx("span",{className:"mx-1 opacity-60",children:"·"}),d.jsx("span",{children:r.message}),r.detail&&d.jsxs("span",{className:"block opacity-75 break-all",children:["(",r.detail,")"]}),r.hint&&d.jsxs("span",{className:"block opacity-90 break-words",children:["Hint: ",r.hint]})]},`${r.code}-${s}`))})]})}export{_u as $,Vt as A,jc as B,lz as C,n2e as D,He as E,ue as F,hf as G,c_e as H,pn as I,S2e as J,Ee as K,P2 as L,le as M,LE as N,tK as O,LV as P,vq as Q,PRe as R,kMe as S,gn as T,CMe as U,_Me as V,SMe as W,Qi as X,Mr as Y,wMe as Z,CS as _,T2e as a,nMe as a$,Fe as a0,HMe as a1,UMe as a2,XMe as a3,Eq as a4,yb as a5,dMe as a6,mMe as a7,gMe as a8,fMe as a9,wd as aA,yMe as aB,Co as aC,gx as aD,jie as aE,Bt as aF,cg as aG,uMe as aH,pr as aI,t4e as aJ,$je as aK,Ry as aL,Cu as aM,os as aN,Zl as aO,Ui as aP,re as aQ,Lae as aR,Di as aS,FRe as aT,DRe as aU,zRe as aV,$Re as aW,iMe as aX,oMe as aY,ORe as aZ,tMe as a_,G1 as aa,Uoe as ab,pMe as ac,hMe as ad,en as ae,Z as af,e4e as ag,MRe as ah,n4e as ai,st as aj,mm as ak,rr as al,wt as am,jae as an,Rae as ao,bMe as ap,Mae as aq,Pae as ar,P6 as as,sp as at,Oae as au,OS as av,D6 as aw,Nae as ax,Tae as ay,Aae as az,$Me as b,j_ as b$,rMe as b0,aMe as b1,cMe as b2,sMe as b3,r4e as b4,s4e as b5,lMe as b6,RRe as b7,vf as b8,lr as b9,VRe as bA,TS as bB,TN as bC,Uje as bD,Wje as bE,$s as bF,Kje as bG,are as bH,m6 as bI,NN as bJ,gf as bK,n6 as bL,eMe as bM,dd as bN,wf as bO,sn as bP,zoe as bQ,rp as bR,aA as bS,lae as bT,Loe as bU,gm as bV,d6 as bW,Bs as bX,Xje as bY,Ds as bZ,I_ as b_,Wx as ba,_P as bb,QK as bc,iq as bd,lq as be,fq as bf,cq as bg,uq as bh,Jr as bi,pq as bj,tT as bk,dq as bl,br as bm,it as bn,ui as bo,Rt as bp,Le as bq,xJ as br,yJ as bs,cs as bt,Rl as bu,Su as bv,cre as bw,ure as bx,Fl as by,dre as bz,DMe as c,Al as c$,R_ as c0,M_ as c1,Vy as c2,qy as c3,y0 as c4,vh as c5,Oi as c6,lre as c7,V6 as c8,yoe as c9,Uie as cA,pm as cB,aie as cC,rd as cD,dg as cE,Kae as cF,qae as cG,Jae as cH,Zae as cI,Ok as cJ,ik as cK,R6 as cL,Aje as cM,Ije as cN,xm as cO,jje as cP,S4 as cQ,Rje as cR,Iu as cS,wU as cT,zH as cU,VNe as cV,lA as cW,X3e as cX,Gee as cY,VMe as cZ,zMe as c_,doe as ca,va as cb,cie as cc,Wi as cd,es as ce,ts as cf,ns as cg,oA as ch,GRe as ci,NRe as cj,Yee as ck,Qee as cl,PS as cm,k6 as cn,N6 as co,I6 as cp,J2 as cq,v0 as cr,_oe as cs,FP as ct,BRe as cu,qx as cv,zne as cw,O6 as cx,Ir as cy,vl as cz,v_e as d,lRe as d$,In as d0,_4 as d1,BU as d2,UNe as d3,WNe as d4,E6 as d5,LU as d6,nje as d7,sd as d8,YD as d9,aX as dA,oX as dB,lX as dC,cX as dD,uX as dE,dX as dF,WRe as dG,fX as dH,KRe as dI,IS as dJ,qRe as dK,_b as dL,Mk as dM,Et as dN,cp as dO,lp as dP,JMe as dQ,GMe as dR,qje as dS,ZMe as dT,Zje as dU,Qje as dV,Yje as dW,YMe as dX,QMe as dY,oRe as dZ,aRe as d_,fA as da,v6 as db,nIe as dc,kP as dd,WMe as de,OU as df,HH as dg,Ih as dh,nx as di,Koe as dj,toe as dk,die as dl,jS as dm,Zm as dn,JRe as dp,Sr as dq,ZRe as dr,jk as ds,YRe as dt,XRe as du,kS as dv,QRe as dw,Nt as dx,sX as dy,iX as dz,Rr as e,cRe as e0,dRe as e1,uRe as e2,vMe as e3,hje as e4,mje as e5,KMe as e6,qMe as e7,xMe as e8,J1 as e9,coe as ea,x0 as eb,RS as ec,kie as ed,SN as ee,Dk as ef,Qae as eg,Goe as eh,qee as ei,RNe as ej,ip as ek,w0 as el,ap as em,op as en,up as eo,$2e as f,Ce as g,OMe as h,VV as i,FMe as j,ls as k,jt as l,LMe as m,BMe as n,RMe as o,MMe as p,Qs as q,$f as r,v2e as s,pe as t,lc as u,Bm as v,ni as w,m1 as x,F2e as y,$V as z};
|