spec-cat 0.1.64 → 0.1.65
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DaYnMifu.js → B-bFNWCF.js} +1 -1
- package/.output/public/_nuxt/{Cqzfu4b1.js → BEWSHKZd.js} +1 -1
- package/.output/public/_nuxt/{C5uvKiQJ.js → BHhMtuRK.js} +1 -1
- package/.output/public/_nuxt/{FCWUBLV4.js → BwRpECPL.js} +1 -1
- package/.output/public/_nuxt/{Be7Q-KZm.js → CC_9aMCT.js} +1 -1
- package/.output/public/_nuxt/CHHbeXzh.js +1 -0
- package/.output/public/_nuxt/{CJOi1pKi.js → CzV__9yP.js} +2 -2
- package/.output/public/_nuxt/{DntGb46R.js → DWDrIutw.js} +1 -1
- package/.output/public/_nuxt/{BOa_3MnO.js → D_4Ow2w2.js} +1 -1
- package/.output/public/_nuxt/{CrxPmt5A.js → D_T_F7lf.js} +1 -1
- package/.output/public/_nuxt/{C0xGK0_5.js → DqFq1MXh.js} +1 -1
- package/.output/public/_nuxt/YzuyFhrD.js +174 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/cdc4ded8-9ff7-4e22-abbe-3b8c94caa781.json +1 -0
- package/.output/public/_nuxt/{default.DKcvUy2t.css → default.Cyeq1Er8.css} +1 -1
- package/.output/public/_nuxt/{DhK8N2yk.js → uyJF9wDo.js} +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +593 -600
- package/.output/server/package.json +1 -1
- package/package.json +3 -1
- package/.output/public/_nuxt/D0ZHasco.js +0 -105
- package/.output/public/_nuxt/DIUADCOG.js +0 -1
- package/.output/public/_nuxt/builds/meta/39e9ce1e-ba3f-4066-8a58-66dfecfe2817.json +0 -1
- package/.output/public/_nuxt/builds/meta/dev.json +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BOa_3MnO.js","./CJOi1pKi.js","./entry.uBSFaL6A.css","./C0xGK0_5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{y,z as _,A as m,d as Xe,C as oe,G as O,S as qe,U as rt,V as ui,K as $e,E as Ze,B as I,I as se,g as A,L as je,W as Ps,k as ae,N as qi,J as Ee,H as Se,o as kt,X as si,Y as Ex,M as He,Z as ai,T as zi,_ as Ja,P as zf,$ as Me,a0 as uc,R as Nr,D as ft,O as gi,a1 as n0,a2 as Ni,a3 as Ms,a4 as Uu,a5 as Dx,c as Lx,a6 as nm,s as ma,a7 as Ix,q as Nx,a8 as zx,x as Zx,a9 as xl}from"./CJOi1pKi.js";import{r as Gt,c as Er,b as yh,a as un}from"./DntGb46R.js";import{c as _h,m as Xx,p as Wx,d as om,r as Vx,i as am,a as Fx,j as Hx,k as qx,w as Yx,l as jx,e as Ux,u as o0,n as lm,C as Gx,o as Tn,f as Zf,s as Kx,q as Jx,b as Xf,g as cm,h as hm}from"./DhK8N2yk.js";import{_ as ns}from"./DlAUqK2U.js";import{S as Mc,s as Gu,i as eS,b as tS,P as iS,W as um,M as dm,c as fm,d as pm,g as mm,e as rS,D as ga,f as sS,j as nS,a as el,k as Si,u as tl,l as Sl,m as wl}from"./BOa_3MnO.js";import{u as gm,_ as oS}from"./C5uvKiQJ.js";function aS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})])}function lS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function cS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25"})])}function hS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function uS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function a0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function l0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function c0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function h0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})])}function u0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})])}function d0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function dS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function fS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function pS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function f0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})])}function mS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})])}function Wf(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function gS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Bc(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function OS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function p0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})])}function Un(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function m0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function vS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 9.75 16.5 12l-2.25 2.25m-4.5 0L7.5 12l2.25-2.25M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function Ku(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function g0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})])}function bS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"})])}function yS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})])}function _S(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})])}function dn(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function Bs(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function xS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}function SS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function wS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function kS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})])}function CS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"})])}function $S(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}function PS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})])}function O0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})])}function ln(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function QS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function v0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})])}function TS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function Om(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function b0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"})])}function MS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})])}function y0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})])}function _0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"})])}function Ca(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function x0(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})])}function Vf(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function BS(t,e){return y(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}async function vm(t){return $fetch("/api/chat/worktree",{method:"POST",body:t})}async function AS(t){await $fetch("/api/chat/worktree",{method:"DELETE",body:t})}async function RS(t){const e=await $fetch("/api/chat/preview-sync",{method:"POST",body:t});if(!e.success)throw new Error(e.error||"Unknown preview sync failure")}const ES={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},DS={class:"relative flex-1 min-w-0"},LS={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},IS=["disabled"],NS=["disabled"],zS=Xe({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(t,{expose:e,emit:i}){const r=i,s=A(""),n=A(null);let o=null;function a(){o&&clearTimeout(o),o=setTimeout(()=>{r("search",s.value)},200)}function l(h){h.key==="Escape"?(h.preventDefault(),r("close")):h.key==="Enter"&&(h.preventDefault(),h.shiftKey?r("prev"):r("next"))}function c(){n.value?.focus(),n.value?.select()}return e({focus:c}),(h,u)=>(y(),_("div",ES,[oe(O(ln),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("div",DS,[qe(m("input",{ref_key:"inputRef",ref:n,"onUpdate:modelValue":u[0]||(u[0]=d=>rt(s)?s.value=d:null),type:"text",placeholder:"Find in commits...","aria-label":"Search commits",class:"w-full px-2 py-1 text-sm bg-retro-dark border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onInput:a,onKeydown:l},null,544),[[ui,O(s)]])]),O(s)?(y(),_("span",LS,[t.resultCount>0?(y(),_($e,{key:0},[Ze(I(t.currentIndex+1)+" of "+I(t.resultCount),1)],64)):(y(),_($e,{key:1},[Ze(" No results ")],64))])):se("",!0),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:t.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:u[1]||(u[1]=d=>r("prev"))},[oe(O(OS),{class:"w-4 h-4"})],8,IS),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:t.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:u[2]||(u[2]=d=>r("next"))},[oe(O(gS),{class:"w-4 h-4"})],8,NS),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:u[3]||(u[3]=d=>r("close"))},[oe(O(Gt),{class:"w-4 h-4"})])]))}}),ZS={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},XS={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},WS={class:"flex-1 overflow-auto max-h-[300px]"},VS={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},FS=["onKeyup"],HS=["onClick"],qS={class:"text-retro-muted truncate flex-1 font-mono"},YS=["onClick"],jS=["onClick"],US={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},GS={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},KS={class:"flex gap-2 justify-end"},JS=["disabled"],ew={key:1,class:"px-3 py-2 border-t border-retro-border"},tw=Xe({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(t,{emit:e}){const i=e,r=A(!1),s=A(""),n=A(""),o=A(null),a=A("");function l(){r.value=!0,s.value="",n.value=""}function c(){!s.value.trim()||!n.value.trim()||(i("add",{name:s.value.trim(),url:n.value.trim()}),r.value=!1)}function h(p){o.value=p.name,a.value=p.fetchUrl}function u(p){a.value.trim()&&(i("edit",{name:p,newUrl:a.value.trim()}),o.value=null)}function d(){o.value=null}return(p,f)=>(y(),_("div",ZS,[m("div",XS,[f[5]||(f[5]=m("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:f[0]||(f[0]=g=>i("close"))},[oe(O(Gt),{class:"w-4 h-4"})])]),m("div",WS,[(y(!0),_($e,null,je(t.remotes,g=>(y(),_("div",{key:g.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[m("span",VS,I(g.name),1),O(o)===g.name?(y(),_($e,{key:0},[qe(m("input",{"onUpdate:modelValue":f[1]||(f[1]=v=>rt(a)?a.value=v:null),type:"text",class:"flex-1 px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan",onKeyup:[Ps(v=>u(g.name),["enter"]),Ps(d,["escape"])]},null,40,FS),[[ui,O(a)]]),m("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:v=>u(g.name)},[oe(O(Wf),{class:"w-3.5 h-3.5"})],8,HS),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:d},[oe(O(Gt),{class:"w-3.5 h-3.5"})])],64)):(y(),_($e,{key:1},[m("span",qS,I(g.fetchUrl),1),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:v=>h(g)},[oe(O(v0),{class:"w-3.5 h-3.5"})],8,YS),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:v=>i("delete",g.name)},[oe(O(Er),{class:"w-3.5 h-3.5"})],8,jS)],64))]))),128)),t.remotes.length===0?(y(),_("div",US," No remotes configured ")):se("",!0)]),O(r)?(y(),_("div",GS,[qe(m("input",{"onUpdate:modelValue":f[2]||(f[2]=g=>rt(s)?s.value=g:null),type:"text",placeholder:"Remote name (e.g., origin)",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[ui,O(s)]]),qe(m("input",{"onUpdate:modelValue":f[3]||(f[3]=g=>rt(n)?n.value=g:null),type:"text",placeholder:"Remote URL",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onKeyup:Ps(c,["enter"])},null,544),[[ui,O(n)]]),m("div",KS,[m("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:f[4]||(f[4]=g=>r.value=!1)}," Cancel "),m("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!O(s).trim()||!O(n).trim(),onClick:c}," Add Remote ",8,JS)])])):se("",!0),O(r)?se("",!0):(y(),_("div",ew,[m("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[oe(O(yh),{class:"w-3.5 h-3.5"}),f[6]||(f[6]=Ze(" Add Remote ",-1))])]))]))}}),xh={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},kl=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Gn={A:{label:"Added",colorClass:"text-retro-green"},M:{label:"Modified",colorClass:"text-retro-yellow"},D:{label:"Deleted",colorClass:"text-retro-red"},R:{label:"Renamed",colorClass:"text-retro-blue"},C:{label:"Copied",colorClass:"text-retro-purple"},U:{label:"Unmerged",colorClass:"text-retro-cyan"}},iw=["width","height"],rw=["d","stroke","stroke-dasharray"],sw={key:0},nw=["cx","r"],ow=["cx","r","fill"],aw=["cx","r","stroke"],lw=["cx","r","fill"],cw=["cx","r","stroke"],hw=["cx","r","fill"],uw=["cx","r"],dw=["cx","r","fill"],S0=Xe({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(t){const e=t,{COLUMN_WIDTH:i,ROW_HEIGHT:r,NODE_RADIUS:s,PADDING:n}=xh,o=ae(()=>n*2+(e.maxLane+1)*i),a=r,l=r/2;function c(d){return n+d*i}function h(d){const p=c(d.fromLane),f=c(d.toLane);if(d.type==="vertical")return`M ${p} 0 L ${f} ${a}`;if(d.type==="vertical-top")return`M ${p} 0 L ${p} ${l}`;if(d.type==="vertical-bottom")return`M ${p} ${l} L ${p} ${a}`;if(d.style==="rounded")return`M ${p} ${l} C ${p} ${a}, ${f} ${a}, ${f} ${a}`;{const g=a*.75;return`M ${p} ${l} L ${p} ${g} L ${f} ${a}`}}const u=ae(()=>e.rowData?c(e.rowData.lane):n);return(d,p)=>(y(),_("svg",{width:O(o),height:O(a),class:"block flex-shrink-0","aria-hidden":"true"},[t.rowData?(y(),_($e,{key:0},[(y(!0),_($e,null,je(t.rowData.connections,(f,g)=>(y(),_("path",{key:g,d:h(f),stroke:f.color,"stroke-width":"2",fill:"none","stroke-dasharray":f.type.startsWith("merge")?"4 3":"none"},null,8,rw))),128)),m("g",null,[t.tooltipText?(y(),_("title",sw,I(t.tooltipText),1)):se("",!0),t.rowData.nodeType==="head"?(y(),_($e,{key:1},[m("circle",{cx:O(u),cy:l,r:O(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,nw),m("circle",{cx:O(u),cy:l,r:O(s),fill:t.rowData.color},null,8,ow)],64)):t.rowData.nodeType==="merge"?(y(),_($e,{key:2},[m("circle",{cx:O(u),cy:l,r:O(s)+1,fill:"none",stroke:t.rowData.color,"stroke-width":"1.5"},null,8,aw),m("circle",{cx:O(u),cy:l,r:O(s)-1,fill:t.rowData.color},null,8,lw)],64)):t.rowData.nodeType==="stash"?(y(),_($e,{key:3},[m("circle",{cx:O(u),cy:l,r:O(s),fill:"none",stroke:t.rowData.color,"stroke-width":"2"},null,8,cw),m("circle",{cx:O(u),cy:l,r:O(s)-2,fill:t.rowData.color},null,8,hw)],64)):t.rowData.nodeType==="uncommitted"?(y(),_("circle",{key:4,cx:O(u),cy:l,r:O(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,uw)):(y(),_("circle",{key:5,cx:O(u),cy:l,r:O(s),fill:t.rowData.color},null,8,dw))])],64)):se("",!0)],8,iw))}}),fw=["aria-selected","aria-label"],pw={key:1,class:"flex gap-1 flex-shrink-0"},mw=["title","onContextmenu"],gw={key:2,class:"flex gap-1 flex-shrink-0"},Ow=["onContextmenu"],vw={class:"text-retro-text text-xs truncate flex-1"},bw={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},yw={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},bm=72,_w=Xe({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(t,{emit:e}){const i=t,r=e,s=ae(()=>{const d=i.commit.branches;if(d.length===0)return[];const p=i.localBranchNames,f=[],g=[];for(const T of d)p.has(T)?f.push(T):g.push(T);const v=new Set(f),b=new Map,S=[];for(const T of g){const $=T.indexOf("/");if($>0){const R=T.substring($+1),D=T.substring(0,$);v.has(R)?(b.has(R)||b.set(R,[]),b.get(R).push(D)):S.push(T)}else S.push(T)}const k=[];for(const T of f){const $=b.get(T)||[];$.length>0?k.push({displayName:`${T}/${$.join(",")}`,originalBranches:[T,...$.map(R=>`${R}/${T}`)],isLocal:!0}):k.push({displayName:T,originalBranches:[T],isLocal:!0})}for(const T of S)k.push({displayName:T,originalBranches:[T],isLocal:!1});return k});function n(d,p){d.preventDefault(),d.stopPropagation();const f=p.originalBranches[0];r("branchContextMenu",{branch:f,x:d.clientX,y:d.clientY,isCurrentBranch:p.isLocal&&p.originalBranches.includes(i.currentBranchName??""),isLocal:p.isLocal})}function o(d,p){d.preventDefault(),d.stopPropagation(),r("tagContextMenu",{tag:p,x:d.clientX,y:d.clientY})}function a(d){d.preventDefault(),d.stopPropagation(),r("commitContextMenu",{x:d.clientX,y:d.clientY})}const{ROW_HEIGHT:l}=xh,c=ae(()=>{const d=[i.commit.shortHash];return i.commit.branches.length>0&&d.push(i.commit.branches.join(", ")),i.commit.tags.length>0&&d.push(i.commit.tags.map(p=>`tag: ${p}`).join(", ")),d.join(" — ")});function h(d){const f=Date.now()/1e3-d;return f<60?"just now":f<3600?`${Math.floor(f/60)}m ago`:f<86400?`${Math.floor(f/3600)}h ago`:f<604800?`${Math.floor(f/86400)}d ago`:f<2592e3?`${Math.floor(f/604800)}w ago`:new Date(d*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function u(d){const p=d.split(`
|
|
3
|
-
`)[0];return p.length>bm?p.substring(0,bm-3)+"...":p}return(d,p)=>{const f=S0;return y(),_("div",{class:Ee(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":t.isMuted,"bg-retro-magenta/10":t.isPreviewHighlighted,"bg-retro-yellow/20":t.isFeatureHighlighted&&!t.isPreviewHighlighted}]),style:qi({height:`${O(l)}px`}),role:"row",tabindex:"0","aria-selected":t.isSelected,"aria-label":`Commit ${t.commit.shortHash} by ${t.commit.author}: ${t.commit.message.split(`
|
|
4
|
-
`)[0]}`,onClick:p[0]||(p[0]=g=>r("click",g)),onKeydown:p[1]||(p[1]=g=>r("keydown",g)),onContextmenu:a},[oe(f,{rowData:t.graphRowData,maxLane:t.maxLane,tooltipText:O(c)},null,8,["rowData","maxLane","tooltipText"]),m("div",{class:Ee(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-magenta/10 border-l-2 border-retro-magenta/40":t.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":t.isFeatureHighlighted&&!t.isPreviewHighlighted,"bg-retro-cyan/15":t.isSelected&&!t.isFeatureHighlighted&&!t.isPreviewHighlighted,"bg-retro-yellow/10":t.isHighlighted&&!t.isSelected&&!t.isFeatureHighlighted&&!t.isPreviewHighlighted,"bg-retro-cyan/5":t.isBranchHighlighted&&!t.isSelected&&!t.isHighlighted&&!t.isFeatureHighlighted&&!t.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!t.isSelected&&!t.isHighlighted&&!t.isFeatureHighlighted&&!t.isPreviewHighlighted&&!t.isBranchHighlighted}]),style:qi({height:`${O(l)-4}px`})},[!t.columnVisibility||t.columnVisibility.commit!==!1?(y(),_("span",{key:0,class:Ee(["flex-shrink-0 font-mono text-[11px]",t.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},I(t.commit.shortHash),3)):se("",!0),O(s).length>0?(y(),_("div",pw,[(y(!0),_($e,null,je(O(s),g=>(y(),_("span",{key:g.displayName,class:Ee(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",t.commit.isHead&&g.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":t.isPreviewHighlighted?"bg-retro-magenta/10 text-retro-magenta border border-retro-magenta/40":t.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":t.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":g.isLocal?"bg-retro-green/15 text-retro-green border border-retro-green/30":"bg-retro-orange/15 text-retro-orange border border-retro-orange/30"]),title:g.originalBranches.join(", "),onContextmenu:v=>n(v,g)},I(g.displayName),43,mw))),128))])):se("",!0),t.commit.tags.length>0?(y(),_("div",gw,[(y(!0),_($e,null,je(t.commit.tags,g=>(y(),_("span",{key:g,class:"px-1 py-0.5 text-[10px] rounded-sm bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/25 flex items-center gap-0.5 leading-none cursor-context-menu hover:ring-1 hover:ring-retro-yellow/50",onContextmenu:v=>o(v,g)},[oe(O(Vf),{class:"w-2.5 h-2.5"}),Ze(" "+I(g),1)],40,Ow))),128))])):se("",!0),m("span",vw,I(u(t.commit.message)),1),t.commit.signatureStatus==="good"?(y(),Se(O(y0),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):t.commit.signatureStatus==="bad"?(y(),Se(O(_0),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):se("",!0),!t.columnVisibility||t.columnVisibility.author!==!1?(y(),_("span",bw,I(t.commit.author),1)):se("",!0),!t.columnVisibility||t.columnVisibility.date!==!1?(y(),_("span",yw,I(h(t.commit.timestamp)),1)):se("",!0)],6)],46,fw)}}});function xw(){const{COLUMN_WIDTH:t,ROW_HEIGHT:e,NODE_RADIUS:i,PADDING:r}=xh;function s(l){let c=0;for(let h=0;h<l.length;h++){const u=l.charCodeAt(h);c=(c<<5)-c+u,c=c&c}return Math.abs(c)}function n(l){const c=s(l)%kl.length;return kl[c]}function o(l,c="rounded"){const h=new Map;if(l.length===0)return h;const u=new Set,d=new Map;for(const k of l)d.set(k.hash,k);const p=l[0];if(p){let k=p;for(;k;){u.add(k.hash);const T=k.parents?.[0];k=T?d.get(T):void 0}}const f=new Map,g=new Map,v=new Map,b=new Map,S=new Map;for(let k=0;k<l.length;k++){const T=l[k];S.set(T.hash,k);const $=u.has(T.hash);let R,D;if(b.has(T.hash)){const M=b.get(T.hash);R=M.lane,D=M.color,b.delete(T.hash)}else if($)R=0,D=kl[0];else{for(R=1;v.has(R);)R++;D=n(T.hash.substring(0,7))}f.set(T.hash,R),g.set(T.hash,D),v.set(R,T.hash);const U=T.isMerge||T.parents&&T.parents.length>1;let ce="regular";T.isHead?ce="head":U&&(ce="merge"),h.set(T.hash,{commitHash:T.hash,lane:R,color:D,nodeType:ce,isMainline:u.has(T.hash),connections:[]});const he=T.parents||[];for(let M=0;M<he.length;M++){const x=he[M];if(f.has(x)||b.has(x))continue;const V=u.has(x);let N,K;if(M===0)N=R,K=D;else if(V)N=0,K=kl[0];else{for(N=1;v.has(N)||N===R;)N++;K=n(x.substring(0,7))}b.set(x,{lane:N,color:K,childHash:T.hash})}const W=he[0];if(!W)v.delete(R);else{const M=f.get(W),x=b.get(W),V=M??x?.lane;V!==void 0&&V!==R&&v.delete(R)}}for(let k=0;k<l.length;k++){const T=l[k],$=h.get(T.hash);if(!$)continue;const R=T.parents||[];for(let D=0;D<R.length;D++){const U=R[D],ce=f.get(U),he=S.get(U);if(ce===void 0)continue;const W=$.lane,M=ce,x=D===0?$.color:g.get(U)||n(U.substring(0,7));if(W===M?$.connections.push({type:"vertical-bottom",fromLane:W,toLane:M,color:x,style:c}):D>0?$.connections.push({type:W<M?"merge-out":"merge-in",fromLane:W,toLane:M,color:x,style:c}):$.connections.push({type:W<M?"branch-out":"branch-in",fromLane:W,toLane:M,color:x,style:c}),he!==void 0&&he>k+1)for(let V=k+1;V<he;V++){const N=l[V],K=h.get(N.hash);K&&K.connections.push({type:"vertical",fromLane:M,toLane:M,color:x,style:c})}if(he!==void 0){const V=h.get(U);V&&V.connections.push({type:"vertical-top",fromLane:M,toLane:M,color:x,style:c})}}}return h}function a(l){let c=0;for(const h of l.values()){h.lane>c&&(c=h.lane);for(const u of h.connections)u.fromLane>c&&(c=u.fromLane),u.toLane>c&&(c=u.toLane)}return c}return{computeGraphRows:o,computeMaxLane:a,getBranchColor:n,COLUMN_WIDTH:t,ROW_HEIGHT:e,NODE_RADIUS:i,PADDING:r}}const Sw=["aria-selected"],ww={class:"text-retro-yellow text-xs font-medium"},kw={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},Cw={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},$w=Xe({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(t,{expose:e,emit:i}){const r=t,s=i;function n(){s("selectUncommittedChanges")}function o(re){(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),s("selectUncommittedChanges"))}const a=ae(()=>r.searchQuery?.toLowerCase()??""),l=ae(()=>new Set(r.highlightBranches??[])),c=ae(()=>l.value.size>0),h=ae(()=>{const re=a.value;if(!re)return new Set;const H=new Set;for(const j of r.commits)(j.message.toLowerCase().includes(re)||j.author.toLowerCase().includes(re)||j.shortHash.toLowerCase().includes(re)||j.hash.toLowerCase().includes(re)||j.branches.some(ee=>ee.toLowerCase().includes(re))||j.tags.some(ee=>ee.toLowerCase().includes(re)))&&H.add(j.hash);return H}),u=ae(()=>{if(!c.value)return new Set;const re=new Set;for(const H of r.commits)H.branches.some(j=>l.value.has(j))&&re.add(H.hash);return re}),d=ae(()=>{if(!r.featureHighlightBranches||r.featureHighlightBranches.length===0)return new Set;const re=r.featureMergeBases??{},H=new Map;for(const ee of r.commits)H.set(ee.hash,ee);const j=new Set;for(const ee of r.featureHighlightBranches){const _e=r.commits.find(Je=>Je.branches.includes(ee));if(!_e)continue;const Le=re[ee]??null;if(!Le)continue;let Ne=_e;for(;Ne&&Ne.hash!==Le;)j.add(Ne.hash),Ne=Ne.parents?.[0]?H.get(Ne.parents[0]):void 0}return j}),p=ae(()=>{if(!r.previewHighlightBranches||r.previewHighlightBranches.length===0)return new Set;const re=r.previewMergeBases??{},H=new Map;for(const ee of r.commits)H.set(ee.hash,ee);const j=new Set;for(const ee of r.previewHighlightBranches){const _e=r.commits.find(Je=>Je.branches.includes(ee));if(!_e)continue;const Le=re[ee]??null;if(!Le)continue;let Ne=_e;for(;Ne&&Ne.hash!==Le;)j.add(Ne.hash),Ne=Ne.parents?.[0]?H.get(Ne.parents[0]):void 0}return j});function f(re,H){s("branchContextMenu",{...H,commitHash:re.hash})}function g(re,H){s("commitContextMenu",{commit:re,...H})}function v(re,H){s("tagContextMenu",{...H,commitHash:re.hash})}const{ROW_HEIGHT:b,VISIBLE_BUFFER:S}=xh,{computeGraphRows:k,computeMaxLane:T}=xw(),$=ae(()=>k([...r.commits],r.graphStyle)),R=ae(()=>T($.value)),D=ae(()=>{const re=r.stashes||[];if(re.length===0)return r.commits.map((_e,Le)=>({type:"commit",commit:_e,commitIndex:Le}));const H=[],j=[...re].sort((_e,Le)=>new Date(Le.date).getTime()-new Date(_e.date).getTime());let ee=0;for(let _e=0;_e<r.commits.length;_e++){const Le=r.commits[_e],Ne=Le.timestamp*1e3;for(;ee<j.length&&new Date(j[ee].date).getTime()>=Ne;)H.push({type:"stash",stash:j[ee]}),ee++;H.push({type:"commit",commit:Le,commitIndex:_e})}for(;ee<j.length;)H.push({type:"stash",stash:j[ee]}),ee++;return H}),U=A(null),ce=A(0),he=A(400);let W=null;const M=ae(()=>{const re=S,H=D.value.length,j=Math.max(0,Math.floor(ce.value/b)-re),ee=Math.min(H,Math.ceil((ce.value+he.value)/b)+re);return{startIndex:j,endIndex:ee}}),x=ae(()=>{const{startIndex:re,endIndex:H}=M.value;return D.value.slice(re,H).map((j,ee)=>({row:j,index:re+ee,graphRow:j.type==="commit"&&$.value.get(j.commit.hash)||null,isHighlighted:j.type==="commit"?h.value.has(j.commit.hash):!1,isBranchHighlighted:j.type==="commit"?u.value.has(j.commit.hash):!1,isFeatureHighlighted:j.type==="commit"?d.value.has(j.commit.hash):!1,isPreviewHighlighted:j.type==="commit"?p.value.has(j.commit.hash):!1,isMuted:j.type==="commit"&&r.muteNonAncestral?!($.value.get(j.commit.hash)?.isMainline??!1):!1}))}),V=ae(()=>D.value.length*b),N=ae(()=>M.value.startIndex*b);function K(re){const H=re.target;ce.value=H.scrollTop,W||s("scrollStart"),W&&clearTimeout(W),W=setTimeout(()=>{W=null,s("scrollEnd")},150),r.hasMore&&!r.loading&&!r.loadingMore&&H.scrollTop+H.clientHeight>=H.scrollHeight-200&&s("loadMore")}function te(re,H){H.ctrlKey||H.metaKey?s("compareSelect",re):s("select",re)}function G(re,H,j){if(re.key==="Enter"||re.key===" ")re.preventDefault(),s("select",H);else if(re.key==="ArrowDown"){re.preventDefault();for(let ee=j+1;ee<D.value.length;ee++){const _e=D.value[ee];if(_e.type==="commit"){s("select",_e.commit),be(ee);break}}}else if(re.key==="ArrowUp"){re.preventDefault();for(let ee=j-1;ee>=0;ee--){const _e=D.value[ee];if(_e.type==="commit"){s("select",_e.commit),be(ee);break}}}}function be(re){if(!U.value)return;const H=re*b,j=U.value.scrollTop,ee=j+U.value.clientHeight;H<j?U.value.scrollTop=H:H+b>ee&&(U.value.scrollTop=H+b-U.value.clientHeight)}kt(()=>{if(U.value){he.value=U.value.clientHeight;const re=new ResizeObserver(H=>{for(const j of H)he.value=j.contentRect.height});re.observe(U.value),si(()=>re.disconnect())}});function ie(){return U.value?.scrollTop??0}function q(re){U.value&&(U.value.scrollTop=re)}return e({getScrollPosition:ie,setScrollPosition:q,scrollToIndex:be}),(re,H)=>{const j=S0,ee=_w;return y(),_("div",{ref_key:"containerRef",ref:U,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:K},[t.uncommittedChangesCount&&t.uncommittedChangesCount>0?(y(),_("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:qi({height:`${O(b)}px`}),role:"button",tabindex:"0","aria-selected":t.isUncommittedChangesSelected,onClick:n,onKeydown:o},[oe(j,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:O(R)},null,8,["maxLane"]),m("div",{class:Ee(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":t.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!t.isUncommittedChangesSelected}]),style:qi({height:`${O(b)-4}px`})},[oe(O(_h),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("span",ww," Uncommitted Changes ("+I(t.uncommittedChangesCount)+") ",1),H[1]||(H[1]=m("span",{class:"flex-1"},null,-1)),H[2]||(H[2]=m("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,Sw)):se("",!0),m("div",{class:"relative",style:qi({height:`${O(V)}px`})},[m("div",{class:"absolute left-0 right-0",style:qi({transform:`translateY(${O(N)}px)`})},[(y(!0),_($e,null,je(O(x),({row:_e,index:Le,graphRow:Ne,isHighlighted:Je,isBranchHighlighted:st,isFeatureHighlighted:Ue,isPreviewHighlighted:B,isMuted:w})=>(y(),_($e,{key:_e.type==="commit"?_e.commit.hash:`stash-${_e.stash.index}`},[_e.type==="commit"?Ex([_e.commit.hash,_e.commit.message,_e.commit.timestamp,_e.commit.branches.join("|"),_e.commit.tags.join("|"),t.selectedCommit?.hash===_e.commit.hash,Je,st,Ue,B,w,r.currentBranchName||"",r.columnVisibility?.date!==!1,r.columnVisibility?.author!==!1,r.columnVisibility?.commit!==!1],()=>(y(),Se(ee,{key:0,commit:_e.commit,index:_e.commitIndex,isSelected:t.selectedCommit?.hash===_e.commit.hash,isHighlighted:Je,isBranchHighlighted:st,isFeatureHighlighted:Ue,isPreviewHighlighted:B,isMuted:w,currentBranchName:r.currentBranchName,localBranchNames:r.localBranchNames,graphRowData:Ne,maxLane:O(R),columnVisibility:r.columnVisibility,onClick:L=>te(_e.commit,L),onKeydown:L=>G(L,_e.commit,Le),onBranchContextMenu:L=>f(_e.commit,L),onCommitContextMenu:L=>g(_e.commit,L),onTagContextMenu:L=>v(_e.commit,L)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),H,0):se("",!0)],64))),128))],4)],4),(t.loading||t.loadingMore)&&t.commits.length>0?(y(),_("div",kw,[...H[3]||(H[3]=[m("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ze(" Loading more commits... ",-1)])])):se("",!0),!t.hasMore&&t.commits.length>0&&!t.loading?(y(),_("div",Cw,I(t.commits.length)+" commits loaded ",1)):se("",!0)],544)}}});function Pw(t){const e=t.charAt(0).toUpperCase();return e in Gn?e:"M"}function Cl(t,e){if(t&&typeof t=="object"){const i=t;if(typeof i.data?.message=="string"&&i.data.message.trim())return i.data.message;if(typeof i.statusMessage=="string"&&i.statusMessage.trim())return i.statusMessage;if(typeof i.message=="string"&&i.message.trim())return i.message}return t instanceof Error&&t.message?t.message:e}function w0(t,e){const i=e.trim().toLowerCase();return i?t.filter(r=>r.message.toLowerCase().includes(i)||r.author.toLowerCase().includes(i)||r.shortHash.includes(i)||r.hash.includes(i)||r.branches.some(s=>s.toLowerCase().includes(i))||r.tags.some(s=>s.toLowerCase().includes(i))):[...t]}function Qw(t,e){return e.size===0?[...t]:t.filter(i=>i.branches.some(r=>e.has(r)))}function Tw(t=10){const e=new Map;function i(s,n){const o=n.toLowerCase(),a=`${o}:${s.length}`,l=e.get(a);if(l)return l;const c=w0(s,o);if(e.size>=t){const h=e.keys().next().value;h!==void 0&&e.delete(h)}return e.set(a,c),c}function r(){e.clear()}return{filter:i,clear:r}}const Mw={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},Bw={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},Aw={class:"flex items-center gap-2 text-xs min-w-0"},Rw={class:"font-mono text-retro-cyan"},Ew={class:"font-mono text-retro-cyan"},Dw={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},Lw={class:"text-retro-green"},Iw={class:"text-retro-red"},Nw={key:1,class:"flex-1 flex items-center justify-center"},zw={key:2,class:"flex-1 overflow-auto"},Zw={class:"text-retro-text truncate flex-1"},Xw={class:"text-retro-muted"},Ww={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Vw={key:0,class:"text-retro-green"},Fw={key:1,class:"text-retro-red ml-1"},Hw={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},qw={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Yw=Xe({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(t,{emit:e}){const i=e;function r(s){const n=Pw(s);return Gn[n]||Gn.M}return(s,n)=>(y(),_("div",Mw,[m("div",Bw,[m("div",Aw,[n[1]||(n[1]=m("span",{class:"text-retro-muted"},"Comparing",-1)),m("span",Rw,I(t.fromCommit.shortHash),1),n[2]||(n[2]=m("span",{class:"text-retro-muted"},"→",-1)),m("span",Ew,I(t.toCommit.shortHash),1)]),m("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:n[0]||(n[0]=o=>i("close"))},[oe(O(Gt),{class:"w-4 h-4"})])]),t.stats?(y(),_("div",Dw,[Ze(I(t.stats.filesChanged)+" file"+I(t.stats.filesChanged!==1?"s":"")+" changed, ",1),m("span",Lw,"+"+I(t.stats.additions),1),m("span",Iw," -"+I(t.stats.deletions),1)])):se("",!0),t.loading?(y(),_("div",Nw,[...n[3]||(n[3]=[m("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[m("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),Ze(" Loading comparison... ")],-1)])])):t.files&&t.files.length>0?(y(),_("div",zw,[(y(!0),_($e,null,je(t.files,o=>(y(),_("div",{key:o.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[m("span",{class:Ee(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",r(o.status).colorClass])},I(o.status.charAt(0)),3),m("span",Zw,[o.oldPath&&o.status.startsWith("R")?(y(),_($e,{key:0},[m("span",Xw,I(o.oldPath),1),n[4]||(n[4]=m("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):se("",!0),Ze(" "+I(o.path),1)]),o.binary?(y(),_("span",Hw,"binary")):(y(),_("span",Ww,[o.additions>0?(y(),_("span",Vw,"+"+I(o.additions),1)):se("",!0),o.deletions>0?(y(),_("span",Fw,"-"+I(o.deletions),1)):se("",!0)]))]))),128))])):t.files&&t.files.length===0?(y(),_("div",qw," No differences between these commits ")):se("",!0)]))}}),jw={":art:":"🎨",":zap:":"⚡",":fire:":"🔥",":bug:":"🐛",":ambulance:":"🚑",":sparkles:":"✨",":memo:":"📝",":rocket:":"🚀",":lipstick:":"💄",":tada:":"🎉",":white_check_mark:":"✅",":lock:":"🔒",":closed_lock_with_key:":"🔐",":bookmark:":"🔖",":rotating_light:":"🚨",":construction:":"🚧",":green_heart:":"💚",":arrow_down:":"⬇️",":arrow_up:":"⬆️",":pushpin:":"📌",":construction_worker:":"👷",":chart_with_upwards_trend:":"📈",":recycle:":"♻️",":heavy_plus_sign:":"➕",":heavy_minus_sign:":"➖",":wrench:":"🔧",":hammer:":"🔨",":globe_with_meridians:":"🌐",":pencil2:":"✏️",":poop:":"💩",":rewind:":"⏪",":twisted_rightwards_arrows:":"🔀",":package:":"📦",":alien:":"👽",":truck:":"🚚",":page_facing_up:":"📄",":boom:":"💥",":bento:":"🍱",":wheelchair:":"♿",":bulb:":"💡",":beers:":"🍻",":speech_balloon:":"💬",":card_file_box:":"🗃️",":loud_sound:":"🔊",":mute:":"🔇",":busts_in_silhouette:":"👥",":children_crossing:":"🚸",":building_construction:":"🏗️",":iphone:":"📱",":clown_face:":"🤡",":egg:":"🥚",":see_no_evil:":"🙈",":camera_flash:":"📸",":alembic:":"⚗️",":mag:":"🔍",":label:":"🏷️",":seedling:":"🌱",":triangular_flag_on_post:":"🚩",":goal_net:":"🥅",":dizzy:":"💫",":wastebasket:":"🗑️",":passport_control:":"🛂",":adhesive_bandage:":"🩹",":monocle_face:":"🧐",":coffin:":"⚰️",":test_tube:":"🧪",":necktie:":"👔",":stethoscope:":"🩺",":bricks:":"🧱",":technologist:":"🧑💻",":money_with_wings:":"💸",":thread:":"🧵",":safety_vest:":"🦺"},Uw=/https?:\/\/[^\s<>)"']+/g;function Gw(t){return t.replace(Uw,e=>`<a href="${e}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${e}</a>`)}function Kw(t){return t.replace(/:[a-z0-9_]+:/g,e=>jw[e]||e)}function Jw(t){if(!t)return"";let e=Kw(t);return e=Xx.parse(e),e=Gw(e),e=Wx.sanitize(e,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),e}const ek={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},tk={class:"flex items-center gap-2 min-w-0"},ik={class:"text-retro-cyan font-mono text-sm"},rk={class:"text-retro-muted text-sm truncate"},sk={class:"flex items-center gap-1 flex-shrink-0"},nk=["aria-label","title"],ok={class:"flex-1 overflow-auto p-4 space-y-4"},ak={class:"space-y-2"},lk={class:"flex items-center gap-2 text-sm"},ck={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},hk={class:"flex items-center gap-2 text-sm"},uk={class:"text-retro-text"},dk={class:"text-retro-muted"},fk={key:0,class:"flex items-center gap-2 text-sm"},pk={class:"text-retro-text"},mk={class:"text-retro-muted"},gk={class:"flex items-center gap-2 text-sm"},Ok={class:"text-retro-text"},vk={key:1,class:"flex items-start gap-2 text-sm"},bk={class:"flex flex-wrap gap-1"},yk=["onClick","title"],_k={key:2,class:"flex items-start gap-2 text-sm"},xk={class:"flex flex-wrap gap-1"},Sk={key:3,class:"flex items-start gap-2 text-sm"},wk={class:"flex flex-wrap gap-1"},kk={class:"space-y-1"},Ck={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},$k={key:0,class:"space-y-1"},Pk=["innerHTML"],Qk={key:1,class:"space-y-2"},Tk={class:"flex items-center gap-2 text-sm"},Mk={class:"text-retro-muted"},Bk={key:0,class:"flex items-center gap-2"},Ak={class:"text-retro-green text-xs font-mono"},Rk={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},Ek={class:"text-retro-red text-xs font-mono"},Dk={key:2,class:"space-y-2"},Lk={class:"flex items-center justify-between"},Ik={class:"text-retro-muted text-xs uppercase tracking-wide"},Nk={class:"flex items-center gap-1"},zk={key:0,class:"text-retro-muted text-sm py-2"},Zk={key:1,class:"space-y-0.5"},Xk=["onClick"],Wk=["title"],Vk={class:"text-retro-text font-mono text-xs truncate flex-1"},Fk={class:"text-retro-muted"},Hk={class:"text-retro-text"},qk={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Yk={key:0,class:"text-retro-green"},jk={key:1,class:"text-retro-red"},Uk={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Gk={key:2,class:"space-y-0"},Kk=["onClick"],Jk={class:"text-retro-text font-mono text-xs"},eC=["title"],tC={class:"text-retro-text font-mono text-xs truncate flex-1"},iC={class:"text-retro-muted"},rC={class:"text-retro-text"},sC={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},nC={key:0,class:"text-retro-green"},oC={key:1,class:"text-retro-red"},aC={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},lC={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},cC={key:4,class:"text-retro-muted text-sm py-2"},hC=Xe({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(t,{emit:e}){const i=t,r=e,s=A(null),n=A("flat"),o=A(new Set),a=ae(()=>!i.committer||!i.committerEmail?!1:i.committer!==i.commit.author||i.committerEmail!==i.commit.email),l=ae(()=>{const W=i.commit.body;return W?Jw(W):""}),c=ae(()=>{if(!i.stats)return"";const{filesChanged:W,additions:M,deletions:x}=i.stats,N=[`${W} ${W===1?"file":"files"} changed`];return M>0&&N.push(`+${M} insertion${M===1?"":"s"}`),x>0&&N.push(`-${x} deletion${x===1?"":"s"}`),N.join(", ")});function h(W){const M=[];for(const x of W){const V=x.path.split("/");let N=M;for(let K=0;K<V.length;K++){const te=V[K],G=K===V.length-1,be=V.slice(0,K+1).join("/");let ie=N.find(q=>q.name===te&&q.isDirectory===!G);ie||(ie={name:te,fullPath:be,isDirectory:!G,children:[],file:G?x:void 0},N.push(ie)),G||(N=ie.children)}}return u(M),M}function u(W){for(const M of W)if(M.isDirectory)for(u(M.children);M.children.length===1&&M.children[0].isDirectory;){const x=M.children[0];M.name=`${M.name}/${x.name}`,M.fullPath=x.fullPath,M.children=x.children}}function d(W){return[...W].sort((M,x)=>M.isDirectory&&!x.isDirectory?-1:!M.isDirectory&&x.isDirectory?1:M.name.localeCompare(x.name))}function p(W,M,x){const V=[];for(const N of d(W)){const K=x.size===0?!0:x.has(N.fullPath);V.push({key:N.fullPath,depth:M,isDirectory:N.isDirectory,name:N.name,fullPath:N.fullPath,expanded:N.isDirectory?K:!1,file:N.file}),N.isDirectory&&K&&V.push(...p(N.children,M+1,x))}return V}const f=ae(()=>!i.files||i.files.length===0?[]:h(i.files)),g=ae(()=>p(f.value,0,o.value));function v(W){o.value.has(W)?o.value.delete(W):o.value.add(W),o.value=new Set(o.value)}function b(){const W=M=>{const x=[];for(const V of M)V.isDirectory&&(x.push(V.fullPath),x.push(...W(V.children)));return x};o.value=new Set(W(f.value))}function S(){o.value=new Set}He(n,W=>{W==="tree"&&b()});function k(W){return new Date(W*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function T(W){return Gn[W]||{label:W,colorClass:"text-retro-muted"}}const $=ae(()=>{if(!i.stats)return{addPct:0,delPct:0};const W=i.stats.additions+i.stats.deletions;return W===0?{addPct:50,delPct:50}:{addPct:Math.round(i.stats.additions/W*100),delPct:Math.round(i.stats.deletions/W*100)}});function R(W){W.key==="ArrowUp"?(W.preventDefault(),r("navigatePrev")):W.key==="ArrowDown"?(W.preventDefault(),r("navigateNext")):W.key==="Escape"&&(W.preventDefault(),r("close"))}kt(()=>{ai(()=>{s.value?.focus()})}),He(()=>i.commit.hash,()=>{ai(()=>{s.value?.focus()})});function D(){r("close")}function U(W){r("navigateToCommit",W)}function ce(){r("togglePosition")}function he(W){r("openFileDiff",W)}return(W,M)=>(y(),_("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:R,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[m("div",ek,[m("div",tk,[m("span",ik,I(t.commit.shortHash),1),m("span",rk,I(t.commit.message.split(`
|
|
5
|
-
`)[0]),1)]),m("div",sk,[m("button",{onClick:ce,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":t.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:t.detailPosition==="inline"?"Dock to bottom":"Show inline"},[t.detailPosition==="inline"?(y(),Se(O(u0),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(y(),Se(O(h0),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,nk),m("button",{onClick:D,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close commit details"},[oe(O(Gt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),m("div",ok,[m("div",ak,[m("div",lk,[M[2]||(M[2]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),m("code",ck,I(t.commit.hash),1)]),m("div",hk,[oe(O(om),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",uk,I(t.commit.author),1),m("span",dk,"<"+I(t.commit.email)+">",1)]),a.value?(y(),_("div",fk,[oe(O(om),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),M[3]||(M[3]=m("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),m("span",pk,I(t.committer),1),m("span",mk,"<"+I(t.committerEmail)+">",1)])):se("",!0),m("div",gk,[oe(O(Vx),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",Ok,I(k(t.commit.timestamp)),1)]),t.commit.parents?.length>0?(y(),_("div",vk,[M[4]||(M[4]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),m("div",bk,[(y(!0),_($e,null,je(t.commit.parents,x=>(y(),_("button",{key:x,onClick:V=>U(x),class:"text-retro-cyan font-mono text-xs bg-retro-panel px-2 py-0.5 rounded hover:bg-retro-dark hover:text-retro-text transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-retro-cyan",title:`Navigate to parent ${x.substring(0,7)}`},I(x.substring(0,7)),9,yk))),128))])])):se("",!0),t.commit.branches?.length>0?(y(),_("div",_k,[M[5]||(M[5]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),m("div",xk,[(y(!0),_($e,null,je(t.commit.branches,x=>(y(),_("span",{key:x,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},I(x),1))),128))])])):se("",!0),t.commit.tags?.length>0?(y(),_("div",Sk,[M[6]||(M[6]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),m("div",wk,[(y(!0),_($e,null,je(t.commit.tags,x=>(y(),_("span",{key:x,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},I(x),1))),128))])])):se("",!0)]),m("div",kk,[M[7]||(M[7]=m("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),m("div",Ck,I(t.commit.message.split(`
|
|
6
|
-
`)[0]),1)]),t.commit.body?(y(),_("div",$k,[M[8]||(M[8]=m("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),m("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:l.value},null,8,Pk)])):se("",!0),t.stats?(y(),_("div",Qk,[m("div",Tk,[m("span",Mk,I(c.value),1)]),t.stats.additions>0||t.stats.deletions>0?(y(),_("div",Bk,[m("span",Ak,"+"+I(t.stats.additions),1),m("div",Rk,[m("div",{class:"bg-retro-green h-full transition-all",style:qi({width:$.value.addPct+"%"})},null,4),m("div",{class:"bg-retro-red h-full transition-all",style:qi({width:$.value.delPct+"%"})},null,4)]),m("span",Ek,"-"+I(t.stats.deletions),1)])):se("",!0)])):se("",!0),t.files?(y(),_("div",Dk,[m("div",Lk,[m("h4",Ik," Files Changed ("+I(t.files.length)+") ",1),m("div",Nk,[m("button",{onClick:M[0]||(M[0]=x=>n.value="flat"),class:Ee(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",n.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[oe(O(O0),{class:"w-4 h-4"})],2),m("button",{onClick:M[1]||(M[1]=x=>n.value="tree"),class:Ee(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",n.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[oe(O(am),{class:"w-4 h-4"})],2)])]),t.files.length===0?(y(),_("div",zk," No files changed in this commit. ")):n.value==="flat"?(y(),_("ul",Zk,[(y(!0),_($e,null,je(t.files,x=>(y(),_("li",{key:x.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:V=>he(x)},[m("span",{class:Ee(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",T(x.status).colorClass]),title:T(x.status).label},I(x.status),11,Wk),oe(O(dn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",Vk,[x.status==="R"&&x.oldPath?(y(),_($e,{key:0},[m("span",Fk,I(x.oldPath),1),M[9]||(M[9]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",Hk,I(x.path),1)],64)):(y(),_($e,{key:1},[Ze(I(x.path),1)],64))]),!x.binary&&(x.additions>0||x.deletions>0)?(y(),_("span",qk,[x.additions>0?(y(),_("span",Yk,"+"+I(x.additions),1)):se("",!0),x.deletions>0?(y(),_("span",jk,"-"+I(x.deletions),1)):se("",!0)])):x.binary?(y(),_("span",Uk,"binary")):se("",!0)],8,Xk))),128))])):(y(),_("div",Gk,[m("div",{class:"flex items-center gap-2 mb-1"},[m("button",{onClick:b,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),M[10]||(M[10]=m("span",{class:"text-retro-muted text-xs"},"|",-1)),m("button",{onClick:S,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(y(!0),_($e,null,je(g.value,x=>(y(),_("div",{key:x.key,class:Ee(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":x.isDirectory}]),style:qi({paddingLeft:x.depth*16+4+"px"}),onClick:V=>x.isDirectory?v(x.fullPath):x.file?he(x.file):void 0},[x.isDirectory?(y(),_($e,{key:0},[oe(O(Fx),{class:Ee(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":x.expanded}])},null,8,["class"]),oe(O(am),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("span",Jk,I(x.name),1)],64)):x.file?(y(),_($e,{key:1},[m("span",{class:Ee(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",T(x.file.status).colorClass]),title:T(x.file.status).label},I(x.file.status),11,eC),oe(O(dn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",tC,[x.file.status==="R"&&x.file.oldPath?(y(),_($e,{key:0},[m("span",iC,I(x.file.oldPath.split("/").pop()),1),M[11]||(M[11]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",rC,I(x.name),1)],64)):(y(),_($e,{key:1},[Ze(I(x.name),1)],64))]),!x.file.binary&&(x.file.additions>0||x.file.deletions>0)?(y(),_("span",sC,[x.file.additions>0?(y(),_("span",nC,"+"+I(x.file.additions),1)):se("",!0),x.file.deletions>0?(y(),_("span",oC,"-"+I(x.file.deletions),1)):se("",!0)])):x.file.binary?(y(),_("span",aC,"binary")):se("",!0)],64)):se("",!0)],14,Kk))),128))]))])):t.loading?(y(),_("div",lC,[...M[12]||(M[12]=[m("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ze(" Loading file changes... ",-1)])])):(y(),_("div",cC," Failed to load file changes. "))])],544))}}),uC=ns(hC,[["__scopeId","data-v-29f450ea"]]),dC={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},fC={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},pC={class:"flex items-center gap-2 min-w-0"},mC={class:"text-retro-muted text-sm"},gC={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},OC={class:"flex-1 overflow-auto p-4 space-y-3"},vC={class:"space-y-2"},bC=["disabled"],yC={class:"space-y-1"},_C={class:"flex items-center justify-between"},xC={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},SC={key:0,class:"text-retro-muted text-xs py-1"},wC={key:1,class:"space-y-0.5"},kC=["aria-label","onClick"],CC={class:"text-retro-text font-mono text-xs truncate"},$C={class:"space-y-1"},PC={class:"flex items-center justify-between"},QC={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},TC={key:0,class:"text-retro-muted text-xs py-1"},MC={key:1,class:"space-y-0.5"},BC=["aria-label","onClick"],AC={class:"text-retro-text font-mono text-xs truncate"},RC=Xe({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(t,{emit:e}){const i=t,r=e,s=A(""),n=A(!1),o=ae(()=>s.value.trim().length>0&&i.stagedFiles.length>0&&!n.value&&!i.isCommitting);function a(g){return Gn[g]||{label:g,colorClass:"text-retro-muted"}}function l(){r("close")}function c(g){r("stageFiles",[g.path])}function h(g){r("unstageFiles",[g.path])}function u(){r("stageAll")}function d(){r("unstageAll")}async function p(){o.value&&(n.value=!0,r("commit",s.value.trim()),s.value="",n.value=!1)}function f(g){(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),p())}return(g,v)=>(y(),_("section",dC,[m("div",fC,[m("div",pC,[oe(O(_h),{class:"w-4 h-4 text-retro-yellow"}),v[1]||(v[1]=m("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),m("span",mC,"("+I(t.stagedFiles.length+t.unstagedFiles.length)+" files)",1),i.isStaging?(y(),_("div",gC)):se("",!0)]),m("button",{onClick:l,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close uncommitted changes details"},[oe(O(Gt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),m("div",OC,[m("div",vC,[qe(m("textarea",{"onUpdate:modelValue":v[0]||(v[0]=b=>rt(s)?s.value=b:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:f},null,544),[[ui,O(s)]]),m("button",{disabled:!O(o),class:Ee(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",O(o)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:p},I(O(n)||i.isCommitting?"Committing...":`Commit (${t.stagedFiles.length} staged)`),11,bC)]),m("div",yC,[m("div",_C,[m("h4",xC," Staged Changes ("+I(t.stagedFiles.length)+") ",1),t.stagedFiles.length>0?(y(),_("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:d}," Unstage All ")):se("",!0)]),t.stagedFiles.length===0?(y(),_("div",SC," No staged files. Stage files below to commit. ")):(y(),_("ul",wC,[(y(!0),_($e,null,je(t.stagedFiles,b=>(y(),_("li",{key:"staged-"+b.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[m("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${b.path}`,onClick:S=>h(b)},[oe(O(QS),{class:"w-3.5 h-3.5 text-retro-red"})],8,kC),m("span",{class:Ee(["flex-shrink-0 w-4 text-center text-xs font-bold",a(b.status).colorClass])},I(b.status),3),oe(O(dn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),m("span",CC,I(b.oldPath?`${b.oldPath} → ${b.path}`:b.path),1)]))),128))]))]),m("div",$C,[m("div",PC,[m("h4",QC," Unstaged Changes ("+I(t.unstagedFiles.length)+") ",1),t.unstagedFiles.length>0?(y(),_("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:u}," Stage All ")):se("",!0)]),t.unstagedFiles.length===0?(y(),_("div",TC," No unstaged changes. ")):(y(),_("ul",MC,[(y(!0),_($e,null,je(t.unstagedFiles,b=>(y(),_("li",{key:"unstaged-"+b.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[m("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${b.path}`,onClick:S=>c(b)},[oe(O(yh),{class:"w-3.5 h-3.5 text-retro-green"})],8,BC),m("span",{class:Ee(["flex-shrink-0 w-4 text-center text-xs font-bold",a(b.status).colorClass])},I(b.status),3),oe(O(dn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),m("span",AC,I(b.oldPath?`${b.oldPath} → ${b.path}`:b.path),1)]))),128))]))])])]))}}),EC=["aria-label"],DC={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},LC={key:0,class:"my-1 border-t border-retro-border",role:"separator"},IC=["aria-disabled","onClick","onMouseenter"],NC={key:1,class:"w-4 h-4 flex-shrink-0"},ym=220,zC=36,ZC=9,XC=29,qr=8,il=Xe({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(t,{emit:e}){const i=t,r=e,s=A(null),n=A(-1),o=ae(()=>i.items.map((p,f)=>({item:p,i:f})).filter(({item:p})=>!p.disabled).map(({i:p})=>p));let a=!1;function l(p){a&&s.value&&!s.value.contains(p.target)&&r("close")}kt(()=>{requestAnimationFrame(()=>{a=!0}),document.addEventListener("mousedown",l),document.addEventListener("contextmenu",l),ai(()=>{s.value?.focus()})}),si(()=>{a=!1,document.removeEventListener("mousedown",l),document.removeEventListener("contextmenu",l)});function c(p){const f=o.value;if(f.length===0)return;if(n.value===-1){n.value=p===1?f[0]:f[f.length-1];return}const g=f.indexOf(n.value);if(g===-1){n.value=p===1?f[0]:f[f.length-1];return}const v=g+p;v>=0&&v<f.length&&(n.value=f[v])}function h(p){switch(p.key){case"Escape":p.preventDefault(),r("close");break;case"ArrowDown":p.preventDefault(),c(1);break;case"ArrowUp":p.preventDefault(),c(-1);break;case"Enter":{p.preventDefault();const f=i.items[n.value];f&&!f.disabled&&(r("action",f.key),r("close"));break}}}function u(p){p.disabled||(r("action",p.key),r("close"))}const d=ae(()=>{const p=i.title?XC:0,f=i.items.filter(k=>k.separator).length,g=i.items.length*zC+f*ZC+qr,v=p+g;let b=i.x,S=i.y;return typeof window<"u"&&(b+ym>window.innerWidth-qr&&(b=window.innerWidth-ym-qr),b<qr&&(b=qr),S+v>window.innerHeight-qr&&(S=window.innerHeight-v-qr),S<qr&&(S=qr)),{left:`${b}px`,top:`${S}px`}});return(p,f)=>(y(),Se(zi,{to:"body"},[m("div",{ref_key:"menuRef",ref:s,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:qi(O(d)),role:"menu","aria-label":t.title??"Context menu",tabindex:"-1",onKeydown:h},[t.title?(y(),_("div",DC,I(t.title),1)):se("",!0),(y(!0),_($e,null,je(t.items,(g,v)=>(y(),_($e,{key:g.key},[g.separator?(y(),_("div",LC)):se("",!0),m("button",{class:Ee(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[g.disabled?"text-retro-muted/50 cursor-not-allowed":g.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",O(n)===v?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",O(n)===v?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":g.disabled||void 0,tabindex:-1,onClick:b=>u(g),onMouseenter:b=>n.value=g.disabled?O(n):v,onMouseleave:f[0]||(f[0]=b=>n.value=-1)},[g.icon?(y(),Se(Ja(g.icon),{key:0,class:Ee(["w-4 h-4 flex-shrink-0",g.disabled?"opacity-50":g.danger?"":"text-retro-muted"])},null,8,["class"])):(y(),_("span",NC)),Ze(" "+I(g.label),1)],42,IC)],64))),128))],44,EC)]))}}),WC=Xe({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(t,{emit:e}){const i=t,r=e,s=ae(()=>[{key:"checkout",label:"Checkout",icon:un,disabled:i.isCurrentBranch},{key:"rename",label:"Rename",icon:Hx,separator:!0},{key:"deleteBranch",label:"Delete",icon:Er,danger:!0,disabled:i.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:d0,separator:!0,disabled:i.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:a0,disabled:i.isCurrentBranch},{key:"push",label:"Push",icon:l0,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Un,separator:!0}]),n=ae(()=>[{key:"checkout",label:"Checkout",icon:un},{key:"deleteBranch",label:"Delete Remote Branch",icon:Er,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:m0,separator:!0},{key:"pull",label:"Pull into Current",icon:hS},{key:"copyName",label:"Copy Branch Name",icon:Un,separator:!0}]),o=ae(()=>i.isLocal?s.value:n.value),a={checkout:()=>r("checkout"),createBranch:()=>r("createBranch"),deleteBranch:()=>r("deleteBranch"),rename:()=>r("rename"),merge:()=>r("merge"),rebase:()=>r("rebase"),push:()=>r("push"),pull:()=>r("pull"),fetch:()=>r("fetch"),copyName:()=>r("copyName")};function l(c){a[c]?.(),r("close")}return(c,h)=>{const u=il;return y(),Se(u,{items:O(o),x:t.x,y:t.y,title:t.branchName,onAction:l,onClose:h[0]||(h[0]=d=>r("close"))},null,8,["items","x","y","title"])}}}),VC=Xe({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(t,{emit:e}){const i=e,r=ae(()=>[{key:"addTag",label:"Add Tag",icon:Vf},{key:"createBranch",label:"Create Branch",icon:yh},{key:"checkout",label:"Checkout (detached HEAD)",icon:un,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:yS},{key:"revert",label:"Revert",icon:c0},{key:"mergeInto",label:"Merge into Current",icon:d0,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:a0,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Un,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Un}]),s={addTag:()=>i("addTag"),createBranch:()=>i("createBranch"),checkout:()=>i("checkout"),cherryPick:()=>i("cherryPick"),revert:()=>i("revert"),mergeInto:()=>i("mergeInto"),reset:()=>i("reset"),copyHash:()=>i("copyHash"),copySubject:()=>i("copySubject")};function n(o){s[o]?.(),i("close")}return(o,a)=>{const l=il;return y(),Se(l,{items:O(r),x:t.x,y:t.y,title:t.commit.shortHash,onAction:n,onClose:a[0]||(a[0]=c=>i("close"))},null,8,["items","x","y","title"])}}}),FC=Xe({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(t,{emit:e}){const i=e,r=[{key:"viewDetails",label:"View Details",icon:Vf},{key:"deleteTag",label:"Delete Tag",icon:Er,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:l0},{key:"copyName",label:"Copy Tag Name",icon:Un,separator:!0}],s={viewDetails:()=>i("viewDetails"),deleteTag:()=>i("deleteTag"),pushTag:()=>i("pushTag"),copyName:()=>i("copyName")};function n(o){s[o]?.()}return(o,a)=>{const l=il;return y(),Se(l,{items:r,x:t.x,y:t.y,title:t.tagName,onClose:a[0]||(a[0]=c=>i("close")),onAction:n},null,8,["x","y","title"])}}}),HC=Xe({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(t,{emit:e}){const i=e,r=[{key:"apply",label:"Apply Stash",icon:cS},{key:"pop",label:"Pop Stash",icon:c0},{key:"createBranch",label:"Create Branch from Stash",icon:qx,separator:!0},{key:"drop",label:"Drop Stash",icon:Er,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Un,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:CS}],s={apply:()=>i("apply"),pop:()=>i("pop"),drop:()=>i("drop"),createBranch:()=>i("createBranch"),copyName:()=>i("copyName"),copyHash:()=>i("copyHash")};function n(o){s[o]?.()}return(o,a)=>{const l=il;return y(),Se(l,{items:r,x:t.x,y:t.y,title:t.stashMessage,onClose:a[0]||(a[0]=c=>i("close")),onAction:n},null,8,["x","y","title"])}}}),qC=Xe({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(t,{emit:e}){const i=e,r=[{key:"stash",label:"Stash Uncommitted Changes",icon:lS},{key:"reset",label:"Reset Working Directory",icon:un,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:Er,danger:!0}],s={stash:()=>i("stash"),reset:()=>i("reset"),clean:()=>i("clean")};function n(o){s[o]?.()}return(o,a)=>{const l=il;return y(),Se(l,{items:r,x:t.x,y:t.y,title:"Uncommitted Changes",onClose:a[0]||(a[0]=c=>i("close")),onAction:n},null,8,["x","y"])}}});async function YC(t,e,i){try{return(await $fetch("/api/git/merge-base",{params:{workingDirectory:t,branch:e,baseBranch:i??void 0}})).mergeBase}catch{return null}}function _m(t){const e={};for(const{branch:i,mergeBase:r}of t)i&&r&&(e[i]=r);return e}async function jC(t){return $fetch("/api/git/file-diff",{query:t})}async function UC(t){return $fetch("/api/git/diff",{query:t})}const Sh=zf("gitGraph",()=>{const t=A([]),e=A([]),i=A([]),r=A(new Set),s=A([]),n=A([]),o=A(0),a=A(!1),l=A(null),c=A(null),h=A(null),u=A(!1),d=A(null),p=A(!1),f=A(0),g=A(""),v=A([]),b=A(null),S=A(!1),k=A(!1),T=A(!1),$=A(!1),R=8e3,D=A(null);let U=null;function ce(J){D.value=J,U&&clearTimeout(U),U=setTimeout(()=>{D.value=null},R)}function he(){D.value=null,U&&(clearTimeout(U),U=null)}async function W(J,ue,ze,yi){if(!b.value)return{success:!1,error:"No working directory set"};try{const vr=await $fetch(J,{method:yi?.method??"POST",body:{workingDirectory:b.value,...ue}});return(yi?.reloadGraph??!0)&&await De(b.value),{success:!0,data:vr}}catch(vr){const br=Cl(vr,ze);return ce(br),{success:!1,error:br}}}const M=A(null),x=A(!1),V=A(!1),N=A(null),K=A([]),te=A([]),G=A(null),be=A(null),ie=A(null),q=A("inline"),re=A("list"),H=A("rounded"),j=A(!1),ee=A({date:!0,author:!0,commit:!0}),_e=A(0),Le=A(0),Ne=A(null),Je=A(null),st=A(null),Ue=A(null),B=A(null),w=A(null),L=A(null),P=A(null),Y=A(null),de=A(null),X=A(null),xe=A(!1),F=Tw(),pe=ae(()=>{if(!g.value&&v.value.length===0)return t.value;let J=t.value;if(g.value&&(J=F.filter(J,g.value)),v.value.length>0){const ue=new Set(v.value);J=Qw(J,ue)}return J}),me=ae(()=>e.value.find(J=>J.isHead)||null);async function De(J){b.value=J,u.value=!0,d.value=null;try{const[ue,ze,yi,vr,br]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:J}}),$fetch("/api/git/status",{query:{workingDirectory:J}}),$fetch("/api/git/stash",{query:{workingDirectory:J}}).then(ms=>ms.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:J}}).then(ms=>ms.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:J}}).then(ms=>ms.state).catch(()=>null)]);t.value=ue.commits,e.value=ue.branches,i.value=ue.tags,r.value=new Set(ue.localBranches??[]),p.value=ue.hasMore,f.value=ue.totalCount,s.value=ze.stagedFiles??[],n.value=ze.unstagedFiles??[],o.value=(ze.stagedCount??0)+(ze.unstagedCount??0),K.value=yi,te.value=vr,N.value=br,M.value=Date.now(),await fs()}catch(ue){const ze=ue instanceof Error?ue.message:"Failed to load git graph";d.value=ze,t.value=[],e.value=[],i.value=[],s.value=[],n.value=[],o.value=0,K.value=[],te.value=[]}finally{u.value=!1}}async function ct(){if(b.value)try{const J=await $fetch("/api/git/status",{query:{workingDirectory:b.value}});s.value=J.stagedFiles??[],n.value=J.unstagedFiles??[],o.value=(J.stagedCount??0)+(J.unstagedCount??0)}catch(J){console.error("Failed to refresh uncommitted changes:",J)}}const Ct=A(!1);async function pt(){if(!(!b.value||!p.value||u.value||Ct.value)){Ct.value=!0;try{const J=await $fetch("/api/git/log",{query:{workingDirectory:b.value,offset:t.value.length}});t.value=[...t.value,...J.commits],p.value=J.hasMore}catch(J){console.error("Failed to load more commits:",J)}finally{Ct.value=!1}}}async function Zs(J){if(l.value=J,c.value=null,h.value=null,a.value=!1,S.value=!0,!b.value){S.value=!1;return}try{const ue=await $fetch("/api/git/show",{query:{workingDirectory:b.value,hash:J.hash}});c.value=ue.files,h.value=ue.stats}catch(ue){console.error("Failed to load commit details:",ue),c.value=[],h.value={additions:0,deletions:0,filesChanged:0},ce("Failed to load commit details")}finally{S.value=!1}}function vo(){l.value=null,c.value=null,h.value=null,a.value=!1}function yn(){l.value=null,h.value=null,c.value=null,a.value=!0}function bo(J){g.value=J,_e.value=0,pr()}const rr=ae(()=>g.value?w0(t.value,g.value).map(J=>J.hash):[]);function pr(){Le.value=rr.value.length}function yo(){rr.value.length!==0&&(_e.value=(_e.value+1)%rr.value.length,pr(),hs())}function _o(){rr.value.length!==0&&(_e.value=_e.value<=0?rr.value.length-1:_e.value-1,pr(),hs())}function hs(){const J=rr.value[_e.value];if(J){const ue=t.value.find(ze=>ze.hash===J);ue&&Zs(ue)}}function _n(J){const ue=v.value.indexOf(J);ue===-1?v.value.push(J):v.value.splice(ue,1)}function xo(){g.value="",v.value=[]}async function xn(J){if(!b.value)return{success:!1,error:"No working directory set"};$.value=!0;try{const ue=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:J}});return ue.success&&await De(b.value),{success:ue.success,error:ue.error}}catch(ue){const ze=ue instanceof Error?ue.message:"Failed to checkout branch";return ce(ze),{success:!1,error:ze}}finally{$.value=!1}}async function Xs(J,ue){if(!b.value)return{success:!1,error:"No working directory set"};try{const ze=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:J,createBranch:!0,fromCommit:ue}});return ze.success&&await De(b.value),{success:ze.success,error:ze.error}}catch(ze){return{success:!1,error:ze instanceof Error?ze.message:"Failed to create branch"}}}async function Sn(J,ue=!1){return W("/api/git/branch",{branchName:J,force:ue},"Failed to delete branch",{method:"DELETE"})}async function So(J){return W("/api/git/branch",{branchName:J,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function wo(J){if(!b.value)return{success:!1,error:"No working directory set"};k.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:b.value,files:J}}),await ct(),{success:!0}}catch(ue){const ze=ue instanceof Error?ue.message:"Failed to stage files";return ce(ze),{success:!1,error:ze}}finally{k.value=!1}}async function ko(J){if(!b.value)return{success:!1,error:"No working directory set"};k.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:b.value,files:J}}),await ct(),{success:!0}}catch(ue){const ze=ue instanceof Error?ue.message:"Failed to unstage files";return ce(ze),{success:!1,error:ze}}finally{k.value=!1}}async function mr(J){if(!b.value)return{success:!1,error:"No working directory set"};T.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:b.value,message:J}}),await De(b.value),{success:!0}}catch(ue){const ze=ue instanceof Error?ue.message:"Failed to commit changes";return ce(ze),{success:!1,error:ze}}finally{T.value=!1}}async function Co(J,ue){return W("/api/git/branch-rename",{oldName:J,newName:ue},"Failed to rename branch")}async function $o(J,ue){return W("/api/git/merge",{branch:J,...ue},"Failed to merge branch")}async function Po(J){return W("/api/git/rebase",{onto:J},"Failed to rebase branch")}async function Qo(J,ue,ze,yi){return W("/api/git/push",{branch:J,remote:ue,force:ze,forceWithLease:yi},"Failed to push branch")}async function To(J,ue,ze,yi){return W("/api/git/pull",{branch:J,remote:ue,noFastForward:ze,squash:yi},"Failed to pull branch")}async function Mo(J,ue,ze){return W("/api/git/fetch",{branch:J,remote:ue,...ze},"Failed to fetch")}async function Bo(J,ue,ze){return W("/api/git/cherry-pick",{hash:J,recordOrigin:ue,noCommit:ze},"Failed to cherry-pick commit")}async function Ao(J){return W("/api/git/revert",{hash:J},"Failed to revert commit")}async function Ro(J,ue){return W("/api/git/reset",{hash:J,mode:ue},"Failed to reset to commit")}async function Eo(J){if(!b.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:b.value,branchName:J}}),await De(b.value),{success:!0}}catch(ue){const ze=ue?.data?.message||ue?.statusMessage||ue?.message||"Failed to checkout commit";return ce(ze),{success:!1,error:ze}}}async function Do(J){const ue=J.message.split(`
|
|
7
|
-
`)[0];return ve(ue)}async function Lo(J,ue,ze,yi,vr){return W("/api/git/tag",{name:J,hash:ue,annotated:ze,message:yi,pushToRemote:vr},"Failed to create tag")}async function Io(J,ue){return W("/api/git/tag",{name:J,deleteFromRemote:ue},"Failed to delete tag",{method:"DELETE"})}async function No(J,ue){return W("/api/git/tag-push",{name:J,remote:ue},"Failed to push tag")}async function wn(J){if(!b.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(J)}`,{query:{workingDirectory:b.value}})}}catch(ue){const ze=Cl(ue,"Failed to get tag detail");return ce(ze),{success:!1,error:ze}}}async function zo(J){return ve(J)}async function It(){if(!b.value)return{success:!1,error:"No working directory set"};try{const J=await $fetch("/api/git/stash",{query:{workingDirectory:b.value}});return K.value=J.stashes,{success:!0}}catch(J){const ue=Cl(J,"Failed to load stashes");return ce(ue),{success:!1,error:ue}}}async function Vt(J,ue){return W("/api/git/stash-apply",{index:J,reinstateIndex:ue},"Failed to apply stash")}async function kn(J,ue){return W("/api/git/stash-pop",{index:J,reinstateIndex:ue},"Failed to pop stash")}async function gr(J){return W("/api/git/stash-drop",{index:J},"Failed to drop stash")}async function us(J,ue){return W("/api/git/stash-branch",{index:J,branchName:ue},"Failed to create branch from stash")}async function sr(J,ue){return W("/api/git/stash",{message:J,includeUntracked:ue},"Failed to stash changes")}async function Xi(){if(!b.value)return{success:!1,error:"No working directory set"};try{const J=await $fetch("/api/git/remotes",{query:{workingDirectory:b.value}});return te.value=J.remotes,{success:!0}}catch(J){const ue=Cl(J,"Failed to load remotes");return ce(ue),{success:!1,error:ue}}}async function Cn(J,ue){return W("/api/git/remote",{name:J,url:ue},"Failed to add remote")}async function Zo(J,ue){return W("/api/git/remote",{name:J,newUrl:ue},"Failed to edit remote",{method:"PUT"})}async function Ws(J){return W("/api/git/remote",{name:J},"Failed to delete remote",{method:"DELETE"})}async function Vs(J,ue){return W("/api/git/fetch",{all:!0,prune:J,pruneTags:ue},"Failed to fetch all")}function Bt(){q.value=q.value==="inline"?"bottom":"inline"}function Or(){re.value=re.value==="list"?"tree":"list"}function Wi(J){H.value=J}function $n(){j.value=!j.value}function Xo(J){ee.value={...ee.value,[J]:!ee.value[J]}}async function nr(J,ue,ze){if(!ue||!b.value){J.value=null;return}J.value=await YC(b.value,ue,ze)}async function Pn(J){Ne.value=J,await nr(Je,J)}async function ds(J,ue){st.value=J,B.value=ue??null,await nr(Ue,J,ue)}async function Wo(J,ue){w.value=J,P.value=ue??null,await nr(L,J,ue)}async function fs(){b.value&&await Promise.all([nr(Je,Ne.value),nr(Ue,st.value,B.value),nr(L,w.value,P.value)])}function Ae(J){const ue=t.value.find(ze=>ze.hash===J||ze.shortHash===J);ue&&Zs(ue)}async function ge(J){return W("/api/git/reset",{hash:"HEAD",mode:J},"Failed to reset working directory")}async function At(){return W("/api/git/clean",{},"Failed to clean untracked files")}function ps(J){be.value=J}function Wr(){be.value=null}function Fs(J){ie.value=J}function Vo(){ie.value=null}const Vr=A(null),Fr=A(null),C=A(!1),z=ae(()=>!!G.value&&!!l.value);function E(J){G.value=J,J&&l.value&&ne()}function Z(){G.value=null,Vr.value=null,Fr.value=null,C.value=!1}async function ne(){if(!(!b.value||!l.value||!G.value)){C.value=!0;try{const J=await UC({workingDirectory:b.value,from:G.value.hash,to:l.value.hash});Vr.value=J.files,Fr.value=J.stats}catch(J){console.error("Failed to load comparison:",J),ce("Failed to load commit comparison"),Vr.value=null,Fr.value=null}finally{C.value=!1}}}async function ve(J){try{return await Yx(J),{success:!0}}catch(ue){const ze=ue?.message||"Failed to copy to clipboard";return ce(ze),{success:!1,error:ze}}}async function Oe(J,ue){Y.value=ue,de.value=J,X.value=null,xe.value=!0,await nt()}function Be(){Y.value=null,de.value=null,X.value=null,xe.value=!1}async function nt(){if(!b.value||!de.value||!Y.value){xe.value=!1;return}xe.value=!0;try{X.value=await jC({workingDirectory:b.value,commitHash:de.value,filePath:Y.value.path})}catch(J){console.error("Failed to load file diff:",J),ce("Failed to load file diff"),X.value=null}finally{xe.value=!1}}function Ye(){t.value=[],e.value=[],i.value=[],r.value=new Set,s.value=[],n.value=[],o.value=0,a.value=!1,l.value=null,c.value=null,h.value=null,u.value=!1,d.value=null,p.value=!1,f.value=0,g.value="",v.value=[],b.value=null,M.value=null,x.value=!1,V.value=!1,N.value=null,Ct.value=!1,S.value=!1,k.value=!1,T.value=!1,$.value=!1,K.value=[],te.value=[],G.value=null,Vr.value=null,Fr.value=null,C.value=!1,be.value=null,ie.value=null,q.value="inline",re.value="list",H.value="rounded",j.value=!1,ee.value={date:!0,author:!0,commit:!0},_e.value=0,Le.value=0,Ne.value=null,st.value=null,Ue.value=null,B.value=null,w.value=null,L.value=null,P.value=null,Y.value=null,de.value=null,X.value=null,xe.value=!1,he(),F.clear()}async function ht(){if(!b.value||V.value||u.value)return!1;V.value=!0;try{const J=(await $fetch("/api/git/state",{query:{workingDirectory:b.value}})).state,ue=N.value;if(N.value=J,M.value=Date.now(),!ue)return!1;const ze=ue.headCommit!==J.headCommit||ue.branchListHash!==J.branchListHash,yi=ue.workingTreeHash!==J.workingTreeHash,vr=ue.stashListHash!==J.stashListHash;if(ze){const[gs,_l,Ax]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:b.value}}),$fetch("/api/git/status",{query:{workingDirectory:b.value}}),$fetch("/api/git/stash",{query:{workingDirectory:b.value}}).then(Rx=>Rx.stashes).catch(()=>[])]);return t.value=gs.commits,e.value=gs.branches,i.value=gs.tags,r.value=new Set(gs.localBranches??[]),p.value=gs.hasMore,f.value=gs.totalCount,s.value=_l.stagedFiles??[],n.value=_l.unstagedFiles??[],o.value=(_l.stagedCount??0)+(_l.unstagedCount??0),K.value=Ax,await fs(),!0}if(!yi&&!vr)return!1;const[br,ms]=await Promise.all([yi?$fetch("/api/git/status",{query:{workingDirectory:b.value}}):Promise.resolve(null),vr?$fetch("/api/git/stash",{query:{workingDirectory:b.value}}).then(gs=>gs.stashes).catch(()=>[]):Promise.resolve(null)]);return br&&(s.value=br.stagedFiles??[],n.value=br.unstagedFiles??[],o.value=(br.stagedCount??0)+(br.unstagedCount??0)),ms&&(K.value=ms),!0}catch(J){return console.error("Failed to refresh git graph:",J),!1}finally{V.value=!1}}function Qn(){x.value=!0}function Hr(){x.value=!1}return{commits:Me(t),branches:Me(e),tags:Me(i),localBranchNames:Me(r),stagedFiles:Me(s),unstagedFiles:Me(n),uncommittedChangesCount:Me(o),isUncommittedChangesSelected:Me(a),selectedCommit:Me(l),selectedCommitFiles:Me(c),selectedCommitStats:Me(h),loading:Me(u),loadingMore:Me(Ct),error:Me(d),hasMore:Me(p),totalCount:Me(f),searchQuery:Me(g),filteredBranches:Me(v),workingDirectory:Me(b),stashes:Me(K),remotes:Me(te),comparisonCommit:Me(G),comparisonFiles:Me(Vr),comparisonStats:Me(Fr),comparisonLoading:Me(C),isComparing:z,activeDialog:Me(be),activeContextMenu:Me(ie),detailViewPosition:Me(q),fileViewMode:Me(re),graphStyle:Me(H),muteNonAncestral:Me(j),columnVisibility:Me(ee),searchResultIndex:Me(_e),searchResultCount:Me(Le),selectedFeatureId:Me(Ne),featureMergeBase:Me(Je),conversationBranch:Me(st),conversationMergeBase:Me(Ue),conversationBaseBranch:Me(B),previewBranch:Me(w),previewMergeBase:Me(L),previewBaseBranch:Me(P),diffViewerFile:Me(Y),diffViewerCommitHash:Me(de),diffViewerContent:Me(X),diffViewerLoading:Me(xe),lastRefreshTime:Me(M),isPollingActive:Me(x),isRefreshing:Me(V),isLoadingDetails:Me(S),isStaging:Me(k),isCommitting:Me(T),isCheckingOut:Me($),operationError:Me(D),filteredCommits:pe,currentBranch:me,searchResultHashes:rr,loadGitGraph:De,loadMoreCommits:pt,refreshUncommittedChanges:ct,selectCommit:Zs,selectUncommittedChanges:yn,clearSelection:vo,setSearchQuery:bo,toggleBranchFilter:_n,clearFilters:xo,nextSearchResult:yo,prevSearchResult:_o,checkoutBranch:xn,createBranch:Xs,deleteLocalBranch:Sn,deleteRemoteBranch:So,stageFiles:wo,unstageFiles:ko,commitChanges:mr,reset:Ye,clearOperationError:he,renameBranch:Co,mergeBranch:$o,rebaseBranch:Po,pushBranch:Qo,pullBranch:To,fetchBranch:Mo,cherryPickCommit:Bo,revertCommit:Ao,resetToCommit:Ro,checkoutCommit:Eo,copyCommitSubject:Do,createTag:Lo,deleteTag:Io,pushTag:No,getTagDetail:wn,copyTagName:zo,loadStashes:It,applyStash:Vt,popStash:kn,dropStash:gr,stashBranch:us,stashChanges:sr,loadRemotes:Xi,addRemote:Cn,editRemote:Zo,deleteRemote:Ws,fetchAll:Vs,setActiveDialog:ps,clearActiveDialog:Wr,setActiveContextMenu:Fs,clearActiveContextMenu:Vo,selectComparisonCommit:E,clearComparison:Z,loadComparisonData:ne,copyToClipboard:ve,toggleDetailViewPosition:Bt,toggleFileViewMode:Or,setGraphStyle:Wi,toggleMuteNonAncestral:$n,toggleColumnVisibility:Xo,navigateToCommit:Ae,resetWorking:ge,cleanUntracked:At,setSelectedFeatureId:Pn,setConversationBranch:ds,setPreviewBranch:Wo,openFileDiff:Oe,closeFileDiff:Be,checkAndRefresh:ht,startPolling:Qn,stopPolling:Hr}});async function xm(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const t=await $fetch("/api/conversations");if(!t||!Array.isArray(t.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};t.version!==Mc&&console.warn(`[conversationStorage] Storage version mismatch: ${t.version} vs ${Mc}`);const e=t.conversations.map(l=>{if(!l||typeof l!="object")return l;const c=l,h={...c};return"claudeSessionId"in c&&!("providerSessionId"in c)&&(h.providerSessionId=c.claudeSessionId),typeof c.title=="string"&&(h.title=Gu(c.title)),h}),r=(Array.isArray(t.archivedConversations)?t.archivedConversations:[]).map(l=>{if(!l||typeof l!="object")return l;const c=l,h={...c};return"claudeSessionId"in c&&!("providerSessionId"in c)&&(h.providerSessionId=c.claudeSessionId),typeof c.title=="string"&&(h.title=Gu(c.title)),h}),s=e.filter(eS),n=r.filter(tS),o=e.length-s.length,a=r.length-n.length;return o>0&&console.warn(`[conversationStorage] Discarded ${o} corrupted active conversation(s)`),a>0&&console.warn(`[conversationStorage] Discarded ${a} corrupted archive conversation(s)`),{conversations:s,archivedConversations:n,discardedConversations:o,discardedArchives:a}}catch(t){return console.error("[conversationStorage] Failed to load conversations:",t),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function GC(t,e=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Mc,conversations:t,archivedConversations:e}}),!0}catch(i){return console.error("Failed to save conversations:",i),!1}}async function KC(t){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:Mc,conversation:t}}),!0}catch(e){return console.error("Failed to save conversation:",e),!1}}function $l(t){t.contentBlocks&&(t.content=jx(t.contentBlocks))}function JC(t,e){if(t.type!==e.type)return!0;switch(e.type){case"text":return t.text!==e.text;case"tool_use":{const i=t;return i.name!==e.name||i.inputSummary!==e.inputSummary}case"tool_result":{const i=t;return i.content!==e.content||i.isError!==e.isError}default:return!1}}function e2(t,e,i="info",r,s=Date.now,n=Math.random){return{id:`conflict-msg-${s()}-${n().toString(36).slice(2,7)}`,role:t,content:e,timestamp:s(),type:i,fileRef:r}}function t2(t,e){return e===0?{message:`All ${t} file${t===1?"":"s"} resolved successfully. Click "Continue Rebase" to proceed.`,succeeded:!0}:{message:`Resolution complete: ${t} succeeded, ${e} failed. You can retry or abort.`,succeeded:!1}}function i2(t,e){const i=[];for(let r=0;r<t.length;r+=e)i.push(t.slice(r,r+e));return i}function r2(t,e){return t.filter(i=>!e.has(i.path))}function s2(t){return`Detected ${t} conflicted file${t===1?"":"s"}. Enter optional guidance below and click "Resolve Conflicts Automatically" to start.`}function n2(t){return`Starting AI resolution for ${t} file${t===1?"":"s"} (parallel)...`}async function o2(t){return $fetch("/api/chat/preview",{method:"POST",body:t})}async function a2(t){return $fetch("/api/chat/preview",{method:"DELETE",body:t})}function l2(t,e){return t===e?{kind:"end-current",id:e}:t?{kind:"swap",endId:t,startId:e}:{kind:"start",id:e}}function c2(t){const e=new Map,i=t.setTimer??setTimeout,r=t.clearTimer??clearTimeout;function s(l){if(e.has(l))return;const c=i(()=>{e.delete(l),t.onFlush(l)},t.delayMs);e.set(l,c)}function n(l){const c=e.get(l);c&&(r(c),e.delete(l)),t.onFlush(l)}function o(l){const c=e.get(l);c&&(r(c),e.delete(l))}function a(){for(const l of e.values())r(l);e.clear()}return{schedule:s,flush:n,cancel:o,cancelAll:a,hasPending:l=>e.has(l),pendingCount:()=>e.size}}async function h2(t){return $fetch("/api/chat/finalize",{method:"POST",body:t})}async function u2(t){return $fetch("/api/chat/rebase",{method:"POST",body:t})}async function d2(t){return $fetch("/api/rebase/conflicts",{params:{worktreePath:t}})}async function f2(t){const{signal:e,...i}=t;return $fetch("/api/rebase/resolve",{method:"PUT",body:i,signal:e})}async function p2(t){const e=t.mode==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue",{mode:i,...r}=t;return $fetch(e,{method:"POST",body:r})}async function Sm(t){return $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:t}})}async function m2(t){const{signal:e,...i}=t;return $fetch("/api/rebase/ai-resolve",{method:"POST",body:i,signal:e})}const Pl="New Conversation",ur=zf("chat",()=>{const t=A(!1),e=A(iS),i=A("ask"),r=A(""),s=A([]),n=A([]),o=A(null),a=A("active"),l=A(new Set),c=new Map,h=A(!1),u=A(0),p=c2({delayMs:1200,onFlush:C=>{const z=s.value.find(E=>E.id===C);z&&(z.updatedAt=new Date().toISOString(),KC(z))}}),f=A(null),g=A(null);let v=null,b=!1;function S(C){return C?c.get(C)??null:null}function k(C){let z=c.get(C);return z||(z={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(C,z)),z}const T=ae(()=>s.value.find(C=>C.id===o.value)||null),$=ae(()=>T.value?.messages??[]),R=ae(()=>(u.value,S(o.value)?.session??null)),D=ae(()=>(u.value,S(o.value)?.pendingPermission??null)),U=ae(()=>(u.value,S(o.value)?.pendingPlanApproval??null)),ce=ae(()=>(u.value,S(o.value)?.lastError??null)),he=ae(()=>(u.value,S(o.value)?.debugEvents??[])),W=ae(()=>R.value?.status==="streaming"),M=ae(()=>T.value?.providerSessionId??""),x=ae(()=>$.value.length>0),V=ae(()=>$.value[$.value.length-1]||null);function N(C){if(l.value.has(C))return!0;u.value;const z=c.get(C);if(z?.pendingPermission||z?.pendingPlanApproval)return!1;const E=s.value.find(Z=>Z.id===C);if(!E)return!1;for(let Z=E.messages.length-1;Z>=0;Z--){const ne=E.messages[Z];if(ne.role==="assistant")return ne.status==="streaming"}return!1}function K(C){return l.value.has(C)}const te=ae(()=>o.value?N(o.value):!1),G=ae(()=>s.value.length>0),be=ae(()=>n.value.length>0),ie=ae(()=>s.value.length),q=ae(()=>ie.value>=um),re=ae(()=>s.value),H=ae(()=>n.value),j=ae(()=>f.value&&s.value.find(C=>C.id===f.value)||null);function ee(C){return f.value===C}function _e(C){a.value=C}function Le(){typeof window>"u"||$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value,isPanelOpen:t.value}}).catch(C=>{console.error("Failed to save active conversation state:",C)})}function Ne(){const C=o.value,E=(C?s.value.find(Z=>Z.id===C):null)??s.value[0]??null;o.value=E?.id??null,E?.cwd&&(r.value=E.cwd),E||(t.value=!1),o.value!==C&&Le()}async function Je(C){if(!(!C?.previewBranch||!C.worktreePath))try{await RS({previewBranch:C.previewBranch,worktreePath:C.worktreePath})}catch(z){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:C.id,previewBranch:C.previewBranch,worktreePath:C.worktreePath,error:z instanceof Error?z.message:String(z)})}}async function st(C){if(K(C))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(E=>E.id===C)===-1)return{success:!1,error:"Conversation not found"};try{const E=await $fetch(`/api/conversations/${C}/archive`,{method:"POST"});return E.success&&E.archived?(p.cancel(C),c.delete(C),s.value=s.value.filter(Z=>Z.id!==C),n.value=[E.archived,...n.value],gr(),us(),f.value===C&&(f.value=null),o.value===C&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(Z=>{console.error("Failed to save active conversation:",Z)}),{success:!0}):{success:!1,error:"Failed to archive conversation"}}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to archive conversation"}}}async function Ue(C,z){if(Fs().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${dm}.`};if(!n.value.some(Z=>Z.id===C))return{success:!1,error:"Archived conversation not found"};try{const Z=await $fetch(`/api/conversations/archives/${C}/restore`,{method:"POST",body:{baseBranch:z}});return Z.success&&Z.conversation?(s.value=Array.isArray(Z.conversations)?Z.conversations:[Z.conversation,...s.value],Array.isArray(Z.archivedConversations)?n.value=Z.archivedConversations:n.value=n.value.filter(ne=>ne.id!==C),a.value="active",Xi(Z.conversation.id),gr(),It(),{success:!0,conversationId:Z.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(Z){return{success:!1,error:Z instanceof Error?Z.message:"Failed to restore archived conversation"}}}async function B(C){const z=n.value.findIndex(E=>E.id===C);if(z===-1)return{success:!1,error:"Archived conversation not found"};try{return await $fetch(`/api/conversations/archives/${C}`,{method:"DELETE"}),n.value.splice(z,1),us(),{success:!0}}catch{return n.value.splice(z,1),It(),{success:!0}}}async function w(){const C=n.value.length;if(C===0)return{success:!0,deletedCount:0};try{return await $fetch("/api/conversations/archives",{method:"DELETE"}),n.value=[],{success:!0,deletedCount:C}}catch{return n.value=[],It(),{success:!0,deletedCount:C}}}async function L(){if(!(typeof window>"u"))try{const C=await $fetch("/api/settings");if(C){if(typeof C.panelWidth=="number"){const Z=C.panelWidth;Z>=fm&&Z<=pm&&(e.value=Z)}typeof C.isPanelOpen=="boolean"&&(t.value=C.isPanelOpen),typeof C.activeConversationId=="string"&&(o.value=C.activeConversationId);const{useSettingsStore:z}=await uc(async()=>{const{useSettingsStore:Z}=await import("./BOa_3MnO.js").then(ne=>ne.n);return{useSettingsStore:Z}},__vite__mapDeps([0,1,2]),import.meta.url),E=z();await E.hydrate(),i.value=E.permissionMode}}catch(C){console.error("Failed to load chat settings:",C)}}function P(C){i.value=C,typeof window<"u"&&uc(async()=>{const{useSettingsStore:z}=await import("./BOa_3MnO.js").then(E=>E.n);return{useSettingsStore:z}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:z})=>{z().setPermissionMode(C)})}function Y(C,z){const E=z??o.value;if(!E)return;const Z=k(E);Z.pendingPermission=C,u.value++}function de(C){const z=C??o.value;if(!z)return;const E=c.get(z);E&&(E.pendingPermission=null,u.value++)}function X(C,z){const E=z??o.value;if(!E)return;const Z=k(E);Z.pendingPlanApproval=C,u.value++}function xe(C){const z=C??o.value;if(!z)return;const E=c.get(z);E&&(E.pendingPlanApproval=null,u.value++)}function F(){t.value=!t.value,De()}function pe(){t.value=!0,De()}function me(){t.value=!1,De()}function De(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:t.value}}).catch(C=>{console.error("Failed to save panel state:",C)})}function ct(C){const z=Math.max(fm,Math.min(pm,C));e.value=z,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:z}}).catch(E=>{console.error("Failed to save panel width:",E)})}function Ct(C){r.value=C}function pt(C,z){const E=z??o.value;if(!E)return;const Z=s.value.find(ne=>ne.id===E);Z&&(Z.providerSessionId=C)}function Zs(C,z){const E=s.value.find(Z=>Z.id===C);E&&(E.worktreeBranch=z,E.lastCommitTime=new Date().toISOString())}function vo(C,z){const E=s.value.find(Z=>Z.id===C);E&&(z.worktreePath&&(E.cwd=z.worktreePath,E.worktreePath=z.worktreePath,E.hasWorktree=!0),z.worktreeBranch&&(E.worktreeBranch=z.worktreeBranch),z.baseBranch&&(E.baseBranch=z.baseBranch),E.updatedAt=new Date().toISOString(),Vt(C))}async function yn(C){const z=s.value.find(Z=>Z.id===C);if(!z?.worktreeBranch)return null;const E=z.worktreeBranch.trim();if(!E)return null;try{const ne=(await $fetch("/api/specs/features")).features.find(ve=>ve.id===E);return ne?(z.featureId!==ne.id&&(z.featureId=ne.id,z.updatedAt=new Date().toISOString(),It()),ne.id):null}catch(Z){return console.warn("[chat] Failed to map branch to feature",{conversationId:C,branchName:E,error:Z instanceof Error?Z.message:String(Z)}),null}}function bo(C,z,E){const Z=s.value.find(ne=>ne.id===C);Z&&(Z.providerId=z,E!==void 0&&(Z.providerModelKey=E))}function rr(C){const z=C??o.value;if(!z)return;const E=s.value.find(Z=>Z.id===z);E&&(E.providerSessionId="")}function pr(C){return s.value.find(E=>E.id===C)?.providerSessionId??""}function yo(C){l.value.add(C)}function _o(C){l.value.delete(C)}function hs(C,z){const E=z??o.value;if(!E)return;const Z=s.value.find(ne=>ne.id===E);Z&&Z.messages.push(C)}function _n(C,z,E){const Z={id:mm(),role:"user",content:C,attachments:E&&E.length>0?E:void 0,timestamp:new Date().toISOString()};return hs(Z,z),Wr(z),Z}function xo(C){const z={id:mm(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return hs(z,C),z}function xn(C,z,E){const Z=E??o.value;if(!Z)return;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return;const ve=ne.messages.findIndex(Oe=>Oe.id===C);ve!==-1&&(ne.messages[ve]={...ne.messages[ve],...z})}function Xs(C,z){const E=s.value.find(ne=>ne.id===z);if(!E)return;const Z=E.messages.findIndex(ne=>ne.id===C);Z!==-1&&(E.messages[Z]={...E.messages[Z],content:"",status:"streaming",contentBlocks:[]})}function Sn(C,z,E){const Z=E??o.value;if(!Z)return;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return;const ve=ne.messages.findIndex(Oe=>Oe.id===C);ve!==-1&&(ne.messages[ve].content+=z)}function So(C,z,E){const Z=E??o.value;if(!Z)return;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return;const ve=ne.messages.findIndex(Oe=>Oe.id===C);if(ve!==-1){const Oe=ne.messages[ve],Be=Oe.tools?[...Oe.tools,z]:[z];ne.messages[ve]={...Oe,tools:Be}}}function wo(C,z,E,Z){const ne=Z??o.value;if(!ne)return;const ve=s.value.find(Be=>Be.id===ne);if(!ve)return;const Oe=ve.messages.findIndex(Be=>Be.id===C);if(Oe!==-1){const Be=ve.messages[Oe];if(Be.tools){const nt=Be.tools.findIndex(Ye=>Ye.id===z);if(nt!==-1){const Ye=[...Be.tools];Ye[nt]={...Ye[nt],...E},ve.messages[Oe]={...Be,tools:Ye}}}}Vt(ne,!1)}function ko(C,z){const E=z??o.value;if(!E)return;const Z=s.value.find(ve=>ve.id===E);if(!Z)return;const ne=Z.messages.find(ve=>ve.id===C);ne&&!ne.contentBlocks&&(ne.contentBlocks=[])}function mr(C,z,E){const Z=E??o.value;if(!Z)return;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return;const ve=ne.messages.find(Oe=>Oe.id===C);ve&&(ve.contentBlocks||(ve.contentBlocks=[]),ve.contentBlocks.push(z),$l(ve))}function Co(C,z,E,Z){const ne=Z??o.value;if(!ne)return;const ve=s.value.find(ht=>ht.id===ne);if(!ve)return;const Oe=ve.messages.find(ht=>ht.id===C);if(!Oe?.contentBlocks)return;const Be=Oe.contentBlocks.findIndex(ht=>ht.id===z);if(Be===-1)return;const Ye={...Oe.contentBlocks[Be]};E(Ye),Oe.contentBlocks[Be]=Ye}function $o(C,z,E,Z,ne){const ve=Z??o.value;if(!ve)return;const Oe=s.value.find(Hr=>Hr.id===ve);if(!Oe)return;const Be=Oe.messages.find(Hr=>Hr.id===C);if(!Be?.contentBlocks)return;const nt=Be.contentBlocks.findIndex(Hr=>Hr.id===z);if(nt===-1)return;const Ye=Be.contentBlocks[nt],ht={...Ye};E(ht),Be.contentBlocks[nt]=ht,ne?.syncContent!==!1&&JC(Ye,ht)&&$l(Be),Vt(ve,!1)}function Po(C,z,E){const Z=E??o.value;if(!Z)return;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return;const ve=ne.messages.find(Oe=>Oe.id===C);ve&&(ve.contentBlocks||(ve.contentBlocks=[]),ve.contentBlocks.push(z),$l(ve),Vt(Z,!1))}function Qo(C,z,E){const Z=E??o.value;if(!Z)return null;const ne=s.value.find(Oe=>Oe.id===Z);if(!ne)return null;const ve=ne.messages.find(Oe=>Oe.id===C);return ve?.contentBlocks?ve.contentBlocks.find(Oe=>Oe.type==="tool_use"&&Oe.toolUseId===z)??null:null}function To(C,z,E,Z,ne){const ve=s.value.find(Be=>Be.id===ne);if(!ve)return;const Oe=ve.messages.findIndex(Be=>Be.id===C);Oe!==-1&&(ve.messages[Oe]={...ve.messages[Oe],content:E,contentBlocks:z,status:Z},Vt(ne,!0))}function Mo(C,z){const E=z??o.value;if(!E)return;const Z=c.get(E);Z?.session&&(Z.session.status=C,u.value++)}function Bo(C,z){const E=z??o.value;if(!E)return;const Z=k(E);Z.session={sessionId:C,cwd:r.value,status:"streaming",startedAt:new Date().toISOString()},Z.lastError=null,u.value++}function Ao(C){const z=C??o.value;if(!z)return;const E=c.get(z);E?.session&&(E.session.status="idle",u.value++)}function Ro(C,z){const E=z??o.value;if(!E)return;const Z=k(E);Z.session&&(Z.session.status="error",Z.session.error=C),Z.lastError=C,u.value++}function Eo(C,z){if(!h.value)return;const E=z??o.value;if(!E)return;const Z=k(E),ne=(()=>{if(typeof C.payload=="string")return C.payload;try{return JSON.stringify(C.payload,null,2)}catch{return String(C.payload)}})(),ve=8e3,Oe=300,Be=ne.length>ve?`${ne.slice(0,ve)}
|
|
8
|
-
... (truncated)`:ne;Z.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:C.direction,channel:C.channel,eventType:C.eventType||"unknown",payload:Be}),Z.debugEvents.length>Oe&&Z.debugEvents.splice(0,Z.debugEvents.length-Oe),u.value++}function Do(C){h.value=C}function Lo(C){const z=C??o.value;if(!z)return;const E=c.get(z);E&&(E.debugEvents=[],u.value++)}function Io(){if(!o.value)return;const C=s.value.find(E=>E.id===o.value);C&&(C.messages=[]);const z=o.value;c.delete(z),u.value++}function No(C){const z=C??o.value;if(!z)return;const E=c.get(z);E&&(E.lastError=null,E.session&&(E.session.error=void 0),u.value++)}async function wn(){const C=await xm();if(s.value=C.conversations,n.value=C.archivedConversations,C.discardedArchives>0&&console.warn(`[chat] Skipped ${C.discardedArchives} corrupted archived conversation(s)`),gr(),us(),!f.value){const z=s.value.find(E=>!!E.previewBranch&&!E.finalized);z&&(f.value=z.id)}Ne()}async function zo(){const C=await xm(),z=new Map(s.value.map(Oe=>[Oe.id,Oe])),E=new Set(C.conversations.map(Oe=>Oe.id));let Z=0,ne=0,ve=0;for(const Oe of C.conversations){const Be=z.get(Oe.id);if(!Be)s.value.push(Oe),z.set(Oe.id,Oe),Z++,console.log(`[chat] refresh: added new conversation ${Oe.id} (source=${Oe.source}, msgs=${Oe.messages.length})`);else if(Oe.source!=="user"&&(Oe.messages.length>Be.messages.length||Oe.updatedAt>(Be.updatedAt||""))){const nt=s.value.findIndex(Ye=>Ye.id===Oe.id);nt!==-1&&(s.value.splice(nt,1,Oe),console.log(`[chat] refresh: updated conversation ${Oe.id} (msgs: ${Be.messages.length} → ${Oe.messages.length}, updatedAt: ${Be.updatedAt} → ${Oe.updatedAt})`)),ne++}else Be&&Oe.messages.length!==Be.messages.length&&console.log(`[chat] refresh: skipped update for ${Oe.id} (source=${Oe.source}, server msgs=${Oe.messages.length}, local msgs=${Be.messages.length})`)}for(let Oe=s.value.length-1;Oe>=0;Oe--){const Be=s.value[Oe];if(!E.has(Be.id)&&!l.value.has(Be.id)){if(console.log(`[chat] refresh: removed conversation ${Be.id} (no longer on server)`),o.value===Be.id){const nt=s.value.find(Ye=>Ye.id!==Be.id)??null;o.value=nt?.id??null,nt?.cwd&&(r.value=nt.cwd),nt||(t.value=!1),Le()}s.value.splice(Oe,1),ve++}}return C.archivedConversations&&(n.value=C.archivedConversations),(Z>0||ne>0||ve>0)&&gr(),console.log(`[chat] refreshServerConversations: loaded=${C.conversations.length}, added=${Z}, updated=${ne}, removed=${ve}`),Z+ne+ve}function It(){GC(s.value,n.value)}function Vt(C,z=!1){s.value.find(Z=>Z.id===C)&&(z?p.flush(C):p.schedule(C))}function kn(C=!1){o.value&&Vt(o.value,C)}function gr(){s.value.sort((C,z)=>new Date(z.createdAt).getTime()-new Date(C.createdAt).getTime())}function us(){n.value.sort((C,z)=>new Date(z.archivedAt).getTime()-new Date(C.archivedAt).getTime())}async function sr(C){if(Fs().atLimit)return"";const E=rS();let Z=null;if(C?.featureId){const Ye=await vm({conversationId:E,featureId:C.featureId,baseBranch:C.baseBranch});if(!Ye.success&&Ye.error)throw new Error(Ye.error);Z=Ye}let ne=null;if(typeof window<"u")try{const{useSettingsStore:Ye}=await uc(async()=>{const{useSettingsStore:Qn}=await import("./BOa_3MnO.js").then(Hr=>Hr.n);return{useSettingsStore:Qn}},__vite__mapDeps([0,1,2]),import.meta.url),ht=Ye();await ht.hydrate(),ne=ht.providerSelection}catch(Ye){console.warn("[chat] Failed to load provider selection for new conversation",Ye)}const ve=ne||{providerId:ga,modelKey:sS},Oe=C?.providerId||ve.providerId,Be=C?.providerModelKey||(C?.providerId?void 0:ve.modelKey),nt={id:E,title:Pl,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:r.value||process.cwd?.()||"",source:C?.featureId?"cascade":"user",featureId:C?.featureId,providerId:Oe,providerModelKey:Be};if(Z?.success&&Z.worktreePath&&Z.branch&&(nt.worktreePath=Z.worktreePath,nt.worktreeBranch=Z.branch,nt.cwd=Z.worktreePath,nt.hasWorktree=!0,Z.baseBranch&&(nt.baseBranch=Z.baseBranch)),s.value.unshift(nt),o.value=E,t.value=!0,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:E,isPanelOpen:!0}}).catch(Ye=>{console.error("Failed to save active conversation:",Ye)}),!C?.featureId)try{const Ye=await vm({conversationId:E,baseBranch:C?.baseBranch});if(Ye.success&&Ye.worktreePath&&Ye.branch){const ht=s.value.find(Qn=>Qn.id===E);ht&&(ht.worktreePath=Ye.worktreePath,ht.worktreeBranch=Ye.branch,ht.cwd=Ye.worktreePath,ht.hasWorktree=!0,Ye.baseBranch&&(ht.baseBranch=Ye.baseBranch))}}catch(Ye){console.warn("[chat] Failed to create worktree for conversation",E,Ye)}return Vt(E,!0),E}function Xi(C){const z=s.value.find(E=>E.id===C);z&&(o.value=C,t.value=!0,z.cwd&&(r.value=z.cwd),!z.featureId&&z.worktreeBranch&&yn(C),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:C,isPanelOpen:!0}}).catch(E=>{console.error("Failed to save active conversation:",E)}))}async function Cn(C){const z=s.value.findIndex(Z=>Z.id===C);if(z===-1)return;const E=s.value[z];if(f.value===C&&(f.value=null),E.hasWorktree&&E.worktreePath&&E.worktreeBranch)try{await AS({worktreePath:E.worktreePath,branch:E.worktreeBranch,conversationId:C})}catch(Z){console.warn("[chat] Failed to clean up worktree for conversation",C,Z)}s.value.splice(z,1),c.delete(C),l.value.delete(C),p.cancel(C),o.value===C&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(Z=>{console.error("Failed to clear active conversation:",Z)})),It()}async function Zo(C,z,E){const Z=s.value.find(ve=>ve.id===C);if(!Z)return{success:!1,error:"Conversation not found"};if(!Z.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const ne=E||Z.baseBranch;try{const ve=await h2({conversationId:C,commitMessage:z,baseBranch:ne,worktreePath:Z.worktreePath,worktreeBranch:Z.worktreeBranch,previewBranch:Z.previewBranch});return ve.success?(f.value===C&&(f.value=null),Z.worktreePath=void 0,Z.worktreeBranch=void 0,Z.hasWorktree=!1,Z.baseBranch=void 0,Z.previewBranch=void 0,Z.finalized=!0,Z.updatedAt=new Date().toISOString(),It()):ve.rebaseInProgress&&(await Vs(C,Z.worktreePath,ne||"main",z),ds().catch(()=>{})),ve}catch(ve){return{success:!1,error:ve instanceof Error?ve.message:String(ve)}}}async function Ws(C,z){const E=s.value.find(ne=>ne.id===C);if(!E)return{success:!1,error:"Conversation not found"};if(!E.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const Z=z||E.baseBranch;try{const ne=await u2({conversationId:C,baseBranch:Z,worktreePath:E.worktreePath});return ne.rebaseInProgress?(await Vs(C,E.worktreePath,Z||"main","","sync"),ds().catch(()=>{})):ne.success&&(await Je(E),E.baseBranch=Z,It()),ne}catch(ne){return{success:!1,error:ne instanceof Error?ne.message:String(ne)}}}async function Vs(C,z,E,Z,ne="finalize"){g.value={conversationId:C,worktreePath:z,baseBranch:E,commitMessage:Z,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:ne,retryCount:0,strategy:"auto",chatMessages:[],userGuidance:"",lifecycleState:"detected"};try{const ve=await d2(z);g.value&&(g.value.files=ve.files,g.value.loading=!1,Bt("system",s2(ve.files.length),"info"))}catch(ve){g.value&&(g.value.error=ve instanceof Error?ve.message:String(ve),g.value.loading=!1)}}function Bt(C,z,E="info",Z){g.value&&g.value.chatMessages.push(e2(C,z,E,Z))}function Or(C){g.value&&(g.value.userGuidance=C)}async function Wi(C,z,E){if(!g.value||E?.aborted)return!1;try{const Z=await f2({worktreePath:g.value.worktreePath,filePath:C,content:z,signal:E});return Z.success&&g.value&&g.value.resolvedFiles.add(C),Z.success}catch{return!1}}async function $n(){if(!g.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:C,commitMessage:z,baseBranch:E,mode:Z,worktreePath:ne}=g.value;try{const ve=s.value.find(Be=>Be.id===C),Oe=await p2({mode:Z,conversationId:C,commitMessage:z,baseBranch:E,worktreePath:ne,worktreeBranch:ve?.worktreeBranch,previewBranch:ve?.previewBranch});if(Oe.success){if(Z==="finalize"){f.value===C&&(f.value=null);const Be=s.value.find(nt=>nt.id===C);Be&&(Be.worktreePath=void 0,Be.worktreeBranch=void 0,Be.hasWorktree=!1,Be.baseBranch=void 0,Be.previewBranch=void 0,Be.finalized=!0,Be.updatedAt=new Date().toISOString(),It())}else if(Z==="sync"){const Be=s.value.find(nt=>nt.id===C);Be&&(await Je(Be),Be.baseBranch=E,Be.updatedAt=new Date().toISOString(),It())}g.value=null}else Oe.rebaseInProgress&&await Vs(C,ne,E,z,Z);return Oe}catch(ve){return{success:!1,error:ve instanceof Error?ve.message:String(ve)}}}async function Xo(){if(!g.value)return!1;try{const C=await Sm(g.value.worktreePath);return g.value=null,C.success}catch{return g.value=null,!1}}async function nr(C,z){if(!g.value||z?.aborted)return!1;const E=g.value.files.find(Z=>Z.path===C);if(!E)return!1;try{const Z=await m2({worktreePath:g.value.worktreePath,filePath:C,conflictContent:E.content,userGuidance:g.value.userGuidance||void 0,signal:z});if(z?.aborted)return!1;if(Z.success&&Z.resolvedContent!==void 0){E.content=Z.resolvedContent;const ne=await Wi(C,Z.resolvedContent,z);return ne?Bt("assistant",`Resolved: ${C}`,"success",C):Bt("assistant",`Failed to write resolved content for ${C}`,"error",C),ne}return Bt("assistant",`Failed to resolve ${C}: ${Z.error||"Unknown error"}`,"error",C),!1}catch(Z){const ne=Z instanceof Error?Z.message:String(Z);return Bt("assistant",`Error resolving ${C}: ${ne}`,"error",C),!1}}async function Pn(){if(!g.value)return;const C=r2(g.value.files,g.value.resolvedFiles);if(C.length===0){Bt("system","All files are already resolved.","info");return}const z=new AbortController;v=z;const E=z.signal;g.value.lifecycleState="resolving";const Z=g.value.userGuidance;Z&&Bt("user",Z),Bt("system",n2(C.length),"info");let ne=0,ve=0;const Oe=i2(C,3);for(const nt of Oe){if(!g.value||E.aborted)break;for(const ht of nt)Bt("assistant",`Resolving: ${ht.path}...`,"progress",ht.path);const Ye=await Promise.all(nt.map(ht=>nr(ht.path,E)));for(const ht of Ye)ht?ne++:ve++}if(v===z&&(v=null),!g.value||E.aborted)return;const Be=t2(ne,ve);g.value.lifecycleState=Be.succeeded?"resolved":"failed",Bt("system",Be.message,"summary")}async function ds(){if(b)return;b=!0;const C=20;try{for(let z=0;z<C;z++){const E=g.value;if(!E||E.error||E.lifecycleState==="resolving")return;await Pn();const Z=g.value;if(!Z)return;if(Z.lifecycleState!=="resolved"){Bt("system","Automatic resolution needs help on the remaining conflicts. Review them, add guidance, or abort.","info");return}const ne=await $n();if(!g.value)return;if(!ne.rebaseInProgress){Bt("system",`Could not continue the rebase: ${ne.error||"unknown error"}.`,"error");return}}Bt("system","Reached the automatic resolution limit. Continue manually to finish.","info")}finally{b=!1}}async function Wo(){if(!g.value)return;v&&(v.abort(),v=null);const{worktreePath:C}=g.value;Bt("system","Resolution cancelled. Resetting conflict state...","info");try{await Sm(C)}catch{}g.value=null}async function fs(C){const z=s.value.find(E=>E.id===C);if(!z)return{success:!1,error:"Conversation not found"};if(!z.hasWorktree||!z.worktreePath||!z.baseBranch)return{success:!1,error:"No worktree to preview"};try{const E=await o2({conversationId:C,worktreePath:z.worktreePath,baseBranch:z.baseBranch});return E.success&&E.previewBranch&&(z.previewBranch=E.previewBranch,f.value=C,z.updatedAt=new Date().toISOString(),It()),{success:E.success,error:E.error}}catch(E){return{success:!1,error:E instanceof Error?E.message:String(E)}}}async function Ae(C){const z=s.value.find(E=>E.id===C);if(!z)return{success:!1,error:"Conversation not found"};if(!z.previewBranch||!z.baseBranch)return f.value=null,{success:!1,error:"No active preview"};try{const E=await a2({previewBranch:z.previewBranch,baseBranch:z.baseBranch});return E.success&&(z.previewBranch=void 0,f.value=null,z.updatedAt=new Date().toISOString(),It()),{success:E.success,error:E.error}}catch(E){return{success:!1,error:E instanceof Error?E.message:String(E)}}}async function ge(C){const z=l2(f.value,C);if(z.kind==="end-current")return await Ae(z.id);if(z.kind==="swap"){const E=await Ae(z.endId);return E.success?await fs(z.startId):{success:!1,error:`Failed to end previous preview: ${E.error}`}}return await fs(z.id)}function At(C){const z=C.trim();if(!z)return null;const E=s.value.filter(Z=>Z.featureId===z?!0:Z.worktreeBranch?.trim()===z);return E.length===0?null:E.sort((Z,ne)=>new Date(ne.updatedAt).getTime()-new Date(Z.updatedAt).getTime())[0]||null}function ps(C,z){const E=s.value.find(Z=>Z.id===C);E&&(E.title=Gu(z),E.updatedAt=new Date().toISOString(),gr(),It())}function Wr(C){const z=C??o.value;if(!z)return;const E=s.value.find(ne=>ne.id===z);if(!E||E.title.trim().toLowerCase()!==Pl.toLowerCase())return;const Z=E.messages.find(ne=>ne.role==="user");Z&&(Z.content.trim().length>0?E.title=nS(Z.content):Z.attachments&&Z.attachments.length>0&&(E.title=Z.attachments.length===1?`[Image] ${Pl}`:`[${Z.attachments.length} Images] ${Pl}`))}function Fs(){const C=s.value.length;return{atLimit:C>=dm,nearLimit:C>=um,count:C}}async function Vo(C,z){o.value||await sr();const E=_n(C,void 0,z);return kn(!0),E}function Vr(C,z,E){const Z=E??o.value;Sn(C,z,Z??void 0),Z&&Vt(Z,!1)}function Fr(C,z){const E=z??o.value;xn(C,{status:"complete"},E??void 0),E&&Vt(E,!0)}return{messages:$,session:R,isPanelOpen:t,panelWidth:Me(e),permissionMode:Me(i),pendingPermission:D,pendingPlanApproval:U,cwd:Me(r),lastError:ce,debugEvents:he,debugStreamEnabled:Me(h),providerSessionId:M,conversations:Me(s),archivedConversations:Me(n),activeConversationId:Me(o),conversationViewMode:Me(a),conflictState:Me(g),previewingConversationId:Me(f),isStreaming:W,hasMessages:x,lastMessage:V,isActiveConversationStreaming:te,hasConversations:G,hasArchivedConversations:be,activeConversation:T,conversationCount:ie,isNearStorageLimit:q,sortedConversations:re,sortedArchivedConversations:H,previewingConversation:j,streamingConversations:Me(l),initialize:L,togglePanel:F,openPanel:pe,closePanel:me,setPanelWidth:ct,setPermissionMode:P,setPendingPermission:Y,clearPendingPermission:de,setPendingPlanApproval:X,clearPendingPlanApproval:xe,setCwd:Ct,setProviderSessionId:pt,clearProviderSession:rr,getProviderSessionId:pr,updateWorktreeBranch:Zs,updateConversationWorktree:vo,setConversationProviderSelection:bo,startConversationStreaming:yo,endConversationStreaming:_o,isConversationStreaming:N,isConversationActivelyStreaming:K,addMessage:hs,addUserMessage:_n,addAssistantMessage:xo,updateMessage:xn,resetMessageForReplay:Xs,appendToMessage:Sn,addToolToMessage:So,updateToolInMessage:wo,initContentBlocks:ko,appendContentBlock:mr,appendContentBlockWithSave:Po,updateBlockById:Co,updateBlockWithSave:$o,findToolUseBlock:Qo,batchSetMessageBlocks:To,syncContentFromBlocks:$l,setSessionStatus:Mo,startSession:Bo,endSession:Ao,setSessionError:Ro,setDebugStreamEnabled:Do,pushDebugEvent:Eo,clearDebugEvents:Lo,clearMessages:Io,clearError:No,loadConversations:wn,refreshServerConversations:zo,saveAllConversations:It,saveCurrentConversation:kn,saveConversation:Vt,createConversation:sr,selectConversation:Xi,deleteConversation:Cn,archiveConversation:st,restoreArchivedConversation:Ue,deleteArchivedConversation:B,deleteAllArchivedConversations:w,setConversationViewMode:_e,findConversationByFeature:At,syncConversationFeatureFromBranch:yn,renameConversation:ps,checkStorageLimits:Fs,finalizeConversation:Zo,rebaseConversation:Ws,resolveConflictFile:Wi,continueRebase:$n,abortRebase:Xo,aiResolveConflictFile:nr,aiResolveAllConflicts:Pn,addConflictChatMessage:Bt,setConflictUserGuidance:Or,cancelConflictResolution:Wo,previewConversation:fs,unpreviewConversation:Ae,togglePreview:ge,isConversationPreviewing:ee,addUserMessageWithConversation:Vo,appendToMessageWithSave:Vr,completeMessageWithSave:Fr}});function g2(t={}){const e=Sh(),i=300,r=5e3,s=250;let n=null,o=null,a=null,l=null,c=null,h=!1,u=!1;const d=A(!1),p=A(!1);let f=t;function g(M){f=M}async function v(){const M=f.getScrollPosition?.()??0,x=await e.checkAndRefresh();return x&&f.setScrollPosition&&(await ai(),f.setScrollPosition(M)),x}function b(){return d.value||!!e.activeContextMenu||!!e.activeDialog}async function S(){if(b()){p.value=!0;return}T()}async function k(){if(h){u=!0;return}h=!0;try{await v()}finally{h=!1,u&&(u=!1,T())}}function T(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,k()},s)}function $(M){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:M}));return}l&&(clearTimeout(l),l=null);const V=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(V),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:M}))},a.onmessage=N=>{try{JSON.parse(N.data).type==="git_changed"&&S()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&$(c)},r))},a.onerror=()=>{}}function R(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function D(M){M&&(c=M),!e.isPollingActive&&(e.startPolling(),c&&$(c))}function U(){R(),e.stopPolling()}function ce(){d.value=!0,n&&(clearTimeout(n),n=null)}function he(){n&&clearTimeout(n),n=setTimeout(async()=>{d.value=!1,p.value&&(p.value=!1,T())},i)}function W(){U(),n&&(clearTimeout(n),n=null),o&&(clearTimeout(o),o=null),h=!1,u=!1,c=null}return He(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&p.value&&!d.value&&(p.value=!1,T())}),{isUserInteracting:Me(d),isDeferredRefresh:Me(p),startPolling:D,stopPolling:U,startInteraction:ce,endInteraction:he,cleanup:W,setScrollCallbacks:g}}function O2(t){function e(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),t.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),t.onEscape();return}}function i(){document.addEventListener("keydown",e)}function r(){document.removeEventListener("keydown",e)}return{start:i,stop:r}}function v2(t){const e=A({visible:!1,branchName:"",loading:!1,error:null});async function i(){e.value.loading=!0,e.value.error=null;const ie=await t.checkoutBranch(e.value.branchName);e.value.loading=!1,ie.success?e.value.visible=!1:e.value.error=ie.error||"Unknown error"}const r=A({visible:!1,fromCommit:"",loading:!1,error:null});async function s(ie){r.value.loading=!0,r.value.error=null;const q=await t.createBranch(ie.name,r.value.fromCommit);r.value.loading=!1,q.success?(ie.checkout&&await t.checkoutBranch(ie.name),r.value.visible=!1):r.value.error=q.error||"Unknown error"}const n=A({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(ie){n.value.loading=!0,n.value.error=null;const{branchName:q,isLocal:re}=n.value,H=ie?.force??n.value.force,j=re?await t.deleteLocalBranch(q,H):await t.deleteRemoteBranch(q);n.value.loading=!1,j.success?n.value.visible=!1:n.value.error=j.error||"Unknown error"}const a=A({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function l(){if(!a.value.newName.trim()){a.value.error="Branch name is required";return}a.value.loading=!0,a.value.error=null;const ie=await t.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,ie.success?a.value.visible=!1:a.value.error=ie.error||"Unknown error"}const c=A({visible:!1,branchName:"",loading:!1,error:null});async function h(ie){c.value.loading=!0,c.value.error=null;const q=await t.mergeBranch(c.value.branchName,ie);c.value.loading=!1,q.success?c.value.visible=!1:c.value.error=q.error||"Unknown error"}const u=A({visible:!1,branchName:"",loading:!1,error:null});async function d(){u.value.loading=!0,u.value.error=null;const ie=await t.rebaseBranch(u.value.branchName);u.value.loading=!1,ie.success?u.value.visible=!1:u.value.error=ie.error||"Unknown error"}const p=A({visible:!1,branchName:"",loading:!1,error:null});async function f(ie){p.value.loading=!0,p.value.error=null;const q=await t.pushBranch(p.value.branchName,ie.remote,ie.force,ie.forceWithLease);p.value.loading=!1,q.success?p.value.visible=!1:p.value.error=q.error||"Unknown error"}const g=A({visible:!1,branchName:"",loading:!1,error:null});async function v(ie){g.value.loading=!0,g.value.error=null;const q=await t.pullBranch(g.value.branchName,ie.remote,ie.noFastForward,ie.squash);g.value.loading=!1,q.success?g.value.visible=!1:g.value.error=q.error||"Unknown error"}const b=A({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function S(ie){b.value.loading=!0,b.value.error=null;const q=await t.cherryPickCommit(b.value.commitHash,ie.recordOrigin,ie.noCommit);b.value.loading=!1,q.success?b.value.visible=!1:b.value.error=q.error||"Unknown error"}const k=A({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function T(ie){k.value.loading=!0,k.value.error=null;const q=await t.resetToCommit(k.value.commitHash,ie.mode);k.value.loading=!1,q.success?k.value.visible=!1:k.value.error=q.error||"Unknown error"}const $=A({visible:!1,commitHash:"",loading:!1,error:null});async function R(ie){$.value.loading=!0,$.value.error=null;const q=await t.createTag(ie.name,$.value.commitHash,ie.annotated,ie.message,ie.pushToRemote);$.value.loading=!1,q.success?$.value.visible=!1:$.value.error=q.error||"Unknown error"}const D=A({visible:!1,tagName:"",loading:!1,error:null});async function U(ie){D.value.loading=!0,D.value.error=null;const q=await t.deleteTag(D.value.tagName,ie.deleteFromRemote?ie.remote||"origin":void 0);D.value.loading=!1,q.success?D.value.visible=!1:D.value.error=q.error||"Unknown error"}const ce=A({visible:!1,tagName:"",loading:!1,tagDetail:null}),he=A({visible:!1,loading:!1,error:null});async function W(ie){he.value.loading=!0,he.value.error=null;const q=await t.stashChanges(ie.message,ie.includeUntracked);he.value.loading=!1,q.success?he.value.visible=!1:he.value.error=q.error||"Unknown error"}const M=A({visible:!1,stashIndex:0,loading:!1,error:null}),x=A("");async function V(ie){M.value.loading=!0,M.value.error=null;const q=await t.stashBranch(M.value.stashIndex,ie);M.value.loading=!1,q.success?M.value.visible=!1:M.value.error=q.error||"Unknown error"}const N=A({visible:!1,loading:!1,error:null});async function K(ie){N.value.loading=!0,N.value.error=null;const q=await t.resetWorking(ie.mode);N.value.loading=!1,q.success?N.value.visible=!1:N.value.error=q.error||"Unknown error"}const te=A({visible:!1,loading:!1,error:null});async function G(){te.value.loading=!0,te.value.error=null;const ie=await t.cleanUntracked();te.value.loading=!1,ie.success?te.value.visible=!1:te.value.error=ie.error||"Unknown error"}const be=ae(()=>e.value.visible||r.value.visible||n.value.visible||a.value.visible||c.value.visible||u.value.visible||p.value.visible||g.value.visible||b.value.visible||k.value.visible||$.value.visible||D.value.visible||ce.value.visible||he.value.visible||M.value.visible||N.value.visible||te.value.visible);return{checkoutDialog:e,confirmCheckout:i,createBranchDialog:r,confirmCreateBranch:s,deleteBranchDialog:n,confirmDeleteBranch:o,renameDialog:a,confirmRenameBranch:l,mergeDialog:c,confirmMerge:h,rebaseDialog:u,confirmRebase:d,pushDialog:p,confirmPush:f,pullDialog:g,confirmPull:v,cherryPickDialog:b,confirmCherryPick:S,resetDialog:k,confirmReset:T,tagCreateDialog:$,confirmTagCreate:R,tagDeleteDialog:D,confirmTagDelete:U,tagDetailDialog:ce,stashDialog:he,confirmStash:W,stashBranchDialog:M,stashBranchInput:x,confirmStashBranch:V,resetWorkingDialog:N,confirmResetWorking:K,cleanUntrackedDialog:te,confirmCleanUntracked:G,isAnyDialogOpen:be}}function b2(t,e){const i=A({visible:!1,x:0,y:0});function r(X,xe){i.value={visible:!0,x:X,y:xe},setTimeout(()=>{i.value.visible=!1},1500)}const s=A({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function n(X){s.value={visible:!0,...X},t.setActiveContextMenu({type:"branch",props:X,position:{x:X.x,y:X.y}})}function o(){s.value.visible=!1,t.clearActiveContextMenu()}function a(){o(),e.checkoutDialog.value={visible:!0,branchName:s.value.branch,loading:!1,error:null}}function l(){const X=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:X,newName:X,loading:!1,error:null}}function c(){const{branch:X,isLocal:xe}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:X,isLocal:xe,force:!1,loading:!1,error:null}}function h(){const X=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:X,loading:!1,error:null}}function u(){const X=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:X,loading:!1,error:null}}function d(){const X=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:X,loading:!1,error:null}}function p(){const X=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:X,loading:!1,error:null}}async function f(){const X=s.value.branch;o(),await t.fetchBranch(X)}async function g(){const{branch:X,x:xe,y:F}=s.value;o(),(await t.copyToClipboard(X)).success&&r(xe,F)}function v(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const b=A({visible:!1,commit:null,x:0,y:0});function S(X){b.value={visible:!0,commit:X.commit,x:X.x,y:X.y},t.setActiveContextMenu({type:"commit",props:X,position:{x:X.x,y:X.y}})}function k(){b.value.visible=!1,t.clearActiveContextMenu()}function T(X){return X===!1?!1:typeof X=="object"&&X!==null&&"success"in X?!!X.success:!0}function $(X){const xe=b.value.commit;if(!xe)return!1;k();const F=X(xe);return F&&typeof F.then=="function"?F.then(T).catch(()=>!1):T(F)}function R(){$(X=>{e.tagCreateDialog.value={visible:!0,commitHash:X.hash,loading:!1,error:null}})}function D(){$(X=>{e.createBranchDialog.value={visible:!0,fromCommit:X.hash,loading:!1,error:null}})}function U(){$(X=>{e.checkoutDialog.value={visible:!0,branchName:X.hash,loading:!1,error:null}})}function ce(){$(X=>{e.cherryPickDialog.value={visible:!0,commitHash:X.hash,commitMessage:X.message,loading:!1,error:null}})}async function he(){await $(X=>t.revertCommit(X.hash))}function W(){$(X=>{e.mergeDialog.value={visible:!0,branchName:X.shortHash,loading:!1,error:null}})}function M(){$(X=>{e.resetDialog.value={visible:!0,commitHash:X.hash,commitMessage:X.message,loading:!1,error:null}})}async function x(){const{x:X,y:xe}=b.value;await $(pe=>t.copyToClipboard(pe.hash))&&r(X,xe)}async function V(){const{x:X,y:xe}=b.value;await $(pe=>t.copyCommitSubject(pe))&&r(X,xe)}const N=A({visible:!1,tag:"",x:0,y:0,commitHash:""});function K(X){N.value={visible:!0,...X},t.setActiveContextMenu({type:"tag",props:X,position:{x:X.x,y:X.y}})}function te(){N.value.visible=!1,t.clearActiveContextMenu()}async function G(){const X=N.value.tag;te(),e.tagDetailDialog.value={visible:!0,tagName:X,loading:!0,tagDetail:null};const xe=await t.getTagDetail(X);e.tagDetailDialog.value.loading=!1,xe.success&&xe.data&&(e.tagDetailDialog.value.tagDetail=xe.data)}function be(){const X=N.value.tag;te(),e.tagDeleteDialog.value={visible:!0,tagName:X,loading:!1,error:null}}async function ie(){const X=N.value.tag;te(),await t.pushTag(X)}async function q(){const{tag:X,x:xe,y:F}=N.value;te(),(await t.copyToClipboard(X)).success&&r(xe,F)}const re=A({visible:!1,x:0,y:0});function H(X){re.value={visible:!0,...X},t.setActiveContextMenu({type:"uncommitted",props:X,position:{x:X.x,y:X.y}})}function j(){re.value.visible=!1,t.clearActiveContextMenu()}function ee(){j(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function _e(){j(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function Le(){j(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const Ne=A({visible:!1,stash:null,x:0,y:0});function Je(X){Ne.value={visible:!0,stash:X.stash,x:X.x,y:X.y},t.setActiveContextMenu({type:"stash",props:X,position:{x:X.x,y:X.y}})}function st(){Ne.value.visible=!1,t.clearActiveContextMenu()}function Ue(X){const xe=Ne.value.stash;if(!xe)return!1;st();const F=X(xe);return F&&typeof F.then=="function"?F.then(T).catch(()=>!1):T(F)}async function B(){await Ue(X=>t.applyStash(X.index))}async function w(){await Ue(X=>t.popStash(X.index))}async function L(){await Ue(X=>t.dropStash(X.index))}function P(){Ue(X=>{e.stashBranchDialog.value={visible:!0,stashIndex:X.index,loading:!1,error:null}})}async function Y(){const{x:X,y:xe}=Ne.value;await Ue(pe=>t.copyToClipboard(`stash@{${pe.index}}`))&&r(X,xe)}async function de(){const{x:X,y:xe}=Ne.value;await Ue(pe=>t.copyToClipboard(pe.hash))&&r(X,xe)}return{copyFeedback:i,showCopyFeedback:r,branchMenu:s,handleBranchContextMenu:n,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:h,handleBranchRebase:u,handleBranchPush:d,handleBranchPull:p,handleBranchFetch:f,handleBranchCopyName:g,handleBranchCreateBranch:v,commitMenu:b,handleCommitContextMenu:S,closeCommitMenu:k,handleCommitAddTag:R,handleCommitCreateBranch:D,handleCommitCheckout:U,handleCommitCherryPick:ce,handleCommitRevert:he,handleCommitMergeInto:W,handleCommitReset:M,handleCommitCopyHash:x,handleCommitCopySubject:V,tagMenu:N,handleTagContextMenu:K,closeTagMenu:te,handleTagViewDetails:G,handleTagDelete:be,handleTagPush:ie,handleTagCopyName:q,uncommittedMenu:re,handleUncommittedContextMenu:H,closeUncommittedMenu:j,handleUncommittedStash:ee,handleUncommittedReset:_e,handleUncommittedClean:Le,stashMenu:Ne,handleStashContextMenu:Je,closeStashMenu:st,handleStashApply:B,handleStashPop:w,handleStashDrop:L,handleStashCreateBranch:P,handleStashCopyName:Y,handleStashCopyHash:de}}const y2={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},_2={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},x2={class:"text-sm font-mono text-retro-text"},S2={class:"p-4"},w2={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},k2={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},C2=["disabled"],$2=["disabled"],ni=Xe({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e;function s(n){n.key==="Escape"&&r("close"),n.key==="Enter"&&!i.loading&&(n.preventDefault(),r("confirm"))}return He(()=>i.visible,n=>{n?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),si(()=>{document.removeEventListener("keydown",s)}),(n,o)=>(y(),Se(zi,{to:"body"},[oe(Nr,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[t.visible?(y(),_("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:o[3]||(o[3]=gi(a=>r("close"),["self"]))},[m("div",y2,[m("div",_2,[m("h3",x2,I(t.title),1),m("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:o[0]||(o[0]=a=>r("close"))},[oe(O(Gt),{class:"h-4 w-4"})])]),m("div",S2,[t.error?(y(),_("div",w2,I(t.error),1)):se("",!0),n0(n.$slots,"default")]),m("div",k2,[m("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:t.loading,onClick:o[1]||(o[1]=a=>r("close"))},I(t.cancelLabel),9,C2),m("button",{type:"button",class:Ee(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[t.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:t.loading,onClick:o[2]||(o[2]=a=>r("confirm"))},I(t.loading?"Loading...":t.confirmLabel),11,$2)])])])):se("",!0)]),_:3})]))}}),P2={class:"text-retro-text text-sm font-mono mb-4"},Q2={class:"text-retro-cyan"},T2={class:"space-y-3"},M2={class:"flex items-center gap-2 cursor-pointer"},B2={class:"flex items-center gap-2 cursor-pointer"},A2={class:"flex items-center gap-2 cursor-pointer"},R2=Xe({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A(!1),n=A(!1),o=A(!1);function a(){r("confirm",{noCommit:s.value,noFastForward:n.value,squash:o.value})}return He(()=>i.visible,l=>{l&&(s.value=!1,n.value=!1,o.value=!1)}),(l,c)=>(y(),Se(ni,{title:"Merge Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Merge",onClose:c[3]||(c[3]=h=>r("close")),onConfirm:a},{default:ft(()=>[m("p",P2,[c[4]||(c[4]=Ze(" Merge ",-1)),m("span",Q2,I(t.branchName),1),c[5]||(c[5]=Ze(" into current branch ",-1))]),m("div",T2,[m("label",M2,[qe(m("input",{"onUpdate:modelValue":c[0]||(c[0]=h=>rt(s)?s.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(s)]]),c[6]||(c[6]=m("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),m("label",B2,[qe(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>rt(n)?n.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(n)]]),c[7]||(c[7]=m("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),m("label",A2,[qe(m("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>rt(o)?o.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(o)]]),c[8]||(c[8]=m("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),E2={class:"text-retro-text text-sm font-mono mb-2"},D2={class:"text-retro-cyan"},L2={class:"space-y-3 mt-4"},I2={class:"flex items-center gap-2 cursor-pointer"},N2=Xe({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A(!1);function n(){r("confirm",{force:s.value})}return He(()=>i.visible,o=>{o&&(s.value=!1)}),(o,a)=>(y(),Se(ni,{title:"Delete Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Delete","confirm-danger":!0,onClose:a[1]||(a[1]=l=>r("close")),onConfirm:n},{default:ft(()=>[a[4]||(a[4]=m("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),m("p",E2,[Ze(" Delete "+I(t.isLocal?"local":"remote")+" branch ",1),m("span",D2,I(t.branchName),1),a[2]||(a[2]=Ze("? ",-1))]),m("div",L2,[m("label",I2,[qe(m("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>rt(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(s)]]),a[3]||(a[3]=m("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),z2={class:"text-retro-text text-sm font-mono mb-4"},Z2={class:"text-retro-cyan"},X2={class:"space-y-3"},W2=["value"],V2={class:"flex items-center gap-2 cursor-pointer"},F2=["checked"],H2={class:"flex items-center gap-2 cursor-pointer"},q2=["checked"],Y2={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},j2=Xe({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A("origin"),n=A(!1),o=A(!1);function a(h){n.value=h,h&&(o.value=!1)}function l(h){o.value=h,h&&(n.value=!1)}function c(){r("confirm",{remote:s.value,force:n.value,forceWithLease:o.value})}return He(()=>i.visible,h=>{h&&(s.value=i.remotes.includes("origin")?"origin":i.remotes[0]??"origin",n.value=!1,o.value=!1)}),(h,u)=>(y(),Se(ni,{title:"Push Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Push",onClose:u[3]||(u[3]=d=>r("close")),onConfirm:c},{default:ft(()=>[m("p",z2,[u[4]||(u[4]=Ze(" Push ",-1)),m("span",Z2,I(t.branchName),1),u[5]||(u[5]=Ze(" to remote ",-1))]),m("div",X2,[m("div",null,[u[6]||(u[6]=m("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),qe(m("select",{"onUpdate:modelValue":u[0]||(u[0]=d=>rt(s)?s.value=d:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(y(!0),_($e,null,je(t.remotes,d=>(y(),_("option",{key:d,value:d},I(d),9,W2))),128))],512),[[Ms,O(s)]])]),m("label",V2,[m("input",{checked:O(n),type:"checkbox",class:"accent-retro-cyan",onChange:u[1]||(u[1]=d=>a(d.target.checked))},null,40,F2),u[7]||(u[7]=m("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),m("label",H2,[m("input",{checked:O(o),type:"checkbox",class:"accent-retro-cyan",onChange:u[2]||(u[2]=d=>l(d.target.checked))},null,40,q2),u[8]||(u[8]=m("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),O(n)||O(o)?(y(),_("div",Y2,I(O(n)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),U2={class:"text-retro-text text-sm font-mono mb-4"},G2={class:"text-retro-cyan"},K2={class:"space-y-3"},J2=["value"],e5={class:"flex items-center gap-2 cursor-pointer"},t5={class:"flex items-center gap-2 cursor-pointer"},i5=Xe({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A("origin"),n=A(!1),o=A(!1);function a(){r("confirm",{remote:s.value,noFastForward:n.value,squash:o.value})}return He(()=>i.visible,l=>{l&&(s.value=i.remotes.includes("origin")?"origin":i.remotes[0]??"origin",n.value=!1,o.value=!1)}),(l,c)=>(y(),Se(ni,{title:"Pull Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Pull",onClose:c[3]||(c[3]=h=>r("close")),onConfirm:a},{default:ft(()=>[m("p",U2,[c[4]||(c[4]=Ze(" Pull ",-1)),m("span",G2,I(t.branchName),1),c[5]||(c[5]=Ze(" from remote ",-1))]),m("div",K2,[m("div",null,[c[6]||(c[6]=m("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),qe(m("select",{"onUpdate:modelValue":c[0]||(c[0]=h=>rt(s)?s.value=h:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(y(!0),_($e,null,je(t.remotes,h=>(y(),_("option",{key:h,value:h},I(h),9,J2))),128))],512),[[Ms,O(s)]])]),m("label",e5,[qe(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>rt(n)?n.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(n)]]),c[7]||(c[7]=m("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),m("label",t5,[qe(m("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>rt(o)?o.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(o)]]),c[8]||(c[8]=m("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),r5={class:"text-retro-text text-sm font-mono mb-4"},s5={class:"text-retro-cyan"},n5={class:"text-retro-cyan"},o5={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},a5={class:"text-retro-cyan"},l5={class:"text-retro-cyan"},c5=Xe({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e;return(r,s)=>(y(),Se(ni,{title:"Rebase Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=n=>i("close")),onConfirm:s[1]||(s[1]=n=>i("confirm"))},{default:ft(()=>[m("p",r5,[s[2]||(s[2]=Ze(" Rebase ",-1)),m("span",s5,I(t.branchName),1),s[3]||(s[3]=Ze(" onto ",-1)),m("span",n5,I(t.ontoBranch),1)]),m("div",o5,[s[4]||(s[4]=Ze(" This will rewrite commit history. Commits from ",-1)),m("span",a5,I(t.branchName),1),s[5]||(s[5]=Ze(" will be replayed on top of ",-1)),m("span",l5,I(t.ontoBranch),1),s[6]||(s[6]=Ze(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),h5={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},u5={class:"text-sm font-mono text-retro-cyan"},d5={class:"text-xs font-mono text-retro-text mt-1 truncate"},f5={class:"space-y-3"},p5={class:"flex items-start gap-2 cursor-pointer group"},m5={class:"flex items-start gap-2 cursor-pointer group"},g5=Xe({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e,r=A(!1),s=A(!1);function n(){i("confirm",{recordOrigin:r.value,noCommit:s.value})}function o(){r.value=!1,s.value=!1,i("close")}return(a,l)=>(y(),Se(ni,{title:"Cherry-Pick Commit",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:n},{default:ft(()=>[m("div",h5,[l[2]||(l[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),m("div",u5,I(t.commitHash.slice(0,7)),1),m("div",d5,I(t.commitMessage.split(`
|
|
9
|
-
`)[0]),1)]),m("div",f5,[m("label",p5,[qe(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>rt(r)?r.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ni,O(r)]]),l[3]||(l[3]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),m("label",m5,[qe(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>rt(s)?s.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ni,O(s)]]),l[4]||(l[4]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),O5={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},v5={class:"text-sm font-mono text-retro-cyan"},b5={class:"text-xs font-mono text-retro-text mt-1 truncate"},y5={class:"space-y-2"},_5=["value"],x5={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},S5=Xe({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e,r=A("mixed"),s=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function n(){i("confirm",{mode:r.value})}function o(){r.value="mixed",i("close")}return(a,l)=>(y(),Se(ni,{title:"Reset to Commit",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Reset","confirm-danger":O(r)==="hard",onClose:o,onConfirm:n},{default:ft(()=>[m("div",O5,[l[1]||(l[1]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),m("div",v5,I(t.commitHash.slice(0,7)),1),m("div",b5,I(t.commitMessage.split(`
|
|
10
|
-
`)[0]),1)]),m("div",y5,[l[2]||(l[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(y(),_($e,null,je(s,c=>m("label",{key:c.value,class:Ee(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[O(r)===c.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[qe(m("input",{"onUpdate:modelValue":l[0]||(l[0]=h=>rt(r)?r.value=h:null),type:"radio",name:"reset-mode",value:c.value,class:"mt-0.5 accent-retro-cyan"},null,8,_5),[[Uu,O(r)]]),m("div",null,[m("span",{class:Ee(["text-sm font-mono transition-colors",[c.value==="hard"?"text-retro-red":"text-retro-text",O(r)===c.value?"text-retro-cyan":""]])},I(c.label),3),m("p",{class:Ee(["text-xs font-mono mt-0.5",c.value==="hard"?"text-retro-red/70":"text-retro-muted"])},I(c.description),3)])],2)),64))]),O(r)==="hard"?(y(),_("div",x5," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):se("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),w5={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},k5={class:"text-sm font-mono text-retro-cyan"},C5={class:"mb-4"},$5={class:"mb-3"},P5={class:"flex items-start gap-2 cursor-pointer group"},Q5={key:0,class:"mb-4"},T5={class:"space-y-2"},M5={class:"flex items-start gap-2 cursor-pointer group"},B5=["disabled"],A5={key:0,class:"ml-6"},R5=["value"],E5=Xe({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e,r=A(""),s=A(!1),n=A(""),o=A(!1),a=A(""),l=ae(()=>r.value.trim().length>0);function c(){if(!l.value)return;const u={name:r.value.trim(),annotated:s.value};s.value&&n.value.trim()&&(u.message=n.value.trim()),o.value&&a.value&&(u.pushToRemote=a.value),i("confirm",u)}function h(){r.value="",s.value=!1,n.value="",o.value=!1,a.value="",i("close")}return He(()=>s.value,u=>{u||(n.value="")}),(u,d)=>(y(),Se(ni,{title:"Create Tag",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Create Tag",onClose:h,onConfirm:c},{default:ft(()=>[m("div",w5,[d[5]||(d[5]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),m("div",k5,I(t.commitHash.slice(0,7)),1)]),m("div",C5,[d[6]||(d[6]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),qe(m("input",{"onUpdate:modelValue":d[0]||(d[0]=p=>rt(r)?r.value=p:null),type:"text",placeholder:"v1.0.0",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[ui,O(r)]])]),m("div",$5,[m("label",P5,[qe(m("input",{"onUpdate:modelValue":d[1]||(d[1]=p=>rt(s)?s.value=p:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ni,O(s)]]),d[7]||(d[7]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),O(s)?(y(),_("div",Q5,[d[8]||(d[8]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),qe(m("textarea",{"onUpdate:modelValue":d[2]||(d[2]=p=>rt(n)?n.value=p:null),rows:"3",placeholder:"Release description...",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none"},null,512),[[ui,O(n)]])])):se("",!0),m("div",T5,[m("label",M5,[qe(m("input",{"onUpdate:modelValue":d[3]||(d[3]=p=>rt(o)?o.value=p:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:t.remotes.length===0},null,8,B5),[[Ni,O(o)]]),m("div",null,[m("span",{class:Ee(["text-sm font-mono transition-colors",t.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),O(o)&&t.remotes.length>0?(y(),_("div",A5,[qe(m("select",{"onUpdate:modelValue":d[4]||(d[4]=p=>rt(a)?a.value=p:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[d[9]||(d[9]=m("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(y(!0),_($e,null,je(t.remotes,p=>(y(),_("option",{key:p,value:p},I(p),9,R5))),128))],512),[[Ms,O(a)]])])):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),D5={class:"text-retro-text text-sm font-mono mb-2"},L5={class:"text-retro-cyan"},I5={class:"space-y-3 mt-4"},N5={class:"flex items-center gap-2 cursor-pointer"},z5={key:0,class:"ml-6"},Z5=["value"],X5=Xe({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A(!1),n=A("origin");function o(){r("confirm",{deleteFromRemote:s.value,remote:s.value?n.value:void 0})}return He(()=>i.visible,a=>{a&&(s.value=!1,n.value=i.remotes.includes("origin")?"origin":i.remotes[0]??"origin")}),(a,l)=>(y(),Se(ni,{title:"Delete Tag",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Delete","confirm-danger":!0,onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:ft(()=>[l[7]||(l[7]=m("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),m("p",D5,[l[3]||(l[3]=Ze(" Delete tag ",-1)),m("span",L5,I(t.tagName),1),l[4]||(l[4]=Ze("? ",-1))]),m("div",I5,[m("label",N5,[qe(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>rt(s)?s.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(s)]]),l[5]||(l[5]=m("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),O(s)?(y(),_("div",z5,[l[6]||(l[6]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),qe(m("select",{"onUpdate:modelValue":l[1]||(l[1]=c=>rt(n)?n.value=c:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(y(!0),_($e,null,je(t.remotes,c=>(y(),_("option",{key:c,value:c},I(c),9,Z5))),128))],512),[[Ms,O(n)]])])):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),W5={class:"mb-4"},V5={class:"text-retro-cyan text-sm font-mono"},F5={class:"mb-4"},H5={class:"text-retro-text text-sm font-mono"},q5={class:"mb-4"},Y5={class:"text-retro-text text-sm font-mono break-all select-all"},j5={class:"mb-4"},U5={class:"text-retro-text text-sm font-mono"},G5={class:"text-retro-muted"},K5={class:"mb-4"},J5={class:"text-retro-text text-sm font-mono"},e$={key:1,class:"mb-2"},t$={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},i$={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},r$=Xe({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:e}){const i=e;return(r,s)=>(y(),Se(ni,{title:"Tag Details",visible:t.visible,loading:t.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=n=>i("close")),onConfirm:s[1]||(s[1]=n=>i("close"))},{default:ft(()=>[m("div",W5,[s[2]||(s[2]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),m("p",V5,I(t.tagName),1)]),t.tagDetail?(y(),_($e,{key:0},[m("div",F5,[s[3]||(s[3]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),m("p",H5,I(t.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),m("div",q5,[s[4]||(s[4]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),m("p",Y5,I(t.tagDetail.hash),1)]),t.tagDetail.tagger?(y(),_($e,{key:0},[m("div",j5,[s[5]||(s[5]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),m("p",U5,[Ze(I(t.tagDetail.tagger.name)+" ",1),m("span",G5,"<"+I(t.tagDetail.tagger.email)+">",1)])]),m("div",K5,[s[6]||(s[6]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),m("p",J5,I(t.tagDetail.tagger.date),1)])],64)):se("",!0),t.tagDetail.message?(y(),_("div",e$,[s[7]||(s[7]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),m("div",t$,I(t.tagDetail.message),1)])):se("",!0)],64)):t.loading?(y(),_("div",i$," Loading tag details... ")):se("",!0)]),_:1},8,["visible","loading"]))}}),s$={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},n$={class:"text-sm font-mono text-retro-cyan"},o$={class:"mb-4"},a$={class:"flex items-start gap-2 cursor-pointer group"},l$=Xe({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e,r=A(""),s=A(!0),n=ae(()=>r.value.trim().length>0);function o(){n.value&&i("confirm",{name:r.value.trim(),checkout:s.value})}function a(){r.value="",s.value=!0,i("close")}return(l,c)=>(y(),Se(ni,{title:"Create Branch",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Create Branch",onClose:a,onConfirm:o},{default:ft(()=>[m("div",s$,[c[2]||(c[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),m("div",n$,I(t.fromCommit.slice(0,7)),1)]),m("div",o$,[c[3]||(c[3]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),qe(m("input",{"onUpdate:modelValue":c[0]||(c[0]=h=>rt(r)?r.value=h:null),type:"text",placeholder:"feature/my-branch",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[ui,O(r)]])]),m("label",a$,[qe(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>rt(s)?s.value=h:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ni,O(s)]]),c[4]||(c[4]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),c$={class:"space-y-4"},h$={class:"flex items-center gap-2 cursor-pointer"},u$=Xe({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A(""),n=A(!1);function o(){r("confirm",{message:s.value.trim()||void 0,includeUntracked:n.value})}return He(()=>i.visible,a=>{a&&(s.value="",n.value=!1)}),(a,l)=>(y(),Se(ni,{title:"Stash Changes",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Stash",onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:ft(()=>[l[5]||(l[5]=m("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),m("div",c$,[m("div",null,[l[3]||(l[3]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),qe(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>rt(s)?s.value=c:null),type:"text",placeholder:"Stash description...",class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted/50 focus:outline-none focus:border-retro-cyan"},null,512),[[ui,O(s)]])]),m("label",h$,[qe(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>rt(n)?n.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ni,O(n)]]),l[4]||(l[4]=m("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),d$={class:"space-y-3"},f$={class:"flex items-start gap-2 cursor-pointer"},p$={class:"flex items-start gap-2 cursor-pointer"},m$={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},g$=Xe({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=t,r=e,s=A("mixed"),n=ae(()=>s.value==="hard");function o(){r("confirm",{mode:s.value})}return He(()=>i.visible,a=>{a&&(s.value="mixed")}),(a,l)=>(y(),Se(ni,{title:"Reset Working Directory",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Reset","confirm-danger":O(n),onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:ft(()=>[l[5]||(l[5]=m("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),m("div",d$,[m("label",f$,[qe(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>rt(s)?s.value=c:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Uu,O(s)]]),l[3]||(l[3]=m("div",null,[m("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),m("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),m("label",p$,[qe(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>rt(s)?s.value=c:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Uu,O(s)]]),l[4]||(l[4]=m("div",null,[m("span",{class:"text-retro-text text-sm font-mono"},"Hard"),m("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),O(n)?(y(),_("div",m$," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):se("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),O$=Xe({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(t,{emit:e}){const i=e;return(r,s)=>(y(),Se(ni,{title:"Clean Untracked Files",visible:t.visible,loading:t.loading,error:t.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=n=>i("close")),onConfirm:s[1]||(s[1]=n=>i("confirm"))},{default:ft(()=>[...s[2]||(s[2]=[m("div",{class:"space-y-3"},[m("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),m("p",{class:"text-retro-muted text-xs font-mono"},[Ze(" This runs "),m("code",null,"git clean -fd"),Ze(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),v$={class:"text-retro-muted text-sm"},b$={class:"text-retro-cyan font-mono"},y$={class:"space-y-3"},_$={class:"text-retro-muted text-sm"},x$={class:"text-retro-cyan font-mono"},S$={class:"space-y-3"},w$={class:"text-retro-muted text-sm"},k$={class:"text-retro-magenta font-mono"},C$={key:0,class:"fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2.5 text-sm bg-retro-red/90 text-white rounded-lg shadow-lg max-w-sm",role:"alert"},$$={class:"flex-1"},P$=Xe({__name:"GitGraphDialogs",props:{dialogs:{},store:{},remoteNames:{},copyFeedback:{}},setup(t){const e=t,{checkoutDialog:i,confirmCheckout:r,createBranchDialog:s,confirmCreateBranch:n,deleteBranchDialog:o,confirmDeleteBranch:a,renameDialog:l,confirmRenameBranch:c,mergeDialog:h,confirmMerge:u,rebaseDialog:d,confirmRebase:p,pushDialog:f,confirmPush:g,pullDialog:v,confirmPull:b,cherryPickDialog:S,confirmCherryPick:k,resetDialog:T,confirmReset:$,tagCreateDialog:R,confirmTagCreate:D,tagDeleteDialog:U,confirmTagDelete:ce,tagDetailDialog:he,stashDialog:W,confirmStash:M,stashBranchDialog:x,stashBranchInput:V,confirmStashBranch:N,resetWorkingDialog:K,confirmResetWorking:te,cleanUntrackedDialog:G,confirmCleanUntracked:be}=e.dialogs;return(ie,q)=>(y(),_($e,null,[O(i).visible?(y(),Se(ni,{key:0,title:"Checkout",visible:O(i).visible,loading:O(i).loading,error:O(i).error,confirmLabel:"Checkout",onClose:q[0]||(q[0]=re=>O(i).visible=!1),onConfirm:O(r)},{default:ft(()=>[m("p",v$,[q[23]||(q[23]=Ze(" Are you sure you want to checkout ",-1)),m("span",b$,I(O(i).branchName),1),q[24]||(q[24]=Ze("? ",-1))])]),_:1},8,["visible","loading","error","onConfirm"])):se("",!0),O(l).visible?(y(),Se(ni,{key:1,title:"Rename Branch",visible:O(l).visible,loading:O(l).loading,error:O(l).error,confirmLabel:"Rename",onClose:q[3]||(q[3]=re=>O(l).visible=!1),onConfirm:O(c)},{default:ft(()=>[m("div",y$,[m("p",_$,[q[25]||(q[25]=Ze(" Rename ",-1)),m("span",x$,I(O(l).branchName),1)]),qe(m("input",{"onUpdate:modelValue":q[1]||(q[1]=re=>O(l).newName=re),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"New branch name",onKeyup:q[2]||(q[2]=Ps((...re)=>O(c)&&O(c)(...re),["enter"]))},null,544),[[ui,O(l).newName]])])]),_:1},8,["visible","loading","error","onConfirm"])):se("",!0),O(h).visible?(y(),Se(R2,{key:2,visible:O(h).visible,branchName:O(h).branchName,loading:O(h).loading,error:O(h).error,onClose:q[4]||(q[4]=re=>O(h).visible=!1),onConfirm:O(u)},null,8,["visible","branchName","loading","error","onConfirm"])):se("",!0),O(o).visible?(y(),Se(N2,{key:3,visible:O(o).visible,branchName:O(o).branchName,isLocal:O(o).isLocal,loading:O(o).loading,error:O(o).error,onClose:q[5]||(q[5]=re=>O(o).visible=!1),onConfirm:O(a)},null,8,["visible","branchName","isLocal","loading","error","onConfirm"])):se("",!0),O(f).visible?(y(),Se(j2,{key:4,visible:O(f).visible,branchName:O(f).branchName,remotes:t.remoteNames,loading:O(f).loading,error:O(f).error,onClose:q[6]||(q[6]=re=>O(f).visible=!1),onConfirm:O(g)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):se("",!0),O(v).visible?(y(),Se(i5,{key:5,visible:O(v).visible,branchName:O(v).branchName,remotes:t.remoteNames,loading:O(v).loading,error:O(v).error,onClose:q[7]||(q[7]=re=>O(v).visible=!1),onConfirm:O(b)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):se("",!0),O(d).visible?(y(),Se(c5,{key:6,visible:O(d).visible,branchName:t.store.currentBranch?.name||"HEAD",ontoBranch:O(d).branchName,loading:O(d).loading,error:O(d).error,onClose:q[8]||(q[8]=re=>O(d).visible=!1),onConfirm:O(p)},null,8,["visible","branchName","ontoBranch","loading","error","onConfirm"])):se("",!0),O(S).visible?(y(),Se(g5,{key:7,visible:O(S).visible,commitHash:O(S).commitHash,commitMessage:O(S).commitMessage,loading:O(S).loading,error:O(S).error,onClose:q[9]||(q[9]=re=>O(S).visible=!1),onConfirm:O(k)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):se("",!0),O(T).visible?(y(),Se(S5,{key:8,visible:O(T).visible,commitHash:O(T).commitHash,commitMessage:O(T).commitMessage,loading:O(T).loading,error:O(T).error,onClose:q[10]||(q[10]=re=>O(T).visible=!1),onConfirm:O($)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):se("",!0),O(R).visible?(y(),Se(E5,{key:9,visible:O(R).visible,commitHash:O(R).commitHash,remotes:t.remoteNames,loading:O(R).loading,error:O(R).error,onClose:q[11]||(q[11]=re=>O(R).visible=!1),onConfirm:O(D)},null,8,["visible","commitHash","remotes","loading","error","onConfirm"])):se("",!0),O(U).visible?(y(),Se(X5,{key:10,visible:O(U).visible,tagName:O(U).tagName,remotes:t.remoteNames,loading:O(U).loading,error:O(U).error,onClose:q[12]||(q[12]=re=>O(U).visible=!1),onConfirm:O(ce)},null,8,["visible","tagName","remotes","loading","error","onConfirm"])):se("",!0),O(he).visible?(y(),Se(r$,{key:11,visible:O(he).visible,tagName:O(he).tagName,tagDetail:O(he).tagDetail,loading:O(he).loading,onClose:q[13]||(q[13]=re=>O(he).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):se("",!0),O(s).visible?(y(),Se(l$,{key:12,visible:O(s).visible,fromCommit:O(s).fromCommit,loading:O(s).loading,error:O(s).error,onClose:q[14]||(q[14]=re=>O(s).visible=!1),onConfirm:O(n)},null,8,["visible","fromCommit","loading","error","onConfirm"])):se("",!0),O(x).visible?(y(),Se(ni,{key:13,title:"Create Branch from Stash",visible:O(x).visible,loading:O(x).loading,error:O(x).error,confirmLabel:"Create Branch",onClose:q[17]||(q[17]=re=>O(x).visible=!1),onConfirm:q[18]||(q[18]=re=>O(N)(O(V)))},{default:ft(()=>[m("div",S$,[m("p",w$,[q[26]||(q[26]=Ze(" Create a new branch from ",-1)),m("span",k$,"stash@"+I("{")+I(O(x).stashIndex)+I("}"),1)]),qe(m("input",{"onUpdate:modelValue":q[15]||(q[15]=re=>rt(V)?V.value=re:null),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"Branch name",onKeyup:q[16]||(q[16]=Ps(re=>O(N)(O(V)),["enter"]))},null,544),[[ui,O(V)]])])]),_:1},8,["visible","loading","error"])):se("",!0),O(W).visible?(y(),Se(u$,{key:14,visible:O(W).visible,loading:O(W).loading,error:O(W).error,onClose:q[19]||(q[19]=re=>O(W).visible=!1),onConfirm:O(M)},null,8,["visible","loading","error","onConfirm"])):se("",!0),O(K).visible?(y(),Se(g$,{key:15,visible:O(K).visible,loading:O(K).loading,error:O(K).error,onClose:q[20]||(q[20]=re=>O(K).visible=!1),onConfirm:O(te)},null,8,["visible","loading","error","onConfirm"])):se("",!0),O(G).visible?(y(),Se(O$,{key:16,visible:O(G).visible,loading:O(G).loading,error:O(G).error,onClose:q[21]||(q[21]=re=>O(G).visible=!1),onConfirm:O(be)},null,8,["visible","loading","error","onConfirm"])):se("",!0),(y(),Se(zi,{to:"body"},[oe(Nr,{name:"fade"},{default:ft(()=>[t.copyFeedback.visible?(y(),_("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:qi({left:`${t.copyFeedback.x}px`,top:`${t.copyFeedback.y-40}px`})}," Copied! ",4)):se("",!0)]),_:1})])),(y(),Se(zi,{to:"body"},[oe(Nr,{name:"fade"},{default:ft(()=>[t.store.operationError?(y(),_("div",C$,[oe(O(Bs),{class:"w-4 h-4 flex-shrink-0"}),m("span",$$,I(t.store.operationError),1),m("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:q[22]||(q[22]=re=>t.store.clearOperationError()),"aria-label":"Dismiss error"},[oe(O(Gt),{class:"w-3.5 h-3.5"})])])):se("",!0)]),_:1})]))],64))}}),Q$=ns(P$,[["__scopeId","data-v-c47c4487"]]),Ff=globalThis.setInterval,T$={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},M$={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},B$={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},A$={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},R$={class:"text-retro-red text-sm mb-4"},E$={key:3,class:"flex-1 flex items-center justify-center p-4"},D$={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},L$={class:"relative"},I$={key:0,class:"absolute left-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-2 min-w-[200px]"},N$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},z$=["checked"],Z$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},X$=["checked"],W$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},V$=["checked"],F$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},H$=["checked"],q$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Y$=["checked"],j$={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},U$=["checked"],G$={class:"relative"},K$=["aria-expanded"],J$={key:0,class:"text-xs"},eP={key:0,class:"absolute right-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px] max-h-[400px] overflow-auto"},tP=["checked","onChange"],iP={class:"text-sm text-retro-text truncate"},rP={key:0,class:"text-[10px] text-retro-cyan"},sP={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},nP=["checked","onChange"],oP={class:"text-sm text-retro-text truncate"},aP={class:"relative"},lP={key:0,class:"absolute right-0 top-full mt-1 z-20"},cP=["title"],hP=5e3,uP=Xe({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(t){const e=t,i=Sh(),r=ur(),s=g2(),n=v2(i),o=b2(i,n),{checkoutDialog:a,confirmCheckout:l,createBranchDialog:c,confirmCreateBranch:h,deleteBranchDialog:u,confirmDeleteBranch:d,renameDialog:p,confirmRenameBranch:f,mergeDialog:g,confirmMerge:v,rebaseDialog:b,confirmRebase:S,pushDialog:k,confirmPush:T,pullDialog:$,confirmPull:R,cherryPickDialog:D,confirmCherryPick:U,resetDialog:ce,confirmReset:he,tagCreateDialog:W,confirmTagCreate:M,tagDeleteDialog:x,confirmTagDelete:V,tagDetailDialog:N,stashDialog:K,confirmStash:te,stashBranchDialog:G,stashBranchInput:be,confirmStashBranch:ie,resetWorkingDialog:q,confirmResetWorking:re,cleanUntrackedDialog:H,confirmCleanUntracked:j,isAnyDialogOpen:ee}=n,{copyFeedback:_e,branchMenu:Le,handleBranchContextMenu:Ne,closeBranchMenu:Je,handleBranchCheckout:st,handleBranchRename:Ue,handleBranchDelete:B,handleBranchMerge:w,handleBranchRebase:L,handleBranchPush:P,handleBranchPull:Y,handleBranchFetch:de,handleBranchCopyName:X,handleBranchCreateBranch:xe,commitMenu:F,handleCommitContextMenu:pe,closeCommitMenu:me,handleCommitAddTag:De,handleCommitCreateBranch:ct,handleCommitCheckout:Ct,handleCommitCherryPick:pt,handleCommitRevert:Zs,handleCommitMergeInto:vo,handleCommitReset:yn,handleCommitCopyHash:bo,handleCommitCopySubject:rr,tagMenu:pr,handleTagContextMenu:yo,closeTagMenu:_o,handleTagViewDetails:hs,handleTagDelete:_n,handleTagPush:xo,handleTagCopyName:xn,uncommittedMenu:Xs,closeUncommittedMenu:Sn,handleUncommittedStash:So,handleUncommittedReset:wo,handleUncommittedClean:ko,stashMenu:mr,handleStashContextMenu:Co,closeStashMenu:$o,handleStashApply:Po,handleStashPop:Qo,handleStashDrop:To,handleStashCreateBranch:Mo,handleStashCopyName:Bo,handleStashCopyHash:Ao}=o,Ro=ae(()=>{const Ae=r.activeConversation?.worktreeBranch;return Ae?[Ae]:[]}),Eo=ae(()=>{const Ae=[],ge=i.selectedFeatureId;ge&&Ae.push(ge);const At=i.conversationBranch;return At&&!Ae.includes(At)&&Ae.push(At),Ae});He(()=>[r.activeConversation?.worktreeBranch,r.activeConversation?.baseBranch],([Ae,ge])=>{i.setConversationBranch(Ae??null,ge??null)},{immediate:!0});const Do=ae(()=>{const Ae=i.previewBranch;return Ae?[Ae]:[]});He(()=>[r.previewingConversation?.worktreeBranch,r.previewingConversation?.baseBranch],([Ae,ge])=>{i.setPreviewBranch(Ae??null,ge??null)},{immediate:!0});const Lo=ae(()=>_m([{branch:i.previewBranch,mergeBase:i.previewMergeBase}])),Io=ae(()=>_m([{branch:i.selectedFeatureId,mergeBase:i.featureMergeBase},{branch:i.conversationBranch,mergeBase:i.conversationMergeBase}])),No=ae(()=>i.remotes.map(Ae=>Ae.name)),wn=A(null);He(()=>e.workingDirectory,async Ae=>{if(Ae){await i.loadGitGraph(Ae);const ge=r.previewingConversation?.worktreeBranch;ge&&await i.setPreviewBranch(ge,r.previewingConversation?.baseBranch??null);const At=r.activeConversation?.worktreeBranch;At&&await i.setConversationBranch(At,r.activeConversation?.baseBranch??null)}},{immediate:!0}),He(()=>e.isActive,Ae=>{Ae&&i.commits.length>0&&!i.error?s.startPolling(e.workingDirectory):s.stopPolling()},{immediate:!0}),He(()=>i.commits.length,Ae=>{Ae>0&&e.isActive&&!i.error&&s.startPolling(e.workingDirectory)}),He(()=>wn.value,Ae=>{Ae&&s.setScrollCallbacks({getScrollPosition:()=>Ae.getScrollPosition(),setScrollPosition:ge=>Ae.setScrollPosition(ge)})}),si(()=>{s.cleanup(),i.reset()});const zo=ae(()=>i.error?.includes("Not a Git repository")),It=A(Date.now());let Vt=null;const kn=()=>{Vt||(Vt=Ff(()=>{It.value=Date.now()},hP))},gr=()=>{Vt&&(clearInterval(Vt),Vt=null)};kt(()=>{He(()=>e.isActive,Ae=>{Ae?(It.value=Date.now(),kn()):gr()},{immediate:!0})}),si(()=>{gr()});const us=ae(()=>{const Ae=i.lastRefreshTime;if(!Ae)return null;const ge=Math.floor((It.value-Ae)/1e3);return i.isRefreshing?"Syncing...":ge<5?"Just now":ge<60?`${ge}s ago`:`${Math.floor(ge/60)}m ago`}),sr=A(!1),Xi=A(!1),Cn=A(null);function Zo(){sr.value=!0,ai(()=>Cn.value?.focus())}function Ws(){sr.value=!1,i.setSearchQuery("")}function Vs(Ae){i.setSearchQuery(Ae)}const Bt=O2({onScrollToHead:()=>{const Ae=i.commits.find(ge=>ge.isHead);Ae&&i.selectCommit(Ae)},onEscape:()=>{Or.value?Or.value=!1:Xi.value?Xi.value=!1:Wi.value?Wi.value=!1:sr.value?Ws():i.isComparing?i.clearComparison():(i.selectedCommit||i.isUncommittedChangesSelected)&&i.clearSelection()}});kt(()=>{Bt.start()}),si(()=>{Bt.stop()});const Or=A(!1),Wi=A(!1);async function $n(){await i.fetchAll(!0)}async function Xo(Ae){await i.addRemote(Ae.name,Ae.url)}async function nr(Ae){await i.editRemote(Ae.name,Ae.newUrl)}async function Pn(Ae){await i.deleteRemote(Ae)}const ds=ae(()=>{const Ae=[],ge={};for(const At of i.branches)if(i.localBranchNames.has(At.name))Ae.push(At);else{const ps=At.name.indexOf("/");if(ps>0){const Wr=At.name.substring(0,ps);ge[Wr]||(ge[Wr]=[]),ge[Wr].push(At)}else Ae.push(At)}return{local:Ae,remotes:ge}});He(ee,Ae=>{Ae?i.setActiveDialog({type:"generic",props:{}}):i.clearActiveDialog()});function Wo(Ae){i.selectedCommit?i.selectComparisonCommit(Ae):i.selectCommit(Ae)}function fs(Ae){i.navigateToCommit(Ae)}return(Ae,ge)=>{const At=zS,ps=tw,Wr=$w,Fs=Yw,Vo=uC,Vr=RC,Fr=WC,C=VC,z=FC,E=HC,Z=qC;return y(),_("div",T$,[O(i).loading&&O(i).commits.length===0?(y(),_("div",M$,[...ge[20]||(ge[20]=[m("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),m("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):O(zo)?(y(),_("div",B$,[oe(O(Bs),{class:"w-12 h-12 text-retro-yellow mb-4"}),ge[21]||(ge[21]=m("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),ge[22]||(ge[22]=m("p",{class:"text-retro-muted text-sm max-w-xs"},[Ze(" This directory is not initialized as a Git repository. Run "),m("code",{class:"text-retro-cyan"},"git init"),Ze(" to get started. ")],-1))])):O(i).error?(y(),_("div",A$,[oe(O(Bs),{class:"w-10 h-10 text-retro-red mb-3"}),m("p",R$,I(O(i).error),1),m("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:ge[0]||(ge[0]=ne=>O(i).loadGitGraph(e.workingDirectory))},[oe(O(un),{class:"w-4 h-4"}),ge[23]||(ge[23]=Ze(" Retry ",-1))])])):O(i).commits.length===0?(y(),_("div",E$,[...ge[24]||(ge[24]=[m("div",{class:"text-retro-muted text-center"},[m("p",null,"No commits found in this repository.")],-1)])])):(y(),_($e,{key:4},[O(sr)?(y(),Se(At,{key:0,ref_key:"findWidgetRef",ref:Cn,resultCount:O(i).searchResultHashes.length,currentIndex:O(i).searchResultIndex,onSearch:Vs,onNext:O(i).nextSearchResult,onPrev:O(i).prevSearchResult,onClose:Ws},null,8,["resultCount","currentIndex","onNext","onPrev"])):se("",!0),m("div",D$,[m("button",{class:Ee(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",O(sr)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Find",title:"Find",onClick:ge[1]||(ge[1]=ne=>O(sr)?Ws():Zo())},[oe(O(ln),{class:"w-4 h-4"})],2),m("div",L$,[m("button",{class:Ee(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",O(Or)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Graph settings",title:"Settings",onClick:ge[2]||(ge[2]=ne=>Or.value=!O(Or))},[oe(O(aS),{class:"w-4 h-4"})],2),O(Or)?(y(),_("div",I$,[ge[31]||(ge[31]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),m("label",N$,[m("input",{type:"radio",name:"graphStyle",value:"rounded",checked:O(i).graphStyle==="rounded",class:"accent-retro-cyan",onChange:ge[3]||(ge[3]=ne=>O(i).setGraphStyle("rounded"))},null,40,z$),ge[25]||(ge[25]=m("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),m("label",Z$,[m("input",{type:"radio",name:"graphStyle",value:"angular",checked:O(i).graphStyle==="angular",class:"accent-retro-cyan",onChange:ge[4]||(ge[4]=ne=>O(i).setGraphStyle("angular"))},null,40,X$),ge[26]||(ge[26]=m("span",{class:"text-sm text-retro-text"},"Angular",-1))]),ge[32]||(ge[32]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),m("label",W$,[m("input",{type:"checkbox",checked:O(i).muteNonAncestral,class:"accent-retro-cyan",onChange:ge[5]||(ge[5]=ne=>O(i).toggleMuteNonAncestral())},null,40,V$),ge[27]||(ge[27]=m("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),ge[33]||(ge[33]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),m("label",F$,[m("input",{type:"checkbox",checked:O(i).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:ge[6]||(ge[6]=ne=>O(i).toggleColumnVisibility("commit"))},null,40,H$),ge[28]||(ge[28]=m("span",{class:"text-sm text-retro-text"},"Hash",-1))]),m("label",q$,[m("input",{type:"checkbox",checked:O(i).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:ge[7]||(ge[7]=ne=>O(i).toggleColumnVisibility("author"))},null,40,Y$),ge[29]||(ge[29]=m("span",{class:"text-sm text-retro-text"},"Author",-1))]),m("label",j$,[m("input",{type:"checkbox",checked:O(i).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:ge[8]||(ge[8]=ne=>O(i).toggleColumnVisibility("date"))},null,40,U$),ge[30]||(ge[30]=m("span",{class:"text-sm text-retro-text"},"Date",-1))])])):se("",!0)]),ge[36]||(ge[36]=m("span",{class:"flex-1"},null,-1)),m("div",G$,[m("button",{class:Ee(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",O(Xi)||O(i).filteredBranches.length>0?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Filter by branch","aria-expanded":O(Xi),onClick:ge[9]||(ge[9]=ne=>Xi.value=!O(Xi))},[oe(O(kS),{class:"w-4 h-4"}),O(i).filteredBranches.length>0?(y(),_("span",J$," ("+I(O(i).filteredBranches.length)+") ",1)):se("",!0)],10,K$),O(Xi)?(y(),_("div",eP,[ge[35]||(ge[35]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),O(i).filteredBranches.length>0?(y(),_("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:ge[10]||(ge[10]=ne=>O(i).clearFilters())}," Clear All Filters ")):se("",!0),O(ds).local.length>0?(y(),_($e,{key:1},[ge[34]||(ge[34]=m("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(y(!0),_($e,null,je(O(ds).local,ne=>(y(),_("label",{key:ne.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[m("input",{type:"checkbox",checked:O(i).filteredBranches.includes(ne.name),class:"accent-retro-cyan",onChange:ve=>O(i).toggleBranchFilter(ne.name)},null,40,tP),m("span",iP,I(ne.name),1),ne.isHead?(y(),_("span",rP,"(HEAD)")):se("",!0)]))),128))],64)):se("",!0),(y(!0),_($e,null,je(O(ds).remotes,(ne,ve)=>(y(),_($e,{key:ve},[m("div",sP,I(ve),1),(y(!0),_($e,null,je(ne,Oe=>(y(),_("label",{key:Oe.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[m("input",{type:"checkbox",checked:O(i).filteredBranches.includes(Oe.name),class:"accent-retro-cyan",onChange:Be=>O(i).toggleBranchFilter(Oe.name)},null,40,nP),m("span",oP,I(Oe.name),1)]))),128))],64))),128))])):se("",!0)]),m("button",{class:Ee(["flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors",{"animate-spin":O(i).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:ge[11]||(ge[11]=ne=>O(i).loadGitGraph(e.workingDirectory))},[oe(O(un),{class:"w-4 h-4"})],2),m("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:$n},[oe(O(m0),{class:"w-4 h-4"})]),m("div",aP,[m("button",{class:Ee(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",O(Wi)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Manage remotes",title:"Remotes",onClick:ge[12]||(ge[12]=ne=>Wi.value=!O(Wi))},[oe(O(Ku),{class:"w-4 h-4"})],2),O(Wi)?(y(),_("div",lP,[oe(ps,{remotes:O(i).remotes,onAdd:Xo,onEdit:nr,onDelete:Pn,onClose:ge[13]||(ge[13]=ne=>Wi.value=!1)},null,8,["remotes"])])):se("",!0)]),O(us)&&e.isActive?(y(),_("div",{key:0,class:Ee(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":O(i).isRefreshing}]),title:O(i).lastRefreshTime?`Last checked: ${new Date(O(i).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[m("span",{class:Ee(["inline-block w-1.5 h-1.5 rounded-full mr-1",O(i).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Ze(" "+I(O(us)),1)],10,cP)):se("",!0)]),m("div",{class:Ee(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":O(i).selectedCommit||O(i).isUncommittedChangesSelected}])},[oe(Wr,{ref_key:"commitListRef",ref:wn,commits:O(i).filteredCommits,stashes:O(i).stashes,selectedCommit:O(i).selectedCommit,hasMore:O(i).hasMore,loading:O(i).loading,loadingMore:O(i).loadingMore,searchQuery:O(i).searchQuery,uncommittedChangesCount:O(i).uncommittedChangesCount,isUncommittedChangesSelected:O(i).isUncommittedChangesSelected,highlightBranches:O(Ro),featureHighlightBranches:O(Eo),featureMergeBases:O(Io),previewHighlightBranches:O(Do),previewMergeBases:O(Lo),currentBranchName:O(i).currentBranch?.name,localBranchNames:O(i).localBranchNames,graphStyle:O(i).graphStyle,muteNonAncestral:O(i).muteNonAncestral,columnVisibility:O(i).columnVisibility,onSelect:O(i).selectCommit,onLoadMore:O(i).loadMoreCommits,onBranchContextMenu:O(Ne),onCommitContextMenu:O(pe),onTagContextMenu:O(yo),onStashContextMenu:O(Co),onCompareSelect:Wo,onSelectUncommittedChanges:O(i).selectUncommittedChanges,onScrollStart:O(s).startInteraction,onScrollEnd:O(s).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onBranchContextMenu","onCommitContextMenu","onTagContextMenu","onStashContextMenu","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),O(i).isComparing&&O(i).selectedCommit&&O(i).comparisonCommit?(y(),Se(Fs,{key:1,fromCommit:O(i).comparisonCommit,toCommit:O(i).selectedCommit,files:O(i).comparisonFiles,stats:O(i).comparisonStats,loading:O(i).comparisonLoading,onClose:O(i).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):O(i).selectedCommit?(y(),Se(Vo,{key:2,commit:O(i).selectedCommit,files:O(i).selectedCommitFiles,stats:O(i).selectedCommitStats,loading:O(i).isLoadingDetails,detailPosition:O(i).detailViewPosition,onClose:O(i).clearSelection,onNavigateToCommit:fs,onTogglePosition:O(i).toggleDetailViewPosition,onOpenFileDiff:ge[14]||(ge[14]=ne=>O(i).selectedCommit&&O(i).openFileDiff(O(i).selectedCommit.hash,ne))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):se("",!0),O(i).isUncommittedChangesSelected?(y(),Se(Vr,{key:3,stagedFiles:O(i).stagedFiles,unstagedFiles:O(i).unstagedFiles,isStaging:O(i).isStaging,isCommitting:O(i).isCommitting,onClose:O(i).clearSelection,onStageFiles:ge[15]||(ge[15]=ne=>O(i).stageFiles(ne)),onUnstageFiles:ge[16]||(ge[16]=ne=>O(i).unstageFiles(ne)),onStageAll:ge[17]||(ge[17]=()=>O(i).stageFiles([])),onUnstageAll:ge[18]||(ge[18]=()=>O(i).unstageFiles([])),onCommit:ge[19]||(ge[19]=ne=>O(i).commitChanges(ne))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):se("",!0)],64)),O(Le).visible?(y(),Se(Fr,{key:5,branchName:O(Le).branch,isCurrentBranch:O(Le).isCurrentBranch,isLocal:O(Le).isLocal,x:O(Le).x,y:O(Le).y,onClose:O(Je),onCheckout:O(st),onCreateBranch:O(xe),onDeleteBranch:O(B),onRename:O(Ue),onMerge:O(w),onRebase:O(L),onPush:O(P),onPull:O(Y),onFetch:O(de),onCopyName:O(X)},null,8,["branchName","isCurrentBranch","isLocal","x","y","onClose","onCheckout","onCreateBranch","onDeleteBranch","onRename","onMerge","onRebase","onPush","onPull","onFetch","onCopyName"])):se("",!0),O(F).visible&&O(F).commit?(y(),Se(C,{key:6,commit:O(F).commit,x:O(F).x,y:O(F).y,onClose:O(me),onAddTag:O(De),onCreateBranch:O(ct),onCheckout:O(Ct),onCherryPick:O(pt),onRevert:O(Zs),onMergeInto:O(vo),onReset:O(yn),onCopyHash:O(bo),onCopySubject:O(rr)},null,8,["commit","x","y","onClose","onAddTag","onCreateBranch","onCheckout","onCherryPick","onRevert","onMergeInto","onReset","onCopyHash","onCopySubject"])):se("",!0),O(pr).visible?(y(),Se(z,{key:7,tagName:O(pr).tag,x:O(pr).x,y:O(pr).y,onClose:O(_o),onViewDetails:O(hs),onDeleteTag:O(_n),onPushTag:O(xo),onCopyName:O(xn)},null,8,["tagName","x","y","onClose","onViewDetails","onDeleteTag","onPushTag","onCopyName"])):se("",!0),O(mr).visible&&O(mr).stash?(y(),Se(E,{key:8,stashIndex:O(mr).stash.index,stashMessage:O(mr).stash.message,x:O(mr).x,y:O(mr).y,onClose:O($o),onApply:O(Po),onPop:O(Qo),onDrop:O(To),onCreateBranch:O(Mo),onCopyName:O(Bo),onCopyHash:O(Ao)},null,8,["stashIndex","stashMessage","x","y","onClose","onApply","onPop","onDrop","onCreateBranch","onCopyName","onCopyHash"])):se("",!0),O(Xs).visible?(y(),Se(Z,{key:9,x:O(Xs).x,y:O(Xs).y,onClose:O(Sn),onStash:O(So),onReset:O(wo),onClean:O(ko)},null,8,["x","y","onClose","onStash","onReset","onClean"])):se("",!0),oe(Q$,{dialogs:O(n),store:O(i),remoteNames:O(No),copyFeedback:O(_e)},null,8,["dialogs","store","remoteNames","copyFeedback"])])}}}),dP=ns(uP,[["__scopeId","data-v-e2b31aba"]]),wm=Dx("/app-logo.svg"),fP={class:"flex items-start justify-between gap-2"},pP={class:"flex-1 min-w-0"},mP={class:"flex items-center gap-2"},gP={class:"font-mono text-sm text-retro-text truncate"},OP={class:"text-xs font-mono text-retro-muted mt-1 truncate"},vP={class:"flex items-center gap-1 flex-shrink-0"},bP={key:0,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-red",title:"Critical traceability gaps"},yP={key:1,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-yellow",title:"Major traceability gaps"},_P={key:2,class:"text-[10px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},xP={key:3,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},SP={key:4,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},wP={key:5,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},kP={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},CP={key:0,class:"flex items-center gap-1"},$P=["title","disabled","onClick"],PP=Xe({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean},criticalAlerts:{},majorAlerts:{}},emits:["select","cascade","openChat","skill"],setup(t,{emit:e}){const i={DocumentCheckIcon:bS,PuzzlePieceIcon:Om,DocumentMagnifyingGlassIcon:_S,WrenchScrewdriverIcon:BS,SparklesIcon:Ca,BeakerIcon:dS,ShieldCheckIcon:y0,CommandLineIcon:g0,CpuChipIcon:Ux,LightBulbIcon:PS},r=t,s=e,n=ur();function o(d){return i[d]||Om}function a(d){return d.prerequisites.every(p=>r.feature.files.some(f=>f.filename===p))}function l(d){return d.prerequisites.filter(p=>!r.feature.files.some(f=>f.filename===p))}function c(d){return a(d)?`${d.name} (Shift+click: new conversation)`:`Requires: ${l(d).join(", ")}`}const h=ae(()=>{const d=n.findConversationByFeature(r.feature.id);return d?n.isConversationStreaming(d.id):!1}),u=ae(()=>r.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(d,p)=>(y(),_("button",{type:"button",class:Ee(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",O(u)]),onClick:p[5]||(p[5]=f=>s("select",t.feature.id))},[m("div",fP,[m("div",pP,[m("div",mP,[oe(O(dn),{class:Ee(["h-4 w-4 flex-shrink-0 transition-colors duration-200",t.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),m("span",gP,I(t.feature.id),1)]),m("p",OP,I(t.feature.name),1)]),m("div",vP,[t.criticalAlerts>0?(y(),_("span",bP,[p[6]||(p[6]=m("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-red"},null,-1)),Ze(" "+I(t.criticalAlerts),1)])):se("",!0),t.majorAlerts>0?(y(),_("span",yP,[p[7]||(p[7]=m("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-yellow"},null,-1)),Ze(" "+I(t.majorAlerts),1)])):se("",!0),t.feature.hasTasks?(y(),_("span",_P,I(t.feature.completedTasks)+"/"+I(t.feature.totalTasks),1)):se("",!0),t.feature.hasSpec?(y(),_("span",xP)):se("",!0),t.feature.hasPlan?(y(),_("span",SP)):se("",!0),t.feature.hasTasks?(y(),_("span",wP)):se("",!0)])]),m("div",kP,[t.feature.hasSpec?(y(),_("div",CP,[m("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:p[0]||(p[0]=gi(f=>s("cascade",f,t.feature.id,"clarify"),["stop"]))},[oe(O(b0),{class:"h-3.5 w-3.5"})]),m("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:p[1]||(p[1]=gi(f=>s("cascade",f,t.feature.id,"plan"),["stop"]))},[oe(O(p0),{class:"h-3.5 w-3.5"})]),t.feature.hasPlan?(y(),_("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:p[2]||(p[2]=gi(f=>s("cascade",f,t.feature.id,"tasks"),["stop"]))},[oe(O(O0),{class:"h-3.5 w-3.5"})])):se("",!0),t.feature.hasTasks?(y(),_("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:p[3]||(p[3]=gi(f=>s("cascade",f,t.feature.id,"implement"),["stop"]))},[oe(O(TS),{class:"h-3.5 w-3.5"})])):se("",!0),t.skills.length>0?(y(),_($e,{key:2},[p[8]||(p[8]=m("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(y(!0),_($e,null,je(t.skills,f=>(y(),_("button",{key:f.id,type:"button",class:Ee(["flex items-center justify-center p-1 rounded transition-colors",[a(f)&&!O(h)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",O(h)?"animate-pulse":""]]),title:c(f),disabled:!a(f)||O(h),onClick:gi(g=>s("skill",g,t.feature.id,f.id),["stop"])},[(y(),Se(Ja(o(f.icon)),{class:"h-3.5 w-3.5"}))],10,$P))),128))],64)):se("",!0)])):se("",!0),t.feature.hasSpec?(y(),_("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:p[4]||(p[4]=gi(f=>s("openChat",f,t.feature.id),["stop"]))},[oe(O(mS),{class:"h-3.5 w-3.5"})])):se("",!0)])],2))}});let Ju=[],k0=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,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,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<t.length;e++)(e%2?k0:Ju).push(i=i+t[e])})();function QP(t){if(t<768)return!1;for(let e=0,i=Ju.length;;){let r=e+i>>1;if(t<Ju[r])i=r;else if(t>=k0[r])e=r+1;else return!0;if(e==i)return!1}}function km(t){return t>=127462&&t<=127487}const Cm=8205;function TP(t,e,i=!0,r=!0){return(i?C0:MP)(t,e,r)}function C0(t,e,i){if(e==t.length)return e;e&&$0(t.charCodeAt(e))&&P0(t.charCodeAt(e-1))&&e--;let r=Wh(t,e);for(e+=$m(r);e<t.length;){let s=Wh(t,e);if(r==Cm||s==Cm||i&&QP(s))e+=$m(s),r=s;else if(km(s)){let n=0,o=e-2;for(;o>=0&&km(Wh(t,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function MP(t,e,i){for(;e>0;){let r=C0(t,e-2,i);if(r<e)return r;e--}return 0}function Wh(t,e){let i=t.charCodeAt(e);if(!P0(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return $0(r)?(i-55296<<10)+(r-56320)+65536:i}function $0(t){return t>=56320&&t<57344}function P0(t){return t>=55296&&t<56320}function $m(t){return t<65536?1:2}let ot=class Q0{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,r){[e,i]=Kn(this,e,i);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(i,this.length,s,1),$r.from(s,this.length-(i-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Kn(this,e,i);let r=[];return this.decompose(e,i,r,0),$r.from(r,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Oa(this),n=new Oa(e);for(let o=i,a=i;;){if(s.next(o),n.next(o),o=0,s.lineBreak!=n.lineBreak||s.done!=n.done||s.value!=n.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(e=1){return new Oa(this,e)}iterRange(e,i=this.length){return new T0(this,e,i)}iterLines(e,i){let r;if(e==null)r=this.iter();else{i==null&&(i=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new M0(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Q0.empty:e.length<=32?new Tt(e):$r.from(Tt.split(e,[]))}};class Tt extends ot{constructor(e,i=BP(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,r,s){for(let n=0;;n++){let o=this.text[n],a=s+o.length;if((i?r:a)>=e)return new AP(s,a,r,o);s=a+1,r++}}decompose(e,i,r,s){let n=e<=0&&i>=this.length?this:new Tt(Pm(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=dc(n.text,o.text.slice(),0,n.length);if(a.length<=32)r.push(new Tt(a,o.length+n.length));else{let l=a.length>>1;r.push(new Tt(a.slice(0,l)),new Tt(a.slice(l)))}}else r.push(n)}replace(e,i,r){if(!(r instanceof Tt))return super.replace(e,i,r);[e,i]=Kn(this,e,i);let s=dc(this.text,dc(r.text,Pm(this.text,0,e)),i),n=this.length+r.length-(i-e);return s.length<=32?new Tt(s,n):$r.from(Tt.split(s,[]),n)}sliceString(e,i=this.length,r=`
|
|
11
|
-
`){[e,i]=Kn(this,e,i);let s="";for(let n=0,o=0;n<=i&&o<this.text.length;o++){let a=this.text[o],l=n+a.length;n>e&&o&&(s+=r),e<l&&i>n&&(s+=a.slice(Math.max(0,e-n),i-n)),n=l+1}return s}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let r=[],s=-1;for(let n of e)r.push(n),s+=n.length+1,r.length==32&&(i.push(new Tt(r,s)),r=[],s=-1);return s>-1&&i.push(new Tt(r,s)),i}}class $r extends ot{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,i,r,s){for(let n=0;;n++){let o=this.children[n],a=s+o.length,l=r+o.lines-1;if((i?l:a)>=e)return o.lineInner(e,i,r,s);s=a+1,r=l+1}}decompose(e,i,r,s){for(let n=0,o=0;o<=i&&n<this.children.length;n++){let a=this.children[n],l=o+a.length;if(e<=l&&i>=o){let c=s&((o<=e?1:0)|(l>=i?2:0));o>=e&&l<=i&&!c?r.push(a):a.decompose(e-o,i-o,r,c)}o=l+1}}replace(e,i,r){if([e,i]=Kn(this,e,i),r.lines<this.lines)for(let s=0,n=0;s<this.children.length;s++){let o=this.children[s],a=n+o.length;if(e>=n&&i<=a){let l=o.replace(e-n,i-n,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[s]=l,new $r(h,this.length-(i-e)+r.length)}return super.replace(n,a,l)}n=a+1}return super.replace(e,i,r)}sliceString(e,i=this.length,r=`
|
|
12
|
-
`){[e,i]=Kn(this,e,i);let s="";for(let n=0,o=0;n<this.children.length&&o<=i;n++){let a=this.children[n],l=o+a.length;o>e&&n&&(s+=r),e<l&&i>o&&(s+=a.sliceString(e-o,i-o,r)),o=l+1}return s}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof $r))return 0;let r=0,[s,n,o,a]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=i,n+=i){if(s==o||n==a)return r;let l=this.children[s],c=e.children[n];if(l!=c)return r+l.scanIdentical(c,i);r+=l.length+1}}static from(e,i=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let f of e)f.flatten(p);return new Tt(p,i)}let s=Math.max(32,r>>5),n=s<<1,o=s>>1,a=[],l=0,c=-1,h=[];function u(p){let f;if(p.lines>n&&p instanceof $r)for(let g of p.children)u(g);else p.lines>o&&(l>o||!l)?(d(),a.push(p)):p instanceof Tt&&l&&(f=h[h.length-1])instanceof Tt&&p.lines+f.lines<=32?(l+=p.lines,c+=p.length+1,h[h.length-1]=new Tt(f.text.concat(p.text),f.length+1+p.length)):(l+p.lines>s&&d(),l+=p.lines,c+=p.length+1,h.push(p))}function d(){l!=0&&(a.push(h.length==1?h[0]:$r.from(h,c)),c=-1,l=h.length=0)}for(let p of e)u(p);return d(),a.length==1?a[0]:new $r(a,i)}}ot.empty=new Tt([""],0);function BP(t){let e=-1;for(let i of t)e+=i.length+1;return e}function dc(t,e,i=0,r=1e9){for(let s=0,n=0,o=!0;n<t.length&&s<=r;n++){let a=t[n],l=s+a.length;l>=i&&(l>r&&(a=a.slice(0,r-s)),s<i&&(a=a.slice(i-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function Pm(t,e,i){return dc(t,[""],e,i)}class Oa{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof Tt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],n=this.offsets[r],o=n>>1,a=s instanceof Tt?s.text.length:s.children.length;if(o==(i>0?a:0)){if(r==0)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(i>0?0:1)){if(this.offsets[r]+=i,e==0)return this.lineBreak=!0,this.value=`
|
|
13
|
-
`,this;e--}else if(s instanceof Tt){let l=s.text[o+(i<0?-1:0)];if(this.offsets[r]+=i,l.length>Math.max(0,e))return this.value=e==0?l:i>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(i<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(i>0?1:(l instanceof Tt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class T0{constructor(e,i,r){this.value="",this.done=!1,this.cursor=new Oa(e,i>r?-1:1),this.pos=i>r?e.length:0,this.from=Math.min(i,r),this.to=Math.max(i,r)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let r=i<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*i,this.value=s.length<=r?s:i<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class M0{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:r,value:s}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ot.prototype[Symbol.iterator]=function(){return this.iter()},Oa.prototype[Symbol.iterator]=T0.prototype[Symbol.iterator]=M0.prototype[Symbol.iterator]=function(){return this});let AP=class{constructor(e,i,r,s){this.from=e,this.to=i,this.number=r,this.text=s}get length(){return this.to-this.from}};function Kn(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Ut(t,e,i=!0,r=!0){return TP(t,e,i,r)}function RP(t){return t>=56320&&t<57344}function EP(t){return t>=55296&&t<56320}function wi(t,e){let i=t.charCodeAt(e);if(!EP(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return RP(r)?(i-55296<<10)+(r-56320)+65536:i}function Hf(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Pr(t){return t<65536?1:2}const ed=/\r\n?|\n/;var ii=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(ii||(ii={}));class Dr{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let r=this.sections[i+1];e+=r<0?this.sections[i]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,r=0,s=0;i<this.sections.length;){let n=this.sections[i++],o=this.sections[i++];o<0?(e(r,s,n),s+=n):s+=o,r+=n}}iterChangedRanges(e,i=!1){td(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let r=this.sections[i++],s=this.sections[i++];s<0?e.push(r,s):e.push(s,r)}return new Dr(e)}composeDesc(e){return this.empty?e:e.empty?this:B0(this,e)}mapDesc(e,i=!1){return e.empty?this:id(this,e,i)}mapPos(e,i=-1,r=ii.Simple){let s=0,n=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>e)return n+(e-s);n+=a}else{if(r!=ii.Simple&&c>=e&&(r==ii.TrackDel&&s<e&&c>e||r==ii.TrackBefore&&s<e||r==ii.TrackAfter&&c>e))return null;if(c>e||c==e&&i<0&&!a)return e==s||i<0?n:n+l;n+=l}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return n}touchesRange(e,i=e){for(let r=0,s=0;r<this.sections.length&&s<=i;){let n=this.sections[r++],o=this.sections[r++],a=s+n;if(o>=0&&s<=i&&a>=e)return s<e&&a>i?"cover":!0;s=a}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let r=this.sections[i++],s=this.sections[i++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Dr(e)}static create(e){return new Dr(e)}}class Zt extends Dr{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return td(this,(i,r,s,n,o)=>e=e.replace(s,s+(r-i),o),!1),e}mapDesc(e,i=!1){return id(this,e,i,!0)}invert(e){let i=this.sections.slice(),r=[];for(let s=0,n=0;s<i.length;s+=2){let o=i[s],a=i[s+1];if(a>=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(ot.empty);r.push(o?e.slice(n,n+o):ot.empty)}n+=o}return new Zt(i,r)}compose(e){return this.empty?e:e.empty?this:B0(this,e,!0)}map(e,i=!1){return e.empty?this:id(this,e,i,!0)}iterChanges(e,i=!1){td(this,e,i)}get desc(){return Dr.create(this.sections)}filter(e){let i=[],r=[],s=[],n=new $a(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&n.len==0;){if(n.done)break e;let h=Math.min(n.len,l-a);hi(s,h,-1);let u=n.ins==-1?-1:n.off==0?n.ins:0;hi(i,h,u),u>0&&Cs(r,i,n.text),n.forward(h),a+=h}let c=e[o++];for(;a<c;){if(n.done)break e;let h=Math.min(n.len,c-a);hi(i,h,-1),hi(s,h,n.ins==-1?-1:n.off==0?n.ins:0),n.forward(h),a+=h}}return{changes:new Zt(i,r),filtered:Dr.create(s)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let r=this.sections[i],s=this.sections[i+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,r){let s=[],n=[],o=0,a=null;function l(h=!1){if(!h&&!s.length)return;o<i&&hi(s,i-o,-1);let u=new Zt(s,n);a=a?a.compose(u.map(a)):u,s=[],n=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof Zt){if(h.length!=i)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${i})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:d=u,insert:p}=h;if(u>d||u<0||d>i)throw new RangeError(`Invalid change range ${u} to ${d} (in doc of length ${i})`);let f=p?typeof p=="string"?ot.of(p.split(r||ed)):p:ot.empty,g=f.length;if(u==d&&g==0)return;u<o&&l(),u>o&&hi(s,u-o,-1),hi(s,d-u,g),Cs(n,s,f),o=d}}return c(e),l(!a),a}static empty(e){return new Zt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],r=[];for(let s=0;s<e.length;s++){let n=e[s];if(typeof n=="number")i.push(n,-1);else{if(!Array.isArray(n)||typeof n[0]!="number"||n.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(n.length==1)i.push(n[0],0);else{for(;r.length<s;)r.push(ot.empty);r[s]=ot.of(n.slice(1)),i.push(n[0],r[s].length)}}}return new Zt(i,r)}static createSet(e,i){return new Zt(e,i)}}function hi(t,e,i,r=!1){if(e==0&&i<=0)return;let s=t.length-2;s>=0&&i<=0&&i==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=i:r?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function Cs(t,e,i){if(i.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<r;)t.push(ot.empty);t.push(i)}}function td(t,e,i){let r=t.inserted;for(let s=0,n=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)s+=a,n+=a;else{let c=s,h=n,u=ot.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,c,n,h,u),s=c,n=h}}}function id(t,e,i,r=!1){let s=[],n=r?[]:null,o=new $a(t),a=new $a(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);hi(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!i))){let c=a.len;for(hi(s,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(hi(s,0,o.ins),n&&Cs(n,s,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;hi(s,c,l<o.i?o.ins:0),n&&l<o.i&&Cs(n,s,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return n?Zt.createSet(s,n):Dr.create(s);throw new Error("Mismatched change set lengths")}}}function B0(t,e,i=!1){let r=[],s=i?[]:null,n=new $a(t),o=new $a(e);for(let a=!1;;){if(n.done&&o.done)return s?Zt.createSet(r,s):Dr.create(r);if(n.ins==0)hi(r,n.len,0,a),n.next();else if(o.len==0&&!o.done)hi(r,0,o.ins,a),s&&Cs(s,r,o.text),o.next();else{if(n.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(n.len2,o.len),c=r.length;if(n.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;hi(r,l,h,a),s&&h&&Cs(s,r,o.text)}else o.ins==-1?(hi(r,n.off?0:n.len,l,a),s&&Cs(s,r,n.textBit(l))):(hi(r,n.off?0:n.len,o.off?0:o.ins,a),s&&!o.off&&Cs(s,r,o.text));a=(n.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),n.forward2(l),o.forward(l)}}}}class $a{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?ot.empty:e[i]}textBit(e){let{inserted:i}=this.set,r=this.i-2>>1;return r>=i.length&&!e?ot.empty:i[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class rn{constructor(e,i,r){this.from=e,this.to=i,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,i):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new rn(r,s,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return le.range(e,i);let r=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return le.range(this.anchor,r)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return le.range(e.anchor,e.head)}static create(e,i,r){return new rn(e,i,r)}}class le{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:le.create(this.ranges.map(r=>r.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new le([this.main],0)}addRange(e,i=!0){return le.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let r=this.ranges.slice();return r[i]=e,le.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new le(e.ranges.map(i=>rn.fromJSON(i)),e.main)}static single(e,i=e){return new le([le.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let n=e[s];if(n.empty?n.from<=r:n.from<r)return le.normalized(e.slice(),i);r=n.to}return new le(e,i)}static cursor(e,i=0,r,s){return rn.create(e,e,(i==0?0:i<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,i,r,s){let n=(r??16777215)<<6|(s==null?7:Math.min(6,s));return i<e?rn.create(i,e,48|n):rn.create(e,i,(i>e?8:0)|n)}static normalized(e,i=0){let r=e[i];e.sort((s,n)=>s.from-n.from),i=e.indexOf(r);for(let s=1;s<e.length;s++){let n=e[s],o=e[s-1];if(n.empty?n.from<=o.to:n.from<o.to){let a=o.from,l=Math.max(n.to,o.to);s<=i&&i--,e.splice(--s,2,n.anchor>n.head?le.range(l,a):le.range(a,l))}}return new le(e,i)}}function A0(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let qf=0;class Qe{constructor(e,i,r,s,n){this.combine=e,this.compareInput=i,this.compare=r,this.isStatic=s,this.id=qf++,this.default=e([]),this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new Qe(e.combine||(i=>i),e.compareInput||((i,r)=>i===r),e.compare||(e.combine?(i,r)=>i===r:Yf),!!e.static,e.enables)}of(e){return new fc([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new fc(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new fc(e,this,2,i)}from(e,i){return i||(i=r=>r),this.compute([e],r=>i(r.field(e)))}}function Yf(t,e){return t==e||t.length==e.length&&t.every((i,r)=>i===e[r])}class fc{constructor(e,i,r,s){this.dependencies=e,this.facet=i,this.type=r,this.value=s,this.id=qf++}dynamicSlot(e){var i;let r=this.value,s=this.facet.compareInput,n=this.id,o=e[n]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:(((i=e[u.id])!==null&&i!==void 0?i:1)&1)==0&&h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||rd(u,h)){let p=r(u);if(a?!Qm(p,u.values[o],s):!s(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,d)=>{let p,f=d.config.address[n];if(f!=null){let g=Rc(d,f);if(this.dependencies.every(v=>v instanceof Qe?d.facet(v)===u.facet(v):v instanceof Kt?d.field(v,!1)==u.field(v,!1):!0)||(a?Qm(p=r(u),g,s):s(p=r(u),g)))return u.values[o]=g,0}else p=r(u);return u.values[o]=p,1}}}}function Qm(t,e,i){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!i(t[r],e[r]))return!1;return!0}function rd(t,e){let i=!1;for(let r of e)va(t,r)&1&&(i=!0);return i}function DP(t,e,i){let r=i.map(l=>t[l.id]),s=i.map(l=>l.type),n=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=Rc(l,r[h]);if(s[h]==2)for(let d of u)c.push(d);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)va(l,c);return l.values[o]=a(l),1},update(l,c){if(!rd(l,n))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=rd(l,r),u=c.config.facets[e.id],d=c.facet(e);if(u&&!h&&Yf(i,u))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const Ql=Qe.define({static:!0});class Kt{constructor(e,i,r,s,n){this.id=e,this.createF=i,this.updateF=r,this.compareF=s,this.spec=n,this.provides=void 0}static define(e){let i=new Kt(qf++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(Ql).find(r=>r.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:r=>(r.values[i]=this.create(r),1),update:(r,s)=>{let n=r.values[i],o=this.updateF(n,s);return this.compareF(n,o)?0:(r.values[i]=o,1)},reconfigure:(r,s)=>{let n=r.facet(Ql),o=s.facet(Ql),a;return(a=n.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[i]=a.create(r),1):s.config.address[this.id]!=null?(r.values[i]=s.field(this),0):(r.values[i]=this.create(r),1)}}}init(e){return[this,Ql.of({field:this,create:e})]}get extension(){return this}}const Js={lowest:4,low:3,default:2,high:1,highest:0};function Fo(t){return e=>new R0(e,t)}const os={highest:Fo(Js.highest),high:Fo(Js.high),default:Fo(Js.default),low:Fo(Js.low),lowest:Fo(Js.lowest)};class R0{constructor(e,i){this.inner=e,this.prec=i}}class wh{of(e){return new sd(this,e)}reconfigure(e){return wh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class sd{constructor(e,i){this.compartment=e,this.inner=i}}class Ac{constructor(e,i,r,s,n,o){for(this.base=e,this.compartments=i,this.dynamicSlots=r,this.address=s,this.staticValues=n,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,r){let s=[],n=Object.create(null),o=new Map;for(let d of LP(e,i,o))d instanceof Kt?s.push(d):(n[d.facet.id]||(n[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of s)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let h=r?.config.facets;for(let d in n){let p=n[d],f=p[0].facet,g=h&&h[d]||[];if(p.every(v=>v.type==0))if(a[f.id]=l.length<<1|1,Yf(g,p))l.push(r.facet(f));else{let v=f.combine(p.map(b=>b.value));l.push(r&&f.compare(v,r.facet(f))?r.facet(f):v)}else{for(let v of p)v.type==0?(a[v.id]=l.length<<1|1,l.push(v.value)):(a[v.id]=c.length<<1,c.push(b=>v.dynamicSlot(b)));a[f.id]=c.length<<1,c.push(v=>DP(v,f,p))}}let u=c.map(d=>d(a));return new Ac(e,o,u,a,l,n)}}function LP(t,e,i){let r=[[],[],[],[],[]],s=new Map;function n(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof sd&&i.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)n(c,a);else if(o instanceof sd){if(i.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;i.set(o.compartment,c),n(c,a)}else if(o instanceof R0)n(o.inner,o.prec);else if(o instanceof Kt)r[a].push(o),o.provides&&n(o.provides,a);else if(o instanceof fc)r[a].push(o),o.facet.extensions&&n(o.facet.extensions,Js.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(c,a)}}return n(t,Js.default),r.reduce((o,a)=>o.concat(a))}function va(t,e){if(e&1)return 2;let i=e>>1,r=t.status[i];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function Rc(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const E0=Qe.define(),nd=Qe.define({combine:t=>t.some(e=>e),static:!0}),D0=Qe.define({combine:t=>t.length?t[0]:void 0,static:!0}),L0=Qe.define(),I0=Qe.define(),N0=Qe.define(),z0=Qe.define({combine:t=>t.length?t[0]:!1});class as{constructor(e,i){this.type=e,this.value=i}static define(){return new IP}}class IP{of(e){return new as(this,e)}}class NP{constructor(e){this.map=e}of(e){return new Ve(this,e)}}class Ve{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new Ve(this.type,i)}is(e){return this.type==e}static define(e={}){return new NP(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let r=[];for(let s of e){let n=s.map(i);n&&r.push(n)}return r}}Ve.reconfigure=Ve.define();Ve.appendConfig=Ve.define();class Dt{constructor(e,i,r,s,n,o){this.startState=e,this.changes=i,this.selection=r,this.effects=s,this.annotations=n,this.scrollIntoView=o,this._doc=null,this._state=null,r&&A0(r,i.newLength),n.some(a=>a.type==Dt.time)||(this.annotations=n.concat(Dt.time.of(Date.now())))}static create(e,i,r,s,n,o){return new Dt(e,i,r,s,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(Dt.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}Dt.time=as.define();Dt.userEvent=as.define();Dt.addToHistory=as.define();Dt.remote=as.define();function zP(t,e){let i=[];for(let r=0,s=0;;){let n,o;if(r<t.length&&(s==e.length||e[s]>=t[r]))n=t[r++],o=t[r++];else if(s<e.length)n=e[s++],o=e[s++];else return i;!i.length||i[i.length-1]<n?i.push(n,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function Z0(t,e,i){var r;let s,n,o;return i?(s=e.changes,n=Zt.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),n=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(n):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:Ve.mapEffects(t.effects,s).concat(Ve.mapEffects(e.effects,n)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function od(t,e,i){let r=e.selection,s=Xn(e.annotations);return e.userEvent&&(s=s.concat(Dt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Zt?e.changes:Zt.of(e.changes||[],i,t.facet(D0)),selection:r&&(r instanceof le?r:le.single(r.anchor,r.head)),effects:Xn(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function X0(t,e,i){let r=od(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let n=1;n<e.length;n++){e[n].filter===!1&&(i=!1);let o=!!e[n].sequential;r=Z0(r,od(t,e[n],o?r.changes.newLength:t.doc.length),o)}let s=Dt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return XP(i?ZP(s):s)}function ZP(t){let e=t.startState,i=!0;for(let s of e.facet(L0)){let n=s(t);if(n===!1){i=!1;break}Array.isArray(n)&&(i=i===!0?n:zP(i,n))}if(i!==!0){let s,n;if(i===!1)n=t.changes.invertedDesc,s=Zt.empty(e.doc.length);else{let o=t.changes.filter(i);s=o.changes,n=o.filtered.mapDesc(o.changes).invertedDesc}t=Dt.create(e,s,t.selection&&t.selection.map(n),Ve.mapEffects(t.effects,n),t.annotations,t.scrollIntoView)}let r=e.facet(I0);for(let s=r.length-1;s>=0;s--){let n=r[s](t);n instanceof Dt?t=n:Array.isArray(n)&&n.length==1&&n[0]instanceof Dt?t=n[0]:t=X0(e,Xn(n),!1)}return t}function XP(t){let e=t.startState,i=e.facet(N0),r=t;for(let s=i.length-1;s>=0;s--){let n=i[s](t);n&&Object.keys(n).length&&(r=Z0(r,od(e,n,t.changes.newLength),!0))}return r==t?t:Dt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const WP=[];function Xn(t){return t==null?WP:Array.isArray(t)?t:[t]}var _t=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(_t||(_t={}));const VP=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ad;try{ad=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function FP(t){if(ad)return ad.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>""&&(i.toUpperCase()!=i.toLowerCase()||VP.test(i)))return!0}return!1}function HP(t){return e=>{if(!/\S/.test(e))return _t.Space;if(FP(e))return _t.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return _t.Word;return _t.Other}}class tt{constructor(e,i,r,s,n,o){this.config=e,this.doc=i,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=n,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)va(this,a<<1);this.computeSlot=null}field(e,i=!0){let r=this.config.address[e.id];if(r==null){if(i)throw new RangeError("Field is not present in this state");return}return va(this,r),Rc(this,r)}update(...e){return X0(this,e,!0)}applyTransaction(e){let i=this.config,{base:r,compartments:s}=i;for(let a of e.effects)a.is(wh.reconfigure)?(i&&(s=new Map,i.compartments.forEach((l,c)=>s.set(c,l)),i=null),s.set(a.value.compartment,a.value.extension)):a.is(Ve.reconfigure)?(i=null,r=a.value):a.is(Ve.appendConfig)&&(i=null,r=Xn(r).concat(a.value));let n;i?n=e.startState.values.slice():(i=Ac.resolve(r,s,this),n=new tt(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(nd)?e.newSelection:e.newSelection.asSingle();new tt(i,e.newDoc,o,n,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:le.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,r=e(i.ranges[0]),s=this.changes(r.changes),n=[r.range],o=Xn(r.effects);for(let a=1;a<i.ranges.length;a++){let l=e(i.ranges[a]),c=this.changes(l.changes),h=c.map(s);for(let d=0;d<a;d++)n[d]=n[d].map(h);let u=s.mapDesc(c,!0);n.push(l.range.map(u)),s=s.compose(h),o=Ve.mapEffects(o,h).concat(Ve.mapEffects(Xn(l.effects),u))}return{changes:s,selection:le.create(n,i.mainIndex),effects:o}}changes(e=[]){return e instanceof Zt?e:Zt.of(e,this.doc.length,this.facet(tt.lineSeparator))}toText(e){return ot.of(e.split(this.facet(tt.lineSeparator)||ed))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(va(this,i),Rc(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof Kt&&this.config.address[s.id]!=null&&(i[r]=s.spec.toJSON(this.field(e[r]),this))}return i}static fromJSON(e,i={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let n in r)if(Object.prototype.hasOwnProperty.call(e,n)){let o=r[n],a=e[n];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return tt.create({doc:e.doc,selection:le.fromJSON(e.selection),extensions:i.extensions?s.concat([i.extensions]):s})}static create(e={}){let i=Ac.resolve(e.extensions||[],new Map),r=e.doc instanceof ot?e.doc:ot.of((e.doc||"").split(i.staticFacet(tt.lineSeparator)||ed)),s=e.selection?e.selection instanceof le?e.selection:le.single(e.selection.anchor,e.selection.head):le.single(0);return A0(s,r.length),i.staticFacet(nd)||(s=s.asSingle()),new tt(i,r,s,i.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(tt.tabSize)}get lineBreak(){return this.facet(tt.lineSeparator)||`
|
|
14
|
-
`}get readOnly(){return this.facet(z0)}phrase(e,...i){for(let r of this.facet(tt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let n=+(s||1);return!n||n>i.length?r:i[n-1]})),e}languageDataAt(e,i,r=-1){let s=[];for(let n of this.facet(E0))for(let o of n(this,i,r))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return HP(i.length?i[0]:"")}wordAt(e){let{text:i,from:r,length:s}=this.doc.lineAt(e),n=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ut(i,o,!1);if(n(i.slice(l,o))!=_t.Word)break;o=l}for(;a<s;){let l=Ut(i,a);if(n(i.slice(a,l))!=_t.Word)break;a=l}return o==a?null:le.range(o+r,a+r)}}tt.allowMultipleSelections=nd;tt.tabSize=Qe.define({combine:t=>t.length?t[0]:4});tt.lineSeparator=D0;tt.readOnly=z0;tt.phrases=Qe.define({compare(t,e){let i=Object.keys(t),r=Object.keys(e);return i.length==r.length&&i.every(s=>t[s]==e[s])}});tt.languageData=E0;tt.changeFilter=L0;tt.transactionFilter=I0;tt.transactionExtender=N0;wh.reconfigure=Ve.define();function Zr(t,e,i={}){let r={};for(let s of t)for(let n of Object.keys(s)){let o=s[n],a=r[n];if(a===void 0)r[n]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(i,n))r[n]=i[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class As{eq(e){return this==e}range(e,i=e){return ld.create(e,i,this)}}As.prototype.startSide=As.prototype.endSide=0;As.prototype.point=!1;As.prototype.mapMode=ii.TrackDel;function jf(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let ld=class W0{constructor(e,i,r){this.from=e,this.to=i,this.value=r}static create(e,i,r){return new W0(e,i,r)}};function cd(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Uf{constructor(e,i,r,s){this.from=e,this.to=i,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,i,r,s=0){let n=r?this.to:this.from;for(let o=s,a=n.length;;){if(o==a)return o;let l=o+a>>1,c=n[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-i;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,i,r,s){for(let n=this.findIndex(i,-1e9,!0),o=this.findIndex(r,1e9,!1,n);n<o;n++)if(s(this.from[n]+e,this.to[n]+e,this.value[n])===!1)return!1}map(e,i){let r=[],s=[],n=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,d,p;if(h==u){let f=i.mapPos(h,c.startSide,c.mapMode);if(f==null||(d=p=f,c.startSide!=c.endSide&&(p=i.mapPos(h,c.endSide),p<d)))continue}else if(d=i.mapPos(h,c.startSide),p=i.mapPos(u,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),r.push(c),s.push(d-o),n.push(p-o))}return{mapped:r.length?new Uf(s,n,r,a):null,pos:o}}}class et{constructor(e,i,r,s){this.chunkPos=e,this.chunk=i,this.nextLayer=r,this.maxPoint=s}static create(e,i,r,s){return new et(e,i,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:r=!1,filterFrom:s=0,filterTo:n=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(r&&(i=i.slice().sort(cd)),this.isEmpty)return i.length?et.of(i):this;let a=new V0(this,null,-1).goto(0),l=0,c=[],h=new is;for(;a.value||l<i.length;)if(l<i.length&&(a.from-i[l].from||a.startSide-i[l].value.startSide)>=0){let u=i[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==i.length||this.chunkEnd(a.chunkIndex)<i[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||n<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||n<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push(ld.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?et.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:n}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)s=Math.max(s,l.maxPoint),i.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(s=Math.max(s,h.maxPoint),i.push(h),r.push(u))}}let n=this.nextLayer.map(e);return i.length==0?n:new et(r,i,n||et.empty,s)}between(e,i,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let n=this.chunkPos[s],o=this.chunk[s];if(i>=n&&e<=n+o.length&&o.between(n,e-n,i-n,r)===!1)return}this.nextLayer.between(e,i,r)}}iter(e=0){return Pa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return Pa.from(e).goto(i)}static compare(e,i,r,s,n=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=n),a=i.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=n),l=Tm(o,a,r),c=new Ho(o,l,n),h=new Ho(a,l,n);r.iterGaps((u,d,p)=>Mm(c,u,h,d,p,s)),r.empty&&r.length==0&&Mm(c,0,h,0,0,s)}static eq(e,i,r=0,s){s==null&&(s=999999999);let n=e.filter(h=>!h.isEmpty&&i.indexOf(h)<0),o=i.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(n.length!=o.length)return!1;if(!n.length)return!0;let a=Tm(n,o),l=new Ho(n,a,0).goto(r),c=new Ho(o,a,0).goto(r);for(;;){if(l.to!=c.to||!hd(l.active,c.active)||l.point&&(!c.point||!jf(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(e,i,r,s,n=-1){let o=new Ho(e,null,n).goto(i),a=i,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<i?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);s.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,i=!1){let r=new is;for(let s of e instanceof ld?[e]:i?qP(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return et.empty;let i=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=et.empty;s=s.nextLayer)i=new et(s.chunkPos,s.chunk,i,Math.max(s.maxPoint,i.maxPoint));return i}}et.empty=new et([],[],null,-1);function qP(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let r=t[i];if(cd(e,r)>0)return t.slice().sort(cd);e=r}return t}et.empty.nextLayer=et.empty;class is{finishChunk(e){this.chunks.push(new Uf(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,r){this.addInner(e,i,r)||(this.nextLayer||(this.nextLayer=new is)).add(e,i,r)}addInner(e,i,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=i,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let r=i.value.length-1;return this.last=i.value[r],this.lastFrom=i.from[r]+e,this.lastTo=i.to[r]+e,!0}finish(){return this.finishInner(et.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=et.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function Tm(t,e,i){let r=new Map;for(let n of t)for(let o=0;o<n.chunk.length;o++)n.chunk[o].maxPoint<=0&&r.set(n.chunk[o],n.chunkPos[o]);let s=new Set;for(let n of e)for(let o=0;o<n.chunk.length;o++){let a=r.get(n.chunk[o]);a!=null&&(i?i.mapPos(a):a)==n.chunkPos[o]&&!i?.touchesRange(a,a+n.chunk[o].length)&&s.add(n.chunk[o])}return s}class V0{constructor(e,i,r,s=0){this.layer=e,this.skip=i,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],i=this.layer.chunk[this.chunkIndex],r=e+i.from[this.rangeIndex];if(this.from=r,this.to=e+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Pa{constructor(e){this.heap=e}static from(e,i=null,r=-1){let s=[];for(let n=0;n<e.length;n++)for(let o=e[n];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new V0(o,i,r,n));return s.length==1?s[0]:new Pa(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let r of this.heap)r.goto(e,i);for(let r=this.heap.length>>1;r>=0;r--)Vh(this.heap,r);return this.next(),this}forward(e,i){for(let r of this.heap)r.forward(e,i);for(let r=this.heap.length>>1;r>=0;r--)Vh(this.heap,r);(this.to-e||this.value.endSide-i)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Vh(this.heap,0)}}}function Vh(t,e){for(let i=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),i.compare(s)<0)break;t[r]=i,t[e]=s,e=r}}class Ho{constructor(e,i,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Pa.from(e,i,r)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){Tl(this.active,e),Tl(this.activeTo,e),Tl(this.activeRank,e),this.minActive=Bm(this.active,this.activeTo)}addActive(e){let i=0,{value:r,to:s,rank:n}=this.cursor;for(;i<this.activeRank.length&&(n-this.activeRank[i]||s-this.activeTo[i])>0;)i++;Ml(this.active,i,r),Ml(this.activeTo,i,s),Ml(this.activeRank,i,n),e&&Ml(e,i,this.cursor.from),this.minActive=Bm(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Tl(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let n=this.cursor.value;if(!n.point)this.addActive(r),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=n,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=n.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&i.push(this.active[r]);return i.reverse()}openEnd(e){let i=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)i++;return i}}function Mm(t,e,i,r,s,n){t.goto(e),i.goto(r);let o=r+s,a=r,l=r-e,c=!!n.boundChange;for(let h=!1;;){let u=t.to+l-i.to,d=u||t.endSide-i.endSide,p=d<0?t.to+l:i.to,f=Math.min(p,o);if(t.point||i.point?(t.point&&i.point&&jf(t.point,i.point)&&hd(t.activeForPoint(t.to),i.activeForPoint(i.to))||n.comparePoint(a,f,t.point,i.point),h=!1):(h&&n.boundChange(a),f>a&&!hd(t.active,i.active)&&n.compareRange(a,f,t.active,i.active),c&&f<o&&(u||t.openEnd(p)!=i.openEnd(p))&&(h=!0)),p>o)break;a=p,d<=0&&t.next(),d>=0&&i.next()}}function hd(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!jf(t[i],e[i]))return!1;return!0}function Tl(t,e){for(let i=e,r=t.length-1;i<r;i++)t[i]=t[i+1];t.pop()}function Ml(t,e,i){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=i}function Bm(t,e){let i=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[i].endSide)<0&&(i=s,r=e[s]);return i}function cr(t,e,i=t.length){let r=0;for(let s=0;s<i&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=Ut(t,s));return r}function ud(t,e,i,r){for(let s=0,n=0;;){if(n>=e)return s;if(s==t.length)break;n+=t.charCodeAt(s)==9?i-n%i:1,s=Ut(t,s)}return r===!0?-1:t.length}const dd="ͼ",Am=typeof Symbol>"u"?"__"+dd:Symbol.for(dd),fd=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Rm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Rs{constructor(e,i){this.rules=[];let{finish:r}=i||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function n(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),d=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let p in a){let f=a[p];if(/&/.test(p))n(p.split(/,\s*/).map(g=>o.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),f,l);else if(f&&typeof f=="object"){if(!u)throw new RangeError("The value of a property ("+p+") should be a primitive value.");n(s(p),f,h,d)}else f!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+f+";")}(h.length||d)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)n(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
15
|
-
`)}static newName(){let e=Rm[Am]||1;return Rm[Am]=e+1,dd+e.toString(36)}static mount(e,i,r){let s=e[fd],n=r&&r.nonce;s?n&&s.setNonce(n):s=new YP(e,n),s.mount(Array.isArray(i)?i:[i],e)}}let Em=new Map;class YP{constructor(e,i){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let n=Em.get(r);if(n)return e[fd]=n;this.sheet=new s.CSSStyleSheet,Em.set(r,this)}else this.styleTag=r.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[fd]=this}mount(e,i){let r=this.sheet,s=0,n=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<n&&l>-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],s++)}else{for(;n<l;)s+=this.modules[n++].rules.length;s+=a.rules.length,n++}}if(r)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
16
|
-
`;this.styleTag.textContent=o;let a=i.head||i;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Es={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Qa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jP=typeof navigator<"u"&&/Mac/.test(navigator.platform),UP=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ti=0;ti<10;ti++)Es[48+ti]=Es[96+ti]=String(ti);for(var ti=1;ti<=24;ti++)Es[ti+111]="F"+ti;for(var ti=65;ti<=90;ti++)Es[ti]=String.fromCharCode(ti+32),Qa[ti]=String.fromCharCode(ti);for(var Fh in Es)Qa.hasOwnProperty(Fh)||(Qa[Fh]=Es[Fh]);function GP(t){var e=jP&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||UP&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?Qa:Es)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function dt(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var s=i[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e<arguments.length;e++)F0(t,arguments[e]);return t}function F0(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)F0(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}let mi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},pd=typeof document<"u"?document:{documentElement:{style:{}}};const md=/Edge\/(\d+)/.exec(mi.userAgent),H0=/MSIE \d/.test(mi.userAgent),gd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mi.userAgent),kh=!!(H0||gd||md),Dm=!kh&&/gecko\/(\d+)/i.test(mi.userAgent),Hh=!kh&&/Chrome\/(\d+)/.exec(mi.userAgent),KP="webkitFontSmoothing"in pd.documentElement.style,Od=!kh&&/Apple Computer/.test(mi.vendor),Lm=Od&&(/Mobile\/\w+/.test(mi.userAgent)||mi.maxTouchPoints>2);var Te={mac:Lm||/Mac/.test(mi.platform),windows:/Win/.test(mi.platform),linux:/Linux|X11/.test(mi.platform),ie:kh,ie_version:H0?pd.documentMode||6:gd?+gd[1]:md?+md[1]:0,gecko:Dm,gecko_version:Dm?+(/Firefox\/(\d+)/.exec(mi.userAgent)||[0,0])[1]:0,chrome:!!Hh,chrome_version:Hh?+Hh[1]:0,ios:Lm,android:/Android\b/.test(mi.userAgent),webkit_version:KP?+(/\bAppleWebKit\/(\d+)/.exec(mi.userAgent)||[0,0])[1]:0,safari:Od,safari_version:Od?+(/\bVersion\/(\d+(\.\d+)?)/.exec(mi.userAgent)||[0,0])[1]:0,tabSize:pd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Gf(t,e){for(let i in t)i=="class"&&e.class?e.class+=" "+t.class:i=="style"&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}const Ec=Object.create(null);function Kf(t,e,i){if(t==e)return!0;t||(t=Ec),e||(e=Ec);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let n of r)if(n!=i&&(s.indexOf(n)==-1||t[n]!==e[n]))return!1;return!0}function JP(t,e){for(let i=t.attributes.length-1;i>=0;i--){let r=t.attributes[i].name;e[r]==null&&t.removeAttribute(r)}for(let i in e){let r=e[i];i=="style"?t.style.cssText=r:t.getAttribute(i)!=r&&t.setAttribute(i,r)}}function Im(t,e,i){let r=!1;if(e)for(let s in e)i&&s in i||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(r=!0,s=="style"?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return r}function eQ(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let r=t.attributes[i];e[r.name]=r.value}return e}class Xr{eq(e){return!1}updateDOM(e,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,i,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var oi=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(oi||(oi={}));class Ie extends As{constructor(e,i,r,s){super(),this.startSide=e,this.endSide=i,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new rl(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return i+=r&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new fn(e,i,i,r,e.widget||null,!1)}static replace(e){let i=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:n,end:o}=q0(e,i);r=(n?i?-3e8:-1:5e8)-1,s=(o?i?2e8:1:-6e8)+1}return new fn(e,r,s,i,e.widget||null,!0)}static line(e){return new sl(e)}static set(e,i=!1){return et.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ie.none=et.empty;class rl extends Ie{constructor(e){let{start:i,end:r}=q0(e);super(i?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Gf(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ec}eq(e){return this==e||e instanceof rl&&this.tagName==e.tagName&&Kf(this.attrs,e.attrs)}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}rl.prototype.point=!1;class sl extends Ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof sl&&this.spec.class==e.spec.class&&Kf(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}sl.prototype.mapMode=ii.TrackBefore;sl.prototype.point=!0;class fn extends Ie{constructor(e,i,r,s,n,o){super(i,r,n,e),this.block=s,this.isReplace=o,this.mapMode=s?i<=0?ii.TrackBefore:ii.TrackAfter:ii.TrackDel}get type(){return this.startSide!=this.endSide?oi.WidgetRange:this.startSide<=0?oi.WidgetBefore:oi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof fn&&tQ(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}fn.prototype.point=!0;function q0(t,e=!1){let{inclusiveStart:i,inclusiveEnd:r}=t;return i==null&&(i=t.inclusive),r==null&&(r=t.inclusive),{start:i??e,end:r??e}}function tQ(t,e){return t==e||!!(t&&e&&t.compare(e))}function Wn(t,e,i,r=0){let s=i.length-1;s>=0&&i[s]+r>=t?i[s]=Math.max(i[s],e):i.push(t,e)}class Ta extends As{constructor(e,i){super(),this.tagName=e,this.attributes=i}eq(e){return e==this||e instanceof Ta&&this.tagName==e.tagName&&Kf(this.attributes,e.attributes)}static create(e){return new Ta(e.tagName,e.attributes||Ec)}static set(e,i=!1){return et.of(e,i)}}Ta.prototype.startSide=Ta.prototype.endSide=-1;function Ma(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function vd(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function ba(t,e){if(!e.anchorNode)return!1;try{return vd(t,e.anchorNode)}catch{return!1}}function pc(t){return t.nodeType==3?Ba(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ya(t,e,i,r){return i?Nm(t,e,i,r,-1)||Nm(t,e,i,r,1):!1}function Ds(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Dc(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Nm(t,e,i,r,s){for(;;){if(t==i&&e==r)return!0;if(e==(s<0?0:rs(t))){if(t.nodeName=="DIV")return!1;let n=t.parentNode;if(!n||n.nodeType!=1)return!1;e=Ds(t)+(s<0?0:1),t=n}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?rs(t):0}else return!1}}function rs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Lc(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function iQ(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Y0(t,e){let i=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:i,scaleY:r}}function rQ(t,e,i,r,s,n,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let h=t,u=!1;h&&!u;)if(h.nodeType==1){let d,p=h==l.body,f=1,g=1;if(p)d=iQ(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let S=h.getBoundingClientRect();({scaleX:f,scaleY:g}=Y0(h,S)),d={left:S.left,right:S.left+h.clientWidth*f,top:S.top,bottom:S.top+h.clientHeight*g}}let v=0,b=0;if(s=="nearest")e.top<d.top?(b=e.top-(d.top+o),i>0&&e.bottom>d.bottom+b&&(b=e.bottom-d.bottom+o)):e.bottom>d.bottom&&(b=e.bottom-d.bottom+o,i<0&&e.top-b<d.top&&(b=e.top-(d.top+o)));else{let S=e.bottom-e.top,k=d.bottom-d.top;b=(s=="center"&&S<=k?e.top+S/2-k/2:s=="start"||s=="center"&&i<0?e.top-o:e.bottom-k+o)-d.top}if(r=="nearest"?e.left<d.left?(v=e.left-(d.left+n),i>0&&e.right>d.right+v&&(v=e.right-d.right+n)):e.right>d.right&&(v=e.right-d.right+n,i<0&&e.left<d.left+v&&(v=e.left-(d.left+n))):v=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==a?e.left-n:e.right-(d.right-d.left)+n)-d.left,v||b)if(p)c.scrollBy(v,b);else{let S=0,k=0;if(b){let T=h.scrollTop;h.scrollTop+=b/g,k=(h.scrollTop-T)*g}if(v){let T=h.scrollLeft;h.scrollLeft+=v/f,S=(h.scrollLeft-T)*f}e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k},S&&Math.abs(S-v)<1&&(r="nearest"),k&&Math.abs(k-b)<1&&(s="nearest")}if(p)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function sQ(t){let e=t.ownerDocument,i,r;for(let s=t.parentNode;s&&!(s==e.body||i&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}class nQ{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:i,focusNode:r}=e;this.set(i,Math.min(e.anchorOffset,i?rs(i):0),r,Math.min(e.focusOffset,r?rs(r):0))}set(e,i,r,s){this.anchorNode=e,this.anchorOffset=i,this.focusNode=r,this.focusOffset=s}}let Us=null;Te.safari&&Te.safari_version>=26&&(Us=!1);function j0(t){if(t.setActive)return t.setActive();if(Us)return t.focus(Us);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(Us==null?{get preventScroll(){return Us={preventScroll:!0},!0}}:void 0),!Us){Us=!1;for(let i=0;i<e.length;){let r=e[i++],s=e[i++],n=e[i++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=n&&(r.scrollLeft=n)}}}let zm;function Ba(t,e,i=e){let r=zm||(zm=document.createRange());return r.setEnd(t,i),r.setStart(t,e),r}function Vn(t,e,i,r){let s={key:e,code:e,keyCode:i,which:i,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let n=new KeyboardEvent("keydown",s);n.synthetic=!0,t.dispatchEvent(n);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,t.dispatchEvent(o),n.defaultPrevented||o.defaultPrevented}function oQ(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function aQ(t,e){let i=e.focusNode,r=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=r)return!1;for(r=Math.min(r,rs(i));;)if(r){if(i.nodeType!=1)return!1;let s=i.childNodes[r-1];s.contentEditable=="false"?r--:(i=s,r=rs(i))}else{if(i==t)return!0;r=Ds(i),i=i.parentNode}}function U0(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function G0(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&r>0)return{node:i,offset:r};if(i.nodeType==1&&r>0){if(i.contentEditable=="false")return null;i=i.childNodes[r-1],r=rs(i)}else if(i.parentNode&&!Dc(i))r=Ds(i),i=i.parentNode;else return null}}function K0(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&r<i.nodeValue.length)return{node:i,offset:r};if(i.nodeType==1&&r<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[r],r=0}else if(i.parentNode&&!Dc(i))r=Ds(i)+1,i=i.parentNode;else return null}}class lr{constructor(e,i,r=!0){this.node=e,this.offset=i,this.precise=r}static before(e,i){return new lr(e.parentNode,Ds(e),i)}static after(e,i){return new lr(e.parentNode,Ds(e)+1,i)}}var gt=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(gt||(gt={}));const pn=gt.LTR,Jf=gt.RTL;function J0(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const lQ=J0("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),cQ=J0("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),bd=Object.create(null),yr=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);bd[e]=i,bd[i]=-e}function e1(t){return t<=247?lQ[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?cQ[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const hQ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Tr{get dir(){return this.level%2?Jf:pn}constructor(e,i,r){this.from=e,this.to=i,this.level=r}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,r,s){let n=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=i&&a.to>=i){if(a.level==r)return o;(n<0||(s!=0?s<0?a.from<i:a.to>i:e[n].level>a.level))&&(n=o)}}if(n<0)throw new RangeError("Index out of range");return n}}function t1(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let r=t[i],s=e[i];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!t1(r.inner,s.inner))return!1}return!0}const mt=[];function uQ(t,e,i,r,s){for(let n=0;n<=r.length;n++){let o=n?r[n-1].to:e,a=n<r.length?r[n].from:i,l=n?256:s;for(let c=o,h=l,u=l;c<a;c++){let d=e1(t.charCodeAt(c));d==512?d=h:d==8&&u==4&&(d=16),mt[c]=d==4?2:d,d&7&&(u=d),h=d}for(let c=o,h=l,u=l;c<a;c++){let d=mt[c];if(d==128)c<a-1&&h==mt[c+1]&&h&24?d=mt[c]=h:mt[c]=256;else if(d==64){let p=c+1;for(;p<a&&mt[p]==64;)p++;let f=c&&h==8||p<i&&mt[p]==8?u==1?1:8:256;for(let g=c;g<p;g++)mt[g]=f;c=p-1}else d==8&&u==1&&(mt[c]=1);h=d,d&7&&(u=d)}}}function dQ(t,e,i,r,s){let n=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:i;for(let u=c,d,p,f;u<h;u++)if(p=bd[d=t.charCodeAt(u)])if(p<0){for(let g=a-3;g>=0;g-=3)if(yr[g+1]==-p){let v=yr[g+2],b=v&2?s:v&4?v&1?n:s:0;b&&(mt[u]=mt[yr[g]]=b),a=g;break}}else{if(yr.length==189)break;yr[a++]=u,yr[a++]=d,yr[a++]=l}else if((f=mt[u])==2||f==1){let g=f==s;l=g?0:1;for(let v=a-3;v>=0;v-=3){let b=yr[v+2];if(b&2)break;if(g)yr[v+2]|=2;else{if(b&4)break;yr[v+2]|=4}}}}}function fQ(t,e,i,r){for(let s=0,n=r;s<=i.length;s++){let o=s?i[s-1].to:t,a=s<i.length?i[s].from:e;for(let l=o;l<a;){let c=mt[l];if(c==256){let h=l+1;for(;;)if(h==a){if(s==i.length)break;h=i[s++].to,a=s<i.length?i[s].from:e}else if(mt[h]==256)h++;else break;let u=n==1,d=(h<e?mt[h]:r)==1,p=u==d?u?1:2:r;for(let f=h,g=s,v=g?i[g-1].to:t;f>l;)f==v&&(f=i[--g].from,v=g?i[g-1].to:t),mt[--f]=p;l=h}else n=c,l++}}}function yd(t,e,i,r,s,n,o){let a=r%2?2:1;if(r%2==s%2)for(let l=e,c=0;l<i;){let h=!0,u=!1;if(c==n.length||l<n[c].from){let g=mt[l];g!=a&&(h=!1,u=g==16)}let d=!h&&a==1?[]:null,p=h?r:r+1,f=l;e:for(;;)if(c<n.length&&f==n[c].from){if(u)break e;let g=n[c];if(!h)for(let v=g.to,b=c+1;;){if(v==i)break e;if(b<n.length&&n[b].from==v)v=n[b++].to;else{if(mt[v]==a)break e;break}}if(c++,d)d.push(g);else{g.from>l&&o.push(new Tr(l,g.from,p));let v=g.direction==pn!=!(p%2);_d(t,v?r+1:r,s,g.inner,g.from,g.to,o),l=g.to}f=g.to}else{if(f==i||(h?mt[f]!=a:mt[f]==a))break;f++}d?yd(t,l,f,r+1,s,d,o):l<f&&o.push(new Tr(l,f,p)),l=f}else for(let l=i,c=n.length;l>e;){let h=!0,u=!1;if(!c||l>n[c-1].to){let g=mt[l-1];g!=a&&(h=!1,u=g==16)}let d=!h&&a==1?[]:null,p=h?r:r+1,f=l;e:for(;;)if(c&&f==n[c-1].to){if(u)break e;let g=n[--c];if(!h)for(let v=g.from,b=c;;){if(v==e)break e;if(b&&n[b-1].to==v)v=n[--b].from;else{if(mt[v-1]==a)break e;break}}if(d)d.push(g);else{g.to<l&&o.push(new Tr(g.to,l,p));let v=g.direction==pn!=!(p%2);_d(t,v?r+1:r,s,g.inner,g.from,g.to,o),l=g.from}f=g.from}else{if(f==e||(h?mt[f-1]!=a:mt[f-1]==a))break;f--}d?yd(t,f,l,r+1,s,d,o):f<l&&o.push(new Tr(f,l,p)),l=f}}function _d(t,e,i,r,s,n,o){let a=e%2?2:1;uQ(t,s,n,r,a),dQ(t,s,n,r,a),fQ(s,n,r,a),yd(t,s,n,e,i,r,o)}function pQ(t,e,i){if(!t)return[new Tr(0,0,e==Jf?1:0)];if(e==pn&&!i.length&&!hQ.test(t))return i1(t.length);if(i.length)for(;t.length>mt.length;)mt[mt.length]=256;let r=[],s=e==pn?0:1;return _d(t,s,s,i,0,t.length,r),r}function i1(t){return[new Tr(0,t,0)]}let r1="";function mQ(t,e,i,r,s){var n;let o=r.head-t.from,a=Tr.find(e,o,(n=r.bidiLevel)!==null&&n!==void 0?n:-1,r.assoc),l=e[a],c=l.side(s,i);if(o==c){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;l=e[a=d],o=l.side(!s,i),c=l.side(s,i)}let h=Ut(t.text,o,l.forward(s,i));(h<l.from||h>l.to)&&(h=c),r1=t.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u&&h==c&&u.level+(s?0:1)<l.level?le.cursor(u.side(!s,i)+t.from,u.forward(s,i)?1:-1,u.level):le.cursor(h+t.from,l.forward(s,i)?-1:1,l.level)}function gQ(t,e,i){for(let r=e;r<i;r++){let s=e1(t.charCodeAt(r));if(s==1)return pn;if(s==2||s==4)return Jf}return pn}const s1=Qe.define(),n1=Qe.define(),o1=Qe.define(),a1=Qe.define(),xd=Qe.define(),l1=Qe.define(),c1=Qe.define(),ep=Qe.define(),tp=Qe.define(),h1=Qe.define({combine:t=>t.some(e=>e)}),u1=Qe.define({combine:t=>t.some(e=>e)}),d1=Qe.define();class Fn{constructor(e,i="nearest",r="nearest",s=5,n=5,o=!1){this.range=e,this.y=i,this.x=r,this.yMargin=s,this.xMargin=n,this.isSnapshot=o}map(e){return e.empty?this:new Fn(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Fn(le.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Bl=Ve.define({map:(t,e)=>t.map(e)}),f1=Ve.define();function $i(t,e,i){let r=t.facet(a1);r.length?r[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const Kr=Qe.define({combine:t=>t.length?t[0]:!0});let OQ=0;const Ln=Qe.define({combine(t){return t.filter((e,i)=>{for(let r=0;r<i;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Mt{constructor(e,i,r,s,n){this.id=e,this.create=i,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=n(this),this.extension=this.baseExtensions.concat(Ln.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ln.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:r,eventObservers:s,provide:n,decorations:o}=i||{};return new Mt(OQ++,e,r,s,a=>{let l=[];return o&&l.push(Ch.of(c=>{let h=c.plugin(a);return h?o(h):Ie.none})),n&&l.push(n(a)),l})}static fromClass(e,i){return Mt.define((r,s)=>new e(r,s),i)}}class qh{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(r){if($i(i.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(i){$i(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(r){$i(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const p1=Qe.define(),ip=Qe.define(),Ch=Qe.define(),m1=Qe.define(),rp=Qe.define(),nl=Qe.define(),g1=Qe.define();function Zm(t,e){let i=t.state.facet(g1);if(!i.length)return i;let r=i.map(n=>n instanceof Function?n(t):n),s=[];return et.spans(r,e.from,e.to,{point(){},span(n,o,a,l){let c=n-e.from,h=o-e.from,u=s;for(let d=a.length-1;d>=0;d--,l--){let p=a[d].spec.bidiIsolate,f;if(p==null&&(p=gQ(e.text,c,h)),l>0&&u.length&&(f=u[u.length-1]).to==c&&f.direction==p)f.to=h,u=f.inner;else{let g={from:c,to:h,direction:p,inner:[]};u.push(g),u=g.inner}}}}),s}const O1=Qe.define();function sp(t){let e=0,i=0,r=0,s=0;for(let n of t.state.facet(O1)){let o=n(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(i=Math.max(i,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:r,bottom:s}}const na=Qe.define();class Yi{constructor(e,i,r,s){this.fromA=e,this.toA=i,this.fromB=r,this.toB=s}join(e){return new Yi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,r=this;for(;i>0;i--){let s=e[i-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(i-1,1)}}return e.splice(i,0,r),e}static extendWithRanges(e,i){if(i.length==0)return e;let r=[];for(let s=0,n=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=n<i.length?i[n]:1e9,c=Math.min(a,l);if(c==1e9)break;let h=c+o,u=c,d=h;for(;;)if(n<i.length&&i[n]<=u){let p=i[n+1];n+=2,u=Math.max(u,p);for(let f=s;f<e.length&&e[f].fromB<=u;f++)o=e[f].toA-e[f].toB;d=Math.max(d,p+o)}else if(s<e.length&&e[s].fromB<=u){let p=e[s++];u=Math.max(u,p.toB),d=Math.max(d,p.toA),o=p.toA-p.toB}else break;r.push(new Yi(h,d,c,u))}return r}}class Ic{constructor(e,i,r){this.view=e,this.state=i,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Zt.empty(this.startState.doc.length);for(let n of r)this.changes=this.changes.compose(n.changes);let s=[];this.changes.iterChangedRanges((n,o,a,l)=>s.push(new Yi(n,o,a,l))),this.changedRanges=s}static create(e,i,r){return new Ic(e,i,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const vQ=[];class Lt{constructor(e,i,r=0){this.dom=e,this.length=i,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return vQ}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let i=this.domAttrs;i&&JP(this.dom,i)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,i=this.posAtStart){let r=i;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,i){return null}domPosFor(e,i){let r=Ds(this.dom),s=this.length?e>0:i>0;return new lr(this.parent.dom,r+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Ph)return e;return null}static get(e){return e.cmTile}}class $h extends Lt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let i=this.dom,r=null,s,n=e?.node==i?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=r?r.nextSibling:i.firstChild,n&&s!=a.dom&&(n.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=Xm(s);else i.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:i.firstChild,n&&s&&(n.written=!0);s;)s=Xm(s);this.length=o}}function Xm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Ph extends $h{constructor(e,i){super(i),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let i=Lt.get(e);if(i&&this.owns(i))return i;e=e.parentNode}}blockTiles(e){for(let i=[],r=this,s=0,n=0;;)if(s==r.children.length){if(!i.length)return;r=r.parent,r.breakAfter&&n++,s=i.pop()}else{let o=r.children[s++];if(o instanceof es)i.push(s),r=o,s=0;else{let a=n+o.length,l=e(o,n);if(l!==void 0)return l;n=a+o.breakAfter}}}resolveBlock(e,i){let r,s=-1,n,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&i>=-1&&i<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(i<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=e-l),(c>e||e==l&&(i>1?a.length:a.covers(-1)))&&(!n||!a.isWidget()&&n.isWidget())&&(n=a,o=e-l)}}),!r&&!n)throw new Error("No tile at position "+e);return r&&i<0||!n?{tile:r,offset:s}:{tile:n,offset:o}}}class es extends $h{constructor(e,i){super(e),this.wrapper=i}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,i){let r=new es(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class Jn extends $h{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,r){let s=new Jn(i||document.createElement("div"),e);return(!i||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,i,r){let s=null,n=-1,o=null,a=-1;function l(h,u){for(let d=0,p=0;d<h.children.length&&p<=u;d++){let f=h.children[d],g=p+f.length;g>=u&&(f.isComposite()?l(f,u-p):(!o||o.isHidden&&(i>0||r&&yQ(o,f)))&&(g>u||f.flags&32)?(o=f,a=u-p):(p<u||f.flags&16&&!f.isHidden)&&(s=f,n=u-p)),p=g}}l(this,e);let c=(i<0?s:o)||s||o;return c?{tile:c,offset:c==s?n:a}:null}coordsIn(e,i){let r=this.resolveInline(e,i,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),i):bQ(this)}domIn(e,i){let r=this.resolveInline(e,i);if(r){let{tile:s,offset:n}=r;if(this.dom.contains(s.dom))return s.isText()?new lr(s.dom,Math.min(s.dom.nodeValue.length,n)):s.domPosFor(n,s.flags&16?1:s.flags&32?-1:i);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new lr(l.dom,0);l==r.tile&&(a=!0)}}return new lr(this.dom,0)}}function bQ(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=pc(e);return i[i.length-1]||null}function yQ(t,e){let i=t.coordsIn(0,1),r=e.coordsIn(0,1);return i&&r&&r.top<i.bottom}class Ci extends $h{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let r=new Ci(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class sn extends Lt{constructor(e,i){super(e,i.length),this.text=i}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,i){let r=this.dom.nodeValue.length;e>r&&(e=r);let s=e,n=e,o=0;e==0&&i<0||e==r&&i>=0?Te.chrome||Te.gecko||(e?(s--,o=1):n<r&&(n++,o=-1)):i<0?s--:n<r&&n++;let a=Ba(this.dom,s,n).getClientRects();if(!a.length)return null;let l=a[(o?o<0:i>=0)?0:a.length-1];return Te.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Lc(l,o<0):l||null}static of(e,i){let r=new sn(i||document.createTextNode(e),e);return i||(r.flags|=2),r}}class mn extends Lt{constructor(e,i,r,s){super(e,i,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,i){return this.coordsInWidget(e,i,!1)}coordsInWidget(e,i,r){let s=this.widget.coordsAt(this.dom,e,i);if(s)return s;if(r)return Lc(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?n.length-1:0;o=n[l],!(e>0?l==0:l==n.length-1||o.top<o.bottom);l+=a?-1:1);return Lc(o,!a)}}get overrideDOMText(){if(!this.length)return ot.empty;let{root:e}=this;if(!e)return ot.empty;let i=this.posAtStart;return e.view.state.doc.slice(i,i+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,r,s,n){return n||(n=e.toDOM(i),e.editable||(n.contentEditable="false")),new mn(n,r,e,s)}}class Nc extends Lt{constructor(e){let i=document.createElement("img");i.className="cm-widgetBuffer",i.setAttribute("aria-hidden","true"),super(i,0,e)}get isHidden(){return!0}get overrideDOMText(){return ot.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class _Q{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,r){let{tile:s,index:n,beforeBreak:o,parents:a}=this;for(;e||i>0;)if(s.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(n==s.children.length){if(!e&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++}else{let l=s.children[n],c=l.breakAfter;(i>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,n++,e-=l.length):(a.push({tile:s,index:n}),s=l,n=0,r&&l.isComposite()&&r.enter(l))}else if(n==s.length)o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++;else if(e){let l=Math.min(e,s.length-n);r&&r.skip(s,n,n+l),e-=l,n+=l}else break;return this.tile=s,this.index=n,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class xQ{constructor(e,i,r,s){this.from=e,this.to=i,this.wrapper=r,this.rank=s}}class SQ{constructor(e,i,r){this.cache=e,this.root=i,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,i,r,s){var n;this.flushBuffer();let o=this.ensureMarks(i,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new sn(a.dom,a.text+e);l.parent=o}else o.append(s||sn.of(e,(n=this.cache.find(sn))===null||n===void 0?void 0:n.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,i){let r=this.curLine;r.dom!=i.line.dom&&(r.setDOM(this.cache.reused.has(i.line)?Yh(i.line.dom):i.line.dom),this.cache.reused.set(i.line,2));let s=r;for(let a=i.marks.length-1;a>=0;a--){let l=i.marks[a],c=s.lastChild;if(c instanceof Ci&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(Yh(l.dom)),s=c;else{if(this.cache.reused.get(l)){let u=Lt.get(l.dom);u&&u.setDOM(Yh(l.dom))}let h=Ci.of(l.mark,l.dom);s.append(h),s=h}this.cache.reused.set(l,2)}let n=Lt.get(e.text);n&&this.cache.reused.set(n,2);let o=new sn(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,i,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let n=this.ensureMarks(i,r);!s&&!(e.flags&16)&&n.append(this.getBuffer(1)),n.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,i,r){this.flushBuffer(),this.ensureMarks(i,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let i=this.afterWidget||this.lastBlock;i.length+=e,this.pos+=e}addLineStart(e,i){var r;e||(e=v1);let s=Jn.start(e,i||((r=this.cache.find(Jn))===null||r===void 0?void 0:r.dom),!!i);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,i){var r;let s=this.curLine;for(let n=e.length-1;n>=0;n--){let o=e[n],a;if(i>0&&(a=s.lastChild)&&a instanceof Ci&&a.mark.eq(o))s=a,i--;else{let l=Ci.of(o,(r=this.cache.find(Ci,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,i=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Wm(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Te.ios&&Wm(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(jh,0,32)||new mn(jh.toDOM(),0,jh,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let i=new xQ(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let i=this.root;for(let r of this.wrappers){let s=i.lastChild;if(r.from<this.pos&&s instanceof es&&s.wrapper.eq(r.wrapper))i=s;else{let n=es.of(r.wrapper,(e=this.cache.find(es,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);i.append(n),i=n}}return i}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let i=2|(e<0?16:32),r=this.cache.find(Nc,void 0,1);return r&&(r.flags=i),r||new Nc(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class wQ{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:n,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return n?null:s.slice(0,a)}let i=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,i);return this.textOff=i,r}}const zc=[mn,Jn,sn,Ci,Nc,es,Ph];for(let t=0;t<zc.length;t++)zc[t].bucket=t;class kQ{constructor(e){this.view=e,this.buckets=zc.map(()=>[]),this.index=zc.map(()=>0),this.reused=new Map}add(e){let i=e.constructor.bucket,r=this.buckets[i];r.length<6?r.push(e):r[this.index[i]=(this.index[i]+1)%6]=e}find(e,i,r=2){let s=e.bucket,n=this.buckets[s],o=this.index[s];for(let a=n.length-1;a>=0;a--){let l=(a+o)%n.length,c=n[l];if((!i||i(c))&&!this.reused.has(c))return n.splice(l,1),l<o&&this.index[s]--,this.reused.set(c,r),c}return null}findWidget(e,i,r){let s=this.buckets[0];if(s.length)for(let n=0,o=0;;n++){if(n==s.length){if(o)return null;o=1,n=0}let a=s[n];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return s.splice(n,1),n<this.index[0]&&this.index[0]--,a.widget==e&&a.length==i&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new mn(a.dom,i,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,i=2){if(!this.reused.has(e))return this.reused.set(e,i),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class CQ{constructor(e,i,r,s,n){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=n,this.openWidget=!1,this.openMarks=0,this.cache=new kQ(e),this.text=new wQ(e.state.doc),this.builder=new SQ(this.cache,new Ph(e,e.contentDOM),et.iter(r)),this.cache.reused.set(i,2),this.old=new _Q(i),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,i){let r=i&&this.getCompositionContext(i.text);for(let s=0,n=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=l,n+=c}if(!a)break;i&&a.fromA<=i.range.fromA&&a.toA>=i.range.toA?(this.forward(a.fromA,i.range.fromA,i.range.fromA<i.range.toA?1:-1),this.emit(n,i.range.fromB),this.cache.clear(),this.builder.addComposition(i,r),this.text.skip(i.range.toB-i.range.fromB),this.forward(i.range.fromA,a.toA),this.emit(i.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(n,a.toB)),n=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,r){let s=QQ(this.old),n=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?mn.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,s,n),n=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,s,n,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,n)),n=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Nc)this.cache.add(o);else if(o instanceof Ci)this.builder.ensureLine(null),this.builder.addMark(o,s,n),this.cache.reused.set(o,1),n=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Ci&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=n=0):o instanceof Ci&&(s.shift(),n=Math.min(n,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let r=null,s=this.builder,n=0,o=et.spans(this.decorations,e,i,{point:(a,l,c,h,u,d)=>{if(c instanceof fn){if(this.disallowBlockEffectsFor[d]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(n=h.length,u>h.length)s.continueWidget(l-a);else{let p=c.widget||(c.block?eo.block:eo.inline),f=$Q(c),g=this.cache.findWidget(p,l-a,f)||mn.of(p,this.view,l-a,f);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(g)):(s.ensureLine(r),s.addInlineWidget(g,h,u))}r=null}else r=PQ(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,h)=>{for(let u=a;u<l;){let d=this.text.next(Math.min(512,l-u));d==null?(s.addLineStartIfNotCovered(r),s.addBreak(),u++):(s.ensureLine(r),s.addText(d,c,u==a?h:c.length),u+=d.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>n,this.openMarks=o}forward(e,i,r=1){i-e<=10?this.old.advance(i-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(i-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let i=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let n=Lt.get(s);if(s==this.view.contentDOM)break;n instanceof Ci?i.push(n):n?.isLine()?r=n:n instanceof es||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new Jn(s,v1):r||i.push(Ci.of(new rl({tagName:s.nodeName.toLowerCase(),attributes:eQ(s)}),s)))}return{line:r,marks:i}}}function Wm(t,e){let i=r=>{for(let s of r.children)if((e?s.isText():s.length)||i(s))return!0;return!1};return i(t)}function $Q(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const v1={class:"cm-line"};function PQ(t,e){let i=e.spec.attributes,r=e.spec.class;return!i&&!r||(t||(t={class:"cm-line"}),i&&Gf(i,t),r&&(t.class+=" "+r)),t}function QQ(t){let e=[];for(let i=t.parents.length;i>1;i--){let r=i==t.parents.length?t.tile:t.parents[i].tile;r instanceof Ci&&e.push(r.mark)}return e}function Yh(t){let e=Lt.get(t);return e&&e.setDOM(t.cloneNode()),t}class eo extends Xr{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}eo.inline=new eo("span");eo.block=new eo("div");const jh=new class extends Xr{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Vm{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ie.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Ph(e,e.contentDOM),this.updateInner([new Yi(0,0,0,e.state.doc.length)],null)}update(e){var i;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:u})=>u<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?s=this.domChanged.newSel.head:!IQ(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let n=s>-1?MQ(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:u}=this.hasComposition;r=new Yi(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(Te.ie||Te.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=RQ(o,this.decorations,e.changes);l.length&&(r=Yi.extendWithRanges(r,l));let c=DQ(a,this.blockWrappers,e.changes);return c.length&&(r=Yi.extendWithRanges(r,c)),n&&!r.some(h=>h.fromA<=n.range.fromA&&h.toA>=n.range.toA)&&(r=n.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,n),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(i||e.length){let o=this.tile,a=new CQ(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,i),Sd(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=Te.chrome||Te.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),n&&(n.written||r.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let n of this.tile.children)n.isWidget()&&n.widget instanceof Uh&&s.push(n.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let r of i.effects)r.is(f1)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,n=s==r,o=!n&&!(this.view.state.facet(Kr)||r.tabIndex>-1)&&ba(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(n||i||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,h;if(l.empty?h=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(h=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Te.gecko&&l.empty&&!this.hasComposition&&TQ(c)){let d=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(d,c.node.childNodes[c.offset]||null)),c=h=new lr(d,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!ya(c.node,c.offset,u.anchorNode,u.anchorOffset)||!ya(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{Te.android&&Te.chrome&&r.contains(u.focusNode)&&LQ(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Ma(this.view.root);if(d)if(l.empty){if(Te.gecko){let p=BQ(c.node,c.offset);if(p&&p!=3){let f=(p==1?G0:K0)(c.node,c.offset);f&&(c=new lr(f.node,f.offset))}}d.collapse(c.node,c.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(c.node,c.offset);try{d.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new lr(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new lr(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&ya(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,r=Ma(e.root),{anchorNode:s,anchorOffset:n}=e.observer.selectionRange;if(!r||!i.empty||!i.assoc||!r.modify)return;let o=this.lineAt(i.head,i.assoc);if(!o)return;let a=o.posAtStart;if(i.head==a||i.head==a+o.length)return;let l=this.coordsAt(i.head,-1),c=this.coordsAt(i.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(i.head+i.assoc,i.assoc);r.collapse(h.node,h.offset),r.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=i.from&&r.collapse(s,n)}posFromDOM(e,i){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let n;if(e==r.dom)n=r.dom.childNodes[i];else{let o=rs(e)==0?0:i==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?n=e:n=e.nextSibling}if(n==r.dom.firstChild)return s;for(;n&&!Lt.get(n);)n=n.nextSibling;if(!n)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?s+i:s+(i?r.length:0):s}domAtPos(e,i){let{tile:r,offset:s}=this.tile.resolveBlock(e,i);return r.isWidget()?r.domPosFor(e,i):r.domIn(s,i)}inlineDOMNearPos(e,i){let r,s=-1,n=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,h)=>{if(c.isWidget()){if(c.flags&32&&h>=e)return!0;c.flags&16&&(n=!0)}else{let u=h+c.length;if(h<=e&&(r=c,s=e-h,n=u<e),u>=e&&!o&&(o=c,a=e-h,l=h>e),h>e&&o)return!0}}),!r&&!o?this.domAtPos(e,i):(n&&o?r=null:l&&r&&(o=null),r&&i<0||!o?r.domIn(s,i):o.domIn(a,i))}coordsAt(e,i){let{tile:r,offset:s}=this.tile.resolveBlock(e,i);return r.isWidget()?r.widget instanceof Uh?null:r.coordsInWidget(s,i,!0):r.coordsIn(s,i)}lineAt(e,i){let{tile:r}=this.tile.resolveBlock(e,i);return r.isLine()?r:null}coordsForChar(e){let{tile:i,offset:r}=this.tile.resolveBlock(e,1);if(!i.isLine())return null;function s(n,o){if(n.isComposite())for(let a of n.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(n.isText()&&o<n.length){let a=Ut(n.text,o);if(a==o)return null;let l=Ba(n.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(c==l.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return s(i,r)}measureVisibleLineHeights(e){let i=[],{from:r,to:s}=e,n=this.view.contentDOM.clientWidth,o=n>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==gt.LTR,c=0,h=(u,d,p)=>{for(let f=0;f<u.children.length&&!(d>s);f++){let g=u.children[f],v=d+g.length,b=g.dom.getBoundingClientRect(),{height:S}=b;if(p&&!f&&(c+=b.top-p.top),g instanceof es)v>r&&h(g,d,b);else if(d>=r&&(c>0&&i.push(-c),i.push(S+c),c=0,o)){let k=g.dom.lastChild,T=k?pc(k):[];if(T.length){let $=T[T.length-1],R=l?$.right-b.left:b.right-$.left;R>a&&(a=R,this.minWidth=n,this.minWidthFrom=d,this.minWidthTo=v)}}p&&f==u.children.length-1&&(c+=p.bottom-b.bottom),d=v+g.breakAfter}};return h(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?gt.RTL:gt.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let h=pc(c.dom);if(h.length!=1)return;a+=h[0].width,l=h[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let i=document.createElement("div"),r,s,n;return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let o=pc(i.firstChild)[0];r=i.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,n=o&&o.height?o.height:r,i.remove()}),{lineHeight:r,charWidth:s,textHeight:n}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let r=0,s=0;;s++){let n=s==i.viewports.length?null:i.viewports[s],o=n?n.from-1:this.view.state.doc.length;if(o>r){let a=(i.lineBlockAt(o).bottom-i.lineBlockAt(r).top)/this.view.scaleY;e.push(Ie.replace({widget:new Uh(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!n)break;r=n.to+1}return Ie.set(e)}updateDeco(){let e=1,i=this.view.state.facet(Ch).map(n=>(this.dynamicDecorationMap[e++]=typeof n=="function")?n(this.view):n),r=!1,s=this.view.state.facet(rp).map((n,o)=>{let a=typeof n=="function";return a&&(r=!0),a?n(this.view):n});for(s.length&&(this.dynamicDecorationMap[e++]=r,i.push(et.join(s))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(m1).map(n=>typeof n=="function"?n(this.view):n)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(d1))try{if(c(this.view,e.range,e))return!0}catch(h){$i(this.view.state,h,"scroll handler")}let{range:i}=e,r=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),s;if(!r)return;!i.empty&&(s=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let n=sp(this.view),o={left:r.left-n.left,top:r.top-n.top,right:r.right+n.right,bottom:r.bottom+n.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(rQ(this.view.scrollDOM,o,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==gt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(i.head,1);c&&c.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let i=r=>r.isWidget()||r.children.some(i);return i(this.tile.resolveBlock(e,1).tile)}destroy(){Sd(this.tile)}}function Sd(t,e){let i=e?.get(t);if(i!=1){i==null&&t.destroy();for(let r of t.children)Sd(r,e)}}function TQ(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function b1(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let r=G0(i.focusNode,i.focusOffset),s=K0(i.focusNode,i.focusOffset),n=r||s;if(s&&r&&s.node!=r.node){let a=Lt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)n=s;else if(t.docView.lastCompositionAfterCursor){let l=Lt.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(n=s)}}if(t.docView.lastCompositionAfterCursor=n!=r,!n)return null;let o=e-n.offset;return{from:o,to:o+n.node.nodeValue.length,node:n.node}}function MQ(t,e,i){let r=b1(t,i);if(!r)return null;let{node:s,from:n,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new Yi(l.mapPos(n),l.mapPos(o),n,o),text:s}}function BQ(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let AQ=class{constructor(){this.changes=[]}compareRange(e,i){Wn(e,i,this.changes)}comparePoint(e,i){Wn(e,i,this.changes)}boundChange(e){Wn(e,e,this.changes)}};function RQ(t,e,i){let r=new AQ;return et.compare(t,e,i,r),r.changes}class EQ{constructor(){this.changes=[]}compareRange(e,i){Wn(e,i,this.changes)}comparePoint(){}boundChange(e){Wn(e,e,this.changes)}}function DQ(t,e,i){let r=new EQ;return et.compare(t,e,i,r),r.changes}function LQ(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function IQ(t,e){let i=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(i=!0)}),i}class Uh extends Xr{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function NQ(t,e,i=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),n=e-s.from;if(s.length==0)return le.cursor(e);n==0?i=1:n==s.length&&(i=-1);let o=n,a=n;i<0?o=Ut(s.text,n,!1):a=Ut(s.text,n);let l=r(s.text.slice(o,a));for(;o>0;){let c=Ut(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=Ut(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return le.range(o+s.from,a+s.from)}function zQ(t,e,i,r,s){let n=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((s-i.top-(t.defaultLineHeight-a)*.5)/a);n+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+ud(o,n,t.state.tabSize)}function wd(t,e,i){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let n of r.type){if(n.from>e)break;if(!(n.to<e)){if(n.from<e&&n.to>e)return n;(!s||n.type==oi.Text&&(s.type!=n.type||(i<0?n.from<e:n.to>e)))&&(s=n)}}return s||r}return r}function ZQ(t,e,i,r){let s=wd(t,e.head,e.assoc||-1),n=!r||s.type!=oi.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(n){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(s.from),l=t.posAtCoords({x:i==(a==gt.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return le.cursor(l,i?-1:1)}return le.cursor(i?s.to:s.from,i?-1:1)}function Fm(t,e,i,r){let s=t.state.doc.lineAt(e.head),n=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let c=mQ(s,n,o,a,i),h=r1;if(!c){if(s.number==(i?t.state.doc.lines:1))return a;h=`
|
|
17
|
-
`,s=t.state.doc.line(s.number+(i?1:-1)),n=t.bidiSpans(s),c=t.visualLineSide(s,!i)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function XQ(t,e,i){let r=t.state.charCategorizer(e),s=r(i);return n=>{let o=r(n);return s==_t.Space&&(s=o),s==o}}function WQ(t,e,i,r){let s=e.head,n=i?1:-1;if(s==(i?t.state.doc.length:0))return le.cursor(s,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(s,(e.empty?e.assoc:0)||(i?1:-1)),h=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=n<0?c.top:c.bottom;else{let f=t.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-f.from))),a=(n<0?f.top:f.bottom)+h}let u=l.left+o,d=r??t.viewState.heightOracle.textHeight>>1,p=kd(t,{x:u,y:a+d*n},!1,n);return le.cursor(p.pos,p.assoc,void 0,o)}function _a(t,e,i){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(n,o,a)=>{if(e>n&&e<o){let l=r||i||(e-n<o-e?-1:1);e=l<0?n:o,r=l}});if(!r)return e}}function y1(t,e){let i=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],n=null;if(s.empty){let o=_a(t,s.from,0);o!=s.from&&(n=le.cursor(o,-1))}else{let o=_a(t,s.from,-1),a=_a(t,s.to,1);(o!=s.from||a!=s.to)&&(n=le.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}n&&(i||(i=e.ranges.slice()),i[r]=n)}return i?le.create(i,e.mainIndex):e}function Gh(t,e,i){let r=_a(t.state.facet(nl).map(s=>s(t)),i.from,e.head>i.from?-1:1);return r==i.from?i:le.cursor(r,r<i.from?1:-1)}class Qr{constructor(e,i){this.pos=e,this.assoc=i}}function kd(t,e,i,r){let s=t.contentDOM.getBoundingClientRect(),n=s.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-n,c;for(;;){if(l<0)return new Qr(0,1);if(l>t.viewState.docHeight)return new Qr(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==oi.Text){if(r<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let d=t.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(d&&(r<0?d.top<=l+n:d.bottom>=l+n))break}let u=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(i)return null;if(c.type==oi.Text){let u=zQ(t,s,c,o,a);return new Qr(u,u==c.from?1:-1)}}if(c.type!=oi.Text)return l<(c.top+c.bottom)/2?new Qr(c.from,1):new Qr(c.to,-1);let h=t.docView.lineAt(c.from,2);return(!h||h.length!=c.length)&&(h=t.docView.lineAt(c.from,-2)),new VQ(t,o,a,t.textDirectionAt(c.from)).scanTile(h,c.from)}class VQ{constructor(e,i,r,s){this.view=e,this.x=i,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,i){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Tr.find(s,e-r.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Tr.find(s,e-r.from,-1,i)].dir}bidiIn(e,i){let{spans:r,line:s}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<i)}scan(e,i){let r=0,s=e.length-1,n=new Set,o=this.bidiIn(e[0],e[s]),a,l,c=-1,h=1e9,u;e:for(;r<s;){let p=s-r,f=r+s>>1;t:if(n.has(f)){let v=r+Math.floor(Math.random()*p);for(let b=0;b<p;b++){if(!n.has(v)){f=v;break t}v++,v==s&&(v=r)}break e}n.add(f);let g=i(f);if(g)for(let v=0;v<g.length;v++){let b=g[v],S=0;if(b.bottom<this.y)(!a||a.bottom<b.bottom)&&(a=b),S=1;else if(b.top>this.y)(!l||l.top>b.top)&&(l=b),S=-1;else{let k=b.left>this.x?this.x-b.left:b.right<this.x?this.x-b.right:0,T=Math.abs(k);T<h&&(c=f,h=T,u=b),k&&(S=k<0==(this.baseDir==gt.LTR)?-1:1)}S==-1&&(!o||this.baseDirAt(e[f],1))?s=f:S==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}}if(!u){let p=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(p.top+p.bottom)/2,this.scan(e,i)}let d=(o?this.dirAt(e[c],1):this.baseDir)==gt.LTR;return{i:c,after:this.x>(u.left+u.right)/2==d}}scanText(e,i){let r=[];for(let n=0;n<e.length;n=Ut(e.text,n))r.push(i+n);r.push(i+e.length);let s=this.scan(r,n=>{let o=r[n]-i,a=r[n+1]-i;return Ba(e.dom,o,a).getClientRects()});return s.after?new Qr(r[s.i+1],-1):new Qr(r[s.i],1)}scanTile(e,i){if(!e.length)return new Qr(i,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,i);if(a.isComposite())return this.scanTile(a,i)}let r=[i];for(let a=0,l=i;a<e.children.length;a++)r.push(l+=e.children[a].length);let s=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ba(l.dom,0,l.length)).getClientRects()}),n=e.children[s.i],o=r[s.i];return n.isText()?this.scanText(n,o):n.isComposite()?this.scanTile(n,o):s.after?new Qr(r[s.i+1],-1):new Qr(o,1)}}const oa="";class FQ{constructor(e,i){this.points=e,this.view=i,this.text="",this.lineSeparator=i.state.facet(tt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=oa}readRange(e,i){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let n=this.text.length;this.readNode(s);let o=Lt.get(s),a=s.nextSibling;if(a==i){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Lt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Dc(s))||Dc(a)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>n)&&!qQ(a,i)&&this.lineBreak(),s=a}return this.findPointBefore(r,i),this}readTextNode(e){let i=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,i.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,o=1,a;if(this.lineSeparator?(n=i.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(i))&&(n=a.index,o=a[0].length),this.append(i.slice(r,n<0?i.length:n)),n<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=n+o}}readNode(e){let i=Lt.get(e),r=i&&i.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==i&&(r.pos=this.text.length)}findPointInside(e,i){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(HQ(e,r.node,r.offset)?i:0))}}function HQ(t,e,i){for(;;){if(!e||i<rs(e))return!1;if(e==t)return!0;i=Ds(e)+1,e=e.parentNode}}function qQ(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let r=Lt.get(t);if(!r?.isWidget())return!1;r&&(i||(i=[])).push(r)}if(i)for(let r of i){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class Hm{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class YQ{constructor(e,i,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:n,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=_1(e.docView.tile,i,r,0))){let a=n||o?[]:UQ(e),l=new FQ(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=GQ(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=n&&n.node==a.focusNode&&n.offset==a.focusOffset||!vd(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!vd(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((Te.ios||Te.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),d=Math.max(l,c),p=h.from-u,f=h.to-d;(p==0||p==1||u==0)&&(f==0||f==-1||d==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(le.range(c,l)):this.newSel=le.single(c,l)}}}function _1(t,e,i,r){if(t.isComposite()){let s=-1,n=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<t.children.length;l++){let u=t.children[l],d=c+u.length;if(c<e&&d>i)return _1(u,e,i,c);if(d>=e&&s==-1&&(s=l,n=c),c>i&&u.dom.parentNode==t.dom){o=l,a=h;break}h=d,c=d+u.breakAfter}return{from:n,to:a<0?r+t.length:a,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function x1(t,e){let i,{newSel:r}=e,s=t.state.selection.main,n=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,c=null;(n===8||Te.android&&e.text.length<a-o)&&(l=s.to,c="end");let h=S1(t.state.doc.sliceString(o,a,oa),e.text,l-o,c);h&&(Te.chrome&&n==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==oa+oa&&h.toB--,i={from:o+h.from,to:o+h.toA,insert:ot.of(e.text.slice(h.from,h.toB).split(oa))})}else r&&(!t.hasFocus&&t.state.facet(Kr)||Zc(r,s))&&(r=null);if(!i&&!r)return!1;if(!i&&e.typeOver&&!s.empty&&r&&r.main.empty?i={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:(Te.mac||Te.android)&&i&&i.from==i.to&&i.from==s.head-1&&/^\. ?$/.test(i.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&i.insert.length==2&&(r=le.single(r.main.anchor-1,r.main.head-1)),i={from:i.from,to:i.to,insert:ot.of([i.insert.toString().replace("."," ")])}):i&&i.from>=s.from&&i.to<=s.to&&(i.from!=s.from||i.to!=s.to)&&s.to-s.from-(i.to-i.from)<=4?i={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,s.to))}:t.state.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Te.chrome&&i&&i.from==i.to&&i.from==s.head&&i.insert.toString()==`
|
|
18
|
-
`&&t.lineWrapping&&(r&&(r=le.single(r.main.anchor-1,r.main.head-1)),i={from:s.from,to:s.to,insert:ot.of([" "])}),i)return np(t,i,r,n);if(r&&!Zc(r,s)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=y1(t.state.facet(nl).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function np(t,e,i,r=-1){if(Te.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Te.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vn(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Vn(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Vn(t.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=jQ(t,e,i));return t.state.facet(l1).some(l=>l(t,e.from,e.to,n,a))||t.dispatch(a()),!0}function jQ(t,e,i){let r,s=t.state,n=s.selection.main,o=-1;if(e.from==e.to&&e.from<n.from||e.from>n.to){let l=e.from<n.from?-1:1,c=l<0?n.from:n.to,h=_a(s.facet(nl).map(u=>u(t)),c,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:le.cursor(e.from+e.insert.length,-1)};else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=n.from<e.from?s.sliceDoc(n.from,e.from):"",c=n.to>e.to?s.sliceDoc(e.to,n.to):"";r=s.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=s.changes(e),c=i&&i.main.to<=l.newLength?i.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let h=t.state.sliceDoc(e.from,e.to),u,d=i&&b1(t,i.main.head);if(d){let f=e.insert.length-(e.to-e.from);u={from:d.from,to:d.to-f}}else u=t.state.doc.lineAt(n.head);let p=n.to-e.to;r=s.changeByRange(f=>{if(f.from==n.from&&f.to==n.to)return{changes:l,range:c||f.map(l)};let g=f.to-p,v=g-h.length;if(t.state.sliceDoc(v,g)!=h||g>=u.from&&v<=u.to)return{range:f};let b=s.changes({from:v,to:g,insert:e.insert}),S=f.to-n.to;return{changes:b,range:c?le.range(Math.max(0,c.anchor+S),Math.max(0,c.head+S)):f.map(b)}})}else r={changes:l,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function S1(t,e,i,r){let s=Math.min(t.length,e.length),n=0;for(;n<s&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==s&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,n-Math.min(o,a));i-=o+l-n}if(o<n&&t.length<e.length){let l=i<=n&&i>=o?n-i:0;n-=l,a=n+(a-o),o=n}else if(a<n){let l=i<=n&&i>=a?n-i:0;n-=l,o=n+(o-a),a=n}return{from:n,toA:o,toB:a}}function UQ(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new Hm(i,r)),(s!=i||n!=r)&&e.push(new Hm(s,n))),e}function GQ(t,e){if(t.length==0)return null;let i=t[0].pos,r=t.length==2?t[1].pos:i;return i>-1&&r>-1?le.single(i+e,r+e):null}function Zc(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class KQ{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Te.safari&&e.contentDOM.addEventListener("input",()=>null),Te.gecko&&fT(e.contentDOM.ownerDocument)}handleEvent(e){!oT(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,i);for(let s of r.handlers){if(i.defaultPrevented)break;if(s(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=JQ(e),r=this.handlers,s=this.view.contentDOM;for(let n in i)if(n!="scroll"){let o=!i[n].handlers.length,a=r[n];a&&o!=!a.handlers.length&&(s.removeEventListener(n,this.handleEvent),a=null),a||s.addEventListener(n,this.handleEvent,{passive:o})}for(let n in r)n!="scroll"&&!i[n]&&s.removeEventListener(n,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&k1.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Te.android&&Te.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return Te.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=w1.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||eT.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Vn(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Te.safari&&!Te.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function qm(t,e){return(i,r)=>{try{return e.call(t,r,i)}catch(s){$i(i.state,s)}}}function JQ(t){let e=Object.create(null);function i(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,n=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(n)for(let a in n){let l=n[a];l&&i(a).handlers.push(qm(r.value,l))}if(o)for(let a in o){let l=o[a];l&&i(a).observers.push(qm(r.value,l))}}for(let r in hr)i(r).handlers.push(hr[r]);for(let r in er)i(r).observers.push(er[r]);return e}const w1=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],eT="dthko",k1=[16,17,18,20,91,92,224,225],Al=6;function Rl(t){return Math.max(0,t)*.7+8}function tT(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class iT{constructor(e,i,r,s){this.view=e,this.startEvent=i,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=sQ(e.contentDOM),this.atoms=e.state.facet(nl).map(o=>o(e));let n=e.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this)),n.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(tt.allowMultipleSelections)&&rT(e,i),this.dragging=nT(e,i)&&P1(i)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&tT(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,r=0,s=0,n=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:n,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=sp(this.view);e.clientX-l.left<=s+Al?i=-Rl(s-e.clientX):e.clientX+l.right>=o-Al&&(i=Rl(e.clientX-o)),e.clientY-l.top<=n+Al?r=-Rl(n-e.clientY):e.clientY+l.bottom>=a-Al&&(r=Rl(e.clientY-a)),this.setScrollSpeed(i,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:i}=this,r=y1(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function rT(t,e){let i=t.state.facet(s1);return i.length?i[0](e):Te.mac?e.metaKey:e.ctrlKey}function sT(t,e){let i=t.state.facet(n1);return i.length?i[0](e):Te.mac?!e.altKey:!e.ctrlKey}function nT(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let r=Ma(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let n=0;n<s.length;n++){let o=s[n];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function oT(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,r;i!=t.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(r=Lt.get(i))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const hr=Object.create(null),er=Object.create(null),C1=Te.ie&&Te.ie_version<15||Te.ios&&Te.webkit_version<604;function aT(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),$1(t,i.value)},50)}function Qh(t,e,i){for(let r of t.facet(e))i=r(i,t);return i}function $1(t,e){e=Qh(t.state,ep,e);let{state:i}=t,r,s=1,n=i.toText(e),o=n.lines==i.selection.ranges.length;if(Cd!=null&&i.selection.ranges.every(l=>l.empty)&&Cd==n.toString()){let l=-1;r=i.changeByRange(c=>{let h=i.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=i.toText((o?n.line(s++).text:e)+i.lineBreak);return{changes:{from:h.from,insert:u},range:le.cursor(c.from+u.length)}})}else o?r=i.changeByRange(l=>{let c=n.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:le.cursor(l.from+c.length)}}):r=i.replaceSelection(n);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}er.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};hr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);er.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};er.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};hr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let r of t.state.facet(o1))if(i=r(t,e),i)break;if(!i&&e.button==0&&(i=cT(t,e)),i){let r=!t.hasFocus;t.inputState.startMouseSelection(new iT(t,e,i,r)),r&&t.observer.ignore(()=>{j0(t.contentDOM);let n=t.root.activeElement;n&&!n.contains(t.contentDOM)&&n.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Ym(t,e,i,r){if(r==1)return le.cursor(e,i);if(r==2)return NQ(t.state,e,i);{let s=t.docView.lineAt(e,i),n=t.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:n.from,a=s?s.posAtEnd:n.to;return a<t.state.doc.length&&a==n.to&&a++,le.range(o,a)}}const lT=Te.ie&&Te.ie_version<=11;let jm=null,Um=0,Gm=0;function P1(t){if(!lT)return t.detail;let e=jm,i=Gm;return jm=t,Gm=Date.now(),Um=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Um+1)%3:1}function cT(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=P1(e),s=t.state.selection;return{update(n){n.docChanged&&(i.pos=n.changes.mapPos(i.pos),s=s.map(n.changes))},get(n,o,a){let l=t.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),c,h=Ym(t,l.pos,l.assoc,r);if(i.pos!=l.pos&&!o){let u=Ym(t,i.pos,i.assoc,r),d=Math.min(u.from,h.from),p=Math.max(u.to,h.to);h=d<h.from?le.range(d,p):le.range(p,d)}return o?s.replaceRange(s.main.extend(h.from,h.to)):a&&r==1&&s.ranges.length>1&&(c=hT(s,l.pos))?c:a?s.addRange(h):le.create([h])}}}function hT(t,e){for(let i=0;i<t.ranges.length;i++){let{from:r,to:s}=t.ranges[i];if(r<=e&&s>=e)return le.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}hr.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let n=s.posAtStart,o=n+s.length;(n>=i.to||o<=i.from)&&(i=le.range(n,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Qh(t.state,tp,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};hr.dragend=t=>(t.inputState.draggedContent=null,!1);function Km(t,e,i,r){if(i=Qh(t.state,ep,i),!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:n}=t.inputState,o=r&&n&&sT(t,e)?{from:n.from,to:n.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}hr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let r=Array(i.length),s=0,n=()=>{++s==i.length&&Km(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<i.length;o++){let a=new FileReader;a.onerror=n,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),n()},a.readAsText(i[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Km(t,e,r,!0),!0}return!1};hr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=C1?null:e.clipboardData;return i?($1(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(aT(t),!1)};function uT(t,e){let i=t.dom.parentNode;if(!i)return;let r=i.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function dT(t){let e=[],i=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),i.push(s));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let o=t.doc.lineAt(n);o.number>s&&(e.push(o.text),i.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Qh(t,tp,e.join(t.lineBreak)),ranges:i,linewise:r}}let Cd=null;hr.copy=hr.cut=(t,e)=>{if(!ba(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:r,linewise:s}=dT(t.state);if(!i&&!s)return!1;Cd=s?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let n=C1?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(uT(t,i),!1)};const Q1=as.define();function T1(t,e){let i=[];for(let r of t.facet(c1)){let s=r(t,e);s&&i.push(s)}return i.length?t.update({effects:i,annotations:Q1.of(!0)}):null}function M1(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=T1(t.state,e);i?t.dispatch(i):t.update([])}},10)}er.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),M1(t)};er.blur=t=>{t.observer.clearSelectionRange(),M1(t)};er.compositionstart=er.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};er.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Te.chrome&&Te.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};er.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};hr.beforeinput=(t,e)=>{var i,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let n=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return np(t,{from:l,to:c,insert:t.state.toText(n)},null),!0}}let s;if(Te.chrome&&Te.android&&(s=w1.find(n=>n.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let n=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Te.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Te.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>er.compositionend(t,e),20),!1};const Jm=new Set;function fT(t){Jm.has(t)||(Jm.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const eg=["pre-wrap","normal","pre-line","break-spaces"];let to=!1;function tg(){to=!1}class pT{constructor(e){this.lineWrapping=e,this.doc=ot.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let r=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((i-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return eg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(i=!0,this.heightSamples[Math.floor(s*10)]=!0)}return i}refresh(e,i,r,s,n,o){let a=eg.indexOf(e)>-1,l=Math.abs(i-this.lineHeight)>.3||this.lineWrapping!=a||Math.abs(r-this.charWidth)>.1;if(this.lineWrapping=a,this.lineHeight=i,this.charWidth=r,this.textHeight=s,this.lineLength=n,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}}class mT{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class ar{constructor(e,i,r,s,n){this.from=e,this.length=i,this.top=r,this.height=s,this._content=n}get type(){return typeof this._content=="number"?oi.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof fn?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ar(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var bt=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(bt||(bt={}));const mc=.001;class Oi{constructor(e,i,r=2){this.length=e,this.height=i,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>mc&&(to=!0),this.height=e)}replace(e,i,r){return Oi.of(r)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,r,s){let n=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=s[a],d=n.lineAt(l,bt.ByPosNoHeight,r.setDoc(i),0,0),p=d.to>=c?d:n.lineAt(c,bt.ByPosNoHeight,r,0,0);for(u+=p.to-c,c=p.to;a>0&&d.from<=s[a-1].toA;)l=s[a-1].fromA,h=s[a-1].fromB,a--,l<d.from&&(d=n.lineAt(l,bt.ByPosNoHeight,r,0,0));h+=d.from-l,l=d.from;let f=op.build(r.setDoc(o),e,h,u);n=Xc(n,n.replace(l,c,f))}return n.updateHeight(r,0)}static empty(){return new Ei(0,0,0)}static of(e){if(e.length==1)return e[0];let i=0,r=e.length,s=0,n=0;for(;;)if(i==r)if(s>n*2){let a=e[i-1];a.break?e.splice(--i,1,a.left,null,a.right):e.splice(--i,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(n>s*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,n-=a.size}else break;else if(s<n){let a=e[i++];a&&(s+=a.size)}else{let a=e[--r];a&&(n+=a.size)}let o=0;return e[i-1]==null?(o=1,i--):e[i]==null&&(o=1,r++),new OT(Oi.of(e.slice(0,i)),o,Oi.of(e.slice(r)))}}function Xc(t,e){return t==e?t:(t.constructor!=e.constructor&&(to=!0),e)}Oi.prototype.size=1;const gT=Ie.replace({});class B1 extends Oi{constructor(e,i,r){super(e,i),this.deco=r,this.spaceAbove=0}mainBlock(e,i){return new ar(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,i,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new ar(s,0,r,this.spaceAbove,gT):this.mainBlock(r,s)}lineAt(e,i,r,s,n){let o=this.mainBlock(s,n);return this.spaceAbove?this.blockAt(0,r,s,n).join(o):o}forEachLine(e,i,r,s,n,o){e<=n+this.length&&i>=n&&o(this.lineAt(0,bt.ByPos,r,s,n))}setMeasuredHeight(e){let i=e.heights[e.index++];i<0?(this.spaceAbove=-i,i=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(i)}updateHeight(e,i=0,r=!1,s){return s&&s.from<=i&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ei extends B1{constructor(e,i,r){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,i){return new ar(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,i,r){let s=r[0];return r.length==1&&(s instanceof Ei||s instanceof ei&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ei?s=new Ei(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Oi.of(r)}updateHeight(e,i=0,r=!1,s){return s&&s.from<=i&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ei extends Oi{constructor(e){super(e,0)}heightMetrics(e,i){let r=e.doc.lineAt(i).number,s=e.doc.lineAt(i+this.length).number,n=s-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*n);o=l/n,this.length>n+1&&(a=(this.height-l)/(this.length-n-1))}else o=this.height/n;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(e,i,r,s){let{firstLine:n,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(i,s);if(i.lineWrapping){let c=s+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=i.doc.lineAt(c),u=a+h.length*l,d=Math.max(r,e-u/2);return new ar(h.from,h.length,d,u,0)}else{let c=Math.max(0,Math.min(o-n,Math.floor((e-r)/a))),{from:h,length:u}=i.doc.line(n+c);return new ar(h,u,r+a*c,a,0)}}lineAt(e,i,r,s,n){if(i==bt.ByHeight)return this.blockAt(e,r,s,n);if(i==bt.ByPosNoHeight){let{from:p,to:f}=r.doc.lineAt(e);return new ar(p,f-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,n),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,d=s+a*u+l*(c.from-n-u);return new ar(c.from,c.length,Math.max(s,Math.min(d,s+this.height-h)),h,0)}forEachLine(e,i,r,s,n,o){e=Math.max(e,n),i=Math.min(i,n+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,n);for(let h=e,u=s;h<=i;){let d=r.doc.lineAt(h);if(h==e){let f=d.number-a;u+=l*f+c*(e-n-f)}let p=l+c*d.length;o(new ar(d.from,d.length,u,p,0)),u+=p,h=d.to+1}}replace(e,i,r){let s=this.length-i;if(s>0){let n=r[r.length-1];n instanceof ei?r[r.length-1]=new ei(n.length+s):r.push(null,new ei(s-1))}if(e>0){let n=r[0];n instanceof ei?r[0]=new ei(e+n.length):r.unshift(new ei(e-1),null)}return Oi.of(r)}decomposeLeft(e,i){i.push(new ei(e-1),null)}decomposeRight(e,i){i.push(null,new ei(this.length-e-1))}updateHeight(e,i=0,r=!1,s){let n=i+this.length;if(s&&s.from<=i+this.length&&s.more){let o=[],a=Math.max(i,s.from),l=-1;for(s.from>i&&o.push(new ei(s.from-i-1).updateHeight(e,i));a<=n&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=s.heights[s.index++],d=0;u<0&&(d=-u,u=s.heights[s.index++]),l==-1?l=u:Math.abs(u-l)>=mc&&(l=-2);let p=new Ei(h,u,d);p.outdated=!1,o.push(p),a+=h+1}a<=n&&o.push(null,new ei(n-a).updateHeight(e,a));let c=Oi.of(o);return(l<0||Math.abs(c.height-this.height)>=mc||Math.abs(l-this.heightMetrics(e,i).perLine)>=mc)&&(to=!0),Xc(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class OT extends Oi{constructor(e,i,r){super(e.length+i+r.length,e.height+r.height,i|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,i,r,s){let n=r+this.left.height;return e<n?this.left.blockAt(e,i,r,s):this.right.blockAt(e,i,n,s+this.left.length+this.break)}lineAt(e,i,r,s,n){let o=s+this.left.height,a=n+this.left.length+this.break,l=i==bt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,i,r,s,n):this.right.lineAt(e,i,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=i==bt.ByPosNoHeight?bt.ByPosNoHeight:bt.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,s,n).join(c)}forEachLine(e,i,r,s,n,o){let a=s+this.left.height,l=n+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,i,r,s,n,o),i>=l&&this.right.forEachLine(e,i,r,a,l,o);else{let c=this.lineAt(l,bt.ByPos,r,s,n);e<c.from&&this.left.forEachLine(e,c.from-1,r,s,n,o),c.to>=e&&c.from<=i&&o(c),i>c.to&&this.right.forEachLine(c.to+1,i,r,a,l,o)}}replace(e,i,r){let s=this.left.length+this.break;if(i<s)return this.balanced(this.left.replace(e,i,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,i-s,r));let n=[];e>0&&this.decomposeLeft(e,n);let o=n.length;for(let a of r)n.push(a);if(e>0&&ig(n,o-1),i<this.length){let a=n.length;this.decomposeRight(i,n),ig(n,a)}return Oi.of(n)}decomposeLeft(e,i){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(r++,e>=r&&i.push(null)),e>r&&this.right.decomposeLeft(e-r,i)}decomposeRight(e,i){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,i);e<r&&this.left.decomposeRight(e,i),this.break&&e<s&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?Oi.of(this.break?[e,null,i]:[e,i]):(this.left=Xc(this.left,e),this.right=Xc(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,r=!1,s){let{left:n,right:o}=this,a=i+n.length+this.break,l=null;return s&&s.from<=i+n.length&&s.more?l=n=n.updateHeight(e,i,r,s):n.updateHeight(e,i,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,r,s):o.updateHeight(e,a,r),l?this.balanced(n,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ig(t,e){let i,r;t[e]==null&&(i=t[e-1])instanceof ei&&(r=t[e+1])instanceof ei&&t.splice(e-1,3,new ei(i.length+1+r.length))}const vT=5;class op{constructor(e,i){this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,i){if(this.lineStart>-1){let r=Math.min(i,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ei(r-this.pos,-1,0)),this.writtenTo=r,i>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,r){if(e<i||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,n=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=i-e;r.block?this.addBlock(new B1(o,s,r)):(o||n||s>=vT)&&this.addLineDeco(s,n,o)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ei(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let r=new ei(i-e);return this.oracle.doc.lineAt(e).to==i&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ei)return e;let i=new Ei(0,-1,0);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=i,this.writtenTo=this.pos=this.pos+r}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof Ei)&&!this.isCovered?this.nodes.push(new Ei(0,-1,0)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof Ei&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,i,r,s){let n=new op(r,e);return et.spans(i,r,s,n,0),n.finish(r)}}function bT(t,e,i){let r=new yT;return et.compare(t,e,i,r,0),r.changes}class yT{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,r,s){(e<i||r&&r.heightRelevant||s&&s.heightRelevant)&&Wn(e,i,this.changes,5)}}function _T(t,e){let i=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,n=Math.max(0,i.left),o=Math.min(s.innerWidth,i.right),a=Math.max(0,i.top),l=Math.min(s.innerHeight,i.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let d=h.getBoundingClientRect();n=Math.max(n,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(c==t.parentNode?s.innerHeight:l,d.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:n-i.left,right:Math.max(n,o)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function xT(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function ST(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Kh{constructor(e,i,r,s){this.from=e,this.to=i,this.size=r,this.displaySize=s}static same(e,i){if(e.length!=i.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],n=i[r];if(s.from!=n.from||s.to!=n.to||s.size!=n.size)return!1}return!0}draw(e,i){return Ie.replace({widget:new wT(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class wT extends Xr{constructor(e,i){super(),this.size=e,this.vertical=i}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class rg{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=sg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=gt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(ip).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new pT(i),this.stateDeco=ng(e),this.heightMap=Oi.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle.setDoc(e.doc),[new Yi(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ie.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let r=0;r<=1;r++){let s=r?i.head:i.anchor;if(!e.some(({from:n,to:o})=>s>=n&&s<=o)){let{from:n,to:o}=this.lineBlockAt(s);e.push(new El(n,o))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sg:new ap(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(aa(e,this.scaler))})}update(e,i=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=ng(this.state);let s=e.changedRanges,n=Yi.extendWithRanges(s,bT(r,this.stateDeco,e?e.changes:Zt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);tg(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n),(this.heightMap.height!=o||to)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=n.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<l.from||i.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,i));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(u1)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,r=window.getComputedStyle(i),s=this.heightOracle,n=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?gt.RTL:gt.LTR;let o=this.heightOracle.mustRefreshForWrapping(n)||this.mustMeasureContent==="refresh",a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:T,scaleY:$}=Y0(i,a);(T>.005&&Math.abs(this.scaleX-T)>.005||$>.005&&Math.abs(this.scaleY-$)>.005)&&(this.scaleX=T,this.scaleY=$,c|=16,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=U0(e.scrollDOM);let f=(this.printing?ST:_T)(i,this.paddingTop),g=f.top-this.pixelViewport.top,v=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget&&!xT(e.dom))return 0;let S=a.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:$,charWidth:R,textHeight:D}=e.docView.measureTextSize();o=$>0&&s.refresh(n,$,R,D,Math.max(5,S/R),T),o&&(e.docView.minWidth=0,c|=16)}g>0&&v>0?h=Math.max(g,v):g<0&&v<0&&(h=Math.min(g,v)),tg();for(let $ of this.viewports){let R=$.from==this.viewport.from?T:e.docView.measureVisibleLineHeights($);this.heightMap=(o?Oi.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle,[new Yi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new mT($.from,R))}to&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,n=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new El(s.lineAt(o-r*1e3,bt.ByHeight,n,0,0).from,s.lineAt(a+(1-r)*1e3,bt.ByHeight,n,0,0).to);if(i){let{head:c}=i.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=s.lineAt(c,bt.ByPos,n,0,0),d;i.y=="center"?d=(u.top+u.bottom)/2-h/2:i.y=="start"||i.y=="nearest"&&c<l.from?d=u.top:d=u.bottom-h,l=new El(s.lineAt(d-1e3/2,bt.ByHeight,n,0,0).from,s.lineAt(d+h+1e3/2,bt.ByHeight,n,0,0).to)}}return l}mapViewport(e,i){let r=i.mapPos(e.from,-1),s=i.mapPos(e.to,1);return new El(this.heightMap.lineAt(r,bt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,bt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,bt.ByPos,this.heightOracle,0,0),{bottom:n}=this.heightMap.lineAt(i,bt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-r,250)))&&(i==this.state.doc.length||n>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&n<a+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let r=[];for(let s of e)i.touchesRange(s.from,s.to)||r.push(new Kh(i.mapPos(s.from),i.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,i){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,n=s>>1,o=s<<1;if(this.defaultTextDirection!=gt.LTR&&!r)return[];let a=[],l=(h,u,d,p)=>{if(u-h<n)return;let f=this.state.selection.main,g=[f.from];f.empty||g.push(f.to);for(let b of g)if(b>h&&b<u){l(h,b-10,d,p),l(b+10,u,d,p);return}let v=CT(e,b=>b.from>=d.from&&b.to<=d.to&&Math.abs(b.from-h)<n&&Math.abs(b.to-u)<n&&!g.some(S=>b.from<S&&b.to>S));if(!v){if(u<d.to&&i&&r&&i.visibleRanges.some(k=>k.from<=u&&k.to>=u)){let k=i.moveToLineBoundary(le.cursor(u),!1,!0).head;k>h&&(u=k)}let b=this.gapSize(d,h,u,p),S=r||b<2e6?b:2e6;v=new Kh(h,u,b,S)}a.push(v)},c=h=>{if(h.length<o||h.type!=oi.Text)return;let u=kT(h.from,h.to,this.stateDeco);if(u.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,p,f;if(r){let g=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,b;if(d!=null){let S=Ll(u,d),k=((this.visibleBottom-this.visibleTop)/2+g)/h.height;v=S-k,b=S+k}else v=(this.visibleTop-h.top-g)/h.height,b=(this.visibleBottom-h.top+g)/h.height;p=Dl(u,v),f=Dl(u,b)}else{let g=u.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,b=0;if(g>2e6)for(let R of e)R.from>=h.from&&R.from<h.to&&R.size!=R.displaySize&&R.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=R.size-R.displaySize);let S=this.pixelViewport.left+b,k=this.pixelViewport.right+b,T,$;if(d!=null){let R=Ll(u,d),D=((k-S)/2+v)/g;T=R-D,$=R+D}else T=(S-v)/g,$=(k+v)/g;p=Dl(u,T),f=Dl(u,$)}p>h.from&&l(h.from,p,h,u),f<h.to&&l(f,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,i,r,s){let n=Ll(s,r)-Ll(s,i);return this.heightOracle.lineWrapping?e.height*n:s.total*this.heightOracle.charWidth*n}updateLineGaps(e){Kh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ie.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let r=[];et.spans(i,this.viewport.from,this.viewport.to,{span(n,o){r.push({from:n,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let n=0;n<r.length&&!(s&8);n++){let o=this.visibleRanges[n],a=r[n];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||aa(this.heightMap.lineAt(e,bt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(i=>i.top<=e&&i.bottom>=e)||aa(this.heightMap.lineAt(this.scaler.fromDOM(e),bt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return aa(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class El{constructor(e,i){this.from=e,this.to=i}}function kT(t,e,i){let r=[],s=t,n=0;return et.spans(i,t,e,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),n+=o-s),s=a}},20),s<e&&(r.push({from:s,to:e}),n+=e-s),{total:n,ranges:r}}function Dl({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let r=Math.floor(t*i);for(let s=0;;s++){let{from:n,to:o}=e[s],a=o-n;if(r<=a)return n+r;r-=a}}function Ll(t,e){let i=0;for(let{from:r,to:s}of t.ranges){if(e<=s){i+=e-r;break}i+=s-r}return i/t.total}function CT(t,e){for(let i of t)if(e(i))return i}const sg={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function ng(t){let e=t.facet(Ch).filter(r=>typeof r!="function"),i=t.facet(rp).filter(r=>typeof r!="function");return i.length&&e.push(et.join(i)),e}class ap{constructor(e,i,r){let s=0,n=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=i.lineAt(a,bt.ByPos,e,0,0).top,h=i.lineAt(l,bt.ByPos,e,0,0).bottom;return s+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(i.height-s);for(let a of this.viewports)a.domTop=o+(a.top-n)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}toDOM(e){for(let i=0,r=0,s=0;;i++){let n=i<this.viewports.length?this.viewports[i]:null;if(!n||e<n.top)return s+(e-r)*this.scale;if(e<=n.bottom)return n.domTop+(e-n.top);r=n.bottom,s=n.domBottom}}fromDOM(e){for(let i=0,r=0,s=0;;i++){let n=i<this.viewports.length?this.viewports[i]:null;if(!n||e<n.domTop)return r+(e-s)/this.scale;if(e<=n.domBottom)return n.top+(e-n.domTop);r=n.bottom,s=n.domBottom}}eq(e){return e instanceof ap?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,r)=>i.from==e.viewports[r].from&&i.to==e.viewports[r].to):!1}}function aa(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ar(t.from,t.length,i,r-i,Array.isArray(t._content)?t._content.map(s=>aa(s,e)):t._content)}const Il=Qe.define({combine:t=>t.join(" ")}),$d=Qe.define({combine:t=>t.indexOf(!0)>-1}),Pd=Rs.newName(),A1=Rs.newName(),R1=Rs.newName(),E1={"&light":"."+A1,"&dark":"."+R1};function Qd(t,e,i){return new Rs(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!i||!i[s])throw new RangeError(`Unsupported selector: ${s}`);return i[s]}):t+" "+r}})}const $T=Qd("."+Pd,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},E1),PT={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Jh=Te.ie&&Te.ie_version<=11;class QT{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new nQ,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let r of i)this.queue.push(r);(Te.ie&&Te.ie_version<=11||Te.ios&&e.composing)&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Te.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Te.chrome&&Te.chrome_version<126)&&(this.editContext=new MT(e),e.state.facet(Kr)&&(e.contentDOM.editContext=this.editContext.editContext)),Jh&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,r)=>i!=e[r]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Kr)?r.root.activeElement!=this.dom:!ba(this.dom,s))return;let n=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(n&&n.isWidget()&&n.widget.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(Te.ie&&Te.ie_version<=11||Te.android&&Te.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ya(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=Ma(e.root);if(!i)return!1;let r=Te.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&TT(this.view,i)||i;if(!r||this.selectionRange.eq(r))return!1;let s=ba(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&aQ(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let r=this.dom;r;)if(r.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=i)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,PT),Jh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Jh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var r;if(!this.delayedAndroidKey){let s=()=>{let n=this.delayedAndroidKey;n&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=n.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&n.force&&Vn(this.dom,n.key,n.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,r=-1,s=!1;for(let n of e){let o=this.readMutation(n);o&&(o.typeOver&&(s=!0),i==-1?{from:i,to:r}=o:(i=Math.min(o.from,i),r=Math.max(o.to,r)))}return{from:i,to:r,typeOver:s}}readChange(){let{from:e,to:i,typeOver:r}=this.processRecords(),s=this.selectionChanged&&ba(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let n=new YQ(this.view,e,i,r);return this.view.docView.domChanged={newSel:n.newSel?n.newSel.main:null},n}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let r=this.view.state,s=x1(this.view,i);return this.view.state==r&&(i.domChanged||i.newSel&&!Zc(this.view.state.selection,i.newSel.main))&&this.view.update([]),s}readMutation(e){let i=this.view.docView.tile.nearest(e.target);if(!i||i.isWidget())return null;if(i.markDirty(e.type=="attributes"),e.type=="childList"){let r=og(i,e.previousSibling||e.target.previousSibling,-1),s=og(i,e.nextSibling||e.target.nextSibling,1);return{from:r?i.posAfter(r):i.posAtStart,to:s?i.posBefore(s):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Kr)!=e.state.facet(Kr)&&(e.view.contentDOM.editContext=e.state.facet(Kr)?this.editContext.editContext:null))}destroy(){var e,i,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function og(t,e,i){for(;e;){let r=Lt.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function ag(t,e){let i=e.startContainer,r=e.startOffset,s=e.endContainer,n=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return ya(o.node,o.offset,s,n)&&([i,r,s,n]=[s,n,i,r]),{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:n}}function TT(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return ag(t,s)}let i=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),i=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),i?ag(t,i):null}class MT{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:n,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&n<this.from?a=n:l==this.to&&n>this.to&&(l=n);let h=S1(e.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!h){let d=le.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Zc(d,s)||e.dispatch({selection:d,userEvent:"select"});return}let u={from:h.from+a,to:h.toA+a,insert:ot.of(r.text.slice(h.from,h.toB).split(`
|
|
19
|
-
`))};if((Te.mac||Te.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:ot.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let d=this.to-this.from+(u.to-u.from+u.insert.length);np(e,u,le.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(i.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],n=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);n=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||n||new DOMRect,s.push(n)}i.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let n of r.getTextFormats()){let o=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);if(l<c){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(Ie.mark({attributes:{style:h}}).range(l,c))}}}e.dispatch({effects:f1.of(Ie.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)i.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Ma(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((n,o,a,l,c)=>{if(r)return;let h=c.length-(o-n);if(s&&o>=s.to)if(s.from==n&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,i+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(n+=i,o+=i,o<=this.from)this.from+=h,this.to+=h;else if(n<this.to){if(n<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(o),c.toString()),this.to+=h}i+=h}),s&&!r&&this.revertPending(e.state),!r}update(e){let i=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||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+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 i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),s=this.toContextPos(i.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ce{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 i;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(n=>r(n,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||oQ(e.parent)||document,this.viewState=new rg(e.state||tt.create(e)),e.scrollTo&&e.scrollTo.is(Bl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ln).map(s=>new qh(s));for(let s of this.plugins)s.update(this);this.observer=new QT(this),this.inputState=new KQ(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Vm(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let i=e.length==1&&e[0]instanceof Dt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,r=!1,s,n=this.state;for(let d of e){if(d.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=d.state}if(this.destroyed){this.viewState.state=n;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Q1))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=T1(n,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))&&(h=null)):this.observer.clear(),n.facet(tt.phrases)!=this.state.facet(tt.phrases))return this.setState(n);s=Ic.create(this,n,e),s.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(u&&(u=u.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;u=new Fn(p.empty?p:le.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Bl)&&(u=p.value.clip(this.state))}this.viewState.update(s,u),this.bidiCache=Wc.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),i=this.docView.update(s),this.state.facet(na)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Il)!=s.state.facet(Il)&&(this.viewState.mustMeasureContent=!0),(i||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(xd))try{d(s)}catch(p){$i(this.state,p,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!x1(this,h)&&c.force&&Vn(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 i=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new rg(e),this.plugins=e.facet(Ln).map(r=>new qh(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Vm(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(Ln),r=e.state.facet(Ln);if(i!=r){let s=[];for(let n of r){let o=i.indexOf(n);if(o<0)s.push(new qh(n));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let n of this.plugins)n.mustUpdate!=e&&n.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);i!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(r){$i(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 i=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:n,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(U0(r))n=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);n=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 h=c.map(p=>{try{return p.read(this)}catch(f){return $i(this.state,f),lg}}),u=Ic.create(this,this.state,[]),d=!1;u.flags|=l,i?i.flags|=l:i=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(h[p]!=lg)try{let f=c[p];f.write&&f.write(h[p],this)}catch(f){$i(this.state,f)}if(d&&this.docView.updateSelection(!0),!u.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 f=(n<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(n).top)-o;if(f>1||f<-1){s=s+f,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let a of this.state.facet(xd))a(i)}get themeClasses(){return Pd+" "+(this.state.facet($d)?R1:A1)+" "+this.state.facet(Il)}updateAttrs(){let e=cg(this,p1,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Kr)?"true":"false",class:"cm-content",style:`${Te.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),cg(this,ip,i);let r=this.observer.ignore(()=>{let s=Im(this.contentDOM,this.contentAttrs,i),n=Im(this.dom,this.editorAttrs,e);return s||n});return this.editorAttrs=e,this.contentAttrs=i,r}showAnnouncements(e){let i=!0;for(let r of e)for(let s of r.effects)if(s.is(Ce.announce)){i&&(this.announceDOM.textContent=""),i=!1;let n=this.announceDOM.appendChild(document.createElement("div"));n.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(na);let e=this.state.facet(Ce.cspNonce);Rs.mount(this.root,this.styleModules.concat($T).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 i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(r=>r.plugin==e)||null),i&&i.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,i,r){return Gh(this,e,Fm(this,e,i,r))}moveByGroup(e,i){return Gh(this,e,Fm(this,e,i,r=>XQ(this,e.head,r)))}visualLineSide(e,i){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),n=r[i?r.length-1:0];return le.cursor(n.side(i,s)+e.from,n.forward(!i,s)?1:-1)}moveToLineBoundary(e,i,r=!0){return ZQ(this,e,i,r)}moveVertically(e,i,r){return Gh(this,e,WQ(this,e,i,r))}domAtPos(e,i=1){return this.docView.domAtPos(e,i)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){this.readMeasured();let r=kd(this,e,i);return r&&r.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),kd(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let r=this.docView.coordsAt(e,i);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),n=this.bidiSpans(s),o=n[Tr.find(n,e-s.from,-1,i)];return Lc(r,o.dir==gt.LTR==i>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(h1)||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>BT)return i1(e.length);let i=this.textDirectionAt(e.from),r;for(let n of this.bidiCache)if(n.from==e.from&&n.dir==i&&(n.fresh||t1(n.isolates,r=Zm(this,e))))return n.order;r||(r=Zm(this,e));let s=pQ(e.text,i,r);return this.bidiCache.push(new Wc(e.from,e.to,i,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Te.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{j0(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,i={}){return Bl.of(new Fn(typeof e=="number"?le.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Bl.of(new Fn(le.cursor(r.from),"start","start",r.top-e,i,!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 Mt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Mt.define(()=>({}),{eventObservers:e})}static theme(e,i){let r=Rs.newName(),s=[Il.of(r),na.of(Qd(`.${r}`,e))];return i&&i.dark&&s.push($d.of(!0)),s}static baseTheme(e){return os.lowest(na.of(Qd("."+Pd,e,E1)))}static findFromDOM(e){var i;let r=e.querySelector(".cm-content"),s=r&&Lt.get(r)||Lt.get(e);return((i=s?.root)===null||i===void 0?void 0:i.view)||null}}Ce.styleModule=na;Ce.inputHandler=l1;Ce.clipboardInputFilter=ep;Ce.clipboardOutputFilter=tp;Ce.scrollHandler=d1;Ce.focusChangeEffect=c1;Ce.perLineTextDirection=h1;Ce.exceptionSink=a1;Ce.updateListener=xd;Ce.editable=Kr;Ce.mouseSelectionStyle=o1;Ce.dragMovesSelection=n1;Ce.clickAddsSelectionRange=s1;Ce.decorations=Ch;Ce.blockWrappers=m1;Ce.outerDecorations=rp;Ce.atomicRanges=nl;Ce.bidiIsolatedRanges=g1;Ce.scrollMargins=O1;Ce.darkTheme=$d;Ce.cspNonce=Qe.define({combine:t=>t.length?t[0]:""});Ce.contentAttributes=ip;Ce.editorAttributes=p1;Ce.lineWrapping=Ce.contentAttributes.of({class:"cm-lineWrapping"});Ce.announce=Ve.define();const BT=4096,lg={};class Wc{constructor(e,i,r,s,n,o){this.from=e,this.to=i,this.dir=r,this.isolates=s,this.fresh=n,this.order=o}static update(e,i){if(i.empty&&!e.some(n=>n.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:gt.LTR;for(let n=Math.max(0,e.length-10);n<e.length;n++){let o=e[n];o.dir==s&&!i.touchesRange(o.from,o.to)&&r.push(new Wc(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function cg(t,e,i){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let n=r[s],o=typeof n=="function"?n(t):n;o&&Gf(o,i)}return i}const AT=Te.mac?"mac":Te.windows?"win":Te.linux?"linux":"key";function RT(t,e){const i=t.split(/-(?!$)/);let r=i[i.length-1];r=="Space"&&(r=" ");let s,n,o,a;for(let l=0;l<i.length-1;++l){const c=i[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))n=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:n=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),n&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Nl(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i!==!1&&e.shiftKey&&(t="Shift-"+t),t}const ET=os.default(Ce.domEventHandlers({keydown(t,e){return L1(D1(e.state),t,e,"editor")}})),ol=Qe.define({enables:ET}),hg=new WeakMap;function D1(t){let e=t.facet(ol),i=hg.get(e);return i||hg.set(e,i=IT(e.reduce((r,s)=>r.concat(s),[]))),i}function DT(t,e,i){return L1(D1(t.state),e,t,i)}let ks=null;const LT=4e3;function IT(t,e=AT){let i=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")},n=(o,a,l,c,h)=>{var u,d;let p=i[o]||(i[o]=Object.create(null)),f=a.split(/ (?!$)/).map(b=>RT(b,e));for(let b=1;b<f.length;b++){let S=f.slice(0,b).join(" ");s(S,!0),p[S]||(p[S]={preventDefault:!0,stopPropagation:!1,run:[k=>{let T=ks={view:k,prefix:S,scope:o};return setTimeout(()=>{ks==T&&(ks=null)},LT),!0}]})}let g=f.join(" ");s(g,!1);let v=p[g]||(p[g]={preventDefault:!1,stopPropagation:!1,run:((d=(u=p._any)===null||u===void 0?void 0:u.run)===null||d===void 0?void 0:d.slice())||[]});l&&v.run.push(l),c&&(v.preventDefault=!0),h&&(v.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=i[c]||(i[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let d in h)h[d].run.push(p=>u(p,Td))}let l=o[e]||o.key;if(l)for(let c of a)n(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&n(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return i}let Td=null;function L1(t,e,i,r){Td=e;let s=GP(e),n=wi(s,0),o=Pr(n)==s.length&&s!=" ",a="",l=!1,c=!1,h=!1;ks&&ks.view==i&&ks.scope==r&&(a=ks.prefix+" ",k1.indexOf(e.keyCode)<0&&(c=!0,ks=null));let u=new Set,d=v=>{if(v){for(let b of v.run)if(!u.has(b)&&(u.add(b),b(i)))return v.stopPropagation&&(h=!0),!0;v.preventDefault&&(v.stopPropagation&&(h=!0),c=!0)}return!1},p=t[r],f,g;return p&&(d(p[a+Nl(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Te.windows&&e.ctrlKey&&e.altKey)&&!(Te.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(f=Es[e.keyCode])&&f!=s?(d(p[a+Nl(f,e,!0)])||e.shiftKey&&(g=Qa[e.keyCode])!=s&&g!=f&&d(p[a+Nl(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Nl(s,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),Td=null,l}class al{constructor(e,i,r,s,n){this.className=e,this.left=i,this.top=r,this.width=s,this.height=n}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.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,i,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let n=I1(e);return[new al(i,s.left-n.left,s.top-n.top,null,s.bottom-s.top)]}else return NT(e,i,r)}}function I1(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==gt.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function ug(t,e,i,r){let s=t.coordsAtPos(e,i*2);if(!s)return r;let n=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:n.left+1,y:o}),l=t.posAtCoords({x:n.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 NT(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let r=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),n=t.textDirection==gt.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=I1(t),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),p=wd(t,r,1),f=wd(t,s,-1),g=p.type==oi.Text?p:null,v=f.type==oi.Text?f:null;if(g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=ug(t,r,1,g)),v&&(t.lineWrapping||f.widgetLineBreaks)&&(v=ug(t,s,-1,v)),g&&v&&g.from==v.from&&g.to==v.to)return S(k(i.from,i.to,g));{let $=g?k(i.from,null,g):T(p,!1),R=v?k(null,i.to,v):T(f,!0),D=[];return(g||p).to<(v||f).from-(g&&v?1:0)||p.widgetLineBreaks>1&&$.bottom+t.defaultLineHeight/2<R.top?D.push(b(u,$.bottom,d,R.top)):$.bottom<R.top&&t.elementAtHeight(($.bottom+R.top)/2).type==oi.Text&&($.bottom=R.top=($.bottom+R.top)/2),S($).concat(D).concat(S(R))}function b($,R,D,U){return new al(e,$-l.left,R-l.top,Math.max(0,D-$),U-R)}function S({top:$,bottom:R,horizontal:D}){let U=[];for(let ce=0;ce<D.length;ce+=2)U.push(b(D[ce],$,D[ce+1],R));return U}function k($,R,D){let U=1e9,ce=-1e9,he=[];function W(V,N,K,te,G){let be=t.coordsAtPos(V,V==D.to?-2:2),ie=t.coordsAtPos(K,K==D.from?2:-2);!be||!ie||(U=Math.min(be.top,ie.top,U),ce=Math.max(be.bottom,ie.bottom,ce),G==gt.LTR?he.push(n&&N?u:be.left,n&&te?d:ie.right):he.push(!n&&te?u:ie.left,!n&&N?d:be.right))}let M=$??D.from,x=R??D.to;for(let V of t.visibleRanges)if(V.to>M&&V.from<x)for(let N=Math.max(V.from,M),K=Math.min(V.to,x);;){let te=t.state.doc.lineAt(N);for(let G of t.bidiSpans(te)){let be=G.from+te.from,ie=G.to+te.from;if(be>=K)break;ie>N&&W(Math.max(be,N),$==null&&be<=M,Math.min(ie,K),R==null&&ie>=x,G.dir)}if(N=te.to+1,N>=K)break}return he.length==0&&W(M,$==null,x,R==null,t.textDirection),{top:U,bottom:ce,horizontal:he}}function T($,R){let D=a.top+(R?$.top:$.bottom);return{top:D,bottom:D,horizontal:[]}}}function zT(t,e){return t.constructor==e.constructor&&t.eq(e)}class ZT{constructor(e,i){this.view=e,this.layer=i,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"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,e)}update(e){e.startState.facet(gc)!=e.state.facet(gc)&&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 i=0,r=e.facet(gc);for(;i<r.length&&r[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:i}=this.view;(e!=this.scaleX||i!=this.scaleY)&&(this.scaleX=e,this.scaleY=i,this.dom.style.transform=`scale(${1/e}, ${1/i})`)}draw(e){if(e.length!=this.drawn.length||e.some((i,r)=>!zT(i,this.drawn[r]))){let i=this.dom.firstChild,r=0;for(let s of e)s.update&&i&&s.constructor&&this.drawn[r].constructor&&s.update(i,this.drawn[r])?(i=i.nextSibling,r++):this.dom.insertBefore(s.draw(),i);for(;i;){let s=i.nextSibling;i.remove(),i=s}this.drawn=e,Te.safari&&Te.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 gc=Qe.define();function N1(t){return[Mt.define(e=>new ZT(e,t)),gc.of(t)]}const Aa=Qe.define({combine(t){return Zr(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function XT(t={}){return[Aa.of(t),WT,VT,FT,u1.of(!0)]}function z1(t){return t.startState.facet(Aa)!=t.state.facet(Aa)}const WT=N1({above:!0,markers(t){let{state:e}=t,i=e.facet(Aa),r=[];for(let s of e.selection.ranges){let n=s==e.selection.main;if(s.empty||i.drawRangeCursor){let o=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:le.cursor(s.head,s.head>s.anchor?-1:1);for(let l of al.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 i=z1(t);return i&&dg(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){dg(e.state,t)},class:"cm-cursorLayer"});function dg(t,e){e.style.animationDuration=t.facet(Aa).cursorBlinkRate+"ms"}const VT=N1({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:al.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||z1(t)},class:"cm-selectionLayer"}),FT=os.highest(Ce.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"}}}})),Z1=Ve.define({map(t,e){return t==null?null:e.mapPos(t)}}),la=Kt.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,r)=>r.is(Z1)?r.value:i,t)}}),HT=Mt.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 i=t.state.field(la);i==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(la)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(la),i=e!=null&&t.coordsAtPos(e);if(!i)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:i.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(la)!=t&&this.view.dispatch({effects:Z1.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 qT(){return[la,HT]}function fg(t,e,i,r,s){e.lastIndex=0;for(let n=t.iterRange(i,r),o=i,a;!n.next().done;o+=n.value.length)if(!n.lineBreak)for(;a=e.exec(n.value);)s(o+a.index,a)}function YT(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let r=[];for(let{from:s,to:n}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),n=Math.min(t.state.doc.lineAt(n).to,n+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=n:r.push({from:s,to:n});return r}class jT{constructor(e){const{regexp:i,decoration:r,decorate:s,boundary:n,maxLength:o=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,s)this.addMatch=(a,l,c,h)=>s(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=n,this.maxLength=o}createDeco(e){let i=new is,r=i.add.bind(i);for(let{from:s,to:n}of YT(e,this.maxLength))fg(e.state.doc,this.regexp,s,n,(o,a)=>this.addMatch(a,e,o,r));return i.finish()}updateDeco(e,i){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((n,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,i.map(e.changes),r,s):i}updateRange(e,i,r,s){for(let n of e.visibleRanges){let o=Math.max(n.from,r),a=Math.min(n.to,s);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(n.from,l.from),u=Math.min(n.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let d=[],p,f=(g,v,b)=>d.push(b.range(g,v));if(l==c)for(this.regexp.lastIndex=h-l.from;(p=this.regexp.exec(l.text))&&p.index<u-l.from;)this.addMatch(p,e,p.index+l.from,f);else fg(e.state.doc,this.regexp,h,u,(g,v)=>this.addMatch(v,e,g,f));i=i.update({filterFrom:h,filterTo:u,filter:(g,v)=>g<h||v>u,add:d})}}return i}}const Md=/x/.unicode!=null?"gu":"g",UT=new RegExp(`[\0-\b
|
|
20
|
-
--\u2028\u2029\uFEFF-]`,Md),GT={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 eu=null;function KT(){var t;if(eu==null&&typeof document<"u"&&document.body){let e=document.body.style;eu=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return eu||!1}const Oc=Qe.define({combine(t){let e=Zr(t,{render:null,specialChars:UT,addSpecialChars:null});return(e.replaceTabs=!KT())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Md)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Md)),e}});function JT(t={}){return[Oc.of(t),e3()]}let pg=null;function e3(){return pg||(pg=Mt.fromClass(class{constructor(t){this.view=t,this.decorations=Ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Oc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new jT({regexp:t.specialChars,decoration:(e,i,r)=>{let{doc:s}=i.state,n=wi(e[0],0);if(n==9){let o=s.lineAt(r),a=i.state.tabSize,l=cr(o.text,a,r-o.from);return Ie.replace({widget:new s3((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[n]||(this.decorationCache[n]=Ie.replace({widget:new r3(t,n)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Oc);t.startState.facet(Oc)!=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 t3="•";function i3(t){return t>=32?t3:t==10?"":String.fromCharCode(9216+t)}class r3 extends Xr{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=i3(this.code),r=e.state.phrase("Control character")+" "+(GT[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,i);if(s)return s;let n=document.createElement("span");return n.textContent=i,n.title=r,n.setAttribute("aria-label",r),n.className="cm-specialChar",n}ignoreEvent(){return!1}}class s3 extends Xr{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 n3(){return a3}const o3=Ie.line({class:"cm-activeLine"}),a3=Mt.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,i=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(i.push(o3.range(s.from)),e=s.from)}return Ie.set(i)}},{decorations:t=>t.decorations}),Bd=2e3;function l3(t,e,i){let r=Math.min(e.line,i.line),s=Math.max(e.line,i.line),n=[];if(e.off>Bd||i.off>Bd||e.col<0||i.col<0){let o=Math.min(e.off,i.off),a=Math.max(e.off,i.off);for(let l=r;l<=s;l++){let c=t.doc.line(l);c.length<=a&&n.push(le.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,i.col),a=Math.max(e.col,i.col);for(let l=r;l<=s;l++){let c=t.doc.line(l),h=ud(c.text,o,t.tabSize,!0);if(h<0)n.push(le.cursor(c.to));else{let u=ud(c.text,a,t.tabSize);n.push(le.range(c.from+h,c.from+u))}}}return n}function c3(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function mg(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(i),s=i-r.from,n=s>Bd?-1:s==r.length?c3(t,e.clientX):cr(r.text,t.state.tabSize,i-r.from);return{line:r.number,col:n,off:s}}function h3(t,e){let i=mg(t,e),r=t.state.selection;return i?{update(s){if(s.docChanged){let n=s.changes.mapPos(s.startState.doc.line(i.line).from),o=s.state.doc.lineAt(n);i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},r=r.map(s.changes)}},get(s,n,o){let a=mg(t,s);if(!a)return r;let l=l3(t.state,i,a);return l.length?o?le.create(l.concat(r.ranges)):le.create(l):r}}:null}function u3(t){let e=(i=>i.altKey&&i.button==0);return Ce.mouseSelectionStyle.of((i,r)=>e(r)?h3(i,r):null)}const d3={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},f3={style:"cursor: crosshair"};function p3(t={}){let[e,i]=d3[t.key||"Alt"],r=Mt.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||i(s))},keyup(s){(s.keyCode==e||!i(s))&&this.set(!1)},mousemove(s){this.set(i(s))}}});return[r,Ce.contentAttributes.of(s=>{var n;return!((n=s.plugin(r))===null||n===void 0)&&n.isDown?f3:null})]}const zl="-10000px";class X1{constructor(e,i,r,s){this.facet=i,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(i),this.tooltips=this.input.filter(o=>o);let n=null;this.tooltipViews=this.tooltips.map(o=>n=r(o,n))}update(e,i){var r;let s=e.state.facet(this.facet),n=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=i?[]:null;for(let l=0;l<n.length;l++){let c=n[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let d=this.tooltips[u];d&&d.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=i[h]),u.update&&u.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 i&&(a.forEach((l,c)=>i[c]=l),i.length=a.length),this.input=s,this.tooltips=n,this.tooltipViews=o,!0}}function m3(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const tu=Qe.define({combine:t=>{var e,i,r;return{position:Te.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((i=t.find(s=>s.parent))===null||i===void 0?void 0:i.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||m3}}}),gg=new WeakMap,lp=Mt.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(tu);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 X1(t,cp,(i,r)=>this.createTooltip(i,r),i=>{this.resizeObserver&&this.resizeObserver.unobserve(i.dom),i.dom.remove()}),this.above=this.manager.tooltips.map(i=>!!i.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.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 i=e||t.geometryChanged,r=t.state.facet(tu);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;i=!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);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),r=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",i.dom.appendChild(s)}return i.dom.style.position=this.position,i.dom.style.top=zl,i.dom.style.left="0px",this.container.insertBefore(i.dom,r),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;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(),(i=this.intersectionObserver)===null||i===void 0||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Te.safari){let o=n.getBoundingClientRect();i=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else i=!!n.offsetParent&&n.offsetParent!=this.container.ownerDocument.body}if(i||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=sp(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((n,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(tu).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}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:i,space:r,scaleX:s,scaleY:n}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=t.pos[a],d=t.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(i.top,r.top)||u.top>=Math.min(i.bottom,r.bottom)||u.right<Math.max(i.left,r.left)-.1||u.left>Math.min(i.right,r.right)+.1)){h.style.top=zl;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=p?7:0,g=d.right-d.left,v=(e=gg.get(c))!==null&&e!==void 0?e:d.bottom-d.top,b=c.offset||O3,S=this.view.textDirection==gt.LTR,k=d.width>r.right-r.left?S?r.left:r.right-d.width:S?Math.max(r.left,Math.min(u.left-(p?14:0)+b.x,r.right-g)):Math.min(Math.max(r.left,u.left-g+(p?14:0)-b.x),r.right-g),T=this.above[a];!l.strictSide&&(T?u.top-v-f-b.y<r.top:u.bottom+v+f+b.y>r.bottom)&&T==r.bottom-u.bottom>u.top-r.top&&(T=this.above[a]=!T);let $=(T?u.top-r.top:r.bottom-u.bottom)-f;if($<v&&c.resize!==!1){if($<this.view.defaultLineHeight){h.style.top=zl;continue}gg.set(c,v),h.style.height=(v=$)/n+"px"}else h.style.height&&(h.style.height="");let R=T?u.top-v-f-b.y:u.bottom+f+b.y,D=k+g;if(c.overlap!==!0)for(let U of o)U.left<D&&U.right>k&&U.top<R+v&&U.bottom>R&&(R=T?U.top-v-2-f:U.bottom+f+2);if(this.position=="absolute"?(h.style.top=(R-t.parent.top)/n+"px",Og(h,(k-t.parent.left)/s)):(h.style.top=R/n+"px",Og(h,k/s)),p){let U=u.left+(S?b.x:-b.x)-(k+14-7);p.style.left=U/s+"px"}c.overlap!==!0&&o.push({left:k,top:R,right:D,bottom:R+v}),h.classList.toggle("cm-tooltip-above",T),h.classList.toggle("cm-tooltip-below",!T),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=zl}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Og(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const g3=Ce.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"}}}),O3={x:0,y:0},cp=Qe.define({enables:[lp,g3]}),Vc=Qe.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])});class Th{static create(e){return new Th(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new X1(e,Vc,(i,r)=>this.createHostedView(i,r),i=>i.dom.remove())}createHostedView(e,i){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,i?i.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let i of this.manager.tooltipViews)i.mount&&i.mount(e);this.mounted=!0}positioned(e){for(let i of this.manager.tooltipViews)i.positioned&&i.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let i of this.manager.tooltipViews)(e=i.destroy)===null||e===void 0||e.call(i)}passProp(e){let i;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(i===void 0)i=s;else if(i!==s)return}}return i}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 v3=cp.compute([Vc],t=>{let e=t.facet(Vc);return e.length===0?null:{pos:Math.min(...e.map(i=>i.pos)),end:Math.max(...e.map(i=>{var r;return(r=i.end)!==null&&r!==void 0?r:i.pos})),create:Th.create,above:e[0].above,arrow:e.some(i=>i.arrow)}});class b3{constructor(e,i,r,s,n){this.view=e,this.source=i,this.field=r,this.setHover=s,this.hoverTime=n,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:i}=this,r=e.docView.tile.nearest(i.target);if(!r)return;let s,n=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(i),s==null)return;let a=e.coordsAtPos(s);if(!a||i.y<a.top||i.y>a.bottom||i.x<a.left-e.defaultCharacterWidth||i.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),c=l&&l.dir==gt.RTL?-1:1;n=i.x<a.left?-c:c}let o=this.source(e,s,n);if(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=>$i(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(lp),i=e?e.manager.tooltips.findIndex(r=>r.create==Th.create):-1;return i>-1?e.manager.tooltipViews[i]:null}mousemove(e){var i,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:n}=this;if(s.length&&n&&!y3(n.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(i=s[0])===null||i===void 0?void 0:i.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!_3(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:i}=this;if(i.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 i=r=>{e.removeEventListener("mouseleave",i),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",i)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Zl=4;function y3(t,e){let{left:i,right:r,top:s,bottom:n}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),n=Math.max(a.bottom,n)}return e.clientX>=i-Zl&&e.clientX<=r+Zl&&e.clientY>=s-Zl&&e.clientY<=n+Zl}function _3(t,e,i,r,s,n){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<=i}function x3(t,e={}){let i=Ve.define(),r=Kt.define({create(){return[]},update(s,n){if(s.length&&(e.hideOnChange&&(n.docChanged||n.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(n,o))),n.docChanged)){let o=[];for(let a of s){let l=n.changes.mapPos(a.pos,-1,ii.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=n.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of n.effects)o.is(i)&&(s=o.value),o.is(S3)&&(s=[]);return s},provide:s=>Vc.from(s)});return{active:r,extension:[r,Mt.define(s=>new b3(s,t,r,i,e.hoverTime||300)),v3]}}function W1(t,e){let i=t.plugin(lp);if(!i)return null;let r=i.manager.tooltips.indexOf(e);return r<0?null:i.manager.tooltipViews[r]}const S3=Ve.define(),vg=Qe.define({combine(t){let e,i;for(let r of t)e=e||r.topContainer,i=i||r.bottomContainer;return{topContainer:e,bottomContainer:i}}});function hp(t,e){let i=t.plugin(V1),r=i?i.specs.indexOf(e):-1;return r>-1?i.panels[r]:null}const V1=Mt.fromClass(class{constructor(t){this.input=t.state.facet(Ra),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(vg);this.top=new Xl(t,!0,e.topContainer),this.bottom=new Xl(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(i=>i.top)),this.bottom.sync(this.panels.filter(i=>!i.top));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(vg);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Xl(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Xl(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ra);if(i!=this.input){let r=i.filter(l=>l),s=[],n=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(t.view),a.push(h)):(h=this.panels[c],h.update&&h.update(t)),s.push(h),(h.top?n:o).push(h)}this.specs=r,this.panels=s,this.top.sync(n),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=>Ce.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class Xl{constructor(e,i,r){this.view=e,this.top=i,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let i of this.panels)i.destroy&&e.indexOf(i)<0&&i.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 i=this.container||this.view.dom;i.insertBefore(this.dom,this.top?i.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=bg(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=bg(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 bg(t){let e=t.nextSibling;return t.remove(),e}const Ra=Qe.define({enables:V1});function w3(t,e){let i,r=new Promise(o=>i=o),s=o=>k3(o,e,i);t.state.field(iu,!1)?t.dispatch({effects:F1.of(s)}):t.dispatch({effects:Ve.appendConfig.of(iu.init(()=>[s]))});let n=H1.of(s);return{close:n,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(iu).indexOf(s)>-1&&t.dispatch({effects:n})}),o))}}const iu=Kt.define({create(){return[]},update(t,e){for(let i of e.effects)i.is(F1)?t=[i.value].concat(t):i.is(H1)&&(t=t.filter(r=>r!=i.value));return t},provide:t=>Ra.computeN([t],e=>e.field(t))}),F1=Ve.define(),H1=Ve.define();function k3(t,e,i){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=dt("form"),e.input){let a=dt("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(dt("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(dt("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 n=dt("div",r,dt("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(n.className=e.class),n.classList.add("cm-dialog");function o(a){n.contains(n.ownerDocument.activeElement)&&t.focus(),i(a)}return{dom:n,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 ss extends As{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ss.prototype.elementClass="";ss.prototype.toDOM=void 0;ss.prototype.mapMode=ii.TrackBefore;ss.prototype.startSide=ss.prototype.endSide=-1;ss.prototype.point=!0;const vc=Qe.define(),C3=Qe.define(),$3={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>et.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},xa=Qe.define();function P3(t){return[q1(),xa.of({...$3,...t})]}const yg=Qe.define({combine:t=>t.some(e=>e)});function q1(t){return[Q3]}const Q3=Mt.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(xa).map(e=>new xg(t,e)),this.fixed=!t.state.facet(yg);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,i=t.view.viewport,r=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(r<(i.to-i.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(yg)!=!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 i=et.iter(this.view.state.facet(vc),this.view.viewport.from),r=[],s=this.gutters.map(n=>new T3(n,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(n.type)){let o=!0;for(let a of n.type)if(a.type==oi.Text&&o){Ad(i,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(n.type==oi.Text){Ad(i,r,n.from);for(let o of s)o.line(this.view,n,r)}else if(n.widget)for(let o of s)o.widget(this.view,n);for(let n of s)n.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(xa),i=t.state.facet(xa),r=t.docChanged||t.heightChanged||t.viewportChanged||!et.eq(t.startState.facet(vc),t.state.facet(vc),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let n of i){let o=e.indexOf(n);o<0?s.push(new xg(this.view,n)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let n of this.gutters)n.dom.remove(),s.indexOf(n)<0&&n.destroy();for(let n of s)n.config.side=="after"?this.getDOMAfter().appendChild(n.dom):this.dom.appendChild(n.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=>Ce.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||i.gutters.length==0||!i.fixed)return null;let r=i.dom.offsetWidth*e.scaleX,s=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==gt.LTR?{left:r,right:s}:{right:r,left:s}})});function _g(t){return Array.isArray(t)?t:[t]}function Ad(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class T3{constructor(e,i,r){this.gutter=e,this.height=r,this.i=0,this.cursor=et.iter(e.markers,i.from)}addElement(e,i,r){let{gutter:s}=this,n=(i.top-this.height)/e.scaleY,o=i.height/e.scaleY;if(this.i==s.elements.length){let a=new Y1(e,o,n,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,n,r);this.height=i.bottom,this.i++}line(e,i,r){let s=[];Ad(this.cursor,s,i.from),r.length&&(s=s.concat(r));let n=this.gutter.config.lineMarker(e,i,s);n&&s.unshift(n);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,i,s)}widget(e,i){let r=this.gutter.config.widgetMarker(e,i.widget,i),s=r?[r]:null;for(let n of e.state.facet(C3)){let o=n(e,i.widget,i);o&&(s||(s=[])).push(o)}s&&this.addElement(e,i,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}}class xg{constructor(e,i){this.view=e,this.config=i,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 i.domEventHandlers)this.dom.addEventListener(r,s=>{let n=s.target,o;if(n!=this.dom&&this.dom.contains(n)){for(;n.parentNode!=this.dom;)n=n.parentNode;let l=n.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);i.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=_g(i.markers(e)),i.initialSpacer&&(this.spacer=new Y1(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let i=this.markers;if(this.markers=_g(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!et.eq(this.markers,i,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Y1{constructor(e,i,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,r,s)}update(e,i,r,s){this.height!=i&&(this.height=i,this.dom.style.height=i+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),M3(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,i){let r="cm-gutterElement",s=this.dom.firstChild;for(let n=0,o=0;;){let a=o,l=n<i.length?i[n++]:null,c=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(s);let u=s.nextSibling;s.remove(),s=u}}if(!l)break;l.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),c&&o++}this.dom.className=r,this.markers=i}destroy(){this.setMarkers(null,[])}}function M3(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}const B3=Qe.define(),A3=Qe.define(),In=Qe.define({combine(t){return Zr(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let r=Object.assign({},e);for(let s in i){let n=r[s],o=i[s];r[s]=n?(a,l,c)=>n(a,l,c)||o(a,l,c):o}return r}})}});class ru extends ss{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function su(t,e){return t.state.facet(In).formatNumber(e,t.state)}const R3=xa.compute([In],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(B3)},lineMarker(e,i,r){return r.some(s=>s.toDOM)?null:new ru(su(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,r)=>{for(let s of e.state.facet(A3)){let n=s(e,i,r);if(n)return n}return null},lineMarkerChange:e=>e.startState.facet(In)!=e.state.facet(In),initialSpacer(e){return new ru(su(e,Sg(e.state.doc.lines)))},updateSpacer(e,i){let r=su(i.view,Sg(i.view.state.doc.lines));return r==e.number?e:new ru(r)},domEventHandlers:t.facet(In).domEventHandlers,side:"before"}));function E3(t={}){return[In.of(t),q1(),R3]}function Sg(t){let e=9;for(;e<t;)e=e*10+9;return e}const D3=new class extends ss{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},L3=vc.compute(["selection"],t=>{let e=[],i=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>i&&(i=s,e.push(D3.range(s)))}return et.of(e)});function I3(){return L3}const j1=1024;let N3=0;class ji{constructor(e,i){this.from=e,this.to=i}}class Fe{constructor(e={}){this.id=N3++,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=Xt.match(e)),i=>{let r=e(i);return r===void 0?null:[this,r]}}}Fe.closedBy=new Fe({deserialize:t=>t.split(" ")});Fe.openedBy=new Fe({deserialize:t=>t.split(" ")});Fe.group=new Fe({deserialize:t=>t.split(" ")});Fe.isolate=new Fe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Fe.contextHash=new Fe({perNode:!0});Fe.lookAhead=new Fe({perNode:!0});Fe.mounted=new Fe({perNode:!0});class Hn{constructor(e,i,r,s=!1){this.tree=e,this.overlay=i,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[Fe.mounted.id]}}const z3=Object.create(null);class Xt{constructor(e,i,r,s=0){this.name=e,this.props=i,this.id=r,this.flags=s}static define(e){let i=e.props&&e.props.length?Object.create(null):z3,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Xt(e.name||"",i,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(s)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[n[0].id]=n[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 i=this.prop(Fe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let r in e)for(let s of r.split(" "))i[s]=e[r];return r=>{for(let s=r.prop(Fe.group),n=-1;n<(s?s.length:0);n++){let o=i[n<0?r.name:s[n]];if(o)return o}}}}Xt.none=new Xt("",Object.create(null),0,8);class ll{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let r of this.types){let s=null;for(let n of e){let o=n(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}}i.push(s?new Xt(r.name,s,r.id,r.flags):r)}return new ll(i)}}const Wl=new WeakMap,wg=new WeakMap;var lt;(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"})(lt||(lt={}));class at{constructor(e,i,r,s,n){if(this.type=e,this.children=i,this.positions=r,this.length=s,this.props=null,n&&n.length){this.props=Object.create(null);for(let[o,a]of n)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Hn.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let r of this.children){let s=r.toString();s&&(i&&(i+=","),i+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new Fc(this.topNode,e)}cursorAt(e,i=0,r=0){let s=Wl.get(this)||this.topNode,n=new Fc(s);return n.moveTo(e,i),Wl.set(this,n._tree),n}get topNode(){return new di(this,0,0,null)}resolve(e,i=0){let r=Ea(Wl.get(this)||this.topNode,e,i,!1);return Wl.set(this,r),r}resolveInner(e,i=0){let r=Ea(wg.get(this)||this.topNode,e,i,!0);return wg.set(this,r),r}resolveStack(e,i=0){return W3(this,e,i)}iterate(e){let{enter:i,leave:r,from:s=0,to:n=this.length}=e,o=e.mode||0,a=(o<.IncludeAnonymous)>0;for(let l=this.cursor(o|lt.IncludeAnonymous);;){let c=!1;if(l.from<=n&&l.to>=s&&(!a&&l.type.isAnonymous||i(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 i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:fp(Xt.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,s)=>new at(this.type,i,r,s,this.propValues),e.makeTree||((i,r,s)=>new at(Xt.none,i,r,s)))}static build(e){return V3(e)}}at.empty=new at(Xt.none,[],[],0);class up{constructor(e,i){this.buffer=e,this.index=i}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 up(this.buffer,this.index)}}class Ls{constructor(e,i,r){this.buffer=e,this.length=i,this.set=r}get type(){return Xt.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],r=this.buffer[e+3],s=this.set.types[i],n=s.name;if(/\W/.test(n)&&!s.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return n+"("+o.join(",")+")"}findChild(e,i,r,s,n){let{buffer:o}=this,a=-1;for(let l=e;l!=i&&!(U1(n,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,i,r){let s=this.buffer,n=new Uint16Array(i-e),o=0;for(let a=e,l=0;a<i;){n[l++]=s[a++],n[l++]=s[a++]-r;let c=n[l++]=s[a++]-r;n[l++]=s[a++]-e,o=Math.max(o,c)}return new Ls(n,o,this.set)}}function U1(t,e,i,r){switch(t){case-2:return i<e;case-1:return r>=e&&i<e;case 0:return i<e&&r>e;case 1:return i<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ea(t,e,i,r){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof di&&t.index<0?null:t.parent;if(!o)return t;t=o}let n=r?0:lt.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof di&&o.index<0&&((s=a.enter(e,i,n))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,i,n);if(!o)return t;t=o}}class G1{cursor(e=0){return new Fc(this,e)}getChild(e,i=null,r=null){let s=kg(this,e,i,r);return s.length?s[0]:null}getChildren(e,i=null,r=null){return kg(this,e,i,r)}resolve(e,i=0){return Ea(this,e,i,!1)}resolveInner(e,i=0){return Ea(this,e,i,!0)}matchContext(e){return Rd(this.parent,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),r=this;for(;i;){let s=i.lastChild;if(!s||s.to!=i.to)break;s.type.isError&&s.from==s.to?(r=i,i=s.prevSibling):i=s}return r}get node(){return this}get next(){return this.parent}}class di extends G1{constructor(e,i,r,s){super(),this._tree=e,this.from=i,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,i,r,s,n=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=i>0?a.length:-1;e!=c;e+=i){let h=a[e],u=l[e]+o.from,d;if(!(!(n<.EnterBracketed&&h instanceof at&&(d=Hn.get(h))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+h.length)&&!U1(s,r,u,u+h.length))){if(h instanceof Ls){if(n<.ExcludeBuffers)continue;let p=h.findChild(0,h.buffer.length,i,r-u,s);if(p>-1)return new Mr(new Z3(o,h,e,u),null,p)}else if(n<.IncludeAnonymous||!h.type.isAnonymous||dp(h)){let p;if(!(n<.IgnoreMounts)&&(p=Hn.get(h))&&!p.overlay)return new di(p.tree,u,e,o);let f=new di(h,u,e,o);return n<.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(i<0?h.children.length-1:0,i,r,s,n)}}}if(n<.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+i:e=i<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,i,r=0){let s;if(!(r<.IgnoreOverlays)&&(s=Hn.get(this._tree))&&s.overlay){let n=e-this.from,o=r<.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((i>0||o?a<=n:a<n)&&(i<0||o?l>=n:l>n))return new di(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,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 kg(t,e,i,r){let s=t.cursor(),n=[];if(!s.firstChild())return n;if(i!=null){for(let o=!1;!o;)if(o=s.type.is(i),!s.nextSibling())return n}for(;;){if(r!=null&&s.type.is(r))return n;if(s.type.is(e)&&n.push(s.node),!s.nextSibling())return r==null?n:[]}}function Rd(t,e,i=e.length-1){for(let r=t;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}class Z3{constructor(e,i,r,s){this.parent=e,this.buffer=i,this.index=r,this.start=s}}class Mr extends G1{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,i,r){super(),this.context=e,this._parent=i,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,i,r){let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],e,i-this.context.start,r);return n<0?null:new Mr(this.context,this,n)}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,i,r=0){if(r<.ExcludeBuffers)return null;let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return n<0?null:new Mr(this.context,this,n)}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,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mr(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new Mr(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:r}=this.context,s=this.index+4,n=r.buffer[this.index+3];if(n>s){let o=r.buffer[this.index+1];e.push(r.slice(s,n,o)),i.push(0)}return new at(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function K1(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;n<t.length;n++){let o=t[n];(o.from>i.from||o.to<i.to)&&(i=o,e=n)}let r=i instanceof di&&i.index<0?null:i.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new X3(s,i)}class X3{constructor(e,i){this.heads=e,this.node=i}get next(){return K1(this.heads)}}function W3(t,e,i){let r=t.resolveInner(e,i),s=null;for(let n=r instanceof di?r:r.context.parent;n;n=n.parent)if(n.index<0){let o=n.parent;(s||(s=[r])).push(o.resolve(e,i)),n=o}else{let o=Hn.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new di(o.tree,o.overlay[0].from+n.from,-1,n);(s||(s=[r])).push(Ea(a,e,i,!1))}}return s?K1(s):r}class Fc{get name(){return this.type.name}constructor(e,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~lt.EnterBracketed,e instanceof di)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,i){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=i||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 di?(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,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,r,this.mode));let{buffer:s}=this.buffer,n=s.findChild(this.index+4,s.buffer[this.index+3],e,i-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}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,i,r=this.mode){return this.buffer?r<.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode<.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode<.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:i}=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(i.findChild(s,this.index,-1,0,4))}else{let s=i.buffer[this.index+3];if(s<(r<0?i.buffer.length:i.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 i,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(s.buffer.buffer[n+3]<this.index)return!1;({index:i,parent:r}=s)}else({index:i,_parent:r}=this._tree);for(;r;{index:i,_parent:r}=r)if(i>-1)for(let n=i+e,o=e<0?-1:r._tree.children.length;n!=o;n+=e){let a=r._tree.children[n];if(this.mode<.IncludeAnonymous||a instanceof Ls||!a.type.isAnonymous||dp(a))return!1}return!0}move(e,i){if(i&&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,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,n=this.stack.length;n>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;i=o,r=n+1;break e}s=this.stack[--n]}for(let s=r;s<this.stack.length;s++)i=new Mr(this.buffer,i,this.stack[s]);return this.bufferNode=new Mr(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){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&&i&&i(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return Rd(this.node.parent,e);let{buffer:i}=this.buffer,{types:r}=i.set;for(let s=e.length-1,n=this.stack.length-1;s>=0;n--){if(n<0)return Rd(this._tree,e,s);let o=r[i.buffer[this.stack[n]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function dp(t){return t.children.some(e=>e instanceof Ls||!e.type.isAnonymous||dp(e))}function V3(t){var e;let{buffer:i,nodeSet:r,maxBufferLength:s=j1,reused:n=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(i)?new up(i,i.length):i,l=r.types,c=0,h=0;function u($,R,D,U,ce,he){let{id:W,start:M,end:x,size:V}=a,N=h,K=c;if(V<0)if(a.next(),V==-1){let q=n[W];D.push(q),U.push(M-$);return}else if(V==-3){c=W;return}else if(V==-4){h=W;return}else throw new RangeError(`Unrecognized record size: ${V}`);let te=l[W],G,be,ie=M-$;if(x-M<=s&&(be=v(a.pos-R,ce))){let q=new Uint16Array(be.size-be.skip),re=a.pos-be.size,H=q.length;for(;a.pos>re;)H=b(be.start,q,H);G=new Ls(q,x-be.start,r),ie=be.start-$}else{let q=a.pos-V;a.next();let re=[],H=[],j=W>=o?W:-1,ee=0,_e=x;for(;a.pos>q;)j>=0&&a.id==j&&a.size>=0?(a.end<=_e-s&&(f(re,H,M,ee,a.end,_e,j,N,K),ee=re.length,_e=a.end),a.next()):he>2500?d(M,q,re,H):u(M,q,re,H,j,he+1);if(j>=0&&ee>0&&ee<re.length&&f(re,H,M,ee,M,_e,j,N,K),re.reverse(),H.reverse(),j>-1&&ee>0){let Le=p(te,K);G=fp(te,re,H,0,re.length,0,x-M,Le,Le)}else G=g(te,re,H,x-M,N-x,K)}D.push(G),U.push(ie)}function d($,R,D,U){let ce=[],he=0,W=-1;for(;a.pos>R;){let{id:M,start:x,end:V,size:N}=a;if(N>4)a.next();else{if(W>-1&&x<W)break;W<0&&(W=V-s),ce.push(M,x,V),he++,a.next()}}if(he){let M=new Uint16Array(he*4),x=ce[ce.length-2];for(let V=ce.length-3,N=0;V>=0;V-=3)M[N++]=ce[V],M[N++]=ce[V+1]-x,M[N++]=ce[V+2]-x,M[N++]=N;D.push(new Ls(M,ce[2]-x,r)),U.push(x-$)}}function p($,R){return(D,U,ce)=>{let he=0,W=D.length-1,M,x;if(W>=0&&(M=D[W])instanceof at){if(!W&&M.type==$&&M.length==ce)return M;(x=M.prop(Fe.lookAhead))&&(he=U[W]+M.length+x)}return g($,D,U,ce,he,R)}}function f($,R,D,U,ce,he,W,M,x){let V=[],N=[];for(;$.length>U;)V.push($.pop()),N.push(R.pop()+D-ce);$.push(g(r.types[W],V,N,he-ce,M-he,x)),R.push(ce-D)}function g($,R,D,U,ce,he,W){if(he){let M=[Fe.contextHash,he];W=W?[M].concat(W):[M]}if(ce>25){let M=[Fe.lookAhead,ce];W=W?[M].concat(W):[M]}return new at($,R,D,U,W)}function v($,R){let D=a.fork(),U=0,ce=0,he=0,W=D.end-s,M={size:0,start:0,skip:0};e:for(let x=D.pos-$;D.pos>x;){let V=D.size;if(D.id==R&&V>=0){M.size=U,M.start=ce,M.skip=he,he+=4,U+=4,D.next();continue}let N=D.pos-V;if(V<0||N<x||D.start<W)break;let K=D.id>=o?4:0,te=D.start;for(D.next();D.pos>N;){if(D.size<0)if(D.size==-3||D.size==-4)K+=4;else break e;else D.id>=o&&(K+=4);D.next()}ce=te,U+=V,he+=K}return(R<0||U==$)&&(M.size=U,M.start=ce,M.skip=he),M.size>4?M:void 0}function b($,R,D){let{id:U,start:ce,end:he,size:W}=a;if(a.next(),W>=0&&U<o){let M=D;if(W>4){let x=a.pos-(W-4);for(;a.pos>x;)D=b($,R,D)}R[--D]=M,R[--D]=he-$,R[--D]=ce-$,R[--D]=U}else W==-3?c=U:W==-4&&(h=U);return D}let S=[],k=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,S,k,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:S.length?k[0]+S[0].length:0;return new at(l[t.topID],S.reverse(),k.reverse(),T)}const Cg=new WeakMap;function bc(t,e){if(!t.isAnonymous||e instanceof Ls||e.type!=t)return 1;let i=Cg.get(e);if(i==null){i=1;for(let r of e.children){if(r.type!=t||!(r instanceof at)){i=1;break}i+=bc(t,r)}Cg.set(e,i)}return i}function fp(t,e,i,r,s,n,o,a,l){let c=0;for(let f=r;f<s;f++)c+=bc(t,e[f]);let h=Math.ceil(c*1.5/8),u=[],d=[];function p(f,g,v,b,S){for(let k=v;k<b;){let T=k,$=g[k],R=bc(t,f[k]);for(k++;k<b;k++){let D=bc(t,f[k]);if(R+D>=h)break;R+=D}if(k==T+1){if(R>h){let D=f[T];p(D.children,D.positions,0,D.children.length,g[T]+S);continue}u.push(f[T])}else{let D=g[k-1]+f[k-1].length-$;u.push(fp(t,f,g,T,k,$,D,null,l))}d.push($+S-n)}}return p(e,i,r,s,0),(a||l)(u,d,o)}class J1{constructor(){this.map=new WeakMap}setBuffer(e,i,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(i,r)}getBuffer(e,i){let r=this.map.get(e);return r&&r.get(i)}set(e,i){e instanceof Mr?this.setBuffer(e.context.buffer,e.index,i):e instanceof di&&this.map.set(e.tree,i)}get(e){return e instanceof Mr?this.getBuffer(e.context.buffer,e.index):e instanceof di?this.map.get(e.tree):void 0}cursorSet(e,i){e.buffer?this.setBuffer(e.buffer.buffer,e.index,i):this.map.set(e.tree,i)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ts{constructor(e,i,r,s,n=!1,o=!1){this.from=e,this.to=i,this.tree=r,this.offset=s,this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],r=!1){let s=[new ts(0,e.length,e,0,!1,r)];for(let n of i)n.to>e.length&&s.push(n);return s}static applyChanges(e,i,r=128){if(!i.length)return e;let s=[],n=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<i.length?i[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let d=o;if(l>=d.from||u<=d.to||c){let p=Math.max(d.from,l)-c,f=Math.min(d.to,u)-c;d=p>=f?null:new ts(p,f,d.tree,d.offset+c,a>0,!!h)}if(d&&s.push(d),o.to>u)break;o=n<e.length?e[n++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return s}}class pp{startParse(e,i,r){return typeof e=="string"&&(e=new F3(e)),r=r?r.length?r.map(s=>new ji(s.from,s.to)):[new ji(0,0)]:[new ji(0,e.length)],this.createParse(e,i||[],r)}parse(e,i,r){let s=this.startParse(e,i,r);for(;;){let n=s.advance();if(n)return n}}}class F3{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}function eb(t){return(e,i,r,s)=>new q3(e,t,i,r,s)}class $g{constructor(e,i,r,s,n,o){this.parser=e,this.parse=i,this.overlay=r,this.bracketed=s,this.target=n,this.from=o}}function Pg(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class H3{constructor(e,i,r,s,n,o,a,l){this.parser=e,this.predicate=i,this.mounts=r,this.index=s,this.start=n,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const Ed=new Fe({perNode:!0});class q3{constructor(e,i,r,s,n){this.nest=i,this.input=r,this.fragments=s,this.ranges=n,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 at(r.type,r.children,r.positions,r.length,r.propValues.concat([[Ed,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],i=e.parse.advance();if(i){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Fe.mounted.id]=new Hn(i,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 i=this.innerDone;i<this.inner.length;i++)this.inner[i].from<e&&(e=Math.min(e,this.inner[i].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let i=this.innerDone;i<this.inner.length;i++)this.inner[i].parse.stopAt(e)}startInner(){let e=new U3(this.fragments),i=null,r=null,s=new Fc(new di(this.baseTree,this.ranges[0].from,0,null),lt.IncludeAnonymous|lt.IgnoreMounts);e:for(let n,o;;){let a=!0,l;if(this.stoppedAt!=null&&s.from>=this.stoppedAt)a=!1;else if(e.hasNode(s)){if(i){let c=i.mounts.find(h=>h.frag.from<=s.from&&h.frag.to>=s.to&&h.mount.overlay);if(c)for(let h of c.mount.overlay){let u=h.from+c.pos,d=h.to+c.pos;u>=s.from&&d<=s.to&&!i.ranges.some(p=>p.from<d&&p.to>u)&&i.ranges.push({from:u,to:d})}}a=!1}else if(r&&(o=Y3(r.ranges,s.from,s.to)))a=o!=2;else if(!s.type.isAnonymous&&(n=this.nest(s,this.input))&&(s.from<s.to||!n.overlay)){s.tree||(j3(s),i&&i.depth++,r&&r.depth++);let c=e.findMounts(s.from,n.parser);if(typeof n.overlay=="function")i=new H3(n.parser,n.overlay,c,this.inner.length,s.from,!!n.bracketed,s.tree,i);else{let h=Mg(this.ranges,n.overlay||(s.from<s.to?[new ji(s.from,s.to)]:[]));h.length&&Pg(h),(h.length||!n.overlay)&&this.inner.push(new $g(n.parser,h.length?n.parser.startParse(this.input,Bg(c,h),h):n.parser.startParse(""),n.overlay?n.overlay.map(u=>new ji(u.from-s.from,u.to-s.from)):null,!!n.bracketed,s.tree,h.length?h[0].from:s.from)),n.overlay?h.length&&(r={ranges:h,depth:0,prev:r}):a=!1}}else if(i&&(l=i.predicate(s))&&(l===!0&&(l=new ji(s.from,s.to)),l.from<l.to)){let c=i.ranges.length-1;c>=0&&i.ranges[c].to==l.from?i.ranges[c]={from:i.ranges[c].from,to:l.to}:i.ranges.push(l)}if(a&&s.firstChild())i&&i.depth++,r&&r.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(i&&!--i.depth){let c=Mg(this.ranges,i.ranges);c.length&&(Pg(c),this.inner.splice(i.index,0,new $g(i.parser,i.parser.startParse(this.input,Bg(i.mounts,c),c),i.ranges.map(h=>new ji(h.from-i.start,h.to-i.start)),i.bracketed,i.target,c[0].from))),i=i.prev}r&&!--r.depth&&(r=r.prev)}}}}function Y3(t,e,i){for(let r of t){if(r.from>=i)break;if(r.to>e)return r.from<=e&&r.to>=i?2:1}return 0}function Qg(t,e,i,r,s,n){if(e<i){let o=t.buffer[e+1];r.push(t.slice(e,i,o)),s.push(o-n)}}function j3(t){let{node:e}=t,i=[],r=e.context.buffer;do i.push(t.index),t.parent();while(!t.tree);let s=t.tree,n=s.children.indexOf(r),o=s.children[n],a=o.buffer,l=[n];function c(h,u,d,p,f,g){let v=i[g],b=[],S=[];Qg(o,h,v,b,S,p);let k=a[v+1],T=a[v+2];l.push(b.length);let $=g?c(v+4,a[v+3],o.set.types[a[v]],k,T-k,g-1):e.toTree();return b.push($),S.push(k-p),Qg(o,a[v+3],u,b,S,p),new at(d,b,S,f)}s.children[n]=c(0,a.length,Xt.none,0,o.length,i.length-1);for(let h of l){let u=t.tree.children[h],d=t.tree.positions[h];t.yield(new di(u,d+t.from,h,t._tree))}}class Tg{constructor(e,i){this.offset=i,this.done=!1,this.cursor=e.cursor(lt.IncludeAnonymous|lt.IgnoreMounts)}moveTo(e){let{cursor:i}=this,r=e-this.offset;for(;!this.done&&i.from<r;)i.to>=e&&i.enter(r,1,lt.IgnoreOverlays|lt.ExcludeBuffers)||i.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 i=this.cursor.tree;;){if(i==e.tree)return!0;if(i.children.length&&i.positions[0]==0&&i.children[0]instanceof at)i=i.children[0];else break}return!1}}let U3=class{constructor(e){var i;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(i=r.tree.prop(Ed))!==null&&i!==void 0?i:r.to,this.inner=new Tg(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 i=this.curFrag=this.fragments[this.fragI];this.curTo=(e=i.tree.prop(Ed))!==null&&e!==void 0?e:i.to,this.inner=new Tg(i.tree,-i.offset)}}findMounts(e,i){var r;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(r=n.tree)===null||r===void 0?void 0:r.prop(Fe.mounted);if(o&&o.parser==i)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=n.to)break;l.tree==this.curFrag.tree&&s.push({frag:l,pos:n.from-l.offset,mount:o})}}}return s}};function Mg(t,e){let i=null,r=e;for(let s=1,n=0;s<t.length;s++){let o=t[s-1].to,a=t[s].from;for(;n<r.length;n++){let l=r[n];if(l.from>=a)break;l.to<=o||(i||(r=i=e.slice()),l.from<o?(i[n]=new ji(l.from,o),l.to>a&&i.splice(n+1,0,new ji(a,l.to))):l.to>a?i[n--]=new ji(a,l.to):i.splice(n--,1))}}return r}function G3(t,e,i,r){let s=0,n=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let h=s==t.length?1e9:o?t[s].to:t[s].from,u=n==e.length?1e9:a?e[n].to:e[n].from;if(o!=a){let d=Math.max(l,i),p=Math.min(h,u,r);d<p&&c.push(new ji(d,p))}if(l=Math.min(h,u),l==1e9)break;h==l&&(o?(o=!1,s++):o=!0),u==l&&(a?(a=!1,n++):a=!0)}return c}function Bg(t,e){let i=[];for(let{pos:r,mount:s,frag:n}of t){let o=r+(s.overlay?s.overlay[0].from:0),a=o+s.tree.length,l=Math.max(n.from,o),c=Math.min(n.to,a);if(s.overlay){let h=s.overlay.map(d=>new ji(d.from+r,d.to+r)),u=G3(e,h,l,c);for(let d=0,p=l;;d++){let f=d==u.length,g=f?c:u[d].from;if(g>p&&i.push(new ts(p,g,s.tree,-o,n.from>=p||n.openStart,n.to<=g||n.openEnd)),f)break;p=u[d].to}}else i.push(new ts(l,c,s.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}return i}let K3=0;class Li{constructor(e,i,r,s){this.name=e,this.set=i,this.base=r,this.modified=s,this.id=K3++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let r=typeof e=="string"?e:"?";if(e instanceof Li&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let s=new Li(r,[],null,[]);if(s.set.push(s),i)for(let n of i.set)s.set.push(n);return s}static defineModifier(e){let i=new Hc(e);return r=>r.modified.indexOf(i)>-1?r:Hc.get(r.base||r,r.modified.concat(i).sort((s,n)=>s.id-n.id))}}let J3=0;class Hc{constructor(e){this.name=e,this.instances=[],this.id=J3++}static get(e,i){if(!i.length)return e;let r=i[0].instances.find(a=>a.base==e&&eM(i,a.modified));if(r)return r;let s=[],n=new Li(e.name,s,e,i);for(let a of i)a.instances.push(n);let o=tM(i);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(Hc.get(a,l));return n}}function eM(t,e){return t.length==e.length&&t.every((i,r)=>i==e[r])}function tM(t){let e=[[]];for(let i=0;i<t.length;i++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[i]));return e.sort((i,r)=>r.length-i.length)}function ho(t){let e=Object.create(null);for(let i in t){let r=t[i];Array.isArray(r)||(r=[r]);for(let s of i.split(" "))if(s){let n=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==s.length)break;let p=s[u++];if(u==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=n.length-1,c=n[l];if(!c)throw new RangeError("Invalid path: "+s);let h=new Da(r,o,l>0?n.slice(0,l):null);e[c]=h.sort(e[c])}}return tb.add(e)}const tb=new Fe({combine(t,e){let i,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),i&&i.mode==s.mode&&!s.context&&!i.context)continue;let n=new Da(s.tags,s.mode,s.context);i?i.next=n:r=n,i=n}return r}});class Da{constructor(e,i,r,s){this.tags=e,this.mode=i,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}}Da.empty=new Da([],2,null);function ib(t,e){let i=Object.create(null);for(let n of t)if(!Array.isArray(n.tag))i[n.tag.id]=n.class;else for(let o of n.tag)i[o.id]=n.class;let{scope:r,all:s=null}=e||{};return{style:n=>{let o=s;for(let a of n)for(let l of a.set){let c=i[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function iM(t,e){let i=null;for(let r of t){let s=r.style(e);s&&(i=i?i+" "+s:s)}return i}function rM(t,e,i,r=0,s=t.length){let n=new sM(r,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),r,s,"",n.highlighters),n.flush(s)}class sM{constructor(e,i,r){this.at=e,this.highlighters=i,this.span=r,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,r,s,n){let{type:o,from:a,to:l}=e;if(a>=r||l<=i)return;o.isTop&&(n=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=s,h=nM(e)||Da.empty,u=iM(n,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(s+=(s?" ":"")+u)),this.startSpan(Math.max(i,a),c),h.opaque)return;let d=e.tree&&e.tree.prop(Fe.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),f=this.highlighters.filter(v=>!v.scope||v.scope(d.tree.type)),g=e.firstChild();for(let v=0,b=a;;v++){let S=v<d.overlay.length?d.overlay[v]:null,k=S?S.from+a:l,T=Math.max(i,b),$=Math.min(r,k);if(T<$&&g)for(;e.from<$&&(this.highlightRange(e,T,$,s,n),this.startSpan(Math.min($,e.to),c),!(e.to>=k||!e.nextSibling())););if(!S||k>r)break;b=S.to+a,b>i&&(this.highlightRange(p.cursor(),Math.max(i,S.from+a),Math.min(r,b),"",f),this.startSpan(Math.min(r,b),c))}g&&e.parent()}else if(e.firstChild()){d&&(s="");do if(!(e.to<=i)){if(e.from>=r)break;this.highlightRange(e,i,r,s,n),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function nM(t){let e=t.type.prop(tb);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const ke=Li.define,Vl=ke(),xs=ke(),Ag=ke(xs),Rg=ke(xs),Ss=ke(),Fl=ke(Ss),nu=ke(Ss),kr=ke(),Hs=ke(kr),_r=ke(),xr=ke(),Dd=ke(),qo=ke(Dd),Hl=ke(),Q={comment:Vl,lineComment:ke(Vl),blockComment:ke(Vl),docComment:ke(Vl),name:xs,variableName:ke(xs),typeName:Ag,tagName:ke(Ag),propertyName:Rg,attributeName:ke(Rg),className:ke(xs),labelName:ke(xs),namespace:ke(xs),macroName:ke(xs),literal:Ss,string:Fl,docString:ke(Fl),character:ke(Fl),attributeValue:ke(Fl),number:nu,integer:ke(nu),float:ke(nu),bool:ke(Ss),regexp:ke(Ss),escape:ke(Ss),color:ke(Ss),url:ke(Ss),keyword:_r,self:ke(_r),null:ke(_r),atom:ke(_r),unit:ke(_r),modifier:ke(_r),operatorKeyword:ke(_r),controlKeyword:ke(_r),definitionKeyword:ke(_r),moduleKeyword:ke(_r),operator:xr,derefOperator:ke(xr),arithmeticOperator:ke(xr),logicOperator:ke(xr),bitwiseOperator:ke(xr),compareOperator:ke(xr),updateOperator:ke(xr),definitionOperator:ke(xr),typeOperator:ke(xr),controlOperator:ke(xr),punctuation:Dd,separator:ke(Dd),bracket:qo,angleBracket:ke(qo),squareBracket:ke(qo),paren:ke(qo),brace:ke(qo),content:kr,heading:Hs,heading1:ke(Hs),heading2:ke(Hs),heading3:ke(Hs),heading4:ke(Hs),heading5:ke(Hs),heading6:ke(Hs),contentSeparator:ke(kr),list:ke(kr),quote:ke(kr),emphasis:ke(kr),strong:ke(kr),link:ke(kr),monospace:ke(kr),strikethrough:ke(kr),inserted:ke(),deleted:ke(),changed:ke(),invalid:ke(),meta:Hl,documentMeta:ke(Hl),annotation:ke(Hl),processingInstruction:ke(Hl),definition:Li.defineModifier("definition"),constant:Li.defineModifier("constant"),function:Li.defineModifier("function"),standard:Li.defineModifier("standard"),local:Li.defineModifier("local"),special:Li.defineModifier("special")};for(let t in Q){let e=Q[t];e instanceof Li&&(e.name=t)}ib([{tag:Q.link,class:"tok-link"},{tag:Q.heading,class:"tok-heading"},{tag:Q.emphasis,class:"tok-emphasis"},{tag:Q.strong,class:"tok-strong"},{tag:Q.keyword,class:"tok-keyword"},{tag:Q.atom,class:"tok-atom"},{tag:Q.bool,class:"tok-bool"},{tag:Q.url,class:"tok-url"},{tag:Q.labelName,class:"tok-labelName"},{tag:Q.inserted,class:"tok-inserted"},{tag:Q.deleted,class:"tok-deleted"},{tag:Q.literal,class:"tok-literal"},{tag:Q.string,class:"tok-string"},{tag:Q.number,class:"tok-number"},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],class:"tok-string2"},{tag:Q.variableName,class:"tok-variableName"},{tag:Q.local(Q.variableName),class:"tok-variableName tok-local"},{tag:Q.definition(Q.variableName),class:"tok-variableName tok-definition"},{tag:Q.special(Q.variableName),class:"tok-variableName2"},{tag:Q.definition(Q.propertyName),class:"tok-propertyName tok-definition"},{tag:Q.typeName,class:"tok-typeName"},{tag:Q.namespace,class:"tok-namespace"},{tag:Q.className,class:"tok-className"},{tag:Q.macroName,class:"tok-macroName"},{tag:Q.propertyName,class:"tok-propertyName"},{tag:Q.operator,class:"tok-operator"},{tag:Q.comment,class:"tok-comment"},{tag:Q.meta,class:"tok-meta"},{tag:Q.invalid,class:"tok-invalid"},{tag:Q.punctuation,class:"tok-punctuation"}]);var ou;const nn=new Fe;function mp(t){return Qe.define({combine:t?e=>e.concat(t):void 0})}const gp=new Fe;class Ui{constructor(e,i,r=[],s=""){this.data=e,this.name=s,tt.prototype.hasOwnProperty("tree")||Object.defineProperty(tt.prototype,"tree",{get(){return Ot(this)}}),this.parser=i,this.extension=[Is.of(this),tt.languageData.of((n,o,a)=>{let l=Eg(n,o,a),c=l.type.prop(nn);if(!c)return[];let h=n.facet(c),u=l.type.prop(gp);if(u){let d=l.resolve(o-l.from,a);for(let p of u)if(p.test(d,n)){let f=n.facet(p.facet);return p.type=="replace"?f:f.concat(h)}}return h})].concat(r)}isActiveAt(e,i,r=-1){return Eg(e,i,r).type.prop(nn)==this.data}findRegions(e){let i=e.facet(Is);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let r=[],s=(n,o)=>{if(n.prop(nn)==this.data){r.push({from:o,to:o+n.length});return}let a=n.prop(Fe.mounted);if(a){if(a.tree.prop(nn)==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+n.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<n.children.length;l++){let c=n.children[l];c instanceof at&&s(c,n.positions[l]+o)}};return s(Ot(e),0),r}get allowsNesting(){return!0}}Ui.setState=Ve.define();function Eg(t,e,i){let r=t.facet(Is),s=Ot(t).topNode;if(!r||r.allowsNesting)for(let n=s;n;n=n.enter(e,i,lt.ExcludeBuffers|lt.EnterBracketed))n.type.isTop&&(s=n);return s}class io extends Ui{constructor(e,i,r){super(e,i,[],r),this.parser=i}static define(e){let i=mp(e.languageData);return new io(i,e.parser.configure({props:[nn.add(r=>r.isTop?i:void 0)]}),e.name)}configure(e,i){return new io(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ot(t){let e=t.field(Ui.state,!1);return e?e.tree:at.empty}class oM{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,i){let r=this.cursorPos-this.string.length;return e<r||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-r,i-r)}}let Yo=null;class La{constructor(e,i,r=[],s,n,o,a,l){this.parser=e,this.state=i,this.fragments=r,this.tree=s,this.treeLen=n,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,i,r){return new La(e,i,[],at.empty,0,r,[],null)}startParse(){return this.parser.startParse(new oM(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=at.empty&&this.isDone(i??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()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(ts.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<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(ts.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Yo;Yo=this;try{return e()}finally{Yo=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=Dg(e,i.from,i.to);return e}changes(e,i){let{fragments:r,tree:s,treeLen:n,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,d)=>l.push({fromA:c,toA:h,fromB:u,toB:d})),r=ts.applyChanges(r,l),s=at.empty,n=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 h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new La(this.parser,i,r,s,n,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:n}=this.skipped[r];s<e.to&&n>e.from&&(this.fragments=Dg(this.fragments,s,n),this.skipped.splice(r--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends pp{createParse(i,r,s){let n=s[0].from,o=s[s.length-1].to;return{parsedPos:n,advance(){let l=Yo;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 at(Xt.none,[],[],o-n)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Yo}}function Dg(t,e,i){return ts.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class ro{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=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),i.viewport.to);return i.work(20,r)||i.takeTree(),new ro(i)}static init(e){let i=Math.min(3e3,e.doc.length),r=La.create(e.facet(Is).parser,e,{from:0,to:i});return r.work(20,i)||r.takeTree(),new ro(r)}}Ui.state=Kt.define({create:ro.init,update(t,e){for(let i of e.effects)if(i.is(Ui.setState))return i.value;return e.startState.facet(Is)!=e.state.facet(Is)?ro.init(e.state):t.apply(e)}});let rb=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(rb=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const au=typeof navigator<"u"&&(!((ou=navigator.scheduling)===null||ou===void 0)&&ou.isInputPending)?()=>navigator.scheduling.isInputPending():null,aM=Mt.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 i=this.view.state.field(Ui.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(Ui.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=rb(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,n=r.field(Ui.state);if(n.tree==n.context.tree&&n.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!au?Math.max(25,e.timeRemaining()-5):1e9),a=n.context.treeLen<s&&r.doc.length>s+1e3,l=n.context.work(()=>au&&au()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-i,(l||this.chunkBudget<=0)&&(n.context.takeTree(),this.view.dispatch({effects:Ui.setState.of(new ro(n.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(n.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>$i(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Is=Qe.define({combine(t){return t.length?t[0]:null},enables:t=>[Ui.state,aM,Ce.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class Ia{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}class qc{constructor(e,i,r,s,n,o=void 0){this.name=e,this.alias=i,this.extensions=r,this.filename=s,this.loadFunc=n,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:i,support:r}=e;if(!i){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=()=>Promise.resolve(r)}return new qc(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,i,r)}static matchFilename(e,i){for(let s of e)if(s.filename&&s.filename.test(i))return s;let r=/\.([^.]+)$/.exec(i);if(r){for(let s of e)if(s.extensions.indexOf(r[1])>-1)return s}return null}static matchLanguageName(e,i,r=!0){i=i.toLowerCase();for(let s of e)if(s.alias.some(n=>n==i))return s;if(r)for(let s of e)for(let n of s.alias){let o=i.indexOf(n);if(o>-1&&(n.length>2||!/\w/.test(i[o-1])&&!/\w/.test(i[o+n.length])))return s}return null}}const lM=Qe.define(),cl=Qe.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Yc(t){let e=t.facet(cl);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Na(t,e){let i="",r=t.tabSize,s=t.facet(cl)[0];if(s==" "){for(;e>=r;)i+=" ",e-=r;s=" "}for(let n=0;n<e;n++)i+=s;return i}function Op(t,e){t instanceof tt&&(t=new Mh(t));for(let r of t.state.facet(lM)){let s=r(t,e);if(s!==void 0)return s}let i=Ot(t.state);return i.length>=e?cM(t,i,e):null}class Mh{constructor(e,i={}){this.state=e,this.options=i,this.unit=Yc(e)}lineAt(e,i=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:n}=this.options;return s!=null&&s>=r.from&&s<=r.to?n&&s==e?{text:"",from:e}:(i<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,i=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,i);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,i=1){let{text:r,from:s}=this.lineAt(e,i),n=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(n+=o-this.countColumn(r,r.search(/\S|$/))),n}countColumn(e,i=e.length){return cr(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:r,from:s}=this.lineAt(e,i),n=this.options.overrideIndentation;if(n){let o=n(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const hl=new Fe;function cM(t,e,i){let r=e.resolveStack(i),s=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(s!=r.node){let n=[];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)n.push(o);for(let o=n.length-1;o>=0;o--)r={node:n[o],next:r}}return sb(r,t,i)}function sb(t,e,i){for(let r=t;r;r=r.next){let s=uM(r.node);if(s)return s(vp.create(e,i,r))}return 0}function hM(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function uM(t){let e=t.type.prop(hl);if(e)return e;let i=t.firstChild,r;if(i&&(r=i.type.prop(Fe.closedBy))){let s=t.lastChild,n=s&&r.indexOf(s.name)>-1;return o=>nb(o,!0,1,void 0,n&&!hM(o)?s.from:void 0)}return t.parent==null?dM:null}function dM(){return 0}class vp extends Mh{constructor(e,i,r){super(e.state,e.options),this.base=e,this.pos=i,this.context=r}get node(){return this.context.node}static create(e,i,r){return new vp(e,i,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let i=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(i.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(fM(r,e))break;i=this.state.doc.lineAt(r.from)}return this.lineIndent(i.from)}continue(){return sb(this.context.next,this.base,this.pos)}}function fM(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function pM(t){let e=t.node,i=e.childAfter(e.from),r=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,n=t.state.doc.lineAt(i.from),o=s==null||s<=n.from?n.to:Math.min(n.to,s);for(let a=i.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(n.text.slice(i.to-n.from))[0].length;return{from:i.from,to:i.to+c}}a=l.to}}function mM({closing:t,align:e=!0,units:i=1}){return r=>nb(r,e,i,t)}function nb(t,e,i,r,s){let n=t.textAfter,o=n.match(/^\s*/)[0].length,a=r&&n.slice(o,o+r.length)==r||s==t.pos+o,l=e?pM(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}const gM=t=>t.baseIndent;function yc({except:t,units:e=1}={}){return i=>{let r=t&&t.test(i.textAfter);return i.baseIndent+(r?0:e*i.unit)}}const OM=200;function vM(){return tt.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 i=t.newDoc,{head:r}=t.newSelection.main,s=i.lineAt(r);if(r>s.from+OM)return t;let n=i.sliceString(s.from,r);if(!e.some(c=>c.test(n)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Op(o,h.from);if(u==null)continue;let d=/^\s*/.exec(h.text)[0],p=Na(o,u);d!=p&&l.push({from:h.from,to:h.from+d.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const ob=Qe.define(),uo=new Fe;function ab(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function bM(t,e,i){let r=Ot(t);if(r.length<i)return null;let s=r.resolveStack(i,1),n=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=i||a.from>i)continue;if(n&&a.from<e)break;let l=a.type.prop(uo);if(l&&(a.to<r.length-50||r.length==t.doc.length||!yM(a))){let c=l(a,t);c&&c.from<=i&&c.from>=e&&c.to>i&&(n=c)}}return n}function yM(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function jc(t,e,i){for(let r of t.facet(ob)){let s=r(t,e,i);if(s)return s}return bM(t,e,i)}function lb(t,e){let i=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return i>=r?void 0:{from:i,to:r}}const Bh=Ve.define({map:lb}),ul=Ve.define({map:lb});function cb(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(r=>r.from<=i&&r.to>=i)||e.push(t.lineBlockAt(i));return e}const gn=Kt.define({create(){return Ie.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,r)=>t=Lg(t,i,r)),t=t.map(e.changes);for(let i of e.effects)if(i.is(Bh)&&!_M(t,i.value.from,i.value.to)){let{preparePlaceholder:r}=e.state.facet(db),s=r?Ie.replace({widget:new PM(r(e.state,i.value))}):Ig;t=t.update({add:[s.range(i.value.from,i.value.to)]})}else i.is(ul)&&(t=t.update({filter:(r,s)=>i.value.from!=r||i.value.to!=s,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=Lg(t,e.selection.main.head)),t},provide:t=>Ce.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(r,s)=>{i.push(r,s)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i<t.length;){let r=t[i++],s=t[i++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(Ig.range(r,s))}return Ie.set(e,!0)}});function Lg(t,e,i=e){let r=!1;return t.between(e,i,(s,n)=>{s<i&&n>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:i,filter:(s,n)=>s>=i||n<=e}):t}function Uc(t,e,i){var r;let s=null;return(r=t.field(gn,!1))===null||r===void 0||r.between(e,i,(n,o)=>{(!s||s.from>n)&&(s={from:n,to:o})}),s}function _M(t,e,i){let r=!1;return t.between(e,e,(s,n)=>{s==e&&n==i&&(r=!0)}),r}function hb(t,e){return t.field(gn,!1)?e:e.concat(Ve.appendConfig.of(fb()))}const xM=t=>{for(let e of cb(t)){let i=jc(t.state,e.from,e.to);if(i)return t.dispatch({effects:hb(t.state,[Bh.of(i),ub(t,i)])}),!0}return!1},SM=t=>{if(!t.state.field(gn,!1))return!1;let e=[];for(let i of cb(t)){let r=Uc(t.state,i.from,i.to);r&&e.push(ul.of(r),ub(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function ub(t,e,i=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ce.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wM=t=>{let{state:e}=t,i=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),n=jc(e,s.from,s.to);n&&i.push(Bh.of(n)),r=(n?t.lineBlockAt(n.to):s).to+1}return i.length&&t.dispatch({effects:hb(t.state,i)}),!!i.length},kM=t=>{let e=t.state.field(gn,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(r,s)=>{i.push(ul.of({from:r,to:s}))}),t.dispatch({effects:i}),!0},CM=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:xM},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:SM},{key:"Ctrl-Alt-[",run:wM},{key:"Ctrl-Alt-]",run:kM}],$M={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},db=Qe.define({combine(t){return Zr(t,$M)}});function fb(t){return[gn,MM]}function pb(t,e){let{state:i}=t,r=i.facet(db),s=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=Uc(t.state,a.from,a.to);l&&t.dispatch({effects:ul.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let n=document.createElement("span");return n.textContent=r.placeholderText,n.setAttribute("aria-label",i.phrase("folded code")),n.title=i.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=s,n}const Ig=Ie.replace({widget:new class extends Xr{toDOM(t){return pb(t,null)}}});class PM extends Xr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return pb(e,this.value)}}const QM={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class lu extends ss{constructor(e,i){super(),this.config=e,this.open=i}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=e.state.phrase(this.open?"Fold line":"Unfold line"),i}}function TM(t={}){let e={...QM,...t},i=new lu(e,!0),r=new lu(e,!1),s=Mt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Is)!=o.state.facet(Is)||o.startState.field(gn,!1)!=o.state.field(gn,!1)||Ot(o.startState)!=Ot(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new is;for(let l of o.viewportLineBlocks){let c=Uc(o.state,l.from,l.to)?r:jc(o.state,l.from,l.to)?i:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:n}=e;return[s,P3({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||et.empty},initialSpacer(){return new lu(e,!1)},domEventHandlers:{...n,click:(o,a,l)=>{if(n.click&&n.click(o,a,l))return!0;let c=Uc(o.state,a.from,a.to);if(c)return o.dispatch({effects:ul.of(c)}),!0;let h=jc(o.state,a.from,a.to);return h?(o.dispatch({effects:Bh.of(h)}),!0):!1}}}),fb()]}const MM=Ce.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 dl{constructor(e,i){this.specs=e;let r;function s(a){let l=Rs.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const n=typeof i.all=="string"?i.all:i.all?s(i.all):void 0,o=i.scope;this.scope=o instanceof Ui?a=>a.prop(nn)==o.data:o?a=>a==o:void 0,this.style=ib(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:n}).style,this.module=r?new Rs(r):null,this.themeType=i.themeType}static define(e,i){return new dl(e,i||{})}}const Ld=Qe.define(),mb=Qe.define({combine(t){return t.length?[t[0]]:null}});function cu(t){let e=t.facet(Ld);return e.length?e:t.facet(mb)}function gb(t,e){let i=[AM],r;return t instanceof dl&&(t.module&&i.push(Ce.styleModule.of(t.module)),r=t.themeType),e?.fallback?i.push(mb.of(t)):r?i.push(Ld.computeN([Ce.darkTheme],s=>s.facet(Ce.darkTheme)==(r=="dark")?[t]:[])):i.push(Ld.of(t)),i}class BM{constructor(e){this.markCache=Object.create(null),this.tree=Ot(e.state),this.decorations=this.buildDeco(e,cu(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Ot(e.state),r=cu(e.state),s=r!=cu(e.startState),{viewport:n}=e.view,o=e.changes.mapPos(this.decoratedTo,1);i.length<n.to&&!s&&i.type==this.tree.type&&o>=n.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(i!=this.tree||e.viewportChanged||s)&&(this.tree=i,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=n.to)}buildDeco(e,i){if(!i||!this.tree.length)return Ie.none;let r=new is;for(let{from:s,to:n}of e.visibleRanges)rM(this.tree,i,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=Ie.mark({class:l})))},s,n);return r.finish()}}const AM=os.high(Mt.fromClass(BM,{decorations:t=>t.decorations})),RM=dl.define([{tag:Q.meta,color:"#404740"},{tag:Q.link,textDecoration:"underline"},{tag:Q.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Q.emphasis,fontStyle:"italic"},{tag:Q.strong,fontWeight:"bold"},{tag:Q.strikethrough,textDecoration:"line-through"},{tag:Q.keyword,color:"#708"},{tag:[Q.atom,Q.bool,Q.url,Q.contentSeparator,Q.labelName],color:"#219"},{tag:[Q.literal,Q.inserted],color:"#164"},{tag:[Q.string,Q.deleted],color:"#a11"},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],color:"#e40"},{tag:Q.definition(Q.variableName),color:"#00f"},{tag:Q.local(Q.variableName),color:"#30a"},{tag:[Q.typeName,Q.namespace],color:"#085"},{tag:Q.className,color:"#167"},{tag:[Q.special(Q.variableName),Q.macroName],color:"#256"},{tag:Q.definition(Q.propertyName),color:"#00c"},{tag:Q.comment,color:"#940"},{tag:Q.invalid,color:"#f00"}]),EM=Ce.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ob=1e4,vb="()[]{}",bb=Qe.define({combine(t){return Zr(t,{afterCursor:!0,brackets:vb,maxScanDistance:Ob,renderMatch:IM})}}),DM=Ie.mark({class:"cm-matchingBracket"}),LM=Ie.mark({class:"cm-nonmatchingBracket"});function IM(t){let e=[],i=t.matched?DM:LM;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}function Ng(t){let e=[],i=t.facet(bb);for(let r of t.selection.ranges){if(!r.empty)continue;let s=Br(t,r.head,-1,i)||r.head>0&&Br(t,r.head-1,1,i)||i.afterCursor&&(Br(t,r.head,1,i)||r.head<t.doc.length&&Br(t,r.head+1,-1,i));s&&(e=e.concat(i.renderMatch(s,t)))}return Ie.set(e,!0)}const NM=Mt.fromClass(class{constructor(t){this.paused=!1,this.decorations=Ng(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=Ng(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),zM=[NM,EM];function ZM(t={}){return[bb.of(t),zM]}const yb=new Fe;function Id(t,e,i){let r=t.prop(e<0?Fe.openedBy:Fe.closedBy);if(r)return r;if(t.name.length==1){let s=i.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[i[s+e]]}return null}function Nd(t){let e=t.type.prop(yb);return e?e(t.node):t}function Br(t,e,i,r={}){let s=r.maxScanDistance||Ob,n=r.brackets||vb,o=Ot(t),a=o.resolveInner(e,i);for(let l=a;l;l=l.parent){let c=Id(l.type,i,n);if(c&&l.from<l.to){let h=Nd(l);if(h&&(i>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return XM(t,e,i,l,h,c,n)}}return WM(t,e,i,o,a.type,s,n)}function XM(t,e,i,r,s,n,o){let a=r.parent,l={from:s.from,to:s.to},c=0,h=a?.cursor();if(h&&(i<0?h.childBefore(r.from):h.childAfter(r.to)))do if(i<0?h.to<=r.from:h.from>=r.to){if(c==0&&n.indexOf(h.type.name)>-1&&h.from<h.to){let u=Nd(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(Id(h.type,i,o))c++;else if(Id(h.type,-i,o)){if(c==0){let u=Nd(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(i<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function WM(t,e,i,r,s,n,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=i>0)return null;let c={from:i<0?e-1:e,to:i>0?e+1:e},h=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let d=0;!h.next().done&&d<=n;){let p=h.value;i<0&&(d+=p.length);let f=e+d*i;for(let g=i>0?0:p.length-1,v=i>0?p.length:-1;g!=v;g+=i){let b=o.indexOf(p[g]);if(!(b<0||r.resolveInner(f+g,1).type!=s))if(b%2==0==i>0)u++;else{if(u==1)return{start:c,end:{from:f+g,to:f+g+1},matched:b>>1==l>>1};u--}}i>0&&(d+=p.length)}return h.done?{start:c,matched:!1}:null}const VM=Object.create(null),zg=[Xt.none],Zg=[],Xg=Object.create(null),FM=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"]])FM[t]=HM(VM,e);function hu(t,e){Zg.indexOf(t)>-1||(Zg.push(t),console.warn(e))}function HM(t,e){let i=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=t[c]||Q[c];h?typeof h=="function"?l.length?l=l.map(h):hu(c,`Modifier ${c} used at start of tag`):l.length?hu(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:hu(c,`Unknown highlighting tag ${c}`)}for(let c of l)i.push(c)}if(!i.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+i.map(a=>a.id),n=Xg[s];if(n)return n.id;let o=Xg[s]=Xt.define({id:zg.length,name:r,props:[ho({[r]:i})]});return zg.push(o),o.id}gt.RTL,gt.LTR;const qM=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),r=yp(t.state,i.from);return r.line?YM(t):r.block?UM(t):!1};function bp(t,e){return({state:i,dispatch:r})=>{if(i.readOnly)return!1;let s=t(e,i);return s?(r(i.update(s)),!0):!1}}const YM=bp(JM,0),jM=bp(_b,0),UM=bp((t,e)=>_b(t,e,KM(e)),0);function yp(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const jo=50;function GM(t,{open:e,close:i},r,s){let n=t.sliceDoc(r-jo,r),o=t.sliceDoc(s,s+jo),a=/\s*$/.exec(n)[0].length,l=/^\s*/.exec(o)[0].length,c=n.length-a;if(n.slice(c-e.length,c)==e&&o.slice(l,l+i.length)==i)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let h,u;s-r<=2*jo?h=u=t.sliceDoc(r,s):(h=t.sliceDoc(r,r+jo),u=t.sliceDoc(s-jo,s));let d=/^\s*/.exec(h)[0].length,p=/\s*$/.exec(u)[0].length,f=u.length-p-i.length;return h.slice(d,d+e.length)==e&&u.slice(f,f+i.length)==i?{open:{pos:r+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:s-p-i.length,margin:/\s/.test(u.charAt(f-1))?1:0}}:null}function KM(t){let e=[];for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),s=i.to<=r.to?r:t.doc.lineAt(i.to);s.from>r.from&&s.from==i.to&&(s=i.to==r.to+1?r:t.doc.lineAt(i.to-1));let n=e.length-1;n>=0&&e[n].to>r.from?e[n].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function _b(t,e,i=e.selection.ranges){let r=i.map(n=>yp(e,n.from).block);if(!r.every(n=>n))return null;let s=i.map((n,o)=>GM(e,r[o],n.from,n.to));if(t!=2&&!s.every(n=>n))return{changes:e.changes(i.map((n,o)=>s[o]?[]:[{from:n.from,insert:r[o].open+" "},{from:n.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(n=>n)){let n=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:h}=a;n.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:n}}return null}function JM(t,e,i=e.selection.ranges){let r=[],s=-1;e:for(let{from:n,to:o}of i){let a=r.length,l=1e9,c;for(let h=n;h<=o;){let u=e.doc.lineAt(h);if(c==null&&(c=yp(e,u.from).line,!c))continue e;if(u.from>s&&(n==o||o>u.from)){s=u.from;let d=/^\s*/.exec(u.text)[0].length,p=d==u.length,f=u.text.slice(d,d+c.length)==c?d:-1;d<u.text.length&&d<l&&(l=d),r.push({line:u,comment:f,token:c,indent:d,empty:p,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(n=>n.comment<0&&(!n.empty||n.single))){let n=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&n.push({from:a.from+c,insert:l+" "});let o=e.changes(n);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(n=>n.comment>=0)){let n=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,n.push({from:c,to:h})}return{changes:n}}return null}const zd=as.define(),e4=as.define(),t4=Qe.define(),xb=Qe.define({combine(t){return Zr(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(r,s)=>e(r,s)||i(r,s)})}}),Sb=Kt.define({create(){return Ar.empty},update(t,e){let i=e.state.facet(xb),r=e.annotation(zd);if(r){let l=Pi.fromTransaction(e,r.selection),c=r.side,h=c==0?t.undone:t.done;return l?h=Gc(h,h.length,i.minDepth,l):h=Cb(h,e.startState.selection),new Ar(c==0?r.rest:h,c==0?h:r.rest)}let s=e.annotation(e4);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Dt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let n=Pi.fromTransaction(e),o=e.annotation(Dt.time),a=e.annotation(Dt.userEvent);return n?t=t.addChanges(n,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,i.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 Ar(t.done.map(Pi.fromJSON),t.undone.map(Pi.fromJSON))}});function i4(t={}){return[Sb,xb.of(t),Ce.domEventHandlers({beforeinput(e,i){let r=e.inputType=="historyUndo"?wb:e.inputType=="historyRedo"?Zd:null;return r?(e.preventDefault(),r(i)):!1}})]}function Ah(t,e){return function({state:i,dispatch:r}){if(!e&&i.readOnly)return!1;let s=i.field(Sb,!1);if(!s)return!1;let n=s.pop(t,i,e);return n?(r(n),!0):!1}}const wb=Ah(0,!1),Zd=Ah(1,!1),r4=Ah(0,!0),s4=Ah(1,!0);class Pi{constructor(e,i,r,s,n){this.changes=e,this.effects=i,this.mapped=r,this.startSelection=s,this.selectionsAfter=n}setSelAfter(e){return new Pi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.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 Pi(e.changes&&Zt.fromJSON(e.changes),[],e.mapped&&Dr.fromJSON(e.mapped),e.startSelection&&le.fromJSON(e.startSelection),e.selectionsAfter.map(le.fromJSON))}static fromTransaction(e,i){let r=Gi;for(let s of e.startState.facet(t4)){let n=s(e);n.length&&(r=r.concat(n))}return!r.length&&e.changes.empty?null:new Pi(e.changes.invert(e.startState.doc),r,void 0,i||e.startState.selection,Gi)}static selection(e){return new Pi(void 0,Gi,void 0,void 0,e)}}function Gc(t,e,i,r){let s=e+1>i+20?e-i-1:0,n=t.slice(s,e);return n.push(r),n}function n4(t,e){let i=[],r=!1;return t.iterChangedRanges((s,n)=>i.push(s,n)),e.iterChangedRanges((s,n,o,a)=>{for(let l=0;l<i.length;){let c=i[l++],h=i[l++];a>=c&&o<=h&&(r=!0)}}),r}function o4(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,r)=>i.empty!=e.ranges[r].empty).length===0}function kb(t,e){return t.length?e.length?t.concat(e):t:e}const Gi=[],a4=200;function Cb(t,e){if(t.length){let i=t[t.length-1],r=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-a4));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Gc(t,t.length-1,1e9,i.setSelAfter(r)))}else return[Pi.selection([e])]}function l4(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function uu(t,e){if(!t.length)return t;let i=t.length,r=Gi;for(;i;){let s=c4(t[i-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let n=t.slice(0,i);return n[i-1]=s,n}else e=s.mapped,i--,r=s.selectionsAfter}return r.length?[Pi.selection(r)]:Gi}function c4(t,e,i){let r=kb(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Gi,i);if(!t.changes)return Pi.selection(r);let s=t.changes.map(e),n=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(n):n;return new Pi(s,Ve.mapEffects(t.effects,e),o,t.startSelection.map(n),r)}const h4=/^(input\.type|delete)($|\.)/;class Ar{constructor(e,i,r=0,s=void 0){this.done=e,this.undone=i,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Ar(this.done,this.undone):this}addChanges(e,i,r,s,n){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||h4.test(r))&&(!a.selectionsAfter.length&&i-this.prevTime<s.newGroupDelay&&s.joinToEvent(n,n4(a.changes,e.changes))||r=="input.type.compose")?o=Gc(o,o.length-1,s.minDepth,new Pi(e.changes.compose(a.changes),kb(Ve.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Gi)):o=Gc(o,o.length,s.minDepth,e),new Ar(o,Gi,i,r)}addSelection(e,i,r,s){let n=this.done.length?this.done[this.done.length-1].selectionsAfter:Gi;return n.length>0&&i-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&o4(n[n.length-1],e)?this:new Ar(Cb(this.done,e),this.undone,i,r)}addMapping(e){return new Ar(uu(this.done,e),uu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,i,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let n=s[s.length-1],o=n.selectionsAfter[0]||(n.startSelection?n.startSelection.map(n.changes.invertedDesc,1):i.selection);if(r&&n.selectionsAfter.length)return i.update({selection:n.selectionsAfter[n.selectionsAfter.length-1],annotations:zd.of({side:e,rest:l4(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(n.changes){let a=s.length==1?Gi:s.slice(0,s.length-1);return n.mapped&&(a=uu(a,n.mapped)),i.update({changes:n.changes,selection:n.startSelection,effects:n.effects,annotations:zd.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ar.empty=new Ar(Gi,Gi);const u4=[{key:"Mod-z",run:wb,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Zd,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Zd,preventDefault:!0},{key:"Mod-u",run:r4,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:s4,preventDefault:!0}];function fo(t,e){return le.create(t.ranges.map(e),t.mainIndex)}function dr(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function fr({state:t,dispatch:e},i){let r=fo(t.selection,i);return r.eq(t.selection,!0)?!1:(e(dr(t,r)),!0)}function Rh(t,e){return le.cursor(e?t.to:t.from)}function $b(t,e){return fr(t,i=>i.empty?t.moveByChar(i,e):Rh(i,e))}function fi(t){return t.textDirectionAt(t.state.selection.main.head)==gt.LTR}const Pb=t=>$b(t,!fi(t)),Qb=t=>$b(t,fi(t));function Tb(t,e){return fr(t,i=>i.empty?t.moveByGroup(i,e):Rh(i,e))}const d4=t=>Tb(t,!fi(t)),f4=t=>Tb(t,fi(t));function p4(t,e,i){if(e.type.prop(i))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Eh(t,e,i){let r=Ot(t).resolveInner(e.head),s=i?Fe.closedBy:Fe.openedBy;for(let l=e.head;;){let c=i?r.childAfter(l):r.childBefore(l);if(!c)break;p4(t,c,s)?r=c:l=i?c.to:c.from}let n=r.type.prop(s),o,a;return n&&(o=i?Br(t,r.from,1):Br(t,r.to,-1))&&o.matched?a=i?o.end.to:o.end.from:a=i?r.to:r.from,le.cursor(a,i?-1:1)}const m4=t=>fr(t,e=>Eh(t.state,e,!fi(t))),g4=t=>fr(t,e=>Eh(t.state,e,fi(t)));function Mb(t,e){return fr(t,i=>{if(!i.empty)return Rh(i,e);let r=t.moveVertically(i,e);return r.head!=i.head?r:t.moveToLineBoundary(i,e)})}const Bb=t=>Mb(t,!1),Ab=t=>Mb(t,!0);function Rb(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,r=0,s;if(e){for(let n of t.state.facet(Ce.scrollMargins)){let o=n(t);o?.top&&(i=Math.max(o?.top,i)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=t.scrollDOM.clientHeight-i-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function Eb(t,e){let i=Rb(t),{state:r}=t,s=fo(r.selection,o=>o.empty?t.moveVertically(o,e,i.height):Rh(o,e));if(s.eq(r.selection))return!1;let n;if(i.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;o&&o.top>l&&o.bottom<c&&(n=Ce.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(dr(r,s),{effects:n}),!0}const Wg=t=>Eb(t,!1),Xd=t=>Eb(t,!0);function zs(t,e,i){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,i);if(s.head==e.head&&s.head!=(i?r.to:r.from)&&(s=t.moveToLineBoundary(e,i,!1)),!i&&s.head==r.from&&r.length){let n=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&e.head!=r.from+n&&(s=le.cursor(r.from+n))}return s}const O4=t=>fr(t,e=>zs(t,e,!0)),v4=t=>fr(t,e=>zs(t,e,!1)),b4=t=>fr(t,e=>zs(t,e,!fi(t))),y4=t=>fr(t,e=>zs(t,e,fi(t))),_4=t=>fr(t,e=>le.cursor(t.lineBlockAt(e.head).from,1)),x4=t=>fr(t,e=>le.cursor(t.lineBlockAt(e.head).to,-1));function S4(t,e,i){let r=!1,s=fo(t.selection,n=>{let o=Br(t,n.head,-1)||Br(t,n.head,1)||n.head>0&&Br(t,n.head-1,1)||n.head<t.doc.length&&Br(t,n.head+1,-1);if(!o||!o.end)return n;r=!0;let a=o.start.from==n.head?o.end.to:o.end.from;return le.cursor(a)});return r?(e(dr(t,s)),!0):!1}const w4=({state:t,dispatch:e})=>S4(t,e);function tr(t,e){let i=fo(t.state.selection,r=>{let s=e(r);return le.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(dr(t.state,i)),!0)}function Db(t,e){return tr(t,i=>t.moveByChar(i,e))}const Lb=t=>Db(t,!fi(t)),Ib=t=>Db(t,fi(t));function Nb(t,e){return tr(t,i=>t.moveByGroup(i,e))}const k4=t=>Nb(t,!fi(t)),C4=t=>Nb(t,fi(t)),$4=t=>tr(t,e=>Eh(t.state,e,!fi(t))),P4=t=>tr(t,e=>Eh(t.state,e,fi(t)));function zb(t,e){return tr(t,i=>t.moveVertically(i,e))}const Zb=t=>zb(t,!1),Xb=t=>zb(t,!0);function Wb(t,e){return tr(t,i=>t.moveVertically(i,e,Rb(t).height))}const Vg=t=>Wb(t,!1),Fg=t=>Wb(t,!0),Q4=t=>tr(t,e=>zs(t,e,!0)),T4=t=>tr(t,e=>zs(t,e,!1)),M4=t=>tr(t,e=>zs(t,e,!fi(t))),B4=t=>tr(t,e=>zs(t,e,fi(t))),A4=t=>tr(t,e=>le.cursor(t.lineBlockAt(e.head).from)),R4=t=>tr(t,e=>le.cursor(t.lineBlockAt(e.head).to)),Hg=({state:t,dispatch:e})=>(e(dr(t,{anchor:0})),!0),qg=({state:t,dispatch:e})=>(e(dr(t,{anchor:t.doc.length})),!0),Yg=({state:t,dispatch:e})=>(e(dr(t,{anchor:t.selection.main.anchor,head:0})),!0),jg=({state:t,dispatch:e})=>(e(dr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),E4=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),D4=({state:t,dispatch:e})=>{let i=Dh(t).map(({from:r,to:s})=>le.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:le.create(i),userEvent:"select"})),!0},L4=({state:t,dispatch:e})=>{let i=fo(t.selection,r=>{let s=Ot(t),n=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=n.node.from&&o.node.to<=n.node.to&&(n=o)}for(let o=n;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 le.range(a.to,a.from)}return r});return i.eq(t.selection)?!1:(e(dr(t,i)),!0)};function Vb(t,e){let{state:i}=t,r=i.selection,s=i.selection.ranges.slice();for(let n of i.selection.ranges){let o=i.doc.lineAt(n.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=n;;){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(dr(i,le.create(s,s.length-1))),!0)}const I4=t=>Vb(t,!1),N4=t=>Vb(t,!0),z4=({state:t,dispatch:e})=>{let i=t.selection,r=null;return i.ranges.length>1?r=le.create([i.main]):i.main.empty||(r=le.create([le.cursor(i.main.head)])),r?(e(dr(t,r)),!0):!1};function fl(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:r}=t,s=r.changeByRange(n=>{let{from:o,to:a}=n;if(o==a){let l=e(n);l<o?(i="delete.backward",l=ql(t,l,!1)):l>o&&(i="delete.forward",l=ql(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ql(t,o,!1),a=ql(t,a,!0);return o==a?{range:n}:{changes:{from:o,to:a},range:le.cursor(o,o<n.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?Ce.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ql(t,e,i){if(t instanceof Ce)for(let r of t.state.facet(Ce.atomicRanges).map(s=>s(t)))r.between(e,e,(s,n)=>{s<e&&n>e&&(e=i?n:s)});return e}const Fb=(t,e,i)=>fl(t,r=>{let s=r.from,{state:n}=t,o=n.doc.lineAt(s),a,l;if(i&&!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=cr(a,n.tabSize),h=c%Yc(n)||Yc(n);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)s--;l=s}else l=Ut(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?n.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Ut(o.text,l-o.from,!1,!1)+o.from);return l}),Wd=t=>Fb(t,!1,!0),Hb=t=>Fb(t,!0,!1),qb=(t,e)=>fl(t,i=>{let r=i.head,{state:s}=t,n=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?n.to:n.from)){r==i.head&&n.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=Ut(n.text,r-n.from,e)+n.from,c=n.text.slice(Math.min(r,l)-n.from,Math.max(r,l)-n.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=i.head)&&(a=h),r=l}return r}),Yb=t=>qb(t,!1),Z4=t=>qb(t,!0),X4=t=>fl(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),W4=t=>fl(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),V4=t=>fl(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),F4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ot.of(["",""])},range:le.cursor(r.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},H4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,n=t.doc.lineAt(s),o=s==n.from?s-1:Ut(n.text,s-n.from,!1)+n.from,a=s==n.to?s+1:Ut(n.text,s-n.from,!0)+n.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:le.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Dh(t){let e=[],i=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),n=t.doc.lineAt(r.to);if(!r.empty&&r.to==n.from&&(n=t.doc.lineAt(r.to-1)),i>=s.number){let o=e[e.length-1];o.to=n.to,o.ranges.push(r)}else e.push({from:s.from,to:n.to,ranges:[r]});i=n.number+1}return e}function jb(t,e,i){if(t.readOnly)return!1;let r=[],s=[];for(let n of Dh(t)){if(i?n.to==t.doc.length:n.from==0)continue;let o=t.doc.lineAt(i?n.to+1:n.from-1),a=o.length+1;if(i){r.push({from:n.to,to:o.to},{from:n.from,insert:o.text+t.lineBreak});for(let l of n.ranges)s.push(le.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:n.from},{from:n.to,insert:t.lineBreak+o.text});for(let l of n.ranges)s.push(le.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:le.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const q4=({state:t,dispatch:e})=>jb(t,e,!1),Y4=({state:t,dispatch:e})=>jb(t,e,!0);function Ub(t,e,i){if(t.readOnly)return!1;let r=[];for(let n of Dh(t))i?r.push({from:n.from,insert:t.doc.slice(n.from,n.to)+t.lineBreak}):r.push({from:n.to,insert:t.lineBreak+t.doc.slice(n.from,n.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const j4=({state:t,dispatch:e})=>Ub(t,e,!1),U4=({state:t,dispatch:e})=>Ub(t,e,!0),G4=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Dh(e).map(({from:s,to:n})=>(s>0?s--:n<e.doc.length&&n++,{from:s,to:n}))),r=fo(e.selection,s=>{let n;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(n=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,n)}).map(i);return t.dispatch({changes:i,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function K4(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=Ot(t).resolveInner(e),r=i.childBefore(e),s=i.childAfter(e),n;return r&&s&&r.to<=e&&s.from>=e&&(n=r.type.prop(Fe.closedBy))&&n.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 Ug=Gb(!1),J4=Gb(!0);function Gb(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:n,to:o}=s,a=e.doc.lineAt(n),l=!t&&n==o&&K4(e,n);t&&(n=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Mh(e,{simulateBreak:n,simulateDoubleBreak:!!l}),h=Op(c,n);for(h==null&&(h=cr(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:n,to:o}=l:n>a.from&&n<a.from+100&&!/\S/.test(a.text.slice(0,n))&&(n=a.from);let u=["",Na(e,h)];return l&&u.push(Na(e,c.lineIndent(a.from,-1))),{changes:{from:n,to:o,insert:ot.of(u)},range:le.cursor(n+1+u[1].length)}});return i(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function _p(t,e){let i=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>i&&(r.empty||r.to>a.from)&&(e(a,s,r),i=a.number),o=a.to+1}let n=t.changes(s);return{changes:s,range:le.range(n.mapPos(r.anchor,1),n.mapPos(r.head,1))}})}const eB=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),r=new Mh(t,{overrideIndentation:n=>{let o=i[n];return o??-1}}),s=_p(t,(n,o,a)=>{let l=Op(r,n.from);if(l==null)return;/\S/.test(n.text)||(l=0);let c=/^\s*/.exec(n.text)[0],h=Na(t,l);(c!=h||a.from<n.from+c.length)&&(i[n.from]=l,o.push({from:n.from,to:n.from+c.length,insert:h}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},tB=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(_p(t,(i,r)=>{r.push({from:i.from,insert:t.facet(cl)})}),{userEvent:"input.indent"})),!0),iB=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(_p(t,(i,r)=>{let s=/^\s*/.exec(i.text)[0];if(!s)return;let n=cr(s,t.tabSize),o=0,a=Na(t,Math.max(0,n-Yc(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:i.from+o,to:i.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),rB=t=>(t.setTabFocusMode(),!0),sB=[{key:"Ctrl-b",run:Pb,shift:Lb,preventDefault:!0},{key:"Ctrl-f",run:Qb,shift:Ib},{key:"Ctrl-p",run:Bb,shift:Zb},{key:"Ctrl-n",run:Ab,shift:Xb},{key:"Ctrl-a",run:_4,shift:A4},{key:"Ctrl-e",run:x4,shift:R4},{key:"Ctrl-d",run:Hb},{key:"Ctrl-h",run:Wd},{key:"Ctrl-k",run:X4},{key:"Ctrl-Alt-h",run:Yb},{key:"Ctrl-o",run:F4},{key:"Ctrl-t",run:H4},{key:"Ctrl-v",run:Xd}],nB=[{key:"ArrowLeft",run:Pb,shift:Lb,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:d4,shift:k4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:b4,shift:M4,preventDefault:!0},{key:"ArrowRight",run:Qb,shift:Ib,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:f4,shift:C4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:y4,shift:B4,preventDefault:!0},{key:"ArrowUp",run:Bb,shift:Zb,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Hg,shift:Yg},{mac:"Ctrl-ArrowUp",run:Wg,shift:Vg},{key:"ArrowDown",run:Ab,shift:Xb,preventDefault:!0},{mac:"Cmd-ArrowDown",run:qg,shift:jg},{mac:"Ctrl-ArrowDown",run:Xd,shift:Fg},{key:"PageUp",run:Wg,shift:Vg},{key:"PageDown",run:Xd,shift:Fg},{key:"Home",run:v4,shift:T4,preventDefault:!0},{key:"Mod-Home",run:Hg,shift:Yg},{key:"End",run:O4,shift:Q4,preventDefault:!0},{key:"Mod-End",run:qg,shift:jg},{key:"Enter",run:Ug,shift:Ug},{key:"Mod-a",run:E4},{key:"Backspace",run:Wd,shift:Wd,preventDefault:!0},{key:"Delete",run:Hb,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Yb,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Z4,preventDefault:!0},{mac:"Mod-Backspace",run:W4,preventDefault:!0},{mac:"Mod-Delete",run:V4,preventDefault:!0}].concat(sB.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),oB=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:m4,shift:$4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:g4,shift:P4},{key:"Alt-ArrowUp",run:q4},{key:"Shift-Alt-ArrowUp",run:j4},{key:"Alt-ArrowDown",run:Y4},{key:"Shift-Alt-ArrowDown",run:U4},{key:"Mod-Alt-ArrowUp",run:I4},{key:"Mod-Alt-ArrowDown",run:N4},{key:"Escape",run:z4},{key:"Mod-Enter",run:J4},{key:"Alt-l",mac:"Ctrl-l",run:D4},{key:"Mod-i",run:L4,preventDefault:!0},{key:"Mod-[",run:iB},{key:"Mod-]",run:tB},{key:"Mod-Alt-\\",run:eB},{key:"Shift-Mod-k",run:G4},{key:"Shift-Mod-\\",run:w4},{key:"Mod-/",run:qM},{key:"Alt-A",run:jM},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rB}].concat(nB),Gg=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class so{constructor(e,i,r=0,s=e.length,n,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=n?a=>n(Gg(a)):Gg,this.query=this.normalize(i)}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 wi(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 i=Hf(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Pr(e);let s=this.normalize(i);if(s.length)for(let n=0,o=r;;n++){let a=s.charCodeAt(n),l=this.match(a,o,this.bufferPos+this.bufferStart);if(n==s.length-1){if(l)return this.value=l,this;break}o==r&&n<i.length&&i.charCodeAt(n)==a&&o++}}}match(e,i,r){let s=null;for(let n=0;n<this.matches.length;n+=2){let o=this.matches[n],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[n+1],to:r}:(this.matches[n]++,a=!0)),a||(this.matches.splice(n,2),n-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:i,to:r}:this.matches.push(1,i)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(so.prototype[Symbol.iterator]=function(){return this});const Kb={from:-1,to:-1,match:/.*/.exec("")},xp="gm"+(/x/.unicode==null?"":"u");class Jb{constructor(e,i,r,s=0,n=e.length){if(this.text=e,this.to=n,this.curLine="",this.done=!1,this.value=Kb,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new ey(e,i,r,s,n);this.re=new RegExp(i,xp+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Kc(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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let r=this.curLineStart+i.index,s=r+i[0].length;if(this.matchPos=Kc(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,i)))return this.value={from:r,to:s,match:i},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 du=new WeakMap;class qn{constructor(e,i){this.from=e,this.text=i}get to(){return this.from+this.text.length}static get(e,i,r){let s=du.get(e);if(!s||s.from>=r||s.to<=i){let a=new qn(i,e.sliceString(i,r));return du.set(e,a),a}if(s.from==i&&s.to==r)return s;let{text:n,from:o}=s;return o>i&&(n=e.sliceString(i,o)+n,o=i),s.to<r&&(n+=e.sliceString(s.to,r)),du.set(e,new qn(o,n)),new qn(i,n.slice(i-o,r-o))}}class ey{constructor(e,i,r,s,n){this.text=e,this.to=n,this.done=!1,this.value=Kb,this.matchPos=Kc(e,s),this.re=new RegExp(i,xp+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=qn.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,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let r=this.flat.from+i.index,s=r+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,i)))return this.value={from:r,to:s,match:i},this.matchPos=Kc(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Jb.prototype[Symbol.iterator]=ey.prototype[Symbol.iterator]=function(){return this});function aB(t){try{return new RegExp(t,xp),!0}catch{return!1}}function Kc(t,e){if(e>=t.length)return e;let i=t.lineAt(e),r;for(;e<i.to&&(r=i.text.charCodeAt(e-i.from))>=56320&&r<57344;)e++;return e}const lB=t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:s}=w3(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return s.then(n=>{let o=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,h,u]=o,d=h?+h.slice(1):0,p=c?+c:a.number;if(c&&u){let v=p/100;l&&(v=v*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*v)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let f=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),g=le.cursor(f.from+Math.max(0,Math.min(d,f.length)));t.dispatch({effects:[r,Ce.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},cB={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hB=Qe.define({combine(t){return Zr(t,cB,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function uB(t){return[gB,mB]}const dB=Ie.mark({class:"cm-selectionMatch"}),fB=Ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Kg(t,e,i,r){return(i==0||t(e.sliceDoc(i-1,i))!=_t.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=_t.Word)}function pB(t,e,i,r){return t(e.sliceDoc(i,i+1))==_t.Word&&t(e.sliceDoc(r-1,r))==_t.Word}const mB=Mt.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(hB),{state:i}=t,r=i.selection;if(r.ranges.length>1)return Ie.none;let s=r.main,n,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Ie.none;let l=i.wordAt(s.head);if(!l)return Ie.none;o=i.charCategorizer(s.head),n=i.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return Ie.none;if(e.wholeWords){if(n=i.sliceDoc(s.from,s.to),o=i.charCategorizer(s.head),!(Kg(o,i,s.from,s.to)&&pB(o,i,s.from,s.to)))return Ie.none}else if(n=i.sliceDoc(s.from,s.to),!n)return Ie.none}let a=[];for(let l of t.visibleRanges){let c=new so(i.doc,n,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||Kg(o,i,h,u))&&(s.empty&&h<=s.from&&u>=s.to?a.push(fB.range(h,u)):(h>=s.to||u<=s.from)&&a.push(dB.range(h,u)),a.length>e.maxMatches))return Ie.none}}return Ie.set(a)}},{decorations:t=>t.decorations}),gB=Ce.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),OB=({state:t,dispatch:e})=>{let{selection:i}=t,r=le.create(i.ranges.map(s=>t.wordAt(s.head)||le.cursor(s.head)),i.mainIndex);return r.eq(i)?!1:(e(t.update({selection:r})),!0)};function vB(t,e){let{main:i,ranges:r}=t.selection,s=t.wordAt(i.head),n=s&&s.from==i.from&&s.to==i.to;for(let o=!1,a=new so(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new so(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(n){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const bB=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(n=>n.from===n.to))return OB({state:t,dispatch:e});let r=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(n=>t.sliceDoc(n.from,n.to)!=r))return!1;let s=vB(t,r);return s?(e(t.update({selection:t.selection.addRange(le.range(s.from,s.to),!1),effects:Ce.scrollIntoView(s.to)})),!0):!1},po=Qe.define({combine(t){return Zr(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new AB(e),scrollToMatch:e=>Ce.scrollIntoView(e)})}});class ty{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||aB(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,(i,r)=>r=="n"?`
|
|
21
|
-
`: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 kB(this):new xB(this)}getCursor(e,i=0,r){let s=e.doc?e:tt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?Dn(this,s,i,r):En(this,s,i,r)}}class iy{constructor(e){this.spec=e}}function yB(t,e,i){return(r,s,n,o)=>{if(i&&!i(r,s,n,o))return!1;let a=r>=o&&s<=o+n.length?n.slice(r-o,s-o):e.doc.sliceString(r,s);return t(a,e,r,s)}}function En(t,e,i,r){let s;return t.wholeWord&&(s=_B(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=yB(t.test,e,s)),new so(e.doc,t.unquoted,i,r,t.caseSensitive?void 0:n=>n.toLowerCase(),s)}function _B(t,e){return(i,r,s,n)=>((n>i||n+s.length<r)&&(n=Math.max(0,i-2),s=t.sliceString(n,Math.min(t.length,r+2))),(e(Jc(s,i-n))!=_t.Word||e(eh(s,i-n))!=_t.Word)&&(e(eh(s,r-n))!=_t.Word||e(Jc(s,r-n))!=_t.Word))}class xB extends iy{constructor(e){super(e)}nextMatch(e,i,r){let s=En(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let n=Math.min(e.doc.length,i+this.spec.unquoted.length);s=En(this.spec,e,0,n).nextOverlapping()}return s.done||s.value.from==i&&s.value.to==r?null:s.value}prevMatchInRange(e,i,r){for(let s=r;;){let n=Math.max(i,s-1e4-this.spec.unquoted.length),o=En(this.spec,e,n,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(n==i)return null;s-=1e4}}prevMatch(e,i,r){let s=this.prevMatchInRange(e,0,i);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=i||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let r=En(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=i)return null;s.push(r.value)}return s}highlight(e,i,r,s){let n=En(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)s(n.value.from,n.value.to)}}function SB(t,e,i){return(r,s,n)=>(!i||i(r,s,n))&&t(n[0],e,r,s)}function Dn(t,e,i,r){let s;return t.wholeWord&&(s=wB(e.charCategorizer(e.selection.main.head))),t.test&&(s=SB(t.test,e,s)),new Jb(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},i,r)}function Jc(t,e){return t.slice(Ut(t,e,!1),e)}function eh(t,e){return t.slice(e,Ut(t,e))}function wB(t){return(e,i,r)=>!r[0].length||(t(Jc(r.input,r.index))!=_t.Word||t(eh(r.input,r.index))!=_t.Word)&&(t(eh(r.input,r.index+r[0].length))!=_t.Word||t(Jc(r.input,r.index+r[0].length))!=_t.Word)}class kB extends iy{nextMatch(e,i,r){let s=Dn(this.spec,e,r,e.doc.length).next();return s.done&&(s=Dn(this.spec,e,0,i).next()),s.done?null:s.value}prevMatchInRange(e,i,r){for(let s=1;;s++){let n=Math.max(i,r-s*1e4),o=Dn(this.spec,e,n,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(n==i||a.from>n+10))return a;if(n==i)return null}}prevMatch(e,i,r){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(i,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let n=+r.slice(0,s);if(n>0&&n<e.match.length)return e.match[n]+r.slice(s)}return i})}matchAll(e,i){let r=Dn(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=i)return null;s.push(r.value)}return s}highlight(e,i,r,s){let n=Dn(this.spec,e,Math.max(0,i-250),Math.min(r+250,e.doc.length));for(;!n.next().done;)s(n.value.from,n.value.to)}}const za=Ve.define(),Sp=Ve.define(),Qs=Kt.define({create(t){return new fu(Vd(t).create(),null)},update(t,e){for(let i of e.effects)i.is(za)?t=new fu(i.value.create(),t.panel):i.is(Sp)&&(t=new fu(t.query,i.value?wp:null));return t},provide:t=>Ra.from(t,e=>e.panel)});class fu{constructor(e,i){this.query=e,this.panel=i}}const CB=Ie.mark({class:"cm-searchMatch"}),$B=Ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),PB=Mt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Qs))}update(t){let e=t.state.field(Qs);(e!=t.startState.field(Qs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ie.none;let{view:i}=this,r=new is;for(let s=0,n=i.visibleRanges,o=n.length;s<o;s++){let{from:a,to:l}=n[s];for(;s<o-1&&l>n[s+1].from-500;)l=n[++s].to;t.highlight(i.state,a,l,(c,h)=>{let u=i.state.selection.ranges.some(d=>d.from==c&&d.to==h);r.add(c,h,u?$B:CB)})}return r.finish()}},{decorations:t=>t.decorations});function pl(t){return e=>{let i=e.state.field(Qs,!1);return i&&i.query.spec.valid?t(e,i):ny(e)}}const th=pl((t,{query:e})=>{let{to:i}=t.state.selection.main,r=e.nextMatch(t.state,i,i);if(!r)return!1;let s=le.single(r.from,r.to),n=t.state.facet(po);return t.dispatch({selection:s,effects:[kp(t,r),n.scrollToMatch(s.main,t)],userEvent:"select.search"}),sy(t),!0}),ih=pl((t,{query:e})=>{let{state:i}=t,{from:r}=i.selection.main,s=e.prevMatch(i,r,r);if(!s)return!1;let n=le.single(s.from,s.to),o=t.state.facet(po);return t.dispatch({selection:n,effects:[kp(t,s),o.scrollToMatch(n.main,t)],userEvent:"select.search"}),sy(t),!0}),QB=pl((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:le.create(i.map(r=>le.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),TB=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:r,to:s}=i.main,n=[],o=0;for(let a=new so(t.doc,t.sliceDoc(r,s));!a.next().done;){if(n.length>1e3)return!1;a.value.from==r&&(o=n.length),n.push(le.range(a.value.from,a.value.to))}return e(t.update({selection:le.create(n,o),userEvent:"select.search.matches"})),!0},Jg=pl((t,{query:e})=>{let{state:i}=t,{from:r,to:s}=i.selection.main;if(i.readOnly)return!1;let n=e.nextMatch(i,r,r);if(!n)return!1;let o=n,a=[],l,c,h=[];o.from==r&&o.to==s&&(c=i.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(i,o.from,o.to),h.push(Ce.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+".")));let u=t.state.changes(a);return o&&(l=le.single(o.from,o.to).map(u),h.push(kp(t,o)),h.push(i.facet(po).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),MB=pl((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(s=>{let{from:n,to:o}=s;return{from:n,to:o,insert:e.getReplacement(s)}});if(!i.length)return!1;let r=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Ce.announce.of(r),userEvent:"input.replace.all"}),!0});function wp(t){return t.state.facet(po).createPanel(t)}function Vd(t,e){var i,r,s,n,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(po);return new ty({search:((i=e?.literal)!==null&&i!==void 0?i:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(n=e?.regexp)!==null&&n!==void 0?n:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function ry(t){let e=hp(t,wp);return e&&e.dom.querySelector("[main-field]")}function sy(t){let e=ry(t);e&&e==t.root.activeElement&&e.select()}const ny=t=>{let e=t.state.field(Qs,!1);if(e&&e.panel){let i=ry(t);if(i&&i!=t.root.activeElement){let r=Vd(t.state,e.query.spec);r.valid&&t.dispatch({effects:za.of(r)}),i.focus(),i.select()}}else t.dispatch({effects:[Sp.of(!0),e?za.of(Vd(t.state,e.query.spec)):Ve.appendConfig.of(EB)]});return!0},oy=t=>{let e=t.state.field(Qs,!1);if(!e||!e.panel)return!1;let i=hp(t,wp);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Sp.of(!1)}),!0},BB=[{key:"Mod-f",run:ny,scope:"editor search-panel"},{key:"F3",run:th,shift:ih,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:th,shift:ih,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oy,scope:"editor search-panel"},{key:"Mod-Shift-l",run:TB},{key:"Mod-Alt-g",run:lB},{key:"Mod-d",run:bB,preventDefault:!0}];class AB{constructor(e){this.view=e;let i=this.query=e.state.field(Qs).query.spec;this.commit=this.commit.bind(this),this.searchField=dt("input",{value:i.search,placeholder:Qi(e,"Find"),"aria-label":Qi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=dt("input",{value:i.replace,placeholder:Qi(e,"Replace"),"aria-label":Qi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=dt("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=dt("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=dt("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function r(s,n,o){return dt("button",{class:"cm-button",name:s,onclick:n,type:"button"},o)}this.dom=dt("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>th(e),[Qi(e,"next")]),r("prev",()=>ih(e),[Qi(e,"previous")]),r("select",()=>QB(e),[Qi(e,"all")]),dt("label",null,[this.caseField,Qi(e,"match case")]),dt("label",null,[this.reField,Qi(e,"regexp")]),dt("label",null,[this.wordField,Qi(e,"by word")]),...e.state.readOnly?[]:[dt("br"),this.replaceField,r("replace",()=>Jg(e),[Qi(e,"replace")]),r("replaceAll",()=>MB(e),[Qi(e,"replace all")])],dt("button",{name:"close",onclick:()=>oy(e),"aria-label":Qi(e,"close"),type:"button"},["×"])])}commit(){let e=new ty({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:za.of(e)}))}keydown(e){DT(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ih:th)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Jg(this.view))}update(e){for(let i of e.transactions)for(let r of i.effects)r.is(za)&&!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(po).top}}function Qi(t,e){return t.state.phrase(e)}const Yl=30,jl=/[\s\.,:;?!]/;function kp(t,{from:e,to:i}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(i).to,n=Math.max(r.from,e-Yl),o=Math.min(s,i+Yl),a=t.state.sliceDoc(n,o);if(n!=r.from){for(let l=0;l<Yl;l++)if(!jl.test(a[l+1])&&jl.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Yl;l--)if(!jl.test(a[l-1])&&jl.test(a[l])){a=a.slice(0,l);break}}return Ce.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const RB=Ce.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"}}),EB=[Qs,os.low(PB),RB];class Cp{constructor(e,i,r,s){this.state=e,this.pos=i,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let i=Ot(this.state).resolveInner(this.pos,-1);for(;i&&e.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}matchBefore(e){let i=this.state.doc.lineAt(this.pos),r=Math.max(i.from,this.pos-250),s=i.text.slice(r-i.from,this.pos-i.from),n=s.search(ly(e,!1));return n<0?null:{from:r+n,to:this.pos,text:s.slice(n)}}get aborted(){return this.abortListeners==null}addEventListener(e,i,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(i),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function eO(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function DB(t){let e=Object.create(null),i=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let n=1;n<s.length;n++)i[s[n]]=!0}let r=eO(e)+eO(i)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function ay(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[i,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:DB(e);return s=>{let n=s.matchBefore(r);return n||s.explicit?{from:n?n.from:s.pos,options:e,validFor:i}:null}}function LB(t,e){return i=>{for(let r=Ot(i.state).resolveInner(i.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(i)}}class tO{constructor(e,i,r,s){this.completion=e,this.source=i,this.match=r,this.score=s}}function cn(t){return t.selection.main.from}function ly(t,e){var i;let{source:r}=t,s=e&&r[0]!="^",n=r[r.length-1]!="$";return!s&&!n?t:new RegExp(`${s?"^":""}(?:${r})${n?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}const $p=as.define();function IB(t,e,i,r){let{main:s}=t.selection,n=i-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&i!=r&&t.sliceDoc(a.from+n,a.from+o)!=t.sliceDoc(i,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+n,to:r==s.from?a.to:a.from+o,insert:l},range:le.cursor(a.from+n+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const iO=new WeakMap;function NB(t){if(!Array.isArray(t))return t;let e=iO.get(t);return e||iO.set(t,e=ay(t)),e}const rh=Ve.define(),Za=Ve.define();class zB{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let i=0;i<e.length;){let r=wi(e,i),s=Pr(r);this.chars.push(r);let n=e.slice(i,i+s),o=n.toUpperCase();this.folded.push(wi(o==n?n.toLowerCase():o,0)),i+=s}this.astral=e.length!=this.chars.length}ret(e,i){return this.score=e,this.matched=i,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:i,folded:r,any:s,precise:n,byWord:o}=this;if(i.length==1){let S=wi(e,0),k=Pr(S),T=k==e.length?0:-100;if(S!=i[0])if(S==r[0])T+=-200;else return null;return this.ret(T,[0,k])}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=i.length,c=0;if(a<0){for(let S=0,k=Math.min(e.length,200);S<k&&c<l;){let T=wi(e,S);(T==i[c]||T==r[c])&&(s[c++]=S),S+=Pr(T)}if(c<l)return null}let h=0,u=0,d=!1,p=0,f=-1,g=-1,v=/[a-z]/.test(e),b=!0;for(let S=0,k=Math.min(e.length,200),T=0;S<k&&u<l;){let $=wi(e,S);a<0&&(h<l&&$==i[h]&&(n[h++]=S),p<l&&($==i[p]||$==r[p]?(p==0&&(f=S),g=S+1,p++):p=0));let R,D=$<255?$>=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(R=Hf($))!=R.toLowerCase()?1:R!=R.toUpperCase()?2:0;(!S||D==1&&v||T==0&&D!=0)&&(i[u]==$||r[u]==$&&(d=!0)?o[u++]=S:o.length&&(b=!1)),T=D,S+=Pr($)}return u==l&&o[0]==0&&b?this.result(-100+(d?-200:0),o,e):p==l&&f==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,[f,g]):u==l?this.result(-100+(d?-200:0)+-700+(b?0:-1100),o,e):i.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,i,r){let s=[],n=0;for(let o of i){let a=o+(this.astral?Pr(wi(r,o)):1);n&&s[n-1]==o?s[n-1]=a:(s[n++]=o,s[n++]=a)}return this.ret(e-r.length,s)}}class ZB{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 i=e.slice(0,this.pattern.length),r=i==this.pattern?0:i.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,i.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const jt=Qe.define({combine(t){return Zr(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:XB,filterStrict:!1,compareCompletions:(e,i)=>(e.sortText||e.label).localeCompare(i.sortText||i.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,i)=>e&&i,closeOnBlur:(e,i)=>e&&i,icons:(e,i)=>e&&i,tooltipClass:(e,i)=>r=>rO(e(r),i(r)),optionClass:(e,i)=>r=>rO(e(r),i(r)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function rO(t,e){return t?e?t+" "+e:t:e}function XB(t,e,i,r,s,n){let o=t.textDirection==gt.RTL,a=o,l=!1,c="top",h,u,d=e.left-s.left,p=s.right-e.right,f=r.right-r.left,g=r.bottom-r.top;if(a&&d<Math.min(f,p)?a=!1:!a&&p<Math.min(f,d)&&(a=!0),f<=(a?d:p))h=Math.max(s.top,Math.min(i.top,s.bottom-g))-e.top,u=Math.min(400,a?d:p);else{l=!0,u=Math.min(400,(o?e.right:s.right-e.left)-30);let S=s.bottom-e.bottom;S>=g||S>e.top?h=i.bottom-e.top:(c="bottom",h=e.bottom-i.top)}let v=(e.bottom-e.top)/n.offsetHeight,b=(e.right-e.left)/n.offsetWidth;return{style:`${c}: ${h/v}px; max-width: ${u/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function WB(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(i){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),i.type&&r.classList.add(...i.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(i,r,s,n){let o=document.createElement("span");o.className="cm-completionLabel";let a=i.displayLabel||i.label,l=0;for(let c=0;c<n.length;){let h=n[c++],u=n[c++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(h,u))),d.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(i){if(!i.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=i.detail,r},position:80}),e.sort((i,r)=>i.position-r.position).map(i=>i.render)}function pu(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/i);return{from:s*i,to:(s+1)*i}}let r=Math.floor((t-e)/i);return{from:t-(r+1)*i,to:t-r*i}}class VB{constructor(e,i,r){this.view=e,this.stateField=i,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(i),{options:n,selected:o}=s.open,a=e.state.facet(jt);this.optionContent=WB(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=pu(n.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(i).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(jt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Za.of(null)})}),this.showOptions(n,s.id)}mount(){this.updateSel()}showOptions(e,i){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,i,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var i;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:n,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=n)&&(this.range=pu(n.length,o,e.state.facet(jt).maxRenderedOptions),this.showOptions(n,r.id)),this.updateSel(),a!=((i=s.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let i=this.tooltipClass(e);if(i!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of i.split(" "))r&&this.dom.classList.add(r);this.currentClass=i}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),i=e.open;(i.selected>-1&&i.selected<this.range.from||i.selected>=this.range.to)&&(this.range=pu(i.options.length,i.selected,this.view.state.facet(jt).maxRenderedOptions),this.showOptions(i.options,e.id));let r=this.updateSelectedOption(i.selected);if(r){this.destroyInfo();let{completion:s}=i.options[i.selected],{info:n}=s;if(!n)return;let o=typeof n=="string"?document.createTextNode(n):n(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=>$i(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,i){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:n}=e;r.appendChild(s),this.infoDestroy=n||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let i=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"),i=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return i&&HB(this.list,i),i}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let i=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),n=this.space;if(!n){let o=this.dom.ownerDocument.documentElement;n={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(n.bottom,i.bottom)-10||s.bottom<Math.max(n.top,i.top)+10?null:this.view.state.facet(jt).positionInfo(this.view,i,s,r,n,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,i,r){const s=document.createElement("ul");s.id=i,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 n=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=n&&(o>r.from||r.from==0))if(n=d,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=d}}const h=s.appendChild(document.createElement("li"));h.id=i+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let d of this.optionContent){let p=d(a,this.view.state,this.view,l);p&&h.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 FB(t,e){return i=>new VB(i,t,e)}function HB(t,e){let i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=i.height/t.offsetHeight;r.top<i.top?t.scrollTop-=(i.top-r.top)/s:r.bottom>i.bottom&&(t.scrollTop+=(r.bottom-i.bottom)/s)}function sO(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function qB(t,e){let i=[],r=null,s=null,n=h=>{i.push(h);let{section:u}=h.completion;if(u){r||(r=[]);let d=typeof u=="string"?u:u.name;r.some(p=>p.name==d)||r.push(typeof u=="string"?{name:d}:u)}},o=e.facet(jt);for(let h of t)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let d of h.result.options)n(new tO(d,h.source,u?u(d):[],1e9-i.length));else{let d=e.sliceDoc(h.from,h.to),p,f=o.filterStrict?new ZB(d):new zB(d);for(let g of h.result.options)if(p=f.match(g.label)){let v=g.displayLabel?u?u(g,p.matched):[]:p.matched,b=p.score+(g.boost||0);if(n(new tO(g,h.source,v,b)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:S}=g.section;s||(s=Object.create(null)),s[S]=Math.max(b,s[S]||-1e9)}}}}if(r){let h=Object.create(null),u=0,d=(p,f)=>(p.rank==="dynamic"&&f.rank==="dynamic"?s[f.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof f.rank=="number"?f.rank:1e9)||(p.name<f.name?-1:1);for(let p of r.sort(d))u-=1e5,h[p.name]=u;for(let p of i){let{section:f}=p.completion;f&&(p.score+=h[typeof f=="string"?f:f.name])}}let a=[],l=null,c=o.compareCompletions;for(let h of i.sort((u,d)=>d.score-u.score||c(u.completion,d.completion))){let u=h.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(h):sO(h.completion)>sO(l)&&(a[a.length-1]=h),l=h.completion}return a}class Nn{constructor(e,i,r,s,n,o){this.options=e,this.attrs=i,this.tooltip=r,this.timestamp=s,this.selected=n,this.disabled=o}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new Nn(this.options,nO(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,r,s,n,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=qB(e,i);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=i.facet(jt).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==c){l=h;break}}return new Nn(a,nO(r,l),{pos:e.reduce((c,h)=>h.hasResult()?Math.min(c,h.from):c,1e8),create:JB,above:n.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new Nn(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Nn(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class sh{constructor(e,i,r){this.active=e,this.id=i,this.open=r}static start(){return new sh(GB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,r=i.facet(jt),n=(r.override||i.languageDataAt("autocomplete",cn(i)).map(NB)).map(l=>(this.active.find(h=>h.source==l)||new Ki(l,this.active.some(h=>h.state!=0)?1:0)).update(e,r));n.length==this.active.length&&n.every((l,c)=>l==this.active[c])&&(n=this.active);let o=this.open,a=e.effects.some(l=>l.is(Pp));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||n.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!YB(n,this.active)||a?o=Nn.build(n,i,this.id,o,r,a):o&&o.disabled&&!n.some(l=>l.isPending)&&(o=null),!o&&n.every(l=>!l.isPending)&&n.some(l=>l.hasResult())&&(n=n.map(l=>l.hasResult()?new Ki(l.source,0):l));for(let l of e.effects)l.is(hy)&&(o=o&&o.setSelected(l.value,this.id));return n==this.active&&o==this.open?this:new sh(n,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?jB:UB}}function YB(t,e){if(t==e)return!0;for(let i=0,r=0;;){for(;i<t.length&&!t[i].hasResult();)i++;for(;r<e.length&&!e[r].hasResult();)r++;let s=i==t.length,n=r==e.length;if(s||n)return s==n;if(t[i++].result!=e[r++].result)return!1}}const jB={"aria-autocomplete":"list"},UB={};function nO(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const GB=[];function cy(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation($p);if(r&&e.activateOnCompletion(r))return 12}let i=t.isUserEvent("input.type");return i&&e.activateOnTyping?5:i?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ki{constructor(e,i,r=!1){this.source=e,this.state=i,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,i){let r=cy(e,i),s=this;(r&8||r&16&&this.touches(e))&&(s=new Ki(s.source,0)),r&4&&s.state==0&&(s=new Ki(this.source,1)),s=s.updateFor(e,r);for(let n of e.effects)if(n.is(rh))s=new Ki(s.source,1,n.value);else if(n.is(Za))s=new Ki(s.source,0);else if(n.is(Pp))for(let o of n.value)o.source==s.source&&(s=o);return s}updateFor(e,i){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(cn(e.state))}}class Yn extends Ki{constructor(e,i,r,s,n,o){super(e,3,i),this.limit=r,this.result=s,this.from=n,this.to=o}hasResult(){return!0}updateFor(e,i){var r;if(!(i&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let n=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=cn(e.state);if(a>o||!s||i&2&&(cn(e.startState)==this.from||a<this.limit))return new Ki(this.source,i&4?1:0);let l=e.changes.mapPos(this.limit);return KB(s.validFor,e.state,n,o)?new Yn(this.source,this.explicit,l,s,n,o):s.update&&(s=s.update(s,n,o,new Cp(e.state,a,!1)))?new Yn(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:cn(e.state)):new Ki(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Yn(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ki(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function KB(t,e,i,r){if(!t)return!1;let s=e.sliceDoc(i,r);return typeof t=="function"?t(s,i,r,e):ly(t,!0).test(s)}const Pp=Ve.define({map(t,e){return t.map(i=>i.map(e))}}),hy=Ve.define(),ki=Kt.define({create(){return sh.start()},update(t,e){return t.update(e)},provide:t=>[cp.from(t,e=>e.tooltip),Ce.contentAttributes.from(t,e=>e.attrs)]});function Qp(t,e){const i=e.completion.apply||e.completion.label;let r=t.state.field(ki).active.find(s=>s.source==e.source);return r instanceof Yn?(typeof i=="string"?t.dispatch({...IB(t.state,i,r.from,r.to),annotations:$p.of(e.completion)}):i(t,e.completion,r.from,r.to),!0):!1}const JB=FB(ki,Qp);function Ul(t,e="option"){return i=>{let r=i.state.field(ki,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<i.state.facet(jt).interactionDelay)return!1;let s=1,n;e=="page"&&(n=W1(i,r.open.tooltip))&&(s=Math.max(2,Math.floor(n.dom.offsetHeight/n.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),i.dispatch({effects:hy.of(a)}),!0}}const eA=t=>{let e=t.state.field(ki,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(jt).interactionDelay?!1:Qp(t,e.open.options[e.open.selected])},mu=t=>t.state.field(ki,!1)?(t.dispatch({effects:rh.of(!0)}),!0):!1,tA=t=>{let e=t.state.field(ki,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:Za.of(null)}),!0)};class iA{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}}const rA=50,sA=1e3,nA=Mt.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(ki).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ki),i=t.state.facet(jt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ki)==e)return;let r=t.transactions.some(n=>{let o=cy(n,i);return o&8||(n.selection||n.docChanged)&&!(o&3)});for(let n=0;n<this.running.length;n++){let o=this.running[n];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>rA&&Date.now()-o.time>sA){for(let a of o.context.abortListeners)try{a()}catch(l){$i(this.view.state,l)}o.context.abortListeners=null,this.running.splice(n--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(n=>n.effects.some(o=>o.is(rh)))&&(this.pendingStart=!0);let s=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(n=>n.isPending&&!this.running.some(o=>o.active.source==n.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let n of t.transactions)n.isUserEvent("input.type")?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ki);for(let i of e.active)i.isPending&&!this.running.some(r=>r.active.source==i.source)&&this.startQuery(i);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(jt).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=cn(e),r=new Cp(e,i,t.explicit,this.view),s=new iA(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(n=>{s.context.aborted||(s.done=n||null,this.scheduleAccept())},n=>{this.view.dispatch({effects:Za.of(null)}),$i(this.view.state,n)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(jt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(jt),r=this.view.state.field(ki);for(let s=0;s<this.running.length;s++){let n=this.running[s];if(n.done===void 0)continue;if(this.running.splice(s--,1),n.done){let a=cn(n.updates.length?n.updates[0].startState:this.view.state),l=Math.min(a,n.done.from+(n.active.explicit?0:1)),c=new Yn(n.active.source,n.active.explicit,l,n.done,n.done.from,(t=n.done.to)!==null&&t!==void 0?t:a);for(let h of n.updates)c=c.update(h,i);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==n.active.source);if(o&&o.isPending)if(n.done==null){let a=new Ki(n.active.source,0);for(let l of n.updates)a=a.update(l,i);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Pp.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ki,!1);if(e&&e.tooltip&&this.view.state.facet(jt).closeOnBlur){let i=e.open&&W1(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Za.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:rh.of(!1)}),20),this.composing=0}}}),oA=typeof navigator=="object"&&/Win/.test(navigator.platform),aA=os.highest(Ce.domEventHandlers({keydown(t,e){let i=e.state.field(ki,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(oA&&t.altKey)||t.metaKey)return!1;let r=i.open.options[i.open.selected],s=i.active.find(o=>o.source==r.source),n=r.completion.commitCharacters||s.result.commitCharacters;return n&&n.indexOf(t.key)>-1&&Qp(e,r),!1}})),uy=Ce.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 lA{constructor(e,i,r,s){this.field=e,this.line=i,this.from=r,this.to=s}}class Tp{constructor(e,i,r){this.field=e,this.from=i,this.to=r}map(e){let i=e.mapPos(this.from,-1,ii.TrackDel),r=e.mapPos(this.to,1,ii.TrackDel);return i==null||r==null?null:new Tp(this.field,i,r)}}class Mp{constructor(e,i){this.lines=e,this.fieldPositions=i}instantiate(e,i){let r=[],s=[i],n=e.doc.lineAt(i),o=/^\s*/.exec(n.text)[0];for(let l of this.lines){if(r.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;u<h;u++)c+=e.facet(cl);s.push(i+c.length-h),l=c+l.slice(h)}r.push(l),i+=l.length+1}let a=this.fieldPositions.map(l=>new Tp(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let i=[],r=[],s=[],n;for(let o of e.split(/\r\n?|\n/)){for(;n=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=n[1]?+n[1]:null,l=n[2]||n[3]||"",c=-1,h=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u<i.length;u++)(a!=null?i[u].seq==a:h&&i[u].name==h)&&(c=u);if(c<0){let u=0;for(;u<i.length&&(a==null||i[u].seq!=null&&i[u].seq<a);)u++;i.splice(u,0,{seq:a,name:h}),c=u;for(let d of s)d.field>=c&&d.field++}for(let u of s)if(u.line==r.length&&u.from>n.index){let d=n[2]?3+(n[1]||"").length:2;u.from-=d,u.to-=d}s.push(new lA(c,r.length,n.index,n.index+h.length)),o=o.slice(0,n.index)+l+o.slice(n.index+n[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let h of s)h.line==r.length&&h.from>c&&(h.from--,h.to--);return l}),r.push(o)}return new Mp(r,s)}}let cA=Ie.widget({widget:new class extends Xr{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),hA=Ie.mark({class:"cm-snippetField"});class mo{constructor(e,i){this.ranges=e,this.active=i,this.deco=Ie.set(e.map(r=>(r.from==r.to?cA:hA).range(r.from,r.to)),!0)}map(e){let i=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;i.push(s)}return new mo(i,this.active)}selectionInsideField(e){return e.ranges.every(i=>this.ranges.some(r=>r.field==this.active&&r.from<=i.from&&r.to>=i.to))}}const ml=Ve.define({map(t,e){return t&&t.map(e)}}),uA=Ve.define(),Xa=Kt.define({create(){return null},update(t,e){for(let i of e.effects){if(i.is(ml))return i.value;if(i.is(uA)&&t)return new mo(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ce.decorations.from(t,e=>e?e.deco:Ie.none)});function Bp(t,e){return le.create(t.filter(i=>i.field==e).map(i=>le.range(i.from,i.to)))}function dA(t){let e=Mp.parse(t);return(i,r,s,n)=>{let{text:o,ranges:a}=e.instantiate(i.state,s),{main:l}=i.state.selection,c={changes:{from:s,to:n==l.from?l.to:n,insert:ot.of(o)},scrollIntoView:!0,annotations:r?[$p.of(r),Dt.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=Bp(a,0)),a.some(h=>h.field>0)){let h=new mo(a,0),u=c.effects=[ml.of(h)];i.state.field(Xa,!1)===void 0&&u.push(Ve.appendConfig.of([Xa,OA,vA,uy]))}i.dispatch(i.state.update(c))}}function dy(t){return({state:e,dispatch:i})=>{let r=e.field(Xa,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,n=t>0&&!r.ranges.some(o=>o.field==s+t);return i(e.update({selection:Bp(r.ranges,s),effects:ml.of(n?null:new mo(r.ranges,s)),scrollIntoView:!0})),!0}}const fA=({state:t,dispatch:e})=>t.field(Xa,!1)?(e(t.update({effects:ml.of(null)})),!0):!1,pA=dy(1),mA=dy(-1),gA=[{key:"Tab",run:pA,shift:mA},{key:"Escape",run:fA}],oO=Qe.define({combine(t){return t.length?t[0]:gA}}),OA=os.highest(ol.compute([oO],t=>t.facet(oO)));function xi(t,e){return{...e,apply:dA(t)}}const vA=Ce.domEventHandlers({mousedown(t,e){let i=e.state.field(Xa,!1),r;if(!i||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=i.ranges.find(n=>n.from<=r&&n.to>=r);return!s||s.field==i.active?!1:(e.dispatch({selection:Bp(i.ranges,s.field),effects:ml.of(i.ranges.some(n=>n.field>s.field)?new mo(i.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Wa={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},on=Ve.define({map(t,e){let i=e.mapPos(t,-1,ii.TrackAfter);return i??void 0}}),Ap=new class extends As{};Ap.startSide=1;Ap.endSide=-1;const fy=Kt.define({create(){return et.empty},update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=i.from&&r<=i.to})}for(let i of e.effects)i.is(on)&&(t=t.update({add:[Ap.range(i.value,i.value+1)]}));return t}});function bA(){return[_A,fy]}const gu="()[]{}<>«»»«[]{}";function py(t){for(let e=0;e<gu.length;e+=2)if(gu.charCodeAt(e)==t)return gu.charAt(e+1);return Hf(t<128?t:t+1)}function my(t,e){return t.languageDataAt("closeBrackets",e)[0]||Wa}const yA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),_A=Ce.inputHandler.of((t,e,i,r)=>{if((yA?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Pr(wi(r,0))==1||e!=s.from||i!=s.to)return!1;let n=wA(t.state,r);return n?(t.dispatch(n),!0):!1}),xA=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=my(t,t.selection.main.head).brackets||Wa.brackets,s=null,n=t.changeByRange(o=>{if(o.empty){let a=kA(t.doc,o.head);for(let l of r)if(l==a&&Lh(t.doc,o.head)==py(wi(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:le.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(n,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},SA=[{key:"Backspace",run:xA}];function wA(t,e){let i=my(t,t.selection.main.head),r=i.brackets||Wa.brackets;for(let s of r){let n=py(wi(s,0));if(e==s)return n==s?PA(t,s,r.indexOf(s+s+s)>-1,i):CA(t,s,n,i.before||Wa.before);if(e==n&&gy(t,t.selection.main.from))return $A(t,s,n)}return null}function gy(t,e){let i=!1;return t.field(fy).between(0,t.doc.length,r=>{r==e&&(i=!0)}),i}function Lh(t,e){let i=t.sliceString(e,e+2);return i.slice(0,Pr(wi(i,0)))}function kA(t,e){let i=t.sliceString(e-2,e);return Pr(wi(i,0))==i.length?i:i.slice(1)}function CA(t,e,i,r){let s=null,n=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:i,from:o.to}],effects:on.of(o.to+e.length),range:le.range(o.anchor+e.length,o.head+e.length)};let a=Lh(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+i,from:o.head},effects:on.of(o.head+e.length),range:le.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function $A(t,e,i){let r=null,s=t.changeByRange(n=>n.empty&&Lh(t.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:le.cursor(n.head+i.length)}:r={range:n});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function PA(t,e,i,r){let s=r.stringPrefixes||Wa.stringPrefixes,n=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:on.of(a.to+e.length),range:le.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Lh(t.doc,l),h;if(c==e){if(aO(t,l))return{changes:{insert:e+e,from:l},effects:on.of(l+e.length),range:le.cursor(l+e.length)};if(gy(t,l)){let d=i&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:le.cursor(l+d.length)}}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=lO(t,l-2*e.length,s))>-1&&aO(t,h))return{changes:{insert:e+e+e+e,from:l},effects:on.of(l+e.length),range:le.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=_t.Word&&lO(t,l,s)>-1&&!QA(t,l,e,s))return{changes:{insert:e+e,from:l},effects:on.of(l+e.length),range:le.cursor(l+e.length)}}return{range:n=a}});return n?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function aO(t,e){let i=Ot(t).resolveInner(e+1);return i.parent&&i.from==e}function QA(t,e,i,r){let s=Ot(t).resolveInner(e,-1),n=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+i.length+n)),l=a.indexOf(i);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>i.length+l;){if(t.sliceDoc(h.to-i.length,h.to)==i)return!1;h=h.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function lO(t,e,i){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=_t.Word)return e;for(let s of i){let n=e-s.length;if(t.sliceDoc(n,e)==s&&r(t.sliceDoc(n-1,n))!=_t.Word)return n}return-1}function TA(t={}){return[aA,ki,jt.of(t),nA,MA,uy]}const Oy=[{key:"Ctrl-Space",run:mu},{mac:"Alt-`",run:mu},{mac:"Alt-i",run:mu},{key:"Escape",run:tA},{key:"ArrowDown",run:Ul(!0)},{key:"ArrowUp",run:Ul(!1)},{key:"PageDown",run:Ul(!0,"page")},{key:"PageUp",run:Ul(!1,"page")},{key:"Enter",run:eA}],MA=os.highest(ol.computeN([jt],t=>t.facet(jt).defaultKeymap?[Oy]:[]));class cO{constructor(e,i,r){this.from=e,this.to=i,this.diagnostic=r}}class en{constructor(e,i,r){this.diagnostics=e,this.panel=i,this.selected=r}static init(e,i,r){let s=r.facet(Va).markerFilter;s&&(e=s(e,r));let n=e.slice().sort((p,f)=>p.from-f.from||p.to-f.to),o=new is,a=[],l=0,c=r.doc.iter(),h=0,u=r.doc.length;for(let p=0;;){let f=p==n.length?null:n[p];if(!f&&!a.length)break;let g,v;if(a.length)g=l,v=a.reduce((k,T)=>Math.min(k,T.to),f&&f.from>g?f.from:1e8);else{if(g=f.from,g>u)break;v=f.to,a.push(f),p++}for(;p<n.length;){let k=n[p];if(k.from==g&&(k.to>k.from||k.to==g))a.push(k),p++,v=Math.min(k.to,v);else{v=Math.min(k.from,v);break}}v=Math.min(v,u);let b=!1;if(a.some(k=>k.from==g&&(k.to==v||v==u))&&(b=g==v,!b&&v-g<10)){let k=g-(h+c.value.length);k>0&&(c.next(k),h=g);for(let T=g;;){if(T>=v){b=!0;break}if(!c.lineBreak&&h+c.value.length>T)break;T=h+c.value.length,h+=c.value.length,c.next()}}let S=VA(a);if(b)o.add(g,g,Ie.widget({widget:new zA(S),diagnostics:a.slice()}));else{let k=a.reduce((T,$)=>$.markClass?T+" "+$.markClass:T,"");o.add(g,v,Ie.mark({class:"cm-lintRange cm-lintRange-"+S+k,diagnostics:a.slice(),inclusiveEnd:a.some(T=>T.to>v)}))}if(l=v,l==u)break;for(let k=0;k<a.length;k++)a[k].to<=l&&a.splice(k--,1)}let d=o.finish();return new en(d,i,Ns(d))}}function Ns(t,e=null,i=0){let r=null;return t.between(i,1e9,(s,n,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new cO(s,n,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new cO(r.from,n,r.diagnostic)}}),r}function BA(t,e){let i=e.pos,r=e.end||i,s=t.state.facet(Va).hideOn(t,i,r);if(s!=null)return s;let n=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(vy))||t.changes.touchesRange(n.from,Math.max(n.to,r)))}function AA(t,e){return t.field(Ii,!1)?e:e.concat(Ve.appendConfig.of(FA))}const vy=Ve.define(),Rp=Ve.define(),by=Ve.define(),Ii=Kt.define({create(){return new en(Ie.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let n=e.changes.mapPos(t.selected.from,1);r=Ns(i,t.selected.diagnostic,n)||Ns(i,null,n)}!i.size&&s&&e.state.facet(Va).autoPanel&&(s=null),t=new en(i,s,r)}for(let i of e.effects)if(i.is(vy)){let r=e.state.facet(Va).autoPanel?i.value.length?Fa.open:null:t.panel;t=en.init(i.value,r,e.state)}else i.is(Rp)?t=new en(t.diagnostics,i.value?Fa.open:null,t.selected):i.is(by)&&(t=new en(t.diagnostics,t.panel,i.value));return t},provide:t=>[Ra.from(t,e=>e.panel),Ce.decorations.from(t,e=>e.diagnostics)]}),RA=Ie.mark({class:"cm-lintRange cm-lintRange-active"});function EA(t,e,i){let{diagnostics:r}=t.state.field(Ii),s,n=-1,o=-1;r.between(e-(i<0?1:0),e+(i>0?1:0),(l,c,{spec:h})=>{if(e>=l&&e<=c&&(l==c||(e>l||i>0)&&(e<c||i<0)))return s=h.diagnostics,n=l,o=c,!1});let a=t.state.facet(Va).tooltipFilter;return s&&a&&(s=a(s,t.state)),s?{pos:n,end:o,above:t.state.doc.lineAt(n).to<o,create(){return{dom:DA(t,s)}}}:null}function DA(t,e){return dt("ul",{class:"cm-tooltip-lint"},e.map(i=>_y(t,i,!1)))}const LA=t=>{let e=t.state.field(Ii,!1);(!e||!e.panel)&&t.dispatch({effects:AA(t.state,[Rp.of(!0)])});let i=hp(t,Fa.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},hO=t=>{let e=t.state.field(Ii,!1);return!e||!e.panel?!1:(t.dispatch({effects:Rp.of(!1)}),!0)},IA=t=>{let e=t.state.field(Ii,!1);if(!e)return!1;let i=t.state.selection.main,r=Ns(e.diagnostics,null,i.to+1);return!r&&(r=Ns(e.diagnostics,null,0),!r||r.from==i.from&&r.to==i.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},NA=[{key:"Mod-Shift-m",run:LA,preventDefault:!0},{key:"F8",run:IA}],Va=Qe.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Zr(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:uO,tooltipFilter:uO,needsRefresh:(e,i)=>e?i?r=>e(r)||i(r):e:i,hideOn:(e,i)=>e?i?(r,s,n)=>e(r,s,n)||i(r,s,n):e:i,autoPanel:(e,i)=>e||i})}}});function uO(t,e){return t?e?(i,r)=>e(t(i,r),r):t:e}function yy(t){let e=[];if(t)e:for(let{name:i}of t){for(let r=0;r<i.length;r++){let s=i[r];if(/[a-zA-Z]/.test(s)&&!e.some(n=>n.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function _y(t,e,i){var r;let s=i?yy(e.actions):[];return dt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},dt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((n,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let f=Ns(t.state.field(Ii).diagnostics,e);f&&n.apply(t,f.from,f.to)},{name:c}=n,h=s[o]?c.indexOf(s[o]):-1,u=h<0?c:[c.slice(0,h),dt("u",c.slice(h,h+1)),c.slice(h+1)],d=n.markClass?" "+n.markClass:"";return dt("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${s[o]})"`}.`},u)}),e.source&&dt("div",{class:"cm-diagnosticSource"},e.source))}class zA extends Xr{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return dt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class dO{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=_y(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Fa{constructor(e){this.view=e,this.items=[];let i=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)hO(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:n}=this.items[this.selectedIndex],o=yy(n.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Ns(this.view.state.field(Ii).diagnostics,n);l&&n.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()}},r=s=>{for(let n=0;n<this.items.length;n++)this.items[n].dom.contains(s.target)&&this.moveSelection(n)};this.list=dt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:r}),this.dom=dt("div",{class:"cm-panel-lint"},this.list,dt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>hO(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ii).selected;if(!e)return-1;for(let i=0;i<this.items.length;i++)if(this.items[i].diagnostic==e.diagnostic)return i;return-1}update(){let{diagnostics:e,selected:i}=this.view.state.field(Ii),r=0,s=!1,n=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let h of c.diagnostics){if(o.has(h))continue;o.add(h);let u=-1,d;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==h){u=p;break}u<0?(d=new dO(this.view,h),this.items.splice(r,0,d),s=!0):(d=this.items[u],u>r&&(this.items.splice(r,u-r),s=!0)),i&&d.diagnostic==i.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),n=d):d.dom.hasAttribute("aria-selected")&&d.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 dO(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),n?(this.list.setAttribute("aria-activedescendant",n.id),this.view.requestMeasure({key:this,read:()=>({sel:n.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 i(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)i();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(Ii),r=Ns(i.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:by.of(r)})}static open(e){return new Fa(e)}}function ZA(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 Gl(t){return ZA(`<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 XA=Ce.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:Gl("#d11")},".cm-lintRange-warning":{backgroundImage:Gl("orange")},".cm-lintRange-info":{backgroundImage:Gl("#999")},".cm-lintRange-hint":{backgroundImage:Gl("#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 WA(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function VA(t){let e="hint",i=1;for(let r of t){let s=WA(r.severity);s>i&&(i=s,e=r.severity)}return e}const FA=[Ii,Ce.decorations.compute([Ii],t=>{let{selected:e,panel:i}=t.field(Ii);return!e||!i||e.from==e.to?Ie.none:Ie.set([RA.range(e.from,e.to)])}),x3(EA,{hideOn:BA}),XA],HA=[E3(),I3(),JT(),i4(),TM(),XT(),qT(),tt.allowMultipleSelections.of(!0),vM(),gb(RM,{fallback:!0}),ZM(),bA(),TA(),u3(),p3(),n3(),uB(),ol.of([...SA,...oB,...BB,...u4,...CM,...Oy,...NA])];class nh{static create(e,i,r,s,n){let o=s+(s<<8)+e+(i<<4)|0;return new nh(e,i,r,o,n,[],[])}constructor(e,i,r,s,n,o,a){this.type=e,this.value=i,this.from=r,this.hash=s,this.end=n,this.children=o,this.positions=a,this.hashProp=[[Fe.contextHash,s]]}addChild(e,i){e.prop(Fe.contextHash)!=this.hash&&(e=new at(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(i)}toTree(e,i=this.end){let r=this.children.length-1;return r>=0&&(i=Math.max(i,this.positions[r]+this.children[r].length+this.from)),new at(e.types[this.type],this.children,this.positions,i-this.from).balance({makeTree:(s,n,o)=>new at(Xt.none,s,n,o,this.hashProp)})}}var ye;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(ye||(ye={}));class qA{constructor(e,i){this.start=e,this.content=i,this.marks=[],this.parsers=[]}}class YA{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Sa(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,i=0,r=0){for(let s=i;s<e;s++)r+=this.text.charCodeAt(s)==9?4-r%4:1;return r}findColumn(e){let i=0;for(let r=0;i<this.text.length&&r<e;i++)r+=this.text.charCodeAt(i)==9?4-r%4:1;return i}scrub(){if(!this.baseIndent)return this.text;let e="";for(let i=0;i<this.basePos;i++)e+=" ";return e+this.text.slice(this.basePos)}}function fO(t,e,i){if(i.pos==i.text.length||t!=e.block&&i.indent>=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let r=(t.type==ye.OrderedList?Lp:Dp)(i,e,!1);return r>0&&(t.type!=ye.BulletList||Ep(i,e,!1)<0)&&i.text.charCodeAt(i.pos+r-1)==t.value}const xy={[ye.Blockquote](t,e,i){return i.next!=62?!1:(i.markers.push(it(ye.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(ir(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0)},[ye.ListItem](t,e,i){return i.indent<i.baseIndent+t.value&&i.next>-1?!1:(i.moveBaseColumn(i.baseIndent+t.value),!0)},[ye.OrderedList]:fO,[ye.BulletList]:fO,[ye.Document](){return!0}};function ir(t){return t==32||t==9||t==10||t==13}function Sa(t,e=0){for(;e<t.length&&ir(t.charCodeAt(e));)e++;return e}function pO(t,e,i){for(;e>i&&ir(t.charCodeAt(e-1));)e--;return e}function Sy(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let i=e;i<t.text.length;i++)if(t.text.charCodeAt(i)==96)return-1}return e}function wy(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function Ep(t,e,i){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let r=1;for(let s=t.pos+1;s<t.text.length;s++){let n=t.text.charCodeAt(s);if(n==t.next)r++;else if(!ir(n))return-1}return i&&t.next==45&&$y(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(My.SetextHeading)>-1||r<3?-1:1}function ky(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function Dp(t,e,i){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||ir(t.text.charCodeAt(t.pos+1)))&&(!i||ky(e,ye.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function Lp(t,e,i){let r=t.pos,s=t.next;for(;s>=48&&s<=57;){r++;if(r==t.text.length)return-1;s=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||s!=46&&s!=41||r<t.text.length-1&&!ir(t.text.charCodeAt(r+1))||i&&!ky(e,ye.OrderedList)&&(t.skipSpace(r+1)==t.text.length||r>t.pos+1||t.next!=49)?-1:r+1-t.pos}function Cy(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let i=e-t.pos;return i>6?-1:i}function $y(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let i=e;for(;e<t.text.length&&ir(t.text.charCodeAt(e));)e++;return e==t.text.length?i:-1}const Fd=/^[ \t]*$/,Py=/-->/,Qy=/\?>/,Hd=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Py],[/^\s*<\?/,Qy],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Fd],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Fd]];function Ty(t,e,i){if(t.next!=60)return-1;let r=t.text.slice(t.pos);for(let s=0,n=Hd.length-(i?1:0);s<n;s++)if(Hd[s][0].test(r))return s;return-1}function mO(t,e){let i=t.countIndent(e,t.pos,t.indent),r=t.countIndent(t.skipSpace(e),e,i);return r>=i+5?i+1:r}function Os(t,e,i){let r=t.length-1;r>=0&&t[r].to==e&&t[r].type==ye.CodeText?t[r].to=i:t.push(it(ye.CodeText,e,i))}const Kl={LinkReference:void 0,IndentedCode(t,e){let i=e.baseIndent+4;if(e.indent<i)return!1;let r=e.findColumn(i),s=t.lineStart+r,n=t.lineStart+e.text.length,o=[],a=[];for(Os(o,s,n);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){Os(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<i)break;{if(a.length){for(let c of a)c.type==ye.CodeText?Os(o,c.from,c.to):o.push(c);a=[]}Os(o,t.lineStart-1,t.lineStart);for(let c of e.markers)o.push(c);n=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<n&&Os(o,l,n)}}return a.length&&(a=a.filter(l=>l.type!=ye.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(ye.CodeBlock,n-s),s),!0},FencedCode(t,e){let i=Sy(e);if(i<0)return!1;let r=t.lineStart+e.pos,s=e.next,n=i-e.pos,o=e.skipSpace(i),a=pO(e.text,e.text.length,o),l=[it(ye.CodeMark,r,r+n)];o<a&&l.push(it(ye.CodeInfo,t.lineStart+o,t.lineStart+a));for(let c=!0,h=!0,u=!1;t.nextLine()&&e.depth>=t.stack.length;c=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==s;)d++;if(d-e.pos>=n&&e.skipSpace(d)==e.text.length){for(let p of e.markers)l.push(p);h&&u&&Os(l,t.lineStart-1,t.lineStart),l.push(it(ye.CodeMark,t.lineStart+e.pos,t.lineStart+d)),t.nextLine();break}else{u=!0,c||(Os(l,t.lineStart-1,t.lineStart),h=!1);for(let g of e.markers)l.push(g);let p=t.lineStart+e.basePos,f=t.lineStart+e.text.length;p<f&&(Os(l,p,f),h=!1)}}return t.addNode(t.buffer.writeElements(l,-r).finish(ye.FencedCode,t.prevLineEnd()-r),r),!0},Blockquote(t,e){let i=wy(e);return i<0?!1:(t.startContext(ye.Blockquote,e.pos),t.addNode(ye.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+i),null)},HorizontalRule(t,e){if(Ep(e,t,!1)<0)return!1;let i=t.lineStart+e.pos;return t.nextLine(),t.addNode(ye.HorizontalRule,i),!0},BulletList(t,e){let i=Dp(e,t,!1);if(i<0)return!1;t.block.type!=ye.BulletList&&t.startContext(ye.BulletList,e.basePos,e.next);let r=mO(e,e.pos+1);return t.startContext(ye.ListItem,e.basePos,r-e.baseIndent),t.addNode(ye.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+i),e.moveBaseColumn(r),null},OrderedList(t,e){let i=Lp(e,t,!1);if(i<0)return!1;t.block.type!=ye.OrderedList&&t.startContext(ye.OrderedList,e.basePos,e.text.charCodeAt(e.pos+i-1));let r=mO(e,e.pos+i);return t.startContext(ye.ListItem,e.basePos,r-e.baseIndent),t.addNode(ye.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+i),e.moveBaseColumn(r),null},ATXHeading(t,e){let i=Cy(e);if(i<0)return!1;let r=e.pos,s=t.lineStart+r,n=pO(e.text,e.text.length,r),o=n;for(;o>r&&e.text.charCodeAt(o-1)==e.next;)o--;(o==n||o==r||!ir(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(ye.HeaderMark,0,i).writeElements(t.parser.parseInline(e.text.slice(r+i+1,o),s+i+1),-s);o<e.text.length&&a.write(ye.HeaderMark,o-r,n-r);let l=a.finish(ye.ATXHeading1-1+i,e.text.length-r);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let i=Ty(e,t,!1);if(i<0)return!1;let r=t.lineStart+e.pos,s=Hd[i][1],n=[],o=s!=Fd;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let c of e.markers)n.push(c)}o&&t.nextLine();let a=s==Py?ye.CommentBlock:s==Qy?ye.ProcessingInstructionBlock:ye.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(n,-r).finish(a,l-r),r),!0},SetextHeading:void 0};class jA{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,i,r){if(this.stage==-1)return!1;let s=r.content+`
|
|
22
|
-
`+i.scrub(),n=this.advance(s);return n>-1&&n<s.length?this.complete(e,r,n):!1}finish(e,i){return(this.stage==2||this.stage==3)&&Sa(i.content,this.pos)==i.content.length?this.complete(e,i,i.content.length):!1}complete(e,i,r){return e.addLeafElement(i,it(ye.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(zy(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(it(ye.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Iy(e,Sa(e,this.pos),this.start)))return-1}else if(this.stage==2){let i=Sa(e,this.pos),r=0;if(i>this.pos){let s=Ny(e,i,this.start);if(s){let n=Ou(e,s.to-this.start);n>0&&(this.nextStage(s),r=n)}}return r||(r=Ou(e,this.pos)),r>0&&r<e.length?r:-1}else return Ou(e,this.pos)}}}function Ou(t,e){for(;e<t.length;e++){let i=t.charCodeAt(e);if(i==10)break;if(!ir(i))return-1}return e}class UA{nextLine(e,i,r){let s=i.depth<e.stack.length?-1:$y(i),n=i.next;if(s<0)return!1;let o=it(ye.HeaderMark,e.lineStart+i.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(r,it(n==61?ye.SetextHeading1:ye.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}}const My={LinkReference(t,e){return e.content.charCodeAt(0)==91?new jA(e):null},SetextHeading(){return new UA}},GA=[(t,e)=>Cy(e)>=0,(t,e)=>Sy(e)>=0,(t,e)=>wy(e)>=0,(t,e)=>Dp(e,t,!0)>=0,(t,e)=>Lp(e,t,!0)>=0,(t,e)=>Ep(e,t,!0)>=0,(t,e)=>Ty(e,t,!0)>=0],KA={text:"",end:0};class JA{constructor(e,i,r,s){this.parser=e,this.input=i,this.ranges=s,this.line=new YA,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=nh.create(ye.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new iR(r,i):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!s||e.markers[r].from<s.end);){let n=e.markers[r++];this.addNode(n.type,n.from,n.to)}if(!s)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let s=r(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let i=new qA(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let s=r(this,i);s&&i.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,i))break e}for(let r of i.parsers)if(r.nextLine(this,e,i))return null;i.content+=`
|
|
23
|
-
`+e.scrub();for(let r of e.markers)i.marks.push(r)}return this.finishLeaf(i),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let i=this.fragments.takeNodes(this);return i?(this.absoluteLineStart+=i,this.lineStart=Zy(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let i=KA;if(i.end=e,e>=this.to)i.text="";else if(i.text=this.lineChunkAt(e),i.end+=i.text.length,this.ranges.length>1){let r=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<i.end;){s++;let n=this.ranges[s].from,o=this.lineChunkAt(n);i.end=n+o.length,i.text=i.text.slice(0,this.ranges[s-1].to-r)+o,r=i.end-i.text.length}}return i}readLine(){let{line:e}=this,{text:i,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(i);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],n=this.parser.skipContextMarkup[s.type];if(!n)throw new Error("Unhandled block context "+ye[s.type]);let o=this.line.markers.length;if(!n(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let i=this.input.chunk(e),r;if(this.input.lineChunks)r=i==`
|
|
24
|
-
`?"":i;else{let s=i.indexOf(`
|
|
25
|
-
`);r=s<0?i:i.slice(0,s)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,r=0){this.block=nh.create(e,r,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,r=0){this.startContext(this.parser.getNodeType(e),i,r)}addNode(e,i,r){typeof e=="number"&&(e=new at(this.parser.nodeSet.types[e],no,no,(r??this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(Yd(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?By(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let i=Yd(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(ye.Paragraph,e.content.length),e.start)}elt(e,i,r,s){return typeof e=="string"?it(this.parser.getNodeType(e),i,r,s):new Ey(e,i)}get buffer(){return new Ry(this.parser.nodeSet)}}function By(t,e,i,r,s){let n=t[e].to,o=[],a=[],l=i.from+r;function c(h,u){for(;u?h>=n:h>n;){let d=t[e+1].from-n;r+=d,h+=d,e++,n=t[e].to}}for(let h=i.firstChild;h;h=h.nextSibling){c(h.from+r,!0);let u=h.from+r,d,p=s.get(h.tree);p?d=p:h.to+r>n?(d=By(t,e,h,r,s),c(h.to+r,!1)):d=h.toTree(),o.push(d),a.push(u-l)}return c(i.to+r,!1),new at(i.type,o,a,i.to+r-l,i.tree?i.tree.propValues:void 0)}class Ih extends pp{constructor(e,i,r,s,n,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=r,this.blockNames=s,this.endLeafBlock=n,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let h of e.types)this.nodeTypes[h.name]=h.id}createParse(e,i,r){let s=new JA(this,e,i,r);for(let n of this.wrappers)s=n(s,e,i,r);return s}configure(e){let i=qd(e);if(!i)return this;let{nodeSet:r,skipContextMarkup:s}=this,n=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),h=this.endLeafBlock.slice(),u=this.wrappers;if(Uo(i.defineNodes)){s=Object.assign({},s);let d=r.types.slice(),p;for(let f of i.defineNodes){let{name:g,block:v,composite:b,style:S}=typeof f=="string"?{name:f}:f;if(d.some($=>$.name==g))continue;b&&(s[d.length]=($,R,D)=>b(R,D,$.value));let k=d.length,T=b?["Block","BlockContext"]:v?k>=ye.ATXHeading1&&k<=ye.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(Xt.define({id:k,name:g,props:T&&[[Fe.group,T]]})),S&&(p||(p={}),Array.isArray(S)||S instanceof Li?p[g]=S:Object.assign(p,S))}r=new ll(d),p&&(r=r.extend(ho(p)))}if(Uo(i.props)&&(r=r.extend(...i.props)),Uo(i.remove))for(let d of i.remove){let p=this.blockNames.indexOf(d),f=this.inlineNames.indexOf(d);p>-1&&(n[p]=o[p]=void 0),f>-1&&(l[f]=void 0)}if(Uo(i.parseBlock))for(let d of i.parseBlock){let p=a.indexOf(d.name);if(p>-1)n[p]=d.parse,o[p]=d.leaf;else{let f=d.before?Jl(a,d.before):d.after?Jl(a,d.after)+1:a.length-1;n.splice(f,0,d.parse),o.splice(f,0,d.leaf),a.splice(f,0,d.name)}d.endLeaf&&h.push(d.endLeaf)}if(Uo(i.parseInline))for(let d of i.parseInline){let p=c.indexOf(d.name);if(p>-1)l[p]=d.parse;else{let f=d.before?Jl(c,d.before):d.after?Jl(c,d.after)+1:c.length-1;l.splice(f,0,d.parse),c.splice(f,0,d.name)}}return i.wrap&&(u=u.concat(i.wrap)),new Ih(r,n,o,a,h,s,l,c,u)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let r=new Ip(this,e,i);e:for(let s=i;s<r.end;){let n=r.char(s);for(let o of this.inlineParsers)if(o){let a=o(r,n,s);if(a>=0){s=a;continue e}}s++}return r.resolveMarkers(0)}}function Uo(t){return t!=null&&t.length>0}function qd(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=qd(t[0]);if(t.length==1)return e;let i=qd(t.slice(1));if(!i||!e)return e||i;let r=(o,a)=>(o||no).concat(a||no),s=e.wrap,n=i.wrap;return{props:r(e.props,i.props),defineNodes:r(e.defineNodes,i.defineNodes),parseBlock:r(e.parseBlock,i.parseBlock),parseInline:r(e.parseInline,i.parseInline),remove:r(e.remove,i.remove),wrap:s?n?(o,a,l,c)=>s(n(o,a,l,c),a,l,c):s:n}}function Jl(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}let Ay=[Xt.none];for(let t=1,e;e=ye[t];t++)Ay[t]=Xt.define({id:t,name:e,props:t>=ye.Escape?[]:[[Fe.group,t in xy?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const no=[];class Ry{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,r,s=0){return this.content.push(e,i,r,4+s*4),this}writeElements(e,i=0){for(let r of e)r.writeTo(this,i);return this}finish(e,i){return at.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:i})}}let Ha=class{constructor(e,i,r,s=no){this.type=e,this.from=i,this.to=r,this.children=s}writeTo(e,i){let r=e.content.length;e.writeElements(this.children,i),e.content.push(this.type,this.from+i,this.to+i,e.content.length+4-r)}toTree(e){return new Ry(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class Ey{constructor(e,i){this.tree=e,this.from=i}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return no}writeTo(e,i){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+i,this.to+i,-1)}toTree(){return this.tree}}function it(t,e,i,r){return new Ha(t,e,i,r)}const Dy={resolve:"Emphasis",mark:"EmphasisMark"},Ly={resolve:"Emphasis",mark:"EmphasisMark"},tn={},oh={};class Di{constructor(e,i,r,s){this.type=e,this.from=i,this.to=r,this.side=s}}const gO="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let qa=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{qa=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const vu={Escape(t,e,i){if(e!=92||i==t.end-1)return-1;let r=t.char(i+1);for(let s=0;s<gO.length;s++)if(gO.charCodeAt(s)==r)return t.append(it(ye.Escape,i,i+2));return-1},Entity(t,e,i){if(e!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(i+1,i+31));return r?t.append(it(ye.Entity,i,i+1+r[0].length)):-1},InlineCode(t,e,i){if(e!=96||i&&t.char(i-1)==96)return-1;let r=i+1;for(;r<t.end&&t.char(r)==96;)r++;let s=r-i,n=0;for(;r<t.end;r++)if(t.char(r)==96){if(n++,n==s&&t.char(r+1)!=96)return t.append(it(ye.InlineCode,i,r+1,[it(ye.CodeMark,i,i+s),it(ye.CodeMark,r+1-s,r+1)]))}else n=0;return-1},HTMLTag(t,e,i){if(e!=60||i==t.end-1)return-1;let r=t.slice(i+1,t.end),s=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(s)return t.append(it(ye.Autolink,i,i+1+s[0].length,[it(ye.LinkMark,i,i+1),it(ye.URL,i+1,i+s[0].length),it(ye.LinkMark,i+s[0].length,i+1+s[0].length)]));let n=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(n)return t.append(it(ye.Comment,i,i+1+n[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return t.append(it(ye.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return a?t.append(it(ye.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(e!=95&&e!=42)return-1;let r=i+1;for(;t.char(r)==e;)r++;let s=t.slice(i-1,i),n=t.slice(r,r+1),o=qa.test(s),a=qa.test(n),l=/\s|^$/.test(s),c=/\s|^$/.test(n),h=!c&&(!a||l||o),u=!l&&(!o||c||a),d=h&&(e==42||!u||o),p=u&&(e==42||!h||a);return t.append(new Di(e==95?Dy:Ly,i,r,(d?1:0)|(p?2:0)))},HardBreak(t,e,i){if(e==92&&t.char(i+1)==10)return t.append(it(ye.HardBreak,i,i+2));if(e==32){let r=i+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=i+2)return t.append(it(ye.HardBreak,i,r+1))}return-1},Link(t,e,i){return e==91?t.append(new Di(tn,i,i+1,1)):-1},Image(t,e,i){return e==33&&t.char(i+1)==91?t.append(new Di(oh,i,i+2,1)):-1},LinkEnd(t,e,i){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let s=t.parts[r];if(s instanceof Di&&(s.type==tn||s.type==oh)){if(!s.side||t.skipSpace(s.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[r]=null,-1;let n=t.takeContent(r),o=t.parts[r]=eR(t,n,s.type==tn?ye.Link:ye.Image,s.from,i+1);if(s.type==tn)for(let a=0;a<r;a++){let l=t.parts[a];l instanceof Di&&l.type==tn&&(l.side=0)}return o.to}}return-1}};function eR(t,e,i,r,s){let{text:n}=t,o=t.char(s),a=s;if(e.unshift(it(ye.LinkMark,r,r+(i==ye.Image?2:1))),e.push(it(ye.LinkMark,s-1,s)),o==40){let l=t.skipSpace(s+1),c=Iy(n,l-t.offset,t.offset),h;c&&(l=t.skipSpace(c.to),l!=c.to&&(h=Ny(n,l-t.offset,t.offset),h&&(l=t.skipSpace(h.to)))),t.char(l)==41&&(e.push(it(ye.LinkMark,s,s+1)),a=l+1,c&&e.push(c),h&&e.push(h),e.push(it(ye.LinkMark,l,a)))}else if(o==91){let l=zy(n,s-t.offset,t.offset,!1);l&&(e.push(l),a=l.to)}return it(i,r,a,e)}function Iy(t,e,i){if(t.charCodeAt(e)==60){for(let s=e+1;s<t.length;s++){let n=t.charCodeAt(s);if(n==62)return it(ye.URL,e+i,s+1+i);if(n==60||n==10)return!1}return null}else{let s=0,n=e;for(let o=!1;n<t.length;n++){let a=t.charCodeAt(n);if(ir(a))break;if(o)o=!1;else if(a==40)s++;else if(a==41){if(!s)break;s--}else a==92&&(o=!0)}return n>e?it(ye.URL,e+i,n+i):n==t.length?null:!1}}function Ny(t,e,i){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let s=r==40?41:r;for(let n=e+1,o=!1;n<t.length;n++){let a=t.charCodeAt(n);if(o)o=!1;else{if(a==s)return it(ye.LinkTitle,e+i,n+1+i);a==92&&(o=!0)}}return null}function zy(t,e,i,r){for(let s=!1,n=e+1,o=Math.min(t.length,n+999);n<o;n++){let a=t.charCodeAt(n);if(s)s=!1;else{if(a==93)return r?!1:it(ye.LinkLabel,e+i,n+1+i);if(r&&!ir(a)&&(r=!1),a==91)return!1;a==92&&(s=!0)}}return null}class Ip{constructor(e,i,r){this.parser=e,this.text=i,this.offset=r,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,i){return this.text.slice(e-this.offset,i-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,i,r,s,n){return this.append(new Di(e,i,r,(s?1:0)|(n?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let i=this.parts[e];if(i instanceof Di&&(i.type==tn||i.type==oh))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r<this.parts.length;r++){let s=this.parts[r];if(!(s instanceof Di&&s.type.resolve&&s.side&2))continue;let n=s.type==Dy||s.type==Ly,o=s.to-s.from,a,l=r-1;for(;l>=e;l--){let g=this.parts[l];if(g instanceof Di&&g.side&1&&g.type==s.type&&!(n&&(s.side&1||g.side&2)&&(g.to-g.from+o)%3==0&&((g.to-g.from)%3||o%3))){a=g;break}}if(!a)continue;let c=s.type.resolve,h=[],u=a.from,d=s.to;if(n){let g=Math.min(2,a.to-a.from,o);u=a.to-g,d=s.from+g,c=g==1?"Emphasis":"StrongEmphasis"}a.type.mark&&h.push(this.elt(a.type.mark,u,a.to));for(let g=l+1;g<r;g++)this.parts[g]instanceof Ha&&h.push(this.parts[g]),this.parts[g]=null;s.type.mark&&h.push(this.elt(s.type.mark,s.from,d));let p=this.elt(c,u,d,h);this.parts[l]=n&&a.from!=u?new Di(a.type,a.from,u,a.side):null,(this.parts[r]=n&&s.to!=d?new Di(s.type,d,s.to,s.side):null)?this.parts.splice(r,0,p):this.parts[r]=p}let i=[];for(let r=e;r<this.parts.length;r++){let s=this.parts[r];s instanceof Ha&&i.push(s)}return i}findOpeningDelimiter(e){for(let i=this.parts.length-1;i>=0;i--){let r=this.parts[i];if(r instanceof Di&&r.type==e&&r.side&1)return i}return null}takeContent(e){let i=this.resolveMarkers(e);return this.parts.length=e,i}getDelimiterAt(e){let i=this.parts[e];return i instanceof Di?i:null}skipSpace(e){return Sa(this.text,e-this.offset)+this.offset}elt(e,i,r,s){return typeof e=="string"?it(this.parser.getNodeType(e),i,r,s):new Ey(e,i)}}Ip.linkStart=tn;Ip.imageStart=oh;function Yd(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),r=0;for(let s of e){for(;r<i.length&&i[r].to<s.to;)r++;if(r<i.length&&i[r].from<s.from){let n=i[r];n instanceof Ha&&(i[r]=new Ha(n.type,n.from,n.to,Yd(n.children,[s])))}else i.splice(r++,0,s)}return i}const tR=[ye.CodeBlock,ye.ListItem,ye.OrderedList,ye.BulletList];let iR=class{constructor(e,i){this.fragments=e,this.input=i,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,i){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let n=this.fragment.to;for(;n>0&&this.input.read(n-1,n)!=`
|
|
26
|
-
`;)n--;this.fragmentEnd=n?n-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let s=e+this.fragment.offset;for(;r.to<=s;)if(!r.parent())return!1;for(;;){if(r.from>=s)return this.fragment.from<=i;if(!r.childAfter(s))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(Fe.contextHash)==e}takeNodes(e){let i=this.cursor,r=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),n=e.absoluteLineStart,o=n,a=e.block.children.length,l=o,c=a;for(;;){if(i.to-r>s){if(i.type.isAnonymous&&i.firstChild())continue;break}let h=Zy(i.from-r,e.ranges);if(i.to-r<=e.ranges[e.rangeI].to)e.addNode(i.tree,h);else{let u=new at(e.parser.nodeSet.types[ye.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(u,i.tree),e.addNode(u,h)}if(i.type.is("Block")&&(tR.indexOf(i.type.id)<0?(o=i.to-r,a=e.block.children.length):(o=l,a=c),l=i.to-r,c=e.block.children.length),!i.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-n}};function Zy(t,e){let i=t;for(let r=1;r<e.length;r++){let s=e[r-1].to,n=e[r].from;s<t&&(i-=n-s)}return i}const rR=ho({"Blockquote/...":Q.quote,HorizontalRule:Q.contentSeparator,"ATXHeading1/... SetextHeading1/...":Q.heading1,"ATXHeading2/... SetextHeading2/...":Q.heading2,"ATXHeading3/...":Q.heading3,"ATXHeading4/...":Q.heading4,"ATXHeading5/...":Q.heading5,"ATXHeading6/...":Q.heading6,"Comment CommentBlock":Q.comment,Escape:Q.escape,Entity:Q.character,"Emphasis/...":Q.emphasis,"StrongEmphasis/...":Q.strong,"Link/... Image/...":Q.link,"OrderedList/... BulletList/...":Q.list,"BlockQuote/...":Q.quote,"InlineCode CodeText":Q.monospace,"URL Autolink":Q.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Q.processingInstruction,"CodeInfo LinkLabel":Q.labelName,LinkTitle:Q.string,Paragraph:Q.content}),sR=new Ih(new ll(Ay).extend(rR),Object.keys(Kl).map(t=>Kl[t]),Object.keys(Kl).map(t=>My[t]),Object.keys(Kl),GA,xy,Object.keys(vu).map(t=>vu[t]),Object.keys(vu),[]);function nR(t,e,i){let r=[];for(let s=t.firstChild,n=e;;s=s.nextSibling){let o=s?s.from:i;if(o>n&&r.push({from:n,to:o}),!s)break;n=s.to}return r}function oR(t){let{codeParser:e,htmlParser:i}=t;return{wrap:eb((s,n)=>{let o=s.type.id;if(e&&(o==ye.CodeBlock||o==ye.FencedCode)){let a="";if(o==ye.FencedCode){let c=s.node.getChild(ye.CodeInfo);c&&(a=n.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ye.CodeText,bracketed:o==ye.FencedCode}}else if(i&&(o==ye.HTMLBlock||o==ye.HTMLTag||o==ye.CommentBlock))return{parser:i,overlay:nR(s.node,s.from,s.to)};return null})}}const aR={resolve:"Strikethrough",mark:"StrikethroughMark"},lR={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Q.strikethrough}},{name:"StrikethroughMark",style:Q.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let r=t.slice(i-1,i),s=t.slice(i+2,i+3),n=/\s|^$/.test(r),o=/\s|^$/.test(s),a=qa.test(r),l=qa.test(s);return t.addDelimiter(aR,i,i+2,!o&&(!l||n||a),!n&&(!a||o||l))},after:"Emphasis"}]};function wa(t,e,i=0,r,s=0){let n=0,o=!0,a=-1,l=-1,c=!1,h=()=>{r.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u<e.length;u++){let d=e.charCodeAt(u);d==124&&!c?((!o||a>-1)&&n++,o=!1,r&&(a>-1&&h(),r.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1):(c||d!=32&&d!=9)&&(a<0&&(a=u),l=u+1),c=!c&&d==92}return a>-1&&(n++,r&&h()),n}function OO(t,e){for(let i=e;i<t.length;i++){let r=t.charCodeAt(i);if(r==124)return!0;r==92&&i++}return!1}const Xy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class vO{constructor(){this.rows=null}nextLine(e,i,r){if(this.rows==null){this.rows=!1;let s;if((i.next==45||i.next==58||i.next==124)&&Xy.test(s=i.text.slice(i.pos))){let n=[];wa(e,r.content,0,n,r.start)==wa(e,s,i.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,n),e.elt("TableDelimiter",e.lineStart+i.pos,e.lineStart+i.text.length)])}}else if(this.rows){let s=[];wa(e,i.text,i.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+i.pos,e.lineStart+i.text.length,s))}return!1}finish(e,i){return this.rows?(e.addLeafElement(i,e.elt("Table",i.start,i.start+i.content.length,this.rows)),!0):!1}}const cR={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":Q.heading}},"TableRow",{name:"TableCell",style:Q.content},{name:"TableDelimiter",style:Q.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return OO(e.content,0)?new vO:null},endLeaf(t,e,i){if(i.parsers.some(s=>s instanceof vO)||!OO(e.text,e.basePos))return!1;let r=t.peekLine();return Xy.test(r)&&wa(t,e.text,e.basePos)==wa(t,r,e.basePos)},before:"SetextHeading"}]};class hR{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}}const uR={defineNodes:[{name:"Task",block:!0,style:Q.list},{name:"TaskMarker",style:Q.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new hR:null},after:"SetextHeading"}]},bO=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,yO=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,dR=/[\w-]+\.[\w-]+($|\/)/,_O=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,xO=/\/[a-zA-Z\d@.]+/gy;function SO(t,e,i,r){let s=0;for(let n=e;n<i;n++)t[n]==r&&s++;return s}function fR(t,e){yO.lastIndex=e;let i=yO.exec(t);if(!i||dR.exec(i[0])[0].indexOf("_")>-1)return-1;let r=e+i[0].length;for(;;){let s=t[r-1],n;if(/[?!.,:*_~]/.test(s)||s==")"&&SO(t,e,r,")")>SO(t,e,r,"("))r--;else if(s==";"&&(n=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,r))))r=e+n.index;else break}return r}function wO(t,e){_O.lastIndex=e;let i=_O.exec(t);if(!i)return-1;let r=i[0][i[0].length-1];return r=="_"||r=="-"?-1:e+i[0].length-(r=="."?1:0)}const pR={parseInline:[{name:"Autolink",parse(t,e,i){let r=i-t.offset;if(r&&/\w/.test(t.text[r-1]))return-1;bO.lastIndex=r;let s=bO.exec(t.text),n=-1;if(!s)return-1;if(s[1]||s[2]){if(n=fR(t.text,r+s[0].length),n>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(r,n));n=r+o[0].length}}else s[3]?n=wO(t.text,r):(n=wO(t.text,r+s[0].length),n>-1&&s[0]=="xmpp:"&&(xO.lastIndex=n,s=xO.exec(t.text),s&&(n=s.index+s[0].length)));return n<0?-1:(t.addElement(t.elt("URL",i,n+t.offset)),n+t.offset)}}]},mR=[cR,uR,lR,pR];function Wy(t,e,i){return(r,s,n)=>{if(s!=t||r.char(n+1)==t)return-1;let o=[r.elt(i,n,n+1)];for(let a=n+1;a<r.end;a++){let l=r.char(a);if(l==t)return r.addElement(r.elt(e,n,a+1,o.concat(r.elt(i,a,a+1))));if(l==92&&o.push(r.elt("Escape",a,a+++2)),ir(l))break}return-1}}const gR={defineNodes:[{name:"Superscript",style:Q.special(Q.content)},{name:"SuperscriptMark",style:Q.processingInstruction}],parseInline:[{name:"Superscript",parse:Wy(94,"Superscript","SuperscriptMark")}]},OR={defineNodes:[{name:"Subscript",style:Q.special(Q.content)},{name:"SubscriptMark",style:Q.processingInstruction}],parseInline:[{name:"Subscript",parse:Wy(126,"Subscript","SubscriptMark")}]},vR={defineNodes:[{name:"Emoji",style:Q.character}],parseInline:[{name:"Emoji",parse(t,e,i){let r;return e!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(t.slice(i+1,t.end)))?-1:t.addElement(t.elt("Emoji",i,i+1+r[0].length))}}]};var kO={};class ah{constructor(e,i,r,s,n,o,a,l,c,h=0,u){this.p=e,this.stack=i,this.state=r,this.reducePos=s,this.pos=n,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,r=0){let s=e.parser.context;return new ah(e,[],i,r,r,0,[],0,s?new CO(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let r=e>>19,s=e&65535,{parser:n}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=n.dynamicPrecedence(s);if(a&&(this.score+=a),r==0){this.pushState(n.getGoto(this.state,s,!0),this.reducePos),s<n.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((i=this.p.parser.nodeSet.types[s])===null||i===void 0)&&i.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-u;if(s<n.minRepeatTerm||e&131072){let p=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,p,d+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=n.getGoto(p,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,i,r,s=4,n=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(i==r)return;if(o.buffer[a-2]>=i){o.buffer[a-2]=r;return}}}if(!n||this.pos==r)this.buffer.push(e,i,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=i,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(e,i,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let n=e,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(n,1);!a&&(s>r||i<=o.maxNode)&&(this.reducePos=s),this.pushState(n,a?r:Math.min(r,this.reducePos)),this.shiftContext(i,r),i<=o.maxNode&&this.buffer.push(i,r,s,4)}else this.pos=s,this.shiftContext(i,r),i<=this.p.parser.maxNode&&this.buffer.push(i,r,s,4)}apply(e,i,r,s){e&65536?this.reduce(e):this.shift(e,i,r,s)}useNode(e,i){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(i,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let r=e.buffer.slice(i),s=e.bufferBase+i;for(;e&&s==e.bufferBase;)e=e.parent;return new ah(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,r?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new bR(this);;){let r=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(r==0)return!1;if((r&65536)==0)return!0;i.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let s=[];for(let n=0,o;n<i.length;n+=2)(o=i[n+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(i[n],o);if(this.stack.length<120)for(let n=0;s.length<8&&n<i.length;n+=2){let o=i[n+1];s.some((a,l)=>l&1&&a==o)||s.push(i[n],o)}i=s}let r=[];for(let s=0;s<i.length&&r.length<4;s+=2){let n=i[s+1];if(n==this.state)continue;let o=this.split();o.pushState(n,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(i[s],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if((i&65536)==0)return!1;if(!e.validAction(this.state,i)){let r=i>>19,s=i&65535,n=this.stack.length-r*3;if(n<0||e.getGoto(this.stack[n],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;i=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],r=(s,n)=>{if(!i.includes(s))return i.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,n+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new CO(this.curContext.tracker,e);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class CO{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class bR{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=s}}class lh{constructor(e,i,r){this.stack=e,this.pos=i,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new lh(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new lh(this.stack,this.pos,this.index)}}function ca(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let r=0,s=0;r<t.length;){let n=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){n=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),n+=l,a)break;n*=46}i?i[s++]=n:i=new e(n)}return i}class _c{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $O=new _c;class yR{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$O,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let r=this.range,s=this.rangeIndex,n=this.pos+e;for(;n<r.from;){if(!s)return null;let o=this.ranges[--s];n-=r.from-o.to,r=o}for(;i<0?n>r.to:n>=r.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];n+=o.from-r.to,r=o}return n}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,r,s;if(i>=0&&i<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(i);else{let n=this.resolveOffset(e,1);if(n==null)return-1;if(r=n,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,i=0){let r=i?this.resolveOffset(i,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=$O,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,i){if(e>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let r="";for(let s of this.ranges){if(s.from>=i)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,i)))}return r}}class jn{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:r}=i.p;Vy(this.data,e,i,this.id,r.data,r.tokenPrecTable)}}jn.prototype.contextual=jn.prototype.fallback=jn.prototype.extend=!1;class ch{constructor(e,i,r){this.precTable=i,this.elseToken=r,this.data=typeof e=="string"?ca(e):e}token(e,i){let r=e.pos,s=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);if(Vy(this.data,e,i,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(r,e.token),e.acceptToken(this.elseToken,s))}}ch.prototype.contextual=jn.prototype.fallback=jn.prototype.extend=!1;class Zi{constructor(e,i={}){this.token=e,this.contextual=!!i.contextual,this.fallback=!!i.fallback,this.extend=!!i.extend}}function Vy(t,e,i,r,s,n){let o=0,a=1<<r,{dialect:l}=i.p.parser;e:for(;(a&t[o])!=0;){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let f=t[p];if(l.allows(f)&&(e.token.value==-1||e.token.value==f||_R(f,e.token.value,s,n))){e.acceptToken(f);break}}let h=e.next,u=0,d=t[o+2];if(e.next<0&&d>u&&t[c+d*3-3]==65535){o=t[c+d*3-1];continue e}for(;u<d;){let p=u+d>>1,f=c+p+(p<<1),g=t[f],v=t[f+1]||65536;if(h<g)d=p;else if(h>=v)u=p+1;else{o=t[f+2],e.advance();continue e}}break}}function PO(t,e,i){for(let r=e,s;(s=t[r])!=65535;r++)if(s==i)return r-e;return-1}function _R(t,e,i,r){let s=PO(i,r,e);return s<0||PO(i,r,t)<s}const Ti=typeof process<"u"&&kO&&/\bparse\b/.test(kO.LOG);let bu=null;function QO(t,e,i){let r=t.cursor(lt.IncludeAnonymous);for(r.moveTo(e);;)if(!(i<0?r.childBefore(e):r.childAfter(e)))for(;;){if((i<0?r.to<e:r.from>e)&&!r.type.isError)return i<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(i<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return i<0?0:t.length}}class xR{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?QO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?QO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let r=this.trees[i],s=this.index[i];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=r.children[s],o=this.start[i]+r.positions[s];if(o>e)return this.nextStart=o,null;if(n instanceof at){if(o==e){if(o<this.safeFrom)return null;let a=o+n.length;if(a<=this.safeTo){let l=n.prop(Fe.lookAhead);if(!l||a+l<this.fragment.to)return n}}this.index[i]++,o+n.length>=Math.max(this.safeFrom,e)&&(this.trees.push(n),this.start.push(o),this.index.push(0))}else this.index[i]++,this.nextStart=o+n.length}}}class SR{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new _c)}getActions(e){let i=0,r=null,{parser:s}=e.p,{tokenizers:n}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<n.length;c++){if((1<<c&o)==0)continue;let h=n[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let d=i;if(u.extended>-1&&(i=this.addActions(e,u.extended,u.end,i)),i=this.addActions(e,u.value,u.end,i),!h.extend&&(r=u,i>d))break}}for(;this.actions.length>i;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new _c,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,i=this.addActions(e,r.value,r.end,i)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new _c,{pos:r,p:s}=e;return i.start=r,i.end=Math.min(r+1,s.stream.end),i.value=r==s.stream.end?s.parser.eofTerm:0,i}updateCachedToken(e,i,r){let s=this.stream.clipPos(r.pos);if(i.token(this.stream.reset(s,e),r),e.value>-1){let{parser:n}=r.p;for(let o=0;o<n.specialized.length;o++)if(n.specialized[o]==e.value){let a=n.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,i,r,s){for(let n=0;n<s;n+=3)if(this.actions[n]==e)return s;return this.actions[s++]=e,this.actions[s++]=i,this.actions[s++]=r,s}addActions(e,i,r,s){let{state:n}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(n,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Gr(a,c+2);else{s==0&&a[c+1]==2&&(s=this.putAction(Gr(a,c+2),i,r,s));break}a[c]==i&&(s=this.putAction(Gr(a,c+1),i,r,s))}return s}}class wR{constructor(e,i,r,s){this.parser=e,this.input=i,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new yR(i,s),this.tokens=new SR(e,this.stream),this.topTerm=e.top[1];let{from:n}=s[0];this.stacks=[ah.start(this,e.top[0],n)],this.fragments=r.length&&this.stream.end-n>e.bufferLength*4?new xR(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,r=this.stacks=[],s,n;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>i)r.push(a);else{if(this.advanceStack(a,r,e))continue;{s||(s=[],n=[]),s.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}}break}}if(!r.length){let o=s&&CR(s);if(o)return Ti&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ti&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,n,r);if(o)return Ti&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,r){let s=e.pos,{parser:n}=this,o=Ti?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(s);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?n.getGoto(e.state,u.type.id):-1;if(d>-1&&u.length&&(!c||(u.prop(Fe.contextHash)||0)==h))return e.useNode(u,d),Ti&&console.log(o+this.stackID(e)+` (via reuse of ${n.getName(u.type.id)})`),!0;if(!(u instanceof at)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof at&&u.positions[0]==0)u=p;else break}}let a=n.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ti&&console.log(o+this.stackID(e)+` (via always-reduce ${n.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],d=l[c++],p=c==l.length||!r,f=p?e:e.split(),g=this.tokens.mainToken;if(f.apply(h,u,g?g.start:f.pos,d),Ti&&console.log(o+this.stackID(f)+` (via ${(h&65536)==0?"shift":`reduce of ${n.getName(h&65535)}`} for ${n.getName(u)} @ ${s}${f==e?"":", split"})`),p)return!0;f.pos>s?i.push(f):r.push(f)}return!1}advanceFully(e,i){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return TO(e,i),!0}}runRecovery(e,i,r){let s=null,n=!1;for(let o=0;o<e.length;o++){let a=e[o],l=i[o<<1],c=i[(o<<1)+1],h=Ti?this.stackID(a)+" -> ":"";if(a.deadEnd&&(n||(n=!0,a.restart(),Ti&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),d=h;for(let p=0;p<10&&u.forceReduce()&&(Ti&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)Ti&&(d=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))Ti&&console.log(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Ti&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),TO(a,r)):(!s||s.score<u.score)&&(s=u)}return s}stackToTree(e){return e.close(),at.build({buffer:lh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let i=(bu||(bu=new WeakMap)).get(e);return i||bu.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function TO(t,e){for(let i=0;i<e.length;i++){let r=e[i];if(r.pos==t.pos&&r.sameState(t)){e[i].score<t.score&&(e[i]=t);return}}e.push(t)}class kR{constructor(e,i,r){this.source=e,this.flags=i,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const yu=t=>t;class Fy{constructor(e){this.start=e.start,this.shift=e.shift||yu,this.reduce=e.reduce||yu,this.reuse=e.reuse||yu,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class oo extends pp{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let a=0;a<e.repeatNodeCount;a++)i.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),s=[];for(let a=0;a<i.length;a++)s.push([]);function n(a,l,c){s[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Fe[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)n(h,l,a[c++]);else{let u=a[c+-h];for(let d=-h;d>0;d--)n(a[c++],l,u);c++}}}this.nodeSet=new ll(i.map((a,l)=>Xt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=j1;let o=ca(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(MO),this.states=ca(e.states,Uint32Array),this.data=ca(e.stateData),this.goto=ca(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new jn(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,r){let s=new wR(this,e,i,r);for(let n of this.wrappers)s=n(s,e,i,r);return s}getGoto(e,i,r=!1){let s=this.goto;if(i>=s[0])return-1;for(let n=s[i+1];;){let o=s[n++],a=o&1,l=s[n++];if(a&&r)return l;for(let c=n+(o>>1);n<c;n++)if(s[n]==e)return l;if(a)return-1}}hasAction(e,i){let r=this.data;for(let s=0;s<2;s++)for(let n=this.stateSlot(e,s?2:1),o;;n+=3){if((o=r[n])==65535)if(r[n+1]==1)o=r[n=Gr(r,n+2)];else{if(r[n+1]==2)return Gr(r,n+2);break}if(o==i||o==0)return Gr(r,n+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,r=>r==i?!0:null)}allActions(e,i){let r=this.stateSlot(e,4),s=r?i(r):void 0;for(let n=this.stateSlot(e,1);s==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Gr(this.data,n+2);else break;s=i(Gr(this.data,n+1))}return s}nextStates(e){let i=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Gr(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];i.some((n,o)=>o&1&&n==s)||i.push(this.data[r],s)}}return i}configure(e){let i=Object.assign(Object.create(oo.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=r}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(n=>n.from==r);return s?s.to:r})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((r,s)=>{let n=e.specializers.find(a=>a.from==r.external);if(!n)return r;let o=Object.assign(Object.assign({},r),{external:n.to});return i.specializers[s]=MO(o),o})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),r=i.map(()=>!1);if(e)for(let n of e.split(" ")){let o=i.indexOf(n);o>=0&&(r[o]=!0)}let s=null;for(let n=0;n<i.length;n++)if(!r[n])for(let o=this.dialects[i[n]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new kR(e,r,s)}static deserialize(e){return new oo(e)}}function Gr(t,e){return t[e]|t[e+1]<<16}function CR(t){let e=null;for(let i of t){let r=i.p.stoppedAt;(i.pos==i.p.stream.end||r!=null&&i.pos>r)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}function MO(t){if(t.external){let e=t.extend?1:0;return(i,r)=>t.external(i,r)<<1|e}return t.get}const $R=55,PR=1,QR=56,TR=2,MR=57,BR=3,BO=4,AR=5,Np=6,Hy=7,qy=8,Yy=9,jy=10,RR=11,ER=12,DR=13,_u=58,LR=14,IR=15,AO=59,Uy=21,NR=23,Gy=24,zR=25,jd=27,Ky=28,ZR=29,XR=32,WR=35,VR=37,FR=38,HR=0,qR=1,YR={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},jR={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},RO={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function UR(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}let EO=null,DO=null,LO=0;function Ud(t,e){let i=t.pos+e;if(LO==i&&DO==t)return EO;let r=t.peek(e),s="";for(;UR(r);)s+=String.fromCharCode(r),r=t.peek(++e);return DO=t,LO=i,EO=s?s.toLowerCase():r==GR||r==KR?void 0:null}const Jy=60,hh=62,zp=47,GR=63,KR=33,JR=45;function IO(t,e){this.name=t,this.parent=e}const eE=[Np,jy,Hy,qy,Yy],tE=new Fy({start:null,shift(t,e,i,r){return eE.indexOf(e)>-1?new IO(Ud(r,1)||"",t):t},reduce(t,e){return e==Uy&&t?t.parent:t},reuse(t,e,i,r){let s=e.type.id;return s==Np||s==VR?new IO(Ud(r,1)||"",t):t},strict:!1}),iE=new Zi((t,e)=>{if(t.next!=Jy){t.next<0&&e.context&&t.acceptToken(_u);return}t.advance();let i=t.next==zp;i&&t.advance();let r=Ud(t,0);if(r===void 0)return;if(!r)return t.acceptToken(i?IR:LR);let s=e.context?e.context.name:null;if(i){if(r==s)return t.acceptToken(RR);if(s&&jR[s])return t.acceptToken(_u,-2);if(e.dialectEnabled(HR))return t.acceptToken(ER);for(let n=e.context;n;n=n.parent)if(n.name==r)return;t.acceptToken(DR)}else{if(r=="script")return t.acceptToken(Hy);if(r=="style")return t.acceptToken(qy);if(r=="textarea")return t.acceptToken(Yy);if(YR.hasOwnProperty(r))return t.acceptToken(jy);s&&RO[s]&&RO[s][r]?t.acceptToken(_u,-1):t.acceptToken(Np)}},{contextual:!0}),rE=new Zi(t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(AO);break}if(t.next==JR)e++;else if(t.next==hh&&e>=2){i>=3&&t.acceptToken(AO,-2);break}else e=0;t.advance()}});function sE(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}const nE=new Zi((t,e)=>{if(t.next==zp&&t.peek(1)==hh){let i=e.dialectEnabled(qR)||sE(e.context);t.acceptToken(i?AR:BO,2)}else t.next==hh&&t.acceptToken(BO,1)});function Zp(t,e,i){let r=2+t.length;return new Zi(s=>{for(let n=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(n==0&&s.next==Jy||n==1&&s.next==zp||n>=2&&n<r&&s.next==t.charCodeAt(n-2))n++,o++;else if(n==r&&s.next==hh){a>o?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}else if((s.next==10||s.next==13)&&a){s.acceptToken(e,1);break}else n=o=0;s.advance()}})}const oE=Zp("script",$R,PR),aE=Zp("style",QR,TR),lE=Zp("textarea",MR,BR),cE=ho({"Text RawText IncompleteTag IncompleteCloseTag":Q.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Q.angleBracket,TagName:Q.tagName,"MismatchedCloseTag/TagName":[Q.tagName,Q.invalid],AttributeName:Q.attributeName,"AttributeValue UnquotedAttributeValue":Q.attributeValue,Is:Q.definitionOperator,"EntityReference CharacterReference":Q.character,Comment:Q.blockComment,ProcessingInst:Q.processingInstruction,DoctypeDecl:Q.documentMeta}),hE=oo.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#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!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:tE,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity T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%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[oE,aE,lE,nE,iE,rE,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function e_(t,e){let i=Object.create(null);for(let r of t.getChildren(Gy)){let s=r.getChild(zR),n=r.getChild(jd)||r.getChild(Ky);s&&(i[e.read(s.from,s.to)]=n?n.type.id==jd?e.read(n.from+1,n.to-1):e.read(n.from,n.to):"")}return i}function NO(t,e){let i=t.getChild(NR);return i?e.read(i.from,i.to):" "}function xu(t,e,i){let r;for(let s of i)if(!s.attrs||s.attrs(r||(r=e_(t.node.parent.firstChild,e))))return{parser:s.parser,bracketed:!0};return null}function t_(t=[],e=[]){let i=[],r=[],s=[],n=[];for(let a of t)(a.tag=="script"?i:a.tag=="style"?r:a.tag=="textarea"?s:n).push(a);let o=e.length?Object.create(null):null;for(let a of e)(o[a.name]||(o[a.name]=[])).push(a);return eb((a,l)=>{let c=a.type.id;if(c==ZR)return xu(a,l,i);if(c==XR)return xu(a,l,r);if(c==WR)return xu(a,l,s);if(c==Uy&&n.length){let h=a.node,u=h.firstChild,d=u&&NO(u,l),p;if(d){for(let f of n)if(f.tag==d&&(!f.attrs||f.attrs(p||(p=e_(u,l))))){let g=h.lastChild,v=g.type.id==FR?g.from:h.to;if(v>u.to)return{parser:f.parser,overlay:[{from:u.to,to:v}]}}}}if(o&&c==Gy){let h=a.node,u;if(u=h.firstChild){let d=o[l.read(u.from,u.to)];if(d)for(let p of d){if(p.tagName&&p.tagName!=NO(h.parent,l))continue;let f=h.lastChild;if(f.type.id==jd){let g=f.from+1,v=f.lastChild,b=f.to-(v&&v.isError?0:1);if(b>g)return{parser:p.parser,overlay:[{from:g,to:b}],bracketed:!0}}else if(f.type.id==Ky)return{parser:p.parser,overlay:[{from:f.from,to:f.to}]}}}}return null})}const uE=122,zO=1,dE=123,fE=124,i_=2,pE=125,mE=3,gE=4,r_=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],OE=58,vE=40,s_=95,bE=91,xc=45,yE=46,_E=35,xE=37,SE=38,wE=92,kE=10,CE=42;function Ya(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Xp(t){return t>=48&&t<=57}function ZO(t){return Xp(t)||t>=97&&t<=102||t>=65&&t<=70}const n_=(t,e,i)=>(r,s)=>{for(let n=!1,o=0,a=0;;a++){let{next:l}=r;if(Ya(l)||l==xc||l==s_||n&&Xp(l))!n&&(l!=xc||a>0)&&(n=!0),o===a&&l==xc&&o++,r.advance();else if(l==wE&&r.peek(1)!=kE){if(r.advance(),ZO(r.next)){do r.advance();while(ZO(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();n=!0}else{n&&r.acceptToken(o==2&&s.canShift(i_)?e:l==vE?i:t);break}}},$E=new Zi(n_(dE,i_,fE)),PE=new Zi(n_(pE,mE,gE)),QE=new Zi(t=>{if(r_.includes(t.peek(-1))){let{next:e}=t;(Ya(e)||e==s_||e==_E||e==yE||e==CE||e==bE||e==OE&&Ya(t.peek(1))||e==xc||e==SE)&&t.acceptToken(uE)}}),TE=new Zi(t=>{if(!r_.includes(t.peek(-1))){let{next:e}=t;if(e==xE&&(t.advance(),t.acceptToken(zO)),Ya(e)){do t.advance();while(Ya(t.next)||Xp(t.next));t.acceptToken(zO)}}}),ME=ho({"AtKeyword import charset namespace keyframes media supports":Q.definitionKeyword,"from to selector":Q.keyword,NamespaceName:Q.namespace,KeyframeName:Q.labelName,KeyframeRangeName:Q.operatorKeyword,TagName:Q.tagName,ClassName:Q.className,PseudoClassName:Q.constant(Q.className),IdName:Q.labelName,"FeatureName PropertyName":Q.propertyName,AttributeName:Q.attributeName,NumberLiteral:Q.number,KeywordQuery:Q.keyword,UnaryQueryOp:Q.operatorKeyword,"CallTag ValueName":Q.atom,VariableName:Q.variableName,Callee:Q.operatorKeyword,Unit:Q.unit,"UniversalSelector NestingSelector":Q.definitionOperator,"MatchOp CompareOp":Q.compareOperator,"ChildOp SiblingOp, LogicOp":Q.logicOperator,BinOp:Q.arithmeticOperator,Important:Q.modifier,Comment:Q.blockComment,ColorLiteral:Q.color,"ParenthesizedContent StringLiteral":Q.string,":":Q.punctuation,"PseudoOp #":Q.derefOperator,"; ,":Q.separator,"( )":Q.paren,"[ ]":Q.squareBracket,"{ }":Q.brace}),BE={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},AE={__proto__:null,or:98,and:98,not:106,only:106,layer:170},RE={__proto__:null,selector:112,layer:166},EE={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},DE={__proto__:null,to:207},LE=oo.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQ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&S%Xk!^]bf!Y![!g#i#j#m$P$R%X%xQ#e!YQ${#mQ%w$tQ&j%xR&w&hQ!ygQ#p!`Q$^!xR%f$`R#n!]!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QQ!qdR$X!rQ!PVR#TrQ#S!PR$i#TQ!SWR#VsQ!UXR#WtQ{UQ!wgQ#^yQ#o!_Q$U!nQ$[!uQ$_!yQ%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",maxTerm:143,nodeProps:[["isolate",-2,5,36,""],["openedBy",20,"(",28,"[",31,"{"],["closedBy",21,")",29,"]",32,"}"]],propSources:[ME],skippedNodes:[0,5,106],repeatNodeCount:15,tokenData:"JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$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%Q}!OGO!O!Q%Q!Q![GO![!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjHQSmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",tokenizers:[QE,TE,$E,PE,1,2,3,4,new ch("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~",28,129)],topRules:{StyleSheet:[0,6],Styles:[1,105]},dynamicPrecedences:{76:1},specialized:[{term:124,get:t=>BE[t]||-1},{term:125,get:t=>AE[t]||-1},{term:4,get:t=>RE[t]||-1},{term:25,get:t=>EE[t]||-1},{term:123,get:t=>DE[t]||-1}],tokenPrec:1963});let Su=null;function wu(){if(!Su&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let r in t)r!="cssText"&&r!="cssFloat"&&typeof t[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())),i.has(r)||(e.push(r),i.add(r)));Su=e.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return Su||[]}const XO=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),WO=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),IE=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),NE=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),Yr=/^(\w[\w-]*|-\w[\w-]*|)$/,zE=/^-(-[\w-]*)?$/;function ZE(t,e){var i;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let r=(i=t.parent)===null||i===void 0?void 0:i.firstChild;return r?.name!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}const VO=new J1,XE=["Declaration"];function WE(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function o_(t,e,i){if(e.to-e.from>4096){let r=VO.get(e);if(r)return r;let s=[],n=new Set,o=e.cursor(lt.IncludeAnonymous);if(o.firstChild())do for(let a of o_(t,o.node,i))n.has(a.label)||(n.add(a.label),s.push(a));while(o.nextSibling());return VO.set(e,s),s}else{let r=[],s=new Set;return e.cursor().iterate(n=>{var o;if(i(n)&&n.matchContext(XE)&&((o=n.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=t.sliceString(n.from,n.to);s.has(a)||(s.add(a),r.push({label:a,type:"variable"}))}}),r}}const VE=t=>e=>{let{state:i,pos:r}=e,s=Ot(i).resolveInner(r,-1),n=s.type.isError&&s.from==s.to-1&&i.doc.sliceString(s.from,s.to)=="-";if(s.name=="PropertyName"||(n||s.name=="TagName")&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:wu(),validFor:Yr};if(s.name=="ValueName")return{from:s.from,options:WO,validFor:Yr};if(s.name=="PseudoClassName")return{from:s.from,options:XO,validFor:Yr};if(t(s)||(e.explicit||n)&&ZE(s,i.doc))return{from:t(s)||n?s.from:r,options:o_(i.doc,WE(s),t),validFor:zE};if(s.name=="TagName"){for(let{parent:l}=s;l;l=l.parent)if(l.name=="Block")return{from:s.from,options:wu(),validFor:Yr};return{from:s.from,options:IE,validFor:Yr}}if(s.name=="AtKeyword")return{from:s.from,options:NE,validFor:Yr};if(!e.explicit)return null;let o=s.resolve(r),a=o.childBefore(r);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:r,options:XO,validFor:Yr}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:r,options:WO,validFor:Yr}:o.name=="Block"||o.name=="Styles"?{from:r,options:wu(),validFor:Yr}:null},FE=VE(t=>t.name=="VariableName"),uh=io.define({name:"css",parser:LE.configure({props:[hl.add({Declaration:yc()}),uo.add({"Block KeyframeList":ab})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function HE(){return new Ia(uh,uh.data.of({autocomplete:FE}))}const qE=316,YE=317,FO=1,jE=2,UE=3,GE=4,KE=318,JE=320,eD=321,tD=5,iD=6,rD=0,Gd=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],a_=125,sD=59,Kd=47,nD=42,oD=43,aD=45,lD=60,cD=44,hD=63,uD=46,dD=91,fD=new Fy({start:!1,shift(t,e){return e==tD||e==iD||e==JE?t:e==eD},strict:!1}),pD=new Zi((t,e)=>{let{next:i}=t;(i==a_||i==-1||e.context)&&t.acceptToken(KE)},{contextual:!0,fallback:!0}),mD=new Zi((t,e)=>{let{next:i}=t,r;Gd.indexOf(i)>-1||i==Kd&&((r=t.peek(1))==Kd||r==nD)||i!=a_&&i!=sD&&i!=-1&&!e.context&&t.acceptToken(qE)},{contextual:!0}),gD=new Zi((t,e)=>{t.next==dD&&!e.context&&t.acceptToken(YE)},{contextual:!0}),OD=new Zi((t,e)=>{let{next:i}=t;if(i==oD||i==aD){if(t.advance(),i==t.next){t.advance();let r=!e.context&&e.canShift(FO);t.acceptToken(r?FO:jE)}}else i==hD&&t.peek(1)==uD&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(UE))},{contextual:!0});function ku(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}const vD=new Zi((t,e)=>{if(t.next!=lD||!e.dialectEnabled(rD)||(t.advance(),t.next==Kd))return;let i=0;for(;Gd.indexOf(t.next)>-1;)t.advance(),i++;if(ku(t.next,!0)){for(t.advance(),i++;ku(t.next,!1);)t.advance(),i++;for(;Gd.indexOf(t.next)>-1;)t.advance(),i++;if(t.next==cD)return;for(let r=0;;r++){if(r==7){if(!ku(t.next,!0))return;break}if(t.next!="extends".charCodeAt(r))break;t.advance(),i++}}t.acceptToken(GE,-i)}),bD=ho({"get set async static":Q.modifier,"for while do if else switch try catch finally return throw break continue default case defer":Q.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":Q.operatorKeyword,"let var const using function class extends":Q.definitionKeyword,"import export from":Q.moduleKeyword,"with debugger new":Q.keyword,TemplateString:Q.special(Q.string),super:Q.atom,BooleanLiteral:Q.bool,this:Q.self,null:Q.null,Star:Q.modifier,VariableName:Q.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Q.function(Q.variableName),VariableDefinition:Q.definition(Q.variableName),Label:Q.labelName,PropertyName:Q.propertyName,PrivatePropertyName:Q.special(Q.propertyName),"CallExpression/MemberExpression/PropertyName":Q.function(Q.propertyName),"FunctionDeclaration/VariableDefinition":Q.function(Q.definition(Q.variableName)),"ClassDeclaration/VariableDefinition":Q.definition(Q.className),"NewExpression/VariableName":Q.className,PropertyDefinition:Q.definition(Q.propertyName),PrivatePropertyDefinition:Q.definition(Q.special(Q.propertyName)),UpdateOp:Q.updateOperator,"LineComment Hashbang":Q.lineComment,BlockComment:Q.blockComment,Number:Q.number,String:Q.string,Escape:Q.escape,ArithOp:Q.arithmeticOperator,LogicOp:Q.logicOperator,BitOp:Q.bitwiseOperator,CompareOp:Q.compareOperator,RegExp:Q.regexp,Equals:Q.definitionOperator,Arrow:Q.function(Q.punctuation),": Spread":Q.punctuation,"( )":Q.paren,"[ ]":Q.squareBracket,"{ }":Q.brace,"InterpolationStart InterpolationEnd":Q.special(Q.brace),".":Q.derefOperator,", ;":Q.separator,"@":Q.meta,TypeName:Q.typeName,TypeDefinition:Q.definition(Q.typeName),"type enum interface implements namespace module declare":Q.definitionKeyword,"abstract global Privacy readonly override":Q.modifier,"is keyof unique infer asserts":Q.operatorKeyword,JSXAttributeValue:Q.attributeValue,JSXText:Q.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Q.angleBracket,"JSXIdentifier JSXNameSpacedName":Q.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Q.attributeName,"JSXBuiltin/JSXIdentifier":Q.standard(Q.tagName)}),yD={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},_D={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},xD={__proto__:null,"<":193},SD=oo.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQ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y(h(iQ.^(jQ0t+^Q3Y.ZU3Z.[.]._S7S3[3]R9`7Td#^W#W#Z%h(T(^*Y+Z.T/mr#gZm#h#i#l%e(h(i(j+^.Z.[.]._3[3]7TS*]$x*bQ/t*^Q2U,oQ2l-VQ4`/pQ6q2dQ7s4aQ9W6rT=m'X+[V#aW%h*YU#`W%h*YS(U#W(^U(Z#Z+Z/mS-['X+[T.O(T.TV'^!e%i*ZQ$lfR)x$qT)m$l)nR4V/UT*_$x*bT*h${*YQ0w+fQ1g,VQ3_.fQ5t1iQ6P1qQ7X3cQ8r6SQ9c7WQ:^8qQ:p9bQ;Z:`Q;c:rQ;n;[R;q;dnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&l!VR,h&itmOXst!U!V!Z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:"⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:fD,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"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!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new ch("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:t=>yD[t]||-1},{term:343,get:t=>_D[t]||-1},{term:95,get:t=>xD[t]||-1}],tokenPrec:15201}),l_=[xi("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),xi("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),xi("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),xi("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),xi("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),xi(`try {
|
|
27
|
-
\${}
|
|
28
|
-
} catch (\${error}) {
|
|
29
|
-
\${}
|
|
30
|
-
}`,{label:"try",detail:"/ catch block",type:"keyword"}),xi("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),xi(`if (\${}) {
|
|
31
|
-
\${}
|
|
32
|
-
} else {
|
|
33
|
-
\${}
|
|
34
|
-
}`,{label:"if",detail:"/ else block",type:"keyword"}),xi(`class \${name} {
|
|
35
|
-
constructor(\${params}) {
|
|
36
|
-
\${}
|
|
37
|
-
}
|
|
38
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),xi('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),xi('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],wD=l_.concat([xi("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),xi("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),xi("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),HO=new J1,c_=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Go(t){return(e,i)=>{let r=e.node.getChild("VariableDefinition");return r&&i(r,t),!0}}const kD=["FunctionDeclaration"],CD={FunctionDeclaration:Go("function"),ClassDeclaration:Go("class"),ClassExpression:()=>!0,EnumDeclaration:Go("constant"),TypeAliasDeclaration:Go("type"),NamespaceDeclaration:Go("namespace"),VariableDefinition(t,e){t.matchContext(kD)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function h_(t,e){let i=HO.get(e);if(i)return i;let r=[],s=!0;function n(o,a){let l=t.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(lt.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=CD[o.name];if(a&&a(o,n)||c_.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of h_(t,o.node))r.push(a);return!1}}),HO.set(e,r),r}const qO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,u_=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function $D(t){let e=Ot(t.state).resolveInner(t.pos,-1);if(u_.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&qO.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)c_.has(s.name)&&(r=r.concat(h_(t.state.doc,s)));return{options:r,from:i?e.from:t.pos,validFor:qO}}const Lr=io.define({name:"javascript",parser:SD.configure({props:[hl.add({IfStatement:yc({except:/^\s*({|else\b)/}),TryStatement:yc({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:gM,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:r?1:2)*t.unit},Block:mM({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":yc({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),uo.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ab,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),d_={test:t=>/^JSX/.test(t.name),facet:mp({commentTokens:{block:{open:"{/*",close:"*/}"}}})},f_=Lr.configure({dialect:"ts"},"typescript"),p_=Lr.configure({dialect:"jsx",props:[gp.add(t=>t.isTop?[d_]:void 0)]}),m_=Lr.configure({dialect:"jsx ts",props:[gp.add(t=>t.isTop?[d_]:void 0)]},"typescript");let g_=t=>({label:t,type:"keyword"});const O_="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(g_),PD=O_.concat(["declare","implements","private","protected","public"].map(g_));function QD(t={}){let e=t.jsx?t.typescript?m_:p_:t.typescript?f_:Lr,i=t.typescript?wD.concat(PD):l_.concat(O_);return new Ia(e,[Lr.data.of({autocomplete:LB(u_,ay(i))}),Lr.data.of({autocomplete:$D}),t.jsx?BD:[]])}function TD(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function YO(t,e,i=t.length){for(let r=e?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,i));return""}const MD=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),BD=Ce.inputHandler.of((t,e,i,r,s)=>{if((MD?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||r!=">"&&r!="/"||!Lr.isActiveAt(t.state,e,-1))return!1;let n=s(),{state:o}=n,a=o.changeByRange(l=>{var c;let{head:h}=l,u=Ot(o).resolveInner(h-1,-1),d;if(u.name=="JSXStartTag"&&(u=u.parent),!(o.doc.sliceString(h-1,h)!=r||u.name=="JSXAttributeValue"&&u.to>h)){if(r==">"&&u.name=="JSXFragmentTag")return{range:l,changes:{from:h,insert:"</>"}};if(r=="/"&&u.name=="JSXStartCloseTag"){let p=u.parent,f=p.parent;if(f&&p.from==h-2&&((d=YO(o.doc,f.firstChild,h))||((c=f.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let g=`${d}>`;return{range:le.cursor(h+g.length,-1),changes:{from:h,insert:g}}}}else if(r==">"){let p=TD(u);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(h,h+2))&&(d=YO(o.doc,p,h)))return{range:l,changes:{from:h,insert:`</${d}>`}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ko=["_blank","_self","_top","_parent"],Cu=["ascii","utf-8","utf-16","latin1","latin1"],$u=["get","post","put","delete"],Pu=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Mi=["true","false"],Re={},AD={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ko,hreflang:null}},abbr:Re,address:Re,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Re,aside:Re,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Re,base:{attrs:{href:null,target:Ko}},bdi:Re,bdo:Re,blockquote:{attrs:{cite:null}},body:Re,br:Re,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Pu,formmethod:$u,formnovalidate:["novalidate"],formtarget:Ko,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Re,center:Re,cite:Re,code:Re,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Re,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Re,div:Re,dl:Re,dt:Re,em:Re,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Re,figure:Re,footer:Re,form:{attrs:{action:null,name:null,"accept-charset":Cu,autocomplete:["on","off"],enctype:Pu,method:$u,novalidate:["novalidate"],target:Ko}},h1:Re,h2:Re,h3:Re,h4:Re,h5:Re,h6:Re,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Re,hgroup:Re,hr:Re,html:{attrs:{manifest:null}},i:Re,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Pu,formmethod:$u,formnovalidate:["novalidate"],formtarget:Ko,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Re,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Re,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Re,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Cu,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Re,noscript:Re,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Re,param:{attrs:{name:null,value:null}},pre:Re,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Re,rt:Re,ruby:Re,samp:Re,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Cu}},section:Re,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Re,source:{attrs:{src:null,type:null,media:null}},span:Re,strong:Re,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Re,summary:Re,sup:Re,table:Re,tbody:Re,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Re,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Re,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Re,time:{attrs:{datetime:null}},title:Re,tr:Re,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Re,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Re},v_={accesskey:null,class:null,contenteditable:Mi,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Mi,autocorrect:Mi,autocapitalize:Mi,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Mi,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Mi,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Mi,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Mi,"aria-hidden":Mi,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Mi,"aria-multiselectable":Mi,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Mi,"aria-relevant":null,"aria-required":Mi,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},b_="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of b_)v_[t]=null;class ja{constructor(e,i){this.tags={...AD,...e},this.globalAttrs={...v_,...i},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}ja.default=new ja;function ao(t,e,i=t.length){if(!e)return"";let r=e.firstChild,s=r&&r.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function lo(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function y_(t,e,i){let r=i.tags[ao(t,lo(e))];return r?.children||i.allTags}function Wp(t,e){let i=[];for(let r=lo(e);r&&!r.type.isTop;r=lo(r.parent)){let s=ao(t,r);if(s&&r.lastChild.name=="CloseTag")break;s&&i.indexOf(s)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&i.push(s)}return i}const __=/^[:\-\.\w\u00b7-\uffff]*$/;function jO(t,e,i,r,s){let n=/\s*>/.test(t.sliceDoc(s,s+5))?"":">",o=lo(i,i.name=="StartTag"||i.name=="TagName");return{from:r,to:s,options:y_(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(Wp(t.doc,i).map((a,l)=>({label:"/"+a,apply:"/"+a+n,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function UO(t,e,i,r){let s=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:i,to:r,options:Wp(t.doc,e).map((n,o)=>({label:n,apply:n+s,type:"type",boost:99-o})),validFor:__}}function RD(t,e,i,r){let s=[],n=0;for(let o of y_(t.doc,i,e))s.push({label:"<"+o,type:"type"});for(let o of Wp(t.doc,i))s.push({label:"</"+o+">",type:"type",boost:99-n++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ED(t,e,i,r,s){let n=lo(i),o=n?e.tags[ao(t.doc,n)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:s,options:l.map(c=>({label:c,type:"property"})),validFor:__}}function DD(t,e,i,r,s){var n;let o=(n=i.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),a=[],l;if(o){let c=t.sliceDoc(o.from,o.to),h=e.globalAttrs[c];if(!h){let u=lo(i),d=u?e.tags[ao(t.doc,u)]:null;h=d?.attrs&&d.attrs[c]}if(h){let u=t.sliceDoc(r,s).toLowerCase(),d='"',p='"';/^['"]/.test(u)?(l=u[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",p=t.sliceDoc(s,s+1)==u[0]?"":u[0],u=u.slice(1),r++):l=/^[^\s<>='"]*$/;for(let f of h)a.push({label:f,apply:d+f+p,type:"constant"})}}return{from:r,to:s,options:a,validFor:l}}function x_(t,e){let{state:i,pos:r}=e,s=Ot(i).resolveInner(r,-1),n=s.resolve(r);for(let o=r,a;n==s&&(a=s.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;n=s=a,o=l.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?UO(i,s,s.from,r):jO(i,t,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?jO(i,t,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?UO(i,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?ED(i,t,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?DD(i,t,s,s.name=="Is"?r:s.from,r):e.explicit&&(n.name=="Element"||n.name=="Text"||n.name=="Document")?RD(i,t,s,r):null}function LD(t){return x_(ja.default,t)}function ID(t){let{extraTags:e,extraGlobalAttributes:i}=t,r=i||e?new ja(e,i):ja.default;return s=>x_(r,s)}const ND=Lr.parser.configure({top:"SingleExpression"}),S_=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:f_.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:p_.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:m_.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:ND},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:Lr.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:uh.parser}],w_=[{name:"style",parser:uh.parser.configure({top:"Styles"})}].concat(b_.map(t=>({name:t,parser:Lr.parser}))),k_=io.define({name:"html",parser:hE.configure({props:[hl.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].length<t.node.to)return t.continue();let e=null,i;for(let r=t.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;e=r=s}return e&&!((i=e.lastChild)&&(i.name=="CloseTag"||i.name=="SelfClosingTag"))?t.lineIndent(e.from)+t.unit:null}}),uo.add({Element(t){let e=t.firstChild,i=t.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:i.name=="CloseTag"?i.from:t.to}}}),yb.add({"OpenTag CloseTag":t=>t.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Sc=k_.configure({wrap:t_(S_,w_)});function zD(t={}){let e="",i;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(i=t_((t.nestedLanguages||[]).concat(S_),(t.nestedAttributes||[]).concat(w_)));let r=i?k_.configure({wrap:i,dialect:e}):e?Sc.configure({dialect:e}):Sc;return new Ia(r,[Sc.data.of({autocomplete:ID(t)}),t.autoCloseTags!==!1?ZD:[],QD().support,HE().support])}const GO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ZD=Ce.inputHandler.of((t,e,i,r,s)=>{if(t.composing||t.state.readOnly||e!=i||r!=">"&&r!="/"||!Sc.isActiveAt(t.state,e,-1))return!1;let n=s(),{state:o}=n,a=o.changeByRange(l=>{var c,h,u;let d=o.doc.sliceString(l.from-1,l.to)==r,{head:p}=l,f=Ot(o).resolveInner(p,-1),g;if(d&&r==">"&&f.name=="EndTag"){let v=f.parent;if(((h=(c=v.parent)===null||c===void 0?void 0:c.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(g=ao(o.doc,v.parent,p))&&!GO.has(g)){let b=p+(o.doc.sliceString(p,p+1)===">"?1:0),S=`</${g}>`;return{range:l,changes:{from:p,to:b,insert:S}}}}else if(d&&r=="/"&&f.name=="IncompleteCloseTag"){let v=f.parent;if(f.from==p-2&&((u=v.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(g=ao(o.doc,v,p))&&!GO.has(g)){let b=p+(o.doc.sliceString(p,p+1)===">"?1:0),S=`${g}>`;return{range:le.cursor(p+S.length,-1),changes:{from:p,to:b,insert:S}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),C_=mp({commentTokens:{block:{open:"<!--",close:"-->"}}}),$_=new Fe,P_=sR.configure({props:[uo.add(t=>!t.is("Block")||t.is("Document")||Jd(t)!=null||XD(t)?void 0:(e,i)=>({from:i.doc.lineAt(e.from).to,to:e.to})),$_.add(Jd),hl.add({Document:()=>null}),nn.add({Document:C_})]});function Jd(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function XD(t){return t.name=="OrderedList"||t.name=="BulletList"}function WD(t,e){let i=t;for(;;){let r=i.nextSibling,s;if(!r||(s=Jd(r.type))!=null&&s<=e)break;i=r}return i.to}const VD=ob.of((t,e,i)=>{for(let r=Ot(t).resolveInner(i,-1);r&&!(r.from<e);r=r.parent){let s=r.type.prop($_);if(s==null)continue;let n=WD(r,s);if(n>i)return{from:i,to:n}}return null});function Vp(t){return new Ui(C_,t,[],"markdown")}const FD=Vp(P_),HD=P_.configure([mR,OR,gR,vR,{props:[uo.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),dh=Vp(HD);function qD(t,e){return i=>{if(i&&t){let r=null;if(i=/\S*/.exec(i)[0],typeof t=="function"?r=t(i):r=qc.matchLanguageName(t,i,!0),r instanceof qc)return r.support?r.support.language.parser:La.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}class Qu{constructor(e,i,r,s,n,o,a){this.node=e,this.from=i,this.to=r,this.spaceBefore=s,this.spaceAfter=n,this.type=o,this.item=a}blank(e,i=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length<e;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(i?this.spaceAfter:"")}}marker(e,i){let r=this.node.name=="OrderedList"?String(+T_(this.item,e)[2]+i):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Q_(t,e){let i=[],r=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&i.push(s)}for(let s=i.length-1;s>=0;s--){let n=i[s],o,a=e.lineAt(n.from),l=n.from-a.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Qu(n,l,l+o[0].length,"",o[1],">",null));else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],h=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),h-=4),r.push(new Qu(n.parent,l,l+h,o[1],c,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],h=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),h-=4);let u=o[2];o[3]&&(u+=o[3].replace(/[xX]/," ")),r.push(new Qu(n.parent,l,l+h,o[1],c,u,n))}}return r}function T_(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function Tu(t,e,i,r=0){for(let s=-1,n=t;;){if(n.name=="ListItem"){let a=T_(n,e),l=+a[2];if(s>=0){if(l!=s+1)return;i.push({from:n.from+a[1].length,to:n.from+a[0].length,insert:String(s+2+r)})}s=l}let o=n.nextSibling;if(!o)break;n=o}}function Fp(t,e){let i=/^[ \t]*/.exec(t)[0].length;if(!i||e.facet(cl)!=" ")return t;let r=cr(t,4,i),s="";for(let n=r;n>0;)n>=4?(s+=" ",n-=4):(s+=" ",n--);return s+t.slice(i)}const YD=(t={})=>({state:e,dispatch:i})=>{let r=Ot(e),{doc:s}=e,n=null,o=e.changeByRange(a=>{if(!a.empty||!dh.isActiveAt(e,a.from,-1)&&!dh.isActiveAt(e,a.from,1))return n={range:a};let l=a.from,c=s.lineAt(l),h=Q_(r.resolveInner(l,-1),s);for(;h.length&&h[h.length-1].from>l-c.from;)h.pop();if(!h.length)return n={range:a};let u=h[h.length-1];if(u.to-u.spaceAfter.length>l-c.from)return n={range:a};let d=l>=u.to-u.spaceAfter.length&&!/\S/.test(c.text.slice(u.to));if(u.item&&d){let b=u.node.firstChild,S=u.node.getChild("ListItem","ListItem");if(b.to>=l||S&&S.to<l||c.from>0&&!/[^\s>]/.test(s.lineAt(c.from-1).text)||t.nonTightLists===!1){let k=h.length>1?h[h.length-2]:null,T,$="";k&&k.item?(T=c.from+k.from,$=k.marker(s,1)):T=c.from+(k?k.to:0);let R=[{from:T,to:l,insert:$}];return u.node.name=="OrderedList"&&Tu(u.item,s,R,-2),k&&k.node.name=="OrderedList"&&Tu(k.item,s,R),{range:le.cursor(T+$.length),changes:R}}else{let k=JO(h,e,c);return{range:le.cursor(l+k.length+1),changes:{from:c.from,insert:k+e.lineBreak}}}}if(u.node.name=="Blockquote"&&d&&c.from){let b=s.lineAt(c.from-1),S=/>\s*$/.exec(b.text);if(S&&S.index==u.from){let k=e.changes([{from:b.from+S.index,to:b.to},{from:c.from+u.from,to:c.to}]);return{range:a.map(k),changes:k}}}let p=[];u.node.name=="OrderedList"&&Tu(u.item,s,p);let f=u.item&&u.item.from<c.from,g="";if(!f||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=u.to)for(let b=0,S=h.length-1;b<=S;b++)g+=b==S&&!f?h[b].marker(s,1):h[b].blank(b<S?cr(c.text,4,h[b+1].from)-g.length:null);let v=l;for(;v>c.from&&/\s/.test(c.text.charAt(v-c.from-1));)v--;return g=Fp(g,e),UD(u.node,e.doc)&&(g=JO(h,e,c)+e.lineBreak+g),p.push({from:v,to:l,insert:e.lineBreak+g}),{range:le.cursor(v+g.length+1),changes:p}});return n?!1:(i(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},jD=YD();function KO(t){return t.name=="QuoteMark"||t.name=="ListMark"}function UD(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let i=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let s=e.lineAt(i.to),n=e.lineAt(r.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<n.number}function JO(t,e,i){let r="";for(let s=0,n=t.length-2;s<=n;s++)r+=t[s].blank(s<n?cr(i.text,4,t[s+1].from)-r.length:null,s<n);return Fp(r,e)}function GD(t,e){let i=t.resolveInner(e,-1),r=e;KO(i)&&(r=i.from,i=i.parent);for(let s;s=i.childBefore(r);)if(KO(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")i=s.lastChild,r=i.to;else break;return i}const KD=({state:t,dispatch:e})=>{let i=Ot(t),r=null,s=t.changeByRange(n=>{let o=n.from,{doc:a}=t;if(n.empty&&dh.isActiveAt(t,n.from)){let l=a.lineAt(o),c=Q_(GD(i,o),a);if(c.length){let h=c[c.length-1],u=h.to-h.spaceAfter.length+(h.spaceAfter?1:0);if(o-l.from>u&&!/\S/.test(l.text.slice(u,o-l.from)))return{range:le.cursor(l.from+u),changes:{from:l.from+u,to:o}};if(o-l.from==u&&(!h.item||l.from<=h.item.from||!/\S/.test(l.text.slice(0,h.to)))){let d=l.from+h.from;if(h.item&&h.node.from<h.item.from&&/\S/.test(l.text.slice(h.from,h.to))){let p=h.blank(cr(l.text,4,h.to)-cr(l.text,4,h.from));return d==l.from&&(p=Fp(p,t)),{range:le.cursor(d+p.length),changes:{from:d,to:l.from+h.to,insert:p}}}if(d<o)return{range:le.cursor(d),changes:{from:d,to:o}}}}}return r={range:n}});return r?!1:(e(t.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},JD=[{key:"Enter",run:jD},{key:"Backspace",run:KD}],M_=zD({matchClosingTags:!1});function eL(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:r=!0,base:{parser:s}=FD,completeHTMLTags:n=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=M_}=t;if(!(s instanceof Ih))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=t.extensions?[t.extensions]:[],c=[a.support,VD],h;o&&c.push(sL),i instanceof Ia?(c.push(i.support),h=i.language):i&&(h=i);let u=e||h?qD(e,h):void 0;l.push(oR({codeParser:u,htmlParser:a.language.parser})),r&&c.push(os.high(ol.of(JD)));let d=Vp(s.configure(l));return n&&c.push(d.data.of({autocomplete:tL})),new Ia(d,c)}function tL(t){let{state:e,pos:i}=t,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(i-25,i));if(!r)return null;let s=Ot(e).resolveInner(i,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:i-r[0].length,to:i,options:iL(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Mu=null;function iL(){if(Mu)return Mu;let t=LD(new Cp(tt.create({extensions:M_}),0,!0));return Mu=t?t.options:[]}const rL=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,sL=Ce.domEventHandlers({paste:(t,e)=>{var i;let{main:r}=e.state.selection;if(r.empty)return!1;let s=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!dh.isActiveAt(e.state,r.from,1)))return!1;let n=Ot(e.state),o=!1;return n.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||rL.test(a.name))&&(o=!0)},leave:a=>{a.to<r.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),nL="#e5c07b",ev="#e06c75",oL="#56b6c2",aL="#ffffff",wc="#abb2bf",ef="#7d8799",lL="#61afef",cL="#98c379",tv="#d19a66",hL="#c678dd",uL="#21252b",iv="#2c313a",rv="#282c34",Bu="#353a42",dL="#3E4451",sv="#528bff",fL=Ce.theme({"&":{color:wc,backgroundColor:rv},".cm-content":{caretColor:sv},".cm-cursor, .cm-dropCursor":{borderLeftColor:sv},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:dL},".cm-panels":{backgroundColor:uL,color:wc},".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 #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:rv,color:ef,border:"none"},".cm-activeLineGutter":{backgroundColor:iv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Bu},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Bu,borderBottomColor:Bu},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:iv,color:wc}}},{dark:!0}),pL=dl.define([{tag:Q.keyword,color:hL},{tag:[Q.name,Q.deleted,Q.character,Q.propertyName,Q.macroName],color:ev},{tag:[Q.function(Q.variableName),Q.labelName],color:lL},{tag:[Q.color,Q.constant(Q.name),Q.standard(Q.name)],color:tv},{tag:[Q.definition(Q.name),Q.separator],color:wc},{tag:[Q.typeName,Q.className,Q.number,Q.changed,Q.annotation,Q.modifier,Q.self,Q.namespace],color:nL},{tag:[Q.operator,Q.operatorKeyword,Q.url,Q.escape,Q.regexp,Q.link,Q.special(Q.string)],color:oL},{tag:[Q.meta,Q.comment],color:ef},{tag:Q.strong,fontWeight:"bold"},{tag:Q.emphasis,fontStyle:"italic"},{tag:Q.strikethrough,textDecoration:"line-through"},{tag:Q.link,color:ef,textDecoration:"underline"},{tag:Q.heading,fontWeight:"bold",color:ev},{tag:[Q.atom,Q.bool,Q.special(Q.variableName)],color:tv},{tag:[Q.processingInstruction,Q.string,Q.inserted],color:cL},{tag:Q.invalid,color:aL}]),mL=[fL,gb(pL)],gL=Xe({__name:"MarkdownCodeEditor",props:{modelValue:{},readOnly:{type:Boolean,default:!1},lineToReveal:{default:null}},emits:["update:modelValue"],setup(t,{emit:e}){const i=t,r=e,s=A(null);let n=null,o=!1,a=null;const l=Ve.define(),c=Ve.define(),h=Kt.define({create(){return Ie.none},update(f,g){let v=f.map(g.changes);for(const b of g.effects)if(b.is(c)&&(v=Ie.none),b.is(l)){const S=Math.max(1,Math.min(b.value,g.state.doc.lines)),k=g.state.doc.line(S);v=Ie.set([Ie.line({class:"cm-target-line"}).range(k.from)])}return v},provide:f=>Ce.decorations.from(f)});function u(){n&&(a&&clearTimeout(a),a=setTimeout(()=>{n&&n.dispatch({effects:c.of(void 0)})},1600))}function d(f){if(!n)return;const g=Math.max(1,Math.min(f,n.state.doc.lines)),v=n.state.doc.line(g);n.dispatch({selection:{anchor:v.from},effects:[Ce.scrollIntoView(v.from,{y:"center"}),l.of(g)]}),n.focus(),u()}function p(f,g){return tt.create({doc:f,extensions:[HA,eL(),mL,Ce.lineWrapping,h,Ce.updateListener.of(v=>{!v.docChanged||o||r("update:modelValue",v.state.doc.toString())}),Ce.theme({"&":{height:"100%",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",fontSize:"13px",backgroundColor:"rgb(var(--color-retro-black))",color:"rgb(var(--color-retro-text))"},".cm-scroller":{overflow:"auto",lineHeight:"1.6"},".cm-gutters":{backgroundColor:"rgb(var(--color-retro-dark))",color:"rgb(var(--color-retro-subtle))",borderRight:"1px solid rgb(var(--color-retro-border))"},".cm-content":{caretColor:"rgb(var(--color-retro-cyan))",padding:"12px 0"},".cm-activeLine":{backgroundColor:"rgba(34, 211, 238, 0.08)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"rgba(34, 211, 238, 0.22)"}}),tt.readOnly.of(g)]})}return kt(()=>{s.value&&(n=new Ce({state:p(i.modelValue,i.readOnly),parent:s.value}),i.lineToReveal&&d(i.lineToReveal))}),He(()=>i.modelValue,f=>{if(!n)return;const g=n.state.doc.toString();g!==f&&(o=!0,n.dispatch({changes:{from:0,to:g.length,insert:f}}),o=!1)}),He(()=>i.lineToReveal,f=>{f&&d(f)}),Lx(()=>{a&&clearTimeout(a),n&&(n.destroy(),n=null)}),(f,g)=>(y(),_("div",{ref_key:"rootRef",ref:s,class:"h-full w-full"},null,512))}}),OL=ns(gL,[["__scopeId","data-v-d77d4160"]]),vL={class:"fixed inset-0 z-50 flex items-center justify-center"},bL={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},yL={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},_L={class:"flex items-center gap-3 min-w-0"},xL={class:"text-sm font-mono font-bold text-retro-cyan truncate"},SL={class:"text-xs font-mono text-retro-subtle"},wL={class:"flex items-center gap-2"},kL=["disabled"],CL={class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},$L=["onClick"],PL={class:"flex-1 min-h-0 overflow-y-auto"},QL={key:0,class:"p-5 max-w-6xl mx-auto"},TL={key:0,class:"flex items-center justify-center py-12"},ML={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},BL={class:"text-sm font-mono text-retro-red"},AL={key:2,class:"space-y-4"},RL={key:0,class:"rounded border border-retro-cyan/40 bg-retro-cyan/10 px-3 py-2 text-xs font-mono text-retro-cyan"},EL={class:"grid grid-cols-2 lg:grid-cols-5 gap-2"},DL={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},LL={class:"text-sm font-mono text-retro-text"},IL={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},NL={class:"text-sm font-mono text-retro-cyan"},zL={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},ZL={class:"text-sm font-mono text-retro-yellow"},XL={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},WL={class:"text-sm font-mono text-retro-green"},VL={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},FL={class:"text-sm font-mono text-retro-text"},HL={class:"rounded border border-retro-border bg-retro-panel px-3 py-3"},qL={class:"flex items-center justify-between gap-2 mb-2"},YL={class:"text-[11px] font-mono text-retro-subtle"},jL={key:0,class:"text-xs font-mono text-retro-green"},UL={key:1,class:"space-y-2"},GL={class:"uppercase tracking-wide mr-2"},KL={class:"rounded border border-retro-border bg-retro-panel p-3 overflow-x-auto"},JL={class:"min-w-[760px]"},e6={class:"text-retro-text"},t6=["disabled","onClick"],i6=["disabled","onClick"],r6=["disabled","onClick"],s6={class:"text-retro-muted"},n6={key:1,class:"flex items-center justify-center py-12"},o6={key:2,class:"flex flex-col items-center justify-center py-12 text-center px-4"},a6={class:"text-sm font-mono text-retro-red"},l6={key:3,class:"flex flex-col items-center justify-center py-12 text-center"},c6={key:4,class:"h-full flex flex-col"},h6=["innerHTML"],u6=Xe({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(t,{emit:e}){const i=t,r=e,s=el(),{renderMarkdown:n}=o0(),o=A(i.feature.files[0]?.filename||""),a=A("document"),l=A(""),c=A(!1),h=A(null),u=A(!1),d=A(""),p=A(!1),f=A(null),g=A(null),v=A(!1),b=A(null),S=A(null),k=ae(()=>{const te={critical:0,major:1,minor:2};return[...S.value?.alerts??[]].sort((G,be)=>te[G.severity]-te[be.severity])});function T(te){return te.status==="covered"?"text-retro-green border-retro-green/40 bg-retro-green/10":te.status==="partial"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-red border-retro-red/40 bg-retro-red/10"}function $(te){return te.severity==="critical"?"text-retro-red border-retro-red/40 bg-retro-red/10":te.severity==="major"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10"}async function R(){v.value=!0,b.value=null;try{S.value=await $fetch(`/api/specs/traceability/${i.feature.id}`)}catch{b.value="Failed to load traceability data",S.value=null}finally{v.value=!1}}async function D(te=o.value){if(te){c.value=!0,h.value=null;try{const G=`/api/specs/${i.feature.id}/${te}`,be=await $fetch(G);l.value=be.content}catch{h.value="Failed to load file",l.value=""}finally{c.value=!1}}}function U(){D()}const ce=ae(()=>l.value?n(l.value):"");function he(te){g.value=null,a.value="document",u.value&&(u.value=!1),o.value=te,D()}function W(){u.value&&V(),a.value="traceability",!S.value&&!v.value&&R()}async function M(te,G,be){G&&(o.value!==te?(o.value=te,await D(te)):l.value||await D(te),a.value="document",u.value=!0,d.value=l.value,f.value=null,g.value={filename:te,line:G,requirementId:be},await ai(),f.value=G)}function x(){d.value=l.value,f.value=null,u.value=!0}function V(){u.value=!1,d.value=""}async function N(){p.value=!0;try{const te=`/api/specs/${i.feature.id}/${o.value}`;await $fetch(te,{method:"PUT",body:{content:d.value}}),l.value=d.value,u.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{p.value=!1}}function K(te){te.key==="Escape"&&(u.value?V():r("close"))}return kt(()=>{window.addEventListener("keydown",K),D(),R()}),si(()=>{window.removeEventListener("keydown",K)}),(te,G)=>{const be=OL;return y(),Se(zi,{to:"body"},[m("div",vL,[m("div",{class:"absolute inset-0 bg-black/80",onClick:G[0]||(G[0]=ie=>r("close"))}),m("div",bL,[m("div",yL,[m("div",_L,[m("span",xL,I(t.feature.name),1),m("span",SL,I(t.feature.id),1)]),m("div",wL,[O(u)?(y(),_($e,{key:0},[m("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:V}," Cancel "),m("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:O(p),onClick:N},I(O(p)?"Saving...":"Save"),9,kL)],64)):O(a)==="document"&&O(l)&&!O(c)&&!O(h)?(y(),_("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:x},[oe(O(v0),{class:"h-4 w-4"})])):se("",!0),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:G[1]||(G[1]=ie=>r("close"))},[oe(O(Gt),{class:"h-4 w-4"})])])]),m("div",CL,[m("button",{type:"button",class:Ee(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap flex items-center gap-1",[O(a)==="traceability"?"border-retro-magenta text-retro-magenta bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:W},[oe(O(pS),{class:"h-3.5 w-3.5"}),G[3]||(G[3]=Ze(" Traceability ",-1))],2),(y(!0),_($e,null,je(t.feature.files,ie=>(y(),_("button",{key:ie.filename,type:"button",class:Ee(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[O(a)==="document"&&O(o)===ie.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:q=>he(ie.filename)},I(ie.label),11,$L))),128))]),m("div",PL,[O(a)==="traceability"?(y(),_("div",QL,[O(v)?(y(),_("div",TL,[...G[4]||(G[4]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading traceability...",-1)])])):O(b)?(y(),_("div",ML,[m("p",BL,I(O(b)),1),m("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:R}," Retry ")])):O(S)?(y(),_("div",AL,[O(g)?(y(),_("div",RL," Jump target: "+I(O(g).requirementId)+" → "+I(O(g).filename)+":"+I(O(g).line),1)):se("",!0),m("div",EL,[m("div",DL,[G[5]||(G[5]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"FR total",-1)),m("p",LL,I(O(S).summary.frTotal),1)]),m("div",IL,[G[6]||(G[6]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Plan coverage",-1)),m("p",NL,I(O(S).summary.frWithPlan)+"/"+I(O(S).summary.frTotal),1)]),m("div",zL,[G[7]||(G[7]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task mapping",-1)),m("p",ZL,I(O(S).summary.frWithTasks)+"/"+I(O(S).summary.frTotal),1)]),m("div",XL,[G[8]||(G[8]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Fully covered",-1)),m("p",WL,I(O(S).summary.frFullyCovered)+"/"+I(O(S).summary.frTotal),1)]),m("div",VL,[G[9]||(G[9]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task progress",-1)),m("p",FL,I(O(S).summary.taskCompleted)+"/"+I(O(S).summary.taskTotal),1)])]),m("div",HL,[m("div",qL,[G[10]||(G[10]=m("h3",{class:"text-xs font-mono text-retro-text"},"Gap Alerts",-1)),m("span",YL,I(O(k).length)+" issues",1)]),O(k).length===0?(y(),_("div",jL," No traceability gaps detected. ")):(y(),_("div",UL,[(y(!0),_($e,null,je(O(k),ie=>(y(),_("div",{key:ie.id,class:Ee(["rounded border px-2.5 py-2 text-xs font-mono",$(ie)])},[m("span",GL,I(ie.severity),1),m("span",null,I(ie.message),1)],2))),128))]))]),m("div",KL,[m("div",JL,[G[11]||(G[11]=m("div",{class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 text-[11px] font-mono text-retro-subtle px-2 pb-2 border-b border-retro-border"},[m("span",null,"Requirement"),m("span",null,"Spec"),m("span",null,"Plan"),m("span",null,"Tasks"),m("span",null,"Progress")],-1)),(y(!0),_($e,null,je(O(S).requirements,ie=>(y(),_("div",{key:ie.id,class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 items-center px-2 py-2 border-b border-retro-border/60 text-xs font-mono"},[m("span",e6,I(ie.id),1),m("button",{type:"button",class:"h-6 rounded border border-retro-green/40 bg-retro-green/10 flex items-center px-2 text-retro-green disabled:opacity-50 disabled:cursor-not-allowed",disabled:!ie.locations.specLine,onClick:q=>M("spec.md",ie.locations.specLine,ie.id)},[m("span",null,I(ie.locations.specLine?`L${ie.locations.specLine}`:"Defined"),1)],8,t6),m("button",{type:"button",class:Ee(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",ie.inPlan?"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10":"text-retro-subtle border-retro-border bg-retro-black/50"]),disabled:!ie.locations.planLine,onClick:q=>M("plan.md",ie.locations.planLine,ie.id)},[m("span",null,I(ie.locations.planLine?`L${ie.locations.planLine}`:ie.inPlan?"Linked":"Missing"),1)],10,i6),m("button",{type:"button",class:Ee(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",T(ie)]),disabled:ie.locations.taskLines.length===0,onClick:q=>M("tasks.md",ie.locations.taskLines[0],ie.id)},[m("span",null,I(ie.locations.taskLines.length>0?`L${ie.locations.taskLines[0]}`:ie.inTasks?"Mapped":"Missing"),1)],10,r6),m("span",s6,I(ie.taskCompleted)+"/"+I(ie.taskTotal),1)]))),128))])])])):se("",!0)])):O(c)?(y(),_("div",n6,[...G[12]||(G[12]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):O(h)?(y(),_("div",o6,[m("p",a6,I(O(h)),1),m("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:U}," Retry ")])):t.feature.files.length===0?(y(),_("div",l6,[...G[13]||(G[13]=[m("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):O(u)?(y(),_("div",c6,[oe(be,{modelValue:O(d),"onUpdate:modelValue":G[2]||(G[2]=ie=>rt(d)?d.value=ie:null),"line-to-reveal":O(f),class:"flex-1"},null,8,["modelValue","line-to-reveal"])])):(y(),_("div",{key:5,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:O(ce)},null,8,h6))])])])])}}}),d6={class:"w-full max-w-2xl rounded-xl border border-retro-border/80 bg-retro-black shadow-[0_24px_70px_rgba(0,0,0,0.55)] overflow-hidden"},f6={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},p6={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},m6={class:"flex items-center justify-between px-4 py-1.5 border-b border-retro-border/40 bg-retro-dark/30 text-[10px] font-mono text-retro-subtle"},g6={class:"flex items-center gap-3"},O6={class:"inline-flex items-center gap-1"},v6={key:0},b6={key:0,class:"truncate max-w-[42%]"},y6={class:"max-h-[58vh] overflow-y-auto"},_6={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},x6={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},S6={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},w6={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},k6={key:4,class:"py-2 px-2 space-y-2"},C6=["onMouseenter","onClick"],$6={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},P6={class:"text-retro-cyan/90"},Q6={class:"text-retro-subtle truncate"},T6=["innerHTML"],M6={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},B6={class:"flex items-center justify-between gap-3 px-4 py-2 border-t border-retro-border/60 bg-retro-dark/50 text-[11px] font-mono text-retro-subtle"},A6={key:0,class:"text-retro-yellow"},R6={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},E6=400,D6=Xe({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(t,{emit:e}){const i=t,r=e,{renderMarkdown:s}=o0(),n=A(""),o=A(!1),a=A(!1),l=A(null),c=A(null),h=A(null),u=A(null),d=A([]),p=A(-1),f=A(null),g=A([]);let v=null,b=0;const S=ae(()=>n.value.trim()),k=ae(()=>{const N=S.value.toLowerCase().split(/\s+/).map(K=>K.trim()).filter(K=>K.length>=2);return Array.from(new Set(N)).slice(0,8)}),T=ae(()=>l.value||c.value?"error":!S.value&&a.value?"empty-query":d.value.length>0?"results":a.value&&!o.value?"no-results":"idle");function $(N){return{featureId:N.chunk.featureId,sourcePath:N.chunk.sourcePath,headingHierarchy:N.chunk.headingHierarchy,snippet:N.chunk.content,matchType:N.matchType,score:N.score,lineStart:N.chunk.lineStart,lineEnd:N.chunk.lineEnd}}async function R(){const N=S.value;if(c.value=null,!N){a.value=!0,h.value=null,u.value=null,l.value=null,d.value=[],p.value=-1;return}const K=++b;a.value=!0,l.value=null,o.value=!0;try{const te=await $fetch("/api/specs/search",{query:{q:N,mode:"keyword",limit:20}});if(K!==b)return;h.value=te.warning??null,u.value=te.searchTime,d.value=te.results.map($),p.value=d.value.length>0?0:-1}catch(te){if(K!==b)return;const G=te instanceof Error?te.message:"Failed to search specs";l.value=G,u.value=null,d.value=[],p.value=-1}finally{K===b&&(o.value=!1)}}He(n,()=>{l.value=null,c.value=null,v&&clearTimeout(v),v=setTimeout(()=>{R()},E6)}),He(d,()=>{g.value=[]}),He(p,async N=>{N<0||(await ai(),g.value[N]?.scrollIntoView({block:"nearest"}))});function D(){r("close")}function U(N){const K=d.value[N];if(K){if(!i.availableFeatureIds.includes(K.featureId)){c.value="Feature unavailable";return}r("select",K.featureId),r("close")}}function ce(N){if(d.value.length===0)return;if(p.value<0){p.value=0;return}const K=p.value+N;if(K<0){p.value=d.value.length-1;return}if(K>=d.value.length){p.value=0;return}p.value=K}function he(N){if(N.key==="ArrowDown"){N.preventDefault(),ce(1);return}if(N.key==="ArrowUp"){N.preventDefault(),ce(-1);return}if(N.key==="Enter"){N.preventDefault(),p.value>=0&&U(p.value);return}N.key==="Escape"&&(N.preventDefault(),D())}function W(N){N.target===N.currentTarget&&D()}function M(N,K){if(!K){g.value[N]=null;return}if(K instanceof HTMLElement){g.value[N]=K;return}const te=K.$el;g.value[N]=te instanceof HTMLElement?te:null}function x(){R()}function V(N){const K=N.trim();if(!K)return"";const te=K.length>700?`${K.slice(0,700)}...`:K,G=s(te);if(k.value.length===0)return G;const be=k.value.map(q=>q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ie=new RegExp(`(${be.join("|")})`,"gi");return G.split(/(<[^>]+>)/g).map(q=>q.startsWith("<")?q:q.replace(ie,"<mark>$1</mark>")).join("")}return kt(()=>{ai(()=>{f.value?.focus()})}),si(()=>{v&&clearTimeout(v)}),(N,K)=>(y(),Se(zi,{to:"body"},[oe(Nr,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[m("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:W},[oe(Nr,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-[0.99]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-1 scale-[0.995]"},{default:ft(()=>[m("div",d6,[m("div",f6,[K[1]||(K[1]=m("div",{class:"flex items-center gap-2"},[m("span",{class:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-mono border border-retro-cyan/50 text-retro-cyan bg-retro-cyan/10"}," Command Palette "),m("span",{class:"text-[10px] font-mono text-retro-subtle"},"Global spec search")],-1)),m("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (Escape)",onClick:D},[oe(O(Gt),{class:"h-4 w-4"})])]),m("div",p6,[oe(O(ln),{class:"h-4 w-4 text-retro-cyan"}),qe(m("input",{ref_key:"inputRef",ref:f,"onUpdate:modelValue":K[0]||(K[0]=te=>rt(n)?n.value=te:null),type:"text",placeholder:"Search specs across all features...",class:"flex-1 bg-transparent text-sm font-mono text-retro-text placeholder:text-retro-subtle focus:outline-none",onKeydown:he},null,544),[[ui,O(n)]]),K[2]||(K[2]=m("span",{class:"text-[10px] font-mono text-retro-subtle border border-retro-border/60 rounded px-1.5 py-0.5"},"400ms",-1))]),m("div",m6,[m("div",g6,[m("span",O6,[oe(O(dn),{class:"h-3.5 w-3.5"}),Ze(" "+I(O(d).length)+" results ",1)]),O(u)!==null?(y(),_("span",v6,I(O(u))+"ms",1)):se("",!0)]),O(S)?(y(),_("span",b6,"“"+I(O(S))+"”",1)):se("",!0)]),m("div",y6,[O(o)?(y(),_("div",_6," Searching... ")):O(T)==="empty-query"?(y(),_("div",x6," Enter a search term to search across all feature specs. ")):O(T)==="no-results"?(y(),_("div",S6," No matching features found. ")):O(T)==="error"?(y(),_("div",w6,[m("p",null,I(O(c)||O(l)),1),O(l)?(y(),_("button",{key:0,type:"button",class:"mt-2 px-2 py-1 rounded border border-retro-border text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:x}," Retry ")):se("",!0)])):O(d).length>0?(y(),_("ul",k6,[(y(!0),_($e,null,je(O(d),(te,G)=>(y(),_("li",{key:`${te.featureId}:${te.sourcePath}:${G}`},[m("button",{type:"button",ref_for:!0,ref:be=>M(G,be),class:Ee(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",G===O(p)?"border-retro-cyan bg-retro-panel/95 text-retro-text shadow-[0_0_0_1px_rgba(34,211,238,0.18)]":"text-retro-muted hover:text-retro-text hover:bg-retro-panel/90"]),onMouseenter:be=>p.value=G,onClick:be=>U(G)},[m("div",$6,[m("span",P6,I(te.featureId),1),m("span",Q6,I(te.sourcePath)+":"+I(te.lineStart)+"-"+I(te.lineEnd),1)]),m("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:V(te.snippet)},null,8,T6),K[3]||(K[3]=m("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,C6)]))),128))])):(y(),_("div",M6," Start typing to search. "))]),m("div",B6,[K[4]||(K[4]=m("div",{class:"flex items-center gap-2"},[m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"↑↓ move"),m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Enter select"),m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Esc close")],-1)),O(h)?(y(),_("span",A6,I(O(h)),1)):se("",!0)]),O(c)?(y(),_("div",R6,[oe(O(Bs),{class:"h-3.5 w-3.5"}),m("span",null,I(O(c)),1)])):se("",!0)])]),_:1})])]),_:1})]))}}),L6=ns(D6,[["__scopeId","data-v-5199b408"]]);function I6(t){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(t)}function N6(t=Date.now,e=Math.random){return`req-${t()}-${e().toString(36).slice(2,8)}`}function nv(t=Date.now){return`session-${t()}`}function Au(t,e=!1){const i={};return(!e||t?.hasWorktree)&&t?.worktreePath&&(i.cwd=t.worktreePath,i.worktreeBranch=t.worktreeBranch),t?.baseBranch&&(i.baseBranch=t.baseBranch),t?.featureId&&(i.featureId=t.featureId),Object.keys(i).length>0?i:void 0}function B_(t){if(t.file_path)return String(t.file_path);if(t.path)return String(t.path);if(t.command)return String(t.command).slice(0,50);if(t.pattern)return String(t.pattern);for(const e of Object.values(t))if(typeof e=="string"&&e.length<100)return e;return""}function z6(t){switch(t){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return t>=4e3&&t<=4999?"Application-specific close code":"Unknown close code"}}function Z6(t,e){const i=[];return t.reason?i.push(t.reason):i.push(z6(t.code)),e?.lastServerError?i.push(`Last server error: ${e.lastServerError}`):e?.lastSocketError&&i.push(`Last socket error: ${e.lastSocketError}`),i.push(`wasClean: ${t.wasClean?"yes":"no"}`),i.join(" | ")}function ov(t,e="Permission"){const i=t||"",r=i.match(/write to (.+?)(?:[\s,?]|$)/i),s=i.match(/read (.+?)(?:[\s,?]|$)/i),n=i.match(/run (.+?)(?:[?,]|$)/i);return r?.[1]?{tool:"Write",description:i,filePath:r[1].trim()}:s?.[1]?{tool:"Read",description:i,filePath:s[1].trim()}:n?.[1]?{tool:"Bash",description:i,command:n[1].trim()}:{tool:e,description:i}}function X6(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function W6(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function Ru(t,e){return`${t}:${e}`}function ec(t,e){for(const i of t)if(i.type==="tool_use"){const r=i;(r.status==="running"||r.status==="pending")&&(r.status=e)}}function V6(){const t=new Map;function e(a,l,c){t.set(a,{featureId:l,queue:[...c]})}function i(a){a?t.delete(a):t.clear()}function r(a){return t.get(a)}function s(a){const l=t.get(a);if(!l||l.queue.length===0)return null;const c=l.queue.shift();return l.queue.length===0&&t.delete(a),{featureId:l.featureId,step:c}}function n(a){return t.has(a)}function o(){return t.size}return{enable:e,disable:i,get:r,popNextStep:s,has:n,size:o}}function A_(t,e=Si){return{id:e(),type:"session_init",model:t.model,tools:t.tools,permissionMode:t.permissionMode,cwd:t.cwd}}function R_(t,e=Si){return{id:t.blockId||e(),type:"text",text:t.text||""}}function E_(t,e=Si){return{id:t.blockId||e(),type:"thinking",thinking:t.thinking||""}}function D_(t,e=Si){if(!t.toolUseId||!t.name)return null;const i=t.blockId||e();return{block:{id:i,type:"tool_use",toolUseId:t.toolUseId,name:t.name,input:{},inputSummary:"",status:"running"},tracking:{blockId:i,toolUseId:t.toolUseId,name:t.name,inputJson:""},index:t.index??0}}function L_(t,e=Si){return{id:e(),type:"tool_result",toolUseId:t.toolUseId,content:t.content||"",isError:!!t.isError}}function I_(t,e=Si){return t.subtype!=="success"||!t.usage?null:{id:e(),type:"result_summary",totalCostUsd:t.totalCostUsd??0,durationMs:t.durationMs??0,numTurns:t.numTurns??0,usage:t.usage}}function fh(t,e,i){if(e!==void 0){const r=t.get(e);if(r)return r}if(i){for(const[,r]of t)if(r.blockId===i)return r}}function F6(t,e=Si){const i=[],r=new Map,s=[];let n="",o=null,a=null,l="streaming",c=!1;for(const h of t){if(h.type==="done"){h.denied||h.aborted?(ec(i,"error"),l="stopped"):h.awaitingUserInput?l="complete":l==="error"||l==="stopped"?ec(i,"error"):(ec(i,"complete"),l="complete"),c=!0;continue}if(h.type==="error"){ec(i,"error"),l="error";continue}if(h.type!=="ui_event"||!h.event)continue;const u=h.event;switch(u.sessionId&&s.push(u.sessionId),u.type){case"session_init":{i.push(A_(u,e));break}case"block_start":{if(u.blockType==="text"){const d=R_(u,e);i.push(d),o=d.id,u.text&&(n+=u.text)}else if(u.blockType==="thinking"){const d=E_(u,e);i.push(d),a=d.id}else if(u.blockType==="tool_use"){const d=D_(u,e);d&&(i.push(d.block),r.set(d.index,d.tracking))}break}case"block_delta":{if(u.text&&o){const d=i.find(p=>p.id===o);d&&d.type==="text"&&(d.text+=u.text,n+=u.text)}if(u.thinking&&a){const d=i.find(p=>p.id===a);d&&d.type==="thinking"&&(d.thinking+=u.thinking)}if(u.partialJson){const d=fh(r,u.index,u.blockId);d&&(d.inputJson+=u.partialJson)}break}case"block_end":{const d=fh(r,u.index,u.blockId);if(!d)o&&(o=null),a&&(a=null);else{let p={};try{p=JSON.parse(d.inputJson)}catch{}const f=i.find(g=>g.id===d.blockId);if(f&&f.type==="tool_use"){const g=f;g.input=p,g.inputSummary=B_(p),g.status="pending"}for(const[g,v]of r)if(v===d){r.delete(g);break}}break}case"tool_result":{const d=i.find(p=>p.type==="tool_use"&&p.toolUseId===u.toolUseId);d&&d.type==="tool_use"&&(d.status=u.isError?"error":"complete"),i.push(L_(u,e));break}case"turn_result":{u.subtype!=="success"&&(l="error");const d=I_(u,e);d&&i.push(d);break}case"error":{l="error";break}}}return{contentBlocks:i,flatText:n,currentTextBlockId:o,currentThinkingBlockId:a,activeTools:r,finalStatus:l,isDone:c,providerSessionIds:s}}function H6(t,e,i=Date.now){return{ws:t,currentMessageId:"",conversationId:e,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:i(),lastServerError:null,lastSocketError:null,cliTurnStopSeen:!1,cliTurnStopConfirmed:!1,cliSubmittedPrompt:null,isReplaying:!1,replayBuffer:[]}}function Eu(t,e,i){const r=t.get(e);return!!r&&r.ws!==i}function q6(t,e){const i=t.get(e);return i?i.ws.readyState===WebSocket.OPEN?{kind:"open",conn:i}:{kind:"stale",conn:i}:{kind:"none"}}const vt=new Map;let tc=0;const Mn=V6(),zn=new Map,ic=new Set;function rc(t){if(t){const e=zn.get(t);e&&(clearTimeout(e),zn.delete(t))}else{for(const e of zn.values())clearTimeout(e);zn.clear()}}const Y6=3e4,N_=18e4,j6=Math.round(N_/1e3);function Hp(){const t=ur(),e=tl();tc++;function i(B){const L=t.conversations.find(P=>P.id===B)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${L} response completed.`,tag:`chat-complete-${B}`})}async function r(B){if(!(typeof window>"u"||typeof Notification>"u")&&!X6()){if(Notification.permission==="granted"){i(B);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&i(B)}catch(w){console.warn("[useChatStream] Failed to request browser notification permission:",w)}}}function s(B){B.healthCheckInterval&&(clearInterval(B.healthCheckInterval),B.healthCheckInterval=null)}function n(B){s(B),B.lastMessageTime=Date.now(),B.healthCheckInterval=Ff(()=>{const w=B.conversationId;if(vt.get(w)!==B){s(B);return}if(B.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${w}`),s(B),t.isConversationStreaming(w)&&(c(B.currentMessageId,w,"error"),t.updateMessage(B.currentMessageId,{status:"error"},w),t.setSessionError("Connection lost during streaming",w),t.endSession(w),t.endConversationStreaming(w)),vt.delete(w);return}if(t.isConversationStreaming(w)){const L=Date.now()-B.lastMessageTime;L>N_&&(console.warn(`[useChatStream] Health check: streaming timeout for ${w} (${Math.round(L/1e3)}s)`),s(B),c(B.currentMessageId,w,"error"),t.updateMessage(B.currentMessageId,{status:"error"},w),t.setSessionError(`Streaming timed out — no response from server for ${j6} seconds`,w),t.endSession(w),t.endConversationStreaming(w),B.ws.close(),vt.delete(w))}},Y6)}function o(B,w){return t.conversations.find(P=>P.id===B)?.messages.find(P=>P.id===w)?.status}function a(B,w=!0){const L=vt.get(B);L&&(s(L),w&&L.ws.readyState!==WebSocket.CLOSED&&L.ws.readyState!==WebSocket.CLOSING&&L.ws.close(),vt.delete(B))}function l(B,w,L){!L||!B.currentTextBlockId||(t.updateBlockWithSave(B.currentMessageId,B.currentTextBlockId,P=>{P.type==="text"&&(P.text+=L)},w,{syncContent:!1}),t.appendToMessage(B.currentMessageId,L,w))}function c(B,w,L){const Y=t.conversations.find(de=>de.id===w)?.messages.find(de=>de.id===B);if(Y?.contentBlocks)for(const de of Y.contentBlocks)de.type==="tool_use"&&(de.status==="running"||de.status==="pending")&&t.updateBlockById(B,de.id,X=>{X.type==="tool_use"&&(X.status=L)},w)}async function h(B){try{(await u(B)).send(JSON.stringify({type:"reset_context"})),t.clearProviderSession(B),console.log("[useChatStream] Context reset requested for conversation:",B)}catch(w){throw console.error("[useChatStream] Failed to reset context:",w),w}}function u(B){return new Promise((w,L)=>{let P=!1;const Y=me=>{P||(P=!0,w(me))},de=me=>{P||(P=!0,L(me))},X=q6(vt,B);if(X.kind==="open"){Y(X.conn.ws);return}X.kind==="stale"&&(s(X.conn),X.conn.ws.close(),vt.delete(B));const xe=W6(),F=new WebSocket(xe),pe=H6(F,B);vt.set(B,pe),F.onopen=()=>{Y(F)},F.onerror=me=>{if(console.error(`[useChatStream] WebSocket error for conversation ${B}:`,me),Eu(vt,B,F))return;const De=vt.get(B);De&&(De.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),t.isConversationStreaming(B)&&(De?.currentMessageId&&(c(De.currentMessageId,B,"error"),t.updateMessage(De.currentMessageId,{status:"error"},B)),t.setSessionError("Connection error during streaming",B),t.endSession(B),t.endConversationStreaming(B)),vt.delete(B),de(new Error("WebSocket connection failed. Server may be unavailable."))},F.onclose=me=>{if(Eu(vt,B,F))return;const De=vt.get(B);if(De&&s(De),vt.delete(B),Mn.disable(B),!P){de(new Error(`WebSocket closed before connection was established (code: ${me.code})`));return}if(t.isConversationStreaming(B)){De?.currentMessageId&&(c(De.currentMessageId,B,"error"),t.updateMessage(De.currentMessageId,{status:"error"},B));const ct=Z6(me,De);t.setSessionError(`Connection closed: ${ct} (code: ${me.code})`,B),t.endSession(B),t.endConversationStreaming(B)}},F.onmessage=me=>{Eu(vt,B,F)||f(me.data,B)}})}async function d(B,w=3){for(let L=0;L<w;L++){const P=t.conversations.find(Y=>Y.id===B);if(P)return P;L<w-1&&await new Promise(Y=>setTimeout(Y,100))}console.error("[useChatStream] Conversation not found after retries:",B)}function p(B,w){const L=t.conversations.find(Y=>Y.id===B);if(!L)return null;const P=L.messages.findIndex(Y=>Y.id===w);if(P<=0)return null;for(let Y=P-1;Y>=0;Y--){const de=L.messages[Y];if(de.role==="user"&&de.content.trim().length>0)return de.content}return null}async function f(B,w){const L=vt.get(w);if(L){L.lastMessageTime=Date.now();try{t.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:B},w);const P=JSON.parse(B);if(t.pushDebugEvent({direction:"in",channel:"ws",eventType:P.type,payload:P},w),L.isReplaying&&((P.type==="ui_event"||P.type==="done"||P.type==="error")&&L.replayBuffer.push(P),P.type!=="replay_end"))return;if(P.type==="error")return await $(P,L,w),void 0;if(P.type==="done"){await R(P,L,w);return}if(P.type==="cli_hook"||P.type==="cli_prompt_submitted"||P.type==="cli_tool_completed"||P.type==="cli_turn_stop"||P.type==="cli_subagent_stop"||P.type==="cli_turn_stop_confirmed"){ce(P,L,w);return}if(P.type==="pong")return;if(P.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${w}:`,P.reason),t.setProviderSessionId("",w),G(L.currentMessageId,`
|
|
39
|
-
|
|
40
|
-
> **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
|
|
41
|
-
|
|
42
|
-
`,w);return}if(P.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${w}`),G(L.currentMessageId,`
|
|
43
|
-
|
|
44
|
-
> **Worktree recovered**: The work directory was restored after a system restart.
|
|
45
|
-
|
|
46
|
-
`,w);return}if(P.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${w}`);return}if(P.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${w}`);return}if(P.type==="subscribed"){console.log(`[useChatStream] Subscribed to ${w}`,P.jobId?`(job: ${P.jobId}, status: ${P.jobStatus})`:"(no active job)"),P.jobId||(t.endSession(w),t.endConversationStreaming(w));return}if(P.type==="replay_start"){console.log(`[useChatStream] Replay start for ${w}: ${P.eventCount} events from job ${P.jobId}`),L.isReplaying=!0,L.replayBuffer=[];return}if(P.type==="replay_end"){console.log(`[useChatStream] Replay end for ${w}: nextCursor=${P.nextCursor}`),K(L,w),L.isReplaying=!1,L.replayBuffer=[];return}if(P.type==="notification"){V(P);return}if(P.type==="permission_request"){b(P,L,w);return}if(P.type==="permission_prompt"&&P.text){S(P,L,w);return}P.type==="ui_event"&&P.event?N(P.event,w):P.type==="provider_json"&&P.data}catch(P){console.error(`[useChatStream] Failed to parse WebSocket message for ${w}:`,P,"Raw data:",B?.slice(0,200)),c(L.currentMessageId,w,"error"),t.updateMessage(L.currentMessageId,{status:"error"},w),t.setSessionError(`Failed to parse server response: ${P instanceof Error?P.message:"Invalid JSON"}`,w),t.endSession(w),t.endConversationStreaming(w),re(w),t.saveConversation(w,!0),a(w)}}}function g(B,w,L){if(B.text&&w.currentTextBlockId&&l(w,L,B.text),B.thinking&&w.currentThinkingBlockId&&t.updateBlockWithSave(w.currentMessageId,w.currentThinkingBlockId,P=>{P.type==="thinking"&&(P.thinking+=B.thinking)},L,{syncContent:!1}),B.partialJson){const P=fh(w.activeTools,B.index,B.blockId);P&&(P.inputJson+=B.partialJson)}}function v(B,w,L){const P=fh(w.activeTools,B.index,B.blockId);if(!P){w.currentTextBlockId&&(w.currentTextBlockId=null),w.currentThinkingBlockId&&(w.currentThinkingBlockId=null);return}let Y={};try{Y=JSON.parse(P.inputJson)}catch{}if(P.name==="ExitPlanMode"){const de={allowedPrompts:Y.allowedPrompts};t.setPendingPlanApproval(de,L)}t.updateBlockWithSave(w.currentMessageId,P.blockId,de=>{if(de.type==="tool_use"){const X=de;X.input=Y,X.inputSummary=B_(Y),X.status="pending"}},L);for(const[de,X]of w.activeTools)if(X===P){w.activeTools.delete(de);break}}function b(B,w,L){s(w),t.endConversationStreaming(L);const P=ov(B.description||"",B.tool||"Permission");t.setPendingPermission(P,L);let Y=`
|
|
47
|
-
|
|
48
|
-
**Permission Required**: ${P.tool}`;P.filePath&&(Y+=` - ${P.filePath}`),G(w.currentMessageId,Y+`
|
|
49
|
-
`,L)}function S(B,w,L){s(w),t.endConversationStreaming(L);const P=ov(B.text||"","Permission");t.setPendingPermission(P,L);const Y=`
|
|
50
|
-
|
|
51
|
-
**${P.tool}**: ${P.filePath||P.command||P.description}
|
|
52
|
-
`;G(w.currentMessageId,Y,L)}const k=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i,T=/state db missing rollout path for thread/i;async function $(B,w,L){console.error(`[useChatStream] Server error for ${L}:`,B.error);const P=B.error||"Unknown server error";w.lastServerError=P;const Y=k.test(P);if(T.test(P)&&!Y){const X=Ru(L,w.currentMessageId);if(!ic.has(X)){const xe=p(L,w.currentMessageId);if(xe){ic.add(X),t.setProviderSessionId("",L),G(w.currentMessageId,`
|
|
53
|
-
|
|
54
|
-
> **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
|
|
55
|
-
|
|
56
|
-
`,L);try{const F=t.conversations.find(me=>me.id===L),pe=Au(F);return await be(xe,w.currentMessageId,L,pe),!0}catch(F){console.error(`[useChatStream] Rollout-path recovery retry failed for ${L}:`,F)}}}}return s(w),c(w.currentMessageId,L,"error"),t.updateMessage(w.currentMessageId,{status:"error"},L),T.test(P)&&t.setProviderSessionId("",L),ic.delete(Ru(L,w.currentMessageId)),t.setSessionError(P,L),t.endSession(L),t.endConversationStreaming(L),re(L),t.saveConversation(L,!0),a(L),!1}async function R(B,w,L){s(w);const P=o(L,w.currentMessageId);if(ic.delete(Ru(L,w.currentMessageId)),B.denied||B.aborted){c(w.currentMessageId,L,"error"),t.updateMessage(w.currentMessageId,{status:"stopped"},L),D(w,L);return}if(B.awaitingUserInput){t.completeMessageWithSave(w.currentMessageId,L),t.endSession(L),t.endConversationStreaming(L),r(L),t.clearPendingPermission(L),t.saveConversation(L,!0),w.activeTools.clear();return}if(P==="error"||P==="stopped"){c(w.currentMessageId,L,"error"),D(w,L);return}c(w.currentMessageId,L,"complete"),t.completeMessageWithSave(w.currentMessageId,L),t.endSession(L),t.endConversationStreaming(L),r(L);const Y=await d(L),de=W(w).then(xe=>xe?U(Y,L,w):void 0),X=Mn.popNextStep(L);X&&de.then(()=>{const xe=setTimeout(()=>{zn.delete(L),H(L,X.featureId,X.step)},1500);rc(L),zn.set(L,xe)}),t.clearPendingPermission(L),t.saveConversation(L,!0),w.activeTools.clear()}function D(B,w){t.endSession(w),t.endConversationStreaming(w),re(w),t.clearPendingPermission(w),B.activeTools.clear(),t.saveConversation(w,!0)}function U(B,w,L){return!B?.hasWorktree||!B.worktreePath?Promise.resolve():$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:B.worktreePath,conversationId:w,previousBranch:B.worktreeBranch}}).then(P=>B.previewBranch&&B.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:B.previewBranch,worktreePath:B.worktreePath}}).then(Y=>{if(!Y.success)throw new Error(Y.error||"Unknown preview sync failure");return P}):P).then(async P=>{if(P?.success&&P.currentBranch!==B.worktreeBranch){const Y=B.worktreeBranch||"unknown";t.updateWorktreeBranch(w,P.currentBranch);const de=await t.syncConversationFeatureFromBranch(w),X=P.deletedPreviousBranch?` and deleted \`${Y}\``:"",xe=de?` and linked to feature \`${de}\``:"";G(L.currentMessageId,`
|
|
57
|
-
|
|
58
|
-
> **Branch changed**: AI switched from \`${Y}\` to \`${P.currentBranch}\`${X}${xe}
|
|
59
|
-
|
|
60
|
-
`,w)}else P?.success&&B.worktreeBranch&&t.updateWorktreeBranch(w,B.worktreeBranch);return t.saveConversation(w,!1),P}).catch(P=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",P)})}function ce(B,w,L){if(B.type==="cli_prompt_submitted"&&typeof B.prompt=="string"&&B.prompt.trim()){w.cliSubmittedPrompt=B.prompt,he(L,B.prompt);return}if(B.type==="cli_turn_stop"){w.cliTurnStopSeen=!0;return}if(B.type==="cli_turn_stop_confirmed"){w.cliTurnStopConfirmed=!0;return}B.type==="cli_tool_completed"&&B.failed&&console.warn("[useChatStream] CLI tool hook reported failure:",B.toolName||B.hookEventName)}function he(B,w){const L=w.trim();if(!L||L.length>2e4)return;const P=t.conversations.find(X=>X.id===B);if(!P)return;const Y=[...P.messages].reverse().find(X=>X.role==="user");if(!Y)return;const de=Y.content.trim();de!==L&&(L.includes(de)&&L.length>de.length*3||(t.updateMessage(Y.id,{content:L},B),t.saveConversation(B,!1)))}async function W(B){if(!B.cliTurnStopSeen||B.cliTurnStopConfirmed)return!0;const w=Date.now();for(;Date.now()-w<750;)if(await new Promise(L=>setTimeout(L,50)),B.cliTurnStopConfirmed)return!0;return console.warn("[useChatStream] CLI Stop seen but not confirmed before done; committing anyway."),!0}let M=null;const x=500;function V(B){const w=B.notificationEvent,L=B.source;console.log(`[useChatStream] Global notification: ${w}`,{jobId:B.jobId,conversationId:B.conversationId,source:L,status:B.status}),(w==="job_created"&&L!=="user"||w==="job_completed"||w==="job_persisted")&&(M&&clearTimeout(M),M=setTimeout(()=>{M=null,t.refreshServerConversations()},x))}function N(B,w){const L=vt.get(w);if(L)switch(t.pushDebugEvent({direction:"in",channel:"ui",eventType:B.type,payload:B},w),B.sessionId&&t.setProviderSessionId(B.sessionId,w),B.type){case"session_init":{te(L.currentMessageId,w),t.appendContentBlockWithSave(L.currentMessageId,A_(B),w);break}case"block_start":{if(te(L.currentMessageId,w),B.blockType==="text"){const P=R_(B);t.appendContentBlockWithSave(L.currentMessageId,P,w),L.currentTextBlockId=P.id}else if(B.blockType==="thinking"){const P=E_(B);t.appendContentBlockWithSave(L.currentMessageId,P,w),L.currentThinkingBlockId=P.id}else if(B.blockType==="tool_use"){const P=D_(B);P&&(t.appendContentBlockWithSave(L.currentMessageId,P.block,w),L.activeTools.set(P.index,P.tracking))}break}case"block_delta":{g(B,L,w);break}case"block_end":{v(B,L,w);break}case"tool_result":{te(L.currentMessageId,w);const P=t.findToolUseBlock(L.currentMessageId,B.toolUseId,w);P&&P.type==="tool_use"&&t.updateBlockById(L.currentMessageId,P.id,Y=>{Y.type==="tool_use"&&(Y.status=B.isError?"error":"complete")},w),t.appendContentBlockWithSave(L.currentMessageId,L_(B),w);break}case"permission_request":{s(L),t.endConversationStreaming(w);const P={tool:B.tool,description:B.description,input:B.input,tools:B.tools};t.setPendingPermission(P,w),G(L.currentMessageId,`
|
|
61
|
-
|
|
62
|
-
**Permission Required**: ${P.tool}
|
|
63
|
-
`,w);break}case"turn_result":{B.subtype!=="success"&&(t.updateMessage(L.currentMessageId,{status:"error"},w),re(w),B.subtype==="max_turns"?t.setSessionError("Maximum conversation turns reached. Please start a new conversation.",w):t.setSessionError("Provider reported an execution error.",w));const P=I_(B);P&&(te(L.currentMessageId,w),t.appendContentBlockWithSave(L.currentMessageId,P,w));break}case"error":{t.updateMessage(L.currentMessageId,{status:"error"},w),t.setSessionError(B.error,w);break}}}function K(B,w){const L=B.replayBuffer;if(L.length===0)return;const P=F6(L);for(const Y of P.providerSessionIds)t.setProviderSessionId(Y,w);t.batchSetMessageBlocks(B.currentMessageId,P.contentBlocks,P.flatText,P.finalStatus,w),B.currentTextBlockId=P.currentTextBlockId,B.currentThinkingBlockId=P.currentThinkingBlockId,B.activeTools=P.activeTools,P.isDone&&(s(B),t.endSession(w),t.endConversationStreaming(w),r(w),P.finalStatus==="complete"&&d(w).then(Y=>U(Y,w,B)).catch(Y=>console.warn("[useChatStream] Replay post-turn commit failed:",Y))),console.log(`[useChatStream] Replay batch processed: ${L.length} events → ${P.contentBlocks.length} blocks, status=${P.finalStatus}`)}function te(B,w){t.initContentBlocks(B,w)}function G(B,w,L){te(B,L);const P={id:Si(),type:"text",text:w};t.appendContentBlockWithSave(B,P,L)}async function be(B,w,L,P){if(typeof window>"u")return;const Y=N6();try{const de=await u(L),X=vt.get(L);X&&(X.currentMessageId=w,X.activeTools.clear(),X.currentTextBlockId=null,X.currentThinkingBlockId=null,X.cliTurnStopSeen=!1,X.cliTurnStopConfirmed=!1,X.cliSubmittedPrompt=null,n(X)),I6(B)&&t.setProviderSessionId("",L);const F=t.getProviderSessionId(L),pe=t.conversations.find(Ct=>Ct.id===L),me=pe?.providerId||e.providerSelection.providerId||ga,De=pe?.providerModelKey;pe&&!pe.providerId&&(t.setConversationProviderSelection(L,me),t.saveConversation(L,!0));const ct={type:"chat",message:B,assistantMessageId:w,attachments:P?.attachments,requestId:Y,sessionId:F||void 0,permissionMode:t.permissionMode,conversationId:L,cwd:P?.cwd,worktreeBranch:P?.worktreeBranch,baseBranch:P?.baseBranch,featureId:P?.featureId,providerId:me,providerModelKey:De};t.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:ct},L),de.send(JSON.stringify(ct))}catch(de){t.updateMessage(w,{status:"error"},L),t.setSessionError(de.message||"Connection failed",L),t.endSession(L),t.endConversationStreaming(L),t.saveConversation(L,!0),a(L)}}function ie(B,w){const L=w??t.activeConversationId;if(!L)return;const P=vt.get(L);if(!P||P.ws.readyState!==WebSocket.OPEN)return;const Y={type:"permission_response",allow:B};t.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:Y},L),P.ws.send(JSON.stringify(Y)),B&&(t.startConversationStreaming(L),n(P));const de=B?"Allowed":"Denied";G(P.currentMessageId,`${de}
|
|
64
|
-
`,L),t.clearPendingPermission(L)}function q(B,w,L){Mn.enable(w,B,L)}function re(B){rc(B),Mn.disable(B)}async function H(B,w,L){const P=t.conversations.find(xe=>xe.id===B);if(!P){re(B);return}t.activeConversationId!==B&&t.selectConversation(B);let Y;if(L.startsWith("skill:")){const xe=L.replace("skill:","");try{Y=(await $fetch(`/api/skills/${xe}/prompt`,{method:"POST",body:{featureId:w,cwd:P?.worktreePath}})).prompt}catch(F){console.error(`[useChatStream] Failed to render skill prompt for ${xe}:`,F);return}}else Y=`/speckit.${L} ${w}`;t.addUserMessage(Y,B),t.saveConversation(B,!0);const de=t.addAssistantMessage(B);t.startSession(nv(),B),t.startConversationStreaming(B);const X=Au(P);await be(Y,de.id,B,X)}async function j(B,w,L=0){if(!(typeof window>"u"))try{const P=await u(B),Y=vt.get(B);Y&&(Y.currentMessageId=w,Y.activeTools.clear(),Y.currentTextBlockId=null,Y.currentThinkingBlockId=null,Y.cliTurnStopSeen=!1,Y.cliTurnStopConfirmed=!1,Y.cliSubmittedPrompt=null,n(Y)),t.startConversationStreaming(B);const de={type:"subscribe",conversationId:B,cursor:L};t.pushDebugEvent({direction:"out",channel:"ws",eventType:"subscribe",payload:de},B),P.send(JSON.stringify(de))}catch(P){console.error(`[useChatStream] Failed to subscribe to ${B}:`,P),t.setSessionError(P.message||"Subscribe failed",B)}}function ee(B){const w=B??t.activeConversationId;if(!w)return;const L=vt.get(w);if(L){if(s(L),L.ws.readyState===WebSocket.OPEN){const Y={type:"abort",conversationId:w};t.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:Y},w),L.ws.send(JSON.stringify(Y))}L.ws.readyState!==WebSocket.CLOSED&&L.ws.readyState!==WebSocket.CLOSING&&L.ws.close(),vt.delete(w)}const P=L?.currentMessageId??_e(w);P&&(c(P,w,"error"),t.updateMessage(P,{status:"stopped"},w)),t.endSession(w),t.endConversationStreaming(w),t.clearPendingPermission(w),re(w),t.saveConversation(w,!0)}function _e(B){const w=t.conversations.find(L=>L.id===B);if(!w)return null;for(let L=w.messages.length-1;L>=0;L--){const P=w.messages[L];if(P.role==="assistant"&&P.status==="streaming")return P.id}return null}function Le(B){const w=vt.get(B);w&&(s(w),w.ws.close(),vt.delete(B)),rc(B),Mn.disable(B)}function Ne(){for(const[B,w]of vt)s(w),w.ws.close(),vt.delete(B);rc(),Mn.disable()}async function Je(B){const w=B??t.activeConversationId;if(!w)return;t.clearPendingPlanApproval(w),t.setPermissionMode("auto");const L="Approved. Proceed with the implementation.";t.addUserMessage(L,w),t.saveConversation(w,!0);const P=t.addAssistantMessage(w);t.startSession(nv(),w),t.startConversationStreaming(w);const Y=t.conversations.find(X=>X.id===w),de=Au(Y,!0);await be(L,P.id,w,de)}function st(B){const w=B??t.activeConversationId;w&&t.clearPendingPlanApproval(w)}async function Ue(B){if(typeof window>"u")return!1;try{const w=await $fetch("/api/jobs",{params:{conversationId:B}}),P=w.find(X=>X.status==="running"||X.status==="waiting_permission"||X.status==="queued")||[...w].sort((X,xe)=>xe.eventCount-X.eventCount).find(X=>X.eventCount>0),Y=t.conversations.find(X=>X.id===B);if(!Y)return!1;const de=[...Y.messages].reverse().find(X=>X.role==="assistant");return P?!de||de.status!=="streaming"?!1:(console.log("[useChatStream] Resuming streaming for",B,"job:",P.id,"status:",P.status,"events:",P.eventCount),t.resetMessageForReplay(de.id,B),t.startSession(`resume-${Date.now()}`,B),await j(B,de.id,0),!0):(de&&de.status==="streaming"&&(t.updateMessage(de.id,{status:"error"},B),t.setSessionError("Streaming was interrupted (server job no longer active)",B)),!1)}catch(w){return console.error("[useChatStream] Failed to resume streaming:",w),!1}}return si(()=>{tc--,tc<=0&&(tc=0,Ne())}),{sendMessage:be,sendPermissionResponse:ie,subscribe:j,tryResumeStreaming:Ue,approvePlan:Je,rejectPlan:st,abort:ee,disconnect:Ne,disconnectConversation:Le,enableCascade:q,disableCascade:re,resetContext:h}}const U6=/^[0-9a-f]{7,40}$/i;function gl(t){if(typeof t!="string")return!1;const e=t.trim();return e.length>0&&e!=="HEAD"&&!e.startsWith("sc/")&&!U6.test(e)}function qp(t,e){const i=e.map(s=>s.trim()).filter(Boolean),r=t?.trim()||"";return r&&i.includes(r)&&gl(r)?r:i.includes("main")?"main":i.includes("master")?"master":i[0]||null}function z_(t){return gl(t)?t.trim():"Loading branches..."}function Yp(t){const e=[t.name,t.ref];for(const i of e){if(typeof i!="string")continue;const r=i.trim();if(!r)continue;const s=r.startsWith("refs/heads/")?r.slice(11):r;if(gl(s))return s}return null}const G6={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},K6={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},J6=["disabled"],e7=["onKeydown"],t7={class:"px-4 py-4 space-y-4"},i7={class:"space-y-2"},r7={class:"relative"},s7=["disabled"],n7={key:0,value:""},o7=["value"],a7={key:0,class:"space-y-2"},l7={class:"space-y-2"},c7={class:"relative"},h7=["disabled"],u7={key:0,value:""},d7=["value"],f7={key:1,class:"text-xs font-mono text-retro-red"},p7={key:2,class:"text-xs font-mono text-retro-red"},m7={key:3,class:"text-xs font-mono text-retro-muted"},g7={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},O7=["disabled"],v7=["disabled"],tf=Xe({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean},showProvider:{type:Boolean,default:!0}},emits:["close","create"],setup(t,{emit:e}){const i=t,r=e,s=tl(),n=A([]),o=A(""),a=A([]),l=A(ga),c=A(!1),h=A(!1),u=A(""),d=A(""),p=A(null),f=ae(()=>a.value.filter(R=>R.id==="claude"||R.id==="codex")),g=ae(()=>f.value.find(R=>R.id===l.value)||f.value[0]),v=ae(()=>!c.value&&!h.value&&!i.creating&&o.value.length>0&&n.value.length>0&&(i.showProvider===!1||!!g.value));function b(){if(f.value.length===0)return;const R=g.value;if(!R){l.value=ga;return}l.value=R.id}async function S(){c.value=!0,u.value="";try{const{cwd:R}=await $fetch("/api/cwd"),U=(await $fetch("/api/git/branches",{query:{excludeSc:!0,workingDirectory:R}})).branches.filter(he=>!he.isRemote).map(Yp).filter(he=>!!he),ce=Array.from(new Set(U)).sort((he,W)=>{const M=V=>V==="main"?0:V==="master"?1:2,x=M(he)-M(W);return x!==0?x:he.localeCompare(W,void 0,{sensitivity:"base"})});if(n.value=ce,!ce.length){o.value="",u.value="No local branches available for chat creation.";return}o.value=qp("main",ce)||ce[0]}catch(R){n.value=[],o.value="",u.value=R instanceof Error?R.message:"Failed to load branches"}finally{c.value=!1}}async function k(){h.value=!0,d.value="";try{await s.hydrate(),l.value=s.providerSelection.providerId;const R=await $fetch("/api/ai/providers");a.value=R.providers,b()}catch(R){a.value=[],l.value=ga,d.value=R instanceof Error?R.message:"Failed to load providers"}finally{h.value=!1}}He(()=>i.show,async R=>{R&&(await ai(),p.value?.focus(),S(),i.showProvider!==!1&&k())}),He(l,()=>{b()});function T(){v.value&&r("create",{baseBranch:o.value,providerId:i.showProvider===!1?s.providerSelection.providerId:l.value})}function $(R){const D=R.target;D instanceof HTMLElement&&D.closest("button")||D instanceof HTMLInputElement||D instanceof HTMLTextAreaElement||(R.preventDefault(),T())}return(R,D)=>(y(),Se(zi,{to:"body"},[oe(Nr,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[t.show?(y(),_("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:D[4]||(D[4]=gi(U=>r("close"),["self"]))},[m("div",G6,[m("div",K6,[D[5]||(D[5]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),m("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:t.creating,onClick:D[0]||(D[0]=U=>r("close"))},[oe(O(Gt),{class:"w-4 h-4"})],8,J6)]),m("form",{ref_key:"formRef",ref:p,tabindex:"-1",onSubmit:gi(T,["prevent"]),onKeydown:Ps(gi($,["exact"]),["enter"])},[m("div",t7,[m("div",i7,[D[6]||(D[6]=m("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),m("div",r7,[qe(m("select",{"onUpdate:modelValue":D[1]||(D[1]=U=>o.value=U),disabled:c.value||t.creating||n.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[c.value?(y(),_("option",n7,"Loading branches...")):se("",!0),(y(!0),_($e,null,je(n.value,U=>(y(),_("option",{key:U,value:U},I(U),9,o7))),128))],8,s7),[[Ms,o.value]]),oe(O(Bc),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),t.showProvider!==!1?(y(),_("div",a7,[m("div",l7,[D[7]||(D[7]=m("label",{class:"block text-xs font-mono text-retro-muted"},"Provider",-1)),m("div",c7,[qe(m("select",{"onUpdate:modelValue":D[2]||(D[2]=U=>l.value=U),disabled:h.value||t.creating||f.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[h.value?(y(),_("option",u7,"Loading...")):se("",!0),(y(!0),_($e,null,je(f.value,U=>(y(),_("option",{key:U.id,value:U.id},I(U.name),9,d7))),128))],8,h7),[[Ms,l.value]]),oe(O(Bc),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])])])):se("",!0),u.value?(y(),_("p",f7,I(u.value),1)):d.value?(y(),_("p",p7,I(d.value),1)):(y(),_("p",m7," Provider is fixed after the conversation is created. "))]),m("div",g7,[m("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:t.creating,onClick:D[3]||(D[3]=U=>r("close"))}," Cancel ",8,O7),m("button",{type:"submit",disabled:!v.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed"},I(t.creating?"Creating...":"Create"),9,v7)])],40,e7)])])):se("",!0)]),_:1})]))}}),b7={class:"h-full flex flex-col bg-retro-black"},y7={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},_7={class:"flex items-center gap-1"},x7={class:"flex-shrink-0 px-3 pt-3"},S7={class:"relative"},w7={class:"flex-1 overflow-y-auto p-3"},k7={class:"space-y-2"},C7={key:0,class:"flex items-center justify-center py-12"},$7={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},P7={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},av=Xe({__name:"FeaturesPanel",setup(t){const e=ur(),i=Sh(),{sendMessage:r,enableCascade:s}=Hp(),n=el(),o=A("features"),a=A(null),l=A(null),c=A([]),h=A([]),u=A(!1),d=A({}),p=A(!1),f=A(null),g=A(!1),v=A(!1),b=A(!1),S=A(null),k=A(""),T=A("");let $=null;He(k,P=>{$&&clearTimeout($),$=setTimeout(()=>{T.value=P},300)});const R=ae(()=>{const P=T.value.trim().toLowerCase();return P?c.value.filter(Y=>Y.name.toLowerCase().includes(P)||Y.id.toLowerCase().includes(P)):c.value}),D=A({}),U=ae(()=>{const P=e.activeConversation;if(!P)return null;if(P.featureId)return P.featureId;const Y=P.worktreeBranch?.trim();return Y&&c.value.some(de=>de.id===Y)?Y:null}),ce=ae(()=>U.value||a.value);He(()=>e.activeConversationId,()=>{a.value=null;const P=U.value;i.setSelectedFeatureId(P),P&&ai(()=>{const Y=D.value[P];Y&&Y.scrollIntoView({behavior:"auto",block:"nearest"})})}),He(a,P=>{P&&ai(()=>{const Y=D.value[P];Y&&Y.scrollIntoView({behavior:"auto",block:"nearest"})})});async function he(){u.value=!0;try{const P=await $fetch("/api/specs/features");c.value=P.features,W(P.features)}catch{n.error("Failed to load features"),c.value=[],d.value={}}finally{u.value=!1}}async function W(P){if(P.length===0){d.value={};return}const Y=await Promise.allSettled(P.map(async X=>{const xe=await $fetch(`/api/specs/traceability/${X.id}`),F=xe.alerts.filter(me=>me.severity==="critical").length,pe=xe.alerts.filter(me=>me.severity==="major").length;return{featureId:X.id,critical:F,major:pe}})),de={};for(const X of Y)X.status==="fulfilled"&&(de[X.value.featureId]={critical:X.value.critical,major:X.value.major});d.value=de}async function M(){try{const P=await $fetch("/api/skills");h.value=P.skills}catch{h.value=[]}}kt(()=>{he(),M(),window.addEventListener("keydown",N)}),si(()=>{window.removeEventListener("keydown",N)});function x(P,Y={}){if(a.value=P,l.value=null,o.value="files",i.setSelectedFeatureId(P),Y.openViewer!==!1){const de=c.value.find(X=>X.id===P);de&&(f.value=de,p.value=!0)}}function V(){p.value=!1,f.value=null}function N(P){(P.ctrlKey||P.metaKey)&&P.key.toLowerCase()==="k"&&(P.preventDefault(),g.value||(g.value=!0))}function K(){g.value=!1}function te(P){x(P,{openViewer:!1}),g.value=!1}function G(){g.value=!0}const be=ae(()=>c.value.map(P=>P.id));function ie(P){return d.value[P]??{critical:0,major:0}}const q={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},re={analyze:["skill:better-spec"]};async function H(P,Y,de){if(P.startsWith("skill:")){const X=P.replace("skill:",""),xe=de?e.conversations.find(pe=>pe.id===de):null;return(await $fetch(`/api/skills/${X}/prompt`,{method:"POST",body:{featureId:Y,cwd:xe?.worktreePath}})).prompt}return`/speckit.${P} ${Y}`}function j(P,Y){if(Y)return null;const de=e.findConversationByFeature(P);return de&&!e.isConversationActivelyStreaming(de.id)&&!de.finalized?(e.selectConversation(de.id),de.id):null}function ee(P){const Y=e.findConversationByFeature(P);return Y&&Y.finalized?(n.error(`This feature has a finalized conversation "${Y.title}". Please archive it first to start a new conversation.`),e.selectConversation(Y.id),!0):!1}async function _e(P,Y,de){const X=await e.createConversation({featureId:P,...de});if(!X)throw new Error("Failed to create conversation");return e.renameConversation(X,Y),e.selectConversation(X),X}async function Le(P,Y){e.addUserMessage(Y,P),e.saveConversation(P,!0);const de=e.conversations.find(F=>F.id===P),X=e.addAssistantMessage(P);e.startSession(`session-${Date.now()}`,P),e.startConversationStreaming(P);const xe={};de?.worktreePath&&(xe.cwd=de.worktreePath,xe.worktreeBranch=de.worktreeBranch),de?.featureId&&(xe.featureId=de.featureId),await r(Y,X.id,P,Object.keys(xe).length>0?xe:void 0)}async function Ne(P,Y,de){const X=re[Y];let xe;if(X&&X.length>0){const F=[...X.slice(1),Y,...q[Y]||[]];s(P,de,F);const pe=X[0];try{xe=await H(pe,P,de)}catch(me){n.error(me instanceof Error?me.message:"Failed to resolve prerequisite step");return}}else{const F=q[Y]||[];F.length>0&&s(P,de,F),xe=`/speckit.${Y} ${P}`}await Le(de,xe)}async function Je(P,Y,de){const X=P.shiftKey;if(!X&&ee(Y))return;const xe=j(Y,X);if(xe){try{await Ne(Y,de,xe)}catch(F){n.error(F instanceof Error?F.message:"Failed to run cascade action")}return}S.value={type:"cascade",featureId:Y,command:de,title:`${de}: ${Y}`},v.value=!0}async function st(P,Y){ee(Y)||(S.value={type:"open-chat",featureId:Y,title:`spec: ${Y}`},v.value=!0)}async function Ue(P,Y,de){let X;try{const xe=e.conversations.find(F=>F.id===de);X=await $fetch(`/api/skills/${Y}/prompt`,{method:"POST",body:{featureId:P,cwd:xe?.worktreePath}})}catch(xe){throw new Error(xe instanceof Error?xe.message:"Failed to render skill prompt")}await Le(de,X.prompt)}async function B(P,Y,de){const X=P.shiftKey;if(!X&&ee(Y))return;const xe=j(Y,X);if(xe){try{await Ue(Y,de,xe)}catch(F){n.error(F instanceof Error?F.message:"Failed to run skill")}return}S.value={type:"skill",featureId:Y,skillId:de,title:`skill: ${de} — ${Y}`},v.value=!0}function w(){v.value=!1,S.value=null}async function L(P){if(S.value){b.value=!0;try{const Y=S.value,de=await _e(Y.featureId,Y.title,P);Y.type==="cascade"?await Ne(Y.featureId,Y.command,de):Y.type==="skill"&&await Ue(Y.featureId,Y.skillId,de),v.value=!1,S.value=null}catch(Y){n.error(Y instanceof Error?Y.message:"Failed to create conversation")}finally{b.value=!1}}}return(P,Y)=>{const de=PP,X=u6,xe=L6;return y(),_("div",b7,[m("div",y7,[Y[2]||(Y[2]=m("div",{class:"flex items-center gap-2 min-w-0"},null,-1)),m("div",_7,[m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:G},[oe(O(ln),{class:"h-4 w-4"})]),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:he},[oe(O(un),{class:Ee(["h-4 w-4",{"animate-spin":O(u)}])},null,8,["class"])])])]),m("div",x7,[m("div",S7,[oe(O(ln),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),qe(m("input",{"onUpdate:modelValue":Y[0]||(Y[0]=F=>rt(k)?k.value=F:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[ui,O(k)]])])]),m("div",w7,[m("div",k7,[(y(!0),_($e,null,je(O(R),F=>(y(),_("div",{key:F.id,ref_for:!0,ref:pe=>{O(D)[F.id]=pe}},[oe(de,{feature:F,skills:O(h),"is-active":O(ce)===F.id,"critical-alerts":ie(F.id).critical,"major-alerts":ie(F.id).major,onSelect:Y[1]||(Y[1]=pe=>x(pe,{openViewer:!0})),onCascade:Je,onOpenChat:st,onSkill:B},null,8,["feature","skills","is-active","critical-alerts","major-alerts"])]))),128))]),O(u)&&O(c).length===0?(y(),_("div",C7,[...Y[3]||(Y[3]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):se("",!0),!O(u)&&O(c).length>0&&O(R).length===0?(y(),_("div",$7,[oe(O(ln),{class:"h-10 w-10 text-retro-subtle mb-3"}),Y[4]||(Y[4]=m("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),Y[5]||(Y[5]=m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):se("",!0),!O(u)&&O(c).length===0?(y(),_("div",P7,[oe(O(wS),{class:"h-10 w-10 text-retro-subtle mb-3"}),Y[6]||(Y[6]=m("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),Y[7]||(Y[7]=m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):se("",!0)]),O(p)&&O(f)?(y(),Se(X,{key:0,feature:O(f),onClose:V},null,8,["feature"])):se("",!0),O(g)?(y(),Se(xe,{key:1,"available-feature-ids":O(be),onClose:K,onSelect:te},null,8,["available-feature-ids"])):se("",!0),oe(tf,{show:O(v),creating:O(b),onClose:w,onCreate:L},null,8,["show","creating"])])}}}),Q7={class:"h-full flex flex-col bg-retro-black"},T7={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},M7={class:"flex items-center justify-between gap-2"},B7={class:"flex items-center gap-1"},A7={class:"relative"},R7=["placeholder"],E7={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},D7={class:"text-retro-yellow font-mono"},L7={class:"flex-1 overflow-y-auto p-2"},I7={key:0,class:"space-y-1"},N7={key:1,class:"text-center py-6 text-retro-muted"},z7={class:"font-mono text-xs"},Z7={key:1,class:"text-center py-8 text-retro-muted"},X7={key:0,class:"space-y-2"},W7={class:"flex items-center justify-end pb-1"},V7={class:"flex items-start justify-between gap-2"},F7={class:"min-w-0"},H7={class:"text-sm font-mono text-retro-text truncate"},q7={class:"text-xs text-retro-muted mt-1 truncate"},Y7={class:"text-xs text-retro-muted/70 mt-1"},j7={class:"text-xs text-retro-muted/70"},U7={class:"flex items-center gap-1 flex-shrink-0"},G7=["onClick"],K7=["onClick"],J7={key:1,class:"text-center py-6 text-retro-muted"},e8={class:"font-mono text-xs"},t8={key:1,class:"text-center py-8 text-retro-muted"},i8={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},r8={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},s8=["disabled"],n8={class:"px-4 py-4"},o8={class:"text-xs font-mono text-retro-text"},a8={class:"px-4 py-3 border-t border-retro-border flex items-center justify-end gap-2"},l8=["disabled"],c8=["disabled"],lv=Xe({__name:"ConversationsPanel",setup(t){const e=ur(),i=el(),r=A(""),s=A(""),n=A(!1),o=A(!1),a=A(!1),l=A(!1),c=A(null),h=A(!1),u=A(!1);let d=null;function p(H){if(!(H instanceof HTMLElement))return!1;const j=H.tagName.toLowerCase();return H.isContentEditable||j==="input"||j==="textarea"||j==="select"}function f(H){H.key.toLowerCase()!=="n"||H.ctrlKey||H.metaKey||H.altKey||H.shiftKey||n.value||a.value||p(H.target)||(H.preventDefault(),W())}He(r,H=>{d&&clearTimeout(d),d=setTimeout(()=>{s.value=H},180)},{immediate:!0}),si(()=>{d&&(clearTimeout(d),d=null),window.removeEventListener("keydown",f)}),kt(()=>{window.addEventListener("keydown",f)});const g=new Map,v=new Map;function b(H){return[...H].reverse().find(j=>j.role==="user")}function S(H){const j=b(H);return`${j?.id||""}:${Tn(j?.content||"")}`}He(()=>e.sortedConversations.map(H=>H.id),H=>{const j=new Set(H);for(const ee of g.keys())j.has(ee)||g.delete(ee)},{immediate:!0}),He(()=>e.sortedArchivedConversations.map(H=>H.id),H=>{const j=new Set(H);for(const ee of v.keys())j.has(ee)||v.delete(ee)},{immediate:!0});function k(H){const j=b(H.messages);return[H.updatedAt,H.title,H.messages.length,j?.id||"",Tn(j?.content||"").length].join("|")}function T(H){const j=b(H.messages);return[H.updatedAt,H.archivedAt,H.title,H.messages.length,j?.id||"",Tn(j?.content||"").length].join("|")}function $(H){const j=k(H),ee=g.get(H.id);if(ee&&ee.signature===j)return ee.text;const _e=[H.title,...H.messages.map(Le=>Tn(Le.content||""))].join(`
|
|
65
|
-
`).toLowerCase();return g.set(H.id,{signature:j,text:_e}),_e}function R(H){const j=T(H),ee=v.get(H.id);if(ee&&ee.signature===j)return ee.text;const _e=[H.title,...H.messages.map(Le=>Tn(Le.content||""))].join(`
|
|
66
|
-
`).toLowerCase();return v.set(H.id,{signature:j,text:_e}),_e}const D=ae(()=>e.conversationViewMode==="archive"),U=ae(()=>{const H=e.sortedConversations;if(!s.value.trim())return H;const j=s.value.toLowerCase().trim();return H.filter(ee=>$(ee).includes(j))}),ce=ae(()=>{const H=e.sortedArchivedConversations;if(!s.value.trim())return H;const j=s.value.toLowerCase().trim();return H.filter(ee=>R(ee).includes(j))}),he=ae(()=>e.previewingConversationId);async function W(){if(e.checkStorageLimits().atLimit){i.error("Delete or archive a conversation first (limit: 100).");return}n.value=!0}async function M(H){o.value=!0;try{if(!await e.createConversation(H)){i.error("Failed to create conversation");return}n.value=!1}catch(j){i.error(j instanceof Error?j.message:"Failed to create conversation")}finally{o.value=!1}}function x(H){e.selectConversation(H),e.setConversationViewMode("active")}async function V(H){const j=await e.archiveConversation(H);if(!j.success){i.error(j.error||"Failed to archive conversation");return}i.success("Conversation archived")}async function N(H){c.value=H,a.value=!0}function K(){a.value=!1,c.value=null}async function te(H){if(c.value){l.value=!0;try{const j=await e.restoreArchivedConversation(c.value,H.baseBranch);if(!j.success){i.error(j.error||"Failed to restore archived conversation");return}i.success("Archived conversation restored"),a.value=!1,c.value=null}finally{l.value=!1}}}async function G(H){const j=await e.deleteArchivedConversation(H);if(!j.success){i.error(j.error||"Failed to delete archived conversation");return}i.success("Archived conversation deleted")}async function be(){u.value=!0;try{const H=await e.deleteAllArchivedConversations();if(!H.success){i.error(H.error||"Failed to clear archived conversations");return}h.value=!1,i.success(`Cleared ${H.deletedCount} archived conversation${H.deletedCount===1?"":"s"}`)}finally{u.value=!1}}function ie(H,j){e.renameConversation(H,j)}function q(H){return new Date(H).toLocaleString()}function re(H){if(!H.length)return"No messages";const j=b(H),ee=Tn(j?.content||"");return ee?ee.length>80?`${ee.slice(0,80)}...`:ee:"No user message"}return(H,j)=>(y(),_("div",Q7,[m("div",T7,[m("div",M7,[m("button",{onClick:W,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[oe(O(yh),{class:"w-4 h-4"})]),m("div",B7,[m("button",{onClick:j[0]||(j[0]=ee=>O(e).setConversationViewMode("active")),class:Ee(["p-1.5 rounded transition-colors",D.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[oe(O(f0),{class:"w-4 h-4"})],2),m("button",{onClick:j[1]||(j[1]=ee=>O(e).setConversationViewMode("archive")),class:Ee(["p-1.5 rounded transition-colors",D.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[oe(O(lm),{class:"w-4 h-4"})],2)])]),m("div",A7,[oe(O(ln),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),qe(m("input",{"onUpdate:modelValue":j[2]||(j[2]=ee=>r.value=ee),type:"text",placeholder:D.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,R7),[[ui,r.value]])])]),O(e).isNearStorageLimit?(y(),_("div",E7,[oe(O(Bs),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("p",D7,I(O(e).conversationCount)+" active conversations. Limit is 100. ",1)])):se("",!0),m("div",L7,[D.value?(y(),_($e,{key:1},[O(e).hasArchivedConversations?(y(),_("div",X7,[m("div",W7,[m("button",{onClick:j[5]||(j[5]=ee=>h.value=!0),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete all archived conversations"},[oe(O(Er),{class:"w-3.5 h-3.5"}),j[13]||(j[13]=Ze(" Clear all ",-1))])]),ce.value.length>0?(y(!0),_($e,{key:0},je(ce.value,(ee,_e,Le,Ne)=>{const Je=[ee.id,ee.title,ee.updatedAt,ee.archivedAt,ee.messages.length];if(Ne&&Ne.key===ee.id&&nm(Ne,Je))return Ne;const st=(y(),_("div",{key:ee.id,onClick:Ue=>N(ee.id),onKeydown:[Ps(gi(Ue=>N(ee.id),["prevent"]),["enter"]),Ps(gi(Ue=>N(ee.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[m("div",V7,[m("div",F7,[m("h3",H7,I(ee.title),1),m("p",q7,I(re(ee.messages)),1),m("p",Y7," Archived: "+I(q(ee.archivedAt)),1),m("p",j7," Updated: "+I(q(ee.updatedAt)),1)]),m("div",U7,[m("button",{onClick:gi(Ue=>N(ee.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[oe(O(lm),{class:"w-3.5 h-3.5"}),j[14]||(j[14]=Ze(" Restore ",-1))],8,G7),m("button",{onClick:gi(Ue=>G(ee.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[oe(O(Er),{class:"w-3.5 h-3.5"}),j[15]||(j[15]=Ze(" Delete ",-1))],8,K7)])])],40,["onClick","onKeydown"]));return st.memo=Je,st},j,6),128)):(y(),_("div",J7,[m("p",e8,'No archived results for "'+I(r.value)+'"',1)]))])):(y(),_("div",t8,[...j[16]||(j[16]=[m("p",{class:"font-mono text-sm"},"No archived conversations",-1),m("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(y(),_($e,{key:0},[O(e).hasConversations?(y(),_("div",I7,[U.value.length>0?(y(!0),_($e,{key:0},je(U.value,(ee,_e,Le,Ne)=>{const Je=[ee.id,ee.title,ee.messages.length,S(ee.messages),ee.finalized,ee.id===O(e).activeConversationId,O(e).isConversationStreaming(ee.id),he.value===ee.id];if(Ne&&Ne.key===ee.id&&nm(Ne,Je))return Ne;const st=(y(),_("div",{key:ee.id},[oe(Gx,{conversation:ee,"is-active":ee.id===O(e).activeConversationId,"is-streaming":O(e).isConversationStreaming(ee.id),"is-previewing":he.value===ee.id,onSelect:Ue=>x(ee.id),onArchive:Ue=>V(ee.id),onRename:Ue=>ie(ee.id,Ue)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return st.memo=Je,st},j,3),128)):(y(),_("div",N7,[m("p",z7,'No results for "'+I(r.value)+'"',1)]))])):(y(),_("div",Z7,[...j[12]||(j[12]=[m("p",{class:"font-mono text-sm"},"No conversations",-1),m("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),oe(tf,{show:n.value,creating:o.value,onClose:j[8]||(j[8]=ee=>n.value=!1),onCreate:M},null,8,["show","creating"]),oe(tf,{show:a.value,creating:l.value,"show-provider":!1,onClose:K,onCreate:te},null,8,["show","creating"]),(y(),Se(zi,{to:"body"},[oe(Nr,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[h.value?(y(),_("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:j[11]||(j[11]=gi(ee=>!u.value&&(h.value=!1),["self"]))},[m("div",i8,[m("div",r8,[j[17]||(j[17]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Clear archived conversations",-1)),m("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:u.value,onClick:j[9]||(j[9]=ee=>h.value=!1)},[oe(O(Gt),{class:"w-4 h-4"})],8,s8)]),m("div",n8,[m("p",o8," Delete all "+I(O(e).archivedConversations.length)+" archived conversation"+I(O(e).archivedConversations.length===1?"":"s")+"? This cannot be undone. ",1)]),m("div",a8,[m("button",{type:"button",disabled:u.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:j[10]||(j[10]=ee=>h.value=!1)}," Cancel ",8,l8),m("button",{type:"button",disabled:u.value,class:"inline-flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border border-red-400/50 text-red-300 hover:bg-red-500/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:be},[oe(O(Er),{class:"w-3.5 h-3.5"}),Ze(" "+I(u.value?"Clearing...":"Clear all"),1)],8,c8)])])])):se("",!0)]),_:1})]))]))}}),h8={mobile:768,tablet:1024};function u8(t,e){return t<e.mobile?"mobile":t<e.tablet?"tablet":"desktop"}const Z_=zf("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:t=>t.currentViewport==="mobile",isTablet:t=>t.currentViewport==="tablet",isDesktop:t=>t.currentViewport==="desktop",isChatFullscreen:t=>t.chatFullscreen},actions:{updateViewport(t){this.currentViewport=u8(t,h8)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(t){this.chatFullscreen=t}}});var X_=Object.defineProperty,d8=Object.getOwnPropertyDescriptor,f8=(t,e)=>{for(var i in e)X_(t,i,{get:e[i],enumerable:!0})},Pt=(t,e,i,r)=>{for(var s=r>1?void 0:r?d8(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=(r?o(e,i,s):o(s))||s);return r&&s&&X_(e,i,s),s},Pe=(t,e)=>(i,r)=>e(i,r,t),cv="Terminal input",rf={get:()=>cv,set:t=>cv=t},hv="Too much output to announce, navigate to rows manually to read",sf={get:()=>hv,set:t=>hv=t};function p8(t){return t.replace(/\r?\n/g,"\r")}function m8(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function g8(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function O8(t,e,i,r){if(t.stopPropagation(),t.clipboardData){let s=t.clipboardData.getData("text/plain");W_(s,e,i,r)}}function W_(t,e,i,r){t=p8(t),t=m8(t,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function V_(t,e,i){let r=i.getBoundingClientRect(),s=t.clientX-r.left-10,n=t.clientY-r.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${s}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function uv(t,e,i,r,s){V_(t,e,i),s&&r.rightClickSelect(t),e.value=r.selectionText,e.select()}function ws(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Nh(t,e=0,i=t.length){let r="";for(let s=e;s<i;++s){let n=t[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var v8=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let r=0,s=0;if(this._interim){let n=t.charCodeAt(s++);56320<=n&&n<=57343?e[r++]=(this._interim-55296)*1024+n-56320+65536:(e[r++]=this._interim,e[r++]=n),this._interim=0}for(let n=s;n<i;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,r;let a=t.charCodeAt(n);56320<=a&&a<=57343?e[r++]=(o-55296)*1024+a-56320+65536:(e[r++]=o,e[r++]=a);continue}o!==65279&&(e[r++]=o)}return r}},b8=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let r=0,s,n,o,a,l=0,c=0;if(this.interim[0]){let d=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,g;for(;(g=this.interim[++f]&63)&&f<4;)p<<=6,p|=g;let v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=v-f;for(;c<b;){if(c>=i)return 0;if(g=t[c++],(g&192)!==128){c--,d=!0;break}else this.interim[f++]=g,p<<=6,p|=g&63}d||(v===2?p<128?c--:e[r++]=p:v===3?p<2048||p>=55296&&p<=57343||p===65279||(e[r++]=p):p<65536||p>1114111||(e[r++]=p)),this.interim.fill(0)}let h=i-4,u=c;for(;u<i;){for(;u<h&&!((s=t[u])&128)&&!((n=t[u+1])&128)&&!((o=t[u+2])&128)&&!((a=t[u+3])&128);)e[r++]=s,e[r++]=n,e[r++]=o,e[r++]=a,u+=4;if(s=t[u++],s<128)e[r++]=s;else if((s&224)===192){if(u>=i)return this.interim[0]=s,r;if(n=t[u++],(n&192)!==128){u--;continue}if(l=(s&31)<<6|n&63,l<128){u--;continue}e[r++]=l}else if((s&240)===224){if(u>=i)return this.interim[0]=s,r;if(n=t[u++],(n&192)!==128){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=t[u++],(o&192)!==128){u--;continue}if(l=(s&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;e[r++]=l}else if((s&248)===240){if(u>=i)return this.interim[0]=s,r;if(n=t[u++],(n&192)!==128){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,r;if(a=t[u++],(a&192)!==128){u--;continue}if(l=(s&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;e[r++]=l}}return r}},F_="",$s=" ",Ol=class H_{constructor(){this.fg=0,this.bg=0,this.extended=new ph}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new H_;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ph=class q_{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new q_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ji=class Y_ extends Ol{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ph,this.combinedData=""}static fromCharData(e){let i=new Y_;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ws(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},dv="di$target",nf="di$dependencies",Du=new Map;function y8(t){return t[nf]||[]}function Jt(t){if(Du.has(t))return Du.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_8(e,i,s)};return e._id=t,Du.set(t,e),e}function _8(t,e,i){e[dv]===e?e[nf].push({id:t,index:i}):(e[nf]=[{id:t,index:i}],e[dv]=e)}var vi=Jt("BufferService"),j_=Jt("CoreMouseService"),bn=Jt("CoreService"),x8=Jt("CharsetService"),jp=Jt("InstantiationService"),U_=Jt("LogService"),bi=Jt("OptionsService"),G_=Jt("OscLinkService"),S8=Jt("UnicodeService"),vl=Jt("DecorationService"),of=class{constructor(t,e,i){this._bufferService=t,this._optionsService=e,this._oscLinkService=i}provideLinks(t,e){let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,n=new Ji,o=i.getTrimmedLength(),a=-1,l=-1,c=!1;for(let h=0;h<o;h++)if(!(l===-1&&!i.hasContent(h))){if(i.loadCell(h,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=h,a=n.extended.urlId;continue}else c=n.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&h===o-1){let u=this._oscLinkService.getLinkData(a)?.uri;if(u){let d={start:{x:l+1,y:t},end:{x:h+(!c&&h===o-1?1:0),y:t}},p=!1;if(!s?.allowNonHttpProtocols)try{let f=new URL(u);["http:","https:"].includes(f.protocol)||(p=!0)}catch{p=!0}p||r.push({text:u,range:d,activate:(f,g)=>s?s.activate(f,g,d):w8(f,g),hover:(f,g)=>s?.hover?.(f,g,d),leave:(f,g)=>s?.leave?.(f,g,d)})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=h,a=n.extended.urlId):(l=-1,a=-1)}}e(r)}};of=Pt([Pe(0,vi),Pe(1,bi),Pe(2,G_)],of);function w8(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
67
|
-
|
|
68
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var zh=Jt("CharSizeService"),ls=Jt("CoreBrowserService"),Up=Jt("MouseService"),cs=Jt("RenderService"),k8=Jt("SelectionService"),K_=Jt("CharacterJoinerService"),go=Jt("ThemeService"),J_=Jt("LinkProviderService"),C8=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?fv.isErrorNoTelemetry(t)?new fv(t.message+`
|
|
69
|
-
|
|
70
|
-
`+t.stack):new Error(t.message+`
|
|
71
|
-
|
|
72
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},$8=new C8;function kc(t){P8(t)||$8.onUnexpectedError(t)}var af="Canceled";function P8(t){return t instanceof Q8?!0:t instanceof Error&&t.name===af&&t.message===af}var Q8=class extends Error{constructor(){super(af),this.name=this.message}};function T8(t){return new Error(`Illegal argument: ${t}`)}var fv=class lf extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof lf)return e;let i=new lf;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},cf=class ex extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,ex.prototype)}};function Bi(t,e=0){return t[t.length-(1+e)]}var M8;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(M8||={});function B8(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var tx;(t=>{function e(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(T){yield T}t.single=s;function n(T){return e(T)?T:s(T)}t.wrap=n;function o(T){return T||i}t.from=o;function*a(T){for(let $=T.length-1;$>=0;$--)yield T[$]}t.reverse=a;function l(T){return!T||T[Symbol.iterator]().next().done===!0}t.isEmpty=l;function c(T){return T[Symbol.iterator]().next().value}t.first=c;function h(T,$){let R=0;for(let D of T)if($(D,R++))return!0;return!1}t.some=h;function u(T,$){for(let R of T)if($(R))return R}t.find=u;function*d(T,$){for(let R of T)$(R)&&(yield R)}t.filter=d;function*p(T,$){let R=0;for(let D of T)yield $(D,R++)}t.map=p;function*f(T,$){let R=0;for(let D of T)yield*$(D,R++)}t.flatMap=f;function*g(...T){for(let $ of T)yield*$}t.concat=g;function v(T,$,R){let D=R;for(let U of T)D=$(D,U);return D}t.reduce=v;function*b(T,$,R=T.length){for($<0&&($+=T.length),R<0?R+=T.length:R>T.length&&(R=T.length);$<R;$++)yield T[$]}t.slice=b;function S(T,$=Number.POSITIVE_INFINITY){let R=[];if($===0)return[R,T];let D=T[Symbol.iterator]();for(let U=0;U<$;U++){let ce=D.next();if(ce.done)return[R,t.empty()];R.push(ce.value)}return[R,{[Symbol.iterator](){return D}}]}t.consume=S;async function k(T){let $=[];for await(let R of T)$.push(R);return Promise.resolve($)}t.asyncToArray=k})(tx||={});function On(t){if(tx.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function A8(...t){return xt(()=>On(t))}function xt(t){return{dispose:B8(()=>{t()})}}var ix=class rx{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{On(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?rx.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};ix.DISABLE_DISPOSED_WARNING=!1;var Ts=ix,Ke=class{constructor(){this._store=new Ts,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ke.None=Object.freeze({dispose(){}});var co=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Jr=typeof window=="object"?window:globalThis,hf=class uf{constructor(e){this.element=e,this.next=uf.Undefined,this.prev=uf.Undefined}};hf.Undefined=new hf(void 0);var St=hf,pv=class{constructor(){this._first=St.Undefined,this._last=St.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===St.Undefined}clear(){let t=this._first;for(;t!==St.Undefined;){let e=t.next;t.prev=St.Undefined,t.next=St.Undefined,t=e}this._first=St.Undefined,this._last=St.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let i=new St(t);if(this._first===St.Undefined)this._first=i,this._last=i;else if(e){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==St.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==St.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==St.Undefined&&t.next!==St.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===St.Undefined&&t.next===St.Undefined?(this._first=St.Undefined,this._last=St.Undefined):t.next===St.Undefined?(this._last=this._last.prev,this._last.next=St.Undefined):t.prev===St.Undefined&&(this._first=this._first.next,this._first.prev=St.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==St.Undefined;)yield t.element,t=t.next}},R8=globalThis.performance&&typeof globalThis.performance.now=="function",E8=class sx{static create(e){return new sx(e)}constructor(e){this._now=R8&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ri;(t=>{t.None=()=>Ke.None;function e(M,x){return u(M,()=>{},0,void 0,!0,void 0,x)}t.defer=e;function i(M){return(x,V=null,N)=>{let K=!1,te;return te=M(G=>{if(!K)return te?te.dispose():K=!0,x.call(V,G)},null,N),K&&te.dispose(),te}}t.once=i;function r(M,x,V){return c((N,K=null,te)=>M(G=>N.call(K,x(G)),null,te),V)}t.map=r;function s(M,x,V){return c((N,K=null,te)=>M(G=>{x(G),N.call(K,G)},null,te),V)}t.forEach=s;function n(M,x,V){return c((N,K=null,te)=>M(G=>x(G)&&N.call(K,G),null,te),V)}t.filter=n;function o(M){return M}t.signal=o;function a(...M){return(x,V=null,N)=>{let K=A8(...M.map(te=>te(G=>x.call(V,G))));return h(K,N)}}t.any=a;function l(M,x,V,N){let K=V;return r(M,te=>(K=x(K,te),K),N)}t.reduce=l;function c(M,x){let V,N={onWillAddFirstListener(){V=M(K.fire,K)},onDidRemoveLastListener(){V?.dispose()}},K=new we(N);return x?.add(K),K.event}function h(M,x){return x instanceof Array?x.push(M):x&&x.add(M),M}function u(M,x,V=100,N=!1,K=!1,te,G){let be,ie,q,re=0,H,j={leakWarningThreshold:te,onWillAddFirstListener(){be=M(_e=>{re++,ie=x(ie,_e),N&&!q&&(ee.fire(ie),ie=void 0),H=()=>{let Le=ie;ie=void 0,q=void 0,(!N||re>1)&&ee.fire(Le),re=0},typeof V=="number"?(clearTimeout(q),q=setTimeout(H,V)):q===void 0&&(q=0,queueMicrotask(H))})},onWillRemoveListener(){K&&re>0&&H?.()},onDidRemoveLastListener(){H=void 0,be.dispose()}},ee=new we(j);return G?.add(ee),ee.event}t.debounce=u;function d(M,x=0,V){return t.debounce(M,(N,K)=>N?(N.push(K),N):[K],x,void 0,!0,void 0,V)}t.accumulate=d;function p(M,x=(N,K)=>N===K,V){let N=!0,K;return n(M,te=>{let G=N||!x(te,K);return N=!1,K=te,G},V)}t.latch=p;function f(M,x,V){return[t.filter(M,x,V),t.filter(M,N=>!x(N),V)]}t.split=f;function g(M,x=!1,V=[],N){let K=V.slice(),te=M(ie=>{K?K.push(ie):be.fire(ie)});N&&N.add(te);let G=()=>{K?.forEach(ie=>be.fire(ie)),K=null},be=new we({onWillAddFirstListener(){te||(te=M(ie=>be.fire(ie)),N&&N.add(te))},onDidAddFirstListener(){K&&(x?setTimeout(G):G())},onDidRemoveLastListener(){te&&te.dispose(),te=null}});return N&&N.add(be),be.event}t.buffer=g;function v(M,x){return(V,N,K)=>{let te=x(new S);return M(function(G){let be=te.evaluate(G);be!==b&&V.call(N,be)},void 0,K)}}t.chain=v;let b=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(V=>(x(V),V)),this}filter(x){return this.steps.push(V=>x(V)?V:b),this}reduce(x,V){let N=V;return this.steps.push(K=>(N=x(N,K),N)),this}latch(x=(V,N)=>V===N){let V=!0,N;return this.steps.push(K=>{let te=V||!x(K,N);return V=!1,N=K,te?K:b}),this}evaluate(x){for(let V of this.steps)if(x=V(x),x===b)break;return x}}function k(M,x,V=N=>N){let N=(...be)=>G.fire(V(...be)),K=()=>M.on(x,N),te=()=>M.removeListener(x,N),G=new we({onWillAddFirstListener:K,onDidRemoveLastListener:te});return G.event}t.fromNodeEventEmitter=k;function T(M,x,V=N=>N){let N=(...be)=>G.fire(V(...be)),K=()=>M.addEventListener(x,N),te=()=>M.removeEventListener(x,N),G=new we({onWillAddFirstListener:K,onDidRemoveLastListener:te});return G.event}t.fromDOMEventEmitter=T;function $(M){return new Promise(x=>i(M)(x))}t.toPromise=$;function R(M){let x=new we;return M.then(V=>{x.fire(V)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}t.fromPromise=R;function D(M,x){return M(V=>x.fire(V))}t.forward=D;function U(M,x,V){return x(V),M(N=>x(N))}t.runAndSubscribe=U;class ce{constructor(x,V){this._observable=x,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};this.emitter=new we(N),V&&V.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,V){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function he(M,x){return new ce(M,x).emitter.event}t.fromObservable=he;function W(M){return(x,V,N)=>{let K=0,te=!1,G={beginUpdate(){K++},endUpdate(){K--,K===0&&(M.reportChanges(),te&&(te=!1,x.call(V)))},handlePossibleChange(){},handleChange(){te=!0}};M.addObserver(G),M.reportChanges();let be={dispose(){M.removeObserver(G)}};return N instanceof Ts?N.add(be):Array.isArray(N)&&N.push(be),be}}t.fromObservableLight=W})(ri||={});var df=class ff{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${ff._idPool++}`,ff.all.add(this)}start(e){this._stopWatch=new E8,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};df.all=new Set,df._idPool=0;var D8=df,L8=-1,nx=class ox{constructor(e,i,r=(ox._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new z8(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};nx._idPool=1;var I8=nx,N8=class ax{constructor(e){this.value=e}static create(){let e=new Error;return new ax(e.stack??"")}print(){console.warn(this.value.split(`
|
|
73
|
-
`).slice(2).join(`
|
|
74
|
-
`))}},z8=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},Z8=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},X8=0,Lu=class{constructor(t){this.value=t,this.id=X8++}},W8=2,V8,we=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new I8(t?.onListenerError??kc,this._options?.leakWarningThreshold??L8):void 0,this._perfMon=this._options?._profName?new D8(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Z8(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||kc)(l),Ke.None}if(this._disposed)return Ke.None;e&&(t=t.bind(e));let r=new Lu(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=N8.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Lu?(this._deliveryQueue??=new F8,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=xt(()=>{s?.(),this._removeListener(r)});return i instanceof Ts?i.add(n):Array.isArray(i)&&i.push(n),n},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*W8<=e.length){let s=0;for(let n=0;n<e.length;n++)e[n]?e[s++]=e[n]:r&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=s}}_deliver(t,e){if(!t)return;let i=this._options?.onListenerError||kc;if(!i){t.value(e);return}try{t.value(e)}catch(r){i(r)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Lu)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},F8=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},pf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};pf.INSTANCE=new pf;var Gp=pf;function H8(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}Gp.INSTANCE.onDidChangeZoomLevel;function q8(t){return Gp.INSTANCE.getZoomFactor(t)}Gp.INSTANCE.onDidChangeFullscreen;var Oo=typeof navigator=="object"?navigator.userAgent:"",mf=Oo.indexOf("Firefox")>=0,Y8=Oo.indexOf("AppleWebKit")>=0,Kp=Oo.indexOf("Chrome")>=0,j8=!Kp&&Oo.indexOf("Safari")>=0;Oo.indexOf("Electron/")>=0;Oo.indexOf("Android")>=0;var Iu=!1;if(typeof Jr.matchMedia=="function"){let t=Jr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Jr.matchMedia("(display-mode: fullscreen)");Iu=t.matches,H8(Jr,t,({matches:i})=>{Iu&&e.matches||(Iu=i)})}var Zn="en",gf=!1,Of=!1,Cc=!1,lx=!1,sc,$c=Zn,mv=Zn,U8,Ur,hn=globalThis,Ri;typeof hn.vscode<"u"&&typeof hn.vscode.process<"u"?Ri=hn.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ri=process);var G8=typeof Ri?.versions?.electron=="string",K8=G8&&Ri?.type==="renderer";if(typeof Ri=="object"){gf=Ri.platform==="win32",Of=Ri.platform==="darwin",Cc=Ri.platform==="linux",Cc&&Ri.env.SNAP&&Ri.env.SNAP_REVISION,Ri.env.CI||Ri.env.BUILD_ARTIFACTSTAGINGDIRECTORY,sc=Zn,$c=Zn;let t=Ri.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);sc=e.userLocale,mv=e.osLocale,$c=e.resolvedLanguage||Zn,U8=e.languagePack?.translationsConfigFile}catch{}lx=!0}else typeof navigator=="object"&&!K8?(Ur=navigator.userAgent,gf=Ur.indexOf("Windows")>=0,Of=Ur.indexOf("Macintosh")>=0,(Ur.indexOf("Macintosh")>=0||Ur.indexOf("iPad")>=0||Ur.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Cc=Ur.indexOf("Linux")>=0,Ur?.indexOf("Mobi")>=0,$c=globalThis._VSCODE_NLS_LANGUAGE||Zn,sc=navigator.language.toLowerCase(),mv=sc):console.error("Unable to resolve platform.");var cx=gf,Ir=Of,J8=Cc,gv=lx,zr=Ur,vs=$c,eI;(t=>{function e(){return vs}t.value=e;function i(){return vs.length===2?vs==="en":vs.length>=3?vs[0]==="e"&&vs[1]==="n"&&vs[2]==="-":!1}t.isDefaultVariant=i;function r(){return vs==="en"}t.isDefault=r})(eI||={});var tI=typeof hn.postMessage=="function"&&!hn.importScripts;(()=>{if(tI){let t=[];hn.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),hn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var iI=!!(zr&&zr.indexOf("Chrome")>=0);zr&&zr.indexOf("Firefox")>=0;!iI&&zr&&zr.indexOf("Safari")>=0;zr&&zr.indexOf("Edg/")>=0;zr&&zr.indexOf("Android")>=0;var Bn=typeof navigator=="object"?navigator:{};gv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Bn&&Bn.clipboard&&Bn.clipboard.writeText,gv||Bn&&Bn.clipboard&&Bn.clipboard.readText;var Jp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},Nu=new Jp,Ov=new Jp,vv=new Jp,rI=new Array(230),hx;(t=>{function e(a){return Nu.keyCodeToStr(a)}t.toString=e;function i(a){return Nu.strToKeyCode(a)}t.fromString=i;function r(a){return Ov.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return vv.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return Ov.strToKeyCode(a)||vv.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Nu.keyCodeToStr(a)}t.toElectronAccelerator=o})(hx||={});var sI=class ux{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(e){return e instanceof ux&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new nI([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},nI=class{constructor(t){if(t.length===0)throw T8("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function oI(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return hx.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(mf)switch(e){case 59:return 85;case 60:if(J8)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ir)return 57;break}else if(Y8&&(Ir&&e===93||!Ir&&e===92))return 57;return rI[e]||0}var aI=Ir?256:2048,lI=512,cI=1024,hI=Ir?2048:256,bv=class{constructor(t){this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=oI(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=aI),this.altKey&&(e|=lI),this.shiftKey&&(e|=cI),this.metaKey&&(e|=hI),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new sI(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},yv=new WeakMap;function uI(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var dI=class{static getSameOriginWindowChain(t){let e=yv.get(t);if(!e){e=[],yv.set(t,e);let i=t,r;do r=uI(i),r?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(t);for(let n of s){let o=n.window.deref();if(i+=o?.scrollY??0,r+=o?.scrollX??0,o===e||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,r+=a.left}return{top:i,left:r}}},nc=class{constructor(t,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,typeof e.pageX=="number"?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=e.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=dI.getPositionOfChildWindowRelativeToAncestorWindow(t,e.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_v=class{constructor(t,e=0,i=0){this.browserEvent=t||null,this.target=t?t.target||t.targetNode||t.srcElement:null,this.deltaY=i,this.deltaX=e;let r=!1;if(Kp){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(t){let s=t,n=t,o=t.view?.devicePixelRatio||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*o):this.deltaY=s.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<"u"&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(t.type==="wheel"){let a=t;a.deltaMode===a.DOM_DELTA_LINE?mf&&!Ir?this.deltaY=-t.deltaY/3:this.deltaY=-t.deltaY:this.deltaY=-t.deltaY/40}if(typeof s.wheelDeltaX<"u")j8&&cx?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*o):this.deltaX=s.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<"u"&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-t.detail/3;else if(t.type==="wheel"){let a=t;a.deltaMode===a.DOM_DELTA_LINE?mf&&!Ir?this.deltaX=-t.deltaX/3:this.deltaX=-t.deltaX:this.deltaX=-t.deltaX/40}this.deltaY===0&&this.deltaX===0&&t.wheelDelta&&(r?this.deltaY=t.wheelDelta/(120*o):this.deltaY=t.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},dx=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),fI;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof pI?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ri.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:dx})})(fI||={});var pI=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?dx:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},em=class{constructor(t,e){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new cf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new cf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},mI=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,i=globalThis){if(this.isDisposed)throw new cf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=xt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},gI;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(gI||={});var xv=class Fi{static fromArray(e){return new Fi(i=>{i.emitMany(e)})}static fromPromise(e){return new Fi(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Fi(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Fi(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new we,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await ri.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new Fi(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Fi.map(this,e)}static filter(e,i){return new Fi(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Fi.filter(this,e)}static coalesce(e){return Fi.filter(e,i=>!!i)}coalesce(){return Fi.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Fi.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};xv.EMPTY=xv.fromArray([]);var{getWindow:Rr,getWindowId:OI,onDidRegisterWindow:vI}=(function(){let t=new Map,e={window:Jr,disposables:new Ts};t.set(Jr.vscodeWindowId,e);let i=new we,r=new we,s=new we;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return Ke.None;let a=new Ts,l={window:o,disposables:a.add(new Ts)};return t.set(o.vscodeWindowId,l),a.add(xt(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(We(o,Ft.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(l),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:Jr},getDocument(o){return Rr(o).document}}})(),bI=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function We(t,e,i,r){return new bI(t,e,i,r)}var Sv=function(t,e,i,r){return We(t,e,i,r)},tm,yI=class extends mI{constructor(t){super(),this.defaultTarget=t&&Rr(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},wv=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){kc(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let t=new Map,e=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),r.set(n,!0);o.length>0;)o.sort(wv.sort),o.shift().execute();r.set(n,!1)};tm=(n,o,a=0)=>{let l=OI(n),c=new wv(o,a),h=t.get(l);return h||(h=[],t.set(l,h)),h.push(c),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>s(l))),c}})();function _I(t){let e=t.getBoundingClientRect(),i=Rr(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Ft={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},xI=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=_i(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=_i(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=_i(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=_i(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=_i(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=_i(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=_i(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=_i(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=_i(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=_i(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=_i(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=_i(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=_i(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=_i(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function _i(t){return typeof t=="number"?`${t}px`:t}function ka(t){return new xI(t)}var fx=class{constructor(){this._hooks=new Ts,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,t&&i&&i(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=t;try{t.setPointerCapture(e),this._hooks.add(xt(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{n=Rr(t)}this._hooks.add(We(n,Ft.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(We(n,Ft.POINTER_UP,o=>this.stopMonitoring(!0)))}};function SI(t,e,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${e}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Cr;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(Cr||={});var ha=class ci extends Ke{constructor(){super(),this.dispatched=!1,this.targets=new pv,this.ignoreTargets=new pv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ri.runAndSubscribe(vI,({window:e,disposables:i})=>{i.add(We(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(We(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(We(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Jr,disposables:this._store}))}static addTarget(e){if(!ci.isTouchDevice())return Ke.None;ci.INSTANCE||(ci.INSTANCE=new ci);let i=ci.INSTANCE.targets.push(e);return xt(i)}static ignoreTarget(e){if(!ci.isTouchDevice())return Ke.None;ci.INSTANCE||(ci.INSTANCE=new ci);let i=ci.INSTANCE.ignoreTargets.push(e);return xt(i)}static isTouchDevice(){return"ontouchstart"in Jr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Cr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<ci.HOLD_DELAY&&Math.abs(l.initialPageX-Bi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Bi(l.rollingPageY))<30){let h=this.newGestureEvent(Cr.Tap,l.initialTarget);h.pageX=Bi(l.rollingPageX),h.pageY=Bi(l.rollingPageY),this.dispatchEvent(h)}else if(c>=ci.HOLD_DELAY&&Math.abs(l.initialPageX-Bi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Bi(l.rollingPageY))<30){let h=this.newGestureEvent(Cr.Contextmenu,l.initialTarget);h.pageX=Bi(l.rollingPageX),h.pageY=Bi(l.rollingPageY),this.dispatchEvent(h)}else if(s===1){let h=Bi(l.rollingPageX),u=Bi(l.rollingPageY),d=Bi(l.rollingTimestamps)-l.rollingTimestamps[0],p=h-l.rollingPageX[0],f=u-l.rollingPageY[0],g=[...this.targets].filter(v=>l.initialTarget instanceof Node&&v.contains(l.initialTarget));this.inertia(e,g,r,Math.abs(p)/d,p>0?1:-1,h,Math.abs(f)/d,f>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Cr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===Cr.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ci.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===Cr.Change||e.type===Cr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let s=0,n=e.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,s,n,o,a,l,c){this.handle=tm(e,()=>{let h=Date.now(),u=h-r,d=0,p=0,f=!0;s+=ci.SCROLL_FRICTION*u,a+=ci.SCROLL_FRICTION*u,s>0&&(f=!1,d=n*s*u),a>0&&(f=!1,p=l*a*u);let g=this.newGestureEvent(Cr.Change);g.translationX=d,g.translationY=p,i.forEach(v=>v.dispatchEvent(g)),f||this.inertia(e,i,h,s,n,o+d,a,l,c+p)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(Cr.Change,o.initialTarget);a.translationX=n.pageX-Bi(o.rollingPageX),a.translationY=n.pageY-Bi(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};ha.SCROLL_FRICTION=-.005,ha.HOLD_DELAY=700,ha.CLEAR_TAP_COUNT_TIME=400,Pt([SI],ha,"isTouchDevice",1);var wI=ha,im=class extends Ke{onclick(t,e){this._register(We(t,Ft.CLICK,i=>e(new nc(Rr(t),i))))}onmousedown(t,e){this._register(We(t,Ft.MOUSE_DOWN,i=>e(new nc(Rr(t),i))))}onmouseover(t,e){this._register(We(t,Ft.MOUSE_OVER,i=>e(new nc(Rr(t),i))))}onmouseleave(t,e){this._register(We(t,Ft.MOUSE_LEAVE,i=>e(new nc(Rr(t),i))))}onkeydown(t,e){this._register(We(t,Ft.KEY_DOWN,i=>e(new bv(i))))}onkeyup(t,e){this._register(We(t,Ft.KEY_UP,i=>e(new bv(i))))}oninput(t,e){this._register(We(t,Ft.INPUT,e))}onblur(t,e){this._register(We(t,Ft.BLUR,e))}onfocus(t,e){this._register(We(t,Ft.FOCUS,e))}onchange(t,e){this._register(We(t,Ft.CHANGE,e))}ignoreGesture(t){return wI.ignoreTarget(t)}},kv=11,kI=class extends im{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=kv+"px",this.domNode.style.height=kv+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new fx),this._register(Sv(this.bgDomNode,Ft.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Sv(this.domNode,Ft.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new yI),this._pointerdownScheduleRepeatTimer=this._register(new em)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Rr(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},CI=class vf{constructor(e,i,r,s,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=s,this.rawScrollTop=a,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new vf(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new vf(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},$I=class extends Ke{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new CI(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;e?r=new $v(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=$v.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},Cv=class{constructor(t,e,i){this.scrollLeft=t,this.scrollTop=e,this.isDone=i}};function zu(t,e){let i=e-t;return function(r){return t+i*TI(r)}}function PI(t,e,i){return function(r){return r<i?t(r/i):e((r-i)/(1-i))}}var $v=class bf{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){let s,n;return e<i?(s=e+.75*r,n=i-.75*r):(s=e-.75*r,n=i+.75*r),PI(zu(e,s),zu(n,i),.33)}return zu(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new Cv(r,s,!1)}return new Cv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,r){return bf.start(e,i,r)}static start(e,i,r){r=r+10;let s=Date.now()-10;return new bf(e,i,s,r)}};function QI(t){return Math.pow(t,3)}function TI(t){return 1-QI(1-t)}var MI=class extends Ke{constructor(t,e,i){super(),this._visibility=t,this._visibleClassName=e,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new em)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this._updateShouldBeVisible())}setShouldBeVisible(t){this._rawShouldBeVisible=t,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let t=this._applyVisibilitySetting();this._shouldBeVisible!==t&&(this._shouldBeVisible=t,this.ensureVisibility())}setIsNeeded(t){this._isNeeded!==t&&(this._isNeeded=t,this.ensureVisibility())}setDomNode(t){this._domNode=t,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}},BI=140,px=class extends im{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new MI(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fx),this._shouldRender=!0,this.domNode=ka(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(We(this.domNode.domNode,Ft.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new kI(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=ka(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(We(this.slider.domNode,Ft.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,i=e+this._scrollbarState.getSliderPosition(),r=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(t);i<=s&&s<=r?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,i;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,i=t.offsetY;else{let s=_I(this.domNode.domNode);e=t.pageX-s.left,i=t.pageY-s.top}let r=this._pointerDownRelativePosition(e,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),i=this._sliderOrthogonalPointerPosition(t),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(cx&&o>BI){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(s)-e;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},mx=class yf{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new yf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),l=s>0&&s>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/s))),h=(a-c)/(s-r),u=n*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let e=yf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},AI=class extends px{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new mx(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:t,scrollByPage:e.scrollByPage}),e.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(t,e){this.slider.setWidth(t),this.slider.setLeft(e)}_renderDomNode(t,e){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(t.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return t}_sliderPointerPosition(t){return t.pageX}_sliderOrthogonalPointerPosition(t){return t.pageY}_updateScrollbarSize(t){this.slider.setHeight(t)}writeScrollPosition(t,e){t.scrollLeft=e}updateOptions(t){this.updateScrollbarSize(t.horizontal===2?0:t.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._visibilityController.setVisibility(t.horizontal),this._scrollByPage=t.scrollByPage}},RI=class extends px{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new mx(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},EI=500,Pv=50,DI=class{constructor(t,e,i){this.timestamp=t,this.deltaX=e,this.deltaY=i,this.score=0}},_f=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,r=1,s=this._rear;do{let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(Kp){let i=Rr(e.browserEvent),r=q8(i);this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new DI(e,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(s,o),1),c=Math.max(Math.min(n,a),1),h=Math.max(s,o),u=Math.max(n,a);h%l===0&&u%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};_f.INSTANCE=new _f;var LI=_f,II=class extends im{constructor(t,e,i){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=zI(e),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new RI(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new AI(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ka(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ka(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ka(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new em),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=On(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,Ir&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new _v(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=On(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new _v(i))};this._mouseWheelToDispose.push(We(this._listenOnDomNode,Ft.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let e=LI.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let s=t.deltaY*this._options.mouseWheelScrollSensitivity,n=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+s===0?n=s=0:Math.abs(s)>=Math.abs(n)?n=0:s=0),this._options.flipAxes&&([s,n]=[n,s]);let o=!Ir&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=s,s=0),t.browserEvent&&t.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(s){let c=Pv*s,h=a.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(l,h)}if(n){let c=Pv*n,h=a.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(l,h)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,r=i?" left":"",s=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),EI)}},NI=class extends II{constructor(t,e,i){super(t,e,i)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function zI(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,Ir&&(e.className+=" mac"),e}var xf=class extends Ke{constructor(t,e,i,r,s,n,o,a){super(),this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new $I({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>tm(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new NI(e,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ri.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),t.appendChild(this._scrollableElement.getDomNode()),this._register(xt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),e.appendChild(this._styleElement),this._register(xt(()=>this._styleElement.remove())),this._register(ri.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
75
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(t){let e=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:e.scrollTop+t*this._renderService.dimensions.css.cell.height})}scrollToLine(t,e){e&&(this._latestYDisp=t),this._scrollableElement.setScrollPosition({reuseAnimation:!e,scrollTop:t*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(t){t!==void 0&&(this._latestYDisp=t),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(t=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,t!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:t*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(t){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let e=Math.round(t.scrollTop/this._renderService.dimensions.css.cell.height),i=e-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=e,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};xf=Pt([Pe(2,vi),Pe(3,ls),Pe(4,j_),Pe(5,go),Pe(6,bi),Pe(7,cs)],xf);var Sf=class extends Ke{constructor(t,e,i,r,s){super(),this._screenElement=t,this._bufferService=e,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(xt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let t of this._decorationService.decorations)this._renderDecoration(t);this._dimensionsChanged=!1}_renderDecoration(t){this._refreshStyle(t),this._dimensionsChanged&&this._refreshXPosition(t)}_createElement(t){let e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",t?.options?.layer==="top"),e.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,e.style.top=`${(t.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=t.options.x??0;return i&&i>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(t,e),e}_refreshStyle(t){let e=t.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)t.element&&(t.element.style.display="none",t.onRenderEmitter.fire(t.element));else{let i=this._decorationElements.get(t);i||(i=this._createElement(t),t.element=i,this._decorationElements.set(t,i),this._container.appendChild(i),t.onDispose(()=>{this._decorationElements.delete(t),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${e*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),t.onRenderEmitter.fire(i)}}_refreshXPosition(t,e=t.element){if(!e)return;let i=t.options.x??0;(t.options.anchor||"left")==="right"?e.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":e.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(t){this._decorationElements.get(t)?.remove(),this._decorationElements.delete(t),t.dispose()}};Sf=Pt([Pe(1,vi),Pe(2,ls),Pe(3,vl),Pe(4,cs)],Sf);var ZI=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=t.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=t.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=t.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=t.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:t.options.overviewRulerOptions.color,position:t.options.overviewRulerOptions.position,startBufferLine:t.marker.line,endBufferLine:t.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(t){this._linePadding=t}_lineIntersectsZone(t,e){return e>=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}},Sr={full:0,left:0,center:0,right:0},bs={full:0,left:0,center:0,right:0},Jo={full:0,left:0,center:0,right:0},mh=class extends Ke{constructor(t,e,i,r,s,n,o,a){super(),this._viewportElement=t,this._screenElement=e,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new ZI,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(xt(()=>this._canvas?.remove()));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let t=Math.floor((this._canvas.width-1)/3),e=Math.ceil((this._canvas.width-1)/3);bs.full=this._canvas.width,bs.left=t,bs.center=e,bs.right=t,this._refreshDrawHeightConstants(),Jo.full=1,Jo.left=1,Jo.center=1+bs.left,Jo.right=1+bs.left+bs.center}_refreshDrawHeightConstants(){Sr.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,e=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);Sr.left=e,Sr.center=e,Sr.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let t=this._colorZoneStore.zones;for(let e of t)e.position!=="full"&&this._renderColorZone(e);for(let e of t)e.position==="full"&&this._renderColorZone(e);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(Jo[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-Sr[t.position||"full"]/2),bs[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+Sr[t.position||"full"]))}_queueRefresh(t,e){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=e||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};mh=Pt([Pe(2,vi),Pe(3,vl),Pe(4,cs),Pe(5,bi),Pe(6,go),Pe(7,ls)],mh);var fe;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
|
|
76
|
-
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(fe||={});var Pc;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(Pc||={});var gx;(t=>t.ST=`${fe.ESC}\\`)(gx||={});var wf=class{constructor(t,e,i,r,s,n){this._textarea=t,this._compositionView=e,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.length<t.length?this._coreService.triggerDataEvent(`${fe.DEL}`,!0):e.length===t.length&&e!==t&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(t){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}t||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wf=Pt([Pe(2,vi),Pe(3,bi),Pe(4,bn),Pe(5,cs)],wf);var Ht=0,qt=0,Yt=0,$t=0,Qv={css:"#00000000",rgba:0},Et;(t=>{function e(s,n,o,a){return a!==void 0?`#${qs(s)}${qs(n)}${qs(o)}${qs(a)}`:`#${qs(s)}${qs(n)}${qs(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(Et||={});var yt;(t=>{function e(l,c){if($t=(c.rgba&255)/255,$t===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,p=l.rgba>>24&255,f=l.rgba>>16&255,g=l.rgba>>8&255;Ht=p+Math.round((h-p)*$t),qt=f+Math.round((u-f)*$t),Yt=g+Math.round((d-g)*$t);let v=Et.toCss(Ht,qt,Yt),b=Et.toRgba(Ht,qt,Yt);return{css:v,rgba:b}}t.blend=e;function i(l){return(l.rgba&255)===255}t.isOpaque=i;function r(l,c,h){let u=Qc.ensureContrastRatio(l.rgba,c.rgba,h);if(u)return Et.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(l){let c=(l.rgba|255)>>>0;return[Ht,qt,Yt]=Qc.toChannels(c),{css:Et.toCss(Ht,qt,Yt),rgba:c}}t.opaque=s;function n(l,c){return $t=Math.round(c*255),[Ht,qt,Yt]=Qc.toChannels(l.rgba),{css:Et.toCss(Ht,qt,Yt,$t),rgba:Et.toRgba(Ht,qt,Yt,$t)}}t.opacity=n;function o(l,c){return $t=l.rgba&255,n(l,$t*c/255)}t.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}t.toColorRGB=a})(yt||={});var wt;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ht=parseInt(s.slice(1,2).repeat(2),16),qt=parseInt(s.slice(2,3).repeat(2),16),Yt=parseInt(s.slice(3,4).repeat(2),16),Et.toColor(Ht,qt,Yt);case 5:return Ht=parseInt(s.slice(1,2).repeat(2),16),qt=parseInt(s.slice(2,3).repeat(2),16),Yt=parseInt(s.slice(3,4).repeat(2),16),$t=parseInt(s.slice(4,5).repeat(2),16),Et.toColor(Ht,qt,Yt,$t);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ht=parseInt(n[1]),qt=parseInt(n[2]),Yt=parseInt(n[3]),$t=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Et.toColor(Ht,qt,Yt,$t);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ht,qt,Yt,$t]=e.getImageData(0,0,1,1).data,$t!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Et.toRgba(Ht,qt,Yt,$t),css:s}}t.toColor=r})(wt||={});var pi;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,l=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}t.relativeLuminance2=i})(pi||={});var Qc;(t=>{function e(o,a){if($t=(a&255)/255,$t===1)return a;let l=a>>24&255,c=a>>16&255,h=a>>8&255,u=o>>24&255,d=o>>16&255,p=o>>8&255;return Ht=u+Math.round((l-u)*$t),qt=d+Math.round((c-d)*$t),Yt=p+Math.round((h-p)*$t),Et.toRgba(Ht,qt,Yt)}t.blend=e;function i(o,a,l){let c=pi.relativeLuminance(o>>8),h=pi.relativeLuminance(a>>8);if(jr(c,h)<l){if(h<c){let p=r(o,a,l),f=jr(c,pi.relativeLuminance(p>>8));if(f<l){let g=s(o,a,l),v=jr(c,pi.relativeLuminance(g>>8));return f>v?p:g}return p}let u=s(o,a,l),d=jr(c,pi.relativeLuminance(u>>8));if(d<l){let p=r(o,a,l),f=jr(c,pi.relativeLuminance(p>>8));return d>f?u:p}return u}}t.ensureContrastRatio=i;function r(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,p=a>>16&255,f=a>>8&255,g=jr(pi.relativeLuminance2(d,p,f),pi.relativeLuminance2(c,h,u));for(;g<l&&(d>0||p>0||f>0);)d-=Math.max(0,Math.ceil(d*.1)),p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),g=jr(pi.relativeLuminance2(d,p,f),pi.relativeLuminance2(c,h,u));return(d<<24|p<<16|f<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,p=a>>16&255,f=a>>8&255,g=jr(pi.relativeLuminance2(d,p,f),pi.relativeLuminance2(c,h,u));for(;g<l&&(d<255||p<255||f<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=jr(pi.relativeLuminance2(d,p,f),pi.relativeLuminance2(c,h,u));return(d<<24|p<<16|f<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Qc||={});function qs(t){let e=t.toString(16);return e.length<2?"0"+e:e}function jr(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var XI=class extends Ol{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gh=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ji}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],r=e.translateToString(!0),s=0,n=0,o=0,a=e.getFg(0),l=e.getBg(0);for(let c=0;c<e.getTrimmedLength();c++)if(e.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-s>1){let h=this._getJoinedRanges(r,o,n,e,s);for(let u=0;u<h.length;u++)i.push(h[u])}s=c,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||$s.length}if(this._bufferService.cols-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let h=0;h<c.length;h++)i.push(c[h])}return i}_getJoinedRanges(t,e,i,r,s){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(n);for(let c=0;c<l.length;c++)gh._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(t,e,i){let r=0,s=!1,n=0,o=t[r];if(o){for(let a=i;a<this._bufferService.cols;a++){let l=e.getWidth(a),c=e.getString(a).length||$s.length;if(l!==0){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=t[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let r=0;r<t.length;r++){let s=t[r];if(i){if(e[1]<=s[0])return t[r-1][1]=e[1],t;if(e[1]<=s[1])return t[r-1][1]=Math.max(e[1],s[1]),t.splice(r,1),t;t.splice(r,1),r--}else{if(e[1]<=s[0])return t.splice(r,0,e),t;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),t;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};gh=Pt([Pe(0,vi)],gh);function WI(t){return 57508<=t&&t<=57558}function VI(t){return 9472<=t&&t<=9631}function FI(t){return WI(t)||VI(t)}function HI(){return{css:{canvas:oc(),cell:oc()},device:{canvas:oc(),cell:oc(),char:{width:0,height:0,left:0,top:0}}}}function oc(){return{width:0,height:0}}var kf=class{constructor(t,e,i,r,s,n,o){this._document=t,this._characterJoinerService=e,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Ji,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(t,e,i){this._selectionStart=t,this._selectionEnd=e,this._columnSelectMode=i}createRow(t,e,i,r,s,n,o,a,l,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(e),p=this._themeService.colors,f=t.getNoBgTrimmedLength();i&&f<n+1&&(f=n+1);let g,v=0,b="",S=0,k=0,T=0,$=0,R=!1,D=0,U=!1,ce=0,he=0,W=[],M=c!==-1&&h!==-1;for(let x=0;x<f;x++){t.loadCell(x,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let N=!1,K=x>=he,te=x,G=this._workCell;if(d.length>0&&x===d[0][0]&&K){let w=d.shift(),L=this._isCellInSelection(w[0],e);for(S=w[0]+1;S<w[1];S++)K&&=L===this._isCellInSelection(S,e);K&&=!i||n<w[0]||n>=w[1],K?(N=!0,G=new XI(this._workCell,t.translateToString(!0,w[0],w[1]),w[1]-w[0]),te=w[1]-1,V=G.getWidth()):he=w[1]}let be=this._isCellInSelection(x,e),ie=i&&x===n,q=M&&x>=c&&x<=h,re=!1;this._decorationService.forEachDecorationAtCell(x,e,void 0,w=>{re=!0});let H=G.getChars()||$s;if(H===" "&&(G.isUnderline()||G.isOverline())&&(H=" "),ce=V*a-l.get(H,G.isBold(),G.isItalic()),!g)g=this._document.createElement("span");else if(v&&(be&&U||!be&&!U&&G.bg===k)&&(be&&U&&p.selectionForeground||G.fg===T)&&G.extended.ext===$&&q===R&&ce===D&&!ie&&!N&&!re&&K){G.isInvisible()?b+=$s:b+=H,v++;continue}else v&&(g.textContent=b),g=this._document.createElement("span"),v=0,b="";if(k=G.bg,T=G.fg,$=G.extended.ext,R=q,D=ce,U=be,N&&n>=x&&n<=te&&(n=x),!this._coreService.isCursorHidden&&ie&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&W.push("xterm-cursor-blink"),W.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(G.isBold()&&W.push("xterm-bold"),G.isItalic()&&W.push("xterm-italic"),G.isDim()&&W.push("xterm-dim"),G.isInvisible()?b=$s:b=G.getChars()||$s,G.isUnderline()&&(W.push(`xterm-underline-${G.extended.underlineStyle}`),b===" "&&(b=" "),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Ol.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let w=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&w<8&&(w+=8),g.style.textDecorationColor=p.ansi[w].css}G.isOverline()&&(W.push("xterm-overline"),b===" "&&(b=" ")),G.isStrikethrough()&&W.push("xterm-strikethrough"),q&&(g.style.textDecoration="underline");let j=G.getFgColor(),ee=G.getFgColorMode(),_e=G.getBgColor(),Le=G.getBgColorMode(),Ne=!!G.isInverse();if(Ne){let w=j;j=_e,_e=w;let L=ee;ee=Le,Le=L}let Je,st,Ue=!1;this._decorationService.forEachDecorationAtCell(x,e,void 0,w=>{w.options.layer!=="top"&&Ue||(w.backgroundColorRGB&&(Le=50331648,_e=w.backgroundColorRGB.rgba>>8&16777215,Je=w.backgroundColorRGB),w.foregroundColorRGB&&(ee=50331648,j=w.foregroundColorRGB.rgba>>8&16777215,st=w.foregroundColorRGB),Ue=w.options.layer==="top")}),!Ue&&be&&(Je=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,_e=Je.rgba>>8&16777215,Le=50331648,Ue=!0,p.selectionForeground&&(ee=50331648,j=p.selectionForeground.rgba>>8&16777215,st=p.selectionForeground)),Ue&&W.push("xterm-decoration-top");let B;switch(Le){case 16777216:case 33554432:B=p.ansi[_e],W.push(`xterm-bg-${_e}`);break;case 50331648:B=Et.toColor(_e>>16,_e>>8&255,_e&255),this._addStyle(g,`background-color:#${Tv((_e>>>0).toString(16),"0",6)}`);break;default:Ne?(B=p.foreground,W.push("xterm-bg-257")):B=p.background}switch(Je||G.isDim()&&(Je=yt.multiplyOpacity(B,.5)),ee){case 16777216:case 33554432:G.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(g,B,p.ansi[j],G,Je,void 0)||W.push(`xterm-fg-${j}`);break;case 50331648:let w=Et.toColor(j>>16&255,j>>8&255,j&255);this._applyMinimumContrast(g,B,w,G,Je,st)||this._addStyle(g,`color:#${Tv(j.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(g,B,p.foreground,G,Je,st)||Ne&&W.push("xterm-fg-257")}W.length&&(g.className=W.join(" "),W.length=0),!ie&&!N&&!re&&K?v++:g.textContent=b,ce!==this.defaultSpacing&&(g.style.letterSpacing=`${ce}px`),u.push(g),x=te}return g&&v&&(g.textContent=b),u}_applyMinimumContrast(t,e,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||FI(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!s&&!n&&(a=o.getColor(e.rgba,i.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=yt.ensureContrastRatio(s||e,n||i,l),o.setColor((s||e).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(t,`color:${a.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t<r[0]&&e<=r[1]:t<i[0]&&e>=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e<r[1]||i[1]===r[1]&&e===i[1]&&t>=i[0]&&t<r[0]||i[1]<r[1]&&e===r[1]&&t<r[0]||i[1]<r[1]&&e===i[1]&&t>=i[0]}};kf=Pt([Pe(1,K_),Pe(2,bi),Pe(3,ls),Pe(4,bn),Pe(5,vl),Pe(6,go)],kf);function Tv(t,e,i){for(;t.length<i;)t=e+t;return t}var qI=class{constructor(t,e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=t.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=t.createElement("span");i.classList.add("xterm-char-measure-element");let r=t.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=t.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=t.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),e.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(t,e,i,r){t===this._font&&e===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=t,this._fontSize=e,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(t,e,i){let r=0;if(!e&&!i&&t.length===1&&(r=t.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(t,0);return o>0&&(this._flat[r]=o),o}let s=t;e&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;e&&(o|=1),i&&(o|=2),n=this._measure(t,o),n>0&&this._holey.set(s,n)}return n}_measure(t,e){let i=this._measureElements[e];return i.textContent=t.repeat(32),i.offsetWidth/32}},YI=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let s=t.buffers.active.ydisp,n=e[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,t.rows-1);if(a>=t.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function jI(){return new YI}var Zu="xterm-dom-renderer-owner-",Vi="xterm-rows",ac="xterm-fg-",Mv="xterm-bg-",ea="xterm-focus",lc="xterm-selection",UI=1,Cf=class extends Ke{constructor(t,e,i,r,s,n,o,a,l,c,h,u,d,p){super(),this._terminal=t,this._document=e,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=p,this._terminalClass=UI++,this._rowElements=[],this._selectionRenderModel=jI(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Vi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(lc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=HI(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(kf,document),this._element.classList.add(Zu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(xt(()=>{this._element.classList.remove(Zu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new qI(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let t=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*t,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*t),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/t),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/t),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let e=`${this._terminalSelector} .${Vi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=e,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(t){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let e=`${this._terminalSelector} .${Vi} { pointer-events: none; color: ${t.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;e+=`${this._terminalSelector} .${Vi} .xterm-dim { color: ${yt.multiplyOpacity(t.foreground,.5).css};}`,e+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;e+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,e+=`@keyframes ${r} { 50% { box-shadow: none; }}`,e+=`@keyframes ${s} { 0% { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css}; } 50% { background-color: inherit; color: ${t.cursor.css}; }}`,e+=`${this._terminalSelector} .${Vi}.${ea} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Vi}.${ea} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Vi}.${ea} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,e+=`${this._terminalSelector} .${lc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${lc} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${lc} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of t.ansi.entries())e+=`${this._terminalSelector} .${ac}${n} { color: ${o.css}; }${this._terminalSelector} .${ac}${n}.xterm-dim { color: ${yt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Mv}${n} { background-color: ${o.css}; }`;e+=`${this._terminalSelector} .${ac}257 { color: ${yt.opaque(t.background).css}; }${this._terminalSelector} .${ac}257.xterm-dim { color: ${yt.multiplyOpacity(yt.opaque(t.background),.5).css}; }${this._terminalSelector} .${Mv}257 { background-color: ${t.foreground.css}; }`,this._themeStyleElement.textContent=e}_setDefaultSpacing(){let t=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${t}px`,this._rowFactory.defaultSpacing=t}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(t,e){for(let i=this._rowElements.length;i<=e;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(t,e){this._refreshRowElements(t,e),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ea),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ea),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(t,e,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(t,e,i),this.renderRows(0,this._bufferService.rows-1),!t||!e||(this._selectionRenderModel.update(this._terminal,t,e,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let l=t[0]>e[0];a.appendChild(this._createSelectionElement(n,l?e[0]:t[0],l?t[0]:e[0],o-n+1))}else{let l=r===n?t[0]:0,c=n===s?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,l,c));let h=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,h)),n!==o){let u=s===o?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,u))}}this._selectionContainer.appendChild(a)}_createSelectionElement(t,e,i,r=1){let s=this._document.createElement("div"),n=e*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-e);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${t*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let t of this._rowElements)t.replaceChildren()}renderRows(t,e){let i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=t;l<=e;l++){let c=l+i.ydisp,h=this._rowElements[l],u=i.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===r,o,a,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Zu}${this._terminalClass}`}_handleLinkHover(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)}_handleLinkLeave(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)}_setCellUnderline(t,e,i,r,s,n){i<0&&(t=0),r<0&&(e=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,s-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=i;p<=r;++p){let f=p+a.ydisp,g=this._rowElements[p],v=a.lines.get(f);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,f,f===l,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,n?p===i?t:0:-1,n?(p===r?e:s)-1:-1))}}};Cf=Pt([Pe(7,jp),Pe(8,zh),Pe(9,bi),Pe(10,vi),Pe(11,bn),Pe(12,ls),Pe(13,go)],Cf);var $f=class extends Ke{constructor(t,e,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new KI(this._optionsService))}catch{this._measureStrategy=this._register(new GI(t,e,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let t=this._measureStrategy.measure();(t.width!==this.width||t.height!==this.height)&&(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};$f=Pt([Pe(2,bi)],$f);var Ox=class extends Ke{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},GI=class extends Ox{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},KI=class extends Ox{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}},JI=class extends Ke{constructor(t,e,i){super(),this._textarea=t,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new e9(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ri.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(We(this._textarea,"focus",()=>this._isFocused=!0)),this._register(We(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(t){this._window!==t&&(this._window=t,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},e9=class extends Ke{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new co),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xt(()=>this.clearListener()))}setWindow(t){this._parentWindow=t,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=We(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},t9=class extends Ke{constructor(){super(),this.linkProviders=[],this._register(xt(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function rm(t,e,i){let r=i.getBoundingClientRect(),s=t.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function i9(t,e,i,r,s,n,o,a,l){if(!n)return;let c=rm(t,e,i);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c}var Pf=class{constructor(t,e){this._renderService=t,this._charSizeService=e}getCoords(t,e,i,r,s){return i9(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(t,e){let i=rm(window,t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Pf=Pt([Pe(0,cs),Pe(1,zh)],Pf);var r9=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}},vx={};f8(vx,{getSafariVersion:()=>n9,isChromeOS:()=>xx,isFirefox:()=>bx,isIpad:()=>o9,isIphone:()=>a9,isLegacyEdge:()=>s9,isLinux:()=>sm,isMac:()=>Oh,isNode:()=>Zh,isSafari:()=>yx,isWindows:()=>_x});var Zh=typeof process<"u"&&"title"in process,bl=Zh?"node":navigator.userAgent,yl=Zh?"node":navigator.platform,bx=bl.includes("Firefox"),s9=bl.includes("Edge"),yx=/^((?!chrome|android).)*safari/i.test(bl);function n9(){if(!yx)return 0;let t=bl.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Oh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(yl),o9=yl==="iPad",a9=yl==="iPhone",_x=["Windows","Win16","Win32","WinCE"].includes(yl),sm=yl.indexOf("Linux")>=0,xx=/\bCrOS\b/.test(bl),Sx=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},l9=class extends Sx{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},c9=class extends Sx{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},vh=!Zh&&"requestIdleCallback"in window?c9:l9,h9=class{constructor(){this._queue=new vh}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Qf=class extends Ke{constructor(t,e,i,r,s,n,o,a,l){super(),this._rowCount=t,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=a,this._renderer=this._register(new co),this._pausedResizeTask=new h9,this._observerDisposable=this._register(new co),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new r9((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new u9(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,e),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,e)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(t,e){if("IntersectionObserver"in t){let i=new t.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(e),this._observerDisposable.value=xt(()=>i.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(t,e,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}let r=this._syncOutputHandler.flush();r&&(t=Math.min(t,r.start),e=Math.max(e,r.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,e,this._rowCount)}_renderRows(t,e){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}t=Math.min(t,this._rowCount-1),e=Math.min(e,this._rowCount-1),this._renderer.value.renderRows(t,e),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:e}),this._onRender.fire({start:t,end:e}),this._isNextRenderRedrawOnly=!0}}resize(t,e){this._rowCount=e,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,e){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(t,e)):this._renderer.value.handleResize(t,e),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(t,e,i){this._selectionState.start=t,this._selectionState.end=e,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(t,e,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Qf=Pt([Pe(2,bi),Pe(3,zh),Pe(4,bn),Pe(5,vl),Pe(6,vi),Pe(7,ls),Pe(8,go)],Qf);var u9=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function d9(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return m9(s,n,t,e,i,r)+Xh(n,e,i,r)+g9(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",Ga(Math.abs(s-t),Ua(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),l=p9(n>e?t:s,i)+(a-1)*i.cols+1+f9(n>e?s:t);return Ga(l,Ua(o,r))}function f9(t,e){return t-1}function p9(t,e){return e.cols-t}function m9(t,e,i,r,s,n){return Xh(e,r,s,n).length===0?"":Ga(kx(t,e,t,e-vn(e,s),!1,s).length,Ua("D",n))}function Xh(t,e,i,r){let s=t-vn(t,i),n=e-vn(e,i),o=Math.abs(s-n)-O9(t,e,i);return Ga(o,Ua(wx(t,e),r))}function g9(t,e,i,r,s,n){let o;Xh(e,r,s,n).length>0?o=r-vn(r,s):o=e;let a=r,l=v9(t,e,i,r,s,n);return Ga(kx(t,o,i,a,l==="C",s).length,Ua(l,n))}function O9(t,e,i){let r=0,s=t-vn(t,i),n=e-vn(e,i);for(let o=0;o<Math.abs(s-n);o++){let a=wx(t,e)==="A"?-1:1;i.buffer.lines.get(s+a*o)?.isWrapped&&r++}return r}function vn(t,e){let i=0,r=e.buffer.lines.get(t),s=r?.isWrapped;for(;s&&t>=0&&t<e.rows;)i++,r=e.buffer.lines.get(--t),s=r?.isWrapped;return i}function v9(t,e,i,r,s,n){let o;return Xh(i,r,s,n).length>0?o=r-vn(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function wx(t,e){return t>e?"A":"B"}function kx(t,e,i,r,s,n){let o=t,a=e,l="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,t,o),o=0,t=0,a++):!s&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,t+1),o=n.cols-1,t=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,t,o)}function Ua(t,e){let i=e?"O":"[";return fe.ESC+i+t}function Ga(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var b9=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Bv(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Xu=50,y9=15,_9=50,x9=500,S9=" ",w9=new RegExp(S9,"g"),Tf=class extends Ke{constructor(t,e,i,r,s,n,o,a,l){super(),this._element=t,this._screenElement=e,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ji,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new b9(this._bufferService),this._activeSelectionMode=0,this._register(xt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return!t||!e?!1:t[0]!==e[0]||t[1]!==e[1]}get selectionText(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!t||!e)return"";let i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(t[0]===e[0])return"";let s=t[0]<e[0]?t[0]:e[0],n=t[0]<e[0]?e[0]:t[0];for(let o=t[1];o<=e[1];o++){let a=i.translateBufferLineToString(o,!0,s,n);r.push(a)}}else{let s=t[1]===e[1]?e[0]:void 0;r.push(i.translateBufferLineToString(t[1],!0,t[0],s));for(let n=t[1]+1;n<=e[1]-1;n++){let o=i.lines.get(n),a=i.translateBufferLineToString(n,!0);o?.isWrapped?r[r.length-1]+=a:r.push(a)}if(t[1]!==e[1]){let n=i.lines.get(e[1]),o=i.translateBufferLineToString(e[1],!0,0,e[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(w9," ")).join(_x?`\r
|
|
77
|
-
`:`
|
|
78
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),sm&&t&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(t){let e=this._getMouseBufferCoords(t),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!e?!1:this._areCoordsInSelection(e,i,r)}isCellInSelection(t,e){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([t,e],i,r)}_areCoordsInSelection(t,e,i){return t[1]>e[1]&&t[1]<i[1]||e[1]===i[1]&&t[1]===e[1]&&t[0]>=e[0]&&t[0]<i[0]||e[1]<i[1]&&t[1]===i[1]&&t[0]<i[0]||e[1]<i[1]&&t[1]===e[1]&&t[0]>=e[0]}_selectWordAtCursor(t,e){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Bv(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(t);return r?(this._selectWordAt(r,e),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,e],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let e=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(e)return e[0]--,e[1]--,e[1]+=this._bufferService.buffer.ydisp,e}_getMouseEventScrollAmount(t){let e=rm(this._coreBrowserService.window,t,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return e>=0&&e<=i?0:(e>i&&(e-=i),e=Math.min(Math.max(e,-Xu),Xu),e/=Xu,e/Math.abs(e)+Math.round(e*(y9-1)))}shouldForceSelection(t){return Oh?t.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:t.shiftKey}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),_9)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let e=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);e&&e.length!==this._model.selectionStart[0]&&e.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=2,this._selectLineAt(e[1]))}shouldColumnSelect(t){return t.altKey&&!(Oh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!e||e[0]!==this._model.selectionEnd[0]||e[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let e=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&e<x9&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=d9(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd,i=!!t&&!!e&&(t[0]!==e[0]||t[1]!==e[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(t,e,i);return}!t||!e||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||e[0]!==this._oldSelectionEnd[0]||e[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,e,i)}_fireOnSelectionChange(t,e,i){this._oldSelectionStart=t,this._oldSelectionEnd=e,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(t,e){let i=e;for(let r=0;e>=r;r++){let s=t.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&e!==r&&(i+=s-1)}return i}setSelection(t,e,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,e,i=!0,r=!0){if(t[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(t[1]);if(!n)return;let o=s.translateBufferLineToString(t[1],!1),a=this._convertViewportColToCharacterIndex(n,t[0]),l=a,c=t[0]-a,h=0,u=0,d=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let v=t[0],b=t[0];n.getWidth(v)===0&&(h++,v--),n.getWidth(b)===2&&(u++,b++);let S=n.getString(b).length;for(S>1&&(p+=S-1,l+=S-1);v>0&&a>0&&!this._isCharWordSeparator(n.loadCell(v-1,this._workCell));){n.loadCell(v-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,v--):k>1&&(d+=k-1,a-=k-1),a--,v--}for(;b<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(b+1,this._workCell));){n.loadCell(b+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,b++):k>1&&(p+=k-1,l+=k-1),l++,b++}}l++;let f=a+c-h+d,g=Math.min(this._bufferService.cols,l-a+h+u-d-p);if(!(!e&&o.slice(a,l).trim()==="")){if(i&&f===0&&n.getCodePoint(0)!==32){let v=s.lines.get(t[1]-1);if(v&&n.isWrapped&&v.getCodePoint(this._bufferService.cols-1)!==32){let b=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(b){let S=this._bufferService.cols-b.start;f-=S,g+=S}}}if(r&&f+g===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let v=s.lines.get(t[1]+1);if(v?.isWrapped&&v.getCodePoint(0)!==32){let b=this._getWordAt([0,t[1]+1],!1,!1,!0);b&&(g+=b.length)}}return{start:f,length:g}}}_selectWordAt(t,e){let i=this._getWordAt(t,e);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[i.start,t[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(t){let e=this._getWordAt(t,!0);if(e){let i=t[1];for(;e.start<0;)e.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;e.start+e.length>this._bufferService.cols;)e.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,i]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let e=this._bufferService.buffer.getWrappedRangeForLine(t),i={start:{x:0,y:e.first},end:{x:this._bufferService.cols-1,y:e.last}};this._model.selectionStart=[0,e.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Bv(i,this._bufferService.cols)}};Tf=Pt([Pe(3,vi),Pe(4,bn),Pe(5,Up),Pe(6,bi),Pe(7,cs),Pe(8,ls)],Tf);var Av=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},Rv=class{constructor(){this._color=new Av,this._css=new Av}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}},Nt=Object.freeze((()=>{let t=[wt.toColor("#2e3436"),wt.toColor("#cc0000"),wt.toColor("#4e9a06"),wt.toColor("#c4a000"),wt.toColor("#3465a4"),wt.toColor("#75507b"),wt.toColor("#06989a"),wt.toColor("#d3d7cf"),wt.toColor("#555753"),wt.toColor("#ef2929"),wt.toColor("#8ae234"),wt.toColor("#fce94f"),wt.toColor("#729fcf"),wt.toColor("#ad7fa8"),wt.toColor("#34e2e2"),wt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=e[i/36%6|0],s=e[i/6%6|0],n=e[i%6];t.push({css:Et.toCss(r,s,n),rgba:Et.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Et.toCss(r,r,r),rgba:Et.toRgba(r,r,r)})}return t})()),Gs=wt.toColor("#ffffff"),ua=wt.toColor("#000000"),Ev=wt.toColor("#ffffff"),Dv=ua,ta={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},k9=Gs,Mf=class extends Ke{constructor(t){super(),this._optionsService=t,this._contrastCache=new Rv,this._halfContrastCache=new Rv,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Gs,background:ua,cursor:Ev,cursorAccent:Dv,selectionForeground:void 0,selectionBackgroundTransparent:ta,selectionBackgroundOpaque:yt.blend(ua,ta),selectionInactiveBackgroundTransparent:ta,selectionInactiveBackgroundOpaque:yt.blend(ua,ta),scrollbarSliderBackground:yt.opacity(Gs,.2),scrollbarSliderHoverBackground:yt.opacity(Gs,.4),scrollbarSliderActiveBackground:yt.opacity(Gs,.5),overviewRulerBorder:Gs,ansi:Nt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(t={}){let e=this._colors;if(e.foreground=ut(t.foreground,Gs),e.background=ut(t.background,ua),e.cursor=yt.blend(e.background,ut(t.cursor,Ev)),e.cursorAccent=yt.blend(e.background,ut(t.cursorAccent,Dv)),e.selectionBackgroundTransparent=ut(t.selectionBackground,ta),e.selectionBackgroundOpaque=yt.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=ut(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=yt.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?ut(t.selectionForeground,Qv):void 0,e.selectionForeground===Qv&&(e.selectionForeground=void 0),yt.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=yt.opacity(e.selectionBackgroundTransparent,.3)),yt.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=yt.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=ut(t.scrollbarSliderBackground,yt.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=ut(t.scrollbarSliderHoverBackground,yt.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=ut(t.scrollbarSliderActiveBackground,yt.opacity(e.foreground,.5)),e.overviewRulerBorder=ut(t.overviewRulerBorder,k9),e.ansi=Nt.slice(),e.ansi[0]=ut(t.black,Nt[0]),e.ansi[1]=ut(t.red,Nt[1]),e.ansi[2]=ut(t.green,Nt[2]),e.ansi[3]=ut(t.yellow,Nt[3]),e.ansi[4]=ut(t.blue,Nt[4]),e.ansi[5]=ut(t.magenta,Nt[5]),e.ansi[6]=ut(t.cyan,Nt[6]),e.ansi[7]=ut(t.white,Nt[7]),e.ansi[8]=ut(t.brightBlack,Nt[8]),e.ansi[9]=ut(t.brightRed,Nt[9]),e.ansi[10]=ut(t.brightGreen,Nt[10]),e.ansi[11]=ut(t.brightYellow,Nt[11]),e.ansi[12]=ut(t.brightBlue,Nt[12]),e.ansi[13]=ut(t.brightMagenta,Nt[13]),e.ansi[14]=ut(t.brightCyan,Nt[14]),e.ansi[15]=ut(t.brightWhite,Nt[15]),t.extendedAnsi){let i=Math.min(e.ansi.length-16,t.extendedAnsi.length);for(let r=0;r<i;r++)e.ansi[r+16]=ut(t.extendedAnsi[r],Nt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(t){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Mf=Pt([Pe(0,bi)],Mf);function ut(t,e){if(t!==void 0)try{return wt.toColor(t)}catch{}return e}var C9=class{constructor(...t){this._entries=new Map;for(let[e,i]of t)this.set(e,i)}set(t,e){let i=this._entries.get(t);return this._entries.set(t,e),i}forEach(t){for(let[e,i]of this._entries.entries())t(e,i)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},$9=class{constructor(){this._services=new C9,this._services.set(jp,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=y8(t).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}},P9={trace:0,debug:1,info:2,warn:3,error:4,off:5},Q9="xterm.js: ",Bf=class extends Ke{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=P9[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":Q9)+e,...i)}trace(t,...e){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,e)}debug(t,...e){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,e)}info(t,...e){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,e)}warn(t,...e){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,e)}error(t,...e){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,e)}};Bf=Pt([Pe(0,bi)],Bf);var Lv=class extends Ke{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let e=new Array(t);for(let i=0;i<Math.min(t,this.length);i++)e[i]=this._array[this._getCyclicIndex(i)];this._array=e,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let e=this._length;e<t;e++)this._array[e]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,e){this._array[this._getCyclicIndex(t)]=e}push(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(t,e,...i){if(e){for(let r=t;r<this._length-e;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+e)];this._length-=e,this.onDeleteEmitter.fire({index:t,amount:e})}for(let r=this._length-1;r>=t;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(t+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:t,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,e,i){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=e-1;s>=0;s--)this.set(t+s+i,this.get(t+s));let r=t+e+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<e;r++)this.set(t+r+i,this.get(t+r))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Ge=3,Rt=Object.freeze(new Ol),cc=0,Wu=2,da=class Cx{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Ge);let s=i||Ji.fromCharData([0,F_,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*Ge+0],r=i&2097151;return[this._data[e*Ge+1],i&2097152?this._combined[e]:r?ws(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*Ge+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*Ge+0]=e|2097152|i[2]<<22):this._data[e*Ge+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*Ge+0]>>22}hasWidth(e){return this._data[e*Ge+0]&12582912}getFg(e){return this._data[e*Ge+1]}getBg(e){return this._data[e*Ge+2]}hasContent(e){return this._data[e*Ge+0]&4194303}getCodePoint(e){let i=this._data[e*Ge+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*Ge+0]&2097152}getString(e){let i=this._data[e*Ge+0];return i&2097152?this._combined[e]:i&2097151?ws(i&2097151):""}isProtected(e){return this._data[e*Ge+2]&536870912}loadCell(e,i){return cc=e*Ge,i.content=this._data[cc+0],i.fg=this._data[cc+1],i.bg=this._data[cc+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*Ge+0]=i.content,this._data[e*Ge+1]=i.fg,this._data[e*Ge+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*Ge+0]=i|r<<22,this._data[e*Ge+1]=s.fg,this._data[e*Ge+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*Ge+0];s&2097152?this._combined[e]+=ws(i):s&2097151?(this._combined[e]=ws(s&2097151)+ws(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*Ge+0]=s}insertCells(e,i,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new Ji;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,s));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new Ji;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return this._data.length*4*Wu<this._data.buffer.byteLength;let r=e*Ge;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,r*4*Wu<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Wu<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new Cx(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ge+0]&4194303)return e+(this._data[e*Ge+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ge+0]&4194303||this._data[e*Ge+2]&50331648)return e+(this._data[e*Ge+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let l=s-1;l>=0;l--){for(let c=0;c<Ge;c++)this._data[(r+l)*Ge+c]=o[(i+l)*Ge+c];o[(i+l)*Ge+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[i+l])}else for(let l=0;l<s;l++){for(let c=0;c<Ge;c++)this._data[(r+l)*Ge+c]=o[(i+l)*Ge+c];o[(i+l)*Ge+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[i+l])}let a=Object.keys(e._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=i&&(this._combined[c-i+r]=e._combined[c])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*Ge+0],a=o&2097151,l=o&2097152?this._combined[i]:a?ws(a):$s;if(n+=l,s)for(let c=0;c<l.length;++c)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function T9(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length-1;a++){let l=a,c=t.get(++l);if(!c.isWrapped)continue;let h=[t.get(a)];for(;l<t.length&&c.isWrapped;)h.push(c),c=t.get(++l);if(!n&&r>=a&&r<l){a+=h.length-1;continue}let u=0,d=Ka(h,u,e),p=1,f=0;for(;p<h.length;){let v=Ka(h,p,e),b=v-f,S=i-d,k=Math.min(b,S);h[u].copyCellsFrom(h[p],f,d,k,!1),d+=k,d===i&&(u++,d=0),f+=k,f===v&&(p++,f=0),d===0&&u!==0&&h[u-1].getWidth(i-1)===2&&(h[u].copyCellsFrom(h[u-1],i-1,d++,1,!1),h[u-1].setCell(i-1,s))}h[u].replaceCells(d,i,s);let g=0;for(let v=h.length-1;v>0&&(v>u||h[v].getTrimmedLength()===0);v--)g++;g>0&&(o.push(a+h.length-g),o.push(g)),a+=h.length-1}return o}function M9(t,e){let i=[],r=0,s=e[r],n=0;for(let o=0;o<t.length;o++)if(s===o){let a=e[++r];t.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,s=e[++r]}else i.push(o);return{layout:i,countRemoved:n}}function B9(t,e){let i=[];for(let r=0;r<e.length;r++)i.push(t.get(e[r]));for(let r=0;r<i.length;r++)t.set(r,i[r]);t.length=e.length}function A9(t,e,i){let r=[],s=t.map((l,c)=>Ka(t,c,e)).reduce((l,c)=>l+c),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let l=Ka(t,o,e);n>l&&(n-=l,o++);let c=t[o].getWidth(n-1)===2;c&&n--;let h=c?i-1:i;r.push(h),a+=h}return r}function Ka(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let r=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,s=t[e+1].getWidth(0)===2;return r&&s?i-1:i}var $x=class Px{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Px._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),On(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};$x._nextId=1;var R9=$x,Wt={},Ks=Wt.B;Wt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Wt.A={"#":"£"};Wt.B=void 0;Wt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Wt.C=Wt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Wt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Wt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Wt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Wt.E=Wt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Wt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Wt.H=Wt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Iv=4294967295,Nv=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Rt.clone(),this.savedCharset=Ks,this.markers=[],this._nullCell=Ji.fromCharData([0,F_,1,0]),this._whitespaceCell=Ji.fromCharData([0,$s,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new vh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Lv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ph),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ph),this._whitespaceCell}getBlankLine(t,e){return new da(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>Iv?Iv:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Rt);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Lv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(Rt),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new da(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new da(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=T9(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Rt),i);if(r.length>0){let s=M9(this.lines,r);B9(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(Rt),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new da(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Rt),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let k=this.ybase+this.y;if(k>=o&&k<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),h=A9(l,this._cols,t),u=h.length-l.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let p=[];for(let k=0;k<u;k++){let T=this.getBlankLine(Rt,!0);p.push(T)}p.length>0&&(s.push({start:o+l.length+n,newLines:p}),n+=p.length),l.push(...p);let f=h.length-1,g=h[f];g===0&&(f--,g=h[f]);let v=l.length-u-1,b=c;for(;v>=0;){let k=Math.min(b,g);if(l[f]===void 0)break;if(l[f].copyCellsFrom(l[v],b-k,g-k,k,!0),g-=k,g===0&&(f--,g=h[f]),b-=k,b===0){v--;let T=Math.max(v,0);b=Ka(l,T,this._cols)}}for(let k=0;k<l.length;k++)h[k]<t&&l[k].setCell(h[k],r);let S=u-d;for(;S-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+e-1)}if(s.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let l=this.lines.length,c=l-1,h=0,u=s[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let g=Math.min(this.lines.maxLength-1,l+n-1);g>=0;g--)if(u&&u.start>c+d){for(let v=u.newLines.length-1;v>=0;v--)this.lines.set(g--,u.newLines[v]);g++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=s[++h]}else this.lines.set(g,a[c--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].amount;let f=Math.max(0,l+n-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(t,e,i=0,r){let s=this.lines.get(t);return s?s.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new R9(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},E9=class extends Ke{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new we),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Nv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Nv(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(t,e){this._normal.resize(t,e),this._alt.resize(t,e),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},Qx=2,Tx=1,Af=class extends Ke{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,Qx),this.rows=Math.max(t.rawOptions.rows||0,Tx),this.buffers=this._register(new E9(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,r=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==t.fg||r.getBg(0)!==t.bg)&&(r=i.getBlankLine(t,e),this._cachedBlankLine=r),r.isWrapped=e;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),r!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};Af=Pt([Pe(0,bi)],Af);var An={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Oh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},D9=["normal","bold","100","200","300","400","500","600","700","800","900"],L9=class extends Ke{constructor(t){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let e={...An};for(let i in t)if(i in e)try{let r=t[i];e[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(xt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,e){return this.onOptionChange(i=>{i===t&&e(this.rawOptions[t])})}onMultipleOptionChange(t,e){return this.onOptionChange(i=>{t.indexOf(i)!==-1&&e()})}_setupOptions(){let t=i=>{if(!(i in An))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,r)=>{if(!(i in An))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:t.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(t,e){switch(t){case"cursorStyle":if(e||(e=An[t]),!I9(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=An[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=D9.includes(e)?e:An[t];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${t} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(`${t} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${t} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{};break}return e}};function I9(t){return t==="block"||t==="underline"||t==="bar"}function fa(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let r in t)i[r]=e<=1?t[r]:t[r]&&fa(t[r],e-1);return i}var zv=Object.freeze({insertMode:!1}),Zv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Rf=class extends Ke{constructor(t,e,i){super(),this._bufferService=t,this._logService=e,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=fa(zv),this.decPrivateModes=fa(Zv)}reset(){this.modes=fa(zv),this.decPrivateModes=fa(Zv)}triggerDataEvent(t,e=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;e&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),e&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(r=>r.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(t))}};Rf=Pt([Pe(0,vi),Pe(1,U_),Pe(2,bi)],Rf);var Xv={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Vu(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Fu=String.fromCharCode,Wv={DEFAULT:t=>{let e=[Vu(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Fu(e[0])}${Fu(e[1])}${Fu(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Vu(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Vu(t,!0)};${t.x};${t.y}${e}`}},Ef=class extends Ke{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Xv))this.addProtocol(r,Xv[r]);for(let r of Object.keys(Wv))this.addEncoding(r,Wv[r]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let r=e/i,s=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(t.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Ef=Pt([Pe(0,vi),Pe(1,bn),Pe(2,bi)],Ef);var Hu=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],N9=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],zt;function z9(t,e){let i=0,r=e.length-1,s;if(t<e[0][0]||t>e[r][1])return!1;for(;r>=i;)if(s=i+r>>1,t>e[s][1])i=s+1;else if(t<e[s][0])r=s-1;else return!0;return!1}var Z9=class{constructor(){if(this.version="6",!zt){zt=new Uint8Array(65536),zt.fill(1),zt[0]=0,zt.fill(0,1,32),zt.fill(0,127,160),zt.fill(2,4352,4448),zt[9001]=2,zt[9002]=2,zt.fill(2,11904,42192),zt[12351]=1,zt.fill(2,44032,55204),zt.fill(2,63744,64256),zt.fill(2,65040,65050),zt.fill(2,65072,65136),zt.fill(2,65280,65377),zt.fill(2,65504,65511);for(let t=0;t<Hu.length;++t)zt.fill(0,Hu[t][0],Hu[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?zt[t]:z9(t,N9)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),r=i===0&&e!==0;if(r){let s=an.extractWidth(e);s===0?r=!1:s>i&&(i=s)}return an.createPropertyValue(0,i,r)}},an=class Tc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let e=new Z9;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(e&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let c=e.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Tc.extractWidth(a);Tc.extractShouldJoin(a)&&(l-=Tc.extractWidth(r)),i+=l,r=a}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},X9=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function Vv(t){let e=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var ia=2147483647,W9=256,Mx=class Df{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>W9)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new Df;if(!e.length)return i;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let e=new Df(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>ia?ia:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>ia?ia:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+e,ia):e}},ra=[],V9=class{constructor(){this._state=0,this._active=ra,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ra}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=ra,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ra,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Nh(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e<i;){let r=t[e++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-e>0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=ra,this._id=-1,this._state=0}}},Ai=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Nh(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}},sa=[],F9=class{constructor(){this._handlers=Object.create(null),this._active=sa,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sa}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=sa,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||sa,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Nh(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=sa,this._ident=0}},pa=new Mx;pa.addParam(0);var Fv=class{constructor(t){this._handler=t,this._data="",this._params=pa,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():pa,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Nh(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=pa,this._data="",this._hitLimit=!1,i));return this._params=pa,this._data="",this._hitLimit=!1,e}},H9=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,r){this.table[e<<8|t]=i<<4|r}addMany(t,e,i,r){for(let s=0;s<t.length;s++)this.table[e<<8|t[s]]=i<<4|r}},Hi=160,q9=(function(){let t=new H9(4095),e=Array.apply(null,Array(256)).map((a,l)=>l),i=(a,l)=>e.slice(a,l),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(r,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(r,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(r,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(r,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Hi,0,2,0),t.add(Hi,8,5,8),t.add(Hi,6,0,6),t.add(Hi,11,0,11),t.add(Hi,13,13,13),t})(),Y9=class extends Ke{constructor(t=q9){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Mx,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(xt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new V9),this._dcsParser=this._register(new F9),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,e=[64,126]){let i=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=t.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<t.intermediates.length;++s){let n=t.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(t.final.length!==1)throw new Error("final must be a single byte");let r=t.final.charCodeAt(0);if(e[0]>r||r>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=r,i}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(t&255)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let i=this._identifier(t,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(e),{dispose:()=>{let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let i=this._identifier(t);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(e),{dispose:()=>{let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,e,i,r,s){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(t,e,i){let r=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=t[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=t[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<e;++a){switch(r=t[a],s=this._transitions.table[this.currentState<<8|(r<160?r:Hi)],s>>4){case 2:for(let d=a+1;;++d){if(d>=e||(r=t[d])<32||r>126&&r<Hi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Hi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Hi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Hi){this._printHandler(t,a,d),a=d-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,l,c,s,a),o;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++a<e&&(r=t[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let h=this._escHandlers[this._collect<<8|r],u=h?h.length-1:-1;for(;u>=0&&(o=h[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,h,u,s,a),o;u<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let d=a+1;;++d)if(d>=e||(r=t[d])===24||r===26||r===27||r>127&&r<Hi){this._dcsParser.put(t,a,d),a=d-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,a),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let d=a+1;;d++)if(d>=e||(r=t[d])<32||r>127&&r<Hi){this._oscParser.put(t,a,d),a=d-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,a),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},j9=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,U9=/^[\da-f]+$/;function Hv(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=j9.exec(e);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),U9.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function qu(t,e){let i=t.toString(16),r=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function G9(t,e=16){let[i,r,s]=t;return`rgb:${qu(i,e)}/${qu(r,e)}/${qu(s,e)}`}var K9={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ys=131072,qv=10;function Yv(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var jv=5e3,Uv=0,J9=class extends Ke{constructor(t,e,i,r,s,n,o,a,l=new Y9){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v8,this._utf8Decoder=new b8,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Rt.clone(),this._eraseAttrDataInternal=Rt.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Lf(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:u})}),this._parser.setDcsHandlerFallback((c,h,u)=>{h==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:u})}),this._parser.setPrintHandler((c,h,u)=>this.print(c,h,u)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(fe.BEL,()=>this.bell()),this._parser.setExecuteHandler(fe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(fe.BS,()=>this.backspace()),this._parser.setExecuteHandler(fe.HT,()=>this.tab()),this._parser.setExecuteHandler(fe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(fe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Pc.IND,()=>this.index()),this._parser.setExecuteHandler(Pc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Pc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ai(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Ai(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Ai(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Ai(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Ai(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Ai(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Ai(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Ai(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Ai(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Ai(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Ai(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Ai(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in Wt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Fv((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),jv))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${jv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>ys&&(n=this._parseStack.position+ys)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(c=>c.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<ys&&(this._parseBuffer=new Uint32Array(Math.min(t.length,ys))),o||this._dirtyRowTracker.clearRange(),t.length>ys)for(let c=n;c<t.length;c+=ys){let h=c+ys<t.length?c+ys:t.length,u=typeof t=="string"?this._stringDecoder.decode(t.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(t.subarray(c,h),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,c),this._logSlowResolvingAsync(i),i}else if(!o){let c=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(t,e,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let p=e;p<i;++p){if(r=t[p],r<127&&n){let b=n[String.fromCharCode(r)];b&&(r=b.charCodeAt(0))}let f=this._unicodeService.charProperties(r,d);s=an.extractWidth(f);let g=an.extractShouldJoin(f),v=g?an.extractWidth(d):0;if(d=f,o&&this._onA11yChar.fire(ws(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-v>a){if(l){let b=u,S=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&u instanceof da&&u.copyCellsFrom(b,S,0,v,!1);S<a;)b.setCellFromCodepoint(S++,0,1,h)}else if(this._activeBuffer.x=a-1,s===2)continue}if(g&&this._activeBuffer.x){let b=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-b,r,s);for(let S=s-v;--S>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,s-v,this._activeBuffer.getNullCell(h)),u.getWidth(a-1)===2&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-e>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>Yv(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new Fv(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ai(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Rt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,r=an.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let h=n.codePointAt(c)||0;o[a++]=h,c+=h>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(fe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(fe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(fe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(fe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(fe.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ks),this._charsetService.setgCharset(1,Ks),this._charsetService.setgCharset(2,Ks),this._charsetService.setgCharset(3,Ks);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){let i;(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:h}=a,u=this._optionsService.rawOptions,d=(g,v)=>(o.triggerDataEvent(`${fe.ESC}[${e?"":"?"}${g};${v}$y`),!0),p=g=>g?1:2,f=t.params[0];return e?f===2?d(f,4):f===4?d(f,p(o.modes.insertMode)):f===12?d(f,3):f===20?d(f,p(u.convertEol)):d(f,0):f===1?d(f,p(r.applicationCursorKeys)):f===3?d(f,u.windowOptions.setWinLines?l===80?2:l===132?1:0:0):f===6?d(f,p(r.origin)):f===7?d(f,p(r.wraparound)):f===8?d(f,3):f===9?d(f,p(s==="X10")):f===12?d(f,p(u.cursorBlink)):f===25?d(f,p(!o.isCursorHidden)):f===45?d(f,p(r.reverseWraparound)):f===66?d(f,p(r.applicationKeypad)):f===67?d(f,4):f===1e3?d(f,p(s==="VT200")):f===1002?d(f,p(s==="DRAG")):f===1003?d(f,p(s==="ANY")):f===1004?d(f,p(r.sendFocus)):f===1005?d(f,4):f===1006?d(f,p(n==="SGR")):f===1015?d(f,4):f===1016?d(f,p(n==="SGR_PIXELS")):f===1048?d(f,1):f===47||f===1047||f===1049?d(f,p(c===h)):f===2004?d(f,p(r.bracketedPasteMode)):f===2026?d(f,p(r.synchronizedOutput)):d(f,0)}_updateAttrColor(t,e,i,r,s){return e===2?(t|=50331648,t&=-16777216,t|=Ol.fromColorRGB([i,r,s])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),a=0;do r[1]===5&&(s=1),r[n+a+1+s]=o[a];while(++a<o.length&&a+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<t.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=Rt.fg,t.bg=Rt.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,r=this._curAttrData;for(let s=0;s<e;s++)i=t.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(t.hasSubParams(s)?t.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Rt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Rt.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(t,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Rt.fg&16777215,r.bg&=-67108864,r.bg|=Rt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${fe.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){if(t.params[0]===6){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[?${e};${i}R`)}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Rt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Yv(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${fe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qv&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qv&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(Gv(n))if(s==="?")e.push({type:0,index:n});else{let o=Hv(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),r=t.slice(e+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let r=0;r<i.length&&!(e>=this._specialColors.length);++r,++e)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=Hv(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);Gv(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Ks),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(K9[t[0]],Wt[t[1]]||Ks),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Rt.clone(),this._eraseAttrDataInternal=Rt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new Ji;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(i);r&&(r.fill(t),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${fe.ESC}${o}${fe.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Lf=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Uv=t,t=e,e=Uv),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Lf=Pt([Pe(0,vi)],Lf);function Gv(t){return 0<=t&&t<256}var eN=5e7,Kv=12,tN=50,iN=class extends Ke{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,e){if(this._pendingData>eN)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e)}_innerWrite(t=0,e=!0){let i=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,e);if(s){let o=a=>performance.now()-i>=Kv?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);s.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=Kv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>tN&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},If=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let a=e.addMarker(e.ybase+e.y),l={data:t,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let i=t,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,e.ybase+e.y),s.id;let n=e.addMarker(e.ybase+e.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(r=>r.line!==e)){let r=this._bufferService.buffer.addMarker(e);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};If=Pt([Pe(0,vi)],If);var Jv=!1,rN=class extends Ke{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new co),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new $9,this.optionsService=this._register(new L9(t)),this._instantiationService.setService(bi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Af)),this._instantiationService.setService(vi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Bf)),this._instantiationService.setService(U_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Rf)),this._instantiationService.setService(bn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ef)),this._instantiationService.setService(j_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(an)),this._instantiationService.setService(S8,this.unicodeService),this._charsetService=this._instantiationService.createInstance(X9),this._instantiationService.setService(x8,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(If),this._instantiationService.setService(G_,this._oscLinkService),this._inputHandler=this._register(new J9(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ri.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ri.forward(this._bufferService.onResize,this._onResize)),this._register(ri.forward(this.coreService.onData,this._onData)),this._register(ri.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new iN((e,i)=>this._inputHandler.parse(e,i))),this._register(ri.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),this._onScroll.event(t=>{this._onScrollApi?.fire(t.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(t){for(let e in t)this.optionsService.options[e]=t[e]}write(t,e){this._writeBuffer.write(t,e)}writeSync(t,e){this._logService.logLevel<=3&&!Jv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Jv=!0),this._writeBuffer.writeSync(t,e)}input(t,e=!0){this.coreService.triggerDataEvent(t,e)}resize(t,e){isNaN(t)||isNaN(e)||(t=Math.max(t,Qx),e=Math.max(e,Tx),this._bufferService.resize(t,e))}scroll(t,e=!1){this._bufferService.scroll(t,e)}scrollLines(t,e){this._bufferService.scrollLines(t,e)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(t,e){return this._inputHandler.registerEscHandler(t,e)}registerDcsHandler(t,e){return this._inputHandler.registerDcsHandler(t,e)}registerCsiHandler(t,e){return this._inputHandler.registerCsiHandler(t,e)}registerOscHandler(t,e){return this._inputHandler.registerOscHandler(t,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?t=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(Vv.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(Vv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xt(()=>{for(let e of t)e.dispose()})}}},sN={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function nN(t,e,i,r){let s={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=fe.ESC+"OA":s.key=fe.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=fe.ESC+"OD":s.key=fe.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=fe.ESC+"OC":s.key=fe.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=fe.ESC+"OB":s.key=fe.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":fe.DEL,t.altKey&&(s.key=fe.ESC+s.key);break;case 9:if(t.shiftKey){s.key=fe.ESC+"[Z";break}s.key=fe.HT,s.cancel=!0;break;case 13:s.key=t.altKey?fe.ESC+fe.CR:fe.CR,s.cancel=!0;break;case 27:s.key=fe.ESC,t.altKey&&(s.key=fe.ESC+fe.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=fe.ESC+"[1;"+(n+1)+"D":e?s.key=fe.ESC+"OD":s.key=fe.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=fe.ESC+"[1;"+(n+1)+"C":e?s.key=fe.ESC+"OC":s.key=fe.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=fe.ESC+"[1;"+(n+1)+"A":e?s.key=fe.ESC+"OA":s.key=fe.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=fe.ESC+"[1;"+(n+1)+"B":e?s.key=fe.ESC+"OB":s.key=fe.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=fe.ESC+"[2~");break;case 46:n?s.key=fe.ESC+"[3;"+(n+1)+"~":s.key=fe.ESC+"[3~";break;case 36:n?s.key=fe.ESC+"[1;"+(n+1)+"H":e?s.key=fe.ESC+"OH":s.key=fe.ESC+"[H";break;case 35:n?s.key=fe.ESC+"[1;"+(n+1)+"F":e?s.key=fe.ESC+"OF":s.key=fe.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=fe.ESC+"[5;"+(n+1)+"~":s.key=fe.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=fe.ESC+"[6;"+(n+1)+"~":s.key=fe.ESC+"[6~";break;case 112:n?s.key=fe.ESC+"[1;"+(n+1)+"P":s.key=fe.ESC+"OP";break;case 113:n?s.key=fe.ESC+"[1;"+(n+1)+"Q":s.key=fe.ESC+"OQ";break;case 114:n?s.key=fe.ESC+"[1;"+(n+1)+"R":s.key=fe.ESC+"OR";break;case 115:n?s.key=fe.ESC+"[1;"+(n+1)+"S":s.key=fe.ESC+"OS";break;case 116:n?s.key=fe.ESC+"[15;"+(n+1)+"~":s.key=fe.ESC+"[15~";break;case 117:n?s.key=fe.ESC+"[17;"+(n+1)+"~":s.key=fe.ESC+"[17~";break;case 118:n?s.key=fe.ESC+"[18;"+(n+1)+"~":s.key=fe.ESC+"[18~";break;case 119:n?s.key=fe.ESC+"[19;"+(n+1)+"~":s.key=fe.ESC+"[19~";break;case 120:n?s.key=fe.ESC+"[20;"+(n+1)+"~":s.key=fe.ESC+"[20~";break;case 121:n?s.key=fe.ESC+"[21;"+(n+1)+"~":s.key=fe.ESC+"[21~";break;case 122:n?s.key=fe.ESC+"[23;"+(n+1)+"~":s.key=fe.ESC+"[23~";break;case 123:n?s.key=fe.ESC+"[24;"+(n+1)+"~":s.key=fe.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=fe.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=fe.DEL:t.keyCode===219?s.key=fe.ESC:t.keyCode===220?s.key=fe.FS:t.keyCode===221&&(s.key=fe.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let o=sN[t.keyCode]?.[t.shiftKey?1:0];if(o)s.key=fe.ESC+o;else if(t.keyCode>=65&&t.keyCode<=90){let a=t.ctrlKey?t.keyCode-64:t.keyCode+32,l=String.fromCharCode(a);t.shiftKey&&(l=l.toUpperCase()),s.key=fe.ESC+l}else if(t.keyCode===32)s.key=fe.ESC+(t.ctrlKey?fe.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let a=t.code.slice(3,4);t.shiftKey||(a=a.toLowerCase()),s.key=fe.ESC+a,s.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=fe.US),t.key==="@"&&(s.key=fe.NUL));break}return s}var Qt=0,oN=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new vh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new vh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((s,n)=>this._getKey(s)-this._getKey(n)),e=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(r[s]=t[e],e++):r[s]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(Qt=this._search(e),Qt===-1)||this._getKey(this._array[Qt])!==e)return!1;do if(this._array[Qt]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Qt),!0;while(++Qt<this._array.length&&this._getKey(this._array[Qt])===e);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((s,n)=>s-n),e=0,i=new Array(this._array.length-t.length),r=0;for(let s=0;s<this._array.length;s++)t[e]===s?e++:i[r++]=this._array[s];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Qt=this._search(t),!(Qt<0||Qt>=this._array.length)&&this._getKey(this._array[Qt])===t))do yield this._array[Qt];while(++Qt<this._array.length&&this._getKey(this._array[Qt])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Qt=this._search(t),!(Qt<0||Qt>=this._array.length)&&this._getKey(this._array[Qt])===t))do e(this._array[Qt]);while(++Qt<this._array.length&&this._getKey(this._array[Qt])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let e=0,i=this._array.length-1;for(;i>=e;){let r=e+i>>1,s=this._getKey(this._array[r]);if(s>t)i=r-1;else if(s<t)e=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===t;)r--;return r}}return e}},Yu=0,e0=0,aN=class extends Ke{constructor(){super(),this._decorations=new oN(t=>t?.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new lN(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),t>=r&&t<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,r){this._decorations.forEachByKey(e,s=>{Yu=s.options.x??0,e0=Yu+(s.options.width??1),t>=Yu&&t<e0&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},lN=class extends Ts{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=wt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=wt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},cN=1e3,hN=class{constructor(t,e=cN){this._renderCallback=t,this._debounceThresholdMS=e,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}},t0=20,bh=class extends Ke{constructor(t,e,i,r){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new hN(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
79
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(We(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<t0+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
|
|
80
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===t0+1&&(this._liveRegion.textContent+=sf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=t;s<=e;s++){let n=i.lines.get(i.ydisp+s),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",l=(i.ydisp+s+1).toString(),c=this._rowElements[s];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||t.relatedTarget!==r)return;let o,a;if(e===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let s=({node:a,offset:l})=>{let c=a instanceof Text?a.parentNode:a,h=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(c);if(!u)return console.warn("columns is null. Race condition?"),null;let d=l<u.length?u[l]:u.slice(-1)[0]+1;return d>=this._terminal.cols&&(++h,d=0),{row:h,column:d}},n=s(e),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){t.style.transform="";let e=t.getBoundingClientRect().width,i=this._rowColumns.get(t)?.slice(-1)?.[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${r/e})`}};bh=Pt([Pe(1,jp),Pe(2,ls),Pe(3,cs)],bh);var Nf=class extends Ke{constructor(t,e,i,r,s){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xt(()=>{On(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(We(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(We(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(We(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(We(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){(!this._activeProviderReplies||!e)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(s=>{s.link.dispose&&s.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[r,s]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(r)&&(i=this._checkLinkProviderResult(r,t,i)):s.provideLinks(t.y,n=>{if(this._isMouseOut)return;let o=n?.map(a=>({link:a}));this._activeProviderReplies?.set(r,o),i=this._checkLinkProviderResult(r,t,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],a=o.link.range.start.y<t?0:o.link.range.start.x,l=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(i.has(c)){s.splice(n--,1);break}i.add(c)}}}}_checkLinkProviderResult(t,e,i){if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(t),s=!1;for(let n=0;n<t;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(s=!0);if(!s&&r){let n=r.find(o=>this._linkAtPosition(o.link,e));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find(a=>this._linkAtPosition(a.link,e));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&uN(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,On(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,r=t.range.end.y*this._bufferService.cols+t.range.end.x,s=e.y*this._bufferService.cols+e.x;return i<=s&&s<=r}_positionFromMouseEvent(t,e,i){let r=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,r,s){return{x1:t,y1:e,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};Nf=Pt([Pe(1,Up),Pe(2,cs),Pe(3,vi),Pe(4,J_)],Nf);function uN(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var dN=class extends rN{constructor(t={}){super(t),this._linkifier=this._register(new co),this.browser=vx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new co),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(aN),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(t9),this._instantiationService.setService(J_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(of)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(ri.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ri.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ri.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ri.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(xt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(t){if(this._themeService)for(let e of t){let i,r="";switch(e.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+e.index}switch(e.type){case 0:let s=yt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[e.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${fe.ESC}]${r};${G9(s)}${gx.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[e.index]=Et.toColor(...e.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Et.toColor(...e.color))}break;case 2:this._themeService.restoreColor(e.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(t){t?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(bh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(fe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(fe.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let t=this.buffer.ybase+this.buffer.y,e=this.buffer.lines.get(t);if(!e)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=e.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(We(this.element,"copy",e=>{this.hasSelection()&&g8(e,this._selectionService)}));let t=e=>O8(e,this.textarea,this.coreService,this.optionsService);this._register(We(this.textarea,"paste",t)),this._register(We(this.element,"paste",t)),bx?this._register(We(this.element,"mousedown",e=>{e.button===2&&uv(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(We(this.element,"contextmenu",e=>{uv(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),sm&&this._register(We(this.element,"auxclick",e=>{e.button===1&&V_(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(We(this.textarea,"keyup",t=>this._keyUp(t),!0)),this._register(We(this.textarea,"keydown",t=>this._keyDown(t),!0)),this._register(We(this.textarea,"keypress",t=>this._keyPress(t),!0)),this._register(We(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(We(this.textarea,"compositionupdate",t=>this._compositionHelper.compositionupdate(t))),this._register(We(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(We(this.textarea,"input",t=>this._inputEvent(t),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(t){if(!t)throw new Error("Terminal requires a parent element.");if(t.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=t.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),t.appendChild(this.element);let e=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),e.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(We(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),e.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",rf.get()),xx||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(JI,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ls,this._coreBrowserService),this._register(We(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(We(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance($f,this._document,this._helperContainer),this._instantiationService.setService(zh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Mf),this._instantiationService.setService(go,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(gh),this._instantiationService.setService(K_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Qf,this.rows,this.screenElement)),this._instantiationService.setService(cs,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Pf),this._instantiationService.setService(Up,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Nf,this.screenElement));this.element.appendChild(e);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(xf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Tf,this.element,this.screenElement,r)),this._instantiationService.setService(k8,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(ri.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Sf,this.screenElement)),this._register(We(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(bh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Cf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let t=this,e=this.element;function i(n){let o=t._mouseService.getMouseReportCoords(n,t.screenElement);if(!o)return!1;let a,l;switch(n.overrideType||n.type){case"mousemove":l=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":l=0,a=n.button<3?n.button:3;break;case"mousedown":l=1,a=n.button<3?n.button:3;break;case"wheel":if(t._customWheelEventHandler&&t._customWheelEventHandler(n)===!1)return!1;let c=n.deltaY;if(c===0||t.coreMouseService.consumeWheelEvent(n,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return!1;l=c<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:t.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),n&8?r.mousemove||(e.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(e.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(e.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(e.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(We(e,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(We(e,"wheel",n=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(t.coreMouseService.consumeWheelEvent(n,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return this.cancel(n,!0);let o=fe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(o,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(t,e){this._renderService?.refreshRows(t,e)}updateCursorStyle(t){this._selectionService?.shouldColumnSelect(t)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(t,e){this._viewport?this._viewport.scrollLines(t):super.scrollLines(t,e),this.refresh(0,this.rows-1)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){t&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}paste(t){W_(t,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(t){this._customKeyEventHandler=t}attachCustomWheelEventHandler(t){this._customWheelEventHandler=t}registerLinkProvider(t){return this._linkProviderService.registerLinkProvider(t)}registerCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let e=this._characterJoinerService.register(t);return this.refresh(0,this.rows-1),e}deregisterCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(t)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(t){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+t)}registerDecoration(t){return this._decorationService.registerDecoration(t)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(t,e,i){this._selectionService.setSelection(t,e,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(t,e){this._selectionService?.selectLines(t,e)}_keyDown(t){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;let e=this.browser.isMac&&this.options.macOptionIsMeta&&t.altKey;if(!e&&!this._compositionHelper.keydown(t))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!e&&(t.key==="Dead"||t.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=nN(t,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(t),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(t,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,t)||(i.cancel&&this.cancel(t,!0),!i.key)||t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1&&t.key.charCodeAt(0)>=65&&t.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===fe.ETX||i.key===fe.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||t.altKey||t.ctrlKey)return this.cancel(t,!0);this._keyDownHandled=!0}_isThirdLevelShift(t,e){let i=t.isMac&&!this.options.macOptionIsMeta&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.isWindows&&e.altKey&&e.ctrlKey&&!e.metaKey||t.isWindows&&e.getModifierState("AltGraph");return e.type==="keypress"?i:i&&(!e.keyCode||e.keyCode>47)}_keyUp(t){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)&&(fN(t)||this.focus(),this.updateCursorStyle(t),this._keyPressHandled=!1)}_keyPress(t){let e;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;if(this.cancel(t),t.charCode)e=t.charCode;else if(t.which===null||t.which===void 0)e=t.keyCode;else if(t.which!==0&&t.charCode!==0)e=t.which;else return!1;return!e||(t.altKey||t.ctrlKey||t.metaKey)&&!this._isThirdLevelShift(this.browser,t)?!1:(e=String.fromCharCode(e),this._onKey.fire({key:e,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(e,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(t){if(t.data&&t.inputType==="insertText"&&(!t.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let e=t.data;return this.coreService.triggerDataEvent(e,!0),this.cancel(t),!0}return!1}resize(t,e){if(t===this.cols&&e===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(t,e)}_afterResize(t,e){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let t=1;t<this.rows;t++)this.buffer.lines.push(this.buffer.getBlankLine(Rt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(fe.ESC+"[I"):this.coreService.triggerDataEvent(fe.ESC+"[O")}_reportWindowsOptions(t){if(this._renderService)switch(t){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[4;${i};${e}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[6;${s};${r}t`);break}}cancel(t,e){if(!(!this.options.cancelEvents&&!e))return t.preventDefault(),t.stopPropagation(),!1}};function fN(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var pN=class{constructor(){this._addons=[]}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===t){e=i;break}if(e===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=!0,t.dispose.apply(t.instance),this._addons.splice(e,1)}},mN=class{constructor(t){this._line=t}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,e){if(!(t<0||t>=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new Ji)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}},i0=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new mN(e)}getNullCell(){return new Ji}},gN=class extends Ke{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new i0(this._core.buffers.normal,"normal"),this._alternate=new i0(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},ON=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},vN=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}},bN=["cols","rows"],wr=0,Bx=class extends Ke{constructor(t){super(),this._core=this._register(new dN(t)),this._addonManager=this._register(new pN),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(t){if(bN.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new ON(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new vN(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new gN(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
81
|
-
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return rf.get()},set promptLabel(t){rf.set(t)},get tooMuchOutput(){return sf.get()},set tooMuchOutput(t){sf.set(t)}}}_verifyIntegers(...t){for(wr of t)if(wr===1/0||isNaN(wr)||wr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(wr of t)if(wr&&(wr===1/0||isNaN(wr)||wr%1!==0||wr<0))throw new Error("This API only accepts positive integers")}};var yN=2,_N=1,xN=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,c=r-a,h=s-l-e;return{cols:Math.max(yN,Math.floor(h/t.css.cell.width)),rows:Math.max(_N,Math.floor(c/t.css.cell.height))}}};const SN={class:"h-full min-h-0 flex flex-col bg-retro-black"},wN={class:"flex-shrink-0 h-9 flex items-center justify-between gap-3 px-3 border-b border-retro-border bg-retro-dark"},kN={class:"min-w-0 flex items-center gap-2 text-[11px] font-mono"},CN={class:"truncate text-retro-muted"},$N=Xe({__name:"TerminalPanel",props:{disabled:{type:Boolean}},setup(t,{expose:e}){const i={background:"#050807",foreground:"#d8f3dc",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#050807",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#38bdf8",magenta:"#d946ef",cyan:"#22d3ee",white:"#d8f3dc",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fde047",brightBlue:"#7dd3fc",brightMagenta:"#e879f9",brightCyan:"#67e8f9",brightWhite:"#f8fafc"},r={background:"#ffffff",foreground:"#1f2328",cursor:"#0969da",selectionBackground:"#b6e3ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#7d4e00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"};function s(F){return F?i:r}const n=t,o=ur(),{isDark:a}=Zf(),l=A(null),c=ma(null),h=ma(null),u=ma(null),d=A("idle"),p=A(""),f=A(""),g=A(null),v=A(null),b=new Map,S=new Map;let k=null,T=null,$=0,R="",D="",U="",ce=null;const he=new Map,W=new Map,M=ae(()=>o.activeConversationId||"none"),x=ae(()=>{const F=o.activeConversation;return F?.worktreePath||F?.cwd||o.cwd||""});function V(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal-ws`}function N(){const F=c.value,pe=h.value,me=u.value;if(!(!F||!pe))try{pe.fit(),me?.readyState===WebSocket.OPEN&&me.send(JSON.stringify({type:"resize",cols:F.cols,rows:F.rows}))}catch{}}function K(){ai(()=>{c.value?.focus()})}e({focusTerminal:K});function te(){return o.activeConversationId||null}function G(F){c.value?.writeln(`\x1B[33m${F}\x1B[0m`)}function be(F){return F.replace(/\r\n/g,`
|
|
82
|
-
`).replace(/\r/g,`
|
|
83
|
-
`)}function ie(F,pe,me){const De=c.value;if(!De||!pe)return;const ct=be(pe);if(F.role==="user"){me&&De.write(`\r
|
|
84
|
-
\x1B[36m> ${ct}\x1B[0m\r
|
|
85
|
-
`);return}me&&De.write(`\r
|
|
86
|
-
`),De.write(ct)}function q(F=!1){const pe=c.value,me=o.activeConversation;if(!(!pe||!me)&&!(me.source==="user"&&me.finalized!==!0)){(F||k!==me.id)&&(S.clear(),k=me.id);for(const De of me.messages){const ct=De.content||"",Ct=S.get(De.id)??0;if(ct.length<=Ct)continue;const pt=ct.slice(Ct);ie(De,pt,Ct===0),S.set(De.id,ct.length)}}}function re(F){let pe=Jx(F).replace(/\r\n/g,`
|
|
87
|
-
`).replace(/\r/g,`
|
|
88
|
-
`).replace(/\u0007/g,"");for(;pe.includes("\b");)pe=pe.replace(/[^\n]?\b/g,"");if(D){const me=D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");pe=pe.replace(new RegExp(`^\\s*>?\\s*${me}\\s*\\n?`),"").replace(new RegExp(`\\n\\s*>?\\s*${me}\\s*\\n?`),`
|
|
89
|
-
`)}return pe}function H(F){return F.split(`
|
|
90
|
-
`).some(pe=>pe.trim().length>0&&pe.trim()!==">")}function j(F){const pe=he.get(F);pe&&clearTimeout(pe),he.delete(F);const me=W.get(F);me&&clearTimeout(me),W.delete(F)}function ee(F){v.value=F,g.value=F&&b.get(F)||null}function _e(F){const pe=o.conversations.find(De=>De.id===F);if(!pe)return;let me=!1;for(const De of pe.messages)De.role==="assistant"&&De.status==="streaming"&&(o.updateMessage(De.id,{status:"complete"},F),me=!0);me&&o.saveConversation(F,!0)}function Le(F){if(!F)return;const pe=b.get(F);if(!F||!pe){v.value===F&&ee(null);return}j(F),o.completeMessageWithSave(pe,F),Ue(F),b.delete(F),v.value===F&&ee(null)}function Ne(){Le(v.value||o.activeConversationId)}function Je(F){const pe=he.get(F);pe&&clearTimeout(pe);const me=setTimeout(()=>{Le(F)},2500);he.set(F,me)}function st(F){const pe=b.get(F);if(pe)return o.updateMessage(pe,{status:"complete"},F),ee(F),pe;const me=o.addAssistantMessage(F);o.updateMessage(me.id,{status:"complete"},F),b.set(F,me.id),ee(F),o.saveConversation(F);const De=W.get(F);De&&clearTimeout(De);const ct=setTimeout(()=>{B(),Le(F)},300*1e3);return W.set(F,ct),me.id}function Ue(F){const pe=o.conversations.find(me=>me.id===F);!pe?.hasWorktree||!pe.worktreePath||$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:pe.worktreePath,conversationId:F,previousBranch:pe.worktreeBranch}}).then(me=>me?.success&&pe.previewBranch&&pe.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:pe.previewBranch,worktreePath:pe.worktreePath}}).then(De=>{if(!De.success)throw new Error(De.error||"Unknown preview sync failure");return me}):me).then(async me=>{me?.success&&(me.currentBranch&&me.currentBranch!==pe.worktreeBranch?(o.updateWorktreeBranch(F,me.currentBranch),await o.syncConversationFeatureFromBranch(F)):pe.worktreeBranch&&o.updateWorktreeBranch(F,pe.worktreeBranch),o.saveConversation(F,!1))}).catch(me=>{console.warn("[TerminalPanel] Auto-commit/preview-sync failed:",me)})}function B(){ce&&(clearTimeout(ce),ce=null);const F=U;if(U="",!F||!H(F))return;const pe=v.value||o.activeConversationId;if(!pe)return;const me=st(pe);o.appendToMessageWithSave(me,F,pe),Je(pe)}function w(F){if(!g.value)return;const pe=re(F);pe&&(U+=pe,ce&&clearTimeout(ce),ce=setTimeout(B,120))}function L(F){const pe=F.trim();if(R="",!pe)return;Ne(),D=pe;const me=o.activeConversationId;me&&(o.addUserMessage(pe,me),o.saveConversation(me,!0),st(me))}function P(F){const pe=Kx(F);for(const me of pe){if(me===""){R="",Ne();continue}if(me==="\r"||me===`
|
|
91
|
-
`){L(R);continue}if(me==="\b"||me===""){R=R.slice(0,-1);continue}me>=" "&&me!=="\x1B"&&(R+=me)}}function Y(F){return new Promise(pe=>setTimeout(pe,F))}async function de(F){const pe=Date.now();for(;Date.now()-pe<1e4;){const me=o.activeConversation;if(!me||me.id!==F||me.worktreePath||me.hasWorktree)return;const De=new Date(me.createdAt).getTime();if(Number.isFinite(De)&&Date.now()-De>15e3)return;await Y(150)}}function X(){const F=u.value;F&&F.readyState!==WebSocket.CLOSING&&F.readyState!==WebSocket.CLOSED&&F.close(),u.value=null}async function xe(){const F=++$,pe=c.value;if(!pe)return;B(),X(),d.value="connecting",p.value="Connecting terminal...";const me=te();if(!me||F!==$){ee(null),d.value="idle",p.value="Create or select a conversation to start Claude.";return}if(o.activeConversation?.finalized===!0){ee(null),pe.clear(),q(!0),d.value="closed",p.value="Finalized conversation — read-only transcript.";return}if(_e(me),ee(me),await de(me),F!==$)return;const De=V();if(!De)return;pe.clear(),q(!0);const ct=new WebSocket(De);u.value=ct,ct.onopen=()=>{if(F!==$)return;N();const Ct=o.activeConversation;ct.send(JSON.stringify({type:"start",conversationId:me,cwd:x.value,featureId:Ct?.featureId,baseBranch:Ct?.baseBranch,providerId:Ct?.providerId,providerModelKey:Ct?.providerModelKey,cols:pe.cols,rows:pe.rows}))},ct.onmessage=Ct=>{const pt=JSON.parse(Ct.data);if(pt.type==="started"){d.value="connected",f.value=pt.cwd||"",p.value=pt.cwd?`Terminal attached: ${pt.cwd}`:"Terminal attached",pt.hasWorktree&&o.updateConversationWorktree(me,{worktreePath:pt.cwd,worktreeBranch:pt.worktreeBranch,baseBranch:pt.baseBranch});return}if(pt.type==="data"||pt.type==="replay"){pt.data&&pe.write(pt.data),pt.type==="data"&&pt.data&&w(pt.data);return}if(pt.type==="exit"){d.value="closed",p.value=`Terminal exited with code ${pt.exitCode??0}`,B(),Le(me),G(p.value);return}pt.type==="error"&&(d.value="error",p.value=pt.error||"Terminal error",G(p.value))},ct.onerror=()=>{F===$&&(d.value="error",p.value="Terminal connection error")},ct.onclose=()=>{F===$&&(d.value==="connecting"||d.value==="connected")&&(d.value="closed",p.value="Terminal connection closed")}}return kt(async()=>{if(!l.value)return;const F=new Bx({cursorBlink:!0,convertEol:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:1.25,scrollback:5e3,theme:s(a.value)}),pe=new xN;F.loadAddon(pe),F.open(l.value),F.onData(me=>{if(n.disabled)return;P(me);const De=u.value;De?.readyState===WebSocket.OPEN&&De.send(JSON.stringify({type:"input",data:me}))}),c.value=F,h.value=pe,T=new ResizeObserver(()=>N()),T.observe(l.value),await ai(),N(),await xe()}),He(a,F=>{c.value&&(c.value.options.theme=s(F))}),He(M,()=>{if(c.value){if(!o.activeConversationId){$++,B(),ee(null),X(),c.value.clear(),f.value="",d.value="idle",p.value="Create or select a conversation to start Claude.";return}xe()}}),He(()=>{const F=o.activeConversation;return!F||F.source==="user"&&F.finalized!==!0?"":F.messages.map(pe=>`${pe.id}:${pe.content.length}:${pe.status??""}`).join("|")},()=>{q()}),si(()=>{$++,T&&(T.disconnect(),T=null),X(),B();for(const F of he.values())clearTimeout(F);he.clear();for(const F of W.values())clearTimeout(F);W.clear(),c.value?.dispose(),c.value=null,h.value=null}),(F,pe)=>(y(),_("div",SN,[m("div",wN,[m("div",kN,[oe(O(g0),{class:"w-4 h-4 text-retro-cyan flex-shrink-0"}),m("span",{class:Ee(["w-2 h-2 rounded-full flex-shrink-0",{"bg-retro-green":O(d)==="connected","bg-retro-yellow animate-pulse":O(d)==="connecting","bg-retro-red":O(d)==="error","bg-retro-muted":O(d)==="idle"||O(d)==="closed"}])},null,2),m("span",CN,I(O(f)||O(p)||"Terminal"),1)])]),m("div",{ref_key:"terminalEl",ref:l,class:"terminal-host flex-1 min-h-0 w-full overflow-hidden"},null,512)]))}}),PN=ns($N,[["__scopeId","data-v-526cbd8b"]]),QN={class:"live-terminal-host h-full min-h-0 w-full overflow-auto"},TN=Xe({__name:"LiveTerminalView",props:{sessionId:{}},setup(t){const e={background:"#050807",foreground:"#d8f3dc",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#050807",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#38bdf8",magenta:"#d946ef",cyan:"#22d3ee",white:"#d8f3dc",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fde047",brightBlue:"#7dd3fc",brightMagenta:"#e879f9",brightCyan:"#67e8f9",brightWhite:"#f8fafc"},i={background:"#ffffff",foreground:"#1f2328",cursor:"#0969da",selectionBackground:"#b6e3ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#7d4e00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"};function r(d){return d?e:i}const s=t,{isDark:n}=Zf(),o=A(null),a=ma(null),l=ma(null);function c(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal-ws`}function h(){const d=l.value;d&&d.readyState!==WebSocket.CLOSING&&d.readyState!==WebSocket.CLOSED&&d.close(),l.value=null}function u(){const d=a.value;if(!d)return;const p=c();if(!p)return;h();const f=new WebSocket(p);l.value=f,f.onopen=()=>{f.send(JSON.stringify({type:"attach",sessionId:s.sessionId}))},f.onmessage=g=>{let v;try{v=JSON.parse(g.data)}catch{return}if(v.type==="started"){if(d&&v.cols&&v.rows)try{d.resize(v.cols,v.rows)}catch{}return}if((v.type==="data"||v.type==="replay")&&v.data){d.write(v.data);return}v.type==="error"&&v.error&&d.writeln(`\r
|
|
92
|
-
\x1B[31m${v.error}\x1B[0m`)}}return kt(async()=>{if(!o.value)return;const d=new Bx({cursorBlink:!1,disableStdin:!0,convertEol:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:12,lineHeight:1.2,scrollback:5e3,theme:r(n.value)});d.open(o.value),a.value=d,await ai(),u()}),He(n,d=>{a.value&&(a.value.options.theme=r(d))}),si(()=>{h(),a.value?.dispose(),a.value=null}),(d,p)=>(y(),_("div",QN,[m("div",{ref_key:"terminalEl",ref:o,class:"inline-block"},null,512)]))}}),MN=ns(TN,[["__scopeId","data-v-b4073335"]]),BN={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},AN={class:"flex items-center justify-between"},RN={class:"space-y-1 text-xs font-mono"},EN={class:"flex items-center gap-2"},DN={class:"relative"},LN=["disabled"],IN=["value"],NN=["value"],zN={class:"flex items-center gap-2"},ZN={class:"text-retro-text"},XN={class:"relative"},WN=["disabled"],VN=["disabled"],FN={key:0,class:"flex items-center justify-between gap-3 rounded border border-retro-border bg-retro-black px-2 py-1.5 text-xs font-mono"},HN={class:"min-w-0"},qN={class:"flex items-center gap-2"},YN={class:"text-retro-text truncate"},jN={key:0,class:"mt-0.5 text-retro-red truncate"},UN={key:1,class:"h-48 rounded border border-retro-border bg-retro-black overflow-hidden"},GN={class:"flex items-center gap-2"},KN=["disabled"],JN=["disabled"],ez=Xe({__name:"FinalizeConfirm",props:{conversationId:{},baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(t,{emit:e}){const i=t,r=e,s=A(""),n=A(null),o=A(!1),a=A(!1),l=A("idle"),c=A(""),h=A(null),u=A(""),d=A(gl(i.baseBranch)?i.baseBranch:""),p=A([]),f=A(!1),g=A(null),v=ae(()=>z_(d.value||i.baseBranch));async function b(){if(a.value)return;a.value=!0,l.value="running",c.value="",u.value=`commitgen:${i.conversationId}:${Date.now()}-${Math.random().toString(36).slice(2,8)}`;const T=new AbortController;h.value=T;try{const $=await $fetch("/api/chat/generate-commit-message",{method:"POST",signal:T.signal,body:{conversationId:i.conversationId,worktreePath:i.worktreePath,worktreeBranch:i.worktreeBranch,baseBranch:d.value||i.baseBranch,previewSessionId:u.value}});$.success&&$.message?(s.value=$.message,l.value="done"):(l.value="error",c.value=$.error||"Failed to generate commit message")}catch($){T.signal.aborted?l.value="aborted":(l.value="error",c.value=$ instanceof Error?$.message:String($))}finally{a.value=!1,h.value===T&&(h.value=null)}}function S(){h.value?.abort()}kt(async()=>{const T=(async()=>{try{const R=i.worktreePath.split("/").pop()||"",D=await $fetch(`/api/commits/${encodeURIComponent(R)}`,{params:{workingDirectory:i.worktreePath}});n.value=D.aheadCount}catch{n.value=null}})(),$=(async()=>{f.value=!0;try{const R=i.worktreePath||(await $fetch("/api/cwd")).cwd,D=await $fetch("/api/git/branches",{query:{workingDirectory:R}});p.value=D.branches.filter(ce=>!ce.isRemote&&!ce.name.startsWith("sc/")).map(Yp).filter(ce=>!!ce);const U=qp(d.value||i.baseBranch,p.value);U&&(d.value=U)}catch{p.value=[]}finally{f.value=!1}})();await Promise.all([T,$]),ai(()=>g.value?.focus())});function k(){!s.value.trim()||!d.value||(o.value=!0,r("confirm",s.value.trim(),d.value))}return(T,$)=>(y(),_("div",BN,[m("div",AN,[$[4]||($[4]=m("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),m("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:$[0]||($[0]=R=>r("cancel"))},[oe(O(Gt),{class:"w-4 h-4"})])]),m("div",RN,[m("div",EN,[$[5]||($[5]=m("span",{class:"text-retro-muted"},"target:",-1)),m("div",DN,[qe(m("select",{"onUpdate:modelValue":$[1]||($[1]=R=>d.value=R),disabled:o.value||f.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[f.value?(y(),_("option",{key:0,value:d.value},I(v.value),9,IN)):se("",!0),(y(!0),_($e,null,je(p.value,R=>(y(),_("option",{key:R,value:R},I(R),9,NN))),128))],8,LN),[[Ms,d.value]]),oe(O(Bc),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),m("div",zN,[$[6]||($[6]=m("span",{class:"text-retro-muted"},"commits:",-1)),m("span",ZN,I(n.value!==null?n.value:"..."),1)])]),m("div",XN,[qe(m("textarea",{ref_key:"textareaRef",ref:g,"onUpdate:modelValue":$[2]||($[2]=R=>s.value=R),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:o.value||a.value},null,8,WN),[[ui,s.value]]),m("button",{type:"button",disabled:o.value||a.value||f.value||!d.value,class:"absolute right-1.5 top-1.5 p-0.5 rounded text-retro-muted hover:text-retro-cyan transition-colors disabled:opacity-40",title:"Generate commit message",onClick:b},[oe(O(Ca),{class:Ee(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,VN)]),l.value!=="idle"?(y(),_("div",FN,[m("div",HN,[m("div",qN,[oe(O(Ca),{class:Ee(["w-3.5 h-3.5 text-retro-cyan shrink-0",{"animate-spin":l.value==="running"}])},null,8,["class"]),m("span",YN,I(l.value==="running"?`Generating from ${d.value}...`:l.value==="done"?"Commit message generated":l.value==="aborted"?"Generation stopped":"Generation failed"),1)]),c.value?(y(),_("div",jN,I(c.value),1)):se("",!0)]),l.value==="running"?(y(),_("button",{key:0,type:"button",class:"shrink-0 p-0.5 rounded text-retro-muted hover:text-retro-red transition-colors",title:"Stop generation",onClick:S},[oe(O(x0),{class:"w-4 h-4"})])):se("",!0)])):se("",!0),l.value==="running"&&u.value?(y(),_("div",UN,[(y(),Se(MN,{key:u.value,"session-id":u.value},null,8,["session-id"]))])):se("",!0),m("div",GN,[m("button",{type:"button",disabled:!s.value.trim()||!d.value||o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:k},[oe(O(Wf),{class:"w-3.5 h-3.5"}),Ze(" "+I(o.value?"Finalizing...":"Confirm"),1)],8,KN),m("button",{type:"button",disabled:o.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:$[3]||($[3]=R=>r("cancel"))}," Cancel ",8,JN)])]))}}),tz={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},iz={class:"flex items-center justify-between"},rz={class:"space-y-1 text-xs font-mono"},sz={class:"flex items-center gap-2"},nz={class:"text-retro-cyan"},oz={class:"flex items-center gap-2"},az={class:"relative"},lz=["disabled"],cz=["value"],hz=["value"],uz={class:"flex items-center gap-2"},dz={class:"text-retro-text"},fz={class:"flex items-center gap-2"},pz=["disabled"],mz=["disabled"],gz=Xe({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(t,{emit:e}){const i=t,r=e,s=A(null),n=A(!1),o=A(gl(i.baseBranch)?i.baseBranch:""),a=A([]),l=A(!1),c=ae(()=>z_(o.value||i.baseBranch));let h=0;async function u(p){if(!p){h++,s.value=null;return}const f=++h;try{const g=await $fetch("/api/chat/compare",{params:{worktreePath:i.worktreePath,baseBranch:p}});if(f!==h)return;s.value=g.ahead}catch{if(f!==h)return;s.value=null}}kt(async()=>{const p=u(o.value),f=(async()=>{l.value=!0;try{const g=i.worktreePath||(await $fetch("/api/cwd")).cwd,v=await $fetch("/api/git/branches",{query:{workingDirectory:g}});a.value=v.branches.filter(S=>!S.isRemote&&!S.name.startsWith("sc/")).map(Yp).filter(S=>!!S);const b=qp(o.value||i.baseBranch,a.value);b&&(o.value=b)}catch{a.value=[]}finally{l.value=!1}})();await Promise.all([p,f])}),He(o,p=>{u(p)});function d(){o.value&&(n.value=!0,r("confirm",o.value))}return(p,f)=>(y(),_("div",tz,[m("div",iz,[f[3]||(f[3]=m("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),m("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:f[0]||(f[0]=g=>r("cancel"))},[oe(O(Gt),{class:"w-4 h-4"})])]),m("div",rz,[m("div",sz,[f[4]||(f[4]=m("span",{class:"text-retro-muted"},"worktree:",-1)),m("span",nz,I(t.worktreeBranch),1)]),m("div",oz,[f[5]||(f[5]=m("span",{class:"text-retro-muted"},"target:",-1)),m("div",az,[qe(m("select",{"onUpdate:modelValue":f[1]||(f[1]=g=>o.value=g),disabled:n.value||l.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[l.value?(y(),_("option",{key:0,value:o.value},I(c.value),9,cz)):se("",!0),(y(!0),_($e,null,je(a.value,g=>(y(),_("option",{key:g,value:g},I(g),9,hz))),128))],8,lz),[[Ms,o.value]]),oe(O(Bc),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),m("div",uz,[f[6]||(f[6]=m("span",{class:"text-retro-muted"},"commits ahead:",-1)),m("span",dz,I(s.value!==null?s.value:"..."),1)])]),m("div",fz,[m("button",{type:"button",disabled:n.value||!o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:d},[oe(O(Wf),{class:"w-3.5 h-3.5"}),Ze(" "+I(n.value?"Rebasing...":"Confirm"),1)],8,pz),m("button",{type:"button",disabled:n.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:f[2]||(f[2]=g=>r("cancel"))}," Cancel ",8,mz)])]))}}),Oz={class:"flex-1 flex flex-col overflow-hidden"},vz={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},bz={class:"text-xs font-mono text-retro-text truncate"},yz={class:"flex items-center gap-2 flex-shrink-0"},_z={key:0,class:"text-xs font-mono text-retro-green"},xz={key:1,class:"text-[11px] font-mono text-retro-muted"},Sz={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},wz=["innerHTML"],kz={key:0,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},Cz=Xe({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},isAiResolving:{type:Boolean},strategy:{}},emits:["resolve","aiResolve","retry"],setup(t,{emit:e}){const i=t;A(i.file.content);const r=A(""),s=A(!1);He(()=>i.file.path,()=>{l()}),He(()=>i.file.content,()=>{l()});const n=ae(()=>{const h=/^<{7}\s/gm;return(i.file.content.match(h)||[]).length});function o(h){const u=h.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[u]||"text"}let a=0;async function l(){const h=++a;s.value=!0;try{const{codeToHtml:u}=await uc(async()=>{const{codeToHtml:k}=await import("./C0xGK0_5.js");return{codeToHtml:k}},__vite__mapDeps([3,1,2]),import.meta.url),d=o(i.file.path),f=i.file.content.split(`
|
|
93
|
-
`);let g="",v=!1,b=!1,S=0;for(const k of f){S++;const T=/^<{7}\s/.test(k),$=/^={7}$/.test(k),R=/^>{7}\s/.test(k);if(T){v=!0,b=!1,g+=`<div class="conflict-line conflict-marker-line" data-line="${S}"><span class="line-number">${S}</span><span class="line-content conflict-marker">${c(k)}</span></div>
|
|
94
|
-
`;continue}if($&&v){v=!1,b=!0,g+=`<div class="conflict-line conflict-marker-line" data-line="${S}"><span class="line-number">${S}</span><span class="line-content conflict-marker">${c(k)}</span></div>
|
|
95
|
-
`;continue}if(R){b=!1,g+=`<div class="conflict-line conflict-marker-line" data-line="${S}"><span class="line-number">${S}</span><span class="line-content conflict-marker">${c(k)}</span></div>
|
|
96
|
-
`;continue}let D=c(k);try{const he=(await u(k||" ",{lang:d,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);he&&(D=he[1])}catch{}let U="";v?U="conflict-ours":b&&(U="conflict-theirs"),g+=`<div class="conflict-line ${U}" data-line="${S}"><span class="line-number">${S}</span><span class="line-content">${D}</span></div>
|
|
97
|
-
`}if(h!==a)return;r.value=g}catch{if(h!==a)return;const u=i.file.content.split(`
|
|
98
|
-
`);r.value=u.map((d,p)=>{const f=p+1;return`<div class="conflict-line" data-line="${f}"><span class="line-number">${f}</span><span class="line-content">${c(d)}</span></div>`}).join(`
|
|
99
|
-
`)}finally{h===a&&(s.value=!1)}}function c(h){return h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}return kt(()=>{l()}),(h,u)=>(y(),_("div",Oz,[m("div",vz,[m("span",bz,I(t.file.path),1),m("div",yz,[t.resolved?(y(),_("span",_z," Resolved ")):n.value>0?(y(),_("span",xz,I(n.value)+" conflict "+I(n.value===1?"block":"blocks"),1)):se("",!0)])]),m("div",{class:Ee(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":t.resolved}])},[s.value?(y(),_("div",Sz," Highlighting... ")):(y(),_("div",{key:1,class:"conflict-code",innerHTML:r.value},null,8,wz))],2),n.value>0&&!t.resolved?(y(),_("div",kz," File contains "+I(n.value)+" conflict "+I(n.value===1?"block":"blocks")+". Use AI resolution to resolve. ",1)):se("",!0)]))}}),$z={class:"flex flex-col h-full border-l border-retro-border bg-retro-dark"},Pz={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border"},Qz={class:"flex items-center gap-2"},Tz={class:"text-[10px] font-mono text-retro-muted mt-1"},Mz={key:0,class:"text-xs font-mono text-retro-muted text-center py-8"},Bz={key:0,class:"bg-retro-panel/50 rounded px-2 py-1.5 border border-retro-border"},Az={class:"mt-0.5"},Rz={class:"inline-block w-3 text-center opacity-70"},Ez={key:1,class:"flex items-center gap-2 text-xs font-mono text-retro-cyan"},Dz={class:"flex-shrink-0 border-t border-retro-border p-3 space-y-2"},Lz=["disabled"],Iz=["disabled"],Nz={key:0},zz={key:1},Zz=Xe({__name:"ConflictChatPanel",setup(t){const e=ur(),i=tl(),r=A(""),s=A(null),n=ae(()=>e.conflictState?.chatMessages??[]),o=ae(()=>e.conflictState?.lifecycleState==="resolving"),a=ae(()=>{if(!e.conflictState)return!1;const f=e.conflictState.files.length,g=e.conflictState.resolvedFiles.size;return f>0&&g>=f}),l=ae(()=>e.conflictState?e.conflictState.files.length-e.conflictState.resolvedFiles.size:0),c=ae(()=>i.providerId);He(()=>n.value.length,async()=>{await ai(),s.value&&(s.value.scrollTop=s.value.scrollHeight)});function h(){!e.conflictState||o.value||(e.setConflictUserGuidance(r.value.trim()),e.aiResolveAllConflicts())}function u(){e.cancelConflictResolution()}function d(f){switch(f.type){case"success":return"text-retro-green";case"error":return"text-retro-red";case"progress":return"text-retro-cyan";case"summary":return"text-retro-yellow";default:return"text-retro-muted"}}function p(f){switch(f.type){case"success":return"✓";case"error":return"✗";case"progress":return"▶";case"summary":return"─";default:return"●"}}return(f,g)=>(y(),_("div",$z,[m("div",Pz,[m("div",Qz,[oe(O(Ca),{class:"w-4 h-4 text-retro-orange"}),g[1]||(g[1]=m("span",{class:"text-xs font-mono text-retro-text font-semibold"},"AI Conflict Resolution",-1))]),m("div",Tz," Provider: "+I(c.value),1)]),m("div",{ref_key:"messagesContainer",ref:s,class:"flex-1 overflow-y-auto px-3 py-2 space-y-2"},[n.value.length===0?(y(),_("div",Mz," Enter optional guidance below and click resolve to start AI conflict resolution. ")):se("",!0),(y(!0),_($e,null,je(n.value,v=>(y(),_("div",{key:v.id,class:Ee(["text-xs font-mono leading-relaxed",v.role==="user"?"text-retro-text":d(v)])},[v.role==="user"?(y(),_("div",Bz,[g[2]||(g[2]=m("span",{class:"text-retro-muted text-[10px]"},"Guidance:",-1)),m("div",Az,I(v.content),1)])):(y(),_($e,{key:1},[m("span",Rz,I(p(v)),1),Ze(" "+I(v.content),1)],64))],2))),128)),o.value?(y(),_("div",Ez,[...g[3]||(g[3]=[m("span",{class:"animate-pulse"},"●",-1),Ze(" Processing... ",-1)])])):se("",!0)],512),m("div",Dz,[qe(m("textarea",{"onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v),disabled:o.value,placeholder:'Optional: Add guidance for AI resolution (e.g., "prefer feature branch API changes", "keep both import sets")...',class:"w-full h-16 px-2 py-1.5 text-xs font-mono bg-retro-black text-retro-text border border-retro-border rounded resize-none focus:outline-none focus:border-retro-cyan/50 placeholder:text-retro-muted/50 disabled:opacity-50",spellcheck:"false"},null,8,Lz),[[ui,r.value]]),o.value?(y(),_("button",{key:1,type:"button",class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-red/10 border-retro-red/50 text-retro-red hover:bg-retro-red/20",onClick:u},[oe(O(x0),{class:"w-4 h-4"}),g[4]||(g[4]=Ze(" Stop Resolution ",-1))])):(y(),_("button",{key:0,type:"button",disabled:a.value||l.value===0,class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:h},[oe(O(Ca),{class:"w-4 h-4"}),a.value?(y(),_("span",Nz,"All Conflicts Resolved")):(y(),_("span",zz,"Resolve Conflicts Automatically ("+I(l.value)+")",1))],8,Iz))])]))}}),Xz={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},Wz={class:"w-full max-w-7xl mx-4 my-8 h-[85vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},Vz={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},Fz={class:"flex items-center gap-3"},Hz={class:"text-xs font-mono text-retro-muted"},qz={class:"flex items-center gap-2"},Yz=["disabled"],jz=["disabled"],Uz={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},Gz={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},Kz={key:2,class:"flex-1 flex overflow-hidden"},Jz={class:"w-56 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},eZ={class:"py-1"},tZ=["onClick"],iZ={class:"flex-1 flex flex-col overflow-hidden min-w-0"},rZ={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},sZ={class:"w-80 flex-shrink-0"},nZ=Xe({__name:"ConflictResolutionModal",emits:["close"],setup(t,{emit:e}){const i=e,r=ur(),s=A(null),n=A(!1),o=A(!1),a=ae(()=>r.conflictState?.files??[]),l=ae(()=>r.conflictState?.resolvedFiles??new Set),c=ae(()=>a.value.length),h=ae(()=>l.value.size),u=ae(()=>c.value>0&&h.value>=c.value),d=ae(()=>s.value?a.value.find(b=>b.path===s.value)??null:null);function p(b){return l.value.has(b)}function f(b){s.value=b}async function g(){n.value=!0;const b=await r.continueRebase();n.value=!1,b.success&&i("close")}async function v(){o.value=!0,await r.cancelConflictResolution(),o.value=!1,i("close")}return(b,S)=>(y(),Se(zi,{to:"body"},[oe(Nr,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[O(r).conflictState?(y(),_("div",Xz,[m("div",Wz,[m("div",Vz,[m("div",Fz,[oe(O(Bs),{class:"w-5 h-5 text-retro-yellow"}),S[0]||(S[0]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Conflicts",-1)),m("span",Hz,I(h.value)+"/"+I(c.value)+" resolved ",1)]),m("div",qz,[m("button",{type:"button",disabled:!u.value||n.value||o.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:g},I(n.value?"Continuing...":"Continue Rebase"),9,Yz),m("button",{type:"button",disabled:n.value||o.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:v},I(o.value?"Aborting...":"Abort"),9,jz)])]),O(r).conflictState?.loading?(y(),_("div",Uz," Loading conflict files... ")):O(r).conflictState?.error?(y(),_("div",Gz,I(O(r).conflictState.error),1)):(y(),_("div",Kz,[m("div",Jz,[m("div",eZ,[(y(!0),_($e,null,je(a.value,k=>(y(),_("button",{key:k.path,type:"button",class:Ee(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":s.value===k.path}]),onClick:T=>f(k.path)},[p(k.path)?(y(),Se(O(Xf),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(y(),Se(O(_h),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),m("span",{class:Ee(["truncate",p(k.path)?"text-retro-green":"text-retro-yellow"])},I(k.path),3)],10,tZ))),128))])]),m("div",iZ,[d.value?(y(),Se(Cz,{key:0,file:d.value,resolved:p(d.value.path)},null,8,["file","resolved"])):(y(),_("div",rZ," Select a file to view "))]),m("div",sZ,[oe(Zz)])]))])])):se("",!0)]),_:1})]))}}),oZ={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},aZ={class:"flex items-center justify-between p-4 border-b border-retro-border"},lZ={class:"flex items-center gap-2"},cZ={class:"p-4"},hZ={class:"mt-2 text-sm text-retro-text font-mono truncate"},uZ={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},dZ=Xe({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(t,{emit:e}){const i=e;function r(s){s.target===s.currentTarget&&i("cancel")}return(s,n)=>(y(),Se(zi,{to:"body"},[oe(Nr,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ft(()=>[t.show?(y(),_("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:r},[oe(Nr,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:ft(()=>[t.show?(y(),_("div",oZ,[m("div",aZ,[m("div",lZ,[oe(O(Bs),{class:"w-5 h-5 text-retro-red"}),n[3]||(n[3]=m("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),m("button",{onClick:n[0]||(n[0]=o=>i("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[oe(O(Gt),{class:"w-5 h-5 text-retro-muted"})])]),m("div",cZ,[n[4]||(n[4]=m("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),m("p",hZ,' "'+I(t.title)+'" ',1),n[5]||(n[5]=m("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),m("div",uZ,[m("button",{onClick:n[1]||(n[1]=o=>i("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),m("button",{onClick:n[2]||(n[2]=o=>i("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):se("",!0)]),_:1})])):se("",!0)]),_:1})]))}}),fZ={class:"h-full flex flex-col bg-retro-black"},pZ={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},mZ={class:"flex items-center gap-2 min-w-0"},gZ={class:"text-xs font-mono text-retro-text truncate"},OZ={class:"flex items-center gap-1"},vZ=["disabled","title"],bZ=["disabled","title"],yZ=["title"],_Z=["disabled"],xZ={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},SZ={class:"flex-1 min-h-0"},r0=Xe({__name:"ChatPanel",setup(t){const e=ur(),i=Z_(),{disconnectConversation:r,abort:s}=Hp(),n=A(null);function o(){ai(()=>{n.value?.focusTerminal()})}kt(async()=>{try{const q=await $fetch("/api/cwd");e.setCwd(q.cwd)}catch{}});const a=ae(()=>e.activeConversation?.title||"New Chat"),l=A(!1),c=ae(()=>i.isChatFullscreen);function h(){i.toggleChatFullscreen()}async function u(){l.value=!1;const q=e.activeConversationId;q&&(e.isConversationStreaming(q)&&s(q),r(q),await e.deleteConversation(q)),e.clearMessages()}function d(){e.hasMessages&&(l.value=!0)}function p(){l.value=!1}const f=A(!1),g=A(null),v=ae(()=>e.activeConversation?.finalized===!0),b=ae(()=>v.value),S=A(null),k=A(!1);let T=0;async function $(){const q=e.activeConversation;if(!q?.worktreePath||!q?.baseBranch){T++,S.value=null;return}const re=++T;k.value=!0;try{const H=await $fetch("/api/chat/compare",{params:{worktreePath:q.worktreePath,baseBranch:q.baseBranch}});if(re!==T)return;S.value=H}catch{if(re!==T)return;S.value=null}finally{re===T&&(k.value=!1)}}He(()=>[e.activeConversationId,e.activeConversation?.worktreePath,e.activeConversation?.baseBranch,e.activeConversation?.lastCommitTime,e.activeConversation?.updatedAt,e.isActiveConversationStreaming],()=>{$()},{immediate:!0}),He(()=>e.activeConversationId,()=>{f.value=!1,te.value=!1,g.value=null,o()});const R=ae(()=>S.value?S.value.ahead===0&&S.value.behind===0:!1),D=ae(()=>{const q=e.activeConversation;return q?.hasWorktree&&!q?.finalized}),U=ae(()=>{const q=e.activeConversation;return!!q?.hasWorktree&&!q?.finalized&&!e.isActiveConversationStreaming&&!R.value}),ce=ae(()=>{const q=e.activeConversation;return!!q?.hasWorktree&&!q?.finalized});function he(){f.value=!0,g.value=null}async function W(q,re){const H=e.activeConversationId;if(!H)return;const j=await e.finalizeConversation(H,q,re);if(f.value=!1,j.success)g.value={type:"success",message:`Merged to ${re}`},setTimeout(()=>{g.value=null},5e3);else if(j.rebaseInProgress)g.value=null;else{const ee=j.conflictFiles?.length?`Conflict in: ${j.conflictFiles.join(", ")}`:j.error||"Finalize failed";g.value={type:"error",message:ee}}}function M(){f.value=!1}function x(){if(!e.conflictState&&e.activeConversation?.hasWorktree){const q=e.activeConversation?.baseBranch||"main";g.value={type:"success",message:`Rebased onto ${q}`},setTimeout(()=>{g.value=null},5e3)}else g.value=null}const V=A(!1),N=ae(()=>!!e.activeConversation?.previewBranch);async function K(){const q=e.activeConversationId;if(!q)return;V.value=!0,g.value=null;const re=N.value,H=await e.togglePreview(q);if(H.success){const j=re?`Switched back to ${e.activeConversation?.baseBranch}`:"Preview active — main worktree updated";g.value={type:"success",message:j},setTimeout(()=>{g.value=null},3e3)}else g.value={type:"error",message:H.error||"Preview toggle failed"};V.value=!1}const te=A(!1);function G(){te.value=!0,g.value=null}async function be(q){const re=e.activeConversationId;if(!re)return;const H=await e.rebaseConversation(re,q);te.value=!1,H.success?(g.value={type:"success",message:`Rebased onto ${q}`},setTimeout(()=>{g.value=null},5e3)):H.rebaseInProgress?g.value=null:g.value={type:"error",message:H.error||"Rebase failed"}}function ie(){te.value=!1}return(q,re)=>(y(),_("div",fZ,[m("div",pZ,[m("div",mZ,[m("span",gZ,I(O(a)),1)]),m("div",OZ,[O(D)?(y(),_("button",{key:0,disabled:O(V),class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:O(N)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:K},[O(N)?(y(),Se(O(xS),{key:0,class:"w-4 h-4 text-retro-cyan"})):(y(),Se(O(SS),{key:1,class:"w-4 h-4"}))],8,vZ)):se("",!0),O(ce)?(y(),_("button",{key:1,disabled:O(e).isActiveConversationStreaming,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:O(e).isActiveConversationStreaming?"Rebase unavailable while Claude is responding":"Rebase: sync worktree onto target base branch",onClick:G},[...re[1]||(re[1]=[Ix('<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="7" cy="4.5" r="1.5" fill="currentColor"></circle><circle cx="18" cy="20" r="1.5" fill="currentColor"></circle><circle cx="12" cy="7" r="1.4" fill="currentColor" opacity="0.9"></circle><path d="M7 6V16M7 16L4.5 13.5M7 16L9.5 13.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.4 7H12.5C15.5376 7 18 9.46243 18 12.5V18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.5 16L18 18.5L20.5 16" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)])],8,bZ)):se("",!0),O(U)?(y(),_("button",{key:2,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:he},[oe(O(Xf),{class:"w-4 h-4"})])):se("",!0),m("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:O(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:h},[O(c)?(y(),Se(O(h0),{key:0,class:"w-4 h-4"})):(y(),Se(O(u0),{key:1,class:"w-4 h-4"}))],8,yZ),m("button",{disabled:!O(e).hasMessages,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:d},[oe(O(Er),{class:"w-4 h-4"})],8,_Z)])]),oe(dZ,{show:O(l),title:O(a),onConfirm:u,onCancel:p},null,8,["show","title"]),O(f)&&O(e).activeConversation?.hasWorktree?(y(),Se(ez,{key:0,"conversation-id":O(e).activeConversation.id,"base-branch":O(e).activeConversation.baseBranch||"main","worktree-branch":O(e).activeConversation.worktreeBranch||"","worktree-path":O(e).activeConversation.worktreePath||"",onConfirm:W,onCancel:M},null,8,["conversation-id","base-branch","worktree-branch","worktree-path"])):se("",!0),O(te)&&O(e).activeConversation?.hasWorktree?(y(),Se(gz,{key:1,"base-branch":O(e).activeConversation.baseBranch||"main","worktree-branch":O(e).activeConversation.worktreeBranch||"","worktree-path":O(e).activeConversation.worktreePath||"",onConfirm:be,onCancel:ie},null,8,["base-branch","worktree-branch","worktree-path"])):se("",!0),O(e).conflictState?(y(),Se(nZ,{key:2,onClose:x})):se("",!0),O(g)?(y(),_("div",{key:3,class:Ee(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",O(g).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[Ze(I(O(g).message)+" ",1),O(g).type==="error"?(y(),_("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:re[0]||(re[0]=H=>g.value=null)}," dismiss ")):se("",!0)],2)):se("",!0),O(v)?(y(),_("div",xZ," This conversation has been finalized and is read-only. ")):se("",!0),m("div",SZ,[oe(PN,{ref_key:"terminalPanelRef",ref:n,disabled:O(b)},null,8,["disabled"])])]))}}),wZ={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},kZ={class:"flex items-center gap-2 min-w-0"},CZ=["title"],$Z={class:"text-retro-text font-mono text-sm truncate"},PZ={class:"text-retro-muted"},QZ={class:"text-retro-text"},TZ={class:"text-retro-muted font-mono text-xs flex-shrink-0"},MZ={class:"flex-1 overflow-auto"},BZ={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},AZ={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},RZ={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},EZ={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},DZ={key:0,class:"diff-warning"},LZ={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},IZ={class:"diff-line-num select-none text-right px-2 w-12"},NZ={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},zZ={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},ZZ={key:0,class:"diff-sign"},XZ={key:1,class:"diff-sign"},WZ={key:2,class:"diff-sign"},VZ={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},FZ=Xe({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(t,{emit:e}){const i=t,r=e,s=A(null),n=ae(()=>i.commitHash.substring(0,7)),o=ae(()=>Gn[i.file.status]||{label:i.file.status,colorClass:"text-retro-muted"}),a=ae(()=>i.file.status==="R"&&i.file.oldPath);function l(c){c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),r("close"))}return kt(()=>{s.value?.focus()}),(c,h)=>(y(),_("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:l,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[m("div",wZ,[m("div",kZ,[m("span",{class:Ee(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",o.value.colorClass]),title:o.value.label},I(t.file.status),11,CZ),m("span",$Z,[a.value&&t.file.oldPath?(y(),_($e,{key:0},[m("span",PZ,I(t.file.oldPath),1),h[1]||(h[1]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",QZ,I(t.file.path),1)],64)):(y(),_($e,{key:1},[Ze(I(t.file.path),1)],64))]),m("span",TZ," @ "+I(n.value),1)]),m("button",{onClick:h[0]||(h[0]=u=>r("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[oe(O(Gt),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),m("div",MZ,[t.loading?(y(),_("div",BZ,[...h[2]||(h[2]=[m("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ze(" Loading diff... ",-1)])])):t.content&&t.content.binary?(y(),_("div",AZ,[...h[3]||(h[3]=[m("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):t.content&&t.content.lines.length===0?(y(),_("div",RZ,[...h[4]||(h[4]=[m("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):t.content?(y(),_("table",EZ,[m("tbody",null,[t.content.truncated?(y(),_("tr",DZ,[...h[5]||(h[5]=[m("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):se("",!0),(y(!0),_($e,null,je(t.content.lines,(u,d)=>(y(),_("tr",{key:d,class:Ee({"diff-add":u.type==="add","diff-delete":u.type==="delete","diff-context":u.type==="context","diff-header":u.type==="header"})},[u.type==="header"?(y(),_("td",LZ,I(u.content),1)):(y(),_($e,{key:1},[m("td",IZ,I(u.oldLineNumber??""),1),m("td",NZ,I(u.newLineNumber??""),1),m("td",zZ,[u.type==="add"?(y(),_("span",ZZ,"+")):u.type==="delete"?(y(),_("span",XZ,"-")):(y(),_("span",WZ," ")),Ze(" "+I(u.content),1)])],64))],2))),128))])])):(y(),_("div",VZ," Failed to load diff content. "))])],544))}}),s0=ns(FZ,[["__scopeId","data-v-74bf9bf3"]]),HZ={class:"fixed inset-0 z-50 flex items-center justify-center"},qZ={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},YZ={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},jZ={class:"flex items-center gap-2"},UZ={class:"text-sm font-mono text-retro-text"},GZ={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},KZ={key:0},JZ={class:"space-y-6"},eX={class:"space-y-1.5"},tX=["value","checked","onChange"],iX={class:"flex-1"},rX={class:"text-sm font-mono text-retro-text"},sX={class:"text-xs text-retro-muted leading-tight"},nX={class:"text-xs font-mono text-retro-muted"},oX={class:"text-xs text-retro-muted mb-3"},aX=["disabled"],lX={class:"space-y-1.5"},cX=["value","checked","onChange"],hX={class:"flex-1"},uX={class:"text-sm font-mono text-retro-text"},dX={class:"text-xs text-retro-muted leading-tight"},fX={key:1,class:"space-y-4"},pX={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},mX={class:"text-xs font-mono text-retro-cyan"},gX=Xe({__name:"SettingsModal",emits:["close"],setup(t,{emit:e}){const i=e,r=tl(),s=Nx(),n=el(),o=A("main"),a=A(!1),l=ae(()=>s.public.appVersion||"unknown"),c=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],h=[{value:"plan",label:wl.plan,description:Sl.plan,icon:p0,color:"text-retro-cyan"},{value:"ask",label:wl.ask,description:Sl.ask,icon:b0,color:"text-retro-green"},{value:"auto",label:wl.auto,description:Sl.auto,icon:fS,color:"text-retro-yellow"},{value:"bypass",label:wl.bypass,description:Sl.bypass,icon:_0,color:"text-retro-red"}],{data:u,pending:d,error:p}=gm("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),f=ae(()=>u.value?.providers??[]),g=ae(()=>{const M=p.value;return M?M instanceof Error?M.message:String(M):null}),{data:v,refresh:b}=gm("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),S=ae(()=>{const M=v.value;return M?M.isIndexing?`Indexing (${M.currentJob||"running"})`:M.schedulerActive?`Indexed ${M.fileCount} files / ${M.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});kt(()=>{r.hydrate()});const k=M=>{r.setProviderSelection(M),n.success("Settings saved")},T=()=>{o.value="provider"},$=()=>{o.value="main"},R=M=>{r.setTheme(M),n.success("Settings saved")},D=M=>{r.setPermissionMode(M),n.success("Settings saved")},U=()=>{i("close")},ce=async()=>{if(!a.value){a.value=!0;try{const M=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!M.success&&M.status==="already-indexing"?n.info("Spec index is already running"):n.success("Spec reindex started"),await b()}catch(M){n.error(M instanceof Error?M.message:"Failed to start spec reindex")}finally{a.value=!1}}},he=M=>{M.key==="Escape"&&i("close")};kt(()=>{window.addEventListener("keydown",he)}),si(()=>{window.removeEventListener("keydown",he)});let W=null;return kt(()=>{W=Ff(()=>{b()},5e3)}),si(()=>{W&&clearInterval(W)}),(M,x)=>(y(),Se(zi,{to:"body"},[m("div",HZ,[m("div",{class:"absolute inset-0 bg-black/70",onClick:U}),m("div",qZ,[m("div",YZ,[m("div",jZ,[o.value==="provider"?(y(),_("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:$},[oe(O(uS),{class:"h-4 w-4"})])):se("",!0),m("h2",UZ,I(o.value==="provider"?"AI Provider Settings":"Settings"),1)]),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:x[0]||(x[0]=V=>i("close"))},[oe(O(Gt),{class:"h-4 w-4"})])]),m("div",GZ,[o.value==="main"?(y(),_("section",KZ,[m("div",JZ,[m("section",null,[x[1]||(x[1]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),x[2]||(x[2]=m("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),m("div",eX,[(y(),_($e,null,je(c,V=>m("label",{key:V.value,class:Ee(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[O(r).theme===V.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[m("input",{type:"radio",name:"theme",value:V.value,checked:O(r).theme===V.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:N=>R(V.value)},null,40,tX),m("div",iX,[m("div",rX,I(V.label),1),m("div",sX,I(V.description),1)])],2)),64))])]),x[9]||(x[9]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[x[4]||(x[4]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),x[5]||(x[5]=m("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),m("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:T},[x[3]||(x[3]=m("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),m("span",nX,I(O(r).providerSelection.providerId)+" / "+I(O(r).providerSelection.modelKey),1)])]),x[10]||(x[10]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[x[6]||(x[6]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),m("p",oX,I(S.value),1),m("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:a.value||O(v)?.isIndexing,onClick:ce},I(a.value?"Starting reindex...":"Reindex Specs"),9,aX)]),x[11]||(x[11]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[x[7]||(x[7]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),x[8]||(x[8]=m("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),m("div",lX,[(y(),_($e,null,je(h,V=>m("label",{key:V.value,class:Ee(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[O(r).permissionMode===V.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[m("input",{type:"radio",name:"permission-mode",value:V.value,checked:O(r).permissionMode===V.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:N=>D(V.value)},null,40,cX),(y(),Se(Ja(V.icon),{class:Ee(["w-4 h-4 flex-shrink-0",V.color])},null,8,["class"])),m("div",hX,[m("div",uX,I(V.label),1),m("div",dX,I(V.description),1)])],2)),64))])]),x[12]||(x[12]=m("div",{class:"border-t border-retro-border"},null,-1))])])):(y(),_("section",fX,[x[13]||(x[13]=m("div",null,[m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),m("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),oe(oS,{providers:f.value,selected:O(r).providerSelection,permissionMode:O(r).permissionMode,pending:O(d),errorMessage:g.value,onSelect:k},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),x[17]||(x[17]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[x[15]||(x[15]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),x[16]||(x[16]=m("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),m("div",pX,[x[14]||(x[14]=m("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),m("span",mX,I(l.value),1)])])])])])]))}}),OX={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},vX={class:"flex-1 text-sm font-mono text-retro-text"},bX=["onClick"],yX=Xe({__name:"ToastContainer",setup(t){const{toasts:e,remove:i}=el(),r={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},s=n=>{switch(n){case"success":return Xf;case"error":return _h;case"warning":return Bs;default:return $S}};return(n,o)=>(y(),Se(zi,{to:"body"},[m("div",OX,[oe(zx,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:ft(()=>[(y(!0),_($e,null,je(O(e),a=>(y(),_("div",{key:a.id,class:Ee(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[r[a.type].bg,r[a.type].border]])},[(y(),Se(Ja(s(a.type)),{class:Ee(["h-5 w-5 flex-shrink-0 mt-0.5",r[a.type].icon])},null,8,["class"])),m("p",vX,I(a.message),1),m("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:l=>O(i)(a.id)},[oe(O(Gt),{class:"h-4 w-4"})],8,bX)],2))),128))]),_:1})])]))}}),_X=Xe({__name:"SplashScreen",setup(t){const e=A(!0),i=A(!1);return kt(()=>{setTimeout(()=>{i.value=!0,setTimeout(()=>{e.value=!1},600)},1800)}),(r,s)=>(y(),Se(zi,{to:"body"},[e.value?(y(),_("div",{key:0,class:Ee(["fixed inset-0 z-[9999] flex items-center justify-center bg-retro-black transition-opacity duration-500",{"opacity-0":i.value}])},[...s[0]||(s[0]=[m("div",{class:"flex flex-col items-center gap-6"},[m("pre",{class:"text-retro-cyan font-mono text-xs leading-tight select-none splash-glow"},` ____ ____ _
|
|
100
|
-
/ ___| _ __ ___ ___ / ___|__ _| |_
|
|
101
|
-
\\___ \\| '_ \\ / _ \\/ __|| | / _\` | __|
|
|
102
|
-
___) | |_) | __/ (__ | |__| (_| | |_
|
|
103
|
-
|____/| .__/ \\___|\\___| \\____\\__,_|\\__|
|
|
104
|
-
|_|
|
|
105
|
-
`),m("div",{class:"flex items-center gap-2"},[m("span",{class:"inline-block w-2 h-2 rounded-full bg-retro-cyan animate-pulse"}),m("span",{class:"text-retro-muted font-mono text-xs tracking-widest uppercase"},"initializing")])],-1)])],2)):se("",!0)]))}}),xX=ns(_X,[["__scopeId","data-v-7fddb179"]]);let li=null,Rn=null,Ys=null;const SX=5e3,wX=500,kX=1e3,ju=5,or=new Map,js=new Map,_s=new Map,hc=new Map;function CX(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function $X(){const t=ur();async function e(){console.log("[GlobalNotifications] Executing debounced refresh");const f=await t.refreshServerConversations();console.log("[GlobalNotifications] Refresh result:",f);const g=[];for(const[v,b]of js)js.delete(v),r(v,b)||g.push([v,b]);for(const[v,b]of g){const S=(_s.get(v)??0)+1;if(S<=ju){_s.set(v,S),console.log(`[GlobalNotifications] Scheduling retry ${S}/${ju} for ${v}`);const k=setTimeout(()=>{hc.delete(v),js.set(v,b),i()},kX*S);hc.set(v,k)}else console.warn(`[GlobalNotifications] Gave up streaming setup for ${v} after ${ju} retries`),_s.delete(v)}}function i(){Ys&&clearTimeout(Ys),Ys=setTimeout(()=>{Ys=null,e()},wX)}function r(f,g){if(!li||li.readyState!==WebSocket.OPEN)return!1;if(or.has(f)||t.isConversationActivelyStreaming(f))return _s.delete(f),!0;const v=t.conversations.find(k=>k.id===f);if(!v)return console.warn("[GlobalNotifications] Conversation not found for streaming:",f),!1;_s.delete(f),v.messages.length===0&&g&&t.addUserMessage(g,f);const b=[...v.messages].reverse().find(k=>k.role==="assistant");if(b)return t.resetMessageForReplay(b.id,f),t.startConversationStreaming(f),or.set(f,{conversationId:f,messageId:b.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]}),li.send(JSON.stringify({type:"subscribe",conversationId:f,cursor:0})),console.log("[GlobalNotifications] Resumed server job streaming (existing msg):",f),!0;const S=t.addAssistantMessage(f);return t.initContentBlocks(S.id,f),t.startConversationStreaming(f),or.set(f,{conversationId:f,messageId:S.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]}),li.send(JSON.stringify({type:"subscribe",conversationId:f,cursor:0})),console.log("[GlobalNotifications] Subscribed to server job streaming:",f),!0}function s(f){try{const g=JSON.parse(f.data);if(g.type==="notification"){n(g);return}const v=g.conversationId;if(!v)return;const b=or.get(v);b&&o(b,g)}catch{}}function n(f){if(console.log("[GlobalNotifications] Received:",f.notificationEvent,f.conversationId),f.notificationEvent==="job_created"){js.set(f.conversationId,f.message||""),i();return}if(f.notificationEvent==="job_persisted"){or.has(f.conversationId)&&(t.endConversationStreaming(f.conversationId),or.delete(f.conversationId)),js.delete(f.conversationId),_s.delete(f.conversationId),i();return}if(f.notificationEvent!=="job_completed"&&f.notificationEvent==="conversation_archived"){i();return}}function o(f,g){const v=f.conversationId;if(g.type==="replay_start"){f.isReplaying=!0,f.replayBuffer=[];return}if(g.type==="replay_end"){a(f),f.isReplaying=!1,f.replayBuffer=[];return}if(f.isReplaying){(g.type==="ui_event"||g.type==="done"||g.type==="error")&&f.replayBuffer.push(g);return}if(g.type==="ui_event"&&g.event){c(f,g.event,v);return}if(g.type!=="done"&&g.type==="error"){t.updateMessage(f.messageId,{status:"error"},v),t.setSessionError(g.error||"Server job error",v),t.endConversationStreaming(v),or.delete(v);return}}function a(f){const g=[];let v="",b=null,S=null,k="";for(const T of f.replayBuffer){if(T.type!=="ui_event"||!T.event)continue;const $=T.event;switch($.type){case"block_start":if($.blockType==="text"){const R=$.blockId||Si();g.push({id:R,type:"text",text:$.text||""}),b=R,S=null,$.text&&(v+=$.text)}else if($.blockType==="tool_use"&&$.toolUseId&&$.name){const R=$.blockId||Si();g.push({id:R,type:"tool_use",toolUseId:$.toolUseId,name:$.name,input:{},inputSummary:"",status:"running"}),b=null,S=$.index??0,k=""}break;case"block_delta":if($.text&&b){const R=g.find(D=>D.id===b);R&&R.type==="text"&&(R.text+=$.text,v+=$.text)}$.partialJson&&S!==null&&(k+=$.partialJson);break;case"block_end":if(b&&(b=null),S!==null){const R=[...g].reverse().find(D=>D.type==="tool_use");if(R){let D={};try{D=JSON.parse(k)}catch{}R.input=D,R.inputSummary=l(D),R.status="pending"}S=null,k=""}break;case"tool_result":{const R=[...g].reverse().find(D=>D.type==="tool_use"&&D.toolUseId===$.toolUseId);R&&(R.status=$.isError?"error":"complete"),g.push({id:Si(),type:"tool_result",toolUseId:$.toolUseId,content:$.content||"",isError:!!$.isError});break}}}g.length>0&&t.batchSetMessageBlocks(f.messageId,g,v,"streaming",f.conversationId),f.currentTextBlockId=b,f.currentToolBlockId=null,f.currentToolInputJson="",console.log(`[GlobalNotifications] Replay batch: ${f.replayBuffer.length} events → ${g.length} blocks`)}function l(f){return f.file_path?String(f.file_path):f.path?String(f.path):f.command?String(f.command).slice(0,50):""}function c(f,g,v){switch(g.type){case"block_start":{if(g.blockType==="text"){const b=g.blockId||Si(),S={id:b,type:"text",text:g.text||""};t.appendContentBlock(f.messageId,S,v),f.currentTextBlockId=b,f.currentToolBlockId=null,g.text&&t.appendToMessage(f.messageId,g.text,v)}else if(g.blockType==="tool_use"&&g.toolUseId&&g.name){const b=g.blockId||Si(),S={id:b,type:"tool_use",toolUseId:g.toolUseId,name:g.name,input:{},inputSummary:"",status:"running"};t.appendContentBlock(f.messageId,S,v),f.currentToolBlockId=b,f.currentToolInputJson="",f.currentTextBlockId=null}break}case"block_delta":{g.text&&f.currentTextBlockId&&(t.updateBlockById(f.messageId,f.currentTextBlockId,b=>{b.type==="text"&&(b.text+=g.text)},v),t.appendToMessage(f.messageId,g.text,v)),g.partialJson&&f.currentToolBlockId&&(f.currentToolInputJson+=g.partialJson);break}case"block_end":{if(f.currentTextBlockId&&(f.currentTextBlockId=null),f.currentToolBlockId){const b=f.currentToolBlockId,S=f.currentToolInputJson;t.updateBlockById(f.messageId,b,k=>{if(k.type==="tool_use"){const T=k;let $={};try{$=JSON.parse(S)}catch{}T.input=$,T.inputSummary=l($),T.status="pending"}},v),f.currentToolBlockId=null,f.currentToolInputJson=""}break}case"tool_result":{if(g.toolUseId){const b=t.findToolUseBlock(f.messageId,g.toolUseId,v);b&&t.updateBlockById(f.messageId,b.id,k=>{k.type==="tool_use"&&(k.status=g.isError?"error":"complete")},v);const S={id:Si(),type:"tool_result",toolUseId:g.toolUseId,content:g.content||"",isError:!!g.isError};t.appendContentBlock(f.messageId,S,v)}break}}}function h(){if(typeof window>"u"||li&&(li.readyState===WebSocket.OPEN||li.readyState===WebSocket.CONNECTING))return;const f=CX();li=new WebSocket(f),li.onopen=()=>{console.log("[GlobalNotifications] WebSocket connected")},li.onmessage=s,li.onclose=g=>{console.log("[GlobalNotifications] WebSocket closed",{code:g.code,reason:g.reason}),li=null;for(const v of or.keys())t.endConversationStreaming(v);or.clear(),u()},li.onerror=g=>{console.warn("[GlobalNotifications] WebSocket error",g)}}function u(){Rn||(Rn=setTimeout(()=>{Rn=null,h()},SX))}function d(){Rn&&(clearTimeout(Rn),Rn=null),Ys&&(clearTimeout(Ys),Ys=null);for(const f of hc.values())clearTimeout(f);hc.clear(),_s.clear(),js.clear();for(const f of or.keys())t.endConversationStreaming(f);or.clear(),li&&(li.close(),li=null)}async function p(){try{const g=(await $fetch("/api/jobs")).filter(v=>v.source!=="user"&&(v.status==="running"||v.status==="waiting_permission"||v.status==="queued"||v.status==="done"&&v.eventCount>0));if(g.length===0)return;await t.refreshServerConversations();for(const v of g){if(t.isConversationActivelyStreaming(v.conversationId))continue;const b=t.conversations.find(T=>T.id===v.conversationId);if(!b)continue;const S=[...b.messages].reverse().find(T=>T.role==="assistant");if(S&&(S.status==="complete"||S.status==="error"||S.status==="stopped"))continue;console.log("[GlobalNotifications] Resuming active server job:",v.id,"for conversation:",v.conversationId),r(v.conversationId,"")||(console.log("[GlobalNotifications] WS not ready for resume, queuing for retry:",v.conversationId),js.set(v.conversationId,""),i())}}catch(f){console.warn("[GlobalNotifications] Failed to check for active server jobs:",f)}}return kt(()=>{h()}),si(()=>{d()}),{connect:h,disconnect:d,resumeActiveServerJobs:p}}const PX={class:"h-screen min-w-[320px] overflow-hidden bg-retro-black text-retro-text"},QX={key:0,class:"flex h-full flex-col overflow-hidden"},TX={class:"flex-shrink-0 border-b border-retro-border bg-retro-panel"},MX={class:"flex h-14 items-center justify-between gap-3 px-3"},BX={class:"flex items-center gap-2 min-w-0"},AX={class:"min-w-0"},RX={class:"text-[11px] text-retro-muted font-mono truncate"},EX={class:"flex items-center gap-1"},DX=["title"],LX={class:"relative flex-1 min-h-0 overflow-hidden"},IX={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Git"},NX={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Specs"},zX={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Conversations"},ZX={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Chat"},XX={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden bg-retro-black"},WX={class:"flex-shrink-0 border-t border-retro-border bg-retro-panel","aria-label":"Mobile primary navigation"},VX={class:"grid h-16 grid-cols-4"},FX=["aria-current","onClick"],HX={class:"truncate"},qX={key:1,class:"flex h-full overflow-x-auto"},YX={class:"flex flex-col overflow-hidden",style:{flex:"3"}},jX={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},UX={class:"flex items-center gap-2 min-w-0"},GX={key:0,class:"text-xs text-retro-muted font-mono truncate"},KX={class:"flex items-center gap-1"},JX=["title"],eW={class:"flex-1 min-h-0 overflow-y-auto"},tW={class:"relative flex min-w-0",style:{flex:"7"}},iW={key:0,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},rW={key:1,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},sW={key:2,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},bW=Xe({__name:"default",setup(t){const e=Z_(),i=tl(),r=ur(),s=Sh(),{isDark:n,toggleTheme:o}=Zf(),{tryResumeStreaming:a}=Hp(),{resumeActiveServerJobs:l}=$X(),c=ae(()=>s.diffViewerFile!==null),h=ae(()=>e.isMobile),u=ae(()=>e.isChatFullscreen),d=ae(()=>u.value),p=ae(()=>u.value?7:3),f=A(!1),g=A(""),v=A("chat"),b=[{id:"git",label:"Git",icon:vS},{id:"features",label:"Specs",icon:dn},{id:"conversations",label:"Threads",icon:MS},{id:"chat",label:"Chat",icon:f0}],S=ae(()=>b.find(D=>D.id===v.value)?.label??"Chat"),k=ae(()=>{if(!g.value)return"";const D=g.value.replace(/\/+$/,"").split("/");return D[D.length-1]||""}),T=ae(()=>k.value?`spec cat :: ${k.value}`:"spec cat");function $(){return r.conversations.filter(D=>[...D.messages].reverse().find(ce=>ce.role==="assistant")?.status==="streaming").map(D=>D.id)}Zx(()=>({title:T.value}));const R=()=>{typeof window<"u"&&e.updateViewport(window.innerWidth)};return He(h,D=>{D&&u.value&&e.setChatFullscreen(!1)}),He(()=>r.activeConversationId,(D,U)=>{h.value&&D&&D!==U&&(v.value="chat")}),kt(async()=>{typeof window<"u"&&(e.updateViewport(window.innerWidth),window.addEventListener("resize",R)),await i.hydrate(),await r.initialize(),await r.loadConversations();const D=$();await Promise.allSettled(D.map(U=>a(U))),await l();try{const U=await $fetch("/api/cwd");g.value=U.cwd}catch{g.value=""}}),si(()=>{typeof window<"u"&&window.removeEventListener("resize",R)}),(D,U)=>{const ce=dP;return y(),_("div",PX,[h.value?(y(),_("div",QX,[m("header",TX,[m("div",MX,[m("div",BX,[U[8]||(U[8]=m("img",{alt:"SpecCat",src:wm,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),m("div",AX,[U[7]||(U[7]=m("div",{class:"text-xs font-bold text-retro-cyan font-mono uppercase tracking-wider"},"SPECCAT",-1)),m("div",RX,I(k.value?`${k.value} / ${S.value}`:S.value),1)])]),m("div",EX,[m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:O(n)?"Switch to light theme":"Switch to dark theme",onClick:U[0]||(U[0]=(...he)=>O(o)&&O(o)(...he))},[O(n)?(y(),Se(O(cm),{key:0,class:"w-5 h-5"})):(y(),Se(O(hm),{key:1,class:"w-5 h-5"}))],8,DX),m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:"Settings",onClick:U[1]||(U[1]=he=>f.value=!0)},[oe(O(Ku),{class:"w-5 h-5"})])])])]),m("main",LX,[qe(m("section",IX,[oe(ce,{"working-directory":g.value,"is-active":v.value==="git"},null,8,["working-directory","is-active"])],512),[[xl,v.value==="git"]]),qe(m("section",NX,[oe(av)],512),[[xl,v.value==="features"]]),qe(m("section",zX,[oe(lv)],512),[[xl,v.value==="conversations"]]),qe(m("section",ZX,[oe(r0)],512),[[xl,v.value==="chat"]]),c.value?(y(),_("div",XX,[oe(s0,{file:O(s).diffViewerFile,"commit-hash":O(s).diffViewerCommitHash,content:O(s).diffViewerContent,loading:O(s).diffViewerLoading,onClose:U[2]||(U[2]=he=>O(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):se("",!0)]),m("nav",WX,[m("div",VX,[(y(),_($e,null,je(b,he=>m("button",{key:he.id,type:"button",class:Ee(["flex min-w-0 flex-col items-center justify-center gap-1 px-1 text-[11px] font-mono transition-colors",v.value===he.id?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-text hover:bg-retro-black"]),"aria-current":v.value===he.id?"page":void 0,onClick:W=>v.value=he.id},[(y(),Se(Ja(he.icon),{class:"h-5 w-5 flex-shrink-0"})),m("span",HX,I(he.label),1)],10,FX)),64))])])])):(y(),_("div",qX,[m("div",YX,[m("div",jX,[m("div",UX,[U[9]||(U[9]=m("img",{alt:"SpecCat",src:wm,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),U[10]||(U[10]=m("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),k.value?(y(),_("span",GX,"/ "+I(k.value),1)):se("",!0)]),m("div",KX,[m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:O(n)?"Switch to light theme":"Switch to dark theme",onClick:U[3]||(U[3]=(...he)=>O(o)&&O(o)(...he))},[O(n)?(y(),Se(O(cm),{key:0,class:"w-5 h-5"})):(y(),Se(O(hm),{key:1,class:"w-5 h-5"}))],8,JX),m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:U[4]||(U[4]=he=>f.value=!0)},[oe(O(Ku),{class:"w-5 h-5"})])])]),m("div",eW,[oe(ce,{"working-directory":g.value},null,8,["working-directory"])])]),m("div",tW,[d.value?se("",!0):(y(),_("div",iW,[oe(av)])),d.value?se("",!0):(y(),_("div",rW,[oe(lv)])),m("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:qi({flex:p.value})},[oe(r0)],4),c.value?(y(),_("div",sW,[oe(s0,{file:O(s).diffViewerFile,"commit-hash":O(s).diffViewerCommitHash,content:O(s).diffViewerContent,loading:O(s).diffViewerLoading,onClose:U[5]||(U[5]=he=>O(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):se("",!0)])])),f.value?(y(),Se(gX,{key:2,onClose:U[6]||(U[6]=he=>f.value=!1)})):se("",!0),oe(yX),oe(xX),n0(D.$slots,"default")])}}});export{bW as default};
|